@elementumai/edk 0.9.5 → 0.9.7

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.
Files changed (97) hide show
  1. package/README.md +31 -1
  2. package/dist-sdk/src/catalog/factories.d.ts +12 -3
  3. package/dist-sdk/src/catalog/factories.js +9 -6
  4. package/dist-sdk/src/catalog/org.js +26 -13
  5. package/dist-sdk/src/catalog/types.d.ts +22 -1
  6. package/dist-sdk/src/core/index.d.ts +1 -1
  7. package/dist-sdk/src/core/system-fields.d.ts +4 -0
  8. package/dist-sdk/src/core/system-fields.js +15 -0
  9. package/dist-sdk/src/core/types/app.d.ts +14 -9
  10. package/dist-sdk/src/core/types/platform.d.ts +1 -1
  11. package/dist-sdk/src/engine/build/context.d.ts +4 -0
  12. package/dist-sdk/src/engine/pull/context.d.ts +9 -0
  13. package/dist-sdk/src/engine/pull/ref-only.d.ts +14 -0
  14. package/dist-sdk/src/engine/pull/ref-only.js +35 -2
  15. package/dist-sdk/src/entities/access-policy/from-tf.js +14 -2
  16. package/dist-sdk/src/entities/access-policy/to-tf.d.ts +6 -0
  17. package/dist-sdk/src/entities/access-policy/to-tf.js +4 -1
  18. package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +18 -1
  19. package/dist-sdk/src/entities/agent/module.js +1 -0
  20. package/dist-sdk/src/entities/agent/to-tf.d.ts +1 -0
  21. package/dist-sdk/src/entities/agent/to-tf.js +1 -0
  22. package/dist-sdk/src/entities/agent-tool/from-tf.d.ts +9 -0
  23. package/dist-sdk/src/entities/agent-tool/from-tf.js +10 -2
  24. package/dist-sdk/src/entities/agent-tool/to-tf.d.ts +2 -0
  25. package/dist-sdk/src/entities/agent-tool/to-tf.js +2 -3
  26. package/dist-sdk/src/entities/app/build.d.ts +42 -22
  27. package/dist-sdk/src/entities/app/build.js +12 -5
  28. package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +10 -0
  29. package/dist-sdk/src/entities/app/from-tf.js +71 -8
  30. package/dist-sdk/src/entities/app/index.d.ts +3 -2
  31. package/dist-sdk/src/entities/app/index.js +2 -1
  32. package/dist-sdk/src/entities/app/to-tf.js +16 -0
  33. package/dist-sdk/src/entities/automation/build.d.ts +31 -19
  34. package/dist-sdk/src/entities/automation/build.js +85 -7
  35. package/dist-sdk/src/entities/automation/catalog-render.js +5 -2
  36. package/dist-sdk/src/entities/automation/deserializer/ast.d.ts +5 -3
  37. package/dist-sdk/src/entities/automation/deserializer/print-automation.js +26 -12
  38. package/dist-sdk/src/entities/automation/from-tf.js +364 -31
  39. package/dist-sdk/src/entities/automation/index.d.ts +1 -1
  40. package/dist-sdk/src/entities/automation/module.js +2 -2
  41. package/dist-sdk/src/entities/automation/operators.d.ts +2 -2
  42. package/dist-sdk/src/entities/automation/operators.js +1 -0
  43. package/dist-sdk/src/entities/automation/output-field-types.d.ts +17 -0
  44. package/dist-sdk/src/entities/automation/output-field-types.js +45 -0
  45. package/dist-sdk/src/entities/automation/output-key-wire-name.d.ts +8 -0
  46. package/dist-sdk/src/entities/automation/output-key-wire-name.js +16 -0
  47. package/dist-sdk/src/entities/automation/script-code.js +153 -25
  48. package/dist-sdk/src/entities/automation/tasks.d.ts +100 -37
  49. package/dist-sdk/src/entities/automation/tasks.js +44 -43
  50. package/dist-sdk/src/entities/automation/to-tf.d.ts +3 -1
  51. package/dist-sdk/src/entities/automation/to-tf.js +454 -58
  52. package/dist-sdk/src/entities/automation/value-ref-tf.d.ts +78 -0
  53. package/dist-sdk/src/entities/automation/value-ref-tf.js +193 -0
  54. package/dist-sdk/src/entities/element/build.js +1 -0
  55. package/dist-sdk/src/entities/element/index.d.ts +2 -1
  56. package/dist-sdk/src/entities/element/index.js +2 -1
  57. package/dist-sdk/src/entities/field/build.d.ts +94 -3
  58. package/dist-sdk/src/entities/field/build.js +82 -3
  59. package/dist-sdk/src/entities/field/from-tf.js +92 -1
  60. package/dist-sdk/src/entities/field/locals.js +6 -7
  61. package/dist-sdk/src/entities/field/options.d.ts +2 -0
  62. package/dist-sdk/src/entities/field/options.js +12 -2
  63. package/dist-sdk/src/entities/field/record-shape.d.ts +12 -15
  64. package/dist-sdk/src/entities/field/to-tf.d.ts +12 -2
  65. package/dist-sdk/src/entities/field/to-tf.js +172 -51
  66. package/dist-sdk/src/entities/field/types.js +2 -0
  67. package/dist-sdk/src/entities/record-create-form/to-tf.js +5 -8
  68. package/dist-sdk/src/entities/relationship/from-tf.js +91 -9
  69. package/dist-sdk/src/entities/shared/aspect-target-from-tf.d.ts +9 -0
  70. package/dist-sdk/src/entities/shared/aspect-target-from-tf.js +39 -0
  71. package/dist-sdk/src/entities/shared/filters/ast.d.ts +18 -1
  72. package/dist-sdk/src/entities/shared/filters/ast.js +1 -0
  73. package/dist-sdk/src/entities/shared/filters/tf-codec.d.ts +6 -1
  74. package/dist-sdk/src/entities/shared/filters/tf-codec.js +6 -4
  75. package/dist-sdk/src/entities/shared/tool-field-ref.d.ts +5 -3
  76. package/dist-sdk/src/entities/shared/tool-field-ref.js +11 -16
  77. package/dist-sdk/src/entities/shared/types/common.d.ts +7 -5
  78. package/dist-sdk/src/entities/shared/types/platform.d.ts +15 -2
  79. package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.d.ts +1 -1
  80. package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +44 -15
  81. package/dist-sdk/src/entities/skill/from-tf.js +11 -1
  82. package/dist-sdk/src/entities/skill/input-coverage.d.ts +68 -0
  83. package/dist-sdk/src/entities/skill/input-coverage.js +184 -0
  84. package/dist-sdk/src/entities/skill/module.js +2 -0
  85. package/dist-sdk/src/entities/skill/to-tf.d.ts +3 -0
  86. package/dist-sdk/src/entities/skill/to-tf.js +7 -2
  87. package/dist-sdk/src/entities/skill/tools.d.ts +10 -1
  88. package/dist-sdk/src/entities/skill/tools.js +0 -5
  89. package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +19 -0
  90. package/dist-sdk/src/entities/skill-tool/from-tf.js +40 -11
  91. package/dist-sdk/src/entities/skill-tool/to-tf.d.ts +4 -2
  92. package/dist-sdk/src/entities/skill-tool/to-tf.js +24 -16
  93. package/dist-sdk/src/entities/table/to-tf.js +18 -1
  94. package/dist-sdk/src/entities/view/to-tf.js +8 -3
  95. package/dist-sdk/src/entities/visual-flow/from-tf.js +6 -2
  96. package/dist-sdk/src/graph/types.d.ts +3 -0
  97. package/package.json +2 -1
