@milaboratories/pl-model-backend 1.1.43 → 1.1.45

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.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- export * from './serde';
2
- export * from './template_data_v2';
3
- export * from './template_data_v3';
4
- export * from './template_resources_v1';
1
+ export * from "./serde";
2
+ export * from "./template_data_v2";
3
+ export * from "./template_data_v3";
4
+ export * from "./template_resources_v1";
5
5
  //# sourceMappingURL=index.d.ts.map
package/dist/serde.cjs CHANGED
@@ -4,21 +4,25 @@ var node_zlib = require('node:zlib');
4
4
  var canonicalize = require('canonicalize');
5
5
  var zod = require('zod');
6
6
 
7
- const TypeSchema = zod.z.object({
7
+ const TypeSchema = zod.z
8
+ .object({
8
9
  type: zod.z.string(),
9
- }).passthrough();
10
+ })
11
+ .passthrough();
10
12
  const templateArchiveEncoder = new TextEncoder();
11
13
  const templateArchiveDecoder = new TextDecoder();
12
14
  function parseTemplate(content) {
13
15
  const data = TypeSchema.parse(JSON.parse(templateArchiveDecoder.decode(node_zlib.gunzipSync(content))));
14
- if (data.type !== 'pl.tengo-template.v2'
15
- && data.type !== 'pl.tengo-template.v3') {
16
- throw new Error('malformed template');
16
+ if (data.type !== "pl.tengo-template.v2" && data.type !== "pl.tengo-template.v3") {
17
+ throw new Error("malformed template");
17
18
  }
18
19
  return data;
19
20
  }
20
21
  function serializeTemplate(data) {
21
- return node_zlib.gzipSync(templateArchiveEncoder.encode(canonicalize(data)), { chunkSize: 256 * 1024, level: 9 });
22
+ return node_zlib.gzipSync(templateArchiveEncoder.encode(canonicalize(data)), {
23
+ chunkSize: 256 * 1024,
24
+ level: 9,
25
+ });
22
26
  }
23
27
 
24
28
  exports.parseTemplate = parseTemplate;
@@ -1 +1 @@
1
- {"version":3,"file":"serde.cjs","sources":["../src/serde.ts"],"sourcesContent":["import { gunzipSync, gzipSync } from 'node:zlib';\nimport canonicalize from 'canonicalize';\nimport type { TemplateData } from './template_data_v2';\nimport type { CompiledTemplateV3 } from './template_data_v3';\nimport { z } from 'zod';\n\nconst TypeSchema = z.object({\n type: z.string(),\n}).passthrough();\n\nconst templateArchiveEncoder = new TextEncoder();\nconst templateArchiveDecoder = new TextDecoder();\n\nexport function parseTemplate(content: Uint8Array): TemplateData | CompiledTemplateV3 {\n const data = TypeSchema.parse(JSON.parse(templateArchiveDecoder.decode(gunzipSync(content))));\n if (data.type !== 'pl.tengo-template.v2'\n && data.type !== 'pl.tengo-template.v3') {\n throw new Error('malformed template');\n }\n\n return data as unknown as TemplateData | CompiledTemplateV3;\n}\n\nexport function serializeTemplate(data: TemplateData | CompiledTemplateV3): Uint8Array {\n return gzipSync(templateArchiveEncoder.encode(canonicalize(data)), { chunkSize: 256 * 1024, level: 9 });\n}\n"],"names":["z","gunzipSync","gzipSync"],"mappings":";;;;;;AAMA,MAAM,UAAU,GAAGA,KAAC,CAAC,MAAM,CAAC;AAC1B,IAAA,IAAI,EAAEA,KAAC,CAAC,MAAM,EAAE;CACjB,CAAC,CAAC,WAAW,EAAE;AAEhB,MAAM,sBAAsB,GAAG,IAAI,WAAW,EAAE;AAChD,MAAM,sBAAsB,GAAG,IAAI,WAAW,EAAE;AAE1C,SAAU,aAAa,CAAC,OAAmB,EAAA;IAC/C,MAAM,IAAI,GAAG,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,sBAAsB,CAAC,MAAM,CAACC,oBAAU,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AAC7F,IAAA,IAAI,IAAI,CAAC,IAAI,KAAK;AACb,WAAA,IAAI,CAAC,IAAI,KAAK,sBAAsB,EAAE;AACzC,QAAA,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC;IACvC;AAEA,IAAA,OAAO,IAAoD;AAC7D;AAEM,SAAU,iBAAiB,CAAC,IAAuC,EAAA;IACvE,OAAOC,kBAAQ,CAAC,sBAAsB,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,SAAS,EAAE,GAAG,GAAG,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;AACzG;;;;;"}
1
+ {"version":3,"file":"serde.cjs","sources":["../src/serde.ts"],"sourcesContent":["import { gunzipSync, gzipSync } from \"node:zlib\";\nimport canonicalize from \"canonicalize\";\nimport type { TemplateData } from \"./template_data_v2\";\nimport type { CompiledTemplateV3 } from \"./template_data_v3\";\nimport { z } from \"zod\";\n\nconst TypeSchema = z\n .object({\n type: z.string(),\n })\n .passthrough();\n\nconst templateArchiveEncoder = new TextEncoder();\nconst templateArchiveDecoder = new TextDecoder();\n\nexport function parseTemplate(content: Uint8Array): TemplateData | CompiledTemplateV3 {\n const data = TypeSchema.parse(JSON.parse(templateArchiveDecoder.decode(gunzipSync(content))));\n if (data.type !== \"pl.tengo-template.v2\" && data.type !== \"pl.tengo-template.v3\") {\n throw new Error(\"malformed template\");\n }\n\n return data as unknown as TemplateData | CompiledTemplateV3;\n}\n\nexport function serializeTemplate(data: TemplateData | CompiledTemplateV3): Uint8Array {\n return gzipSync(templateArchiveEncoder.encode(canonicalize(data)), {\n chunkSize: 256 * 1024,\n level: 9,\n });\n}\n"],"names":["z","gunzipSync","gzipSync"],"mappings":";;;;;;AAMA,MAAM,UAAU,GAAGA;AAChB,KAAA,MAAM,CAAC;AACN,IAAA,IAAI,EAAEA,KAAC,CAAC,MAAM,EAAE;CACjB;AACA,KAAA,WAAW,EAAE;AAEhB,MAAM,sBAAsB,GAAG,IAAI,WAAW,EAAE;AAChD,MAAM,sBAAsB,GAAG,IAAI,WAAW,EAAE;AAE1C,SAAU,aAAa,CAAC,OAAmB,EAAA;IAC/C,MAAM,IAAI,GAAG,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,sBAAsB,CAAC,MAAM,CAACC,oBAAU,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AAC7F,IAAA,IAAI,IAAI,CAAC,IAAI,KAAK,sBAAsB,IAAI,IAAI,CAAC,IAAI,KAAK,sBAAsB,EAAE;AAChF,QAAA,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC;IACvC;AAEA,IAAA,OAAO,IAAoD;AAC7D;AAEM,SAAU,iBAAiB,CAAC,IAAuC,EAAA;IACvE,OAAOC,kBAAQ,CAAC,sBAAsB,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,EAAE;QACjE,SAAS,EAAE,GAAG,GAAG,IAAI;AACrB,QAAA,KAAK,EAAE,CAAC;AACT,KAAA,CAAC;AACJ;;;;;"}
package/dist/serde.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import type { TemplateData } from './template_data_v2';
2
- import type { CompiledTemplateV3 } from './template_data_v3';
1
+ import type { TemplateData } from "./template_data_v2";
2
+ import type { CompiledTemplateV3 } from "./template_data_v3";
3
3
  export declare function parseTemplate(content: Uint8Array): TemplateData | CompiledTemplateV3;
4
4
  export declare function serializeTemplate(data: TemplateData | CompiledTemplateV3): Uint8Array;
5
5
  //# sourceMappingURL=serde.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"serde.d.ts","sourceRoot":"","sources":["../src/serde.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAU7D,wBAAgB,aAAa,CAAC,OAAO,EAAE,UAAU,GAAG,YAAY,GAAG,kBAAkB,CAQpF;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,YAAY,GAAG,kBAAkB,GAAG,UAAU,CAErF"}
1
+ {"version":3,"file":"serde.d.ts","sourceRoot":"","sources":["../src/serde.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAY7D,wBAAgB,aAAa,CAAC,OAAO,EAAE,UAAU,GAAG,YAAY,GAAG,kBAAkB,CAOpF;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,YAAY,GAAG,kBAAkB,GAAG,UAAU,CAKrF"}
package/dist/serde.js CHANGED
@@ -2,21 +2,25 @@ import { gunzipSync, gzipSync } from 'node:zlib';
2
2
  import canonicalize from 'canonicalize';
3
3
  import { z } from 'zod';
4
4
 
5
- const TypeSchema = z.object({
5
+ const TypeSchema = z
6
+ .object({
6
7
  type: z.string(),
7
- }).passthrough();
8
+ })
9
+ .passthrough();
8
10
  const templateArchiveEncoder = new TextEncoder();
9
11
  const templateArchiveDecoder = new TextDecoder();
10
12
  function parseTemplate(content) {
11
13
  const data = TypeSchema.parse(JSON.parse(templateArchiveDecoder.decode(gunzipSync(content))));
12
- if (data.type !== 'pl.tengo-template.v2'
13
- && data.type !== 'pl.tengo-template.v3') {
14
- throw new Error('malformed template');
14
+ if (data.type !== "pl.tengo-template.v2" && data.type !== "pl.tengo-template.v3") {
15
+ throw new Error("malformed template");
15
16
  }
16
17
  return data;
17
18
  }
18
19
  function serializeTemplate(data) {
19
- return gzipSync(templateArchiveEncoder.encode(canonicalize(data)), { chunkSize: 256 * 1024, level: 9 });
20
+ return gzipSync(templateArchiveEncoder.encode(canonicalize(data)), {
21
+ chunkSize: 256 * 1024,
22
+ level: 9,
23
+ });
20
24
  }
21
25
 
22
26
  export { parseTemplate, serializeTemplate };
package/dist/serde.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"serde.js","sources":["../src/serde.ts"],"sourcesContent":["import { gunzipSync, gzipSync } from 'node:zlib';\nimport canonicalize from 'canonicalize';\nimport type { TemplateData } from './template_data_v2';\nimport type { CompiledTemplateV3 } from './template_data_v3';\nimport { z } from 'zod';\n\nconst TypeSchema = z.object({\n type: z.string(),\n}).passthrough();\n\nconst templateArchiveEncoder = new TextEncoder();\nconst templateArchiveDecoder = new TextDecoder();\n\nexport function parseTemplate(content: Uint8Array): TemplateData | CompiledTemplateV3 {\n const data = TypeSchema.parse(JSON.parse(templateArchiveDecoder.decode(gunzipSync(content))));\n if (data.type !== 'pl.tengo-template.v2'\n && data.type !== 'pl.tengo-template.v3') {\n throw new Error('malformed template');\n }\n\n return data as unknown as TemplateData | CompiledTemplateV3;\n}\n\nexport function serializeTemplate(data: TemplateData | CompiledTemplateV3): Uint8Array {\n return gzipSync(templateArchiveEncoder.encode(canonicalize(data)), { chunkSize: 256 * 1024, level: 9 });\n}\n"],"names":[],"mappings":";;;;AAMA,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,CAAC;AAC1B,IAAA,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;CACjB,CAAC,CAAC,WAAW,EAAE;AAEhB,MAAM,sBAAsB,GAAG,IAAI,WAAW,EAAE;AAChD,MAAM,sBAAsB,GAAG,IAAI,WAAW,EAAE;AAE1C,SAAU,aAAa,CAAC,OAAmB,EAAA;IAC/C,MAAM,IAAI,GAAG,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,sBAAsB,CAAC,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AAC7F,IAAA,IAAI,IAAI,CAAC,IAAI,KAAK;AACb,WAAA,IAAI,CAAC,IAAI,KAAK,sBAAsB,EAAE;AACzC,QAAA,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC;IACvC;AAEA,IAAA,OAAO,IAAoD;AAC7D;AAEM,SAAU,iBAAiB,CAAC,IAAuC,EAAA;IACvE,OAAO,QAAQ,CAAC,sBAAsB,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,SAAS,EAAE,GAAG,GAAG,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;AACzG;;;;"}
1
+ {"version":3,"file":"serde.js","sources":["../src/serde.ts"],"sourcesContent":["import { gunzipSync, gzipSync } from \"node:zlib\";\nimport canonicalize from \"canonicalize\";\nimport type { TemplateData } from \"./template_data_v2\";\nimport type { CompiledTemplateV3 } from \"./template_data_v3\";\nimport { z } from \"zod\";\n\nconst TypeSchema = z\n .object({\n type: z.string(),\n })\n .passthrough();\n\nconst templateArchiveEncoder = new TextEncoder();\nconst templateArchiveDecoder = new TextDecoder();\n\nexport function parseTemplate(content: Uint8Array): TemplateData | CompiledTemplateV3 {\n const data = TypeSchema.parse(JSON.parse(templateArchiveDecoder.decode(gunzipSync(content))));\n if (data.type !== \"pl.tengo-template.v2\" && data.type !== \"pl.tengo-template.v3\") {\n throw new Error(\"malformed template\");\n }\n\n return data as unknown as TemplateData | CompiledTemplateV3;\n}\n\nexport function serializeTemplate(data: TemplateData | CompiledTemplateV3): Uint8Array {\n return gzipSync(templateArchiveEncoder.encode(canonicalize(data)), {\n chunkSize: 256 * 1024,\n level: 9,\n });\n}\n"],"names":[],"mappings":";;;;AAMA,MAAM,UAAU,GAAG;AAChB,KAAA,MAAM,CAAC;AACN,IAAA,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;CACjB;AACA,KAAA,WAAW,EAAE;AAEhB,MAAM,sBAAsB,GAAG,IAAI,WAAW,EAAE;AAChD,MAAM,sBAAsB,GAAG,IAAI,WAAW,EAAE;AAE1C,SAAU,aAAa,CAAC,OAAmB,EAAA;IAC/C,MAAM,IAAI,GAAG,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,sBAAsB,CAAC,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AAC7F,IAAA,IAAI,IAAI,CAAC,IAAI,KAAK,sBAAsB,IAAI,IAAI,CAAC,IAAI,KAAK,sBAAsB,EAAE;AAChF,QAAA,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC;IACvC;AAEA,IAAA,OAAO,IAAoD;AAC7D;AAEM,SAAU,iBAAiB,CAAC,IAAuC,EAAA;IACvE,OAAO,QAAQ,CAAC,sBAAsB,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,EAAE;QACjE,SAAS,EAAE,GAAG,GAAG,IAAI;AACrB,QAAA,KAAK,EAAE,CAAC;AACT,KAAA,CAAC;AACJ;;;;"}
@@ -24,7 +24,7 @@ export interface TemplateAssetData {
24
24
  }
25
25
  export interface TemplateData {
26
26
  /** Discriminator for future use */
27
- type: 'pl.tengo-template.v2';
27
+ type: "pl.tengo-template.v2";
28
28
  /** i.e. @milaboratory/some-package:template */
29
29
  name: string;
30
30
  /** i.e. 1.2.3 */
@@ -45,7 +45,7 @@ export interface TemplateDataV3 {
45
45
  }
46
46
  export interface CompiledTemplateV3 {
47
47
  /** Discriminator for future use */
48
- type: 'pl.tengo-template.v3';
48
+ type: "pl.tengo-template.v3";
49
49
  /** Hashes of all artifacts to sources itself. */
50
50
  hashToSource: Record<string, string>;
51
51
  template: TemplateDataV3;
@@ -4,13 +4,13 @@ var plClient = require('@milaboratories/pl-client');
4
4
 
5
5
  exports.PlTemplateLibV1 = void 0;
6
6
  (function (PlTemplateLibV1) {
7
- PlTemplateLibV1.type = plClient.resourceType('TengoLib', '1');
7
+ PlTemplateLibV1.type = plClient.resourceType("TengoLib", "1");
8
8
  function fromV2Data(info) {
9
9
  return {
10
10
  data: {
11
11
  Name: info.name,
12
12
  Version: info.version,
13
- Code: Buffer.from(info.src, 'utf8').toString('base64'),
13
+ Code: Buffer.from(info.src, "utf8").toString("base64"),
14
14
  },
15
15
  };
16
16
  }
@@ -20,7 +20,7 @@ exports.PlTemplateLibV1 = void 0;
20
20
  data: {
21
21
  Name: info.name,
22
22
  Version: info.version,
23
- Code: Buffer.from(sourceCode, 'utf8').toString('base64'),
23
+ Code: Buffer.from(sourceCode, "utf8").toString("base64"),
24
24
  },
25
25
  };
26
26
  }
@@ -28,8 +28,8 @@ exports.PlTemplateLibV1 = void 0;
28
28
  })(exports.PlTemplateLibV1 || (exports.PlTemplateLibV1 = {}));
29
29
  exports.PlTemplateSoftwareV1 = void 0;
30
30
  (function (PlTemplateSoftwareV1) {
31
- PlTemplateSoftwareV1.type = plClient.resourceType('SoftwareInfo', '1');
32
- PlTemplateSoftwareV1.metaNameKey = 'ctl/runner/package/name';
31
+ PlTemplateSoftwareV1.type = plClient.resourceType("SoftwareInfo", "1");
32
+ PlTemplateSoftwareV1.metaNameKey = "ctl/runner/package/name";
33
33
  function fromV2Data(info) {
34
34
  return {
35
35
  data: info.src,
@@ -53,10 +53,10 @@ exports.PlTemplateSoftwareV1 = void 0;
53
53
  })(exports.PlTemplateSoftwareV1 || (exports.PlTemplateSoftwareV1 = {}));
54
54
  exports.PlTemplateV1 = void 0;
55
55
  (function (PlTemplateV1) {
56
- PlTemplateV1.type = plClient.resourceType('TengoTemplate', '1');
57
- PlTemplateV1.libPrefix = 'lib';
58
- PlTemplateV1.softPrefix = 'soft';
59
- PlTemplateV1.tplPrefix = 'tpl';
56
+ PlTemplateV1.type = plClient.resourceType("TengoTemplate", "1");
57
+ PlTemplateV1.libPrefix = "lib";
58
+ PlTemplateV1.softPrefix = "soft";
59
+ PlTemplateV1.tplPrefix = "tpl";
60
60
  function libField(ref, libId) {
61
61
  return plClient.field(ref, `${PlTemplateV1.libPrefix}/${libId}`);
62
62
  }
@@ -74,7 +74,7 @@ exports.PlTemplateV1 = void 0;
74
74
  data: {
75
75
  Name: info.name,
76
76
  Version: info.version,
77
- Code: Buffer.from(info.src, 'utf8').toString('base64'),
77
+ Code: Buffer.from(info.src, "utf8").toString("base64"),
78
78
  },
79
79
  };
80
80
  }
@@ -84,7 +84,7 @@ exports.PlTemplateV1 = void 0;
84
84
  data: {
85
85
  Name: info.name,
86
86
  Version: info.version,
87
- Code: Buffer.from(sourceCode, 'utf8').toString('base64'),
87
+ Code: Buffer.from(sourceCode, "utf8").toString("base64"),
88
88
  },
89
89
  };
90
90
  }
@@ -92,9 +92,9 @@ exports.PlTemplateV1 = void 0;
92
92
  })(exports.PlTemplateV1 || (exports.PlTemplateV1 = {}));
