@milaboratories/pl-model-middle-layer 1.21.0 → 1.22.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.
- package/dist/block_meta/block_components.cjs +19 -26
- package/dist/block_meta/block_components.cjs.map +1 -1
- package/dist/block_meta/block_components.d.ts +46 -428
- package/dist/block_meta/block_components.d.ts.map +1 -1
- package/dist/block_meta/block_components.js +19 -23
- package/dist/block_meta/block_components.js.map +1 -1
- package/dist/block_meta/block_description.cjs +5 -3
- package/dist/block_meta/block_description.cjs.map +1 -1
- package/dist/block_meta/block_description.d.ts +402 -914
- package/dist/block_meta/block_description.d.ts.map +1 -1
- package/dist/block_meta/block_description.js +5 -3
- package/dist/block_meta/block_description.js.map +1 -1
- package/dist/block_meta/block_id.d.ts +4 -4
- package/dist/block_meta/block_manifest.cjs +10 -1
- package/dist/block_meta/block_manifest.cjs.map +1 -1
- package/dist/block_meta/block_manifest.d.ts +1045 -1623
- package/dist/block_meta/block_manifest.d.ts.map +1 -1
- package/dist/block_meta/block_manifest.js +11 -2
- package/dist/block_meta/block_manifest.js.map +1 -1
- package/dist/block_meta/block_meta.cjs.map +1 -1
- package/dist/block_meta/block_meta.d.ts +164 -246
- package/dist/block_meta/block_meta.d.ts.map +1 -1
- package/dist/block_meta/block_meta.js.map +1 -1
- package/dist/block_meta/content_types.cjs +25 -77
- package/dist/block_meta/content_types.cjs.map +1 -1
- package/dist/block_meta/content_types.d.ts +71 -387
- package/dist/block_meta/content_types.d.ts.map +1 -1
- package/dist/block_meta/content_types.js +26 -64
- package/dist/block_meta/content_types.js.map +1 -1
- package/dist/block_meta/index.d.ts +3 -3
- package/dist/block_registry/block_pack_spec.d.ts +16 -16
- package/dist/block_registry/overview.d.ts +1534 -1534
- package/dist/block_registry/registry_spec.d.ts +12 -12
- package/dist/index.cjs +1 -18
- package/dist/index.d.ts +4 -4
- package/dist/index.js +3 -3
- package/package.json +2 -2
- package/src/block_meta/block_components.ts +67 -42
- package/src/block_meta/block_description.ts +18 -3
- package/src/block_meta/block_manifest.ts +14 -3
- package/src/block_meta/block_meta.ts +40 -6
- package/src/block_meta/content_types.ts +149 -207
|
@@ -1,36 +1,29 @@
|
|
|
1
1
|
require("../_virtual/_rolldown/runtime.cjs");
|
|
2
|
-
const require_content_types = require("./content_types.cjs");
|
|
3
|
-
const require_content_conversion = require("./content_conversion.cjs");
|
|
4
2
|
let zod = require("zod");
|
|
5
3
|
//#region src/block_meta/block_components.ts
|
|
6
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Builds the zod schema for a wrapped workflow component carrying `content`
|
|
6
|
+
* as the `main` payload. Shared between the `package.json` boundary parser
|
|
7
|
+
* (where `content` is `z.string()`) and the manifest schema (where `content`
|
|
8
|
+
* is `ContentRelative`).
|
|
9
|
+
*/
|
|
10
|
+
function WorkflowSchemaV1(content) {
|
|
7
11
|
return zod.z.object({
|
|
8
12
|
type: zod.z.literal("workflow-v1"),
|
|
9
|
-
main:
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
function Workflow(contentType) {
|
|
13
|
-
return zod.z.union([contentType.transform((value) => ({
|
|
14
|
-
type: "workflow-v1",
|
|
15
|
-
main: value
|
|
16
|
-
})).pipe(WorkflowV1(contentType)), zod.z.discriminatedUnion("type", [WorkflowV1(contentType)])]);
|
|
17
|
-
}
|
|
18
|
-
function BlockComponents(wfAndModel, ui) {
|
|
19
|
-
return zod.z.object({
|
|
20
|
-
workflow: Workflow(wfAndModel),
|
|
21
|
-
model: wfAndModel,
|
|
22
|
-
ui
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
const BlockComponentsDescriptionRaw = BlockComponents(zod.z.string(), zod.z.string());
|
|
26
|
-
function BlockComponentsAbsoluteUrl(prefix) {
|
|
27
|
-
return BlockComponents(require_content_types.ContentRelativeBinary.transform(require_content_conversion.mapRemoteToAbsolute(prefix)), require_content_types.ContentRelativeBinary.transform(require_content_conversion.mapRemoteToAbsolute(prefix)));
|
|
13
|
+
main: content
|
|
14
|
+
}).strict();
|
|
28
15
|
}
|
|
16
|
+
const WorkflowDescriptionRaw = zod.z.union([zod.z.string().transform((value) => ({
|
|
17
|
+
type: "workflow-v1",
|
|
18
|
+
main: value
|
|
19
|
+
})), WorkflowSchemaV1(zod.z.string())]);
|
|
20
|
+
const BlockComponentsDescriptionRaw = zod.z.object({
|
|
21
|
+
workflow: WorkflowDescriptionRaw,
|
|
22
|
+
model: zod.z.string(),
|
|
23
|
+
ui: zod.z.string()
|
|
24
|
+
});
|
|
29
25
|
//#endregion
|
|
30
|
-
exports.BlockComponents = BlockComponents;
|
|
31
|
-
exports.BlockComponentsAbsoluteUrl = BlockComponentsAbsoluteUrl;
|
|
32
26
|
exports.BlockComponentsDescriptionRaw = BlockComponentsDescriptionRaw;
|
|
33
|
-
exports.
|
|
34
|
-
exports.WorkflowV1 = WorkflowV1;
|
|
27
|
+
exports.WorkflowSchemaV1 = WorkflowSchemaV1;
|
|
35
28
|
|
|
36
29
|
//# sourceMappingURL=block_components.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block_components.cjs","names":["z"
|
|
1
|
+
{"version":3,"file":"block_components.cjs","names":["z"],"sources":["../../src/block_meta/block_components.ts"],"sourcesContent":["import { z } from \"zod\";\n\n//\n// Workflow + BlockComponents canonical TS types.\n//\n\n/**\n * Wrapped workflow component, schema version 1. Currently the only workflow\n * schema; carries a single `main` entry pointing at the workflow source.\n */\nexport type WorkflowV1<Content> = {\n type: \"workflow-v1\";\n main: Content;\n};\n\n/**\n * Current workflow component shape. Alias to `WorkflowV1` while v1 is the\n * only version — future versions widen this to a discriminated union.\n */\nexport type Workflow<Content> = WorkflowV1<Content>;\n\n/**\n * Trio of artifacts every block ships: a workflow (Tengo source), a model\n * (compiled JS), and a UI (front-end bundle). `WMContent` carries\n * `workflow.main` and `model` together (they travel as files); `UIContent`\n * carries the UI bundle (a folder when resolved locally, a relative path in\n * manifest form). Parameterizing this lets the same shape express every\n * stage the description passes through: raw `package.json` input (bare\n * strings), manifest form (relative paths stored in the registry), resolved\n * absolute form (local file/folder paths), and the registry-reader output\n * (URLs into registry storage, produced by `blockComponentsManifestToAbsoluteUrl`).\n */\nexport type BlockComponents<WMContent, UIContent> = {\n workflow: Workflow<WMContent>;\n model: WMContent;\n ui: UIContent;\n};\n\n/**\n * Builds the zod schema for a wrapped workflow component carrying `content`\n * as the `main` payload. Shared between the `package.json` boundary parser\n * (where `content` is `z.string()`) and the manifest schema (where `content`\n * is `ContentRelative`).\n */\nexport function WorkflowSchemaV1<C extends z.ZodTypeAny>(content: C) {\n return z\n .object({\n type: z.literal(\"workflow-v1\"),\n main: content,\n })\n .strict();\n}\n\n//\n// `package.json` boundary schema. The workflow field accepts either a bare\n// string (treated as `main`) or the wrapped object form; both normalize to\n// the canonical wrapped shape.\n//\n\nconst WorkflowDescriptionRaw = z.union([\n z.string().transform<WorkflowV1<string>>((value) => ({\n type: \"workflow-v1\",\n main: value,\n })),\n WorkflowSchemaV1(z.string()),\n]) satisfies z.ZodType<Workflow<string>, z.ZodTypeDef, any>;\n\nexport type BlockComponentsDescriptionRaw = BlockComponents<string, string>;\n\nexport const BlockComponentsDescriptionRaw = z.object({\n workflow: WorkflowDescriptionRaw,\n model: z.string(),\n ui: z.string(),\n}) satisfies z.ZodType<BlockComponentsDescriptionRaw, z.ZodTypeDef, any>;\n"],"mappings":";;;;;;;;;AA4CA,SAAgB,iBAAyC,SAAY;AACnE,QAAOA,IAAAA,EACJ,OAAO;EACN,MAAMA,IAAAA,EAAE,QAAQ,cAAc;EAC9B,MAAM;EACP,CAAC,CACD,QAAQ;;AASb,MAAM,yBAAyBA,IAAAA,EAAE,MAAM,CACrCA,IAAAA,EAAE,QAAQ,CAAC,WAA+B,WAAW;CACnD,MAAM;CACN,MAAM;CACP,EAAE,EACH,iBAAiBA,IAAAA,EAAE,QAAQ,CAAC,CAC7B,CAAC;AAIF,MAAa,gCAAgCA,IAAAA,EAAE,OAAO;CACpD,UAAU;CACV,OAAOA,IAAAA,EAAE,QAAQ;CACjB,IAAIA,IAAAA,EAAE,QAAQ;CACf,CAAC"}
|
|
@@ -1,141 +1,67 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
|
|
3
3
|
//#region src/block_meta/block_components.d.ts
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
main: Content;
|
|
10
|
-
}>, any> extends infer T ? { [k in keyof T]: T[k] } : never, z.baseObjectInputType<{
|
|
11
|
-
type: z.ZodLiteral<"workflow-v1">;
|
|
12
|
-
main: Content;
|
|
13
|
-
}> extends infer T_1 ? { [k_1 in keyof T_1]: T_1[k_1] } : never>;
|
|
14
|
-
declare function Workflow<const Content extends z.ZodTypeAny>(contentType: Content): z.ZodUnion<[z.ZodPipeline<z.ZodEffects<Content, {
|
|
4
|
+
/**
|
|
5
|
+
* Wrapped workflow component, schema version 1. Currently the only workflow
|
|
6
|
+
* schema; carries a single `main` entry pointing at the workflow source.
|
|
7
|
+
*/
|
|
8
|
+
type WorkflowV1<Content> = {
|
|
15
9
|
type: "workflow-v1";
|
|
16
|
-
main: z.TypeOf<Content>;
|
|
17
|
-
}, z.input<Content>>, z.ZodObject<{
|
|
18
|
-
type: z.ZodLiteral<"workflow-v1">;
|
|
19
|
-
main: Content;
|
|
20
|
-
}, "strip", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
|
|
21
|
-
type: z.ZodLiteral<"workflow-v1">;
|
|
22
10
|
main: Content;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Current workflow component shape. Alias to `WorkflowV1` while v1 is the
|
|
14
|
+
* only version — future versions widen this to a discriminated union.
|
|
15
|
+
*/
|
|
16
|
+
type Workflow<Content> = WorkflowV1<Content>;
|
|
17
|
+
/**
|
|
18
|
+
* Trio of artifacts every block ships: a workflow (Tengo source), a model
|
|
19
|
+
* (compiled JS), and a UI (front-end bundle). `WMContent` carries
|
|
20
|
+
* `workflow.main` and `model` together (they travel as files); `UIContent`
|
|
21
|
+
* carries the UI bundle (a folder when resolved locally, a relative path in
|
|
22
|
+
* manifest form). Parameterizing this lets the same shape express every
|
|
23
|
+
* stage the description passes through: raw `package.json` input (bare
|
|
24
|
+
* strings), manifest form (relative paths stored in the registry), resolved
|
|
25
|
+
* absolute form (local file/folder paths), and the registry-reader output
|
|
26
|
+
* (URLs into registry storage, produced by `blockComponentsManifestToAbsoluteUrl`).
|
|
27
|
+
*/
|
|
28
|
+
type BlockComponents<WMContent, UIContent> = {
|
|
29
|
+
workflow: Workflow<WMContent>;
|
|
30
|
+
model: WMContent;
|
|
31
|
+
ui: UIContent;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Builds the zod schema for a wrapped workflow component carrying `content`
|
|
35
|
+
* as the `main` payload. Shared between the `package.json` boundary parser
|
|
36
|
+
* (where `content` is `z.string()`) and the manifest schema (where `content`
|
|
37
|
+
* is `ContentRelative`).
|
|
38
|
+
*/
|
|
39
|
+
declare function WorkflowSchemaV1<C extends z.ZodTypeAny>(content: C): z.ZodObject<{
|
|
27
40
|
type: z.ZodLiteral<"workflow-v1">;
|
|
28
|
-
main:
|
|
29
|
-
}, "
|
|
41
|
+
main: C;
|
|
42
|
+
}, "strict", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
|
|
30
43
|
type: z.ZodLiteral<"workflow-v1">;
|
|
31
|
-
main:
|
|
32
|
-
}>, any> extends infer
|
|
44
|
+
main: C;
|
|
45
|
+
}>, any> extends infer T ? { [k in keyof T]: T[k] } : never, z.baseObjectInputType<{
|
|
33
46
|
type: z.ZodLiteral<"workflow-v1">;
|
|
34
|
-
main:
|
|
35
|
-
}> extends infer
|
|
36
|
-
|
|
37
|
-
workflow: z.ZodUnion<[z.ZodPipeline<z.ZodEffects<WfAndModel, {
|
|
38
|
-
type: "workflow-v1";
|
|
39
|
-
main: z.TypeOf<WfAndModel>;
|
|
40
|
-
}, z.input<WfAndModel>>, z.ZodObject<{
|
|
41
|
-
type: z.ZodLiteral<"workflow-v1">;
|
|
42
|
-
main: WfAndModel;
|
|
43
|
-
}, "strip", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
|
|
44
|
-
type: z.ZodLiteral<"workflow-v1">;
|
|
45
|
-
main: WfAndModel;
|
|
46
|
-
}>, any> extends infer T ? { [k in keyof T]: T[k] } : never, z.baseObjectInputType<{
|
|
47
|
-
type: z.ZodLiteral<"workflow-v1">;
|
|
48
|
-
main: WfAndModel;
|
|
49
|
-
}> extends infer T_1 ? { [k_1 in keyof T_1]: T_1[k_1] } : never>>, z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
50
|
-
type: z.ZodLiteral<"workflow-v1">;
|
|
51
|
-
main: WfAndModel;
|
|
52
|
-
}, "strip", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
|
|
53
|
-
type: z.ZodLiteral<"workflow-v1">;
|
|
54
|
-
main: WfAndModel;
|
|
55
|
-
}>, any> extends infer T_2 ? { [k in keyof T_2]: T_2[k] } : never, z.baseObjectInputType<{
|
|
56
|
-
type: z.ZodLiteral<"workflow-v1">;
|
|
57
|
-
main: WfAndModel;
|
|
58
|
-
}> extends infer T_3 ? { [k_1 in keyof T_3]: T_3[k_1] } : never>]>]>;
|
|
59
|
-
model: WfAndModel;
|
|
60
|
-
ui: UI;
|
|
61
|
-
}, "strip", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
|
|
62
|
-
workflow: z.ZodUnion<[z.ZodPipeline<z.ZodEffects<WfAndModel, {
|
|
63
|
-
type: "workflow-v1";
|
|
64
|
-
main: z.TypeOf<WfAndModel>;
|
|
65
|
-
}, z.input<WfAndModel>>, z.ZodObject<{
|
|
66
|
-
type: z.ZodLiteral<"workflow-v1">;
|
|
67
|
-
main: WfAndModel;
|
|
68
|
-
}, "strip", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
|
|
69
|
-
type: z.ZodLiteral<"workflow-v1">;
|
|
70
|
-
main: WfAndModel;
|
|
71
|
-
}>, any> extends infer T_5 ? { [k in keyof T_5]: T_5[k] } : never, z.baseObjectInputType<{
|
|
72
|
-
type: z.ZodLiteral<"workflow-v1">;
|
|
73
|
-
main: WfAndModel;
|
|
74
|
-
}> extends infer T_6 ? { [k_1 in keyof T_6]: T_6[k_1] } : never>>, z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
75
|
-
type: z.ZodLiteral<"workflow-v1">;
|
|
76
|
-
main: WfAndModel;
|
|
77
|
-
}, "strip", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
|
|
78
|
-
type: z.ZodLiteral<"workflow-v1">;
|
|
79
|
-
main: WfAndModel;
|
|
80
|
-
}>, any> extends infer T_7 ? { [k in keyof T_7]: T_7[k] } : never, z.baseObjectInputType<{
|
|
81
|
-
type: z.ZodLiteral<"workflow-v1">;
|
|
82
|
-
main: WfAndModel;
|
|
83
|
-
}> extends infer T_8 ? { [k_1 in keyof T_8]: T_8[k_1] } : never>]>]>;
|
|
84
|
-
model: WfAndModel;
|
|
85
|
-
ui: UI;
|
|
86
|
-
}>, any> extends infer T_4 ? { [k_2 in keyof T_4]: T_4[k_2] } : never, z.baseObjectInputType<{
|
|
87
|
-
workflow: z.ZodUnion<[z.ZodPipeline<z.ZodEffects<WfAndModel, {
|
|
88
|
-
type: "workflow-v1";
|
|
89
|
-
main: z.TypeOf<WfAndModel>;
|
|
90
|
-
}, z.input<WfAndModel>>, z.ZodObject<{
|
|
91
|
-
type: z.ZodLiteral<"workflow-v1">;
|
|
92
|
-
main: WfAndModel;
|
|
93
|
-
}, "strip", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
|
|
94
|
-
type: z.ZodLiteral<"workflow-v1">;
|
|
95
|
-
main: WfAndModel;
|
|
96
|
-
}>, any> extends infer T_10 ? { [k in keyof T_10]: T_10[k] } : never, z.baseObjectInputType<{
|
|
97
|
-
type: z.ZodLiteral<"workflow-v1">;
|
|
98
|
-
main: WfAndModel;
|
|
99
|
-
}> extends infer T_11 ? { [k_1 in keyof T_11]: T_11[k_1] } : never>>, z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
100
|
-
type: z.ZodLiteral<"workflow-v1">;
|
|
101
|
-
main: WfAndModel;
|
|
102
|
-
}, "strip", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
|
|
103
|
-
type: z.ZodLiteral<"workflow-v1">;
|
|
104
|
-
main: WfAndModel;
|
|
105
|
-
}>, any> extends infer T_12 ? { [k in keyof T_12]: T_12[k] } : never, z.baseObjectInputType<{
|
|
106
|
-
type: z.ZodLiteral<"workflow-v1">;
|
|
107
|
-
main: WfAndModel;
|
|
108
|
-
}> extends infer T_13 ? { [k_1 in keyof T_13]: T_13[k_1] } : never>]>]>;
|
|
109
|
-
model: WfAndModel;
|
|
110
|
-
ui: UI;
|
|
111
|
-
}> extends infer T_9 ? { [k_3 in keyof T_9]: T_9[k_3] } : never>;
|
|
47
|
+
main: C;
|
|
48
|
+
}> extends infer T_1 ? { [k_1 in keyof T_1]: T_1[k_1] } : never>;
|
|
49
|
+
type BlockComponentsDescriptionRaw = BlockComponents<string, string>;
|
|
112
50
|
declare const BlockComponentsDescriptionRaw: z.ZodObject<{
|
|
113
|
-
workflow: z.ZodUnion<[z.
|
|
114
|
-
type: "workflow-v1";
|
|
115
|
-
main: string;
|
|
116
|
-
}, string>, z.ZodObject<{
|
|
117
|
-
type: z.ZodLiteral<"workflow-v1">;
|
|
118
|
-
main: z.ZodString;
|
|
119
|
-
}, "strip", z.ZodTypeAny, {
|
|
120
|
-
type: "workflow-v1";
|
|
121
|
-
main: string;
|
|
122
|
-
}, {
|
|
123
|
-
type: "workflow-v1";
|
|
124
|
-
main: string;
|
|
125
|
-
}>>, z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
51
|
+
workflow: z.ZodUnion<[z.ZodEffects<z.ZodString, WorkflowV1<string>, string>, z.ZodObject<{
|
|
126
52
|
type: z.ZodLiteral<"workflow-v1">;
|
|
127
53
|
main: z.ZodString;
|
|
128
|
-
}, "
|
|
54
|
+
}, "strict", z.ZodTypeAny, {
|
|
129
55
|
type: "workflow-v1";
|
|
130
56
|
main: string;
|
|
131
57
|
}, {
|
|
132
58
|
type: "workflow-v1";
|
|
133
59
|
main: string;
|
|
134
|
-
}>]
|
|
60
|
+
}>]>;
|
|
135
61
|
model: z.ZodString;
|
|
136
62
|
ui: z.ZodString;
|
|
137
63
|
}, "strip", z.ZodTypeAny, {
|
|
138
|
-
workflow: {
|
|
64
|
+
workflow: WorkflowV1<string> | {
|
|
139
65
|
type: "workflow-v1";
|
|
140
66
|
main: string;
|
|
141
67
|
};
|
|
@@ -149,314 +75,6 @@ declare const BlockComponentsDescriptionRaw: z.ZodObject<{
|
|
|
149
75
|
model: string;
|
|
150
76
|
ui: string;
|
|
151
77
|
}>;
|
|
152
|
-
type BlockComponentsDescriptionRaw = z.infer<typeof BlockComponentsDescriptionRaw>;
|
|
153
|
-
declare function BlockComponentsAbsoluteUrl(prefix: string): z.ZodObject<{
|
|
154
|
-
workflow: z.ZodUnion<[z.ZodPipeline<z.ZodEffects<z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
155
|
-
type: z.ZodLiteral<"explicit-base64">;
|
|
156
|
-
mimeType: z.ZodString;
|
|
157
|
-
content: z.ZodString;
|
|
158
|
-
}, "strict", z.ZodTypeAny, {
|
|
159
|
-
type: "explicit-base64";
|
|
160
|
-
content: string;
|
|
161
|
-
mimeType: string;
|
|
162
|
-
}, {
|
|
163
|
-
type: "explicit-base64";
|
|
164
|
-
content: string;
|
|
165
|
-
mimeType: string;
|
|
166
|
-
}>, z.ZodObject<{
|
|
167
|
-
type: z.ZodLiteral<"relative">;
|
|
168
|
-
path: z.ZodString;
|
|
169
|
-
}, "strict", z.ZodTypeAny, {
|
|
170
|
-
type: "relative";
|
|
171
|
-
path: string;
|
|
172
|
-
}, {
|
|
173
|
-
type: "relative";
|
|
174
|
-
path: string;
|
|
175
|
-
}>]>, {
|
|
176
|
-
type: "explicit-base64";
|
|
177
|
-
content: string;
|
|
178
|
-
mimeType: string;
|
|
179
|
-
} | {
|
|
180
|
-
type: "absolute-url";
|
|
181
|
-
url: string;
|
|
182
|
-
}, {
|
|
183
|
-
type: "relative";
|
|
184
|
-
path: string;
|
|
185
|
-
} | {
|
|
186
|
-
type: "explicit-base64";
|
|
187
|
-
content: string;
|
|
188
|
-
mimeType: string;
|
|
189
|
-
}>, {
|
|
190
|
-
type: "workflow-v1";
|
|
191
|
-
main: {
|
|
192
|
-
type: "explicit-base64";
|
|
193
|
-
content: string;
|
|
194
|
-
mimeType: string;
|
|
195
|
-
} | {
|
|
196
|
-
type: "absolute-url";
|
|
197
|
-
url: string;
|
|
198
|
-
};
|
|
199
|
-
}, {
|
|
200
|
-
type: "relative";
|
|
201
|
-
path: string;
|
|
202
|
-
} | {
|
|
203
|
-
type: "explicit-base64";
|
|
204
|
-
content: string;
|
|
205
|
-
mimeType: string;
|
|
206
|
-
}>, z.ZodObject<{
|
|
207
|
-
type: z.ZodLiteral<"workflow-v1">;
|
|
208
|
-
main: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
209
|
-
type: z.ZodLiteral<"explicit-base64">;
|
|
210
|
-
mimeType: z.ZodString;
|
|
211
|
-
content: z.ZodString;
|
|
212
|
-
}, "strict", z.ZodTypeAny, {
|
|
213
|
-
type: "explicit-base64";
|
|
214
|
-
content: string;
|
|
215
|
-
mimeType: string;
|
|
216
|
-
}, {
|
|
217
|
-
type: "explicit-base64";
|
|
218
|
-
content: string;
|
|
219
|
-
mimeType: string;
|
|
220
|
-
}>, z.ZodObject<{
|
|
221
|
-
type: z.ZodLiteral<"relative">;
|
|
222
|
-
path: z.ZodString;
|
|
223
|
-
}, "strict", z.ZodTypeAny, {
|
|
224
|
-
type: "relative";
|
|
225
|
-
path: string;
|
|
226
|
-
}, {
|
|
227
|
-
type: "relative";
|
|
228
|
-
path: string;
|
|
229
|
-
}>]>, {
|
|
230
|
-
type: "explicit-base64";
|
|
231
|
-
content: string;
|
|
232
|
-
mimeType: string;
|
|
233
|
-
} | {
|
|
234
|
-
type: "absolute-url";
|
|
235
|
-
url: string;
|
|
236
|
-
}, {
|
|
237
|
-
type: "relative";
|
|
238
|
-
path: string;
|
|
239
|
-
} | {
|
|
240
|
-
type: "explicit-base64";
|
|
241
|
-
content: string;
|
|
242
|
-
mimeType: string;
|
|
243
|
-
}>;
|
|
244
|
-
}, "strip", z.ZodTypeAny, {
|
|
245
|
-
type: "workflow-v1";
|
|
246
|
-
main: {
|
|
247
|
-
type: "explicit-base64";
|
|
248
|
-
content: string;
|
|
249
|
-
mimeType: string;
|
|
250
|
-
} | {
|
|
251
|
-
type: "absolute-url";
|
|
252
|
-
url: string;
|
|
253
|
-
};
|
|
254
|
-
}, {
|
|
255
|
-
type: "workflow-v1";
|
|
256
|
-
main: {
|
|
257
|
-
type: "relative";
|
|
258
|
-
path: string;
|
|
259
|
-
} | {
|
|
260
|
-
type: "explicit-base64";
|
|
261
|
-
content: string;
|
|
262
|
-
mimeType: string;
|
|
263
|
-
};
|
|
264
|
-
}>>, z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
265
|
-
type: z.ZodLiteral<"workflow-v1">;
|
|
266
|
-
main: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
267
|
-
type: z.ZodLiteral<"explicit-base64">;
|
|
268
|
-
mimeType: z.ZodString;
|
|
269
|
-
content: z.ZodString;
|
|
270
|
-
}, "strict", z.ZodTypeAny, {
|
|
271
|
-
type: "explicit-base64";
|
|
272
|
-
content: string;
|
|
273
|
-
mimeType: string;
|
|
274
|
-
}, {
|
|
275
|
-
type: "explicit-base64";
|
|
276
|
-
content: string;
|
|
277
|
-
mimeType: string;
|
|
278
|
-
}>, z.ZodObject<{
|
|
279
|
-
type: z.ZodLiteral<"relative">;
|
|
280
|
-
path: z.ZodString;
|
|
281
|
-
}, "strict", z.ZodTypeAny, {
|
|
282
|
-
type: "relative";
|
|
283
|
-
path: string;
|
|
284
|
-
}, {
|
|
285
|
-
type: "relative";
|
|
286
|
-
path: string;
|
|
287
|
-
}>]>, {
|
|
288
|
-
type: "explicit-base64";
|
|
289
|
-
content: string;
|
|
290
|
-
mimeType: string;
|
|
291
|
-
} | {
|
|
292
|
-
type: "absolute-url";
|
|
293
|
-
url: string;
|
|
294
|
-
}, {
|
|
295
|
-
type: "relative";
|
|
296
|
-
path: string;
|
|
297
|
-
} | {
|
|
298
|
-
type: "explicit-base64";
|
|
299
|
-
content: string;
|
|
300
|
-
mimeType: string;
|
|
301
|
-
}>;
|
|
302
|
-
}, "strip", z.ZodTypeAny, {
|
|
303
|
-
type: "workflow-v1";
|
|
304
|
-
main: {
|
|
305
|
-
type: "explicit-base64";
|
|
306
|
-
content: string;
|
|
307
|
-
mimeType: string;
|
|
308
|
-
} | {
|
|
309
|
-
type: "absolute-url";
|
|
310
|
-
url: string;
|
|
311
|
-
};
|
|
312
|
-
}, {
|
|
313
|
-
type: "workflow-v1";
|
|
314
|
-
main: {
|
|
315
|
-
type: "relative";
|
|
316
|
-
path: string;
|
|
317
|
-
} | {
|
|
318
|
-
type: "explicit-base64";
|
|
319
|
-
content: string;
|
|
320
|
-
mimeType: string;
|
|
321
|
-
};
|
|
322
|
-
}>]>]>;
|
|
323
|
-
model: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
324
|
-
type: z.ZodLiteral<"explicit-base64">;
|
|
325
|
-
mimeType: z.ZodString;
|
|
326
|
-
content: z.ZodString;
|
|
327
|
-
}, "strict", z.ZodTypeAny, {
|
|
328
|
-
type: "explicit-base64";
|
|
329
|
-
content: string;
|
|
330
|
-
mimeType: string;
|
|
331
|
-
}, {
|
|
332
|
-
type: "explicit-base64";
|
|
333
|
-
content: string;
|
|
334
|
-
mimeType: string;
|
|
335
|
-
}>, z.ZodObject<{
|
|
336
|
-
type: z.ZodLiteral<"relative">;
|
|
337
|
-
path: z.ZodString;
|
|
338
|
-
}, "strict", z.ZodTypeAny, {
|
|
339
|
-
type: "relative";
|
|
340
|
-
path: string;
|
|
341
|
-
}, {
|
|
342
|
-
type: "relative";
|
|
343
|
-
path: string;
|
|
344
|
-
}>]>, {
|
|
345
|
-
type: "explicit-base64";
|
|
346
|
-
content: string;
|
|
347
|
-
mimeType: string;
|
|
348
|
-
} | {
|
|
349
|
-
type: "absolute-url";
|
|
350
|
-
url: string;
|
|
351
|
-
}, {
|
|
352
|
-
type: "relative";
|
|
353
|
-
path: string;
|
|
354
|
-
} | {
|
|
355
|
-
type: "explicit-base64";
|
|
356
|
-
content: string;
|
|
357
|
-
mimeType: string;
|
|
358
|
-
}>;
|
|
359
|
-
ui: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
360
|
-
type: z.ZodLiteral<"explicit-base64">;
|
|
361
|
-
mimeType: z.ZodString;
|
|
362
|
-
content: z.ZodString;
|
|
363
|
-
}, "strict", z.ZodTypeAny, {
|
|
364
|
-
type: "explicit-base64";
|
|
365
|
-
content: string;
|
|
366
|
-
mimeType: string;
|
|
367
|
-
}, {
|
|
368
|
-
type: "explicit-base64";
|
|
369
|
-
content: string;
|
|
370
|
-
mimeType: string;
|
|
371
|
-
}>, z.ZodObject<{
|
|
372
|
-
type: z.ZodLiteral<"relative">;
|
|
373
|
-
path: z.ZodString;
|
|
374
|
-
}, "strict", z.ZodTypeAny, {
|
|
375
|
-
type: "relative";
|
|
376
|
-
path: string;
|
|
377
|
-
}, {
|
|
378
|
-
type: "relative";
|
|
379
|
-
path: string;
|
|
380
|
-
}>]>, {
|
|
381
|
-
type: "explicit-base64";
|
|
382
|
-
content: string;
|
|
383
|
-
mimeType: string;
|
|
384
|
-
} | {
|
|
385
|
-
type: "absolute-url";
|
|
386
|
-
url: string;
|
|
387
|
-
}, {
|
|
388
|
-
type: "relative";
|
|
389
|
-
path: string;
|
|
390
|
-
} | {
|
|
391
|
-
type: "explicit-base64";
|
|
392
|
-
content: string;
|
|
393
|
-
mimeType: string;
|
|
394
|
-
}>;
|
|
395
|
-
}, "strip", z.ZodTypeAny, {
|
|
396
|
-
workflow: {
|
|
397
|
-
type: "workflow-v1";
|
|
398
|
-
main: {
|
|
399
|
-
type: "explicit-base64";
|
|
400
|
-
content: string;
|
|
401
|
-
mimeType: string;
|
|
402
|
-
} | {
|
|
403
|
-
type: "absolute-url";
|
|
404
|
-
url: string;
|
|
405
|
-
};
|
|
406
|
-
};
|
|
407
|
-
model: {
|
|
408
|
-
type: "explicit-base64";
|
|
409
|
-
content: string;
|
|
410
|
-
mimeType: string;
|
|
411
|
-
} | {
|
|
412
|
-
type: "absolute-url";
|
|
413
|
-
url: string;
|
|
414
|
-
};
|
|
415
|
-
ui: {
|
|
416
|
-
type: "explicit-base64";
|
|
417
|
-
content: string;
|
|
418
|
-
mimeType: string;
|
|
419
|
-
} | {
|
|
420
|
-
type: "absolute-url";
|
|
421
|
-
url: string;
|
|
422
|
-
};
|
|
423
|
-
}, {
|
|
424
|
-
workflow: {
|
|
425
|
-
type: "relative";
|
|
426
|
-
path: string;
|
|
427
|
-
} | {
|
|
428
|
-
type: "explicit-base64";
|
|
429
|
-
content: string;
|
|
430
|
-
mimeType: string;
|
|
431
|
-
} | {
|
|
432
|
-
type: "workflow-v1";
|
|
433
|
-
main: {
|
|
434
|
-
type: "relative";
|
|
435
|
-
path: string;
|
|
436
|
-
} | {
|
|
437
|
-
type: "explicit-base64";
|
|
438
|
-
content: string;
|
|
439
|
-
mimeType: string;
|
|
440
|
-
};
|
|
441
|
-
};
|
|
442
|
-
model: {
|
|
443
|
-
type: "relative";
|
|
444
|
-
path: string;
|
|
445
|
-
} | {
|
|
446
|
-
type: "explicit-base64";
|
|
447
|
-
content: string;
|
|
448
|
-
mimeType: string;
|
|
449
|
-
};
|
|
450
|
-
ui: {
|
|
451
|
-
type: "relative";
|
|
452
|
-
path: string;
|
|
453
|
-
} | {
|
|
454
|
-
type: "explicit-base64";
|
|
455
|
-
content: string;
|
|
456
|
-
mimeType: string;
|
|
457
|
-
};
|
|
458
|
-
}>;
|
|
459
|
-
type BlockComponentsAbsolute = z.infer<ReturnType<typeof BlockComponentsAbsoluteUrl>>;
|
|
460
78
|
//#endregion
|
|
461
|
-
export { BlockComponents,
|
|
79
|
+
export { BlockComponents, BlockComponentsDescriptionRaw, Workflow, WorkflowSchemaV1, WorkflowV1 };
|
|
462
80
|
//# sourceMappingURL=block_components.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block_components.d.ts","names":[],"sources":["../../src/block_meta/block_components.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"block_components.d.ts","names":[],"sources":["../../src/block_meta/block_components.ts"],"mappings":";;;;;AAUA;;KAAY,UAAA;EACV,IAAA;EACA,IAAA,EAAM,OAAA;AAAA;;;;;KAOI,QAAA,YAAoB,UAAA,CAAW,OAAA;;;;;;;;;AAa3C;;;KAAY,eAAA;EACV,QAAA,EAAU,QAAA,CAAS,SAAA;EACnB,KAAA,EAAO,SAAA;EACP,EAAA,EAAI,SAAA;AAAA;;;;;;;iBASU,gBAAA,WAA2B,CAAA,CAAE,UAAA,CAAA,CAAY,OAAA,EAAS,CAAA,GAAC,CAAA,CAAA,SAAA;;;;;;;;;;KAuBvD,6BAAA,GAAgC,eAAA;AAAA,cAE/B,6BAAA,EAA6B,CAAA,CAAA,SAAA"}
|
|
@@ -1,31 +1,27 @@
|
|
|
1
|
-
import { ContentRelativeBinary } from "./content_types.js";
|
|
2
|
-
import { mapRemoteToAbsolute } from "./content_conversion.js";
|
|
3
1
|
import { z } from "zod";
|
|
4
2
|
//#region src/block_meta/block_components.ts
|
|
5
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Builds the zod schema for a wrapped workflow component carrying `content`
|
|
5
|
+
* as the `main` payload. Shared between the `package.json` boundary parser
|
|
6
|
+
* (where `content` is `z.string()`) and the manifest schema (where `content`
|
|
7
|
+
* is `ContentRelative`).
|
|
8
|
+
*/
|
|
9
|
+
function WorkflowSchemaV1(content) {
|
|
6
10
|
return z.object({
|
|
7
11
|
type: z.literal("workflow-v1"),
|
|
8
|
-
main:
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
function Workflow(contentType) {
|
|
12
|
-
return z.union([contentType.transform((value) => ({
|
|
13
|
-
type: "workflow-v1",
|
|
14
|
-
main: value
|
|
15
|
-
})).pipe(WorkflowV1(contentType)), z.discriminatedUnion("type", [WorkflowV1(contentType)])]);
|
|
16
|
-
}
|
|
17
|
-
function BlockComponents(wfAndModel, ui) {
|
|
18
|
-
return z.object({
|
|
19
|
-
workflow: Workflow(wfAndModel),
|
|
20
|
-
model: wfAndModel,
|
|
21
|
-
ui
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
const BlockComponentsDescriptionRaw = BlockComponents(z.string(), z.string());
|
|
25
|
-
function BlockComponentsAbsoluteUrl(prefix) {
|
|
26
|
-
return BlockComponents(ContentRelativeBinary.transform(mapRemoteToAbsolute(prefix)), ContentRelativeBinary.transform(mapRemoteToAbsolute(prefix)));
|
|
12
|
+
main: content
|
|
13
|
+
}).strict();
|
|
27
14
|
}
|
|
15
|
+
const WorkflowDescriptionRaw = z.union([z.string().transform((value) => ({
|
|
16
|
+
type: "workflow-v1",
|
|
17
|
+
main: value
|
|
18
|
+
})), WorkflowSchemaV1(z.string())]);
|
|
19
|
+
const BlockComponentsDescriptionRaw = z.object({
|
|
20
|
+
workflow: WorkflowDescriptionRaw,
|
|
21
|
+
model: z.string(),
|
|
22
|
+
ui: z.string()
|
|
23
|
+
});
|
|
28
24
|
//#endregion
|
|
29
|
-
export {
|
|
25
|
+
export { BlockComponentsDescriptionRaw, WorkflowSchemaV1 };
|
|
30
26
|
|
|
31
27
|
//# sourceMappingURL=block_components.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block_components.js","names":[],"sources":["../../src/block_meta/block_components.ts"],"sourcesContent":["import { z } from \"zod\";\
|
|
1
|
+
{"version":3,"file":"block_components.js","names":[],"sources":["../../src/block_meta/block_components.ts"],"sourcesContent":["import { z } from \"zod\";\n\n//\n// Workflow + BlockComponents canonical TS types.\n//\n\n/**\n * Wrapped workflow component, schema version 1. Currently the only workflow\n * schema; carries a single `main` entry pointing at the workflow source.\n */\nexport type WorkflowV1<Content> = {\n type: \"workflow-v1\";\n main: Content;\n};\n\n/**\n * Current workflow component shape. Alias to `WorkflowV1` while v1 is the\n * only version — future versions widen this to a discriminated union.\n */\nexport type Workflow<Content> = WorkflowV1<Content>;\n\n/**\n * Trio of artifacts every block ships: a workflow (Tengo source), a model\n * (compiled JS), and a UI (front-end bundle). `WMContent` carries\n * `workflow.main` and `model` together (they travel as files); `UIContent`\n * carries the UI bundle (a folder when resolved locally, a relative path in\n * manifest form). Parameterizing this lets the same shape express every\n * stage the description passes through: raw `package.json` input (bare\n * strings), manifest form (relative paths stored in the registry), resolved\n * absolute form (local file/folder paths), and the registry-reader output\n * (URLs into registry storage, produced by `blockComponentsManifestToAbsoluteUrl`).\n */\nexport type BlockComponents<WMContent, UIContent> = {\n workflow: Workflow<WMContent>;\n model: WMContent;\n ui: UIContent;\n};\n\n/**\n * Builds the zod schema for a wrapped workflow component carrying `content`\n * as the `main` payload. Shared between the `package.json` boundary parser\n * (where `content` is `z.string()`) and the manifest schema (where `content`\n * is `ContentRelative`).\n */\nexport function WorkflowSchemaV1<C extends z.ZodTypeAny>(content: C) {\n return z\n .object({\n type: z.literal(\"workflow-v1\"),\n main: content,\n })\n .strict();\n}\n\n//\n// `package.json` boundary schema. The workflow field accepts either a bare\n// string (treated as `main`) or the wrapped object form; both normalize to\n// the canonical wrapped shape.\n//\n\nconst WorkflowDescriptionRaw = z.union([\n z.string().transform<WorkflowV1<string>>((value) => ({\n type: \"workflow-v1\",\n main: value,\n })),\n WorkflowSchemaV1(z.string()),\n]) satisfies z.ZodType<Workflow<string>, z.ZodTypeDef, any>;\n\nexport type BlockComponentsDescriptionRaw = BlockComponents<string, string>;\n\nexport const BlockComponentsDescriptionRaw = z.object({\n workflow: WorkflowDescriptionRaw,\n model: z.string(),\n ui: z.string(),\n}) satisfies z.ZodType<BlockComponentsDescriptionRaw, z.ZodTypeDef, any>;\n"],"mappings":";;;;;;;;AA4CA,SAAgB,iBAAyC,SAAY;AACnE,QAAO,EACJ,OAAO;EACN,MAAM,EAAE,QAAQ,cAAc;EAC9B,MAAM;EACP,CAAC,CACD,QAAQ;;AASb,MAAM,yBAAyB,EAAE,MAAM,CACrC,EAAE,QAAQ,CAAC,WAA+B,WAAW;CACnD,MAAM;CACN,MAAM;CACP,EAAE,EACH,iBAAiB,EAAE,QAAQ,CAAC,CAC7B,CAAC;AAIF,MAAa,gCAAgC,EAAE,OAAO;CACpD,UAAU;CACV,OAAO,EAAE,QAAQ;CACjB,IAAI,EAAE,QAAQ;CACf,CAAC"}
|
|
@@ -5,9 +5,11 @@ const require_block_meta = require("./block_meta.cjs");
|
|
|
5
5
|
let zod = require("zod");
|
|
6
6
|
let es_toolkit = require("es-toolkit");
|
|
7
7
|
//#region src/block_meta/block_description.ts
|
|
8
|
-
/**
|
|
9
|
-
*
|
|
10
|
-
* strings
|
|
8
|
+
/**
|
|
9
|
+
* Description as it appears in the root block `package.json`. `file:`-prefixed
|
|
10
|
+
* strings become `ContentRelative`; bare text strings become
|
|
11
|
+
* `ContentExplicitString`. See `DescriptionContentText`/`DescriptionContentBinary`.
|
|
12
|
+
*/
|
|
11
13
|
const BlockPackDescriptionFromPackageJsonRaw = zod.z.object({
|
|
12
14
|
components: require_block_components.BlockComponentsDescriptionRaw,
|
|
13
15
|
meta: require_block_meta.BlockPackMetaDescriptionRaw
|