@milaboratories/pl-model-backend 1.2.29 → 1.3.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.
@@ -0,0 +1,25 @@
1
+ //#region src/capabilities.ts
2
+ /**
3
+ * Backend capability tokens advertised by pl in
4
+ * `MaintenanceAPI.Ping.Response.capabilities` and required by compiled
5
+ * templates via `TemplateDataV3.requiredCapabilities`.
6
+ *
7
+ * Single TypeScript source of truth shared across:
8
+ * - `@platforma-sdk/tengo-builder` — populates the field at compile time
9
+ * - `@platforma-sdk/block-tools` — copies it onto the published manifest
10
+ * - `@milaboratories/pl-middle-layer` — checks it at install time
11
+ *
12
+ * Mirror of `pl/platform/api/plapiserver/server_capabilities.go` — keep
13
+ * tokens in sync with the backend's advertised list. Format is
14
+ * `<feature>:<version>`; bump the version when wire semantics change.
15
+ */
16
+ /**
17
+ * Backend bundles a wasmtime-based WASI 0.2 / Component Model runtime.
18
+ * Templates that reference wasm components via `assets.importWasm(...)`
19
+ * require this capability.
20
+ */
21
+ const CapabilityWasm = "wasm:v1";
22
+ //#endregion
23
+ exports.CapabilityWasm = CapabilityWasm;
24
+
25
+ //# sourceMappingURL=capabilities.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capabilities.cjs","names":[],"sources":["../src/capabilities.ts"],"sourcesContent":["/**\n * Backend capability tokens advertised by pl in\n * `MaintenanceAPI.Ping.Response.capabilities` and required by compiled\n * templates via `TemplateDataV3.requiredCapabilities`.\n *\n * Single TypeScript source of truth shared across:\n * - `@platforma-sdk/tengo-builder` — populates the field at compile time\n * - `@platforma-sdk/block-tools` — copies it onto the published manifest\n * - `@milaboratories/pl-middle-layer` — checks it at install time\n *\n * Mirror of `pl/platform/api/plapiserver/server_capabilities.go` — keep\n * tokens in sync with the backend's advertised list. Format is\n * `<feature>:<version>`; bump the version when wire semantics change.\n */\n\n/**\n * Backend bundles a wasmtime-based WASI 0.2 / Component Model runtime.\n * Templates that reference wasm components via `assets.importWasm(...)`\n * require this capability.\n */\nexport const CapabilityWasm = \"wasm:v1\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAoBA,MAAa,iBAAiB"}
@@ -0,0 +1,24 @@
1
+ //#region src/capabilities.d.ts
2
+ /**
3
+ * Backend capability tokens advertised by pl in
4
+ * `MaintenanceAPI.Ping.Response.capabilities` and required by compiled
5
+ * templates via `TemplateDataV3.requiredCapabilities`.
6
+ *
7
+ * Single TypeScript source of truth shared across:
8
+ * - `@platforma-sdk/tengo-builder` — populates the field at compile time
9
+ * - `@platforma-sdk/block-tools` — copies it onto the published manifest
10
+ * - `@milaboratories/pl-middle-layer` — checks it at install time
11
+ *
12
+ * Mirror of `pl/platform/api/plapiserver/server_capabilities.go` — keep
13
+ * tokens in sync with the backend's advertised list. Format is
14
+ * `<feature>:<version>`; bump the version when wire semantics change.
15
+ */
16
+ /**
17
+ * Backend bundles a wasmtime-based WASI 0.2 / Component Model runtime.
18
+ * Templates that reference wasm components via `assets.importWasm(...)`
19
+ * require this capability.
20
+ */
21
+ declare const CapabilityWasm = "wasm:v1";
22
+ //#endregion
23
+ export { CapabilityWasm };
24
+ //# sourceMappingURL=capabilities.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capabilities.d.ts","names":[],"sources":["../src/capabilities.ts"],"mappings":";;AAoBA;;;;;;;;;;;;;;;;;;cAAa,cAAA"}
@@ -0,0 +1,25 @@
1
+ //#region src/capabilities.ts
2
+ /**
3
+ * Backend capability tokens advertised by pl in
4
+ * `MaintenanceAPI.Ping.Response.capabilities` and required by compiled
5
+ * templates via `TemplateDataV3.requiredCapabilities`.
6
+ *
7
+ * Single TypeScript source of truth shared across:
8
+ * - `@platforma-sdk/tengo-builder` — populates the field at compile time
9
+ * - `@platforma-sdk/block-tools` — copies it onto the published manifest
10
+ * - `@milaboratories/pl-middle-layer` — checks it at install time
11
+ *
12
+ * Mirror of `pl/platform/api/plapiserver/server_capabilities.go` — keep
13
+ * tokens in sync with the backend's advertised list. Format is
14
+ * `<feature>:<version>`; bump the version when wire semantics change.
15
+ */
16
+ /**
17
+ * Backend bundles a wasmtime-based WASI 0.2 / Component Model runtime.
18
+ * Templates that reference wasm components via `assets.importWasm(...)`
19
+ * require this capability.
20
+ */
21
+ const CapabilityWasm = "wasm:v1";
22
+ //#endregion
23
+ export { CapabilityWasm };
24
+
25
+ //# sourceMappingURL=capabilities.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capabilities.js","names":[],"sources":["../src/capabilities.ts"],"sourcesContent":["/**\n * Backend capability tokens advertised by pl in\n * `MaintenanceAPI.Ping.Response.capabilities` and required by compiled\n * templates via `TemplateDataV3.requiredCapabilities`.\n *\n * Single TypeScript source of truth shared across:\n * - `@platforma-sdk/tengo-builder` — populates the field at compile time\n * - `@platforma-sdk/block-tools` — copies it onto the published manifest\n * - `@milaboratories/pl-middle-layer` — checks it at install time\n *\n * Mirror of `pl/platform/api/plapiserver/server_capabilities.go` — keep\n * tokens in sync with the backend's advertised list. Format is\n * `<feature>:<version>`; bump the version when wire semantics change.\n */\n\n/**\n * Backend bundles a wasmtime-based WASI 0.2 / Component Model runtime.\n * Templates that reference wasm components via `assets.importWasm(...)`\n * require this capability.\n */\nexport const CapabilityWasm = \"wasm:v1\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAoBA,MAAa,iBAAiB"}
package/dist/index.cjs CHANGED
@@ -1,6 +1,8 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_capabilities = require("./capabilities.cjs");
2
3
  const require_serde = require("./serde.cjs");
