@cloudbase/cals 1.0.52-alpha.0 → 1.0.52-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,4 +1,34 @@
|
|
|
1
1
|
import { IPlatformApp, IDependencies } from '../../types';
|
|
2
|
+
interface IDependenceRequest {
|
|
3
|
+
capiRequest?: any;
|
|
4
|
+
lowcodeRequest?: any;
|
|
5
|
+
DescribeLatestCompositeGroupList?: (daata: {
|
|
6
|
+
WeAppId: string;
|
|
7
|
+
}) => Promise<{
|
|
8
|
+
Data: {
|
|
9
|
+
List: ICompositeGroupData[];
|
|
10
|
+
};
|
|
11
|
+
}>;
|
|
12
|
+
DescribeCompositeGroupList?: (data: {
|
|
13
|
+
WeAppId?: string;
|
|
14
|
+
GroupList?: {
|
|
15
|
+
Id: string;
|
|
16
|
+
GroupVersion: string;
|
|
17
|
+
}[];
|
|
18
|
+
}, opts?: any) => Promise<{
|
|
19
|
+
Data: {
|
|
20
|
+
List?: ICompositeGroupData[];
|
|
21
|
+
};
|
|
22
|
+
}>;
|
|
23
|
+
DescribeShareCompGroups?: (data: {
|
|
24
|
+
WeAppId: string;
|
|
25
|
+
}) => Promise<{
|
|
26
|
+
Data: {
|
|
27
|
+
List?: ICompositeGroupData[];
|
|
28
|
+
};
|
|
29
|
+
}>;
|
|
30
|
+
DescribeCompositeContent?: (data: any) => Promise<any>;
|
|
31
|
+
}
|
|
2
32
|
export declare class Dependencies {
|
|
3
33
|
#private;
|
|
4
34
|
constructor({ request, cals, compositeGroupId, compositeComponentId, }: {
|
|
@@ -8,10 +38,7 @@ export declare class Dependencies {
|
|
|
8
38
|
};
|
|
9
39
|
compositeGroupId?: string;
|
|
10
40
|
compositeComponentId?: string;
|
|
11
|
-
request?:
|
|
12
|
-
capiRequest?: any;
|
|
13
|
-
lowcodeRequest?: any;
|
|
14
|
-
};
|
|
41
|
+
request?: IDependenceRequest;
|
|
15
42
|
}, options?: {});
|
|
16
43
|
static diffDependencies(source: any, target: any, whiteList?: string[]): {
|
|
17
44
|
diff: {};
|
|
@@ -77,7 +104,7 @@ export declare class Dependencies {
|
|
|
77
104
|
};
|
|
78
105
|
}>;
|
|
79
106
|
get schema(): any[];
|
|
80
|
-
|
|
107
|
+
DescribeCompositeGroupList(data: {
|
|
81
108
|
WeAppId?: string;
|
|
82
109
|
GroupList?: {
|
|
83
110
|
Id: string;
|
|
@@ -88,14 +115,14 @@ export declare class Dependencies {
|
|
|
88
115
|
List?: ICompositeGroupData[];
|
|
89
116
|
};
|
|
90
117
|
}>;
|
|
91
|
-
|
|
92
|
-
WeAppId
|
|
118
|
+
DescribeShareCompGroups(data: {
|
|
119
|
+
WeAppId: string;
|
|
93
120
|
}): Promise<{
|
|
94
121
|
Data: {
|
|
95
122
|
List?: ICompositeGroupData[];
|
|
96
123
|
};
|
|
97
124
|
}>;
|
|
98
|
-
|
|
125
|
+
DescribeCompositeContent(data: any): Promise<any>;
|
|
99
126
|
}
|
|
100
127
|
interface ICompositeGroupData {
|
|
101
128
|
Id: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/parser/dependiencies/index.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAY1D,qBAAa,YAAY;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/parser/dependiencies/index.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAY1D,UAAU,kBAAkB;IAC1B,WAAW,CAAC,EAAE,GAAG,CAAC;IAClB,cAAc,CAAC,EAAE,GAAG,CAAC;IACrB,gCAAgC,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC;QAAE,IAAI,EAAE;YAAE,IAAI,EAAE,m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MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,gBAAgB,EAAE,MAAM,CAAC;IACzB,eAAe,EAAE,MAAM,CAAC;IACxB,gBAAgB,EAAE,MAAM,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB"}
|
|
@@ -19,7 +19,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
19
19
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
20
20
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
21
21
|
};
|
|
22
|
-
var _Dependencies_instances, _Dependencies_schema,
|
|
22
|
+
var _Dependencies_instances, _Dependencies_schema, _Dependencies_request, _Dependencies_cals, _Dependencies_compositeGroupId, _Dependencies_compositeComponentId, _Dependencies_options, _Dependencies_actualUsedDependencies, _Dependencies_resolveComposititeComponentData;
|
|
23
23
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
24
|
exports.Dependencies = void 0;
|
|
25
25
|
// import { CompositeGroupList, SharedCompositeGroupList } from './mock';
|
|
@@ -36,8 +36,7 @@ class Dependencies {
|
|
|
36
36
|
constructor({ request = {}, cals, compositeGroupId, compositeComponentId, }, options = {}) {
|
|
37
37
|
_Dependencies_instances.add(this);
|
|
38
38
|
_Dependencies_schema.set(this, []);
|
|
39
|
-
|
|
40
|
-
_Dependencies_lowcodeRequest.set(this, void 0);
|
|
39
|
+
_Dependencies_request.set(this, void 0);
|
|
41
40
|
_Dependencies_cals.set(this, void 0);
|
|
42
41
|
_Dependencies_compositeGroupId.set(this, void 0);
|
|
43
42
|
_Dependencies_compositeComponentId.set(this, void 0);
|
|
@@ -46,14 +45,8 @@ class Dependencies {
|
|
|
46
45
|
__classPrivateFieldSet(this, _Dependencies_cals, cals, "f");
|
|
47
46
|
__classPrivateFieldSet(this, _Dependencies_compositeGroupId, compositeGroupId, "f");
|
|
48
47
|
__classPrivateFieldSet(this, _Dependencies_compositeComponentId, compositeComponentId, "f");
|
|
48
|
+
__classPrivateFieldSet(this, _Dependencies_request, request || {}, "f");
|
|
49
49
|
__classPrivateFieldSet(this, _Dependencies_options, options, "f");
|
|
50
|
-
const { capiRequest, lowcodeRequest } = request;
|
|
51
|
-
if (capiRequest) {
|
|
52
|
-
__classPrivateFieldSet(this, _Dependencies_capiRequest, capiRequest, "f");
|
|
53
|
-
}
|
|
54
|
-
if (lowcodeRequest) {
|
|
55
|
-
__classPrivateFieldSet(this, _Dependencies_lowcodeRequest, lowcodeRequest, "f");
|
|
56
|
-
}
|
|
57
50
|
return this;
|
|
58
51
|
}
|
|
59
52
|
static diffDependencies(source, target, whiteList = []) {
|
|
@@ -188,7 +181,8 @@ class Dependencies {
|
|
|
188
181
|
return ((_b = (_a = __classPrivateFieldGet(this, _Dependencies_options, "f")).useLatestDependiencies) === null || _b === void 0 ? void 0 : _b.call(_a, latestCompositeGroupList)) || false;
|
|
189
182
|
}
|
|
190
183
|
onCalsDependenciesChange(dependencies) {
|
|
191
|
-
|
|
184
|
+
var _a, _b;
|
|
185
|
+
return (_b = (_a = __classPrivateFieldGet(this, _Dependencies_options, "f")).onCalsDependenciesChange) === null || _b === void 0 ? void 0 : _b.call(_a, dependencies);
|
|
192
186
|
}
|
|
193
187
|
/**
|
|
194
188
|
* 核心逻辑。获取组件物料,主要做了以下事情:
|
|
@@ -221,7 +215,7 @@ class Dependencies {
|
|
|
221
215
|
compositeGroupList.push(compositeGroup);
|
|
222
216
|
}
|
|
223
217
|
});
|
|
224
|
-
const { Data: { List: officialCompositeGroupMetaList = [] }, } = yield this.
|
|
218
|
+
const { Data: { List: officialCompositeGroupMetaList = [] }, } = yield this.DescribeCompositeGroupList({ GroupList: officialCompositeGroupMeta });
|
|
225
219
|
if (!__classPrivateFieldGet(this, _Dependencies_options, "f").autoUpgradeToLatestPatchVersion) {
|
|
226
220
|
compositeGroupList.push(...officialCompositeGroupMetaList);
|
|
227
221
|
}
|
|
@@ -242,7 +236,7 @@ class Dependencies {
|
|
|
242
236
|
}
|
|
243
237
|
});
|
|
244
238
|
if (patchGroupMeta.length) {
|
|
245
|
-
const { Data: { List: patchGroupList = [] }, } = yield this.
|
|
239
|
+
const { Data: { List: patchGroupList = [] }, } = yield this.DescribeCompositeGroupList({ GroupList: patchGroupMeta });
|
|
246
240
|
compositeGroupList.push(...patchGroupList);
|
|
247
241
|
}
|
|
248
242
|
}
|
|
@@ -281,8 +275,8 @@ class Dependencies {
|
|
|
281
275
|
DescribeLatestCompositeGroupList({ WeAppId }) {
|
|
282
276
|
return __awaiter(this, void 0, void 0, function* () {
|
|
283
277
|
const [{ Data: { List: compositeGroup = [] }, }, { Data: { List: sharedCompositeGroup = [] }, },] = yield Promise.all([
|
|
284
|
-
this.
|
|
285
|
-
this.
|
|
278
|
+
this.DescribeCompositeGroupList({ WeAppId }),
|
|
279
|
+
this.DescribeShareCompGroups({ WeAppId }).catch((e) => {
|
|
286
280
|
return {
|
|
287
281
|
Data: { Count: 0, List: [] },
|
|
288
282
|
};
|
|
@@ -303,25 +297,36 @@ class Dependencies {
|
|
|
303
297
|
get schema() {
|
|
304
298
|
return __classPrivateFieldGet(this, _Dependencies_schema, "f");
|
|
305
299
|
}
|
|
306
|
-
|
|
300
|
+
DescribeCompositeGroupList(data, opts = undefined) {
|
|
301
|
+
var _a;
|
|
307
302
|
return __awaiter(this, void 0, void 0, function* () {
|
|
308
|
-
|
|
303
|
+
if ((_a = __classPrivateFieldGet(this, _Dependencies_request, "f")) === null || _a === void 0 ? void 0 : _a.DescribeCompositeGroupList) {
|
|
304
|
+
return __classPrivateFieldGet(this, _Dependencies_request, "f").DescribeCompositeGroupList(data, opts);
|
|
305
|
+
}
|
|
306
|
+
throw new Error('need to impl DescribeCompositeGroupList');
|
|
309
307
|
});
|
|
310
308
|
}
|
|
311
|
-
|
|
309
|
+
DescribeShareCompGroups(data) {
|
|
310
|
+
var _a;
|
|
312
311
|
return __awaiter(this, void 0, void 0, function* () {
|
|
313
|
-
|
|
314
|
-
|
|
312
|
+
if ((_a = __classPrivateFieldGet(this, _Dependencies_request, "f")) === null || _a === void 0 ? void 0 : _a.DescribeShareCompGroups) {
|
|
313
|
+
return __classPrivateFieldGet(this, _Dependencies_request, "f").DescribeShareCompGroups(data);
|
|
314
|
+
}
|
|
315
|
+
throw new Error('need to impl DescribeShareCompGroups');
|
|
315
316
|
});
|
|
316
317
|
}
|
|
317
|
-
|
|
318
|
+
DescribeCompositeContent(data) {
|
|
319
|
+
var _a;
|
|
318
320
|
return __awaiter(this, void 0, void 0, function* () {
|
|
319
|
-
|
|
321
|
+
if ((_a = __classPrivateFieldGet(this, _Dependencies_request, "f")) === null || _a === void 0 ? void 0 : _a.DescribeCompositeContent) {
|
|
322
|
+
return __classPrivateFieldGet(this, _Dependencies_request, "f").DescribeCompositeContent(data);
|
|
323
|
+
}
|
|
324
|
+
throw new Error('need to impl DescribeCompositeContent');
|
|
320
325
|
});
|
|
321
326
|
}
|
|
322
327
|
}
|
|
323
328
|
exports.Dependencies = Dependencies;
|
|
324
|
-
_Dependencies_schema = new WeakMap(),
|
|
329
|
+
_Dependencies_schema = new WeakMap(), _Dependencies_request = new WeakMap(), _Dependencies_cals = new WeakMap(), _Dependencies_compositeGroupId = new WeakMap(), _Dependencies_compositeComponentId = new WeakMap(), _Dependencies_options = new WeakMap(), _Dependencies_actualUsedDependencies = new WeakMap(), _Dependencies_instances = new WeakSet(), _Dependencies_resolveComposititeComponentData = function _Dependencies_resolveComposititeComponentData(appId, componentGroups, options) {
|
|
325
330
|
return __awaiter(this, void 0, void 0, function* () {
|
|
326
331
|
const { compositeGroupId } = options || {};
|
|
327
332
|
const compData = [];
|
|
@@ -347,7 +352,7 @@ _Dependencies_schema = new WeakMap(), _Dependencies_capiRequest = new WeakMap(),
|
|
|
347
352
|
const dev = groupName === utils_1.OFFICIAL_COMPONENT_LIB_NAME ? false : compositeGroupId === obj.id;
|
|
348
353
|
let data;
|
|
349
354
|
try {
|
|
350
|
-
data = yield this.
|
|
355
|
+
data = yield this.DescribeCompositeContent({
|
|
351
356
|
CompositeGroupId: obj.id,
|
|
352
357
|
WeAppId: appId,
|
|
353
358
|
Version: version,
|