@platforma-sdk/model 1.82.0 → 1.83.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 (62) hide show
  1. package/dist/bconfig/index.d.ts +2 -2
  2. package/dist/bconfig/lambdas.d.ts +2 -12
  3. package/dist/bconfig/lambdas.d.ts.map +1 -1
  4. package/dist/bconfig/v3.d.ts +1 -1
  5. package/dist/block_model.cjs +2 -2
  6. package/dist/block_model.js +2 -2
  7. package/dist/config/index.d.ts +2 -6
  8. package/dist/config/type_engine.d.ts +7 -28
  9. package/dist/config/type_engine.d.ts.map +1 -1
  10. package/dist/index.cjs +20 -60
  11. package/dist/index.d.ts +5 -11
  12. package/dist/index.js +4 -8
  13. package/dist/package.cjs +1 -1
  14. package/dist/package.js +1 -1
  15. package/dist/render/api.cjs +0 -22
  16. package/dist/render/api.cjs.map +1 -1
  17. package/dist/render/api.d.ts +1 -9
  18. package/dist/render/api.d.ts.map +1 -1
  19. package/dist/render/api.js +1 -22
  20. package/dist/render/api.js.map +1 -1
  21. package/dist/render/index.cjs +0 -1
  22. package/dist/render/index.d.ts +2 -2
  23. package/dist/render/index.js +2 -2
  24. package/package.json +4 -4
  25. package/src/bconfig/lambdas.ts +1 -25
  26. package/src/config/index.ts +0 -4
  27. package/src/config/type_engine.ts +6 -49
  28. package/src/index.ts +0 -2
  29. package/src/render/api.ts +0 -32
  30. package/src/typing.test.ts +4 -143
  31. package/dist/block_model_legacy.cjs +0 -240
  32. package/dist/block_model_legacy.cjs.map +0 -1
  33. package/dist/block_model_legacy.d.ts +0 -115
  34. package/dist/block_model_legacy.d.ts.map +0 -1
  35. package/dist/block_model_legacy.js +0 -240
  36. package/dist/block_model_legacy.js.map +0 -1
  37. package/dist/config/actions.cjs +0 -232
  38. package/dist/config/actions.cjs.map +0 -1
  39. package/dist/config/actions.d.ts +0 -48
  40. package/dist/config/actions.d.ts.map +0 -1
  41. package/dist/config/actions.js +0 -201
  42. package/dist/config/actions.js.map +0 -1
  43. package/dist/config/actions_kinds.d.ts +0 -116
  44. package/dist/config/actions_kinds.d.ts.map +0 -1
  45. package/dist/config/index.cjs +0 -33
  46. package/dist/config/index.js +0 -2
  47. package/dist/config/model_meta.d.ts +0 -9
  48. package/dist/config/model_meta.d.ts.map +0 -1
  49. package/dist/config/type_util.d.ts +0 -14
  50. package/dist/config/type_util.d.ts.map +0 -1
  51. package/dist/ref_util.cjs +0 -21
  52. package/dist/ref_util.cjs.map +0 -1
  53. package/dist/ref_util.d.ts +0 -19
  54. package/dist/ref_util.d.ts.map +0 -1
  55. package/dist/ref_util.js +0 -20
  56. package/dist/ref_util.js.map +0 -1
  57. package/src/block_model_legacy.ts +0 -465
  58. package/src/config/actions.ts +0 -468
  59. package/src/config/actions_kinds.ts +0 -264
  60. package/src/config/model_meta.ts +0 -5
  61. package/src/config/type_util.ts +0 -25
  62. package/src/ref_util.ts +0 -17
