@platforma-sdk/block-tools 2.8.3 → 2.9.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.
@@ -1,653 +1,25 @@
1
- import { z } from 'zod';
2
- export declare function BlockComponentsDescription(moduleRoot: string): z.ZodObject<{
3
- workflow: z.ZodUnion<[z.ZodPipeline<z.ZodEffects<z.ZodEffects<z.ZodString, {
4
- type: "absolute-file";
5
- file: string;
6
- }, string>, {
7
- type: "workflow-v1";
8
- main: {
9
- type: "absolute-file";
10
- file: string;
11
- };
12
- }, string>, z.ZodObject<{
13
- type: z.ZodLiteral<"workflow-v1">;
14
- main: z.ZodEffects<z.ZodString, {
15
- type: "absolute-file";
16
- file: string;
17
- }, string>;
18
- }, "strip", z.ZodTypeAny, {
19
- type: "workflow-v1";
20
- main: {
21
- type: "absolute-file";
22
- file: string;
23
- };
24
- }, {
25
- type: "workflow-v1";
26
- main: string;
27
- }>>, z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
28
- type: z.ZodLiteral<"workflow-v1">;
29
- main: z.ZodEffects<z.ZodString, {
30
- type: "absolute-file";
31
- file: string;
32
- }, string>;
33
- }, "strip", z.ZodTypeAny, {
34
- type: "workflow-v1";
35
- main: {
36
- type: "absolute-file";
37
- file: string;
38
- };
39
- }, {
40
- type: "workflow-v1";
41
- main: string;
42
- }>]>]>;
43
- model: z.ZodEffects<z.ZodString, {
44
- type: "absolute-file";
45
- file: string;
46
- }, string>;
47
- ui: z.ZodEffects<z.ZodString, {
48
- type: "absolute-folder";
49
- folder: string;
50
- }, string>;
51
- }, "strip", z.ZodTypeAny, {
52
- workflow: {
53
- type: "workflow-v1";
54
- main: {
55
- type: "absolute-file";
56
- file: string;
57
- };
58
- } | {
59
- type: "workflow-v1";
60
- main: {
61
- type: "absolute-file";
62
- file: string;
63
- };
64
- };
65
- model: {
66
- type: "absolute-file";
67
- file: string;
68
- };
69
- ui: {
70
- type: "absolute-folder";
71
- folder: string;
72
- };
73
- }, {
74
- workflow: string | {
75
- type: "workflow-v1";
76
- main: string;
77
- };
78
- model: string;
79
- ui: string;
80
- }>;
81
- export type BlockComponentsDescription = z.infer<ReturnType<typeof BlockComponentsDescription>>;
82
- export declare function BlockComponentsConsolidate(dstFolder: string, fileAccumulator?: string[]): z.ZodPipeline<z.ZodObject<{
83
- workflow: z.ZodUnion<[z.ZodPipeline<z.ZodEffects<z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
84
- type: z.ZodLiteral<"explicit-base64">;
85
- mimeType: z.ZodString;
86
- content: z.ZodString;
87
- }, "strict", z.ZodTypeAny, {
88
- type: "explicit-base64";
89
- mimeType: string;
90
- content: string;
91
- }, {
92
- type: "explicit-base64";
93
- mimeType: string;
94
- content: string;
95
- }>, z.ZodObject<{
96
- type: z.ZodLiteral<"absolute-file">;
97
- file: z.ZodString;
98
- }, "strict", z.ZodTypeAny, {
99
- type: "absolute-file";
100
- file: string;
101
- }, {
102
- type: "absolute-file";
103
- file: string;
104
- }>]>, {
105
- type: "relative";
106
- path: string;
107
- } | {
108
- type: "explicit-base64";
109
- mimeType: string;
110
- content: string;
111
- }, {
112
- type: "explicit-base64";
113
- mimeType: string;
114
- content: string;
115
- } | {
116
- type: "absolute-file";
117
- file: string;
118
- }>, {
119
- type: "workflow-v1";
120
- main: {
121
- type: "relative";
122
- path: string;
123
- } | {
124
- type: "explicit-base64";
125
- mimeType: string;
126
- content: string;
127
- };
128
- }, {
129
- type: "explicit-base64";
130
- mimeType: string;
131
- content: string;
132
- } | {
133
- type: "absolute-file";
134
- file: string;
135
- }>, z.ZodObject<{
136
- type: z.ZodLiteral<"workflow-v1">;
137
- main: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
138
- type: z.ZodLiteral<"explicit-base64">;
139
- mimeType: z.ZodString;
140
- content: z.ZodString;
141
- }, "strict", z.ZodTypeAny, {
142
- type: "explicit-base64";
143
- mimeType: string;
144
- content: string;
145
- }, {
146
- type: "explicit-base64";
147
- mimeType: string;
148
- content: string;
149
- }>, z.ZodObject<{
150
- type: z.ZodLiteral<"absolute-file">;
151
- file: z.ZodString;
152
- }, "strict", z.ZodTypeAny, {
153
- type: "absolute-file";
154
- file: string;
155
- }, {
156
- type: "absolute-file";
157
- file: string;
158
- }>]>, {
159
- type: "relative";
160
- path: string;
161
- } | {
162
- type: "explicit-base64";
163
- mimeType: string;
164
- content: string;
165
- }, {
166
- type: "explicit-base64";
167
- mimeType: string;
168
- content: string;
169
- } | {
170
- type: "absolute-file";
171
- file: string;
172
- }>;
173
- }, "strip", z.ZodTypeAny, {
174
- type: "workflow-v1";
175
- main: {
176
- type: "relative";
177
- path: string;
178
- } | {
179
- type: "explicit-base64";
180
- mimeType: string;
181
- content: string;
182
- };
183
- }, {
184
- type: "workflow-v1";
185
- main: {
186
- type: "explicit-base64";
187
- mimeType: string;
188
- content: string;
189
- } | {
190
- type: "absolute-file";
191
- file: string;
192
- };
193
- }>>, z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
194
- type: z.ZodLiteral<"workflow-v1">;
195
- main: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
196
- type: z.ZodLiteral<"explicit-base64">;
197
- mimeType: z.ZodString;
198
- content: z.ZodString;
199
- }, "strict", z.ZodTypeAny, {
200
- type: "explicit-base64";
201
- mimeType: string;
202
- content: string;
203
- }, {
204
- type: "explicit-base64";
205
- mimeType: string;
206
- content: string;
207
- }>, z.ZodObject<{
208
- type: z.ZodLiteral<"absolute-file">;
209
- file: z.ZodString;
210
- }, "strict", z.ZodTypeAny, {
211
- type: "absolute-file";
212
- file: string;
213
- }, {
214
- type: "absolute-file";
215
- file: string;
216
- }>]>, {
217
- type: "relative";
218
- path: string;
219
- } | {
220
- type: "explicit-base64";
221
- mimeType: string;
222
- content: string;
223
- }, {
224
- type: "explicit-base64";
225
- mimeType: string;
226
- content: string;
227
- } | {
228
- type: "absolute-file";
229
- file: string;
230
- }>;
231
- }, "strip", z.ZodTypeAny, {
232
- type: "workflow-v1";
233
- main: {
234
- type: "relative";
235
- path: string;
236
- } | {
237
- type: "explicit-base64";
238
- mimeType: string;
239
- content: string;
240
- };
241
- }, {
242
- type: "workflow-v1";
243
- main: {
244
- type: "explicit-base64";
245
- mimeType: string;
246
- content: string;
247
- } | {
248
- type: "absolute-file";
249
- file: string;
250
- };
251
- }>]>]>;
252
- model: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
253
- type: z.ZodLiteral<"explicit-base64">;
254
- mimeType: z.ZodString;
255
- content: z.ZodString;
256
- }, "strict", z.ZodTypeAny, {
257
- type: "explicit-base64";
258
- mimeType: string;
259
- content: string;
260
- }, {
261
- type: "explicit-base64";
262
- mimeType: string;
263
- content: string;
264
- }>, z.ZodObject<{
265
- type: z.ZodLiteral<"absolute-file">;
266
- file: z.ZodString;
267
- }, "strict", z.ZodTypeAny, {
268
- type: "absolute-file";
269
- file: string;
270
- }, {
271
- type: "absolute-file";
272
- file: string;
273
- }>]>, {
274
- type: "relative";
275
- path: string;
276
- } | {
277
- type: "explicit-base64";
278
- mimeType: string;
279
- content: string;
280
- }, {
281
- type: "explicit-base64";
282
- mimeType: string;
283
- content: string;
284
- } | {
285
- type: "absolute-file";
286
- file: string;
287
- }>;
288
- ui: z.ZodEffects<z.ZodObject<{
289
- type: z.ZodLiteral<"absolute-folder">;
290
- folder: z.ZodString;
291
- }, "strict", z.ZodTypeAny, {
292
- type: "absolute-folder";
293
- folder: string;
294
- }, {
295
- type: "absolute-folder";
296
- folder: string;
297
- }>, {
298
- type: "relative";
299
- path: string;
300
- }, {
301
- type: "absolute-folder";
302
- folder: string;
303
- }>;
304
- }, "strip", z.ZodTypeAny, {
305
- workflow: {
306
- type: "workflow-v1";
307
- main: {
308
- type: "relative";
309
- path: string;
310
- } | {
311
- type: "explicit-base64";
312
- mimeType: string;
313
- content: string;
314
- };
315
- } | {
316
- type: "workflow-v1";
317
- main: {
318
- type: "relative";
319
- path: string;
320
- } | {
321
- type: "explicit-base64";
322
- mimeType: string;
323
- content: string;
324
- };
325
- };
326
- model: {
327
- type: "relative";
328
- path: string;
329
- } | {
330
- type: "explicit-base64";
331
- mimeType: string;
332
- content: string;
333
- };
334
- ui: {
335
- type: "relative";
336
- path: string;
337
- };
338
- }, {
339
- workflow: {
340
- type: "explicit-base64";
341
- mimeType: string;
342
- content: string;
343
- } | {
344
- type: "absolute-file";
345
- file: string;
346
- } | {
347
- type: "workflow-v1";
348
- main: {
349
- type: "explicit-base64";
350
- mimeType: string;
351
- content: string;
352
- } | {
353
- type: "absolute-file";
354
- file: string;
355
- };
356
- };
357
- model: {
358
- type: "explicit-base64";
359
- mimeType: string;
360
- content: string;
361
- } | {
362
- type: "absolute-file";
363
- file: string;
364
- };
365
- ui: {
366
- type: "absolute-folder";
367
- folder: string;
368
- };
369
- }>, z.ZodObject<{
370
- workflow: z.ZodUnion<[z.ZodPipeline<z.ZodEffects<z.ZodObject<{
371
- type: z.ZodLiteral<"relative">;
372
- path: z.ZodString;
373
- }, "strict", z.ZodTypeAny, {
374
- type: "relative";
375
- path: string;
376
- }, {
377
- type: "relative";
378
- path: string;
379
- }>, {
380
- type: "workflow-v1";
381
- main: {
382
- type: "relative";
383
- path: string;
384
- };
385
- }, {
386
- type: "relative";
387
- path: string;
388
- }>, z.ZodObject<{
389
- type: z.ZodLiteral<"workflow-v1">;
390
- main: z.ZodObject<{
391
- type: z.ZodLiteral<"relative">;
392
- path: z.ZodString;
393
- }, "strict", z.ZodTypeAny, {
394
- type: "relative";
395
- path: string;
396
- }, {
397
- type: "relative";
398
- path: string;
399
- }>;
400
- }, "strip", z.ZodTypeAny, {
401
- type: "workflow-v1";
402
- main: {
403
- type: "relative";
404
- path: string;
405
- };
406
- }, {
407
- type: "workflow-v1";
408
- main: {
409
- type: "relative";
410
- path: string;
411
- };
412
- }>>, z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
413
- type: z.ZodLiteral<"workflow-v1">;
414
- main: z.ZodObject<{
415
- type: z.ZodLiteral<"relative">;
416
- path: z.ZodString;
417
- }, "strict", z.ZodTypeAny, {
418
- type: "relative";
419
- path: string;
420
- }, {
421
- type: "relative";
422
- path: string;
423
- }>;
424
- }, "strip", z.ZodTypeAny, {
425
- type: "workflow-v1";
426
- main: {
427
- type: "relative";
428
- path: string;
429
- };
430
- }, {
431
- type: "workflow-v1";
432
- main: {
433
- type: "relative";
434
- path: string;
435
- };
436
- }>]>]>;
437
- model: z.ZodObject<{
438
- type: z.ZodLiteral<"relative">;
439
- path: z.ZodString;
440
- }, "strict", z.ZodTypeAny, {
441
- type: "relative";
442
- path: string;
443
- }, {
444
- type: "relative";
445
- path: string;
446
- }>;
447
- ui: z.ZodObject<{
448
- type: z.ZodLiteral<"relative">;
449
- path: z.ZodString;
450
- }, "strict", z.ZodTypeAny, {
451
- type: "relative";
452
- path: string;
453
- }, {
454
- type: "relative";
455
- path: string;
456
- }>;
457
- }, "strip", z.ZodTypeAny, {
458
- workflow: {
459
- type: "workflow-v1";
460
- main: {
461
- type: "relative";
462
- path: string;
463
- };
464
- };
465
- model: {
466
- type: "relative";
467
- path: string;
468
- };
469
- ui: {
470
- type: "relative";
471
- path: string;
472
- };
473
- }, {
474
- workflow: {
475
- type: "relative";
476
- path: string;
477
- } | {
478
- type: "workflow-v1";
479
- main: {
480
- type: "relative";
481
- path: string;
482
- };
483
- };
484
- model: {
485
- type: "relative";
486
- path: string;
487
- };
488
- ui: {
489
- type: "relative";
490
- path: string;
491
- };
492
- }>>;
493
- export declare function BlockComponentsAbsoluteUrl(prefix: string): z.ZodObject<{
494
- workflow: z.ZodUnion<[z.ZodPipeline<z.ZodEffects<z.ZodEffects<z.ZodObject<{
495
- type: z.ZodLiteral<"relative">;
496
- path: z.ZodString;
497
- }, "strict", z.ZodTypeAny, {
498
- type: "relative";
499
- path: string;
500
- }, {
501
- type: "relative";
502
- path: string;
503
- }>, {
504
- type: "absolute-url";
505
- url: string;
506
- }, {
507
- type: "relative";
508
- path: string;
509
- }>, {
510
- type: "workflow-v1";
511
- main: {
512
- type: "absolute-url";
513
- url: string;
514
- };
515
- }, {
516
- type: "relative";
517
- path: string;
518
- }>, z.ZodObject<{
519
- type: z.ZodLiteral<"workflow-v1">;
520
- main: z.ZodEffects<z.ZodObject<{
521
- type: z.ZodLiteral<"relative">;
522
- path: z.ZodString;
523
- }, "strict", z.ZodTypeAny, {
524
- type: "relative";
525
- path: string;
526
- }, {
527
- type: "relative";
528
- path: string;
529
- }>, {
530
- type: "absolute-url";
531
- url: string;
532
- }, {
533
- type: "relative";
534
- path: string;
535
- }>;
536
- }, "strip", z.ZodTypeAny, {
537
- type: "workflow-v1";
538
- main: {
539
- type: "absolute-url";
540
- url: string;
541
- };
542
- }, {
543
- type: "workflow-v1";
544
- main: {
545
- type: "relative";
546
- path: string;
547
- };
548
- }>>, z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
549
- type: z.ZodLiteral<"workflow-v1">;
550
- main: z.ZodEffects<z.ZodObject<{
551
- type: z.ZodLiteral<"relative">;
552
- path: z.ZodString;
553
- }, "strict", z.ZodTypeAny, {
554
- type: "relative";
555
- path: string;
556
- }, {
557
- type: "relative";
558
- path: string;
559
- }>, {
560
- type: "absolute-url";
561
- url: string;
562
- }, {
563
- type: "relative";
564
- path: string;
565
- }>;
566
- }, "strip", z.ZodTypeAny, {
567
- type: "workflow-v1";
568
- main: {
569
- type: "absolute-url";
570
- url: string;
571
- };
572
- }, {
573
- type: "workflow-v1";
574
- main: {
575
- type: "relative";
576
- path: string;
577
- };
578
- }>]>]>;
579
- model: z.ZodEffects<z.ZodObject<{
580
- type: z.ZodLiteral<"relative">;
581
- path: z.ZodString;
582
- }, "strict", z.ZodTypeAny, {
583
- type: "relative";
584
- path: string;
585
- }, {
586
- type: "relative";
587
- path: string;
588
- }>, {
589
- type: "absolute-url";
590
- url: string;
591
- }, {
592
- type: "relative";
593
- path: string;
594
- }>;
595
- ui: z.ZodEffects<z.ZodObject<{
596
- type: z.ZodLiteral<"relative">;
597
- path: z.ZodString;
598
- }, "strict", z.ZodTypeAny, {
599
- type: "relative";
600
- path: string;
601
- }, {
602
- type: "relative";
603
- path: string;
604
- }>, {
605
- type: "absolute-url";
606
- url: string;
607
- }, {
608
- type: "relative";
609
- path: string;
610
- }>;
611
- }, "strip", z.ZodTypeAny, {
612
- workflow: {
613
- type: "workflow-v1";
614
- main: {
615
- type: "absolute-url";
616
- url: string;
617
- };
618
- } | {
619
- type: "workflow-v1";
620
- main: {
621
- type: "absolute-url";
622
- url: string;
623
- };
624
- };
625
- model: {
626
- type: "absolute-url";
627
- url: string;
628
- };
629
- ui: {
630
- type: "absolute-url";
631
- url: string;
632
- };
633
- }, {
634
- workflow: {
635
- type: "relative";
636
- path: string;
637
- } | {
638
- type: "workflow-v1";
639
- main: {
640
- type: "relative";
641
- path: string;
642
- };
643
- };
644
- model: {
645
- type: "relative";
646
- path: string;
647
- };
648
- ui: {
649
- type: "relative";
650
- path: string;
651
- };
652
- }>;
653
- export type BlockComponentsAbsoluteUrl = z.infer<ReturnType<typeof BlockComponentsAbsoluteUrl>>;
1
+ import { BlockComponents, BlockComponentsDescriptionRaw, BlockComponentsManifest, ContentAbsoluteFile, ContentAbsoluteFolder, ContentAbsoluteUrl } from '@milaboratories/pl-model-middle-layer';
2
+ /**
3
+ * Resolved BlockComponents — workflow main and model resolved to absolute
4
+ * file references, UI request resolved to its absolute folder.
5
+ */
6
+ export type BlockComponentsDescription = BlockComponents<ContentAbsoluteFile, ContentAbsoluteFolder>;
7
+ /** BlockComponents pointing at registry-served URLs. */
8
+ export type BlockComponentsAbsoluteUrl = BlockComponents<ContentAbsoluteUrl, ContentAbsoluteUrl>;
9
+ /**
10
+ * Resolves block-components paths from `package.json` raw form against the
11
+ * module root. Workflow and model strings are resolved via node module
12
+ * resolution; the UI request resolves to a folder containing `index.html`.
13
+ */
14
+ export declare function resolveBlockComponents(raw: BlockComponentsDescriptionRaw, moduleRoot: string): BlockComponentsDescription;
15
+ /**
16
+ * Copies file references for workflow and model into `dstFolder`, packs the
17
+ * UI folder into `ui.tgz`, returning the manifest form with relative paths.
18
+ */
19
+ export declare function consolidateBlockComponents(description: BlockComponentsDescription, dstFolder: string, fileAccumulator?: string[]): Promise<BlockComponentsManifest>;
20
+ /**
21
+ * Maps a manifest with relative paths to one with absolute URLs against the
22
+ * given prefix. Used by the registry reader to point components at registry
23
+ * storage.
24
+ */
25
+ export declare function blockComponentsManifestToAbsoluteUrl(manifest: BlockComponentsManifest, prefix: string): BlockComponentsAbsoluteUrl;