93
93
  exports.PlTemplateOverrideV1 = void 0;
94
94
  (function (PlTemplateOverrideV1) {
95
- PlTemplateOverrideV1.type = plClient.resourceType('TengoTemplateOverride', '1');
95
+ PlTemplateOverrideV1.type = plClient.resourceType("TengoTemplateOverride", "1");
96
96
  function tplField(ref) {
97
- return plClient.field(ref, 'tpl');
97
+ return plClient.field(ref, "tpl");
98
98
  }
99
99
  PlTemplateOverrideV1.tplField = tplField;
100
100
  function fromV2Data(info) {
@@ -1 +1 @@
1
- {"version":3,"file":"template_resources_v1.cjs","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(info: infoV3.TemplateLibDataV3, 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 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(info: infoV2.TemplateSoftwareData | infoV2.TemplateAssetData): 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(info: infoV3.TemplateSoftwareDataV3, sourceCode: string): 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(`template tree rendering error: template has no hash override, cannot generate PlTemplateOverrideV1.ResourceStructure from template data`);\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(`template tree rendering error: template has no hash override, cannot generate PlTemplateOverrideV1.ResourceStructure from template data`);\n }\n\n return {\n data: {\n OverrideUUID: info.hashOverride,\n },\n };\n }\n}\n"],"names":["PlTemplateLibV1","resourceType","PlTemplateSoftwareV1","PlTemplateV1","field","PlTemplateOverrideV1"],"mappings":";;;;AAIiBA;AAAjB,CAAA,UAAiB,eAAe,EAAA;AACjB,IAAA,eAAA,CAAA,IAAI,GAAGC,qBAAY,CAAC,UAAU,EAAE,GAAG,CAAC;IAejD,SAAgB,UAAU,CAAC,IAA4B,EAAA;QACrD,OAAO;AACL,YAAA,IAAI,EAAE;gBACJ,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,OAAO,EAAE,IAAI,CAAC,OAAO;AACrB,gBAAA,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC;AACvD,aAAA;SACF;IACH;AARgB,IAAA,eAAA,CAAA,UAAU,aAQzB;AAED,IAAA,SAAgB,UAAU,CAAC,IAA8B,EAAE,UAAkB,EAAA;QAC3E,OAAO;AACL,YAAA,IAAI,EAAE;gBACJ,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,OAAO,EAAE,IAAI,CAAC,OAAO;AACrB,gBAAA,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC;AACzD,aAAA;SACF;IACH;AARgB,IAAA,eAAA,CAAA,UAAU,aAQzB;AACH,CAAC,EAnCgBD,uBAAe,KAAfA,uBAAe,GAAA,EAAA,CAAA,CAAA;AAqCfE;AAAjB,CAAA,UAAiB,oBAAoB,EAAA;AACtB,IAAA,oBAAA,CAAA,IAAI,GAAGD,qBAAY,CAAC,cAAc,EAAE,GAAG,CAAC;IAUxC,oBA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AAU,CAAC,IAAyB,EAAA;AAClD,QAAA,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE;AACtB,YAAA,MAAM,IAAI,KAAK,CAAC,CAAA,uIAAA,CAAyI,CAAC;QAC5J;QAEA,OAAO;AACL,YAAA,IAAI,EAAE;gBACJ,YAAY,EAAE,IAAI,CAAC,YAAY;AAChC,aAAA;SACF;IACH;AAVgB,IAAA,oBAAA,CAAA,UAAU,aAUzB;IAED,SAAgB,UAAU,CAAC,IAA2B,EAAA;AACpD,QAAA,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE;AACtB,YAAA,MAAM,IAAI,KAAK,CAAC,CAAA,uIAAA,CAAyI,CAAC;QAC5J;QAEA,OAAO;AACL,YAAA,IAAI,EAAE;gBACJ,YAAY,EAAE,IAAI,CAAC,YAAY;AAChC,aAAA;SACF;IACH;AAVgB,IAAA,oBAAA,CAAA,UAAU,aAUzB;AACH,CAAC,EAtCgBC,4BAAoB,KAApBA,4BAAoB,GAAA,EAAA,CAAA,CAAA;;"}
1
+ {"version":3,"file":"template_resources_v1.cjs","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"],"names":["PlTemplateLibV1","resourceType","PlTemplateSoftwareV1","PlTemplateV1","field","PlTemplateOverrideV1"],"mappings":";;;;AAIiBA;AAAjB,CAAA,UAAiB,eAAe,EAAA;AACjB,IAAA,eAAA,CAAA,IAAI,GAAGC,qBAAY,CAAC,UAAU,EAAE,GAAG,CAAC;IAejD,SAAgB,UAAU,CAAC,IAA4B,EAAA;QACrD,OAAO;AACL,YAAA,IAAI,EAAE;gBACJ,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,OAAO,EAAE,IAAI,CAAC,OAAO;AACrB,gBAAA,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC;AACvD,aAAA;SACF;IACH;AARgB,IAAA,eAAA,CAAA,UAAU,aAQzB;AAED,IAAA,SAAgB,UAAU,CACxB,IAA8B,EAC9B,UAA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,CAAC,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC;AACzD,aAAA;SACF;IACH;AARgB,IAAA,YAAA,CAAA,UAAU,aAQzB;AACH,CAAC,EAjDgBD,oBAAY,KAAZA,oBAAY,GAAA,EAAA,CAAA,CAAA;AAmDZE;AAAjB,CAAA,UAAiB,oBAAoB,EAAA;AACtB,IAAA,oBAAA,CAAA,IAAI,GAAGJ,qBAAY,CAAC,uBAAuB,EAAE,GAAG,CAAC;IAM9D,SAAgB,QAAQ,CAAC,GAAmB,EAAA;AAC1C,QAAA,OAAOG,cAAK,CAAC,GAAG,EAAE,KAAK,CAAC;IAC1B;AAFgB,IAAA,oBAAA,CAAA,QAAQ,WAEvB;IAMD,SAAgB,UAAU,CAAC,IAAyB,EAAA;AAClD,QAAA,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE;AACtB,YAAA,MAAM,IAAI,KAAK,CACb,CAAA,uIAAA,CAAyI,CAC1I;QACH;QAEA,OAAO;AACL,YAAA,IAAI,EAAE;gBACJ,YAAY,EAAE,IAAI,CAAC,YAAY;AAChC,aAAA;SACF;IACH;AAZgB,IAAA,oBAAA,CAAA,UAAU,aAYzB;IAED,SAAgB,UAAU,CAAC,IAA2B,EAAA;AACpD,QAAA,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE;AACtB,YAAA,MAAM,IAAI,KAAK,CACb,CAAA,uIAAA,CAAyI,CAC1I;QACH;QAEA,OAAO;AACL,YAAA,IAAI,EAAE;gBACJ,YAAY,EAAE,IAAI,CAAC,YAAY;AAChC,aAAA;SACF;IACH;AAZgB,IAAA,oBAAA,CAAA,UAAU,aAYzB;AACH,CAAC,EA1CgBC,4BAAoB,KAApBA,4BAAoB,GAAA,EAAA,CAAA,CAAA;;"}
@@ -1,6 +1,6 @@
1
- import type { AnyFieldRef, AnyResourceRef } from '@milaboratories/pl-client';
2
- import type * as infoV2 from './template_data_v2';
3
- import type * as infoV3 from './template_data_v3';
1
+ import type { AnyFieldRef, AnyResourceRef } from "@milaboratories/pl-client";
2
+ import type * as infoV2 from "./template_data_v2";
3
+ import type * as infoV3 from "./template_data_v3";
4
4
  export declare namespace PlTemplateLibV1 {
5
5
  const type: import("@milaboratories/pl-client").ResourceType;
6
6
  type ResourceStructure = {
@@ -1 +1 @@
1
- {"version":3,"file":"template_resources_v1.d.ts","sourceRoot":"","sources":["../src/template_resources_v1.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE7E,OAAO,KAAK,KAAK,MAAM,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,KAAK,MAAM,MAAM,oBAAoB,CAAC;AAClD,yBAAiB,eAAe,CAAC;IACxB,MAAM,IAAI,kDAAgC,CAAC;IAElD,KAAY,iBAAiB,GAAG;QAC9B,IAAI,EAAE,IAAI,CAAC;KACZ,CAAC;IAEF,KAAY,IAAI,GAAG;QACjB,2CAA2C;QAC3C,IAAI,EAAE,MAAM,CAAC;QACb,iBAAiB;QACjB,OAAO,EAAE,MAAM,CAAC;QAChB,2CAA2C;QAC3C,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IAEF,SAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC,eAAe,GAAG,iBAAiB,CAQ1E;IAED,SAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC,iBAAiB,EAAE,UAAU,EAAE,MAAM,GAAG,iBAAiB,CAQhG;CACF;AAED,yBAAiB,oBAAoB,CAAC;IAC7B,MAAM,IAAI,kDAAoC,CAAC;IAEtD,KAAY,iBAAiB,GAAG;QAC9B,IAAI,EAAE,IAAI,CAAC;QACX,IAAI,EAAE,QAAQ,CAAC;KAChB,CAAC;IAEF,oDAAoD;IACpD,KAAY,IAAI,GAAG,MAAM,CAAC;IAEnB,MAAM,WAAW,4BAA4B,CAAC;IACrD,KAAY,QAAQ,GAAG;QACrB,0CAA0C;QAC1C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F;CACF;AAED,yBAAiB,oBAAoB,CAAC;IAC7B,MAAM,IAAI,kDAA6C,CAAC;IAE/D,KAAY,iBAAiB,GAAG;QAC9B,IAAI,EAAE,IAAI,CAAC;KACZ,CAAC;IAEF,SAAgB,QAAQ,CAAC,GAAG,EAAE,cAAc,GAAG,WAAW,CAEzD;IAED,KAAY,IAAI,GAAG;QACjB,YAAY,EAAE,MAAM,CAAC;KACtB,CAAC;IAEF,SAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC,YAAY,GAAG,iBAAiB,CAYvE;IAED,SAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC,cAAc,GAAG,iBAAiB,CAYzE;CACF"}
@@ -2,13 +2,13 @@ import { resourceType, field } from '@milaboratories/pl-client';
2
2
 
3
3
  var PlTemplateLibV1;
4
4
  (function (PlTemplateLibV1) {
5
- PlTemplateLibV1.type = resourceType('TengoLib', '1');
5
+ PlTemplateLibV1.type = resourceType("TengoLib", "1");
6
6
  function fromV2Data(info) {
7
7
  return {
8
8
  data: {
9
9
  Name: info.name,
10
10
  Version: info.version,
11
- Code: Buffer.from(info.src, 'utf8').toString('base64'),
11
+ Code: Buffer.from(info.src, "utf8").toString("base64"),
12
12
  },
13
13
  };
14
14
  }
@@ -18,7 +18,7 @@ var PlTemplateLibV1;
18
18
  data: {
19
19
  Name: info.name,
20
20
  Version: info.version,
21
- Code: Buffer.from(sourceCode, 'utf8').toString('base64'),
21
+ Code: Buffer.from(sourceCode, "utf8").toString("base64"),
22
22
  },
23
23
  };
24
24
  }
@@ -26,8 +26,8 @@ var PlTemplateLibV1;
26
26
  })(PlTemplateLibV1 || (PlTemplateLibV1 = {}));
27
27
  var PlTemplateSoftwareV1;
28
28
  (function (PlTemplateSoftwareV1) {
29
- PlTemplateSoftwareV1.type = resourceType('SoftwareInfo', '1');
30
- PlTemplateSoftwareV1.metaNameKey = 'ctl/runner/package/name';
29
+ PlTemplateSoftwareV1.type = resourceType("SoftwareInfo", "1");
30
+ PlTemplateSoftwareV1.metaNameKey = "ctl/runner/package/name";
31
31
  function fromV2Data(info) {
32
32
  return {
33
33
  data: info.src,
@@ -51,10 +51,10 @@ var PlTemplateSoftwareV1;
51
51
  })(PlTemplateSoftwareV1 || (PlTemplateSoftwareV1 = {}));
52
52
  var PlTemplateV1;
53
53
  (function (PlTemplateV1) {
54
- PlTemplateV1.type = resourceType('TengoTemplate', '1');
55
- PlTemplateV1.libPrefix = 'lib';
56
- PlTemplateV1.softPrefix = 'soft';
57
- PlTemplateV1.tplPrefix = 'tpl';
54
+ PlTemplateV1.type = resourceType("TengoTemplate", "1");
55
+ PlTemplateV1.libPrefix = "lib";
56
+ PlTemplateV1.softPrefix = "soft";
57
+ PlTemplateV1.tplPrefix = "tpl";
58
58
  function libField(ref, libId) {
59
59
  return field(ref, `${PlTemplateV1.libPrefix}/${libId}`);
60
60
  }
@@ -72,7 +72,7 @@ var PlTemplateV1;
72
72
  data: {
73
73
  Name: info.name,
74
74
  Version: info.version,
75
- Code: Buffer.from(info.src, 'utf8').toString('base64'),
75
+ Code: Buffer.from(info.src, "utf8").toString("base64"),
76
76
  },
77
77
  };
78
78
  }
@@ -82,7 +82,7 @@ var PlTemplateV1;
82
82
  data: {
83
83
  Name: info.name,
84
84
  Version: info.version,
85
- Code: Buffer.from(sourceCode, 'utf8').toString('base64'),
85
+ Code: Buffer.from(sourceCode, "utf8").toString("base64"),
86
86
  },
87
87
  };
88
88
  }
@@ -90,9 +90,9 @@ var PlTemplateV1;
90
90
  })(PlTemplateV1 || (PlTemplateV1 = {}));
