@milaboratories/pl-model-middle-layer 1.7.43 → 1.7.45

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/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { z as t } from "zod";
2
2
  import * as v from "remeda";
3
- const Y = {}, s = t.object({
3
+ const tt = {}, s = t.object({
4
4
  type: t.literal("explicit-string"),
5
5
  content: t.string().describe("Actual string value")
6
6
  }).strict(), r = t.object({
@@ -12,71 +12,71 @@ const Y = {}, s = t.object({
12
12
  path: t.string().describe(
13
13
  "Address of the file, in most cases relative to the file which this structure is a part of"
14
14
  )
15
- }).strict(), b = new RegExp("^(/|[A-Z]:\\\\)"), c = t.object({
15
+ }).strict(), b = new RegExp("^(/|[A-Z]:\\\\)"), a = t.object({
16
16
  type: t.literal("absolute-file"),
17
17
  file: t.string().regex(b, "path to file must be absolute").describe("Absolute address of the file in local file system")
18
18
  }).strict(), l = t.object({
19
19
  type: t.literal("absolute-url"),
20
20
  url: t.string().url().describe("Global URL to reach the requested file")
21
- }).strict(), A = t.object({
21
+ }).strict(), x = t.object({
22
22
  type: t.literal("explicit-bytes"),
23
23
  mimeType: t.string().regex(/\w+\/[-+.\w]+/).describe("MIME type to interpret content"),
24
24
  content: t.instanceof(Uint8Array).describe("Raw content")
25
- }).strict(), tt = t.object({
25
+ }).strict(), et = t.object({
26
26
  type: t.literal("absolute-folder"),
27
27
  folder: t.string().regex(b, "path to folder must be absolute").describe("Absolute address of the folder in local file system")
28
- }).strict(), et = t.discriminatedUnion("type", [
28
+ }).strict(), nt = t.discriminatedUnion("type", [
29
29
  s,
30
30
  r,
31
31
  o,
32
- c,
32
+ a,
33
33
  l
34
- ]), nt = t.discriminatedUnion("type", [
34
+ ]), it = t.discriminatedUnion("type", [
35
35
  s,
36
36
  r,
37
37
  o
38
- ]), it = t.discriminatedUnion("type", [
38
+ ]), ot = t.discriminatedUnion("type", [
39
39
  s,
40
40
  r,
41
41
  o,
42
- c
43
- ]), ot = t.discriminatedUnion("type", [
42
+ a
43
+ ]), rt = t.discriminatedUnion("type", [
44
44
  s,
45
45
  r,
46
46
  o,
47
47
  l
48
- ]), x = t.discriminatedUnion("type", [
48
+ ]), w = t.discriminatedUnion("type", [
49
49
  r,
50
50
  o,
51
- c
52
- ]), w = t.discriminatedUnion("type", [
51
+ a
52
+ ]), U = t.discriminatedUnion("type", [
53
53
  s,
54
54
  o,
55
- c
56
- ]), rt = t.discriminatedUnion("type", [
55
+ a
56
+ ]), st = t.discriminatedUnion("type", [
57
57
  r,
58
58
  l
59
- ]), st = t.discriminatedUnion("type", [
59
+ ]), at = t.discriminatedUnion("type", [
60
60
  r,
61
- c
61
+ a
62
62
  ]), ct = t.discriminatedUnion("type", [
63
63
  s,
64
64
  l
65
- ]), at = t.discriminatedUnion("type", [
65
+ ]), lt = t.discriminatedUnion("type", [
66
66
  s,
67
- c
67
+ a
68
68
  ]), p = t.discriminatedUnion("type", [
69
69
  r,
70
70
  o
71
- ]), U = t.discriminatedUnion("type", [
71
+ ]), S = t.discriminatedUnion("type", [
72
72
  s,
73
73
  o
74
- ]), S = t.union([
75
- t.string().startsWith("file:").transform((e, n) => ({ type: "relative", path: e.slice(5) })),
76
- x
77
74
  ]), V = t.union([
78
- t.string().transform((e, n) => e.startsWith("file:") ? { type: "relative", path: e.slice(5) } : { type: "explicit-string", content: e }),
75
+ t.string().startsWith("file:").transform((e, n) => ({ type: "relative", path: e.slice(5) })),
79
76
  w
77
+ ]), z = t.union([
78
+ t.string().transform((e, n) => e.startsWith("file:") ? { type: "relative", path: e.slice(5) } : { type: "explicit-string", content: e }),
79
+ U
80
80
  ]), u = t.string().regex(
81
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-]+)*))?$/,
82
82
  "Wrong version format, please use valid semver"
@@ -85,27 +85,27 @@ function f(e) {
85
85
  const n = e.endsWith("/") ? e : `${e}/`;
86
86
  return (i) => i.type === "relative" ? { type: "absolute-url", url: n + i.path } : i;
87
87
  }
88
- function lt(e) {
88
+ function dt(e) {
89
89
  const n = e.endsWith("/") ? e : `${e}/`;
90
90
  return (i) => i.type === "relative" ? { type: "relative", path: n + i.path } : i;
91
91
  }
92
- const a = t.object({
92
+ const c = t.object({
93
93
  organization: t.string(),
94
94
  name: t.string(),
95
95
  version: u
96
- }).strict(), z = a.omit({ version: !0 });
97
- function dt(e) {
96
+ }).strict(), M = c.omit({ version: !0 });
97
+ function gt(e) {
98
98
  if (e !== void 0)
99
99
  return `${e.organization}:${e.name}:${e.version}`;
100
100
  }
101
- function gt(e) {
101
+ function mt(e) {
102
102
  if (e !== void 0)
103
103
  return `${e.organization}:${e.name}`;
104
104
  }
105
- function mt(e, n) {
105
+ function pt(e, n) {
106
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;
107
107
  }
108
- function pt(e, n) {
108
+ function ut(e, n) {
109
109
  return e === void 0 && n === void 0 ? !0 : e === void 0 || n === void 0 ? !1 : e.name === n.name && e.organization === n.organization;
110
110
  }
111
111
  function k(e) {
@@ -114,7 +114,7 @@ function k(e) {
114
114
  main: e.describe("Main workflow")
115
115
  });
116
116
  }
117
- function M(e) {
117
+ function D(e) {
118
118
  return t.union([
119
119
  // string is converted to v1 workflow
120
120
  e.transform((n) => ({
@@ -127,13 +127,13 @@ function M(e) {
127
127
  }
128
128
  function y(e, n) {
129
129
  return t.object({
130
- workflow: M(e),
130
+ workflow: D(e),
131
131
  model: e,
132
132
  ui: n
133
133
  });
134
134
  }
135
135
  const h = y(t.string(), t.string());
136
- function ut(e) {
136
+ function yt(e) {
137
137
  return y(
138
138
  p.transform(f(e)),
139
139
  p.transform(f(e))
@@ -167,113 +167,115 @@ function d(e, n) {
167
167
  });
168
168
  }
169
169
  const B = d(
170
- V,
171
- S
172
- ), yt = d(
170
+ z,
171
+ V
172
+ ), ft = d(
173
173
  t.string(),
174
174
  r
175
175
  ), C = d(
176
176
  t.string(),
177
- A
178
- ), ft = t.object({
177
+ x
178
+ ), kt = t.object({
179
179
  components: h,
180
180
  meta: B
181
- });
182
- function P(e, n) {
181
+ }), P = t.record(t.string(), t.union([t.boolean(), t.number()])).transform((e) => e);
182
+ function j(e, n) {
183
183
  return t.object({
184
- id: a,
184
+ id: c,
185
185
  components: e,
186
- meta: n
186
+ meta: n,
187
+ featureFlags: P.optional()
187
188
  });
188
189
  }
189
- const kt = P(
190
+ const vt = j(
190
191
  h,
191
192
  B
192
193
  );
193
- function vt(e, n) {
194
+ function bt(e, n) {
194
195
  return v.mergeDeep(e, { id: { version: n } });
195
196
  }
196
- const D = y(o, o), I = d(U, p), E = P(
197
- D,
198
- I
197
+ const I = y(o, o), F = d(S, p), E = j(
198
+ I,
199
+ F
199
200
  ), L = t.string().regex(/[0-9a-fA-F]/).toUpperCase().length(64), T = t.object({
200
201
  name: t.string(),
201
202
  size: t.number().int(),
202
203
  sha256: L
203
- }), bt = t.object({
204
+ }), ht = t.object({
204
205
  schema: t.literal("v2"),
205
206
  description: E,
206
207
  timestamp: t.number().optional(),
207
208
  files: t.array(T)
208
- }), ht = "manifest.json";
209
- function Bt(e, n) {
209
+ }), Bt = "manifest.json";
210
+ function Ct(e, n) {
210
211
  return v.mergeDeep(e, { description: { id: { version: n } } });
211
212
  }
212
- const F = t.object({
213
+ const O = t.object({
213
214
  type: t.literal("dev-v1"),
214
215
  folder: t.string(),
215
216
  mtime: t.string().optional()
216
- }), O = t.object({
217
+ }), W = t.object({
217
218
  type: t.literal("dev-v2"),
218
219
  folder: t.string(),
219
220
  mtime: t.string().optional()
220
- }), W = t.object({
221
+ }), $ = t.object({
221
222
  type: t.literal("from-registry-v1"),
222
223
  registryUrl: t.string(),
223
- id: a
224
- }), $ = t.object({
224
+ id: c
225
+ }), Z = t.object({
225
226
  type: t.literal("from-registry-v2"),
226
227
  registryUrl: t.string(),
227
- id: a,
228
+ id: c,
228
229
  channel: t.string().optional()
229
- }), j = t.discriminatedUnion("type", [
230
- F,
230
+ }), R = t.discriminatedUnion("type", [
231
231
  O,
232
232
  W,
233
- $
234
- ]), Z = t.object({
233
+ $,
234
+ Z
235
+ ]), _ = t.object({
235
236
  type: t.literal("local-dev"),
236
237
  path: t.string()
237
- }), _ = t.object({
238
+ }), q = t.object({
238
239
  type: t.literal("remote-v1"),
239
240
  url: t.string().url()
240
- }), q = t.object({
241
+ }), N = t.object({
241
242
  type: t.literal("remote-v2"),
242
243
  url: t.string().url()
243
- }), N = t.discriminatedUnion("type", [
244
- _,
244
+ }), G = t.discriminatedUnion("type", [
245
245
  q,
246
- Z
247
- ]), R = t.object({
246
+ N,
247
+ _
248
+ ]), A = t.object({
248
249
  id: t.string(),
249
250
  title: t.string().optional(),
250
- spec: N
251
- }), Ct = t.array(R), Pt = t.object({
251
+ spec: G
252
+ }), Pt = t.array(A), jt = t.object({
252
253
  registryId: t.string(),
253
- id: a,
254
+ id: c,
254
255
  meta: C,
255
- spec: j,
256
+ spec: R,
256
257
  otherVersions: t.array(u)
257
- }), G = "any", m = "stable", J = t.object({
258
+ }), J = "any", m = "stable", H = t.object({
258
259
  version: u,
259
260
  channels: t.array(t.string())
260
- }), H = t.object({
261
- id: a,
262
- meta: C,
263
- spec: j
264
261
  }), K = t.object({
265
- id: z,
266
- latestByChannel: t.record(t.string(), H),
267
- allVersions: t.array(J),
262
+ id: c,
263
+ meta: C,
264
+ featureFlags: P.optional(),
265
+ spec: R
266
+ }), Q = t.object({
267
+ id: M,
268
+ latestByChannel: t.record(t.string(), K),
269
+ allVersions: t.array(H),
268
270
  registryId: t.string()
269
- }), Q = R.extend({
271
+ }), X = A.extend({
270
272
  status: t.union([t.literal("online"), t.literal("offline")])
271
- }), jt = t.object({
272
- registries: t.array(Q),
273
- blockPacks: t.array(K)
273
+ }), Rt = t.object({
274
+ registries: t.array(X),
275
+ blockPacks: t.array(Q)
274
276
  });
275
- function Rt(e) {
276
- const n = e.latestByChannel[m] !== void 0 ? m : G, i = e.latestByChannel[n];
277
+ function At(e) {
278
+ const n = e.latestByChannel[m] !== void 0 ? m : J, i = e.latestByChannel[n];
277
279
  return {
278
280
  id: i.id,
279
281
  meta: i.meta,
@@ -283,82 +285,83 @@ function Rt(e) {
283
285
  registryId: e.registryId
284
286
  };
285
287
  }
286
- const At = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
288
+ const xt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
287
289
  __proto__: null
288
290
  }, Symbol.toStringTag, { value: "Module" }));
289
291
  export {
290
- G as AnyChannel,
292
+ J as AnyChannel,
291
293
  y as BlockComponents,
292
- ut as BlockComponentsAbsoluteUrl,
294
+ yt as BlockComponentsAbsoluteUrl,
293
295
  h as BlockComponentsDescriptionRaw,
294
- D as BlockComponentsManifest,
295
- ft as BlockPackDescriptionFromPackageJsonRaw,
296
+ I as BlockComponentsManifest,
297
+ kt as BlockPackDescriptionFromPackageJsonRaw,
296
298
  E as BlockPackDescriptionManifest,
297
- kt as BlockPackDescriptionRaw,
298
- F as BlockPackDevV1,
299
- O as BlockPackDevV2,
300
- W as BlockPackFromRegistryV1,
301
- $ as BlockPackFromRegistryV2,
302
- a as BlockPackId,
303
- z as BlockPackIdNoVersion,
304
- jt as BlockPackListing,
305
- bt as BlockPackManifest,
306
- ht as BlockPackManifestFile,
299
+ vt as BlockPackDescriptionRaw,
300
+ O as BlockPackDevV1,
301
+ W as BlockPackDevV2,
302
+ $ as BlockPackFromRegistryV1,
303
+ Z as BlockPackFromRegistryV2,
304
+ c as BlockPackId,
305
+ M as BlockPackIdNoVersion,
306
+ Rt as BlockPackListing,
307
+ ht as BlockPackManifest,
308
+ Bt as BlockPackManifestFile,
307
309
  d as BlockPackMeta,
308
310
  B as BlockPackMetaDescriptionRaw,
309
- yt as BlockPackMetaEmbeddedBase64,
311
+ ft as BlockPackMetaEmbeddedBase64,
310
312
  C as BlockPackMetaEmbeddedBytes,
311
- I as BlockPackMetaManifest,
312
- K as BlockPackOverview,
313
- Pt as BlockPackOverviewLegacy,
314
- j as BlockPackSpec,
315
- st as ContentAbsoluteBinaryLocal,
316
- rt as ContentAbsoluteBinaryRemote,
317
- c as ContentAbsoluteFile,
318
- tt as ContentAbsoluteFolder,
319
- at as ContentAbsoluteTextLocal,
313
+ F as BlockPackMetaManifest,
314
+ Q as BlockPackOverview,
315
+ jt as BlockPackOverviewLegacy,
316
+ R as BlockPackSpec,
317
+ at as ContentAbsoluteBinaryLocal,
318
+ st as ContentAbsoluteBinaryRemote,
319
+ a as ContentAbsoluteFile,
320
+ et as ContentAbsoluteFolder,
321
+ lt as ContentAbsoluteTextLocal,
320
322
  ct as ContentAbsoluteTextRemote,
321
323
  l as ContentAbsoluteUrl,
322
- et as ContentAny,
323
- x as ContentAnyBinaryLocal,
324
- it as ContentAnyLocal,
325
- ot as ContentAnyRemote,
326
- w as ContentAnyTextLocal,
324
+ nt as ContentAny,
325
+ w as ContentAnyBinaryLocal,
326
+ ot as ContentAnyLocal,
327
+ rt as ContentAnyRemote,
328
+ U as ContentAnyTextLocal,
327
329
  r as ContentExplicitBase64,
328
- A as ContentExplicitBytes,
329
- nt as ContentExplicitOrRelative,
330
+ x as ContentExplicitBytes,
331
+ it as ContentExplicitOrRelative,
330
332
  s as ContentExplicitString,
331
333
  o as ContentRelative,
332
334
  p as ContentRelativeBinary,
333
- U as ContentRelativeText,
334
- P as CreateBlockPackDescriptionSchema,
335
- S as DescriptionContentBinary,
336
- V as DescriptionContentText,
337
- Y as InitialBlockSettings,
338
- Z as LocalDevFolder,
335
+ S as ContentRelativeText,
336
+ j as CreateBlockPackDescriptionSchema,
337
+ V as DescriptionContentBinary,
338
+ z as DescriptionContentText,
339
+ P as FeatureFlags,
340
+ tt as InitialBlockSettings,
341
+ _ as LocalDevFolder,
339
342
  T as ManifestFileInfo,
340
- At as PFrameInternal,
341
- R as RegistryEntry,
342
- Ct as RegistryList,
343
- N as RegistrySpec,
344
- Q as RegistryStatus,
345
- _ as RemoteRegistryV1Spec,
346
- q as RemoteRegistryV2Spec,
343
+ xt as PFrameInternal,
344
+ A as RegistryEntry,
345
+ Pt as RegistryList,
346
+ G as RegistrySpec,
347
+ X as RegistryStatus,
348
+ q as RemoteRegistryV1Spec,
349
+ N as RemoteRegistryV2Spec,
347
350
  u as SemVer,
348
351
  L as Sha256Schema,
349
- H as SingleBlockPackOverview,
352
+ K as SingleBlockPackOverview,
350
353
  m as StableChannel,
351
- J as VersionWithChannels,
352
- M as Workflow,
354
+ H as VersionWithChannels,
355
+ D as Workflow,
353
356
  k as WorkflowV1,
354
- lt as addPrefixToRelative,
355
- mt as blockPackIdEquals,
356
- pt as blockPackIdNoVersionEquals,
357
- gt as blockPackIdNoVersionToString,
358
- dt as blockPackIdToString,
359
- Rt as blockPackOverviewToLegacy,
357
+ dt as addPrefixToRelative,
358
+ pt as blockPackIdEquals,
359
+ ut as blockPackIdNoVersionEquals,
360
+ mt as blockPackIdNoVersionToString,
361
+ gt as blockPackIdToString,
362
+ At as blockPackOverviewToLegacy,
360
363
  f as mapRemoteToAbsolute,
361
- vt as overrideDescriptionVersion,
362
- Bt as overrideManifestVersion
364
+ bt as overrideDescriptionVersion,
365
+ Ct as overrideManifestVersion
363
366
  };
364
367
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../src/block_settings.ts","../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":["/**\n * What part of block version should be locked against updates.\n *\n * - `major` - 1.2.3 can be updated to 1.4.7\n * - `minor` - 1.2.3 can be updated to 1.2.5\n * - `patch` - version of the block is completely locked\n *\n * */\nexport type VersionLock = 'major' | 'minor' | 'patch';\n\n/**\n * Block settings, persisted on the backend.\n *\n * Settings modulate different aspects of block behaviour,\n * currently only updates.\n * */\nexport type BlockSettings = {\n /** Only version stricktly greater that this one will be suggested for auto-update. */\n skipVersion?: string;\n /**\n * If certain version locking policy is set, auto-updates will only be suggested,\n * if there is an update within the specified release line.\n * */\n versionLock?: VersionLock;\n};\n\nexport const InitialBlockSettings: BlockSettings = {};\n","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\nconst absPathRegex = new RegExp(`^(/|[A-Z]:\\\\\\\\)`);\n\nexport const ContentAbsoluteFile = z\n .object({\n type: z.literal('absolute-file'),\n file: z\n .string()\n .regex(absPathRegex, 'path to file must be absolute')\n .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 .regex(absPathRegex, 'path to folder must be absolute')\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\nexport function blockPackIdToString(bp: BlockPackId): string;\nexport function blockPackIdToString(bp: BlockPackId | undefined): string | undefined;\nexport function blockPackIdToString(bp: BlockPackId | undefined): string | undefined {\n if (bp === undefined) return undefined;\n return `${bp.organization}:${bp.name}:${bp.version}`;\n}\n\nexport function blockPackIdNoVersionToString(bp: BlockPackIdNoVersion): string;\nexport function blockPackIdNoVersionToString(\n bp: BlockPackIdNoVersion | undefined\n): string | undefined;\nexport function blockPackIdNoVersionToString(\n bp: BlockPackIdNoVersion | undefined\n): string | undefined {\n if (bp === undefined) return undefined;\n return `${bp.organization}:${bp.name}`;\n}\n\nexport function blockPackIdEquals(\n bp1: BlockPackId | undefined,\n bp2: BlockPackId | undefined\n): boolean {\n if (bp1 === undefined && bp2 === undefined) return true;\n if (bp1 === undefined || bp2 === undefined) return false;\n return (\n bp1.name === bp2.name && bp1.organization === bp2.organization && bp1.version === bp2.version\n );\n}\n\nexport function blockPackIdNoVersionEquals(\n bp1: BlockPackIdNoVersion | undefined,\n bp2: BlockPackIdNoVersion | undefined\n): boolean {\n if (bp1 === undefined && bp2 === undefined) return true;\n if (bp1 === undefined || bp2 === undefined) return false;\n return bp1.name === bp2.name && bp1.organization === bp2.organization;\n}\n","import { z } from 'zod';\nimport { ContentRelativeBinary } from './content_types';\nimport { mapRemoteToAbsolute } from './content_conversion';\n\nexport type BlockPackComponents = {};\n\nexport function WorkflowV1<const Content extends z.ZodTypeAny>(contentType: Content) {\n return z.object({\n type: z.literal('workflow-v1'),\n main: contentType.describe('Main workflow')\n });\n}\n\nexport function Workflow<const Content extends z.ZodTypeAny>(contentType: Content) {\n return z.union([\n // string is converted to v1 workflow\n contentType\n .transform((value: z.infer<typeof contentType>) => ({\n type: 'workflow-v1' as const,\n main: value\n }))\n .pipe(WorkflowV1(contentType)),\n // structured objects are decoded as union with type descriptor\n z.discriminatedUnion('type', [WorkflowV1(contentType)])\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 changelog: 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 * The order of blocks on the \"marketplace\" (higher values push block higher to the top of the list).\n * `undefined` value or absent field is treated exactly the same as number `0`.\n */\n marketplaceRanking: z.number().optional(),\n /**\n * The URL to the Terms of Service for the block. If provided checkbox with link to this URL should be shown in order to add block.\n */\n termsOfServiceUrl: z.string().url().optional()\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';\nimport * as R from 'remeda';\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\nexport function overrideDescriptionVersion<T extends { id: BlockPackId }>(\n manifest: T,\n newVersion: string\n): T {\n return R.mergeDeep(manifest, { id: { version: newVersion } }) as T;\n}\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';\nimport * as R from 'remeda';\nimport { BlockPackId } from './block_id';\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 timestamp: z.number().optional(),\n files: z.array(ManifestFileInfo)\n});\nexport type BlockPackManifest = z.infer<typeof BlockPackManifest>;\n\nexport const BlockPackManifestFile = 'manifest.json';\n\nexport function overrideManifestVersion<T extends { description: { id: BlockPackId } }>(\n manifest: T,\n newVersion: string\n): T {\n return R.mergeDeep(manifest, { description: { id: { version: newVersion } } }) as T;\n}\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 channel: z.string().optional()\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 {\n BlockPackId,\n BlockPackIdNoVersion,\n BlockPackMetaEmbeddedBytes,\n SemVer\n} from '../block_meta';\nimport { BlockPackFromRegistryV2, 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 BlockPackOverviewLegacy = z.object({\n registryId: z.string(),\n id: BlockPackId,\n meta: BlockPackMetaEmbeddedBytes,\n spec: BlockPackSpec,\n otherVersions: z.array(SemVer)\n});\nexport type BlockPackOverviewLegacy = z.infer<typeof BlockPackOverviewLegacy>;\n\nexport const AnyChannel = 'any';\nexport const StableChannel = 'stable';\n\nexport const VersionWithChannels = z.object({\n version: SemVer,\n channels: z.array(z.string())\n});\n\n/**\n * Information about specific block pack version.\n * */\nexport const SingleBlockPackOverview = z.object({\n id: BlockPackId,\n meta: BlockPackMetaEmbeddedBytes,\n spec: BlockPackSpec\n});\nexport type SingleBlockPackOverview = z.infer<typeof SingleBlockPackOverview>;\n\n/**\n * Latest information about specific block pack. Contain information about latest version of the package.\n * */\nexport const BlockPackOverview = z.object({\n id: BlockPackIdNoVersion,\n latestByChannel: z.record(z.string(), SingleBlockPackOverview),\n allVersions: z.array(VersionWithChannels),\n registryId: z.string()\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\nexport function blockPackOverviewToLegacy(bpo: BlockPackOverview): BlockPackOverviewLegacy {\n const mainChannel = bpo.latestByChannel[StableChannel] !== undefined ? StableChannel : AnyChannel;\n const latestOverview = bpo.latestByChannel[mainChannel];\n return {\n id: latestOverview.id,\n meta: latestOverview.meta,\n // so we only add stable channel specs to projects, to smooth the transition\n spec: { ...(latestOverview.spec as BlockPackFromRegistryV2), channel: StableChannel },\n otherVersions: bpo.allVersions\n .filter((v) => v.channels.indexOf(mainChannel) >= 0)\n .map((v) => v.version),\n registryId: bpo.registryId\n };\n}\n"],"names":["InitialBlockSettings","ContentExplicitString","z","ContentExplicitBase64","ContentRelative","absPathRegex","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","blockPackIdToString","bp","blockPackIdNoVersionToString","blockPackIdEquals","bp1","bp2","blockPackIdNoVersionEquals","WorkflowV1","contentType","Workflow","BlockComponents","wfAndModel","ui","BlockComponentsDescriptionRaw","BlockComponentsAbsoluteUrl","BlockPackMeta","longString","binary","BlockPackMetaDescriptionRaw","BlockPackMetaEmbeddedBase64","BlockPackMetaEmbeddedBytes","BlockPackDescriptionFromPackageJsonRaw","CreateBlockPackDescriptionSchema","components","meta","BlockPackDescriptionRaw","overrideDescriptionVersion","manifest","newVersion","R","BlockComponentsManifest","BlockPackMetaManifest","BlockPackDescriptionManifest","Sha256Schema","ManifestFileInfo","BlockPackManifest","BlockPackManifestFile","overrideManifestVersion","BlockPackDevV1","BlockPackDevV2","BlockPackFromRegistryV1","BlockPackFromRegistryV2","BlockPackSpec","LocalDevFolder","RemoteRegistryV1Spec","RemoteRegistryV2Spec","RegistrySpec","RegistryEntry","RegistryList","BlockPackOverviewLegacy","AnyChannel","StableChannel","VersionWithChannels","SingleBlockPackOverview","BlockPackOverview","RegistryStatus","BlockPackListing","blockPackOverviewToLegacy","bpo","mainChannel","latestOverview","v"],"mappings":";;AA0BO,MAAMA,IAAsC,CAAA,GCpBtCC,IAAwBC,EAClC,OAAO;AAAA,EACN,MAAMA,EAAE,QAAQ,iBAAiB;AAAA,EACjC,SAASA,EAAE,OAAO,EAAE,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;A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AAE,MAAMuF,CAAiB;AACvC,CAAC;AAGM,SAASG,GAA0BC,GAAiD;AACzF,QAAMC,IAAcD,EAAI,gBAAgBP,CAAa,MAAM,SAAYA,IAAgBD,GACjFU,IAAiBF,EAAI,gBAAgBC,CAAW;AAC/C,SAAA;AAAA,IACL,IAAIC,EAAe;AAAA,IACnB,MAAMA,EAAe;AAAA;AAAA,IAErB,MAAM,EAAE,GAAIA,EAAe,MAAkC,SAAST,EAAc;AAAA,IACpF,eAAeO,EAAI,YAChB,OAAO,CAACG,MAAMA,EAAE,SAAS,QAAQF,CAAW,KAAK,CAAC,EAClD,IAAI,CAACE,MAAMA,EAAE,OAAO;AAAA,IACvB,YAAYH,EAAI;AAAA,EAClB;AACF;;;;"}
1
+ {"version":3,"file":"index.mjs","sources":["../src/block_settings.ts","../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":["/**\n * What part of block version should be locked against updates.\n *\n * - `major` - 1.2.3 can be updated to 1.4.7\n * - `minor` - 1.2.3 can be updated to 1.2.5\n * - `patch` - version of the block is completely locked\n *\n * */\nexport type VersionLock = 'major' | 'minor' | 'patch';\n\n/**\n * Block settings, persisted on the backend.\n *\n * Settings modulate different aspects of block behaviour,\n * currently only updates.\n * */\nexport type BlockSettings = {\n /** Only version stricktly greater that this one will be suggested for auto-update. */\n skipVersion?: string;\n /**\n * If certain version locking policy is set, auto-updates will only be suggested,\n * if there is an update within the specified release line.\n * */\n versionLock?: VersionLock;\n};\n\nexport const InitialBlockSettings: BlockSettings = {};\n","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\nconst absPathRegex = new RegExp(`^(/|[A-Z]:\\\\\\\\)`);\n\nexport const ContentAbsoluteFile = z\n .object({\n type: z.literal('absolute-file'),\n file: z\n .string()\n .regex(absPathRegex, 'path to file must be absolute')\n .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 .regex(absPathRegex, 'path to folder must be absolute')\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\nexport function blockPackIdToString(bp: BlockPackId): string;\nexport function blockPackIdToString(bp: BlockPackId | undefined): string | undefined;\nexport function blockPackIdToString(bp: BlockPackId | undefined): string | undefined {\n if (bp === undefined) return undefined;\n return `${bp.organization}:${bp.name}:${bp.version}`;\n}\n\nexport function blockPackIdNoVersionToString(bp: BlockPackIdNoVersion): string;\nexport function blockPackIdNoVersionToString(\n bp: BlockPackIdNoVersion | undefined\n): string | undefined;\nexport function blockPackIdNoVersionToString(\n bp: BlockPackIdNoVersion | undefined\n): string | undefined {\n if (bp === undefined) return undefined;\n return `${bp.organization}:${bp.name}`;\n}\n\nexport function blockPackIdEquals(\n bp1: BlockPackId | undefined,\n bp2: BlockPackId | undefined\n): boolean {\n if (bp1 === undefined && bp2 === undefined) return true;\n if (bp1 === undefined || bp2 === undefined) return false;\n return (\n bp1.name === bp2.name && bp1.organization === bp2.organization && bp1.version === bp2.version\n );\n}\n\nexport function blockPackIdNoVersionEquals(\n bp1: BlockPackIdNoVersion | undefined,\n bp2: BlockPackIdNoVersion | undefined\n): boolean {\n if (bp1 === undefined && bp2 === undefined) return true;\n if (bp1 === undefined || bp2 === undefined) return false;\n return bp1.name === bp2.name && bp1.organization === bp2.organization;\n}\n","import { z } from 'zod';\nimport { ContentRelativeBinary } from './content_types';\nimport { mapRemoteToAbsolute } from './content_conversion';\n\nexport type BlockPackComponents = {};\n\nexport function WorkflowV1<const Content extends z.ZodTypeAny>(contentType: Content) {\n return z.object({\n type: z.literal('workflow-v1'),\n main: contentType.describe('Main workflow')\n });\n}\n\nexport function Workflow<const Content extends z.ZodTypeAny>(contentType: Content) {\n return z.union([\n // string is converted to v1 workflow\n contentType\n .transform((value: z.infer<typeof contentType>) => ({\n type: 'workflow-v1' as const,\n main: value\n }))\n .pipe(WorkflowV1(contentType)),\n // structured objects are decoded as union with type descriptor\n z.discriminatedUnion('type', [WorkflowV1(contentType)])\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 changelog: 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 * The order of blocks on the \"marketplace\" (higher values push block higher to the top of the list).\n * `undefined` value or absent field is treated exactly the same as number `0`.\n */\n marketplaceRanking: z.number().optional(),\n /**\n * The URL to the Terms of Service for the block. If provided checkbox with link to this URL should be shown in order to add block.\n */\n termsOfServiceUrl: z.string().url().optional()\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';\nimport * as R from 'remeda';\nimport { BlockCodeKnownFeatureFlags } from '@milaboratories/pl-model-common';\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 const FeatureFlags = z.record(z.string(), z.union([z.boolean(), z.number()]))\n .transform((flags) => flags as BlockCodeKnownFeatureFlags);\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 featureFlags: FeatureFlags.optional()\n });\n}\n\nexport const BlockPackDescriptionRaw = CreateBlockPackDescriptionSchema(\n BlockComponentsDescriptionRaw,\n BlockPackMetaDescriptionRaw\n);\nexport type BlockPackDescriptionRaw = z.infer<typeof BlockPackDescriptionRaw>;\n\nexport function overrideDescriptionVersion<T extends { id: BlockPackId }>(\n manifest: T,\n newVersion: string\n): T {\n return R.mergeDeep(manifest, { id: { version: newVersion } }) as T;\n}\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';\nimport * as R from 'remeda';\nimport { BlockPackId } from './block_id';\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 timestamp: z.number().optional(),\n files: z.array(ManifestFileInfo)\n});\nexport type BlockPackManifest = z.infer<typeof BlockPackManifest>;\n\nexport const BlockPackManifestFile = 'manifest.json';\n\nexport function overrideManifestVersion<T extends { description: { id: BlockPackId } }>(\n manifest: T,\n newVersion: string\n): T {\n return R.mergeDeep(manifest, { description: { id: { version: newVersion } } }) as T;\n}\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 channel: z.string().optional()\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 {\n BlockPackId,\n BlockPackIdNoVersion,\n BlockPackMetaEmbeddedBytes,\n FeatureFlags,\n SemVer\n} from '../block_meta';\nimport { BlockPackFromRegistryV2, 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 BlockPackOverviewLegacy = z.object({\n registryId: z.string(),\n id: BlockPackId,\n meta: BlockPackMetaEmbeddedBytes,\n spec: BlockPackSpec,\n otherVersions: z.array(SemVer)\n});\nexport type BlockPackOverviewLegacy = z.infer<typeof BlockPackOverviewLegacy>;\n\nexport const AnyChannel = 'any';\nexport const StableChannel = 'stable';\n\nexport const VersionWithChannels = z.object({\n version: SemVer,\n channels: z.array(z.string())\n});\n\n/**\n * Information about specific block pack version.\n * */\nexport const SingleBlockPackOverview = z.object({\n id: BlockPackId,\n meta: BlockPackMetaEmbeddedBytes,\n featureFlags: FeatureFlags.optional(),\n spec: BlockPackSpec,\n});\nexport type SingleBlockPackOverview = z.infer<typeof SingleBlockPackOverview>;\n\n/**\n * Latest information about specific block pack. Contain information about latest version of the package.\n * */\nexport const BlockPackOverview = z.object({\n id: BlockPackIdNoVersion,\n latestByChannel: z.record(z.string(), SingleBlockPackOverview),\n allVersions: z.array(VersionWithChannels),\n registryId: z.string()\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\nexport function blockPackOverviewToLegacy(bpo: BlockPackOverview): BlockPackOverviewLegacy {\n const mainChannel = bpo.latestByChannel[StableChannel] !== undefined ? StableChannel : AnyChannel;\n const latestOverview = bpo.latestByChannel[mainChannel];\n return {\n id: latestOverview.id,\n meta: latestOverview.meta,\n // so we only add stable channel specs to projects, to smooth the transition\n spec: { ...(latestOverview.spec as BlockPackFromRegistryV2), channel: StableChannel },\n otherVersions: bpo.allVersions\n .filter((v) => v.channels.indexOf(mainChannel) >= 0)\n .map((v) => v.version),\n registryId: bpo.registryId\n };\n}\n"],"names":["InitialBlockSettings","ContentExplicitString","z","ContentExplicitBase64","ContentRelative","absPathRegex","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","blockPackIdToString","bp","blockPackIdNoVersionToString","blockPackIdEquals","bp1","bp2","blockPackIdNoVersionEquals","WorkflowV1","contentType","Workflow","BlockComponents","wfAndModel","ui","BlockComponentsDescriptionRaw","BlockComponentsAbsoluteUrl","BlockPackMeta","longString","binary","BlockPackMetaDescriptionRaw","BlockPackMetaEmbeddedBase64","BlockPackMetaEmbeddedBytes","BlockPackDescriptionFromPackageJsonRaw","FeatureFlags","flags","CreateBlockPackDescriptionSchema","components","meta","BlockPackDescriptionRaw","overrideDescriptionVersion","manifest","newVersion","R","BlockComponentsManifest","BlockPackMetaManifest","BlockPackDescriptionManifest","Sha256Schema","ManifestFileInfo","BlockPackManifest","BlockPackManifestFile","overrideManifestVersion","BlockPackDevV1","BlockPackDevV2","BlockPackFromRegistryV1","BlockPackFromRegistryV2","BlockPackSpec","LocalDevFolder","RemoteRegistryV1Spec","RemoteRegistryV2Spec","RegistrySpec","RegistryEntry","RegistryList","BlockPackOverviewLegacy","AnyChannel","StableChannel","VersionWithChannels","SingleBlockPackOverview","BlockPackOverview","RegistryStatus","BlockPackListing","blockPackOverviewToLegacy","bpo","mainChannel","latestOverview","v"],"mappings":";;AA0BO,MAAMA,KAAsC,CAAA,GCpBtCC,IAAwBC,EAClC,OAAO;AAAA,EACN,MAAMA,EAAE,QAAQ,iBAAiB;AAAA,EACjC,SAASA,EAAE,OAAO,EAAE,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,EAAA;AAEN,CAAC,EACA,OAAO,GAGJG,IAAe,IAAI,OAAO,iBAAiB,GAEpCC,IAAsBJ,EAChC,OAAO;AAAA,EACN,MAAMA,EAAE,QAAQ,eAAe;AAAA,EAC/B,MAAMA,EACH,SACA,MAAMG,GAAc,+BAA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