@milaboratories/pl-model-middle-layer 1.2.20 → 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.
Files changed (52) hide show
  1. package/dist/block_meta/block_components.d.ts +221 -85
  2. package/dist/block_meta/block_components.d.ts.map +1 -1
  3. package/dist/block_meta/block_description.d.ts +872 -0
  4. package/dist/block_meta/block_description.d.ts.map +1 -0
  5. package/dist/block_meta/{block_pack_id.d.ts → block_id.d.ts} +1 -1
  6. package/dist/block_meta/block_id.d.ts.map +1 -0
  7. package/dist/block_meta/block_manifest.d.ts +1246 -0
  8. package/dist/block_meta/block_manifest.d.ts.map +1 -0
  9. package/dist/block_meta/{meta.d.ts → block_meta.d.ts} +36 -102
  10. package/dist/block_meta/block_meta.d.ts.map +1 -0
  11. package/dist/block_meta/content_conversion.d.ts +9 -1
  12. package/dist/block_meta/content_conversion.d.ts.map +1 -1
  13. package/dist/block_meta/content_types.d.ts +40 -5
  14. package/dist/block_meta/content_types.d.ts.map +1 -1
  15. package/dist/block_meta/index.d.ts +6 -1665
  16. package/dist/block_meta/index.d.ts.map +1 -1
  17. package/dist/block_registry/block_pack_spec.d.ts +201 -0
  18. package/dist/block_registry/block_pack_spec.d.ts.map +1 -0
  19. package/dist/block_registry/index.d.ts +4 -0
  20. package/dist/block_registry/index.d.ts.map +1 -0
  21. package/dist/block_registry/overview.d.ts +914 -0
  22. package/dist/block_registry/overview.d.ts.map +1 -0
  23. package/dist/block_registry/registry_spec.d.ts +184 -0
  24. package/dist/block_registry/registry_spec.d.ts.map +1 -0
  25. package/dist/index.d.ts +1 -1
  26. package/dist/index.d.ts.map +1 -1
  27. package/dist/index.js +1 -1
  28. package/dist/index.js.map +1 -1
  29. package/dist/index.mjs +202 -125
  30. package/dist/index.mjs.map +1 -1
  31. package/dist/project_overview.d.ts +1 -1
  32. package/dist/project_overview.d.ts.map +1 -1
  33. package/package.json +2 -2
  34. package/src/block_meta/block_components.ts +5 -5
  35. package/src/block_meta/block_description.ts +29 -0
  36. package/src/block_meta/block_manifest.ts +40 -0
  37. package/src/block_meta/{meta.ts → block_meta.ts} +8 -13
  38. package/src/block_meta/content_conversion.ts +24 -4
  39. package/src/block_meta/content_types.ts +14 -3
  40. package/src/block_meta/index.ts +6 -52
  41. package/src/block_registry/block_pack_spec.ts +51 -0
  42. package/src/block_registry/index.ts +3 -0
  43. package/src/block_registry/overview.ts +27 -0
  44. package/src/block_registry/registry_spec.ts +38 -0
  45. package/src/index.ts +1 -1
  46. package/src/project_overview.ts +1 -1
  47. package/dist/block_meta/block_pack_id.d.ts.map +0 -1
  48. package/dist/block_meta/meta.d.ts.map +0 -1
  49. package/dist/block_pack.d.ts +0 -24
  50. package/dist/block_pack.d.ts.map +0 -1
  51. package/src/block_pack.ts +0 -29
  52. /package/src/block_meta/{block_pack_id.ts → block_id.ts} +0 -0
package/dist/index.mjs CHANGED
@@ -1,82 +1,99 @@
1
1
  import { z as t } from "zod";