91
91
  var PlTemplateOverrideV1;
92
92
  (function (PlTemplateOverrideV1) {
93
- PlTemplateOverrideV1.type = resourceType('TengoTemplateOverride', '1');
93
+ PlTemplateOverrideV1.type = resourceType("TengoTemplateOverride", "1");
94
94
  function tplField(ref) {
95
- return field(ref, 'tpl');
95
+ return field(ref, "tpl");
96
96
  }
97
97
  PlTemplateOverrideV1.tplField = tplField;
98
98
  function fromV2Data(info) {
@@ -1 +1 @@
1
- {"version":3,"file":"template_resources_v1.js","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(info: infoV3.TemplateLibDataV3, 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 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(info: infoV2.TemplateSoftwareData | infoV2.TemplateAssetData): 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(info: infoV3.TemplateSoftwareDataV3, sourceCode: string): 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(`template tree rendering error: template has no hash override, cannot generate PlTemplateOverrideV1.ResourceStructure from template data`);\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(`template tree rendering error: template has no hash override, cannot generate PlTemplateOverrideV1.ResourceStructure from template data`);\n }\n\n return {\n data: {\n OverrideUUID: info.hashOverride,\n },\n };\n }\n}\n"],"names":[],"mappings":";;AAIM,IAAW;AAAjB,CAAA,UAAiB,eAAe,EAAA;AACjB,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A,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE;AACtB,YAAA,MAAM,IAAI,KAAK,CAAC,CAAA,uIAAA,CAAyI,CAAC;QAC5J;QAEA,OAAO;AACL,YAAA,IAAI,EAAE;gBACJ,YAAY,EAAE,IAAI,CAAC,YAAY;AAChC,aAAA;SACF;IACH;AAVgB,IAAA,oBAAA,CAAA,UAAU,aAUzB;AACH,CAAC,EAtCgB,oBAAoB,KAApB,oBAAoB,GAAA,EAAA,CAAA,CAAA;;;;"}
1
+ {"version":3,"file":"template_resources_v1.js","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"],"names":[],"mappings":";;AAIM,IAAW;AAAjB,CAAA,UAAiB,eAAe,EAAA;AACjB,IAAA,eAAA,CAAA,IAAI,GAAG,YAAY,CAAC,UAAU,EAAE,GAAG,CAAC;IAejD,SAAgB,UAAU,CAAC,IAA4B,EAAA;QACrD,OAAO;AACL,YAAA,IAAI,EAAE;gBACJ,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,OAAO,EAAE,IAAI,CAAC,OAAO;AACrB,gBAAA,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC;AACvD,aAAA;SACF;IACH;AARgB,IAAA,eAAA,CAAA,UAAU,aAQzB;AAED,IAAA,SAAgB,UAAU,CACxB,IAA8B,EAC9B,UAAkB,EAAA;QAElB,OAAO;AACL,YAAA,IAAI,EAAE;gBACJ,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,OAAO,EAAE,IAAI,CAAC,OAAO;AACrB,gBAAA,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC;AACzD,aAAA;SACF;IACH;AAXgB,IAAA,eAAA,CAAA,UAAU,aAWzB;AACH,CAAC,EAtCgB,eAAe,KAAf,eAAe,GAAA,EAAA,CAAA,CAAA;AAwC1B,IAAW;AAAjB,CAAA,UAAiB,oBAAoB,EA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AAG,EAAE,KAAK,CAAC;IAC1B;AAFgB,IAAA,oBAAA,CAAA,QAAQ,WAEvB;IAMD,SAAgB,UAAU,CAAC,IAAyB,EAAA;AAClD,QAAA,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE;AACtB,YAAA,MAAM,IAAI,KAAK,CACb,CAAA,uIAAA,CAAyI,CAC1I;QACH;QAEA,OAAO;AACL,YAAA,IAAI,EAAE;gBACJ,YAAY,EAAE,IAAI,CAAC,YAAY;AAChC,aAAA;SACF;IACH;AAZgB,IAAA,oBAAA,CAAA,UAAU,aAYzB;IAED,SAAgB,UAAU,CAAC,IAA2B,EAAA;AACpD,QAAA,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE;AACtB,YAAA,MAAM,IAAI,KAAK,CACb,CAAA,uIAAA,CAAyI,CAC1I;QACH;QAEA,OAAO;AACL,YAAA,IAAI,EAAE;gBACJ,YAAY,EAAE,IAAI,CAAC,YAAY;AAChC,aAAA;SACF;IACH;AAZgB,IAAA,oBAAA,CAAA,UAAU,aAYzB;AACH,CAAC,EA1CgB,oBAAoB,KAApB,oBAAoB,GAAA,EAAA,CAAA,CAAA;;;;"}
package/package.json CHANGED
@@ -1,11 +1,15 @@
1
1
  {
2
2
  "name": "@milaboratories/pl-model-backend",
3
- "version": "1.1.43",
4
- "type": "module",
3
+ "version": "1.1.45",
5
4
  "description": "Backend model for Platforma.bio",
6
- "types": "./dist/index.d.ts",
5
+ "files": [
6
+ "./dist/**/*",
7
+ "./src/**/*"
8
+ ],
9
+ "type": "module",
7
10
  "main": "./dist/index.cjs",
8
11
  "module": "./dist/index.js",
12
+ "types": "./dist/index.d.ts",
9
13
  "exports": {
10
14
  ".": {
11
15
  "types": "./dist/index.d.ts",
@@ -13,28 +17,26 @@
13
17
  "require": "./dist/index.cjs"
14
18
  }
15
19
  },
16
- "files": [
17
- "./dist/**/*",
18
- "./src/**/*"
19
- ],
20
20
  "dependencies": {
21
- "zod": "~3.23.8",
22
21
  "canonicalize": "~2.1.0",
23
- "@milaboratories/pl-client": "2.16.26"
22
+ "zod": "~3.23.8",
23
+ "@milaboratories/pl-client": "2.16.28"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@types/node": "~24.5.2",
27
27
  "typescript": "~5.6.3",
28
- "@milaboratories/build-configs": "1.4.0",
29
- "@milaboratories/eslint-config": "1.0.5",
30
- "@milaboratories/ts-configs": "1.2.0",
31
- "@milaboratories/ts-builder": "1.2.4"
28
+ "@milaboratories/ts-configs": "1.2.1",
29
+ "@milaboratories/build-configs": "1.4.2",
30
+ "@milaboratories/ts-builder": "1.2.6"
32
31
  },
33
32
  "scripts": {
34
- "type-check": "ts-builder types --target node",
35
33
  "build": "ts-builder build --target node",
36
34
  "watch": "ts-builder build --target node --watch",
37
- "lint": "eslint .",
38
- "do-pack": "rm -f *.tgz && pnpm pack && mv *.tgz package.tgz"
35
+ "check": "ts-builder check --target node",
36
+ "formatter:check": "ts-builder formatter --check",
37
+ "linter:check": "ts-builder linter --check",
38
+ "types:check": "ts-builder type-check --target node",
39
+ "do-pack": "rm -f *.tgz && pnpm pack && mv *.tgz package.tgz",
40
+ "fmt": "ts-builder format"
39
41
  }
40
42
  }
package/src/index.ts CHANGED
@@ -1,4 +1,4 @@
1
- export * from './serde';
2
- export * from './template_data_v2';
3
- export * from './template_data_v3';
4
- export * from './template_resources_v1';
1
+ export * from "./serde";
2
+ export * from "./template_data_v2";
3
+ export * from "./template_data_v3";
4
+ export * from "./template_resources_v1";
package/src/serde.ts CHANGED
@@ -1,26 +1,30 @@
1
- import { gunzipSync, gzipSync } from 'node:zlib';
2
- import canonicalize from 'canonicalize';
3
- import type { TemplateData } from './template_data_v2';
4
- import type { CompiledTemplateV3 } from './template_data_v3';
5
- import { z } from 'zod';
1
+ import { gunzipSync, gzipSync } from "node:zlib";
2
+ import canonicalize from "canonicalize";
3
+ import type { TemplateData } from "./template_data_v2";
4
+ import type { CompiledTemplateV3 } from "./template_data_v3";
5
+ import { z } from "zod";
6
6
 
7
- const TypeSchema = z.object({
8
- type: z.string(),
9
- }).passthrough();
7
+ const TypeSchema = z
8
+ .object({
9
+ type: z.string(),
10
+ })
11
+ .passthrough();
10
12
 
11
13
  const templateArchiveEncoder = new TextEncoder();
12
14
  const templateArchiveDecoder = new TextDecoder();
13
15
 
14
16
  export function parseTemplate(content: Uint8Array): TemplateData | CompiledTemplateV3 {
15
17
  const data = TypeSchema.parse(JSON.parse(templateArchiveDecoder.decode(gunzipSync(content))));
16
- if (data.type !== 'pl.tengo-template.v2'
17
- && data.type !== 'pl.tengo-template.v3') {
18
- throw new Error('malformed template');
18
+ if (data.type !== "pl.tengo-template.v2" && data.type !== "pl.tengo-template.v3") {
19
+ throw new Error("malformed template");
19
20
  }
20
21
 
21
22
  return data as unknown as TemplateData | CompiledTemplateV3;
22
23
  }
23
24
 
24
25
  export function serializeTemplate(data: TemplateData | CompiledTemplateV3): Uint8Array {
25
- return gzipSync(templateArchiveEncoder.encode(canonicalize(data)), { chunkSize: 256 * 1024, level: 9 });
26
+ return gzipSync(templateArchiveEncoder.encode(canonicalize(data)), {
27
+ chunkSize: 256 * 1024,
28
+ level: 9,
29
+ });
26
30
  }
@@ -27,7 +27,7 @@ export interface TemplateAssetData {
27
27
 
28
28
  export interface TemplateData {
29
29
  /** Discriminator for future use */
30
- type: 'pl.tengo-template.v2';
30
+ type: "pl.tengo-template.v2";
31
31
 
32
32
  /** i.e. @milaboratory/some-package:template */
33
33
  name: string;
@@ -52,7 +52,7 @@ export interface TemplateDataV3 {
52
52
 
53
53
  export interface CompiledTemplateV3 {
54
54
  /** Discriminator for future use */
55
- type: 'pl.tengo-template.v3';
55
+ type: "pl.tengo-template.v3";
56
56
 
57
57
  /** Hashes of all artifacts to sources itself. */
58
58
  hashToSource: Record<string, string>;
@@ -1,9 +1,9 @@
1
- import type { AnyFieldRef, AnyResourceRef } from '@milaboratories/pl-client';
2
- import { field, resourceType } from '@milaboratories/pl-client';
3
- import type * as infoV2 from './template_data_v2';
4
- import type * as infoV3 from './template_data_v3';
1
+ import type { AnyFieldRef, AnyResourceRef } from "@milaboratories/pl-client";
2
+ import { field, resourceType } from "@milaboratories/pl-client";
3
+ import type * as infoV2 from "./template_data_v2";
4
+ import type * as infoV3 from "./template_data_v3";
5
5
  export namespace PlTemplateLibV1 {
6
- export const type = resourceType('TengoLib', '1');
6
+ export const type = resourceType("TengoLib", "1");
7
7
 
8
8
  export type ResourceStructure = {
9
9
  data: Data;
@@ -23,24 +23,27 @@ export namespace PlTemplateLibV1 {
23
23
  data: {
24
24
  Name: info.name,
25
25
  Version: info.version,
26
- Code: Buffer.from(info.src, 'utf8').toString('base64'),
26
+ Code: Buffer.from(info.src, "utf8").toString("base64"),
27
27
  },
28
28
  };
29
29
  }
30
30
 
31
- export function fromV3Data(info: infoV3.TemplateLibDataV3, sourceCode: string): ResourceStructure {
31
+ export function fromV3Data(
32
+ info: infoV3.TemplateLibDataV3,
33
+ sourceCode: string,
34
+ ): ResourceStructure {
32
35
  return {
33
36
  data: {
34
37
  Name: info.name,
35
38
  Version: info.version,
36
- Code: Buffer.from(sourceCode, 'utf8').toString('base64'),
39
+ Code: Buffer.from(sourceCode, "utf8").toString("base64"),
37
40
  },
38
41
  };
39
42
  }
40
43
  }
41
44
 
42
45
  export namespace PlTemplateSoftwareV1 {
43
- export const type = resourceType('SoftwareInfo', '1');
46
+ export const type = resourceType("SoftwareInfo", "1");
44
47
 
45
48
  export type ResourceStructure = {
46
49
  data: Data;
@@ -50,7 +53,7 @@ export namespace PlTemplateSoftwareV1 {
50
53
  /** Raw entrypoint descriptor encoded with Base64 */
51
54
  export type Data = string;
52
55
 
53
- export const metaNameKey = 'ctl/runner/package/name';
56
+ export const metaNameKey = "ctl/runner/package/name";
54
57
  export type MetaName = {
55
58
  /** i.e. @milaboratory/some-package:sw1 */
56
59
  Name: string;
@@ -58,7 +61,9 @@ export namespace PlTemplateSoftwareV1 {
58
61
  Version: string;
59
62
  };
60
63
 
61
- export function fromV2Data(info: infoV2.TemplateSoftwareData | infoV2.TemplateAssetData): ResourceStructure {
64
+ export function fromV2Data(
65
+ info: infoV2.TemplateSoftwareData | infoV2.TemplateAssetData,
66
+ ): ResourceStructure {
62
67
  return {
63
68
  data: info.src,
64
69
  name: {
@@ -68,7 +73,10 @@ export namespace PlTemplateSoftwareV1 {
68
73
  };
69
74
  }
70
75
 
71
- export function fromV3Data(info: infoV3.TemplateSoftwareDataV3, sourceCode: string): ResourceStructure {
76
+ export function fromV3Data(
77
+ info: infoV3.TemplateSoftwareDataV3,
78
+ sourceCode: string,
79
+ ): ResourceStructure {
72
80
  return {
73
81
  data: sourceCode,
74
82
  name: {
@@ -80,15 +88,15 @@ export namespace PlTemplateSoftwareV1 {
80
88
  }
81
89
 
82
90
  export namespace PlTemplateV1 {
83
- export const type = resourceType('TengoTemplate', '1');
91
+ export const type = resourceType("TengoTemplate", "1");
84
92
 
85
93
  export type ResourceStructure = {
86
94
  data: Data;
87
95
  };
88
96
 
89
- export const libPrefix = 'lib';
90
- export const softPrefix = 'soft';
91
- export const tplPrefix = 'tpl';
97
+ export const libPrefix = "lib";
98
+ export const softPrefix = "soft";
99
+ export const tplPrefix = "tpl";
92
100
 
93
101
  export function libField(ref: AnyResourceRef, libId: string): AnyFieldRef {
94
102
  return field(ref, `${libPrefix}/${libId}`);
@@ -114,7 +122,7 @@ export namespace PlTemplateV1 {
114
122
  data: {
115
123
  Name: info.name,
116
124
  Version: info.version,
117
- Code: Buffer.from(info.src, 'utf8').toString('base64'),
125
+ Code: Buffer.from(info.src, "utf8").toString("base64"),
118
126
  },
119
127
  };
120
128
  }
@@ -124,21 +132,21 @@ export namespace PlTemplateV1 {
124
132
  data: {
125
133
  Name: info.name,
126
134
  Version: info.version,
127
- Code: Buffer.from(sourceCode, 'utf8').toString('base64'),
135
+ Code: Buffer.from(sourceCode, "utf8").toString("base64"),
128
136
  },
129
137
  };
130
138
  }
131
139
  }
132
140
 
133
141
  export namespace PlTemplateOverrideV1 {
134
- export const type = resourceType('TengoTemplateOverride', '1');
142
+ export const type = resourceType("TengoTemplateOverride", "1");
135
143
 
136
144
  export type ResourceStructure = {
137
145
  data: Data;
138
146
  };
139
147
 
140
148
  export function tplField(ref: AnyResourceRef): AnyFieldRef {
141
- return field(ref, 'tpl');
149
+ return field(ref, "tpl");
142
150
  }
143
151
 
144
152
  export type Data = {
@@ -147,7 +155,9 @@ export namespace PlTemplateOverrideV1 {
147
155
 
148
156
  export function fromV2Data(info: infoV2.TemplateData): ResourceStructure {
149
157
  if (!info.hashOverride) {
150
- throw new Error(`template tree rendering error: template has no hash override, cannot generate PlTemplateOverrideV1.ResourceStructure from template data`);
158
+ throw new Error(
159
+ `template tree rendering error: template has no hash override, cannot generate PlTemplateOverrideV1.ResourceStructure from template data`,
160
+ );
151
161
  }
152
162
 
153
163
  return {
@@ -159,7 +169,9 @@ export namespace PlTemplateOverrideV1 {
159
169
 
160
170
  export function fromV3Data(info: infoV3.TemplateDataV3): ResourceStructure {
161
171
  if (!info.hashOverride) {
162
- throw new Error(`template tree rendering error: template has no hash override, cannot generate PlTemplateOverrideV1.ResourceStructure from template data`);
172
+ throw new Error(
173
+ `template tree rendering error: template has no hash override, cannot generate PlTemplateOverrideV1.ResourceStructure from template data`,
174
+ );
163
175
  }
164
176
 
165
177
  return {