@milaboratories/pl-middle-layer 1.10.12
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/block_registry/index.d.ts +4 -0
- package/dist/block_registry/index.d.ts.map +1 -0
- package/dist/block_registry/registry.d.ts +37 -0
- package/dist/block_registry/registry.d.ts.map +1 -0
- package/dist/block_registry/registry_spec.d.ts +12 -0
- package/dist/block_registry/registry_spec.d.ts.map +1 -0
- package/dist/block_registry/watcher.d.ts +15 -0
- package/dist/block_registry/watcher.d.ts.map +1 -0
- package/dist/block_registry/well_known_registries.d.ts +4 -0
- package/dist/block_registry/well_known_registries.d.ts.map +1 -0
- package/dist/cfg_render/executor.d.ts +8 -0
- package/dist/cfg_render/executor.d.ts.map +1 -0
- package/dist/cfg_render/operation.d.ts +29 -0
- package/dist/cfg_render/operation.d.ts.map +1 -0
- package/dist/cfg_render/renderer.d.ts +6 -0
- package/dist/cfg_render/renderer.d.ts.map +1 -0
- package/dist/cfg_render/traverse.d.ts +3 -0
- package/dist/cfg_render/traverse.d.ts.map +1 -0
- package/dist/cfg_render/util.d.ts +5 -0
- package/dist/cfg_render/util.d.ts.map +1 -0
- package/dist/dev/index.d.ts +21 -0
- package/dist/dev/index.d.ts.map +1 -0
- package/dist/dev/util.d.ts +3 -0
- package/dist/dev/util.d.ts.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +3587 -0
- package/dist/index.mjs.map +1 -0
- package/dist/js_render/context.d.ts +68 -0
- package/dist/js_render/context.d.ts.map +1 -0
- package/dist/js_render/index.d.ts +6 -0
- package/dist/js_render/index.d.ts.map +1 -0
- package/dist/middle_layer/active_cfg.d.ts +6 -0
- package/dist/middle_layer/active_cfg.d.ts.map +1 -0
- package/dist/middle_layer/block.d.ts +9 -0
- package/dist/middle_layer/block.d.ts.map +1 -0
- package/dist/middle_layer/block_ctx.d.ts +20 -0
- package/dist/middle_layer/block_ctx.d.ts.map +1 -0
- package/dist/middle_layer/block_ctx_unsafe.d.ts +16 -0
- package/dist/middle_layer/block_ctx_unsafe.d.ts.map +1 -0
- package/dist/middle_layer/driver_kit.d.ts +31 -0
- package/dist/middle_layer/driver_kit.d.ts.map +1 -0
- package/dist/middle_layer/frontend_path.d.ts +6 -0
- package/dist/middle_layer/frontend_path.d.ts.map +1 -0
- package/dist/middle_layer/index.d.ts +5 -0
- package/dist/middle_layer/index.d.ts.map +1 -0
- package/dist/middle_layer/middle_layer.d.ts +78 -0
- package/dist/middle_layer/middle_layer.d.ts.map +1 -0
- package/dist/middle_layer/navigation_states.d.ts +10 -0
- package/dist/middle_layer/navigation_states.d.ts.map +1 -0
- package/dist/middle_layer/ops.d.ts +64 -0
- package/dist/middle_layer/ops.d.ts.map +1 -0
- package/dist/middle_layer/project.d.ts +110 -0
- package/dist/middle_layer/project.d.ts.map +1 -0
- package/dist/middle_layer/project_list.d.ts +11 -0
- package/dist/middle_layer/project_list.d.ts.map +1 -0
- package/dist/middle_layer/project_overview.d.ts +8 -0
- package/dist/middle_layer/project_overview.d.ts.map +1 -0
- package/dist/middle_layer/render.d.ts +6 -0
- package/dist/middle_layer/render.d.ts.map +1 -0
- package/dist/middle_layer/types.d.ts +11 -0
- package/dist/middle_layer/types.d.ts.map +1 -0
- package/dist/middle_layer/util.d.ts +3 -0
- package/dist/middle_layer/util.d.ts.map +1 -0
- package/dist/model/args.d.ts +12 -0
- package/dist/model/args.d.ts.map +1 -0
- package/dist/model/block_pack.d.ts +8 -0
- package/dist/model/block_pack.d.ts.map +1 -0
- package/dist/model/block_pack_spec.d.ts +40 -0
- package/dist/model/block_pack_spec.d.ts.map +1 -0
- package/dist/model/frontend.d.ts +10 -0
- package/dist/model/frontend.d.ts.map +1 -0
- package/dist/model/index.d.ts +3 -0
- package/dist/model/index.d.ts.map +1 -0
- package/dist/model/project_model.d.ts +67 -0
- package/dist/model/project_model.d.ts.map +1 -0
- package/dist/model/project_model_util.d.ts +29 -0
- package/dist/model/project_model_util.d.ts.map +1 -0
- package/dist/model/template_spec.d.ts +16 -0
- package/dist/model/template_spec.d.ts.map +1 -0
- package/dist/mutator/block-pack/block_pack.d.ts +17 -0
- package/dist/mutator/block-pack/block_pack.d.ts.map +1 -0
- package/dist/mutator/block-pack/frontend.d.ts +4 -0
- package/dist/mutator/block-pack/frontend.d.ts.map +1 -0
- package/dist/mutator/context_export.d.ts +9 -0
- package/dist/mutator/context_export.d.ts.map +1 -0
- package/dist/mutator/project.d.ts +121 -0
- package/dist/mutator/project.d.ts.map +1 -0
- package/dist/mutator/template/render_block.d.ts +32 -0
- package/dist/mutator/template/render_block.d.ts.map +1 -0
- package/dist/mutator/template/render_template.d.ts +12 -0
- package/dist/mutator/template/render_template.d.ts.map +1 -0
- package/dist/mutator/template/template_loading.d.ts +13 -0
- package/dist/mutator/template/template_loading.d.ts.map +1 -0
- package/dist/pool/data.d.ts +24 -0
- package/dist/pool/data.d.ts.map +1 -0
- package/dist/pool/driver.d.ts +22 -0
- package/dist/pool/driver.d.ts.map +1 -0
- package/dist/pool/index.d.ts +3 -0
- package/dist/pool/index.d.ts.map +1 -0
- package/dist/pool/p_object_collection.d.ts +29 -0
- package/dist/pool/p_object_collection.d.ts.map +1 -0
- package/dist/pool/ref_count_pool.d.ts +25 -0
- package/dist/pool/ref_count_pool.d.ts.map +1 -0
- package/dist/pool/result_pool.d.ts +25 -0
- package/dist/pool/result_pool.d.ts.map +1 -0
- package/dist/test/block_packs.d.ts +6 -0
- package/dist/test/block_packs.d.ts.map +1 -0
- package/dist/test/explicit_templates.d.ts +3 -0
- package/dist/test/explicit_templates.d.ts.map +1 -0
- package/dist/test/known_templates.d.ts +6 -0
- package/dist/test/known_templates.d.ts.map +1 -0
- package/package.json +55 -0
- package/src/block_registry/index.ts +3 -0
- package/src/block_registry/registry.test.ts +35 -0
- package/src/block_registry/registry.ts +180 -0
- package/src/block_registry/registry_spec.ts +13 -0
- package/src/block_registry/watcher.ts +72 -0
- package/src/block_registry/well_known_registries.ts +13 -0
- package/src/cfg_render/executor.test.ts +120 -0
- package/src/cfg_render/executor.ts +253 -0
- package/src/cfg_render/operation.ts +38 -0
- package/src/cfg_render/renderer.ts +540 -0
- package/src/cfg_render/traverse.ts +58 -0
- package/src/cfg_render/util.ts +29 -0
- package/src/dev/index.ts +89 -0
- package/src/dev/util.ts +13 -0
- package/src/index.ts +21 -0
- package/src/js_render/context.ts +768 -0
- package/src/js_render/index.ts +41 -0
- package/src/middle_layer/active_cfg.ts +56 -0
- package/src/middle_layer/block.ts +70 -0
- package/src/middle_layer/block_ctx.ts +90 -0
- package/src/middle_layer/block_ctx_unsafe.ts +29 -0
- package/src/middle_layer/driver_kit.ts +107 -0
- package/src/middle_layer/frontend_path.ts +83 -0
- package/src/middle_layer/index.ts +4 -0
- package/src/middle_layer/middle_layer.test.ts +720 -0
- package/src/middle_layer/middle_layer.ts +235 -0
- package/src/middle_layer/navigation_states.ts +48 -0
- package/src/middle_layer/ops.ts +147 -0
- package/src/middle_layer/project.ts +380 -0
- package/src/middle_layer/project_list.ts +59 -0
- package/src/middle_layer/project_overview.ts +220 -0
- package/src/middle_layer/render.test.ts +129 -0
- package/src/middle_layer/render.ts +19 -0
- package/src/middle_layer/types.ts +16 -0
- package/src/middle_layer/util.ts +22 -0
- package/src/model/args.ts +62 -0
- package/src/model/block_pack.ts +8 -0
- package/src/model/block_pack_spec.ts +52 -0
- package/src/model/frontend.ts +10 -0
- package/src/model/index.ts +2 -0
- package/src/model/project_model.test.ts +26 -0
- package/src/model/project_model.ts +142 -0
- package/src/model/project_model_util.test.ts +88 -0
- package/src/model/project_model_util.ts +169 -0
- package/src/model/template_spec.ts +18 -0
- package/src/mutator/block-pack/block_pack.test.ts +53 -0
- package/src/mutator/block-pack/block_pack.ts +187 -0
- package/src/mutator/block-pack/frontend.ts +29 -0
- package/src/mutator/context_export.ts +25 -0
- package/src/mutator/project.test.ts +272 -0
- package/src/mutator/project.ts +1112 -0
- package/src/mutator/template/render_block.ts +91 -0
- package/src/mutator/template/render_template.ts +40 -0
- package/src/mutator/template/template_loading.ts +77 -0
- package/src/mutator/template/template_render.test.ts +272 -0
- package/src/pool/data.ts +239 -0
- package/src/pool/driver.ts +325 -0
- package/src/pool/index.ts +2 -0
- package/src/pool/p_object_collection.ts +122 -0
- package/src/pool/ref_count_pool.ts +76 -0
- package/src/pool/result_pool.ts +284 -0
- package/src/test/block_packs.ts +23 -0
- package/src/test/explicit_templates.ts +8 -0
- package/src/test/known_templates.ts +24 -0
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ArgumentKey,
|
|
3
|
+
ArgumentValues,
|
|
4
|
+
ExecutionEnvironment,
|
|
5
|
+
Operation,
|
|
6
|
+
Subroutine
|
|
7
|
+
} from './operation';
|
|
8
|
+
import Denque from 'denque';
|
|
9
|
+
import { assertNever, notEmpty } from '@milaboratories/ts-helpers';
|
|
10
|
+
import { Computable, ComputableCtx, ComputableRenderingOps } from '@milaboratories/computable';
|
|
11
|
+
import { Cfg } from '@platforma-sdk/model';
|
|
12
|
+
import { renderCfg, resOp } from './renderer';
|
|
13
|
+
import canonicalize from 'canonicalize';
|
|
14
|
+
import { BlockContextAny } from '../middle_layer/block_ctx';
|
|
15
|
+
import { MiddleLayerDriverKit } from '../middle_layer/driver_kit';
|
|
16
|
+
import { NonKeyCtxFields, toCfgContext } from '../middle_layer/block_ctx_unsafe';
|
|
17
|
+
|
|
18
|
+
/** Addresses pending subroutines inside the stack */
|
|
19
|
+
type SubroutineKey = symbol;
|
|
20
|
+
|
|
21
|
+
/** Represents destination of the result of an operation. I.e. when sequence of
|
|
22
|
+
* subroutine invocations, and computables terminates with result, this object
|
|
23
|
+
* determines to which argument of which pending subroutine it should be delivered.
|
|
24
|
+
* See special value for delivery of the final "return" result. */
|
|
25
|
+
type Destination = {
|
|
26
|
+
op: SubroutineKey;
|
|
27
|
+
arg: ArgumentKey;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
/** Special address of operation, see below. */
|
|
31
|
+
const ReturnOpKey: unique symbol = Symbol();
|
|
32
|
+
/** The same, but for the argument part of destination, see below. */
|
|
33
|
+
const ReturnArgKey = 'return';
|
|
34
|
+
|
|
35
|
+
/** Special destination, telling the executor that corresponding result should
|
|
36
|
+
* be exposed as a final result, and execution terminate at this point. */
|
|
37
|
+
const ReturnDestination = { op: ReturnOpKey, arg: ReturnArgKey } as Destination;
|
|
38
|
+
|
|
39
|
+
function isReturnDestination(destination: Destination): Boolean {
|
|
40
|
+
return destination.op == ReturnOpKey && destination.arg == ReturnArgKey;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** Queued operation, used inside the executor */
|
|
44
|
+
type QueuedOperation = {
|
|
45
|
+
operation: Operation;
|
|
46
|
+
destination: Destination;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
/** Queued computation, returned by the first round of config execution. Such
|
|
50
|
+
* computables should be returned in the intermediate representation of the
|
|
51
|
+
* enclosing computable, and after they are resolved and passed to the
|
|
52
|
+
* postprocessing routine, should be injected into the execution stack to
|
|
53
|
+
* finalize the computation. */
|
|
54
|
+
type ScheduledComputable = {
|
|
55
|
+
destination: Destination;
|
|
56
|
+
computable: Computable<unknown>;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
/** This is what ScheduledComputable transforms from intermediate
|
|
60
|
+
* representation to post-processing. */
|
|
61
|
+
type MaterializedComputable = {
|
|
62
|
+
destination: Destination;
|
|
63
|
+
computable: unknown;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
/** Main entry inside the execution stack. */
|
|
67
|
+
type PendingSubroutine = {
|
|
68
|
+
subroutine: Subroutine;
|
|
69
|
+
destination: Destination;
|
|
70
|
+
argCounter: number;
|
|
71
|
+
args: ArgumentValues;
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
/** Execution stack. The closest concept that this object along with enclosed
|
|
75
|
+
* {@link PendingSubroutine}s represent is a Continuation.
|
|
76
|
+
* https://en.wikipedia.org/wiki/Continuation */
|
|
77
|
+
type ExecutionStack = {
|
|
78
|
+
result?: unknown;
|
|
79
|
+
pendingSubroutines: Map<SubroutineKey, PendingSubroutine>;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
/** Returns initial stack value. */
|
|
83
|
+
function zeroStack(): ExecutionStack {
|
|
84
|
+
return { pendingSubroutines: new Map<SubroutineKey, PendingSubroutine>() };
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** Implements main executor mechanism.
|
|
88
|
+
* @param env to be passed to while executing operations
|
|
89
|
+
* @param stack execution stack to continue execution from
|
|
90
|
+
* @param operations operations to initiate the execution process
|
|
91
|
+
* @param allowComputables if false, scheduling of async computables will result in error
|
|
92
|
+
* */
|
|
93
|
+
function execute(
|
|
94
|
+
env: ExecutionEnvironment,
|
|
95
|
+
stack: ExecutionStack,
|
|
96
|
+
operations: QueuedOperation[],
|
|
97
|
+
allowComputables: boolean
|
|
98
|
+
): ScheduledComputable[] {
|
|
99
|
+
const operationQueue = new Denque<QueuedOperation>(operations);
|
|
100
|
+
|
|
101
|
+
/** Returns false if final result is set as result of this operation,
|
|
102
|
+
* true if we should continue processing. */
|
|
103
|
+
const deliverResult = (destination: Destination, result: unknown): boolean => {
|
|
104
|
+
if (isReturnDestination(destination)) {
|
|
105
|
+
stack.result = result;
|
|
106
|
+
return false;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
const pending = notEmpty(stack.pendingSubroutines.get(destination.op));
|
|
110
|
+
if (destination.arg in pending.args) throw new Error('argument already set');
|
|
111
|
+
pending.args[destination.arg] = result;
|
|
112
|
+
pending.argCounter--;
|
|
113
|
+
if (pending.argCounter === 0) {
|
|
114
|
+
stack.pendingSubroutines.delete(destination.op);
|
|
115
|
+
operationQueue.push({
|
|
116
|
+
destination: pending.destination,
|
|
117
|
+
operation: pending.subroutine(pending.args)
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
return true;
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
// computables, scheduled during computation, are aggregated in this array,
|
|
125
|
+
// and returned from the function in the end
|
|
126
|
+
const computables: ScheduledComputable[] = [];
|
|
127
|
+
|
|
128
|
+
// each loop = execution of a single queued operation
|
|
129
|
+
mainLoop: while (operationQueue.length > 0) {
|
|
130
|
+
const op = operationQueue.shift()!;
|
|
131
|
+
const action = op.operation(env);
|
|
132
|
+
switch (action.type) {
|
|
133
|
+
case 'ReturnResult':
|
|
134
|
+
if (!deliverResult(op.destination, action.result)) break mainLoop; // this terminates execution
|
|
135
|
+
break; // switch
|
|
136
|
+
|
|
137
|
+
case 'ScheduleSubroutine':
|
|
138
|
+
const newOpKey = Symbol();
|
|
139
|
+
|
|
140
|
+
const argRequests = Object.entries(action.args);
|
|
141
|
+
const initialArgCounter = argRequests.length;
|
|
142
|
+
|
|
143
|
+
if (initialArgCounter === 0)
|
|
144
|
+
// if no pending arguments
|
|
145
|
+
operationQueue.push({
|
|
146
|
+
destination: op.destination,
|
|
147
|
+
operation: action.subroutine({})
|
|
148
|
+
});
|
|
149
|
+
else {
|
|
150
|
+
for (const [arg, operation] of argRequests)
|
|
151
|
+
operationQueue.push({
|
|
152
|
+
destination: { op: newOpKey, arg },
|
|
153
|
+
operation
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
stack.pendingSubroutines.set(newOpKey, {
|
|
157
|
+
argCounter: initialArgCounter,
|
|
158
|
+
args: {},
|
|
159
|
+
subroutine: action.subroutine,
|
|
160
|
+
destination: op.destination
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
break;
|
|
165
|
+
|
|
166
|
+
case 'ScheduleComputable':
|
|
167
|
+
if (!allowComputables)
|
|
168
|
+
throw new Error('asynchronous operations are forbidden in this context');
|
|
169
|
+
computables.push({
|
|
170
|
+
destination: op.destination,
|
|
171
|
+
computable: action.computable
|
|
172
|
+
});
|
|
173
|
+
break;
|
|
174
|
+
|
|
175
|
+
default:
|
|
176
|
+
assertNever(action);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
return computables;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
//
|
|
184
|
+
// Computable
|
|
185
|
+
//
|
|
186
|
+
|
|
187
|
+
/** Main method to render configurations */
|
|
188
|
+
export function computableFromCfg(
|
|
189
|
+
drivers: MiddleLayerDriverKit,
|
|
190
|
+
bCtx: BlockContextAny,
|
|
191
|
+
cfg: Cfg,
|
|
192
|
+
ops: Partial<ComputableRenderingOps> = {}
|
|
193
|
+
): Computable<unknown> {
|
|
194
|
+
return computableFromCfgUnsafe(drivers, toCfgContext(bCtx), cfg, ops);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
export function computableFromCfgUnsafe(
|
|
198
|
+
drivers: MiddleLayerDriverKit,
|
|
199
|
+
ctx: Record<string, unknown>,
|
|
200
|
+
cfg: Cfg,
|
|
201
|
+
ops: Partial<ComputableRenderingOps> = {}
|
|
202
|
+
): Computable<unknown> {
|
|
203
|
+
const key = canonicalize({
|
|
204
|
+
ctx: Object.fromEntries(Object.entries(ctx).filter(([k]) => NonKeyCtxFields.indexOf(k) === -1)),
|
|
205
|
+
cfg: cfg
|
|
206
|
+
})!;
|
|
207
|
+
return Computable.makeRaw(
|
|
208
|
+
(c) => {
|
|
209
|
+
const env: ExecutionEnvironment = { drivers, cCtx: c };
|
|
210
|
+
const stack = zeroStack();
|
|
211
|
+
const computables = execute(
|
|
212
|
+
env,
|
|
213
|
+
stack,
|
|
214
|
+
[
|
|
215
|
+
{
|
|
216
|
+
destination: ReturnDestination,
|
|
217
|
+
operation: renderCfg(ctx, cfg)
|
|
218
|
+
}
|
|
219
|
+
],
|
|
220
|
+
true
|
|
221
|
+
);
|
|
222
|
+
return {
|
|
223
|
+
ir: computables,
|
|
224
|
+
async postprocessValue(value: MaterializedComputable[], stable: boolean): Promise<unknown> {
|
|
225
|
+
const resolvedOps: QueuedOperation[] = [];
|
|
226
|
+
for (const mc of value)
|
|
227
|
+
resolvedOps.push({ destination: mc.destination, operation: resOp(mc.computable) });
|
|
228
|
+
const postEnv: ExecutionEnvironment = {
|
|
229
|
+
drivers,
|
|
230
|
+
get cCtx(): ComputableCtx {
|
|
231
|
+
throw new Error('asynchronous operations are forbidden in this context');
|
|
232
|
+
}
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
// Post process can be called several times, that's why it must be a side-effect-free function.
|
|
236
|
+
// But `execute` modifies a stack, so we have to defensively copy it here.
|
|
237
|
+
const copyOfPendingSubrotines = new Map<SubroutineKey, PendingSubroutine>();
|
|
238
|
+
for (const [key, value] of stack.pendingSubroutines)
|
|
239
|
+
copyOfPendingSubrotines.set(key, { ...value, args: { ...value.args } });
|
|
240
|
+
const copiedStack: ExecutionStack = {
|
|
241
|
+
result: stack.result,
|
|
242
|
+
pendingSubroutines: copyOfPendingSubrotines
|
|
243
|
+
};
|
|
244
|
+
execute(postEnv, copiedStack, resolvedOps, false);
|
|
245
|
+
if (!('result' in copiedStack))
|
|
246
|
+
throw new Error('illegal cfg rendering stack state, no result');
|
|
247
|
+
return copiedStack.result;
|
|
248
|
+
}
|
|
249
|
+
};
|
|
250
|
+
},
|
|
251
|
+
{ ...ops, key }
|
|
252
|
+
);
|
|
253
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { DownloadDriver, LogsDriver, UploadDriver } from '@milaboratories/pl-drivers';
|
|
2
|
+
import { Computable, ComputableCtx } from '@milaboratories/computable';
|
|
3
|
+
import { MiddleLayerDriverKit } from '../middle_layer/driver_kit';
|
|
4
|
+
|
|
5
|
+
export type ArgumentKey = string;
|
|
6
|
+
|
|
7
|
+
export type ExecutionEnvironment = {
|
|
8
|
+
/** Each configuration is rendered inside a computable callback, this is the
|
|
9
|
+
* context of the computable we are rendering inside. */
|
|
10
|
+
cCtx: ComputableCtx;
|
|
11
|
+
/** Available drivers */
|
|
12
|
+
drivers: MiddleLayerDriverKit;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export type ArgumentValues = Record<ArgumentKey, unknown>;
|
|
16
|
+
export type ArgumentRequests = Record<ArgumentKey, Operation>;
|
|
17
|
+
|
|
18
|
+
export type Subroutine = (args: ArgumentValues) => Operation;
|
|
19
|
+
|
|
20
|
+
export type ScheduleSubroutine = {
|
|
21
|
+
type: 'ScheduleSubroutine';
|
|
22
|
+
subroutine: Subroutine;
|
|
23
|
+
args: ArgumentRequests;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export type ScheduleComputable = {
|
|
27
|
+
type: 'ScheduleComputable';
|
|
28
|
+
computable: Computable<unknown>;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export type ReturnResult = {
|
|
32
|
+
type: 'ReturnResult';
|
|
33
|
+
result: unknown;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export type OperationAction = ScheduleSubroutine | ScheduleComputable | ReturnResult;
|
|
37
|
+
|
|
38
|
+
export type Operation = (e: ExecutionEnvironment) => OperationAction;
|