@elementumai/edk 0.10.4 → 0.12.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/README.md +49 -13
- package/dist-sdk/src/catalog/token.js +2 -1
- package/dist-sdk/src/core/triggers/on-demand.d.ts +2 -0
- package/dist-sdk/src/core/triggers/on-demand.js +3 -0
- package/dist-sdk/src/core/wire/ref-serializer.js +26 -1
- package/dist-sdk/src/engine/build/context.d.ts +4 -0
- package/dist-sdk/src/engine/coverage-gaps.d.ts +7 -0
- package/dist-sdk/src/engine/coverage-gaps.js +12 -0
- package/dist-sdk/src/engine/ei/json-stream-reader.d.ts +43 -0
- package/dist-sdk/src/engine/ei/json-stream-reader.js +234 -0
- package/dist-sdk/src/engine/ei/run.d.ts +42 -1
- package/dist-sdk/src/engine/ei/run.js +201 -32
- package/dist-sdk/src/engine/ei/saved-plan.d.ts +16 -0
- package/dist-sdk/src/engine/ei/saved-plan.js +19 -0
- package/dist-sdk/src/engine/ei/state.d.ts +1 -1
- package/dist-sdk/src/engine/ei/state.js +17 -4
- package/dist-sdk/src/engine/progress.d.ts +3 -1
- package/dist-sdk/src/engine/progress.js +7 -3
- package/dist-sdk/src/engine/pull/authored-address.d.ts +15 -1
- package/dist-sdk/src/engine/pull/authored-address.js +180 -29
- package/dist-sdk/src/engine/pull/context.d.ts +37 -2
- package/dist-sdk/src/engine/pull/context.js +7 -4
- package/dist-sdk/src/engine/pull/ref-only.d.ts +18 -0
- package/dist-sdk/src/engine/pull/ref-only.js +52 -0
- package/dist-sdk/src/engine/tf/index.d.ts +2 -2
- package/dist-sdk/src/engine/tf/index.js +2 -2
- package/dist-sdk/src/engine/tf/labels.d.ts +22 -0
- package/dist-sdk/src/engine/tf/labels.js +50 -0
- package/dist-sdk/src/engine/tf/model.d.ts +2 -0
- package/dist-sdk/src/engine/tf/model.js +26 -0
- package/dist-sdk/src/engine/validation.d.ts +2 -0
- package/dist-sdk/src/entities/access-policy/from-tf.d.ts +18 -0
- package/dist-sdk/src/entities/access-policy/from-tf.js +58 -24
- package/dist-sdk/src/entities/access-policy/member-list.d.ts +32 -0
- package/dist-sdk/src/entities/access-policy/member-list.js +57 -0
- package/dist-sdk/src/entities/access-policy/module.js +10 -0
- package/dist-sdk/src/entities/access-policy/to-tf.d.ts +4 -3
- package/dist-sdk/src/entities/access-policy/to-tf.js +21 -12
- package/dist-sdk/src/entities/agent/build.js +7 -5
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +2 -0
- package/dist-sdk/src/entities/agent/from-tf.js +13 -3
- package/dist-sdk/src/entities/agent/to-tf.js +11 -5
- package/dist-sdk/src/entities/agent/tools.d.ts +8 -0
- package/dist-sdk/src/entities/agent/tools.js +6 -2
- package/dist-sdk/src/entities/agent-tool/from-tf.d.ts +2 -0
- package/dist-sdk/src/entities/agent-tool/to-tf.d.ts +29 -0
- package/dist-sdk/src/entities/agent-tool/to-tf.js +56 -3
- package/dist-sdk/src/entities/agent-tool/types.d.ts +12 -8
- package/dist-sdk/src/entities/agent-tool/types.js +13 -9
- package/dist-sdk/src/entities/app/build.d.ts +12 -1
- package/dist-sdk/src/entities/app/build.js +80 -4
- package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +5 -7
- package/dist-sdk/src/entities/app/from-tf.js +17 -12
- package/dist-sdk/src/entities/app/stage-keys.d.ts +18 -3
- package/dist-sdk/src/entities/app/stage-keys.js +40 -6
- package/dist-sdk/src/entities/app/to-tf.js +7 -4
- package/dist-sdk/src/entities/automation/build.d.ts +52 -31
- package/dist-sdk/src/entities/automation/build.js +59 -20
- package/dist-sdk/src/entities/automation/deserializer/ast.d.ts +7 -4
- package/dist-sdk/src/entities/automation/deserializer/print-automation.js +39 -14
- package/dist-sdk/src/entities/automation/from-tf.d.ts +35 -2
- package/dist-sdk/src/entities/automation/from-tf.js +721 -93
- package/dist-sdk/src/entities/automation/index.d.ts +1 -1
- package/dist-sdk/src/entities/automation/module.d.ts +22 -2
- package/dist-sdk/src/entities/automation/module.js +244 -57
- package/dist-sdk/src/entities/automation/output-key-wire-name.d.ts +22 -2
- package/dist-sdk/src/entities/automation/output-key-wire-name.js +54 -3
- package/dist-sdk/src/entities/automation/run-target.d.ts +61 -0
- package/dist-sdk/src/entities/automation/run-target.js +104 -0
- package/dist-sdk/src/entities/automation/script-code.d.ts +11 -1
- package/dist-sdk/src/entities/automation/script-code.js +106 -4
- package/dist-sdk/src/entities/automation/script-lint.d.ts +13 -0
- package/dist-sdk/src/entities/automation/script-lint.js +418 -0
- package/dist-sdk/src/entities/automation/task-output-labels.d.ts +17 -1
- package/dist-sdk/src/entities/automation/task-output-labels.js +58 -1
- package/dist-sdk/src/entities/automation/tasks.d.ts +67 -22
- package/dist-sdk/src/entities/automation/tasks.js +18 -4
- package/dist-sdk/src/entities/automation/to-tf.d.ts +1 -3
- package/dist-sdk/src/entities/automation/to-tf.js +354 -64
- package/dist-sdk/src/entities/automation/triggers.d.ts +63 -11
- package/dist-sdk/src/entities/automation/triggers.js +45 -5
- package/dist-sdk/src/entities/automation/types.d.ts +21 -0
- package/dist-sdk/src/entities/automation/types.js +26 -0
- package/dist-sdk/src/entities/chart/build.d.ts +9 -1
- package/dist-sdk/src/entities/chart/from-tf.d.ts +2 -2
- package/dist-sdk/src/entities/chart/from-tf.js +25 -1
- package/dist-sdk/src/entities/chart/index.d.ts +1 -1
- package/dist-sdk/src/entities/chart/printer.js +5 -2
- package/dist-sdk/src/entities/chart/to-tf.js +19 -1
- package/dist-sdk/src/entities/dashboard/from-tf.d.ts +11 -1
- package/dist-sdk/src/entities/dashboard/from-tf.js +57 -7
- package/dist-sdk/src/entities/dashboard/to-tf.js +13 -0
- package/dist-sdk/src/entities/dynamic-layout/build.d.ts +8 -2
- package/dist-sdk/src/entities/dynamic-layout/condition-keys.d.ts +48 -0
- package/dist-sdk/src/entities/dynamic-layout/condition-keys.js +261 -0
- package/dist-sdk/src/entities/dynamic-layout/from-tf.d.ts +3 -0
- package/dist-sdk/src/entities/dynamic-layout/from-tf.js +66 -20
- package/dist-sdk/src/entities/dynamic-layout/module.js +2 -1
- package/dist-sdk/src/entities/dynamic-layout/to-tf.d.ts +4 -2
- package/dist-sdk/src/entities/dynamic-layout/to-tf.js +341 -32
- package/dist-sdk/src/entities/element/build.d.ts +10 -0
- package/dist-sdk/src/entities/element/build.js +1 -0
- package/dist-sdk/src/entities/element/from-tf.js +14 -9
- package/dist-sdk/src/entities/element/to-tf.js +7 -4
- package/dist-sdk/src/entities/field/from-tf.d.ts +24 -0
- package/dist-sdk/src/entities/field/from-tf.js +79 -1
- package/dist-sdk/src/entities/field/module.js +14 -1
- package/dist-sdk/src/entities/field/to-tf.d.ts +38 -3
- package/dist-sdk/src/entities/field/to-tf.js +108 -34
- package/dist-sdk/src/entities/file-reader/module.js +3 -3
- package/dist-sdk/src/entities/file-reader/to-tf.js +3 -3
- package/dist-sdk/src/entities/file-reader/types.d.ts +4 -16
- package/dist-sdk/src/entities/file-reader/types.js +7 -0
- package/dist-sdk/src/entities/org/group.d.ts +1 -0
- package/dist-sdk/src/entities/org/group.js +2 -1
- package/dist-sdk/src/entities/org/role.js +5 -0
- package/dist-sdk/src/entities/record-create-form/from-tf.d.ts +8 -0
- package/dist-sdk/src/entities/record-create-form/from-tf.js +10 -2
- package/dist-sdk/src/entities/record-create-form/to-tf.d.ts +2 -1
- package/dist-sdk/src/entities/record-create-form/to-tf.js +14 -2
- package/dist-sdk/src/entities/relationship/from-tf.d.ts +8 -0
- package/dist-sdk/src/entities/relationship/from-tf.js +88 -10
- package/dist-sdk/src/entities/relationship/to-tf.d.ts +3 -2
- package/dist-sdk/src/entities/relationship/to-tf.js +79 -8
- package/dist-sdk/src/entities/role/from-tf.js +24 -7
- package/dist-sdk/src/entities/role/to-tf.js +25 -7
- package/dist-sdk/src/entities/service-account/from-tf.js +2 -1
- package/dist-sdk/src/entities/service-account/module.js +20 -0
- package/dist-sdk/src/entities/service-account/role-fidelity.d.ts +5 -5
- package/dist-sdk/src/entities/service-account/role-fidelity.js +21 -13
- package/dist-sdk/src/entities/service-account/to-tf.js +12 -4
- package/dist-sdk/src/entities/shared/filters/ast.d.ts +2 -0
- package/dist-sdk/src/entities/shared/filters/tf-codec.d.ts +1 -1
- package/dist-sdk/src/entities/shared/filters/tf-codec.js +12 -7
- package/dist-sdk/src/entities/shared/types/field-types.d.ts +6 -3
- package/dist-sdk/src/entities/shared/types/field-types.js +3 -1
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.d.ts +5 -2
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +8 -1
- package/dist-sdk/src/entities/skill/from-tf.js +10 -3
- package/dist-sdk/src/entities/skill/module.js +18 -0
- package/dist-sdk/src/entities/skill/to-tf.d.ts +8 -1
- package/dist-sdk/src/entities/skill/to-tf.js +23 -14
- package/dist-sdk/src/entities/skill/tools.d.ts +8 -0
- package/dist-sdk/src/entities/skill/tools.js +6 -2
- package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +2 -0
- package/dist-sdk/src/entities/skill-tool/to-tf.d.ts +8 -0
- package/dist-sdk/src/entities/skill-tool/to-tf.js +6 -2
- package/dist-sdk/src/entities/task/to-tf.js +1 -0
- package/dist-sdk/src/entities/view/agent-view-layout-from-tf.d.ts +8 -2
- package/dist-sdk/src/entities/view/agent-view-layout-from-tf.js +20 -10
- package/dist-sdk/src/entities/view/from-tf.d.ts +68 -4
- package/dist-sdk/src/entities/view/from-tf.js +394 -22
- package/dist-sdk/src/entities/view/module.js +20 -0
- package/dist-sdk/src/entities/view/portable.d.ts +11 -0
- package/dist-sdk/src/entities/view/portable.js +47 -0
- package/dist-sdk/src/entities/view/to-tf.d.ts +4 -1
- package/dist-sdk/src/entities/view/to-tf.js +25 -7
- package/dist-sdk/src/entities/view/types.js +1 -1
- package/dist-sdk/src/entities/widget/build.d.ts +4 -3
- package/dist-sdk/src/entities/widget/from-tf.d.ts +3 -0
- package/dist-sdk/src/entities/widget/from-tf.js +100 -3
- package/dist-sdk/src/entities/widget/to-tf.d.ts +16 -1
- package/dist-sdk/src/entities/widget/to-tf.js +77 -14
- package/dist-sdk/src/generated/ragnarok/ragnarok-spec.d.ts +30 -9
- package/dist-sdk/src/generated/ragnarok/ragnarok-spec.js +2 -2
- package/dist-sdk/src/graph/field-resource-types.d.ts +2 -0
- package/dist-sdk/src/graph/field-resource-types.js +11 -0
- package/dist-sdk/src/graph/index.d.ts +41 -3
- package/dist-sdk/src/graph/index.js +24 -2
- package/dist-sdk/src/graph/types.d.ts +195 -5
- package/package.json +1 -1
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
import { type FromTfContext } from "../../engine/pull/context.js";
|
|
9
9
|
import { type FieldOwnerScope, type TfBlock, type TfValue } from "../../engine/tf/index.js";
|
|
10
10
|
import type { NormalizedField } from "../app/deserializer/normalize.js";
|
|
11
|
+
/** Whether one of the owner's own field resources is keyed `fieldKey`; true when the stream can't be listed. */
|
|
12
|
+
export declare function ownerMayHaveCustomField(owner: FieldOwner, fieldKey: string, ctx: FromTfContext): boolean;
|
|
11
13
|
export interface FieldOwner {
|
|
12
14
|
/** The owner's resource type ("elementum_app") — what `object_id` must reference. */
|
|
13
15
|
readonly type: string;
|
|
@@ -18,6 +20,28 @@ export interface FieldOwner {
|
|
|
18
20
|
/** The owner's catalog refName — the `appHandle` of same-owner field RefExprs. */
|
|
19
21
|
readonly refName?: string;
|
|
20
22
|
}
|
|
23
|
+
/** Who owns a field block, by its `object_id` (see {@link fieldBlockOwner}). */
|
|
24
|
+
export type FieldBlockOwner = "own" | "foreign" | "unresolved";
|
|
25
|
+
/**
|
|
26
|
+
* Who owns a field block, read from its `object_id` (#1990): `owner` itself,
|
|
27
|
+
* another app, element or task, or nobody extraction can name. fieldFromTf
|
|
28
|
+
* extracts only blocks whose `object_id` references `owner`; a clone keeps a
|
|
29
|
+
* reference to a field it does not copy only when that field is "foreign".
|
|
30
|
+
* - A bare id is "own" when it is `ownerId` (the owner's platform id, any
|
|
31
|
+
* case) and "foreign" otherwise.
|
|
32
|
+
* - An app, element or task `.id` reference is "own" when it is the owner's
|
|
33
|
+
* resource, and "foreign" for any other resource or another type.
|
|
34
|
+
* - A data lookup of the owner's type is "own" when it finds the owner by
|
|
35
|
+
* the attribute the provider looks it up by (see `dataLookupKey`: an app
|
|
36
|
+
* by namespace, else name; an element by namespace, else name, else
|
|
37
|
+
* handle; a task by name), and "foreign" when that attribute names
|
|
38
|
+
* something else.
|
|
39
|
+
* "unresolved" (fail closed) is a missing `ownerId` for a bare id, a string
|
|
40
|
+
* that is not a platform id, an `object_id` that is not an app, element or
|
|
41
|
+
* task `.id`, or a data lookup whose deciding attribute is missing, not a
|
|
42
|
+
* literal string, or absent from the owner's block.
|
|
43
|
+
*/
|
|
44
|
+
export declare function fieldBlockOwner(objectId: TfValue | undefined, owner: Pick<FieldOwner, "type" | "label">, ctx: FromTfContext, ownerId: string | undefined): FieldBlockOwner;
|
|
21
45
|
/**
|
|
22
46
|
* One field block → its normalized entry; undefined = skipped with a
|
|
23
47
|
* diagnostic (unknown resource type, or a field belonging to a different
|
|
@@ -214,7 +214,7 @@ function selfSystemField(v, owner, ctx) {
|
|
|
214
214
|
};
|
|
215
215
|
}
|
|
216
216
|
/** Whether one of the owner's own field resources is keyed `fieldKey`; true when the stream can't be listed. */
|
|
217
|
-
function ownerMayHaveCustomField(owner, fieldKey, ctx) {
|
|
217
|
+
export function ownerMayHaveCustomField(owner, fieldKey, ctx) {
|
|
218
218
|
if (ctx.resourcesOfType === undefined)
|
|
219
219
|
return true;
|
|
220
220
|
const scope = owner.scope ?? "app";
|
|
@@ -584,6 +584,82 @@ function staticParentLinkageFromTf(value, optionsValue, owner, ctx, where) {
|
|
|
584
584
|
...(optionParentLabels.size > 0 && { optionParentLabels }),
|
|
585
585
|
};
|
|
586
586
|
}
|
|
587
|
+
const FIELD_OWNER_RESOURCE_TYPES = new Set(["elementum_app", "elementum_element", "elementum_task"]);
|
|
588
|
+
const BARE_ASPECT_ID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
589
|
+
/**
|
|
590
|
+
* Who owns a field block, read from its `object_id` (#1990): `owner` itself,
|
|
591
|
+
* another app, element or task, or nobody extraction can name. fieldFromTf
|
|
592
|
+
* extracts only blocks whose `object_id` references `owner`; a clone keeps a
|
|
593
|
+
* reference to a field it does not copy only when that field is "foreign".
|
|
594
|
+
* - A bare id is "own" when it is `ownerId` (the owner's platform id, any
|
|
595
|
+
* case) and "foreign" otherwise.
|
|
596
|
+
* - An app, element or task `.id` reference is "own" when it is the owner's
|
|
597
|
+
* resource, and "foreign" for any other resource or another type.
|
|
598
|
+
* - A data lookup of the owner's type is "own" when it finds the owner by
|
|
599
|
+
* the attribute the provider looks it up by (see `dataLookupKey`: an app
|
|
600
|
+
* by namespace, else name; an element by namespace, else name, else
|
|
601
|
+
* handle; a task by name), and "foreign" when that attribute names
|
|
602
|
+
* something else.
|
|
603
|
+
* "unresolved" (fail closed) is a missing `ownerId` for a bare id, a string
|
|
604
|
+
* that is not a platform id, an `object_id` that is not an app, element or
|
|
605
|
+
* task `.id`, or a data lookup whose deciding attribute is missing, not a
|
|
606
|
+
* literal string, or absent from the owner's block.
|
|
607
|
+
*/
|
|
608
|
+
export function fieldBlockOwner(objectId, owner, ctx, ownerId) {
|
|
609
|
+
if (typeof objectId === "string") {
|
|
610
|
+
if (ownerId === undefined || !BARE_ASPECT_ID.test(objectId))
|
|
611
|
+
return "unresolved";
|
|
612
|
+
return objectId.toLowerCase() === ownerId.toLowerCase() ? "own" : "foreign";
|
|
613
|
+
}
|
|
614
|
+
if (objectId === undefined ||
|
|
615
|
+
!isTfExpr(objectId) ||
|
|
616
|
+
(objectId.$expr !== "resource-attr" && objectId.$expr !== "data-attr") ||
|
|
617
|
+
!FIELD_OWNER_RESOURCE_TYPES.has(objectId.type) ||
|
|
618
|
+
objectId.path.length !== 1 ||
|
|
619
|
+
objectId.path[0] !== "id") {
|
|
620
|
+
return "unresolved";
|
|
621
|
+
}
|
|
622
|
+
if (objectId.type !== owner.type)
|
|
623
|
+
return "foreign";
|
|
624
|
+
if (objectId.$expr === "resource-attr")
|
|
625
|
+
return objectId.label === owner.label ? "own" : "foreign";
|
|
626
|
+
const lookup = ctx.dataAttrs?.(objectId.type, objectId.label);
|
|
627
|
+
const key = dataLookupKey(objectId.type, lookup);
|
|
628
|
+
if (key === undefined)
|
|
629
|
+
return "unresolved";
|
|
630
|
+
const ownValue = ctx.resourceByAddress?.(`${owner.type}.${owner.label}`)?.attrs[key];
|
|
631
|
+
if (typeof ownValue !== "string" || ownValue === "")
|
|
632
|
+
return "unresolved";
|
|
633
|
+
// The provider compares case-insensitively (app, element and task data sources).
|
|
634
|
+
return (lookup?.[key]).toLowerCase() === ownValue.toLowerCase() ? "own" : "foreign";
|
|
635
|
+
}
|
|
636
|
+
/** Each data source's lookup attributes, in the order it tries them. */
|
|
637
|
+
const DATA_LOOKUP_KEYS = new Map([
|
|
638
|
+
// app_data_source.go: namespace when set, else name.
|
|
639
|
+
["elementum_app", ["namespace", "name"]],
|
|
640
|
+
// element_data_source.go: namespace, else name, else handle.
|
|
641
|
+
["elementum_element", ["namespace", "name", "handle"]],
|
|
642
|
+
// task_data_source.go: name only.
|
|
643
|
+
["elementum_task", ["name"]],
|
|
644
|
+
]);
|
|
645
|
+
/**
|
|
646
|
+
* The attribute a `type` data source finds its target by: the first one in
|
|
647
|
+
* the provider's order that has a value. Only an absent, null or literal
|
|
648
|
+
* empty attribute falls through to the next, as in the provider. One that
|
|
649
|
+
* has a value pull cannot read (a `local`, a function call) decides the
|
|
650
|
+
* lookup but cannot be compared, so the result is undefined and the owner
|
|
651
|
+
* check fails closed, as it does when no attribute is set. A display name is
|
|
652
|
+
* compared only when the namespace is unset, since names are not unique.
|
|
653
|
+
*/
|
|
654
|
+
function dataLookupKey(type, attrs) {
|
|
655
|
+
for (const key of DATA_LOOKUP_KEYS.get(type) ?? []) {
|
|
656
|
+
const value = attrs?.[key];
|
|
657
|
+
if (value === undefined || value === null || value === "")
|
|
658
|
+
continue;
|
|
659
|
+
return typeof value === "string" ? key : undefined;
|
|
660
|
+
}
|
|
661
|
+
return undefined;
|
|
662
|
+
}
|
|
587
663
|
/**
|
|
588
664
|
* One field block → its normalized entry; undefined = skipped with a
|
|
589
665
|
* diagnostic (unknown resource type, or a field belonging to a different
|
|
@@ -620,6 +696,8 @@ export function fieldFromTf(block, owner, ctx) {
|
|
|
620
696
|
ctx.diagnostics.push(`${where}: unhandled attribute "${key}" — the export dialect grew; extend fieldFromTf deliberately`);
|
|
621
697
|
}
|
|
622
698
|
}
|
|
699
|
+
// Only an own block is extracted; a clone tells the other owners apart
|
|
700
|
+
// with fieldBlockOwner (#1990).
|
|
623
701
|
const objectLabel = resourceRefLabel(attrs["object_id"], owner.type);
|
|
624
702
|
if (objectLabel !== owner.label) {
|
|
625
703
|
ctx.diagnostics.push(`${where}: object_id does not reference ${owner.type}.${owner.label}; skipped`);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { asNamedRef, namedFactoryEntry } from "../../catalog/render-helpers.js";
|
|
3
3
|
import { NO_CANVAS, NO_CATALOG, NO_DATA, NO_LIFECYCLE } from "../../graph/types.js";
|
|
4
4
|
import { managedFieldOrderStateAdoption } from "./order.js";
|
|
5
|
-
import { FIELD_SUB_TYPES, MANAGED_FIELD_ORDER_RESOURCE_TYPE } from "./types.js";
|
|
5
|
+
import { FIELD_RESOURCE_TYPES, FIELD_SUB_TYPES, MANAGED_FIELD_ORDER_RESOURCE_TYPE } from "./types.js";
|
|
6
6
|
export const FIELD_DATA_RESOURCE_TYPE = "elementum_field";
|
|
7
7
|
export const fieldModule = {
|
|
8
8
|
kind: "field",
|
|
@@ -71,6 +71,19 @@ export const fieldModule = {
|
|
|
71
71
|
}),
|
|
72
72
|
refFromAuthoring: () => undefined,
|
|
73
73
|
},
|
|
74
|
+
roundtrip: {
|
|
75
|
+
referenceAliases: [],
|
|
76
|
+
// A filter on a foreign record's field: the build interpolates the
|
|
77
|
+
// field's lookup (`record.${data.elementum_field.<x>.id}`), the export
|
|
78
|
+
// inlines the field's id (#1701).
|
|
79
|
+
// A field read off a record found in a sibling app/element
|
|
80
|
+
// (`{{task name="record.<field-id>" …}}`) has its lookup declared but not
|
|
81
|
+
// read in state, so the id comes from the managed field (#1839).
|
|
82
|
+
stateResolvedDataLookups: [{
|
|
83
|
+
dataType: FIELD_DATA_RESOURCE_TYPE,
|
|
84
|
+
managedFallback: { resourceTypes: FIELD_RESOURCE_TYPES, matchAttributes: ["name"], ownerAttribute: "object_id" },
|
|
85
|
+
}],
|
|
86
|
+
},
|
|
74
87
|
};
|
|
75
88
|
/**
|
|
76
89
|
* `elementum_managed_field_order` orders an owner's custom fields. Build emits
|
|
@@ -6,11 +6,15 @@
|
|
|
6
6
|
* module never names the owner's resource type.
|
|
7
7
|
*
|
|
8
8
|
* Unsupported authoring shapes degrade through `diagnostics` — reported,
|
|
9
|
-
* never silent
|
|
10
|
-
* non-canonical bag key
|
|
9
|
+
* never silent (plan §4.3). Two shapes are hard errors instead: a
|
|
10
|
+
* non-canonical bag key (it has no well-defined terraform address), and a
|
|
11
|
+
* dynamic Dropdown or Multi-Select `filter` that can't be built (#2309):
|
|
12
|
+
* dropping it would leave the whole field resource out and the plan would
|
|
13
|
+
* destroy the field, so `buildDynamicPicklistConfigAttr` throws (see its
|
|
14
|
+
* `failClosed`).
|
|
11
15
|
*/
|
|
12
16
|
import { type OrgRefLookup, type WorkspaceAspect } from "../../engine/build/context.js";
|
|
13
|
-
import { type FieldOwnerScope, type TfBlock, type TfExpr, type TfValue } from "../../engine/tf/index.js";
|
|
17
|
+
import { type ChildResourceScope, type FieldOwnerScope, type TfBlock, type TfExpr, type TfValue } from "../../engine/tf/index.js";
|
|
14
18
|
import { type PicklistValueWire } from "./options.js";
|
|
15
19
|
/**
|
|
16
20
|
* The authored fields known to belong to an app/element. Maps produced by a
|
|
@@ -128,6 +132,8 @@ export interface FieldToTfOptions {
|
|
|
128
132
|
readonly ownerTfLabel: string;
|
|
129
133
|
/** The owning stream root's refName — needed to detect a self-targeting RELATION field. */
|
|
130
134
|
readonly appRefName: string;
|
|
135
|
+
/** The owning stream root's display name, for errors in the #1780 shape; falls back to `appRefName`. */
|
|
136
|
+
readonly ownerName?: string;
|
|
131
137
|
/** App children use `apps_<ns>_<ns>_`, element children `elements_<ns>_<ns>_`, task children `tasks_<ns>_<ns>_` (edk#1464). */
|
|
132
138
|
readonly scope?: FieldOwnerScope;
|
|
133
139
|
/** The owner's id reference, e.g. `elementum_app.<ns>.id` — computed by the owner's to-tf. */
|
|
@@ -163,4 +169,33 @@ export interface FieldToTfResult {
|
|
|
163
169
|
export declare function claimFieldDisplayName(seen: Map<string, string>, field: FieldToTfResult): void;
|
|
164
170
|
export declare function fieldToTf(typeKey: string, inner: FieldInnerWire, opts: FieldToTfOptions): FieldToTfResult | undefined;
|
|
165
171
|
export declare function fieldRefToTfValue(fieldType: string, refName: string, ownerTfLabel: string, scope?: FieldOwnerScope, fieldOwnership?: FieldOwnership): TfExpr | undefined;
|
|
172
|
+
/**
|
|
173
|
+
* Why build leaves out an entry: its field reference has no field in source
|
|
174
|
+
* and no platform id (#1966, #1978). The gaps below state what apply then
|
|
175
|
+
* does, not the generic "the platform keeps its current value".
|
|
176
|
+
*/
|
|
177
|
+
export declare const UNRESOLVED_FIELD_REF = "field reference is unresolved (skipped during extract)";
|
|
178
|
+
/**
|
|
179
|
+
* Why build can't reference `refName` on another app or element of this
|
|
180
|
+
* workspace by its resource (#1966): that root's source has no such custom
|
|
181
|
+
* field, because its pull did not extract it or it was removed, so its
|
|
182
|
+
* resource address would name a resource no block declares and fail plan for
|
|
183
|
+
* the whole workspace. Callers look the field up by name instead, the way the
|
|
184
|
+
* export did; they report this reason only when the ref has no name to look
|
|
185
|
+
* it up by. Undefined when the root's fields are unknown, when `refName` is
|
|
186
|
+
* one of them, or when it is a system field.
|
|
187
|
+
*/
|
|
188
|
+
export declare function unauthoredSiblingFieldRef(refName: string, sibling: {
|
|
189
|
+
readonly kind: ChildResourceScope;
|
|
190
|
+
readonly refName: string;
|
|
191
|
+
readonly fieldOwnership?: FieldOwnership;
|
|
192
|
+
}): string | undefined;
|
|
193
|
+
/** A field ref's name, when it has one build can look the field up by. */
|
|
194
|
+
export declare function fieldLookupName(value: {
|
|
195
|
+
readonly name?: string;
|
|
196
|
+
}): string | undefined;
|
|
197
|
+
/** A dropped entry of `holder` (e.g. "dynamic layout"): apply removes it from the platform (#1978). */
|
|
198
|
+
export declare function droppedEntryGap(where: string, detail: string, holder: string): string;
|
|
199
|
+
/** A whole `resource` (e.g. "relationship") build leaves out: if it is already managed, plan destroys it (#1978). */
|
|
200
|
+
export declare function skippedResourceGap(where: string, detail: string, resource: string): string;
|
|
166
201
|
export {};
|
|
@@ -6,10 +6,15 @@
|
|
|
6
6
|
* module never names the owner's resource type.
|
|
7
7
|
*
|
|
8
8
|
* Unsupported authoring shapes degrade through `diagnostics` — reported,
|
|
9
|
-
* never silent
|
|
10
|
-
* non-canonical bag key
|
|
9
|
+
* never silent (plan §4.3). Two shapes are hard errors instead: a
|
|
10
|
+
* non-canonical bag key (it has no well-defined terraform address), and a
|
|
11
|
+
* dynamic Dropdown or Multi-Select `filter` that can't be built (#2309):
|
|
12
|
+
* dropping it would leave the whole field resource out and the plan would
|
|
13
|
+
* destroy the field, so `buildDynamicPicklistConfigAttr` throws (see its
|
|
14
|
+
* `failClosed`).
|
|
11
15
|
*/
|
|
12
16
|
import { EntityTfError } from "../../engine/entity.js";
|
|
17
|
+
import { typedCoverageGap } from "../../engine/coverage-gaps.js";
|
|
13
18
|
import { workspaceAspectKey } from "../../engine/build/context.js";
|
|
14
19
|
import { expr, isCanonicalTsLabel, sanitizeName, scopedResourceLabel, snakeSlug, tsLabelToTfLabel } from "../../engine/tf/index.js";
|
|
15
20
|
import { SYSTEM_FIELD_KEY_SET, systemFieldTag } from "../../core/system-fields.js";
|
|
@@ -270,7 +275,7 @@ function stageOrgRefs(real) {
|
|
|
270
275
|
* and committed only once the ENTIRE config resolves — an early `undefined`
|
|
271
276
|
* return anywhere below leaves no orphaned `data.tf` block behind.
|
|
272
277
|
*/
|
|
273
|
-
function buildDynamicPicklistConfigAttr(cfg, opts, where, typeKey) {
|
|
278
|
+
function buildDynamicPicklistConfigAttr(cfg, opts, where, typeKey, field) {
|
|
274
279
|
if (cfg.relatedAspectId === undefined || cfg.relatedLabelFieldId === undefined) {
|
|
275
280
|
opts.diagnostics.push(`${where}: dynamic picklist config requires relatedAspectId and relatedLabelFieldId; dropped`);
|
|
276
281
|
return undefined;
|
|
@@ -334,6 +339,23 @@ function buildDynamicPicklistConfigAttr(cfg, opts, where, typeKey) {
|
|
|
334
339
|
if (cfg.valuesRenderType !== undefined)
|
|
335
340
|
attrs["values_render_type"] = cfg.valuesRenderType;
|
|
336
341
|
if (cfg.filter !== undefined) {
|
|
342
|
+
// A filter build can't resolve fails the build instead of dropping the
|
|
343
|
+
// whole dynamic config (#2309): without it the field resource is left
|
|
344
|
+
// out and plan destroys the field (the #1978 rule). Pull never prints
|
|
345
|
+
// such a filter: it blocks a filter it can't reconstruct
|
|
346
|
+
// (field/from-tf.ts blockReplaceForcingDrop) and keeps an unextracted
|
|
347
|
+
// field as its platform id.
|
|
348
|
+
const diagnosticsBefore = opts.diagnostics.length;
|
|
349
|
+
const failClosed = (reason) => {
|
|
350
|
+
const resolverNotes = opts.diagnostics.slice(diagnosticsBefore).map((note) => `\n - ${note.replace(/; dropped$/, "")}`).join("");
|
|
351
|
+
// Same shape as the authoring error (#1780): owner kind and name,
|
|
352
|
+
// `fields.<key>`, display name and type; build adds the source file.
|
|
353
|
+
throw new EntityTfError(`${opts.scope ?? "app"} ${JSON.stringify(opts.ownerName ?? opts.appRefName)} fields.${field.bagKey} ` +
|
|
354
|
+
`(${JSON.stringify(field.name)}, dynamic ${typeKey === "multiPicklist" ? "Multi-Select" : "Dropdown"}): ` +
|
|
355
|
+
`config.dynamic.filter ${reason}.${resolverNotes}\n` +
|
|
356
|
+
"Building would drop this field's dynamic config and the plan would destroy the field; " +
|
|
357
|
+
"fix or remove the filter's ref (#2309).");
|
|
358
|
+
};
|
|
337
359
|
let unresolvedField = false;
|
|
338
360
|
const owner = {
|
|
339
361
|
value: opts.objectId,
|
|
@@ -342,40 +364,42 @@ function buildDynamicPicklistConfigAttr(cfg, opts, where, typeKey) {
|
|
|
342
364
|
target: { kind: opts.scope ?? "app", tfLabel: opts.ownerTfLabel },
|
|
343
365
|
fieldOwnership: opts.fieldOwnership,
|
|
344
366
|
};
|
|
367
|
+
const filter = cfg.filter;
|
|
368
|
+
const buildFilter = () => filterWireToTfCodec(filter, {
|
|
369
|
+
recordField: (token) => {
|
|
370
|
+
const value = resolveFieldOnObject(token, owner, opts_, where, "filter record field");
|
|
371
|
+
if (value === undefined) {
|
|
372
|
+
unresolvedField = true;
|
|
373
|
+
return "";
|
|
374
|
+
}
|
|
375
|
+
return value;
|
|
376
|
+
},
|
|
377
|
+
recordFieldOwner: () => opts.objectId,
|
|
378
|
+
field: (token) => {
|
|
379
|
+
const value = resolveFieldOnObject(token, resolvedObject, opts_, where, "filter field");
|
|
380
|
+
if (value === undefined) {
|
|
381
|
+
// resolveFieldOnObject already pushed a diagnostic — this
|
|
382
|
+
// placeholder only satisfies the codec's TfValue return type
|
|
383
|
+
// long enough to unwind via the unresolvedField check below.
|
|
384
|
+
unresolvedField = true;
|
|
385
|
+
return "";
|
|
386
|
+
}
|
|
387
|
+
return value;
|
|
388
|
+
},
|
|
389
|
+
reference: () => {
|
|
390
|
+
throw new EntityTfError(`${where}: dynamic picklist filter does not support value references`);
|
|
391
|
+
},
|
|
392
|
+
});
|
|
393
|
+
let filterValue;
|
|
345
394
|
try {
|
|
346
|
-
|
|
347
|
-
recordField: (token) => {
|
|
348
|
-
const value = resolveFieldOnObject(token, owner, opts_, where, "filter record field");
|
|
349
|
-
if (value === undefined) {
|
|
350
|
-
unresolvedField = true;
|
|
351
|
-
return "";
|
|
352
|
-
}
|
|
353
|
-
return value;
|
|
354
|
-
},
|
|
355
|
-
recordFieldOwner: () => opts.objectId,
|
|
356
|
-
field: (token) => {
|
|
357
|
-
const value = resolveFieldOnObject(token, resolvedObject, opts_, where, "filter field");
|
|
358
|
-
if (value === undefined) {
|
|
359
|
-
// resolveFieldOnObject already pushed a diagnostic — this
|
|
360
|
-
// placeholder only satisfies the codec's TfValue return type
|
|
361
|
-
// long enough to unwind via the unresolvedField check below.
|
|
362
|
-
unresolvedField = true;
|
|
363
|
-
return "";
|
|
364
|
-
}
|
|
365
|
-
return value;
|
|
366
|
-
},
|
|
367
|
-
reference: () => {
|
|
368
|
-
throw new EntityTfError(`${where}: dynamic picklist filter does not support value references`);
|
|
369
|
-
},
|
|
370
|
-
});
|
|
371
|
-
if (unresolvedField)
|
|
372
|
-
return undefined;
|
|
373
|
-
attrs["filter"] = filterValue;
|
|
395
|
+
filterValue = buildFilter();
|
|
374
396
|
}
|
|
375
397
|
catch (e) {
|
|
376
|
-
|
|
377
|
-
return undefined;
|
|
398
|
+
failClosed(`can't be built: ${e instanceof Error ? e.message : String(e)}`);
|
|
378
399
|
}
|
|
400
|
+
if (unresolvedField)
|
|
401
|
+
failClosed("names a field build can't resolve");
|
|
402
|
+
attrs["filter"] = filterValue;
|
|
379
403
|
}
|
|
380
404
|
if (cfg.sort !== undefined) {
|
|
381
405
|
const sort = resolveDynamicPicklistSort(cfg.sort, resolvedObject, opts, where);
|
|
@@ -648,7 +672,7 @@ export function fieldToTf(typeKey, inner, opts) {
|
|
|
648
672
|
}
|
|
649
673
|
if (subType.hasOptions === true && inner.config?.dynamic !== undefined) {
|
|
650
674
|
const where = `field "${name}"`;
|
|
651
|
-
const dynamicConfig = buildDynamicPicklistConfigAttr(inner.config.dynamic, opts, where, typeKey);
|
|
675
|
+
const dynamicConfig = buildDynamicPicklistConfigAttr(inner.config.dynamic, opts, where, typeKey, { bagKey, name });
|
|
652
676
|
if (dynamicConfig === undefined)
|
|
653
677
|
return undefined;
|
|
654
678
|
attrs["dynamic_config"] = dynamicConfig;
|
|
@@ -873,3 +897,53 @@ export function fieldRefToTfValue(fieldType, refName, ownerTfLabel, scope = "app
|
|
|
873
897
|
return undefined;
|
|
874
898
|
return expr.resourceAttr(subType.resourceType, scopedResourceLabel(ownerTfLabel, tsLabelToTfLabel(refName), scope), ["id"]);
|
|
875
899
|
}
|
|
900
|
+
/**
|
|
901
|
+
* Why build leaves out an entry: its field reference has no field in source
|
|
902
|
+
* and no platform id (#1966, #1978). The gaps below state what apply then
|
|
903
|
+
* does, not the generic "the platform keeps its current value".
|
|
904
|
+
*/
|
|
905
|
+
export const UNRESOLVED_FIELD_REF = "field reference is unresolved (skipped during extract)";
|
|
906
|
+
/**
|
|
907
|
+
* Why build can't reference `refName` on another app or element of this
|
|
908
|
+
* workspace by its resource (#1966): that root's source has no such custom
|
|
909
|
+
* field, because its pull did not extract it or it was removed, so its
|
|
910
|
+
* resource address would name a resource no block declares and fail plan for
|
|
911
|
+
* the whole workspace. Callers look the field up by name instead, the way the
|
|
912
|
+
* export did; they report this reason only when the ref has no name to look
|
|
913
|
+
* it up by. Undefined when the root's fields are unknown, when `refName` is
|
|
914
|
+
* one of them, or when it is a system field.
|
|
915
|
+
*/
|
|
916
|
+
export function unauthoredSiblingFieldRef(refName, sibling) {
|
|
917
|
+
if (sibling.fieldOwnership === undefined || sibling.fieldOwnership.has(refName))
|
|
918
|
+
return undefined;
|
|
919
|
+
const systemField = sibling.kind === "element"
|
|
920
|
+
? ELEMENT_SYSTEM_FIELD_KEY_SET.has(refName)
|
|
921
|
+
: SYSTEM_FIELD_KEY_SET.has(refName);
|
|
922
|
+
if (systemField)
|
|
923
|
+
return undefined;
|
|
924
|
+
const owner = `${sibling.kind} "${sibling.refName}"`;
|
|
925
|
+
return `field "${refName}" is not in the source of ${owner} (its pull did not extract it, or it was removed) ` +
|
|
926
|
+
`and the reference has no name to look it up by; add the field to ${owner}'s source, or re-pull ${owner}`;
|
|
927
|
+
}
|
|
928
|
+
/** A field ref's name, when it has one build can look the field up by. */
|
|
929
|
+
export function fieldLookupName(value) {
|
|
930
|
+
return value.name !== undefined && value.name.trim() !== "" ? value.name : undefined;
|
|
931
|
+
}
|
|
932
|
+
/** A dropped entry of `holder` (e.g. "dynamic layout"): apply removes it from the platform (#1978). */
|
|
933
|
+
export function droppedEntryGap(where, detail, holder) {
|
|
934
|
+
return typedCoverageGap({
|
|
935
|
+
kind: "dropped",
|
|
936
|
+
entity: where,
|
|
937
|
+
detail,
|
|
938
|
+
consequence: `the entry is not built, so apply removes it from the ${holder} on the platform if it is there`,
|
|
939
|
+
});
|
|
940
|
+
}
|
|
941
|
+
/** A whole `resource` (e.g. "relationship") build leaves out: if it is already managed, plan destroys it (#1978). */
|
|
942
|
+
export function skippedResourceGap(where, detail, resource) {
|
|
943
|
+
return typedCoverageGap({
|
|
944
|
+
kind: "skipped",
|
|
945
|
+
entity: where,
|
|
946
|
+
detail,
|
|
947
|
+
consequence: `the ${resource} is not built; if it is already managed, plan destroys it and apply deletes it from the platform`,
|
|
948
|
+
});
|
|
949
|
+
}
|
|
@@ -4,7 +4,7 @@ import { NO_CANVAS, } from "../../graph/types.js";
|
|
|
4
4
|
import { printFileReader } from "./deserializer/print-file-reader.js";
|
|
5
5
|
import { fileReaderFromTf } from "./from-tf.js";
|
|
6
6
|
import { fileReaderToTf } from "./to-tf.js";
|
|
7
|
-
import { ALL_FILE_READER_RESOURCE_TYPES, FILE_READER_SUB_TYPES } from "./types.js";
|
|
7
|
+
import { ALL_FILE_READER_RESOURCE_TYPES, FILE_READER_BAG, FILE_READER_SUB_TYPES } from "./types.js";
|
|
8
8
|
function isConfigured(value) {
|
|
9
9
|
return (typeof value === "object" &&
|
|
10
10
|
value !== null &&
|
|
@@ -79,7 +79,7 @@ function extractFileReaders(ownBlocks, _stream, ctx) {
|
|
|
79
79
|
export const fileReaderModule = {
|
|
80
80
|
kind: "file-reader",
|
|
81
81
|
stream: { role: "streamMember" },
|
|
82
|
-
authoring: { unit: "ownFile", bag:
|
|
82
|
+
authoring: { unit: "ownFile", bag: FILE_READER_BAG },
|
|
83
83
|
parents: [{ parent: "app", child: "file-reader" }, { parent: "element", child: "file-reader" }],
|
|
84
84
|
resource: {
|
|
85
85
|
shape: "subTypes",
|
|
@@ -106,7 +106,7 @@ export const fileReaderModule = {
|
|
|
106
106
|
catalog: {
|
|
107
107
|
participates: true,
|
|
108
108
|
refKind: "documentModel",
|
|
109
|
-
catalogBag:
|
|
109
|
+
catalogBag: FILE_READER_BAG,
|
|
110
110
|
renderOrder: 55,
|
|
111
111
|
catalogRoot: "app",
|
|
112
112
|
factoryName: "documentModelRef",
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
* `skill/to-tf.ts`'s shape for a single-resource own-file kind.
|
|
5
5
|
*/
|
|
6
6
|
import { EntityTfError } from "../../engine/entity.js";
|
|
7
|
-
import {
|
|
7
|
+
import { expr } from "../../engine/tf/index.js";
|
|
8
8
|
import { APP_RESOURCE_TYPE } from "../app/module.js";
|
|
9
|
-
import { FILE_READER_SUB_TYPE_BY_TYPE_KEY } from "./types.js";
|
|
9
|
+
import { FILE_READER_SUB_TYPE_BY_TYPE_KEY, fileReaderResourceLabel } from "./types.js";
|
|
10
10
|
function serializeStructureField(f) {
|
|
11
11
|
switch (f.type) {
|
|
12
12
|
case "text":
|
|
@@ -65,7 +65,7 @@ export function fileReaderToTf(entity, ctx) {
|
|
|
65
65
|
if (subType === undefined || subType.implemented !== true) {
|
|
66
66
|
throw new EntityTfError(`file reader "${entity.refName}": type "${payload.type}" does not build on the terraform path yet`);
|
|
67
67
|
}
|
|
68
|
-
const tfLabel =
|
|
68
|
+
const tfLabel = fileReaderResourceLabel(ctx.appTfLabel, entity.refName);
|
|
69
69
|
const attrs = {
|
|
70
70
|
app_id: expr.resourceAttr(APP_RESOURCE_TYPE, ctx.appTfLabel, ["id"]),
|
|
71
71
|
name: payload.name,
|
|
@@ -1,19 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The file-reader entity's sub-type table. Five platform resource types share
|
|
3
|
-
* one ownership shape (app-scoped, own-file, one `.ts` per instance):
|
|
4
|
-
* `elementum_excel_file_reader`, `elementum_json_file_reader`,
|
|
5
|
-
* `elementum_text_file_reader`, `elementum_xml_file_reader`, and
|
|
6
|
-
* `elementum_ai_file_reader` — exactly the `entities/field/types.ts` /
|
|
7
|
-
* `entities/agent-tool/types.ts` pattern, one ROW per sub-type.
|
|
8
|
-
*
|
|
9
|
-
* All five variants are implemented. excel/json/text are the three
|
|
10
|
-
* `elementum_file_reader_task.file_reader_id` accepts (the provider's own
|
|
11
|
-
* schema docs say so explicitly); `ai` backs `elementum_ai_file_read_task`
|
|
12
|
-
* instead (see `entities/automation/types.ts`'s `aiFileAnalysis` row) — a
|
|
13
|
-
* live capture also confirms a plain `elementum_file_reader_task` can
|
|
14
|
-
* reference one. XML shares JSON's recursive structure dialect under the
|
|
15
|
-
* provider's `values` attribute.
|
|
16
|
-
*/
|
|
17
1
|
export interface FileReaderSubType {
|
|
18
2
|
/** The authoring `type` discriminant (`FileReaderOptions.type`). */
|
|
19
3
|
readonly typeKey: "excel" | "json" | "text" | "xml" | "ai";
|
|
@@ -31,3 +15,7 @@ export declare const FILE_READER_SUB_TYPE_BY_RESOURCE: ReadonlyMap<string, FileR
|
|
|
31
15
|
export declare const IMPLEMENTED_FILE_READER_RESOURCE_TYPES: readonly string[];
|
|
32
16
|
/** Every declared file-reader resource type — stream partition recognizes these by name. */
|
|
33
17
|
export declare const ALL_FILE_READER_RESOURCE_TYPES: readonly string[];
|
|
18
|
+
/** Own-file bag (`apps/<ref>/fileReaders/<refName>.ts`) and catalog bag. */
|
|
19
|
+
export declare const FILE_READER_BAG = "fileReaders";
|
|
20
|
+
/** The Terraform label build gives an app's file reader `refName`. */
|
|
21
|
+
export declare function fileReaderResourceLabel(ownerTfLabel: string, refName: string): string;
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
* reference one. XML shares JSON's recursive structure dialect under the
|
|
15
15
|
* provider's `values` attribute.
|
|
16
16
|
*/
|
|
17
|
+
import { appScopedResourceLabel, tsLabelToTfLabel } from "../../engine/tf/labels.js";
|
|
17
18
|
export const FILE_READER_SUB_TYPES = [
|
|
18
19
|
{ typeKey: "excel", resourceType: "elementum_excel_file_reader", implemented: true, unreadableAttributes: ["document_content", "document_name", "file_type"] },
|
|
19
20
|
{ typeKey: "json", resourceType: "elementum_json_file_reader", implemented: true },
|
|
@@ -27,3 +28,9 @@ export const FILE_READER_SUB_TYPE_BY_RESOURCE = new Map(FILE_READER_SUB_TYPES.ma
|
|
|
27
28
|
export const IMPLEMENTED_FILE_READER_RESOURCE_TYPES = FILE_READER_SUB_TYPES.filter((t) => t.implemented === true).map((t) => t.resourceType);
|
|
28
29
|
/** Every declared file-reader resource type — stream partition recognizes these by name. */
|
|
29
30
|
export const ALL_FILE_READER_RESOURCE_TYPES = FILE_READER_SUB_TYPES.map((t) => t.resourceType);
|
|
31
|
+
/** Own-file bag (`apps/<ref>/fileReaders/<refName>.ts`) and catalog bag. */
|
|
32
|
+
export const FILE_READER_BAG = "fileReaders";
|
|
33
|
+
/** The Terraform label build gives an app's file reader `refName`. */
|
|
34
|
+
export function fileReaderResourceLabel(ownerTfLabel, refName) {
|
|
35
|
+
return appScopedResourceLabel(ownerTfLabel, tsLabelToTfLabel(refName));
|
|
36
|
+
}
|
|
@@ -2,4 +2,5 @@
|
|
|
2
2
|
import { type EntityKindModule } from "../../graph/types.js";
|
|
3
3
|
/** org.ts / OrgRefLookup bag — keep in lockstep with `data.orgBag`. */
|
|
4
4
|
export declare const GROUP_ORG_BAG: "groups";
|
|
5
|
+
export declare const GROUP_RESOURCE_TYPE = "elementum_group";
|
|
5
6
|
export declare const groupModule: EntityKindModule;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { namedOnlyFactoryEntry } from "../../catalog/render-helpers.js";
|
|
3
3
|
/** org.ts / OrgRefLookup bag — keep in lockstep with `data.orgBag`. */
|
|
4
4
|
export const GROUP_ORG_BAG = "groups";
|
|
5
|
+
export const GROUP_RESOURCE_TYPE = "elementum_group";
|
|
5
6
|
export const groupModule = {
|
|
6
7
|
kind: "group",
|
|
7
8
|
stream: { role: "streamMember" },
|
|
@@ -23,7 +24,7 @@ export const groupModule = {
|
|
|
23
24
|
},
|
|
24
25
|
authoring: { unit: "inline", bag: "groups" },
|
|
25
26
|
parents: [{ parent: "org", child: "group" }],
|
|
26
|
-
resource: { shape: "single", resourceType:
|
|
27
|
+
resource: { shape: "single", resourceType: GROUP_RESOURCE_TYPE, adoptable: true },
|
|
27
28
|
lifecycle: { participates: true },
|
|
28
29
|
canvas: { participates: true, label: "Groups", glyph: "◎", component: "orgIdentity" },
|
|
29
30
|
catalog: {
|
|
@@ -20,5 +20,10 @@ export const roleModule = {
|
|
|
20
20
|
lifecycle: NO_LIFECYCLE,
|
|
21
21
|
canvas: NO_CANVAS,
|
|
22
22
|
catalog: NO_CATALOG,
|
|
23
|
+
roundtrip: {
|
|
24
|
+
referenceAliases: [],
|
|
25
|
+
// Provider set attributes (edk#2437): order carries no meaning.
|
|
26
|
+
unorderedListAttributes: ["user_ids", "group_ids", "service_account_ids"],
|
|
27
|
+
},
|
|
23
28
|
};
|
|
24
29
|
export const ROLE_RESOURCE_TYPE = "elementum_role";
|
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
import { type FromTfContext } from "../../engine/pull/context.js";
|
|
2
2
|
import { type ChildResourceScope, type TfBlock } from "../../engine/tf/index.js";
|
|
3
3
|
import type { NormalizedRecordCreateForm } from "../app/deserializer/normalize.js";
|
|
4
|
+
import { type UnextractedFieldOwner } from "../view/from-tf.js";
|
|
4
5
|
export interface RecordCreateFormOwner {
|
|
5
6
|
readonly type: string;
|
|
6
7
|
readonly label: string;
|
|
8
|
+
/**
|
|
9
|
+
* The owner's TF label (`preston_high`), which its child resource labels
|
|
10
|
+
* carry. Never the camelCase ref: the two differ once the label has an
|
|
11
|
+
* underscore (#2046).
|
|
12
|
+
*/
|
|
7
13
|
readonly ownerTfLabel: string;
|
|
8
14
|
readonly scope: ChildResourceScope;
|
|
15
|
+
/** The owner's extracted fields, so a field pull did not extract keeps its platform id (#1966). */
|
|
16
|
+
readonly unextracted?: UnextractedFieldOwner;
|
|
9
17
|
}
|
|
10
18
|
/** Provider resource -> id-free normalized create-form authoring. */
|
|
11
19
|
export declare function recordCreateFormFromTf(block: TfBlock | undefined, owner: RecordCreateFormOwner, ctx: FromTfContext): NormalizedRecordCreateForm | undefined;
|
|
@@ -2,6 +2,7 @@ import { optionalString, plainObject, resourceRefLabel } from "../../engine/pull
|
|
|
2
2
|
import { reportUnknownAttrs } from "../../engine/pull/attrs.js";
|
|
3
3
|
import { scopedLabelToBagKey, tfLabelToTsLabel } from "../../engine/tf/index.js";
|
|
4
4
|
import { fieldKeyFromTfValue } from "../field/from-tf.js";
|
|
5
|
+
import { unextractedFieldRefId } from "../view/from-tf.js";
|
|
5
6
|
import { RECORD_CREATE_FORM_RESOURCE_TYPE } from "./module.js";
|
|
6
7
|
const KNOWN_ATTRS = new Set(["app_id", "sections"]);
|
|
7
8
|
const KNOWN_SECTION_ATTRS = new Set([
|
|
@@ -45,8 +46,15 @@ function sectionFromTf(raw, index, formWhere, owner, ctx) {
|
|
|
45
46
|
return undefined;
|
|
46
47
|
}
|
|
47
48
|
const fields = [];
|
|
48
|
-
for (const fieldId of fieldIds) {
|
|
49
|
-
|
|
49
|
+
for (const [fieldIndex, fieldId] of fieldIds.entries()) {
|
|
50
|
+
// Field resource labels carry the owner's TF label (`apps_<label>_<label>_…`),
|
|
51
|
+
// not its camelCase name (#1978).
|
|
52
|
+
const resolved = fieldKeyFromTfValue(fieldId, tfLabelToTsLabel(owner.label), owner.label, owner.scope, ctx);
|
|
53
|
+
// A field pull did not extract keeps its platform id: its key would print
|
|
54
|
+
// as nothing and crash build (#1966). With no id the pull fails (#1978).
|
|
55
|
+
const key = owner.unextracted === undefined
|
|
56
|
+
? resolved
|
|
57
|
+
: unextractedFieldRefId(fieldId, resolved, owner.unextracted, ctx, `${formWhere}.sections[${index}].field_ids[${fieldIndex}]`);
|
|
50
58
|
if (key === undefined) {
|
|
51
59
|
ctx.diagnostics.push(`${where}: field_ids entry ${JSON.stringify(fieldId)} is not a known field reference; dropped`);
|
|
52
60
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type ChildResourceScope, type TfBlock, type TfValue } from "../../engine/tf/index.js";
|
|
2
|
-
|
|
2
|
+
import { type UnsafePlatformId } from "../../core/platform-id.js";
|
|
3
|
+
export type RecordCreateFormFieldRefWire = string | UnsafePlatformId | {
|
|
3
4
|
readonly refName?: string;
|
|
4
5
|
readonly fieldType?: string;
|
|
5
6
|
readonly parent?: string;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { expr, isCanonicalTsLabel, scopedResourceLabel, tsLabelToTfLabel, } from "../../engine/tf/index.js";
|
|
2
|
-
import {
|
|
2
|
+
import { isUnsafePlatformId } from "../../core/platform-id.js";
|
|
3
|
+
import { droppedEntryGap, fieldRefToTfValue, UNRESOLVED_FIELD_REF } from "../field/to-tf.js";
|
|
3
4
|
import { SUB_TYPE_BY_AUTHORING_TYPE } from "../field/types.js";
|
|
4
5
|
import { SYSTEM_FIELD_ID_ATTR_BY_KEY } from "../view/types.js";
|
|
5
6
|
import { RECORD_CREATE_FORM_RESOURCE_TYPE } from "./module.js";
|
|
@@ -55,7 +56,18 @@ export function recordCreateFormToTf(form, opts) {
|
|
|
55
56
|
}
|
|
56
57
|
function resolveFields(refs, where, opts) {
|
|
57
58
|
const out = [];
|
|
58
|
-
for (const ref of refs) {
|
|
59
|
+
for (const [index, ref] of refs.entries()) {
|
|
60
|
+
// A field pull did not extract stays as its platform id (#1736, #1966).
|
|
61
|
+
if (isUnsafePlatformId(ref)) {
|
|
62
|
+
out.push(ref.value);
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
// Pulled source prints `undefined as any` for a field pull skipped with
|
|
66
|
+
// no id; report it instead of crashing on it (#1966).
|
|
67
|
+
if (typeof ref !== "string" && (ref === null || typeof ref !== "object")) {
|
|
68
|
+
opts.diagnostics.push(droppedEntryGap(`${where}.fields[${index}]`, `${UNRESOLVED_FIELD_REF}; dropped`, "record create form"));
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
59
71
|
if (typeof ref === "string") {
|
|
60
72
|
const attr = SYSTEM_FIELD_ID_ATTR_BY_KEY.get(ref);
|
|
61
73
|
if (attr === undefined)
|