@milaboratories/pl-middle-layer 1.22.5 → 1.23.0
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.
- package/dist/index.js +9 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1369 -1238
- package/dist/index.mjs.map +1 -1
- package/dist/js_render/context.d.ts +1 -1
- package/dist/js_render/context.d.ts.map +1 -1
- package/dist/mutator/template/direct_template_loader.d.ts +4 -0
- package/dist/mutator/template/direct_template_loader.d.ts.map +1 -0
- package/dist/mutator/template/template_loading.d.ts.map +1 -1
- package/dist/pool/data.d.ts +3 -1
- package/dist/pool/data.d.ts.map +1 -1
- package/dist/pool/p_object_collection.d.ts +1 -1
- package/dist/pool/p_object_collection.d.ts.map +1 -1
- package/package.json +11 -9
- package/src/js_render/context.ts +6 -4
- package/src/mutator/template/direct_template_loader.ts +177 -0
- package/src/mutator/template/template_loading.ts +9 -6
- package/src/pool/data.ts +11 -3
- package/src/pool/driver.ts +51 -10
- package/src/pool/p_object_collection.ts +12 -9
- package/src/pool/result_pool.ts +3 -3
|
@@ -36,7 +36,7 @@ export declare class JsExecutionContext implements JsRenderInternal.GlobalCfgRen
|
|
|
36
36
|
getKeyValueAsString(handle: string, key: string): string | undefined;
|
|
37
37
|
getDataBase64(handle: string): string | undefined;
|
|
38
38
|
getDataAsString(handle: string): string | undefined;
|
|
39
|
-
parsePObjectCollection(handle: string, errorOnUnknownField: boolean, prefix: string): Record<string, PObject<string>> | undefined;
|
|
39
|
+
parsePObjectCollection(handle: string, errorOnUnknownField: boolean, prefix: string, ...resolveSteps: string[]): Record<string, PObject<string>> | undefined;
|
|
40
40
|
private registerComputable;
|
|
41
41
|
getBlobContentAsString(handle: string): string;
|
|
42
42
|
getBlobContentAsBase64(handle: string): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/js_render/context.ts"],"names":[],"mappings":"AAAA,OAAO,EA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;IAO9D,0BAA0B,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS;IAIxF,0BAA0B,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,GAAG,SAAS;IAUrF,YAAY,CAAC,GAAG,EAAE,SAAS,CAAC,MAAM,GAAG,aAAa,CAAC,GAAG,YAAY;IAalE,YAAY,CAAC,GAAG,EAAE,SAAS,CAAC,OAAO,CAAC,MAAM,GAAG,aAAa,CAAC,CAAC,GAAG,YAAY;IAiB3E,wBAAwB,IAAI,MAAM,GAAG,SAAS;IAQrD,OAAO,CAAC,WAAW;IAMnB,OAAO,CAAC,YAAY;IAepB,OAAO,CAAC,iBAAiB;IASzB,OAAO,CAAC,oBAAoB;IAiCrB,qBAAqB,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,GAAG,SAAS,GAAG,aAAa;IAM5E,mBAAmB,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,GAAG,SAAS,GAAG,aAAa;IAS1E,qBAAqB,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO;IAarD,mBAAmB,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO;IAU1D,OAAO,CAAC,SAAS;CAmRlB"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { AnyRef, PlTransaction } from '@milaboratories/pl-client';
|
|
2
|
+
import { ExplicitTemplate } from '../../model/template_spec';
|
|
3
|
+
export declare function loadTemplateFromExplicitDirect(tx: PlTransaction, spec: ExplicitTemplate): AnyRef;
|
|
4
|
+
//# sourceMappingURL=direct_template_loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"direct_template_loader.d.ts","sourceRoot":"","sources":["../../../src/mutator/template/direct_template_loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAkB,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAEvF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAMlE,wBAAgB,8BAA8B,CAAC,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,gBAAgB,GAAG,MAAM,CAUhG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"template_loading.d.ts","sourceRoot":"","sources":["../../../src/mutator/template/template_loading.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"template_loading.d.ts","sourceRoot":"","sources":["../../../src/mutator/template/template_loading.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAGrF,OAAO,KAAK,EAGV,eAAe,EACf,oBAAoB,EACrB,MAAM,2BAA2B,CAAC;AAQnC,eAAO,MAAM,gBAAgB,EAAE,YAAyD,CAAC;AACzF,eAAO,MAAM,wBAAwB,aAAa,CAAC;AACnD,eAAO,MAAM,2BAA2B,gBAAgB,CAAC;AACzD,eAAO,MAAM,wBAAwB,aAAa,CAAC;AAEnD,eAAO,MAAM,iBAAiB,EAAE,YAA0D,CAAC;AAC3F,eAAO,MAAM,wBAAwB,EAAE,YAGtC,CAAC;AACF,eAAO,MAAM,oCAAoC,iBAAiB,CAAC;AACnE,eAAO,MAAM,gCAAgC,aAAa,CAAC;AAE3D,wBAAsB,mBAAmB,CAAC,GAAG,EAAE,eAAe,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAa7F;AA2BD,wBAAgB,YAAY,CAAC,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,oBAAoB,GAAG,MAAM,CAUlF"}
|
package/dist/pool/data.d.ts
CHANGED
|
@@ -22,5 +22,7 @@ export type PColumnDataSuperPartitionedResourceValue = {
|
|
|
22
22
|
};
|
|
23
23
|
export declare function parseDataInfoResource(data: PlTreeNodeAccessor): PFrameInternal.DataInfo<ResourceInfo>;
|
|
24
24
|
export declare function makeDataInfoResource(spec: PColumnSpec, data: PColumnValues): PFrameInternal.DataInfo<ResourceInfo>;
|
|
25
|
-
export declare function
|
|
25
|
+
export declare function deriveLegacyPObjectId(spec: PObjectSpec, data: PlTreeNodeAccessor): PObjectId;
|
|
26
|
+
export declare function deriveGlobalPObjectId(blockId: string, exportName: string): PObjectId;
|
|
27
|
+
export declare function deriveLocalPObjectId(resolvePath: string[], outputName: string): PObjectId;
|
|
26
28
|
//# sourceMappingURL=data.d.ts.map
|
package/dist/pool/data.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../src/pool/data.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../src/pool/data.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,aAAa,EAAS,SAAS,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACjG,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAY3E,wBAAiB,QAAQ,CAAC,CAAC,EAAE,IAAI,EAAE,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAgB3E;AAWD,wBAAgB,QAAQ,CAAC,EAAE,EAAE,EAAE,EAC7B,IAAI,EAAE,cAAc,CAAC,QAAQ,CAAC,EAAE,CAAC,EACjC,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,GACxB,cAAc,CAAC,QAAQ,CAAC,EAAE,CAAC,CAiB7B;AAED,eAAO,MAAM,0BAA0B,kDAAmD,CAAC;AAC3F,eAAO,MAAM,+BAA+B,kDAG3C,CAAC;AACF,eAAO,MAAM,4BAA4B,kDAAqD,CAAC;AAC/F,eAAO,MAAM,iCAAiC,kDAG7C,CAAC;AACF,eAAO,MAAM,eAAe,kDAAwC,CAAC;AAErE,MAAM,MAAM,4BAA4B,GAAG;IACzC,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,aAAa,CAAC,CAAC;CACpD,CAAC;AAEF,MAAM,MAAM,mCAAmC,GAAG;IAChD,kBAAkB,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,wCAAwC,GAAG;IACrD,uBAAuB,EAAE,MAAM,CAAC;IAChC,kBAAkB,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,kBAAkB,GACvB,cAAc,CAAC,QAAQ,CAAC,YAAY,CAAC,CA4IvC;AAED,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,WAAW,EACjB,IAAI,EAAE,aAAa,GAClB,cAAc,CAAC,QAAQ,CAAC,YAAY,CAAC,CAcvC;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,kBAAkB,GAAG,SAAS,CAK5F;AAED,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,SAAS,CAEpF;AAED,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,MAAM,EAAE,EAAE,UAAU,EAAE,MAAM,GAAG,SAAS,CAEzF"}
|
|
@@ -25,5 +25,5 @@ export interface RawPObjectEntry {
|
|
|
25
25
|
data?(): ValueOrError<PlTreeNodeAccessor, string> | undefined;
|
|
26
26
|
}
|
|
27
27
|
export declare function parseRawPObjectCollection(node: PlTreeNodeAccessor, errorOnUnknownField?: boolean, ignoreFieldErrors?: boolean, prefix?: string): RawPObjectCollection;
|
|
28
|
-
export declare function parseFinalPObjectCollection(node: PlTreeNodeAccessor, errorOnUnknownField
|
|
28
|
+
export declare function parseFinalPObjectCollection(node: PlTreeNodeAccessor, errorOnUnknownField: boolean | undefined, prefix: string | undefined, resolvePath: string[]): Record<string, PObject<PlTreeNodeAccessor>>;
|
|
29
29
|
//# sourceMappingURL=p_object_collection.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"p_object_collection.d.ts","sourceRoot":"","sources":["../../src/pool/p_object_collection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"p_object_collection.d.ts","sourceRoot":"","sources":["../../src/pool/p_object_collection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,EAAE,OAAO,EAAa,WAAW,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAMrF,mDAAmD;AACnD,MAAM,WAAW,oBAAoB;IACnC,0CAA0C;IAC1C,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,sBAAsB;IACtB,QAAQ,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;CAChD;AAED,wCAAwC;AACxC,MAAM,WAAW,eAAe;IAC9B;;;;SAIK;IACL,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAE3B,sEAAsE;IACtE,QAAQ,CAAC,IAAI,CAAC,EAAE,WAAW,CAAC;IAE5B;;;;SAIK;IACL,IAAI,CAAC,IAAI,YAAY,CAAC,kBAAkB,EAAE,MAAM,CAAC,GAAG,SAAS,CAAC;CAC/D;AAMD,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,kBAAkB,EACxB,mBAAmB,GAAE,OAAc,EACnC,iBAAiB,GAAE,OAAe,EAClC,MAAM,GAAE,MAAW,GAClB,oBAAoB,CAoDtB;AAED,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,kBAAkB,EACxB,mBAAmB,EAAE,OAAO,YAAO,EACnC,MAAM,EAAE,MAAM,YAAK,EACnB,WAAW,EAAE,MAAM,EAAE,GACpB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAqB7C"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@milaboratories/pl-middle-layer",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.23.0",
|
|
4
4
|
"description": "Pl Middle Layer",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -28,20 +28,21 @@
|
|
|
28
28
|
"utility-types": "^3.11.0",
|
|
29
29
|
"yaml": "^2.6.1",
|
|
30
30
|
"zod": "~3.23.8",
|
|
31
|
-
"@milaboratories/pl-http": "^1.0.2",
|
|
32
|
-
"@milaboratories/resolve-helper": "^1.0.2",
|
|
33
31
|
"@milaboratories/computable": "^2.3.4",
|
|
32
|
+
"@milaboratories/resolve-helper": "^1.0.2",
|
|
33
|
+
"@milaboratories/pl-drivers": "^1.5.5",
|
|
34
34
|
"@platforma-sdk/block-tools": "^2.5.0",
|
|
35
|
+
"@milaboratories/pl-http": "^1.0.2",
|
|
36
|
+
"@milaboratories/pl-model-common": "^1.10.1",
|
|
35
37
|
"@milaboratories/pl-client": "^2.7.1",
|
|
36
|
-
"@milaboratories/pl-
|
|
37
|
-
"@milaboratories/pl-tree": "^1.4.20",
|
|
38
|
+
"@milaboratories/pl-model-backend": "^1.0.1",
|
|
38
39
|
"@milaboratories/pl-model-middle-layer": "^1.6.8",
|
|
39
|
-
"@
|
|
40
|
-
"@
|
|
40
|
+
"@milaboratories/pl-tree": "^1.4.20",
|
|
41
|
+
"@platforma-sdk/model": "^1.20.24",
|
|
41
42
|
"@milaboratories/ts-helpers": "^1.1.3",
|
|
43
|
+
"@milaboratories/pl-local": "^1.9.1",
|
|
42
44
|
"@platforma-sdk/workflow-tengo": "2.8.5",
|
|
43
|
-
"@milaboratories/pl-config": "^1.3.3"
|
|
44
|
-
"@milaboratories/pl-local": "^1.9.1"
|
|
45
|
+
"@milaboratories/pl-config": "^1.3.3"
|
|
45
46
|
},
|
|
46
47
|
"devDependencies": {
|
|
47
48
|
"semver": "^7.6.3",
|
|
@@ -53,6 +54,7 @@
|
|
|
53
54
|
"jest": "^29.7.0",
|
|
54
55
|
"@jest/globals": "^29.7.0",
|
|
55
56
|
"ts-jest": "^29.2.5",
|
|
57
|
+
"@milaboratories/eslint-config": "^1.0.1",
|
|
56
58
|
"@milaboratories/platforma-build-configs": "1.0.2"
|
|
57
59
|
},
|
|
58
60
|
"scripts": {
|
package/src/js_render/context.ts
CHANGED
|
@@ -215,11 +215,12 @@ export class JsExecutionContext
|
|
|
215
215
|
parsePObjectCollection(
|
|
216
216
|
handle: string,
|
|
217
217
|
errorOnUnknownField: boolean,
|
|
218
|
-
prefix: string
|
|
218
|
+
prefix: string,
|
|
219
|
+
...resolveSteps: string[]
|
|
219
220
|
): Record<string, PObject<string>> | undefined {
|
|
220
221
|
const acc = this.getAccessor(handle);
|
|
221
222
|
if (!acc.getIsReadyOrError()) return undefined;
|
|
222
|
-
const accResult = parseFinalPObjectCollection(acc, errorOnUnknownField, prefix);
|
|
223
|
+
const accResult = parseFinalPObjectCollection(acc, errorOnUnknownField, prefix, resolveSteps);
|
|
223
224
|
const result: Record<string, PObject<string>> = {};
|
|
224
225
|
for (const [key, obj] of Object.entries(accResult)) {
|
|
225
226
|
result[key] = mapPObjectData(obj, (d) => this.wrapAccessor(d));
|
|
@@ -666,12 +667,13 @@ export class JsExecutionContext
|
|
|
666
667
|
// Accessor helpers
|
|
667
668
|
//
|
|
668
669
|
|
|
669
|
-
exportCtxFunction('parsePObjectCollection', (handle, errorOnUnknownField, prefix) => {
|
|
670
|
+
exportCtxFunction('parsePObjectCollection', (handle, errorOnUnknownField, prefix, ...resolveSteps) => {
|
|
670
671
|
return this.exportObjectUniversal(
|
|
671
672
|
this.parsePObjectCollection(
|
|
672
673
|
this.vm.getString(handle),
|
|
673
674
|
this.vm.dump(errorOnUnknownField) as boolean,
|
|
674
|
-
this.vm.getString(prefix)
|
|
675
|
+
this.vm.getString(prefix),
|
|
676
|
+
...resolveSteps.map(this.vm.getString),
|
|
675
677
|
),
|
|
676
678
|
undefined
|
|
677
679
|
);
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import type { AnyRef, AnyResourceRef, PlTransaction } from '@milaboratories/pl-client';
|
|
2
|
+
import { assertNever } from '@milaboratories/ts-helpers';
|
|
3
|
+
import type { ExplicitTemplate } from '../../model/template_spec';
|
|
4
|
+
import type { Hash } from 'node:crypto';
|
|
5
|
+
import { createHash } from 'node:crypto';
|
|
6
|
+
import type { TemplateData, TemplateLibData, TemplateSoftwareData } from '@milaboratories/pl-model-backend';
|
|
7
|
+
import { PlTemplateLibV1, PlTemplateSoftwareV1, PlTemplateV1, PlTemplateOverrideV1, parseTemplate } from '@milaboratories/pl-model-backend';
|
|
8
|
+
|
|
9
|
+
export function loadTemplateFromExplicitDirect(tx: PlTransaction, spec: ExplicitTemplate): AnyRef {
|
|
10
|
+
const templateInfo: TemplateData = parseTemplate(spec.content);
|
|
11
|
+
|
|
12
|
+
const templateFormat = templateInfo.type;
|
|
13
|
+
switch (templateFormat) {
|
|
14
|
+
case 'pl.tengo-template.v2':
|
|
15
|
+
return createTemplateV2Tree(tx, templateInfo);
|
|
16
|
+
default:
|
|
17
|
+
assertNever(templateFormat);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
type Renderer<T> = {
|
|
22
|
+
hash: Hasher<T>;
|
|
23
|
+
render: (resource: T, tx: PlTransaction, creator: Creator<T>) => AnyResourceRef;
|
|
24
|
+
};
|
|
25
|
+
type Hasher<T> = (resource: T, hash: Hash) => void;
|
|
26
|
+
type Creator<T> = (resource: T, renderer: Renderer<T>) => AnyResourceRef;
|
|
27
|
+
|
|
28
|
+
const LibRenderer: Renderer<TemplateLibData> = {
|
|
29
|
+
hash(resource, hash) {
|
|
30
|
+
hash
|
|
31
|
+
.update(PlTemplateLibV1.type.name)
|
|
32
|
+
.update(PlTemplateLibV1.type.version)
|
|
33
|
+
.update(resource.name)
|
|
34
|
+
.update(resource.version)
|
|
35
|
+
.update(resource.src);
|
|
36
|
+
},
|
|
37
|
+
render(resource, tx, _creator) {
|
|
38
|
+
return tx.createValue(
|
|
39
|
+
PlTemplateLibV1.type,
|
|
40
|
+
JSON.stringify(PlTemplateLibV1.fromV2Data(resource).data),
|
|
41
|
+
);
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const SoftwareInfoRenderer: Renderer<TemplateSoftwareData> = {
|
|
46
|
+
hash(resource, hash) {
|
|
47
|
+
hash
|
|
48
|
+
.update(PlTemplateSoftwareV1.type.name)
|
|
49
|
+
.update(PlTemplateSoftwareV1.type.version)
|
|
50
|
+
.update(resource.name)
|
|
51
|
+
.update(resource.version)
|
|
52
|
+
.update(resource.src);
|
|
53
|
+
},
|
|
54
|
+
render(resource, tx, _creator) {
|
|
55
|
+
const sw = PlTemplateSoftwareV1.fromV2Data(resource);
|
|
56
|
+
const ref = tx.createStruct(PlTemplateSoftwareV1.type, sw.data);
|
|
57
|
+
tx.setKValue(ref, PlTemplateSoftwareV1.metaNameKey, JSON.stringify(sw.name));
|
|
58
|
+
tx.lock(ref);
|
|
59
|
+
return ref;
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const TemplateRenderer: Renderer<TemplateData> = {
|
|
64
|
+
hash(resource, hash) {
|
|
65
|
+
hash
|
|
66
|
+
.update(PlTemplateV1.type.name)
|
|
67
|
+
.update(PlTemplateV1.type.version)
|
|
68
|
+
.update(resource.hashOverride ?? '')
|
|
69
|
+
.update(resource.name)
|
|
70
|
+
.update(resource.version)
|
|
71
|
+
.update(resource.src);
|
|
72
|
+
|
|
73
|
+
const srt = <T>(entries: [string, T][]) : [string, T][] => {
|
|
74
|
+
entries.sort((a, b) => a[0] === b[0] ? 0 : a[0] < b[0] ? -1 : 1);
|
|
75
|
+
return entries;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
for (const [libId, lib] of srt(Object.entries(resource.libs ?? {}))) {
|
|
79
|
+
hash.update('lib:' + libId);
|
|
80
|
+
LibRenderer.hash(lib, hash);
|
|
81
|
+
}
|
|
82
|
+
for (const [swId, sw] of srt(Object.entries(resource.software ?? {}))) {
|
|
83
|
+
hash.update('soft:' + swId);
|
|
84
|
+
SoftwareInfoRenderer.hash(sw, hash);
|
|
85
|
+
}
|
|
86
|
+
for (const [swId, sw] of srt(Object.entries(resource.assets ?? {}))) {
|
|
87
|
+
hash.update('asset:' + swId);
|
|
88
|
+
SoftwareInfoRenderer.hash(sw, hash);
|
|
89
|
+
}
|
|
90
|
+
for (const [tplId, tpl] of srt(Object.entries(resource.templates ?? {}))) {
|
|
91
|
+
hash.update('tpl:' + tplId);
|
|
92
|
+
this.hash(tpl, hash);
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
render(resource, tx, _creator) {
|
|
96
|
+
return tx.createStruct(
|
|
97
|
+
PlTemplateV1.type,
|
|
98
|
+
JSON.stringify(PlTemplateV1.fromV2Data(resource).data),
|
|
99
|
+
);
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
const HashOverrideRenderer: Renderer<TemplateData> = {
|
|
104
|
+
hash(resource, hash) {
|
|
105
|
+
hash
|
|
106
|
+
.update(PlTemplateOverrideV1.type.name)
|
|
107
|
+
.update(PlTemplateOverrideV1.type.version)
|
|
108
|
+
.update(resource.hashOverride ?? '');
|
|
109
|
+
},
|
|
110
|
+
render(resource, tx, _creator) {
|
|
111
|
+
return tx.createStruct(
|
|
112
|
+
PlTemplateOverrideV1.type,
|
|
113
|
+
JSON.stringify(PlTemplateOverrideV1.fromV2Data(resource)),
|
|
114
|
+
);
|
|
115
|
+
},
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
function createTemplateV2Tree(tx: PlTransaction, tplInfo: TemplateData, resourceCache?: Map<string, AnyResourceRef>): AnyRef {
|
|
119
|
+
if (!resourceCache) {
|
|
120
|
+
resourceCache = new Map<string, AnyResourceRef>();
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
const createResource = <T>(resource: T, renderer: Renderer<T>): AnyResourceRef => {
|
|
124
|
+
const hasher: Hash = createHash('sha256');
|
|
125
|
+
renderer.hash(resource, hasher);
|
|
126
|
+
|
|
127
|
+
const rKey = hasher.digest('hex');
|
|
128
|
+
if (!resourceCache.has(rKey)) {
|
|
129
|
+
const rId = renderer.render(resource, tx, createResource);
|
|
130
|
+
resourceCache.set(rKey, rId);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
return resourceCache.get(rKey)!;
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
const tplRef = createResource(tplInfo, TemplateRenderer);
|
|
137
|
+
|
|
138
|
+
// Render libraries
|
|
139
|
+
for (const [libId, lib] of Object.entries(tplInfo.libs ?? {})) {
|
|
140
|
+
const fld = PlTemplateV1.libField(tplRef, libId);
|
|
141
|
+
tx.createField(fld, 'Input');
|
|
142
|
+
tx.setField(fld, createResource(lib, LibRenderer));
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// Render software and assets
|
|
146
|
+
for (const [swId, sw] of Object.entries(tplInfo.software ?? {})) {
|
|
147
|
+
const fld = PlTemplateV1.swField(tplRef, swId);
|
|
148
|
+
tx.createField(fld, 'Input');
|
|
149
|
+
tx.setField(fld, createResource(sw, SoftwareInfoRenderer));
|
|
150
|
+
}
|
|
151
|
+
for (const [swId, sw] of Object.entries(tplInfo.assets ?? {})) {
|
|
152
|
+
const fld = PlTemplateV1.swField(tplRef, swId);
|
|
153
|
+
tx.createField(fld, 'Input');
|
|
154
|
+
tx.setField(fld, createResource(sw, SoftwareInfoRenderer));
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// Render dependency templates
|
|
158
|
+
for (const [depTplId, depTpl] of Object.entries(tplInfo.templates ?? {})) {
|
|
159
|
+
const fld = PlTemplateV1.tplField(tplRef, depTplId);
|
|
160
|
+
tx.createField(fld, 'Input');
|
|
161
|
+
tx.setField(fld, createTemplateV2Tree(tx, depTpl, resourceCache));
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
tx.lock(tplRef);
|
|
165
|
+
|
|
166
|
+
if (!tplInfo.hashOverride) {
|
|
167
|
+
return tplRef;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// Override template hash with proxy resource, when hash override is configured for template
|
|
171
|
+
const overrideRef = createResource(tplInfo, HashOverrideRenderer);
|
|
172
|
+
const fld = PlTemplateOverrideV1.tplField(overrideRef);
|
|
173
|
+
tx.createField(fld, 'Service');
|
|
174
|
+
tx.setField(fld, tplRef);
|
|
175
|
+
tx.lock(tplRef);
|
|
176
|
+
return overrideRef;
|
|
177
|
+
}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { AnyRef,
|
|
1
|
+
import type { AnyRef, PlTransaction, ResourceType } from '@milaboratories/pl-client';
|
|
2
|
+
import { field, Pl } from '@milaboratories/pl-client';
|
|
2
3
|
import fs from 'node:fs';
|
|
3
|
-
import {
|
|
4
|
+
import type {
|
|
4
5
|
ExplicitTemplate,
|
|
5
6
|
TemplateFromRegistry,
|
|
6
7
|
TemplateSpecAny,
|
|
7
|
-
TemplateSpecPrepared
|
|
8
|
+
TemplateSpecPrepared,
|
|
8
9
|
} from '../../model/template_spec';
|
|
9
10
|
import { assertNever } from '@milaboratories/ts-helpers';
|
|
11
|
+
import { loadTemplateFromExplicitDirect } from './direct_template_loader';
|
|
10
12
|
|
|
11
13
|
//
|
|
12
14
|
// Resource schema
|
|
@@ -20,7 +22,7 @@ export const TengoTemplateGetTemplate = 'template';
|
|
|
20
22
|
export const TengoTemplatePack: ResourceType = { name: 'TengoTemplatePack', version: '1' };
|
|
21
23
|
export const TengoTemplatePackConvert: ResourceType = {
|
|
22
24
|
name: 'TengoTemplatePackConvert',
|
|
23
|
-
version: '1'
|
|
25
|
+
version: '1',
|
|
24
26
|
};
|
|
25
27
|
export const TengoTemplatePackConvertTemplatePack = 'templatePack';
|
|
26
28
|
export const TengoTemplatePackConvertTemplate = 'template';
|
|
@@ -30,7 +32,7 @@ export async function prepareTemplateSpec(tpl: TemplateSpecAny): Promise<Templat
|
|
|
30
32
|
case 'from-file':
|
|
31
33
|
return {
|
|
32
34
|
type: 'explicit',
|
|
33
|
-
content: await fs.promises.readFile(tpl.path)
|
|
35
|
+
content: await fs.promises.readFile(tpl.path),
|
|
34
36
|
};
|
|
35
37
|
case 'from-registry':
|
|
36
38
|
case 'explicit':
|
|
@@ -70,7 +72,8 @@ export function loadTemplate(tx: PlTransaction, spec: TemplateSpecPrepared): Any
|
|
|
70
72
|
case 'from-registry':
|
|
71
73
|
return loadTemplateFromRegistry(tx, spec);
|
|
72
74
|
case 'explicit':
|
|
73
|
-
return
|
|
75
|
+
return loadTemplateFromExplicitDirect(tx, spec);
|
|
76
|
+
// return loadTemplateFromExplicit(tx, spec);
|
|
74
77
|
default:
|
|
75
78
|
return assertNever(spec);
|
|
76
79
|
}
|
package/src/pool/data.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { PColumnSpec, PColumnValues, PObjectId, PObjectSpec } from '@platforma-sdk/model';
|
|
1
|
+
import { PColumnSpec, PColumnValues, PlRef, PObjectId, PObjectSpec } from '@platforma-sdk/model';
|
|
2
2
|
import { PFrameInternal } from '@milaboratories/pl-model-middle-layer';
|
|
3
3
|
import { PlTreeNodeAccessor, ResourceInfo } from '@milaboratories/pl-tree';
|
|
4
4
|
import { assertNever } from '@milaboratories/ts-helpers';
|
|
5
|
-
import { createHash } from 'crypto';
|
|
6
5
|
import canonicalize from 'canonicalize';
|
|
7
6
|
import {
|
|
8
7
|
isNullResourceId,
|
|
@@ -11,6 +10,7 @@ import {
|
|
|
11
10
|
resourceTypesEqual
|
|
12
11
|
} from '@milaboratories/pl-client';
|
|
13
12
|
import { Writable } from 'utility-types';
|
|
13
|
+
import { createHash } from 'crypto';
|
|
14
14
|
|
|
15
15
|
export function* allBlobs<B>(data: PFrameInternal.DataInfo<B>): Generator<B> {
|
|
16
16
|
switch (data.type) {
|
|
@@ -250,9 +250,17 @@ export function makeDataInfoResource(
|
|
|
250
250
|
};
|
|
251
251
|
}
|
|
252
252
|
|
|
253
|
-
export function
|
|
253
|
+
export function deriveLegacyPObjectId(spec: PObjectSpec, data: PlTreeNodeAccessor): PObjectId {
|
|
254
254
|
const hash = createHash('sha256');
|
|
255
255
|
hash.update(canonicalize(spec)!);
|
|
256
256
|
hash.update(String(!isNullResourceId(data.originalId) ? data.originalId : data.id));
|
|
257
257
|
return hash.digest().toString('hex') as PObjectId;
|
|
258
258
|
}
|
|
259
|
+
|
|
260
|
+
export function deriveGlobalPObjectId(blockId: string, exportName: string): PObjectId {
|
|
261
|
+
return canonicalize({ __isRef: true, blockId, name: exportName } satisfies PlRef)! as PObjectId;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
export function deriveLocalPObjectId(resolvePath: string[], outputName: string): PObjectId {
|
|
265
|
+
return canonicalize({ resolvePath, name: outputName })! as PObjectId
|
|
266
|
+
}
|
package/src/pool/driver.ts
CHANGED
|
@@ -364,20 +364,61 @@ function joinEntryToInternal(entry: JoinEntry<PObjectId>): PFrameInternal.JoinEn
|
|
|
364
364
|
|
|
365
365
|
function stableKeyFromFullPTableDef(data: FullPTableDef): string {
|
|
366
366
|
const hash = createHash('sha256');
|
|
367
|
-
hash.update(data.pFrameHandle);
|
|
368
367
|
hash.update(canonicalize(data.def)!);
|
|
369
368
|
return hash.digest().toString('hex');
|
|
370
369
|
}
|
|
371
370
|
|
|
372
|
-
function stableKeyFromPFrameData(data: PColumn<
|
|
373
|
-
|
|
374
|
-
|
|
371
|
+
function stableKeyFromPFrameData(data: PColumn<PFrameInternal.DataInfo<ResourceInfo>>[]): string {
|
|
372
|
+
const orderedData = [...data].map((column) => mapPObjectData(column, (r) => {
|
|
373
|
+
let result: {
|
|
374
|
+
type: string,
|
|
375
|
+
keyLength: number,
|
|
376
|
+
payload: {
|
|
377
|
+
key: string;
|
|
378
|
+
value: null | number | string | [string, string]
|
|
379
|
+
}[];
|
|
380
|
+
};
|
|
381
|
+
const type = r.type;
|
|
382
|
+
switch (type) {
|
|
383
|
+
case 'Json':
|
|
384
|
+
result = {
|
|
385
|
+
type: r.type,
|
|
386
|
+
keyLength: r.keyLength,
|
|
387
|
+
payload: Object.entries(r.data).map(([part, value]) => ({
|
|
388
|
+
key: part,
|
|
389
|
+
value,
|
|
390
|
+
}))
|
|
391
|
+
};
|
|
392
|
+
break;
|
|
393
|
+
case 'JsonPartitioned':
|
|
394
|
+
result = {
|
|
395
|
+
type: r.type,
|
|
396
|
+
keyLength: r.partitionKeyLength,
|
|
397
|
+
payload: Object.entries(r.parts).map(([part, info]) => ({
|
|
398
|
+
key: part,
|
|
399
|
+
value: info.id.toString(),
|
|
400
|
+
}))
|
|
401
|
+
};
|
|
402
|
+
break;
|
|
403
|
+
case 'BinaryPartitioned':
|
|
404
|
+
result = {
|
|
405
|
+
type: r.type,
|
|
406
|
+
keyLength: r.partitionKeyLength,
|
|
407
|
+
payload: Object.entries(r.parts).map(([part, info]) => ({
|
|
408
|
+
key: part,
|
|
409
|
+
value: [info.index.id.toString(), info.values.id.toString()] as const,
|
|
410
|
+
}))
|
|
411
|
+
};
|
|
412
|
+
break;
|
|
413
|
+
default:
|
|
414
|
+
throw Error(`unsupported resource type: ${ type satisfies never }`);
|
|
415
|
+
}
|
|
416
|
+
result.payload.sort((lhs, rhs) => lhs.key.localeCompare(rhs.key));
|
|
417
|
+
return result;
|
|
418
|
+
}));
|
|
419
|
+
orderedData.sort((lhs, rhs) => lhs.id.localeCompare(rhs.id));
|
|
420
|
+
|
|
375
421
|
const hash = createHash('sha256');
|
|
376
|
-
|
|
377
|
-
for (const id of ids) {
|
|
378
|
-
if (previous === id) continue; // only unique ids
|
|
379
|
-
hash.update(id);
|
|
380
|
-
previous = id;
|
|
381
|
-
}
|
|
422
|
+
hash.update(canonicalize(orderedData)!);
|
|
382
423
|
return hash.digest().toString('hex');
|
|
383
424
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { PlError, PlTreeNodeAccessor } from '@milaboratories/pl-tree';
|
|
2
|
-
import { PObject, PObjectSpec, ValueOrError } from '@platforma-sdk/model';
|
|
2
|
+
import { PObject, PObjectId, PObjectSpec, ValueOrError } from '@platforma-sdk/model';
|
|
3
3
|
import { notEmpty } from '@milaboratories/ts-helpers';
|
|
4
4
|
import assert from 'assert';
|
|
5
5
|
import { Writable } from 'utility-types';
|
|
6
|
-
import {
|
|
6
|
+
import { deriveLegacyPObjectId, deriveLocalPObjectId } from './data';
|
|
7
7
|
|
|
8
8
|
/** Represents specific staging or prod ctx data */
|
|
9
9
|
export interface RawPObjectCollection {
|
|
@@ -99,21 +99,24 @@ export function parseRawPObjectCollection(
|
|
|
99
99
|
export function parseFinalPObjectCollection(
|
|
100
100
|
node: PlTreeNodeAccessor,
|
|
101
101
|
errorOnUnknownField: boolean = true,
|
|
102
|
-
prefix: string = ''
|
|
102
|
+
prefix: string = '',
|
|
103
|
+
resolvePath: string[],
|
|
103
104
|
): Record<string, PObject<PlTreeNodeAccessor>> {
|
|
104
105
|
if (!node.getIsReadyOrError()) throw new Error('resource is not ready');
|
|
105
106
|
const rawCollection = parseRawPObjectCollection(node, errorOnUnknownField, false, prefix);
|
|
106
107
|
assert(rawCollection.locked);
|
|
107
108
|
const collection: Record<string, PObject<PlTreeNodeAccessor>> = {};
|
|
108
|
-
for (const [
|
|
109
|
-
if (result.spec === undefined) throw new Error(`no spec for key ${
|
|
109
|
+
for (const [outputName, result] of rawCollection.results) {
|
|
110
|
+
if (result.spec === undefined) throw new Error(`no spec for key ${outputName}`);
|
|
110
111
|
if (result.hasData !== true || result.data === undefined)
|
|
111
|
-
throw new Error(`no data for key ${
|
|
112
|
+
throw new Error(`no data for key ${outputName}`);
|
|
112
113
|
const data = result.data();
|
|
113
|
-
if (data === undefined) throw new Error(`no data for key ${
|
|
114
|
+
if (data === undefined) throw new Error(`no data for key ${outputName}`);
|
|
114
115
|
if (!data.ok) throw new PlError(data.error);
|
|
115
|
-
collection[
|
|
116
|
-
id:
|
|
116
|
+
collection[outputName] = {
|
|
117
|
+
id: resolvePath.length === 0
|
|
118
|
+
? deriveLegacyPObjectId(result.spec, data.value) // for old blocks opened in new desktop
|
|
119
|
+
: deriveLocalPObjectId(resolvePath, outputName),
|
|
117
120
|
spec: result.spec,
|
|
118
121
|
data: data.value
|
|
119
122
|
};
|
package/src/pool/result_pool.ts
CHANGED
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
} from '../model/project_model';
|
|
23
23
|
import { allBlocks, stagingGraph } from '../model/project_model_util';
|
|
24
24
|
import { Optional } from 'utility-types';
|
|
25
|
-
import {
|
|
25
|
+
import { deriveGlobalPObjectId } from './data';
|
|
26
26
|
import {
|
|
27
27
|
RawPObjectCollection,
|
|
28
28
|
RawPObjectEntry,
|
|
@@ -100,7 +100,7 @@ export class ResultPool {
|
|
|
100
100
|
let data = result?.data?.();
|
|
101
101
|
if (result !== undefined && result.spec !== undefined && data !== undefined)
|
|
102
102
|
return mapValueInVOE(data, (value) => ({
|
|
103
|
-
id:
|
|
103
|
+
id: deriveGlobalPObjectId(blockId, exportName),
|
|
104
104
|
spec: result!.spec!,
|
|
105
105
|
data: value
|
|
106
106
|
}));
|
|
@@ -161,7 +161,7 @@ export class ResultPool {
|
|
|
161
161
|
entries.push({
|
|
162
162
|
ref: outputRef(blockId, exportName),
|
|
163
163
|
obj: {
|
|
164
|
-
id: data.ok ?
|
|
164
|
+
id: data.ok ? deriveGlobalPObjectId(blockId, exportName) : undefined,
|
|
165
165
|
spec: result.spec,
|
|
166
166
|
data
|
|
167
167
|
}
|