MCPcopy
hub / github.com/alibaba/lowcode-engine / constructor

Method constructor

packages/workspace/src/resource.ts:85–100  ·  view source on GitHub ↗
(readonly resourceData: IPublicResourceData, readonly resourceType: IResourceType, readonly workspace: IWorkspace)

Source from the content-addressed store, hash-verified

83 }
84
85 constructor(readonly resourceData: IPublicResourceData, readonly resourceType: IResourceType, readonly workspace: IWorkspace) {
86 this.context = new BasicContext(workspace, `resource-${resourceData.resourceName || resourceType.name}`, IPublicEnumPluginRegisterLevel.Resource);
87 this.resourceTypeInstance = resourceType.resourceTypeModel(this.context.innerPlugins._getLowCodePluginContext({
88 pluginName: '',
89 }), this.options);
90 this.init();
91 if (this.resourceTypeInstance.editorViews) {
92 this.resourceTypeInstance.editorViews.forEach((d: any) => {
93 this.editorViewMap.set(d.viewName, d);
94 });
95 }
96 if (!resourceType) {
97 logger.error(`resourceType[${resourceType}] is unValid.`);
98 }
99 this.children = this.resourceData?.children?.map(d => new Resource(d, this.workspace.getResourceType(d.resourceName || this.resourceType.name), this.workspace)) || [];
100 }
101
102 async init() {
103 await this.resourceTypeInstance.init?.();

Callers

nothing calls this directly

Calls 7

initMethod · 0.95
forEachMethod · 0.65
setMethod · 0.65
errorMethod · 0.65
mapMethod · 0.65
getResourceTypeMethod · 0.65

Tested by

no test coverage detected