@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
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z as t } from "zod";
|
|
2
|
-
const
|
|
2
|
+
const r = t.object({
|
|
3
3
|
type: t.literal("explicit-string"),
|
|
4
4
|
content: t.string().describe("Actual string value")
|
|
5
5
|
}).strict(), o = t.object({
|
|
@@ -14,86 +14,86 @@ const s = t.object({
|
|
|
14
14
|
}).strict(), c = t.object({
|
|
15
15
|
type: t.literal("absolute-file"),
|
|
16
16
|
file: t.string().startsWith("/").describe("Absolute address of the file in local file system")
|
|
17
|
-
}).strict(),
|
|
17
|
+
}).strict(), l = t.object({
|
|
18
18
|
type: t.literal("absolute-url"),
|
|
19
19
|
url: t.string().url().describe("Global URL to reach the requested file")
|
|
20
|
-
}).strict(),
|
|
20
|
+
}).strict(), B = t.object({
|
|
21
21
|
type: t.literal("explicit-bytes"),
|
|
22
22
|
mimeType: t.string().regex(/\w+\/[-+.\w]+/).describe("MIME type to interpret content"),
|
|
23
23
|
content: t.instanceof(Uint8Array).describe("Raw content")
|
|
24
|
-
}).strict(),
|
|
24
|
+
}).strict(), $ = t.object({
|
|
25
25
|
type: t.literal("absolute-folder"),
|
|
26
26
|
folder: t.string().startsWith("/").describe("Absolute address of the folder in local file system")
|
|
27
|
-
}).strict(),
|
|
28
|
-
|
|
27
|
+
}).strict(), q = t.discriminatedUnion("type", [
|
|
28
|
+
r,
|
|
29
29
|
o,
|
|
30
30
|
i,
|
|
31
31
|
c,
|
|
32
|
-
|
|
33
|
-
]),
|
|
34
|
-
|
|
32
|
+
l
|
|
33
|
+
]), G = t.discriminatedUnion("type", [
|
|
34
|
+
r,
|
|
35
35
|
o,
|
|
36
36
|
i
|
|
37
|
-
]),
|
|
38
|
-
|
|
37
|
+
]), J = t.discriminatedUnion("type", [
|
|
38
|
+
r,
|
|
39
39
|
o,
|
|
40
40
|
i,
|
|
41
41
|
c
|
|
42
|
-
]),
|
|
43
|
-
|
|
42
|
+
]), N = t.discriminatedUnion("type", [
|
|
43
|
+
r,
|
|
44
44
|
o,
|
|
45
45
|
i,
|
|
46
|
-
|
|
47
|
-
]),
|
|
46
|
+
l
|
|
47
|
+
]), h = t.discriminatedUnion("type", [
|
|
48
48
|
o,
|
|
49
49
|
i,
|
|
50
50
|
c
|
|
51
|
-
]),
|
|
52
|
-
|
|
51
|
+
]), v = t.discriminatedUnion("type", [
|
|
52
|
+
r,
|
|
53
53
|
i,
|
|
54
54
|
c
|
|
55
|
-
]),
|
|
55
|
+
]), H = t.discriminatedUnion("type", [
|
|
56
56
|
o,
|
|
57
|
-
|
|
58
|
-
]),
|
|
57
|
+
l
|
|
58
|
+
]), K = t.discriminatedUnion("type", [
|
|
59
59
|
o,
|
|
60
60
|
c
|
|
61
|
-
]),
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
]),
|
|
65
|
-
|
|
61
|
+
]), Q = t.discriminatedUnion("type", [
|
|
62
|
+
r,
|
|
63
|
+
l
|
|
64
|
+
]), X = t.discriminatedUnion("type", [
|
|
65
|
+
r,
|
|
66
66
|
c
|
|
67
|
-
]),
|
|
67
|
+
]), d = t.discriminatedUnion("type", [
|
|
68
68
|
o,
|
|
69
69
|
i
|
|
70
|
-
]),
|
|
71
|
-
|
|
70
|
+
]), j = t.discriminatedUnion("type", [
|
|
71
|
+
r,
|
|
72
72
|
i
|
|
73
73
|
]), C = t.union([
|
|
74
74
|
t.string().startsWith("file:").transform((e, n) => ({ type: "relative", path: e.slice(5) })),
|
|
75
|
-
|
|
75
|
+
h
|
|
76
76
|
]), A = t.union([
|
|
77
77
|
t.string().transform((e, n) => e.startsWith("file:") ? { type: "relative", path: e.slice(5) } : { type: "explicit-string", content: e }),
|
|
78
|
-
|
|
79
|
-
]),
|
|
78
|
+
v
|
|
79
|
+
]), m = t.string().regex(
|
|
80
80
|
/^(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-]+)*))?$/,
|
|
81
81
|
"Wrong version format, please use valid semver"
|
|
82
82
|
);
|
|
83
|
-
function
|
|
83
|
+
function g(e) {
|
|
84
84
|
const n = e.endsWith("/") ? e : `${e}/`;
|
|
85
|
-
return (
|
|
85
|
+
return (s) => s.type === "relative" ? { type: "absolute-url", url: n + s.path } : s;
|
|
86
86
|
}
|
|
87
|
-
function
|
|
87
|
+
function Y(e) {
|
|
88
88
|
const n = e.endsWith("/") ? e : `${e}/`;
|
|
89
|
-
return (
|
|
89
|
+
return (s) => s.type === "relative" ? { type: "relative", path: n + s.path } : s;
|
|
90
90
|
}
|
|
91
|
-
const
|
|
91
|
+
const a = t.object({
|
|
92
92
|
organization: t.string(),
|
|
93
93
|
name: t.string(),
|
|
94
|
-
version:
|
|
95
|
-
}).strict(),
|
|
96
|
-
function
|
|
94
|
+
version: m
|
|
95
|
+
}).strict(), tt = a.omit({ version: !0 });
|
|
96
|
+
function P(e) {
|
|
97
97
|
return t.union([
|
|
98
98
|
// string is converted to v1 workflow
|
|
99
99
|
e.transform((n) => ({
|
|
@@ -109,21 +109,21 @@ function x(e) {
|
|
|
109
109
|
])
|
|
110
110
|
]);
|
|
111
111
|
}
|
|
112
|
-
function
|
|
112
|
+
function y(e, n) {
|
|
113
113
|
return t.object({
|
|
114
|
-
workflow:
|
|
114
|
+
workflow: P(e),
|
|
115
115
|
model: e,
|
|
116
116
|
ui: n
|
|
117
117
|
});
|
|
118
118
|
}
|
|
119
|
-
const
|
|
120
|
-
function
|
|
121
|
-
return
|
|
122
|
-
|
|
123
|
-
|
|
119
|
+
const b = y(t.string(), t.string());
|
|
120
|
+
function et(e) {
|
|
121
|
+
return y(
|
|
122
|
+
d.transform(g(e)),
|
|
123
|
+
d.transform(g(e))
|
|
124
124
|
);
|
|
125
125
|
}
|
|
126
|
-
function
|
|
126
|
+
function p(e, n) {
|
|
127
127
|
return t.object({
|
|
128
128
|
title: t.string(),
|
|
129
129
|
description: t.string(),
|
|
@@ -140,84 +140,151 @@ function d(e, n) {
|
|
|
140
140
|
})
|
|
141
141
|
});
|
|
142
142
|
}
|
|
143
|
-
const
|
|
143
|
+
const u = p(
|
|
144
144
|
A,
|
|
145
145
|
C
|
|
146
|
-
),
|
|
146
|
+
), nt = p(
|
|
147
147
|
t.string(),
|
|
148
148
|
o
|
|
149
|
-
),
|
|
150
|
-
|
|
151
|
-
|
|
149
|
+
), R = p(
|
|
150
|
+
t.string(),
|
|
151
|
+
B
|
|
152
|
+
), it = t.object({
|
|
153
|
+
components: b,
|
|
154
|
+
meta: u
|
|
152
155
|
});
|
|
153
156
|
function f(e, n) {
|
|
154
157
|
return t.object({
|
|
155
|
-
id:
|
|
158
|
+
id: a,
|
|
156
159
|
components: e,
|
|
157
160
|
meta: n
|
|
158
161
|
});
|
|
159
162
|
}
|
|
160
|
-
const
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
),
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
),
|
|
163
|
+
const ot = f(
|
|
164
|
+
b,
|
|
165
|
+
u
|
|
166
|
+
), x = y(i, i), U = p(j, d), w = f(
|
|
167
|
+
x,
|
|
168
|
+
U
|
|
169
|
+
), M = t.string().regex(/[0-9a-fA-F]/).toUpperCase().length(64), S = t.object({
|
|
167
170
|
name: t.string(),
|
|
168
171
|
size: t.number().int(),
|
|
169
|
-
sha256:
|
|
170
|
-
|
|
171
|
-
}), q = t.object({
|
|
172
|
+
sha256: M
|
|
173
|
+
}), rt = t.object({
|
|
172
174
|
schema: t.literal("v2"),
|
|
173
|
-
description:
|
|
174
|
-
files: t.array(
|
|
175
|
-
}),
|
|
175
|
+
description: w,
|
|
176
|
+
files: t.array(S)
|
|
177
|
+
}), st = "manifest.json", D = t.object({
|
|
178
|
+
type: t.literal("dev-v1"),
|
|
179
|
+
folder: t.string(),
|
|
180
|
+
mtime: t.string().optional()
|
|
181
|
+
}), z = t.object({
|
|
182
|
+
type: t.literal("dev-v2"),
|
|
183
|
+
folder: t.string(),
|
|
184
|
+
mtime: t.string().optional()
|
|
185
|
+
}), F = t.object({
|
|
186
|
+
type: t.literal("from-registry-v1"),
|
|
187
|
+
registryUrl: t.string(),
|
|
188
|
+
id: a
|
|
189
|
+
}), W = t.object({
|
|
190
|
+
type: t.literal("from-registry-v2"),
|
|
191
|
+
registryUrl: t.string(),
|
|
192
|
+
id: a
|
|
193
|
+
}), E = t.discriminatedUnion("type", [
|
|
194
|
+
D,
|
|
195
|
+
z,
|
|
196
|
+
F,
|
|
197
|
+
W
|
|
198
|
+
]), L = t.object({
|
|
199
|
+
type: t.literal("local-dev"),
|
|
200
|
+
path: t.string()
|
|
201
|
+
}), T = t.object({
|
|
202
|
+
type: t.literal("remote-v1"),
|
|
203
|
+
url: t.string().url()
|
|
204
|
+
}), V = t.object({
|
|
205
|
+
type: t.literal("remote-v2"),
|
|
206
|
+
url: t.string().url()
|
|
207
|
+
}), I = t.discriminatedUnion("type", [
|
|
208
|
+
T,
|
|
209
|
+
V,
|
|
210
|
+
L
|
|
211
|
+
]), k = t.object({
|
|
212
|
+
id: t.string(),
|
|
213
|
+
title: t.string().optional(),
|
|
214
|
+
spec: I
|
|
215
|
+
}), ct = t.array(k), Z = t.object({
|
|
216
|
+
registryId: t.string(),
|
|
217
|
+
id: a,
|
|
218
|
+
meta: R,
|
|
219
|
+
spec: E,
|
|
220
|
+
otherVersions: t.array(m)
|
|
221
|
+
}), O = k.extend({
|
|
222
|
+
status: t.union([t.literal("online"), t.literal("offline")])
|
|
223
|
+
}), at = t.object({
|
|
224
|
+
registries: t.array(O),
|
|
225
|
+
blockPacks: t.array(Z)
|
|
226
|
+
}), lt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
176
227
|
__proto__: null
|
|
177
228
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
178
229
|
export {
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
230
|
+
y as BlockComponents,
|
|
231
|
+
et as BlockComponentsAbsoluteUrl,
|
|
232
|
+
b as BlockComponentsDescriptionRaw,
|
|
233
|
+
x as BlockComponentsManifest,
|
|
234
|
+
it as BlockPackDescriptionFromPackageJsonRaw,
|
|
235
|
+
w as BlockPackDescriptionManifest,
|
|
236
|
+
ot as BlockPackDescriptionRaw,
|
|
237
|
+
D as BlockPackDevV1,
|
|
238
|
+
z as BlockPackDevV2,
|
|
239
|
+
F as BlockPackFromRegistryV1,
|
|
240
|
+
W as BlockPackFromRegistryV2,
|
|
241
|
+
a as BlockPackId,
|
|
242
|
+
tt as BlockPackIdNoVersion,
|
|
243
|
+
at as BlockPackListing,
|
|
244
|
+
rt as BlockPackManifest,
|
|
245
|
+
st as BlockPackManifestFile,
|
|
246
|
+
p as BlockPackMeta,
|
|
247
|
+
u as BlockPackMetaDescriptionRaw,
|
|
248
|
+
nt as BlockPackMetaEmbeddedBase64,
|
|
249
|
+
R as BlockPackMetaEmbeddedBytes,
|
|
250
|
+
U as BlockPackMetaManifest,
|
|
251
|
+
Z as BlockPackOverview,
|
|
252
|
+
E as BlockPackSpec,
|
|
253
|
+
K as ContentAbsoluteBinaryLocal,
|
|
254
|
+
H as ContentAbsoluteBinaryRemote,
|
|
196
255
|
c as ContentAbsoluteFile,
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
256
|
+
$ as ContentAbsoluteFolder,
|
|
257
|
+
X as ContentAbsoluteTextLocal,
|
|
258
|
+
Q as ContentAbsoluteTextRemote,
|
|
259
|
+
l as ContentAbsoluteUrl,
|
|
260
|
+
q as ContentAny,
|
|
261
|
+
h as ContentAnyBinaryLocal,
|
|
262
|
+
J as ContentAnyLocal,
|
|
263
|
+
N as ContentAnyRemote,
|
|
264
|
+
v as ContentAnyTextLocal,
|
|
206
265
|
o as ContentExplicitBase64,
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
266
|
+
B as ContentExplicitBytes,
|
|
267
|
+
G as ContentExplicitOrRelative,
|
|
268
|
+
r as ContentExplicitString,
|
|
210
269
|
i as ContentRelative,
|
|
211
|
-
|
|
212
|
-
|
|
270
|
+
d as ContentRelativeBinary,
|
|
271
|
+
j as ContentRelativeText,
|
|
213
272
|
f as CreateBlockPackDescriptionSchema,
|
|
214
273
|
C as DescriptionContentBinary,
|
|
215
274
|
A as DescriptionContentText,
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
275
|
+
L as LocalDevFolder,
|
|
276
|
+
S as ManifestFileInfo,
|
|
277
|
+
lt as PFrameInternal,
|
|
278
|
+
k as RegistryEntry,
|
|
279
|
+
ct as RegistryList,
|
|
280
|
+
I as RegistrySpec,
|
|
281
|
+
O as RegistryStatus,
|
|
282
|
+
T as RemoteRegistryV1Spec,
|
|
283
|
+
V as RemoteRegistryV2Spec,
|
|
284
|
+
m as SemVer,
|
|
285
|
+
M as Sha256Schema,
|
|
286
|
+
P as Workflow,
|
|
287
|
+
Y as addPrefixToRelative,
|
|
288
|
+
g as mapRemoteToAbsolute
|
|
222
289
|
};
|
|
223
290
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","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","BlockPackMetaManifest","BlockPackDescriptionManifest","ManifestF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E,OAAO;AAAA,IACd,IAAI8B;AAAA,IACJ,YAAAgB;AAAA,IACA,MAAAC;AAAA,EAAA,CACD;AACH;AAEO,MAAMC,IAA0BH;AAAA,EACrCR;AAAA,EACAK;AACF,GCrBaO,IAA0Bf,EAAgBhC,GAAiBA,CAAe,GAG1EgD,IAAwBX,EAAcrB,GAAqBD,CAAqB,GAIhFkC,IAA+BN;AAAA,EAC1CI;AAAA,EACAC;AACF,GAGaE,IAAmBpD,EAAE,OAAO;AAAA,EACvC,MAAMA,EAAE,OAAO;AAAA,EACf,MAAMA,EAAE,OAAO,EAAE,IAAI;AAAA,EACrB,QAAQA,EACL,OAAA,EACA,MAAM,aAAa,EACnB,YAAA,EACA,OAAO,EAAE;AAAA;AACd,CAAC,GAGYqD,IAAoBrD,EAAE,OAAO;AAAA,EACxC,QAAQA,EAAE,QAAQ,IAAI;AAAA,EACtB,aAAamD;AAAA,EACb,OAAOnD,EAAE,MAAMoD,CAAgB;AACjC,CAAC,GAGYE,IAAwB;;;"}
|
|
1
|
+
{"version":3,"file":"index.mjs","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":";AAMa,MAAAA,IAAwBC,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ec } from './
|
|
2
|
+
import { BlockPackSpec } from './block_registry/block_pack_spec';
|
|
3
3
|
import { BlockRenderingMode, BlockSection, NavigationState } from '@milaboratories/pl-model-common';
|
|
4
4
|
import { AuthorMarker } from './author_marker';
|
|
5
5
|
/** Generalized block status, to be used in block item "styling". */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project_overview.d.ts","sourceRoot":"","sources":["../src/project_overview.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"project_overview.d.ts","sourceRoot":"","sources":["../src/project_overview.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AACpG,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,oEAAoE;AACpE,MAAM,MAAM,sBAAsB,GAAG,eAAe,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,CAAC;AAEpF,4EAA4E;AAC5E,MAAM,MAAM,eAAe,GAAG;IAC5B,+DAA+D;IAC/D,IAAI,EAAE,WAAW,CAAC;IAElB,0BAA0B;IAC1B,OAAO,EAAE,IAAI,CAAC;IAEd,mCAAmC;IACnC,YAAY,EAAE,IAAI,CAAC;IAEnB;;;;;;SAMK;IACL,YAAY,CAAC,EAAE,YAAY,CAAC;IAE5B,0CAA0C;IAC1C,MAAM,EAAE,kBAAkB,EAAE,CAAC;CAC9B,CAAC;AAEF,gFAAgF;AAChF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,eAAe;IACf,EAAE,EAAE,MAAM,CAAC;IAEX,uCAAuC;IACvC,KAAK,EAAE,MAAM,CAAC;IAEd,2BAA2B;IAC3B,aAAa,EAAE,kBAAkB,CAAC;IAElC;;;SAGK;IACL,gBAAgB,EAAE,OAAO,CAAC;IAE1B;;;;;SAKK;IACL,KAAK,EAAE,OAAO,CAAC;IAEf;;;SAGK;IACL,YAAY,EAAE,OAAO,CAAC;IAEtB;;;SAGK;IACL,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;SAGK;IACL,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB,2CAA2C;IAC3C,iBAAiB,EAAE,sBAAsB,CAAC;IAE1C;;;SAGK;IACL,SAAS,EAAE,MAAM,EAAE,CAAC;IAEpB;;;SAGK;IACL,WAAW,EAAE,MAAM,EAAE,CAAC;IAEtB;;;SAGK;IACL,QAAQ,EAAE,YAAY,EAAE,GAAG,SAAS,CAAC;IAErC;;;SAGK;IACL,WAAW,EAAE,OAAO,GAAG,SAAS,CAAC;IAEjC;;;SAGK;IACL,MAAM,EAAE,OAAO,CAAC;IAEhB;;;SAGK;IACL,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IAE/B,mEAAmE;IACnE,gBAAgB,EAAE,aAAa,GAAG,SAAS,CAAC;IAE5C;;;SAGK;IACL,gBAAgB,EAAE,aAAa,GAAG,SAAS,CAAC;IAE5C,4CAA4C;IAC5C,eAAe,EAAE,eAAe,CAAC;CAClC,CAAC"}
|
package/package.json
CHANGED
|
@@ -42,3 +42,6 @@ export function BlockComponentsAbsoluteUrl(prefix: string) {
|
|
|
42
42
|
);
|
|
43
43
|
}
|
|
44
44
|
export type BlockComponentsAbsolute = z.infer<ReturnType<typeof BlockComponentsAbsoluteUrl>>;
|
|
45
|
+
|
|
46
|
+
// export const BlockComponentsExplicit = BlockComponents(, ContentRelative);
|
|
47
|
+
// export type BlockComponentsExplicit = z.infer<typeof BlockComponentsExplicit>;
|
|
@@ -17,14 +17,16 @@ export const BlockPackDescriptionManifest = CreateBlockPackDescriptionSchema(
|
|
|
17
17
|
);
|
|
18
18
|
export type BlockPackDescriptionManifest = z.infer<typeof BlockPackDescriptionManifest>;
|
|
19
19
|
|
|
20
|
+
export const Sha256Schema = z
|
|
21
|
+
.string()
|
|
22
|
+
.regex(/[0-9a-fA-F]/)
|
|
23
|
+
.toUpperCase()
|
|
24
|
+
.length(64); // 256 / 4 (bits per hex register);
|
|
25
|
+
|
|
20
26
|
export const ManifestFileInfo = z.object({
|
|
21
27
|
name: z.string(),
|
|
22
28
|
size: z.number().int(),
|
|
23
|
-
sha256:
|
|
24
|
-
.string()
|
|
25
|
-
.regex(/[0-9a-fA-F]/)
|
|
26
|
-
.toUpperCase()
|
|
27
|
-
.length(64) // 256 / 4 (bits per hex register)
|
|
29
|
+
sha256: Sha256Schema
|
|
28
30
|
});
|
|
29
31
|
export type ManifestFileInfo = z.infer<typeof ManifestFileInfo>;
|
|
30
32
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import {
|
|
3
3
|
ContentExplicitBase64,
|
|
4
|
+
ContentExplicitBytes,
|
|
4
5
|
DescriptionContentBinary,
|
|
5
6
|
DescriptionContentText
|
|
6
7
|
} from './content_types';
|
|
@@ -34,8 +35,15 @@ export const BlockPackMetaDescriptionRaw = BlockPackMeta(
|
|
|
34
35
|
export type BlockPackMetaDescriptionRaw = z.infer<typeof BlockPackMetaDescriptionRaw>;
|
|
35
36
|
|
|
36
37
|
// prettier-ignore
|
|
37
|
-
export const
|
|
38
|
+
export const BlockPackMetaEmbeddedBase64 = BlockPackMeta(
|
|
38
39
|
z.string(),
|
|
39
40
|
ContentExplicitBase64
|
|
40
41
|
);
|
|
41
|
-
export type
|
|
42
|
+
export type BlockPackMetaEmbeddedBase64 = z.infer<typeof BlockPackMetaEmbeddedBase64>;
|
|
43
|
+
|
|
44
|
+
// prettier-ignore
|
|
45
|
+
export const BlockPackMetaEmbeddedBytes = BlockPackMeta(
|
|
46
|
+
z.string(),
|
|
47
|
+
ContentExplicitBytes
|
|
48
|
+
);
|
|
49
|
+
export type BlockPackMetaEmbeddedBytes = z.infer<typeof BlockPackMetaEmbeddedBytes>;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { BlockPackId } from '../block_meta';
|
|
3
|
+
|
|
4
|
+
/** Block pack from local folder, to be used during block development. Old layout.
|
|
5
|
+
* @deprecated don't use */
|
|
6
|
+
export const BlockPackDevV1 = z.object({
|
|
7
|
+
type: z.literal('dev-v1'),
|
|
8
|
+
folder: z.string(),
|
|
9
|
+
mtime: z.string().optional()
|
|
10
|
+
});
|
|
11
|
+
/** @deprecated don't use */
|
|
12
|
+
export type BlockPackDevV1 = z.infer<typeof BlockPackDevV1>;
|
|
13
|
+
|
|
14
|
+
/** Block pack from local folder, to be used during block development. New layout. */
|
|
15
|
+
export const BlockPackDevV2 = z.object({
|
|
16
|
+
type: z.literal('dev-v2'),
|
|
17
|
+
folder: z.string(),
|
|
18
|
+
mtime: z.string().optional()
|
|
19
|
+
});
|
|
20
|
+
export type BlockPackDevV2 = z.infer<typeof BlockPackDevV2>;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Block pack from registry with version 2 layout, to be loaded directly
|
|
24
|
+
* from the client.
|
|
25
|
+
* @deprecated don't use
|
|
26
|
+
* */
|
|
27
|
+
export const BlockPackFromRegistryV1 = z.object({
|
|
28
|
+
type: z.literal('from-registry-v1'),
|
|
29
|
+
registryUrl: z.string(),
|
|
30
|
+
id: BlockPackId
|
|
31
|
+
});
|
|
32
|
+
/** @deprecated don't use */
|
|
33
|
+
export type BlockPackFromRegistryV1 = z.infer<typeof BlockPackFromRegistryV1>;
|
|
34
|
+
|
|
35
|
+
/** Block pack from registry with version 2 layout, to be loaded directly
|
|
36
|
+
* from the client. */
|
|
37
|
+
export const BlockPackFromRegistryV2 = z.object({
|
|
38
|
+
type: z.literal('from-registry-v2'),
|
|
39
|
+
registryUrl: z.string(),
|
|
40
|
+
id: BlockPackId
|
|
41
|
+
});
|
|
42
|
+
export type BlockPackFromRegistryV2 = z.infer<typeof BlockPackFromRegistryV2>;
|
|
43
|
+
|
|
44
|
+
/** Information about block origin, can be used to instantiate new blocks */
|
|
45
|
+
export const BlockPackSpec = z.discriminatedUnion('type', [
|
|
46
|
+
BlockPackDevV1,
|
|
47
|
+
BlockPackDevV2,
|
|
48
|
+
BlockPackFromRegistryV1,
|
|
49
|
+
BlockPackFromRegistryV2
|
|
50
|
+
]);
|
|
51
|
+
export type BlockPackSpec = z.infer<typeof BlockPackSpec>;
|