@@ -1,468 +0,0 @@
1
- import type {
2
- ActGetField,
3
- ActGetFromCtx,
4
- ActGetImmediate,
5
- ActGetResourceField,
6
- ActGetResourceValueAsJson,
7
- ActMakeObject,
8
- ActMapRecordValues,
9
- ActMapResourceFields,
10
- ActMapArrayValues,
11
- ActIsEmpty,
12
- ActNot,
13
- ActIsolate,
14
- ActGetBlobContentAsJson,
15
- ActGetBlobContentAsString,
16
- ActGetBlobContent,
17
- ActAnd,
18
- ActOr,
19
- ActMakeArray,
20
- ActFlatten,
21
- ActGetDownloadedBlobContent,
22
- ActGetOnDemandBlobContent,
23
- ActImportProgress,
24
- ActGetLastLogs,
25
- ActGetProgressLog,
26
- ActGetProgressLogWithInfo,
27
- ActGetLogHandle,
28
- ActExtractArchiveAndGetURL,
29
- } from "./actions_kinds";
30
- import type {
31
- ExtractAction,
32
- POCExtractAction,
33
- PrimitiveOrConfig,
34
- TypedConfig,
35
- } from "./type_engine";
36
- import type { Cfg } from "./model";
37
- import type { CheckedSyncConf } from "./type_util";
38
- import type { ArchiveFormat, RangeBytes } from "@milaboratories/pl-model-common";
39
-
40
- //
41
- // Helpers
42
- //
43
-
44
- function primitiveToConfig(value: PrimitiveOrConfig): TypedConfig {
45
- if (
46
- typeof value === "string" ||
47
- typeof value === "number" ||
48
- typeof value === "boolean" ||
49
- value === null
50
- )
51
- return getImmediate(value);
52
- else return value as TypedConfig;
53
- }
54
-
55
- //
56
- // Context
57
- //
58
-
59
- export function getFromCfg<const V extends string>(variable: V): TypedConfig<ActGetFromCtx<V>> {
60
- return { type: "GetFromCtx", variable } as Cfg as any;
61
- }
62
-
63
- //
64
- // Isolate
65
- //
66
-
67
- export function isolate<const Config extends TypedConfig>(
68
- cfg: Config,
69
- ): TypedConfig<ActIsolate<ExtractAction<Config>>> {
70
- return {
71
- type: "Isolate",
72
- cfg,
73
- } as Cfg as any;
74
- }
75
-
76
- //
77
- // Well-known Context Vars
78
- //
79
-
80
- export const Args = getFromCfg("$args");
81
- export const It = getFromCfg("$it");
82
- export const MainOutputs = getFromCfg("$prod");
83
- export const StagingOutputs = getFromCfg("$staging");
84
- export const UiState = getFromCfg("$ui");
85
-
86
- //
87
- // Json
88
- //
89
-
90
- export function getImmediate<const T>(value: T): TypedConfig<ActGetImmediate<T>> {
91
- return { type: "Immediate", value } as Cfg as any;
92
- }
93
-
94
- export function makeObject<const T extends Record<string, PrimitiveOrConfig>>(
95
- template: T,
96
- ): TypedConfig<ActMakeObject<{ [Key in keyof T]: POCExtractAction<T[Key]> }>> {
97
- const normalizedTemplate: Record<string, TypedConfig> = {};
98
- for (const [k, cfg] of Object.entries(template)) normalizedTemplate[k] = primitiveToConfig(cfg);
99
- return {
100
- type: "MakeObject",
101
- template: normalizedTemplate,
102
- } as Cfg as any;
103
- }
104
-
105
- export function makeArray<const T extends PrimitiveOrConfig[]>(
106
- ...template: T
107
- ): TypedConfig<ActMakeArray<{ [Key in keyof T]: POCExtractAction<T[Key]> }>> {
108
- const normalizedTemplate: TypedConfig[] = [];
109
- for (const cfg of template) normalizedTemplate.push(primitiveToConfig(cfg));
110
- return {
111
- type: "MakeArray",
112
- template: normalizedTemplate,
113
- } as Cfg as any;
114
- }
115
-
116
- export function getJsonField<
117
- const Source extends PrimitiveOrConfig,
118
- const Field extends PrimitiveOrConfig,
119
- >(
120
- source: Source,
121
- field: Field,
122
- ): TypedConfig<ActGetField<POCExtractAction<Source>, POCExtractAction<Field>>> {
123
- return {
124
- type: "GetJsonField",
125
- source: primitiveToConfig(source),
126
- field: primitiveToConfig(field),
127
- } as Cfg as any;
128
- }
129
-
130
- export function mapRecordValues<
131
- const Source extends TypedConfig,
132
- const Mapping extends TypedConfig,
133
- >(
134
- source: Source & CheckedSyncConf<Source>,
135
- mapping: Mapping,
136
- ): TypedConfig<ActMapRecordValues<ExtractAction<Source>, ExtractAction<Mapping>, "$it">>;
137
- export function mapRecordValues<
138
- const Source extends TypedConfig,
139
- const Mapping extends TypedConfig,
140
- >(
141
- source: Source,
142
- mapping: Mapping & CheckedSyncConf<Mapping>,
143
- ): TypedConfig<ActMapRecordValues<ExtractAction<Source>, ExtractAction<Mapping>, "$it">>;
144
- export function mapRecordValues<
145
- const Source extends TypedConfig,
146
- const Mapping extends TypedConfig,
147
- const ItVar extends string,
148
- >(
149
- source: Source & CheckedSyncConf<Source>,
150
- mapping: Mapping,
151
- itVar: ItVar,
152
- ): TypedConfig<ActMapRecordValues<ExtractAction<Source>, ExtractAction<Mapping>, ItVar>>;
153
- export function mapRecordValues<
154
- const Source extends TypedConfig,
155
- const Mapping extends TypedConfig,
156
- const ItVar extends string,
157
- >(
158
- source: Source,
159
- mapping: Mapping & CheckedSyncConf<Mapping>,
160
- itVar: ItVar,
161
- ): TypedConfig<ActMapRecordValues<ExtractAction<Source>, ExtractAction<Mapping>, ItVar>>;
162
- export function mapRecordValues<
163
- const Source extends TypedConfig,
164
- const Mapping extends TypedConfig,
165
- const ItVar extends string,
166
- >(
167
- source: Source,
168
- mapping: Mapping,
169
- itVar: ItVar = "$it" as ItVar,
170
- ): TypedConfig<ActMapRecordValues<ExtractAction<Source>, ExtractAction<Mapping>, ItVar>> {
171
- return {
172
- type: "MapRecordValues",
173
- source,
174
- mapping,
175
- itVar,
176
- } as Cfg as any;
177
- }
178
-
179
- export function mapArrayValues<const Source extends TypedConfig, const Mapping extends TypedConfig>(
180
- source: Source & CheckedSyncConf<Source>,
181
- mapping: Mapping,
182
- ): TypedConfig<ActMapArrayValues<ExtractAction<Source>, ExtractAction<Mapping>, "$it">>;
183
- export function mapArrayValues<const Source extends TypedConfig, const Mapping extends TypedConfig>(
184
- source: Source,
185
- mapping: Mapping & CheckedSyncConf<Mapping>,
186
- ): TypedConfig<ActMapArrayValues<ExtractAction<Source>, ExtractAction<Mapping>, "$it">>;
187
- export function mapArrayValues<
188
- const Source extends TypedConfig,
189
- const Mapping extends TypedConfig,
190
- const ItVar extends string,
191
- >(
192
- source: Source & CheckedSyncConf<Source>,
193
- mapping: Mapping,
194
- itVar: ItVar,
195
- ): TypedConfig<ActMapArrayValues<ExtractAction<Source>, ExtractAction<Mapping>, ItVar>>;
196
- export function mapArrayValues<
197
- const Source extends TypedConfig,
198
- const Mapping extends TypedConfig,
199
- const ItVar extends string,
200
- >(
201
- source: Source,
202
- mapping: Mapping & CheckedSyncConf<Mapping>,
203
- itVar: ItVar,
204
- ): TypedConfig<ActMapArrayValues<ExtractAction<Source>, ExtractAction<Mapping>, ItVar>>;
205
- export function mapArrayValues<
206
- const Source extends TypedConfig,
207
- const Mapping extends TypedConfig,
208
- const ItVar extends string,
209
- >(
210
- source: Source,
211
- mapping: Mapping,
212
- itVar: ItVar = "$it" as ItVar,
213
- ): TypedConfig<ActMapArrayValues<ExtractAction<Source>, ExtractAction<Mapping>, ItVar>> {
214
- return {
215
- type: "MapArrayValues",
216
- source,
217
- mapping,
218
- itVar,
219
- } as Cfg as any;
220
- }
221
-
222
- export function flatten<const Source extends TypedConfig>(
223
- source: Source,
224
- ): TypedConfig<ActFlatten<ExtractAction<Source>>> {
225
- return {
226
- type: "Flatten",
227
- source,
228
- } as Cfg as any;
229
- }
230
-
231
- //
232
- // Boolean
233
- //
234
-
235
- export function isEmpty<const Arg extends TypedConfig>(
236
- arg: Arg,
237
- ): TypedConfig<ActIsEmpty<ExtractAction<Arg>>> {
238
- return {
239
- type: "IsEmpty",
240
- arg,
241
- } as Cfg as any;
242
- }
243
-
244
- export function not<const Operand extends TypedConfig>(
245
- operand: Operand,
246
- ): TypedConfig<ActNot<ExtractAction<Operand>>> {
247
- return {
248
- type: "Not",
249
- operand,
250
- } as Cfg as any;
251
- }
252
-
253
- export function and<const Operand1 extends TypedConfig, const Operand2 extends TypedConfig>(
254
- operand1: Operand1,
255
- operand2: Operand2,
256
- ): TypedConfig<ActAnd<ExtractAction<Operand1>, ExtractAction<Operand2>>> {
257
- return {
258
- type: "And",
259
- operand1,
260
- operand2,
261
- } as Cfg as any;
262
- }
263
-
264
- export function or<const Operand1 extends TypedConfig, const Operand2 extends TypedConfig>(
265
- operand1: Operand1,
266
- operand2: Operand2,
267
- ): TypedConfig<ActOr<ExtractAction<Operand1>, ExtractAction<Operand2>>> {
268
- return {
269
- type: "Or",
270
- operand1,
271
- operand2,
272
- } as Cfg as any;
273
- }
274
-
275
- //
276
- // Resources
277
- //
278
-
279
- export function getResourceField<
280
- const Source extends PrimitiveOrConfig,
281
- const Field extends PrimitiveOrConfig,
282
- >(
283
- source: Source,
284
- field: Field,
285
- ): TypedConfig<ActGetResourceField<POCExtractAction<Source>, POCExtractAction<Field>>> {
286
- return {
287
- type: "GetResourceField",
288
- source: primitiveToConfig(source),
289
- field: primitiveToConfig(field),
290
- } as Cfg as any;
291
- }
292
-
293
- export function getResourceValueAsJson<T>() {
294
- return function <const Source extends PrimitiveOrConfig>(
295
- source: Source,
296
- ): TypedConfig<ActGetResourceValueAsJson<POCExtractAction<Source>, T>> {
297
- return {
298
- type: "GetResourceValueAsJson",
299
- source: primitiveToConfig(source),
300
- } as Cfg as any;
301
- };
302
- }
303
-
304
- export function mapResourceFields<
305
- const Source extends TypedConfig,
306
- const Mapping extends TypedConfig,
307
- >(
308
- source: Source,
309
- mapping: Mapping,
310
- ): TypedConfig<ActMapResourceFields<ExtractAction<Source>, ExtractAction<Mapping>, "$it">>;
311
- export function mapResourceFields<
312
- const Source extends TypedConfig,
313
- const Mapping extends TypedConfig,
314
- const ItVar extends string,
315
- >(
316
- source: Source,
317
- mapping: Mapping,
318
- itVar: ItVar,
319
- ): TypedConfig<ActMapResourceFields<ExtractAction<Source>, ExtractAction<Mapping>, ItVar>>;
320
- export function mapResourceFields<
321
- const Source extends TypedConfig,
322
- const Mapping extends TypedConfig,
323
- const ItVar extends string,
324
- >(
325
- source: Source,
326
- mapping: Mapping,
327
- itVar: ItVar = "$it" as ItVar,
328
- ): TypedConfig<ActMapResourceFields<ExtractAction<Source>, ExtractAction<Mapping>, ItVar>> {
329
- return {
330
- type: "MapResourceFields",
331
- source,
332
- mapping,
333
- itVar,
334
- } as Cfg as TypedConfig<
335
- ActMapResourceFields<ExtractAction<Source>, ExtractAction<Mapping>, ItVar>
336
- >;
337
- }
338
-
339
- //
340
- // Download Blobs
341
- //
342
-
343
- export function getBlobContent<const Source extends TypedConfig>(
344
- source: Source,
345
- range?: RangeBytes,
346
- ): TypedConfig<ActGetBlobContent<ExtractAction<Source>>> {
347
- return {
348
- type: "GetBlobContent",
349
- range,
350
- source: primitiveToConfig(source),
351
- } as Cfg as any;
352
- }
353
-
354
- export function getBlobContentAsString<const Source extends TypedConfig>(
355
- source: Source,
356
- range?: RangeBytes,
357
- ): TypedConfig<ActGetBlobContentAsString<ExtractAction<Source>>> {
358
- return {
359
- type: "GetBlobContentAsString",
360
- range,
361
- source: primitiveToConfig(source),
362
- } as Cfg as any;
363
- }
364
-
365
- export function getBlobContentAsJson<T>() {
366
- return function <const Source extends TypedConfig>(
367
- source: Source,
368
- range?: RangeBytes,
369
- ): TypedConfig<ActGetBlobContentAsJson<ExtractAction<Source>, T>> {
370
- return {
371
- type: "GetBlobContentAsJson",
372
- range,
373
- source: primitiveToConfig(source),
374
- } as Cfg as any;
375
- };
376
- }
377
-
378
- export function getDownloadedBlobContent<const Source extends TypedConfig>(
379
- source: Source,
380
- ): TypedConfig<ActGetDownloadedBlobContent<ExtractAction<Source>>> {
381
- return {
382
- type: "GetDownloadedBlobContent",
383
- source: primitiveToConfig(source),
384
- } as Cfg as any;
385
- }
386
-
387
- export function getOnDemandBlobContent<const Source extends TypedConfig>(
388
- source: Source,
389
- ): TypedConfig<ActGetOnDemandBlobContent<ExtractAction<Source>>> {
390
- return {
391
- type: "GetOnDemandBlobContent",
392
- source: primitiveToConfig(source),
393
- } as Cfg as any;
394
- }
395
-
396
- //
397
- // Download Blobs to URLs
398
- //
399
-
400
- export function extractArchiveAndGetURL<const Source extends TypedConfig>(
401
- source: Source,
402
- format: ArchiveFormat,
403
- ): TypedConfig<ActExtractArchiveAndGetURL<ExtractAction<Source>>> {
404
- return {
405
- type: "ExtractArchiveAndGetURL",
406
- format,
407
- source: primitiveToConfig(source),
408
- } as Cfg as any;
409
- }
410
-
411
- //
412
- // Upload Blobs
413
- //
414
-
415
- export function getImportProgress<const Source extends TypedConfig>(
416
- source: Source,
417
- ): TypedConfig<ActImportProgress<ExtractAction<Source>>> {
418
- return {
419
- type: "GetImportProgress",
420
- source: primitiveToConfig(source),
421
- } as Cfg as any;
422
- }
423
-
424
- //
425
- // Logs
426
- //
427
-
428
- export function getLastLogs<const Source extends TypedConfig>(
429
- source: Source,
430
- lines: number,
431
- ): TypedConfig<ActGetLastLogs<ExtractAction<Source>>> {
432
- return {
433
- type: "GetLastLogs",
434
- source: primitiveToConfig(source),
435
- lines,
436
- } as Cfg as any;
437
- }
438
-
439
- export function getProgressLog<const Source extends TypedConfig>(
440
- source: Source,
441
- patternToSearch: string,
442
- ): TypedConfig<ActGetProgressLog<ExtractAction<Source>>> {
443
- return {
444
- type: "GetProgressLog",
445
- source: primitiveToConfig(source),
446
- patternToSearch,
447
- } as Cfg as any;
448
- }
449
-
450
- export function getProgressLogWithInfo<const Source extends TypedConfig>(
451
- source: Source,
452
- patternToSearch: string,
453
- ): TypedConfig<ActGetProgressLogWithInfo<ExtractAction<Source>>> {
454
- return {
455
- type: "GetProgressLogWithInfo",
456
- source: primitiveToConfig(source),
457
- patternToSearch,
458
- } as Cfg as any;
459
- }
460
-
461
- export function getLogHandle<const Source extends TypedConfig>(
462
- source: Source,
463
- ): TypedConfig<ActGetLogHandle<ExtractAction<Source>>> {
464
- return {
465
- type: "GetLogHandle",
466
- source: primitiveToConfig(source),
467
- } as Cfg as any;
468
- }