@milaboratories/pl-model-middle-layer 1.3.0 → 1.4.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.d.ts +13 -13
- package/dist/block_meta/block_description.d.ts +8 -8
- package/dist/block_meta/block_manifest.d.ts +40 -39
- package/dist/block_meta/block_manifest.d.ts.map +1 -1
- package/dist/block_meta/block_meta.d.ts +102 -2
- package/dist/block_meta/block_meta.d.ts.map +1 -1
- package/dist/block_registry/block_pack_spec.d.ts +201 -0
- package/dist/block_registry/block_pack_spec.d.ts.map +1 -0
- package/dist/block_registry/index.d.ts +4 -0
- package/dist/block_registry/index.d.ts.map +1 -0
- package/dist/block_registry/overview.d.ts +914 -0
- package/dist/block_registry/overview.d.ts.map +1 -0
- package/dist/block_registry/registry_spec.d.ts +184 -0
- package/dist/block_registry/registry_spec.d.ts.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +170 -103
- package/dist/index.mjs.map +1 -1
- package/dist/project_overview.d.ts +1 -1
- package/dist/project_overview.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/block_meta/block_components.ts +3 -0
- package/src/block_meta/block_manifest.ts +7 -5
- package/src/block_meta/block_meta.ts +10 -2
- package/src/block_registry/block_pack_spec.ts +51 -0
- package/src/block_registry/index.ts +3 -0
- package/src/block_registry/overview.ts +27 -0
- package/src/block_registry/registry_spec.ts +38 -0
- package/src/index.ts +1 -1
- package/src/project_overview.ts +1 -1
- package/dist/block_pack.d.ts +0 -24
- package/dist/block_pack.d.ts.map +0 -1
- package/src/block_pack.ts +0 -29
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"overview.d.ts","sourceRoot":"","sources":["../../src/block_registry/overview.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAG3B,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const LocalDevFolder: z.ZodObject<{
|
|
3
|
+
type: z.ZodLiteral<"local-dev">;
|
|
4
|
+
path: z.ZodString;
|
|
5
|
+
}, "strip", z.ZodTypeAny, {
|
|
6
|
+
type: "local-dev";
|
|
7
|
+
path: string;
|
|
8
|
+
}, {
|
|
9
|
+
type: "local-dev";
|
|
10
|
+
path: string;
|
|
11
|
+
}>;
|
|
12
|
+
export type LocalDevFolder = z.infer<typeof LocalDevFolder>;
|
|
13
|
+
/** @deprecated don't use */
|
|
14
|
+
export declare const RemoteRegistryV1Spec: z.ZodObject<{
|
|
15
|
+
type: z.ZodLiteral<"remote-v1">;
|
|
16
|
+
url: z.ZodString;
|
|
17
|
+
}, "strip", z.ZodTypeAny, {
|
|
18
|
+
type: "remote-v1";
|
|
19
|
+
url: string;
|
|
20
|
+
}, {
|
|
21
|
+
type: "remote-v1";
|
|
22
|
+
url: string;
|
|
23
|
+
}>;
|
|
24
|
+
/** @deprecated don't use */
|
|
25
|
+
export type RemoteRegistryV1Spec = z.infer<typeof RemoteRegistryV1Spec>;
|
|
26
|
+
export declare const RemoteRegistryV2Spec: z.ZodObject<{
|
|
27
|
+
type: z.ZodLiteral<"remote-v2">;
|
|
28
|
+
url: z.ZodString;
|
|
29
|
+
}, "strip", z.ZodTypeAny, {
|
|
30
|
+
type: "remote-v2";
|
|
31
|
+
url: string;
|
|
32
|
+
}, {
|
|
33
|
+
type: "remote-v2";
|
|
34
|
+
url: string;
|
|
35
|
+
}>;
|
|
36
|
+
export type RemoteRegistryV2Spec = z.infer<typeof RemoteRegistryV2Spec>;
|
|
37
|
+
export declare const RegistrySpec: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
38
|
+
type: z.ZodLiteral<"remote-v1">;
|
|
39
|
+
url: z.ZodString;
|
|
40
|
+
}, "strip", z.ZodTypeAny, {
|
|
41
|
+
type: "remote-v1";
|
|
42
|
+
url: string;
|
|
43
|
+
}, {
|
|
44
|
+
type: "remote-v1";
|
|
45
|
+
url: string;
|
|
46
|
+
}>, z.ZodObject<{
|
|
47
|
+
type: z.ZodLiteral<"remote-v2">;
|
|
48
|
+
url: z.ZodString;
|
|
49
|
+
}, "strip", z.ZodTypeAny, {
|
|
50
|
+
type: "remote-v2";
|
|
51
|
+
url: string;
|
|
52
|
+
}, {
|
|
53
|
+
type: "remote-v2";
|
|
54
|
+
url: string;
|
|
55
|
+
}>, z.ZodObject<{
|
|
56
|
+
type: z.ZodLiteral<"local-dev">;
|
|
57
|
+
path: z.ZodString;
|
|
58
|
+
}, "strip", z.ZodTypeAny, {
|
|
59
|
+
type: "local-dev";
|
|
60
|
+
path: string;
|
|
61
|
+
}, {
|
|
62
|
+
type: "local-dev";
|
|
63
|
+
path: string;
|
|
64
|
+
}>]>;
|
|
65
|
+
export type RegistrySpec = z.infer<typeof RegistrySpec>;
|
|
66
|
+
export declare const RegistryEntry: z.ZodObject<{
|
|
67
|
+
id: z.ZodString;
|
|
68
|
+
title: z.ZodOptional<z.ZodString>;
|
|
69
|
+
spec: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
70
|
+
type: z.ZodLiteral<"remote-v1">;
|
|
71
|
+
url: z.ZodString;
|
|
72
|
+
}, "strip", z.ZodTypeAny, {
|
|
73
|
+
type: "remote-v1";
|
|
74
|
+
url: string;
|
|
75
|
+
}, {
|
|
76
|
+
type: "remote-v1";
|
|
77
|
+
url: string;
|
|
78
|
+
}>, z.ZodObject<{
|
|
79
|
+
type: z.ZodLiteral<"remote-v2">;
|
|
80
|
+
url: z.ZodString;
|
|
81
|
+
}, "strip", z.ZodTypeAny, {
|
|
82
|
+
type: "remote-v2";
|
|
83
|
+
url: string;
|
|
84
|
+
}, {
|
|
85
|
+
type: "remote-v2";
|
|
86
|
+
url: string;
|
|
87
|
+
}>, z.ZodObject<{
|
|
88
|
+
type: z.ZodLiteral<"local-dev">;
|
|
89
|
+
path: z.ZodString;
|
|
90
|
+
}, "strip", z.ZodTypeAny, {
|
|
91
|
+
type: "local-dev";
|
|
92
|
+
path: string;
|
|
93
|
+
}, {
|
|
94
|
+
type: "local-dev";
|
|
95
|
+
path: string;
|
|
96
|
+
}>]>;
|
|
97
|
+
}, "strip", z.ZodTypeAny, {
|
|
98
|
+
id: string;
|
|
99
|
+
spec: {
|
|
100
|
+
type: "local-dev";
|
|
101
|
+
path: string;
|
|
102
|
+
} | {
|
|
103
|
+
type: "remote-v1";
|
|
104
|
+
url: string;
|
|
105
|
+
} | {
|
|
106
|
+
type: "remote-v2";
|
|
107
|
+
url: string;
|
|
108
|
+
};
|
|
109
|
+
title?: string | undefined;
|
|
110
|
+
}, {
|
|
111
|
+
id: string;
|
|
112
|
+
spec: {
|
|
113
|
+
type: "local-dev";
|
|
114
|
+
path: string;
|
|
115
|
+
} | {
|
|
116
|
+
type: "remote-v1";
|
|
117
|
+
url: string;
|
|
118
|
+
} | {
|
|
119
|
+
type: "remote-v2";
|
|
120
|
+
url: string;
|
|
121
|
+
};
|
|
122
|
+
title?: string | undefined;
|
|
123
|
+
}>;
|
|
124
|
+
export type RegistryEntry = z.infer<typeof RegistryEntry>;
|
|
125
|
+
export declare const RegistryList: z.ZodArray<z.ZodObject<{
|
|
126
|
+
id: z.ZodString;
|
|
127
|
+
title: z.ZodOptional<z.ZodString>;
|
|
128
|
+
spec: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
129
|
+
type: z.ZodLiteral<"remote-v1">;
|
|
130
|
+
url: z.ZodString;
|
|
131
|
+
}, "strip", z.ZodTypeAny, {
|
|
132
|
+
type: "remote-v1";
|
|
133
|
+
url: string;
|
|
134
|
+
}, {
|
|
135
|
+
type: "remote-v1";
|
|
136
|
+
url: string;
|
|
137
|
+
}>, z.ZodObject<{
|
|
138
|
+
type: z.ZodLiteral<"remote-v2">;
|
|
139
|
+
url: z.ZodString;
|
|
140
|
+
}, "strip", z.ZodTypeAny, {
|
|
141
|
+
type: "remote-v2";
|
|
142
|
+
url: string;
|
|
143
|
+
}, {
|
|
144
|
+
type: "remote-v2";
|
|
145
|
+
url: string;
|
|
146
|
+
}>, z.ZodObject<{
|
|
147
|
+
type: z.ZodLiteral<"local-dev">;
|
|
148
|
+
path: z.ZodString;
|
|
149
|
+
}, "strip", z.ZodTypeAny, {
|
|
150
|
+
type: "local-dev";
|
|
151
|
+
path: string;
|
|
152
|
+
}, {
|
|
153
|
+
type: "local-dev";
|
|
154
|
+
path: string;
|
|
155
|
+
}>]>;
|
|
156
|
+
}, "strip", z.ZodTypeAny, {
|
|
157
|
+
id: string;
|
|
158
|
+
spec: {
|
|
159
|
+
type: "local-dev";
|
|
160
|
+
path: string;
|
|
161
|
+
} | {
|
|
162
|
+
type: "remote-v1";
|
|
163
|
+
url: string;
|
|
164
|
+
} | {
|
|
165
|
+
type: "remote-v2";
|
|
166
|
+
url: string;
|
|
167
|
+
};
|
|
168
|
+
title?: string | undefined;
|
|
169
|
+
}, {
|
|
170
|
+
id: string;
|
|
171
|
+
spec: {
|
|
172
|
+
type: "local-dev";
|
|
173
|
+
path: string;
|
|
174
|
+
} | {
|
|
175
|
+
type: "remote-v1";
|
|
176
|
+
url: string;
|
|
177
|
+
} | {
|
|
178
|
+
type: "remote-v2";
|
|
179
|
+
url: string;
|
|
180
|
+
};
|
|
181
|
+
title?: string | undefined;
|
|
182
|
+
}>, "many">;
|
|
183
|
+
export type RegistryList = z.infer<typeof RegistryList>;
|
|
184
|
+
//# sourceMappingURL=registry_spec.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry_spec.d.ts","sourceRoot":"","sources":["../../src/block_registry/registry_spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,cAAc;;;;;;;;;EAGzB,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAE5D,4BAA4B;AAC5B,eAAO,MAAM,oBAAoB;;;;;;;;;EAG/B,CAAC;AACH,4BAA4B;AAC5B,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAExE,eAAO,MAAM,oBAAoB;;;;;;;;;EAG/B,CAAC;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAExE,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;IAIvB,CAAC;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAExD,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAIxB,CAAC;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAE1D,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WAAyB,CAAC;AACnD,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,UAAU,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("zod"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("zod"),r=t.z.object({type:t.z.literal("explicit-string"),content:t.z.string().describe("Actual string value")}).strict(),i=t.z.object({type:t.z.literal("explicit-base64"),mimeType:t.z.string().regex(/\w+\/[-+.\w]+/).describe("MIME type to interpret content"),content:t.z.string().base64().describe("Base64 encoded binary value")}).strict(),o=t.z.object({type:t.z.literal("relative"),path:t.z.string().describe("Address of the file, in most cases relative to the file which this structure is a part of")}).strict(),c=t.z.object({type:t.z.literal("absolute-file"),file:t.z.string().startsWith("/").describe("Absolute address of the file in local file system")}).strict(),l=t.z.object({type:t.z.literal("absolute-url"),url:t.z.string().url().describe("Global URL to reach the requested file")}).strict(),B=t.z.object({type:t.z.literal("explicit-bytes"),mimeType:t.z.string().regex(/\w+\/[-+.\w]+/).describe("MIME type to interpret content"),content:t.z.instanceof(Uint8Array).describe("Raw content")}).strict(),_=t.z.object({type:t.z.literal("absolute-folder"),folder:t.z.string().startsWith("/").describe("Absolute address of the folder in local file system")}).strict(),$=t.z.discriminatedUnion("type",[r,i,o,c,l]),q=t.z.discriminatedUnion("type",[r,i,o]),J=t.z.discriminatedUnion("type",[r,i,o,c]),N=t.z.discriminatedUnion("type",[r,i,o,l]),f=t.z.discriminatedUnion("type",[i,o,c]),C=t.z.discriminatedUnion("type",[r,o,c]),G=t.z.discriminatedUnion("type",[i,l]),H=t.z.discriminatedUnion("type",[i,c]),K=t.z.discriminatedUnion("type",[r,l]),Q=t.z.discriminatedUnion("type",[r,c]),p=t.z.discriminatedUnion("type",[i,o]),P=t.z.discriminatedUnion("type",[r,o]),R=t.z.union([t.z.string().startsWith("file:").transform((e,n)=>({type:"relative",path:e.slice(5)})),f]),v=t.z.union([t.z.string().transform((e,n)=>e.startsWith("file:")?{type:"relative",path:e.slice(5)}:{type:"explicit-string",content:e}),C]),k=t.z.string().regex(/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/,"Wrong version format, please use valid semver");function y(e){const n=e.endsWith("/")?e:`${e}/`;return s=>s.type==="relative"?{type:"absolute-url",url:n+s.path}:s}function X(e){const n=e.endsWith("/")?e:`${e}/`;return s=>s.type==="relative"?{type:"relative",path:n+s.path}:s}const a=t.z.object({organization:t.z.string(),name:t.z.string(),version:k}).strict(),Y=a.omit({version:!0});function A(e){return t.z.union([e.transform(n=>({type:"workflow-v1",main:n})),t.z.discriminatedUnion("type",[t.z.object({type:t.z.literal("workflow-v1"),main:e.describe("Main workflow")})])])}function d(e,n){return t.z.object({workflow:A(e),model:e,ui:n})}const m=d(t.z.string(),t.z.string());function tt(e){return d(p.transform(y(e)),p.transform(y(e)))}function z(e,n){return t.z.object({title:t.z.string(),description:t.z.string(),longDescription:e.optional(),logo:n.optional(),url:t.z.string().url().optional(),docs:t.z.string().url().optional(),support:t.z.union([t.z.string().url(),t.z.string().email()]).optional(),tags:t.z.array(t.z.string()).optional(),organization:t.z.object({name:t.z.string(),url:t.z.string().url(),logo:n.optional()})})}const g=z(v,R),et=z(t.z.string(),i),h=z(t.z.string(),B),nt=t.z.object({components:m,meta:g});function b(e,n){return t.z.object({id:a,components:e,meta:n})}const ot=b(m,g),j=d(o,o),x=z(P,p),M=b(j,x),S=t.z.string().regex(/[0-9a-fA-F]/).toUpperCase().length(64),w=t.z.object({name:t.z.string(),size:t.z.number().int(),sha256:S}),it=t.z.object({schema:t.z.literal("v2"),description:M,files:t.z.array(w)}),rt="manifest.json",D=t.z.object({type:t.z.literal("dev-v1"),folder:t.z.string(),mtime:t.z.string().optional()}),U=t.z.object({type:t.z.literal("dev-v2"),folder:t.z.string(),mtime:t.z.string().optional()}),F=t.z.object({type:t.z.literal("from-registry-v1"),registryUrl:t.z.string(),id:a}),L=t.z.object({type:t.z.literal("from-registry-v2"),registryUrl:t.z.string(),id:a}),T=t.z.discriminatedUnion("type",[D,U,F,L]),V=t.z.object({type:t.z.literal("local-dev"),path:t.z.string()}),E=t.z.object({type:t.z.literal("remote-v1"),url:t.z.string().url()}),W=t.z.object({type:t.z.literal("remote-v2"),url:t.z.string().url()}),I=t.z.discriminatedUnion("type",[E,W,V]),u=t.z.object({id:t.z.string(),title:t.z.string().optional(),spec:I}),st=t.z.array(u),O=t.z.object({registryId:t.z.string(),id:a,meta:h,spec:T,otherVersions:t.z.array(k)}),Z=u.extend({status:t.z.union([t.z.literal("online"),t.z.literal("offline")])}),ct=t.z.object({registries:t.z.array(Z),blockPacks:t.z.array(O)}),at=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));exports.BlockComponents=d;exports.BlockComponentsAbsoluteUrl=tt;exports.BlockComponentsDescriptionRaw=m;exports.BlockComponentsManifest=j;exports.BlockPackDescriptionFromPackageJsonRaw=nt;exports.BlockPackDescriptionManifest=M;exports.BlockPackDescriptionRaw=ot;exports.BlockPackDevV1=D;exports.BlockPackDevV2=U;exports.BlockPackFromRegistryV1=F;exports.BlockPackFromRegistryV2=L;exports.BlockPackId=a;exports.BlockPackIdNoVersion=Y;exports.BlockPackListing=ct;exports.BlockPackManifest=it;exports.BlockPackManifestFile=rt;exports.BlockPackMeta=z;exports.BlockPackMetaDescriptionRaw=g;exports.BlockPackMetaEmbeddedBase64=et;exports.BlockPackMetaEmbeddedBytes=h;exports.BlockPackMetaManifest=x;exports.BlockPackOverview=O;exports.BlockPackSpec=T;exports.ContentAbsoluteBinaryLocal=H;exports.ContentAbsoluteBinaryRemote=G;exports.ContentAbsoluteFile=c;exports.ContentAbsoluteFolder=_;exports.ContentAbsoluteTextLocal=Q;exports.ContentAbsoluteTextRemote=K;exports.ContentAbsoluteUrl=l;exports.ContentAny=$;exports.ContentAnyBinaryLocal=f;exports.ContentAnyLocal=J;exports.ContentAnyRemote=N;exports.ContentAnyTextLocal=C;exports.ContentExplicitBase64=i;exports.ContentExplicitBytes=B;exports.ContentExplicitOrRelative=q;exports.ContentExplicitString=r;exports.ContentRelative=o;exports.ContentRelativeBinary=p;exports.ContentRelativeText=P;exports.CreateBlockPackDescriptionSchema=b;exports.DescriptionContentBinary=R;exports.DescriptionContentText=v;exports.LocalDevFolder=V;exports.ManifestFileInfo=w;exports.PFrameInternal=at;exports.RegistryEntry=u;exports.RegistryList=st;exports.RegistrySpec=I;exports.RegistryStatus=Z;exports.RemoteRegistryV1Spec=E;exports.RemoteRegistryV2Spec=W;exports.SemVer=k;exports.Sha256Schema=S;exports.Workflow=A;exports.addPrefixToRelative=X;exports.mapRemoteToAbsolute=y;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/block_meta/content_types.ts","../src/block_meta/semver.ts","../src/block_meta/content_conversion.ts","../src/block_meta/block_id.ts","../src/block_meta/block_components.ts","../src/block_meta/block_meta.ts","../src/block_meta/block_description.ts","../src/block_meta/block_manifest.ts"],"sourcesContent":["import { z } from 'zod';\n\n//\n// Base content types\n//\n\nexport const ContentExplicitString = z\n .object({\n type: z.literal('explicit-string'),\n content: z.string().describe('Actual string value')\n })\n .strict();\nexport type ContentExplicitString = z.infer<typeof ContentExplicitString>;\n\nexport const ContentExplicitBase64 = z\n .object({\n type: z.literal('explicit-base64'),\n mimeType: z\n .string()\n .regex(/\\w+\\/[-+.\\w]+/)\n .describe('MIME type to interpret content'),\n content: z.string().base64().describe('Base64 encoded binary value')\n })\n .strict();\nexport type ContentExplicitBase64 = z.infer<typeof ContentExplicitBase64>;\n\nexport const ContentRelative = z\n .object({\n type: z.literal('relative'),\n path: z\n .string()\n .describe(\n 'Address of the file, in most cases relative to the file which this structure is a part of'\n )\n })\n .strict();\nexport type ContentRelative = z.infer<typeof ContentRelative>;\n\nexport const ContentAbsoluteFile = z\n .object({\n type: z.literal('absolute-file'),\n file: z.string().startsWith('/').describe('Absolute address of the file in local file system')\n })\n .strict();\nexport type ContentAbsoluteFile = z.infer<typeof ContentAbsoluteFile>;\n\nexport const ContentAbsoluteUrl = z\n .object({\n type: z.literal('absolute-url'),\n url: z.string().url().describe('Global URL to reach the requested file')\n })\n .strict();\nexport type ContentAbsoluteUrl = z.infer<typeof ContentAbsoluteUrl>;\n\n//\n// Special content types\n//\n\nexport const ContentExplicitBytes = z\n .object({\n type: z.literal('explicit-bytes'),\n mimeType: z\n .string()\n .regex(/\\w+\\/[-+.\\w]+/)\n .describe('MIME type to interpret content'),\n content: z.instanceof(Uint8Array).describe('Raw content')\n })\n .strict();\nexport type ContentExplicitBytes = z.infer<typeof ContentExplicitBytes>;\n\nexport const ContentAbsoluteFolder = z\n .object({\n type: z.literal('absolute-folder'),\n folder: z\n .string()\n .startsWith('/')\n .describe('Absolute address of the folder in local file system')\n })\n .strict();\nexport type ContentAbsoluteFolder = z.infer<typeof ContentAbsoluteFolder>;\n\n//\n// Unions\n//\n\nexport const ContentAny = z.discriminatedUnion('type', [\n ContentExplicitString,\n ContentExplicitBase64,\n ContentRelative,\n ContentAbsoluteFile,\n ContentAbsoluteUrl\n]);\nexport type ContentAny = z.infer<typeof ContentAny>;\n\nexport const ContentExplicitOrRelative = z.discriminatedUnion('type', [\n ContentExplicitString,\n ContentExplicitBase64,\n ContentRelative\n]);\nexport type ContentExplicitOrRelative = z.infer<typeof ContentExplicitOrRelative>;\n\nexport const ContentAnyLocal = z.discriminatedUnion('type', [\n ContentExplicitString,\n ContentExplicitBase64,\n ContentRelative,\n ContentAbsoluteFile\n]);\nexport type ContentAnyLocal = z.infer<typeof ContentAnyLocal>;\n\nexport const ContentAnyRemote = z.discriminatedUnion('type', [\n ContentExplicitString,\n ContentExplicitBase64,\n ContentRelative,\n ContentAbsoluteUrl\n]);\nexport type ContentAnyRemote = z.infer<typeof ContentAnyRemote>;\n\n//\n// Narrow types with relative option\n//\n\n// export const ContentAnyBinaryRemote = z.discriminatedUnion('type', [\n// ContentExplicitBase64,\n// ContentRelative,\n// ContentAbsoluteUrl\n// ]);\n// export type ContentAnyBinaryRemote = z.infer<typeof ContentAnyBinaryRemote>;\n\nexport const ContentAnyBinaryLocal = z.discriminatedUnion('type', [\n ContentExplicitBase64,\n ContentRelative,\n ContentAbsoluteFile\n]);\nexport type ContentAnyBinaryLocal = z.infer<typeof ContentAnyBinaryLocal>;\n\n// export const ContentAnyTextRemote = z.discriminatedUnion('type', [\n// ContentExplicitString,\n// ContentRelative,\n// ContentAbsoluteUrl\n// ]);\n// export type ContentAnyTextRemote = z.infer<typeof ContentAnyTextRemote>;\n\nexport const ContentAnyTextLocal = z.discriminatedUnion('type', [\n ContentExplicitString,\n ContentRelative,\n ContentAbsoluteFile\n]);\nexport type ContentAnyTextLocal = z.infer<typeof ContentAnyTextLocal>;\n\n//\n// Narrow absolute types\n//\n\nexport const ContentAbsoluteBinaryRemote = z.discriminatedUnion('type', [\n ContentExplicitBase64,\n ContentAbsoluteUrl\n]);\nexport type ContentAbsoluteBinaryRemote = z.infer<typeof ContentAbsoluteBinaryRemote>;\n\nexport const ContentAbsoluteBinaryLocal = z.discriminatedUnion('type', [\n ContentExplicitBase64,\n ContentAbsoluteFile\n]);\nexport type ContentAbsoluteBinaryLocal = z.infer<typeof ContentAbsoluteBinaryLocal>;\n\nexport const ContentAbsoluteTextRemote = z.discriminatedUnion('type', [\n ContentExplicitString,\n ContentAbsoluteUrl\n]);\nexport type ContentAbsoluteTextRemote = z.infer<typeof ContentAbsoluteTextRemote>;\n\nexport const ContentAbsoluteTextLocal = z.discriminatedUnion('type', [\n ContentExplicitString,\n ContentAbsoluteFile\n]);\nexport type ContentAbsoluteTextLocal = z.infer<typeof ContentAbsoluteTextLocal>;\n\n//\n// Narrow relative types\n//\n\nexport const ContentRelativeBinary = z.discriminatedUnion('type', [\n ContentExplicitBase64,\n ContentRelative\n]);\nexport type ContentRelativeBinary = z.infer<typeof ContentRelativeBinary>;\n\nexport const ContentRelativeText = z.discriminatedUnion('type', [\n ContentExplicitString,\n ContentRelative\n]);\nexport type ContentRelativeText = z.infer<typeof ContentRelativeText>;\n\n// export function ConstructContent(\n// contentType: 'text',\n// contextType: 'local'\n// ): typeof ContentAnyTextLocal;\n// export function ConstructContent(\n// contentType: 'text',\n// contextType: 'remote'\n// ): typeof ContentAnyTextRemote;\n// export function ConstructContent(\n// contentType: 'binary',\n// contextType: 'local'\n// ): typeof ContentAnyBinaryLocal;\n// export function ConstructContent(\n// contentType: 'binary',\n// contextType: 'remote'\n// ): typeof ContentAnyBinaryRemote;\n// export function ConstructContent(\n// contentType: ContentType,\n// contextType: ContextType\n// ):\n// | typeof ContentAnyTextLocal\n// | typeof ContentAnyTextRemote\n// | typeof ContentAnyBinaryLocal\n// | typeof ContentAnyBinaryRemote;\n// export function ConstructContent(contentType: ContentType, contextType: ContextType) {\n// return contentType === 'text'\n// ? contextType === 'local'\n// ? ContentAnyTextLocal\n// : ContentAnyTextRemote\n// : contextType === 'local'\n// ? ContentAnyBinaryLocal\n// : ContentAnyBinaryRemote;\n// }\n\nexport const DescriptionContentBinary = z.union([\n z\n .string()\n .startsWith('file:')\n .transform<ContentRelativeBinary>((value, ctx) => ({ type: 'relative', path: value.slice(5) })),\n ContentAnyBinaryLocal\n]);\nexport type DescriptionContentBinary = z.infer<typeof DescriptionContentBinary>;\n\nexport const DescriptionContentText = z.union([\n z.string().transform<ContentRelativeText>((value, ctx) => {\n if (value.startsWith('file:')) return { type: 'relative', path: value.slice(5) };\n else return { type: 'explicit-string', content: value };\n }),\n ContentAnyTextLocal\n]);\nexport type DescriptionContentText = z.infer<typeof DescriptionContentText>;\n","import { z } from 'zod';\n\n// Regex taken from here:\n// https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string\nexport const SemVer = z\n .string()\n .regex(\n /^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$/,\n 'Wrong version format, please use valid semver'\n );\n","import {\n ContentAbsoluteUrl,\n ContentAnyLocal,\n ContentExplicitOrRelative,\n ContentRelative\n} from './content_types';\n\nexport function mapRemoteToAbsolute(\n rootUrl: string\n): <T extends ContentAnyLocal>(value: T) => Exclude<T, ContentRelative> | ContentAbsoluteUrl {\n const rootWithSlash = rootUrl.endsWith('/') ? rootUrl : `${rootUrl}/`;\n return <T extends ContentAnyLocal>(value: T) =>\n value.type === 'relative'\n ? { type: 'absolute-url', url: rootWithSlash + value.path }\n : (value as Exclude<T, ContentRelative>);\n}\n\n/**\n * Creates transformer of relative content paths, that adds a specific prefix to the relative path.\n *\n * If prefix = \"nested-path/\", paths like \"somefile.txt\" will be transformed to \"nested-path/somefile.txt\".\n *\n * @param prefix prefix to add to the relaive path, slesh at the end will be added automatically if missed\n */\nexport function addPrefixToRelative(\n prefix: string\n): <T extends ContentExplicitOrRelative>(value: T) => T {\n const prefixWithSlash = prefix.endsWith('/') ? prefix : `${prefix}/`;\n return <T extends ContentExplicitOrRelative>(value: T) =>\n (value.type === 'relative'\n ? { type: 'relative', path: prefixWithSlash + value.path }\n : value) as T;\n}\n","import { z } from 'zod';\nimport { SemVer } from './semver';\n\n/** Global identifier of the block */\nexport const BlockPackId = z\n .object({\n organization: z.string(),\n name: z.string(),\n version: SemVer\n })\n .strict();\nexport type BlockPackId = z.infer<typeof BlockPackId>;\n\nexport const BlockPackIdNoVersion = BlockPackId.omit({ version: true });\nexport type BlockPackIdNoVersion = z.infer<typeof BlockPackIdNoVersion>;\n","import { z } from 'zod';\nimport { ContentRelativeBinary } from './content_types';\nimport { mapRemoteToAbsolute } from './content_conversion';\n\nexport type BlockPackComponents = {};\n\nexport function Workflow<const Content extends z.ZodTypeAny>(contentType: Content) {\n return z.union([\n // string is converted to v1 workflow\n contentType.transform((value) => ({\n type: 'workflow-v1',\n main: value\n })),\n // structured objects are decoded as union with type descriptor\n z.discriminatedUnion('type', [\n z.object({\n type: z.literal('workflow-v1'),\n main: contentType.describe('Main workflow')\n })\n ])\n ]);\n}\n\nexport function BlockComponents<\n const WfAndModel extends z.ZodTypeAny,\n const UI extends z.ZodTypeAny\n>(wfAndModel: WfAndModel, ui: UI) {\n return z.object({\n workflow: Workflow(wfAndModel),\n model: wfAndModel,\n ui\n });\n}\n\nexport const BlockComponentsDescriptionRaw = BlockComponents(z.string(), z.string());\nexport type BlockComponentsDescriptionRaw = z.infer<typeof BlockComponentsDescriptionRaw>;\n\nexport function BlockComponentsAbsoluteUrl(prefix: string) {\n return BlockComponents(\n ContentRelativeBinary.transform(mapRemoteToAbsolute(prefix)),\n ContentRelativeBinary.transform(mapRemoteToAbsolute(prefix))\n );\n}\nexport type BlockComponentsAbsolute = z.infer<ReturnType<typeof BlockComponentsAbsoluteUrl>>;\n","import { z } from 'zod';\nimport {\n ContentExplicitBase64,\n DescriptionContentBinary,\n DescriptionContentText\n} from './content_types';\n\nexport function BlockPackMeta<\n const LongStringType extends z.ZodTypeAny,\n const BinaryType extends z.ZodTypeAny\n>(longString: LongStringType, binary: BinaryType) {\n return z.object({\n title: z.string(),\n description: z.string(),\n longDescription: longString.optional(),\n logo: binary.optional(),\n url: z.string().url().optional(),\n docs: z.string().url().optional(),\n support: z.union([z.string().url(), z.string().email()]).optional(),\n tags: z.array(z.string()).optional(),\n organization: z.object({\n name: z.string(),\n url: z.string().url(),\n logo: binary.optional()\n })\n });\n}\n\n// prettier-ignore\nexport const BlockPackMetaDescriptionRaw = BlockPackMeta(\n DescriptionContentText,\n DescriptionContentBinary\n);\nexport type BlockPackMetaDescriptionRaw = z.infer<typeof BlockPackMetaDescriptionRaw>;\n\n// prettier-ignore\nexport const BlockPackMetaEmbeddedContent = BlockPackMeta(\n z.string(),\n ContentExplicitBase64\n);\nexport type BlockPackMetaEmbeddedContent = z.infer<typeof BlockPackMetaEmbeddedContent>;\n","import { z, ZodTypeAny } from 'zod';\nimport { BlockComponentsDescriptionRaw } from './block_components';\nimport { BlockPackMetaDescriptionRaw } from './block_meta';\nimport { BlockPackId } from './block_id';\n\n/** Description, as appears in root block package.json file,\n * `file:` references are parsed into relative content of corresponding type, depending on the context,\n * strings are converted to explicit content type. */\nexport const BlockPackDescriptionFromPackageJsonRaw = z.object({\n components: BlockComponentsDescriptionRaw,\n meta: BlockPackMetaDescriptionRaw\n});\n\nexport function CreateBlockPackDescriptionSchema<\n Components extends ZodTypeAny,\n Meta extends ZodTypeAny\n>(components: Components, meta: Meta) {\n return z.object({\n id: BlockPackId,\n components,\n meta\n });\n}\n\nexport const BlockPackDescriptionRaw = CreateBlockPackDescriptionSchema(\n BlockComponentsDescriptionRaw,\n BlockPackMetaDescriptionRaw\n);\nexport type BlockPackDescriptionRaw = z.infer<typeof BlockPackDescriptionRaw>;\n","import { z } from 'zod';\nimport { BlockComponents } from './block_components';\nimport { ContentRelative, ContentRelativeBinary, ContentRelativeText } from './content_types';\nimport { CreateBlockPackDescriptionSchema } from './block_description';\nimport { BlockPackMeta } from './block_meta';\n\nexport const BlockComponentsManifest = BlockComponents(ContentRelative, ContentRelative);\nexport type BlockComponentsManifest = z.infer<typeof BlockComponentsManifest>;\n\nexport const BlockPackMetaManifest = BlockPackMeta(ContentRelativeText, ContentRelativeBinary);\nexport type BlockPackMetaManifest = z.infer<typeof BlockPackMetaManifest>;\n\n/** Block description to be used in block manifest */\nexport const BlockPackDescriptionManifest = CreateBlockPackDescriptionSchema(\n BlockComponentsManifest,\n BlockPackMetaManifest\n);\nexport type BlockPackDescriptionManifest = z.infer<typeof BlockPackDescriptionManifest>;\n\nexport const ManifestFileInfo = z.object({\n name: z.string(),\n size: z.number().int(),\n sha256: z\n .string()\n .regex(/[0-9a-fA-F]/)\n .toUpperCase()\n .length(64) // 256 / 4 (bits per hex register)\n});\nexport type ManifestFileInfo = z.infer<typeof ManifestFileInfo>;\n\nexport const BlockPackManifest = z.object({\n schema: z.literal('v2'),\n description: BlockPackDescriptionManifest,\n files: z.array(ManifestFileInfo)\n});\nexport type BlockPackManifest = z.infer<typeof BlockPackManifest>;\n\nexport const BlockPackManifestFile = 'manifest.json';\n"],"names":["ContentExplicitString","z","ContentExplicitBase64","ContentRelative","ContentAbsoluteFile","ContentAbsoluteUrl","ContentExplicitBytes","ContentAbsoluteFolder","ContentAny","ContentExplicitOrRelative","ContentAnyLocal","ContentAnyRemote","ContentAnyBinaryLocal","ContentAnyTextLocal","ContentAbsoluteBinaryRemote","ContentAbsoluteBinaryLocal","ContentAbsoluteTextRemote","ContentAbsoluteTextLocal","ContentRelativeBinary","ContentRelativeText","DescriptionContentBinary","value","ctx","DescriptionContentText","SemVer","mapRemoteToAbsolute","rootUrl","rootWithSlash","addPrefixToRelative","prefix","prefixWithSlash","BlockPackId","BlockPackIdNoVersion","Workflow","contentType","BlockComponents","wfAndModel","ui","BlockComponentsDescriptionRaw","BlockComponentsAbsoluteUrl","BlockPackMeta","longString","binary","BlockPackMetaDescriptionRaw","BlockPackMetaEmbeddedContent","BlockPackDescriptionFromPackageJsonRaw","CreateBlockPackDescriptionSchema","components","meta","BlockPackDescriptionRaw","BlockComponentsManifest","BlockPackMetaManif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E,OAAO,EAAE,IAAI,EACrB,OAAQA,EAAAA,EACL,OAAA,EACA,MAAM,aAAa,EACnB,YAAA,EACA,OAAO,EAAE,CACd,CAAC,EAGYqD,EAAoBrD,IAAE,OAAO,CACxC,OAAQA,EAAAA,EAAE,QAAQ,IAAI,EACtB,YAAamD,EACb,MAAOnD,EAAAA,EAAE,MAAMoD,CAAgB,CACjC,CAAC,EAGYE,EAAwB"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/block_meta/content_types.ts","../src/block_meta/semver.ts","../src/block_meta/content_conversion.ts","../src/block_meta/block_id.ts","../src/block_meta/block_components.ts","../src/block_meta/block_meta.ts","../src/block_meta/block_description.ts","../src/block_meta/block_manifest.ts","../src/block_registry/block_pack_spec.ts","../src/block_registry/registry_spec.ts","../src/block_registry/overview.ts"],"sourcesContent":["import { z } from 'zod';\n\n//\n// Base content types\n//\n\nexport const ContentExplicitString = z\n .object({\n type: z.literal('explicit-string'),\n content: z.string().describe('Actual string value')\n })\n .strict();\nexport type ContentExplicitString = z.infer<typeof ContentExplicitString>;\n\nexport const ContentExplicitBase64 = z\n .object({\n type: z.literal('explicit-base64'),\n mimeType: z\n .string()\n .regex(/\\w+\\/[-+.\\w]+/)\n .describe('MIME type to interpret content'),\n content: z.string().base64().describe('Base64 encoded binary value')\n })\n .strict();\nexport type ContentExplicitBase64 = z.infer<typeof ContentExplicitBase64>;\n\nexport const ContentRelative = z\n .object({\n type: z.literal('relative'),\n path: z\n .string()\n .describe(\n 'Address of the file, in most cases relative to the file which this structure is a part of'\n )\n })\n .strict();\nexport type ContentRelative = z.infer<typeof ContentRelative>;\n\nexport const ContentAbsoluteFile = z\n .object({\n type: z.literal('absolute-file'),\n file: z.string().startsWith('/').describe('Absolute address of the file in local file system')\n })\n .strict();\nexport type ContentAbsoluteFile = z.infer<typeof ContentAbsoluteFile>;\n\nexport const ContentAbsoluteUrl = z\n .object({\n type: z.literal('absolute-url'),\n url: z.string().url().describe('Global URL to reach the requested file')\n })\n .strict();\nexport type ContentAbsoluteUrl = z.infer<typeof ContentAbsoluteUrl>;\n\n//\n// Special content types\n//\n\nexport const ContentExplicitBytes = z\n .object({\n type: z.literal('explicit-bytes'),\n mimeType: z\n .string()\n .regex(/\\w+\\/[-+.\\w]+/)\n .describe('MIME type to interpret content'),\n content: z.instanceof(Uint8Array).describe('Raw content')\n })\n .strict();\nexport type ContentExplicitBytes = z.infer<typeof ContentExplicitBytes>;\n\nexport const ContentAbsoluteFolder = z\n .object({\n type: z.literal('absolute-folder'),\n folder: z\n .string()\n .startsWith('/')\n .describe('Absolute address of the folder in local file system')\n })\n .strict();\nexport type ContentAbsoluteFolder = z.infer<typeof ContentAbsoluteFolder>;\n\n//\n// Unions\n//\n\nexport const ContentAny = z.discriminatedUnion('type', [\n ContentExplicitString,\n ContentExplicitBase64,\n ContentRelative,\n ContentAbsoluteFile,\n ContentAbsoluteUrl\n]);\nexport type ContentAny = z.infer<typeof ContentAny>;\n\nexport const ContentExplicitOrRelative = z.discriminatedUnion('type', [\n ContentExplicitString,\n ContentExplicitBase64,\n ContentRelative\n]);\nexport type ContentExplicitOrRelative = z.infer<typeof ContentExplicitOrRelative>;\n\nexport const ContentAnyLocal = z.discriminatedUnion('type', [\n ContentExplicitString,\n ContentExplicitBase64,\n ContentRelative,\n ContentAbsoluteFile\n]);\nexport type ContentAnyLocal = z.infer<typeof ContentAnyLocal>;\n\nexport const ContentAnyRemote = z.discriminatedUnion('type', [\n ContentExplicitString,\n ContentExplicitBase64,\n ContentRelative,\n ContentAbsoluteUrl\n]);\nexport type ContentAnyRemote = z.infer<typeof ContentAnyRemote>;\n\n//\n// Narrow types with relative option\n//\n\n// export const ContentAnyBinaryRemote = z.discriminatedUnion('type', [\n// ContentExplicitBase64,\n// ContentRelative,\n// ContentAbsoluteUrl\n// ]);\n// export type ContentAnyBinaryRemote = z.infer<typeof ContentAnyBinaryRemote>;\n\nexport const ContentAnyBinaryLocal = z.discriminatedUnion('type', [\n ContentExplicitBase64,\n ContentRelative,\n ContentAbsoluteFile\n]);\nexport type ContentAnyBinaryLocal = z.infer<typeof ContentAnyBinaryLocal>;\n\n// export const ContentAnyTextRemote = z.discriminatedUnion('type', [\n// ContentExplicitString,\n// ContentRelative,\n// ContentAbsoluteUrl\n// ]);\n// export type ContentAnyTextRemote = z.infer<typeof ContentAnyTextRemote>;\n\nexport const ContentAnyTextLocal = z.discriminatedUnion('type', [\n ContentExplicitString,\n ContentRelative,\n ContentAbsoluteFile\n]);\nexport type ContentAnyTextLocal = z.infer<typeof ContentAnyTextLocal>;\n\n//\n// Narrow absolute types\n//\n\nexport const ContentAbsoluteBinaryRemote = z.discriminatedUnion('type', [\n ContentExplicitBase64,\n ContentAbsoluteUrl\n]);\nexport type ContentAbsoluteBinaryRemote = z.infer<typeof ContentAbsoluteBinaryRemote>;\n\nexport const ContentAbsoluteBinaryLocal = z.discriminatedUnion('type', [\n ContentExplicitBase64,\n ContentAbsoluteFile\n]);\nexport type ContentAbsoluteBinaryLocal = z.infer<typeof ContentAbsoluteBinaryLocal>;\n\nexport const ContentAbsoluteTextRemote = z.discriminatedUnion('type', [\n ContentExplicitString,\n ContentAbsoluteUrl\n]);\nexport type ContentAbsoluteTextRemote = z.infer<typeof ContentAbsoluteTextRemote>;\n\nexport const ContentAbsoluteTextLocal = z.discriminatedUnion('type', [\n ContentExplicitString,\n ContentAbsoluteFile\n]);\nexport type ContentAbsoluteTextLocal = z.infer<typeof ContentAbsoluteTextLocal>;\n\n//\n// Narrow relative types\n//\n\nexport const ContentRelativeBinary = z.discriminatedUnion('type', [\n ContentExplicitBase64,\n ContentRelative\n]);\nexport type ContentRelativeBinary = z.infer<typeof ContentRelativeBinary>;\n\nexport const ContentRelativeText = z.discriminatedUnion('type', [\n ContentExplicitString,\n ContentRelative\n]);\nexport type ContentRelativeText = z.infer<typeof ContentRelativeText>;\n\n// export function ConstructContent(\n// contentType: 'text',\n// contextType: 'local'\n// ): typeof ContentAnyTextLocal;\n// export function ConstructContent(\n// contentType: 'text',\n// contextType: 'remote'\n// ): typeof ContentAnyTextRemote;\n// export function ConstructContent(\n// contentType: 'binary',\n// contextType: 'local'\n// ): typeof ContentAnyBinaryLocal;\n// export function ConstructContent(\n// contentType: 'binary',\n// contextType: 'remote'\n// ): typeof ContentAnyBinaryRemote;\n// export function ConstructContent(\n// contentType: ContentType,\n// contextType: ContextType\n// ):\n// | typeof ContentAnyTextLocal\n// | typeof ContentAnyTextRemote\n// | typeof ContentAnyBinaryLocal\n// | typeof ContentAnyBinaryRemote;\n// export function ConstructContent(contentType: ContentType, contextType: ContextType) {\n// return contentType === 'text'\n// ? contextType === 'local'\n// ? ContentAnyTextLocal\n// : ContentAnyTextRemote\n// : contextType === 'local'\n// ? ContentAnyBinaryLocal\n// : ContentAnyBinaryRemote;\n// }\n\nexport const DescriptionContentBinary = z.union([\n z\n .string()\n .startsWith('file:')\n .transform<ContentRelativeBinary>((value, ctx) => ({ type: 'relative', path: value.slice(5) })),\n ContentAnyBinaryLocal\n]);\nexport type DescriptionContentBinary = z.infer<typeof DescriptionContentBinary>;\n\nexport const DescriptionContentText = z.union([\n z.string().transform<ContentRelativeText>((value, ctx) => {\n if (value.startsWith('file:')) return { type: 'relative', path: value.slice(5) };\n else return { type: 'explicit-string', content: value };\n }),\n ContentAnyTextLocal\n]);\nexport type DescriptionContentText = z.infer<typeof DescriptionContentText>;\n","import { z } from 'zod';\n\n// Regex taken from here:\n// https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string\nexport const SemVer = z\n .string()\n .regex(\n /^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$/,\n 'Wrong version format, please use valid semver'\n );\n","import {\n ContentAbsoluteUrl,\n ContentAnyLocal,\n ContentExplicitOrRelative,\n ContentRelative\n} from './content_types';\n\nexport function mapRemoteToAbsolute(\n rootUrl: string\n): <T extends ContentAnyLocal>(value: T) => Exclude<T, ContentRelative> | ContentAbsoluteUrl {\n const rootWithSlash = rootUrl.endsWith('/') ? rootUrl : `${rootUrl}/`;\n return <T extends ContentAnyLocal>(value: T) =>\n value.type === 'relative'\n ? { type: 'absolute-url', url: rootWithSlash + value.path }\n : (value as Exclude<T, ContentRelative>);\n}\n\n/**\n * Creates transformer of relative content paths, that adds a specific prefix to the relative path.\n *\n * If prefix = \"nested-path/\", paths like \"somefile.txt\" will be transformed to \"nested-path/somefile.txt\".\n *\n * @param prefix prefix to add to the relaive path, slesh at the end will be added automatically if missed\n */\nexport function addPrefixToRelative(\n prefix: string\n): <T extends ContentExplicitOrRelative>(value: T) => T {\n const prefixWithSlash = prefix.endsWith('/') ? prefix : `${prefix}/`;\n return <T extends ContentExplicitOrRelative>(value: T) =>\n (value.type === 'relative'\n ? { type: 'relative', path: prefixWithSlash + value.path }\n : value) as T;\n}\n","import { z } from 'zod';\nimport { SemVer } from './semver';\n\n/** Global identifier of the block */\nexport const BlockPackId = z\n .object({\n organization: z.string(),\n name: z.string(),\n version: SemVer\n })\n .strict();\nexport type BlockPackId = z.infer<typeof BlockPackId>;\n\nexport const BlockPackIdNoVersion = BlockPackId.omit({ version: true });\nexport type BlockPackIdNoVersion = z.infer<typeof BlockPackIdNoVersion>;\n","import { z } from 'zod';\nimport { ContentRelativeBinary } from './content_types';\nimport { mapRemoteToAbsolute } from './content_conversion';\n\nexport type BlockPackComponents = {};\n\nexport function Workflow<const Content extends z.ZodTypeAny>(contentType: Content) {\n return z.union([\n // string is converted to v1 workflow\n contentType.transform((value) => ({\n type: 'workflow-v1',\n main: value\n })),\n // structured objects are decoded as union with type descriptor\n z.discriminatedUnion('type', [\n z.object({\n type: z.literal('workflow-v1'),\n main: contentType.describe('Main workflow')\n })\n ])\n ]);\n}\n\nexport function BlockComponents<\n const WfAndModel extends z.ZodTypeAny,\n const UI extends z.ZodTypeAny\n>(wfAndModel: WfAndModel, ui: UI) {\n return z.object({\n workflow: Workflow(wfAndModel),\n model: wfAndModel,\n ui\n });\n}\n\nexport const BlockComponentsDescriptionRaw = BlockComponents(z.string(), z.string());\nexport type BlockComponentsDescriptionRaw = z.infer<typeof BlockComponentsDescriptionRaw>;\n\nexport function BlockComponentsAbsoluteUrl(prefix: string) {\n return BlockComponents(\n ContentRelativeBinary.transform(mapRemoteToAbsolute(prefix)),\n ContentRelativeBinary.transform(mapRemoteToAbsolute(prefix))\n );\n}\nexport type BlockComponentsAbsolute = z.infer<ReturnType<typeof BlockComponentsAbsoluteUrl>>;\n\n// export const BlockComponentsExplicit = BlockComponents(, ContentRelative);\n// export type BlockComponentsExplicit = z.infer<typeof BlockComponentsExplicit>;\n","import { z } from 'zod';\nimport {\n ContentExplicitBase64,\n ContentExplicitBytes,\n DescriptionContentBinary,\n DescriptionContentText\n} from './content_types';\n\nexport function BlockPackMeta<\n const LongStringType extends z.ZodTypeAny,\n const BinaryType extends z.ZodTypeAny\n>(longString: LongStringType, binary: BinaryType) {\n return z.object({\n title: z.string(),\n description: z.string(),\n longDescription: longString.optional(),\n logo: binary.optional(),\n url: z.string().url().optional(),\n docs: z.string().url().optional(),\n support: z.union([z.string().url(), z.string().email()]).optional(),\n tags: z.array(z.string()).optional(),\n organization: z.object({\n name: z.string(),\n url: z.string().url(),\n logo: binary.optional()\n })\n });\n}\n\n// prettier-ignore\nexport const BlockPackMetaDescriptionRaw = BlockPackMeta(\n DescriptionContentText,\n DescriptionContentBinary\n);\nexport type BlockPackMetaDescriptionRaw = z.infer<typeof BlockPackMetaDescriptionRaw>;\n\n// prettier-ignore\nexport const BlockPackMetaEmbeddedBase64 = BlockPackMeta(\n z.string(),\n ContentExplicitBase64\n);\nexport type BlockPackMetaEmbeddedBase64 = z.infer<typeof BlockPackMetaEmbeddedBase64>;\n\n// prettier-ignore\nexport const BlockPackMetaEmbeddedBytes = BlockPackMeta(\n z.string(),\n ContentExplicitBytes\n);\nexport type BlockPackMetaEmbeddedBytes = z.infer<typeof BlockPackMetaEmbeddedBytes>;\n","import { z, ZodTypeAny } from 'zod';\nimport { BlockComponentsDescriptionRaw } from './block_components';\nimport { BlockPackMetaDescriptionRaw } from './block_meta';\nimport { BlockPackId } from './block_id';\n\n/** Description, as appears in root block package.json file,\n * `file:` references are parsed into relative content of corresponding type, depending on the context,\n * strings are converted to explicit content type. */\nexport const BlockPackDescriptionFromPackageJsonRaw = z.object({\n components: BlockComponentsDescriptionRaw,\n meta: BlockPackMetaDescriptionRaw\n});\n\nexport function CreateBlockPackDescriptionSchema<\n Components extends ZodTypeAny,\n Meta extends ZodTypeAny\n>(components: Components, meta: Meta) {\n return z.object({\n id: BlockPackId,\n components,\n meta\n });\n}\n\nexport const BlockPackDescriptionRaw = CreateBlockPackDescriptionSchema(\n BlockComponentsDescriptionRaw,\n BlockPackMetaDescriptionRaw\n);\nexport type BlockPackDescriptionRaw = z.infer<typeof BlockPackDescriptionRaw>;\n","import { z } from 'zod';\nimport { BlockComponents } from './block_components';\nimport { ContentRelative, ContentRelativeBinary, ContentRelativeText } from './content_types';\nimport { CreateBlockPackDescriptionSchema } from './block_description';\nimport { BlockPackMeta } from './block_meta';\n\nexport const BlockComponentsManifest = BlockComponents(ContentRelative, ContentRelative);\nexport type BlockComponentsManifest = z.infer<typeof BlockComponentsManifest>;\n\nexport const BlockPackMetaManifest = BlockPackMeta(ContentRelativeText, ContentRelativeBinary);\nexport type BlockPackMetaManifest = z.infer<typeof BlockPackMetaManifest>;\n\n/** Block description to be used in block manifest */\nexport const BlockPackDescriptionManifest = CreateBlockPackDescriptionSchema(\n BlockComponentsManifest,\n BlockPackMetaManifest\n);\nexport type BlockPackDescriptionManifest = z.infer<typeof BlockPackDescriptionManifest>;\n\nexport const Sha256Schema = z\n .string()\n .regex(/[0-9a-fA-F]/)\n .toUpperCase()\n .length(64); // 256 / 4 (bits per hex register);\n\nexport const ManifestFileInfo = z.object({\n name: z.string(),\n size: z.number().int(),\n sha256: Sha256Schema\n});\nexport type ManifestFileInfo = z.infer<typeof ManifestFileInfo>;\n\nexport const BlockPackManifest = z.object({\n schema: z.literal('v2'),\n description: BlockPackDescriptionManifest,\n files: z.array(ManifestFileInfo)\n});\nexport type BlockPackManifest = z.infer<typeof BlockPackManifest>;\n\nexport const BlockPackManifestFile = 'manifest.json';\n","import { z } from 'zod';\nimport { BlockPackId } from '../block_meta';\n\n/** Block pack from local folder, to be used during block development. Old layout.\n * @deprecated don't use */\nexport const BlockPackDevV1 = z.object({\n type: z.literal('dev-v1'),\n folder: z.string(),\n mtime: z.string().optional()\n});\n/** @deprecated don't use */\nexport type BlockPackDevV1 = z.infer<typeof BlockPackDevV1>;\n\n/** Block pack from local folder, to be used during block development. New layout. */\nexport const BlockPackDevV2 = z.object({\n type: z.literal('dev-v2'),\n folder: z.string(),\n mtime: z.string().optional()\n});\nexport type BlockPackDevV2 = z.infer<typeof BlockPackDevV2>;\n\n/**\n * Block pack from registry with version 2 layout, to be loaded directly\n * from the client.\n * @deprecated don't use\n * */\nexport const BlockPackFromRegistryV1 = z.object({\n type: z.literal('from-registry-v1'),\n registryUrl: z.string(),\n id: BlockPackId\n});\n/** @deprecated don't use */\nexport type BlockPackFromRegistryV1 = z.infer<typeof BlockPackFromRegistryV1>;\n\n/** Block pack from registry with version 2 layout, to be loaded directly\n * from the client. */\nexport const BlockPackFromRegistryV2 = z.object({\n type: z.literal('from-registry-v2'),\n registryUrl: z.string(),\n id: BlockPackId\n});\nexport type BlockPackFromRegistryV2 = z.infer<typeof BlockPackFromRegistryV2>;\n\n/** Information about block origin, can be used to instantiate new blocks */\nexport const BlockPackSpec = z.discriminatedUnion('type', [\n BlockPackDevV1,\n BlockPackDevV2,\n BlockPackFromRegistryV1,\n BlockPackFromRegistryV2\n]);\nexport type BlockPackSpec = z.infer<typeof BlockPackSpec>;\n","import { z } from 'zod';\n\nexport const LocalDevFolder = z.object({\n type: z.literal('local-dev'),\n path: z.string()\n});\nexport type LocalDevFolder = z.infer<typeof LocalDevFolder>;\n\n/** @deprecated don't use */\nexport const RemoteRegistryV1Spec = z.object({\n type: z.literal('remote-v1'),\n url: z.string().url()\n});\n/** @deprecated don't use */\nexport type RemoteRegistryV1Spec = z.infer<typeof RemoteRegistryV1Spec>;\n\nexport const RemoteRegistryV2Spec = z.object({\n type: z.literal('remote-v2'),\n url: z.string().url()\n});\nexport type RemoteRegistryV2Spec = z.infer<typeof RemoteRegistryV2Spec>;\n\nexport const RegistrySpec = z.discriminatedUnion('type', [\n RemoteRegistryV1Spec,\n RemoteRegistryV2Spec,\n LocalDevFolder\n]);\nexport type RegistrySpec = z.infer<typeof RegistrySpec>;\n\nexport const RegistryEntry = z.object({\n id: z.string(),\n title: z.string().optional(),\n spec: RegistrySpec\n});\nexport type RegistryEntry = z.infer<typeof RegistryEntry>;\n\nexport const RegistryList = z.array(RegistryEntry);\nexport type RegistryList = z.infer<typeof RegistryList>;\n","import { z } from 'zod';\nimport { BlockPackId, BlockPackMetaEmbeddedBytes, SemVer } from '../block_meta';\nimport { BlockPackSpec } from './block_pack_spec';\nimport { RegistryEntry } from './registry_spec';\n\n/**\n * Latest information about specific block pack. Contain information about latest version of the package.\n * */\nexport const BlockPackOverview = z.object({\n registryId: z.string(),\n id: BlockPackId,\n meta: BlockPackMetaEmbeddedBytes,\n spec: BlockPackSpec,\n otherVersions: z.array(SemVer)\n});\nexport type BlockPackOverview = z.infer<typeof BlockPackOverview>;\n\nexport const RegistryStatus = RegistryEntry.extend({\n status: z.union([z.literal('online'), z.literal('offline')])\n});\nexport type RegistryStatus = z.infer<typeof RegistryStatus>;\n\nexport const BlockPackListing = z.object({\n registries: z.array(RegistryStatus),\n blockPacks: z.array(BlockPackOverview)\n});\nexport type BlockPackListing = z.infer<typeof BlockPackListing>;\n"],"names":["ContentExplicitString","z","ContentExplicitBase64","ContentRelative","ContentAbsoluteFile","ContentAbsoluteUrl","ContentExplicitBytes","ContentAbsoluteFolder","ContentAny","ContentExplicitOrRelative","ContentAnyLocal","ContentAnyRemote","ContentAnyBinaryLocal","ContentAnyTextLocal","ContentAbsoluteBinaryRemote","ContentAbsoluteBinaryLocal","ContentAbsoluteTextRemote","ContentAbsoluteTextLocal","ContentRelativeBinary","ContentRelativeText","DescriptionContentBinary","value","ctx","DescriptionContentText","SemVer","mapRemoteToAbsolute","rootUrl","rootWithSlash","addPrefixToRelative","prefix","prefixWithSlash","BlockPackId","BlockPackIdNoVersion","Workflow","contentType","BlockComponents","wfAndModel","ui","BlockComponentsDescriptionRaw","BlockComponentsAbsoluteUrl","BlockPackMeta","longString","binary","BlockPackMetaDescriptionRaw","BlockPackMetaEmbeddedBase64","BlockPackMetaEmbeddedBytes","BlockPackDescriptionFromPackageJsonRaw","CreateBlockPackDescriptionSchema","components","meta","BlockPackDescriptionRaw","BlockComponentsManifest","BlockPackMetaManifest","BlockPackDescriptionManifest","Sha256Schema","ManifestFileInfo","BlockPackManifest","BlockPackManifestFile","BlockPackDevV1","BlockPackDevV2","BlockPackFromRegistryV1","BlockPackFromRegistryV2","BlockPackSpec","LocalDevFolder","RemoteRegistryV1Spec","RemoteRegistryV2Spec","RegistrySpec","RegistryEntry","RegistryList","BlockPackOverview","RegistryStatus","BlockPackListing"],"mappings":"uGAMaA,EAAwBC,IAClC,OAAO,CACN,KAAMA,EAAAA,EAAE,QAAQ,iBAAiB,EACjC,QAASA,EAAAA,EAAE,SAAS,SAAS,qBAAqB,CACpD,CAAC,EACA,OAAO,EAGGC,EAAwBD,IAClC,OAAO,CACN,KAAMA,EAAAA,EAAE,QAAQ,iBAAiB,EACjC,SAAUA,IACP,OAAO,EACP,MAAM,eAAe,EACrB,SAAS,gCAAgC,EAC5C,QAASA,EAAE,EAAA,OAAA,EAAS,OAAO,EAAE,SAAS,6BAA6B,CACrE,CAAC,EACA,OAAO,EAGGE,EAAkBF,IAC5B,OAAO,CACN,KA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