@milaboratories/pl-model-common 1.34.1 → 1.36.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/dialog/index.d.ts +34 -0
- package/dist/dialog/index.d.ts.map +1 -0
- package/dist/drivers/index.d.ts +1 -1
- package/dist/drivers/pframe/data_types.cjs +1 -0
- package/dist/drivers/pframe/data_types.cjs.map +1 -1
- package/dist/drivers/pframe/data_types.d.ts +27 -1
- package/dist/drivers/pframe/data_types.d.ts.map +1 -1
- package/dist/drivers/pframe/data_types.js +1 -1
- package/dist/drivers/pframe/data_types.js.map +1 -1
- package/dist/drivers/pframe/driver.cjs.map +1 -1
- package/dist/drivers/pframe/driver.d.ts +6 -1
- package/dist/drivers/pframe/driver.d.ts.map +1 -1
- package/dist/drivers/pframe/driver.js.map +1 -1
- package/dist/drivers/pframe/index.d.ts +1 -1
- package/dist/index.cjs +12 -3
- package/dist/index.d.ts +7 -6
- package/dist/index.js +6 -6
- package/dist/ref.cjs +16 -0
- package/dist/ref.cjs.map +1 -1
- package/dist/ref.d.ts +16 -12
- package/dist/ref.d.ts.map +1 -1
- package/dist/ref.js +15 -1
- package/dist/ref.js.map +1 -1
- package/dist/services/index.cjs +1 -1
- package/dist/services/index.d.ts +3 -3
- package/dist/services/index.js +1 -1
- package/dist/services/{service_injector_factory.js → node_service_handlers.cjs} +6 -5
- package/dist/services/node_service_handlers.cjs.map +1 -0
- package/dist/services/node_service_handlers.d.ts +8 -0
- package/dist/services/node_service_handlers.d.ts.map +1 -0
- package/dist/services/{service_injector_factory.cjs → node_service_handlers.js} +6 -5
- package/dist/services/node_service_handlers.js.map +1 -0
- package/dist/services/service_declarations.cjs +48 -2
- package/dist/services/service_declarations.cjs.map +1 -1
- package/dist/services/service_declarations.d.ts +2 -0
- package/dist/services/service_declarations.d.ts.map +1 -1
- package/dist/services/service_declarations.js +48 -2
- package/dist/services/service_declarations.js.map +1 -1
- package/dist/services/service_injectors.cjs +29 -25
- package/dist/services/service_injectors.cjs.map +1 -1
- package/dist/services/service_injectors.d.ts +21 -10
- package/dist/services/service_injectors.d.ts.map +1 -1
- package/dist/services/service_injectors.js +29 -26
- package/dist/services/service_injectors.js.map +1 -1
- package/dist/services/service_types.cjs +26 -2
- package/dist/services/service_types.cjs.map +1 -1
- package/dist/services/service_types.d.ts +6 -4
- package/dist/services/service_types.d.ts.map +1 -1
- package/dist/services/service_types.js +22 -3
- package/dist/services/service_types.js.map +1 -1
- package/package.json +3 -3
- package/src/dialog/index.ts +33 -0
- package/src/drivers/pframe/data_types.ts +30 -1
- package/src/drivers/pframe/driver.ts +17 -2
- package/src/index.ts +1 -0
- package/src/ref.test.ts +37 -0
- package/src/ref.ts +34 -1
- package/src/services/{service_injector_factory.ts → node_service_handlers.ts} +13 -6
- package/src/services/service_declarations.ts +60 -3
- package/src/services/service_injectors.ts +50 -34
- package/src/services/service_types.ts +38 -4
- package/dist/services/service_injector_factory.cjs.map +0 -1
- package/dist/services/service_injector_factory.d.ts +0 -8
- package/dist/services/service_injector_factory.d.ts.map +0 -1
- package/dist/services/service_injector_factory.js.map +0 -1
package/dist/ref.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ref.cjs","names":["z"],"sources":["../src/ref.ts"],"sourcesContent":["import { z } from \"zod\";\n\nexport const PlRef = z\n .object({\n __isRef: z\n .literal(true)\n .describe(\"Crucial marker for the block dependency tree reconstruction\"),\n blockId: z.string().describe(\"Upstream block id\"),\n name: z.string().describe(\"Name of the output provided to the upstream block's output context\"),\n requireEnrichments: z\n .literal(true)\n .optional()\n .describe(\n \"True if current block that stores this reference in its args, may need enrichments \" +\n \"for the references value originating from the blocks in between current and referenced block\",\n ),\n })\n .describe(\n \"Universal reference type, allowing to set block connections. It is crucial that \" +\n \"{@link __isRef} is present and equal to true, internal logic relies on this marker \" +\n \"to build block dependency trees.\",\n )\n .readonly();\nexport type PlRef = z.infer<typeof PlRef>;\n/** @deprecated use {@link PlRef} */\nexport type Ref = PlRef;\n\n/**\n * Type guard to check if a value is a PlRef.\n *\n * @param value - The value to check.\n * @returns True if the value is a PlRef, false otherwise.\n */\nexport function isPlRef(value: unknown): value is PlRef {\n return (\n typeof value === \"object\" &&\n value !== null &&\n \"__isRef\" in value &&\n (value as { __isRef: unknown }).__isRef === true &&\n \"blockId\" in value &&\n \"name\" in value\n );\n}\n\n/** Standard way how to communicate possible connections given specific\n * requirements for incoming data. */\nexport type Option = {\n /** Fully rendered reference to be assigned for the intended field in block's\n * args */\n readonly ref: PlRef;\n\n /** Label to be present for the user in i.e. drop-down list */\n readonly label: string;\n};\n\n/**\n * Creates a PlRef with the given blockId and name.\n *\n * @param blockId - The blockId of the reference.\n * @param name - The name of the reference.\n * @param requireEnrichments - Whether the reference requires enrichments.\n */\nexport function createPlRef(blockId: string
|
|
1
|
+
{"version":3,"file":"ref.cjs","names":["z"],"sources":["../src/ref.ts"],"sourcesContent":["import { z } from \"zod\";\n\nexport const PlRef = z\n .object({\n __isRef: z\n .literal(true)\n .describe(\"Crucial marker for the block dependency tree reconstruction\"),\n blockId: z.string().describe(\"Upstream block id\"),\n name: z.string().describe(\"Name of the output provided to the upstream block's output context\"),\n requireEnrichments: z\n .literal(true)\n .optional()\n .describe(\n \"True if current block that stores this reference in its args, may need enrichments \" +\n \"for the references value originating from the blocks in between current and referenced block\",\n ),\n })\n .describe(\n \"Universal reference type, allowing to set block connections. It is crucial that \" +\n \"{@link __isRef} is present and equal to true, internal logic relies on this marker \" +\n \"to build block dependency trees.\",\n )\n .readonly();\nexport type PlRef = z.infer<typeof PlRef>;\n/** @deprecated use {@link PlRef} */\nexport type Ref = PlRef;\n\n/**\n * Type guard to check if a value is a PlRef.\n *\n * @param value - The value to check.\n * @returns True if the value is a PlRef, false otherwise.\n */\nexport function isPlRef(value: unknown): value is PlRef {\n return (\n typeof value === \"object\" &&\n value !== null &&\n \"__isRef\" in value &&\n (value as { __isRef: unknown }).__isRef === true &&\n \"blockId\" in value &&\n \"name\" in value\n );\n}\n\n/** Standard way how to communicate possible connections given specific\n * requirements for incoming data. */\nexport type Option = {\n /** Fully rendered reference to be assigned for the intended field in block's\n * args */\n readonly ref: PlRef;\n\n /** Label to be present for the user in i.e. drop-down list */\n readonly label: string;\n};\n\n/**\n * Creates a PlRef with the given blockId and name.\n *\n * @param blockId - The blockId of the reference.\n * @param name - The name of the reference.\n * @param requireEnrichments - Whether the reference requires enrichments.\n */\nexport function createPlRef(\n blockId: string,\n name: string,\n requireEnrichments: boolean = false,\n): PlRef {\n if (requireEnrichments)\n return {\n __isRef: true,\n blockId,\n name,\n requireEnrichments: true,\n };\n else\n return {\n __isRef: true,\n blockId,\n name,\n };\n}\n\n/**\n * Creates a new PlRef based on an existing one, explicitly setting (default) or removing the\n * requireEnrichments property.\n *\n * @param ref - The original PlRef object.\n * @param requireEnrichments - If true, the `requireEnrichments: true` property is added\n * to the returned PlRef. If false, the `requireEnrichments` property is removed. Defaults to true.\n * @returns A new PlRef object with the `requireEnrichments` property set or removed accordingly.\n */\nexport function withEnrichments(ref: PlRef, requireEnrichments: boolean = true): PlRef {\n if (requireEnrichments)\n return {\n ...ref,\n requireEnrichments: true,\n };\n else {\n const { requireEnrichments: _, ...rest } = ref;\n return rest;\n }\n}\n\n/** Primary dataset reference with an optional filter. */\nexport type PrimaryRef = {\n readonly __isPrimaryRef: \"v1\";\n readonly column: PlRef;\n readonly filter?: PlRef;\n};\n\nexport function isPrimaryRef(value: unknown): value is PrimaryRef {\n return (\n typeof value === \"object\" &&\n value !== null &&\n (value as { __isPrimaryRef?: unknown }).__isPrimaryRef === \"v1\" &&\n \"column\" in value\n );\n}\n\nexport function createPrimaryRef(column: PlRef, filter?: PlRef): PrimaryRef {\n if (filter !== undefined) return { __isPrimaryRef: \"v1\", column, filter };\n else return { __isPrimaryRef: \"v1\", column };\n}\n\n/** Block args accept either form — backward compatible. */\nexport type DatasetInput = PlRef | PrimaryRef;\n\n/** Dataset option with optional filter choices. */\nexport type DatasetOption = Option & {\n readonly filters?: readonly Option[];\n};\n\n/** Compare two PlRefs and returns true if they are qual */\nexport function plRefsEqual(ref1: PlRef, ref2: PlRef, ignoreEnrichments: boolean = false) {\n return (\n ref1.blockId === ref2.blockId &&\n ref1.name === ref2.name &&\n (ignoreEnrichments || ref1.requireEnrichments === ref2.requireEnrichments)\n );\n}\n"],"mappings":";;;AAEA,MAAa,QAAQA,IAAAA,EAClB,OAAO;CACN,SAASA,IAAAA,EACN,QAAQ,KAAK,CACb,SAAS,8DAA8D;CAC1E,SAASA,IAAAA,EAAE,QAAQ,CAAC,SAAS,oBAAoB;CACjD,MAAMA,IAAAA,EAAE,QAAQ,CAAC,SAAS,qEAAqE;CAC/F,oBAAoBA,IAAAA,EACjB,QAAQ,KAAK,CACb,UAAU,CACV,SACC,kLAED;CACJ,CAAC,CACD,SACC,sMAGD,CACA,UAAU;;;;;;;AAWb,SAAgB,QAAQ,OAAgC;AACtD,QACE,OAAO,UAAU,YACjB,UAAU,QACV,aAAa,SACZ,MAA+B,YAAY,QAC5C,aAAa,SACb,UAAU;;;;;;;;;AAsBd,SAAgB,YACd,SACA,MACA,qBAA8B,OACvB;AACP,KAAI,mBACF,QAAO;EACL,SAAS;EACT;EACA;EACA,oBAAoB;EACrB;KAED,QAAO;EACL,SAAS;EACT;EACA;EACD;;;;;;;;;;;AAYL,SAAgB,gBAAgB,KAAY,qBAA8B,MAAa;AACrF,KAAI,mBACF,QAAO;EACL,GAAG;EACH,oBAAoB;EACrB;MACE;EACH,MAAM,EAAE,oBAAoB,GAAG,GAAG,SAAS;AAC3C,SAAO;;;AAWX,SAAgB,aAAa,OAAqC;AAChE,QACE,OAAO,UAAU,YACjB,UAAU,QACT,MAAuC,mBAAmB,QAC3D,YAAY;;AAIhB,SAAgB,iBAAiB,QAAe,QAA4B;AAC1E,KAAI,WAAW,KAAA,EAAW,QAAO;EAAE,gBAAgB;EAAM;EAAQ;EAAQ;KACpE,QAAO;EAAE,gBAAgB;EAAM;EAAQ;;;AAY9C,SAAgB,YAAY,MAAa,MAAa,oBAA6B,OAAO;AACxF,QACE,KAAK,YAAY,KAAK,WACtB,KAAK,SAAS,KAAK,SAClB,qBAAqB,KAAK,uBAAuB,KAAK"}
|
package/dist/ref.d.ts
CHANGED
|
@@ -42,17 +42,7 @@ type Option = {
|
|
|
42
42
|
* @param name - The name of the reference.
|
|
43
43
|
* @param requireEnrichments - Whether the reference requires enrichments.
|
|
44
44
|
*/
|
|
45
|
-
declare function createPlRef(blockId: string, name: string, requireEnrichments?: boolean):
|
|
46
|
-
__isRef: boolean;
|
|
47
|
-
blockId: string;
|
|
48
|
-
name: string;
|
|
49
|
-
requireEnrichments: boolean;
|
|
50
|
-
} | {
|
|
51
|
-
__isRef: boolean;
|
|
52
|
-
blockId: string;
|
|
53
|
-
name: string;
|
|
54
|
-
requireEnrichments?: undefined;
|
|
55
|
-
};
|
|
45
|
+
declare function createPlRef(blockId: string, name: string, requireEnrichments?: boolean): PlRef;
|
|
56
46
|
/**
|
|
57
47
|
* Creates a new PlRef based on an existing one, explicitly setting (default) or removing the
|
|
58
48
|
* requireEnrichments property.
|
|
@@ -63,8 +53,22 @@ declare function createPlRef(blockId: string, name: string, requireEnrichments?:
|
|
|
63
53
|
* @returns A new PlRef object with the `requireEnrichments` property set or removed accordingly.
|
|
64
54
|
*/
|
|
65
55
|
declare function withEnrichments(ref: PlRef, requireEnrichments?: boolean): PlRef;
|
|
56
|
+
/** Primary dataset reference with an optional filter. */
|
|
57
|
+
type PrimaryRef = {
|
|
58
|
+
readonly __isPrimaryRef: "v1";
|
|
59
|
+
readonly column: PlRef;
|
|
60
|
+
readonly filter?: PlRef;
|
|
61
|
+
};
|
|
62
|
+
declare function isPrimaryRef(value: unknown): value is PrimaryRef;
|
|
63
|
+
declare function createPrimaryRef(column: PlRef, filter?: PlRef): PrimaryRef;
|
|
64
|
+
/** Block args accept either form — backward compatible. */
|
|
65
|
+
type DatasetInput = PlRef | PrimaryRef;
|
|
66
|
+
/** Dataset option with optional filter choices. */
|
|
67
|
+
type DatasetOption = Option & {
|
|
68
|
+
readonly filters?: readonly Option[];
|
|
69
|
+
};
|
|
66
70
|
/** Compare two PlRefs and returns true if they are qual */
|
|
67
71
|
declare function plRefsEqual(ref1: PlRef, ref2: PlRef, ignoreEnrichments?: boolean): boolean;
|
|
68
72
|
//#endregion
|
|
69
|
-
export { Option, PlRef, Ref, createPlRef, isPlRef, plRefsEqual, withEnrichments };
|
|
73
|
+
export { DatasetInput, DatasetOption, Option, PlRef, PrimaryRef, Ref, createPlRef, createPrimaryRef, isPlRef, isPrimaryRef, plRefsEqual, withEnrichments };
|
|
70
74
|
//# sourceMappingURL=ref.d.ts.map
|
package/dist/ref.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ref.d.ts","names":[],"sources":["../src/ref.ts"],"mappings":";;;cAEa,KAAA,EAAK,CAAA,CAAA,WAAA,CAAA,CAAA,CAAA,SAAA;;;;;;;;;;;;;;;;KAqBN,KAAA,GAAQ,CAAA,CAAE,KAAA,QAAa,KAAA;;KAEvB,GAAA,GAAM,KAAA;;;;;;;iBAQF,OAAA,CAAQ,KAAA,YAAiB,KAAA,IAAS,KAAA;;;KAatC,MAAA;;;WAGD,GAAA,EAAK,KAAA;WAGL,KAAA;AAAA;;;;;;;;iBAUK,WAAA,
|
|
1
|
+
{"version":3,"file":"ref.d.ts","names":[],"sources":["../src/ref.ts"],"mappings":";;;cAEa,KAAA,EAAK,CAAA,CAAA,WAAA,CAAA,CAAA,CAAA,SAAA;;;;;;;;;;;;;;;;KAqBN,KAAA,GAAQ,CAAA,CAAE,KAAA,QAAa,KAAA;;KAEvB,GAAA,GAAM,KAAA;;;;;;;iBAQF,OAAA,CAAQ,KAAA,YAAiB,KAAA,IAAS,KAAA;;;KAatC,MAAA;;;WAGD,GAAA,EAAK,KAAA;WAGL,KAAA;AAAA;;;;;;;;iBAUK,WAAA,CACd,OAAA,UACA,IAAA,UACA,kBAAA,aACC,KAAA;;;AA3CH;;;;;;;iBAoEgB,eAAA,CAAgB,GAAA,EAAK,KAAA,EAAO,kBAAA,aAAqC,KAAA;;KAarE,UAAA;EAAA,SACD,cAAA;EAAA,SACA,MAAA,EAAQ,KAAA;EAAA,SACR,MAAA,GAAS,KAAA;AAAA;AAAA,iBAGJ,YAAA,CAAa,KAAA,YAAiB,KAAA,IAAS,UAAA;AAAA,iBASvC,gBAAA,CAAiB,MAAA,EAAQ,KAAA,EAAO,MAAA,GAAS,KAAA,GAAQ,UAAA;;KAMrD,YAAA,GAAe,KAAA,GAAQ,UAAA;;KAGvB,aAAA,GAAgB,MAAA;EAAA,SACjB,OAAA,YAAmB,MAAA;AAAA;;iBAId,WAAA,CAAY,IAAA,EAAM,KAAA,EAAO,IAAA,EAAM,KAAA,EAAO,iBAAA"}
|
package/dist/ref.js
CHANGED
|
@@ -54,11 +54,25 @@ function withEnrichments(ref, requireEnrichments = true) {
|
|
|
54
54
|
return rest;
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
|
+
function isPrimaryRef(value) {
|
|
58
|
+
return typeof value === "object" && value !== null && value.__isPrimaryRef === "v1" && "column" in value;
|
|
59
|
+
}
|
|
60
|
+
function createPrimaryRef(column, filter) {
|
|
61
|
+
if (filter !== void 0) return {
|
|
62
|
+
__isPrimaryRef: "v1",
|
|
63
|
+
column,
|
|
64
|
+
filter
|
|
65
|
+
};
|
|
66
|
+
else return {
|
|
67
|
+
__isPrimaryRef: "v1",
|
|
68
|
+
column
|
|
69
|
+
};
|
|
70
|
+
}
|
|
57
71
|
/** Compare two PlRefs and returns true if they are qual */
|
|
58
72
|
function plRefsEqual(ref1, ref2, ignoreEnrichments = false) {
|
|
59
73
|
return ref1.blockId === ref2.blockId && ref1.name === ref2.name && (ignoreEnrichments || ref1.requireEnrichments === ref2.requireEnrichments);
|
|
60
74
|
}
|
|
61
75
|
//#endregion
|
|
62
|
-
export { PlRef, createPlRef, isPlRef, plRefsEqual, withEnrichments };
|
|
76
|
+
export { PlRef, createPlRef, createPrimaryRef, isPlRef, isPrimaryRef, plRefsEqual, withEnrichments };
|
|
63
77
|
|
|
64
78
|
//# sourceMappingURL=ref.js.map
|
package/dist/ref.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ref.js","names":[],"sources":["../src/ref.ts"],"sourcesContent":["import { z } from \"zod\";\n\nexport const PlRef = z\n .object({\n __isRef: z\n .literal(true)\n .describe(\"Crucial marker for the block dependency tree reconstruction\"),\n blockId: z.string().describe(\"Upstream block id\"),\n name: z.string().describe(\"Name of the output provided to the upstream block's output context\"),\n requireEnrichments: z\n .literal(true)\n .optional()\n .describe(\n \"True if current block that stores this reference in its args, may need enrichments \" +\n \"for the references value originating from the blocks in between current and referenced block\",\n ),\n })\n .describe(\n \"Universal reference type, allowing to set block connections. It is crucial that \" +\n \"{@link __isRef} is present and equal to true, internal logic relies on this marker \" +\n \"to build block dependency trees.\",\n )\n .readonly();\nexport type PlRef = z.infer<typeof PlRef>;\n/** @deprecated use {@link PlRef} */\nexport type Ref = PlRef;\n\n/**\n * Type guard to check if a value is a PlRef.\n *\n * @param value - The value to check.\n * @returns True if the value is a PlRef, false otherwise.\n */\nexport function isPlRef(value: unknown): value is PlRef {\n return (\n typeof value === \"object\" &&\n value !== null &&\n \"__isRef\" in value &&\n (value as { __isRef: unknown }).__isRef === true &&\n \"blockId\" in value &&\n \"name\" in value\n );\n}\n\n/** Standard way how to communicate possible connections given specific\n * requirements for incoming data. */\nexport type Option = {\n /** Fully rendered reference to be assigned for the intended field in block's\n * args */\n readonly ref: PlRef;\n\n /** Label to be present for the user in i.e. drop-down list */\n readonly label: string;\n};\n\n/**\n * Creates a PlRef with the given blockId and name.\n *\n * @param blockId - The blockId of the reference.\n * @param name - The name of the reference.\n * @param requireEnrichments - Whether the reference requires enrichments.\n */\nexport function createPlRef(blockId: string
|
|
1
|
+
{"version":3,"file":"ref.js","names":[],"sources":["../src/ref.ts"],"sourcesContent":["import { z } from \"zod\";\n\nexport const PlRef = z\n .object({\n __isRef: z\n .literal(true)\n .describe(\"Crucial marker for the block dependency tree reconstruction\"),\n blockId: z.string().describe(\"Upstream block id\"),\n name: z.string().describe(\"Name of the output provided to the upstream block's output context\"),\n requireEnrichments: z\n .literal(true)\n .optional()\n .describe(\n \"True if current block that stores this reference in its args, may need enrichments \" +\n \"for the references value originating from the blocks in between current and referenced block\",\n ),\n })\n .describe(\n \"Universal reference type, allowing to set block connections. It is crucial that \" +\n \"{@link __isRef} is present and equal to true, internal logic relies on this marker \" +\n \"to build block dependency trees.\",\n )\n .readonly();\nexport type PlRef = z.infer<typeof PlRef>;\n/** @deprecated use {@link PlRef} */\nexport type Ref = PlRef;\n\n/**\n * Type guard to check if a value is a PlRef.\n *\n * @param value - The value to check.\n * @returns True if the value is a PlRef, false otherwise.\n */\nexport function isPlRef(value: unknown): value is PlRef {\n return (\n typeof value === \"object\" &&\n value !== null &&\n \"__isRef\" in value &&\n (value as { __isRef: unknown }).__isRef === true &&\n \"blockId\" in value &&\n \"name\" in value\n );\n}\n\n/** Standard way how to communicate possible connections given specific\n * requirements for incoming data. */\nexport type Option = {\n /** Fully rendered reference to be assigned for the intended field in block's\n * args */\n readonly ref: PlRef;\n\n /** Label to be present for the user in i.e. drop-down list */\n readonly label: string;\n};\n\n/**\n * Creates a PlRef with the given blockId and name.\n *\n * @param blockId - The blockId of the reference.\n * @param name - The name of the reference.\n * @param requireEnrichments - Whether the reference requires enrichments.\n */\nexport function createPlRef(\n blockId: string,\n name: string,\n requireEnrichments: boolean = false,\n): PlRef {\n if (requireEnrichments)\n return {\n __isRef: true,\n blockId,\n name,\n requireEnrichments: true,\n };\n else\n return {\n __isRef: true,\n blockId,\n name,\n };\n}\n\n/**\n * Creates a new PlRef based on an existing one, explicitly setting (default) or removing the\n * requireEnrichments property.\n *\n * @param ref - The original PlRef object.\n * @param requireEnrichments - If true, the `requireEnrichments: true` property is added\n * to the returned PlRef. If false, the `requireEnrichments` property is removed. Defaults to true.\n * @returns A new PlRef object with the `requireEnrichments` property set or removed accordingly.\n */\nexport function withEnrichments(ref: PlRef, requireEnrichments: boolean = true): PlRef {\n if (requireEnrichments)\n return {\n ...ref,\n requireEnrichments: true,\n };\n else {\n const { requireEnrichments: _, ...rest } = ref;\n return rest;\n }\n}\n\n/** Primary dataset reference with an optional filter. */\nexport type PrimaryRef = {\n readonly __isPrimaryRef: \"v1\";\n readonly column: PlRef;\n readonly filter?: PlRef;\n};\n\nexport function isPrimaryRef(value: unknown): value is PrimaryRef {\n return (\n typeof value === \"object\" &&\n value !== null &&\n (value as { __isPrimaryRef?: unknown }).__isPrimaryRef === \"v1\" &&\n \"column\" in value\n );\n}\n\nexport function createPrimaryRef(column: PlRef, filter?: PlRef): PrimaryRef {\n if (filter !== undefined) return { __isPrimaryRef: \"v1\", column, filter };\n else return { __isPrimaryRef: \"v1\", column };\n}\n\n/** Block args accept either form — backward compatible. */\nexport type DatasetInput = PlRef | PrimaryRef;\n\n/** Dataset option with optional filter choices. */\nexport type DatasetOption = Option & {\n readonly filters?: readonly Option[];\n};\n\n/** Compare two PlRefs and returns true if they are qual */\nexport function plRefsEqual(ref1: PlRef, ref2: PlRef, ignoreEnrichments: boolean = false) {\n return (\n ref1.blockId === ref2.blockId &&\n ref1.name === ref2.name &&\n (ignoreEnrichments || ref1.requireEnrichments === ref2.requireEnrichments)\n );\n}\n"],"mappings":";;AAEA,MAAa,QAAQ,EAClB,OAAO;CACN,SAAS,EACN,QAAQ,KAAK,CACb,SAAS,8DAA8D;CAC1E,SAAS,EAAE,QAAQ,CAAC,SAAS,oBAAoB;CACjD,MAAM,EAAE,QAAQ,CAAC,SAAS,qEAAqE;CAC/F,oBAAoB,EACjB,QAAQ,KAAK,CACb,UAAU,CACV,SACC,kLAED;CACJ,CAAC,CACD,SACC,sMAGD,CACA,UAAU;;;;;;;AAWb,SAAgB,QAAQ,OAAgC;AACtD,QACE,OAAO,UAAU,YACjB,UAAU,QACV,aAAa,SACZ,MAA+B,YAAY,QAC5C,aAAa,SACb,UAAU;;;;;;;;;AAsBd,SAAgB,YACd,SACA,MACA,qBAA8B,OACvB;AACP,KAAI,mBACF,QAAO;EACL,SAAS;EACT;EACA;EACA,oBAAoB;EACrB;KAED,QAAO;EACL,SAAS;EACT;EACA;EACD;;;;;;;;;;;AAYL,SAAgB,gBAAgB,KAAY,qBAA8B,MAAa;AACrF,KAAI,mBACF,QAAO;EACL,GAAG;EACH,oBAAoB;EACrB;MACE;EACH,MAAM,EAAE,oBAAoB,GAAG,GAAG,SAAS;AAC3C,SAAO;;;AAWX,SAAgB,aAAa,OAAqC;AAChE,QACE,OAAO,UAAU,YACjB,UAAU,QACT,MAAuC,mBAAmB,QAC3D,YAAY;;AAIhB,SAAgB,iBAAiB,QAAe,QAA4B;AAC1E,KAAI,WAAW,KAAA,EAAW,QAAO;EAAE,gBAAgB;EAAM;EAAQ;EAAQ;KACpE,QAAO;EAAE,gBAAgB;EAAM;EAAQ;;;AAY9C,SAAgB,YAAY,MAAa,MAAa,oBAA6B,OAAO;AACxF,QACE,KAAK,YAAY,KAAK,WACtB,KAAK,SAAS,KAAK,SAClB,qBAAqB,KAAK,uBAAuB,KAAK"}
|
package/dist/services/index.cjs
CHANGED
|
@@ -2,5 +2,5 @@ require("./service_types.cjs");
|
|
|
2
2
|
require("./service_registry.cjs");
|
|
3
3
|
require("./service_declarations.cjs");
|
|
4
4
|
require("./service_capabilities.cjs");
|
|
5
|
-
require("./
|
|
5
|
+
require("./node_service_handlers.cjs");
|
|
6
6
|
require("./service_injectors.cjs");
|
package/dist/services/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Services } from "./service_declarations.js";
|
|
2
|
-
import { InferServiceKind, InferServiceModel, InferServiceUi, ModelServiceFactoryMap, ModelServices, RequireServices, ServiceBrand, ServiceDispatch, ServiceName, ServiceNameLiterals, ServiceRequireFlags, ServiceType, ServiceTypesLike, UiServiceFactoryMap, UiServices, isNodeService, service, serviceFnKey } from "./service_types.js";
|
|
2
|
+
import { InferServiceKind, InferServiceModel, InferServiceUi, ModelServiceFactoryMap, ModelServices, RequireServices, ServiceBrand, ServiceDispatch, ServiceName, ServiceNameLiterals, ServiceRequireFlags, ServiceType, ServiceTypesLike, UiServiceFactoryMap, UiServices, getServiceKind, getServiceModelMethods, getServiceUiMethods, isMainService, isNodeService, isWasmService, service, serviceFnKey } from "./service_types.js";
|
|
3
3
|
import { ModelServiceRegistry, UiServiceRegistry } from "./service_registry.js";
|
|
4
4
|
import { KnownServiceName, SERVICE_CAPABILITY_FLAGS, SERVICE_FEATURE_FLAGS, getMethodNames, isKnownServiceName, registerServiceCapabilities, resolveRequiredServices } from "./service_capabilities.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { createNodeServiceHandlers } from "./node_service_handlers.js";
|
|
6
|
+
import { MODEL_SERVICE_METHOD_MAP, NodeServiceHandlerMap, SERVICE_METHOD_MAP, buildServiceInfo, resolveNodeServiceHandler } from "./service_injectors.js";
|
package/dist/services/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
//#region src/services/
|
|
2
|
-
function
|
|
1
|
+
//#region src/services/node_service_handlers.ts
|
|
2
|
+
function createNodeServiceHandlers(driverKit) {
|
|
3
3
|
const { pFrameDriver } = driverKit;
|
|
4
4
|
return { PFrame: {
|
|
5
5
|
findColumns: (handle, request) => pFrameDriver.findColumns(handle, request),
|
|
@@ -9,10 +9,11 @@ function createUiServiceInjectors(driverKit) {
|
|
|
9
9
|
getUniqueValues: (handle, request) => pFrameDriver.getUniqueValues(handle, request),
|
|
10
10
|
getShape: (handle) => pFrameDriver.getShape(handle),
|
|
11
11
|
getSpec: (handle) => pFrameDriver.getSpec(handle),
|
|
12
|
-
getData: (handle, columnIndices, range) => pFrameDriver.getData(handle, columnIndices, range)
|
|
12
|
+
getData: (handle, columnIndices, range) => pFrameDriver.getData(handle, columnIndices, range),
|
|
13
|
+
writePTableToFs: (handle, options) => pFrameDriver.writePTableToFs(handle, options)
|
|
13
14
|
} };
|
|
14
15
|
}
|
|
15
16
|
//#endregion
|
|
16
|
-
|
|
17
|
+
exports.createNodeServiceHandlers = createNodeServiceHandlers;
|
|
17
18
|
|
|
18
|
-
//# sourceMappingURL=
|
|
19
|
+
//# sourceMappingURL=node_service_handlers.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node_service_handlers.cjs","names":[],"sources":["../../src/services/node_service_handlers.ts"],"sourcesContent":["/**\n * Worker-side dispatch table for `node`-kind services.\n *\n * Each entry maps a method name to a closure that calls the real driver\n * inside the worker process. Used by `callServiceMethod` in the worker\n * (see `platforma-desktop-app/packages/worker/src/workerApi.ts`) to route\n * incoming IPC calls to concrete driver methods.\n *\n * NOT used for:\n * - `wasm` services — instantiated locally on each consumer (no IPC).\n * - `main` services — dispatched in the Electron main process via its\n * own router, never reaches the worker.\n */\n\nimport type { DriverKit } from \"../driver_kit\";\nimport type { NodeServiceHandlerMap } from \"./service_injectors\";\n\nexport function createNodeServiceHandlers(driverKit: DriverKit): NodeServiceHandlerMap {\n const { pFrameDriver } = driverKit;\n return {\n PFrame: {\n findColumns: (handle, request) => pFrameDriver.findColumns(handle, request),\n getColumnSpec: (handle, columnId) => pFrameDriver.getColumnSpec(handle, columnId),\n listColumns: (handle) => pFrameDriver.listColumns(handle),\n calculateTableData: (handle, request, range) =>\n pFrameDriver.calculateTableData(handle, request, range),\n getUniqueValues: (handle, request) => pFrameDriver.getUniqueValues(handle, request),\n getShape: (handle) => pFrameDriver.getShape(handle),\n getSpec: (handle) => pFrameDriver.getSpec(handle),\n getData: (handle, columnIndices, range) => pFrameDriver.getData(handle, columnIndices, range),\n writePTableToFs: (handle, options) => pFrameDriver.writePTableToFs(handle, options),\n },\n };\n}\n"],"mappings":";AAiBA,SAAgB,0BAA0B,WAA6C;CACrF,MAAM,EAAE,iBAAiB;AACzB,QAAO,EACL,QAAQ;EACN,cAAc,QAAQ,YAAY,aAAa,YAAY,QAAQ,QAAQ;EAC3E,gBAAgB,QAAQ,aAAa,aAAa,cAAc,QAAQ,SAAS;EACjF,cAAc,WAAW,aAAa,YAAY,OAAO;EACzD,qBAAqB,QAAQ,SAAS,UACpC,aAAa,mBAAmB,QAAQ,SAAS,MAAM;EACzD,kBAAkB,QAAQ,YAAY,aAAa,gBAAgB,QAAQ,QAAQ;EACnF,WAAW,WAAW,aAAa,SAAS,OAAO;EACnD,UAAU,WAAW,aAAa,QAAQ,OAAO;EACjD,UAAU,QAAQ,eAAe,UAAU,aAAa,QAAQ,QAAQ,eAAe,MAAM;EAC7F,kBAAkB,QAAQ,YAAY,aAAa,gBAAgB,QAAQ,QAAQ;EACpF,EACF"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { DriverKit } from "../driver_kit.js";
|
|
2
|
+
import { NodeServiceHandlerMap } from "./service_injectors.js";
|
|
3
|
+
|
|
4
|
+
//#region src/services/node_service_handlers.d.ts
|
|
5
|
+
declare function createNodeServiceHandlers(driverKit: DriverKit): NodeServiceHandlerMap;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { createNodeServiceHandlers };
|
|
8
|
+
//# sourceMappingURL=node_service_handlers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node_service_handlers.d.ts","names":[],"sources":["../../src/services/node_service_handlers.ts"],"mappings":";;;;iBAiBgB,yBAAA,CAA0B,SAAA,EAAW,SAAA,GAAY,qBAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
//#region src/services/
|
|
2
|
-
function
|
|
1
|
+
//#region src/services/node_service_handlers.ts
|
|
2
|
+
function createNodeServiceHandlers(driverKit) {
|
|
3
3
|
const { pFrameDriver } = driverKit;
|
|
4
4
|
return { PFrame: {
|
|
5
5
|
findColumns: (handle, request) => pFrameDriver.findColumns(handle, request),
|
|
@@ -9,10 +9,11 @@ function createUiServiceInjectors(driverKit) {
|
|
|
9
9
|
getUniqueValues: (handle, request) => pFrameDriver.getUniqueValues(handle, request),
|
|
10
10
|
getShape: (handle) => pFrameDriver.getShape(handle),
|
|
11
11
|
getSpec: (handle) => pFrameDriver.getSpec(handle),
|
|
12
|
-
getData: (handle, columnIndices, range) => pFrameDriver.getData(handle, columnIndices, range)
|
|
12
|
+
getData: (handle, columnIndices, range) => pFrameDriver.getData(handle, columnIndices, range),
|
|
13
|
+
writePTableToFs: (handle, options) => pFrameDriver.writePTableToFs(handle, options)
|
|
13
14
|
} };
|
|
14
15
|
}
|
|
15
16
|
//#endregion
|
|
16
|
-
|
|
17
|
+
export { createNodeServiceHandlers };
|
|
17
18
|
|
|
18
|
-
//# sourceMappingURL=
|
|
19
|
+
//# sourceMappingURL=node_service_handlers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node_service_handlers.js","names":[],"sources":["../../src/services/node_service_handlers.ts"],"sourcesContent":["/**\n * Worker-side dispatch table for `node`-kind services.\n *\n * Each entry maps a method name to a closure that calls the real driver\n * inside the worker process. Used by `callServiceMethod` in the worker\n * (see `platforma-desktop-app/packages/worker/src/workerApi.ts`) to route\n * incoming IPC calls to concrete driver methods.\n *\n * NOT used for:\n * - `wasm` services — instantiated locally on each consumer (no IPC).\n * - `main` services — dispatched in the Electron main process via its\n * own router, never reaches the worker.\n */\n\nimport type { DriverKit } from \"../driver_kit\";\nimport type { NodeServiceHandlerMap } from \"./service_injectors\";\n\nexport function createNodeServiceHandlers(driverKit: DriverKit): NodeServiceHandlerMap {\n const { pFrameDriver } = driverKit;\n return {\n PFrame: {\n findColumns: (handle, request) => pFrameDriver.findColumns(handle, request),\n getColumnSpec: (handle, columnId) => pFrameDriver.getColumnSpec(handle, columnId),\n listColumns: (handle) => pFrameDriver.listColumns(handle),\n calculateTableData: (handle, request, range) =>\n pFrameDriver.calculateTableData(handle, request, range),\n getUniqueValues: (handle, request) => pFrameDriver.getUniqueValues(handle, request),\n getShape: (handle) => pFrameDriver.getShape(handle),\n getSpec: (handle) => pFrameDriver.getSpec(handle),\n getData: (handle, columnIndices, range) => pFrameDriver.getData(handle, columnIndices, range),\n writePTableToFs: (handle, options) => pFrameDriver.writePTableToFs(handle, options),\n },\n };\n}\n"],"mappings":";AAiBA,SAAgB,0BAA0B,WAA6C;CACrF,MAAM,EAAE,iBAAiB;AACzB,QAAO,EACL,QAAQ;EACN,cAAc,QAAQ,YAAY,aAAa,YAAY,QAAQ,QAAQ;EAC3E,gBAAgB,QAAQ,aAAa,aAAa,cAAc,QAAQ,SAAS;EACjF,cAAc,WAAW,aAAa,YAAY,OAAO;EACzD,qBAAqB,QAAQ,SAAS,UACpC,aAAa,mBAAmB,QAAQ,SAAS,MAAM;EACzD,kBAAkB,QAAQ,YAAY,aAAa,gBAAgB,QAAQ,QAAQ;EACnF,WAAW,WAAW,aAAa,SAAS,OAAO;EACnD,UAAU,WAAW,aAAa,QAAQ,OAAO;EACjD,UAAU,QAAQ,eAAe,UAAU,aAAa,QAAQ,QAAQ,eAAe,MAAM;EAC7F,kBAAkB,QAAQ,YAAY,aAAa,gBAAgB,QAAQ,QAAQ;EACpF,EACF"}
|
|
@@ -3,11 +3,57 @@ const require_service_types = require("./service_types.cjs");
|
|
|
3
3
|
const Services = {
|
|
4
4
|
PFrameSpec: require_service_types.service()({
|
|
5
5
|
type: "wasm",
|
|
6
|
-
name: "pframeSpec"
|
|
6
|
+
name: "pframeSpec",
|
|
7
|
+
modelMethods: [
|
|
8
|
+
"createSpecFrame",
|
|
9
|
+
"listColumns",
|
|
10
|
+
"discoverColumns",
|
|
11
|
+
"deleteColumn",
|
|
12
|
+
"evaluateQuery",
|
|
13
|
+
"buildQuery",
|
|
14
|
+
"expandAxes",
|
|
15
|
+
"collapseAxes",
|
|
16
|
+
"findAxis",
|
|
17
|
+
"findTableColumn"
|
|
18
|
+
],
|
|
19
|
+
uiMethods: [
|
|
20
|
+
"createSpecFrame",
|
|
21
|
+
"listColumns",
|
|
22
|
+
"discoverColumns",
|
|
23
|
+
"deleteColumn",
|
|
24
|
+
"evaluateQuery",
|
|
25
|
+
"buildQuery",
|
|
26
|
+
"expandAxes",
|
|
27
|
+
"collapseAxes",
|
|
28
|
+
"findAxis",
|
|
29
|
+
"findTableColumn"
|
|
30
|
+
]
|
|
7
31
|
}),
|
|
8
32
|
PFrame: require_service_types.service()({
|
|
9
33
|
type: "node",
|
|
10
|
-
name: "pframe"
|
|
34
|
+
name: "pframe",
|
|
35
|
+
modelMethods: [
|
|
36
|
+
"createPFrame",
|
|
37
|
+
"createPTable",
|
|
38
|
+
"createPTableV2"
|
|
39
|
+
],
|
|
40
|
+
uiMethods: [
|
|
41
|
+
"findColumns",
|
|
42
|
+
"getColumnSpec",
|
|
43
|
+
"listColumns",
|
|
44
|
+
"calculateTableData",
|
|
45
|
+
"getUniqueValues",
|
|
46
|
+
"getShape",
|
|
47
|
+
"getSpec",
|
|
48
|
+
"getData",
|
|
49
|
+
"writePTableToFs"
|
|
50
|
+
]
|
|
51
|
+
}),
|
|
52
|
+
Dialog: require_service_types.service()({
|
|
53
|
+
type: "main",
|
|
54
|
+
name: "dialog",
|
|
55
|
+
modelMethods: [],
|
|
56
|
+
uiMethods: ["showSaveDialog"]
|
|
11
57
|
})
|
|
12
58
|
};
|
|
13
59
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service_declarations.cjs","names":["service"],"sources":["../../src/services/service_declarations.ts"],"sourcesContent":["/**\n * Service declarations — add new services here.\n *\n * After adding a service, fix type errors in these files:\n *\n * Model side:\n * - lib/node/pl-middle-layer/src/js_render/service_injectors.ts — VM bridge for workflow scripts\n * - lib/node/pl-middle-layer/src/middle_layer/middle_layer.ts — ModelServiceRegistry factory\n *\n * UI side:\n * - lib/model/common/src/services/
|
|
1
|
+
{"version":3,"file":"service_declarations.cjs","names":["service"],"sources":["../../src/services/service_declarations.ts"],"sourcesContent":["/**\n * Service declarations — add new services here.\n *\n * `modelMethods` / `uiMethods` lists are the single source of truth for\n * method names exposed on each side. They drive SERVICE_METHOD_MAP (UI\n * ServiceProxy forwarders) and MODEL_SERVICE_METHOD_MAP (workflow VM\n * bridge), so node/main/wasm split no longer needs introspection stubs.\n *\n * After adding a service, fix type errors in these files:\n *\n * Model side:\n * - lib/node/pl-middle-layer/src/js_render/service_injectors.ts — VM bridge for workflow scripts\n * - lib/node/pl-middle-layer/src/middle_layer/middle_layer.ts — ModelServiceRegistry factory\n *\n * UI side:\n * - lib/model/common/src/services/node_service_handlers.ts — driver method wrappers (node services only)\n * - sdk/ui-vue/src/internal/createAppV3.ts — UiServiceRegistry factory\n *\n * Electron main side (only for `main` services):\n * - platforma-desktop-app/packages/main/src/services/mainServices.ts — main-process dispatcher\n *\n * Optional:\n * - sdk/model/src/services/block_service_flags.ts — only if default-required by all blocks\n */\n\nimport type { DialogService } from \"../dialog\";\nimport type { PFrameDriver, PFrameModelDriver } from \"../drivers/pframe/driver\";\nimport type { PFrameSpecDriver } from \"../drivers/pframe/spec_driver\";\nimport { service } from \"./service_types\";\n\nexport const Services = {\n PFrameSpec: service<PFrameSpecDriver, PFrameSpecDriver>()({\n type: \"wasm\",\n name: \"pframeSpec\",\n modelMethods: [\n \"createSpecFrame\",\n \"listColumns\",\n \"discoverColumns\",\n \"deleteColumn\",\n \"evaluateQuery\",\n \"buildQuery\",\n \"expandAxes\",\n \"collapseAxes\",\n \"findAxis\",\n \"findTableColumn\",\n ] as const,\n uiMethods: [\n \"createSpecFrame\",\n \"listColumns\",\n \"discoverColumns\",\n \"deleteColumn\",\n \"evaluateQuery\",\n \"buildQuery\",\n \"expandAxes\",\n \"collapseAxes\",\n \"findAxis\",\n \"findTableColumn\",\n ] as const,\n }),\n PFrame: service<PFrameModelDriver, PFrameDriver>()({\n type: \"node\",\n name: \"pframe\",\n modelMethods: [\"createPFrame\", \"createPTable\", \"createPTableV2\"] as const,\n uiMethods: [\n \"findColumns\",\n \"getColumnSpec\",\n \"listColumns\",\n \"calculateTableData\",\n \"getUniqueValues\",\n \"getShape\",\n \"getSpec\",\n \"getData\",\n \"writePTableToFs\",\n ] as const,\n }),\n Dialog: service<Record<string, never>, DialogService>()({\n type: \"main\",\n name: \"dialog\",\n modelMethods: [] as const,\n uiMethods: [\"showSaveDialog\"] as const,\n }),\n};\n"],"mappings":";;AA8BA,MAAa,WAAW;CACtB,YAAYA,sBAAAA,SAA6C,CAAC;EACxD,MAAM;EACN,MAAM;EACN,cAAc;GACZ;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACD;EACD,WAAW;GACT;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACD;EACF,CAAC;CACF,QAAQA,sBAAAA,SAA0C,CAAC;EACjD,MAAM;EACN,MAAM;EACN,cAAc;GAAC;GAAgB;GAAgB;GAAiB;EAChE,WAAW;GACT;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACD;EACF,CAAC;CACF,QAAQA,sBAAAA,SAA+C,CAAC;EACtD,MAAM;EACN,MAAM;EACN,cAAc,EAAE;EAChB,WAAW,CAAC,iBAAiB;EAC9B,CAAC;CACH"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Branded } from "../branding.js";
|
|
2
|
+
import { DialogService } from "../dialog/index.js";
|
|
2
3
|
import { PColumn } from "../drivers/pframe/spec/spec.js";
|
|
3
4
|
import { DataInfo, PColumnValues } from "../drivers/pframe/data_info.js";
|
|
4
5
|
import { PFrameSpecDriver } from "../drivers/pframe/spec_driver.js";
|
|
@@ -8,6 +9,7 @@ import { ServiceTypesLike } from "./service_types.js";
|
|
|
8
9
|
declare const Services: {
|
|
9
10
|
PFrameSpec: Branded<"pframeSpec", ServiceTypesLike<PFrameSpecDriver, PFrameSpecDriver, "wasm">>;
|
|
10
11
|
PFrame: Branded<"pframe", ServiceTypesLike<PFrameModelDriver<PColumn<string | PColumnValues | DataInfo<string>>>, PFrameDriver, "node">>;
|
|
12
|
+
Dialog: Branded<"dialog", ServiceTypesLike<Record<string, never>, DialogService, "main">>;
|
|
11
13
|
};
|
|
12
14
|
//#endregion
|
|
13
15
|
export { Services };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service_declarations.d.ts","names":[],"sources":["../../src/services/service_declarations.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"service_declarations.d.ts","names":[],"sources":["../../src/services/service_declarations.ts"],"mappings":";;;;;;;;cA8Ba,QAAA"}
|
|
@@ -3,11 +3,57 @@ import { service } from "./service_types.js";
|
|
|
3
3
|
const Services = {
|
|
4
4
|
PFrameSpec: service()({
|
|
5
5
|
type: "wasm",
|
|
6
|
-
name: "pframeSpec"
|
|
6
|
+
name: "pframeSpec",
|
|
7
|
+
modelMethods: [
|
|
8
|
+
"createSpecFrame",
|
|
9
|
+
"listColumns",
|
|
10
|
+
"discoverColumns",
|
|
11
|
+
"deleteColumn",
|
|
12
|
+
"evaluateQuery",
|
|
13
|
+
"buildQuery",
|
|
14
|
+
"expandAxes",
|
|
15
|
+
"collapseAxes",
|
|
16
|
+
"findAxis",
|
|
17
|
+
"findTableColumn"
|
|
18
|
+
],
|
|
19
|
+
uiMethods: [
|
|
20
|
+
"createSpecFrame",
|
|
21
|
+
"listColumns",
|
|
22
|
+
"discoverColumns",
|
|
23
|
+
"deleteColumn",
|
|
24
|
+
"evaluateQuery",
|
|
25
|
+
"buildQuery",
|
|
26
|
+
"expandAxes",
|
|
27
|
+
"collapseAxes",
|
|
28
|
+
"findAxis",
|
|
29
|
+
"findTableColumn"
|
|
30
|
+
]
|
|
7
31
|
}),
|
|
8
32
|
PFrame: service()({
|
|
9
33
|
type: "node",
|
|
10
|
-
name: "pframe"
|
|
34
|
+
name: "pframe",
|
|
35
|
+
modelMethods: [
|
|
36
|
+
"createPFrame",
|
|
37
|
+
"createPTable",
|
|
38
|
+
"createPTableV2"
|
|
39
|
+
],
|
|
40
|
+
uiMethods: [
|
|
41
|
+
"findColumns",
|
|
42
|
+
"getColumnSpec",
|
|
43
|
+
"listColumns",
|
|
44
|
+
"calculateTableData",
|
|
45
|
+
"getUniqueValues",
|
|
46
|
+
"getShape",
|
|
47
|
+
"getSpec",
|
|
48
|
+
"getData",
|
|
49
|
+
"writePTableToFs"
|
|
50
|
+
]
|
|
51
|
+
}),
|
|
52
|
+
Dialog: service()({
|
|
53
|
+
type: "main",
|
|
54
|
+
name: "dialog",
|
|
55
|
+
modelMethods: [],
|
|
56
|
+
uiMethods: ["showSaveDialog"]
|
|
11
57
|
})
|
|
12
58
|
};
|
|
13
59
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service_declarations.js","names":[],"sources":["../../src/services/service_declarations.ts"],"sourcesContent":["/**\n * Service declarations — add new services here.\n *\n * After adding a service, fix type errors in these files:\n *\n * Model side:\n * - lib/node/pl-middle-layer/src/js_render/service_injectors.ts — VM bridge for workflow scripts\n * - lib/node/pl-middle-layer/src/middle_layer/middle_layer.ts — ModelServiceRegistry factory\n *\n * UI side:\n * - lib/model/common/src/services/
|
|
1
|
+
{"version":3,"file":"service_declarations.js","names":[],"sources":["../../src/services/service_declarations.ts"],"sourcesContent":["/**\n * Service declarations — add new services here.\n *\n * `modelMethods` / `uiMethods` lists are the single source of truth for\n * method names exposed on each side. They drive SERVICE_METHOD_MAP (UI\n * ServiceProxy forwarders) and MODEL_SERVICE_METHOD_MAP (workflow VM\n * bridge), so node/main/wasm split no longer needs introspection stubs.\n *\n * After adding a service, fix type errors in these files:\n *\n * Model side:\n * - lib/node/pl-middle-layer/src/js_render/service_injectors.ts — VM bridge for workflow scripts\n * - lib/node/pl-middle-layer/src/middle_layer/middle_layer.ts — ModelServiceRegistry factory\n *\n * UI side:\n * - lib/model/common/src/services/node_service_handlers.ts — driver method wrappers (node services only)\n * - sdk/ui-vue/src/internal/createAppV3.ts — UiServiceRegistry factory\n *\n * Electron main side (only for `main` services):\n * - platforma-desktop-app/packages/main/src/services/mainServices.ts — main-process dispatcher\n *\n * Optional:\n * - sdk/model/src/services/block_service_flags.ts — only if default-required by all blocks\n */\n\nimport type { DialogService } from \"../dialog\";\nimport type { PFrameDriver, PFrameModelDriver } from \"../drivers/pframe/driver\";\nimport type { PFrameSpecDriver } from \"../drivers/pframe/spec_driver\";\nimport { service } from \"./service_types\";\n\nexport const Services = {\n PFrameSpec: service<PFrameSpecDriver, PFrameSpecDriver>()({\n type: \"wasm\",\n name: \"pframeSpec\",\n modelMethods: [\n \"createSpecFrame\",\n \"listColumns\",\n \"discoverColumns\",\n \"deleteColumn\",\n \"evaluateQuery\",\n \"buildQuery\",\n \"expandAxes\",\n \"collapseAxes\",\n \"findAxis\",\n \"findTableColumn\",\n ] as const,\n uiMethods: [\n \"createSpecFrame\",\n \"listColumns\",\n \"discoverColumns\",\n \"deleteColumn\",\n \"evaluateQuery\",\n \"buildQuery\",\n \"expandAxes\",\n \"collapseAxes\",\n \"findAxis\",\n \"findTableColumn\",\n ] as const,\n }),\n PFrame: service<PFrameModelDriver, PFrameDriver>()({\n type: \"node\",\n name: \"pframe\",\n modelMethods: [\"createPFrame\", \"createPTable\", \"createPTableV2\"] as const,\n uiMethods: [\n \"findColumns\",\n \"getColumnSpec\",\n \"listColumns\",\n \"calculateTableData\",\n \"getUniqueValues\",\n \"getShape\",\n \"getSpec\",\n \"getData\",\n \"writePTableToFs\",\n ] as const,\n }),\n Dialog: service<Record<string, never>, DialogService>()({\n type: \"main\",\n name: \"dialog\",\n modelMethods: [] as const,\n uiMethods: [\"showSaveDialog\"] as const,\n }),\n};\n"],"mappings":";;AA8BA,MAAa,WAAW;CACtB,YAAY,SAA6C,CAAC;EACxD,MAAM;EACN,MAAM;EACN,cAAc;GACZ;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACD;EACD,WAAW;GACT;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACD;EACF,CAAC;CACF,QAAQ,SAA0C,CAAC;EACjD,MAAM;EACN,MAAM;EACN,cAAc;GAAC;GAAgB;GAAgB;GAAiB;EAChE,WAAW;GACT;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACD;EACF,CAAC;CACF,QAAQ,SAA+C,CAAC;EACtD,MAAM;EACN,MAAM;EACN,cAAc,EAAE;EAChB,WAAW,CAAC,iBAAiB;EAC9B,CAAC;CACH"}
|
|
@@ -1,47 +1,51 @@
|
|
|
1
|
+
const require_service_types = require("./service_types.cjs");
|
|
1
2
|
const require_service_declarations = require("./service_declarations.cjs");
|
|
2
3
|
const require_service_capabilities = require("./service_capabilities.cjs");
|
|
3
|
-
const
|
|
4
|
+
const require_node_service_handlers = require("./node_service_handlers.cjs");
|
|
4
5
|
//#region src/services/service_injectors.ts
|
|
5
6
|
let cachedKit;
|
|
6
|
-
let
|
|
7
|
-
function
|
|
8
|
-
if (!
|
|
7
|
+
let cachedHandlers;
|
|
8
|
+
function getOrCreateHandlers(driverKit) {
|
|
9
|
+
if (!cachedHandlers || cachedKit !== driverKit) {
|
|
9
10
|
cachedKit = driverKit;
|
|
10
|
-
|
|
11
|
+
cachedHandlers = require_node_service_handlers.createNodeServiceHandlers(driverKit);
|
|
11
12
|
}
|
|
12
|
-
return
|
|
13
|
+
return cachedHandlers;
|
|
13
14
|
}
|
|
14
|
-
/**
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
/**
|
|
16
|
+
* Resolve the worker-side handler object for a given service ID. Caches
|
|
17
|
+
* per DriverKit reference. Called from the worker's IPC dispatch path.
|
|
18
|
+
*/
|
|
19
|
+
function resolveNodeServiceHandler(driverKit, serviceId) {
|
|
20
|
+
const handlers = getOrCreateHandlers(driverKit);
|
|
17
21
|
const key = Object.keys(require_service_declarations.Services).find((k) => require_service_declarations.Services[k] === serviceId);
|
|
18
22
|
if (!key) return null;
|
|
19
|
-
return
|
|
23
|
+
return handlers[key];
|
|
20
24
|
}
|
|
21
|
-
|
|
22
|
-
* Static map of ServiceName → method names, auto-derived from the injector shape.
|
|
23
|
-
* Computed once at module load. The stub DriverKit is never called — it only
|
|
24
|
-
* provides a target so the closures in createUiServiceInjectors have own-property
|
|
25
|
-
* keys that getMethodNames can introspect.
|
|
26
|
-
*/
|
|
27
|
-
const SERVICE_METHOD_MAP = (() => {
|
|
28
|
-
const injectors = require_service_injector_factory.createUiServiceInjectors(new Proxy({}, { get: () => new Proxy({}, { get: () => () => {} }) }));
|
|
25
|
+
function buildMethodMap(pick) {
|
|
29
26
|
const result = {};
|
|
30
|
-
for (const
|
|
31
|
-
const serviceId = require_service_declarations.Services[key];
|
|
32
|
-
const injector = injectors[key];
|
|
33
|
-
result[serviceId] = injector ? require_service_capabilities.getMethodNames(injector) : [];
|
|
34
|
-
}
|
|
27
|
+
for (const id of Object.values(require_service_declarations.Services)) result[id] = [...pick(id)];
|
|
35
28
|
return result;
|
|
36
|
-
}
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* UI-side method names per service. Drives ServiceProxy forwarder
|
|
32
|
+
* construction in the renderer.
|
|
33
|
+
*/
|
|
34
|
+
const SERVICE_METHOD_MAP = buildMethodMap(require_service_types.getServiceUiMethods);
|
|
35
|
+
/**
|
|
36
|
+
* Model-side method names per service. Drives the workflow VM bridge
|
|
37
|
+
* (see pl-middle-layer js_render).
|
|
38
|
+
*/
|
|
39
|
+
const MODEL_SERVICE_METHOD_MAP = buildMethodMap(require_service_types.getServiceModelMethods);
|
|
37
40
|
/** Build service info for a block from its feature flags. */
|
|
38
41
|
function buildServiceInfo(featureFlags) {
|
|
39
42
|
const serviceIds = require_service_capabilities.resolveRequiredServices(featureFlags);
|
|
40
43
|
return Object.fromEntries(serviceIds.map((id) => [id, SERVICE_METHOD_MAP[id] ?? []]));
|
|
41
44
|
}
|
|
42
45
|
//#endregion
|
|
46
|
+
exports.MODEL_SERVICE_METHOD_MAP = MODEL_SERVICE_METHOD_MAP;
|
|
43
47
|
exports.SERVICE_METHOD_MAP = SERVICE_METHOD_MAP;
|
|
44
48
|
exports.buildServiceInfo = buildServiceInfo;
|
|
45
|
-
exports.
|
|
49
|
+
exports.resolveNodeServiceHandler = resolveNodeServiceHandler;
|
|
46
50
|
|
|
47
51
|
//# sourceMappingURL=service_injectors.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service_injectors.cjs","names":["
|
|
1
|
+
{"version":3,"file":"service_injectors.cjs","names":["createNodeServiceHandlers","Services","getServiceUiMethods","getServiceModelMethods","resolveRequiredServices"],"sources":["../../src/services/service_injectors.ts"],"sourcesContent":["/**\n * Service dispatch glue — auto-derived types, method maps, and service info builder.\n *\n * The worker-side handler factory (createNodeServiceHandlers) lives in\n * node_service_handlers.ts — that's the only file to edit when adding a\n * new node service. Method-name registries for UI and model sides are\n * derived directly from the `uiMethods` / `modelMethods` declarations in\n * service_declarations.ts — no factory introspection, no stubs.\n */\n\nimport type { InferServiceKind, InferServiceUi, ServiceBrand, ServiceName } from \"./service_types\";\nimport type { DriverKit } from \"../driver_kit\";\nimport { Services } from \"./service_declarations\";\nimport { getServiceModelMethods, getServiceUiMethods } from \"./service_types\";\nimport { resolveRequiredServices } from \"./service_capabilities\";\nimport { createNodeServiceHandlers } from \"./node_service_handlers\";\n\nexport { createNodeServiceHandlers } from \"./node_service_handlers\";\n\ntype NodeServiceKeys = {\n [K in keyof typeof Services]: InferServiceKind<ServiceBrand<(typeof Services)[K]>> extends \"node\"\n ? K\n : never;\n}[keyof typeof Services];\n\n/**\n * Auto-derived map of node service keys to their UI-facing interfaces.\n * Fulfilled by real driver wrappers in the worker. Main services are\n * dispatched by the Electron main-process router and never reach this\n * map; wasm services are instantiated locally on each consumer.\n */\nexport type NodeServiceHandlerMap = {\n [K in NodeServiceKeys]: InferServiceUi<ServiceBrand<(typeof Services)[K]>>;\n};\n\nlet cachedKit: DriverKit | undefined;\nlet cachedHandlers: NodeServiceHandlerMap | undefined;\n\nfunction getOrCreateHandlers(driverKit: DriverKit): NodeServiceHandlerMap {\n if (!cachedHandlers || cachedKit !== driverKit) {\n cachedKit = driverKit;\n cachedHandlers = createNodeServiceHandlers(driverKit);\n }\n return cachedHandlers;\n}\n\n/**\n * Resolve the worker-side handler object for a given service ID. Caches\n * per DriverKit reference. Called from the worker's IPC dispatch path.\n */\nexport function resolveNodeServiceHandler(\n driverKit: DriverKit,\n serviceId: ServiceName,\n): NodeServiceHandlerMap[keyof NodeServiceHandlerMap] | null {\n const handlers = getOrCreateHandlers(driverKit);\n const key = Object.keys(Services).find(\n (k) => Services[k as keyof typeof Services] === serviceId,\n ) as NodeServiceKeys | undefined;\n if (!key) return null;\n return handlers[key];\n}\n\nfunction buildMethodMap(\n pick: (id: ServiceName) => readonly string[],\n): Readonly<Record<string, string[]>> {\n const result: Record<string, string[]> = {};\n for (const id of Object.values(Services)) {\n result[id as string] = [...pick(id)];\n }\n return result;\n}\n\n/**\n * UI-side method names per service. Drives ServiceProxy forwarder\n * construction in the renderer.\n */\nexport const SERVICE_METHOD_MAP: Readonly<Record<string, string[]>> =\n buildMethodMap(getServiceUiMethods);\n\n/**\n * Model-side method names per service. Drives the workflow VM bridge\n * (see pl-middle-layer js_render).\n */\nexport const MODEL_SERVICE_METHOD_MAP: Readonly<Record<string, string[]>> =\n buildMethodMap(getServiceModelMethods);\n\n/** Build service info for a block from its feature flags. */\nexport function buildServiceInfo(\n featureFlags: Record<string, unknown>,\n): Record<ServiceName, string[]> {\n const serviceIds = resolveRequiredServices(featureFlags);\n return Object.fromEntries(\n serviceIds.map((id) => [id, SERVICE_METHOD_MAP[id as string] ?? []]),\n ) as Record<ServiceName, string[]>;\n}\n"],"mappings":";;;;;AAmCA,IAAI;AACJ,IAAI;AAEJ,SAAS,oBAAoB,WAA6C;AACxE,KAAI,CAAC,kBAAkB,cAAc,WAAW;AAC9C,cAAY;AACZ,mBAAiBA,8BAAAA,0BAA0B,UAAU;;AAEvD,QAAO;;;;;;AAOT,SAAgB,0BACd,WACA,WAC2D;CAC3D,MAAM,WAAW,oBAAoB,UAAU;CAC/C,MAAM,MAAM,OAAO,KAAKC,6BAAAA,SAAS,CAAC,MAC/B,MAAMA,6BAAAA,SAAS,OAAgC,UACjD;AACD,KAAI,CAAC,IAAK,QAAO;AACjB,QAAO,SAAS;;AAGlB,SAAS,eACP,MACoC;CACpC,MAAM,SAAmC,EAAE;AAC3C,MAAK,MAAM,MAAM,OAAO,OAAOA,6BAAAA,SAAS,CACtC,QAAO,MAAgB,CAAC,GAAG,KAAK,GAAG,CAAC;AAEtC,QAAO;;;;;;AAOT,MAAa,qBACX,eAAeC,sBAAAA,oBAAoB;;;;;AAMrC,MAAa,2BACX,eAAeC,sBAAAA,uBAAuB;;AAGxC,SAAgB,iBACd,cAC+B;CAC/B,MAAM,aAAaC,6BAAAA,wBAAwB,aAAa;AACxD,QAAO,OAAO,YACZ,WAAW,KAAK,OAAO,CAAC,IAAI,mBAAmB,OAAiB,EAAE,CAAC,CAAC,CACrE"}
|
|
@@ -1,23 +1,34 @@
|
|
|
1
1
|
import { Services } from "./service_declarations.js";
|
|
2
2
|
import { InferServiceKind, InferServiceUi, ServiceBrand, ServiceName } from "./service_types.js";
|
|
3
3
|
import { DriverKit } from "../driver_kit.js";
|
|
4
|
-
import {
|
|
4
|
+
import { createNodeServiceHandlers } from "./node_service_handlers.js";
|
|
5
5
|
|
|
6
6
|
//#region src/services/service_injectors.d.ts
|
|
7
7
|
type NodeServiceKeys = { [K in keyof typeof Services]: InferServiceKind<ServiceBrand<(typeof Services)[K]>> extends "node" ? K : never }[keyof typeof Services];
|
|
8
|
-
/** Auto-derived map of node service keys to their UI-side driver interfaces. */
|
|
9
|
-
type UiServiceInjectorMap = { [K in NodeServiceKeys]: InferServiceUi<ServiceBrand<(typeof Services)[K]>> };
|
|
10
|
-
/** Resolve the injector for a given service ID. Caches injectors per DriverKit reference. */
|
|
11
|
-
declare function resolveUiInjector(driverKit: DriverKit, serviceId: ServiceName): UiServiceInjectorMap[keyof UiServiceInjectorMap] | null;
|
|
12
8
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
9
|
+
* Auto-derived map of node service keys to their UI-facing interfaces.
|
|
10
|
+
* Fulfilled by real driver wrappers in the worker. Main services are
|
|
11
|
+
* dispatched by the Electron main-process router and never reach this
|
|
12
|
+
* map; wasm services are instantiated locally on each consumer.
|
|
13
|
+
*/
|
|
14
|
+
type NodeServiceHandlerMap = { [K in NodeServiceKeys]: InferServiceUi<ServiceBrand<(typeof Services)[K]>> };
|
|
15
|
+
/**
|
|
16
|
+
* Resolve the worker-side handler object for a given service ID. Caches
|
|
17
|
+
* per DriverKit reference. Called from the worker's IPC dispatch path.
|
|
18
|
+
*/
|
|
19
|
+
declare function resolveNodeServiceHandler(driverKit: DriverKit, serviceId: ServiceName): NodeServiceHandlerMap[keyof NodeServiceHandlerMap] | null;
|
|
20
|
+
/**
|
|
21
|
+
* UI-side method names per service. Drives ServiceProxy forwarder
|
|
22
|
+
* construction in the renderer.
|
|
17
23
|
*/
|
|
18
24
|
declare const SERVICE_METHOD_MAP: Readonly<Record<string, string[]>>;
|
|
25
|
+
/**
|
|
26
|
+
* Model-side method names per service. Drives the workflow VM bridge
|
|
27
|
+
* (see pl-middle-layer js_render).
|
|
28
|
+
*/
|
|
29
|
+
declare const MODEL_SERVICE_METHOD_MAP: Readonly<Record<string, string[]>>;
|
|
19
30
|
/** Build service info for a block from its feature flags. */
|
|
20
31
|
declare function buildServiceInfo(featureFlags: Record<string, unknown>): Record<ServiceName, string[]>;
|
|
21
32
|
//#endregion
|
|
22
|
-
export {
|
|
33
|
+
export { MODEL_SERVICE_METHOD_MAP, NodeServiceHandlerMap, SERVICE_METHOD_MAP, buildServiceInfo, resolveNodeServiceHandler };
|
|
23
34
|
//# sourceMappingURL=service_injectors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service_injectors.d.ts","names":[],"sources":["../../src/services/service_injectors.ts"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"service_injectors.d.ts","names":[],"sources":["../../src/services/service_injectors.ts"],"mappings":";;;;;;KAmBK,eAAA,wBACgB,QAAA,GAAW,gBAAA,CAAiB,YAAA,SAAqB,QAAA,EAAU,CAAA,qBAC1E,CAAA,wBAES,QAAA;;;;;;;KAQH,qBAAA,WACJ,eAAA,GAAkB,cAAA,CAAe,YAAA,SAAqB,QAAA,EAAU,CAAA;;;;AADxE;iBAmBgB,yBAAA,CACd,SAAA,EAAW,SAAA,EACX,SAAA,EAAW,WAAA,GACV,qBAAA,OAA4B,qBAAA;;;;;cAuBlB,kBAAA,EAAoB,QAAA,CAAS,MAAA;;;;;cAO7B,wBAAA,EAA0B,QAAA,CAAS,MAAA;;iBAIhC,gBAAA,CACd,YAAA,EAAc,MAAA,oBACb,MAAA,CAAO,WAAA"}
|