@elementumai/edk 0.9.18 → 0.9.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -3
- package/dist-sdk/src/catalog/factories.d.ts +11 -0
- package/dist-sdk/src/catalog/factories.js +6 -0
- package/dist-sdk/src/catalog/index.d.ts +2 -2
- package/dist-sdk/src/catalog/index.js +2 -2
- package/dist-sdk/src/catalog/org.d.ts +39 -1
- package/dist-sdk/src/catalog/org.js +460 -50
- package/dist-sdk/src/catalog/types.d.ts +10 -0
- package/dist-sdk/src/catalog/types.js +2 -0
- package/dist-sdk/src/engine/pull/ref-only.js +54 -20
- package/dist-sdk/src/engine/pull/result-output.d.ts +2 -0
- package/dist-sdk/src/engine/pull/result-output.js +1 -1
- package/dist-sdk/src/engine/tf/expr.js +38 -13
- package/dist-sdk/src/engine/tf/index.d.ts +2 -2
- package/dist-sdk/src/engine/tf/index.js +2 -2
- package/dist-sdk/src/engine/tf/labels.d.ts +2 -0
- package/dist-sdk/src/engine/tf/labels.js +4 -0
- package/dist-sdk/src/engine/tf/parse.d.ts +19 -0
- package/dist-sdk/src/engine/tf/parse.js +105 -6
- package/dist-sdk/src/engine/workspace/loader.js +49 -12
- package/dist-sdk/src/entities/access-policy/from-tf.d.ts +11 -1
- package/dist-sdk/src/entities/access-policy/from-tf.js +6 -1
- package/dist-sdk/src/entities/access-policy/to-tf.d.ts +11 -0
- package/dist-sdk/src/entities/access-policy/to-tf.js +11 -4
- package/dist-sdk/src/entities/agent-tool/to-tf.js +2 -1
- package/dist-sdk/src/entities/app/build.d.ts +10 -0
- package/dist-sdk/src/entities/app/build.js +0 -13
- package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +6 -1
- package/dist-sdk/src/entities/app/from-tf.js +4 -3
- package/dist-sdk/src/entities/app/index.d.ts +1 -0
- package/dist-sdk/src/entities/app/index.js +1 -0
- package/dist-sdk/src/entities/app/module.js +13 -0
- package/dist-sdk/src/entities/app/to-tf.js +2 -0
- package/dist-sdk/src/entities/automation/build.d.ts +2 -1
- package/dist-sdk/src/entities/automation/build.js +27 -0
- package/dist-sdk/src/entities/automation/deserializer/print-automation.js +6 -0
- package/dist-sdk/src/entities/automation/from-tf.js +135 -26
- package/dist-sdk/src/entities/automation/index.d.ts +1 -1
- package/dist-sdk/src/entities/automation/module.d.ts +2 -0
- package/dist-sdk/src/entities/automation/module.js +56 -0
- package/dist-sdk/src/entities/automation/system-ref-name.d.ts +16 -0
- package/dist-sdk/src/entities/automation/system-ref-name.js +44 -0
- package/dist-sdk/src/entities/automation/task-output-labels.d.ts +15 -0
- package/dist-sdk/src/entities/automation/task-output-labels.js +38 -0
- package/dist-sdk/src/entities/automation/tasks.d.ts +29 -2
- package/dist-sdk/src/entities/automation/to-tf.js +158 -84
- package/dist-sdk/src/entities/automation/types.js +1 -0
- package/dist-sdk/src/entities/chart/from-tf.js +33 -17
- package/dist-sdk/src/entities/chart/module.js +3 -1
- package/dist-sdk/src/entities/chart/printer.d.ts +1 -0
- package/dist-sdk/src/entities/chart/printer.js +26 -16
- package/dist-sdk/src/entities/chart/rebind-owner.d.ts +3 -0
- package/dist-sdk/src/entities/chart/rebind-owner.js +42 -0
- package/dist-sdk/src/entities/chart/to-tf.js +12 -10
- package/dist-sdk/src/entities/dashboard/build.d.ts +4 -0
- package/dist-sdk/src/entities/dashboard/from-tf.js +15 -4
- package/dist-sdk/src/entities/dashboard/to-tf.d.ts +2 -0
- package/dist-sdk/src/entities/dashboard/to-tf.js +13 -0
- package/dist-sdk/src/entities/dashboard-widget/module.js +4 -0
- package/dist-sdk/src/entities/dynamic-layout/build.d.ts +51 -2
- package/dist-sdk/src/entities/dynamic-layout/dialect.d.ts +3 -0
- package/dist-sdk/src/entities/dynamic-layout/dialect.js +5 -0
- package/dist-sdk/src/entities/dynamic-layout/from-tf.d.ts +9 -6
- package/dist-sdk/src/entities/dynamic-layout/from-tf.js +188 -26
- package/dist-sdk/src/entities/dynamic-layout/module.js +4 -1
- package/dist-sdk/src/entities/dynamic-layout/to-tf.d.ts +5 -1
- package/dist-sdk/src/entities/dynamic-layout/to-tf.js +254 -23
- package/dist-sdk/src/entities/element/build.d.ts +8 -0
- package/dist-sdk/src/entities/element/build.js +1 -0
- package/dist-sdk/src/entities/element/from-tf.d.ts +1 -0
- package/dist-sdk/src/entities/element/from-tf.js +6 -2
- package/dist-sdk/src/entities/element/index.d.ts +1 -0
- package/dist-sdk/src/entities/element/index.js +1 -0
- package/dist-sdk/src/entities/element/module.js +2 -0
- package/dist-sdk/src/entities/element/to-tf.js +12 -0
- package/dist-sdk/src/entities/field/from-tf.d.ts +2 -0
- package/dist-sdk/src/entities/field/from-tf.js +11 -0
- package/dist-sdk/src/entities/field/to-tf.js +13 -9
- package/dist-sdk/src/entities/relationship/from-tf.d.ts +8 -1
- package/dist-sdk/src/entities/relationship/from-tf.js +53 -10
- package/dist-sdk/src/entities/relationship/to-tf.d.ts +8 -0
- package/dist-sdk/src/entities/relationship/to-tf.js +19 -10
- package/dist-sdk/src/entities/shared/filters/ast.d.ts +7 -2
- package/dist-sdk/src/entities/shared/filters/index.d.ts +23 -2
- package/dist-sdk/src/entities/shared/filters/index.js +24 -1
- package/dist-sdk/src/entities/shared/filters/print.js +14 -2
- package/dist-sdk/src/entities/shared/filters/tf-codec.d.ts +23 -3
- package/dist-sdk/src/entities/shared/filters/tf-codec.js +46 -14
- package/dist-sdk/src/entities/shared/filters/types.d.ts +13 -4
- package/dist-sdk/src/entities/shared/foreign-ref.d.ts +16 -0
- package/dist-sdk/src/entities/shared/foreign-ref.js +17 -1
- package/dist-sdk/src/entities/shared/tool-field-ref.js +6 -9
- package/dist-sdk/src/entities/skill/access-policy.d.ts +17 -0
- package/dist-sdk/src/entities/skill/access-policy.js +101 -0
- package/dist-sdk/src/entities/skill/build.d.ts +3 -0
- package/dist-sdk/src/entities/skill/build.js +3 -0
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.d.ts +4 -1
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +21 -0
- package/dist-sdk/src/entities/skill/from-tf.d.ts +2 -0
- package/dist-sdk/src/entities/skill/from-tf.js +4 -9
- package/dist-sdk/src/entities/skill/index.d.ts +2 -0
- package/dist-sdk/src/entities/skill/index.js +1 -0
- package/dist-sdk/src/entities/skill/module.js +1 -0
- package/dist-sdk/src/entities/skill/to-tf.d.ts +2 -2
- package/dist-sdk/src/entities/skill/to-tf.js +5 -2
- package/dist-sdk/src/entities/skill-tool/to-tf.js +2 -1
- package/dist-sdk/src/entities/table/to-tf.js +3 -3
- package/dist-sdk/src/entities/view/agent-view-layout-from-tf.d.ts +49 -0
- package/dist-sdk/src/entities/view/agent-view-layout-from-tf.js +224 -0
- package/dist-sdk/src/entities/view/agent-view-layout-to-tf.d.ts +36 -0
- package/dist-sdk/src/entities/view/agent-view-layout-to-tf.js +288 -0
- package/dist-sdk/src/entities/view/agent-view-layout.d.ts +121 -0
- package/dist-sdk/src/entities/view/agent-view-layout.js +21 -0
- package/dist-sdk/src/entities/view/from-tf.d.ts +3 -1
- package/dist-sdk/src/entities/view/from-tf.js +42 -7
- package/dist-sdk/src/entities/view/to-tf.d.ts +10 -1
- package/dist-sdk/src/entities/view/to-tf.js +30 -1
- package/dist-sdk/src/entities/view/types.js +2 -0
- package/dist-sdk/src/entities/widget/to-tf.js +2 -2
- package/dist-sdk/src/generated/ragnarok/ragnarok-spec.d.ts +25 -8
- package/dist-sdk/src/generated/ragnarok/ragnarok-spec.js +2 -2
- package/dist-sdk/src/graph/index.d.ts +43 -0
- package/dist-sdk/src/graph/index.js +9 -0
- package/dist-sdk/src/graph/types.d.ts +78 -0
- package/package.json +2 -1
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
* Includes typed scalar, Dropdown/Multi-Select, relation, calculation, and
|
|
12
12
|
* record-experience configuration with build/pull round-trip support.
|
|
13
13
|
*/
|
|
14
|
+
import type { AppAgentViewLayout } from "../view/agent-view-layout.js";
|
|
14
15
|
import { type AgentRef, type AppOrElementOrTaskRef, type AppOrElementRef, type AutomationCatalogRef, type CatalogRef, type ChartRef, type CloudLinkRef, type DashboardRef, type FieldRef, type WidgetRef } from "../../catalog/index.js";
|
|
15
16
|
import type { WorkflowFieldType } from "../shared/types/field-types.js";
|
|
16
17
|
import { type SystemFieldKey } from "../../core/system-fields.js";
|
|
@@ -263,6 +264,8 @@ export interface AppLayoutSection {
|
|
|
263
264
|
readonly color?: string;
|
|
264
265
|
/** `"group"` only — maximum columns used to arrange the group's fields. */
|
|
265
266
|
readonly maxColumns?: number;
|
|
267
|
+
/** `"group"` only — an agent from this app whose chat is embedded in the section, with the record as context. */
|
|
268
|
+
readonly agent?: AgentRef;
|
|
266
269
|
/** `"group"` only — the fields shown in this group, in order. */
|
|
267
270
|
readonly fields?: readonly AppViewFieldRef[];
|
|
268
271
|
/** `"group"` only — app-owned action/record widgets shown after the fields. */
|
|
@@ -304,6 +307,13 @@ export interface AppAgentView extends ManagedViewSharing {
|
|
|
304
307
|
/** Ordered, typed field sorts using the platform's managed-view Sort contract. */
|
|
305
308
|
readonly sort?: ManagedViewSort;
|
|
306
309
|
readonly displayOrder?: number;
|
|
310
|
+
/**
|
|
311
|
+
* The Welcome landing screen (image, header, sub-header, branding, custom
|
|
312
|
+
* view). The code owns it: omitting it gives the standard chat, and an
|
|
313
|
+
* apply then removes any live customization. Run `elementum pull app` to
|
|
314
|
+
* bring a UI-made customization into code before applying.
|
|
315
|
+
*/
|
|
316
|
+
readonly layout?: AppAgentViewLayout;
|
|
307
317
|
}
|
|
308
318
|
/** A calendar view positioned by a date/datetime field (`elementum_calendar_view`). */
|
|
309
319
|
export interface AppCalendarView extends ManagedViewSharing {
|
|
@@ -1,16 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* v2 app/element authoring — `app`. Parallel to v1 `src/aspects`,
|
|
3
|
-
* standalone from it.
|
|
4
|
-
*
|
|
5
|
-
* Produces a `DeployableEntity` of kind `app`/`element` with `parent: "org"` (apps are
|
|
6
|
-
* org-owned), whose payload is the platform's `AgentAspectInput` compose body.
|
|
7
|
-
* The cloud link is a `CatalogRef` token resolved at deploy; fields are authored
|
|
8
|
-
* inline (a new app's fields get server-assigned ids on compose). Deployed via
|
|
9
|
-
* the wire client's compose path (`composeAspect`).
|
|
10
|
-
*
|
|
11
|
-
* Includes typed scalar, Dropdown/Multi-Select, relation, calculation, and
|
|
12
|
-
* record-experience configuration with build/pull round-trip support.
|
|
13
|
-
*/
|
|
14
1
|
import { slimTokens } from "../../catalog/index.js";
|
|
15
2
|
import { DEPLOY_DEFAULT_SYSTEM_FIELD_NAMES, SYSTEM_FIELD_KEYS, SYSTEM_FIELD_REQUIRED, SYSTEM_FIELD_TAG_BY_KEY, WRITABLE_SYSTEM_TAG_NAMES, } from "../../core/system-fields.js";
|
|
16
3
|
import { serializeDisplayBlocks } from "./display-blocks.js";
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
* pristine-refactor pipeline these shapes are produced from `ei export`
|
|
10
10
|
* HCL streams instead (see `appFromTf`).
|
|
11
11
|
*/
|
|
12
|
+
import type { NormalizedAgentViewLayout } from "../../view/agent-view-layout-from-tf.js";
|
|
12
13
|
import type { AppCategory, AppField, AppStage, AspectType } from "../../../core/types/app.js";
|
|
13
14
|
import type { DisplayBlock } from "../../../core/types/display-block.js";
|
|
14
15
|
import type { NormalizedAccessPolicy } from "../../access-policy/from-tf.js";
|
|
@@ -121,6 +122,8 @@ export interface NormalizedLayoutSection {
|
|
|
121
122
|
readonly maxColumns?: number;
|
|
122
123
|
readonly fields?: readonly string[];
|
|
123
124
|
readonly widgets?: readonly string[];
|
|
125
|
+
/** `group` only — the app-owned agent embedded in the section, by bag key. */
|
|
126
|
+
readonly agentKey?: string;
|
|
124
127
|
}
|
|
125
128
|
/** A stage's record-detail layout, keyed by stage key on `NormalizedApp.layouts`. */
|
|
126
129
|
export interface NormalizedLayout {
|
|
@@ -148,6 +151,7 @@ export interface NormalizedAgentView extends ManagedViewSharing {
|
|
|
148
151
|
readonly filter?: Filter<RefExpr, RefExpr>;
|
|
149
152
|
readonly sort?: NormalizedManagedViewSort;
|
|
150
153
|
readonly displayOrder?: number;
|
|
154
|
+
readonly layout?: NormalizedAgentViewLayout;
|
|
151
155
|
}
|
|
152
156
|
/** A calendar view (`elementum_calendar_view`). */
|
|
153
157
|
export interface NormalizedCalendarView extends ManagedViewSharing {
|
|
@@ -181,6 +185,7 @@ export type NormalizedDashboardWidget = {
|
|
|
181
185
|
readonly kind: "app" | "element";
|
|
182
186
|
};
|
|
183
187
|
readonly filter?: Filter<RefExpr, RefExpr>;
|
|
188
|
+
readonly sort?: NormalizedManagedViewSort;
|
|
184
189
|
} | {
|
|
185
190
|
readonly key: string;
|
|
186
191
|
readonly name: string;
|
|
@@ -267,7 +272,7 @@ export interface NormalizedRecordCreateForm {
|
|
|
267
272
|
readonly sections: readonly NormalizedRecordCreateFormSection[];
|
|
268
273
|
}
|
|
269
274
|
export interface PulledDynamicLayoutRef {
|
|
270
|
-
readonly __pulledRef: "field" | "automation" | "agent" | "app" | "element" | "task";
|
|
275
|
+
readonly __pulledRef: "field" | "automation" | "agent" | "app" | "element" | "task" | "widget";
|
|
271
276
|
readonly key: string;
|
|
272
277
|
readonly parent?: string;
|
|
273
278
|
readonly name?: string;
|
|
@@ -140,7 +140,7 @@ export function appFromTf(appBlock, fieldBlocks, ctx, viewBlocks = { layoutBlock
|
|
|
140
140
|
}
|
|
141
141
|
// --- System-field attributes/config → tagged NormalizedField entries.
|
|
142
142
|
const fields = [];
|
|
143
|
-
const owner = { type: APP_RESOURCE_TYPE, label, scope: "app" };
|
|
143
|
+
const owner = { type: APP_RESOURCE_TYPE, label, scope: "app", refName };
|
|
144
144
|
const customFields = fieldBlocks.flatMap((block) => {
|
|
145
145
|
const entry = fieldFromTf(block, owner, ctx);
|
|
146
146
|
return entry === undefined ? [] : [entry];
|
|
@@ -218,9 +218,10 @@ export function appFromTf(appBlock, fieldBlocks, ctx, viewBlocks = { layoutBlock
|
|
|
218
218
|
ctx.diagnostics.push(`app "${label}": found ${viewBlocks.recordCreateFormBlocks.length} record create forms; only the first is used`);
|
|
219
219
|
}
|
|
220
220
|
const recordCreateForm = recordCreateFormFromTf(viewBlocks.recordCreateFormBlocks[0], { type: APP_RESOURCE_TYPE, label, ownerTfLabel: refName, scope: "app" }, ctx);
|
|
221
|
-
const
|
|
221
|
+
const dynamicLayoutOwner = { type: APP_RESOURCE_TYPE, label, ownerRefName: refName, ownerTfLabel: label };
|
|
222
|
+
const dynamicLayouts = dynamicLayoutsFromTf(viewBlocks.dynamicLayoutBlocks, dynamicLayoutOwner, ctx);
|
|
222
223
|
const relationships = relationshipsFromTf(viewBlocks.relationshipBlocks, { kind: "app", label, ownerRefName: refName, ownerTfLabel: refName, scope: "app" }, ctx);
|
|
223
|
-
const widgets = widgetsFromTf(viewBlocks.widgetBlocks, { type: APP_RESOURCE_TYPE, label, ownerRefName: refName, ownerTfLabel: label, scope: "app" }, ctx, dynamicLayoutCompanionWidgetLabels(viewBlocks.dynamicLayoutBlocks));
|
|
224
|
+
const widgets = widgetsFromTf(viewBlocks.widgetBlocks, { type: APP_RESOURCE_TYPE, label, ownerRefName: refName, ownerTfLabel: label, scope: "app" }, ctx, dynamicLayoutCompanionWidgetLabels(viewBlocks.dynamicLayoutBlocks, dynamicLayoutOwner));
|
|
224
225
|
// --- Access policies (entities/access-policy), owner passed in.
|
|
225
226
|
const accessPolicyOwner = {
|
|
226
227
|
type: APP_RESOURCE_TYPE,
|
|
@@ -21,6 +21,7 @@ export { preservePulledCalculation } from "./deserializer/pulled-expression.js";
|
|
|
21
21
|
export { groupId, userId, type AccessPolicyGroupRef, type AccessPolicyOptions, type AccessPolicyPrincipalRef, type AccessPolicyUserRef, type GroupId, type UserId } from "../access-policy/build.js";
|
|
22
22
|
export { type ManagedViewSharing } from "../view/sharing.js";
|
|
23
23
|
export { type ElementumBlocksElement, type ElementumBlocksSpec } from "../view/ragnarok.js";
|
|
24
|
+
export { agentViewFontFamily, type AgentViewBlock, type AgentViewBranding, type AgentViewCustomView, type AgentViewFontFamily, type AgentViewHexColor, type AgentViewImage, type AgentViewSpecApp, type AgentViewSpecField, type AgentViewSpecFilterRef, type AppAgentViewLayout, } from "../view/agent-view-layout.js";
|
|
24
25
|
export { roleAutoShare, rolePermissionGroup, rolePermissionLevel, userRef, type AppRole, type RoleAutoShare, type RoleGroupRef, type RolePermission, type RolePermissionGroup, type RolePermissionLevel, type RoleUserRef } from "../role/build.js";
|
|
25
26
|
export { serviceAccountRoleRef, serviceAccountStatus, type AppServiceAccount, type ServiceAccountAccessPolicy, type ServiceAccountRoleRef, type ServiceAccountStatus } from "../service-account/build.js";
|
|
26
27
|
export { serviceAccountRef, type ServiceAccountRef } from "../service-account/ref.js";
|
|
@@ -16,6 +16,7 @@ export { agentEvaluation, } from "../agent-evaluation/index.js";
|
|
|
16
16
|
export { phoneService, callerAccessMode, } from "../phone-service/index.js";
|
|
17
17
|
export { preservePulledCalculation } from "./deserializer/pulled-expression.js";
|
|
18
18
|
export { groupId, userId } from "../access-policy/build.js";
|
|
19
|
+
export { agentViewFontFamily, } from "../view/agent-view-layout.js";
|
|
19
20
|
export { roleAutoShare, rolePermissionGroup, rolePermissionLevel, userRef } from "../role/build.js";
|
|
20
21
|
export { serviceAccountRoleRef, serviceAccountStatus } from "../service-account/build.js";
|
|
21
22
|
export { serviceAccountRef } from "../service-account/ref.js";
|
|
@@ -95,6 +95,19 @@ export const appModule = {
|
|
|
95
95
|
{ attribute: "status_field_name", value: "Status" },
|
|
96
96
|
{ attribute: "title_field_name", value: "Title" },
|
|
97
97
|
],
|
|
98
|
+
keyedLocalAliases: [{
|
|
99
|
+
listAttribute: "stages",
|
|
100
|
+
keyAttribute: "key",
|
|
101
|
+
nameAttribute: "name",
|
|
102
|
+
byNameSuffix: "_stage_options_by_label",
|
|
103
|
+
byKeySuffix: "_stage_ids_by_key",
|
|
104
|
+
}],
|
|
105
|
+
computedMapAttributes: [{
|
|
106
|
+
attribute: "status_option_ids_by_label",
|
|
107
|
+
listAttribute: "status_options",
|
|
108
|
+
keyAttribute: "label",
|
|
109
|
+
valueAttribute: "id",
|
|
110
|
+
}],
|
|
98
111
|
},
|
|
99
112
|
catalog: NO_CATALOG,
|
|
100
113
|
};
|
|
@@ -268,6 +268,7 @@ export function appToTf(entity, ctx) {
|
|
|
268
268
|
stageTfLabels,
|
|
269
269
|
dashboardKeys: new Set(Object.keys(payload.dashboards ?? {})),
|
|
270
270
|
orgRefs: ctx.orgRefs,
|
|
271
|
+
workspaceAspects: ctx.workspaceAspects,
|
|
271
272
|
diagnostics: ctx.diagnostics,
|
|
272
273
|
fieldAddresses,
|
|
273
274
|
widgetKeys: new Set(Object.keys(payload.widgets ?? {})),
|
|
@@ -291,6 +292,7 @@ export function appToTf(entity, ctx) {
|
|
|
291
292
|
orgRefs: ctx.orgRefs,
|
|
292
293
|
workspaceAspects: ctx.workspaceAspects,
|
|
293
294
|
fieldAddresses,
|
|
295
|
+
widgetKeys: new Set(Object.keys(payload.widgets ?? {})),
|
|
294
296
|
}));
|
|
295
297
|
blocks.push(...relationshipsToTf(payload.relationships, {
|
|
296
298
|
ownerRefName: ctx.appRefName,
|
|
@@ -250,7 +250,8 @@ interface ActionMethods<TTrigger, TActions extends Record<string, unknown>, TVar
|
|
|
250
250
|
approvalStatusUpdate<TName extends string>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").ApprovalStatusUpdateOptions>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, EmptyObject>;
|
|
251
251
|
addWatcher<TName extends string>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").AddWatcherOptions>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, EmptyObject>;
|
|
252
252
|
saveAttachment<TName extends string>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").SaveAttachmentOptions>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, EmptyObject>;
|
|
253
|
-
userSearch<TName extends string>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").UserSearchOptions>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, import("./tasks.js").
|
|
253
|
+
userSearch<TName extends string>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").UserSearchOptions>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, import("./tasks.js").UserSearchOutput>;
|
|
254
|
+
userGroupSearch<TName extends string>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").UserGroupSearchOptions>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, import("./tasks.js").UserGroupSearchOutput>;
|
|
254
255
|
initiateCall<TName extends string>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").InitiateCallOptions>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, EmptyObject>;
|
|
255
256
|
recordFieldLocking<TName extends string>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").RecordFieldLockingOptions>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, EmptyObject>;
|
|
256
257
|
unimplementedTask<TName extends string>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").UnimplementedTaskOptions>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, EmptyObject>;
|
|
@@ -39,6 +39,7 @@ import { serializeNode } from "./serialize.js";
|
|
|
39
39
|
// automations call the direct fluent methods declared on ActionBuilder.
|
|
40
40
|
import * as operatorFactories from "./operators.js";
|
|
41
41
|
import * as actionFactories from "./tasks.js";
|
|
42
|
+
import { USER_SEARCH_REF_WIRE_NAMES, WHOLE_RECORD_REF_WIRE_NAMES } from "./task-output-labels.js";
|
|
42
43
|
import { isWorkflowOutputDeclaration, workflowOutputFieldType, } from "./workflow-output.js";
|
|
43
44
|
/** Placeholder `forEachTaskRefKey` the forEach item proxy emits; replaced with the real refKey. */
|
|
44
45
|
export const FOR_EACH_PLACEHOLDER = "__forEach__";
|
|
@@ -201,6 +202,14 @@ function collectRecordKinds(tasks) {
|
|
|
201
202
|
*/
|
|
202
203
|
const RECORD_BEARING_TASK_KEYS = new Set(["recordSearch", "createRecord", "findRelatedRecords"]);
|
|
203
204
|
const FIND_RELATED_RECORDS_COUNT_REF_NAMES = new Set(["totalCount", "Records Size", "count"]);
|
|
205
|
+
/** userGroupSearch authoring output → provider refs-map key (captured live with `ei refs --from-remote`). */
|
|
206
|
+
const USER_GROUP_SEARCH_REF_WIRE_NAMES = {
|
|
207
|
+
count: "Groups Size",
|
|
208
|
+
group: "First found group",
|
|
209
|
+
"group.id": "ID",
|
|
210
|
+
"group.name": "Name",
|
|
211
|
+
groups: "All found groups",
|
|
212
|
+
};
|
|
204
213
|
function findRelatedRecordsTotalCountError(taskRefKey) {
|
|
205
214
|
const task = taskRefKey === undefined ? "findRelatedRecords" : `findRelatedRecords task "${taskRefKey}"`;
|
|
206
215
|
return new EntityTfError(`${task} does not expose totalCount. That output is recordSearch-only ` +
|
|
@@ -246,6 +255,15 @@ function rewriteForwardTaskRefName(taskKey, name, taskRefKey) {
|
|
|
246
255
|
if (taskKey === "recordSearch" && name === "totalCount") {
|
|
247
256
|
return "Records Size";
|
|
248
257
|
}
|
|
258
|
+
if (taskKey === "userGroupSearch") {
|
|
259
|
+
return USER_GROUP_SEARCH_REF_WIRE_NAMES[name] ?? name;
|
|
260
|
+
}
|
|
261
|
+
if (taskKey === "userSearch") {
|
|
262
|
+
return USER_SEARCH_REF_WIRE_NAMES[name] ?? name;
|
|
263
|
+
}
|
|
264
|
+
if (taskKey === "executeScript" && name === "textResult") {
|
|
265
|
+
return "Text Result";
|
|
266
|
+
}
|
|
249
267
|
if (taskKey === "aiSearchTable" && name === "records") {
|
|
250
268
|
return "All Records";
|
|
251
269
|
}
|
|
@@ -290,6 +308,14 @@ function rewriteTaskOutputRefs(node, taskKindByRefKey) {
|
|
|
290
308
|
if (node === null || typeof node !== "object")
|
|
291
309
|
return;
|
|
292
310
|
const rec = node;
|
|
311
|
+
if (Array.isArray(rec.field_mappings)) {
|
|
312
|
+
const mapped = rec.value?.taskReference;
|
|
313
|
+
const wholeRecord = typeof mapped?.taskRefKey === "string" && mapped.name === "record"
|
|
314
|
+
? WHOLE_RECORD_REF_WIRE_NAMES[taskKindByRefKey.get(mapped.taskRefKey) ?? ""]
|
|
315
|
+
: undefined;
|
|
316
|
+
if (wholeRecord !== undefined)
|
|
317
|
+
mapped.name = wholeRecord;
|
|
318
|
+
}
|
|
293
319
|
const ref = rec.taskReference;
|
|
294
320
|
if (ref && typeof ref.taskRefKey === "string" && typeof ref.name === "string") {
|
|
295
321
|
ref.name = rewriteForwardTaskRefName(taskKindByRefKey.get(ref.taskRefKey), ref.name, ref.taskRefKey);
|
|
@@ -427,6 +453,7 @@ function makeActionBuilder(state, mode = "root", item) {
|
|
|
427
453
|
addWatcher: actionFactories.addWatcher,
|
|
428
454
|
saveAttachment: actionFactories.saveAttachment,
|
|
429
455
|
userSearch: actionFactories.userSearch,
|
|
456
|
+
userGroupSearch: actionFactories.userGroupSearch,
|
|
430
457
|
initiateCall: actionFactories.initiateCall,
|
|
431
458
|
recordFieldLocking: actionFactories.recordFieldLocking,
|
|
432
459
|
unimplementedTask: actionFactories.unimplementedTask,
|
|
@@ -70,6 +70,7 @@ const TASK_FACTORY_V2 = {
|
|
|
70
70
|
sendEmail: "sendEmail",
|
|
71
71
|
saveAttachment: "saveAttachment",
|
|
72
72
|
userSearch: "userSearch",
|
|
73
|
+
userGroupSearch: "userGroupSearch",
|
|
73
74
|
groupSearch: "userGroupSearch",
|
|
74
75
|
initiateCall: "initiateCall",
|
|
75
76
|
approvalChain: "approvalChain",
|
|
@@ -1318,6 +1319,8 @@ function printRef(ref, state, refCtx) {
|
|
|
1318
1319
|
}
|
|
1319
1320
|
case "userField":
|
|
1320
1321
|
return `catalog.users.fields${safeMember(ref.fieldKey)}`;
|
|
1322
|
+
case "userGroupField":
|
|
1323
|
+
return `catalog.userGroups.fields${safeMember(ref.fieldKey)}`;
|
|
1321
1324
|
case "app": {
|
|
1322
1325
|
if (ref.entityType === undefined || ref.name === undefined) {
|
|
1323
1326
|
return `catalog.${catalogOwnerHandle(state, ref.appHandle)}`;
|
|
@@ -1446,6 +1449,9 @@ function printFilterField(left, state, refCtx = DEFAULT_CTX) {
|
|
|
1446
1449
|
if (left.kind === "userField") {
|
|
1447
1450
|
return `catalog.users.fields${safeMember(left.fieldKey)}`;
|
|
1448
1451
|
}
|
|
1452
|
+
if (left.kind === "userGroupField") {
|
|
1453
|
+
return `catalog.userGroups.fields${safeMember(left.fieldKey)}`;
|
|
1454
|
+
}
|
|
1449
1455
|
if (left.kind === "unresolved") {
|
|
1450
1456
|
// A field placeholder (hint === "field") legitimately round-trips
|
|
1451
1457
|
// through the field_id wire slot on rebuild (filter.ts's leftDescriptor).
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { USER_FIELD_KEYS } from "../../catalog/types.js";
|
|
2
|
-
import { DEPLOY_DEFAULT_SYSTEM_FIELD_NAMES, SYSTEM_FIELD_KEYS } from "../../core/system-fields.js";
|
|
1
|
+
import { USER_FIELD_KEYS, USER_GROUP_FIELD_KEYS } from "../../catalog/types.js";
|
|
2
|
+
import { DEPLOY_DEFAULT_SYSTEM_FIELD_NAMES, SYSTEM_FIELD_KEY_SET, SYSTEM_FIELD_KEYS } from "../../core/system-fields.js";
|
|
3
3
|
import { EntityTfError } from "../../engine/entity.js";
|
|
4
4
|
import { procedureDiscriminator } from "../../engine/pull/procedure-refs.js";
|
|
5
5
|
import { childPartFromScopedLabel, isTfExpr, sanitizeName, scopedLabelToBagKey, tfLabelToTsLabel, tsLabelToTfLabel, } from "../../engine/tf/index.js";
|
|
@@ -13,6 +13,7 @@ import { TABLE_RESOURCE_TYPE } from "../table/module.js";
|
|
|
13
13
|
import { SEARCH_TABLE_RESOURCE_TYPES } from "../search-table/types.js";
|
|
14
14
|
import { outputFieldTypesFromScriptSchema, scriptOutputReferenceIsDeclared } from "./output-field-types.js";
|
|
15
15
|
import { apiTaskRefAuthoringPath, matchesOutputWireKey, OUTPUT_KEY_WIRE_NAME } from "./output-key-wire-name.js";
|
|
16
|
+
import { systemRefNameRoundTrips } from "./system-ref-name.js";
|
|
16
17
|
import { taskTfLabel } from "./task-label.js";
|
|
17
18
|
import { workflowOutputTypeFromFieldType } from "./workflow-output.js";
|
|
18
19
|
import { ALL_AUTOMATION_TASK_TYPE_SET, AUTOMATION_BRANCH_TYPE_SET, AUTOMATION_RESOURCE_TYPE, AUTOMATION_TRIGGER_TYPE_SET, WORKFLOW_PUBLISH_RESOURCE_TYPE, } from "./types.js";
|
|
@@ -58,6 +59,7 @@ const TASK_FACTORIES = {
|
|
|
58
59
|
elementum_ai_transform_task: "aiTransform",
|
|
59
60
|
elementum_save_attachment_task: "saveAttachment",
|
|
60
61
|
elementum_user_search_task: "userSearch",
|
|
62
|
+
elementum_user_group_search_task: "userGroupSearch",
|
|
61
63
|
elementum_calculation_task: "calculation",
|
|
62
64
|
elementum_execute_script_task: "executeScript",
|
|
63
65
|
elementum_file_reader_task: "documentModel",
|
|
@@ -354,17 +356,30 @@ function recordFieldRefPath(wireName, ctx, ownerRefName = ctx.appRefName, rootNa
|
|
|
354
356
|
continue;
|
|
355
357
|
const base = wireName.slice(0, wireName.length - suffix.length);
|
|
356
358
|
const fieldKey = lookupFieldKeyByDisplayName(ownerRefName, base, ctx);
|
|
357
|
-
if (fieldKey !== undefined) {
|
|
359
|
+
if (fieldKey !== undefined && systemFieldPathRoundTrips(fieldKey, suffix, wireName)) {
|
|
358
360
|
return [rootName, fieldKey, ...suffixPath];
|
|
359
361
|
}
|
|
360
362
|
}
|
|
361
|
-
|
|
362
|
-
|
|
363
|
+
const systemPath = systemFieldRefPath(wireName);
|
|
364
|
+
return systemPath === undefined ? undefined : [rootName, ...systemPath];
|
|
365
|
+
}
|
|
366
|
+
function systemFieldPathRoundTrips(fieldKey, wireSuffix, wireName) {
|
|
367
|
+
return !SYSTEM_FIELD_KEY_SET.has(fieldKey) ||
|
|
368
|
+
systemRefNameRoundTrips(fieldKey, wireSuffix, wireName);
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* System fields have no `*_field` resource block, so they never appear in
|
|
372
|
+
* fieldById. Match their provider-default display names explicitly, but only
|
|
373
|
+
* when a rebuild of the typed path emits the same refs key; otherwise the
|
|
374
|
+
* caller keeps the org's exact label.
|
|
375
|
+
*/
|
|
376
|
+
function systemFieldRefPath(wireName) {
|
|
377
|
+
const wireNameLower = wireName.toLowerCase();
|
|
363
378
|
for (const key of SYSTEM_FIELD_KEYS) {
|
|
364
379
|
const defaultName = DEPLOY_DEFAULT_SYSTEM_FIELD_NAMES[key];
|
|
365
380
|
for (const [suffix, suffixPath] of FIELD_REF_SUFFIX_FROM_WIRE) {
|
|
366
|
-
if (wireNameLower === `${defaultName}${suffix}`.toLowerCase()) {
|
|
367
|
-
return [
|
|
381
|
+
if (wireNameLower === `${defaultName}${suffix}`.toLowerCase() && systemRefNameRoundTrips(key, suffix, wireName)) {
|
|
382
|
+
return [key, ...suffixPath];
|
|
368
383
|
}
|
|
369
384
|
}
|
|
370
385
|
}
|
|
@@ -429,7 +444,7 @@ const RECORD_SEARCH_TASK_REF_SEGMENT_TO_TS = {
|
|
|
429
444
|
/**
|
|
430
445
|
* The same outputs as seen from a CALCULATION formula, which addresses a
|
|
431
446
|
* reference by its WorkflowTaskReference name rather than the refs-map
|
|
432
|
-
* display key above (`
|
|
447
|
+
* display key above (`task-output-labels.ts`'s `TASK_OUTPUT_REFERENCE_NAMES` is the
|
|
433
448
|
* write side). Only the names that differ from their authoring path are
|
|
434
449
|
* listed; the rest already read back correctly.
|
|
435
450
|
*/
|
|
@@ -452,6 +467,33 @@ const AI_SEARCH_TABLE_TASK_REF_SEGMENT_TO_TS = {
|
|
|
452
467
|
const TABLE_RECORDS_SEARCH_TASK_REF_SEGMENT_TO_TS = {
|
|
453
468
|
"All matching table rows": "records",
|
|
454
469
|
};
|
|
470
|
+
// Platform-fixed output labels → authoring path, inverse of
|
|
471
|
+
// task-output-labels.ts and executeScript's "Text Result". Scoped per task
|
|
472
|
+
// type: a field may share a label elsewhere.
|
|
473
|
+
const TASK_OUTPUT_LABEL_TO_TS = {
|
|
474
|
+
elementum_record_search_task: { "First found record": ["record"] },
|
|
475
|
+
elementum_create_record_task: { "Created record": ["record"] },
|
|
476
|
+
elementum_update_field_task: { "Updated record": ["record"] },
|
|
477
|
+
elementum_execute_script_task: { "Text Result": ["textResult"] },
|
|
478
|
+
elementum_user_search_task: {
|
|
479
|
+
"User's Id": ["user", "id"],
|
|
480
|
+
"User's Name": ["user", "name"],
|
|
481
|
+
"User's Email": ["user", "email"],
|
|
482
|
+
"Manager Name": ["user", "managerName"],
|
|
483
|
+
"Manager Email": ["user", "managerEmail"],
|
|
484
|
+
"All found users": ["users"],
|
|
485
|
+
},
|
|
486
|
+
};
|
|
487
|
+
// userGroupSearch refs-map keys → authoring path; inverse of build.ts's
|
|
488
|
+
// USER_GROUP_SEARCH_REF_WIRE_NAMES. "ID"/"Name" are only these outputs on
|
|
489
|
+
// elementum_user_group_search_task, so the table must stay scoped to it.
|
|
490
|
+
const USER_GROUP_SEARCH_TASK_REF_LABEL_TO_TS = {
|
|
491
|
+
"Groups Size": ["count"],
|
|
492
|
+
"First found group": ["group"],
|
|
493
|
+
ID: ["group", "id"],
|
|
494
|
+
Name: ["group", "name"],
|
|
495
|
+
"All found groups": ["groups"],
|
|
496
|
+
};
|
|
455
497
|
/**
|
|
456
498
|
* Restore the public aiAgent `.result` shape from either a provider refs-map
|
|
457
499
|
* key (`Action Response` / authored schema field) or the nested platform
|
|
@@ -830,7 +872,8 @@ function forEachItemRefPath(path, ctx) {
|
|
|
830
872
|
if (names.length !== 1)
|
|
831
873
|
return names.flatMap((segment) => segment.split("."));
|
|
832
874
|
const wireName = names[0];
|
|
833
|
-
|
|
875
|
+
// "" is a plain-list loop's whole item (provider Read: `for_each.<id>.`).
|
|
876
|
+
if (wireName === "item" || wireName === "")
|
|
834
877
|
return [];
|
|
835
878
|
if (wireName === "Record")
|
|
836
879
|
return ["recordId"];
|
|
@@ -847,15 +890,7 @@ function forEachItemRefPath(path, ctx) {
|
|
|
847
890
|
}
|
|
848
891
|
}
|
|
849
892
|
}
|
|
850
|
-
|
|
851
|
-
const defaultName = DEPLOY_DEFAULT_SYSTEM_FIELD_NAMES[key];
|
|
852
|
-
for (const [suffix, suffixPath] of FIELD_REF_SUFFIX_FROM_WIRE) {
|
|
853
|
-
if (wireNameLower === `${defaultName}${suffix}`.toLowerCase()) {
|
|
854
|
-
return [key, ...suffixPath];
|
|
855
|
-
}
|
|
856
|
-
}
|
|
857
|
-
}
|
|
858
|
-
return names.flatMap((segment) => segment.split("."));
|
|
893
|
+
return systemFieldRefPath(wireName) ?? names.flatMap((segment) => segment.split("."));
|
|
859
894
|
}
|
|
860
895
|
function resolveTaskRefKey(taskIdOrKey, ctx) {
|
|
861
896
|
if (/^[a-f0-9-]{36}$/.test(taskIdOrKey)) {
|
|
@@ -956,6 +991,11 @@ function decodeTaskReferenceFromString(taskIdOrKey, pathSegments, ctx) {
|
|
|
956
991
|
return { kind: "taskRef", task: refKey, path: [tableSearchName, ...tail] };
|
|
957
992
|
}
|
|
958
993
|
}
|
|
994
|
+
if (block?.type === "elementum_user_group_search_task" && pathSegments.length === 1) {
|
|
995
|
+
const groupPath = USER_GROUP_SEARCH_TASK_REF_LABEL_TO_TS[pathSegments[0]];
|
|
996
|
+
if (groupPath !== undefined)
|
|
997
|
+
return { kind: "taskRef", task: refKey, path: [...groupPath] };
|
|
998
|
+
}
|
|
959
999
|
// createRecord/findRelatedRecords record-id + field outputs (same as the
|
|
960
1000
|
// refs["Title"] / refs["Record"] resource-attr path in decodeValue).
|
|
961
1001
|
if ((block?.type === "elementum_create_record_task" || block?.type === "elementum_find_related_records_task") &&
|
|
@@ -964,10 +1004,7 @@ function decodeTaskReferenceFromString(taskIdOrKey, pathSegments, ctx) {
|
|
|
964
1004
|
if (pathSegments.length === 1 && (head === "Record" || head === "Record ID")) {
|
|
965
1005
|
return { kind: "taskRef", task: refKey, path: ["record", "recordId"] };
|
|
966
1006
|
}
|
|
967
|
-
if (
|
|
968
|
-
head === "record" &&
|
|
969
|
-
tail.length >= 1 &&
|
|
970
|
-
/^[a-f0-9-]{36}$/i.test(tail[0])) {
|
|
1007
|
+
if (head === "record" && tail.length >= 1 && /^[a-f0-9-]{36}$/i.test(tail[0])) {
|
|
971
1008
|
const taskAddress = block.label !== undefined ? `${block.type}.${block.label}` : undefined;
|
|
972
1009
|
const ownerRefName = taskAddress !== undefined
|
|
973
1010
|
? ctx.taskTargetOwnerRefNameByAddress?.get(taskAddress) ?? ctx.appRefName
|
|
@@ -1093,9 +1130,10 @@ function decodeTemplateTriggerRecordFieldRef(value, ctx) {
|
|
|
1093
1130
|
function decodeTemplateTaskRef(value, ctx) {
|
|
1094
1131
|
if (!isTfExpr(value) || value.$expr !== "template")
|
|
1095
1132
|
return undefined;
|
|
1096
|
-
const [prefix, idPart,
|
|
1133
|
+
const [prefix, idPart, ...nameTemplate] = mergeAdjacentTemplateStrings(value.parts);
|
|
1097
1134
|
if (prefix !== "task." || idPart === undefined || typeof idPart === "string")
|
|
1098
1135
|
return undefined;
|
|
1136
|
+
const suffixPart = nameTemplate[0];
|
|
1099
1137
|
if (typeof suffixPart !== "string" || !suffixPart.startsWith("."))
|
|
1100
1138
|
return undefined;
|
|
1101
1139
|
if (!isTfExpr(idPart) || idPart.$expr !== "resource-attr" || idPart.path[0] !== "id")
|
|
@@ -1103,11 +1141,47 @@ function decodeTemplateTaskRef(value, ctx) {
|
|
|
1103
1141
|
const task = ctx.taskByAddress.get(`${idPart.type}.${idPart.label}`);
|
|
1104
1142
|
if (task === undefined)
|
|
1105
1143
|
return undefined;
|
|
1144
|
+
if (nameTemplate.length > 1) {
|
|
1145
|
+
const path = templateRecordFieldPath([suffixPart.slice(1), ...nameTemplate.slice(1)], task.block, ctx);
|
|
1146
|
+
return path === undefined ? undefined : { kind: "taskRef", task: task.refKey, path };
|
|
1147
|
+
}
|
|
1106
1148
|
const nameParts = suffixPart.slice(1).split(".").filter((segment) => segment.length > 0);
|
|
1107
1149
|
if (nameParts.length === 0)
|
|
1108
1150
|
return undefined;
|
|
1109
1151
|
return decodeTaskReferenceFromString(task.refKey, nameParts, ctx);
|
|
1110
1152
|
}
|
|
1153
|
+
function mergeAdjacentTemplateStrings(parts) {
|
|
1154
|
+
const out = [];
|
|
1155
|
+
for (const part of parts) {
|
|
1156
|
+
const last = out[out.length - 1];
|
|
1157
|
+
if (typeof part === "string" && typeof last === "string")
|
|
1158
|
+
out[out.length - 1] = last + part;
|
|
1159
|
+
else
|
|
1160
|
+
out.push(part);
|
|
1161
|
+
}
|
|
1162
|
+
return out;
|
|
1163
|
+
}
|
|
1164
|
+
/**
|
|
1165
|
+
* Inverse of to-tf's `foundRecordFieldReferenceName`: a found record's field
|
|
1166
|
+
* built as `record.${<field id expr>}[.suffix]`. Only the automation's own
|
|
1167
|
+
* app's field labels decode by tf label; another app's do not, so a task
|
|
1168
|
+
* targeting one stays undefined rather than guessing its field.
|
|
1169
|
+
*/
|
|
1170
|
+
function templateRecordFieldPath(parts, taskBlock, ctx) {
|
|
1171
|
+
const [head, fieldPart, suffixPart, ...rest] = mergeAdjacentTemplateStrings(parts);
|
|
1172
|
+
if (head !== "record." || fieldPart === undefined || typeof fieldPart === "string" || rest.length > 0)
|
|
1173
|
+
return undefined;
|
|
1174
|
+
if (suffixPart !== undefined && (typeof suffixPart !== "string" || !suffixPart.startsWith(".")))
|
|
1175
|
+
return undefined;
|
|
1176
|
+
const taskAddress = taskBlock.label !== undefined ? `${taskBlock.type}.${taskBlock.label}` : undefined;
|
|
1177
|
+
const ownerRefName = taskAddress !== undefined ? ctx.taskTargetOwnerRefNameByAddress?.get(taskAddress) : undefined;
|
|
1178
|
+
if (ownerRefName !== undefined && ownerRefName !== ctx.appRefName)
|
|
1179
|
+
return undefined;
|
|
1180
|
+
const fieldKey = fieldKeyFromTriggerFieldIdExpr(fieldPart, ctx);
|
|
1181
|
+
if (fieldKey === undefined)
|
|
1182
|
+
return undefined;
|
|
1183
|
+
return ["record", fieldKey, ...(suffixPart ?? "").split(".").filter((segment) => segment.length > 0)];
|
|
1184
|
+
}
|
|
1111
1185
|
function decodeTemplateForEachRef(value, ctx) {
|
|
1112
1186
|
if (!isTfExpr(value) || value.$expr !== "template")
|
|
1113
1187
|
return undefined;
|
|
@@ -1122,7 +1196,7 @@ function decodeTemplateForEachRef(value, ctx) {
|
|
|
1122
1196
|
if (task === undefined)
|
|
1123
1197
|
return undefined;
|
|
1124
1198
|
const nameParts = suffixPart.slice(1).split(".").filter((segment) => segment.length > 0);
|
|
1125
|
-
if (nameParts.length === 0)
|
|
1199
|
+
if (nameParts.length === 0 && suffixPart !== ".")
|
|
1126
1200
|
return undefined;
|
|
1127
1201
|
return {
|
|
1128
1202
|
kind: "forEachItemRef",
|
|
@@ -1313,6 +1387,13 @@ function decodeValue(value, ctx) {
|
|
|
1313
1387
|
return { kind: "taskRef", task: task.refKey, path: aiAgentPath };
|
|
1314
1388
|
}
|
|
1315
1389
|
}
|
|
1390
|
+
const blockType = task.block.type;
|
|
1391
|
+
const labelPath = rawSegments.length === 1 && blockType !== undefined
|
|
1392
|
+
? TASK_OUTPUT_LABEL_TO_TS[blockType]?.[rawSegments[0]]
|
|
1393
|
+
: undefined;
|
|
1394
|
+
if (labelPath !== undefined) {
|
|
1395
|
+
return { kind: "taskRef", task: task.refKey, path: [...labelPath] };
|
|
1396
|
+
}
|
|
1316
1397
|
if (task.block.type === "elementum_record_search_task" && rawSegments.length === 1 && rawSegments[0] === "First found record id") {
|
|
1317
1398
|
return { kind: "taskRef", task: task.refKey, path: ["record", "recordId"] };
|
|
1318
1399
|
}
|
|
@@ -1369,6 +1450,12 @@ function decodeValue(value, ctx) {
|
|
|
1369
1450
|
return { kind: "taskRef", task: task.refKey, path: [tableSearchName] };
|
|
1370
1451
|
}
|
|
1371
1452
|
}
|
|
1453
|
+
if (task.block.type === "elementum_user_group_search_task" && rawSegments.length === 1) {
|
|
1454
|
+
const groupPath = USER_GROUP_SEARCH_TASK_REF_LABEL_TO_TS[rawSegments[0]];
|
|
1455
|
+
if (groupPath !== undefined) {
|
|
1456
|
+
return { kind: "taskRef", task: task.refKey, path: [...groupPath] };
|
|
1457
|
+
}
|
|
1458
|
+
}
|
|
1372
1459
|
// apiRequest's refs map uses display labels ("File", "Content Type",
|
|
1373
1460
|
// …) that don't match the lowercase authoring property names
|
|
1374
1461
|
// (`file`, `file.contentType`) - see API_TASK_REF_AUTHORING_NAMES.
|
|
@@ -1799,6 +1886,17 @@ function userFieldRef(value, ctx) {
|
|
|
1799
1886
|
}
|
|
1800
1887
|
return fieldRef(value, ctx);
|
|
1801
1888
|
}
|
|
1889
|
+
const USER_GROUP_FIELD_KEY_SET = new Set(USER_GROUP_FIELD_KEYS);
|
|
1890
|
+
function userGroupFieldRef(value, ctx) {
|
|
1891
|
+
if (typeof value === "string" && USER_GROUP_FIELD_KEY_SET.has(value)) {
|
|
1892
|
+
return { kind: "userGroupField", fieldKey: value };
|
|
1893
|
+
}
|
|
1894
|
+
return fieldRef(value, ctx);
|
|
1895
|
+
}
|
|
1896
|
+
const FILTER_FIELD_SCOPE_BY_FACTORY = {
|
|
1897
|
+
userSearch: "user",
|
|
1898
|
+
userGroupSearch: "userGroup",
|
|
1899
|
+
};
|
|
1802
1900
|
function picklistOptionLabel(value) {
|
|
1803
1901
|
if (value === undefined || !isTfExpr(value))
|
|
1804
1902
|
return undefined;
|
|
@@ -2132,6 +2230,15 @@ function decodeFilterReferenceEnvelope(value, ctx, outputName, role) {
|
|
|
2132
2230
|
return decoded;
|
|
2133
2231
|
}
|
|
2134
2232
|
}
|
|
2233
|
+
if (isObject(taskRef) && isTfExpr(taskRef.name) && taskRef.name.$expr === "template") {
|
|
2234
|
+
const taskIdOrKey = workflowOutputTaskIdOrKey(taskRef.taskId, ctx);
|
|
2235
|
+
const { refKey, block } = taskIdOrKey !== undefined ? resolveTaskRefKey(taskIdOrKey, ctx) : { refKey: undefined, block: undefined };
|
|
2236
|
+
const path = block !== undefined
|
|
2237
|
+
? templateRecordFieldPath(taskRef.name.parts, block, ctx)
|
|
2238
|
+
: undefined;
|
|
2239
|
+
if (refKey !== undefined && path !== undefined)
|
|
2240
|
+
return { kind: "taskRef", task: refKey, path };
|
|
2241
|
+
}
|
|
2135
2242
|
const triggerRef = raw.triggerReference;
|
|
2136
2243
|
if (isObject(triggerRef) && typeof triggerRef.name === "string") {
|
|
2137
2244
|
return decodeReferenceString(`trigger.${triggerRef.name}`, ctx);
|
|
@@ -2248,7 +2355,9 @@ export function inferredPublishOutputType(value, ctx) {
|
|
|
2248
2355
|
function decodeFilter(value, ctx, fieldScope = "app") {
|
|
2249
2356
|
return deserializeFilterFromTf(value, {
|
|
2250
2357
|
field: (fieldValue, scope) => {
|
|
2251
|
-
const field = scope === "user"
|
|
2358
|
+
const field = scope === "user"
|
|
2359
|
+
? userFieldRef(fieldValue, ctx)
|
|
2360
|
+
: scope === "userGroup" ? userGroupFieldRef(fieldValue, ctx) : filterFieldRef(fieldValue, ctx);
|
|
2252
2361
|
return field ?? { kind: "unresolved", uuid: String(fieldValue), hint: "field" };
|
|
2253
2362
|
},
|
|
2254
2363
|
reference: (reference, role) => filterReference(reference, ctx, role),
|
|
@@ -2397,7 +2506,7 @@ function taskArgs(block, factory, ctx, fieldMappingDiagnostics) {
|
|
|
2397
2506
|
if (attr === "parent" || attr === "name" || attr === "depends_on")
|
|
2398
2507
|
continue;
|
|
2399
2508
|
if (attr === "filter") {
|
|
2400
|
-
args.filter = decodeFilter(value, ctx, factory
|
|
2509
|
+
args.filter = decodeFilter(value, ctx, FILTER_FIELD_SCOPE_BY_FACTORY[factory] ?? "app");
|
|
2401
2510
|
continue;
|
|
2402
2511
|
}
|
|
2403
2512
|
if (attr === "fields" && (factory === "createRecord" || factory === "updateField")) {
|
|
@@ -18,5 +18,5 @@ export * as filter from "../shared/filters/index.js";
|
|
|
18
18
|
export { automationStatus, chainableTrigger, actions, automation, type ActionBuilder, type ActionChain, type ActionDef, type ActionOptions, type ActionSequenceDef, type ActionsStarted, type AutomationConfigured, type AutomationOptions, type AutomationStatus, type ForkJoinBranch, type ForkJoinBranchBuilder, type ForkJoinConfig, type ForEachBuilder, type ForEachConfig, type NestedActionBuilder, type NestedActionChain, type NestedActionContext, type OperatorChild, type SwitchCase, type SwitchCaseBuilder, type SwitchConfig, type TriggerChain, type TriggerDef, type TriggerParamMeta } from "./build.js";
|
|
19
19
|
export { ScriptCodeError, scriptFile, type ScriptCodeFn, type ScriptFile, type ScriptInput } from "./script-code.js";
|
|
20
20
|
export { workflowOutput, workflowOutputType, type WorkflowOutputDeclaration, type WorkflowOutputType, } from "./workflow-output.js";
|
|
21
|
-
export { addWatcher, aiAgent, aiClassify, aiEmailAnalysis, aiFileAnalysis, aiSearchTable, aiSummarize, aiTransform, apiRequest, approvalChain, approvalChainTemplate, approvalStatusUpdate, assignGroup, assignUser, assignmentEngine, bulkExcel, 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 ApprovalChainOptions, type ApprovalChainTemplateOptions, type ApprovalStatusUpdateOptions, type ApprovalStatusUpdateStatus, type AssignGroupOptions, type AssignUserOptions, type AssignmentEngineOptions, type BulkExcelFieldMapping, type BulkExcelFieldSource, type BulkExcelOptions, 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 FieldAssignment, type FindRelatedRecordsOptions, type FindRelatedRecordsOutput, type GenerateReportOptions, type InitiateCallOptions, type InitiateEmailConversationOptions, type InitiateEmailFirstEmail, type LegacyCalculationOptions, type MultiSelectUpdateMode, type NotificationOptions, 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 RunAutomationOptions, 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 UserSearchOptions, type VariableAssign, type VariableDecl } from "./tasks.js";
|
|
21
|
+
export { addWatcher, aiAgent, aiClassify, aiEmailAnalysis, aiFileAnalysis, aiSearchTable, aiSummarize, aiTransform, apiRequest, approvalChain, approvalChainTemplate, approvalStatusUpdate, assignGroup, assignUser, assignmentEngine, bulkExcel, 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 ApprovalChainOptions, type ApprovalChainTemplateOptions, type ApprovalStatusUpdateOptions, type ApprovalStatusUpdateStatus, type AssignGroupOptions, type AssignUserOptions, type AssignmentEngineOptions, type BulkExcelFieldMapping, type BulkExcelFieldSource, type BulkExcelOptions, 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 FieldAssignment, type FindRelatedRecordsOptions, type FindRelatedRecordsOutput, type GenerateReportOptions, type InitiateCallOptions, type InitiateEmailConversationOptions, type InitiateEmailFirstEmail, type LegacyCalculationOptions, type MultiSelectUpdateMode, type NotificationOptions, 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 RunAutomationOptions, 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";
|
|
22
22
|
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";
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
/** The automation entity's registry entry (see src/graph/). */
|
|
2
2
|
import { type EntityKindModule } from "../../graph/types.js";
|
|
3
3
|
export declare const automationModule: EntityKindModule;
|
|
4
|
+
/** The provider's `normalizeOnDemandFilterRefName`, which computes `filter_refs` at plan time. */
|
|
5
|
+
export declare function onDemandFilterRefName(name: string): string;
|