@milaboratories/pl-model-backend 1.1.0 → 1.1.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.js.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/serde.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/serde.ts +4 -4
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/serde.ts","../src/template_resources_v1.ts"],"sourcesContent":["import { gunzipSync, gzipSync } from 'node:zlib';\nimport canonicalize from 'canonicalize';\nimport { TemplateData } from './template_data_v2';\nimport { 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'
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/serde.ts","../src/template_resources_v1.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","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":["TypeSchema","z","templateArchiveEncoder","templateArchiveDecoder","parseTemplate","content","data","gunzipSync","serializeTemplate","gzipSync","canonicalize","PlTemplateLibV1","resourceType","fromV2Data","info","fromV3Data","sourceCode","PlTemplateSoftwareV1","PlTemplateV1","libField","ref","libId","field","tplField","tplId","swField","softwareId","PlTemplateOverrideV1"],"mappings":"+LAMMA,EAAaC,IAAE,OAAO,CAC1B,KAAMA,IAAE,OAAO,CACjB,CAAC,EAAE,YAAY,EAETC,EAAyB,IAAI,YAC7BC,EAAyB,IAAI,YAE5B,SAASC,EAAcC,EAAwD,CAC9E,MAAAC,EAAON,EAAW,MAAM,KAAK,MAAMG,EAAuB,OAAOI,EAAAA,WAAWF,CAAO,CAAC,CAAC,CAAC,EAC5F,GAAIC,EAAK,OAAS,wBACbA,EAAK,OAAS,uBACX,MAAA,IAAI,MAAM,oBAAoB,EAG/B,OAAAA,CACT,CAEO,SAASE,EAAkBF,EAAqD,CACrF,OAAOG,EAAS,SAAAP,EAAuB,OAAOQ,EAAaJ,CAAI,CAAC,EAAG,CAAE,UAAW,IAAM,KAAM,MAAO,EAAG,CACxG,CCrBiBK,QAAAA,gBAAAA,QAAAA,GAAV,CACQA,EAAA,KAAOC,eAAa,WAAY,GAAG,EAezC,SAASC,EAAWC,EAAiD,CACnE,MAAA,CACL,KAAM,CACJ,KAAMA,EAAK,KACX,QAASA,EAAK,QACd,KAAM,OAAO,KAAKA,EAAK,IAAK,MAAM,EAAE,SAAS,QAAQ,CAAA,CAEzD,CAAA,CAPKH,EAAS,WAAAE,EAUA,SAAAE,EAAWD,EAAgCE,EAAuC,CACzF,MAAA,CACL,KAAM,CACJ,KAAMF,EAAK,KACX,QAASA,EAAK,QACd,KAAM,OAAO,KAAKE,EAAY,MAAM,EAAE,SAAS,QAAQ,CAAA,CAE3D,CAAA,CAPKL,EAAS,WAAAI,CAAA,GA1BDJ,QAAA,kBAAAA,wBAAA,CAAA,EAAA,EAqCAM,QAAAA,qBAAAA,QAAAA,GAAV,CACQA,EAAA,KAAOL,eAAa,eAAgB,GAAG,EAUv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PKE,EAAS,WAAAH,CAAA,GAxCDG,QAAA,eAAAA,qBAAA,CAAA,EAAA,EAmDAS,QAAAA,qBAAAA,QAAAA,GAAV,CACQA,EAAA,KAAOf,eAAa,wBAAyB,GAAG,EAMtD,SAASW,EAASH,EAAkC,CAClD,OAAAE,EAAA,MAAMF,EAAK,KAAK,CAAA,CADlBO,EAAS,SAAAJ,EAQT,SAASV,EAAWC,EAA8C,CACnE,GAAA,CAACA,EAAK,aACF,MAAA,IAAI,MAAM,yIAAyI,EAGpJ,MAAA,CACL,KAAM,CACJ,aAAcA,EAAK,YAAA,CAEvB,CAAA,CATKa,EAAS,WAAAd,EAYT,SAASE,EAAWD,EAAgD,CACrE,GAAA,CAACA,EAAK,aACF,MAAA,IAAI,MAAM,yIAAyI,EAGpJ,MAAA,CACL,KAAM,CACJ,aAAcA,EAAK,YAAA,CAEvB,CAAA,CATKa,EAAS,WAAAZ,CAAA,GA3BDY,QAAA,uBAAAA,6BAAA,CAAA,EAAA"}
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../src/serde.ts","../src/template_resources_v1.ts"],"sourcesContent":["import { gunzipSync, gzipSync } from 'node:zlib';\nimport canonicalize from 'canonicalize';\nimport { TemplateData } from './template_data_v2';\nimport { 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'
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../src/serde.ts","../src/template_resources_v1.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","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":["TypeSchema","z","templateArchiveEncoder","templateArchiveDecoder","parseTemplate","content","data","gunzipSync","serializeTemplate","gzipSync","canonicalize","PlTemplateLibV1","resourceType","fromV2Data","info","fromV3Data","sourceCode","PlTemplateSoftwareV1","PlTemplateV1","libField","ref","libId","field","tplField","tplId","swField","softwareId","PlTemplateOverrideV1"],"mappings":";;;;AAMA,MAAMA,IAAaC,EAAE,OAAO;AAAA,EAC1B,MAAMA,EAAE,OAAO;AACjB,CAAC,EAAE,YAAY,GAETC,IAAyB,IAAI,YAAY,GACzCC,IAAyB,IAAI,YAAY;AAExC,SAASC,EAAcC,GAAwD;AAC9E,QAAAC,IAAON,EAAW,MAAM,KAAK,MAAMG,EAAuB,OAAOI,EAAWF,CAAO,CAAC,CAAC,CAAC;AAC5F,MAAIC,EAAK,SAAS,0BACbA,EAAK,SAAS;AACX,UAAA,IAAI,MAAM,oBAAoB;AAG/B,SAAAA;AACT;AAEO,SAASE,EAAkBF,GAAqD;AACrF,SAAOG,EAASP,EAAuB,OAAOQ,EAAaJ,CAAI,CAAC,GAAG,EAAE,WAAW,MAAM,MAAM,OAAO,GAAG;AACxG;ACrBiB,IAAAK;AAAA,CAAV,CAAUA,MAAV;AACQA,EAAAA,EAAA,OAAOC,EAAa,YAAY,GAAG;AAezC,WAASC,EAAWC,GAAiD;AACnE,WAAA;AAAA,MACL,MAAM;AAAA,QACJ,MAAMA,EAAK;AA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gD;AACrE,QAAA,CAACA,EAAK;AACF,YAAA,IAAI,MAAM,yIAAyI;AAGpJ,WAAA;AAAA,MACL,MAAM;AAAA,QACJ,cAAcA,EAAK;AAAA,MAAA;AAAA,IAEvB;AAAA,EAAA;AATKa,EAAAA,EAAS,aAAAZ;AAAA,GA3BDY,MAAAA,IAAA,CAAA,EAAA;"}
|
package/dist/serde.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serde.d.ts","sourceRoot":"","sources":["../src/serde.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;
|
|
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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@milaboratories/pl-model-backend",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "Backend model for Platforma.bio",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@types/node": "~20.16.15",
|
|
26
26
|
"typescript": "~5.5.4",
|
|
27
|
-
"vite": "^
|
|
28
|
-
"@milaboratories/
|
|
27
|
+
"vite": "^6.3.5",
|
|
28
|
+
"@milaboratories/build-configs": "1.0.4",
|
|
29
29
|
"@milaboratories/eslint-config": "^1.0.4"
|
|
30
30
|
},
|
|
31
31
|
"scripts": {
|
package/src/serde.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { gunzipSync, gzipSync } from 'node:zlib';
|
|
2
2
|
import canonicalize from 'canonicalize';
|
|
3
|
-
import { TemplateData } from './template_data_v2';
|
|
4
|
-
import { CompiledTemplateV3 } from './template_data_v3';
|
|
3
|
+
import type { TemplateData } from './template_data_v2';
|
|
4
|
+
import type { CompiledTemplateV3 } from './template_data_v3';
|
|
5
5
|
import { z } from 'zod';
|
|
6
6
|
|
|
7
7
|
const TypeSchema = z.object({
|
|
@@ -13,8 +13,8 @@ const templateArchiveDecoder = new TextDecoder();
|
|
|
13
13
|
|
|
14
14
|
export function parseTemplate(content: Uint8Array): TemplateData | CompiledTemplateV3 {
|
|
15
15
|
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') {
|
|
16
|
+
if (data.type !== 'pl.tengo-template.v2'
|
|
17
|
+
&& data.type !== 'pl.tengo-template.v3') {
|
|
18
18
|
throw new Error('malformed template');
|
|
19
19
|
}
|
|
20
20
|
|