@milaboratories/pl-model-backend 1.2.30 → 1.3.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.
@@ -0,0 +1,2 @@
1
+ require("./_virtual/_rolldown/runtime.cjs");
2
+ require("@milaboratories/pl-client");
@@ -0,0 +1,2 @@
1
+ import { BackendCapability, hasCapability } from "@milaboratories/pl-client";
2
+ export { type BackendCapability, hasCapability };
@@ -0,0 +1,2 @@
1
+ import { hasCapability } from "@milaboratories/pl-client";
2
+ export { hasCapability };
package/dist/index.cjs CHANGED
@@ -1,6 +1,9 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ require("./_virtual/_rolldown/runtime.cjs");
3
+ require("./capabilities.cjs");
2
4
  const require_serde = require("./serde.cjs");
3
5
  const require_template_resources_v1 = require("./template_resources_v1.cjs");
6
+ let _milaboratories_pl_client = require("@milaboratories/pl-client");
4
7
  Object.defineProperty(exports, "PlTemplateLibV1", {
5
8
  enumerable: true,
6
9
  get: function() {
@@ -25,5 +28,11 @@ Object.defineProperty(exports, "PlTemplateV1", {
25
28
  return require_template_resources_v1.PlTemplateV1;
26
29
  }
27
30
  });
31
+ Object.defineProperty(exports, "hasCapability", {
32
+ enumerable: true,
33
+ get: function() {
34
+ return _milaboratories_pl_client.hasCapability;
35
+ }
36
+ });
28
37
  exports.parseTemplate = require_serde.parseTemplate;
29
38
  exports.serializeTemplate = require_serde.serializeTemplate;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
+ import { BackendCapability, hasCapability } 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 { BackendCapability, CompiledTemplateV3, PlTemplateLibV1, PlTemplateOverrideV1, PlTemplateSoftwareV1, PlTemplateV1, TemplateAssetData, TemplateAssetDataV3, TemplateData, TemplateDataV3, TemplateLibData, TemplateLibDataV3, TemplateSoftwareData, TemplateSoftwareDataV3, TemplateWasmDataV3, hasCapability, parseTemplate, serializeTemplate };
package/dist/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { hasCapability } 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 { PlTemplateLibV1, PlTemplateOverrideV1, PlTemplateSoftwareV1, PlTemplateV1, hasCapability, parseTemplate, serializeTemplate };
@@ -1,3 +1,5 @@
1
+ import { BackendCapability } from "./capabilities.js";
2
+
1
3
  //#region src/template_data_v3.d.ts
2
4
  interface TemplateLibDataV3 {
3
5
  /** i.e. @milaboratory/some-package:lib1 */
@@ -23,6 +25,14 @@ interface TemplateAssetDataV3 {
23
25
  /** hash of the full contents of asset dependency description */
24
26
  sourceHash: string;
25
27
  }
28
+ 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
+ }
26
36
  interface TemplateDataV3 {
27
37
  /** i.e. @milaboratory/some-package:template */
28
38
  name: string;
@@ -43,6 +53,27 @@ interface TemplateDataV3 {
43
53
  software: Record<string, TemplateSoftwareDataV3>;
44
54
  /** i.e. @milaboratory/genome:human -> the asset metadata */
45
55
  assets: Record<string, TemplateAssetDataV3>;
56
+ /** i.e. @milaboratories/pframes-rs-wasip2:main -> the wasm component metadata.
57
+ * The actual wasm bytes are base64-encoded and stored under sourceHash in the
58
+ * parent CompiledTemplateV3.hashToSource map. */
59
+ wasm?: Record<string, TemplateWasmDataV3>;
60
+ /**
61
+ * Backend capability tokens this template (and its transitively-imported
62
+ * sub-templates) requires to run. Populated by `tengo-builder` at compile
63
+ * time:
64
+ * - `"wasm:v1"` is added when a wasm artifact is embedded (via
65
+ * `assets.importWasm`, directly or through a library).
66
+ * - Child templates contribute their own `requiredCapabilities` —
67
+ * unioned transitively, so the top template carries the full set.
68
+ *
69
+ * Consumers (`block-tools pack`, `pl-middle-layer` install gate,
70
+ * `pl-middle-layer` catalog listing) read this directly; the recursive
71
+ * tree walk that previously rediscovered the same fact at every
72
+ * consumer is gone. Tokens are the same vocabulary the backend
73
+ * advertises in `MaintenanceAPI.Ping.Response.capabilities` — see
74
+ * `./capabilities.ts`.
75
+ */
76
+ requiredCapabilities?: BackendCapability[];
46
77
  }
47
78
  interface CompiledTemplateV3 {
48
79
  /** Discriminator for future use */
@@ -52,5 +83,5 @@ interface CompiledTemplateV3 {
52
83
  template: TemplateDataV3;
53
84
  }
54
85
  //#endregion
55
- export { CompiledTemplateV3, TemplateAssetDataV3, TemplateDataV3, TemplateLibDataV3, TemplateSoftwareDataV3 };
86
+ export { CompiledTemplateV3, TemplateAssetDataV3, TemplateDataV3, TemplateLibDataV3, TemplateSoftwareDataV3, TemplateWasmDataV3 };
56
87
  //# 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":";;;UAEiB,iBAAA;;EAEf,IAAA;EAFgC;EAIhC,OAAA;EAJgC;EAMhC,UAAA;AAAA;AAAA,UAGe,sBAAA;EAHL;EAKV,IAAA;EAFe;EAIf,OAAA;;EAEA,UAAA;AAAA;AAAA,UAGe,mBAAA;EAHf;EAKA,IAAA;EALU;EAOV,OAAA;EAJkC;EAMlC,UAAA;AAAA;AAAA,UAGe,kBAAA;EALf;EAOA,IAAA;EALU;EAOV,OAAA;EAJe;EAMf,UAAA;AAAA;AAAA,UAGe,cAAA;EAPf;EASA,IAAA;EALA;EAOA,OAAA;EAPU;EAUV,UAAA;EAP6B;;;;EAa7B,YAAA;EAKW;EAFX,IAAA,EAAM,MAAA,SAAe,iBAAA;EAIX;EAFV,SAAA,EAAW,MAAA,SAAe,cAAA;EAIlB;EAFR,QAAA,EAAU,MAAA,SAAe,sBAAA;EAMlB;EAJP,MAAA,EAAQ,MAAA,SAAe,mBAAA;EAsBiB;;;EAlBxC,IAAA,GAAO,MAAA,SAAe,kBAAA;EAnBtB;;;;;;;;;;;;;;;;EAqCA,oBAAA,GAAuB,iBAAA;AAAA;AAAA,UAGR,kBAAA;EAHyB;EAKxC,IAAA;EAFe;EAKf,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.30",
3
+ "version": "1.3.1",
4
4
  "description": "Backend model for Platforma.bio",
5
5
  "files": [
6
6
  "./dist/**/*",
@@ -20,11 +20,13 @@
20
20
  "dependencies": {
21
21
  "canonicalize": "~2.1.0",
22
22
  "zod": "~3.25.76",
23
- "@milaboratories/pl-client": "3.6.0"
23
+ "@milaboratories/pl-client": "3.8.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",
28
30
  "@milaboratories/build-configs": "2.0.0",
29
31
  "@milaboratories/ts-builder": "1.5.0",
30
32
  "@milaboratories/ts-configs": "1.2.3"
@@ -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,4 @@
1
+ /**
2
+ * Re-export backend capability types for easier access.
3
+ */
4
+ export { hasCapability, type BackendCapability } from "@milaboratories/pl-client";
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";
@@ -1,3 +1,5 @@
1
+ import type { BackendCapability } from "./capabilities";
2
+
1
3
  export interface TemplateLibDataV3 {
2
4
  /** i.e. @milaboratory/some-package:lib1 */
3
5
  name: string;
@@ -25,6 +27,15 @@ export interface TemplateAssetDataV3 {
25
27
  sourceHash: string;
26
28
  }
27
29
 
30
+ export interface TemplateWasmDataV3 {
31
+ /** i.e. @milaboratories/pframes-rs-wasip2:main */
32
+ name: string;
33
+ /** i.e. 0.0.0 */
34
+ version: string;
35
+ /** sha256 of the base64-encoded wasm bytes stored in hashToSource */
36
+ sourceHash: string;
37
+ }
38
+
28
39
  export interface TemplateDataV3 {
29
40
  /** i.e. @milaboratory/some-package:template */
30
41
  name: string;
@@ -48,6 +59,28 @@ export interface TemplateDataV3 {
48
59
  software: Record<string, TemplateSoftwareDataV3>;
49
60
  /** i.e. @milaboratory/genome:human -> the asset metadata */
50
61
  assets: Record<string, TemplateAssetDataV3>;
62
+ /** i.e. @milaboratories/pframes-rs-wasip2:main -> the wasm component metadata.
63
+ * The actual wasm bytes are base64-encoded and stored under sourceHash in the
64
+ * parent CompiledTemplateV3.hashToSource map. */
65
+ wasm?: Record<string, TemplateWasmDataV3>;
66
+
67
+ /**
68
+ * Backend capability tokens this template (and its transitively-imported
69
+ * sub-templates) requires to run. Populated by `tengo-builder` at compile
70
+ * time:
71
+ * - `"wasm:v1"` is added when a wasm artifact is embedded (via
72
+ * `assets.importWasm`, directly or through a library).
73
+ * - Child templates contribute their own `requiredCapabilities` —
74
+ * unioned transitively, so the top template carries the full set.
75
+ *
76
+ * Consumers (`block-tools pack`, `pl-middle-layer` install gate,
77
+ * `pl-middle-layer` catalog listing) read this directly; the recursive
78
+ * tree walk that previously rediscovered the same fact at every
79
+ * consumer is gone. Tokens are the same vocabulary the backend
80
+ * advertises in `MaintenanceAPI.Ping.Response.capabilities` — see
81
+ * `./capabilities.ts`.
82
+ */
83
+ requiredCapabilities?: BackendCapability[];
51
84
  }
52
85
 
53
86
  export interface CompiledTemplateV3 {