@elementumai/edk 0.12.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 +2 -0
- 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/types/app.d.ts +6 -0
- package/dist-sdk/src/engine/build/context.d.ts +3 -0
- 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 +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 +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 +7 -0
- package/dist-sdk/src/entities/access-policy/from-tf.js +18 -3
- 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 +33 -13
- package/dist-sdk/src/entities/app/build.js +14 -12
- package/dist-sdk/src/entities/app/from-tf.js +24 -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 +1 -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.js +70 -27
- package/dist-sdk/src/entities/automation/deserializer/print-automation.js +20 -5
- package/dist-sdk/src/entities/automation/from-tf.d.ts +26 -5
- package/dist-sdk/src/entities/automation/from-tf.js +593 -101
- package/dist-sdk/src/entities/automation/index.d.ts +1 -0
- 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/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 +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 +3 -0
- package/dist-sdk/src/entities/automation/to-tf.js +337 -77
- 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/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.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 +1 -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 +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 +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 +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/filters/ast.d.ts +2 -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/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 +2 -1
- package/dist-sdk/src/entities/view/from-tf.js +7 -4
- package/dist-sdk/src/entities/widget/from-tf.js +13 -2
- 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 +5 -0
- package/dist-sdk/src/graph/index.js +7 -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 +78 -6
- package/package.json +6 -3
|
@@ -9,5 +9,6 @@ export { connectorModule } from "./connector.js";
|
|
|
9
9
|
export { emailAliasModule } from "./email-alias.js";
|
|
10
10
|
export { groupModule } from "./group.js";
|
|
11
11
|
export { phoneProviderModule } from "./phone-provider.js";
|
|
12
|
+
export { voiceAuthModule } from "./voice-auth.js";
|
|
12
13
|
export { roleModule } from "./role.js";
|
|
13
14
|
export { userModule } from "./user.js";
|
|
@@ -9,5 +9,6 @@ export { connectorModule } from "./connector.js";
|
|
|
9
9
|
export { emailAliasModule } from "./email-alias.js";
|
|
10
10
|
export { groupModule } from "./group.js";
|
|
11
11
|
export { phoneProviderModule } from "./phone-provider.js";
|
|
12
|
+
export { voiceAuthModule } from "./voice-auth.js";
|
|
12
13
|
export { roleModule } from "./role.js";
|
|
13
14
|
export { userModule } from "./user.js";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** Voice auth configs: org-owned reference identities, name-keyed data lookups. */
|
|
2
|
+
import { type EntityKindModule } from "../../graph/types.js";
|
|
3
|
+
export declare const VOICE_AUTH_RESOURCE_TYPE = "elementum_voice_auth_config";
|
|
4
|
+
export declare const VOICE_AUTH_ORG_BAG: "voiceAuths";
|
|
5
|
+
export declare const voiceAuthModule: EntityKindModule;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/** Voice auth configs: org-owned reference identities, name-keyed data lookups. */
|
|
2
|
+
import { namedOnlyFactoryEntry } from "../../catalog/render-helpers.js";
|
|
3
|
+
export const VOICE_AUTH_RESOURCE_TYPE = "elementum_voice_auth_config";
|
|
4
|
+
export const VOICE_AUTH_ORG_BAG = "voiceAuths";
|
|
5
|
+
export const voiceAuthModule = {
|
|
6
|
+
kind: "voice-auth",
|
|
7
|
+
stream: { role: "streamMember" },
|
|
8
|
+
data: {
|
|
9
|
+
participates: true,
|
|
10
|
+
resourceType: VOICE_AUTH_RESOURCE_TYPE,
|
|
11
|
+
lookupAttr: "name",
|
|
12
|
+
catalogKind: "voiceAuth",
|
|
13
|
+
orgBag: VOICE_AUTH_ORG_BAG,
|
|
14
|
+
referencedByBuild: true,
|
|
15
|
+
managedInOrganization: true,
|
|
16
|
+
},
|
|
17
|
+
authoring: { unit: "inline", bag: "voiceAuths" },
|
|
18
|
+
parents: [{ parent: "org", child: "voice-auth" }],
|
|
19
|
+
resource: { shape: "single", resourceType: VOICE_AUTH_RESOURCE_TYPE, adoptable: true },
|
|
20
|
+
lifecycle: { participates: true },
|
|
21
|
+
canvas: { participates: true, label: "Voice Auth", glyph: "◉", component: "orgIdentity" },
|
|
22
|
+
catalog: {
|
|
23
|
+
participates: true,
|
|
24
|
+
refKind: "voiceAuth",
|
|
25
|
+
catalogBag: "voiceAuths",
|
|
26
|
+
renderOrder: 116,
|
|
27
|
+
catalogRoot: "org",
|
|
28
|
+
factoryName: "voiceAuthRef",
|
|
29
|
+
renderEntry: namedOnlyFactoryEntry("voiceAuthRef"),
|
|
30
|
+
stubRef: (refName) => ({ __kind: "voiceAuth", refName, name: refName }),
|
|
31
|
+
refFromAuthoring: () => undefined,
|
|
32
|
+
},
|
|
33
|
+
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type OrganizationVoiceAuth } from "./voice-auth.js";
|
|
1
2
|
import type { RoleUserRef } from "../role/build.js";
|
|
2
3
|
export interface OrganizationCategory {
|
|
3
4
|
readonly name: string;
|
|
@@ -227,6 +228,7 @@ export interface DefineOrganizationOptions {
|
|
|
227
228
|
readonly cloudLinks?: Readonly<Record<string, OrganizationCloudLink>>;
|
|
228
229
|
readonly emailAliases?: Readonly<Record<string, OrganizationEmailAlias>>;
|
|
229
230
|
readonly phoneProviders?: Readonly<Record<string, OrganizationPhoneProvider>>;
|
|
231
|
+
readonly voiceAuths?: Readonly<Record<string, OrganizationVoiceAuth>>;
|
|
230
232
|
}
|
|
231
233
|
export interface ConfiguredOrganization {
|
|
232
234
|
readonly kind: "organizationConfig";
|
|
@@ -235,6 +237,7 @@ export interface ConfiguredOrganization {
|
|
|
235
237
|
readonly cloudLinks: Readonly<Record<string, OrganizationCloudLink>>;
|
|
236
238
|
readonly emailAliases: Readonly<Record<string, OrganizationEmailAlias>>;
|
|
237
239
|
readonly phoneProviders: Readonly<Record<string, OrganizationPhoneProvider>>;
|
|
240
|
+
readonly voiceAuths: Readonly<Record<string, OrganizationVoiceAuth>>;
|
|
238
241
|
}
|
|
239
242
|
/** Organization-owned resources live in one ergonomic, optional `organization.ts` file. */
|
|
240
243
|
export declare function organization(opts: DefineOrganizationOptions): ConfiguredOrganization;
|
|
@@ -143,6 +143,7 @@ export function organization(opts) {
|
|
|
143
143
|
requireNames("groups", opts.groups);
|
|
144
144
|
requireNames("cloudLinks", opts.cloudLinks);
|
|
145
145
|
requireNames("phoneProviders", opts.phoneProviders);
|
|
146
|
+
requireNames("voiceAuths", opts.voiceAuths);
|
|
146
147
|
for (const [key, value] of Object.entries(opts.emailAliases ?? {})) {
|
|
147
148
|
if (key.trim() === "" || value.alias.trim() === "")
|
|
148
149
|
throw new EdkValidationError(`organization emailAliases.${key} must have a non-empty alias.`);
|
|
@@ -161,5 +162,6 @@ export function organization(opts) {
|
|
|
161
162
|
cloudLinks: opts.cloudLinks ?? {},
|
|
162
163
|
emailAliases: opts.emailAliases ?? {},
|
|
163
164
|
phoneProviders: opts.phoneProviders ?? {},
|
|
165
|
+
voiceAuths: opts.voiceAuths ?? {},
|
|
164
166
|
};
|
|
165
167
|
}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
export { organization, apiCloudLink, bearerTokenCredentials, bigQueryCloudLink, cloudLinkScheduleUnit, cloudLinkUsageType, cloudLinkWarehouseSize, databricksCloudLink, emailAlias, elementumCloudLink, elementumSnowflakeCloudLink, externalOauthCredentials, passwordCredentials, privateKeyCredentials, serviceAccountCredentials, snowflakeCloudLink, twilioPhoneProvider, type ConfiguredOrganization, type DefineOrganizationOptions, type OrganizationCategory, type OrganizationGroup, redactedSecret, secret, unavailableValue, type CloudLinkCredentials, type CloudLinkSchedule, type CloudLinkScheduleUnit, type CloudLinkUsageType, type CloudLinkWarehouseSize, type OrganizationCloudLink, type OrganizationEmailAlias, type OrganizationPhoneProvider, type OrganizationSecret, type OrganizationSecretValue, type RedactedOrganizationSecret, type UnavailableOrganizationValue, } from "./build.js";
|
|
2
|
+
export { knownCallerAuth, unknownCallerAuth, voiceAuth, voiceAuthFailureAction, type KnownCallerAuth, type OrganizationVoiceAuth, type UnknownCallerAuth, type VoiceAuthCallerTreatment, type VoiceAuthEndCall, type VoiceAuthFailure, type VoiceAuthFailureAction, type VoiceAuthHandoff, type VoiceAuthOtpRecovery, } from "./voice-auth.js";
|
|
2
3
|
export { userRef, type RoleUserRef as OrganizationUserRef } from "../role/build.js";
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
export { organization, apiCloudLink, bearerTokenCredentials, bigQueryCloudLink, cloudLinkScheduleUnit, cloudLinkUsageType, cloudLinkWarehouseSize, databricksCloudLink, emailAlias, elementumCloudLink, elementumSnowflakeCloudLink, externalOauthCredentials, passwordCredentials, privateKeyCredentials, serviceAccountCredentials, snowflakeCloudLink, twilioPhoneProvider, redactedSecret, secret, unavailableValue, } from "./build.js";
|
|
2
|
+
export { knownCallerAuth, unknownCallerAuth, voiceAuth, voiceAuthFailureAction, } from "./voice-auth.js";
|
|
2
3
|
export { userRef } from "../role/build.js";
|
|
@@ -5,3 +5,5 @@ export declare function organizationToTf(organization: ConfiguredOrganization, c
|
|
|
5
5
|
readonly orgRefs: OrgRefLookup;
|
|
6
6
|
readonly diagnostics?: string[];
|
|
7
7
|
}): TfBlock[];
|
|
8
|
+
/** Resource HCL for one organization.ts voice auth, used when adoption imports it. */
|
|
9
|
+
export declare function renderVoiceAuthAdoptionResource(label: string, value: unknown): string | undefined;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { expr, sanitizeName, tsLabelToTfLabel } from "../../engine/tf/index.js";
|
|
1
|
+
import { expr, renderBlock, sanitizeName, tsLabelToTfLabel } from "../../engine/tf/index.js";
|
|
2
|
+
import { VOICE_AUTH_RESOURCE_TYPE } from "../org/voice-auth.js";
|
|
3
|
+
import { voiceAuthFailureAction } from "./voice-auth.js";
|
|
2
4
|
const CATEGORY = "elementum_category";
|
|
3
5
|
const GROUP = "elementum_group";
|
|
4
6
|
const USER = "elementum_user";
|
|
@@ -150,5 +152,61 @@ export function organizationToTf(organization, ctx) {
|
|
|
150
152
|
for (const [name, block] of resourceVariables)
|
|
151
153
|
variables.set(name, block);
|
|
152
154
|
}
|
|
155
|
+
for (const [key, config] of Object.entries(organization.voiceAuths)) {
|
|
156
|
+
blocks.push({ kind: "resource", type: VOICE_AUTH_RESOURCE_TYPE, label: tsLabelToTfLabel(key), attrs: voiceAuthAttrs(config) });
|
|
157
|
+
}
|
|
153
158
|
return [...variables.values(), ...blocks];
|
|
154
159
|
}
|
|
160
|
+
/** Resource HCL for one organization.ts voice auth, used when adoption imports it. */
|
|
161
|
+
export function renderVoiceAuthAdoptionResource(label, value) {
|
|
162
|
+
if (!isOrganizationVoiceAuth(value))
|
|
163
|
+
return undefined;
|
|
164
|
+
return renderBlock({
|
|
165
|
+
kind: "resource",
|
|
166
|
+
type: VOICE_AUTH_RESOURCE_TYPE,
|
|
167
|
+
label,
|
|
168
|
+
attrs: voiceAuthAttrs(value),
|
|
169
|
+
}).trimEnd();
|
|
170
|
+
}
|
|
171
|
+
function isOrganizationVoiceAuth(value) {
|
|
172
|
+
if (value === null || typeof value !== "object")
|
|
173
|
+
return false;
|
|
174
|
+
const config = value;
|
|
175
|
+
return typeof config.name === "string" && config.name !== ""
|
|
176
|
+
&& typeof config.knownCallers?.treatment === "string"
|
|
177
|
+
&& typeof config.unknownCallers?.treatment === "string"
|
|
178
|
+
&& typeof config.failure?.action === "string";
|
|
179
|
+
}
|
|
180
|
+
function voiceAuthAttrs(config) {
|
|
181
|
+
const knownCallers = { treatment: config.knownCallers.treatment };
|
|
182
|
+
if (config.knownCallers.firstMessage !== undefined)
|
|
183
|
+
knownCallers["first_message"] = config.knownCallers.firstMessage;
|
|
184
|
+
const unknownCallers = { treatment: config.unknownCallers.treatment };
|
|
185
|
+
if (config.unknownCallers.firstMessage !== undefined)
|
|
186
|
+
unknownCallers["first_message"] = config.unknownCallers.firstMessage;
|
|
187
|
+
const failure = { action: config.failure.action };
|
|
188
|
+
if (config.failure.action === voiceAuthFailureAction.handoff) {
|
|
189
|
+
failure["handoff"] = { phone_number: config.failure.phoneNumber, message: config.failure.message };
|
|
190
|
+
}
|
|
191
|
+
else if (config.failure.message !== undefined) {
|
|
192
|
+
failure["end_call_message"] = config.failure.message;
|
|
193
|
+
}
|
|
194
|
+
const attrs = {
|
|
195
|
+
name: config.name,
|
|
196
|
+
known_callers: knownCallers,
|
|
197
|
+
unknown_callers: unknownCallers,
|
|
198
|
+
failure,
|
|
199
|
+
};
|
|
200
|
+
if (config.instructions !== undefined)
|
|
201
|
+
attrs["instructions"] = config.instructions;
|
|
202
|
+
if (config.firstMessage !== undefined)
|
|
203
|
+
attrs["first_message"] = config.firstMessage;
|
|
204
|
+
if (config.otpRecovery !== undefined) {
|
|
205
|
+
attrs["otp_recovery"] = {
|
|
206
|
+
allow_employee_id_correction: config.otpRecovery.allowEmployeeIdCorrection,
|
|
207
|
+
allow_otp_resend: config.otpRecovery.allowOtpResend,
|
|
208
|
+
repeat_provided_employee_id: config.otpRecovery.repeatProvidedEmployeeId,
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
return attrs;
|
|
212
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/** How a voice auth config treats a caller whose number is already known. */
|
|
2
|
+
export declare const knownCallerAuth: {
|
|
3
|
+
readonly continue: "CONTINUE";
|
|
4
|
+
readonly employeeIdAndOtp: "EMPLOYEE_ID_OTP";
|
|
5
|
+
readonly pin: "PIN";
|
|
6
|
+
};
|
|
7
|
+
export type KnownCallerAuth = (typeof knownCallerAuth)[keyof typeof knownCallerAuth];
|
|
8
|
+
/** How a voice auth config treats a caller whose number is not known. */
|
|
9
|
+
export declare const unknownCallerAuth: {
|
|
10
|
+
readonly continue: "CONTINUE";
|
|
11
|
+
readonly stop: "DO_NOT_CONTINUE";
|
|
12
|
+
readonly employeeIdAndOtp: "EMPLOYEE_ID_OTP";
|
|
13
|
+
};
|
|
14
|
+
export type UnknownCallerAuth = (typeof unknownCallerAuth)[keyof typeof unknownCallerAuth];
|
|
15
|
+
/** What a voice auth config does when verification fails. */
|
|
16
|
+
export declare const voiceAuthFailureAction: {
|
|
17
|
+
readonly endCall: "END_CALL";
|
|
18
|
+
readonly handoff: "HANDOFF";
|
|
19
|
+
};
|
|
20
|
+
export type VoiceAuthFailureAction = (typeof voiceAuthFailureAction)[keyof typeof voiceAuthFailureAction];
|
|
21
|
+
export interface VoiceAuthCallerTreatment<Treatment extends string> {
|
|
22
|
+
readonly treatment: Treatment;
|
|
23
|
+
readonly firstMessage?: string;
|
|
24
|
+
}
|
|
25
|
+
/** End the call, optionally after speaking a message. */
|
|
26
|
+
export interface VoiceAuthEndCall {
|
|
27
|
+
readonly action: typeof voiceAuthFailureAction.endCall;
|
|
28
|
+
readonly message?: string;
|
|
29
|
+
}
|
|
30
|
+
/** Transfer the caller to another number. */
|
|
31
|
+
export interface VoiceAuthHandoff {
|
|
32
|
+
readonly action: typeof voiceAuthFailureAction.handoff;
|
|
33
|
+
readonly phoneNumber: `+${number}`;
|
|
34
|
+
readonly message: string;
|
|
35
|
+
}
|
|
36
|
+
export type VoiceAuthFailure = VoiceAuthEndCall | VoiceAuthHandoff;
|
|
37
|
+
export interface VoiceAuthOtpRecovery {
|
|
38
|
+
readonly allowEmployeeIdCorrection: boolean;
|
|
39
|
+
readonly allowOtpResend: boolean;
|
|
40
|
+
readonly repeatProvidedEmployeeId: boolean;
|
|
41
|
+
}
|
|
42
|
+
export interface OrganizationVoiceAuth {
|
|
43
|
+
readonly name: string;
|
|
44
|
+
readonly instructions?: string;
|
|
45
|
+
readonly firstMessage?: string;
|
|
46
|
+
readonly knownCallers: VoiceAuthCallerTreatment<KnownCallerAuth>;
|
|
47
|
+
readonly unknownCallers: VoiceAuthCallerTreatment<UnknownCallerAuth>;
|
|
48
|
+
readonly failure: VoiceAuthFailure;
|
|
49
|
+
readonly otpRecovery?: VoiceAuthOtpRecovery;
|
|
50
|
+
}
|
|
51
|
+
/** An organization-owned voice authentication policy for phone services. */
|
|
52
|
+
export declare function voiceAuth(opts: {
|
|
53
|
+
readonly name: string;
|
|
54
|
+
readonly instructions?: string;
|
|
55
|
+
readonly firstMessage?: string;
|
|
56
|
+
readonly knownCallers: VoiceAuthCallerTreatment<KnownCallerAuth>;
|
|
57
|
+
readonly unknownCallers: VoiceAuthCallerTreatment<UnknownCallerAuth>;
|
|
58
|
+
readonly failure: VoiceAuthFailure;
|
|
59
|
+
readonly otpRecovery?: VoiceAuthOtpRecovery;
|
|
60
|
+
}): OrganizationVoiceAuth;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { EdkValidationError } from "../../../elementum-entity-client/errors.js";
|
|
2
|
+
/** How a voice auth config treats a caller whose number is already known. */
|
|
3
|
+
export const knownCallerAuth = {
|
|
4
|
+
continue: "CONTINUE",
|
|
5
|
+
employeeIdAndOtp: "EMPLOYEE_ID_OTP",
|
|
6
|
+
pin: "PIN",
|
|
7
|
+
};
|
|
8
|
+
/** How a voice auth config treats a caller whose number is not known. */
|
|
9
|
+
export const unknownCallerAuth = {
|
|
10
|
+
continue: "CONTINUE",
|
|
11
|
+
stop: "DO_NOT_CONTINUE",
|
|
12
|
+
employeeIdAndOtp: "EMPLOYEE_ID_OTP",
|
|
13
|
+
};
|
|
14
|
+
/** What a voice auth config does when verification fails. */
|
|
15
|
+
export const voiceAuthFailureAction = {
|
|
16
|
+
endCall: "END_CALL",
|
|
17
|
+
handoff: "HANDOFF",
|
|
18
|
+
};
|
|
19
|
+
const E164 = /^\+[1-9]\d{7,14}$/;
|
|
20
|
+
function requireTreatment(where, value, allowed) {
|
|
21
|
+
if (value === undefined)
|
|
22
|
+
throw new EdkValidationError(`${where} is required.`);
|
|
23
|
+
if (!Object.values(allowed).includes(value.treatment)) {
|
|
24
|
+
throw new EdkValidationError(`${where}.treatment ${JSON.stringify(value.treatment)} is not supported.`);
|
|
25
|
+
}
|
|
26
|
+
return value;
|
|
27
|
+
}
|
|
28
|
+
/** An organization-owned voice authentication policy for phone services. */
|
|
29
|
+
export function voiceAuth(opts) {
|
|
30
|
+
if (opts.name.trim() === "")
|
|
31
|
+
throw new EdkValidationError("voiceAuth name must be non-empty.");
|
|
32
|
+
const knownCallers = requireTreatment("voiceAuth knownCallers", opts.knownCallers, knownCallerAuth);
|
|
33
|
+
const unknownCallers = requireTreatment("voiceAuth unknownCallers", opts.unknownCallers, unknownCallerAuth);
|
|
34
|
+
const failure = opts.failure;
|
|
35
|
+
if (failure === undefined)
|
|
36
|
+
throw new EdkValidationError("voiceAuth failure is required.");
|
|
37
|
+
if (failure.action === voiceAuthFailureAction.handoff) {
|
|
38
|
+
if (!E164.test(failure.phoneNumber)) {
|
|
39
|
+
throw new EdkValidationError("voiceAuth failure phoneNumber must be an E.164 number such as +14155551234.");
|
|
40
|
+
}
|
|
41
|
+
if (failure.message.trim() === "")
|
|
42
|
+
throw new EdkValidationError("voiceAuth handoff message must be non-empty.");
|
|
43
|
+
}
|
|
44
|
+
else if (failure.action === voiceAuthFailureAction.endCall) {
|
|
45
|
+
// Accepted. A message is optional.
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
const unexpected = failure;
|
|
49
|
+
throw new EdkValidationError(`voiceAuth failure action ${JSON.stringify(unexpected)} is not supported.`);
|
|
50
|
+
}
|
|
51
|
+
return {
|
|
52
|
+
name: opts.name,
|
|
53
|
+
...(opts.instructions !== undefined ? { instructions: opts.instructions } : {}),
|
|
54
|
+
...(opts.firstMessage !== undefined ? { firstMessage: opts.firstMessage } : {}),
|
|
55
|
+
knownCallers,
|
|
56
|
+
unknownCallers,
|
|
57
|
+
failure,
|
|
58
|
+
...(opts.otpRecovery !== undefined ? { otpRecovery: opts.otpRecovery } : {}),
|
|
59
|
+
};
|
|
60
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type AgentRef, type CatalogRef, type PhoneProviderRef, type PhoneServiceRef } from "../../catalog/index.js";
|
|
1
|
+
import { type AgentRef, type CatalogRef, type PhoneProviderRef, type PhoneServiceRef, type VoiceAuthRef } from "../../catalog/index.js";
|
|
2
2
|
import type { DeployableEntity, EntityDeployOptions } from "../../engine/entity.js";
|
|
3
3
|
import { type PhoneServiceNumber } from "./types.js";
|
|
4
4
|
/**
|
|
@@ -9,6 +9,14 @@ export type PhoneServiceOptions<AppRefName extends string = string> = EntityDepl
|
|
|
9
9
|
readonly app: CatalogRef<"app", AppRefName>;
|
|
10
10
|
readonly agent: AgentRef<NoInfer<AppRefName>>;
|
|
11
11
|
readonly provider: PhoneProviderRef;
|
|
12
|
+
/**
|
|
13
|
+
* Organization voice-auth policy applied to calls on this number.
|
|
14
|
+
* `catalog.voiceAuths.<key>` after `pull org`. `{ name }` addresses a policy
|
|
15
|
+
* authored in `organization.ts` in the same apply, before that catalog key exists.
|
|
16
|
+
*/
|
|
17
|
+
readonly voiceAuth?: VoiceAuthRef | {
|
|
18
|
+
readonly name: string;
|
|
19
|
+
};
|
|
12
20
|
};
|
|
13
21
|
export interface PhoneServiceConfigured {
|
|
14
22
|
ref(refName: string): PhoneServiceRef;
|
|
@@ -23,6 +23,7 @@ export function phoneService(opts) {
|
|
|
23
23
|
...(opts.twilioExistingNumber !== undefined ? { twilioExistingNumber: opts.twilioExistingNumber } : {}),
|
|
24
24
|
...(opts.twilioNewNumber !== undefined ? { twilioNewNumber: opts.twilioNewNumber } : {}),
|
|
25
25
|
...(opts.registration !== undefined ? { registration: opts.registration } : {}),
|
|
26
|
+
...(opts.voiceAuth !== undefined ? { voiceAuth: opts.voiceAuth } : {}),
|
|
26
27
|
}),
|
|
27
28
|
...(opts.enabled !== undefined ? { enabled: opts.enabled } : {}),
|
|
28
29
|
};
|
|
@@ -27,6 +27,9 @@ export function printPhoneService(service, opts) {
|
|
|
27
27
|
lines.push(` app: catalog.${opts.appRefName},`);
|
|
28
28
|
lines.push(` agent: catalog.${opts.appRefName}.agents.${service.agentKey},`);
|
|
29
29
|
lines.push(` provider: catalog.phoneProviders.${service.providerKey},`);
|
|
30
|
+
if (service.voiceAuthKey !== undefined) {
|
|
31
|
+
lines.push(` voiceAuth: catalog.voiceAuths.${service.voiceAuthKey},`);
|
|
32
|
+
}
|
|
30
33
|
if (service.callerAccessMode !== undefined) {
|
|
31
34
|
lines.push(` callerAccessMode: callerAccessMode.${constantKey(callerAccessMode, service.callerAccessMode)},`);
|
|
32
35
|
}
|
|
@@ -5,6 +5,7 @@ export interface NormalizedPhoneService {
|
|
|
5
5
|
readonly refName: string;
|
|
6
6
|
readonly agentKey: string;
|
|
7
7
|
readonly providerKey: string;
|
|
8
|
+
readonly voiceAuthKey?: string;
|
|
8
9
|
readonly callerAccessMode?: CallerAccessMode;
|
|
9
10
|
readonly twilioExistingNumber?: {
|
|
10
11
|
readonly phoneNumber: E164PhoneNumber;
|
|
@@ -2,9 +2,10 @@ import { dataRefLabel, optionalString, plainObject, resourceRefLabel } from "../
|
|
|
2
2
|
import { scopedLabelToBagKey, tfLabelToTsLabel } from "../../engine/tf/index.js";
|
|
3
3
|
import { AGENT_RESOURCE_TYPE } from "../agent/module.js";
|
|
4
4
|
import { APP_RESOURCE_TYPE } from "../app/module.js";
|
|
5
|
+
import { VOICE_AUTH_RESOURCE_TYPE } from "../org/voice-auth.js";
|
|
5
6
|
import { callerAccessMode } from "./types.js";
|
|
6
7
|
const KNOWN_ATTRS = new Set([
|
|
7
|
-
"app_id", "provider_id", "agent_id", "caller_access_mode", "twilio_existing_number",
|
|
8
|
+
"app_id", "provider_id", "agent_id", "caller_access_mode", "voice_auth_config_id", "twilio_existing_number",
|
|
8
9
|
"twilio_new_number", "registration",
|
|
9
10
|
]);
|
|
10
11
|
const CALLER_ACCESS_MODES = new Set(Object.values(callerAccessMode));
|
|
@@ -43,6 +44,11 @@ export function phoneServiceFromTf(block, opts, ctx) {
|
|
|
43
44
|
ctx.diagnostics.push(`${where}: expected exactly one valid Twilio existing number or new area code; skipped`);
|
|
44
45
|
return undefined;
|
|
45
46
|
}
|
|
47
|
+
const voiceAuthLabel = dataRefLabel(block.attrs["voice_auth_config_id"], VOICE_AUTH_RESOURCE_TYPE)
|
|
48
|
+
?? resourceRefLabel(block.attrs["voice_auth_config_id"], VOICE_AUTH_RESOURCE_TYPE);
|
|
49
|
+
if (block.attrs["voice_auth_config_id"] !== undefined && voiceAuthLabel === undefined) {
|
|
50
|
+
ctx.diagnostics.push(`${where}: voice_auth_config_id is not a resolvable ${VOICE_AUTH_RESOURCE_TYPE} reference; omitted`);
|
|
51
|
+
}
|
|
46
52
|
const callerAccess = optionalString(block.attrs, "caller_access_mode", where, ctx);
|
|
47
53
|
if (callerAccess !== undefined && !isCallerAccessMode(callerAccess)) {
|
|
48
54
|
ctx.diagnostics.push(`${where}: unsupported caller_access_mode "${callerAccess}"; omitted`);
|
|
@@ -59,6 +65,7 @@ export function phoneServiceFromTf(block, opts, ctx) {
|
|
|
59
65
|
refName: scopedLabelToBagKey(opts.appLabel, label, "app"),
|
|
60
66
|
agentKey: scopedLabelToBagKey(opts.appLabel, agentLabel, "app"),
|
|
61
67
|
providerKey: tfLabelToTsLabel(providerLabel),
|
|
68
|
+
...(voiceAuthLabel !== undefined ? { voiceAuthKey: tfLabelToTsLabel(voiceAuthLabel) } : {}),
|
|
62
69
|
...(callerAccess !== undefined && isCallerAccessMode(callerAccess) ? { callerAccessMode: callerAccess } : {}),
|
|
63
70
|
...(hasExisting ? { twilioExistingNumber: { phoneNumber: existingNumber } } : {}),
|
|
64
71
|
...(hasCreated ? { twilioNewNumber: { areaCode: areaCode } } : {}),
|
|
@@ -3,6 +3,7 @@ import { expr, scopedResourceLabel, tsLabelToTfLabel } from "../../engine/tf/ind
|
|
|
3
3
|
import { APP_RESOURCE_TYPE } from "../app/module.js";
|
|
4
4
|
import { AGENT_RESOURCE_TYPE } from "../agent/module.js";
|
|
5
5
|
import { PHONE_PROVIDER_ORG_BAG } from "../org/phone-provider.js";
|
|
6
|
+
import { VOICE_AUTH_ORG_BAG, VOICE_AUTH_RESOURCE_TYPE } from "../org/voice-auth.js";
|
|
6
7
|
import { PHONE_SERVICE_RESOURCE_TYPE } from "./module.js";
|
|
7
8
|
export function phoneServiceToTf(entity, opts) {
|
|
8
9
|
if (entity.kind !== "phone-service") {
|
|
@@ -29,6 +30,21 @@ export function phoneServiceToTf(entity, opts) {
|
|
|
29
30
|
};
|
|
30
31
|
if (service.callerAccessMode !== undefined)
|
|
31
32
|
attrs["caller_access_mode"] = service.callerAccessMode;
|
|
33
|
+
const voiceAuthWire = service.voiceAuth;
|
|
34
|
+
if (voiceAuthWire !== undefined) {
|
|
35
|
+
const voiceAuth = voiceAuthWire.__kind === "voiceAuth" && voiceAuthWire.refName !== undefined
|
|
36
|
+
? opts.orgRefs.byTsLabel(VOICE_AUTH_ORG_BAG, voiceAuthWire.refName)
|
|
37
|
+
: voiceAuthWire.name !== undefined
|
|
38
|
+
? opts.orgRefs.byName(VOICE_AUTH_ORG_BAG, voiceAuthWire.name)
|
|
39
|
+
: undefined;
|
|
40
|
+
const described = voiceAuthWire.refName ?? voiceAuthWire.name ?? "";
|
|
41
|
+
if (voiceAuth === undefined) {
|
|
42
|
+
throw new EntityTfError(`phone service "${entity.refName}": voice auth "${described}" is not in org.voiceAuths or organization.ts — re-run \`elementum pull org --data-only\` or author it with voiceAuth(...) and pass { name }`);
|
|
43
|
+
}
|
|
44
|
+
attrs["voice_auth_config_id"] = voiceAuth.managed === true
|
|
45
|
+
? expr.resourceAttr(VOICE_AUTH_RESOURCE_TYPE, voiceAuth.tfLabel, ["id"])
|
|
46
|
+
: expr.dataAttr(VOICE_AUTH_RESOURCE_TYPE, voiceAuth.tfLabel, ["id"]);
|
|
47
|
+
}
|
|
32
48
|
if (service.twilioExistingNumber !== undefined) {
|
|
33
49
|
attrs["twilio_existing_number"] = { phone_number: service.twilioExistingNumber.phoneNumber ?? "" };
|
|
34
50
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { optionalString, plainObject, resourceRefLabel } from "../../engine/pull/context.js";
|
|
2
2
|
import { reportUnknownAttrs } from "../../engine/pull/attrs.js";
|
|
3
3
|
import { scopedLabelToBagKey, tfLabelToTsLabel } from "../../engine/tf/index.js";
|
|
4
|
-
import { fieldKeyFromTfValue } from "../field/from-tf.js";
|
|
4
|
+
import { elementAuditFieldReference, fieldKeyFromTfValue } from "../field/from-tf.js";
|
|
5
5
|
import { unextractedFieldRefId } from "../view/from-tf.js";
|
|
6
6
|
import { RECORD_CREATE_FORM_RESOURCE_TYPE } from "./module.js";
|
|
7
7
|
const KNOWN_ATTRS = new Set(["app_id", "sections"]);
|
|
@@ -59,7 +59,7 @@ function sectionFromTf(raw, index, formWhere, owner, ctx) {
|
|
|
59
59
|
ctx.diagnostics.push(`${where}: field_ids entry ${JSON.stringify(fieldId)} is not a known field reference; dropped`);
|
|
60
60
|
}
|
|
61
61
|
else
|
|
62
|
-
fields.push(key);
|
|
62
|
+
fields.push(key === resolved ? elementAuditFieldReference(fieldId, key, owner, ctx) : key);
|
|
63
63
|
}
|
|
64
64
|
const agentLabel = resourceRefLabel(rec["agent_id"], "elementum_agent");
|
|
65
65
|
if (rec["agent_id"] !== undefined && agentLabel === undefined) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { dataRefLabel, reportAuthoringBlocker, resourceRefLabel } from "../../engine/pull/context.js";
|
|
2
2
|
import { expr, isTfExpr, scopedLabelToBagKey, tfLabelToTsLabel, } from "../../engine/tf/index.js";
|
|
3
3
|
import { filterFromTf } from "../access-policy/from-tf.js";
|
|
4
|
-
import { decodeForeignDataField, fieldKeyFromTfRef, fieldKeyFromTfValue } from "../field/from-tf.js";
|
|
4
|
+
import { decodeForeignDataField, elementAuditFieldReference, fieldKeyFromTfRef, fieldKeyFromTfValue } from "../field/from-tf.js";
|
|
5
5
|
import { resolveDataAspectTarget, resolveDataTaskTarget } from "../shared/aspect-target-from-tf.js";
|
|
6
6
|
import { SUB_TYPE_BY_RESOURCE } from "../field/types.js";
|
|
7
7
|
import { bareForeignFieldIdRef, isBarePlatformId, resolveOwnDataFieldRef, unextractedFieldRefId } from "../view/from-tf.js";
|
|
@@ -49,9 +49,14 @@ function relationshipFromTf(block, owner, ctx) {
|
|
|
49
49
|
// A field pull did not extract keeps its platform id: its key would print
|
|
50
50
|
// as nothing and build would drop the column (#1966). With no id the pull
|
|
51
51
|
// fails (#1978).
|
|
52
|
-
const
|
|
52
|
+
const kept = owner.unextracted === undefined
|
|
53
53
|
? fieldKey
|
|
54
54
|
: unextractedFieldRefId(rec["field_id"], fieldKey, owner.unextracted, ctx, `${where}.columns[${index}]`);
|
|
55
|
+
// A platform audit column keeps its own identity next to an own field
|
|
56
|
+
// under the same key, as in views and layouts (#2513).
|
|
57
|
+
const field = kept === undefined || kept !== fieldKey
|
|
58
|
+
? kept
|
|
59
|
+
: elementAuditFieldReference(rec["field_id"], kept, { type: ownerResourceType, label: owner.label, scope: owner.scope, refName: owner.ownerRefName }, ctx);
|
|
55
60
|
// A bare related id ei couldn't name resolves the same way as the owner
|
|
56
61
|
// side, so the join column is never dropped silently (#1991).
|
|
57
62
|
const relatedRaw = rec["related_field_id"];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { NO_CANVAS, NO_CATALOG, NO_LIFECYCLE } from "../../graph/types.js";
|
|
2
|
-
import { relationshipPairErrors } from "./pair-check.js";
|
|
2
|
+
import { relationshipPair, relationshipPairErrors } from "./pair-check.js";
|
|
3
3
|
export const RELATIONSHIP_RESOURCE_TYPE = "elementum_relationship";
|
|
4
4
|
export const relationshipModule = {
|
|
5
5
|
kind: "relationship",
|
|
@@ -14,5 +14,5 @@ export const relationshipModule = {
|
|
|
14
14
|
lifecycle: NO_LIFECYCLE,
|
|
15
15
|
canvas: NO_CANVAS,
|
|
16
16
|
catalog: NO_CATALOG,
|
|
17
|
-
buildChecks: {
|
|
17
|
+
buildChecks: { validateBuiltRoots: relationshipPairErrors, comparedGroup: relationshipPair },
|
|
18
18
|
};
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { type TfBlock } from "../../engine/tf/index.js";
|
|
2
|
+
import type { BuildCheckFailure, BuiltRootSource } from "../../graph/types.js";
|
|
3
|
+
/** The pair a relationship block joins, which build hashes per root against the last pull (edk#2430). */
|
|
4
|
+
export declare function relationshipPair(block: TfBlock): string | undefined;
|
|
2
5
|
/**
|
|
3
6
|
* A relationship between two managed roots is two platform records, one per side, whose columns the platform
|
|
4
7
|
* mirrors: changing one side changes the other. Each side lives in its owner's source, so the two must mirror
|
|
5
|
-
* each other or the next plan reverts a one-sided edit. Returns one
|
|
8
|
+
* each other or the next plan reverts a one-sided edit. Returns one failure per root pair that disagrees,
|
|
9
|
+
* naming both source files and which one differs from its last pull when that is known (edk#2430).
|
|
6
10
|
*/
|
|
7
|
-
export declare function relationshipPairErrors(
|
|
11
|
+
export declare function relationshipPairErrors(roots: readonly BuiltRootSource[]): BuildCheckFailure[];
|