2
- const s = t.object({
2
+ const r = t.object({
3
3
  type: t.literal("explicit-string"),
4
4
  content: t.string().describe("Actual string value")
5
- }).strict(), i = t.object({
5
+ }).strict(), o = t.object({
6
6
  type: t.literal("explicit-base64"),
7
7
  mimeType: t.string().regex(/\w+\/[-+.\w]+/).describe("MIME type to interpret content"),
8
8
  content: t.string().base64().describe("Base64 encoded binary value")
9
- }).strict(), o = t.object({
9
+ }).strict(), i = t.object({
10
10
  type: t.literal("relative"),
11
11
  path: t.string().describe(
12
12
  "Address of the file, in most cases relative to the file which this structure is a part of"
13
13
  )
14
- }).strict(), r = t.object({
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(), c = t.object({
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(), P = t.object({
21
- type: t.literal("explicit"),
20
+ }).strict(), B = t.object({
21
+ type: t.literal("explicit-bytes"),
22
+ mimeType: t.string().regex(/\w+\/[-+.\w]+/).describe("MIME type to interpret content"),
22
23
  content: t.instanceof(Uint8Array).describe("Raw content")
23
- }).strict(), R = t.object({
24
+ }).strict(), $ = t.object({
24
25
  type: t.literal("absolute-folder"),
25
26
  folder: t.string().startsWith("/").describe("Absolute address of the folder in local file system")
26
- }).strict(), M = t.discriminatedUnion("type", [
27
- s,
27
+ }).strict(), q = t.discriminatedUnion("type", [
28
+ r,
29
+ o,
28
30
  i,
31
+ c,
32
+ l
33
+ ]), G = t.discriminatedUnion("type", [
34
+ r,
29
35
  o,
36
+ i
37
+ ]), J = t.discriminatedUnion("type", [
30
38
  r,
31
- c
32
- ]), z = t.discriminatedUnion("type", [
33
- s,
39
+ o,
34
40
  i,
41
+ c
42
+ ]), N = t.discriminatedUnion("type", [
43
+ r,
35
44
  o,
36
- r
37
- ]), D = t.discriminatedUnion("type", [
38
- s,
39
45
  i,
46
+ l
47
+ ]), h = t.discriminatedUnion("type", [
40
48
  o,
49
+ i,
41
50
  c
42
- ]), y = t.discriminatedUnion("type", [
51
+ ]), v = t.discriminatedUnion("type", [
52
+ r,
43
53
  i,
54
+ c
55
+ ]), H = t.discriminatedUnion("type", [
44
56
  o,
45
- r
46
- ]), k = t.discriminatedUnion("type", [
47
- s,
57
+ l
58
+ ]), K = t.discriminatedUnion("type", [
48
59
  o,
49
- r
50
- ]), W = t.discriminatedUnion("type", [
51
- i,
52
60
  c
53
- ]), T = t.discriminatedUnion("type", [
54
- i,
55
- r
56
- ]), F = t.discriminatedUnion("type", [
57
- s,
61
+ ]), Q = t.discriminatedUnion("type", [
62
+ r,
63
+ l
64
+ ]), X = t.discriminatedUnion("type", [
65
+ r,
58
66
  c
59
- ]), L = t.discriminatedUnion("type", [
60
- s,
61
- r
62
- ]), l = t.discriminatedUnion("type", [
63
- i,
64
- o
65
- ]), C = t.discriminatedUnion("type", [
66
- s,
67
- o
68
- ]), A = t.union([
67
+ ]), d = t.discriminatedUnion("type", [
68
+ o,
69
+ i
70
+ ]), j = t.discriminatedUnion("type", [
71
+ r,
72
+ i
73
+ ]), C = t.union([
69
74
  t.string().startsWith("file:").transform((e, n) => ({ type: "relative", path: e.slice(5) })),
70
- y
71
- ]), h = t.union([
75
+ h
76
+ ]), A = t.union([
72
77
  t.string().transform((e, n) => e.startsWith("file:") ? { type: "relative", path: e.slice(5) } : { type: "explicit-string", content: e }),
73
- k
74
- ]);
75
- function m(e) {
78
+ v
79
+ ]), m = t.string().regex(
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
+ "Wrong version format, please use valid semver"
82
+ );
83
+ function g(e) {
76
84
  const n = e.endsWith("/") ? e : `${e}/`;
77
- return (a) => a.type === "relative" ? { type: "absolute-url", url: n + a.path } : a;
85
+ return (s) => s.type === "relative" ? { type: "absolute-url", url: n + s.path } : s;
78
86
  }
79
- function S(e) {
87
+ function Y(e) {
88
+ const n = e.endsWith("/") ? e : `${e}/`;
89
+ return (s) => s.type === "relative" ? { type: "relative", path: n + s.path } : s;
90
+ }
91
+ const a = t.object({
92
+ organization: t.string(),
93
+ name: t.string(),
94
+ version: m
95
+ }).strict(), tt = a.omit({ version: !0 });
96
+ function P(e) {
80
97
  return t.union([
81
98
  // string is converted to v1 workflow
82
99
  e.transform((n) => ({
@@ -92,29 +109,21 @@ function S(e) {
92
109
  ])
93
110
  ]);
94
111
  }
95
- function p(e, n) {
112
+ function y(e, n) {
96
113
  return t.object({
97
- workflow: e,
114
+ workflow: P(e),
98
115
  model: e,
99
116
  ui: n
100
117
  });
101
118
  }
102
- const u = p(t.string(), t.string()), B = p(o, o);
103
- function Z(e) {
104
- return p(
105
- l.transform(m(e)),
106
- l.transform(m(e))
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))
107
124
  );
108
125
  }
109
- const j = t.string().regex(
110
- /^(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-]+)*))?$/,
111
- "Wrong version format, please use valid semver"
112
- ), b = t.object({
113
- organization: t.string(),
114
- name: t.string(),
115
- version: j
116
- }).strict(), E = b.omit({ version: !0 });
117
- function d(e, n) {
126
+ function p(e, n) {
118
127
  return t.object({
119
128
  title: t.string(),
120
129
  description: t.string(),
@@ -131,83 +140,151 @@ function d(e, n) {
131
140
  })
132
141
  });
133
142
  }
134
- const f = d(
135
- h,
136
- A
137
- ), x = d(
138
- C,
139
- l
140
- ), I = d(
143
+ const u = p(
144
+ A,
145
+ C
146
+ ), nt = p(
141
147
  t.string(),
142
- i
143
- ), _ = t.object({
144
- components: u,
145
- meta: f
148
+ o
149
+ ), R = p(
150
+ t.string(),
151
+ B
152
+ ), it = t.object({
153
+ components: b,
154
+ meta: u
146
155
  });
147
- function g(e, n) {
156
+ function f(e, n) {
148
157
  return t.object({
149
- id: b,
158
+ id: a,
150
159
  components: e,
151
160
  meta: n
152
161
  });
153
162
  }
154
- const w = g(
155
- B,
156
- x
157
- ), O = g(
158
- u,
159
- f
160
- ), v = t.object({
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({
161
170
  name: t.string(),
162
171
  size: t.number().int(),
163
- sha256: t.string().regex(/[0-9a-fA-F]/).toUpperCase().length(64)
164
- // 256 / 4 (bits per hex register)
165
- }), V = t.object({
166
- schema: t.literal("v1"),
172
+ sha256: M
173
+ }), rt = t.object({
174
+ schema: t.literal("v2"),
167
175
  description: w,
168
- files: t.array(v)
169
- }), $ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
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({
170
227
  __proto__: null
171
228
  }, Symbol.toStringTag, { value: "Module" }));
172
229
  export {
173
- p as BlockComponents,
174
- Z as BlockComponentsAbsoluteUrl,
175
- u as BlockComponentsDescriptionRaw,
176
- B as BlockComponentsManifest,
177
- _ as BlockPackDescriptionFromPackageJsonRaw,
230
+ y as BlockComponents,
231
+ et as BlockComponentsAbsoluteUrl,
232
+ b as BlockComponentsDescriptionRaw,
233
+ x as BlockComponentsManifest,
234
+ it as BlockPackDescriptionFromPackageJsonRaw,
178
235
  w as BlockPackDescriptionManifest,
179
- O as BlockPackDescriptionRaw,
180
- b as BlockPackId,
181
- E as BlockPackIdNoVersion,
182
- V as BlockPackManifest,
183
- d as BlockPackMeta,
184
- f as BlockPackMetaDescriptionRaw,
185
- I as BlockPackMetaEmbeddedContent,
186
- x as BlockPackMetaManifest,
187
- T as ContentAbsoluteBinaryLocal,
188
- W as ContentAbsoluteBinaryRemote,
189
- r as ContentAbsoluteFile,
190
- R as ContentAbsoluteFolder,
191
- L as ContentAbsoluteTextLocal,
192
- F as ContentAbsoluteTextRemote,
193
- c as ContentAbsoluteUrl,
194
- M as ContentAny,
195
- y as ContentAnyBinaryLocal,
196
- z as ContentAnyLocal,
197
- D as ContentAnyRemote,
198
- k as ContentAnyTextLocal,
199
- P as ContentExplicit,
200
- i as ContentExplicitBase64,
201
- s as ContentExplicitString,
202
- o as ContentRelative,
203
- l as ContentRelativeBinary,
204
- C as ContentRelativeText,
205
- g as CreateBlockPackDescriptionSchema,
206
- A as DescriptionContentBinary,
207
- h as DescriptionContentText,
208
- v as ManifestFileInfo,
209
- $ as PFrameInternal,
210
- j as SemVer,
211
- S as Workflow
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,
255
+ c as ContentAbsoluteFile,
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,
265
+ o as ContentExplicitBase64,
266
+ B as ContentExplicitBytes,
267
+ G as ContentExplicitOrRelative,
268
+ r as ContentExplicitString,
269
+ i as ContentRelative,
270
+ d as ContentRelativeBinary,
271
+ j as ContentRelativeText,
272
+ f as CreateBlockPackDescriptionSchema,
273
+ C as DescriptionContentBinary,
274
+ A as DescriptionContentText,
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
212
289
  };
213
290
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../src/block_meta/content_types.ts","../src/block_meta/content_conversion.ts","../src/block_meta/block_components.ts","../src/block_meta/semver.ts","../src/block_meta/block_pack_id.ts","../src/block_meta/meta.ts","../src/block_meta/index.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 ContentExplicit = z\n .object({\n type: z.literal('explicit'),\n content: z.instanceof(Uint8Array).describe('Raw content')\n })\n .strict();\nexport type ContentExplicit = z.infer<typeof ContentExplicit>;\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 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 { ContentAbsoluteUrl, ContentAnyLocal, ContentRelative } from \"./content_types\";\n\nexport function mapRemoteToAbsolute(\n rootUrl: string\n): <T extends ContentAnyLocal>(\n value: T\n) => 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","import { z } from 'zod';\nimport { ContentRelative, 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: 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 const BlockComponentsManifest = BlockComponents(ContentRelative, ContentRelative);\nexport type BlockComponentsManifest = z.infer<typeof BlockComponentsManifest>;\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';\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 { 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 {\n ContentAbsoluteBinaryLocal,\n ContentAbsoluteTextLocal,\n ContentExplicitBase64,\n ContentExplicitString,\n ContentRelative,\n ContentRelativeBinary,\n ContentRelativeText,\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 BlockPackMetaManifest = BlockPackMeta(\n ContentRelativeText,\n ContentRelativeBinary\n);\nexport type BlockPackMetaManifest = z.infer<typeof BlockPackMetaManifest>;\n\n// prettier-ignore\nexport const BlockPackMetaEmbeddedContent = BlockPackMeta(\n z.string(),\n ContentExplicitBase64\n);\nexport type BlockPackMetaEmbeddedContent = z.infer<typeof BlockPackMetaEmbeddedContent>;\n","import { ZodTypeAny, string, z } from 'zod';\nimport { BlockComponentsDescriptionRaw, BlockComponentsManifest } from './block_components';\nimport { BlockPackId } from './block_pack_id';\nimport { BlockPackMetaDescriptionRaw, BlockPackMetaManifest } from './meta';\n\nexport * from './block_components';\nexport * from './block_pack_id';\nexport * from './common';\nexport * from './content_types';\nexport * from './meta';\nexport * from './semver';\n\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 BlockPackDescriptionManifest = CreateBlockPackDescriptionSchema(\n BlockComponentsManifest,\n BlockPackMetaManifest\n);\nexport type BlockPackDescriptionManifest = z.infer<typeof BlockPackDescriptionManifest>;\n\nexport const BlockPackDescriptionRaw = CreateBlockPackDescriptionSchema(\n BlockComponentsDescriptionRaw,\n BlockPackMetaDescriptionRaw\n);\nexport type BlockPackDescriptionRaw = z.infer<typeof BlockPackDescriptionRaw>;\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('v1'),\n description: BlockPackDescriptionManifest,\n files: z.array(ManifestFileInfo)\n});\nexport type BlockPackManifest = z.infer<typeof BlockPackManifest>;\n"],"names":["ContentExplicitString","z","ContentExplicitBase64","ContentRelative","ContentAbsoluteFile","ContentAbsoluteUrl","ContentExplicit","ContentAbsoluteFolder","ContentAny","ContentAnyLocal","ContentAnyRemote","ContentAnyBinaryLocal","ContentAnyTextLocal","ContentAbsoluteBinaryRemote","ContentAbsoluteBinaryLocal","ContentAbsoluteTextRemote","ContentAbsoluteTextLocal","ContentRelativeBinary","ContentRelativeText","DescriptionContentBinary","value","ctx","DescriptionContentText","mapRemoteToAbsolute","rootUrl","rootWithSlash","Workflow","contentType","BlockComponents","wfAndModel","ui","BlockComponentsDescriptionRaw","BlockComponentsManifest","BlockComponentsAbsoluteUrl","prefix","SemVer","BlockPackId","BlockPackIdNoVersion","BlockPackMeta","longString","binary","BlockPackMetaDescriptionRaw","BlockPackMetaManifest","BlockPackMetaEmbeddedContent","BlockPackDescriptionFromPackageJsonRaw","CreateBlockPackDescriptionSchema","components","meta","BlockPackDescriptionManifest","BlockPackDescriptionRaw","ManifestFileInfo","BlockPackManifest"],"mappings":";AAMa,MAAAA,IAAwBC,EAClC,OAAO;AAAA,EACN,MAAMA,EAAE,QAAQ,iBAAiB;AAAA,EACjC,SAASA,EAAE,SAAS,SAAS,qBAAqB;AACpD,CAAC,EACA,OAAO,GAGGC,IAAwBD,EAClC,OAAO;AAAA,EACN,MAAMA,EAAE,QAAQ,iBAAiB;AAAA,EACjC,UAAUA,EACP,OAAO,EACP,MAAM,eAAe,EACrB,SAAS,gCAAgC;AAAA,EAC5C,SAASA,EAAE,OAAA,EAAS,OAAO,EAAE,SAAS,6BAA6B;AACrE,CAAC,EACA,OAAO,GAGGE,IAAkBF,EAC5B,OAAO;AAAA,EACN,MAAMA,EAAE,QAAQ,UAAU;AAAA,EAC1B,MAAMA,EACH,OAAA,EACA;AAAA,IACC;AAAA,EACF;AACJ,CAAC,EACA,OAAO,GAGGG,IAAsBH,EAChC,OAAO;AAAA,EACN,MAAMA,EAAE,QAAQ,eAAe;AAAA,EAC/B,MAAMA,EAAE,OAAO,EAAE,WAAW,GAAG,EAAE,SAAS,mDAAmD;AAC/F,CAAC,EACA,OAAO,GAGGI,IAAqBJ,EAC/B,O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EACnCpB;AAAA,EACAD;AACF,GAIa0B,IAA+BL;AAAA,EAC1CrC,EAAE,OAAO;AAAA,EACTC;AACF,GCxCa0C,IAAyC3C,EAAE,OAAO;AAAA,EAC7D,YAAY8B;AAAA,EACZ,MAAMU;AACR,CAAC;AAEe,SAAAI,EAGdC,GAAwBC,GAAY;AACpC,SAAO9C,EAAE,OAAO;AAAA,IACd,IAAImC;AAAA,IACJ,YAAAU;AAAA,IACA,MAAAC;AAAA,EAAA,CACD;AACH;AAEO,MAAMC,IAA+BH;AAAA,EAC1Cb;AAAA,EACAU;AACF,GAGaO,IAA0BJ;AAAA,EACrCd;AAAA,EACAU;AACF,GAGaS,IAAmBjD,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,GAGYkD,IAAoBlD,EAAE,OAAO;AAAA,EACxC,QAAQA,EAAE,QAAQ,IAAI;AAAA,EACtB,aAAa+C;AAAA,EACb,OAAO/C,EAAE,MAAMiD,CAAgB;AACjC,CAAC;;;"}
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,EAClC,OAAO;AAAA,EACN,MAAMA,EAAE,QAAQ,iBAAiB;AAAA,EACjC,SAASA,EAAE,SAAS,SAAS,qBAAqB;AACpD,CAAC,EACA,OAAO,GAGGC,IAAwBD,EAClC,OAAO;AAAA,EACN,MAAMA,EAAE,QAAQ,iBAAiB;AAAA,EACjC,UAAUA,EACP,OAAO,EACP,MAAM,eAAe,EACrB,SAAS,gCAAgC;AAAA,EAC5C,SAASA,EAAE,OAAA,EAAS,OAAO,EAAE,SAAS,6BAA6B;AACrE,CAAC,EACA,OAAO,GAGGE,IAAkBF,EAC5B,OAAO;AAAA,EACN,MAAMA,EAAE,QAAQ,UAAU;AAAA,EAC1B,MAAMA,EACH,OAAA,EACA;AAAA,IACC;AAAA,EACF;AACJ,CAAC,EACA,OAAO,GAGGG,IAAsBH,EAChC,OAAO;AAAA,EACN,MAAMA,EAAE,QAAQ,eAAe;AAAA,EAC/B,MAAMA,EAAE,OAAO,EAAE,WAAW,GAAG,EAAE,SAAS,mDAAmD;AAC/F,CAAC,EACA,OAAO,GAGGI,IAAqBJ,EAC/B,OAAO;AAAA,EACN,MAAMA,EAAE,QAAQ,cAAc;AAAA,EAC9B,KAAKA,EAAE,OAAA,EAAS,IAAI,EAAE,SAAS,wCAAwC;AACzE,CAAC,EACA,OAAO,GAOGK,IAAuBL,EACjC,OAAO;AAAA,EACN,MAAMA,EAAE,QAAQ,gBAAgB;AAAA,EAChC,UAAUA,EACP,OAAO,EACP,MAAM,eAAe,EACrB,SAAS,gCAAgC;AAAA,EAC5C,SAASA,EAAE,WAAW,UAAU,EAAE,SAAS,aAAa;AAC1D,CAAC,EACA,OAAO,GAGGM,IAAwBN,EAClC,OAAO;AAAA,EACN,MAAMA,EAAE,QAAQ,iBAAiB;AAAA,EACjC,QAAQA,EACL,OAAO,EAC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E,MAAMoE,CAAiB;AACvC,CAAC;;;"}
@@ -1,5 +1,5 @@
1
1
  import { ProjectMeta } from './project';
2
- import { BlockPackSpec } from './block_pack';
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,cAAc,CAAC;AAC7C,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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version": "1.2.20",
3
+ "version": "1.4.0",
4
4
  "description": "Common model between middle layer and non-block UI code",
5
5
  "types": "./dist/index.d.ts",
6
6
  "main": "./dist/index.js",
@@ -23,7 +23,7 @@
23
23
  },
24
24
  "devDependencies": {
25
25
  "typescript": "~5.5.4",
26
- "vite": "^5.4.7",
26
+ "vite": "^5.4.8",
27
27
  "@milaboratories/platforma-build-configs": "1.0.1"
28
28
  },
29
29
  "scripts": {
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { ContentRelative, ContentRelativeBinary } from './content_types';
2
+ import { ContentRelativeBinary } from './content_types';
3
3
  import { mapRemoteToAbsolute } from './content_conversion';
4
4
 
5
5
  export type BlockPackComponents = {};
@@ -26,7 +26,7 @@ export function BlockComponents<
26
26
  const UI extends z.ZodTypeAny
27
27
  >(wfAndModel: WfAndModel, ui: UI) {
28
28
  return z.object({
29
- workflow: wfAndModel,
29
+ workflow: Workflow(wfAndModel),
30
30
  model: wfAndModel,
31
31
  ui
32
32
  });
@@ -35,9 +35,6 @@ export function BlockComponents<
35
35
  export const BlockComponentsDescriptionRaw = BlockComponents(z.string(), z.string());
36
36
  export type BlockComponentsDescriptionRaw = z.infer<typeof BlockComponentsDescriptionRaw>;
37
37
 
38
- export const BlockComponentsManifest = BlockComponents(ContentRelative, ContentRelative);
39
- export type BlockComponentsManifest = z.infer<typeof BlockComponentsManifest>;
40
-
41
38
  export function BlockComponentsAbsoluteUrl(prefix: string) {
42
39
  return BlockComponents(
43
40
  ContentRelativeBinary.transform(mapRemoteToAbsolute(prefix)),
@@ -45,3 +42,6 @@ export function BlockComponentsAbsoluteUrl(prefix: string) {
45
42
  );
46
43
  }
47
44
  export type BlockComponentsAbsolute = z.infer<ReturnType<typeof BlockComponentsAbsoluteUrl>>;
45
+
46
+ // export const BlockComponentsExplicit = BlockComponents(, ContentRelative);
47
+ // export type BlockComponentsExplicit = z.infer<typeof BlockComponentsExplicit>;
@@ -0,0 +1,29 @@
1
+ import { z, ZodTypeAny } from 'zod';
2
+ import { BlockComponentsDescriptionRaw } from './block_components';
3
+ import { BlockPackMetaDescriptionRaw } from './block_meta';
4
+ import { BlockPackId } from './block_id';
5
+
6
+ /** Description, as appears in root block package.json file,
7
+ * `file:` references are parsed into relative content of corresponding type, depending on the context,
8
+ * strings are converted to explicit content type. */
9
+ export const BlockPackDescriptionFromPackageJsonRaw = z.object({
10
+ components: BlockComponentsDescriptionRaw,
11
+ meta: BlockPackMetaDescriptionRaw
12
+ });
13
+
14
+ export function CreateBlockPackDescriptionSchema<
15
+ Components extends ZodTypeAny,
16
+ Meta extends ZodTypeAny
17
+ >(components: Components, meta: Meta) {
18
+ return z.object({
19
+ id: BlockPackId,
20
+ components,
21
+ meta
22
+ });
23
+ }
24
+
25
+ export const BlockPackDescriptionRaw = CreateBlockPackDescriptionSchema(
26
+ BlockComponentsDescriptionRaw,
27
+ BlockPackMetaDescriptionRaw
28
+ );
29
+ export type BlockPackDescriptionRaw = z.infer<typeof BlockPackDescriptionRaw>;
@@ -0,0 +1,40 @@
1
+ import { z } from 'zod';
2
+ import { BlockComponents } from './block_components';
3
+ import { ContentRelative, ContentRelativeBinary, ContentRelativeText } from './content_types';
4
+ import { CreateBlockPackDescriptionSchema } from './block_description';
5
+ import { BlockPackMeta } from './block_meta';
6
+
7
+ export const BlockComponentsManifest = BlockComponents(ContentRelative, ContentRelative);
8
+ export type BlockComponentsManifest = z.infer<typeof BlockComponentsManifest>;
9
+
10
+ export const BlockPackMetaManifest = BlockPackMeta(ContentRelativeText, ContentRelativeBinary);
11
+ export type BlockPackMetaManifest = z.infer<typeof BlockPackMetaManifest>;
12
+
13
+ /** Block description to be used in block manifest */
14
+ export const BlockPackDescriptionManifest = CreateBlockPackDescriptionSchema(
15
+ BlockComponentsManifest,
16
+ BlockPackMetaManifest
17
+ );
18
+ export type BlockPackDescriptionManifest = z.infer<typeof BlockPackDescriptionManifest>;
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
+
26
+ export const ManifestFileInfo = z.object({
27
+ name: z.string(),
28
+ size: z.number().int(),
29
+ sha256: Sha256Schema
30
+ });
31
+ export type ManifestFileInfo = z.infer<typeof ManifestFileInfo>;
32
+
33
+ export const BlockPackManifest = z.object({
34
+ schema: z.literal('v2'),
35
+ description: BlockPackDescriptionManifest,
36
+ files: z.array(ManifestFileInfo)
37
+ });
38
+ export type BlockPackManifest = z.infer<typeof BlockPackManifest>;
39
+
40
+ export const BlockPackManifestFile = 'manifest.json';