@milaboratories/pl-model-middle-layer 1.5.12 → 1.6.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_description.d.ts +4 -0
- package/dist/block_meta/block_description.d.ts.map +1 -1
- package/dist/block_meta/block_id.d.ts +4 -0
- package/dist/block_meta/block_id.d.ts.map +1 -1
- package/dist/block_meta/block_manifest.d.ts +9 -0
- package/dist/block_meta/block_manifest.d.ts.map +1 -1
- package/dist/block_registry/block_pack_spec.d.ts +6 -0
- package/dist/block_registry/block_pack_spec.d.ts.map +1 -1
- package/dist/block_registry/overview.d.ts +1443 -426
- package/dist/block_registry/overview.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +213 -161
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -3
- package/src/block_meta/block_description.ts +8 -0
- package/src/block_meta/block_id.ts +18 -0
- package/src/block_meta/block_manifest.ts +10 -0
- package/src/block_registry/block_pack_spec.ts +2 -1
- package/src/block_registry/overview.ts +50 -2
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { z as t } from "zod";
|
|
2
|
-
|
|
2
|
+
import * as v from "remeda";
|
|
3
|
+
const s = t.object({
|
|
3
4
|
type: t.literal("explicit-string"),
|
|
4
5
|
content: t.string().describe("Actual string value")
|
|
5
|
-
}).strict(),
|
|
6
|
+
}).strict(), r = t.object({
|
|
6
7
|
type: t.literal("explicit-base64"),
|
|
7
8
|
mimeType: t.string().regex(/\w+\/[-+.\w]+/).describe("MIME type to interpret content"),
|
|
8
9
|
content: t.string().base64().describe("Base64 encoded binary value")
|
|
@@ -11,123 +12,131 @@ const r = t.object({
|
|
|
11
12
|
path: t.string().describe(
|
|
12
13
|
"Address of the file, in most cases relative to the file which this structure is a part of"
|
|
13
14
|
)
|
|
14
|
-
}).strict(),
|
|
15
|
+
}).strict(), b = new RegExp("^(/|[A-Z]:\\\\)"), c = t.object({
|
|
15
16
|
type: t.literal("absolute-file"),
|
|
16
|
-
file: t.string().regex(
|
|
17
|
+
file: t.string().regex(b, "path to file must be absolute").describe("Absolute address of the file in local file system")
|
|
17
18
|
}).strict(), l = t.object({
|
|
18
19
|
type: t.literal("absolute-url"),
|
|
19
20
|
url: t.string().url().describe("Global URL to reach the requested file")
|
|
20
|
-
}).strict(),
|
|
21
|
+
}).strict(), A = t.object({
|
|
21
22
|
type: t.literal("explicit-bytes"),
|
|
22
23
|
mimeType: t.string().regex(/\w+\/[-+.\w]+/).describe("MIME type to interpret content"),
|
|
23
24
|
content: t.instanceof(Uint8Array).describe("Raw content")
|
|
24
|
-
}).strict(),
|
|
25
|
+
}).strict(), Y = t.object({
|
|
25
26
|
type: t.literal("absolute-folder"),
|
|
26
|
-
folder: t.string().regex(
|
|
27
|
-
}).strict(),
|
|
27
|
+
folder: t.string().regex(b, "path to folder must be absolute").describe("Absolute address of the folder in local file system")
|
|
28
|
+
}).strict(), tt = t.discriminatedUnion("type", [
|
|
29
|
+
s,
|
|
28
30
|
r,
|
|
29
|
-
i,
|
|
30
31
|
o,
|
|
31
32
|
c,
|
|
32
33
|
l
|
|
33
|
-
]),
|
|
34
|
+
]), et = t.discriminatedUnion("type", [
|
|
35
|
+
s,
|
|
34
36
|
r,
|
|
35
|
-
i,
|
|
36
37
|
o
|
|
37
|
-
]),
|
|
38
|
+
]), nt = t.discriminatedUnion("type", [
|
|
39
|
+
s,
|
|
38
40
|
r,
|
|
39
|
-
i,
|
|
40
41
|
o,
|
|
41
42
|
c
|
|
42
|
-
]),
|
|
43
|
+
]), it = t.discriminatedUnion("type", [
|
|
44
|
+
s,
|
|
43
45
|
r,
|
|
44
|
-
i,
|
|
45
46
|
o,
|
|
46
47
|
l
|
|
47
|
-
]),
|
|
48
|
-
i,
|
|
49
|
-
o,
|
|
50
|
-
c
|
|
51
|
-
]), P = t.discriminatedUnion("type", [
|
|
48
|
+
]), x = t.discriminatedUnion("type", [
|
|
52
49
|
r,
|
|
53
50
|
o,
|
|
54
51
|
c
|
|
55
|
-
]),
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
]), X = t.discriminatedUnion("type", [
|
|
59
|
-
i,
|
|
52
|
+
]), w = t.discriminatedUnion("type", [
|
|
53
|
+
s,
|
|
54
|
+
o,
|
|
60
55
|
c
|
|
61
|
-
]),
|
|
56
|
+
]), ot = t.discriminatedUnion("type", [
|
|
62
57
|
r,
|
|
63
58
|
l
|
|
64
|
-
]),
|
|
59
|
+
]), rt = t.discriminatedUnion("type", [
|
|
65
60
|
r,
|
|
66
61
|
c
|
|
67
|
-
]),
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
]),
|
|
62
|
+
]), st = t.discriminatedUnion("type", [
|
|
63
|
+
s,
|
|
64
|
+
l
|
|
65
|
+
]), ct = t.discriminatedUnion("type", [
|
|
66
|
+
s,
|
|
67
|
+
c
|
|
68
|
+
]), m = t.discriminatedUnion("type", [
|
|
71
69
|
r,
|
|
72
70
|
o
|
|
73
|
-
]),
|
|
71
|
+
]), U = t.discriminatedUnion("type", [
|
|
72
|
+
s,
|
|
73
|
+
o
|
|
74
|
+
]), V = t.union([
|
|
74
75
|
t.string().startsWith("file:").transform((e, n) => ({ type: "relative", path: e.slice(5) })),
|
|
75
|
-
|
|
76
|
-
]),
|
|
76
|
+
x
|
|
77
|
+
]), z = t.union([
|
|
77
78
|
t.string().transform((e, n) => e.startsWith("file:") ? { type: "relative", path: e.slice(5) } : { type: "explicit-string", content: e }),
|
|
78
|
-
|
|
79
|
-
]),
|
|
79
|
+
w
|
|
80
|
+
]), p = t.string().regex(
|
|
80
81
|
/^(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
82
|
"Wrong version format, please use valid semver"
|
|
82
83
|
);
|
|
83
|
-
function
|
|
84
|
+
function y(e) {
|
|
84
85
|
const n = e.endsWith("/") ? e : `${e}/`;
|
|
85
|
-
return (
|
|
86
|
+
return (i) => i.type === "relative" ? { type: "absolute-url", url: n + i.path } : i;
|
|
86
87
|
}
|
|
87
|
-
function
|
|
88
|
+
function at(e) {
|
|
88
89
|
const n = e.endsWith("/") ? e : `${e}/`;
|
|
89
|
-
return (
|
|
90
|
+
return (i) => i.type === "relative" ? { type: "relative", path: n + i.path } : i;
|
|
90
91
|
}
|
|
91
92
|
const a = t.object({
|
|
92
93
|
organization: t.string(),
|
|
93
94
|
name: t.string(),
|
|
94
|
-
version:
|
|
95
|
-
}).strict(),
|
|
96
|
-
function
|
|
95
|
+
version: p
|
|
96
|
+
}).strict(), M = a.omit({ version: !0 });
|
|
97
|
+
function lt(e) {
|
|
98
|
+
if (e !== void 0)
|
|
99
|
+
return `${e.organization}:${e.name}:${e.version}`;
|
|
100
|
+
}
|
|
101
|
+
function dt(e) {
|
|
102
|
+
if (e !== void 0)
|
|
103
|
+
return `${e.organization}:${e.name}`;
|
|
104
|
+
}
|
|
105
|
+
function gt(e, n) {
|
|
97
106
|
return e === void 0 && n === void 0 ? !0 : e === void 0 || n === void 0 ? !1 : e.name === n.name && e.organization === n.organization && e.version === n.version;
|
|
98
107
|
}
|
|
99
|
-
function
|
|
108
|
+
function mt(e, n) {
|
|
100
109
|
return e === void 0 && n === void 0 ? !0 : e === void 0 || n === void 0 ? !1 : e.name === n.name && e.organization === n.organization;
|
|
101
110
|
}
|
|
102
|
-
function
|
|
111
|
+
function f(e) {
|
|
103
112
|
return t.object({
|
|
104
113
|
type: t.literal("workflow-v1"),
|
|
105
114
|
main: e.describe("Main workflow")
|
|
106
115
|
});
|
|
107
116
|
}
|
|
108
|
-
function
|
|
117
|
+
function S(e) {
|
|
109
118
|
return t.union([
|
|
110
119
|
// string is converted to v1 workflow
|
|
111
120
|
e.transform((n) => ({
|
|
112
121
|
type: "workflow-v1",
|
|
113
122
|
main: n
|
|
114
|
-
})).pipe(
|
|
123
|
+
})).pipe(f(e)),
|
|
115
124
|
// structured objects are decoded as union with type descriptor
|
|
116
|
-
t.discriminatedUnion("type", [
|
|
125
|
+
t.discriminatedUnion("type", [f(e)])
|
|
117
126
|
]);
|
|
118
127
|
}
|
|
119
|
-
function
|
|
128
|
+
function u(e, n) {
|
|
120
129
|
return t.object({
|
|
121
|
-
workflow:
|
|
130
|
+
workflow: S(e),
|
|
122
131
|
model: e,
|
|
123
132
|
ui: n
|
|
124
133
|
});
|
|
125
134
|
}
|
|
126
|
-
const
|
|
127
|
-
function
|
|
128
|
-
return
|
|
129
|
-
|
|
130
|
-
|
|
135
|
+
const h = u(t.string(), t.string());
|
|
136
|
+
function pt(e) {
|
|
137
|
+
return u(
|
|
138
|
+
m.transform(y(e)),
|
|
139
|
+
m.transform(y(e))
|
|
131
140
|
);
|
|
132
141
|
}
|
|
133
142
|
function d(e, n) {
|
|
@@ -153,154 +162,197 @@ function d(e, n) {
|
|
|
153
162
|
marketplaceRanking: t.number().optional()
|
|
154
163
|
});
|
|
155
164
|
}
|
|
156
|
-
const
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
),
|
|
165
|
+
const B = d(
|
|
166
|
+
z,
|
|
167
|
+
V
|
|
168
|
+
), ut = d(
|
|
160
169
|
t.string(),
|
|
161
|
-
|
|
162
|
-
),
|
|
170
|
+
r
|
|
171
|
+
), C = d(
|
|
163
172
|
t.string(),
|
|
164
|
-
|
|
165
|
-
),
|
|
166
|
-
components:
|
|
167
|
-
meta:
|
|
173
|
+
A
|
|
174
|
+
), yt = t.object({
|
|
175
|
+
components: h,
|
|
176
|
+
meta: B
|
|
168
177
|
});
|
|
169
|
-
function
|
|
178
|
+
function P(e, n) {
|
|
170
179
|
return t.object({
|
|
171
180
|
id: a,
|
|
172
181
|
components: e,
|
|
173
182
|
meta: n
|
|
174
183
|
});
|
|
175
184
|
}
|
|
176
|
-
const
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
)
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
185
|
+
const ft = P(
|
|
186
|
+
h,
|
|
187
|
+
B
|
|
188
|
+
);
|
|
189
|
+
function kt(e, n) {
|
|
190
|
+
return v.mergeDeep(e, { id: { version: n } });
|
|
191
|
+
}
|
|
192
|
+
const D = u(o, o), I = d(U, m), E = P(
|
|
193
|
+
D,
|
|
194
|
+
I
|
|
195
|
+
), L = t.string().regex(/[0-9a-fA-F]/).toUpperCase().length(64), T = t.object({
|
|
183
196
|
name: t.string(),
|
|
184
197
|
size: t.number().int(),
|
|
185
|
-
sha256:
|
|
186
|
-
}),
|
|
198
|
+
sha256: L
|
|
199
|
+
}), vt = t.object({
|
|
187
200
|
schema: t.literal("v2"),
|
|
188
|
-
description:
|
|
189
|
-
|
|
190
|
-
|
|
201
|
+
description: E,
|
|
202
|
+
timestamp: t.number().optional(),
|
|
203
|
+
files: t.array(T)
|
|
204
|
+
}), bt = "manifest.json";
|
|
205
|
+
function ht(e, n) {
|
|
206
|
+
return v.mergeDeep(e, { description: { id: { version: n } } });
|
|
207
|
+
}
|
|
208
|
+
const F = t.object({
|
|
191
209
|
type: t.literal("dev-v1"),
|
|
192
210
|
folder: t.string(),
|
|
193
211
|
mtime: t.string().optional()
|
|
194
|
-
}),
|
|
212
|
+
}), W = t.object({
|
|
195
213
|
type: t.literal("dev-v2"),
|
|
196
214
|
folder: t.string(),
|
|
197
215
|
mtime: t.string().optional()
|
|
198
|
-
}),
|
|
216
|
+
}), O = t.object({
|
|
199
217
|
type: t.literal("from-registry-v1"),
|
|
200
218
|
registryUrl: t.string(),
|
|
201
219
|
id: a
|
|
202
|
-
}),
|
|
220
|
+
}), $ = t.object({
|
|
203
221
|
type: t.literal("from-registry-v2"),
|
|
204
222
|
registryUrl: t.string(),
|
|
205
|
-
id: a
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
V,
|
|
223
|
+
id: a,
|
|
224
|
+
channel: t.string().optional()
|
|
225
|
+
}), j = t.discriminatedUnion("type", [
|
|
209
226
|
F,
|
|
210
|
-
|
|
211
|
-
|
|
227
|
+
W,
|
|
228
|
+
O,
|
|
229
|
+
$
|
|
230
|
+
]), Z = t.object({
|
|
212
231
|
type: t.literal("local-dev"),
|
|
213
232
|
path: t.string()
|
|
214
|
-
}),
|
|
233
|
+
}), _ = t.object({
|
|
215
234
|
type: t.literal("remote-v1"),
|
|
216
235
|
url: t.string().url()
|
|
217
|
-
}),
|
|
236
|
+
}), q = t.object({
|
|
218
237
|
type: t.literal("remote-v2"),
|
|
219
238
|
url: t.string().url()
|
|
220
|
-
}),
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
]),
|
|
239
|
+
}), N = t.discriminatedUnion("type", [
|
|
240
|
+
_,
|
|
241
|
+
q,
|
|
242
|
+
Z
|
|
243
|
+
]), R = t.object({
|
|
225
244
|
id: t.string(),
|
|
226
245
|
title: t.string().optional(),
|
|
227
|
-
spec:
|
|
228
|
-
}),
|
|
246
|
+
spec: N
|
|
247
|
+
}), Bt = t.array(R), Ct = t.object({
|
|
229
248
|
registryId: t.string(),
|
|
230
249
|
id: a,
|
|
231
|
-
meta:
|
|
232
|
-
spec:
|
|
233
|
-
otherVersions: t.array(
|
|
234
|
-
}),
|
|
250
|
+
meta: C,
|
|
251
|
+
spec: j,
|
|
252
|
+
otherVersions: t.array(p)
|
|
253
|
+
}), G = "any", k = "stable", J = t.object({
|
|
254
|
+
version: p,
|
|
255
|
+
channels: t.array(t.string())
|
|
256
|
+
}), H = t.object({
|
|
257
|
+
id: a,
|
|
258
|
+
meta: C,
|
|
259
|
+
spec: j
|
|
260
|
+
}), K = t.object({
|
|
261
|
+
id: M,
|
|
262
|
+
latestByChannel: t.record(t.string(), H),
|
|
263
|
+
allVersions: t.array(J),
|
|
264
|
+
registryId: t.string()
|
|
265
|
+
}), Q = R.extend({
|
|
235
266
|
status: t.union([t.literal("online"), t.literal("offline")])
|
|
236
|
-
}),
|
|
237
|
-
registries: t.array(
|
|
238
|
-
blockPacks: t.array(
|
|
239
|
-
})
|
|
267
|
+
}), Pt = t.object({
|
|
268
|
+
registries: t.array(Q),
|
|
269
|
+
blockPacks: t.array(K)
|
|
270
|
+
});
|
|
271
|
+
function jt(e) {
|
|
272
|
+
const n = e.latestByChannel[k] !== void 0 ? k : G, i = e.latestByChannel[n];
|
|
273
|
+
return {
|
|
274
|
+
id: i.id,
|
|
275
|
+
meta: i.meta,
|
|
276
|
+
spec: i.spec,
|
|
277
|
+
otherVersions: e.allVersions.filter((g) => g.channels.indexOf(n) >= 0).map((g) => g.version),
|
|
278
|
+
registryId: e.registryId
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
const Rt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
240
282
|
__proto__: null
|
|
241
283
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
242
284
|
export {
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
285
|
+
G as AnyChannel,
|
|
286
|
+
u as BlockComponents,
|
|
287
|
+
pt as BlockComponentsAbsoluteUrl,
|
|
288
|
+
h as BlockComponentsDescriptionRaw,
|
|
289
|
+
D as BlockComponentsManifest,
|
|
290
|
+
yt as BlockPackDescriptionFromPackageJsonRaw,
|
|
291
|
+
E as BlockPackDescriptionManifest,
|
|
292
|
+
ft as BlockPackDescriptionRaw,
|
|
293
|
+
F as BlockPackDevV1,
|
|
294
|
+
W as BlockPackDevV2,
|
|
295
|
+
O as BlockPackFromRegistryV1,
|
|
296
|
+
$ as BlockPackFromRegistryV2,
|
|
254
297
|
a as BlockPackId,
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
298
|
+
M as BlockPackIdNoVersion,
|
|
299
|
+
Pt as BlockPackListing,
|
|
300
|
+
vt as BlockPackManifest,
|
|
301
|
+
bt as BlockPackManifestFile,
|
|
259
302
|
d as BlockPackMeta,
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
303
|
+
B as BlockPackMetaDescriptionRaw,
|
|
304
|
+
ut as BlockPackMetaEmbeddedBase64,
|
|
305
|
+
C as BlockPackMetaEmbeddedBytes,
|
|
306
|
+
I as BlockPackMetaManifest,
|
|
307
|
+
K as BlockPackOverview,
|
|
308
|
+
Ct as BlockPackOverviewLegacy,
|
|
309
|
+
j as BlockPackSpec,
|
|
310
|
+
rt as ContentAbsoluteBinaryLocal,
|
|
311
|
+
ot as ContentAbsoluteBinaryRemote,
|
|
268
312
|
c as ContentAbsoluteFile,
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
313
|
+
Y as ContentAbsoluteFolder,
|
|
314
|
+
ct as ContentAbsoluteTextLocal,
|
|
315
|
+
st as ContentAbsoluteTextRemote,
|
|
272
316
|
l as ContentAbsoluteUrl,
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
317
|
+
tt as ContentAny,
|
|
318
|
+
x as ContentAnyBinaryLocal,
|
|
319
|
+
nt as ContentAnyLocal,
|
|
320
|
+
it as ContentAnyRemote,
|
|
321
|
+
w as ContentAnyTextLocal,
|
|
322
|
+
r as ContentExplicitBase64,
|
|
323
|
+
A as ContentExplicitBytes,
|
|
324
|
+
et as ContentExplicitOrRelative,
|
|
325
|
+
s as ContentExplicitString,
|
|
282
326
|
o as ContentRelative,
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
327
|
+
m as ContentRelativeBinary,
|
|
328
|
+
U as ContentRelativeText,
|
|
329
|
+
P as CreateBlockPackDescriptionSchema,
|
|
330
|
+
V as DescriptionContentBinary,
|
|
331
|
+
z as DescriptionContentText,
|
|
332
|
+
Z as LocalDevFolder,
|
|
333
|
+
T as ManifestFileInfo,
|
|
334
|
+
Rt as PFrameInternal,
|
|
335
|
+
R as RegistryEntry,
|
|
336
|
+
Bt as RegistryList,
|
|
337
|
+
N as RegistrySpec,
|
|
338
|
+
Q as RegistryStatus,
|
|
339
|
+
_ as RemoteRegistryV1Spec,
|
|
340
|
+
q as RemoteRegistryV2Spec,
|
|
341
|
+
p as SemVer,
|
|
342
|
+
L as Sha256Schema,
|
|
343
|
+
H as SingleBlockPackOverview,
|
|
344
|
+
k as StableChannel,
|
|
345
|
+
J as VersionWithChannels,
|
|
346
|
+
S as Workflow,
|
|
347
|
+
f as WorkflowV1,
|
|
348
|
+
at as addPrefixToRelative,
|
|
349
|
+
gt as blockPackIdEquals,
|
|
350
|
+
mt as blockPackIdNoVersionEquals,
|
|
351
|
+
dt as blockPackIdNoVersionToString,
|
|
352
|
+
lt as blockPackIdToString,
|
|
353
|
+
jt as blockPackOverviewToLegacy,
|
|
354
|
+
y as mapRemoteToAbsolute,
|
|
355
|
+
kt as overrideDescriptionVersion,
|
|
356
|
+
ht as overrideManifestVersion
|
|
305
357
|
};
|
|
306
358
|
//# sourceMappingURL=index.mjs.map
|