3
4
  const require_template_resources_v1 = require("./template_resources_v1.cjs");
5
+ exports.CapabilityWasm = require_capabilities.CapabilityWasm;
4
6
  Object.defineProperty(exports, "PlTemplateLibV1", {
5
7
  enumerable: true,
6
8
  get: function() {
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
+ import { CapabilityWasm } from "./capabilities.js";
1
2
  import { TemplateAssetData, TemplateData, TemplateLibData, TemplateSoftwareData } from "./template_data_v2.js";
2
- import { CompiledTemplateV3, TemplateAssetDataV3, TemplateDataV3, TemplateLibDataV3, TemplateSoftwareDataV3 } from "./template_data_v3.js";
3
+ import { CompiledTemplateV3, TemplateAssetDataV3, TemplateDataV3, TemplateLibDataV3, TemplateSoftwareDataV3, TemplateWasmDataV3 } from "./template_data_v3.js";
3
4
  import { parseTemplate, serializeTemplate } from "./serde.js";
4
5
  import { PlTemplateLibV1, PlTemplateOverrideV1, PlTemplateSoftwareV1, PlTemplateV1 } from "./template_resources_v1.js";
5
- export { CompiledTemplateV3, PlTemplateLibV1, PlTemplateOverrideV1, PlTemplateSoftwareV1, PlTemplateV1, TemplateAssetData, TemplateAssetDataV3, TemplateData, TemplateDataV3, TemplateLibData, TemplateLibDataV3, TemplateSoftwareData, TemplateSoftwareDataV3, parseTemplate, serializeTemplate };
6
+ export { CapabilityWasm, CompiledTemplateV3, PlTemplateLibV1, PlTemplateOverrideV1, PlTemplateSoftwareV1, PlTemplateV1, TemplateAssetData, TemplateAssetDataV3, TemplateData, TemplateDataV3, TemplateLibData, TemplateLibDataV3, TemplateSoftwareData, TemplateSoftwareDataV3, TemplateWasmDataV3, parseTemplate, serializeTemplate };
package/dist/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { CapabilityWasm } from "./capabilities.js";
1
2
  import { parseTemplate, serializeTemplate } from "./serde.js";
2
3
  import { PlTemplateLibV1, PlTemplateOverrideV1, PlTemplateSoftwareV1, PlTemplateV1 } from "./template_resources_v1.js";
3
- export { PlTemplateLibV1, PlTemplateOverrideV1, PlTemplateSoftwareV1, PlTemplateV1, parseTemplate, serializeTemplate };
4
+ export { CapabilityWasm, PlTemplateLibV1, PlTemplateOverrideV1, PlTemplateSoftwareV1, PlTemplateV1, parseTemplate, serializeTemplate };
@@ -23,6 +23,14 @@ interface TemplateAssetDataV3 {
23
23
  /** hash of the full contents of asset dependency description */
24
24
  sourceHash: string;
25
25
  }
26
+ interface TemplateWasmDataV3 {
27
+ /** i.e. @milaboratories/pframes-rs-wasip2:main */
28
+ name: string;
29
+ /** i.e. 0.0.0 */
30
+ version: string;
31
+ /** sha256 of the base64-encoded wasm bytes stored in hashToSource */
32
+ sourceHash: string;
33
+ }
26
34
  interface TemplateDataV3 {
27
35
  /** i.e. @milaboratory/some-package:template */
28
36
  name: string;
@@ -43,6 +51,27 @@ interface TemplateDataV3 {
43
51
  software: Record<string, TemplateSoftwareDataV3>;
44
52
  /** i.e. @milaboratory/genome:human -> the asset metadata */
45
53
  assets: Record<string, TemplateAssetDataV3>;
54
+ /** i.e. @milaboratories/pframes-rs-wasip2:main -> the wasm component metadata.
55
+ * The actual wasm bytes are base64-encoded and stored under sourceHash in the
56
+ * parent CompiledTemplateV3.hashToSource map. */
57
+ wasm?: Record<string, TemplateWasmDataV3>;
58
+ /**
59
+ * Backend capability tokens this template (and its transitively-imported
60
+ * sub-templates) requires to run. Populated by `tengo-builder` at compile
61
+ * time:
62
+ * - `CapabilityWasm` ("wasm:v1") is added when a wasm artifact is
63
+ * embedded (via `assets.importWasm`, directly or through a library).
64
+ * - Child templates contribute their own `requiredCapabilities` —
65
+ * unioned transitively, so the top template carries the full set.
66
+ *
67
+ * Consumers (`block-tools pack`, `pl-middle-layer` install gate,
68
+ * `pl-middle-layer` catalog listing) read this directly; the recursive
69
+ * tree walk that previously rediscovered the same fact at every
70
+ * consumer is gone. Tokens are the same vocabulary the backend
71
+ * advertises in `MaintenanceAPI.Ping.Response.capabilities` — see
72
+ * `./capabilities.ts`.
73
+ */
74
+ requiredCapabilities?: string[];
46
75
  }
47
76
  interface CompiledTemplateV3 {
48
77
  /** Discriminator for future use */
@@ -52,5 +81,5 @@ interface CompiledTemplateV3 {
52
81
  template: TemplateDataV3;
53
82
  }
54
83
  //#endregion
55
- export { CompiledTemplateV3, TemplateAssetDataV3, TemplateDataV3, TemplateLibDataV3, TemplateSoftwareDataV3 };
84
+ export { CompiledTemplateV3, TemplateAssetDataV3, TemplateDataV3, TemplateLibDataV3, TemplateSoftwareDataV3, TemplateWasmDataV3 };
56
85
  //# sourceMappingURL=template_data_v3.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"template_data_v3.d.ts","names":[],"sources":["../src/template_data_v3.ts"],"mappings":";UAAiB,iBAAA;EAAA;EAEf,IAAA;;EAEA,OAAA;EAFA;EAIA,UAAA;AAAA;AAAA,UAGe,sBAAA;EAHL;EAKV,IAAA;EAFqC;EAIrC,OAAA;EAJqC;EAMrC,UAAA;AAAA;AAAA,UAGe,mBAAA;EAHL;EAKV,IAAA;EAFe;EAIf,OAAA;;EAEA,UAAA;AAAA;AAAA,UAGe,cAAA;EAHf;EAKA,IAAA;EALU;EAOV,OAAA;EAJ6B;EAO7B,UAAA;EASqB;;;;EAHrB,YAAA;EAOU;EAJV,IAAA,EAAM,MAAA,SAAe,iBAAA;EAMb;EAJR,SAAA,EAAW,MAAA,SAAe,cAAA;EAIZ;EAFd,QAAA,EAAU,MAAA,SAAe,sBAAA;EAhBzB;EAkBA,MAAA,EAAQ,MAAA,SAAe,mBAAA;AAAA;AAAA,UAGR,kBAAA;EATT;EAWN,IAAA;EATA;EAYA,YAAA,EAAc,MAAA;EAEd,QAAA,EAAU,cAAA;AAAA"}
1
+ {"version":3,"file":"template_data_v3.d.ts","names":[],"sources":["../src/template_data_v3.ts"],"mappings":";UAAiB,iBAAA;EAAA;EAEf,IAAA;;EAEA,OAAA;EAFA;EAIA,UAAA;AAAA;AAAA,UAGe,sBAAA;EAHL;EAKV,IAAA;EAFqC;EAIrC,OAAA;EAJqC;EAMrC,UAAA;AAAA;AAAA,UAGe,mBAAA;EAHL;EAKV,IAAA;EAFe;EAIf,OAAA;;EAEA,UAAA;AAAA;AAAA,UAGe,kBAAA;EAHf;EAKA,IAAA;EALU;EAOV,OAAA;EAJiC;EAMjC,UAAA;AAAA;AAAA,UAGe,cAAA;EALf;EAOA,IAAA;EALU;EAOV,OAAA;EAJe;EAOf,UAAA;;;;;EAMA,YAAA;EAOyB;EAJzB,IAAA,EAAM,MAAA,SAAe,iBAAA;EAME;EAJvB,SAAA,EAAW,MAAA,SAAe,cAAA;EAQJ;EANtB,QAAA,EAAU,MAAA,SAAe,sBAAA;EAMZ;EAJb,MAAA,EAAQ,MAAA,SAAe,mBAAA;EApBvB;;;EAwBA,IAAA,GAAO,MAAA,SAAe,kBAAA;EAVtB;;;;;;;;;;;;;;;;EA4BA,oBAAA;AAAA;AAAA,UAGe,kBAAA;EAAkB;EAEjC,IAAA;EAKwB;EAFxB,YAAA,EAAc,MAAA;EAEd,QAAA,EAAU,cAAA;AAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@milaboratories/pl-model-backend",
3
- "version": "1.2.29",
3
+ "version": "1.3.0",
4
4
  "description": "Backend model for Platforma.bio",
5
5
  "files": [
6
6
  "./dist/**/*",
@@ -20,13 +20,15 @@
20
20
  "dependencies": {
21
21
  "canonicalize": "~2.1.0",
22
22
  "zod": "~3.25.76",
23
- "@milaboratories/pl-client": "3.5.0"
23
+ "@milaboratories/pl-client": "3.7.0"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@types/node": "~24.5.2",
27
+ "@vitest/coverage-istanbul": "^4.1.3",
27
28
  "typescript": "~5.9.3",
29
+ "vitest": "^4.1.3",
30
+ "@milaboratories/ts-builder": "1.5.0",
28
31
  "@milaboratories/build-configs": "2.0.0",
29
- "@milaboratories/ts-builder": "1.4.0",
30
32
  "@milaboratories/ts-configs": "1.2.3"
31
33
  },
32
34
  "scripts": {
@@ -36,6 +38,7 @@
36
38
  "formatter:check": "ts-builder formatter --check",
37
39
  "linter:check": "ts-builder linter --check",
38
40
  "types:check": "ts-builder type-check --target node",
41
+ "test": "vitest run --coverage",
39
42
  "do-pack": "rm -f *.tgz && pnpm pack && mv *.tgz package.tgz",
40
43
  "fmt": "ts-builder format"
41
44
  }
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Backend capability tokens advertised by pl in
3
+ * `MaintenanceAPI.Ping.Response.capabilities` and required by compiled
4
+ * templates via `TemplateDataV3.requiredCapabilities`.
5
+ *
6
+ * Single TypeScript source of truth shared across:
7
+ * - `@platforma-sdk/tengo-builder` — populates the field at compile time
8
+ * - `@platforma-sdk/block-tools` — copies it onto the published manifest
9
+ * - `@milaboratories/pl-middle-layer` — checks it at install time
10
+ *
11
+ * Mirror of `pl/platform/api/plapiserver/server_capabilities.go` — keep
12
+ * tokens in sync with the backend's advertised list. Format is
13
+ * `<feature>:<version>`; bump the version when wire semantics change.
14
+ */
15
+
16
+ /**
17
+ * Backend bundles a wasmtime-based WASI 0.2 / Component Model runtime.
18
+ * Templates that reference wasm components via `assets.importWasm(...)`
19
+ * require this capability.
20
+ */
21
+ export const CapabilityWasm = "wasm:v1";
package/src/index.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export * from "./capabilities";
1
2
  export * from "./serde";
2
3
  export * from "./template_data_v2";
3
4
  export * from "./template_data_v3";
@@ -25,6 +25,15 @@ export interface TemplateAssetDataV3 {
25
25
  sourceHash: string;
26
26
  }
27
27
 
28
+ export interface TemplateWasmDataV3 {
29
+ /** i.e. @milaboratories/pframes-rs-wasip2:main */
30
+ name: string;
31
+ /** i.e. 0.0.0 */
32
+ version: string;
33
+ /** sha256 of the base64-encoded wasm bytes stored in hashToSource */
34
+ sourceHash: string;
35
+ }
36
+
28
37
  export interface TemplateDataV3 {
29
38
  /** i.e. @milaboratory/some-package:template */
30
39
  name: string;
@@ -48,6 +57,28 @@ export interface TemplateDataV3 {
48
57
  software: Record<string, TemplateSoftwareDataV3>;
49
58
  /** i.e. @milaboratory/genome:human -> the asset metadata */
50
59
  assets: Record<string, TemplateAssetDataV3>;
60
+ /** i.e. @milaboratories/pframes-rs-wasip2:main -> the wasm component metadata.
61
+ * The actual wasm bytes are base64-encoded and stored under sourceHash in the
62
+ * parent CompiledTemplateV3.hashToSource map. */
63
+ wasm?: Record<string, TemplateWasmDataV3>;
64
+
65
+ /**
66
+ * Backend capability tokens this template (and its transitively-imported
67
+ * sub-templates) requires to run. Populated by `tengo-builder` at compile
68
+ * time:
69
+ * - `CapabilityWasm` ("wasm:v1") is added when a wasm artifact is
70
+ * embedded (via `assets.importWasm`, directly or through a library).
71
+ * - Child templates contribute their own `requiredCapabilities` —
72
+ * unioned transitively, so the top template carries the full set.
73
+ *
74
+ * Consumers (`block-tools pack`, `pl-middle-layer` install gate,
75
+ * `pl-middle-layer` catalog listing) read this directly; the recursive
76
+ * tree walk that previously rediscovered the same fact at every
77
+ * consumer is gone. Tokens are the same vocabulary the backend
78
+ * advertises in `MaintenanceAPI.Ping.Response.capabilities` — see
79
+ * `./capabilities.ts`.
80
+ */
81
+ requiredCapabilities?: string[];
51
82
  }
52
83
 
53
84
  export interface CompiledTemplateV3 {