@elementumai/edk 0.12.0 → 0.13.1
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 +8 -2
- package/dist-sdk/src/catalog/factories.d.ts +7 -1
- package/dist-sdk/src/catalog/factories.js +10 -2
- 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 +12 -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/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 +2 -0
- package/dist-sdk/src/engine/coverage-gaps.js +4 -0
- package/dist-sdk/src/engine/ei/run.d.ts +8 -0
- package/dist-sdk/src/engine/ei/run.js +46 -7
- 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 +34 -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 +4 -0
- package/dist-sdk/src/engine/pull/ref-only.js +7 -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 +159 -0
- package/dist-sdk/src/engine/pull/stream-root.js +579 -0
- package/dist-sdk/src/engine/workspace/authoring-layout.js +16 -2
- 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 +7 -0
- package/dist-sdk/src/entities/access-policy/from-tf.js +17 -5
- 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 +70 -1
- package/dist-sdk/src/entities/agent/from-tf.d.ts +36 -1
- package/dist-sdk/src/entities/agent/from-tf.js +289 -2
- package/dist-sdk/src/entities/agent/index.d.ts +1 -1
- package/dist-sdk/src/entities/agent/module.js +1 -0
- package/dist-sdk/src/entities/agent/to-tf.d.ts +11 -11
- package/dist-sdk/src/entities/agent/to-tf.js +179 -17
- 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 +33 -13
- package/dist-sdk/src/entities/app/build.js +14 -12
- package/dist-sdk/src/entities/app/from-tf.d.ts +1 -0
- package/dist-sdk/src/entities/app/from-tf.js +7 -9
- 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 +3 -0
- package/dist-sdk/src/entities/app/stage-keys.d.ts +2 -2
- package/dist-sdk/src/entities/app/stage-keys.js +3 -3
- package/dist-sdk/src/entities/app/to-tf.js +1 -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 +10 -1
- package/dist-sdk/src/entities/automation/build.js +70 -27
- package/dist-sdk/src/entities/automation/deserializer/print-automation.js +21 -5
- package/dist-sdk/src/entities/automation/from-tf.d.ts +26 -5
- package/dist-sdk/src/entities/automation/from-tf.js +665 -112
- 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 +45 -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/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/system-ref-name.d.ts +23 -3
- package/dist-sdk/src/entities/automation/system-ref-name.js +86 -4
- package/dist-sdk/src/entities/automation/task-output-labels.d.ts +11 -0
- package/dist-sdk/src/entities/automation/task-output-labels.js +23 -0
- package/dist-sdk/src/entities/automation/tasks.d.ts +29 -4
- package/dist-sdk/src/entities/automation/tasks.js +34 -11
- package/dist-sdk/src/entities/automation/to-tf.d.ts +8 -1
- package/dist-sdk/src/entities/automation/to-tf.js +563 -103
- package/dist-sdk/src/entities/automation/triggers.d.ts +0 -8
- package/dist-sdk/src/entities/automation/triggers.js +26 -11
- 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 +9 -1
- package/dist-sdk/src/entities/chart/from-tf.js +3 -0
- package/dist-sdk/src/entities/chart/to-tf.js +19 -2
- package/dist-sdk/src/entities/dashboard/from-tf.d.ts +3 -1
- package/dist-sdk/src/entities/dashboard/from-tf.js +42 -2
- package/dist-sdk/src/entities/dashboard/to-tf.js +9 -1
- package/dist-sdk/src/entities/dashboard-widget-order/module.d.ts +10 -0
- package/dist-sdk/src/entities/dashboard-widget-order/module.js +25 -0
- package/dist-sdk/src/entities/dashboard-widget-order/order.d.ts +31 -0
- package/dist-sdk/src/entities/dashboard-widget-order/order.js +102 -0
- package/dist-sdk/src/entities/dynamic-layout/build.d.ts +2 -0
- package/dist-sdk/src/entities/dynamic-layout/from-tf.js +44 -5
- 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.d.ts +1 -0
- package/dist-sdk/src/entities/element/from-tf.js +4 -7
- package/dist-sdk/src/entities/element/module.js +5 -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 +1 -0
- package/dist-sdk/src/entities/field/build.d.ts +9 -0
- package/dist-sdk/src/entities/field/from-tf.d.ts +52 -1
- package/dist-sdk/src/entities/field/from-tf.js +212 -14
- package/dist-sdk/src/entities/field/module.js +4 -0
- package/dist-sdk/src/entities/field/to-tf.d.ts +5 -1
- package/dist-sdk/src/entities/field/to-tf.js +33 -12
- 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/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 +9 -4
- 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/build.d.ts +3 -4
- 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/search-table/build.d.ts +9 -3
- package/dist-sdk/src/entities/search-table/build.js +4 -4
- package/dist-sdk/src/entities/search-table/printer.js +3 -1
- package/dist-sdk/src/entities/search-table/to-tf.js +20 -2
- package/dist-sdk/src/entities/service-account/module.d.ts +2 -1
- package/dist-sdk/src/entities/service-account/module.js +4 -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-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/context.d.ts +14 -1
- package/dist-sdk/src/entities/shared/filters/ast.d.ts +2 -0
- package/dist-sdk/src/entities/shared/filters/index.d.ts +97 -15
- package/dist-sdk/src/entities/shared/filters/index.js +30 -7
- 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.d.ts +2 -0
- package/dist-sdk/src/entities/shared/filters/print.js +19 -6
- package/dist-sdk/src/entities/shared/filters/tf-codec.d.ts +16 -7
- package/dist-sdk/src/entities/shared/filters/tf-codec.js +25 -5
- package/dist-sdk/src/entities/shared/filters/types.d.ts +4 -0
- 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.d.ts +1 -1
- package/dist-sdk/src/entities/shared/tool-field-ref.js +3 -2
- package/dist-sdk/src/entities/skill/input-coverage.js +5 -2
- 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 +3 -2
- package/dist-sdk/src/entities/view/custom-view-validate.d.ts +6 -4
- package/dist-sdk/src/entities/view/custom-view-validate.js +36 -18
- package/dist-sdk/src/entities/view/from-tf.js +16 -4
- package/dist-sdk/src/entities/view/to-tf.js +66 -47
- package/dist-sdk/src/entities/visual-flow/module.js +52 -1
- package/dist-sdk/src/entities/widget/from-tf.js +19 -8
- package/dist-sdk/src/generated/ragnarok/ragnarok-spec.d.ts +49 -4
- package/dist-sdk/src/generated/ragnarok/ragnarok-spec.js +2 -2
- package/dist-sdk/src/graph/index.d.ts +9 -0
- package/dist-sdk/src/graph/index.js +8 -0
- package/dist-sdk/src/graph/modules.js +13 -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 +113 -6
- package/package.json +7 -4
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// Which levels each app/element role permission group stores as written
|
|
2
|
+
// (edk#2133). The provider refuses any other level at plan, so the build
|
|
3
|
+
// refuses it first. These are copies of the provider's tables in
|
|
4
|
+
// provider/internal/provider/role_resource.go, where the reasons for each
|
|
5
|
+
// entry are: MAX_LEVEL_BY_GROUP = MaxPermissionLevelByGroup,
|
|
6
|
+
// MIN_LEVEL_BY_GROUP = MinPermissionLevelByGroup and UNSTORED_LEVEL_BY_GROUP
|
|
7
|
+
// = UnstoredPermissionLevelByGroup. The exporter,
|
|
8
|
+
// cmd/elementum/export/hcl_role.go, has its own copies of the max and
|
|
9
|
+
// unstored tables only; the minimum table exists in the provider and here.
|
|
10
|
+
// Change all copies together.
|
|
11
|
+
const LEVEL_RANK = { NONE: 0, VIEW: 1, EDIT: 2, ADMIN: 3 };
|
|
12
|
+
const MAX_LEVEL_BY_GROUP = {
|
|
13
|
+
AGENTS: "ADMIN",
|
|
14
|
+
AI_PROVIDERS: "ADMIN",
|
|
15
|
+
ANALYTICS: "ADMIN",
|
|
16
|
+
APPS: "ADMIN",
|
|
17
|
+
ATTACHMENTS: "EDIT",
|
|
18
|
+
AUTOMATIONS: "ADMIN",
|
|
19
|
+
CONVERSATIONS: "ADMIN",
|
|
20
|
+
RECORDS: "ADMIN",
|
|
21
|
+
RELATIONSHIPS: "ADMIN",
|
|
22
|
+
SERVICES: "ADMIN",
|
|
23
|
+
SLAS: "ADMIN",
|
|
24
|
+
USERS: "ADMIN",
|
|
25
|
+
};
|
|
26
|
+
const MIN_LEVEL_BY_GROUP = {
|
|
27
|
+
AGENTS: "EDIT",
|
|
28
|
+
AI_PROVIDERS: "ADMIN",
|
|
29
|
+
AUTOMATIONS: "EDIT",
|
|
30
|
+
RELATIONSHIPS: "EDIT",
|
|
31
|
+
};
|
|
32
|
+
const UNSTORED_LEVEL_BY_GROUP = {
|
|
33
|
+
ATTACHMENTS: { ADMIN: "EDIT" },
|
|
34
|
+
SLAS: { EDIT: "VIEW" },
|
|
35
|
+
};
|
|
36
|
+
/** An unknown level ranks as NONE, as in the provider's `levelRank[level]` lookup. */
|
|
37
|
+
function rank(level) {
|
|
38
|
+
return LEVEL_RANK[level] ?? 0;
|
|
39
|
+
}
|
|
40
|
+
/** The non-NONE levels a group stores as written, e.g. "VIEW or ADMIN". */
|
|
41
|
+
function supportedLevels(group) {
|
|
42
|
+
const levels = ["VIEW", "EDIT", "ADMIN"].filter((level) => {
|
|
43
|
+
const max = MAX_LEVEL_BY_GROUP[group];
|
|
44
|
+
const min = MIN_LEVEL_BY_GROUP[group];
|
|
45
|
+
if (max !== undefined && rank(level) > rank(max))
|
|
46
|
+
return false;
|
|
47
|
+
if (min !== undefined && rank(level) < rank(min))
|
|
48
|
+
return false;
|
|
49
|
+
return UNSTORED_LEVEL_BY_GROUP[group]?.[level] === undefined;
|
|
50
|
+
});
|
|
51
|
+
return levels.length < 2 ? levels.join("") : `${levels.slice(0, -1).join(", ")} or ${levels[levels.length - 1]}`;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Why a role permission's level can't be used with its group, or undefined
|
|
55
|
+
* when it can. CUSTOM, NONE and groups the table doesn't list are left to
|
|
56
|
+
* the provider, as it does.
|
|
57
|
+
*/
|
|
58
|
+
export function rolePermissionLevelError(permission) {
|
|
59
|
+
const group = permission.group;
|
|
60
|
+
const level = permission.level;
|
|
61
|
+
if (level === "CUSTOM" || level === "NONE")
|
|
62
|
+
return undefined;
|
|
63
|
+
const max = MAX_LEVEL_BY_GROUP[group];
|
|
64
|
+
if (max === undefined)
|
|
65
|
+
return undefined;
|
|
66
|
+
const storedAs = UNSTORED_LEVEL_BY_GROUP[group]?.[level];
|
|
67
|
+
if (storedAs !== undefined) {
|
|
68
|
+
return `${group} supports ${supportedLevels(group)}; ${level} is stored as ${storedAs}, so the plan would never converge`;
|
|
69
|
+
}
|
|
70
|
+
const min = MIN_LEVEL_BY_GROUP[group];
|
|
71
|
+
if (min !== undefined && rank(level) > rank("NONE") && rank(level) < rank(min)) {
|
|
72
|
+
return `${group} grants nothing below ${min}, so ${level} would be stored as NONE; use NONE or at least ${min} (${group} supports ${supportedLevels(group)})`;
|
|
73
|
+
}
|
|
74
|
+
if (rank(level) > rank(max)) {
|
|
75
|
+
return `${group} goes up to ${max}, not ${level} (${group} supports ${supportedLevels(group)})`;
|
|
76
|
+
}
|
|
77
|
+
return undefined;
|
|
78
|
+
}
|
|
@@ -3,6 +3,8 @@ import { ROLE_RESOURCE_TYPE } from "../org/role.js";
|
|
|
3
3
|
import { SERVICE_ACCOUNT_RESOURCE_TYPE } from "../service-account/module.js";
|
|
4
4
|
import { serviceAccountRefToTf } from "../service-account/to-tf.js";
|
|
5
5
|
import { describeDroppedEntry, finishMemberList } from "../access-policy/member-list.js";
|
|
6
|
+
import { currentValidationMode, recordValidations, ValidationFailureError } from "../../engine/validation.js";
|
|
7
|
+
import { rolePermissionLevelError } from "./permission-levels.js";
|
|
6
8
|
function principals(values, type, where, orgRefs, diagnostics) {
|
|
7
9
|
if (values === undefined)
|
|
8
10
|
return undefined;
|
|
@@ -37,7 +39,9 @@ function principals(values, type, where, orgRefs, diagnostics) {
|
|
|
37
39
|
return finishMemberList(where, out, dropped, diagnostics);
|
|
38
40
|
}
|
|
39
41
|
export function rolesToTf(roles, opts) {
|
|
40
|
-
|
|
42
|
+
const invalidRoles = [];
|
|
43
|
+
const blocks = Object.entries(roles ?? {}).map(([key, role]) => {
|
|
44
|
+
const label = scopedResourceLabel(opts.ownerTfLabel, tsLabelToTfLabel(key), opts.scope);
|
|
41
45
|
const attrs = { object_id: opts.objectId, name: role.name };
|
|
42
46
|
if (role.description !== undefined)
|
|
43
47
|
attrs["description"] = role.description;
|
|
@@ -79,6 +83,24 @@ export function rolesToTf(roles, opts) {
|
|
|
79
83
|
if (serviceAccountIds !== undefined)
|
|
80
84
|
attrs["service_account_ids"] = serviceAccountIds;
|
|
81
85
|
}
|
|
86
|
+
if (role.permissions !== undefined) {
|
|
87
|
+
// A level the group doesn't store as written fails plan in the
|
|
88
|
+
// provider; fail the build first, one finding per role, so a single
|
|
89
|
+
// build names every bad role (edk#2133).
|
|
90
|
+
const invalid = role.permissions.flatMap((permission) => {
|
|
91
|
+
const error = rolePermissionLevelError(permission);
|
|
92
|
+
return error === undefined ? [] : [`${permission.group} ${permission.level}: ${error}`];
|
|
93
|
+
});
|
|
94
|
+
if (invalid.length > 0) {
|
|
95
|
+
invalidRoles.push({
|
|
96
|
+
severity: "fatal",
|
|
97
|
+
address: `${ROLE_RESOURCE_TYPE}.${label}`,
|
|
98
|
+
name: role.name,
|
|
99
|
+
ownerKind: "role",
|
|
100
|
+
message: `roles.${key}.permissions (${opts.ownerRefName}): ${invalid.length === 1 ? "this permission level is" : "these permission levels are"} not valid for the group, so plan would fail: ${invalid.join(" | ")}`,
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
}
|
|
82
104
|
if (role.permissions !== undefined)
|
|
83
105
|
attrs["permissions"] = [...role.permissions].sort((a, b) => a.group.localeCompare(b.group)).map((permission) => ({
|
|
84
106
|
group: permission.group,
|
|
@@ -88,8 +110,16 @@ export function rolesToTf(roles, opts) {
|
|
|
88
110
|
return {
|
|
89
111
|
kind: "resource",
|
|
90
112
|
type: ROLE_RESOURCE_TYPE,
|
|
91
|
-
label
|
|
113
|
+
label,
|
|
92
114
|
attrs,
|
|
93
115
|
};
|
|
94
116
|
});
|
|
117
|
+
if (invalidRoles.length > 0) {
|
|
118
|
+
// In a build or pull session the findings are collected with the rest; outside one, fail closed.
|
|
119
|
+
if (currentValidationMode() !== undefined)
|
|
120
|
+
recordValidations(invalidRoles);
|
|
121
|
+
else
|
|
122
|
+
throw new ValidationFailureError(invalidRoles);
|
|
123
|
+
}
|
|
124
|
+
return blocks;
|
|
95
125
|
}
|
|
@@ -34,11 +34,16 @@ type OwnerOption<Owner extends SearchTableOwner> = {
|
|
|
34
34
|
type OwnedField<Owner extends SearchTableOwner> = Owner extends {
|
|
35
35
|
readonly fields: infer Fields;
|
|
36
36
|
} ? Fields extends Readonly<Record<string, FieldRef>> ? Fields[keyof Fields] : FieldRef<Owner["refName"]> : FieldRef<Owner["refName"]>;
|
|
37
|
-
type CommonOptions<Owner extends SearchTableOwner> = EntityDeployOptions & OwnerOption<Owner
|
|
38
|
-
readonly name: string;
|
|
39
|
-
};
|
|
37
|
+
type CommonOptions<Owner extends SearchTableOwner> = EntityDeployOptions & OwnerOption<Owner>;
|
|
40
38
|
/** Options for an Elementum-managed element search table. */
|
|
41
39
|
export type DefineSearchTableOptions<Owner extends SearchTableOwner = SearchTableOwner> = CommonOptions<Owner> & {
|
|
40
|
+
/**
|
|
41
|
+
* The table's platform name. Give every new search table one. Leave it
|
|
42
|
+
* unset only for an existing table the platform holds without a name
|
|
43
|
+
* (older tables predate the field); pull prints those without one, so
|
|
44
|
+
* the plan doesn't keep trying to set a name (#2937).
|
|
45
|
+
*/
|
|
46
|
+
readonly name?: string;
|
|
42
47
|
readonly attributeFields: readonly [OwnedField<Owner>, ...OwnedField<Owner>[]];
|
|
43
48
|
readonly duration: SearchTableDuration;
|
|
44
49
|
readonly targetLag: number;
|
|
@@ -49,6 +54,7 @@ export type DefineSearchTableOptions<Owner extends SearchTableOwner = SearchTabl
|
|
|
49
54
|
};
|
|
50
55
|
/** Options for linking an existing Cortex Search Service. */
|
|
51
56
|
export type DefineLinkedSearchTableOptions<Owner extends SearchTableOwner = SearchTableOwner> = CommonOptions<Owner> & {
|
|
57
|
+
readonly name: string;
|
|
52
58
|
readonly cloudLink: CloudLinkRef;
|
|
53
59
|
readonly database: string;
|
|
54
60
|
readonly schema: string;
|
|
@@ -54,7 +54,7 @@ function managedBody(opts) {
|
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
return {
|
|
57
|
-
name: opts.name,
|
|
57
|
+
...(opts.name !== undefined ? { name: opts.name } : {}),
|
|
58
58
|
attributeFieldIds: opts.attributeFields,
|
|
59
59
|
duration: opts.duration,
|
|
60
60
|
targetLag: opts.targetLag,
|
|
@@ -81,7 +81,7 @@ function configuredSearchTable(opts, variant, body) {
|
|
|
81
81
|
const payload = slimTokens({ __variant: variant, ...body });
|
|
82
82
|
return {
|
|
83
83
|
ref(refName) {
|
|
84
|
-
return { __kind: "searchTable", refName, name: opts.name, parent: owner.refName, __variant: variant };
|
|
84
|
+
return { __kind: "searchTable", refName, name: opts.name ?? refName, parent: owner.refName, __variant: variant };
|
|
85
85
|
},
|
|
86
86
|
def(refName) {
|
|
87
87
|
return { kind: "searchTable", parent: owner.refName, refName, payload, ...(opts.enabled !== undefined ? { enabled: opts.enabled } : {}) };
|
|
@@ -90,8 +90,8 @@ function configuredSearchTable(opts, variant, body) {
|
|
|
90
90
|
}
|
|
91
91
|
/** Build an element-owned managed search table. */
|
|
92
92
|
export function searchTable(opts) {
|
|
93
|
-
if (opts.name
|
|
94
|
-
throw new EdkValidationError("searchTable
|
|
93
|
+
if (opts.name?.trim() === "")
|
|
94
|
+
throw new EdkValidationError("searchTable name must not be empty; omit it only for an existing unnamed table.");
|
|
95
95
|
return configuredSearchTable(opts, "snowflake", managedBody(opts));
|
|
96
96
|
}
|
|
97
97
|
/** Link an existing Cortex Search Service to an element. */
|
|
@@ -36,7 +36,9 @@ parentScope, orgImportPath) {
|
|
|
36
36
|
lines.push(` creationTimeout: ${quote(table.creationTimeout)},`);
|
|
37
37
|
}
|
|
38
38
|
else if (table.kind === "snowflake") {
|
|
39
|
-
lines.push(` ${parentScope}: catalog${member(ownerRefName)},`,
|
|
39
|
+
lines.push(` ${parentScope}: catalog${member(ownerRefName)},`,
|
|
40
|
+
// An unnamed platform table stays unnamed: inventing one plans `+ name` forever (#2937).
|
|
41
|
+
...(table.name !== undefined ? [` name: ${quote(table.name)},`] : []), ` attributeFields: [${table.attributeFieldKeys.map((key) => `catalog${member(ownerRefName)}.fields${member(key)}`).join(", ")}],`, ...(table.textIndexFieldKeys !== undefined
|
|
40
42
|
? [` textIndexFields: [${table.textIndexFieldKeys.map((key) => `catalog${member(ownerRefName)}.fields${member(key)}`).join(", ")}],`]
|
|
41
43
|
: []), ` vectorIndex: { field: catalog${member(ownerRefName)}.fields${member(table.fieldKey)}, service: ${connectorExpr(table.connectorKey)} },`, ` duration: searchTableDuration.${table.duration.toLowerCase()},`, ` targetLag: ${table.targetLag},`);
|
|
42
44
|
if (table.warehouse !== undefined)
|
|
@@ -15,6 +15,18 @@ function fieldValue(token, ctx, where) {
|
|
|
15
15
|
throw new EntityTfError(`${where}: field ${token.refName} has no Terraform resource mapping`);
|
|
16
16
|
return value;
|
|
17
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* The platform indexes the owner's record ID with every app or element search
|
|
20
|
+
* table and returns it first among the attribute fields, whether or not the
|
|
21
|
+
* source lists it. Build writes the same list, so a table that leaves out
|
|
22
|
+
* `fields.id` (or lists it later) doesn't plan a replacement on every apply,
|
|
23
|
+
* which `attribute_field_ids` forces on any difference (#2890).
|
|
24
|
+
*/
|
|
25
|
+
function withRecordIdFirst(attributes, ownerTfLabel) {
|
|
26
|
+
const recordId = expr.local(`${ownerTfLabel}_id_field_id`);
|
|
27
|
+
const key = JSON.stringify(recordId);
|
|
28
|
+
return [recordId, ...attributes.filter((value) => JSON.stringify(value) !== key)];
|
|
29
|
+
}
|
|
18
30
|
function connectorValue(token, ctx, where) {
|
|
19
31
|
const key = token?.parent !== undefined ? `${token.parent}.${token.refName ?? ""}` : token?.refName ?? "";
|
|
20
32
|
const resolved = ctx.orgRefs.byTsLabel(CONNECTOR_ORG_BAG, key);
|
|
@@ -82,11 +94,17 @@ export function searchTableToTf(entity, ctx) {
|
|
|
82
94
|
throw new EntityTfError(`search table ${entity.refName}: no vector index`);
|
|
83
95
|
if ((payload.vectorIndexes?.length ?? 0) > 1)
|
|
84
96
|
throw new EntityTfError(`search table ${entity.refName}: Terraform supports exactly one vector index`);
|
|
97
|
+
const vectorField = fieldValue(index.fieldId, aspectCtx, `search table ${entity.refName}`);
|
|
98
|
+
if (JSON.stringify(vectorField) === JSON.stringify(expr.local(`${ctx.appTfLabel}_id_field_id`))) {
|
|
99
|
+
// Build always lists the record ID as an attribute (#2890), and the provider
|
|
100
|
+
// refuses a vector field that is also an attribute: say so here, naming it.
|
|
101
|
+
throw new EntityTfError(`search table ${entity.refName}: the record ID (fields.id) is always an attribute field, which the provider doesn't allow as the vector index field; index a text field`);
|
|
102
|
+
}
|
|
85
103
|
const attrs = {
|
|
86
104
|
object_id: objectId,
|
|
87
|
-
field_id:
|
|
105
|
+
field_id: vectorField,
|
|
88
106
|
ai_provider_connector_id: connectorValue(index.aiProviderConnectorId, ctx, `search table ${entity.refName}`),
|
|
89
|
-
attribute_field_ids: (payload.attributeFieldIds ?? []).map((field) => fieldValue(field, aspectCtx, `search table ${entity.refName}`)),
|
|
107
|
+
attribute_field_ids: withRecordIdFirst((payload.attributeFieldIds ?? []).map((field) => fieldValue(field, aspectCtx, `search table ${entity.refName}`)), ctx.appTfLabel),
|
|
90
108
|
duration: payload.duration ?? "DAYS",
|
|
91
109
|
target_lag: payload.targetLag ?? 1,
|
|
92
110
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type EntityKindModule } from "../../graph/types.js";
|
|
2
|
-
|
|
2
|
+
import { SERVICE_ACCOUNT_RESOURCE_TYPE } from "./resource-type.js";
|
|
3
|
+
export { SERVICE_ACCOUNT_RESOURCE_TYPE };
|
|
3
4
|
export declare const SERVICE_ACCOUNT_ACCESS_POLICY_RESOURCE_TYPE = "elementum_service_account_access_policy";
|
|
4
5
|
export declare const serviceAccountModule: EntityKindModule;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { NO_CANVAS, NO_CATALOG, NO_LIFECYCLE } from "../../graph/types.js";
|
|
2
2
|
import { GROUP_RESOURCE_TYPE } from "../org/group.js";
|
|
3
|
-
|
|
3
|
+
import { roleServiceAccountMembershipErrors } from "./role-membership-check.js";
|
|
4
|
+
import { SERVICE_ACCOUNT_RESOURCE_TYPE } from "./resource-type.js";
|
|
5
|
+
export { SERVICE_ACCOUNT_RESOURCE_TYPE };
|
|
4
6
|
export const SERVICE_ACCOUNT_ACCESS_POLICY_RESOURCE_TYPE = "elementum_service_account_access_policy";
|
|
5
7
|
export const serviceAccountModule = {
|
|
6
8
|
kind: "service-account",
|
|
@@ -19,6 +21,7 @@ export const serviceAccountModule = {
|
|
|
19
21
|
lifecycle: NO_LIFECYCLE,
|
|
20
22
|
canvas: NO_CANVAS,
|
|
21
23
|
catalog: NO_CATALOG,
|
|
24
|
+
buildChecks: { validateBuiltRoots: roleServiceAccountMembershipErrors },
|
|
22
25
|
roundtrip: {
|
|
23
26
|
referenceAliases: [],
|
|
24
27
|
// Provider set attributes (edk#2437): order carries no meaning.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { BuildCheckFailure, BuiltRootSource } from "../../graph/types.js";
|
|
2
|
+
/**
|
|
3
|
+
* A role's `service_account_ids` and a service account's `role_ids` write the
|
|
4
|
+
* same membership. When both lists are set and disagree about one role and
|
|
5
|
+
* one account, each apply undoes the other forever (edk#2159), so the build
|
|
6
|
+
* stops and names both. Agreement is left alone: on one app both sides naming
|
|
7
|
+
* each other is a dependency cycle that tofu already reports.
|
|
8
|
+
*
|
|
9
|
+
* A role list never holds a raw id (build resolves every account it names), but
|
|
10
|
+
* an account's `role_ids` can (pull keeps another app's role as
|
|
11
|
+
* `unsafePlatformId`), and this check can't tell which role a raw id is. So a
|
|
12
|
+
* role that lists the account is not reported against an account list holding
|
|
13
|
+
* raw ids, and an account list made only of raw ids never names a role here:
|
|
14
|
+
* it is not compared, including when the role's list leaves that account out.
|
|
15
|
+
*
|
|
16
|
+
* The fix-it text says which property to leave off, chosen by which side
|
|
17
|
+
* claims the membership. Leaving a list off is not the same as `[]` (#2124),
|
|
18
|
+
* and naming the membership on both sides is a dependency cycle on one app.
|
|
19
|
+
*/
|
|
20
|
+
export declare function roleServiceAccountMembershipErrors(roots: readonly BuiltRootSource[]): BuildCheckFailure[];
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { isTfExpr } from "../../engine/tf/index.js";
|
|
2
|
+
import { ROLE_RESOURCE_TYPE, roleModule } from "../org/role.js";
|
|
3
|
+
import { SERVICE_ACCOUNT_RESOURCE_TYPE } from "./resource-type.js";
|
|
4
|
+
function sideOf(block, attr, name) {
|
|
5
|
+
const list = block.attrs[attr];
|
|
6
|
+
if (!Array.isArray(list) || block.label === undefined)
|
|
7
|
+
return undefined;
|
|
8
|
+
const members = new Set();
|
|
9
|
+
let hasRawId = false;
|
|
10
|
+
for (const item of list) {
|
|
11
|
+
if (isTfExpr(item) && item.$expr === "resource-attr")
|
|
12
|
+
members.add(`${item.type}.${item.label}`);
|
|
13
|
+
else if (typeof item === "string")
|
|
14
|
+
hasRawId = true;
|
|
15
|
+
}
|
|
16
|
+
return { address: `${block.type}.${block.label}`, name, members, hasRawId };
|
|
17
|
+
}
|
|
18
|
+
function accountName(block) {
|
|
19
|
+
const first = block.attrs["first_name"];
|
|
20
|
+
const last = block.attrs["last_name"];
|
|
21
|
+
return typeof first === "string" && typeof last === "string" ? `${first} ${last}`.trim() : block.label ?? "?";
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* A role's `service_account_ids` and a service account's `role_ids` write the
|
|
25
|
+
* same membership. When both lists are set and disagree about one role and
|
|
26
|
+
* one account, each apply undoes the other forever (edk#2159), so the build
|
|
27
|
+
* stops and names both. Agreement is left alone: on one app both sides naming
|
|
28
|
+
* each other is a dependency cycle that tofu already reports.
|
|
29
|
+
*
|
|
30
|
+
* A role list never holds a raw id (build resolves every account it names), but
|
|
31
|
+
* an account's `role_ids` can (pull keeps another app's role as
|
|
32
|
+
* `unsafePlatformId`), and this check can't tell which role a raw id is. So a
|
|
33
|
+
* role that lists the account is not reported against an account list holding
|
|
34
|
+
* raw ids, and an account list made only of raw ids never names a role here:
|
|
35
|
+
* it is not compared, including when the role's list leaves that account out.
|
|
36
|
+
*
|
|
37
|
+
* The fix-it text says which property to leave off, chosen by which side
|
|
38
|
+
* claims the membership. Leaving a list off is not the same as `[]` (#2124),
|
|
39
|
+
* and naming the membership on both sides is a dependency cycle on one app.
|
|
40
|
+
*/
|
|
41
|
+
export function roleServiceAccountMembershipErrors(roots) {
|
|
42
|
+
const blocks = roots.flatMap((root) => root.blocks);
|
|
43
|
+
const roles = blocks
|
|
44
|
+
.filter((block) => block.kind === "resource" && block.type === ROLE_RESOURCE_TYPE)
|
|
45
|
+
.map((block) => sideOf(block, "service_account_ids", typeof block.attrs["name"] === "string" ? block.attrs["name"] : block.label ?? "?"))
|
|
46
|
+
.filter((side) => side !== undefined);
|
|
47
|
+
if (roles.length === 0)
|
|
48
|
+
return [];
|
|
49
|
+
const accounts = blocks
|
|
50
|
+
.filter((block) => block.kind === "resource" && block.type === SERVICE_ACCOUNT_RESOURCE_TYPE)
|
|
51
|
+
.map((block) => sideOf(block, "role_ids", accountName(block)))
|
|
52
|
+
.filter((side) => side !== undefined);
|
|
53
|
+
const errors = [];
|
|
54
|
+
for (const role of roles) {
|
|
55
|
+
for (const account of accounts) {
|
|
56
|
+
const roleSays = role.members.has(account.address);
|
|
57
|
+
const accountSays = account.members.has(role.address);
|
|
58
|
+
if (roleSays === accountSays)
|
|
59
|
+
continue;
|
|
60
|
+
if (roleSays && account.hasRawId)
|
|
61
|
+
continue;
|
|
62
|
+
const disagreement = roleSays
|
|
63
|
+
? `the role's serviceAccounts list names the account, but the account's roles list leaves the role out`
|
|
64
|
+
: `the account's roles list names the role, but the role's serviceAccounts list leaves the account out`;
|
|
65
|
+
const fix = roleSays
|
|
66
|
+
? `If the account should hold the role, leave the roles property off the account (not roles: []) so the role's serviceAccounts decides. ` +
|
|
67
|
+
`If it shouldn't, take the account out of the role's serviceAccounts.`
|
|
68
|
+
: `If the account should hold the role, leave the serviceAccounts property off the role (not serviceAccounts: []) so the account's roles decide. ` +
|
|
69
|
+
`If it shouldn't, take the role out of the account's roles.`;
|
|
70
|
+
errors.push({
|
|
71
|
+
address: role.address,
|
|
72
|
+
name: role.name,
|
|
73
|
+
ownerKind: roleModule.kind,
|
|
74
|
+
message: `role "${role.name}" (${role.address}) and service account "${account.name}" (${account.address}) both set whether the account holds the role, and they disagree: ${disagreement}. ` +
|
|
75
|
+
`Each apply would undo the other. ${fix}`,
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return errors;
|
|
80
|
+
}
|
|
@@ -5,6 +5,21 @@ import type { FromTfContext } from "../../engine/pull/context.js";
|
|
|
5
5
|
* recursive pull's namespace -> refName and display-name -> refName maps.
|
|
6
6
|
*/
|
|
7
7
|
export declare function dataAspectDisplayName(ctx: FromTfContext, kind: "app" | "element" | "task", label: string): string | undefined;
|
|
8
|
+
/**
|
|
9
|
+
* Workspace catalog key for an app or element the export named by its
|
|
10
|
+
* namespace. Prefer the workspace namespace map (case-insensitive via
|
|
11
|
+
* {@link lookupNamespaceMap}). A known namespace that is not on disk must
|
|
12
|
+
* not fall through to the display-name map — that map is not unique and
|
|
13
|
+
* can silently bind another app (#2667 B1). Without a namespace, a unique
|
|
14
|
+
* display-name or sanitized terraform-label match is still allowed.
|
|
15
|
+
*/
|
|
16
|
+
export declare function catalogRefForAspectOwner(input: {
|
|
17
|
+
readonly namespace?: string;
|
|
18
|
+
readonly name?: string;
|
|
19
|
+
readonly tfLabel?: string;
|
|
20
|
+
readonly refNamesByNamespace?: ReadonlyMap<string, string>;
|
|
21
|
+
readonly refNamesByName?: ReadonlyMap<string, string>;
|
|
22
|
+
}): string | undefined;
|
|
8
23
|
/** Resolve the stable pulled catalog key for the same foreign lookup. */
|
|
9
24
|
export declare function dataAspectRefName(ctx: FromTfContext, kind: "app" | "element" | "task", label: string, displayName?: string): string | undefined;
|
|
10
25
|
/**
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { lookupNamespaceMap } from "../../engine/pull/authored-root.js";
|
|
1
2
|
import { sanitizeName, tfLabelToTsLabel } from "../../engine/tf/index.js";
|
|
2
3
|
/**
|
|
3
4
|
* Resolve a foreign app/element data lookup to its display name. Ref-only
|
|
@@ -25,6 +26,41 @@ export function dataAspectDisplayName(ctx, kind, label) {
|
|
|
25
26
|
const names = kind === "app" ? ctx.foreignAppRefNames : kind === "element" ? ctx.foreignElementRefNames : undefined;
|
|
26
27
|
return [...(names?.entries() ?? [])].find(([, candidateRefName]) => candidateRefName === refName)?.[0];
|
|
27
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* Workspace catalog key for an app or element the export named by its
|
|
31
|
+
* namespace. Prefer the workspace namespace map (case-insensitive via
|
|
32
|
+
* {@link lookupNamespaceMap}). A known namespace that is not on disk must
|
|
33
|
+
* not fall through to the display-name map — that map is not unique and
|
|
34
|
+
* can silently bind another app (#2667 B1). Without a namespace, a unique
|
|
35
|
+
* display-name or sanitized terraform-label match is still allowed.
|
|
36
|
+
*/
|
|
37
|
+
export function catalogRefForAspectOwner(input) {
|
|
38
|
+
const namespace = input.namespace !== undefined && input.namespace !== "" ? input.namespace : undefined;
|
|
39
|
+
if (namespace !== undefined) {
|
|
40
|
+
if (input.refNamesByNamespace !== undefined) {
|
|
41
|
+
const byNamespace = lookupNamespaceMap(input.refNamesByNamespace, namespace);
|
|
42
|
+
if (byNamespace !== undefined)
|
|
43
|
+
return byNamespace;
|
|
44
|
+
throw new Error(`table source namespace ${JSON.stringify(namespace)} is not in this workspace; ` +
|
|
45
|
+
"pull that app or element first so the table can use its refName " +
|
|
46
|
+
"(refusing a display-name guess that could bind a different app)");
|
|
47
|
+
}
|
|
48
|
+
return tfLabelToTsLabel(sanitizeName(namespace));
|
|
49
|
+
}
|
|
50
|
+
if (input.name !== undefined && input.name !== "") {
|
|
51
|
+
const byName = input.refNamesByName?.get(input.name);
|
|
52
|
+
if (byName !== undefined)
|
|
53
|
+
return byName;
|
|
54
|
+
}
|
|
55
|
+
if (input.tfLabel !== undefined && input.refNamesByNamespace !== undefined) {
|
|
56
|
+
const refs = [...new Set([...input.refNamesByNamespace.entries()]
|
|
57
|
+
.filter(([candidate]) => sanitizeName(candidate) === input.tfLabel)
|
|
58
|
+
.map(([, refName]) => refName))];
|
|
59
|
+
if (refs.length === 1)
|
|
60
|
+
return refs[0];
|
|
61
|
+
}
|
|
62
|
+
return input.tfLabel === undefined ? undefined : tfLabelToTsLabel(input.tfLabel);
|
|
63
|
+
}
|
|
28
64
|
/** Resolve the stable pulled catalog key for the same foreign lookup. */
|
|
29
65
|
export function dataAspectRefName(ctx, kind, label, displayName) {
|
|
30
66
|
if (kind === "task")
|
|
@@ -79,7 +79,20 @@ export declare function createActionsProxy<TActions extends Record<string, unkno
|
|
|
79
79
|
* into nested object fields (e.g. a DropdownValue's .label) the same way
|
|
80
80
|
* createTriggerProxy/createActionOutputProxy do.
|
|
81
81
|
*/
|
|
82
|
-
export type ForEachItem<T> = Ref<T> & DeepRefs<T
|
|
82
|
+
export type ForEachItem<T> = Ref<T> & DeepRefs<T> & {
|
|
83
|
+
/**
|
|
84
|
+
* The loop's own position, the same for every collection kind: whether
|
|
85
|
+
* this is the first or last item, the iteration number, and the number of
|
|
86
|
+
* items (the platform's "Is First Item", "Is Last Item", "Iteration" and
|
|
87
|
+
* "Total Size"), e.g. `filter.boolean(ctx.item.metadata.last)`.
|
|
88
|
+
*/
|
|
89
|
+
readonly metadata: DeepRefs<{
|
|
90
|
+
readonly first: boolean;
|
|
91
|
+
readonly last: boolean;
|
|
92
|
+
readonly iteration: number;
|
|
93
|
+
readonly size: number;
|
|
94
|
+
}>;
|
|
95
|
+
};
|
|
83
96
|
/**
|
|
84
97
|
* Creates a forEach item proxy.
|
|
85
98
|
* item.fieldName → Ref with { kind: "forEach", forEachActionName, name: "fieldName" }
|
|
@@ -253,6 +253,8 @@ export type RefExpr =
|
|
|
253
253
|
| {
|
|
254
254
|
kind: "triggerRef";
|
|
255
255
|
path: readonly string[];
|
|
256
|
+
/** Pulled record trigger ref name the trigger output type doesn't declare (#2643). */
|
|
257
|
+
undeclaredHead?: true;
|
|
256
258
|
}
|
|
257
259
|
/** Reference to a forEach loop variable: `ctx.actions.<forEachTask>.<path...>`. */
|
|
258
260
|
| {
|