@@ -17,5 +17,5 @@ export { AUTOMATION_RESOURCE_TYPES, AUTOMATION_TASK_TYPES, AUTOMATION_TRIGGER_TY
17
17
  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, type ScriptCodeFn, type ScriptInput } from "./script-code.js";
20
- export { addWatcher, aiAgent, aiClassify, aiEmailAnalysis, aiFileAnalysis, aiSearchTable, aiSummarize, aiTransform, apiRequest, approvalChain, approvalChainTemplate, approvalStatusUpdate, assignGroup, assignUser, assignmentEngine, bulkExcel, calculation, createRecord, executeScript, filterAction, findRelatedRecords, generateReport, initiateCall, initiateEmailConversation, notification, postComment, postTeamsMessage, procedure, readFile, recordFieldLocking, recordSearch, relateRecords, runAutomation, saveAttachment, sendEmail, sendSurvey, setVariable, tableRecordsSearch, unzip, updateField, userGroupSearch, userSearch, type AddWatcherOptions, 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 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 ExecuteScriptOptions, type FieldAssignment, type FilterActionOptions, type FindRelatedRecordsOptions, type GenerateReportOptions, type InitiateCallOptions, type InitiateEmailConversationOptions, type InitiateEmailFirstEmail, type LegacyCalculationOptions, type NotificationOptions, type PostCommentOptions, type PostTeamsMessageOptions, type ProcedureOptions, type ReadFileDataSource, type ReadFileOptions, type RecordFieldLockingOptions, type RecordId, type RecordReference, type RecordSearchOptions, type RecordSearchOutput, type RelateRecordsOptions, type RunAutomationInput, type RunAutomationOptions, type SaveAttachmentOptions, type SendEmailOptions, type SendSurveyOptions, type SetVariableOptions, type TableRecordsSearchOptions, type TableRecordsSearchOutput, type UnzipOptions, type UpdateFieldOptions, type UserSearchOptions, type VariableAssign, type VariableDecl } from "./tasks.js";
20
+ export { addWatcher, aiAgent, aiClassify, aiEmailAnalysis, aiFileAnalysis, aiSearchTable, aiSummarize, aiTransform, apiRequest, approvalChain, approvalChainTemplate, approvalStatusUpdate, assignGroup, assignUser, assignmentEngine, bulkExcel, calculation, createRecord, executeScript, filterAction, findRelatedRecords, generateReport, initiateCall, initiateEmailConversation, notification, postComment, postTeamsMessage, procedure, readFile, recordFieldLocking, recordSearch, relateRecords, runAutomation, saveAttachment, sendEmail, sendSurvey, setVariable, tableRecordsSearch, unzip, updateField, userGroupSearch, userSearch, type AddWatcherOptions, 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 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 ExecuteScriptOptions, type FieldAssignment, type FilterActionOptions, type FindRelatedRecordsOptions, type GenerateReportOptions, type InitiateCallOptions, type InitiateEmailConversationOptions, type InitiateEmailFirstEmail, type LegacyCalculationOptions, type MultiSelectUpdateMode, type NotificationOptions, type PostCommentOptions, type PostTeamsMessageOptions, type ProcedureOptions, 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 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
21
  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 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";
@@ -155,7 +155,7 @@ export const automationModule = {
155
155
  participates: true,
156
156
  resourceType: AUTOMATION_RESOURCE_TYPE,
157
157
  lookupAttr: "name",
158
- referencedByBuild: false,
158
+ referencedByBuild: true,
159
159
  referenceLookups: [
160
160
  { strategy: "owned", ownerKinds: ["app", "element"], memberAttr: "name" },
161
161
  { strategy: "nameOnlyMetadata", ownerKind: "automation" },
@@ -205,7 +205,7 @@ export const automationModule = {
205
205
  workspaceAspects: ctx.workspaceAspects,
206
206
  localsAttrs: ctx.localsAttrs,
207
207
  serviceAccounts: ctx.streamRootEntity?.payload?.serviceAccounts,
208
- activeAutomationRefNames: new Set((ctx.siblingEntities ?? [])
208
+ activeAutomationRefNames: ctx.activeAutomationRefNames ?? new Set((ctx.siblingEntities ?? [])
209
209
  .filter((sibling) => sibling.kind === "automation" &&
210
210
  sibling.payload?.status === "ACTIVE")
211
211
  .map((sibling) => sibling.refName)),
@@ -26,7 +26,7 @@ export interface ForEachConfig<TTrigger, TActions extends Record<string, unknown
26
26
  }
27
27
  export declare function forEach<TTrigger, TActions extends Record<string, unknown>, TItem, TVars extends Record<string, unknown> = NoVariables>(_ctx: Context<TTrigger, TActions, TVars>, config: ForEachConfig<TTrigger, TActions, TItem, TVars>): ActionDef<Empty>;
28
28
  export interface SwitchCase<TTrigger, TActions extends Record<string, unknown>, TVars extends Record<string, unknown> = NoVariables> {
29
- readonly label: string;
29
+ readonly label?: string;
30
30
  /**
31
31
  * Condition for this case, built with the `filter.*` DSL
32
32
  * (`@elementumai/edk/automations`). Omit for a condition-free fallthrough
@@ -66,7 +66,7 @@ export interface SwitchConfig<TTrigger, TActions extends Record<string, unknown>
66
66
  }
67
67
  export declare function switchAction<TTrigger, TActions extends Record<string, unknown>, TVars extends Record<string, unknown> = NoVariables>(_ctx: Context<TTrigger, TActions, TVars>, config: SwitchConfig<TTrigger, TActions, TVars>): ActionDef<Empty>;
68
68
  export interface ForkJoinBranch<TTrigger, TActions extends Record<string, unknown>, TVars extends Record<string, unknown> = NoVariables> {
69
- readonly label: string;
69
+ readonly label?: string;
70
70
  readonly actions: (innerCtx: Context<TTrigger, TActions, TVars>) => readonly NestedActionEntry[];
71
71
  }
72
72
  export interface ForkJoinConfig<TTrigger, TActions extends Record<string, unknown>, TVars extends Record<string, unknown> = NoVariables> {
@@ -25,6 +25,7 @@ export function switchAction(_ctx, config) {
25
25
  const defaultFilterMode = isPlainFn ? undefined : config.defaultActions.defaultFilterMode;
26
26
  operatorChildren.push({
27
27
  label: null,
28
+ isDefault: true,
28
29
  ...(defaultLabel !== undefined ? { defaultLabel } : {}),
29
30
  ...(defaultFilterMode !== undefined ? { defaultFilterMode } : {}),
30
31
  tasks: actionsFn(innerCtx),
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Map an executeScript task's `output_schema` (the platform's tagged
3
+ * `{ object: { properties: [{ bool: { name } }, ...] } }` shape) to the
4
+ * workflow field type each declared property resolves to.
5
+ *
6
+ * Used by `to-tf.ts` (forward: building the `elementum_workflow_publish`
7
+ * outputs' `fieldType` envelope) and `build.ts` (authoring-time: stamping
8
+ * `OutputPropertyRef.valueType` on the catalog ref) — kept dependency-free
9
+ * like `output-key-wire-name.ts` so importing it from either side can never
10
+ * introduce a cycle.
11
+ */
12
+ /** Map executeScript output_schema properties to refs keys (`result.<name>`). */
13
+ export declare function outputFieldTypesFromScriptSchema(schema: unknown): Map<string, {
14
+ fieldType: string;
15
+ multiple: boolean;
16
+ kind: string;
17
+ }> | undefined;
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Map an executeScript task's `output_schema` (the platform's tagged
3
+ * `{ object: { properties: [{ bool: { name } }, ...] } }` shape) to the
4
+ * workflow field type each declared property resolves to.
5
+ *
6
+ * Used by `to-tf.ts` (forward: building the `elementum_workflow_publish`
7
+ * outputs' `fieldType` envelope) and `build.ts` (authoring-time: stamping
8
+ * `OutputPropertyRef.valueType` on the catalog ref) — kept dependency-free
9
+ * like `output-key-wire-name.ts` so importing it from either side can never
10
+ * introduce a cycle.
11
+ */
12
+ function isObject(value) {
13
+ return value !== null && typeof value === "object" && !Array.isArray(value);
14
+ }
15
+ /** Map executeScript output_schema properties to refs keys (`result.<name>`). */
16
+ export function outputFieldTypesFromScriptSchema(schema) {
17
+ if (!isObject(schema))
18
+ return undefined;
19
+ const objectNode = isObject(schema.object) ? schema.object : schema;
20
+ const properties = objectNode.properties;
21
+ if (!Array.isArray(properties))
22
+ return undefined;
23
+ const out = new Map();
24
+ for (const property of properties) {
25
+ if (!isObject(property))
26
+ continue;
27
+ for (const [kind, body] of Object.entries(property)) {
28
+ if (!isObject(body) || typeof body.name !== "string")
29
+ continue;
30
+ const fieldType = kind === "bool" ? "BOOLEAN"
31
+ // Platform publish/ref envelopes use NUMBER for whole numbers, not INTEGER
32
+ // (Sanofi demoClassifyHacat: authored "integer" → state fieldType NUMBER).
33
+ : kind === "integer" ? "NUMBER"
34
+ : kind === "number" ? "DECIMAL"
35
+ // "string" is a real, confirmed-text kind; anything else (e.g. "object")
36
+ // is an unmodeled schema kind falling back to the platform's own TEXT
37
+ // default — real for the wire, but callers that need to know whether
38
+ // this was an ACTUAL text kind (not a guess) should check `kind` too.
39
+ : "TEXT";
40
+ out.set(`result.${body.name}`, { fieldType, multiple: false, kind });
41
+ out.set(body.name, { fieldType, multiple: false, kind });
42
+ }
43
+ }
44
+ return out.size > 0 ? out : undefined;
45
+ }
@@ -17,3 +17,11 @@
17
17
  * either side can never introduce a cycle.
18
18
  */
19
19
  export declare const OUTPUT_KEY_WIRE_NAME: Readonly<Record<string, string>>;
20
+ /**
21
+ * apiRequest task outputs in authoring use camelCase segments (`statusCode`,
22
+ * `file.content`, …) but the provider refs map uses display labels — confirmed
23
+ * live on Sanofi saveAttachment (FILE) and Deloitte demoapptwo (CUSTOM).
24
+ */
25
+ export declare const API_TASK_REF_WIRE_NAMES: Readonly<Record<string, string>>;
26
+ /** Inverse of {@link API_TASK_REF_WIRE_NAMES} for export jsonencode envelopes. */
27
+ export declare const API_TASK_REF_AUTHORING_NAMES: Readonly<Record<string, string>>;
@@ -22,3 +22,19 @@ export const OUTPUT_KEY_WIRE_NAME = {
22
22
  aiClassify: "Response",
23
23
  documentModel: "text",
24
24
  };
25
+ /**
26
+ * apiRequest task outputs in authoring use camelCase segments (`statusCode`,
27
+ * `file.content`, …) but the provider refs map uses display labels — confirmed
28
+ * live on Sanofi saveAttachment (FILE) and Deloitte demoapptwo (CUSTOM).
29
+ */
30
+ export const API_TASK_REF_WIRE_NAMES = {
31
+ statusCode: "API Response Status Code",
32
+ textResponse: "API Response (text)",
33
+ response: "Response",
34
+ file: "File",
35
+ "file.content": "Content",
36
+ "file.contentType": "Content Type",
37
+ "file.name": "Name",
38
+ };
39
+ /** Inverse of {@link API_TASK_REF_WIRE_NAMES} for export jsonencode envelopes. */
40
+ export const API_TASK_REF_AUTHORING_NAMES = Object.fromEntries(Object.entries(API_TASK_REF_WIRE_NAMES).map(([authoring, wire]) => [wire, authoring]));
@@ -211,6 +211,59 @@ function skipNonCode(src, i) {
211
211
  }
212
212
  return i;
213
213
  }
214
+ /**
215
+ * Characters a `/` may follow and still begin a regex literal rather than a
216
+ * division. After an identifier, number, `)` or `]` — or a closing quote — the
217
+ * slash divides.
218
+ */
219
+ const REGEX_MAY_START_AFTER = /[({[=,:;!?&|+\-*%^~<>]/;
220
+ /**
221
+ * True when the `/` at `i` opens a regex literal, judged by the nearest
222
+ * preceding significant character. Looks BACKWARD so the balancing scans below
223
+ * need not each thread a "previous token" through their branches; it reaches
224
+ * the same verdicts as {@link maskNonCodeForIdentifierScan}'s forward state.
225
+ */
226
+ function startsRegexLiteralAt(src, i) {
227
+ let k = i - 1;
228
+ while (k >= 0 && /\s/.test(src[k]))
229
+ k -= 1;
230
+ const previous = src[k];
231
+ return previous === undefined || REGEX_MAY_START_AFTER.test(previous);
232
+ }
233
+ /**
234
+ * Skip a regex literal starting at `src[i] === "/"`; returns the index just
235
+ * past its closing delimiter and flags.
236
+ *
237
+ * Every delimiter inside is pattern text, not code, so the balancing scans
238
+ * must not count it: a pulled body's `.replace(/\([^)]*\)/g, " ")` reads as
239
+ * `(`, `[`, `)`, `]`, `)` and left the `.executeScript(...)` call looking
240
+ * unbalanced — the byte-exact extraction then either missed the call entirely
241
+ * or ran past the function's closing brace and swallowed the following
242
+ * options (live: Sanofi getSuppliers_1's "Shape Final Output").
243
+ */
244
+ function skipRegexLiteral(src, i) {
245
+ let j = i + 1;
246
+ let inClass = false;
247
+ while (j < src.length) {
248
+ const c = src[j];
249
+ if (c === "\\") {
250
+ j += 2;
251
+ continue;
252
+ }
253
+ if (c === "[")
254
+ inClass = true;
255
+ else if (c === "]")
256
+ inClass = false;
257
+ else if (c === "/" && !inClass) {
258
+ j += 1;
259
+ while (/[A-Za-z]/.test(src[j] ?? ""))
260
+ j += 1;
261
+ return j;
262
+ }
263
+ j += 1;
264
+ }
265
+ return j;
266
+ }
214
267
  /** Skip a string/template starting at `i` (which must be a quote char); returns the index after it. */
215
268
  function skipString(src, i) {
216
269
  const quote = src[i];
@@ -346,15 +399,17 @@ function dedent(body) {
346
399
  export function freeIdentifiers(body, params) {
347
400
  const stripped = maskNonCodeForIdentifierScan(body);
348
401
  const declared = new Set(params);
349
- // const/let/var declarations, incl. destructuring lists; function/class names.
350
- for (const m of stripped.matchAll(/\b(?:const|let|var)\s+([^=;]+)/g)) {
402
+ collectLexicalDeclarations(stripped, declared);
403
+ // catch (e) / for (const x of ...) already covered by const/let/var; arrow params inside:
404
+ for (const m of stripped.matchAll(/\(([^)]*)\)\s*=>/g)) {
351
405
  for (const id of (m[1] ?? "").matchAll(/[A-Za-z_$][\w$]*/g))
352
406
  declared.add(id[0]);
353
407
  }
408
+ // function / class names AND their formal parameters (nested helpers in
409
+ // pulled scripts are common — Sanofi getSuppliers_1's levenshtein helpers).
354
410
  for (const m of stripped.matchAll(/\b(?:function|class)\s+([A-Za-z_$][\w$]*)/g))
355
411
  declared.add(m[1]);
356
- // catch (e) / for (const x of ...) already covered by const/let/var; arrow params inside:
357
- for (const m of stripped.matchAll(/\(([^)]*)\)\s*=>/g)) {
412
+ for (const m of stripped.matchAll(/\bfunction(?:\s+[A-Za-z_$][\w$]*)?\s*\(([^)]*)\)/g)) {
358
413
  for (const id of (m[1] ?? "").matchAll(/[A-Za-z_$][\w$]*/g))
359
414
  declared.add(id[0]);
360
415
  }
@@ -379,6 +434,77 @@ export function freeIdentifiers(body, params) {
379
434
  }
380
435
  return [...unknown].sort();
381
436
  }
437
+ /**
438
+ * Collect binding names from `const`/`let`/`var` statements, including every
439
+ * declarator in a comma list (`var prev = [], cur = [], i, j`). The previous
440
+ * `[^=;]+` regex stopped at the first `=` and only recorded the leading
441
+ * name — false-positive "closure captures" on every later declarator.
442
+ *
443
+ * Initializers can contain commas (arrays, calls, objects), so this walks
444
+ * depth-aware from the keyword to the terminating `;` (or EOF).
445
+ */
446
+ function collectLexicalDeclarations(source, declared) {
447
+ const keywordRe = /\b(?:const|let|var)\b/g;
448
+ let km;
449
+ while ((km = keywordRe.exec(source)) !== null) {
450
+ let i = km.index + km[0].length;
451
+ while (i < source.length) {
452
+ while (i < source.length && /\s/.test(source[i]))
453
+ i += 1;
454
+ if (i >= source.length || source[i] === ";")
455
+ break;
456
+ // Binding pattern: identifier, or a destructuring list whose identifiers
457
+ // we collect wholesale (same best-effort as before).
458
+ if (source[i] === "{" || source[i] === "[") {
459
+ const open = source[i];
460
+ const close = open === "{" ? "}" : "]";
461
+ let depth = 1;
462
+ const start = i;
463
+ i += 1;
464
+ while (i < source.length && depth > 0) {
465
+ const c = source[i];
466
+ if (c === open)
467
+ depth += 1;
468
+ else if (c === close)
469
+ depth -= 1;
470
+ i += 1;
471
+ }
472
+ for (const id of source.slice(start, i).matchAll(/[A-Za-z_$][\w$]*/g))
473
+ declared.add(id[0]);
474
+ }
475
+ else {
476
+ const m = /^[A-Za-z_$][\w$]*/.exec(source.slice(i));
477
+ if (m === null)
478
+ break;
479
+ declared.add(m[0]);
480
+ i += m[0].length;
481
+ }
482
+ while (i < source.length && /\s/.test(source[i]))
483
+ i += 1;
484
+ if (source[i] === "=") {
485
+ i += 1;
486
+ let depth = 0;
487
+ while (i < source.length) {
488
+ const c = source[i];
489
+ if (c === "(" || c === "[" || c === "{")
490
+ depth += 1;
491
+ else if (c === ")" || c === "]" || c === "}")
492
+ depth -= 1;
493
+ else if ((c === "," || c === ";") && depth <= 0)
494
+ break;
495
+ i += 1;
496
+ }
497
+ }
498
+ while (i < source.length && /\s/.test(source[i]))
499
+ i += 1;
500
+ if (source[i] === ",") {
501
+ i += 1;
502
+ continue;
503
+ }
504
+ break; // `;` or unexpected — end of this declaration statement
505
+ }
506
+ }
507
+ }
382
508
  /**
383
509
  * Replace comments, strings, template literals, and regex literals with
384
510
  * spaces while preserving line breaks and character offsets. A regex-only
@@ -397,7 +523,6 @@ function maskNonCodeForIdentifierScan(source) {
397
523
  if (chars[i] !== "\n" && chars[i] !== "\r")
398
524
  chars[i] = " ";
399
525
  };
400
- const canStartRegexAfter = /[({[=,:;!?&|+\-*%^~<>]/;
401
526
  let i = 0;
402
527
  let previousSignificant = "";
403
528
  while (i < source.length) {
@@ -442,27 +567,10 @@ function maskNonCodeForIdentifierScan(source) {
442
567
  previousSignificant = '"';
443
568
  continue;
444
569
  }
445
- const regexContext = previousSignificant === "" || canStartRegexAfter.test(previousSignificant);
570
+ const regexContext = previousSignificant === "" || REGEX_MAY_START_AFTER.test(previousSignificant);
446
571
  if (c === "/" && next !== "/" && next !== "*" && regexContext) {
447
- const start = i++;
448
- let inClass = false;
449
- while (i < source.length) {
450
- if (source[i] === "\\") {
451
- i += 2;
452
- continue;
453
- }
454
- if (source[i] === "[")
455
- inClass = true;
456
- else if (source[i] === "]")
457
- inClass = false;
458
- else if (source[i] === "/" && !inClass) {
459
- i += 1;
460
- while (/[A-Za-z]/.test(source[i] ?? ""))
461
- i += 1;
462
- break;
463
- }
464
- i += 1;
465
- }
572
+ const start = i;
573
+ i = skipRegexLiteral(source, i);
466
574
  mask(start, i);
467
575
  previousSignificant = "/";
468
576
  continue;
@@ -520,6 +628,10 @@ function scanExecuteScriptBodies(src) {
520
628
  i = skipString(src, i);
521
629
  continue;
522
630
  }
631
+ if (c === "/" && startsRegexLiteralAt(src, i)) {
632
+ i = skipRegexLiteral(src, i);
633
+ continue;
634
+ }
523
635
  if (isIdentifierBoundaryMatch(src, i, "executeScript")) {
524
636
  const openParen = skipWs(src, i + "executeScript".length);
525
637
  if (src[openParen] === "(") {
@@ -561,6 +673,10 @@ function scanCallArgs(src, open) {
561
673
  i = skipString(src, i);
562
674
  continue;
563
675
  }
676
+ if (c === "/" && startsRegexLiteralAt(src, i)) {
677
+ i = skipRegexLiteral(src, i);
678
+ continue;
679
+ }
564
680
  if (c === "(" || c === "[" || c === "{") {
565
681
  depth += 1;
566
682
  i += 1;
@@ -617,6 +733,10 @@ function extractCodeBody(optsText) {
617
733
  i = skipString(optsText, i);
618
734
  continue;
619
735
  }
736
+ if (c === "/" && startsRegexLiteralAt(optsText, i)) {
737
+ i = skipRegexLiteral(optsText, i);
738
+ continue;
739
+ }
620
740
  if (c === "{" || c === "(" || c === "[") {
621
741
  depth += 1;
622
742
  i += 1;
@@ -658,6 +778,10 @@ function extractFunctionBlockBodyAt(text, start) {
658
778
  i = skipString(text, i);
659
779
  continue;
660
780
  }
781
+ if (c === "/" && startsRegexLiteralAt(text, i)) {
782
+ i = skipRegexLiteral(text, i);
783
+ continue;
784
+ }
661
785
  if (text.startsWith("=>", i)) {
662
786
  sawArrow = true;
663
787
  const bodyStart = skipWs(text, i + 2);
@@ -696,6 +820,10 @@ function extractFunctionBlockBodyAt(text, start) {
696
820
  k = skipString(text, k);
697
821
  continue;
698
822
  }
823
+ if (cc === "/" && startsRegexLiteralAt(text, k)) {
824
+ k = skipRegexLiteral(text, k);
825
+ continue;
826
+ }
699
827
  if (cc === "{")
700
828
  blockDepth += 1;
701
829
  else if (cc === "}")
@@ -11,12 +11,13 @@
11
11
  * accept a literal or a `ctx` `Ref` and are pre-serialized to the platform's
12
12
  * `ValueReference` JSON via the shared, agnostic `serializeValueOrRef`.
13
13
  */
14
- import type { AgentRef, AppOrElementRef, AutomationRef, CloudLinkRef, ConnectorRef, DocumentModelFieldRef, FieldRef, FileReaderCatalogRef, PhoneServiceRef, SearchTableRef, TableRef } from "../../catalog/index.js";
14
+ import type { AgentRef, AppOrElementRef, ApprovalProcessRef, AutomationCatalogRef, CloudLinkRef, ConnectorRef, DocumentModelFieldRef, FieldRef, FileReaderCatalogRef, OutputPropertyRef, PhoneServiceRef, SearchTableRef, TableRef } from "../../catalog/index.js";
15
15
  import type { UnsafePlatformId } from "../../core/platform-id.js";
16
16
  import type { CalculationInclude, Expr, ExprCardinality, ExprContext, ExprType } from "../field/calc/types.js";
17
17
  import type { RecordId, RecordShape } from "../field/record-shape.js";
18
18
  import type { RoleUserRef } from "../role/build.js";
19
19
  import type { Ref, ValueOrRef } from "../shared/ref.js";
20
+ import type { DropdownValue } from "../shared/types/platform.js";
20
21
  import type { ActionDef } from "./build.js";
21
22
  import { type CalculationValue } from "./calculation-expression.js";
22
23
  import type { Filter } from "./filter.js";
@@ -30,11 +31,32 @@ export type { RecordId };
30
31
  */
31
32
  export type RecordReference<A extends AppOrElementRef = AppOrElementRef> = Ref<RecordShape<A>> | ValueOrRef<RecordId> | UnsafePlatformId;
32
33
  /** A field assignment: which field, and the value (literal or `ctx` ref). */
33
- export interface FieldAssignment {
34
+ export interface FieldAssignment<F extends FieldRef | UnsafePlatformId = FieldRef | UnsafePlatformId> {
34
35
  /** Prefer a typed catalog field; pulled source uses an explicit escape hatch when a non-recursive export only exposes the platform id. */
35
- readonly field: FieldRef | UnsafePlatformId;
36
+ readonly field: F;
36
37
  readonly value: ValueOrRef<unknown>;
37
38
  }
39
+ /** How an updateField assignment changes an existing Multi-Select value. */
40
+ export type MultiSelectUpdateMode = "replace" | "add";
41
+ type MultiSelectFieldRef = FieldRef<string, string, "MULTI_PICKLIST" | "MULTI_PICKLIST_ID">;
42
+ type IsAny<T> = 0 extends (1 & T) ? true : false;
43
+ type UpdateModeForField<F extends FieldRef | UnsafePlatformId> = [F] extends [MultiSelectFieldRef] ? {
44
+ readonly updateMode?: MultiSelectUpdateMode;
45
+ } : {
46
+ readonly updateMode?: never;
47
+ };
48
+ type UpdateValueForField<F extends FieldRef | UnsafePlatformId> = IsAny<F> extends true ? {
49
+ readonly value: ValueOrRef<unknown>;
50
+ } : [F] extends [MultiSelectFieldRef] ? {
51
+ readonly value: readonly string[] | Ref<readonly DropdownValue[], string>;
52
+ } : {
53
+ readonly value: ValueOrRef<unknown>;
54
+ };
55
+ /**
56
+ * A field assignment accepted by updateField. Multi-Select assignments can
57
+ * choose replace/add behavior; every other field rejects updateMode.
58
+ */
59
+ export type UpdateFieldAssignment<F extends FieldRef | UnsafePlatformId = FieldRef | UnsafePlatformId> = Omit<FieldAssignment<F>, "value"> & UpdateValueForField<F> & UpdateModeForField<F>;
38
60
  export interface RecordSearchOutput<A extends AppOrElementRef = AppOrElementRef> {
39
61
  readonly records: readonly RecordShape<A>[];
40
62
  readonly record: RecordShape<A>;
@@ -85,13 +107,16 @@ export interface CreateRecordOptions<A extends AppOrElementRef = AppOrElementRef
85
107
  readonly record?: RecordReference<A>;
86
108
  }
87
109
  export declare function createRecord<A extends AppOrElementRef>(opts: CreateRecordOptions<A>): ActionDef<CreateRecordOutput<A>>;
88
- export interface UpdateFieldOptions<A extends AppOrElementRef = AppOrElementRef> {
110
+ type ValidatedUpdateFieldAssignments<Fields extends readonly FieldAssignment[]> = {
111
+ readonly [Index in keyof Fields]: Fields[Index] extends FieldAssignment<infer F> ? Fields[Index] & UpdateValueForField<F> & UpdateModeForField<F> : never;
112
+ };
113
+ export interface UpdateFieldOptions<A extends AppOrElementRef = AppOrElementRef, Fields extends readonly FieldAssignment[] = readonly FieldAssignment[]> {
89
114
  readonly app: A;
90
115
  /** The record to update (e.g. `ctx.trigger.record` or `.record.recordId`). */
91
116
  readonly record: RecordReference<A>;
92
- readonly fields: readonly FieldAssignment[];
117
+ readonly fields: Fields & ValidatedUpdateFieldAssignments<NoInfer<Fields>>;
93
118
  }
94
- export declare function updateField<A extends AppOrElementRef>(opts: UpdateFieldOptions<A>): ActionDef<{
119
+ export declare function updateField<A extends AppOrElementRef, const Fields extends readonly FieldAssignment[]>(opts: UpdateFieldOptions<A, Fields>): ActionDef<{
95
120
  record: RecordShape<A>;
96
121
  }>;
97
122
  export interface FindRelatedRecordsOptions<A extends AppOrElementRef = AppOrElementRef> {
@@ -186,13 +211,39 @@ export interface SetVariableOptions {
186
211
  readonly update?: readonly VariableAssign[];
187
212
  }
188
213
  export declare function setVariable(opts: SetVariableOptions): ActionDef<Record<string, never>>;
189
- type ExecuteScriptFieldValue<T extends string> = Uppercase<T> extends "INTEGER" | "NUMBER" | "DECIMAL" ? number : Uppercase<T> extends "BOOLEAN" ? boolean : string;
190
- type ExecuteScriptOutput<O extends Record<string, string> | undefined> = {
191
- readonly result: O extends Record<string, string> ? {
192
- readonly [K in keyof O]: ExecuteScriptFieldValue<O[K]>;
214
+ /** An output schema's properties: output name → type. */
215
+ export type ScriptOutputProperties = Record<string, string>;
216
+ /**
217
+ * A script's declared outputs — either the properties alone, or those
218
+ * properties plus the root object's own `name`.
219
+ *
220
+ * The platform's schema node carries an optional `name` on every node,
221
+ * including the root. On a PROPERTY that name is the output's key (and so is
222
+ * the map key here); on the ROOT it is inert — refs are keyed `result.<prop>`
223
+ * whether or not it is set, and the GraphQL input documents the root as
224
+ * nameless. It is nonetheless real stored data on some tasks, so the schema
225
+ * a pull reads back has to survive a rebuild unchanged; a task whose root
226
+ * carries a name prints the second form.
227
+ *
228
+ * The two forms are distinguished by `properties` holding an object — every
229
+ * value in the flat form is a type string, so an output actually named
230
+ * `properties` or `name` stays unambiguous.
231
+ */
232
+ export type ScriptOutputs = ScriptOutputProperties | {
233
+ readonly name?: string;
234
+ readonly properties: ScriptOutputProperties;
235
+ };
236
+ type ExecuteScriptFieldValue<T extends string> = Uppercase<T> extends "INTEGER" | "NUMBER" | "DECIMAL" ? number : Uppercase<T> extends "BOOLEAN" ? boolean : Uppercase<T> extends "OBJECT" ? Record<string, unknown> : string;
237
+ /** The properties of an authored `outputs` option, in either accepted form. */
238
+ type ScriptOutputPropertiesOf<O> = O extends {
239
+ readonly properties: Record<string, string>;
240
+ } ? O["properties"] : O extends Record<string, string> ? O : undefined;
241
+ type ExecuteScriptOutput<O extends ScriptOutputs | undefined> = {
242
+ readonly result: ScriptOutputPropertiesOf<O> extends Record<string, string> ? {
243
+ readonly [K in keyof ScriptOutputPropertiesOf<O>]: ExecuteScriptFieldValue<Extract<ScriptOutputPropertiesOf<O>[K], string>>;
193
244
  } : Record<string, unknown>;
194
245
  };
195
- export interface ExecuteScriptOptions<O extends Record<string, string> | undefined = undefined> {
246
+ export interface ExecuteScriptOptions<O extends ScriptOutputs | undefined = undefined> {
196
247
  /**
197
248
  * A FUNCTION whose body ships as the platform script (v3):
198
249
  * `(input) => { const { X } = input.parameters; return { OUT: X }; }`.
@@ -206,7 +257,11 @@ export interface ExecuteScriptOptions<O extends Record<string, string> | undefin
206
257
  */
207
258
  readonly code: ScriptCodeFn<Record<string, unknown>, Record<string, unknown>>;
208
259
  readonly inputs?: Record<string, ValueOrRef<unknown>>;
209
- /** Output schema: property name → `"text" | "integer" | "number" | "decimal" | "boolean"`. */
260
+ /**
261
+ * Output schema: property name → `"text" | "integer" | "number" |
262
+ * "decimal" | "boolean" | "object"`, or `{ name, properties }` when the
263
+ * platform's root object carries a name (see {@link ScriptOutputs}).
264
+ */
210
265
  readonly outputs?: O;
211
266
  }
212
267
  /**
@@ -218,10 +273,10 @@ export interface ExecuteScriptOptions<O extends Record<string, string> | undefin
218
273
  * falling back to `extractScriptBody` only when there's no tracked source) —
219
274
  * so the body is computed exactly once, not re-derived by each layer.
220
275
  */
221
- export declare function executeScriptActionDefWithBody<O extends Record<string, string> | undefined = undefined>(body: string, opts: Pick<ExecuteScriptOptions<O>, "inputs" | "outputs">): ActionDef<ExecuteScriptOutput<O>> & {
276
+ export declare function executeScriptActionDefWithBody<O extends ScriptOutputs | undefined = undefined>(body: string, opts: Pick<ExecuteScriptOptions<O>, "inputs" | "outputs">): ActionDef<ExecuteScriptOutput<O>> & {
222
277
  readonly key: "executeScript";
223
278
  };
224
- export declare function executeScript<const O extends Record<string, string> | undefined = undefined>(opts: ExecuteScriptOptions<O>): ActionDef<ExecuteScriptOutput<O>> & {
279
+ export declare function executeScript<const O extends ScriptOutputs | undefined = undefined>(opts: ExecuteScriptOptions<O>): ActionDef<ExecuteScriptOutput<O>> & {
225
280
  readonly key: "executeScript";
226
281
  };
227
282
  export interface ApiRequestHeader {
@@ -432,8 +487,6 @@ export declare function assignGroup(opts: AssignGroupOptions): ActionDef<Empty>;
432
487
  export interface AddWatcherOptions {
433
488
  readonly userIds?: readonly string[];
434
489
  readonly groupIds?: readonly string[];
435
- readonly userRefs?: readonly ValueOrRef<unknown>[];
436
- readonly groupRefs?: readonly ValueOrRef<unknown>[];
437
490
  readonly record?: ValueOrRef<unknown>;
438
491
  }
439
492
  export declare function addWatcher(opts: AddWatcherOptions): ActionDef<Empty>;
@@ -583,21 +636,36 @@ export interface RunAutomationInput {
583
636
  readonly name: string;
584
637
  readonly value: ValueOrRef<unknown>;
585
638
  }
586
- export interface RunAutomationOptions {
587
- readonly automation: AutomationRef;
639
+ /**
640
+ * A workflow output's declared value type (the same domain
641
+ * `outputFieldTypesFromScriptSchema` computes for the wire) mapped to the
642
+ * real TS type it deserializes to. An unresolved/unknown `valueType` (the
643
+ * output's source wasn't a typed executeScript result) stays `unknown` —
644
+ * an honest "we don't know", never a wrong guess.
645
+ */
646
+ type WorkflowOutputValue<T extends string | undefined> = T extends "BOOLEAN" ? boolean : T extends "NUMBER" | "DECIMAL" ? number : T extends "TEXT" ? string : unknown;
647
+ /**
648
+ * A `runAutomation` step's result: flat, one property per key the target
649
+ * automation's `AutomationCatalogRef.outputs` declares — matches the real
650
+ * platform behavior (`refs["<output_name>"]` on the run_automation_task,
651
+ * confirmed live), not a nested `.output` wrapper.
652
+ */
653
+ export type RunAutomationOutput<A extends AutomationCatalogRef> = A["outputs"] extends Record<string, OutputPropertyRef> ? {
654
+ readonly [K in keyof A["outputs"]]: WorkflowOutputValue<A["outputs"][K]["valueType"]>;
655
+ } : Record<string, unknown>;
656
+ export interface RunAutomationOptions<A extends AutomationCatalogRef = AutomationCatalogRef> {
657
+ readonly automation: A;
588
658
  readonly synchronous?: boolean;
589
659
  /**
590
- * Input mappings by parameter **name**. v2 uses the platform's dynamic-mapping
591
- * path (name-resolved at runtime) — v1's static path resolves names to param
592
- * ids at build time, which v2 can't do (trigger params aren't catalog-modeled).
660
+ * Input mappings by parameter **name**. Build resolves each name through the
661
+ * target on-demand trigger's computed `parameter_ids` map, so authored source
662
+ * never carries a platform UUID.
593
663
  */
594
664
  readonly inputs?: readonly RunAutomationInput[];
595
665
  /** Output property names to surface. */
596
666
  readonly outputs?: readonly string[];
597
667
  }
598
- export declare function runAutomation(opts: RunAutomationOptions): ActionDef<{
599
- output: unknown;
600
- }>;
668
+ export declare function runAutomation<const A extends AutomationCatalogRef>(opts: RunAutomationOptions<A>): ActionDef<RunAutomationOutput<A>>;
601
669
  export type ReadFileDataSource = {
602
670
  readonly type: "attachmentId";
603
671
  readonly value: ValueOrRef<unknown>;
@@ -642,24 +710,19 @@ export declare function bulkExcel(opts: BulkExcelOptions): ActionDef<{
642
710
  output: unknown;
643
711
  }>;
644
712
  export interface ApprovalChainOptions {
645
- readonly approverIds?: readonly string[];
713
+ /** App-owned approval process to start. */
714
+ readonly approvalProcess: ApprovalProcessRef;
715
+ /** Record being submitted for approval. */
716
+ readonly record: RecordReference;
717
+ /** User requesting the approval. Use a USER_ID value reference. */
718
+ readonly requester: ValueOrRef<unknown>;
719
+ /** Optional dynamic approvers. Each entry must resolve to a USER_ID. */
646
720
  readonly approvers?: readonly ValueOrRef<unknown>[];
647
721
  readonly reason?: ValueOrRef<unknown>;
648
722
  readonly summary?: ValueOrRef<unknown>;
649
723
  }
650
724
  export declare function approvalChain(opts: ApprovalChainOptions): ActionDef<Empty>;
651
- export interface ApprovalChainTemplateOptions {
652
- /** Approval-chain template id (approval chains aren't catalog-modeled yet). */
653
- readonly approvalChainTemplateId: string;
654
- readonly requester: ValueOrRef<unknown>;
655
- readonly record: ValueOrRef<unknown>;
656
- readonly summary?: ValueOrRef<unknown>;
657
- readonly reason?: ValueOrRef<unknown>;
658
- readonly relatedRecord?: ValueOrRef<unknown>;
659
- readonly tags?: ValueOrRef<unknown>;
660
- /** Pre-built wire dynamic-approver entries. */
661
- readonly dynamicApprovers?: readonly Record<string, unknown>[];
662
- }
725
+ export type ApprovalChainTemplateOptions = ApprovalChainOptions;
663
726
  export declare function approvalChainTemplate(opts: ApprovalChainTemplateOptions): ActionDef<Empty>;
664
727
  export interface SendSurveyOptions {
665
728
  readonly record: ValueOrRef<unknown>;