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