@elementumai/edk 0.13.3 → 0.13.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-sdk/src/engine/coverage-gaps.d.ts +3 -0
- package/dist-sdk/src/engine/coverage-gaps.js +5 -0
- package/dist-sdk/src/engine/pull/context.d.ts +1 -1
- package/dist-sdk/src/engine/pull/context.js +1 -1
- package/dist-sdk/src/engine/pull/stream-root.d.ts +5 -1
- package/dist-sdk/src/engine/pull/stream-root.js +3 -0
- package/dist-sdk/src/engine/tf/index.d.ts +1 -0
- package/dist-sdk/src/engine/tf/index.js +1 -0
- package/dist-sdk/src/engine/tf/jsonencode.d.ts +19 -0
- package/dist-sdk/src/engine/tf/jsonencode.js +49 -0
- package/dist-sdk/src/entities/app/index.d.ts +1 -1
- package/dist-sdk/src/entities/automation/approval-trigger-refs.d.ts +20 -0
- package/dist-sdk/src/entities/automation/approval-trigger-refs.js +83 -0
- package/dist-sdk/src/entities/automation/build.js +1 -1
- package/dist-sdk/src/entities/automation/deserializer/print-automation.js +7 -0
- package/dist-sdk/src/entities/automation/from-tf.d.ts +2 -0
- package/dist-sdk/src/entities/automation/from-tf.js +104 -14
- package/dist-sdk/src/entities/automation/index.d.ts +1 -1
- package/dist-sdk/src/entities/automation/lookup-owner.d.ts +23 -0
- package/dist-sdk/src/entities/automation/lookup-owner.js +27 -0
- package/dist-sdk/src/entities/automation/module.js +182 -24
- package/dist-sdk/src/entities/automation/to-tf.js +163 -5
- package/dist-sdk/src/entities/automation/triggers.d.ts +47 -1
- package/dist-sdk/src/entities/automation/unsafe-script-output.d.ts +10 -5
- package/dist-sdk/src/entities/automation/unsafe-script-output.js +10 -5
- package/dist-sdk/src/entities/dynamic-layout/build.d.ts +31 -11
- package/dist-sdk/src/entities/dynamic-layout/to-tf.js +38 -2
- package/dist-sdk/src/entities/element/index.d.ts +1 -1
- package/dist-sdk/src/entities/shared/filters/ast.d.ts +6 -0
- package/dist-sdk/src/entities/shared/filters/index.d.ts +15 -3
- package/dist-sdk/src/entities/shared/filters/index.js +19 -1
- package/dist-sdk/src/entities/shared/filters/print.js +5 -0
- package/dist-sdk/src/entities/shared/filters/tf-codec.d.ts +13 -0
- package/dist-sdk/src/entities/shared/filters/tf-codec.js +74 -1
- package/dist-sdk/src/entities/shared/filters/types.d.ts +8 -1
- package/dist-sdk/src/entities/widget/to-tf.js +2 -1
- package/dist-sdk/src/generated/ragnarok/ragnarok-spec.d.ts +4 -2
- package/dist-sdk/src/generated/ragnarok/ragnarok-spec.js +2 -2
- package/dist-sdk/src/graph/index.d.ts +1 -1
- package/dist-sdk/src/graph/types.d.ts +23 -0
- package/package.json +1 -1
|
@@ -32,6 +32,9 @@
|
|
|
32
32
|
* right-panel section sharing a displayOrder with a main-area one, and in
|
|
33
33
|
* dynamic layouts an empty container or more than 8 stacked fields; the
|
|
34
34
|
* layout is emitted as authored
|
|
35
|
+
* - a dynamic layout Current User / Current User's Groups condition on a
|
|
36
|
+
* field of another type (edk#3038; the condition is emitted as authored and
|
|
37
|
+
* never matches the viewer as intended)
|
|
35
38
|
*
|
|
36
39
|
* The ~600 emit sites push free-form `"<where>: <what>; dropped"` strings.
|
|
37
40
|
* Rather than rewrite every site, they are classified here, where they leave
|
|
@@ -32,6 +32,9 @@
|
|
|
32
32
|
* right-panel section sharing a displayOrder with a main-area one, and in
|
|
33
33
|
* dynamic layouts an empty container or more than 8 stacked fields; the
|
|
34
34
|
* layout is emitted as authored
|
|
35
|
+
* - a dynamic layout Current User / Current User's Groups condition on a
|
|
36
|
+
* field of another type (edk#3038; the condition is emitted as authored and
|
|
37
|
+
* never matches the viewer as intended)
|
|
35
38
|
*
|
|
36
39
|
* The ~600 emit sites push free-form `"<where>: <what>; dropped"` strings.
|
|
37
40
|
* Rather than rewrite every site, they are classified here, where they leave
|
|
@@ -59,6 +62,8 @@ const ADVISORY_DIAGNOSTICS = [
|
|
|
59
62
|
// Section names are quoted as authored, so match them with [\s\S]* and anchor on the fixed rest of the message.
|
|
60
63
|
/\.sections\[\d+\](?: \("[\s\S]*"\))?: group section (?:has no fields, widgets or agent, so the record page shows an empty section; add fields or remove it|holds \d+ fields; split them into labeled groups \(key fields first\) so the record page doesn't read as one long list|stacks \d+ fields in one column \(maxColumns: 1\); use maxColumns: 2 or split it into labeled groups)$/,
|
|
61
64
|
/\.sections\[\d+\](?: \("[\s\S]*"\))?: right-panel section shares displayOrder -?\d+ with main-area [\s\S]+; the platform reads sections back by displayOrder, so plan replaces this layout on every run\. Give each section its own displayOrder, counted across both panels$/,
|
|
65
|
+
// edk#3038: a viewer condition on a field of another type is built as written.
|
|
66
|
+
/dynamicLayouts\.[\s\S]+\.conditions\.[\s\S]+: currentUser(?:Groups)? compares a (?:user|group) field, but this field is [A-Z_]+; the condition will not match the viewer as intended$/,
|
|
62
67
|
/dynamicLayouts\.[\s\S]+\.components\.[\s\S]+: (?:(?:container|section|row|column|grid|card) has no children, so it renders empty; add components or remove it|(?:container|section|column|card) stacks \d+ fields in one column; put them in a grid \(columns: 2\) or split them into titled sections)$/,
|
|
63
68
|
];
|
|
64
69
|
export function isAdvisoryDiagnostic(message) {
|
|
@@ -16,7 +16,7 @@ export interface ImportedResourceRef {
|
|
|
16
16
|
readonly attrs: Readonly<Record<string, TfValue>>;
|
|
17
17
|
}
|
|
18
18
|
/** Why the bridge left an automation out; a bridge from before #1764 writes no kind. */
|
|
19
|
-
export declare const OMITTED_AUTOMATION_KINDS: readonly ["unrepresentable", "disabled", "no-draft", "unadoptable"];
|
|
19
|
+
export declare const OMITTED_AUTOMATION_KINDS: readonly ["unrepresentable", "disabled", "no-draft", "empty-draft", "unadoptable"];
|
|
20
20
|
export type OmittedAutomationKind = (typeof OMITTED_AUTOMATION_KINDS)[number];
|
|
21
21
|
/** Extraction context: stream lookups + the diagnostics sink. */
|
|
22
22
|
/** An automation the export left out, as omitted-automations.json names it. */
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import { EntityTfError } from "../entity.js";
|
|
8
8
|
import { isTfExpr, tfLabelToTsLabel } from "../tf/index.js";
|
|
9
9
|
/** Why the bridge left an automation out; a bridge from before #1764 writes no kind. */
|
|
10
|
-
export const OMITTED_AUTOMATION_KINDS = ["unrepresentable", "disabled", "no-draft", "unadoptable"];
|
|
10
|
+
export const OMITTED_AUTOMATION_KINDS = ["unrepresentable", "disabled", "no-draft", "empty-draft", "unadoptable"];
|
|
11
11
|
/** The pull-abort (or, for `clone app`, clone-abort) message for one or more authoring blockers. */
|
|
12
12
|
export function authoringBlockedMessage(blockers, command = "pull") {
|
|
13
13
|
const remedies = [...new Set(blockers.map((blocker) => blocker.remedy))];
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* Kind switches live in the entity graph — this file walks TYPE_TO_KIND /
|
|
13
13
|
* lifecycle hooks and must not import entity modules (value or type).
|
|
14
14
|
*/
|
|
15
|
-
import { type EntityKindId, type AdoptionAddressAlias, type UnmanagedLookup } from "../../graph/index.js";
|
|
15
|
+
import { type EntityKindId, type AdoptionAddressAlias, type SkippedOwnFileReport, type UnmanagedLookup } from "../../graph/index.js";
|
|
16
16
|
import type { QuarantinedOwnFile } from "../../graph/types.js";
|
|
17
17
|
import { type TfDocument } from "../tf/index.js";
|
|
18
18
|
import type { ValidationFailure } from "../validation.js";
|
|
@@ -57,6 +57,10 @@ export interface StreamRootExtract {
|
|
|
57
57
|
readonly adoptionAddressAliases: readonly AdoptionAddressAlias[];
|
|
58
58
|
/** Lookups adoption declares for references to skipped resources (see {@link UnmanagedLookup}). */
|
|
59
59
|
readonly unmanagedLookups?: readonly UnmanagedLookup[];
|
|
60
|
+
/** Each skipped own-file child, by kind, for the pull summary (#3053). */
|
|
61
|
+
readonly skippedReports?: readonly (SkippedOwnFileReport & {
|
|
62
|
+
readonly kind: EntityKindId;
|
|
63
|
+
})[];
|
|
60
64
|
/**
|
|
61
65
|
* Resource address → the addresses it `depends_on` (e.g. a workflow_publish
|
|
62
66
|
* depending on its automation's tasks). `tofu plan -target=X` implicitly
|
|
@@ -447,6 +447,7 @@ export function extractStreamRoot(doc, kindId, opts = {}) {
|
|
|
447
447
|
const ownFileByKind = new Map();
|
|
448
448
|
const adoptionAddressAliases = [];
|
|
449
449
|
const unmanagedLookups = [];
|
|
450
|
+
const skippedReports = [];
|
|
450
451
|
const quarantineOwnFiles = [];
|
|
451
452
|
const validationFailures = [];
|
|
452
453
|
const settles = [];
|
|
@@ -464,6 +465,7 @@ export function extractStreamRoot(doc, kindId, opts = {}) {
|
|
|
464
465
|
validationFailures.push(...(result.validations ?? []));
|
|
465
466
|
adoptionAddressAliases.push(...(result.adoptionAddressAliases ?? []));
|
|
466
467
|
unmanagedLookups.push(...(result.unmanagedLookups ?? []));
|
|
468
|
+
skippedReports.push(...(result.skippedReports ?? []).map((report) => ({ ...report, kind: child.kind })));
|
|
467
469
|
quarantineOwnFiles.push(...(result.quarantineOwnFiles ?? []));
|
|
468
470
|
if (result.settleAfterExtract !== undefined)
|
|
469
471
|
settles.push(result.settleAfterExtract);
|
|
@@ -500,6 +502,7 @@ export function extractStreamRoot(doc, kindId, opts = {}) {
|
|
|
500
502
|
importIds,
|
|
501
503
|
adoptionAddressAliases,
|
|
502
504
|
...(unmanagedLookups.length > 0 && { unmanagedLookups }),
|
|
505
|
+
...(skippedReports.length > 0 && { skippedReports }),
|
|
503
506
|
dependsOn,
|
|
504
507
|
unresolvedForeignRefs: { apps: [...unresolvedForeignApps], elements: [...unresolvedForeignElements] },
|
|
505
508
|
authoringBlockers: [
|
|
@@ -7,6 +7,7 @@ export type { PathSeg, TfBlock, TfBlockKind, TfDocument, TfExpr, TfLifecycle, Tf
|
|
|
7
7
|
export { expr, forEachExpr, isTfExpr } from "./model.js";
|
|
8
8
|
export { decodeTemplateEscapes, encodeTemplateEscapes, quoteHclString } from "./escape.js";
|
|
9
9
|
export { parseExpression, parseStringValue, TfExprError } from "./expr.js";
|
|
10
|
+
export { renderJsonencode } from "./jsonencode.js";
|
|
10
11
|
export { assertNoUnsafeIntegers, inspectBackendHcl, parseHcl, parseHclDocuments, TfParseError, type BackendHclInspection, } from "./parse.js";
|
|
11
12
|
export { renderBlock, renderDocument } from "./render.js";
|
|
12
13
|
export { hclCodeLines, hclDepthDelta, hclStatementEnd, type HclCodeLine } from "./scan.js";
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
export { expr, forEachExpr, isTfExpr } from "./model.js";
|
|
7
7
|
export { decodeTemplateEscapes, encodeTemplateEscapes, quoteHclString } from "./escape.js";
|
|
8
8
|
export { parseExpression, parseStringValue, TfExprError } from "./expr.js";
|
|
9
|
+
export { renderJsonencode } from "./jsonencode.js";
|
|
9
10
|
export { assertNoUnsafeIntegers, inspectBackendHcl, parseHcl, parseHclDocuments, TfParseError, } from "./parse.js";
|
|
10
11
|
export { renderBlock, renderDocument } from "./render.js";
|
|
11
12
|
export { hclCodeLines, hclDepthDelta, hclStatementEnd } from "./scan.js";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenTofu's `jsonencode` text for a literal value, shared by pull's
|
|
3
|
+
* round-trip check and automation extraction (#3050).
|
|
4
|
+
*/
|
|
5
|
+
import { type TfValue } from "./model.js";
|
|
6
|
+
/**
|
|
7
|
+
* The string OpenTofu's `jsonencode` renders for a literal value: object keys
|
|
8
|
+
* in byte order, `<`, `>`, `&`, U+2028 and U+2029 escaped (as Go's
|
|
9
|
+
* encoding/json does), no whitespace. Undefined for an
|
|
10
|
+
* expression, or a value whose rendering this does not reproduce exactly
|
|
11
|
+
* (a non-integer or unsafe number, `-0`, a lone surrogate).
|
|
12
|
+
*
|
|
13
|
+
* It sees parsed numbers, not their source text: a decimal literal that
|
|
14
|
+
* parses to a safe integer (`1.0000000000000001`) renders as that integer,
|
|
15
|
+
* while OpenTofu keeps the decimal. Neither side can write such a literal
|
|
16
|
+
* today: the build prints JS numbers in their shortest form, and the export
|
|
17
|
+
* writes Go float64s the same way.
|
|
18
|
+
*/
|
|
19
|
+
export declare function renderJsonencode(value: TfValue): string | undefined;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenTofu's `jsonencode` text for a literal value, shared by pull's
|
|
3
|
+
* round-trip check and automation extraction (#3050).
|
|
4
|
+
*/
|
|
5
|
+
import { isTfExpr } from "./model.js";
|
|
6
|
+
const LONE_SURROGATE = /[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/;
|
|
7
|
+
function utf8Order(left, right) {
|
|
8
|
+
return Buffer.compare(Buffer.from(left, "utf8"), Buffer.from(right, "utf8"));
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* The string OpenTofu's `jsonencode` renders for a literal value: object keys
|
|
12
|
+
* in byte order, `<`, `>`, `&`, U+2028 and U+2029 escaped (as Go's
|
|
13
|
+
* encoding/json does), no whitespace. Undefined for an
|
|
14
|
+
* expression, or a value whose rendering this does not reproduce exactly
|
|
15
|
+
* (a non-integer or unsafe number, `-0`, a lone surrogate).
|
|
16
|
+
*
|
|
17
|
+
* It sees parsed numbers, not their source text: a decimal literal that
|
|
18
|
+
* parses to a safe integer (`1.0000000000000001`) renders as that integer,
|
|
19
|
+
* while OpenTofu keeps the decimal. Neither side can write such a literal
|
|
20
|
+
* today: the build prints JS numbers in their shortest form, and the export
|
|
21
|
+
* writes Go float64s the same way.
|
|
22
|
+
*/
|
|
23
|
+
export function renderJsonencode(value) {
|
|
24
|
+
if (value === null || typeof value === "boolean")
|
|
25
|
+
return JSON.stringify(value);
|
|
26
|
+
if (typeof value === "number") {
|
|
27
|
+
return Number.isSafeInteger(value) && !Object.is(value, -0) ? String(value) : undefined;
|
|
28
|
+
}
|
|
29
|
+
if (typeof value === "string") {
|
|
30
|
+
if (LONE_SURROGATE.test(value))
|
|
31
|
+
return undefined;
|
|
32
|
+
return JSON.stringify(value).replace(/[<>&\u2028\u2029]/g, (char) => `\\u${char.charCodeAt(0).toString(16).padStart(4, "0")}`);
|
|
33
|
+
}
|
|
34
|
+
if (Array.isArray(value)) {
|
|
35
|
+
const items = value.map(renderJsonencode);
|
|
36
|
+
return items.every((item) => item !== undefined) ? `[${items.join(",")}]` : undefined;
|
|
37
|
+
}
|
|
38
|
+
if (isTfExpr(value))
|
|
39
|
+
return undefined;
|
|
40
|
+
const entries = [];
|
|
41
|
+
for (const key of Object.keys(value).sort(utf8Order)) {
|
|
42
|
+
const rendered = renderJsonencode(value[key]);
|
|
43
|
+
const renderedKey = renderJsonencode(key);
|
|
44
|
+
if (rendered === undefined || renderedKey === undefined)
|
|
45
|
+
return undefined;
|
|
46
|
+
entries.push(`${renderedKey}:${rendered}`);
|
|
47
|
+
}
|
|
48
|
+
return `{${entries.join(",")}}`;
|
|
49
|
+
}
|
|
@@ -12,7 +12,7 @@ export { runAutomationParameterValue, type AppWidget, type CreateRecordWidget, t
|
|
|
12
12
|
export { type DisplayBlock } from "./display-blocks.js";
|
|
13
13
|
export { type AppRelationship, type AppRelationshipColumn } from "../relationship/build.js";
|
|
14
14
|
export { dashboardChartWidget, dashboardRecordsWidget, dashboardWidgetSize, type DashboardChartWidget, type DashboardRecordsWidget, type DashboardWidget, type DashboardWidgetSize, } from "../dashboard/build.js";
|
|
15
|
-
export { type AppDynamicLayout, type DynamicLayoutBlockCommon, type DynamicLayoutComponent, type DynamicLayoutCondition, type DynamicLayoutCssLength, type DynamicLayoutDependency, type DynamicLayoutFieldComponent, type DynamicLayoutFieldValidation, type DynamicLayoutSaveGroup, type DynamicLayoutStyle, type DynamicLayoutTypedValue, type DynamicLayoutValidationRule, dynamicLayout, } from "../dynamic-layout/build.js";
|
|
15
|
+
export { type AppDynamicLayout, type DynamicLayoutBlockCommon, type DynamicLayoutComponent, type DynamicLayoutCondition, type DynamicLayoutCssLength, type DynamicLayoutDependency, type DynamicLayoutFieldComponent, type DynamicLayoutFieldValidation, type DynamicLayoutSaveGroup, type DynamicLayoutStyle, type DynamicLayoutTypedValue, type DynamicLayoutCurrentUserValue, type DynamicLayoutCurrentUserGroupsValue, type DynamicLayoutEqualityComparison, type DynamicLayoutMembershipComparison, type DynamicLayoutValidationRule, dynamicLayout, } from "../dynamic-layout/build.js";
|
|
16
16
|
export { attachmentField, booleanField, calculatedField, dateField, dateTimeField, decimalField, dropdownDisplay, dropdownField, dropdownOption, dropdownValue, groupField, jsonField, multiSelectField, numberField, relationField, richTextField, textField, userField, type AttachmentFieldOptions, type BaseFieldOptions, type CalculatedFieldOptions, type InferredCalculatedField, type DropdownConfig, type DropdownDisplay, type DropdownFieldOptions, type DropdownOption, type DropdownParentValueRef, type DynamicDropdownConfig, type DynamicDropdownParent, type DynamicDropdownParentMapping, type MultiSelectFieldOptions, type NumericFieldOptions, type NumericFieldFormat, type PicklistFieldOptions, type RelationFieldOptions, type TextFieldOptions, type QrFieldFormat, } from "../field/build.js";
|
|
17
17
|
export { asc, desc, sortBy, type SortDirection, type SortOrder } from "../shared/types/common.js";
|
|
18
18
|
export { calc, dateDifUnit, dateTimeTruncPrecision, field, orderByDirection, predicateOp, weekdayMode, type ConcatExprType, type DateDifUnit, type DateTimeTruncPrecision, type Expr, type ExprType, type FieldRefExprType, type OrderByDirection, type Predicate, type PredicateOp, type StringAggOptions, type StringAggOrderBy, type WeekdayMode, } from "../field/calc.js";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `refs` map key for `ctx.trigger.<name>` on an approval process status
|
|
3
|
+
* trigger, or undefined when the name is not an approval output.
|
|
4
|
+
* `fieldNames` are the display names of the trigger app's fields.
|
|
5
|
+
*/
|
|
6
|
+
export declare function approvalTriggerRefsKey(name: string, fieldNames: Iterable<string>): string | undefined;
|
|
7
|
+
/** The `triggerReference.name` for `ctx.trigger.<name>`, or undefined when it is not an approval output. */
|
|
8
|
+
export declare function approvalTriggerReferenceName(name: string): string | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* The accessor path for an approval process status trigger's `refs` key, or
|
|
11
|
+
* undefined when the key is not an approval output. A plain key that a field
|
|
12
|
+
* of the trigger's app owns (`fieldOwnsKey`) is that field, not the output.
|
|
13
|
+
*/
|
|
14
|
+
export declare function approvalTriggerPathFromRefsKey(key: string, fieldOwnsKey: (key: string) => boolean): string[] | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* The top-level `ctx.trigger.<name>` heads an approval process status trigger
|
|
17
|
+
* declares (`record` plus every approval output), derived from the table
|
|
18
|
+
* above so pull's undeclared-head check can't drift from it.
|
|
19
|
+
*/
|
|
20
|
+
export declare const APPROVAL_TRIGGER_OUTPUT_HEADS: ReadonlySet<string>;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { EntityTfError } from "../../engine/entity.js";
|
|
2
|
+
const APPROVAL_TRIGGER_REFS = {
|
|
3
|
+
approver: { refsKey: "Final Approval By's id", referenceName: "approver.id" },
|
|
4
|
+
"approver.id": { refsKey: "Final Approval By's id", referenceName: "approver.id" },
|
|
5
|
+
"approver.email": { refsKey: "Final Approval By's Email", referenceName: "approver.email" },
|
|
6
|
+
"approver.name": { refsKey: "Final Approval By's Name", referenceName: "approver.name" },
|
|
7
|
+
approvalUpdatedAt: { refsKey: "Final Approval At", referenceName: "approvalUpdatedAt" },
|
|
8
|
+
status: { refsKey: "Approval Status", referenceName: "status" },
|
|
9
|
+
reason: { refsKey: "Approval Reason", referenceName: "reason" },
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* When a field of the trigger's app has the same display name as one of these
|
|
13
|
+
* keys, the field keeps the plain key and the trigger output is published as
|
|
14
|
+
* "<group> - <key>" (the provider's `refkeys.Qualified`; live: an app with an
|
|
15
|
+
* "Approval Status" text field gets refs["Approval Chain Trigger - Approval
|
|
16
|
+
* Status"] for the trigger's status).
|
|
17
|
+
*/
|
|
18
|
+
const APPROVAL_TRIGGER_REF_GROUP = "Approval Chain Trigger";
|
|
19
|
+
const QUALIFIED_PREFIX = `${APPROVAL_TRIGGER_REF_GROUP} - `;
|
|
20
|
+
function isApprovalAccessor(name) {
|
|
21
|
+
return Object.hasOwn(APPROVAL_TRIGGER_REFS, name);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* The accessor entry for `ctx.trigger.<name>`, or undefined when the name is
|
|
25
|
+
* not one of the approval outputs (the record and its fields). Fails closed on
|
|
26
|
+
* an approver property the platform does not publish.
|
|
27
|
+
*/
|
|
28
|
+
function approvalEntry(name) {
|
|
29
|
+
if (isApprovalAccessor(name))
|
|
30
|
+
return APPROVAL_TRIGGER_REFS[name];
|
|
31
|
+
if (name.startsWith("approver.")) {
|
|
32
|
+
throw new EntityTfError(`ctx.trigger.${name}: an approval process status trigger publishes only the approver's id, email and name. ` +
|
|
33
|
+
"Use ctx.trigger.approver.id, ctx.trigger.approver.email or ctx.trigger.approver.name.");
|
|
34
|
+
}
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The `refs` map key for `ctx.trigger.<name>` on an approval process status
|
|
39
|
+
* trigger, or undefined when the name is not an approval output.
|
|
40
|
+
* `fieldNames` are the display names of the trigger app's fields.
|
|
41
|
+
*/
|
|
42
|
+
export function approvalTriggerRefsKey(name, fieldNames) {
|
|
43
|
+
const entry = approvalEntry(name);
|
|
44
|
+
if (entry === undefined)
|
|
45
|
+
return undefined;
|
|
46
|
+
for (const fieldName of fieldNames) {
|
|
47
|
+
if (fieldName === entry.refsKey)
|
|
48
|
+
return `${QUALIFIED_PREFIX}${entry.refsKey}`;
|
|
49
|
+
}
|
|
50
|
+
return entry.refsKey;
|
|
51
|
+
}
|
|
52
|
+
/** The `triggerReference.name` for `ctx.trigger.<name>`, or undefined when it is not an approval output. */
|
|
53
|
+
export function approvalTriggerReferenceName(name) {
|
|
54
|
+
return approvalEntry(name)?.referenceName;
|
|
55
|
+
}
|
|
56
|
+
/** Plain refs key → accessor path. The bare `approver` shares the id's key, so pull prints `.id`. */
|
|
57
|
+
const PATH_BY_REFS_KEY = new Map(Object.entries(APPROVAL_TRIGGER_REFS)
|
|
58
|
+
.filter(([accessor]) => accessor !== "approver")
|
|
59
|
+
.map(([accessor, { refsKey }]) => [refsKey, accessor.split(".")]));
|
|
60
|
+
/**
|
|
61
|
+
* The accessor path for an approval process status trigger's `refs` key, or
|
|
62
|
+
* undefined when the key is not an approval output. A plain key that a field
|
|
63
|
+
* of the trigger's app owns (`fieldOwnsKey`) is that field, not the output.
|
|
64
|
+
*/
|
|
65
|
+
export function approvalTriggerPathFromRefsKey(key, fieldOwnsKey) {
|
|
66
|
+
if (key.startsWith(QUALIFIED_PREFIX)) {
|
|
67
|
+
const path = PATH_BY_REFS_KEY.get(key.slice(QUALIFIED_PREFIX.length));
|
|
68
|
+
return path === undefined ? undefined : [...path];
|
|
69
|
+
}
|
|
70
|
+
const path = PATH_BY_REFS_KEY.get(key);
|
|
71
|
+
if (path === undefined || fieldOwnsKey(key))
|
|
72
|
+
return undefined;
|
|
73
|
+
return [...path];
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* The top-level `ctx.trigger.<name>` heads an approval process status trigger
|
|
77
|
+
* declares (`record` plus every approval output), derived from the table
|
|
78
|
+
* above so pull's undeclared-head check can't drift from it.
|
|
79
|
+
*/
|
|
80
|
+
export const APPROVAL_TRIGGER_OUTPUT_HEADS = new Set([
|
|
81
|
+
"record",
|
|
82
|
+
...Object.keys(APPROVAL_TRIGGER_REFS).map((accessor) => accessor.split(".")[0]),
|
|
83
|
+
]);
|
|
@@ -338,7 +338,7 @@ function assertKnownScriptOutput(name, taskRefKey, schema, undeclared) {
|
|
|
338
338
|
(undeclared === "unsafeOnly"
|
|
339
339
|
? ` Read a declared output${reads.length > 0 ? ` (${reads.join(" or ")})` : ""}, add ${JSON.stringify(output)} to the script's outputs, ` +
|
|
340
340
|
`or keep a pulled reference the live schema doesn't declare with unsafeScriptOutput(${at}, ${JSON.stringify(output)}) ` +
|
|
341
|
-
`(the platform won't publish the automation while
|
|
341
|
+
`(the platform won't publish the automation while it reads an undeclared output).`
|
|
342
342
|
: ""));
|
|
343
343
|
}
|
|
344
344
|
// A bare name is not a `result.<prop>` read (an undeclared `result.<name>` is
|
|
@@ -536,6 +536,7 @@ function emptyImports() {
|
|
|
536
536
|
usesRefType: false,
|
|
537
537
|
usesTableSearchTableRef: false,
|
|
538
538
|
usesGroupRef: false,
|
|
539
|
+
usesAutomationRef: false,
|
|
539
540
|
};
|
|
540
541
|
}
|
|
541
542
|
/** Folder (inside the automations folder) that holds printed script files. */
|
|
@@ -779,6 +780,7 @@ function renderHeader(ast, imports, _opts) {
|
|
|
779
780
|
});
|
|
780
781
|
lines.push(`import { ${sortedSpecifiers.join(", ")} } from "${sdkPackageSpecifier("automations")}";`);
|
|
781
782
|
const catalogNamed = [
|
|
783
|
+
...(imports.usesAutomationRef ? ["automationRef"] : []),
|
|
782
784
|
...(imports.usesGroupRef ? ["groupRef"] : []),
|
|
783
785
|
...(imports.usesTableSearchTableRef ? ["tableSearchTableRef"] : []),
|
|
784
786
|
];
|
|
@@ -1851,6 +1853,11 @@ function printRef(ref, state, refCtx) {
|
|
|
1851
1853
|
case "agent":
|
|
1852
1854
|
return `catalog.${catalogOwnerHandle(state, ref.appHandle)}.agents${safeMember(ref.agentKey)}`;
|
|
1853
1855
|
case "automation":
|
|
1856
|
+
if (ref.unmanagedName !== undefined) {
|
|
1857
|
+
// Not in source: no catalog entry exists, so name the live automation (#3047).
|
|
1858
|
+
state.imports.usesAutomationRef = true;
|
|
1859
|
+
return `automationRef({ refName: ${quote(ref.automationKey)}, name: ${quote(ref.unmanagedName)}, parent: ${quote(catalogOwnerHandle(state, ref.appHandle))} })`;
|
|
1860
|
+
}
|
|
1854
1861
|
return `catalog.${catalogOwnerHandle(state, ref.appHandle)}.automations${safeMember(ref.automationKey)}`;
|
|
1855
1862
|
case "phoneService":
|
|
1856
1863
|
return `catalog.${catalogOwnerHandle(state, ref.appHandle)}.phoneServices${safeMember(ref.phoneServiceKey)}`;
|
|
@@ -92,6 +92,8 @@ interface DecodeContext {
|
|
|
92
92
|
readonly stringifiedValueReferences?: {
|
|
93
93
|
unresolved: boolean;
|
|
94
94
|
};
|
|
95
|
+
/** Script task refKey → undeclared outputs a field assignment reads, for one pull warning (#3050). */
|
|
96
|
+
readonly undeclaredScriptOutputFieldReads?: Map<string, Set<string>>;
|
|
95
97
|
/** Names of static group recipients org.ts doesn't carry yet (edk#2241), for one pull diagnostic each. */
|
|
96
98
|
readonly groupsMissingFromOrg?: Set<string>;
|
|
97
99
|
/** Filter option ids that are not one of the compared field's current options (#2568), one pull warning each. */
|
|
@@ -5,7 +5,7 @@ import { normalizeOnDemandParamKey } from "../../../pull/util.js";
|
|
|
5
5
|
import { EntityTfError } from "../../engine/entity.js";
|
|
6
6
|
import { dataRefLabel } from "../../engine/pull/context.js";
|
|
7
7
|
import { procedureDiscriminator } from "../../engine/pull/procedure-refs.js";
|
|
8
|
-
import { appResourceLabelPrefix, childPartFromScopedLabel, elementResourceLabelPrefix, isTfExpr, isTfLabel, isUuid, ownerFromScopedChildLabel, sanitizeName, scopedLabelToBagKey, tfLabelToTsLabel, tsLabelToTfLabel, } from "../../engine/tf/index.js";
|
|
8
|
+
import { appResourceLabelPrefix, childPartFromScopedLabel, elementResourceLabelPrefix, isTfExpr, isTfLabel, isUuid, ownerFromScopedChildLabel, renderJsonencode, sanitizeName, scopedLabelToBagKey, tfLabelToTsLabel, tsLabelToTfLabel, } from "../../engine/tf/index.js";
|
|
9
9
|
import { SUB_TYPE_BY_RESOURCE } from "../field/types.js";
|
|
10
10
|
import { IMPLEMENTED_FILE_READER_RESOURCE_TYPES } from "../file-reader/types.js";
|
|
11
11
|
import { connectorIdentityFromTf } from "../shared/connector-from-tf.js";
|
|
@@ -22,6 +22,7 @@ import { taskTfLabel } from "./task-label.js";
|
|
|
22
22
|
import { parseTriggerAttachmentPayloadRefJson, parseTriggerWholeRecordRefJson, TASK_OUTPUT_REFERENCE_NAMES, TRIGGER_WHOLE_RECORD_REF_NAME } from "./task-output-labels.js";
|
|
23
23
|
import { workflowOutputTypeFromFieldType } from "./workflow-output.js";
|
|
24
24
|
import { slackMessageTriggerPathFromWire } from "./slack-message-refs.js";
|
|
25
|
+
import { APPROVAL_TRIGGER_OUTPUT_HEADS, approvalTriggerPathFromRefsKey } from "./approval-trigger-refs.js";
|
|
25
26
|
import { ALL_AUTOMATION_TASK_TYPE_SET, AUTOMATION_BRANCH_TYPE_SET, AUTOMATION_RESOURCE_TYPE, AUTOMATION_TRIGGER_TYPE_SET, WEBHOOK_REQUEST_REF_PATTERN, WORKFLOW_PUBLISH_RESOURCE_TYPE, } from "./types.js";
|
|
26
27
|
const TRIGGER_KINDS = {
|
|
27
28
|
elementum_record_created_trigger: "recordCreate",
|
|
@@ -1007,18 +1008,18 @@ function approverReferenceFieldAuthoringType(value, ctx) {
|
|
|
1007
1008
|
}
|
|
1008
1009
|
return undefined;
|
|
1009
1010
|
}
|
|
1010
|
-
function decodeFieldAssignmentValue(value, ctx, diagnostics, where = "field assignment") {
|
|
1011
|
+
function decodeFieldAssignmentValue(value, ctx, diagnostics, where = "field assignment", position = "whole") {
|
|
1011
1012
|
// Multi-Select assignments are exported as jsonencode([<option UUID>, ...])
|
|
1012
1013
|
// rather than the options-by-label locals used for a scalar Dropdown. Walk
|
|
1013
1014
|
// that payload with the state-derived option registry so pulled source stays
|
|
1014
1015
|
// portable across organizations and fresh creates.
|
|
1015
1016
|
if (isTfExpr(value) && value.$expr === "jsonencode") {
|
|
1016
|
-
return decodeFieldAssignmentValue(value.value, ctx, diagnostics, where);
|
|
1017
|
+
return decodeFieldAssignmentValue(value.value, ctx, diagnostics, where, position);
|
|
1017
1018
|
}
|
|
1018
1019
|
if (Array.isArray(value)) {
|
|
1019
|
-
return value.map((item) => decodeFieldAssignmentValue(item, ctx, diagnostics, where));
|
|
1020
|
+
return value.map((item) => decodeFieldAssignmentValue(item, ctx, diagnostics, where, "item"));
|
|
1020
1021
|
}
|
|
1021
|
-
return decodeValueOrStringifiedRef(value, ctx, diagnostics, where);
|
|
1022
|
+
return decodeValueOrStringifiedRef(value, ctx, diagnostics, where, position);
|
|
1022
1023
|
}
|
|
1023
1024
|
/**
|
|
1024
1025
|
* A Dropdown or Multi-Select assignment's option, printed as
|
|
@@ -1076,7 +1077,7 @@ const VALUE_REFERENCE_KEYS = ["taskReference", "triggerReference", "variableRefe
|
|
|
1076
1077
|
* diagnostic instead of a silent literal. Returns undefined for any string
|
|
1077
1078
|
* that carries no envelope.
|
|
1078
1079
|
*/
|
|
1079
|
-
function decodeStringifiedValueReference(value, ctx, diagnostics, where) {
|
|
1080
|
+
function decodeStringifiedValueReference(value, ctx, diagnostics, where, fieldAssignment) {
|
|
1080
1081
|
if (!value.includes("{") || !VALUE_REFERENCE_KEYS.some((key) => value.includes(`"${key}"`)))
|
|
1081
1082
|
return undefined;
|
|
1082
1083
|
const parts = [];
|
|
@@ -1129,13 +1130,21 @@ function decodeStringifiedValueReference(value, ctx, diagnostics, where) {
|
|
|
1129
1130
|
if (start > cursor)
|
|
1130
1131
|
parts.push(value.slice(cursor, start));
|
|
1131
1132
|
const reference = decodeFilterReferenceEnvelope(parsed, ctx, undefined, "envelope");
|
|
1132
|
-
|
|
1133
|
+
// Build writes an undeclared script output back as this envelope only
|
|
1134
|
+
// as the whole value of a field assignment, and only as its own
|
|
1135
|
+
// jsonencode text (#3050).
|
|
1136
|
+
const undeclaredRebuilds = fieldAssignment === "whole" && start === 0 && end === value.length &&
|
|
1137
|
+
isBuiltUndeclaredScriptOutputText(parsed, value);
|
|
1138
|
+
if (reference === undefined || stringifiedEnvelopeCannotMatchRead(parsed, reference, ctx, where, undeclaredRebuilds)) {
|
|
1133
1139
|
unresolved = true;
|
|
1134
1140
|
if (ctx.stringifiedValueReferences !== undefined)
|
|
1135
1141
|
ctx.stringifiedValueReferences.unresolved = true;
|
|
1136
1142
|
parts.push({ kind: "unresolved", uuid: value.slice(start, end), hint: "value-reference (edk#1646)" });
|
|
1137
1143
|
}
|
|
1138
1144
|
else {
|
|
1145
|
+
if (reference.kind === "taskRef" && reference.undeclaredScriptOutput === true) {
|
|
1146
|
+
recordUndeclaredScriptOutputFieldRead(reference, ctx);
|
|
1147
|
+
}
|
|
1139
1148
|
parts.push(reference);
|
|
1140
1149
|
}
|
|
1141
1150
|
cursor = end;
|
|
@@ -1169,6 +1178,53 @@ function decodeStringifiedValueReference(value, ctx, diagnostics, where) {
|
|
|
1169
1178
|
return merged[0];
|
|
1170
1179
|
return { kind: "template", parts: merged };
|
|
1171
1180
|
}
|
|
1181
|
+
/**
|
|
1182
|
+
* True when `text` is exactly what build writes for an undeclared script
|
|
1183
|
+
* output in a field assignment: `jsonencode({ fieldType, multiple,
|
|
1184
|
+
* taskReference = { name, taskId } })` (`undeclaredExecuteScriptFieldEnvelope`
|
|
1185
|
+
* in to-tf.ts). Other text (keys in another order, other keys, unescaped
|
|
1186
|
+
* `&`) would plan an update after adoption, so it keeps the skip.
|
|
1187
|
+
*/
|
|
1188
|
+
function isBuiltUndeclaredScriptOutputText(envelope, text) {
|
|
1189
|
+
const reference = envelope.taskReference;
|
|
1190
|
+
if (!isObject(reference) || typeof reference.name !== "string" || typeof reference.taskId !== "string" ||
|
|
1191
|
+
typeof envelope.fieldType !== "string" || typeof envelope.multiple !== "boolean")
|
|
1192
|
+
return false;
|
|
1193
|
+
const built = {
|
|
1194
|
+
fieldType: envelope.fieldType,
|
|
1195
|
+
multiple: envelope.multiple,
|
|
1196
|
+
taskReference: { name: reference.name, taskId: reference.taskId },
|
|
1197
|
+
};
|
|
1198
|
+
return renderJsonencode(built) === text;
|
|
1199
|
+
}
|
|
1200
|
+
/**
|
|
1201
|
+
* The platform's publish check rejects a reference to a script output the
|
|
1202
|
+
* script doesn't declare ("has a value reference that is no longer valid";
|
|
1203
|
+
* mobius #341, confirmed on ironman for a Create Record field). The automation
|
|
1204
|
+
* pulls and plans clean, but its next publish fails until the script
|
|
1205
|
+
* declares the output (#3050).
|
|
1206
|
+
*/
|
|
1207
|
+
function undeclaredScriptOutputFieldWarning(reads) {
|
|
1208
|
+
const listed = [...reads].map(([task, outputs]) => `${JSON.stringify(task)} (${[...outputs].map((output) => JSON.stringify(output)).join(", ")})`).join("; ");
|
|
1209
|
+
return `record fields are set from Run Script outputs the script's outputs don't declare: ${listed}. ` +
|
|
1210
|
+
"Pull keeps them as unsafeScriptOutput(...), so the automation is managed and plans with no changes, " +
|
|
1211
|
+
"but the platform won't publish a reference to an undeclared output: the next apply that changes this " +
|
|
1212
|
+
"automation fails at publish, and the live version stays as it is. Add each output to its script's outputs " +
|
|
1213
|
+
"and read it as ctx.actions.<script>.result.<output> before changing this automation.";
|
|
1214
|
+
}
|
|
1215
|
+
/**
|
|
1216
|
+
* Remember a field assignment kept as an undeclared script output, for the
|
|
1217
|
+
* pull warning that the platform won't publish it (#3050).
|
|
1218
|
+
*/
|
|
1219
|
+
function recordUndeclaredScriptOutputFieldRead(reference, ctx) {
|
|
1220
|
+
const reads = ctx.undeclaredScriptOutputFieldReads;
|
|
1221
|
+
if (reads === undefined)
|
|
1222
|
+
return;
|
|
1223
|
+
const output = reference.path.slice(1).join(".");
|
|
1224
|
+
const outputs = reads.get(reference.task) ?? new Set();
|
|
1225
|
+
outputs.add(output);
|
|
1226
|
+
reads.set(reference.task, outputs);
|
|
1227
|
+
}
|
|
1172
1228
|
function stringifiedReferenceResolves(envelope, reference, ctx) {
|
|
1173
1229
|
if (reference.kind === "unresolved")
|
|
1174
1230
|
return false;
|
|
@@ -1185,10 +1241,10 @@ function stringifiedReferenceResolves(envelope, reference, ctx) {
|
|
|
1185
1241
|
* script output rebuilds as TEXT, and an envelope whose fieldType or multiple
|
|
1186
1242
|
* is not the type build infers would plan an update after Read (#1858).
|
|
1187
1243
|
*/
|
|
1188
|
-
function stringifiedEnvelopeCannotMatchRead(envelope, reference, ctx, where) {
|
|
1244
|
+
function stringifiedEnvelopeCannotMatchRead(envelope, reference, ctx, where, undeclaredScriptOutputRebuilds) {
|
|
1189
1245
|
if (!stringifiedReferenceResolves(envelope, reference, ctx))
|
|
1190
1246
|
return true;
|
|
1191
|
-
if (reference.kind === "taskRef" && reference.undeclaredScriptOutput === true)
|
|
1247
|
+
if (reference.kind === "taskRef" && reference.undeclaredScriptOutput === true && !undeclaredScriptOutputRebuilds)
|
|
1192
1248
|
return true;
|
|
1193
1249
|
if (typeof envelope.fieldType !== "string")
|
|
1194
1250
|
return false;
|
|
@@ -1243,9 +1299,9 @@ function shadowedOnDemandParamFromEnvelope(value, ctx) {
|
|
|
1243
1299
|
return declared;
|
|
1244
1300
|
}
|
|
1245
1301
|
/** decodeValue, upgrading a stringified ValueReference envelope (edk#1646). */
|
|
1246
|
-
function decodeValueOrStringifiedRef(value, ctx, diagnostics, where) {
|
|
1302
|
+
function decodeValueOrStringifiedRef(value, ctx, diagnostics, where, fieldAssignment) {
|
|
1247
1303
|
if (typeof value === "string") {
|
|
1248
|
-
const decoded = decodeStringifiedValueReference(value, ctx, diagnostics, where);
|
|
1304
|
+
const decoded = decodeStringifiedValueReference(value, ctx, diagnostics, where, fieldAssignment);
|
|
1249
1305
|
if (decoded !== undefined)
|
|
1250
1306
|
return decoded;
|
|
1251
1307
|
}
|
|
@@ -1287,6 +1343,15 @@ function triggerRefPath(path, ctx) {
|
|
|
1287
1343
|
if (wireName === "Attachment Id")
|
|
1288
1344
|
return ["attachment", "id"];
|
|
1289
1345
|
}
|
|
1346
|
+
// An approval process status trigger's own outputs (#2990): "Final
|
|
1347
|
+
// Approval By's id" -> approver.id, "Approval Status" -> status, ... A
|
|
1348
|
+
// field of the app with the same display name keeps the plain key, and the
|
|
1349
|
+
// output then comes as "Approval Chain Trigger - <key>".
|
|
1350
|
+
if (ctx.trigger.type === "elementum_approval_chain_trigger") {
|
|
1351
|
+
const approvalPath = approvalTriggerPathFromRefsKey(wireName, (key) => ownerFieldHasDisplayName(key, ctx));
|
|
1352
|
+
if (approvalPath !== undefined)
|
|
1353
|
+
return approvalPath;
|
|
1354
|
+
}
|
|
1290
1355
|
// emailReceived's own trigger-output field names (EmailReceivedTriggerOutput,
|
|
1291
1356
|
// triggers.ts) use snake_case matching the platform's field identifiers,
|
|
1292
1357
|
// not the human display labels the platform emits in triggerReference.name
|
|
@@ -1364,8 +1429,27 @@ function triggerRefPath(path, ctx) {
|
|
|
1364
1429
|
return names;
|
|
1365
1430
|
return recordFieldRefPath(wireName, ctx) ?? names;
|
|
1366
1431
|
}
|
|
1432
|
+
/**
|
|
1433
|
+
* Whether a field of this export's app or element has exactly this display
|
|
1434
|
+
* name: the provider keeps the plain refs key for such a field. Read from the
|
|
1435
|
+
* field blocks, not `fieldById`, which a `--no-imports` export leaves empty.
|
|
1436
|
+
*/
|
|
1437
|
+
function ownerFieldHasDisplayName(name, ctx) {
|
|
1438
|
+
if (name === ctx.titleFieldName || name === ctx.idFieldName || name === ctx.statusFieldName)
|
|
1439
|
+
return true;
|
|
1440
|
+
for (const block of ctx.resourceBlocks.values()) {
|
|
1441
|
+
if (block.type?.endsWith("_field") !== true || block.attrs.name !== name)
|
|
1442
|
+
continue;
|
|
1443
|
+
// Only the trigger's own app or element: build checks the owner's fields alone.
|
|
1444
|
+
const ownerTf = (block.label !== undefined ? ownerFromScopedChildLabel(block.label)?.ownerTfLabel : undefined) ?? ctx.appTfLabel;
|
|
1445
|
+
if (tfLabelToTsLabel(ownerTf) === ctx.appRefName)
|
|
1446
|
+
return true;
|
|
1447
|
+
}
|
|
1448
|
+
return false;
|
|
1449
|
+
}
|
|
1367
1450
|
// Top-level properties the record trigger outputs declare (RecordTriggerOutput,
|
|
1368
|
-
// AttachmentTriggerOutput, CommentAddedTriggerOutput
|
|
1451
|
+
// AttachmentTriggerOutput, CommentAddedTriggerOutput,
|
|
1452
|
+
// ApprovalProcessStatusUpdatedTriggerOutput in triggers.ts).
|
|
1369
1453
|
const RECORD_TRIGGER_OUTPUT_HEADS = new Set(["record", "changedFieldIds", "attachment", "comment"]);
|
|
1370
1454
|
const UNDECLARED_HEAD_TRIGGER_TYPES = new Set([
|
|
1371
1455
|
"elementum_record_created_trigger",
|
|
@@ -1381,7 +1465,8 @@ const UNDECLARED_HEAD_TRIGGER_TYPES = new Set([
|
|
|
1381
1465
|
* signature, so pull prints it through an `as any` escape (#2643).
|
|
1382
1466
|
*/
|
|
1383
1467
|
function undeclaredRecordTriggerHead(path, ctx) {
|
|
1384
|
-
|
|
1468
|
+
const heads = ctx.trigger.type === "elementum_approval_chain_trigger" ? APPROVAL_TRIGGER_OUTPUT_HEADS : RECORD_TRIGGER_OUTPUT_HEADS;
|
|
1469
|
+
return UNDECLARED_HEAD_TRIGGER_TYPES.has(ctx.trigger.type ?? "") && path.length === 1 && !heads.has(path[0]);
|
|
1385
1470
|
}
|
|
1386
1471
|
function forEachItemOwnerRefName(loop, ctx) {
|
|
1387
1472
|
const collection = loop === undefined ? undefined : resourceRef(loop.attrs.list);
|
|
@@ -5351,6 +5436,7 @@ function automationFromTfDocument(doc, automationLabel, appRefName, foreignField
|
|
|
5351
5436
|
}
|
|
5352
5437
|
}
|
|
5353
5438
|
const stringifiedValueReferences = { unresolved: false };
|
|
5439
|
+
const undeclaredScriptOutputFieldReads = new Map();
|
|
5354
5440
|
const groupsMissingFromOrg = new Set();
|
|
5355
5441
|
const optionIdWarnings = new Set();
|
|
5356
5442
|
const ctx = {
|
|
@@ -5381,6 +5467,7 @@ function automationFromTfDocument(doc, automationLabel, appRefName, foreignField
|
|
|
5381
5467
|
...(procedureKeysByDiscriminator !== undefined && { procedureKeysByDiscriminator }),
|
|
5382
5468
|
...(groupKeysByName !== undefined && { groupKeysByName }),
|
|
5383
5469
|
stringifiedValueReferences,
|
|
5470
|
+
undeclaredScriptOutputFieldReads,
|
|
5384
5471
|
groupsMissingFromOrg,
|
|
5385
5472
|
optionIdWarnings,
|
|
5386
5473
|
...(resourceImportIds.has(`${AUTOMATION_RESOURCE_TYPE}.${automationLabel}`) && {
|
|
@@ -5619,13 +5706,16 @@ function automationFromTfDocument(doc, automationLabel, appRefName, foreignField
|
|
|
5619
5706
|
ast,
|
|
5620
5707
|
blocks: [automation, trigger, ...tasks, ...ownedBranches, ...(publish ? [publish] : [])],
|
|
5621
5708
|
adoptionAddressAliases,
|
|
5622
|
-
...((unrebuildableTasks.length > 0 || placeholderTasks.length > 0 || outputDiagnostics.length > 0 || taskDiagnostics.length > 0 || groupsMissingFromOrg.size > 0 || optionIdWarnings.size > 0) && {
|
|
5709
|
+
...((unrebuildableTasks.length > 0 || placeholderTasks.length > 0 || outputDiagnostics.length > 0 || taskDiagnostics.length > 0 || groupsMissingFromOrg.size > 0 || optionIdWarnings.size > 0 || undeclaredScriptOutputFieldReads.size > 0) && {
|
|
5623
5710
|
diagnostics: [
|
|
5624
5711
|
...unrebuildableTasks.map((address) => `automation "${automationLabel}": ${address}'s real parent is a task type EDK doesn't support yet, so its authored position couldn't be reconstructed (anchored to the trigger instead) - not rebuildable from this source until that task type is supported`),
|
|
5625
5712
|
...placeholderTasks.map(({ name, taskType }) => `automation "${automationLabel}" uses platform task type "${taskType}" ("${name}"), which EDK doesn't implement - kept as an unimplementedTask(...) placeholder; its configuration isn't authorable, but its position and downstream chain are round-trip-safe`),
|
|
5626
5713
|
...outputDiagnostics,
|
|
5627
5714
|
...taskDiagnostics.map((message) => `automation "${automationLabel}": ${message}`),
|
|
5628
5715
|
...[...optionIdWarnings].map((message) => `automation "${automationLabel}": ${message}`),
|
|
5716
|
+
...(undeclaredScriptOutputFieldReads.size > 0
|
|
5717
|
+
? [`automation ${JSON.stringify(typeof automation.attrs.name === "string" ? automation.attrs.name : automationLabel)}: ${undeclaredScriptOutputFieldWarning(undeclaredScriptOutputFieldReads)}`]
|
|
5718
|
+
: []),
|
|
5629
5719
|
...[...groupsMissingFromOrg].map((name) => `automation "${automationLabel}": group "${name}" is not in the org catalog this pull loaded (org.ts doesn't carry it, or org.ts is missing or couldn't be imported), so it was pulled as groupRef({ name: ${JSON.stringify(name)} }); run \`elementum pull org --data-only\`, then pull this app again to refer to it as org.groups.<key>`),
|
|
5630
5720
|
],
|
|
5631
5721
|
}),
|
|
@@ -20,4 +20,4 @@ export { ScriptCodeError, scriptFile, type ScriptCodeFn, type ScriptFile, type S
|
|
|
20
20
|
export { unsafeScriptOutput } from "./unsafe-script-output.js";
|
|
21
21
|
export { workflowOutput, workflowOutputType, type WorkflowOutputDeclaration, type WorkflowOutputType, } from "./workflow-output.js";
|
|
22
22
|
export { addWatcher, aiAgent, aiClassify, aiEmailAnalysis, aiFileAnalysis, aiSearchTable, aiSummarize, aiTransform, apiRequest, approvalChain, approvalChainTemplate, approvalStatusUpdate, requiredSecret, assignGroup, assignUser, assignmentEngine, bulkExcel, bulkUpdateFields, calculation, createRecord, executeScript, findRelatedRecords, generateReport, initiateCall, initiateEmailConversation, notification, postComment, postTeamsMessage, procedure, readFile, recordFieldLocking, recordSearch, relateRecords, runAutomation, saveAttachment, sendEmail, sendSurvey, setVariable, tableRecordsSearch, unzip, updateField, userGroupSearch, userSearch, withFieldMappings, type AddWatcherOptions, type AiAgentAttachment, type AiAgentOptions, type AiAgentOutput, type AiAgentOutputField, type AiAgentOutputFieldType, type AiClassifyCategorySource, type AiClassifyOptions, type AiClassifyStaticCategory, type AiEmailAnalysisOptions, type AiFileAnalysisOptions, type AiSearchTableOptions, type AiSearchTableOutput, type AiSummarizeOptions, type AiTransformOptions, type ApiRequestHeader, type ApiRequestOptions, type ApiRequestOutputs, type ApiResponseType, type ApprovalChainOptions, type RequiredSecret, type ApprovalChainTemplateOptions, type ApprovalStatusUpdateOptions, type ApprovalStatusUpdateStatus, type AssignGroupOptions, type AssignUserOptions, type AssignmentEngineOptions, type BulkExcelFieldMapping, type BulkExcelFieldSource, type BulkExcelOptions, type BulkUpdateFieldsOptions, type BulkUpdateFieldsOutput, type CalculationEntry, type CalculationExpression, type CalculationInclude, type CalculationOptions, type CalculationOutputs, type CalculationValueInput, type CalculationValueOptions, type CalculationValueOutputs, type CalculationValues, type CreateRecordOptions, type CreateRecordOutput, type EmailAttachment, type ExecuteScriptFieldMapping, type ExecuteScriptOptions, type ExecuteScriptOutput, type FieldAssignment, type FindRelatedRecordsOptions, type FindRelatedRecordsOutput, type GenerateReportOptions, type InitiateCallOptions, type InitiateEmailConversationOptions, type InitiateEmailFirstEmail, type LegacyCalculationOptions, type MultiSelectUpdateMode, type NotificationOptions, type StaticGroupRecipient, type StaticUserRecipient, type PostCommentOptions, type PostTeamsMessageOptions, type LegacyProcedureOptions, type ProcedureOptions, type TypedProcedureOptions, type ReadFileDataSource, type ReadFileOptions, type RecordFieldLockingOptions, type RecordId, type RecordReference, type RecordSearchOptions, type RecordSearchOutput, type RelateRecordsOptions, type RunAutomationInput, type RunAutomationDynamicReferenceOptions, type RunAutomationOptions, type RunAutomationStaticOptions, type SaveAttachmentOptions, type ScriptOutputProperties, type ScriptOutputScalarType, type ScriptOutputType, type ScriptOutputs, type SendEmailOptions, type SendSurveyOptions, type SetVariableOptions, type TableRecordsSearchOptions, type TableRecordsSearchOutput, type UnzipOptions, type UpdateFieldAssignment, type UpdateFieldOptions, type UserGroupSearchOptions, type UserGroupSearchOutput, type UserGroupShape, type UserSearchOptions, type VariableAssign, type VariableDecl } from "./tasks.js";
|
|
23
|
-
export { approvalProcessStatusUpdated, attachment, commentAdded, conversationEnd, dataMine, emailReceived, onDemand, recordCreated, recordUpdated, schedule, slackMessage, surveyResponseCreate, temporal, webHook, webhook, type AttachmentTriggerOptions, type AttachmentTriggerOutput, type CommentAddedTriggerOptions, type CommentAddedTriggerOutput, type ConversationEndConversationType, type ConversationEndTriggerOptions, type ConversationEndTriggerOutput, type DataMineTriggerOptions, type DataMineTriggerOutput, type EmailReceivedTriggerOptions, type EmailReceivedTriggerOutput, type RecordTriggerOptions, type RecordTriggerOutput, type ScheduleFrequency, type ScheduleTriggerOptions, type ScheduleTriggerOutput, type SlackMessageTriggerOutput, type SurveyResponseCreateTriggerOptions, type SurveyResponseCreateTriggerOutput, type TemporalTriggerOptions, type TemporalUnit, type WebhookTriggerOptions, type WebhookTriggerOutput, type Weekday, type approvalProcessStatusUpdatedStatus, type approvalProcessStatusUpdatedTriggerOptions } from "./triggers.js";
|
|
23
|
+
export { approvalProcessStatusUpdated, attachment, commentAdded, conversationEnd, dataMine, emailReceived, onDemand, recordCreated, recordUpdated, schedule, slackMessage, surveyResponseCreate, temporal, webHook, webhook, type ApprovalProcessStatusUpdatedApprover, type ApprovalProcessStatusUpdatedTriggerOutput, type AttachmentTriggerOptions, type AttachmentTriggerOutput, type CommentAddedTriggerOptions, type CommentAddedTriggerOutput, type ConversationEndConversationType, type ConversationEndTriggerOptions, type ConversationEndTriggerOutput, type DataMineTriggerOptions, type DataMineTriggerOutput, type EmailReceivedTriggerOptions, type EmailReceivedTriggerOutput, type RecordTriggerOptions, type RecordTriggerOutput, type ScheduleFrequency, type ScheduleTriggerOptions, type ScheduleTriggerOutput, type SlackMessageTriggerOutput, type SurveyResponseCreateTriggerOptions, type SurveyResponseCreateTriggerOutput, type TemporalTriggerOptions, type TemporalUnit, type WebhookTriggerOptions, type WebhookTriggerOutput, type Weekday, type approvalProcessStatusUpdatedStatus, type approvalProcessStatusUpdatedTriggerOptions } from "./triggers.js";
|