@milaboratories/pl-middle-layer 2.10.1 → 2.11.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.
- package/dist/block_registry/registry-v2-provider.cjs +8 -1
- package/dist/block_registry/registry-v2-provider.cjs.map +1 -1
- package/dist/block_registry/registry-v2-provider.d.ts.map +1 -1
- package/dist/block_registry/registry-v2-provider.js +8 -1
- package/dist/block_registry/registry-v2-provider.js.map +1 -1
- package/dist/index.cjs +24 -0
- package/dist/index.d.ts +11 -4
- package/dist/index.js +4 -2
- package/dist/js_render/bundle_bytecode_cache.cjs +6 -1
- package/dist/js_render/bundle_bytecode_cache.cjs.map +1 -1
- package/dist/js_render/bundle_bytecode_cache.js +6 -1
- package/dist/js_render/bundle_bytecode_cache.js.map +1 -1
- package/dist/js_render/column_registry.cjs +17 -0
- package/dist/js_render/column_registry.cjs.map +1 -1
- package/dist/js_render/column_registry.js +16 -1
- package/dist/js_render/column_registry.js.map +1 -1
- package/dist/js_render/computable_context.cjs +1 -1
- package/dist/js_render/computable_context.js +1 -1
- package/dist/js_render/context.cjs +3 -2
- package/dist/js_render/context.cjs.map +1 -1
- package/dist/js_render/context.js +3 -2
- package/dist/js_render/context.js.map +1 -1
- package/dist/js_render/index.cjs +1 -1
- package/dist/js_render/index.cjs.map +1 -1
- package/dist/js_render/index.js +1 -1
- package/dist/js_render/index.js.map +1 -1
- package/dist/js_render/service_injectors.cjs +2 -9
- package/dist/js_render/service_injectors.cjs.map +1 -1
- package/dist/js_render/service_injectors.js +2 -9
- package/dist/js_render/service_injectors.js.map +1 -1
- package/dist/middle_layer/block.cjs +48 -0
- package/dist/middle_layer/block.cjs.map +1 -1
- package/dist/middle_layer/block.js +51 -4
- package/dist/middle_layer/block.js.map +1 -1
- package/dist/middle_layer/block_pack_description.cjs +80 -0
- package/dist/middle_layer/block_pack_description.cjs.map +1 -0
- package/dist/middle_layer/block_pack_description.d.ts +36 -0
- package/dist/middle_layer/block_pack_description.d.ts.map +1 -0
- package/dist/middle_layer/block_pack_description.js +78 -0
- package/dist/middle_layer/block_pack_description.js.map +1 -0
- package/dist/middle_layer/build_stamp.cjs +1 -1
- package/dist/middle_layer/build_stamp.js +1 -1
- package/dist/middle_layer/index.cjs +11 -0
- package/dist/middle_layer/index.d.ts +8 -2
- package/dist/middle_layer/index.js +3 -1
- package/dist/middle_layer/legacy_project_holds.cjs +61 -0
- package/dist/middle_layer/legacy_project_holds.cjs.map +1 -0
- package/dist/middle_layer/legacy_project_holds.js +61 -0
- package/dist/middle_layer/legacy_project_holds.js.map +1 -0
- package/dist/middle_layer/middle_layer.cjs +18 -21
- package/dist/middle_layer/middle_layer.cjs.map +1 -1
- package/dist/middle_layer/middle_layer.d.ts +13 -3
- package/dist/middle_layer/middle_layer.d.ts.map +1 -1
- package/dist/middle_layer/middle_layer.js +18 -21
- package/dist/middle_layer/middle_layer.js.map +1 -1
- package/dist/middle_layer/pool_columns.cjs +160 -0
- package/dist/middle_layer/pool_columns.cjs.map +1 -0
- package/dist/middle_layer/pool_columns.d.ts +59 -0
- package/dist/middle_layer/pool_columns.d.ts.map +1 -0
- package/dist/middle_layer/pool_columns.js +157 -0
- package/dist/middle_layer/pool_columns.js.map +1 -0
- package/dist/middle_layer/pool_frame.cjs +82 -0
- package/dist/middle_layer/pool_frame.cjs.map +1 -0
- package/dist/middle_layer/pool_frame.d.ts +37 -0
- package/dist/middle_layer/pool_frame.d.ts.map +1 -0
- package/dist/middle_layer/pool_frame.js +81 -0
- package/dist/middle_layer/pool_frame.js.map +1 -0
- package/dist/middle_layer/pool_table.cjs +66 -0
- package/dist/middle_layer/pool_table.cjs.map +1 -0
- package/dist/middle_layer/pool_table.d.ts +27 -0
- package/dist/middle_layer/pool_table.d.ts.map +1 -0
- package/dist/middle_layer/pool_table.js +66 -0
- package/dist/middle_layer/pool_table.js.map +1 -0
- package/dist/middle_layer/project.cjs +83 -2
- package/dist/middle_layer/project.cjs.map +1 -1
- package/dist/middle_layer/project.d.ts +69 -3
- package/dist/middle_layer/project.d.ts.map +1 -1
- package/dist/middle_layer/project.js +84 -3
- package/dist/middle_layer/project.js.map +1 -1
- package/dist/middle_layer/rich_column_query.cjs +180 -0
- package/dist/middle_layer/rich_column_query.cjs.map +1 -0
- package/dist/middle_layer/rich_column_query.d.ts +34 -0
- package/dist/middle_layer/rich_column_query.d.ts.map +1 -0
- package/dist/middle_layer/rich_column_query.js +176 -0
- package/dist/middle_layer/rich_column_query.js.map +1 -0
- package/dist/model/args.cjs +23 -0
- package/dist/model/args.cjs.map +1 -1
- package/dist/model/args.js +24 -2
- package/dist/model/args.js.map +1 -1
- package/dist/model/args_derivation.cjs +60 -2
- package/dist/model/args_derivation.cjs.map +1 -1
- package/dist/model/args_derivation.d.ts +73 -3
- package/dist/model/args_derivation.d.ts.map +1 -1
- package/dist/model/args_derivation.js +60 -3
- package/dist/model/args_derivation.js.map +1 -1
- package/dist/model/block_params_model.cjs +42 -0
- package/dist/model/block_params_model.cjs.map +1 -0
- package/dist/model/block_params_model.d.ts +45 -0
- package/dist/model/block_params_model.d.ts.map +1 -0
- package/dist/model/block_params_model.js +42 -0
- package/dist/model/block_params_model.js.map +1 -0
- package/dist/model/index.d.ts +3 -1
- package/dist/model/project_helper.cjs +50 -6
- package/dist/model/project_helper.cjs.map +1 -1
- package/dist/model/project_helper.d.ts +25 -1
- package/dist/model/project_helper.d.ts.map +1 -1
- package/dist/model/project_helper.js +51 -7
- package/dist/model/project_helper.js.map +1 -1
- package/dist/mutator/block-pack/block_pack.cjs +1 -1
- package/dist/mutator/block-pack/block_pack.js +1 -1
- package/dist/mutator/project.cjs +4 -0
- package/dist/mutator/project.cjs.map +1 -1
- package/dist/mutator/project.d.ts +1 -1
- package/dist/mutator/project.d.ts.map +1 -1
- package/dist/mutator/project.js +4 -0
- package/dist/mutator/project.js.map +1 -1
- package/package.json +9 -9
- package/src/block_registry/registry-v2-provider.test.ts +23 -0
- package/src/block_registry/registry-v2-provider.ts +11 -1
- package/src/index.ts +2 -0
- package/src/js_render/bundle_bytecode_cache.ts +15 -4
- package/src/js_render/column_registry.ts +24 -3
- package/src/js_render/context.ts +4 -3
- package/src/js_render/index.ts +3 -2
- package/src/js_render/service_injectors.ts +2 -11
- package/src/middle_layer/block.ts +61 -2
- package/src/middle_layer/block_pack_description.test.ts +235 -0
- package/src/middle_layer/block_pack_description.ts +143 -0
- package/src/middle_layer/index.ts +9 -1
- package/src/middle_layer/legacy_project_holds.test.ts +133 -0
- package/src/middle_layer/legacy_project_holds.ts +73 -0
- package/src/middle_layer/middle_layer.ts +23 -26
- package/src/middle_layer/pool_columns.test.ts +217 -0
- package/src/middle_layer/pool_columns.ts +250 -0
- package/src/middle_layer/pool_frame.test.ts +144 -0
- package/src/middle_layer/pool_frame.ts +127 -0
- package/src/middle_layer/pool_table.test.ts +182 -0
- package/src/middle_layer/pool_table.ts +98 -0
- package/src/middle_layer/project.ts +128 -5
- package/src/middle_layer/rich_column_query.test.ts +311 -0
- package/src/middle_layer/rich_column_query.ts +214 -0
- package/src/model/args.test.ts +23 -1
- package/src/model/args.ts +29 -1
- package/src/model/args_derivation.test.ts +129 -12
- package/src/model/args_derivation.ts +112 -8
- package/src/model/block_params_model.test.ts +194 -0
- package/src/model/block_params_model.ts +117 -0
- package/src/model/index.ts +6 -0
- package/src/model/project_helper.ts +101 -20
- package/src/mutator/project.ts +5 -0
- package/src/pool/result_pool_markers.test.ts +47 -0
- package/src/test/fake_project.ts +33 -6
package/src/model/index.ts
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
export * from "./block_pack_spec";
|
|
2
|
+
export type {
|
|
3
|
+
BlockReadiness,
|
|
4
|
+
DerivedPrerunArgsSummary,
|
|
5
|
+
MissingBlockReference,
|
|
6
|
+
} from "./args_derivation";
|
|
2
7
|
export { type ProjectId, type ProjectListEntry, type ProjectField } from "./project_model";
|
|
8
|
+
export type { BlockParamsModel, VersionedBlockData } from "./block_params_model";
|
|
3
9
|
|
|
4
10
|
export {
|
|
5
11
|
ProjectMetaKey,
|
|
@@ -13,7 +13,12 @@ import { executeSingleLambda } from "../js_render";
|
|
|
13
13
|
import type { SignedResourceId } from "@milaboratories/pl-client";
|
|
14
14
|
import { ConsoleLoggerAdapter, type MiLogger } from "@milaboratories/ts-helpers";
|
|
15
15
|
import { getDebugFlags } from "../debug";
|
|
16
|
-
import {
|
|
16
|
+
import {
|
|
17
|
+
parseArgsDeriveResult,
|
|
18
|
+
parsePrerunArgsDeriveResult,
|
|
19
|
+
type DerivedArgs,
|
|
20
|
+
type DerivedPrerunArgs,
|
|
21
|
+
} from "./args_derivation";
|
|
17
22
|
|
|
18
23
|
type EnrichmentTargetsRequest = {
|
|
19
24
|
blockConfig: () => BlockConfig;
|
|
@@ -37,14 +42,13 @@ export type MigrationResult =
|
|
|
37
42
|
|
|
38
43
|
/**
|
|
39
44
|
* Result of a derivation from storage that either produced a value or failed.
|
|
40
|
-
* Returned by the
|
|
41
|
-
* newer model adds the issues found in the prerun args, which are not read here.
|
|
45
|
+
* Returned by the __pl_initializationParams_derive VM callback.
|
|
42
46
|
*/
|
|
43
47
|
type DeriveResult = { error: string } | { error?: undefined; value: unknown };
|
|
44
48
|
|
|
45
49
|
/**
|
|
46
|
-
* Result of building
|
|
47
|
-
* Returned by the __pl_storage_initialFromParams VM
|
|
50
|
+
* Result of building storage from params.
|
|
51
|
+
* Returned by the __pl_storage_initialFromParams and __pl_storage_applyParams VM callbacks.
|
|
48
52
|
*/
|
|
49
53
|
type ParamsStorageResult =
|
|
50
54
|
| { error: string }
|
|
@@ -135,23 +139,44 @@ export class ProjectHelper {
|
|
|
135
139
|
if (blockConfig.modelAPIVersion !== BLOCK_STORAGE_FACADE_VERSION) {
|
|
136
140
|
throw new Error("derivePrerunArgsFromStorage is only supported for model API version 2");
|
|
137
141
|
}
|
|
142
|
+
const derived = this.derivePrerunArgsDetailedFromStorage(blockConfig, storageJson);
|
|
143
|
+
// Anything but staged args skips the block in staging.
|
|
144
|
+
return derived.type === "staged" ? derived.args : undefined;
|
|
145
|
+
}
|
|
138
146
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
147
|
+
/**
|
|
148
|
+
* {@link derivePrerunArgsFromStorage} with the reason when there are no prerun args to stage:
|
|
149
|
+
* the issues found in them, the error of a lambda that threw, or a `prerunArgs()` that returned
|
|
150
|
+
* nothing. Never throws; a failure of the derivation itself is `failed`.
|
|
151
|
+
*
|
|
152
|
+
* @param blockConfig The block configuration (provides the model code)
|
|
153
|
+
* @param storageJson Storage as JSON string
|
|
154
|
+
*/
|
|
155
|
+
public derivePrerunArgsDetailedFromStorage(
|
|
156
|
+
blockConfig: BlockConfig,
|
|
157
|
+
storageJson: string,
|
|
158
|
+
): DerivedPrerunArgs {
|
|
159
|
+
if (blockConfig.modelAPIVersion !== BLOCK_STORAGE_FACADE_VERSION) {
|
|
160
|
+
return {
|
|
161
|
+
type: "failed",
|
|
162
|
+
error: "Prerun args derivation from storage is only supported for model API version 2",
|
|
163
|
+
};
|
|
164
|
+
}
|
|
146
165
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
166
|
+
try {
|
|
167
|
+
return parsePrerunArgsDeriveResult(
|
|
168
|
+
executeSingleLambda(
|
|
169
|
+
this.quickJs,
|
|
170
|
+
blockConfig.blockLifecycleCallbacks[BlockStorageFacadeCallbacks.PrerunArgsDerive],
|
|
171
|
+
extractCodeWithInfo(blockConfig),
|
|
172
|
+
storageJson,
|
|
173
|
+
),
|
|
174
|
+
);
|
|
175
|
+
} catch (e) {
|
|
176
|
+
return {
|
|
177
|
+
type: "failed",
|
|
178
|
+
error: `Prerun args derivation from storage failed: ${ensureError(e).message}`,
|
|
179
|
+
};
|
|
155
180
|
}
|
|
156
181
|
}
|
|
157
182
|
|
|
@@ -458,6 +483,62 @@ export class ProjectHelper {
|
|
|
458
483
|
}
|
|
459
484
|
}
|
|
460
485
|
|
|
486
|
+
/**
|
|
487
|
+
* Puts params onto a block's live data with the block's own `applyParams`, through the VM
|
|
488
|
+
* callback `__pl_storage_applyParams`. Nothing is written: the storage comes back as JSON.
|
|
489
|
+
*
|
|
490
|
+
* The callback runs the kind's params check first, as
|
|
491
|
+
* {@link getInitialStorageFromParamsInVM} does, and refuses data that is not at the data
|
|
492
|
+
* model's current version. Params are live: their references name blocks of this project and
|
|
493
|
+
* are not relocated.
|
|
494
|
+
*
|
|
495
|
+
* @param blockConfig The block configuration (provides the model code)
|
|
496
|
+
* @param storageJson The block's current storage as JSON string
|
|
497
|
+
* @param params The new params, whole
|
|
498
|
+
* @returns The storage with the params applied as JSON string, or why there is none
|
|
499
|
+
*/
|
|
500
|
+
public applyParamsInVM(
|
|
501
|
+
blockConfig: BlockConfig,
|
|
502
|
+
storageJson: string,
|
|
503
|
+
params: unknown,
|
|
504
|
+
): ResultOrError<string> {
|
|
505
|
+
if (blockConfig.modelAPIVersion !== BLOCK_STORAGE_FACADE_VERSION) {
|
|
506
|
+
return {
|
|
507
|
+
error: new Error("applyParamsInVM is only supported for model API version 2"),
|
|
508
|
+
};
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
// Registered only by a block that declares `applyParams`; anything else builds data
|
|
512
|
+
// from params with `init` instead, which is the caller's call to make.
|
|
513
|
+
const callback =
|
|
514
|
+
blockConfig.blockLifecycleCallbacks[BlockStorageFacadeCallbacks.StorageApplyParams];
|
|
515
|
+
if (callback === undefined) {
|
|
516
|
+
return {
|
|
517
|
+
error: new Error("This version of the block does not put params onto its data itself."),
|
|
518
|
+
};
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
try {
|
|
522
|
+
const result = executeSingleLambda(
|
|
523
|
+
this.quickJs,
|
|
524
|
+
callback,
|
|
525
|
+
extractCodeWithInfo(blockConfig),
|
|
526
|
+
storageJson,
|
|
527
|
+
JSON.stringify(params ?? {}),
|
|
528
|
+
) as ParamsStorageResult;
|
|
529
|
+
|
|
530
|
+
if (result.error !== undefined) return { error: new Error(result.error) };
|
|
531
|
+
return { value: result.storageJson };
|
|
532
|
+
} catch (e) {
|
|
533
|
+
const cause = ensureError(e);
|
|
534
|
+
return {
|
|
535
|
+
error: new Error(`Applying params to the block's data failed: ${cause.message}`, {
|
|
536
|
+
cause,
|
|
537
|
+
}),
|
|
538
|
+
};
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
|
|
461
542
|
/**
|
|
462
543
|
* Applies a state update using VM-based transformation.
|
|
463
544
|
* This calls the model's `__pl_storage_applyUpdate` callback which:
|
package/src/mutator/project.ts
CHANGED
|
@@ -721,6 +721,11 @@ export class ProjectMutator {
|
|
|
721
721
|
return info;
|
|
722
722
|
}
|
|
723
723
|
|
|
724
|
+
/** The model of the block's current pack, as this transaction sees it. */
|
|
725
|
+
public getBlockConfig(blockId: BlockId): BlockConfig {
|
|
726
|
+
return this.getBlockInfo(blockId).config;
|
|
727
|
+
}
|
|
728
|
+
|
|
724
729
|
/** Create a plain JSON resource value from a JS object (no compression). */
|
|
725
730
|
private createJsonFieldValue(obj: unknown): BlockFieldStateValue {
|
|
726
731
|
const value = Buffer.from(JSON.stringify(obj));
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import type { RawPObjectCollection } from "./p_object_collection";
|
|
3
|
+
import { ResultPool } from "./result_pool";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The instability markers the result pool puts on a computable are read outside the middle layer:
|
|
7
|
+
* the MCP server parses `prod_not_locked:<blockId>` and `no_data:<blockId>:<export>` to tell which
|
|
8
|
+
* block above an output waits for (pl-mcp-server `upstreamOfMarker`). These tests pin both
|
|
9
|
+
* strings, so a rename fails here and not, silently, in the server's waits.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* A pool over `blocks` (block id → its prod context) whose computable context records the markers.
|
|
14
|
+
* The constructor is private; the pool reads only `markUnstable` of the context and the contexts
|
|
15
|
+
* of the blocks, so that is all it is given.
|
|
16
|
+
*/
|
|
17
|
+
function poolOver(blocks: Record<string, RawPObjectCollection>) {
|
|
18
|
+
const markers: string[] = [];
|
|
19
|
+
const ctx = { markUnstable: (marker: string) => markers.push(marker) };
|
|
20
|
+
const poolBlocks = new Map(Object.entries(blocks).map(([id, prod]) => [id, { prod }]));
|
|
21
|
+
const pool: ResultPool = Reflect.construct(ResultPool, [ctx, poolBlocks]);
|
|
22
|
+
return { pool, markers };
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
describe("result pool instability markers", () => {
|
|
26
|
+
it("marks an export of an unlocked prod as prod_not_locked:<blockId>", () => {
|
|
27
|
+
const { pool, markers } = poolOver({ up: { locked: false, results: new Map() } });
|
|
28
|
+
expect(pool.getSpecByRef("up", "main")).toBeUndefined();
|
|
29
|
+
expect(markers).toEqual(["prod_not_locked:up"]);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it("marks an export without data yet as no_data:<blockId>:<export>", () => {
|
|
33
|
+
const { pool, markers } = poolOver({
|
|
34
|
+
up: { locked: true, results: new Map([["main", { hasData: true, data: () => undefined }]]) },
|
|
35
|
+
});
|
|
36
|
+
expect(pool.getDataOrErrorByRef("up", "main")).toBeUndefined();
|
|
37
|
+
expect(markers).toEqual(["no_data:up:main"]);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it("gives both markers for an export without data in an unlocked prod", () => {
|
|
41
|
+
const { pool, markers } = poolOver({
|
|
42
|
+
up: { locked: false, results: new Map([["main", { hasData: true, data: () => undefined }]]) },
|
|
43
|
+
});
|
|
44
|
+
pool.getDataOrErrorByRef("up", "main");
|
|
45
|
+
expect(markers).toEqual(["no_data:up:main", "prod_not_locked:up"]);
|
|
46
|
+
});
|
|
47
|
+
});
|
package/src/test/fake_project.ts
CHANGED
|
@@ -19,8 +19,15 @@ import {
|
|
|
19
19
|
/** What a project field holds: a resource, an error, or nothing yet. */
|
|
20
20
|
export type FieldContent = SignedResourceId | { error: SignedResourceId } | "unresolved";
|
|
21
21
|
|
|
22
|
-
/**
|
|
23
|
-
|
|
22
|
+
/**
|
|
23
|
+
* Columns of a result list by name: the spec of each and the cells of its data. `data` says what
|
|
24
|
+
* the column's data field holds: a ready resource (the default), nothing (`missing`), a resource
|
|
25
|
+
* still being calculated (`notReady`) or an error (`failed`).
|
|
26
|
+
*/
|
|
27
|
+
export type Columns = Record<
|
|
28
|
+
string,
|
|
29
|
+
{ spec: PColumnSpec; cells: string[]; data?: "ready" | "missing" | "notReady" | "failed" }
|
|
30
|
+
>;
|
|
24
31
|
|
|
25
32
|
/**
|
|
26
33
|
* State of a result list: `locked` — complete; `open` — more columns may come; `failed` — it has
|
|
@@ -77,6 +84,13 @@ export class FakeProject {
|
|
|
77
84
|
return id;
|
|
78
85
|
}
|
|
79
86
|
|
|
87
|
+
/** Marks a resource made by this project as still being calculated. */
|
|
88
|
+
private notReady(id: SignedResourceId): void {
|
|
89
|
+
const i = this.nodes.findIndex((n) => n.id === id);
|
|
90
|
+
if (i < 0) throw new Error("Not a resource of this project");
|
|
91
|
+
this.nodes[i] = { ...this.nodes[i], resourceReady: false, final: false };
|
|
92
|
+
}
|
|
93
|
+
|
|
80
94
|
/** An error a resource or field can hold. */
|
|
81
95
|
error(message: string): SignedResourceId {
|
|
82
96
|
return this.value("json/resourceError", { message });
|
|
@@ -94,12 +108,14 @@ export class FakeProject {
|
|
|
94
108
|
extend(id: SignedResourceId, columns: Columns, { state }: FrameState): void {
|
|
95
109
|
const fields = this.frameFields.get(id);
|
|
96
110
|
if (fields === undefined) throw new Error("Not a result list of this project");
|
|
97
|
-
for (const [name, { spec, cells }] of Object.entries(columns)) {
|
|
111
|
+
for (const [name, { spec, cells, data: state = "ready" }] of Object.entries(columns)) {
|
|
98
112
|
const data = Object.fromEntries(cells.map((cell, i) => [`["s${i}"]`, cell]));
|
|
99
113
|
fields.push(field("Input", `${name}.spec`, this.value("PColumnSpec", spec)));
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
);
|
|
114
|
+
if (state === "missing") continue;
|
|
115
|
+
const value = this.value("PColumnData/Json", { keyLength: 1, data });
|
|
116
|
+
if (state === "notReady") this.notReady(value);
|
|
117
|
+
if (state === "failed") fields.push(fieldError("Input", `${name}.data`, this.error("boom")));
|
|
118
|
+
else fields.push(field("Input", `${name}.data`, value));
|
|
103
119
|
}
|
|
104
120
|
const error = state === "failed" ? this.error("render failed") : NullSignedResourceId;
|
|
105
121
|
this.nodes.push({
|
|
@@ -198,6 +214,17 @@ function field(type: FieldType, name: string, value: SignedResourceId): FieldDat
|
|
|
198
214
|
return { name, type, value, error: NullSignedResourceId, status: "Resolved", valueIsFinal: true };
|
|
199
215
|
}
|
|
200
216
|
|
|
217
|
+
function fieldError(type: FieldType, name: string, error: SignedResourceId): FieldData {
|
|
218
|
+
return {
|
|
219
|
+
name,
|
|
220
|
+
type,
|
|
221
|
+
value: NullSignedResourceId,
|
|
222
|
+
error,
|
|
223
|
+
status: "Resolved",
|
|
224
|
+
valueIsFinal: true,
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
|
|
201
228
|
function projectField(name: string, content: FieldContent): FieldData {
|
|
202
229
|
if (content === "unresolved") {
|
|
203
230
|
return {
|