@elementumai/edk 0.10.3 → 0.11.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 +11 -7
- package/dist-sdk/src/catalog/token.js +2 -1
- package/dist-sdk/src/core/wire/ref-serializer.js +26 -1
- package/dist-sdk/src/engine/build/context.d.ts +4 -0
- package/dist-sdk/src/engine/coverage-gaps.d.ts +2 -0
- package/dist-sdk/src/engine/coverage-gaps.js +3 -0
- package/dist-sdk/src/engine/ei/json-stream-reader.d.ts +43 -0
- package/dist-sdk/src/engine/ei/json-stream-reader.js +234 -0
- package/dist-sdk/src/engine/ei/run.d.ts +22 -0
- package/dist-sdk/src/engine/ei/run.js +99 -18
- package/dist-sdk/src/engine/ei/saved-plan.d.ts +16 -0
- package/dist-sdk/src/engine/ei/saved-plan.js +19 -0
- package/dist-sdk/src/engine/ei/state.d.ts +1 -1
- package/dist-sdk/src/engine/ei/state.js +17 -4
- package/dist-sdk/src/engine/progress.d.ts +3 -1
- package/dist-sdk/src/engine/progress.js +7 -3
- package/dist-sdk/src/engine/pull/authored-address.d.ts +15 -1
- package/dist-sdk/src/engine/pull/authored-address.js +180 -29
- package/dist-sdk/src/engine/pull/context.d.ts +52 -7
- package/dist-sdk/src/engine/pull/context.js +7 -4
- package/dist-sdk/src/engine/tf/index.d.ts +3 -2
- package/dist-sdk/src/engine/tf/index.js +3 -2
- package/dist-sdk/src/engine/tf/labels.d.ts +22 -0
- package/dist-sdk/src/engine/tf/labels.js +50 -0
- package/dist-sdk/src/engine/tf/model.d.ts +2 -0
- package/dist-sdk/src/engine/tf/model.js +26 -0
- package/dist-sdk/src/engine/tf/scan.d.ts +22 -0
- package/dist-sdk/src/engine/tf/scan.js +123 -0
- package/dist-sdk/src/engine/validation.d.ts +2 -0
- package/dist-sdk/src/engine/workspace/loader.d.ts +8 -0
- package/dist-sdk/src/engine/workspace/loader.js +20 -0
- package/dist-sdk/src/entities/access-policy/from-tf.d.ts +17 -0
- package/dist-sdk/src/entities/access-policy/from-tf.js +52 -24
- package/dist-sdk/src/entities/access-policy/member-list.d.ts +32 -0
- package/dist-sdk/src/entities/access-policy/member-list.js +57 -0
- package/dist-sdk/src/entities/access-policy/module.js +5 -0
- package/dist-sdk/src/entities/access-policy/to-tf.d.ts +4 -3
- package/dist-sdk/src/entities/access-policy/to-tf.js +21 -12
- package/dist-sdk/src/entities/agent/build.js +7 -5
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +2 -0
- package/dist-sdk/src/entities/agent/from-tf.js +13 -3
- package/dist-sdk/src/entities/agent/to-tf.d.ts +13 -11
- package/dist-sdk/src/entities/agent/to-tf.js +28 -17
- package/dist-sdk/src/entities/agent/tools.d.ts +8 -0
- package/dist-sdk/src/entities/agent/tools.js +6 -2
- package/dist-sdk/src/entities/agent-tool/from-tf.d.ts +2 -0
- package/dist-sdk/src/entities/agent-tool/from-tf.js +2 -2
- package/dist-sdk/src/entities/agent-tool/to-tf.d.ts +29 -0
- package/dist-sdk/src/entities/agent-tool/to-tf.js +65 -3
- package/dist-sdk/src/entities/agent-tool/types.d.ts +12 -8
- package/dist-sdk/src/entities/agent-tool/types.js +13 -9
- package/dist-sdk/src/entities/app/build.d.ts +11 -0
- package/dist-sdk/src/entities/app/build.js +1 -0
- package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +11 -7
- package/dist-sdk/src/entities/app/from-tf.js +19 -9
- package/dist-sdk/src/entities/app/to-tf.js +6 -4
- package/dist-sdk/src/entities/automation/build.d.ts +2 -7
- package/dist-sdk/src/entities/automation/build.js +55 -16
- package/dist-sdk/src/entities/automation/deserializer/ast.d.ts +7 -4
- package/dist-sdk/src/entities/automation/deserializer/print-automation.js +7 -11
- package/dist-sdk/src/entities/automation/from-tf.d.ts +23 -1
- package/dist-sdk/src/entities/automation/from-tf.js +456 -34
- package/dist-sdk/src/entities/automation/index.d.ts +1 -1
- package/dist-sdk/src/entities/automation/module.d.ts +22 -2
- package/dist-sdk/src/entities/automation/module.js +273 -58
- package/dist-sdk/src/entities/automation/output-field-types.d.ts +8 -0
- package/dist-sdk/src/entities/automation/output-field-types.js +20 -0
- package/dist-sdk/src/entities/automation/output-key-wire-name.d.ts +24 -2
- package/dist-sdk/src/entities/automation/output-key-wire-name.js +72 -3
- package/dist-sdk/src/entities/automation/run-target.d.ts +59 -0
- package/dist-sdk/src/entities/automation/run-target.js +99 -0
- package/dist-sdk/src/entities/automation/script-code.d.ts +9 -0
- package/dist-sdk/src/entities/automation/script-code.js +24 -3
- package/dist-sdk/src/entities/automation/task-output-labels.d.ts +16 -0
- package/dist-sdk/src/entities/automation/task-output-labels.js +49 -0
- package/dist-sdk/src/entities/automation/tasks.d.ts +20 -8
- package/dist-sdk/src/entities/automation/to-tf.d.ts +8 -3
- package/dist-sdk/src/entities/automation/to-tf.js +171 -58
- package/dist-sdk/src/entities/automation/triggers.d.ts +22 -3
- package/dist-sdk/src/entities/automation/triggers.js +40 -0
- package/dist-sdk/src/entities/automation/types.d.ts +21 -0
- package/dist-sdk/src/entities/automation/types.js +26 -0
- package/dist-sdk/src/entities/dashboard/from-tf.d.ts +11 -1
- package/dist-sdk/src/entities/dashboard/from-tf.js +57 -7
- package/dist-sdk/src/entities/dashboard/to-tf.js +13 -0
- package/dist-sdk/src/entities/dynamic-layout/build.d.ts +7 -2
- package/dist-sdk/src/entities/dynamic-layout/from-tf.d.ts +3 -0
- package/dist-sdk/src/entities/dynamic-layout/from-tf.js +65 -19
- package/dist-sdk/src/entities/dynamic-layout/to-tf.d.ts +4 -2
- package/dist-sdk/src/entities/dynamic-layout/to-tf.js +341 -32
- package/dist-sdk/src/entities/element/build.d.ts +10 -0
- package/dist-sdk/src/entities/element/build.js +1 -0
- package/dist-sdk/src/entities/element/from-tf.js +16 -9
- package/dist-sdk/src/entities/element/to-tf.js +6 -4
- package/dist-sdk/src/entities/field/from-tf.d.ts +24 -0
- package/dist-sdk/src/entities/field/from-tf.js +79 -1
- package/dist-sdk/src/entities/field/module.js +7 -0
- package/dist-sdk/src/entities/field/to-tf.d.ts +30 -1
- package/dist-sdk/src/entities/field/to-tf.js +51 -0
- package/dist-sdk/src/entities/file-reader/module.js +3 -3
- package/dist-sdk/src/entities/file-reader/to-tf.js +3 -3
- package/dist-sdk/src/entities/file-reader/types.d.ts +4 -16
- package/dist-sdk/src/entities/file-reader/types.js +7 -0
- package/dist-sdk/src/entities/org/group.d.ts +1 -0
- package/dist-sdk/src/entities/org/group.js +2 -1
- package/dist-sdk/src/entities/record-create-form/from-tf.d.ts +8 -0
- package/dist-sdk/src/entities/record-create-form/from-tf.js +10 -2
- package/dist-sdk/src/entities/record-create-form/to-tf.d.ts +2 -1
- package/dist-sdk/src/entities/record-create-form/to-tf.js +14 -2
- package/dist-sdk/src/entities/relationship/from-tf.d.ts +8 -0
- package/dist-sdk/src/entities/relationship/from-tf.js +88 -10
- package/dist-sdk/src/entities/relationship/to-tf.d.ts +3 -2
- package/dist-sdk/src/entities/relationship/to-tf.js +79 -8
- package/dist-sdk/src/entities/role/from-tf.js +24 -7
- package/dist-sdk/src/entities/role/to-tf.js +25 -7
- package/dist-sdk/src/entities/service-account/from-tf.js +2 -1
- package/dist-sdk/src/entities/service-account/module.js +15 -0
- package/dist-sdk/src/entities/service-account/to-tf.js +12 -4
- package/dist-sdk/src/entities/shared/filters/tf-codec.d.ts +1 -1
- package/dist-sdk/src/entities/shared/filters/tf-codec.js +12 -7
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.d.ts +5 -2
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +8 -1
- package/dist-sdk/src/entities/skill/from-tf.js +10 -3
- package/dist-sdk/src/entities/skill/module.js +44 -2
- package/dist-sdk/src/entities/skill/to-tf.d.ts +8 -1
- package/dist-sdk/src/entities/skill/to-tf.js +23 -14
- package/dist-sdk/src/entities/skill/tools.d.ts +8 -0
- package/dist-sdk/src/entities/skill/tools.js +6 -2
- package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +2 -0
- package/dist-sdk/src/entities/skill-tool/to-tf.d.ts +8 -0
- package/dist-sdk/src/entities/skill-tool/to-tf.js +6 -2
- package/dist-sdk/src/entities/view/agent-view-layout-from-tf.d.ts +10 -2
- package/dist-sdk/src/entities/view/agent-view-layout-from-tf.js +18 -4
- package/dist-sdk/src/entities/view/custom-view-validate.js +6 -5
- package/dist-sdk/src/entities/view/from-tf.d.ts +68 -0
- package/dist-sdk/src/entities/view/from-tf.js +503 -25
- package/dist-sdk/src/entities/view/module.js +15 -0
- package/dist-sdk/src/entities/view/portable.d.ts +11 -0
- package/dist-sdk/src/entities/view/portable.js +47 -0
- package/dist-sdk/src/entities/view/to-tf.d.ts +4 -1
- package/dist-sdk/src/entities/view/to-tf.js +25 -7
- package/dist-sdk/src/entities/view/types.js +1 -1
- package/dist-sdk/src/entities/widget/build.d.ts +4 -3
- package/dist-sdk/src/entities/widget/from-tf.d.ts +3 -0
- package/dist-sdk/src/entities/widget/from-tf.js +100 -3
- package/dist-sdk/src/entities/widget/to-tf.d.ts +16 -1
- package/dist-sdk/src/entities/widget/to-tf.js +77 -14
- package/dist-sdk/src/generated/ragnarok/ragnarok-spec.d.ts +27 -8
- package/dist-sdk/src/generated/ragnarok/ragnarok-spec.js +2 -2
- package/dist-sdk/src/graph/field-resource-types.d.ts +2 -0
- package/dist-sdk/src/graph/field-resource-types.js +11 -0
- package/dist-sdk/src/graph/index.d.ts +28 -3
- package/dist-sdk/src/graph/index.js +12 -2
- package/dist-sdk/src/graph/types.d.ts +164 -5
- package/package.json +1 -1
|
@@ -220,13 +220,8 @@ export type NormalizedDashboardWidget = {
|
|
|
220
220
|
export interface NormalizedWidgetRef {
|
|
221
221
|
readonly kind: "app" | "element" | "task" | "automation" | "field" | "recordIdentity";
|
|
222
222
|
readonly key: string;
|
|
223
|
+
/** The display name; build looks an automation that is not in source up by it (#1900). */
|
|
223
224
|
readonly name: string;
|
|
224
|
-
/**
|
|
225
|
-
* Export display name, present only when pull read one. Build uses it to
|
|
226
|
-
* look up an automation that is not in source. Absent means `name` is not
|
|
227
|
-
* a display name.
|
|
228
|
-
*/
|
|
229
|
-
readonly displayName?: string;
|
|
230
225
|
readonly parent?: string;
|
|
231
226
|
readonly fieldType?: string;
|
|
232
227
|
readonly target?: NormalizedWidgetRef;
|
|
@@ -331,9 +326,10 @@ export interface PulledRelationshipRef {
|
|
|
331
326
|
export interface NormalizedRelationship {
|
|
332
327
|
readonly key: string;
|
|
333
328
|
readonly target: PulledRelationshipRef;
|
|
329
|
+
/** `relatedField` is a platform id when ei couldn't name another owner's field (#1991). */
|
|
334
330
|
readonly columns: readonly {
|
|
335
331
|
readonly field: string;
|
|
336
|
-
readonly relatedField: PulledRelationshipRef;
|
|
332
|
+
readonly relatedField: PulledRelationshipRef | string;
|
|
337
333
|
}[];
|
|
338
334
|
readonly filter?: NormalizedAccessPolicy["filter"];
|
|
339
335
|
}
|
|
@@ -387,6 +383,12 @@ export interface NormalizedApp {
|
|
|
387
383
|
readonly layouts?: readonly NormalizedLayout[];
|
|
388
384
|
/** Saved list views (`elementum_list_view`). */
|
|
389
385
|
readonly listViews?: readonly NormalizedListView[];
|
|
386
|
+
/**
|
|
387
|
+
* Platform ids pull kept in view field references because it did not
|
|
388
|
+
* extract their field (#1736). Print marks them as intentional instead of
|
|
389
|
+
* #1178's "replace with a real ref" TODO, which would drop the column.
|
|
390
|
+
*/
|
|
391
|
+
readonly unextractedFieldIds?: readonly string[];
|
|
390
392
|
/** Calendar views (`elementum_calendar_view`). */
|
|
391
393
|
readonly calendarViews?: readonly NormalizedCalendarView[];
|
|
392
394
|
/** Kanban views (`elementum_kanban_view`). */
|
|
@@ -403,6 +405,8 @@ export interface NormalizedApp {
|
|
|
403
405
|
readonly relationships?: readonly NormalizedRelationship[];
|
|
404
406
|
/** Display order of `listViews`, by key (`elementum_managed_view_order`). */
|
|
405
407
|
readonly viewOrder?: readonly string[];
|
|
408
|
+
/** `elementum_managed_view_order.delete_platform_default_list_view` (#1773). */
|
|
409
|
+
readonly deleteDefaultListView?: boolean;
|
|
406
410
|
/** App/element-level sharing & row-level-security policies (`elementum_access_policy`), in export order. */
|
|
407
411
|
readonly accessPolicies?: readonly NormalizedAccessPolicy[];
|
|
408
412
|
/** Custom roles only; managed roles are represented by data lookups. */
|
|
@@ -12,7 +12,7 @@ import { DEPLOY_DEFAULT_SYSTEM_FIELD_NAMES, SYSTEM_FIELD_KEYS, SYSTEM_FIELD_KEY_
|
|
|
12
12
|
import { EntityTfError } from "../../engine/entity.js";
|
|
13
13
|
import { dataRefLabel, optionalString, plainObject } from "../../engine/pull/context.js";
|
|
14
14
|
import { tfLabelToTsLabel } from "../../engine/tf/index.js";
|
|
15
|
-
import { accessPolicyFromTf } from "../access-policy/from-tf.js";
|
|
15
|
+
import { accessPolicyBlocksInLabelOrder, accessPolicyFromTf } from "../access-policy/from-tf.js";
|
|
16
16
|
import { dynamicLayoutCompanionWidgetLabels, dynamicLayoutsFromTf, } from "../dynamic-layout/from-tf.js";
|
|
17
17
|
import { dashboardsFromTf } from "../dashboard/from-tf.js";
|
|
18
18
|
import { fieldFromTf } from "../field/from-tf.js";
|
|
@@ -21,7 +21,7 @@ import { recordCreateFormFromTf } from "../record-create-form/from-tf.js";
|
|
|
21
21
|
import { relationshipsFromTf } from "../relationship/from-tf.js";
|
|
22
22
|
import { rolesFromTf } from "../role/from-tf.js";
|
|
23
23
|
import { serviceAccountsFromTf } from "../service-account/from-tf.js";
|
|
24
|
-
import { viewsFromTf } from "../view/from-tf.js";
|
|
24
|
+
import { fieldKeysByDisplayName, viewsFromTf } from "../view/from-tf.js";
|
|
25
25
|
import { widgetsFromTf } from "../widget/from-tf.js";
|
|
26
26
|
import { APP_RESOURCE_TYPE } from "./module.js";
|
|
27
27
|
import { stageHandleIndex } from "./stage-keys.js";
|
|
@@ -215,20 +215,28 @@ export function appFromTf(appBlock, fieldBlocks, ctx, viewBlocks = { layoutBlock
|
|
|
215
215
|
// One stage-handle map for every stage reference this app pulls (#1136).
|
|
216
216
|
const stageHandles = stageHandleIndex(stages.map((stage) => ({ key: stage.key, name: stage.stage.name })), ctx.diagnostics);
|
|
217
217
|
// --- View pass: layouts / list views / view order (entities/view), owner passed in.
|
|
218
|
-
const
|
|
219
|
-
const
|
|
218
|
+
const unextractedFieldIds = new Set();
|
|
219
|
+
const fieldKeys = new Set(fields.map((field) => field.key));
|
|
220
|
+
// Every field reference pull writes keeps an unextracted field as its platform id (#1736, #1966).
|
|
221
|
+
const fieldKeysByName = fieldKeysByDisplayName(fields);
|
|
222
|
+
const dashboards = dashboardsFromTf(viewBlocks.dashboardBlocks, viewBlocks.dashboardWidgetBlocks, { type: APP_RESOURCE_TYPE, label, ownerTfLabel: label, ownerRefName: refName, scope: "app", ownerType: "APP_ASPECT", fieldKeys, fieldKeysByName, unextractedFieldIds }, ctx);
|
|
223
|
+
const unextracted = { type: APP_RESOURCE_TYPE, label, ownerTfLabel: label, scope: "app", fieldKeys, fieldKeysByName, unextractedFieldIds };
|
|
224
|
+
const { layouts, listViews, calendarViews, kanbanViews, dashboardViews, agentViews, customViews, viewOrder, deleteDefaultListView } = viewsFromTf(viewBlocks.layoutBlocks, viewBlocks.listViewBlocks, viewBlocks.calendarViewBlocks, viewBlocks.kanbanViewBlocks, viewBlocks.dashboardViewBlocks, viewBlocks.agentViewBlocks, viewBlocks.managedViewOrderBlocks, {
|
|
220
225
|
type: APP_RESOURCE_TYPE, label, ownerTfLabel: label, scope: "app",
|
|
221
226
|
stageKeys: stageHandles.keys,
|
|
222
227
|
stageKeyByHandle: stageHandles.byHandle,
|
|
228
|
+
fieldKeys,
|
|
229
|
+
fieldKeysByName,
|
|
230
|
+
unextractedFieldIds,
|
|
223
231
|
}, ctx, viewBlocks.customViewBlocks);
|
|
224
232
|
if (viewBlocks.recordCreateFormBlocks.length > 1) {
|
|
225
233
|
ctx.diagnostics.push(`app "${label}": found ${viewBlocks.recordCreateFormBlocks.length} record create forms; only the first is used`);
|
|
226
234
|
}
|
|
227
|
-
const recordCreateForm = recordCreateFormFromTf(viewBlocks.recordCreateFormBlocks[0], { type: APP_RESOURCE_TYPE, label, ownerTfLabel:
|
|
228
|
-
const dynamicLayoutOwner = { type: APP_RESOURCE_TYPE, label, ownerRefName: refName, ownerTfLabel: label, stageHandles };
|
|
235
|
+
const recordCreateForm = recordCreateFormFromTf(viewBlocks.recordCreateFormBlocks[0], { type: APP_RESOURCE_TYPE, label, ownerTfLabel: label, scope: "app", unextracted }, ctx);
|
|
236
|
+
const dynamicLayoutOwner = { type: APP_RESOURCE_TYPE, label, ownerRefName: refName, ownerTfLabel: label, stageHandles, unextracted };
|
|
229
237
|
const dynamicLayouts = dynamicLayoutsFromTf(viewBlocks.dynamicLayoutBlocks, dynamicLayoutOwner, ctx);
|
|
230
|
-
const relationships = relationshipsFromTf(viewBlocks.relationshipBlocks, { kind: "app", label, ownerRefName: refName, ownerTfLabel:
|
|
231
|
-
const widgets = widgetsFromTf(viewBlocks.widgetBlocks, { type: APP_RESOURCE_TYPE, label, ownerRefName: refName, ownerTfLabel: label, scope: "app" }, ctx, dynamicLayoutCompanionWidgetLabels(viewBlocks.dynamicLayoutBlocks, dynamicLayoutOwner));
|
|
238
|
+
const relationships = relationshipsFromTf(viewBlocks.relationshipBlocks, { kind: "app", label, ownerRefName: refName, ownerTfLabel: label, scope: "app", unextracted }, ctx);
|
|
239
|
+
const widgets = widgetsFromTf(viewBlocks.widgetBlocks, { type: APP_RESOURCE_TYPE, label, ownerRefName: refName, ownerTfLabel: label, scope: "app", unextracted }, ctx, dynamicLayoutCompanionWidgetLabels(viewBlocks.dynamicLayoutBlocks, dynamicLayoutOwner));
|
|
232
240
|
// --- Access policies (entities/access-policy), owner passed in.
|
|
233
241
|
const accessPolicyOwner = {
|
|
234
242
|
type: APP_RESOURCE_TYPE,
|
|
@@ -238,7 +246,7 @@ export function appFromTf(appBlock, fieldBlocks, ctx, viewBlocks = { layoutBlock
|
|
|
238
246
|
scope: "app",
|
|
239
247
|
};
|
|
240
248
|
const accessPolicies = [];
|
|
241
|
-
for (const block of accessPolicyBlocks) {
|
|
249
|
+
for (const block of accessPolicyBlocksInLabelOrder(accessPolicyBlocks)) {
|
|
242
250
|
const entry = accessPolicyFromTf(block, accessPolicyOwner, ctx);
|
|
243
251
|
if (entry !== undefined)
|
|
244
252
|
accessPolicies.push(entry);
|
|
@@ -268,6 +276,7 @@ export function appFromTf(appBlock, fieldBlocks, ctx, viewBlocks = { layoutBlock
|
|
|
268
276
|
...(autoShare !== undefined && { autoShare }),
|
|
269
277
|
...(layouts.length > 0 && { layouts }),
|
|
270
278
|
...(listViews.length > 0 && { listViews }),
|
|
279
|
+
...(unextractedFieldIds.size > 0 && { unextractedFieldIds: [...unextractedFieldIds] }),
|
|
271
280
|
...(calendarViews.length > 0 && { calendarViews }),
|
|
272
281
|
...(kanbanViews.length > 0 && { kanbanViews }),
|
|
273
282
|
...(dashboardViews.length > 0 && { dashboardViews }),
|
|
@@ -279,6 +288,7 @@ export function appFromTf(appBlock, fieldBlocks, ctx, viewBlocks = { layoutBlock
|
|
|
279
288
|
...(dynamicLayouts.length > 0 && { dynamicLayouts }),
|
|
280
289
|
...(relationships.length > 0 && { relationships }),
|
|
281
290
|
...(viewOrder !== undefined && { viewOrder }),
|
|
291
|
+
...(deleteDefaultListView !== undefined && { deleteDefaultListView }),
|
|
282
292
|
...(accessPolicies.length > 0 && { accessPolicies }),
|
|
283
293
|
...(roles.length > 0 && { roles }),
|
|
284
294
|
...(serviceAccounts.length > 0 && { serviceAccounts }),
|
|
@@ -270,7 +270,7 @@ export function appToTf(entity, ctx) {
|
|
|
270
270
|
availableChartRefNames: ctx.workspaceAspects?.get(workspaceAspectKey("app", ctx.appRefName))?.managedChildRefNames?.get("chart"),
|
|
271
271
|
diagnostics: ctx.diagnostics,
|
|
272
272
|
}));
|
|
273
|
-
|
|
273
|
+
const widgets = widgetsToTf(payload.widgets, {
|
|
274
274
|
ownerRefName: ctx.appRefName,
|
|
275
275
|
ownerTfLabel: ctx.appTfLabel,
|
|
276
276
|
ownerType: APP_RESOURCE_TYPE,
|
|
@@ -281,7 +281,8 @@ export function appToTf(entity, ctx) {
|
|
|
281
281
|
diagnostics: ctx.diagnostics,
|
|
282
282
|
fieldAddresses,
|
|
283
283
|
relationshipTargets: relationshipTargetsFromBag(payload.relationships),
|
|
284
|
-
})
|
|
284
|
+
});
|
|
285
|
+
blocks.push(...widgets.blocks);
|
|
285
286
|
const { blocks: viewBlocks } = viewToTf(payload.layouts, payload.listViews, payload.calendarViews, payload.kanbanViews, payload.dashboardViews, payload.agentViews, payload.viewOrder, {
|
|
286
287
|
ownerRefName: ctx.appRefName,
|
|
287
288
|
ownerTfLabel: ctx.appTfLabel,
|
|
@@ -295,7 +296,8 @@ export function appToTf(entity, ctx) {
|
|
|
295
296
|
fieldAddresses,
|
|
296
297
|
fieldNames,
|
|
297
298
|
fieldMetadata,
|
|
298
|
-
|
|
299
|
+
widgets: widgets.widgets,
|
|
300
|
+
...(payload.deleteDefaultListView !== undefined ? { deleteDefaultListView: payload.deleteDefaultListView } : {}),
|
|
299
301
|
}, payload.customViews);
|
|
300
302
|
blocks.push(...viewBlocks);
|
|
301
303
|
const recordCreateForm = recordCreateFormToTf(payload.recordCreateForm, {
|
|
@@ -316,7 +318,7 @@ export function appToTf(entity, ctx) {
|
|
|
316
318
|
orgRefs: ctx.orgRefs,
|
|
317
319
|
workspaceAspects: ctx.workspaceAspects,
|
|
318
320
|
fieldAddresses,
|
|
319
|
-
|
|
321
|
+
widgets: widgets.widgets,
|
|
320
322
|
stageKeyByTfLabel,
|
|
321
323
|
}));
|
|
322
324
|
blocks.push(...relationshipsToTf(payload.relationships, {
|
|
@@ -97,7 +97,7 @@ export declare const FOR_EACH_PLACEHOLDER = "__forEach__";
|
|
|
97
97
|
* accessor → canonical; identity for most kinds. Validated against
|
|
98
98
|
* TASK_OUTPUT_CONTRACTS by canonical-reference-model.test.ts.
|
|
99
99
|
*/
|
|
100
|
-
export declare function rewriteCanonicalOutputRefName(taskKey: string | undefined, name: string, taskRefKey?: string, schema?: unknown): string;
|
|
100
|
+
export declare function rewriteCanonicalOutputRefName(taskKey: string | undefined, name: string, taskRefKey?: string, schema?: unknown, apiResponseType?: string): string;
|
|
101
101
|
/** One finalized automation-level output property (already serialized to wire). */
|
|
102
102
|
export interface OutputEntry {
|
|
103
103
|
readonly name: string;
|
|
@@ -278,12 +278,7 @@ interface ActionMethods<TTrigger, TActions extends Record<string, unknown>, TVar
|
|
|
278
278
|
aiFileAnalysis<TName extends string>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").AiFileAnalysisOptions>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, {
|
|
279
279
|
output: unknown;
|
|
280
280
|
}>;
|
|
281
|
-
apiRequest<TName extends string>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").ApiRequestOptions
|
|
282
|
-
response: unknown;
|
|
283
|
-
file?: unknown;
|
|
284
|
-
statusCode?: unknown;
|
|
285
|
-
textResponse?: unknown;
|
|
286
|
-
}>;
|
|
281
|
+
apiRequest<TName extends string, R extends import("./tasks.js").ApiResponseType = "JSON">(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").ApiRequestOptions<R>>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, import("./tasks.js").ApiRequestOutputs<R>>;
|
|
287
282
|
calculation<TName extends string, const Values extends import("./tasks.js").CalculationValues>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").CalculationOptions<Values>>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, import("./tasks.js").CalculationValueOutputs<Values>>;
|
|
288
283
|
calculation<TName extends string, const Entries extends readonly import("./tasks.js").CalculationEntry[]>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").LegacyCalculationOptions<Entries>>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, import("./tasks.js").CalculationOutputs<Entries>>;
|
|
289
284
|
procedure<TName extends string, const Parameters extends readonly import("../../catalog/types.js").ProcedureParameterType[]>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").TypedProcedureOptions<Parameters>>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, Record<string, unknown>>;
|
|
@@ -29,9 +29,9 @@ import { valid as validSemver } from "semver";
|
|
|
29
29
|
import { EntityTfError } from "../../engine/entity.js";
|
|
30
30
|
import { isOnDemandRecordType } from "../shared/types/field-types.js";
|
|
31
31
|
import { buildContext, createForEachItemProxy } from "../shared/context.js";
|
|
32
|
-
import { outputFieldTypesFromScriptSchema } from "./output-field-types.js";
|
|
32
|
+
import { outputFieldTypesFromScriptSchema, scriptSchemaIsSingleStringArray } from "./output-field-types.js";
|
|
33
33
|
import { isRef } from "../shared/ref.js";
|
|
34
|
-
import {
|
|
34
|
+
import { apiTaskCanonicalOutputName, apiTaskJsonRefsKeys, apiTaskRefsIndex, OUTPUT_KEY_CANONICAL, OUTPUT_KEY_WIRE_NAME } from "./output-key-wire-name.js";
|
|
35
35
|
import { extractScriptBody, inferOutputSchema, isScriptFile, readScriptFile, toPlatformScriptBody, tryExtractFromCurrentSource } from "./script-code.js";
|
|
36
36
|
import { serializeNode } from "./serialize.js";
|
|
37
37
|
// Runtime factory imports stay below the public action-native surface. Their
|
|
@@ -130,6 +130,30 @@ function collectExecuteScriptOutputSchemas(tasks) {
|
|
|
130
130
|
visit(tasks);
|
|
131
131
|
return out;
|
|
132
132
|
}
|
|
133
|
+
/** Build error for an output a JSON apiRequest doesn't have (edk#2058). */
|
|
134
|
+
function apiTaskMissingOutput(taskRefKey, name, apiResponseType) {
|
|
135
|
+
throw new EntityTfError(`apiRequest task "${taskRefKey ?? "?"}" has no "${name}" output: a ${apiResponseType ?? "JSON"} response ` +
|
|
136
|
+
`exposes only .response, .textResponse and .statusCode (refs ${apiTaskJsonRefsKeys().map((k) => `"${k}"`).join(", ")}). ` +
|
|
137
|
+
"Reference one of those, or set the task's responseType to the kind of response it returns.");
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Map every apiRequest task's refKey to its `responseType`, descending into
|
|
141
|
+
* operator children — mirrors `collectTaskKinds`. Its refs-map keys depend on
|
|
142
|
+
* it (edk#2058).
|
|
143
|
+
*/
|
|
144
|
+
function collectApiResponseTypes(tasks) {
|
|
145
|
+
const out = new Map();
|
|
146
|
+
const visit = (entries) => {
|
|
147
|
+
for (const { name, def } of entries) {
|
|
148
|
+
if (def.key === "api" && typeof def.config.responseType === "string")
|
|
149
|
+
out.set(name, def.config.responseType);
|
|
150
|
+
for (const child of def.operatorChildren ?? [])
|
|
151
|
+
visit(child.tasks);
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
visit(tasks);
|
|
155
|
+
return out;
|
|
156
|
+
}
|
|
133
157
|
/**
|
|
134
158
|
* Resolve an automation-level output's `valueType` from its (already
|
|
135
159
|
* serialized) value. Explicit workflowOutput metadata wins. Otherwise, infer
|
|
@@ -286,8 +310,18 @@ function assertKnownScriptOutput(name, taskRefKey, schema, checkDeclaredResult)
|
|
|
286
310
|
throw new EntityTfError(`executeScript${taskRefKey === undefined ? "" : ` task "${taskRefKey}"`} has no output "${name}"; ` +
|
|
287
311
|
`declared result properties are ${listed === "" ? "(none)" : listed}.`);
|
|
288
312
|
}
|
|
313
|
+
// Only suggest reads that exist: a `.result.<name>` the schema doesn't declare
|
|
314
|
+
// builds in a filter but reads nothing at runtime (#1725).
|
|
315
|
+
const declared = declaredScriptResultProperties(schema);
|
|
316
|
+
const missing = declared !== undefined && !declared.has(name.split(".")[0] ?? "");
|
|
317
|
+
const at = `ctx.actions.${taskRefKey ?? "<script>"}`;
|
|
318
|
+
const uses = missing ? [...declared].map((p) => `${at}.result.${p}`) : [`${at}.result.${name}`];
|
|
319
|
+
if ((missing || !name.includes(".")) && scriptSchemaIsSingleStringArray(schema))
|
|
320
|
+
uses.push(`${at}.stringArrayResult`);
|
|
289
321
|
throw new EntityTfError(`executeScript${taskRefKey === undefined ? "" : ` task "${taskRefKey}"`} has no output "${name}"; ` +
|
|
290
|
-
`script outputs are read under result
|
|
322
|
+
`script outputs are read under result` +
|
|
323
|
+
(missing ? ` and the declared result properties are ${declared.size === 0 ? "(none)" : [...declared].join(", ")}` : "") +
|
|
324
|
+
(uses.length > 0 ? `. Use ${uses.join(" or ")}.` : "."));
|
|
291
325
|
}
|
|
292
326
|
/**
|
|
293
327
|
* Forward output-name rewrites, the inverse of the deserializer's read-side
|
|
@@ -317,12 +351,12 @@ function assertKnownScriptOutput(name, taskRefKey, schema, checkDeclaredResult)
|
|
|
317
351
|
* - single-scalar-output tasks (see `OUTPUT_KEY_WIRE_NAME`): `output` →
|
|
318
352
|
* the platform's actual output name for that task kind.
|
|
319
353
|
*/
|
|
320
|
-
function rewriteForwardTaskRefName(taskKey, name, taskRefKey, schema, checkDeclaredScriptResult = true) {
|
|
354
|
+
function rewriteForwardTaskRefName(taskKey, name, taskRefKey, schema, checkDeclaredScriptResult = true, apiResponseType) {
|
|
321
355
|
if (taskKey === "findRelatedRecords" && FIND_RELATED_RECORDS_COUNT_REF_NAMES.has(name.split(".")[0])) {
|
|
322
356
|
throw findRelatedRecordsTotalCountError(taskRefKey);
|
|
323
357
|
}
|
|
324
358
|
if (taskKey === "api") {
|
|
325
|
-
return
|
|
359
|
+
return apiTaskRefsIndex(apiResponseType, name) ?? apiTaskMissingOutput(taskRefKey, name, apiResponseType);
|
|
326
360
|
}
|
|
327
361
|
if (taskKey === "recordSearch" && name === "totalCount") {
|
|
328
362
|
return "Records Size";
|
|
@@ -376,7 +410,7 @@ function rewriteForwardTaskRefName(taskKey, name, taskRefKey, schema, checkDecla
|
|
|
376
410
|
* accessor → canonical; identity for most kinds. Validated against
|
|
377
411
|
* TASK_OUTPUT_CONTRACTS by canonical-reference-model.test.ts.
|
|
378
412
|
*/
|
|
379
|
-
export function rewriteCanonicalOutputRefName(taskKey, name, taskRefKey, schema) {
|
|
413
|
+
export function rewriteCanonicalOutputRefName(taskKey, name, taskRefKey, schema, apiResponseType) {
|
|
380
414
|
if (taskKey === "findRelatedRecords" && FIND_RELATED_RECORDS_COUNT_REF_NAMES.has(name.split(".")[0])) {
|
|
381
415
|
throw findRelatedRecordsTotalCountError(taskRefKey);
|
|
382
416
|
}
|
|
@@ -389,8 +423,10 @@ export function rewriteCanonicalOutputRefName(taskKey, name, taskRefKey, schema)
|
|
|
389
423
|
// provider's refs-map DISPLAY label ("Content" / "Content Type" / "Name", via
|
|
390
424
|
// API_TASK_REF_WIRE_NAMES). Keep the base display rewrite. Top-level api
|
|
391
425
|
// outputs ARE contract names and ride the envelope as identity.
|
|
392
|
-
return rewriteForwardTaskRefName(taskKey, name, taskRefKey, schema);
|
|
426
|
+
return rewriteForwardTaskRefName(taskKey, name, taskRefKey, schema, true, apiResponseType);
|
|
393
427
|
}
|
|
428
|
+
if (taskKey === "api")
|
|
429
|
+
return apiTaskCanonicalOutputName(apiResponseType, name) ?? apiTaskMissingOutput(taskRefKey, name, apiResponseType);
|
|
394
430
|
if ((taskKey === "recordSearch" || taskKey === "tableRecordsSearch") && name === "totalCount") {
|
|
395
431
|
// Both expose a `totalCount` accessor, but the executors' canonical count
|
|
396
432
|
// output is `count` (aspect_records_search.count / table_records_search.count).
|
|
@@ -467,10 +503,10 @@ function rewriteTaskOutputRefs(node, taskKindByRefKey, scriptSchemas,
|
|
|
467
503
|
// those positions.
|
|
468
504
|
canonical = false,
|
|
469
505
|
// Field assignments rebuild an undeclared result.* as the value envelope.
|
|
470
|
-
checkDeclaredScriptResult = true) {
|
|
506
|
+
checkDeclaredScriptResult = true, apiResponseTypes = new Map()) {
|
|
471
507
|
if (Array.isArray(node)) {
|
|
472
508
|
for (const item of node)
|
|
473
|
-
rewriteTaskOutputRefs(item, taskKindByRefKey, scriptSchemas, canonical, checkDeclaredScriptResult);
|
|
509
|
+
rewriteTaskOutputRefs(item, taskKindByRefKey, scriptSchemas, canonical, checkDeclaredScriptResult, apiResponseTypes);
|
|
474
510
|
return;
|
|
475
511
|
}
|
|
476
512
|
if (node === null || typeof node !== "object")
|
|
@@ -494,14 +530,15 @@ checkDeclaredScriptResult = true) {
|
|
|
494
530
|
if (ref && typeof ref.taskRefKey === "string" && typeof ref.name === "string") {
|
|
495
531
|
const kind = taskKindByRefKey.get(ref.taskRefKey);
|
|
496
532
|
const schema = scriptSchemas.get(ref.taskRefKey);
|
|
533
|
+
const apiResponseType = apiResponseTypes.get(ref.taskRefKey);
|
|
497
534
|
ref.name = canonical
|
|
498
|
-
? rewriteCanonicalOutputRefName(kind, ref.name, ref.taskRefKey, schema)
|
|
499
|
-
: rewriteForwardTaskRefName(kind, ref.name, ref.taskRefKey, schema, checkDeclaredScriptResult);
|
|
535
|
+
? rewriteCanonicalOutputRefName(kind, ref.name, ref.taskRefKey, schema, apiResponseType)
|
|
536
|
+
: rewriteForwardTaskRefName(kind, ref.name, ref.taskRefKey, schema, checkDeclaredScriptResult, apiResponseType);
|
|
500
537
|
}
|
|
501
538
|
if (rec.type === "TASK" && typeof rec.taskRefKey === "string" && typeof rec.name === "string") {
|
|
502
539
|
// Filter `{type:"TASK"}` shapes never appear in a workflow OUTPUT subtree;
|
|
503
540
|
// keep the display rewrite (#1271's filter path) regardless of `canonical`.
|
|
504
|
-
rec.name = rewriteForwardTaskRefName(taskKindByRefKey.get(rec.taskRefKey), rec.name, rec.taskRefKey, scriptSchemas.get(rec.taskRefKey), false);
|
|
541
|
+
rec.name = rewriteForwardTaskRefName(taskKindByRefKey.get(rec.taskRefKey), rec.name, rec.taskRefKey, scriptSchemas.get(rec.taskRefKey), false, apiResponseTypes.get(rec.taskRefKey));
|
|
505
542
|
}
|
|
506
543
|
for (const [key, v] of Object.entries(rec)) {
|
|
507
544
|
// A calc-engine mustache subtree (`calculationReference` → templateReference)
|
|
@@ -509,7 +546,7 @@ checkDeclaredScriptResult = true) {
|
|
|
509
546
|
// (decodeCalculationTaskMustache) stays idempotent.
|
|
510
547
|
const childCanonical = key === "calculationReference" ? false : canonical;
|
|
511
548
|
const childCheck = key === "workflowFields" ? false : checkDeclaredScriptResult;
|
|
512
|
-
rewriteTaskOutputRefs(v, taskKindByRefKey, scriptSchemas, childCanonical, childCheck);
|
|
549
|
+
rewriteTaskOutputRefs(v, taskKindByRefKey, scriptSchemas, childCanonical, childCheck, apiResponseTypes);
|
|
513
550
|
}
|
|
514
551
|
}
|
|
515
552
|
/**
|
|
@@ -657,7 +694,8 @@ function makeActionBuilder(state, mode = "root", item, loops = {}) {
|
|
|
657
694
|
// untranspiled source when running under `elementum build`
|
|
658
695
|
// (tryExtractFromCurrentSource); fall back to the toString()-based
|
|
659
696
|
// extractScriptBody otherwise (e.g. an automation built directly in a
|
|
660
|
-
// test, with no tracked source file
|
|
697
|
+
// test, with no tracked source file, or a hand-typed body whose source
|
|
698
|
+
// is not plain JavaScript, #1927). Either way the body is computed
|
|
661
699
|
// exactly ONCE here and threaded straight into the ActionDef — no
|
|
662
700
|
// separate re-extraction downstream.
|
|
663
701
|
// Explicit `outputs` always wins; an explicit `null` means "no schema"
|
|
@@ -761,15 +799,16 @@ function makeActionBuilder(state, mode = "root", item, loops = {}) {
|
|
|
761
799
|
__finalize() {
|
|
762
800
|
const taskKindByRefKey = collectTaskKinds(state.tasks);
|
|
763
801
|
const scriptSchemas = collectExecuteScriptOutputSchemas(state.tasks);
|
|
802
|
+
const apiResponseTypes = collectApiResponseTypes(state.tasks);
|
|
764
803
|
const tasks = state.tasks.map((t) => serializeTaskEntry(t.name, t.def, t.displayName, t.hclParent));
|
|
765
804
|
// Deep copy: the rewrites below mutate in place, and `state.outputs` is
|
|
766
805
|
// shared by every build of this definition (#1536).
|
|
767
806
|
const outputs = state.outputs?.map((o) => structuredClone(o));
|
|
768
|
-
rewriteTaskOutputRefs(tasks, taskKindByRefKey, scriptSchemas);
|
|
807
|
+
rewriteTaskOutputRefs(tasks, taskKindByRefKey, scriptSchemas, false, true, apiResponseTypes);
|
|
769
808
|
// Workflow OUTPUTS emit the platform's CANONICAL output name (edk#835);
|
|
770
809
|
// task inputs/filters above stay on the display path (#1271 owns them).
|
|
771
810
|
if (outputs)
|
|
772
|
-
rewriteTaskOutputRefs(outputs, taskKindByRefKey, scriptSchemas, /* canonical */ true);
|
|
811
|
+
rewriteTaskOutputRefs(outputs, taskKindByRefKey, scriptSchemas, /* canonical */ true, true, apiResponseTypes);
|
|
773
812
|
// Trigger reference names are NOT canonicalized: the authored name is
|
|
774
813
|
// the name, everywhere in EDK. (Mobius canonicalizes reference names in
|
|
775
814
|
// ITS storage — `ValueReference.ofTriggerReference` — but on the tf
|
|
@@ -97,13 +97,13 @@ export type TriggerAst = {
|
|
|
97
97
|
customResponse?: {
|
|
98
98
|
success?: {
|
|
99
99
|
enabled: boolean;
|
|
100
|
-
format: "JSON" | "XML" | "
|
|
100
|
+
format: "JSON" | "XML" | "TEXT";
|
|
101
101
|
statusCode?: number;
|
|
102
102
|
body: string;
|
|
103
103
|
};
|
|
104
104
|
failure?: {
|
|
105
105
|
enabled: boolean;
|
|
106
|
-
format: "JSON" | "XML" | "
|
|
106
|
+
format: "JSON" | "XML" | "TEXT";
|
|
107
107
|
statusCode?: number;
|
|
108
108
|
body: string;
|
|
109
109
|
};
|
|
@@ -111,14 +111,15 @@ export type TriggerAst = {
|
|
|
111
111
|
} | {
|
|
112
112
|
kind: "temporal";
|
|
113
113
|
app: AppRefAst | UnresolvedRefAst;
|
|
114
|
-
|
|
114
|
+
field: FieldRefAst | UnresolvedRefAst;
|
|
115
115
|
temporalUnit: "MINUTES" | "HOURS" | "DAYS";
|
|
116
116
|
value: number;
|
|
117
|
+
filter?: Filter<RefExpr, RefExpr>;
|
|
117
118
|
} | {
|
|
118
119
|
kind: "approvalProcessStatusUpdated";
|
|
119
120
|
app: AppRefAst | UnresolvedRefAst;
|
|
120
121
|
approvalChain?: string | ApprovalChainRefAst;
|
|
121
|
-
status: "ACTIVE" | "STEP_APPROVED" | "CANCELLED" | "DENIED" | "APPROVED";
|
|
122
|
+
status: "ACTIVE" | "STEP_APPROVED" | "CANCELLED" | "DENIED" | "APPROVED" | "EXCEPTION";
|
|
122
123
|
filter?: Filter<RefExpr, RefExpr>;
|
|
123
124
|
} | {
|
|
124
125
|
kind: "schedule";
|
|
@@ -133,6 +134,7 @@ export type TriggerAst = {
|
|
|
133
134
|
datamine: DatamineRefAst | string;
|
|
134
135
|
fireOnAlert?: boolean;
|
|
135
136
|
fireOnRecovery?: boolean;
|
|
137
|
+
filter?: Filter<RefExpr, RefExpr>;
|
|
136
138
|
} | {
|
|
137
139
|
kind: "emailReceived";
|
|
138
140
|
emailAliasId: string;
|
|
@@ -142,6 +144,7 @@ export type TriggerAst = {
|
|
|
142
144
|
kind: "surveyResponseCreate";
|
|
143
145
|
app: AppRefAst | UnresolvedRefAst;
|
|
144
146
|
survey: string;
|
|
147
|
+
filter?: Filter<RefExpr, RefExpr>;
|
|
145
148
|
};
|
|
146
149
|
export interface AutomationAst {
|
|
147
150
|
readonly ownerHandle: string;
|
|
@@ -869,15 +869,14 @@ function printTrigger(trigger, state) {
|
|
|
869
869
|
}
|
|
870
870
|
case "temporal": {
|
|
871
871
|
const temporal = trackFactory("temporal", state);
|
|
872
|
-
const fieldExpr = trigger.app.kind === "app"
|
|
873
|
-
? printFieldRef(trigger.app.appHandle, trigger.fieldKey, state)
|
|
874
|
-
: `${quote(trigger.fieldKey.replace(/^__unresolved_/, ""))} as any /* TODO: unresolved field */`;
|
|
875
872
|
const parts = [
|
|
876
873
|
`app: ${printRef(trigger.app, state, DEFAULT_CTX)}`,
|
|
877
|
-
`field: ${
|
|
874
|
+
`field: ${printRef(trigger.field, state, DEFAULT_CTX)}`,
|
|
878
875
|
`temporalUnit: ${quote(trigger.temporalUnit)}`,
|
|
879
876
|
`value: ${trigger.value}`,
|
|
880
877
|
];
|
|
878
|
+
if (trigger.filter)
|
|
879
|
+
parts.push(`filter: ${printFilter(trigger.filter, state)}`);
|
|
881
880
|
return `${temporal}({\n ${parts.join(",\n ")}\n })`;
|
|
882
881
|
}
|
|
883
882
|
case "approvalProcessStatusUpdated": {
|
|
@@ -939,6 +938,9 @@ function printTrigger(trigger, state) {
|
|
|
939
938
|
if (trigger.fireOnRecovery !== undefined) {
|
|
940
939
|
parts.push(`fireOnRecovery: ${trigger.fireOnRecovery}`);
|
|
941
940
|
}
|
|
941
|
+
if (trigger.filter) {
|
|
942
|
+
parts.push(`filter: ${printFilter(trigger.filter, state)}`);
|
|
943
|
+
}
|
|
942
944
|
return `${dataMine}({ ${parts.join(", ")} })`;
|
|
943
945
|
}
|
|
944
946
|
case "emailReceived": {
|
|
@@ -955,6 +957,7 @@ function printTrigger(trigger, state) {
|
|
|
955
957
|
const parts = [
|
|
956
958
|
`app: ${printRef(trigger.app, state, DEFAULT_CTX)}`,
|
|
957
959
|
`survey: unsafePlatformId(${quote(trigger.survey)})${unresolvedReferenceComment(trigger.survey, state.unresolvedReferences)}`,
|
|
960
|
+
...(trigger.filter ? [`filter: ${printFilter(trigger.filter, state)}`] : []),
|
|
958
961
|
];
|
|
959
962
|
return `${surveyResponseCreate}({\n ${parts.join(",\n ")}\n })`;
|
|
960
963
|
}
|
|
@@ -975,13 +978,6 @@ function recordTriggerBody(trigger, state) {
|
|
|
975
978
|
parts.push(`thinkUi: ${trigger.thinkUi}`);
|
|
976
979
|
return `{ ${parts.join(", ")} }`;
|
|
977
980
|
}
|
|
978
|
-
function printFieldRef(appHandle, fieldKey, state) {
|
|
979
|
-
if (!fieldKey.startsWith("__unresolved_")) {
|
|
980
|
-
return `catalog.${catalogOwnerHandle(state, appHandle)}.fields${safeMember(fieldKey)}`;
|
|
981
|
-
}
|
|
982
|
-
const uuid = fieldKey.replace(/^__unresolved_/, "");
|
|
983
|
-
return `${quote(uuid)} as any /* TODO: unresolved field */`;
|
|
984
|
-
}
|
|
985
981
|
// ---------------------------------------------------------------------------
|
|
986
982
|
// Tasks
|
|
987
983
|
// ---------------------------------------------------------------------------
|
|
@@ -64,6 +64,7 @@ interface DecodeContext {
|
|
|
64
64
|
readonly tableRefName: string;
|
|
65
65
|
readonly name: string;
|
|
66
66
|
}>;
|
|
67
|
+
readonly foreignFileReaderRefsById?: FromTfContext["foreignFileReaderRefsById"];
|
|
67
68
|
readonly picklistOptionLabelById?: ReadonlyMap<string, string>;
|
|
68
69
|
readonly fieldNamesByOwnerRefName?: ReadonlyMap<string, ReadonlyMap<string, string>>;
|
|
69
70
|
/** Task resource address → target aspect refName (from `object_id`). */
|
|
@@ -81,6 +82,10 @@ interface DecodeContext {
|
|
|
81
82
|
readonly stringifiedValueReferences?: {
|
|
82
83
|
unresolved: boolean;
|
|
83
84
|
};
|
|
85
|
+
/** Says what a task id that matches none of this automation's tasks points to (#2054). */
|
|
86
|
+
readonly describeUnresolvedTask?: (taskId: string) => string;
|
|
87
|
+
/** This automation's platform id, from its import block. */
|
|
88
|
+
readonly automationId?: string;
|
|
84
89
|
}
|
|
85
90
|
/**
|
|
86
91
|
* The same outputs as seen from a CALCULATION formula, which addresses a
|
|
@@ -92,6 +97,8 @@ interface DecodeContext {
|
|
|
92
97
|
export declare const RECORD_SEARCH_CALCULATION_REF_NAME_TO_TS: Readonly<Record<string, readonly string[]>>;
|
|
93
98
|
export declare const AI_SEARCH_TABLE_TASK_REF_SEGMENT_TO_TS: Readonly<Record<string, string>>;
|
|
94
99
|
export declare const TABLE_RECORDS_SEARCH_TASK_REF_SEGMENT_TO_TS: Readonly<Record<string, string>>;
|
|
100
|
+
/** Option ids `filterOptionLabel` will print as labels. The export still holds the id. */
|
|
101
|
+
export declare function filterOptionIdsPrintedAsLabels(doc: TfDocument, optionLabelById: ReadonlyMap<string, string> | undefined): ReadonlySet<string>;
|
|
95
102
|
export declare function inferredPublishOutputType(value: TfValue, ctx: DecodeContext): {
|
|
96
103
|
readonly fieldType: string;
|
|
97
104
|
readonly multiple: boolean;
|
|
@@ -129,6 +136,20 @@ export declare class UnsupportedMultiTriggerError extends EntityTfError {
|
|
|
129
136
|
readonly triggerCount: number;
|
|
130
137
|
constructor(automationName: string, triggerCount: number);
|
|
131
138
|
}
|
|
139
|
+
/**
|
|
140
|
+
* A filter names a task id that is not one of its automation's tasks (#2054).
|
|
141
|
+
* Pull fails on it rather than skip the automation: the message says what the
|
|
142
|
+
* id points to so it can be fixed in the platform's automation builder.
|
|
143
|
+
*/
|
|
144
|
+
export declare class UnresolvedTaskFilterRefError extends EntityTfError {
|
|
145
|
+
readonly taskId: string;
|
|
146
|
+
readonly target: string;
|
|
147
|
+
readonly automationId: string | undefined;
|
|
148
|
+
readonly where: string | undefined;
|
|
149
|
+
constructor(taskId: string, target: string, automationId: string | undefined, where?: string);
|
|
150
|
+
/** Run `decode`, naming `where` (the task, branch or trigger whose filter it is) on this error. */
|
|
151
|
+
static within<T>(where: string, decode: () => T): T;
|
|
152
|
+
}
|
|
132
153
|
/**
|
|
133
154
|
* A bare service_account_id belongs to an app this export does not contain.
|
|
134
155
|
* Pull cannot print a serviceAccountRef until that app is in the workspace,
|
|
@@ -176,6 +197,7 @@ export interface AutomationFromTfContext {
|
|
|
176
197
|
readonly procedureKeysByDiscriminator?: ReadonlyMap<string, string>;
|
|
177
198
|
readonly groupKeysByName?: ReadonlyMap<string, string>;
|
|
178
199
|
readonly serviceAccountsById?: FromTfContext["serviceAccountsById"];
|
|
200
|
+
readonly foreignFileReaderRefsById?: FromTfContext["foreignFileReaderRefsById"];
|
|
179
201
|
}
|
|
180
202
|
export interface AutomationGraphFromTfResult {
|
|
181
203
|
readonly automation?: AutomationAst;
|
|
@@ -199,5 +221,5 @@ export declare function automationFromTf(doc: TfDocument, automationLabel: strin
|
|
|
199
221
|
}>, foreignTableRefsById?: ReadonlyMap<string, {
|
|
200
222
|
readonly tableRefName: string;
|
|
201
223
|
readonly name: string;
|
|
202
|
-
}>, picklistOptionLabelById?: ReadonlyMap<string, string>, fieldNamesByOwnerRefName?: ReadonlyMap<string, ReadonlyMap<string, string>>, foreignAppRefNames?: ReadonlyMap<string, string>, foreignElementRefNames?: ReadonlyMap<string, string>, procedureKeysByDiscriminator?: ReadonlyMap<string, string>, foreignTaskRefNames?: ReadonlyMap<string, string>, groupKeysByName?: ReadonlyMap<string, string>, serviceAccountsById?: FromTfContext["serviceAccountsById"]): AutomationFromTfResult;
|
|
224
|
+
}>, picklistOptionLabelById?: ReadonlyMap<string, string>, fieldNamesByOwnerRefName?: ReadonlyMap<string, ReadonlyMap<string, string>>, foreignAppRefNames?: ReadonlyMap<string, string>, foreignElementRefNames?: ReadonlyMap<string, string>, procedureKeysByDiscriminator?: ReadonlyMap<string, string>, foreignTaskRefNames?: ReadonlyMap<string, string>, groupKeysByName?: ReadonlyMap<string, string>, serviceAccountsById?: FromTfContext["serviceAccountsById"], foreignFileReaderRefsById?: FromTfContext["foreignFileReaderRefsById"]): AutomationFromTfResult;
|
|
203
225
|
export {};
|