@milaboratories/pl-model-backend 1.3.5 → 1.4.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.
package/dist/index.cjs CHANGED
@@ -28,6 +28,12 @@ Object.defineProperty(exports, "PlTemplateV1", {
28
28
  return require_template_resources_v1.PlTemplateV1;
29
29
  }
30
30
  });
31
+ Object.defineProperty(exports, "PlWasmV1", {
32
+ enumerable: true,
33
+ get: function() {
34
+ return require_template_resources_v1.PlWasmV1;
35
+ }
36
+ });
31
37
  Object.defineProperty(exports, "hasCapability", {
32
38
  enumerable: true,
33
39
  get: function() {
package/dist/index.d.ts CHANGED
@@ -2,5 +2,5 @@ import { BackendCapability, hasCapability } from "./capabilities.js";
2
2
  import { TemplateAssetData, TemplateData, TemplateLibData, TemplateSoftwareData } from "./template_data_v2.js";
3
3
  import { CompiledTemplateV3, TemplateAssetDataV3, TemplateDataV3, TemplateLibDataV3, TemplateSoftwareDataV3, TemplateWasmDataV3 } from "./template_data_v3.js";
4
4
  import { parseTemplate, serializeTemplate } from "./serde.js";
5
- import { PlTemplateLibV1, PlTemplateOverrideV1, PlTemplateSoftwareV1, PlTemplateV1 } from "./template_resources_v1.js";
6
- export { BackendCapability, CompiledTemplateV3, PlTemplateLibV1, PlTemplateOverrideV1, PlTemplateSoftwareV1, PlTemplateV1, TemplateAssetData, TemplateAssetDataV3, TemplateData, TemplateDataV3, TemplateLibData, TemplateLibDataV3, TemplateSoftwareData, TemplateSoftwareDataV3, TemplateWasmDataV3, hasCapability, parseTemplate, serializeTemplate };
5
+ import { PlTemplateLibV1, PlTemplateOverrideV1, PlTemplateSoftwareV1, PlTemplateV1, PlWasmV1 } from "./template_resources_v1.js";
6
+ export { BackendCapability, CompiledTemplateV3, PlTemplateLibV1, PlTemplateOverrideV1, PlTemplateSoftwareV1, PlTemplateV1, PlWasmV1, TemplateAssetData, TemplateAssetDataV3, TemplateData, TemplateDataV3, TemplateLibData, TemplateLibDataV3, TemplateSoftwareData, TemplateSoftwareDataV3, TemplateWasmDataV3, hasCapability, parseTemplate, serializeTemplate };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
1
  import { hasCapability } from "./capabilities.js";
2
2
  import { parseTemplate, serializeTemplate } from "./serde.js";
3
- import { PlTemplateLibV1, PlTemplateOverrideV1, PlTemplateSoftwareV1, PlTemplateV1 } from "./template_resources_v1.js";
4
- export { PlTemplateLibV1, PlTemplateOverrideV1, PlTemplateSoftwareV1, PlTemplateV1, hasCapability, parseTemplate, serializeTemplate };
3
+ import { PlTemplateLibV1, PlTemplateOverrideV1, PlTemplateSoftwareV1, PlTemplateV1, PlWasmV1 } from "./template_resources_v1.js";
4
+ export { PlTemplateLibV1, PlTemplateOverrideV1, PlTemplateSoftwareV1, PlTemplateV1, PlWasmV1, hasCapability, parseTemplate, serializeTemplate };
@@ -52,6 +52,7 @@ let PlTemplateV1;
52
52
  const libPrefix = _PlTemplateV.libPrefix = "lib";
53
53
  const softPrefix = _PlTemplateV.softPrefix = "soft";
54
54
  const tplPrefix = _PlTemplateV.tplPrefix = "tpl";
55
+ const wasmPrefix = _PlTemplateV.wasmPrefix = "wasm";
55
56
  function libField(ref, libId) {
56
57
  return (0, _milaboratories_pl_client.field)(ref, `${libPrefix}/${libId}`);
57
58
  }
@@ -64,6 +65,10 @@ let PlTemplateV1;
64
65
  return (0, _milaboratories_pl_client.field)(ref, `${softPrefix}/${softwareId}`);
65
66
  }
66
67
  _PlTemplateV.swField = swField;
68
+ function wasmField(ref, alias) {
69
+ return (0, _milaboratories_pl_client.field)(ref, `${wasmPrefix}/${alias}`);
70
+ }
71
+ _PlTemplateV.wasmField = wasmField;
67
72
  function fromV2Data(info) {
68
73
  return { data: {
69
74
  Name: info.name,
@@ -81,6 +86,22 @@ let PlTemplateV1;
81
86
  }
82
87
  _PlTemplateV.fromV3Data = fromV3Data;
83
88
  })(PlTemplateV1 || (PlTemplateV1 = {}));
89
+ let PlWasmV1;
90
+ (function(_PlWasmV) {
91
+ _PlWasmV.type = (0, _milaboratories_pl_client.resourceType)("Wasm", "1");
92
+ const runtimeWasiP2 = _PlWasmV.runtimeWasiP2 = "wasi-p2";
93
+ const defaultMemoryLimit = _PlWasmV.defaultMemoryLimit = 32 * 1024 * 1024;
94
+ function fromV3Data(info, base64Source) {
95
+ return { data: {
96
+ Name: info.name,
97
+ Version: info.version,
98
+ Runtime: runtimeWasiP2,
99
+ Code: base64Source,
100
+ DefaultMemoryLimit: defaultMemoryLimit
101
+ } };
102
+ }
103
+ _PlWasmV.fromV3Data = fromV3Data;
104
+ })(PlWasmV1 || (PlWasmV1 = {}));
84
105
  let PlTemplateOverrideV1;
85
106
  (function(_PlTemplateOverrideV) {
86
107
  _PlTemplateOverrideV.type = (0, _milaboratories_pl_client.resourceType)("TengoTemplateOverride", "1");
@@ -124,5 +145,11 @@ Object.defineProperty(exports, "PlTemplateV1", {
124
145
  return PlTemplateV1;
125
146
  }
126
147
  });
148
+ Object.defineProperty(exports, "PlWasmV1", {
149
+ enumerable: true,
150
+ get: function() {
151
+ return PlWasmV1;
152
+ }
153
+ });
127
154
 
128
155
  //# sourceMappingURL=template_resources_v1.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"template_resources_v1.cjs","names":[],"sources":["../src/template_resources_v1.ts"],"sourcesContent":["import type { AnyFieldRef, AnyResourceRef } from \"@milaboratories/pl-client\";\nimport { field, resourceType } from \"@milaboratories/pl-client\";\nimport type * as infoV2 from \"./template_data_v2\";\nimport type * as infoV3 from \"./template_data_v3\";\nexport namespace PlTemplateLibV1 {\n export const type = resourceType(\"TengoLib\", \"1\");\n\n export type ResourceStructure = {\n data: Data;\n };\n\n export type Data = {\n /** i.e. @milaboratory/some-package:lib1 */\n Name: string;\n /** i.e. 1.2.3 */\n Version: string;\n /** Full source code encoded with Base64 */\n Code: string;\n };\n\n export function fromV2Data(info: infoV2.TemplateLibData): ResourceStructure {\n return {\n data: {\n Name: info.name,\n Version: info.version,\n Code: Buffer.from(info.src, \"utf8\").toString(\"base64\"),\n },\n };\n }\n\n export function fromV3Data(\n info: infoV3.TemplateLibDataV3,\n sourceCode: string,\n ): ResourceStructure {\n return {\n data: {\n Name: info.name,\n Version: info.version,\n Code: Buffer.from(sourceCode, \"utf8\").toString(\"base64\"),\n },\n };\n }\n}\n\nexport namespace PlTemplateSoftwareV1 {\n export const type = resourceType(\"SoftwareInfo\", \"1\");\n\n export type ResourceStructure = {\n data: Data;\n name: MetaName;\n };\n\n /** Raw entrypoint descriptor encoded with Base64 */\n export type Data = string;\n\n export const metaNameKey = \"ctl/runner/package/name\";\n export type MetaName = {\n /** i.e. @milaboratory/some-package:sw1 */\n Name: string;\n /** i.e. 1.2.3 */\n Version: string;\n };\n\n export function fromV2Data(\n info: infoV2.TemplateSoftwareData | infoV2.TemplateAssetData,\n ): ResourceStructure {\n return {\n data: info.src,\n name: {\n Name: info.name,\n Version: info.version,\n },\n };\n }\n\n export function fromV3Data(\n info: infoV3.TemplateSoftwareDataV3,\n sourceCode: string,\n ): ResourceStructure {\n return {\n data: sourceCode,\n name: {\n Name: info.name,\n Version: info.version,\n },\n };\n }\n}\n\nexport namespace PlTemplateV1 {\n export const type = resourceType(\"TengoTemplate\", \"1\");\n\n export type ResourceStructure = {\n data: Data;\n };\n\n export const libPrefix = \"lib\";\n export const softPrefix = \"soft\";\n export const tplPrefix = \"tpl\";\n\n export function libField(ref: AnyResourceRef, libId: string): AnyFieldRef {\n return field(ref, `${libPrefix}/${libId}`);\n }\n export function tplField(ref: AnyResourceRef, tplId: string): AnyFieldRef {\n return field(ref, `${tplPrefix}/${tplId}`);\n }\n export function swField(ref: AnyResourceRef, softwareId: string): AnyFieldRef {\n return field(ref, `${softPrefix}/${softwareId}`);\n }\n\n export type Data = {\n /** i.e. @milaboratory/some-package:tpl1 */\n Name: string;\n /** i.e. 1.2.3 */\n Version: string;\n /** Full source code encoded with Base64 */\n Code: string;\n };\n\n export function fromV2Data(info: infoV2.TemplateData): ResourceStructure {\n return {\n data: {\n Name: info.name,\n Version: info.version,\n Code: Buffer.from(info.src, \"utf8\").toString(\"base64\"),\n },\n };\n }\n\n export function fromV3Data(info: infoV3.TemplateDataV3, sourceCode: string): ResourceStructure {\n return {\n data: {\n Name: info.name,\n Version: info.version,\n Code: Buffer.from(sourceCode, \"utf8\").toString(\"base64\"),\n },\n };\n }\n}\n\nexport namespace PlTemplateOverrideV1 {\n export const type = resourceType(\"TengoTemplateOverride\", \"1\");\n\n export type ResourceStructure = {\n data: Data;\n };\n\n export function tplField(ref: AnyResourceRef): AnyFieldRef {\n return field(ref, \"tpl\");\n }\n\n export type Data = {\n OverrideUUID: string;\n };\n\n export function fromV2Data(info: infoV2.TemplateData): ResourceStructure {\n if (!info.hashOverride) {\n throw new Error(\n `template tree rendering error: template has no hash override, cannot generate PlTemplateOverrideV1.ResourceStructure from template data`,\n );\n }\n\n return {\n data: {\n OverrideUUID: info.hashOverride,\n },\n };\n }\n\n export function fromV3Data(info: infoV3.TemplateDataV3): ResourceStructure {\n if (!info.hashOverride) {\n throw new Error(\n `template tree rendering error: template has no hash override, cannot generate PlTemplateOverrideV1.ResourceStructure from template data`,\n );\n }\n\n return {\n data: {\n OverrideUUID: info.hashOverride,\n },\n };\n }\n}\n"],"mappings":";;;AAIO,IAAA;;oEAC4B,YAAY,IAAI;CAe1C,SAAS,WAAW,MAAiD;AAC1E,SAAO,EACL,MAAM;GACJ,MAAM,KAAK;GACX,SAAS,KAAK;GACd,MAAM,OAAO,KAAK,KAAK,KAAK,OAAO,CAAC,SAAS,SAAS;GACvD,EACF;;;CAGI,SAAS,WACd,MACA,YACmB;AACnB,SAAO,EACL,MAAM;GACJ,MAAM,KAAK;GACX,SAAS,KAAK;GACd,MAAM,OAAO,KAAK,YAAY,OAAO,CAAC,SAAS,SAAS;GACzD,EACF;;;6CAEJ;AAEM,IAAA;;yEAC4B,gBAAgB,IAAI;oCAU1B;CAQpB,SAAS,WACd,MACmB;AACnB,SAAO;GACL,MAAM,KA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,0IACD;AAGH,SAAO,EACL,MAAM,EACJ,cAAc,KAAK,cACpB,EACF;;;uDAEJ"}
1
+ {"version":3,"file":"template_resources_v1.cjs","names":[],"sources":["../src/template_resources_v1.ts"],"sourcesContent":["import type { AnyFieldRef, AnyResourceRef } from \"@milaboratories/pl-client\";\nimport { field, resourceType } from \"@milaboratories/pl-client\";\nimport type * as infoV2 from \"./template_data_v2\";\nimport type * as infoV3 from \"./template_data_v3\";\nexport namespace PlTemplateLibV1 {\n export const type = resourceType(\"TengoLib\", \"1\");\n\n export type ResourceStructure = {\n data: Data;\n };\n\n export type Data = {\n /** i.e. @milaboratory/some-package:lib1 */\n Name: string;\n /** i.e. 1.2.3 */\n Version: string;\n /** Full source code encoded with Base64 */\n Code: string;\n };\n\n export function fromV2Data(info: infoV2.TemplateLibData): ResourceStructure {\n return {\n data: {\n Name: info.name,\n Version: info.version,\n Code: Buffer.from(info.src, \"utf8\").toString(\"base64\"),\n },\n };\n }\n\n export function fromV3Data(\n info: infoV3.TemplateLibDataV3,\n sourceCode: string,\n ): ResourceStructure {\n return {\n data: {\n Name: info.name,\n Version: info.version,\n Code: Buffer.from(sourceCode, \"utf8\").toString(\"base64\"),\n },\n };\n }\n}\n\nexport namespace PlTemplateSoftwareV1 {\n export const type = resourceType(\"SoftwareInfo\", \"1\");\n\n export type ResourceStructure = {\n data: Data;\n name: MetaName;\n };\n\n /** Raw entrypoint descriptor encoded with Base64 */\n export type Data = string;\n\n export const metaNameKey = \"ctl/runner/package/name\";\n export type MetaName = {\n /** i.e. @milaboratory/some-package:sw1 */\n Name: string;\n /** i.e. 1.2.3 */\n Version: string;\n };\n\n export function fromV2Data(\n info: infoV2.TemplateSoftwareData | infoV2.TemplateAssetData,\n ): ResourceStructure {\n return {\n data: info.src,\n name: {\n Name: info.name,\n Version: info.version,\n },\n };\n }\n\n export function fromV3Data(\n info: infoV3.TemplateSoftwareDataV3,\n sourceCode: string,\n ): ResourceStructure {\n return {\n data: sourceCode,\n name: {\n Name: info.name,\n Version: info.version,\n },\n };\n }\n}\n\nexport namespace PlTemplateV1 {\n export const type = resourceType(\"TengoTemplate\", \"1\");\n\n export type ResourceStructure = {\n data: Data;\n };\n\n export const libPrefix = \"lib\";\n export const softPrefix = \"soft\";\n export const tplPrefix = \"tpl\";\n // Must match TengoTemplateFieldWasmPrefix in\n // core/pl/controllers/shared/resources/template_tengo.go.\n export const wasmPrefix = \"wasm\";\n\n export function libField(ref: AnyResourceRef, libId: string): AnyFieldRef {\n return field(ref, `${libPrefix}/${libId}`);\n }\n export function tplField(ref: AnyResourceRef, tplId: string): AnyFieldRef {\n return field(ref, `${tplPrefix}/${tplId}`);\n }\n export function swField(ref: AnyResourceRef, softwareId: string): AnyFieldRef {\n return field(ref, `${softPrefix}/${softwareId}`);\n }\n export function wasmField(ref: AnyResourceRef, alias: string): AnyFieldRef {\n return field(ref, `${wasmPrefix}/${alias}`);\n }\n\n export type Data = {\n /** i.e. @milaboratory/some-package:tpl1 */\n Name: string;\n /** i.e. 1.2.3 */\n Version: string;\n /** Full source code encoded with Base64 */\n Code: string;\n };\n\n export function fromV2Data(info: infoV2.TemplateData): ResourceStructure {\n return {\n data: {\n Name: info.name,\n Version: info.version,\n Code: Buffer.from(info.src, \"utf8\").toString(\"base64\"),\n },\n };\n }\n\n export function fromV3Data(info: infoV3.TemplateDataV3, sourceCode: string): ResourceStructure {\n return {\n data: {\n Name: info.name,\n Version: info.version,\n Code: Buffer.from(sourceCode, \"utf8\").toString(\"base64\"),\n },\n };\n }\n}\n\nexport namespace PlWasmV1 {\n export const type = resourceType(\"Wasm\", \"1\");\n\n // Must match controllers/shared/resources/wasm.go : WasmRuntimeWasiP2.\n export const runtimeWasiP2 = \"wasi-p2\";\n\n // Default per-instance memory cap stamped at resource creation time when\n // the template doesn't carry an explicit value. Mirrors the production\n // controller default at core/pl/controllers/workflow/internal/tplctl/\n // handle_template_pack_convert.go : defaultWasmMemoryLimit (32 MiB).\n export const defaultMemoryLimit = 32 * 1024 * 1024;\n\n export type ResourceStructure = {\n data: Data;\n };\n\n // Field names match the WasmV1Data struct in\n // core/pl/controllers/shared/resources/wasm.go. Default Go JSON\n // capitalisation — keep PascalCase.\n export type Data = {\n Name: string;\n Version: string;\n Runtime: string;\n /** Raw wasm component bytes, base64-encoded for JSON transport. */\n Code: string;\n DefaultMemoryLimit: number;\n };\n\n export function fromV3Data(\n info: infoV3.TemplateWasmDataV3,\n base64Source: string,\n ): ResourceStructure {\n return {\n data: {\n Name: info.name,\n Version: info.version,\n Runtime: runtimeWasiP2,\n // Wasm sources in CompiledTemplateV3.hashToSource are already\n // base64-encoded by tengo-builder (see addWasmFile in\n // tools/tengo-builder/src/compiler/main.ts).\n Code: base64Source,\n DefaultMemoryLimit: defaultMemoryLimit,\n },\n };\n }\n}\n\nexport namespace PlTemplateOverrideV1 {\n export const type = resourceType(\"TengoTemplateOverride\", \"1\");\n\n export type ResourceStructure = {\n data: Data;\n };\n\n export function tplField(ref: AnyResourceRef): AnyFieldRef {\n return field(ref, \"tpl\");\n }\n\n export type Data = {\n OverrideUUID: string;\n };\n\n export function fromV2Data(info: infoV2.TemplateData): ResourceStructure {\n if (!info.hashOverride) {\n throw new Error(\n `template tree rendering error: template has no hash override, cannot generate PlTemplateOverrideV1.ResourceStructure from template data`,\n );\n }\n\n return {\n data: {\n OverrideUUID: info.hashOverride,\n },\n };\n }\n\n export function fromV3Data(info: infoV3.TemplateDataV3): ResourceStructure {\n if (!info.hashOverride) {\n throw new Error(\n `template tree rendering error: template has no hash override, cannot generate PlTemplateOverrideV1.ResourceStructure from template data`,\n );\n }\n\n return {\n data: {\n OverrideUUID: info.hashOverride,\n },\n };\n }\n}\n"],"mappings":";;;AAIO,IAAA;;oEAC4B,YAAY,IAAI;CAe1C,SAAS,WAAW,MAAiD;AAC1E,SAAO,EACL,MAAM;GACJ,MAAM,KAAK;GACX,SAAS,KAAK;GACd,MAAM,OAAO,KAAK,KAAK,KAAK,OAAO,CAAC,SAAS,SAAS;GAC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AAS,KAAK;GACd,MAAM,OAAO,KAAK,YAAY,OAAO,CAAC,SAAS,SAAS;GACzD,EACF;;;uCAEJ;AAEM,IAAA;;6DAC4B,QAAQ,IAAI;CAGtC,MAAM,gBAAA,SAAA,gBAAgB;CAMtB,MAAM,qBAAA,SAAA,qBAAqB,KAAK,OAAO;CAkBvC,SAAS,WACd,MACA,cACmB;AACnB,SAAO,EACL,MAAM;GACJ,MAAM,KAAK;GACX,SAAS,KAAK;GACd,SAAS;GAIT,MAAM;GACN,oBAAoB;GACrB,EACF;;;+BAEJ;AAEM,IAAA;;yEAC4B,yBAAyB,IAAI;CAMvD,SAAS,SAAS,KAAkC;AACzD,UAAA,GAAA,0BAAA,OAAa,KAAK,MAAM;;;CAOnB,SAAS,WAAW,MAA8C;AACvE,MAAI,CAAC,KAAK,aACR,OAAM,IAAI,MACR,0IACD;AAGH,SAAO,EACL,MAAM,EACJ,cAAc,KAAK,cACpB,EACF;;;CAGI,SAAS,WAAW,MAAgD;AACzE,MAAI,CAAC,KAAK,aACR,OAAM,IAAI,MACR,0IACD;AAGH,SAAO,EACL,MAAM,EACJ,cAAc,KAAK,cACpB,EACF;;;uDAEJ"}
@@ -1,5 +1,5 @@
1
1
  import { TemplateAssetData, TemplateData, TemplateLibData, TemplateSoftwareData } from "./template_data_v2.js";
2
- import { TemplateDataV3, TemplateLibDataV3, TemplateSoftwareDataV3 } from "./template_data_v3.js";
2
+ import { TemplateDataV3, TemplateLibDataV3, TemplateSoftwareDataV3, TemplateWasmDataV3 } from "./template_data_v3.js";
3
3
  import * as _$_milaboratories_pl_client0 from "@milaboratories/pl-client";
4
4
  import { AnyFieldRef, AnyResourceRef } from "@milaboratories/pl-client";
5
5
 
@@ -41,9 +41,11 @@ declare namespace PlTemplateV1 {
41
41
  const libPrefix = "lib";
42
42
  const softPrefix = "soft";
43
43
  const tplPrefix = "tpl";
44
+ const wasmPrefix = "wasm";
44
45
  function libField(ref: AnyResourceRef, libId: string): AnyFieldRef;
45
46
  function tplField(ref: AnyResourceRef, tplId: string): AnyFieldRef;
46
47
  function swField(ref: AnyResourceRef, softwareId: string): AnyFieldRef;
48
+ function wasmField(ref: AnyResourceRef, alias: string): AnyFieldRef;
47
49
  type Data = {
48
50
  /** i.e. @milaboratory/some-package:tpl1 */Name: string; /** i.e. 1.2.3 */
49
51
  Version: string; /** Full source code encoded with Base64 */
@@ -52,6 +54,22 @@ declare namespace PlTemplateV1 {
52
54
  function fromV2Data(info: TemplateData): ResourceStructure;
53
55
  function fromV3Data(info: TemplateDataV3, sourceCode: string): ResourceStructure;
54
56
  }
57
+ declare namespace PlWasmV1 {
58
+ const type: _$_milaboratories_pl_client0.ResourceType;
59
+ const runtimeWasiP2 = "wasi-p2";
60
+ const defaultMemoryLimit: number;
61
+ type ResourceStructure = {
62
+ data: Data;
63
+ };
64
+ type Data = {
65
+ Name: string;
66
+ Version: string;
67
+ Runtime: string; /** Raw wasm component bytes, base64-encoded for JSON transport. */
68
+ Code: string;
69
+ DefaultMemoryLimit: number;
70
+ };
71
+ function fromV3Data(info: TemplateWasmDataV3, base64Source: string): ResourceStructure;
72
+ }
55
73
  declare namespace PlTemplateOverrideV1 {
56
74
  const type: _$_milaboratories_pl_client0.ResourceType;
57
75
  type ResourceStructure = {
@@ -65,5 +83,5 @@ declare namespace PlTemplateOverrideV1 {
65
83
  function fromV3Data(info: TemplateDataV3): ResourceStructure;
66
84
  }
67
85
  //#endregion
68
- export { PlTemplateLibV1, PlTemplateOverrideV1, PlTemplateSoftwareV1, PlTemplateV1 };
86
+ export { PlTemplateLibV1, PlTemplateOverrideV1, PlTemplateSoftwareV1, PlTemplateV1, PlWasmV1 };
69
87
  //# sourceMappingURL=template_resources_v1.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"template_resources_v1.d.ts","names":[],"sources":["../src/template_resources_v1.ts"],"mappings":";;;;;;kBAIiB,eAAA;EAAA,MACF,IAAA,EADiB,4BAAA,CACb,YAAA;EAAA,KAEL,iBAAA;IACV,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
52
52
  const softPrefix = _PlTemplateV.softPrefix = "soft";
53
53
  const tplPrefix = _PlTemplateV.tplPrefix = "tpl";
54
+ const wasmPrefix = _PlTemplateV.wasmPrefix = "wasm";
54
55
  function libField(ref, libId) {
55
56
  return field(ref, `${libPrefix}/${libId}`);
56
57
  }
@@ -63,6 +64,10 @@ let PlTemplateV1;
63
64
  return field(ref, `${softPrefix}/${softwareId}`);
64
65
  }
65
66
  _PlTemplateV.swField = swField;
67
+ function wasmField(ref, alias) {
68
+ return field(ref, `${wasmPrefix}/${alias}`);
69
+ }
70
+ _PlTemplateV.wasmField = wasmField;
66
71
  function fromV2Data(info) {
67
72
  return { data: {
68
73
  Name: info.name,
@@ -80,6 +85,22 @@ let PlTemplateV1;
80
85
  }
81
86
  _PlTemplateV.fromV3Data = fromV3Data;
82
87
  })(PlTemplateV1 || (PlTemplateV1 = {}));
88
+ let PlWasmV1;
89
+ (function(_PlWasmV) {
90
+ _PlWasmV.type = resourceType("Wasm", "1");
91
+ const runtimeWasiP2 = _PlWasmV.runtimeWasiP2 = "wasi-p2";
92
+ const defaultMemoryLimit = _PlWasmV.defaultMemoryLimit = 32 * 1024 * 1024;
93
+ function fromV3Data(info, base64Source) {
94
+ return { data: {
95
+ Name: info.name,
96
+ Version: info.version,
97
+ Runtime: runtimeWasiP2,
98
+ Code: base64Source,
99
+ DefaultMemoryLimit: defaultMemoryLimit
100
+ } };
101
+ }
102
+ _PlWasmV.fromV3Data = fromV3Data;
103
+ })(PlWasmV1 || (PlWasmV1 = {}));
83
104
  let PlTemplateOverrideV1;
84
105
  (function(_PlTemplateOverrideV) {
85
106
  _PlTemplateOverrideV.type = resourceType("TengoTemplateOverride", "1");
@@ -99,6 +120,6 @@ let PlTemplateOverrideV1;
99
120
  _PlTemplateOverrideV.fromV3Data = fromV3Data;
100
121
  })(PlTemplateOverrideV1 || (PlTemplateOverrideV1 = {}));
101
122
  //#endregion
102
- export { PlTemplateLibV1, PlTemplateOverrideV1, PlTemplateSoftwareV1, PlTemplateV1 };
123
+ export { PlTemplateLibV1, PlTemplateOverrideV1, PlTemplateSoftwareV1, PlTemplateV1, PlWasmV1 };
103
124
 
104
125
  //# sourceMappingURL=template_resources_v1.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"template_resources_v1.js","names":[],"sources":["../src/template_resources_v1.ts"],"sourcesContent":["import type { AnyFieldRef, AnyResourceRef } from \"@milaboratories/pl-client\";\nimport { field, resourceType } from \"@milaboratories/pl-client\";\nimport type * as infoV2 from \"./template_data_v2\";\nimport type * as infoV3 from \"./template_data_v3\";\nexport namespace PlTemplateLibV1 {\n export const type = resourceType(\"TengoLib\", \"1\");\n\n export type ResourceStructure = {\n data: Data;\n };\n\n export type Data = {\n /** i.e. @milaboratory/some-package:lib1 */\n Name: string;\n /** i.e. 1.2.3 */\n Version: string;\n /** Full source code encoded with Base64 */\n Code: string;\n };\n\n export function fromV2Data(info: infoV2.TemplateLibData): ResourceStructure {\n return {\n data: {\n Name: info.name,\n Version: info.version,\n Code: Buffer.from(info.src, \"utf8\").toString(\"base64\"),\n },\n };\n }\n\n export function fromV3Data(\n info: infoV3.TemplateLibDataV3,\n sourceCode: string,\n ): ResourceStructure {\n return {\n data: {\n Name: info.name,\n Version: info.version,\n Code: Buffer.from(sourceCode, \"utf8\").toString(\"base64\"),\n },\n };\n }\n}\n\nexport namespace PlTemplateSoftwareV1 {\n export const type = resourceType(\"SoftwareInfo\", \"1\");\n\n export type ResourceStructure = {\n data: Data;\n name: MetaName;\n };\n\n /** Raw entrypoint descriptor encoded with Base64 */\n export type Data = string;\n\n export const metaNameKey = \"ctl/runner/package/name\";\n export type MetaName = {\n /** i.e. @milaboratory/some-package:sw1 */\n Name: string;\n /** i.e. 1.2.3 */\n Version: string;\n };\n\n export function fromV2Data(\n info: infoV2.TemplateSoftwareData | infoV2.TemplateAssetData,\n ): ResourceStructure {\n return {\n data: info.src,\n name: {\n Name: info.name,\n Version: info.version,\n },\n };\n }\n\n export function fromV3Data(\n info: infoV3.TemplateSoftwareDataV3,\n sourceCode: string,\n ): ResourceStructure {\n return {\n data: sourceCode,\n name: {\n Name: info.name,\n Version: info.version,\n },\n };\n }\n}\n\nexport namespace PlTemplateV1 {\n export const type = resourceType(\"TengoTemplate\", \"1\");\n\n export type ResourceStructure = {\n data: Data;\n };\n\n export const libPrefix = \"lib\";\n export const softPrefix = \"soft\";\n export const tplPrefix = \"tpl\";\n\n export function libField(ref: AnyResourceRef, libId: string): AnyFieldRef {\n return field(ref, `${libPrefix}/${libId}`);\n }\n export function tplField(ref: AnyResourceRef, tplId: string): AnyFieldRef {\n return field(ref, `${tplPrefix}/${tplId}`);\n }\n export function swField(ref: AnyResourceRef, softwareId: string): AnyFieldRef {\n return field(ref, `${softPrefix}/${softwareId}`);\n }\n\n export type Data = {\n /** i.e. @milaboratory/some-package:tpl1 */\n Name: string;\n /** i.e. 1.2.3 */\n Version: string;\n /** Full source code encoded with Base64 */\n Code: string;\n };\n\n export function fromV2Data(info: infoV2.TemplateData): ResourceStructure {\n return {\n data: {\n Name: info.name,\n Version: info.version,\n Code: Buffer.from(info.src, \"utf8\").toString(\"base64\"),\n },\n };\n }\n\n export function fromV3Data(info: infoV3.TemplateDataV3, sourceCode: string): ResourceStructure {\n return {\n data: {\n Name: info.name,\n Version: info.version,\n Code: Buffer.from(sourceCode, \"utf8\").toString(\"base64\"),\n },\n };\n }\n}\n\nexport namespace PlTemplateOverrideV1 {\n export const type = resourceType(\"TengoTemplateOverride\", \"1\");\n\n export type ResourceStructure = {\n data: Data;\n };\n\n export function tplField(ref: AnyResourceRef): AnyFieldRef {\n return field(ref, \"tpl\");\n }\n\n export type Data = {\n OverrideUUID: string;\n };\n\n export function fromV2Data(info: infoV2.TemplateData): ResourceStructure {\n if (!info.hashOverride) {\n throw new Error(\n `template tree rendering error: template has no hash override, cannot generate PlTemplateOverrideV1.ResourceStructure from template data`,\n );\n }\n\n return {\n data: {\n OverrideUUID: info.hashOverride,\n },\n };\n }\n\n export function fromV3Data(info: infoV3.TemplateDataV3): ResourceStructure {\n if (!info.hashOverride) {\n throw new Error(\n `template tree rendering error: template has no hash override, cannot generate PlTemplateOverrideV1.ResourceStructure from template data`,\n );\n }\n\n return {\n data: {\n OverrideUUID: info.hashOverride,\n },\n };\n }\n}\n"],"mappings":";;AAIO,IAAA;;wBACe,aAAa,YAAY,IAAI;CAe1C,SAAS,WAAW,MAAiD;AAC1E,SAAO,EACL,MAAM;GACJ,MAAM,KAAK;GACX,SAAS,KAAK;GACd,MAAM,OAAO,KAAK,KAAK,KAAK,OAAO,CAAC,SAAS,SAAS;GACvD,EACF;;;CAGI,SAAS,WACd,MACA,YACmB;AACnB,SAAO,EACL,MAAM;GACJ,MAAM,KAAK;GACX,SAAS,KAAK;GACd,MAAM,OAAO,KAAK,YAAY,OAAO,CAAC,SAAS,SAAS;GACzD,EACF;;;6CAEJ;AAEM,IAAA;;6BACe,aAAa,gBAAgB,IAAI;oCAU1B;CAQpB,SAAS,WACd,MACmB;AACnB,SAAO;GACL,MAAM,KAAK;GACX,MAAM;IACJ,MAAM,KAAK;IACX,SAAS,KAAK;IACf;GACF;;;CAGI,SAAS,WACd,MACA,YACmB;AACnB,SAAO;GACL,MAAM;GACN,MAAM;IACJ,MAAM,KAAK;IACX,SAAS,KAAK;IACf;GACF;;;uDAEJ;AAEM,IAAA;;qBACe,aAAa,iBAAiB,IAAI;CAM/C,MAAM,YAAA,aAAA,YAAY;CAClB,MAAM,aAAA,aAAA,aAAa;CACnB,MAAM,YAAA,aAAA,YAAY;CAElB,SAAS,SAAS,KAAqB,OAA4B;AACxE,SAAO,MAAM,KAAK,GAAG,UAAU,GAAG,QAAQ;;;CAErC,SAAS,SAAS,KAAqB,OAA4B;AACxE,SAAO,MAAM,KAAK,GAAG,UAAU,GAAG,QAAQ;;;CAErC,SAAS,QAAQ,KAAqB,YAAiC;AAC5E,SAAO,MAAM,KAAK,GAAG,WAAW,GAAG,aAAa;;;CAY3C,SAAS,WAAW,MAA8C;AACvE,SAAO,EACL,MAAM;GACJ,MAAM,KAAK;GACX,SAAS,KAAK;GACd,MAAM,OAAO,KAAK,KAAK,KAAK,OAAO,CAAC,SAAS,SAAS;GACvD,EACF;;;CAGI,SAAS,WAAW,MAA6B,YAAuC;AAC7F,SAAO,EACL,MAAM;GACJ,MAAM,KAAK;GACX,SAAS,KAAK;GACd,MAAM,OAAO,KAAK,YAAY,OAAO,CAAC,SAAS,SAAS;GACzD,EACF;;;uCAEJ;AAEM,IAAA;;6BACe,aAAa,yBAAyB,IAAI;CAMvD,SAAS,SAAS,KAAkC;AACzD,SAAO,MAAM,KAAK,MAAM;;;CAOnB,SAAS,WAAW,MAA8C;AACvE,MAAI,CAAC,KAAK,aACR,OAAM,IAAI,MACR,0IACD;AAGH,SAAO,EACL,MAAM,EACJ,cAAc,KAAK,cACpB,EACF;;;CAGI,SAAS,WAAW,MAAgD;AACzE,MAAI,CAAC,KAAK,aACR,OAAM,IAAI,MACR,0IACD;AAGH,SAAO,EACL,MAAM,EACJ,cAAc,KAAK,cACpB,EACF;;;uDAEJ"}
1
+ {"version":3,"file":"template_resources_v1.js","names":[],"sources":["../src/template_resources_v1.ts"],"sourcesContent":["import type { AnyFieldRef, AnyResourceRef } from \"@milaboratories/pl-client\";\nimport { field, resourceType } from \"@milaboratories/pl-client\";\nimport type * as infoV2 from \"./template_data_v2\";\nimport type * as infoV3 from \"./template_data_v3\";\nexport namespace PlTemplateLibV1 {\n export const type = resourceType(\"TengoLib\", \"1\");\n\n export type ResourceStructure = {\n data: Data;\n };\n\n export type Data = {\n /** i.e. @milaboratory/some-package:lib1 */\n Name: string;\n /** i.e. 1.2.3 */\n Version: string;\n /** Full source code encoded with Base64 */\n Code: string;\n };\n\n export function fromV2Data(info: infoV2.TemplateLibData): ResourceStructure {\n return {\n data: {\n Name: info.name,\n Version: info.version,\n Code: Buffer.from(info.src, \"utf8\").toString(\"base64\"),\n },\n };\n }\n\n export function fromV3Data(\n info: infoV3.TemplateLibDataV3,\n sourceCode: string,\n ): ResourceStructure {\n return {\n data: {\n Name: info.name,\n Version: info.version,\n Code: Buffer.from(sourceCode, \"utf8\").toString(\"base64\"),\n },\n };\n }\n}\n\nexport namespace PlTemplateSoftwareV1 {\n export const type = resourceType(\"SoftwareInfo\", \"1\");\n\n export type ResourceStructure = {\n data: Data;\n name: MetaName;\n };\n\n /** Raw entrypoint descriptor encoded with Base64 */\n export type Data = string;\n\n export const metaNameKey = \"ctl/runner/package/name\";\n export type MetaName = {\n /** i.e. @milaboratory/some-package:sw1 */\n Name: string;\n /** i.e. 1.2.3 */\n Version: string;\n };\n\n export function fromV2Data(\n info: infoV2.TemplateSoftwareData | infoV2.TemplateAssetData,\n ): ResourceStructure {\n return {\n data: info.src,\n name: {\n Name: info.name,\n Version: info.version,\n },\n };\n }\n\n export function fromV3Data(\n info: infoV3.TemplateSoftwareDataV3,\n sourceCode: string,\n ): ResourceStructure {\n return {\n data: sourceCode,\n name: {\n Name: info.name,\n Version: info.version,\n },\n };\n }\n}\n\nexport namespace PlTemplateV1 {\n export const type = resourceType(\"TengoTemplate\", \"1\");\n\n export type ResourceStructure = {\n data: Data;\n };\n\n export const libPrefix = \"lib\";\n export const softPrefix = \"soft\";\n export const tplPrefix = \"tpl\";\n // Must match TengoTemplateFieldWasmPrefix in\n // core/pl/controllers/shared/resources/template_tengo.go.\n export const wasmPrefix = \"wasm\";\n\n export function libField(ref: AnyResourceRef, libId: string): AnyFieldRef {\n return field(ref, `${libPrefix}/${libId}`);\n }\n export function tplField(ref: AnyResourceRef, tplId: string): AnyFieldRef {\n return field(ref, `${tplPrefix}/${tplId}`);\n }\n export function swField(ref: AnyResourceRef, softwareId: string): AnyFieldRef {\n return field(ref, `${softPrefix}/${softwareId}`);\n }\n export function wasmField(ref: AnyResourceRef, alias: string): AnyFieldRef {\n return field(ref, `${wasmPrefix}/${alias}`);\n }\n\n export type Data = {\n /** i.e. @milaboratory/some-package:tpl1 */\n Name: string;\n /** i.e. 1.2.3 */\n Version: string;\n /** Full source code encoded with Base64 */\n Code: string;\n };\n\n export function fromV2Data(info: infoV2.TemplateData): ResourceStructure {\n return {\n data: {\n Name: info.name,\n Version: info.version,\n Code: Buffer.from(info.src, \"utf8\").toString(\"base64\"),\n },\n };\n }\n\n export function fromV3Data(info: infoV3.TemplateDataV3, sourceCode: string): ResourceStructure {\n return {\n data: {\n Name: info.name,\n Version: info.version,\n Code: Buffer.from(sourceCode, \"utf8\").toString(\"base64\"),\n },\n };\n }\n}\n\nexport namespace PlWasmV1 {\n export const type = resourceType(\"Wasm\", \"1\");\n\n // Must match controllers/shared/resources/wasm.go : WasmRuntimeWasiP2.\n export const runtimeWasiP2 = \"wasi-p2\";\n\n // Default per-instance memory cap stamped at resource creation time when\n // the template doesn't carry an explicit value. Mirrors the production\n // controller default at core/pl/controllers/workflow/internal/tplctl/\n // handle_template_pack_convert.go : defaultWasmMemoryLimit (32 MiB).\n export const defaultMemoryLimit = 32 * 1024 * 1024;\n\n export type ResourceStructure = {\n data: Data;\n };\n\n // Field names match the WasmV1Data struct in\n // core/pl/controllers/shared/resources/wasm.go. Default Go JSON\n // capitalisation — keep PascalCase.\n export type Data = {\n Name: string;\n Version: string;\n Runtime: string;\n /** Raw wasm component bytes, base64-encoded for JSON transport. */\n Code: string;\n DefaultMemoryLimit: number;\n };\n\n export function fromV3Data(\n info: infoV3.TemplateWasmDataV3,\n base64Source: string,\n ): ResourceStructure {\n return {\n data: {\n Name: info.name,\n Version: info.version,\n Runtime: runtimeWasiP2,\n // Wasm sources in CompiledTemplateV3.hashToSource are already\n // base64-encoded by tengo-builder (see addWasmFile in\n // tools/tengo-builder/src/compiler/main.ts).\n Code: base64Source,\n DefaultMemoryLimit: defaultMemoryLimit,\n },\n };\n }\n}\n\nexport namespace PlTemplateOverrideV1 {\n export const type = resourceType(\"TengoTemplateOverride\", \"1\");\n\n export type ResourceStructure = {\n data: Data;\n };\n\n export function tplField(ref: AnyResourceRef): AnyFieldRef {\n return field(ref, \"tpl\");\n }\n\n export type Data = {\n OverrideUUID: string;\n };\n\n export function fromV2Data(info: infoV2.TemplateData): ResourceStructure {\n if (!info.hashOverride) {\n throw new Error(\n `template tree rendering error: template has no hash override, cannot generate PlTemplateOverrideV1.ResourceStructure from template data`,\n );\n }\n\n return {\n data: {\n OverrideUUID: info.hashOverride,\n },\n };\n }\n\n export function fromV3Data(info: infoV3.TemplateDataV3): ResourceStructure {\n if (!info.hashOverride) {\n throw new Error(\n `template tree rendering error: template has no hash override, cannot generate PlTemplateOverrideV1.ResourceStructure from template data`,\n );\n }\n\n return {\n data: {\n OverrideUUID: info.hashOverride,\n },\n };\n }\n}\n"],"mappings":";;AAIO,IAAA;;wBACe,aAAa,YAAY,IAAI;CAe1C,SAAS,WAAW,MAAiD;AAC1E,SAAO,EACL,MAAM;GACJ,MAAM,KAAK;GACX,SAAS,KAAK;GACd,MAAM,OAAO,KAAK,KAAK,KAAK,OAAO,CAAC,SAAS,SAAS;GACvD,EACF;;;CAGI,SAAS,WACd,MACA,YACmB;AACnB,SAAO,EACL,MAAM;GACJ,MAAM,KAAK;GACX,SAAS,KAAK;GACd,MAAM,OAAO,KAAK,YAAY,OAAO,CAAC,SAAS,SAAS;GACzD,EACF;;;6CAEJ;AAEM,IAAA;;6BACe,aAAa,gBAAgB,IAAI;oCAU1B;CAQpB,SAAS,WACd,MACmB;AACnB,SAAO;GACL,MAAM,KAAK;GACX,MAAM;IACJ,MAAM,KAAK;IACX,SAAS,KAAK;IACf;GACF;;;CAGI,SAAS,WACd,MACA,YACmB;AACnB,SAAO;GACL,MAAM;GACN,MAAM;IACJ,MAAM,KAAK;IACX,SAAS,KAAK;IACf;GACF;;;uDAEJ;AAEM,IAAA;;qBACe,aAAa,iBAAiB,IAAI;CAM/C,MAAM,YAAA,aAAA,YAAY;CAClB,MAAM,aAAA,aAAA,aAAa;CACnB,MAAM,YAAA,aAAA,YAAY;CAGlB,MAAM,aAAA,aAAA,aAAa;CAEnB,SAAS,SAAS,KAAqB,OAA4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,cAAc,KAAK,cACpB,EACF;;;uDAEJ"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@milaboratories/pl-model-backend",
3
- "version": "1.3.5",
3
+ "version": "1.4.1",
4
4
  "description": "Backend model for Platforma.bio",
5
5
  "files": [
6
6
  "./dist/**/*",
@@ -20,7 +20,7 @@
20
20
  "dependencies": {
21
21
  "canonicalize": "~2.1.0",
22
22
  "zod": "~3.25.76",
23
- "@milaboratories/pl-client": "3.9.2"
23
+ "@milaboratories/pl-client": "3.10.1"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@types/node": "~24.5.2",
@@ -1,4 +1,5 @@
1
1
  /**
2
2
  * Re-export backend capability types for easier access.
3
3
  */
4
- export { hasCapability, type BackendCapability } from "@milaboratories/pl-client";
4
+ export { hasCapability } from "@milaboratories/pl-client";
5
+ export type { BackendCapability } from "@milaboratories/pl-client";
@@ -97,6 +97,9 @@ export namespace PlTemplateV1 {
97
97
  export const libPrefix = "lib";
98
98
  export const softPrefix = "soft";
99
99
  export const tplPrefix = "tpl";
100
+ // Must match TengoTemplateFieldWasmPrefix in
101
+ // core/pl/controllers/shared/resources/template_tengo.go.
102
+ export const wasmPrefix = "wasm";
100
103
 
101
104
  export function libField(ref: AnyResourceRef, libId: string): AnyFieldRef {
102
105
  return field(ref, `${libPrefix}/${libId}`);
@@ -107,6 +110,9 @@ export namespace PlTemplateV1 {
107
110
  export function swField(ref: AnyResourceRef, softwareId: string): AnyFieldRef {
108
111
  return field(ref, `${softPrefix}/${softwareId}`);
109
112
  }
113
+ export function wasmField(ref: AnyResourceRef, alias: string): AnyFieldRef {
114
+ return field(ref, `${wasmPrefix}/${alias}`);
115
+ }
110
116
 
111
117
  export type Data = {
112
118
  /** i.e. @milaboratory/some-package:tpl1 */
@@ -138,6 +144,53 @@ export namespace PlTemplateV1 {
138
144
  }
139
145
  }
140
146
 
147
+ export namespace PlWasmV1 {
148
+ export const type = resourceType("Wasm", "1");
149
+
150
+ // Must match controllers/shared/resources/wasm.go : WasmRuntimeWasiP2.
151
+ export const runtimeWasiP2 = "wasi-p2";
152
+
153
+ // Default per-instance memory cap stamped at resource creation time when
154
+ // the template doesn't carry an explicit value. Mirrors the production
155
+ // controller default at core/pl/controllers/workflow/internal/tplctl/
156
+ // handle_template_pack_convert.go : defaultWasmMemoryLimit (32 MiB).
157
+ export const defaultMemoryLimit = 32 * 1024 * 1024;
158
+
159
+ export type ResourceStructure = {
160
+ data: Data;
161
+ };
162
+
163
+ // Field names match the WasmV1Data struct in
164
+ // core/pl/controllers/shared/resources/wasm.go. Default Go JSON
165
+ // capitalisation — keep PascalCase.
166
+ export type Data = {
167
+ Name: string;
168
+ Version: string;
169
+ Runtime: string;
170
+ /** Raw wasm component bytes, base64-encoded for JSON transport. */
171
+ Code: string;
172
+ DefaultMemoryLimit: number;
173
+ };
174
+
175
+ export function fromV3Data(
176
+ info: infoV3.TemplateWasmDataV3,
177
+ base64Source: string,
178
+ ): ResourceStructure {
179
+ return {
180
+ data: {
181
+ Name: info.name,
182
+ Version: info.version,
183
+ Runtime: runtimeWasiP2,
184
+ // Wasm sources in CompiledTemplateV3.hashToSource are already
185
+ // base64-encoded by tengo-builder (see addWasmFile in
186
+ // tools/tengo-builder/src/compiler/main.ts).
187
+ Code: base64Source,
188
+ DefaultMemoryLimit: defaultMemoryLimit,
189
+ },
190
+ };
191
+ }
192
+ }
193
+
141
194
  export namespace PlTemplateOverrideV1 {
142
195
  export const type = resourceType("TengoTemplateOverride", "1");
143
196