@elementumai/edk 0.11.0 → 0.13.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 +40 -6
- package/dist-sdk/src/catalog/factories.d.ts +7 -1
- package/dist-sdk/src/catalog/factories.js +2 -0
- package/dist-sdk/src/catalog/index.d.ts +2 -2
- package/dist-sdk/src/catalog/index.js +1 -1
- package/dist-sdk/src/catalog/org.js +79 -34
- package/dist-sdk/src/catalog/token.js +5 -0
- package/dist-sdk/src/catalog/types.d.ts +7 -1
- package/dist-sdk/src/catalog/types.js +3 -0
- package/dist-sdk/src/core/system-fields.d.ts +1 -1
- package/dist-sdk/src/core/system-fields.js +1 -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/types/app.d.ts +6 -0
- package/dist-sdk/src/engine/build/context.d.ts +3 -0
- package/dist-sdk/src/engine/coverage-gaps.d.ts +5 -0
- package/dist-sdk/src/engine/coverage-gaps.js +9 -0
- package/dist-sdk/src/engine/ei/run.d.ts +20 -1
- package/dist-sdk/src/engine/ei/run.js +102 -14
- package/dist-sdk/src/engine/pull/authored-address.js +42 -6
- package/dist-sdk/src/engine/pull/authored-root.d.ts +88 -0
- package/dist-sdk/src/engine/pull/authored-root.js +306 -0
- package/dist-sdk/src/engine/pull/context.d.ts +10 -0
- package/dist-sdk/src/engine/pull/field-refs-registry.d.ts +114 -0
- package/dist-sdk/src/engine/pull/field-refs-registry.js +501 -0
- package/dist-sdk/src/engine/pull/org.d.ts +1 -0
- package/dist-sdk/src/engine/pull/org.js +2 -0
- package/dist-sdk/src/engine/pull/partition.d.ts +8 -0
- package/dist-sdk/src/engine/pull/partition.js +43 -0
- package/dist-sdk/src/engine/pull/pulled-roots.d.ts +89 -0
- package/dist-sdk/src/engine/pull/pulled-roots.js +203 -0
- package/dist-sdk/src/engine/pull/ref-only.d.ts +22 -0
- package/dist-sdk/src/engine/pull/ref-only.js +59 -1
- package/dist-sdk/src/engine/pull/source-resources.d.ts +39 -0
- package/dist-sdk/src/engine/pull/source-resources.js +110 -0
- package/dist-sdk/src/engine/pull/stream-root.d.ts +148 -0
- package/dist-sdk/src/engine/pull/stream-root.js +563 -0
- package/dist-sdk/src/engine/workspace/reserved-catalog-keys.d.ts +47 -0
- package/dist-sdk/src/engine/workspace/reserved-catalog-keys.js +115 -0
- package/dist-sdk/src/entities/access-policy/build.d.ts +2 -1
- package/dist-sdk/src/entities/access-policy/from-tf.d.ts +9 -1
- package/dist-sdk/src/entities/access-policy/from-tf.js +25 -4
- package/dist-sdk/src/entities/access-policy/module.js +5 -0
- package/dist-sdk/src/entities/access-policy/to-tf.d.ts +19 -0
- package/dist-sdk/src/entities/access-policy/to-tf.js +65 -8
- package/dist-sdk/src/entities/agent/build.d.ts +52 -1
- package/dist-sdk/src/entities/agent/build.js +34 -0
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +68 -0
- package/dist-sdk/src/entities/agent/from-tf.d.ts +34 -1
- package/dist-sdk/src/entities/agent/from-tf.js +262 -2
- package/dist-sdk/src/entities/agent/index.d.ts +1 -1
- package/dist-sdk/src/entities/agent/to-tf.d.ts +8 -10
- package/dist-sdk/src/entities/agent/to-tf.js +158 -14
- package/dist-sdk/src/entities/agent-tool/from-tf.js +6 -0
- package/dist-sdk/src/entities/agent-tool/to-tf.d.ts +2 -2
- package/dist-sdk/src/entities/agent-tool/to-tf.js +2 -2
- package/dist-sdk/src/entities/app/build.d.ts +34 -14
- package/dist-sdk/src/entities/app/build.js +93 -16
- package/dist-sdk/src/entities/app/from-tf.js +25 -11
- package/dist-sdk/src/entities/app/index.d.ts +1 -0
- package/dist-sdk/src/entities/app/index.js +1 -0
- package/dist-sdk/src/entities/app/module.js +1 -0
- package/dist-sdk/src/entities/app/stage-keys.d.ts +20 -5
- package/dist-sdk/src/entities/app/stage-keys.js +43 -9
- package/dist-sdk/src/entities/app/to-tf.js +2 -0
- package/dist-sdk/src/entities/approval-chain/build.d.ts +46 -11
- package/dist-sdk/src/entities/approval-chain/build.js +120 -8
- package/dist-sdk/src/entities/approval-chain/from-tf.d.ts +24 -2
- package/dist-sdk/src/entities/approval-chain/from-tf.js +148 -6
- package/dist-sdk/src/entities/approval-chain/index.d.ts +4 -1
- package/dist-sdk/src/entities/approval-chain/index.js +4 -1
- package/dist-sdk/src/entities/approval-chain/module.js +23 -5
- package/dist-sdk/src/entities/approval-chain/printer.d.ts +1 -1
- package/dist-sdk/src/entities/approval-chain/printer.js +91 -5
- package/dist-sdk/src/entities/approval-chain/steps-tf.d.ts +77 -0
- package/dist-sdk/src/entities/approval-chain/steps-tf.js +255 -0
- package/dist-sdk/src/entities/approval-chain/steps.d.ts +71 -0
- package/dist-sdk/src/entities/approval-chain/steps.js +83 -0
- package/dist-sdk/src/entities/approval-chain/to-tf.d.ts +16 -6
- package/dist-sdk/src/entities/approval-chain/to-tf.js +37 -4
- package/dist-sdk/src/entities/automation/build.d.ts +50 -24
- package/dist-sdk/src/entities/automation/build.js +86 -33
- package/dist-sdk/src/entities/automation/deserializer/print-automation.js +52 -8
- package/dist-sdk/src/entities/automation/from-tf.d.ts +38 -6
- package/dist-sdk/src/entities/automation/from-tf.js +855 -157
- package/dist-sdk/src/entities/automation/index.d.ts +2 -1
- package/dist-sdk/src/entities/automation/index.js +1 -0
- package/dist-sdk/src/entities/automation/module.d.ts +4 -3
- package/dist-sdk/src/entities/automation/module.js +33 -12
- package/dist-sdk/src/entities/automation/refs-read.d.ts +19 -0
- package/dist-sdk/src/entities/automation/refs-read.js +48 -0
- package/dist-sdk/src/entities/automation/run-target.d.ts +2 -0
- package/dist-sdk/src/entities/automation/run-target.js +5 -0
- package/dist-sdk/src/entities/automation/script-code.d.ts +2 -1
- package/dist-sdk/src/entities/automation/script-code.js +82 -1
- 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/slack-message-refs.d.ts +9 -0
- package/dist-sdk/src/entities/automation/slack-message-refs.js +75 -0
- package/dist-sdk/src/entities/automation/task-output-labels.d.ts +12 -1
- package/dist-sdk/src/entities/automation/task-output-labels.js +32 -1
- package/dist-sdk/src/entities/automation/tasks.d.ts +76 -18
- package/dist-sdk/src/entities/automation/tasks.js +52 -15
- package/dist-sdk/src/entities/automation/to-tf.d.ts +3 -0
- package/dist-sdk/src/entities/automation/to-tf.js +585 -97
- package/dist-sdk/src/entities/automation/triggers.d.ts +48 -23
- package/dist-sdk/src/entities/automation/triggers.js +27 -12
- package/dist-sdk/src/entities/automation/unsafe-script-output.d.ts +50 -0
- package/dist-sdk/src/entities/automation/unsafe-script-output.js +92 -0
- package/dist-sdk/src/entities/chart/build.d.ts +18 -2
- package/dist-sdk/src/entities/chart/from-tf.d.ts +2 -2
- package/dist-sdk/src/entities/chart/from-tf.js +28 -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 +38 -3
- package/dist-sdk/src/entities/dynamic-layout/build.d.ts +3 -0
- 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.js +45 -6
- package/dist-sdk/src/entities/dynamic-layout/module.js +2 -1
- package/dist-sdk/src/entities/dynamic-layout/to-tf.js +46 -12
- package/dist-sdk/src/entities/element/audit-field-guard.d.ts +9 -0
- package/dist-sdk/src/entities/element/audit-field-guard.js +88 -0
- package/dist-sdk/src/entities/element/build.js +2 -1
- package/dist-sdk/src/entities/element/from-tf.js +15 -2
- package/dist-sdk/src/entities/element/module.js +3 -0
- package/dist-sdk/src/entities/element/system-fields.d.ts +13 -0
- package/dist-sdk/src/entities/element/system-fields.js +23 -0
- package/dist-sdk/src/entities/element/to-tf.js +2 -0
- package/dist-sdk/src/entities/field/build.d.ts +9 -0
- package/dist-sdk/src/entities/field/from-tf.d.ts +29 -1
- package/dist-sdk/src/entities/field/from-tf.js +99 -6
- package/dist-sdk/src/entities/field/module.js +12 -2
- package/dist-sdk/src/entities/field/to-tf.d.ts +13 -3
- package/dist-sdk/src/entities/field/to-tf.js +90 -46
- package/dist-sdk/src/entities/org/category.js +1 -0
- package/dist-sdk/src/entities/org/index.d.ts +1 -0
- package/dist-sdk/src/entities/org/index.js +1 -0
- package/dist-sdk/src/entities/org/role.js +5 -0
- package/dist-sdk/src/entities/org/voice-auth.d.ts +5 -0
- package/dist-sdk/src/entities/org/voice-auth.js +33 -0
- package/dist-sdk/src/entities/organization/build.d.ts +3 -0
- package/dist-sdk/src/entities/organization/build.js +2 -0
- package/dist-sdk/src/entities/organization/index.d.ts +1 -0
- package/dist-sdk/src/entities/organization/index.js +1 -0
- package/dist-sdk/src/entities/organization/to-tf.d.ts +2 -0
- package/dist-sdk/src/entities/organization/to-tf.js +59 -1
- package/dist-sdk/src/entities/organization/voice-auth.d.ts +60 -0
- package/dist-sdk/src/entities/organization/voice-auth.js +60 -0
- package/dist-sdk/src/entities/phone-service/build.d.ts +9 -1
- package/dist-sdk/src/entities/phone-service/build.js +1 -0
- package/dist-sdk/src/entities/phone-service/deserializer/print-phone-service.js +3 -0
- package/dist-sdk/src/entities/phone-service/from-tf.d.ts +1 -0
- package/dist-sdk/src/entities/phone-service/from-tf.js +8 -1
- package/dist-sdk/src/entities/phone-service/to-tf.js +16 -0
- package/dist-sdk/src/entities/record-create-form/from-tf.js +2 -2
- package/dist-sdk/src/entities/relationship/from-tf.js +7 -2
- package/dist-sdk/src/entities/relationship/module.js +2 -2
- package/dist-sdk/src/entities/relationship/pair-check.d.ts +6 -2
- package/dist-sdk/src/entities/relationship/pair-check.js +105 -18
- package/dist-sdk/src/entities/relationship/to-tf.js +5 -2
- package/dist-sdk/src/entities/role/permission-levels.d.ts +7 -0
- package/dist-sdk/src/entities/role/permission-levels.js +78 -0
- package/dist-sdk/src/entities/role/to-tf.js +32 -2
- package/dist-sdk/src/entities/service-account/module.d.ts +2 -1
- package/dist-sdk/src/entities/service-account/module.js +9 -1
- package/dist-sdk/src/entities/service-account/resource-type.d.ts +2 -0
- package/dist-sdk/src/entities/service-account/resource-type.js +2 -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/role-membership-check.d.ts +20 -0
- package/dist-sdk/src/entities/service-account/role-membership-check.js +80 -0
- package/dist-sdk/src/entities/shared/aspect-target-from-tf.d.ts +15 -0
- package/dist-sdk/src/entities/shared/aspect-target-from-tf.js +36 -0
- package/dist-sdk/src/entities/shared/filters/ast.d.ts +4 -0
- package/dist-sdk/src/entities/shared/filters/index.d.ts +85 -14
- package/dist-sdk/src/entities/shared/filters/index.js +18 -6
- package/dist-sdk/src/entities/shared/filters/option-lookups.d.ts +57 -0
- package/dist-sdk/src/entities/shared/filters/option-lookups.js +108 -0
- package/dist-sdk/src/entities/shared/filters/print.js +9 -5
- package/dist-sdk/src/entities/shared/filters/tf-codec.d.ts +12 -7
- package/dist-sdk/src/entities/shared/filters/tf-codec.js +9 -5
- package/dist-sdk/src/entities/shared/raw-option-id.d.ts +30 -0
- package/dist-sdk/src/entities/shared/raw-option-id.js +41 -0
- package/dist-sdk/src/entities/shared/tool-field-ref.js +6 -2
- 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/input-coverage.js +5 -2
- package/dist-sdk/src/entities/skill/module.js +2 -0
- package/dist-sdk/src/entities/sla/build.d.ts +96 -0
- package/dist-sdk/src/entities/sla/build.js +124 -0
- package/dist-sdk/src/entities/sla/from-tf.d.ts +40 -0
- package/dist-sdk/src/entities/sla/from-tf.js +164 -0
- package/dist-sdk/src/entities/sla/index.d.ts +1 -0
- package/dist-sdk/src/entities/sla/index.js +1 -0
- package/dist-sdk/src/entities/sla/module.d.ts +4 -0
- package/dist-sdk/src/entities/sla/module.js +73 -0
- package/dist-sdk/src/entities/sla/printer.d.ts +2 -0
- package/dist-sdk/src/entities/sla/printer.js +84 -0
- package/dist-sdk/src/entities/sla/to-tf.d.ts +12 -0
- package/dist-sdk/src/entities/sla/to-tf.js +81 -0
- package/dist-sdk/src/entities/table/build.d.ts +7 -2
- package/dist-sdk/src/entities/table/build.js +22 -1
- package/dist-sdk/src/entities/table/deserializer/normalize.d.ts +4 -1
- package/dist-sdk/src/entities/table/from-tf.js +89 -14
- package/dist-sdk/src/entities/table/index.d.ts +1 -1
- package/dist-sdk/src/entities/table/to-tf.js +41 -2
- package/dist-sdk/src/entities/task/from-tf.js +2 -1
- package/dist-sdk/src/entities/task/to-tf.js +1 -0
- package/dist-sdk/src/entities/view/from-tf.d.ts +8 -4
- package/dist-sdk/src/entities/view/from-tf.js +10 -9
- package/dist-sdk/src/entities/view/module.js +5 -0
- package/dist-sdk/src/entities/widget/from-tf.js +15 -4
- package/dist-sdk/src/generated/ragnarok/ragnarok-spec.d.ts +51 -4
- package/dist-sdk/src/generated/ragnarok/ragnarok-spec.js +2 -2
- package/dist-sdk/src/graph/index.d.ts +20 -2
- package/dist-sdk/src/graph/index.js +19 -0
- package/dist-sdk/src/graph/modules.js +11 -1
- package/dist-sdk/src/graph/resource-types.d.ts +47 -0
- package/dist-sdk/src/graph/resource-types.js +62 -0
- package/dist-sdk/src/graph/types.d.ts +116 -6
- package/package.json +6 -3
|
@@ -69,6 +69,7 @@ export function element(opts) {
|
|
|
69
69
|
...("dynamicSource" in field && field.dynamicSource === true ? { dynamicSource: true } : {}),
|
|
70
70
|
...(field.options !== undefined ? { options: picklistOptionLabels(field.options) } : {}),
|
|
71
71
|
...(field.tags !== undefined ? { tags: field.tags } : {}),
|
|
72
|
+
...(field.resourceKey !== undefined ? { resourceKey: field.resourceKey } : {}),
|
|
72
73
|
};
|
|
73
74
|
}
|
|
74
75
|
if (opts.readonlyFields !== undefined) {
|
|
@@ -109,7 +110,7 @@ export function element(opts) {
|
|
|
109
110
|
};
|
|
110
111
|
},
|
|
111
112
|
def(refName) {
|
|
112
|
-
assertNoSystemKeyCollision("element", opts.name, opts.fields,
|
|
113
|
+
assertNoSystemKeyCollision("element", opts.name, opts.fields, new Set(ELEMENT_SYSTEM_FIELD_KEYS));
|
|
113
114
|
const displayBlocks = serializeDisplayBlocks(opts.displayBlocks, "LAYOUT");
|
|
114
115
|
const recordCreateDisplayBlocks = serializeDisplayBlocks(opts.recordCreateDisplayBlocks, "CREATE");
|
|
115
116
|
const payload = {
|
|
@@ -7,7 +7,7 @@ import { autoShareFromTf } from "../app/auto-share.js";
|
|
|
7
7
|
import { DEPLOY_DEFAULT_SYSTEM_FIELD_NAMES } from "../../core/system-fields.js";
|
|
8
8
|
import { EntityTfError } from "../../engine/entity.js";
|
|
9
9
|
import { dataRefLabel, optionalBoolean, optionalString } from "../../engine/pull/context.js";
|
|
10
|
-
import { tfLabelToTsLabel } from "../../engine/tf/index.js";
|
|
10
|
+
import { scopedLabelToBagKey, tfLabelToTsLabel } from "../../engine/tf/index.js";
|
|
11
11
|
import { accessPolicyBlocksInLabelOrder, accessPolicyFromTf } from "../access-policy/from-tf.js";
|
|
12
12
|
import { dashboardsFromTf } from "../dashboard/from-tf.js";
|
|
13
13
|
import { dynamicLayoutCompanionWidgetLabels, dynamicLayoutsFromTf } from "../dynamic-layout/from-tf.js";
|
|
@@ -18,6 +18,7 @@ import { rolesFromTf } from "../role/from-tf.js";
|
|
|
18
18
|
import { fieldKeysByDisplayName, viewsFromTf } from "../view/from-tf.js";
|
|
19
19
|
import { widgetsFromTf } from "../widget/from-tf.js";
|
|
20
20
|
import { ELEMENT_RESOURCE_TYPE } from "./module.js";
|
|
21
|
+
import { ELEMENT_SYSTEM_FIELD_KEYS } from "./system-fields.js";
|
|
21
22
|
/** Attributes `elementFromTf` understands — anything else is dialect growth. */
|
|
22
23
|
const KNOWN_ELEMENT_ATTRS = new Set([
|
|
23
24
|
"name",
|
|
@@ -139,8 +140,20 @@ export function elementFromTf(elementBlock, fieldBlocks, ctx, viewBlocks = {
|
|
|
139
140
|
fields.push(systemEntry("id", idName ?? DEPLOY_DEFAULT_SYSTEM_FIELD_NAMES.id, "TEXT", "HANDLE", idFieldDescription));
|
|
140
141
|
}
|
|
141
142
|
const owner = { type: ELEMENT_RESOURCE_TYPE, label, scope: "element", refName };
|
|
143
|
+
const usedFieldKeys = new Set();
|
|
144
|
+
const nonReservedBlocks = [];
|
|
145
|
+
const reservedBlocks = [];
|
|
146
|
+
const elementReserved = new Set(ELEMENT_SYSTEM_FIELD_KEYS);
|
|
142
147
|
for (const block of fieldBlocks) {
|
|
143
|
-
|
|
148
|
+
if (block.label === undefined) {
|
|
149
|
+
nonReservedBlocks.push(block);
|
|
150
|
+
continue;
|
|
151
|
+
}
|
|
152
|
+
const natural = scopedLabelToBagKey(label, block.label, "element");
|
|
153
|
+
(elementReserved.has(natural) ? reservedBlocks : nonReservedBlocks).push(block);
|
|
154
|
+
}
|
|
155
|
+
for (const block of [...nonReservedBlocks, ...reservedBlocks]) {
|
|
156
|
+
const entry = fieldFromTf(block, owner, ctx, usedFieldKeys);
|
|
144
157
|
if (entry !== undefined)
|
|
145
158
|
fields.push(entry);
|
|
146
159
|
}
|
|
@@ -8,6 +8,7 @@ import { NO_CATALOG, } from "../../graph/types.js";
|
|
|
8
8
|
import { appendFieldLocals } from "../field/locals.js";
|
|
9
9
|
import { CALENDAR_VIEW_RESOURCE_TYPE, CUSTOM_VIEW_RESOURCE_TYPE, DASHBOARD_VIEW_RESOURCE_TYPE, KANBAN_VIEW_RESOURCE_TYPE, LAYOUT_RESOURCE_TYPE, LIST_VIEW_RESOURCE_TYPE } from "../view/types.js";
|
|
10
10
|
import { elementAuditFieldIds, elementFromTf, referencesElementAuditFields } from "./from-tf.js";
|
|
11
|
+
import { missingElementAuditFieldErrors } from "./audit-field-guard.js";
|
|
11
12
|
import { appendElementLocals } from "./locals.js";
|
|
12
13
|
import { elementToTf } from "./to-tf.js";
|
|
13
14
|
export const ELEMENT_RESOURCE_TYPE = "elementum_element";
|
|
@@ -79,6 +80,7 @@ export const elementModule = {
|
|
|
79
80
|
diagnostics: ctx.diagnostics,
|
|
80
81
|
workspaceAspects: ctx.workspaceAspects,
|
|
81
82
|
...(ctx.outOfScopeApps !== undefined && { outOfScopeApps: ctx.outOfScopeApps }),
|
|
83
|
+
...(ctx.optionIds !== undefined && { optionIds: ctx.optionIds }),
|
|
82
84
|
});
|
|
83
85
|
return {
|
|
84
86
|
blocks: result.blocks,
|
|
@@ -95,4 +97,5 @@ export const elementModule = {
|
|
|
95
97
|
},
|
|
96
98
|
},
|
|
97
99
|
catalog: NO_CATALOG,
|
|
100
|
+
buildChecks: { validateRenderedFiles: missingElementAuditFieldErrors },
|
|
98
101
|
};
|
|
@@ -2,3 +2,16 @@
|
|
|
2
2
|
export declare const ELEMENT_AUDIT_SYSTEM_FIELD_KEYS: readonly ["createdAt", "createdBy", "updatedAt", "updatedBy"];
|
|
3
3
|
export declare const ELEMENT_SYSTEM_FIELD_KEYS: readonly ["id", "title", "createdAt", "createdBy", "updatedAt", "updatedBy"];
|
|
4
4
|
export type ElementSystemFieldKey = typeof ELEMENT_SYSTEM_FIELD_KEYS[number];
|
|
5
|
+
/**
|
|
6
|
+
* What pull extracts for a reference to an element's platform audit field
|
|
7
|
+
* when the element also authors its own field under that key (#2513). Print
|
|
8
|
+
* writes it as the bare key, and the own field's references stay the key and
|
|
9
|
+
* print as its field ref. It only exists between extract and print: a colon
|
|
10
|
+
* can't appear in a field key or a platform id.
|
|
11
|
+
*/
|
|
12
|
+
export declare function platformAuditFieldToken(key: string): string;
|
|
13
|
+
/** The system-field key a {@link platformAuditFieldToken} names; undefined for anything else.
|
|
14
|
+
* Element audit keys and app system keys (status/closedAt/…) both use this token when
|
|
15
|
+
* a same-keyed custom field would otherwise retarget the platform reference (#1871 / #2513).
|
|
16
|
+
*/
|
|
17
|
+
export declare function platformAuditFieldTokenKey(value: string): string | undefined;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SYSTEM_FIELD_KEYS } from "../../core/system-fields.js";
|
|
1
2
|
/** System-field roles EDK can reference when those tagged fields exist on an element. */
|
|
2
3
|
export const ELEMENT_AUDIT_SYSTEM_FIELD_KEYS = [
|
|
3
4
|
"createdAt",
|
|
@@ -10,3 +11,25 @@ export const ELEMENT_SYSTEM_FIELD_KEYS = [
|
|
|
10
11
|
"title",
|
|
11
12
|
...ELEMENT_AUDIT_SYSTEM_FIELD_KEYS,
|
|
12
13
|
];
|
|
14
|
+
/**
|
|
15
|
+
* What pull extracts for a reference to an element's platform audit field
|
|
16
|
+
* when the element also authors its own field under that key (#2513). Print
|
|
17
|
+
* writes it as the bare key, and the own field's references stay the key and
|
|
18
|
+
* print as its field ref. It only exists between extract and print: a colon
|
|
19
|
+
* can't appear in a field key or a platform id.
|
|
20
|
+
*/
|
|
21
|
+
export function platformAuditFieldToken(key) {
|
|
22
|
+
return `platformAuditField:${key}`;
|
|
23
|
+
}
|
|
24
|
+
/** The system-field key a {@link platformAuditFieldToken} names; undefined for anything else.
|
|
25
|
+
* Element audit keys and app system keys (status/closedAt/…) both use this token when
|
|
26
|
+
* a same-keyed custom field would otherwise retarget the platform reference (#1871 / #2513).
|
|
27
|
+
*/
|
|
28
|
+
export function platformAuditFieldTokenKey(value) {
|
|
29
|
+
const key = value.startsWith("platformAuditField:") ? value.slice("platformAuditField:".length) : undefined;
|
|
30
|
+
if (key === undefined)
|
|
31
|
+
return undefined;
|
|
32
|
+
if (ELEMENT_AUDIT_SYSTEM_FIELD_KEYS.includes(key))
|
|
33
|
+
return key;
|
|
34
|
+
return SYSTEM_FIELD_KEYS.includes(key) ? key : undefined;
|
|
35
|
+
}
|
|
@@ -184,6 +184,7 @@ export function elementToTf(entity, ctx) {
|
|
|
184
184
|
const field = fieldToTf(typeKey, inner, {
|
|
185
185
|
ownerTfLabel: ctx.appTfLabel,
|
|
186
186
|
appRefName: ctx.appRefName,
|
|
187
|
+
...(payload.name !== undefined && { ownerName: payload.name }),
|
|
187
188
|
scope: "element",
|
|
188
189
|
objectId,
|
|
189
190
|
diagnostics: ctx.diagnostics,
|
|
@@ -300,6 +301,7 @@ export function elementToTf(entity, ctx) {
|
|
|
300
301
|
objectId,
|
|
301
302
|
orgRefs: ctx.orgRefs,
|
|
302
303
|
diagnostics: ctx.diagnostics,
|
|
304
|
+
...(ctx.optionIds !== undefined && { optionIds: ctx.optionIds }),
|
|
303
305
|
fieldAddresses,
|
|
304
306
|
// An element has no service accounts of its own. Hand the sibling app's
|
|
305
307
|
// authored bag to the shared resolver so a managed account becomes a
|
|
@@ -41,6 +41,15 @@ export interface BaseFieldOptions {
|
|
|
41
41
|
readonly defaultValue?: unknown;
|
|
42
42
|
/** Platform semantic role tags for system fields (e.g. `["STATUS"]`). */
|
|
43
43
|
readonly tags?: readonly string[];
|
|
44
|
+
/**
|
|
45
|
+
* Natural bag key when this field was re-keyed off a reserved system key
|
|
46
|
+
* (#1871). When renaming an already-applied field (for example `closedAt`
|
|
47
|
+
* → `closedAtCustom`), set this to the original key
|
|
48
|
+
* (`resourceKey: "closedAt"`) so the terraform address stays put. A
|
|
49
|
+
* brand-new field needs no `resourceKey`. Omitting it addresses the field
|
|
50
|
+
* from the bag key. Pull stamps this automatically when it re-keys.
|
|
51
|
+
*/
|
|
52
|
+
readonly resourceKey?: string;
|
|
44
53
|
}
|
|
45
54
|
type ScalarExpression<T extends ExprType> = Expr<T, "single", ExprContext>;
|
|
46
55
|
type WithExpression<T extends ExprType> = {
|
|
@@ -8,6 +8,23 @@
|
|
|
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
|
+
/**
|
|
12
|
+
* Bag key for a pulled custom field resource. A key that matches a reserved
|
|
13
|
+
* system-field key is rewritten to `<key>Custom` so pulled source builds
|
|
14
|
+
* under #1871 Q1 A (reject at build). When `usedKeys` is provided, the
|
|
15
|
+
* assignment is collision-safe: non-reserved naturals claim first, and a
|
|
16
|
+
* reserved key takes `<key>Custom`, then `<key>Custom2`, … with a warning.
|
|
17
|
+
* Terraform addresses stay on the natural key via the stamped `resourceKey` / {@link tfChildPartForFieldBagKey}.
|
|
18
|
+
*/
|
|
19
|
+
export declare function bagKeyForPulledCustomField(ownerTfLabel: string, fieldLabel: string, scope: FieldOwnerScope, reservedKeys: ReadonlySet<string>, usedKeys?: Set<string>, diagnostics?: string[]): string;
|
|
20
|
+
/**
|
|
21
|
+
* Terraform child-part for a field bag key. Only a key that pull actually
|
|
22
|
+
* re-keyed from a reserved natural — carried as `resourceKey` / wire
|
|
23
|
+
* `__resourceKey` — keeps the address on that natural. A field whose own
|
|
24
|
+
* label is already `closed_at_custom` (bag key `closedAtCustom`) is not
|
|
25
|
+
* remapped, so Custom and Custom2 never share an address (Review B1).
|
|
26
|
+
*/
|
|
27
|
+
export declare function tfChildPartForFieldBagKey(bagKey: string, resourceKey?: string): string;
|
|
11
28
|
/** Whether one of the owner's own field resources is keyed `fieldKey`; true when the stream can't be listed. */
|
|
12
29
|
export declare function ownerMayHaveCustomField(owner: FieldOwner, fieldKey: string, ctx: FromTfContext): boolean;
|
|
13
30
|
export interface FieldOwner {
|
|
@@ -47,7 +64,7 @@ export declare function fieldBlockOwner(objectId: TfValue | undefined, owner: Pi
|
|
|
47
64
|
* diagnostic (unknown resource type, or a field belonging to a different
|
|
48
65
|
* owner — a recursive stream carries discovered aspects' fields too).
|
|
49
66
|
*/
|
|
50
|
-
export declare function fieldFromTf(block: TfBlock, owner: FieldOwner, ctx: FromTfContext): NormalizedField | undefined;
|
|
67
|
+
export declare function fieldFromTf(block: TfBlock, owner: FieldOwner, ctx: FromTfContext, usedKeys?: Set<string>): NormalizedField | undefined;
|
|
51
68
|
/**
|
|
52
69
|
* `<resourceType>.<tfLabel>.id` → the field's bag key — shared by anything
|
|
53
70
|
* that names a field by ref rather than owning it directly (agent-tool
|
|
@@ -61,6 +78,17 @@ export declare function fieldKeyFromTfRef(v: TfValue, ownerTfLabel?: string, sco
|
|
|
61
78
|
* one app or element from becoming a same-owner field token accidentally.
|
|
62
79
|
*/
|
|
63
80
|
export declare function fieldKeyFromTfValue(v: TfValue, ownerRefName: string, ownerTfLabel: string, scope: FieldOwnerScope, ctx: FromTfContext): string | undefined;
|
|
81
|
+
/**
|
|
82
|
+
* The key a view, layout or form entry prints from, when the owner also
|
|
83
|
+
* authors its own field under a system key (#2513 elements, #1871 apps). Pull
|
|
84
|
+
* resolves the platform system field and the own field to the same key, so
|
|
85
|
+
* this keeps them apart per reference: the platform field's local or data
|
|
86
|
+
* source becomes {@link platformAuditFieldToken} (printed as the bare key),
|
|
87
|
+
* the own field's resource stays the key (printed as its field ref), and a
|
|
88
|
+
* raw platform id stays raw, since pull can't tell whose it is (as
|
|
89
|
+
* `selfSystemField` does). Any other reference returns `key` unchanged.
|
|
90
|
+
*/
|
|
91
|
+
export declare function elementAuditFieldReference(v: TfValue, key: string, owner: FieldOwner, ctx: FromTfContext): string;
|
|
64
92
|
export interface DecodedForeignDataField {
|
|
65
93
|
readonly key: string;
|
|
66
94
|
readonly name: string;
|
|
@@ -10,15 +10,74 @@ import { DEPLOY_DEFAULT_SYSTEM_FIELD_NAMES, SYSTEM_FIELD_KEY_SET } from "../../c
|
|
|
10
10
|
import { dataRefLabel, groupCatalogKey, optionalString, reportAuthoringBlocker, resourceRefLabel } from "../../engine/pull/context.js";
|
|
11
11
|
import { bareChildResourceLabel, isTfExpr, sanitizeName, scopedLabelToBagKey, tfLabelToTsLabel, tsLabelToTfLabel } from "../../engine/tf/index.js";
|
|
12
12
|
import { filterFromTf as deserializeFilterFromTf } from "../shared/filters/tf-codec.js";
|
|
13
|
+
import { optionLookupDecode } from "../shared/filters/option-lookups.js";
|
|
13
14
|
import { __pulledExpression } from "../app/deserializer/pulled-expression.js";
|
|
14
15
|
import { isAttachmentMediaType } from "./media-types.js";
|
|
15
16
|
import { optionsFromTf } from "./options.js";
|
|
16
17
|
import { isCalculationResultType } from "./calculation-types.js";
|
|
17
18
|
import { KNOWN_FIELD_ATTRS, SUB_TYPE_BY_RESOURCE } from "./types.js";
|
|
18
|
-
import { ELEMENT_AUDIT_SYSTEM_FIELD_KEYS, ELEMENT_SYSTEM_FIELD_KEYS } from "../element/system-fields.js";
|
|
19
|
+
import { ELEMENT_AUDIT_SYSTEM_FIELD_KEYS, ELEMENT_SYSTEM_FIELD_KEYS, platformAuditFieldToken } from "../element/system-fields.js";
|
|
19
20
|
import { resolveDataAspectTarget, resolveDataTaskTarget } from "../shared/aspect-target-from-tf.js";
|
|
20
21
|
const ELEMENT_AUDIT_SYSTEM_FIELD_KEY_SET = new Set(ELEMENT_AUDIT_SYSTEM_FIELD_KEYS);
|
|
21
22
|
const ELEMENT_SYSTEM_FIELD_KEY_SET = new Set(ELEMENT_SYSTEM_FIELD_KEYS);
|
|
23
|
+
/**
|
|
24
|
+
* Bag key for a pulled custom field resource. A key that matches a reserved
|
|
25
|
+
* system-field key is rewritten to `<key>Custom` so pulled source builds
|
|
26
|
+
* under #1871 Q1 A (reject at build). When `usedKeys` is provided, the
|
|
27
|
+
* assignment is collision-safe: non-reserved naturals claim first, and a
|
|
28
|
+
* reserved key takes `<key>Custom`, then `<key>Custom2`, … with a warning.
|
|
29
|
+
* Terraform addresses stay on the natural key via the stamped `resourceKey` / {@link tfChildPartForFieldBagKey}.
|
|
30
|
+
*/
|
|
31
|
+
export function bagKeyForPulledCustomField(ownerTfLabel, fieldLabel, scope, reservedKeys, usedKeys, diagnostics) {
|
|
32
|
+
const natural = scopedLabelToBagKey(ownerTfLabel, fieldLabel, scope);
|
|
33
|
+
if (!reservedKeys.has(natural)) {
|
|
34
|
+
if (usedKeys === undefined || !usedKeys.has(natural)) {
|
|
35
|
+
usedKeys?.add(natural);
|
|
36
|
+
return natural;
|
|
37
|
+
}
|
|
38
|
+
// Natural key already claimed (should not happen when non-reserved
|
|
39
|
+
// fields are assigned before reserved re-keys). Suffix until free.
|
|
40
|
+
let i = 2;
|
|
41
|
+
let candidate = `${natural}${i}`;
|
|
42
|
+
while (usedKeys.has(candidate)) {
|
|
43
|
+
i += 1;
|
|
44
|
+
candidate = `${natural}${i}`;
|
|
45
|
+
if (i > 1000) {
|
|
46
|
+
throw new EntityTfError(`no free bag key for custom field "${fieldLabel}" under owner "${ownerTfLabel}"`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
diagnostics?.push(`custom field "${fieldLabel}" keyed "${candidate}" because "${natural}" was already used`);
|
|
50
|
+
usedKeys.add(candidate);
|
|
51
|
+
return candidate;
|
|
52
|
+
}
|
|
53
|
+
let candidate = `${natural}Custom`;
|
|
54
|
+
let i = 2;
|
|
55
|
+
while (usedKeys?.has(candidate) === true) {
|
|
56
|
+
candidate = `${natural}Custom${i}`;
|
|
57
|
+
i += 1;
|
|
58
|
+
if (i > 1000) {
|
|
59
|
+
throw new EntityTfError(`no free bag key for system-keyed custom field "${natural}" under owner "${ownerTfLabel}"`);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
if (candidate !== `${natural}Custom`) {
|
|
63
|
+
diagnostics?.push(`custom field with reserved key "${natural}" re-keyed to "${candidate}" because "${natural}Custom" was already used`);
|
|
64
|
+
}
|
|
65
|
+
usedKeys?.add(candidate);
|
|
66
|
+
return candidate;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Terraform child-part for a field bag key. Only a key that pull actually
|
|
70
|
+
* re-keyed from a reserved natural — carried as `resourceKey` / wire
|
|
71
|
+
* `__resourceKey` — keeps the address on that natural. A field whose own
|
|
72
|
+
* label is already `closed_at_custom` (bag key `closedAtCustom`) is not
|
|
73
|
+
* remapped, so Custom and Custom2 never share an address (Review B1).
|
|
74
|
+
*/
|
|
75
|
+
export function tfChildPartForFieldBagKey(bagKey, resourceKey) {
|
|
76
|
+
if (resourceKey !== undefined && resourceKey !== "") {
|
|
77
|
+
return tsLabelToTfLabel(resourceKey);
|
|
78
|
+
}
|
|
79
|
+
return tsLabelToTfLabel(bagKey);
|
|
80
|
+
}
|
|
22
81
|
/** A system field's authoring type, as the owner's own `fields.<key>` token carries it. */
|
|
23
82
|
const SYSTEM_FIELD_TYPE_BY_KEY = {
|
|
24
83
|
id: "HANDLE",
|
|
@@ -195,8 +254,9 @@ function selfSystemField(v, owner, ctx) {
|
|
|
195
254
|
const systemKeys = scope === "element" ? ELEMENT_SYSTEM_FIELD_KEY_SET : SYSTEM_FIELD_KEY_SET;
|
|
196
255
|
if (!systemKeys.has(fieldKey))
|
|
197
256
|
return undefined;
|
|
198
|
-
//
|
|
199
|
-
//
|
|
257
|
+
// Custom fields that would collide are re-keyed to `<key>Custom` (#1871), so
|
|
258
|
+
// a system-field local always names the platform field. Element audit still
|
|
259
|
+
// uses {@link elementAuditFieldReference} when a same-keyed custom remains.
|
|
200
260
|
if (scope === "element" && ELEMENT_AUDIT_SYSTEM_FIELD_KEY_SET.has(fieldKey) && ownerMayHaveCustomField(owner, fieldKey, ctx))
|
|
201
261
|
return undefined;
|
|
202
262
|
// Title and ID carry their display names on the owner's own block; any
|
|
@@ -447,6 +507,8 @@ function dynamicConfigFromTf(value, owner, ctx, site) {
|
|
|
447
507
|
reference: () => {
|
|
448
508
|
throw new EntityTfError("dynamic picklist filter does not support value references");
|
|
449
509
|
},
|
|
510
|
+
// #2582: a stored option lookup prints as filter.textOption(label).
|
|
511
|
+
...optionLookupDecode,
|
|
450
512
|
});
|
|
451
513
|
}
|
|
452
514
|
catch (e) {
|
|
@@ -665,7 +727,7 @@ function dataLookupKey(type, attrs) {
|
|
|
665
727
|
* diagnostic (unknown resource type, or a field belonging to a different
|
|
666
728
|
* owner — a recursive stream carries discovered aspects' fields too).
|
|
667
729
|
*/
|
|
668
|
-
export function fieldFromTf(block, owner, ctx) {
|
|
730
|
+
export function fieldFromTf(block, owner, ctx, usedKeys) {
|
|
669
731
|
const subType = SUB_TYPE_BY_RESOURCE.get(block.type ?? "");
|
|
670
732
|
const fieldLabel = block.label;
|
|
671
733
|
if (fieldLabel === undefined || fieldLabel === "") {
|
|
@@ -872,8 +934,11 @@ export function fieldFromTf(block, owner, ctx) {
|
|
|
872
934
|
ctx.diagnostics.push(`${where}: unsupported include_type ${JSON.stringify(includeType)}; defaulted to AUTO`);
|
|
873
935
|
}
|
|
874
936
|
}
|
|
937
|
+
const reservedKeys = scope === "element" ? ELEMENT_SYSTEM_FIELD_KEY_SET : SYSTEM_FIELD_KEY_SET;
|
|
938
|
+
const natural = scopedLabelToBagKey(owner.label, fieldLabel, scope);
|
|
939
|
+
const key = bagKeyForPulledCustomField(owner.label, fieldLabel, scope, reservedKeys, usedKeys, ctx.diagnostics);
|
|
875
940
|
return {
|
|
876
|
-
key
|
|
941
|
+
key,
|
|
877
942
|
...(parentLinkage !== undefined && { parentLinkage }),
|
|
878
943
|
...(isCalculationResultType(calculationType) && { calculationType }),
|
|
879
944
|
...(calculationInclude !== undefined && { calculationInclude }),
|
|
@@ -881,6 +946,9 @@ export function fieldFromTf(block, owner, ctx) {
|
|
|
881
946
|
id: ctx.importId(`${block.type}.${fieldLabel}`) ?? "",
|
|
882
947
|
name: fieldName,
|
|
883
948
|
type: subType.authoringType,
|
|
949
|
+
// Explicit re-key map for #1871: only reserved naturals that pull
|
|
950
|
+
// re-keyed carry resourceKey so build keeps the live TF address.
|
|
951
|
+
...(reservedKeys.has(natural) ? { resourceKey: natural } : {}),
|
|
884
952
|
...(calculation !== undefined && { expression: __pulledExpression(calculation) }),
|
|
885
953
|
// Only true flags are carried into authoring — false is the platform
|
|
886
954
|
// default and stays unwritten (build re-emits explicit false; ei's
|
|
@@ -1014,7 +1082,10 @@ export function fieldKeyFromTfRef(v, ownerTfLabel, scope = "app") {
|
|
|
1014
1082
|
if (!SUB_TYPE_BY_RESOURCE.has(v.type))
|
|
1015
1083
|
return undefined;
|
|
1016
1084
|
const bare = ownerTfLabel !== undefined ? bareChildResourceLabel(ownerTfLabel, v.label, scope) : v.label;
|
|
1017
|
-
|
|
1085
|
+
if (ownerTfLabel === undefined)
|
|
1086
|
+
return tfLabelToTsLabel(bare);
|
|
1087
|
+
const reserved = scope === "element" ? ELEMENT_SYSTEM_FIELD_KEY_SET : SYSTEM_FIELD_KEY_SET;
|
|
1088
|
+
return bagKeyForPulledCustomField(ownerTfLabel, v.label, scope, reserved);
|
|
1018
1089
|
}
|
|
1019
1090
|
/**
|
|
1020
1091
|
* Resolve either a normal Terraform field reference or a raw platform field
|
|
@@ -1040,6 +1111,28 @@ export function fieldKeyFromTfValue(v, ownerRefName, ownerTfLabel, scope, ctx) {
|
|
|
1040
1111
|
}
|
|
1041
1112
|
return fieldKeyFromTfRef(v, ownerTfLabel, scope);
|
|
1042
1113
|
}
|
|
1114
|
+
/**
|
|
1115
|
+
* The key a view, layout or form entry prints from, when the owner also
|
|
1116
|
+
* authors its own field under a system key (#2513 elements, #1871 apps). Pull
|
|
1117
|
+
* resolves the platform system field and the own field to the same key, so
|
|
1118
|
+
* this keeps them apart per reference: the platform field's local or data
|
|
1119
|
+
* source becomes {@link platformAuditFieldToken} (printed as the bare key),
|
|
1120
|
+
* the own field's resource stays the key (printed as its field ref), and a
|
|
1121
|
+
* raw platform id stays raw, since pull can't tell whose it is (as
|
|
1122
|
+
* `selfSystemField` does). Any other reference returns `key` unchanged.
|
|
1123
|
+
*/
|
|
1124
|
+
export function elementAuditFieldReference(v, key, owner, ctx) {
|
|
1125
|
+
// Apps re-key colliding custom fields (#1871); only element audit still
|
|
1126
|
+
// shares a bag key with a possible same-keyed custom until that path re-keys.
|
|
1127
|
+
const scope = owner.scope ?? "app";
|
|
1128
|
+
if (scope !== "element" || !ELEMENT_AUDIT_SYSTEM_FIELD_KEY_SET.has(key))
|
|
1129
|
+
return key;
|
|
1130
|
+
if (ctx.resourcesOfType === undefined || !ownerMayHaveCustomField(owner, key, ctx))
|
|
1131
|
+
return key;
|
|
1132
|
+
if (typeof v === "string")
|
|
1133
|
+
return v;
|
|
1134
|
+
return isTfExpr(v) && (v.$expr === "local" || v.$expr === "data-attr") ? platformAuditFieldToken(key) : key;
|
|
1135
|
+
}
|
|
1043
1136
|
/**
|
|
1044
1137
|
* Decode `data.elementum_field.<label>` to the target's public field key.
|
|
1045
1138
|
* ei labels are `elementum_element_<sanitize(displayName)>_<field>` (or
|
|
@@ -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",
|
|
@@ -20,6 +20,10 @@ export const fieldModule = {
|
|
|
20
20
|
resourceType: t.resourceType,
|
|
21
21
|
implemented: t.implemented === true,
|
|
22
22
|
authoringType: t.authoringType,
|
|
23
|
+
// The provider's Read drops an inactive option that isn't in prior state
|
|
24
|
+
// (`keepPicklistAPIOption`), so adoption re-imports the field so state
|
|
25
|
+
// holds the inactive options a re-pull prints (#2186).
|
|
26
|
+
...(t.hasOptions === true && { stateScopedInactiveOptions: ["options"] }),
|
|
23
27
|
})),
|
|
24
28
|
},
|
|
25
29
|
// Foreign relationship/relation fields are looked up by name under their
|
|
@@ -76,7 +80,13 @@ export const fieldModule = {
|
|
|
76
80
|
// A filter on a foreign record's field: the build interpolates the
|
|
77
81
|
// field's lookup (`record.${data.elementum_field.<x>.id}`), the export
|
|
78
82
|
// inlines the field's id (#1701).
|
|
79
|
-
|
|
83
|
+
// A field read off a record found in a sibling app/element
|
|
84
|
+
// (`{{task name="record.<field-id>" …}}`) has its lookup declared but not
|
|
85
|
+
// read in state, so the id comes from the managed field (#1839).
|
|
86
|
+
stateResolvedDataLookups: [{
|
|
87
|
+
dataType: FIELD_DATA_RESOURCE_TYPE,
|
|
88
|
+
managedFallback: { resourceTypes: FIELD_RESOURCE_TYPES, matchAttributes: ["name"], ownerAttribute: "object_id" },
|
|
89
|
+
}],
|
|
80
90
|
},
|
|
81
91
|
};
|
|
82
92
|
/**
|
|
@@ -6,8 +6,12 @@
|
|
|
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
17
|
import { type ChildResourceScope, type FieldOwnerScope, type TfBlock, type TfExpr, type TfValue } from "../../engine/tf/index.js";
|
|
@@ -41,6 +45,8 @@ interface FieldTokenWire {
|
|
|
41
45
|
readonly parentKind?: "app" | "element" | "task";
|
|
42
46
|
readonly parentName?: string;
|
|
43
47
|
readonly fieldType?: string;
|
|
48
|
+
/** Natural bag key when pull re-keyed off a reserved system key (#1871). */
|
|
49
|
+
readonly resourceKey?: string;
|
|
44
50
|
}
|
|
45
51
|
/**
|
|
46
52
|
* One entry of `sort.orders` in the shape actually observed live on a
|
|
@@ -91,6 +97,8 @@ interface FieldConfigWire {
|
|
|
91
97
|
export interface FieldInnerWire {
|
|
92
98
|
readonly name?: string;
|
|
93
99
|
readonly __refName?: string;
|
|
100
|
+
/** Natural bag key when pull re-keyed off a reserved system key (#1871). */
|
|
101
|
+
readonly __resourceKey?: string;
|
|
94
102
|
readonly columnName?: string;
|
|
95
103
|
readonly required?: boolean;
|
|
96
104
|
readonly requiredOnClose?: boolean;
|
|
@@ -128,6 +136,8 @@ export interface FieldToTfOptions {
|
|
|
128
136
|
readonly ownerTfLabel: string;
|
|
129
137
|
/** The owning stream root's refName — needed to detect a self-targeting RELATION field. */
|
|
130
138
|
readonly appRefName: string;
|
|
139
|
+
/** The owning stream root's display name, for errors in the #1780 shape; falls back to `appRefName`. */
|
|
140
|
+
readonly ownerName?: string;
|
|
131
141
|
/** App children use `apps_<ns>_<ns>_`, element children `elements_<ns>_<ns>_`, task children `tasks_<ns>_<ns>_` (edk#1464). */
|
|
132
142
|
readonly scope?: FieldOwnerScope;
|
|
133
143
|
/** The owner's id reference, e.g. `elementum_app.<ns>.id` — computed by the owner's to-tf. */
|
|
@@ -162,7 +172,7 @@ export interface FieldToTfResult {
|
|
|
162
172
|
*/
|
|
163
173
|
export declare function claimFieldDisplayName(seen: Map<string, string>, field: FieldToTfResult): void;
|
|
164
174
|
export declare function fieldToTf(typeKey: string, inner: FieldInnerWire, opts: FieldToTfOptions): FieldToTfResult | undefined;
|
|
165
|
-
export declare function fieldRefToTfValue(fieldType: string, refName: string, ownerTfLabel: string, scope?: FieldOwnerScope, fieldOwnership?: FieldOwnership): TfExpr | undefined;
|
|
175
|
+
export declare function fieldRefToTfValue(fieldType: string, refName: string, ownerTfLabel: string, scope?: FieldOwnerScope, fieldOwnership?: FieldOwnership, resourceKey?: string): TfExpr | undefined;
|
|
166
176
|
/**
|
|
167
177
|
* Why build leaves out an entry: its field reference has no field in source
|
|
168
178
|
* and no platform id (#1966, #1978). The gaps below state what apply then
|