@elementumai/edk 0.11.0 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (222) hide show
  1. package/README.md +40 -6
  2. package/dist-sdk/src/catalog/factories.d.ts +7 -1
  3. package/dist-sdk/src/catalog/factories.js +2 -0
  4. package/dist-sdk/src/catalog/index.d.ts +2 -2
  5. package/dist-sdk/src/catalog/index.js +1 -1
  6. package/dist-sdk/src/catalog/org.js +79 -34
  7. package/dist-sdk/src/catalog/token.js +5 -0
  8. package/dist-sdk/src/catalog/types.d.ts +7 -1
  9. package/dist-sdk/src/catalog/types.js +3 -0
  10. package/dist-sdk/src/core/system-fields.d.ts +1 -1
  11. package/dist-sdk/src/core/system-fields.js +1 -1
  12. package/dist-sdk/src/core/triggers/on-demand.d.ts +2 -0
  13. package/dist-sdk/src/core/triggers/on-demand.js +3 -0
  14. package/dist-sdk/src/core/types/app.d.ts +6 -0
  15. package/dist-sdk/src/engine/build/context.d.ts +3 -0
  16. package/dist-sdk/src/engine/coverage-gaps.d.ts +5 -0
  17. package/dist-sdk/src/engine/coverage-gaps.js +9 -0
  18. package/dist-sdk/src/engine/ei/run.d.ts +20 -1
  19. package/dist-sdk/src/engine/ei/run.js +102 -14
  20. package/dist-sdk/src/engine/pull/authored-address.js +42 -6
  21. package/dist-sdk/src/engine/pull/authored-root.d.ts +88 -0
  22. package/dist-sdk/src/engine/pull/authored-root.js +306 -0
  23. package/dist-sdk/src/engine/pull/context.d.ts +10 -0
  24. package/dist-sdk/src/engine/pull/field-refs-registry.d.ts +114 -0
  25. package/dist-sdk/src/engine/pull/field-refs-registry.js +501 -0
  26. package/dist-sdk/src/engine/pull/org.d.ts +1 -0
  27. package/dist-sdk/src/engine/pull/org.js +2 -0
  28. package/dist-sdk/src/engine/pull/partition.d.ts +8 -0
  29. package/dist-sdk/src/engine/pull/partition.js +43 -0
  30. package/dist-sdk/src/engine/pull/pulled-roots.d.ts +89 -0
  31. package/dist-sdk/src/engine/pull/pulled-roots.js +203 -0
  32. package/dist-sdk/src/engine/pull/ref-only.d.ts +22 -0
  33. package/dist-sdk/src/engine/pull/ref-only.js +59 -1
  34. package/dist-sdk/src/engine/pull/source-resources.d.ts +39 -0
  35. package/dist-sdk/src/engine/pull/source-resources.js +110 -0
  36. package/dist-sdk/src/engine/pull/stream-root.d.ts +148 -0
  37. package/dist-sdk/src/engine/pull/stream-root.js +563 -0
  38. package/dist-sdk/src/engine/workspace/reserved-catalog-keys.d.ts +47 -0
  39. package/dist-sdk/src/engine/workspace/reserved-catalog-keys.js +115 -0
  40. package/dist-sdk/src/entities/access-policy/build.d.ts +2 -1
  41. package/dist-sdk/src/entities/access-policy/from-tf.d.ts +9 -1
  42. package/dist-sdk/src/entities/access-policy/from-tf.js +25 -4
  43. package/dist-sdk/src/entities/access-policy/module.js +5 -0
  44. package/dist-sdk/src/entities/access-policy/to-tf.d.ts +19 -0
  45. package/dist-sdk/src/entities/access-policy/to-tf.js +65 -8
  46. package/dist-sdk/src/entities/agent/build.d.ts +52 -1
  47. package/dist-sdk/src/entities/agent/build.js +34 -0
  48. package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +68 -0
  49. package/dist-sdk/src/entities/agent/from-tf.d.ts +34 -1
  50. package/dist-sdk/src/entities/agent/from-tf.js +262 -2
  51. package/dist-sdk/src/entities/agent/index.d.ts +1 -1
  52. package/dist-sdk/src/entities/agent/to-tf.d.ts +8 -10
  53. package/dist-sdk/src/entities/agent/to-tf.js +158 -14
  54. package/dist-sdk/src/entities/agent-tool/from-tf.js +6 -0
  55. package/dist-sdk/src/entities/agent-tool/to-tf.d.ts +2 -2
  56. package/dist-sdk/src/entities/agent-tool/to-tf.js +2 -2
  57. package/dist-sdk/src/entities/app/build.d.ts +34 -14
  58. package/dist-sdk/src/entities/app/build.js +93 -16
  59. package/dist-sdk/src/entities/app/from-tf.js +25 -11
  60. package/dist-sdk/src/entities/app/index.d.ts +1 -0
  61. package/dist-sdk/src/entities/app/index.js +1 -0
  62. package/dist-sdk/src/entities/app/module.js +1 -0
  63. package/dist-sdk/src/entities/app/stage-keys.d.ts +20 -5
  64. package/dist-sdk/src/entities/app/stage-keys.js +43 -9
  65. package/dist-sdk/src/entities/app/to-tf.js +2 -0
  66. package/dist-sdk/src/entities/approval-chain/build.d.ts +46 -11
  67. package/dist-sdk/src/entities/approval-chain/build.js +120 -8
  68. package/dist-sdk/src/entities/approval-chain/from-tf.d.ts +24 -2
  69. package/dist-sdk/src/entities/approval-chain/from-tf.js +148 -6
  70. package/dist-sdk/src/entities/approval-chain/index.d.ts +4 -1
  71. package/dist-sdk/src/entities/approval-chain/index.js +4 -1
  72. package/dist-sdk/src/entities/approval-chain/module.js +23 -5
  73. package/dist-sdk/src/entities/approval-chain/printer.d.ts +1 -1
  74. package/dist-sdk/src/entities/approval-chain/printer.js +91 -5
  75. package/dist-sdk/src/entities/approval-chain/steps-tf.d.ts +77 -0
  76. package/dist-sdk/src/entities/approval-chain/steps-tf.js +255 -0
  77. package/dist-sdk/src/entities/approval-chain/steps.d.ts +71 -0
  78. package/dist-sdk/src/entities/approval-chain/steps.js +83 -0
  79. package/dist-sdk/src/entities/approval-chain/to-tf.d.ts +16 -6
  80. package/dist-sdk/src/entities/approval-chain/to-tf.js +37 -4
  81. package/dist-sdk/src/entities/automation/build.d.ts +50 -24
  82. package/dist-sdk/src/entities/automation/build.js +86 -33
  83. package/dist-sdk/src/entities/automation/deserializer/print-automation.js +52 -8
  84. package/dist-sdk/src/entities/automation/from-tf.d.ts +38 -6
  85. package/dist-sdk/src/entities/automation/from-tf.js +855 -157
  86. package/dist-sdk/src/entities/automation/index.d.ts +2 -1
  87. package/dist-sdk/src/entities/automation/index.js +1 -0
  88. package/dist-sdk/src/entities/automation/module.d.ts +4 -3
  89. package/dist-sdk/src/entities/automation/module.js +33 -12
  90. package/dist-sdk/src/entities/automation/refs-read.d.ts +19 -0
  91. package/dist-sdk/src/entities/automation/refs-read.js +48 -0
  92. package/dist-sdk/src/entities/automation/run-target.d.ts +2 -0
  93. package/dist-sdk/src/entities/automation/run-target.js +5 -0
  94. package/dist-sdk/src/entities/automation/script-code.d.ts +2 -1
  95. package/dist-sdk/src/entities/automation/script-code.js +82 -1
  96. package/dist-sdk/src/entities/automation/script-lint.d.ts +13 -0
  97. package/dist-sdk/src/entities/automation/script-lint.js +418 -0
  98. package/dist-sdk/src/entities/automation/slack-message-refs.d.ts +9 -0
  99. package/dist-sdk/src/entities/automation/slack-message-refs.js +75 -0
  100. package/dist-sdk/src/entities/automation/task-output-labels.d.ts +12 -1
  101. package/dist-sdk/src/entities/automation/task-output-labels.js +32 -1
  102. package/dist-sdk/src/entities/automation/tasks.d.ts +76 -18
  103. package/dist-sdk/src/entities/automation/tasks.js +52 -15
  104. package/dist-sdk/src/entities/automation/to-tf.d.ts +3 -0
  105. package/dist-sdk/src/entities/automation/to-tf.js +585 -97
  106. package/dist-sdk/src/entities/automation/triggers.d.ts +48 -23
  107. package/dist-sdk/src/entities/automation/triggers.js +27 -12
  108. package/dist-sdk/src/entities/automation/unsafe-script-output.d.ts +50 -0
  109. package/dist-sdk/src/entities/automation/unsafe-script-output.js +92 -0
  110. package/dist-sdk/src/entities/chart/build.d.ts +18 -2
  111. package/dist-sdk/src/entities/chart/from-tf.d.ts +2 -2
  112. package/dist-sdk/src/entities/chart/from-tf.js +28 -1
  113. package/dist-sdk/src/entities/chart/index.d.ts +1 -1
  114. package/dist-sdk/src/entities/chart/printer.js +5 -2
  115. package/dist-sdk/src/entities/chart/to-tf.js +38 -3
  116. package/dist-sdk/src/entities/dynamic-layout/build.d.ts +3 -0
  117. package/dist-sdk/src/entities/dynamic-layout/condition-keys.d.ts +48 -0
  118. package/dist-sdk/src/entities/dynamic-layout/condition-keys.js +261 -0
  119. package/dist-sdk/src/entities/dynamic-layout/from-tf.js +45 -6
  120. package/dist-sdk/src/entities/dynamic-layout/module.js +2 -1
  121. package/dist-sdk/src/entities/dynamic-layout/to-tf.js +46 -12
  122. package/dist-sdk/src/entities/element/audit-field-guard.d.ts +9 -0
  123. package/dist-sdk/src/entities/element/audit-field-guard.js +88 -0
  124. package/dist-sdk/src/entities/element/build.js +2 -1
  125. package/dist-sdk/src/entities/element/from-tf.js +15 -2
  126. package/dist-sdk/src/entities/element/module.js +3 -0
  127. package/dist-sdk/src/entities/element/system-fields.d.ts +13 -0
  128. package/dist-sdk/src/entities/element/system-fields.js +23 -0
  129. package/dist-sdk/src/entities/element/to-tf.js +2 -0
  130. package/dist-sdk/src/entities/field/build.d.ts +9 -0
  131. package/dist-sdk/src/entities/field/from-tf.d.ts +29 -1
  132. package/dist-sdk/src/entities/field/from-tf.js +99 -6
  133. package/dist-sdk/src/entities/field/module.js +12 -2
  134. package/dist-sdk/src/entities/field/to-tf.d.ts +13 -3
  135. package/dist-sdk/src/entities/field/to-tf.js +90 -46
  136. package/dist-sdk/src/entities/org/category.js +1 -0
  137. package/dist-sdk/src/entities/org/index.d.ts +1 -0
  138. package/dist-sdk/src/entities/org/index.js +1 -0
  139. package/dist-sdk/src/entities/org/role.js +5 -0
  140. package/dist-sdk/src/entities/org/voice-auth.d.ts +5 -0
  141. package/dist-sdk/src/entities/org/voice-auth.js +33 -0
  142. package/dist-sdk/src/entities/organization/build.d.ts +3 -0
  143. package/dist-sdk/src/entities/organization/build.js +2 -0
  144. package/dist-sdk/src/entities/organization/index.d.ts +1 -0
  145. package/dist-sdk/src/entities/organization/index.js +1 -0
  146. package/dist-sdk/src/entities/organization/to-tf.d.ts +2 -0
  147. package/dist-sdk/src/entities/organization/to-tf.js +59 -1
  148. package/dist-sdk/src/entities/organization/voice-auth.d.ts +60 -0
  149. package/dist-sdk/src/entities/organization/voice-auth.js +60 -0
  150. package/dist-sdk/src/entities/phone-service/build.d.ts +9 -1
  151. package/dist-sdk/src/entities/phone-service/build.js +1 -0
  152. package/dist-sdk/src/entities/phone-service/deserializer/print-phone-service.js +3 -0
  153. package/dist-sdk/src/entities/phone-service/from-tf.d.ts +1 -0
  154. package/dist-sdk/src/entities/phone-service/from-tf.js +8 -1
  155. package/dist-sdk/src/entities/phone-service/to-tf.js +16 -0
  156. package/dist-sdk/src/entities/record-create-form/from-tf.js +2 -2
  157. package/dist-sdk/src/entities/relationship/from-tf.js +7 -2
  158. package/dist-sdk/src/entities/relationship/module.js +2 -2
  159. package/dist-sdk/src/entities/relationship/pair-check.d.ts +6 -2
  160. package/dist-sdk/src/entities/relationship/pair-check.js +105 -18
  161. package/dist-sdk/src/entities/relationship/to-tf.js +5 -2
  162. package/dist-sdk/src/entities/role/permission-levels.d.ts +7 -0
  163. package/dist-sdk/src/entities/role/permission-levels.js +78 -0
  164. package/dist-sdk/src/entities/role/to-tf.js +32 -2
  165. package/dist-sdk/src/entities/service-account/module.d.ts +2 -1
  166. package/dist-sdk/src/entities/service-account/module.js +9 -1
  167. package/dist-sdk/src/entities/service-account/resource-type.d.ts +2 -0
  168. package/dist-sdk/src/entities/service-account/resource-type.js +2 -0
  169. package/dist-sdk/src/entities/service-account/role-fidelity.d.ts +5 -5
  170. package/dist-sdk/src/entities/service-account/role-fidelity.js +21 -13
  171. package/dist-sdk/src/entities/service-account/role-membership-check.d.ts +20 -0
  172. package/dist-sdk/src/entities/service-account/role-membership-check.js +80 -0
  173. package/dist-sdk/src/entities/shared/aspect-target-from-tf.d.ts +15 -0
  174. package/dist-sdk/src/entities/shared/aspect-target-from-tf.js +36 -0
  175. package/dist-sdk/src/entities/shared/filters/ast.d.ts +4 -0
  176. package/dist-sdk/src/entities/shared/filters/index.d.ts +85 -14
  177. package/dist-sdk/src/entities/shared/filters/index.js +18 -6
  178. package/dist-sdk/src/entities/shared/filters/option-lookups.d.ts +57 -0
  179. package/dist-sdk/src/entities/shared/filters/option-lookups.js +108 -0
  180. package/dist-sdk/src/entities/shared/filters/print.js +9 -5
  181. package/dist-sdk/src/entities/shared/filters/tf-codec.d.ts +12 -7
  182. package/dist-sdk/src/entities/shared/filters/tf-codec.js +9 -5
  183. package/dist-sdk/src/entities/shared/raw-option-id.d.ts +30 -0
  184. package/dist-sdk/src/entities/shared/raw-option-id.js +41 -0
  185. package/dist-sdk/src/entities/shared/tool-field-ref.js +6 -2
  186. package/dist-sdk/src/entities/shared/types/field-types.d.ts +6 -3
  187. package/dist-sdk/src/entities/shared/types/field-types.js +3 -1
  188. package/dist-sdk/src/entities/skill/input-coverage.js +5 -2
  189. package/dist-sdk/src/entities/skill/module.js +2 -0
  190. package/dist-sdk/src/entities/sla/build.d.ts +96 -0
  191. package/dist-sdk/src/entities/sla/build.js +124 -0
  192. package/dist-sdk/src/entities/sla/from-tf.d.ts +40 -0
  193. package/dist-sdk/src/entities/sla/from-tf.js +164 -0
  194. package/dist-sdk/src/entities/sla/index.d.ts +1 -0
  195. package/dist-sdk/src/entities/sla/index.js +1 -0
  196. package/dist-sdk/src/entities/sla/module.d.ts +4 -0
  197. package/dist-sdk/src/entities/sla/module.js +73 -0
  198. package/dist-sdk/src/entities/sla/printer.d.ts +2 -0
  199. package/dist-sdk/src/entities/sla/printer.js +84 -0
  200. package/dist-sdk/src/entities/sla/to-tf.d.ts +12 -0
  201. package/dist-sdk/src/entities/sla/to-tf.js +81 -0
  202. package/dist-sdk/src/entities/table/build.d.ts +7 -2
  203. package/dist-sdk/src/entities/table/build.js +22 -1
  204. package/dist-sdk/src/entities/table/deserializer/normalize.d.ts +4 -1
  205. package/dist-sdk/src/entities/table/from-tf.js +89 -14
  206. package/dist-sdk/src/entities/table/index.d.ts +1 -1
  207. package/dist-sdk/src/entities/table/to-tf.js +41 -2
  208. package/dist-sdk/src/entities/task/from-tf.js +2 -1
  209. package/dist-sdk/src/entities/task/to-tf.js +1 -0
  210. package/dist-sdk/src/entities/view/from-tf.d.ts +8 -4
  211. package/dist-sdk/src/entities/view/from-tf.js +10 -9
  212. package/dist-sdk/src/entities/view/module.js +5 -0
  213. package/dist-sdk/src/entities/widget/from-tf.js +15 -4
  214. package/dist-sdk/src/generated/ragnarok/ragnarok-spec.d.ts +51 -4
  215. package/dist-sdk/src/generated/ragnarok/ragnarok-spec.js +2 -2
  216. package/dist-sdk/src/graph/index.d.ts +20 -2
  217. package/dist-sdk/src/graph/index.js +19 -0
  218. package/dist-sdk/src/graph/modules.js +11 -1
  219. package/dist-sdk/src/graph/resource-types.d.ts +47 -0
  220. package/dist-sdk/src/graph/resource-types.js +62 -0
  221. package/dist-sdk/src/graph/types.d.ts +116 -6
  222. package/package.json +6 -3
@@ -20,6 +20,7 @@ import { type Ref, type ValueOrRef } from "../shared/ref.js";
20
20
  import type { DropdownValue } from "../shared/types/platform.js";
21
21
  import type { ActionDef } from "./build.js";
22
22
  import { type CalculationValue } from "./calculation-expression.js";
23
+ import type { TextOptionValue } from "../shared/filters/index.js";
23
24
  import type { Filter } from "./filter.js";
24
25
  import { type ScriptCodeFn, type ScriptFile } from "./script-code.js";
25
26
  export type { CalculationInclude } from "../field/calc/types.js";
@@ -48,7 +49,7 @@ type UpdateModeForField<F extends FieldRef | UnsafePlatformId> = [F] extends [Mu
48
49
  type UpdateValueForField<F extends FieldRef | UnsafePlatformId> = IsAny<F> extends true ? {
49
50
  readonly value: ValueOrRef<unknown>;
50
51
  } : [F] extends [MultiSelectFieldRef] ? {
51
- readonly value: readonly string[] | Ref<readonly string[], string> | Ref<readonly DropdownValue[], string>;
52
+ readonly value: readonly (TextOptionValue | string)[] | Ref<readonly string[], string> | Ref<readonly DropdownValue[], string>;
52
53
  } : {
53
54
  readonly value: ValueOrRef<unknown>;
54
55
  };
@@ -67,6 +68,7 @@ export interface RecordSearchOptions<A extends AppOrElementOrTaskRef = AppOrElem
67
68
  /** Required — the platform rejects a record search with no filter (use `filter.whereTrue()` for all). */
68
69
  readonly filter: Filter;
69
70
  readonly sort?: Record<string, unknown>;
71
+ /** Integer from 1 to 500. Compare totalCount with returned records before treating a search as complete. */
70
72
  readonly limit?: number;
71
73
  }
72
74
  export declare function recordSearch<A extends AppOrElementOrTaskRef>(opts: RecordSearchOptions<A>): ActionDef<RecordSearchOutput<A>>;
@@ -116,8 +118,11 @@ type ValidatedUpdateFieldAssignments<Fields extends readonly FieldAssignment[]>
116
118
  };
117
119
  export interface UpdateFieldOptions<A extends AppOrElementOrTaskRef = AppOrElementOrTaskRef, Fields extends readonly FieldAssignment[] = readonly FieldAssignment[]> {
118
120
  readonly app: A;
119
- /** The record to update (e.g. `ctx.trigger.record` or `.record.recordId`). */
120
- readonly record: RecordReference<A>;
121
+ /**
122
+ * The record to update (e.g. `ctx.trigger.record` or `.record.recordId`),
123
+ * or every record a search found (`ctx.actions.<search>.records`).
124
+ */
125
+ readonly record: RecordReference<A> | Ref<readonly RecordShape<A>[]>;
121
126
  readonly fields: Fields & ValidatedUpdateFieldAssignments<NoInfer<Fields>>;
122
127
  }
123
128
  /** Update fields on an existing record. `value: ""` or `value: null` clears a nullable field (including Dropdown). */
@@ -168,11 +173,23 @@ export interface RelateRecordsOptions {
168
173
  readonly target: ValueOrRef<unknown>;
169
174
  }
170
175
  export declare function relateRecords(opts: RelateRecordsOptions): ActionDef<Record<string, never>>;
171
- /** An email attachment: a literal/ref file value, or an existing record's attachment field to reuse. */
176
+ /**
177
+ * A file to attach to the email. Set exactly one key: `attachment` is an
178
+ * attachment field, `file` is a file from the trigger or an earlier task, and
179
+ * `record` attaches every file on a record.
180
+ */
172
181
  export type EmailAttachment = {
182
+ readonly attachment: ValueOrRef<unknown>;
183
+ readonly file?: never;
184
+ readonly record?: never;
185
+ } | {
173
186
  readonly file: ValueOrRef<unknown>;
187
+ readonly attachment?: never;
188
+ readonly record?: never;
174
189
  } | {
175
- readonly fromRecord: ValueOrRef<unknown>;
190
+ readonly record: ValueOrRef<unknown>;
191
+ readonly attachment?: never;
192
+ readonly file?: never;
176
193
  };
177
194
  export interface SendEmailOptions {
178
195
  readonly subject: ValueOrRef<unknown>;
@@ -185,12 +202,19 @@ export interface SendEmailOptions {
185
202
  readonly toGroups?: readonly ValueOrRef<unknown>[];
186
203
  /** Literal email addresses. */
187
204
  readonly toAddresses?: readonly ValueOrRef<unknown>[];
205
+ /** Files to attach. Omit to leave the live attachments as they are; `[]` removes them. */
188
206
  readonly attachments?: readonly EmailAttachment[];
207
+ /**
208
+ * The platform id of a DNS-verified sending domain. Omit to keep the live
209
+ * task's domain, including one chosen in the web app; omitting it does not
210
+ * reset the task to the default domain.
211
+ */
212
+ readonly emailSendDomainId?: string;
189
213
  }
190
214
  export declare function sendEmail(opts: SendEmailOptions): ActionDef<Record<string, never>>;
191
215
  export interface PostCommentOptions {
192
216
  readonly contents: ValueOrRef<unknown>;
193
- /** Conversation tags. Omit for an untagged comment — the provider's message task has no tags of its own. */
217
+ /** Channel (Select Channel): omit or `["public"]` for the Public Channel; `["consumer"]` for the Customer Channel (needs customer chat on the app's record comments). */
194
218
  readonly tags?: readonly string[];
195
219
  /** The record to comment on (required). */
196
220
  readonly record: ValueOrRef<unknown>;
@@ -316,12 +340,13 @@ type ExecuteScriptFieldValue<T extends ScriptOutputType> = T extends {
316
340
  readonly [K in keyof P]: ExecuteScriptFieldValue<P[K]>;
317
341
  } : T extends {
318
342
  readonly type: "object";
319
- } ? Record<string, unknown> : T extends "integer" | "number" | "decimal" ? number : T extends "boolean" ? boolean : string;
343
+ } | "object" ? Record<string, unknown> : T extends "integer" | "number" | "decimal" ? number : T extends "boolean" ? boolean : string;
320
344
  /** The properties of an authored `outputs` option, in either accepted form. */
321
345
  type ScriptOutputPropertiesOf<O> = O extends {
322
346
  readonly properties: ScriptOutputProperties;
323
347
  } ? O["properties"] : O extends ScriptOutputProperties ? O : undefined;
324
- type ExecuteScriptOutput<O extends ScriptOutputs | undefined> = {
348
+ /** Result shape for an executeScript whose `outputs` option is `O`. */
349
+ export type ExecuteScriptOutput<O extends ScriptOutputs | undefined> = {
325
350
  readonly result: ScriptOutputPropertiesOf<O> extends ScriptOutputProperties ? {
326
351
  readonly [K in keyof ScriptOutputPropertiesOf<O>]: ExecuteScriptFieldValue<Extract<ScriptOutputPropertiesOf<O>[K], ScriptOutputType>>;
327
352
  } : Record<string, unknown>;
@@ -354,9 +379,12 @@ export interface ExecuteScriptListInputToken {
354
379
  * can read - which fields, and under what alias. The value is a whole record
355
380
  * or a list of records (a prior task's `.records`, read per item).
356
381
  *
357
- * Inside this wrapper these deploy the whole record: a record trigger's
358
- * `ctx.trigger.record`, and the `.record` of `recordSearch`, `createRecord`
359
- * and `updateField`. Elsewhere they are the record ID a `record:` slot takes.
382
+ * Inside this wrapper a record trigger's `ctx.trigger.record` deploys the
383
+ * whole record. The `.record` of `recordSearch`, `createRecord` and
384
+ * `updateField` is the whole record in any script input, wrapped or not.
385
+ * `.record.recordId` is the ID for `recordSearch` and `createRecord`. An
386
+ * Update Field `.record.recordId` does not build. Elsewhere they are the
387
+ * record ID a `record:` slot takes.
360
388
  * An on-demand record parameter and `findRelatedRecords`' `.record` expose
361
389
  * only the record ID, so they stay the ID here too.
362
390
  */
@@ -574,6 +602,15 @@ export interface AiTransformOptions {
574
602
  /** Required — `BOOLEAN`, `DATE`, `DATETIME`, or `TEXT`. */
575
603
  readonly fieldType: string;
576
604
  readonly connector?: ConnectorRef;
605
+ /**
606
+ * Size of the embedding the task produces (the web app's **Dimensions**).
607
+ * Only for a connector whose embedding model lists the sizes it supports,
608
+ * and only one of those sizes (for example 256, 512 or 1024 for Titan Embed
609
+ * V2). A whole number ≥ 1. Leave it out for no size. A size can be changed
610
+ * in place (512 to 256). Removing it from a task that has one fails the
611
+ * plan, so set it again or delete and recreate the task.
612
+ */
613
+ readonly dimensions?: number;
577
614
  }
578
615
  export declare function aiTransform(opts: AiTransformOptions): ActionDef<Record<string, unknown>>;
579
616
  export interface AiEmailAnalysisOptions {
@@ -658,6 +695,8 @@ export declare function assignGroup(opts: AssignGroupOptions): ActionDef<Empty>;
658
695
  export interface AddWatcherOptions {
659
696
  readonly userIds?: readonly StaticUserRecipient[];
660
697
  readonly groupIds?: readonly StaticGroupRecipient[];
698
+ readonly userRefs?: readonly ValueOrRef<string>[];
699
+ readonly groupRefs?: readonly ValueOrRef<string>[];
661
700
  readonly record?: ValueOrRef<unknown>;
662
701
  }
663
702
  export declare function addWatcher(opts: AddWatcherOptions): ActionDef<Empty>;
@@ -862,10 +901,15 @@ export declare function calculation<const Values extends CalculationValues>(opts
862
901
  /** @deprecated Prefer `calculation({ values: { name: expression } })`. */
863
902
  export declare function calculation<const Entries extends readonly CalculationEntry[]>(opts: LegacyCalculationOptions<Entries>): ActionDef<CalculationOutputs<Entries>>;
864
903
  /** The status to set on the referenced approval. Mirrors the provider's `status` validator. */
865
- export type ApprovalStatusUpdateStatus = "APPROVED" | "DENIED" | "EXCEPTION";
904
+ export type ApprovalStatusUpdateStatus = "APPROVED" | "DENIED" | "CANCELLED" | "EXCEPTION";
866
905
  export interface ApprovalStatusUpdateOptions {
867
- /** Value reference to the approval to update (typically an `approvalChain` task's output). */
868
- readonly approvalReference: ValueOrRef<unknown>;
906
+ /**
907
+ * Approval process (approval chain template) whose status to update.
908
+ * Sent as the platform's approvalChainTemplateId (edk#1581).
909
+ */
910
+ readonly approvalReference: ApprovalProcessRef;
911
+ /** Record whose approval status to update. */
912
+ readonly record: RecordReference;
869
913
  readonly status: ApprovalStatusUpdateStatus;
870
914
  readonly reason?: ValueOrRef<unknown>;
871
915
  }
@@ -914,7 +958,8 @@ export interface RunAutomationStaticOptions<A extends AutomationCatalogRef = Aut
914
958
  * The UI's "Dynamic Reference" mode: the automation to run is a value
915
959
  * resolved at runtime, such as a trigger parameter or an earlier step's
916
960
  * output holding an automation ID. The platform always waits for a dynamic
917
- * target, so `synchronous` must be `true`.
961
+ * target, so `synchronous` must be `true`. Its outputs don't come back today
962
+ * (see `outputs`).
918
963
  */
919
964
  export interface RunAutomationDynamicReferenceOptions<Outputs extends readonly string[] | undefined = undefined> {
920
965
  readonly automation: Ref<string>;
@@ -922,9 +967,15 @@ export interface RunAutomationDynamicReferenceOptions<Outputs extends readonly s
922
967
  /** Input mappings by the target's on-demand trigger parameter **name**. */
923
968
  readonly inputs?: readonly RunAutomationInput[];
924
969
  /**
925
- * Output names to capture from whichever automation runs. The target is
926
- * unknown at build time, so each captured name is `unknown`. Omitting
927
- * `outputs` exposes nothing on the step result.
970
+ * Output names to expose on the step result. The target is unknown at build
971
+ * time, so each name is `unknown`. Omitting `outputs` exposes nothing.
972
+ *
973
+ * The platform doesn't return a Dynamic Reference target's outputs today:
974
+ * every name listed here reads as null at run time, though the same target
975
+ * called with Select Automation returns them (edk#1869). To get a result
976
+ * back, have the target report it instead: give a separate on-demand
977
+ * automation trigger inputs for the result, and end the target with a
978
+ * Select Automation `runAutomation` to it that maps them.
928
979
  */
929
980
  readonly outputs?: Outputs;
930
981
  }
@@ -997,6 +1048,13 @@ export interface ApprovalChainOptions {
997
1048
  readonly approvers?: readonly ValueOrRef<unknown>[];
998
1049
  readonly reason?: ValueOrRef<unknown>;
999
1050
  readonly summary?: ValueOrRef<unknown>;
1051
+ /**
1052
+ * The Approval Process Tag. A record can have one active approval per
1053
+ * approval process and tag, so approvals of the same process that run in
1054
+ * parallel on one record each need a distinct tag (for example a loop's
1055
+ * iteration).
1056
+ */
1057
+ readonly tag?: ValueOrRef<unknown>;
1000
1058
  }
1001
1059
  export declare function approvalChain(opts: ApprovalChainOptions): ActionDef<Empty>;
1002
1060
  export type ApprovalChainTemplateOptions = ApprovalChainOptions;
@@ -3,13 +3,28 @@ import { isExpr } from "../field/calc/runtime.js";
3
3
  import { isRef } from "../shared/ref.js";
4
4
  import { renderCalculationExpression, } from "./calculation-expression.js";
5
5
  import { extractScriptBody, isScriptFile, readScriptFile, toPlatformScriptBody } from "./script-code.js";
6
- function workflowFields(fields) {
6
+ /**
7
+ * Where an undefined `fields[i].field` most likely came from, for the error.
8
+ * `catalog.<owner>.fields.someKey` evaluates to undefined when the key is not
9
+ * in the owner's fields bag: renamed or removed in source (#1579), or added
10
+ * in Elementum after the owner's source was last pulled, while the pulled
11
+ * automation already uses it (#2629). Build names the exact keys it can find
12
+ * in the file; this names the owner and the pull that refreshes it.
13
+ */
14
+ function missingFieldHint(target) {
15
+ const owner = target;
16
+ if (owner?.refName === undefined)
17
+ return "Check the key against its app/element's fields bag.";
18
+ const kind = owner.__kind === "element" || owner.__kind === "task" ? owner.__kind : "app";
19
+ const label = `${kind} ${JSON.stringify(owner.name ?? owner.refName)}`;
20
+ return (`The key is not in the fields bag of ${label} (catalog.${owner.refName}.fields). ` +
21
+ `If the field was added or renamed in Elementum after that ${kind} was last pulled, run ` +
22
+ `\`elementum pull ${kind} ${owner.namespace ?? owner.refName}\`; if it was renamed or removed in source, use its current key.`);
23
+ }
24
+ function workflowFields(action, target, fields) {
7
25
  return fields.map((f, index) => {
8
26
  if (typeof f.field !== "object" || f.field === null) {
9
- // `app.fields.someKey` evaluates to undefined when the key is not in the
10
- // bag (renamed or removed, e.g. by a re-pull, #1579).
11
- throw new Error(`updateField: fields[${index}].field is ${String(f.field)}; the field key it reads does not exist on its app/element ` +
12
- "(renamed or removed?). Check the app's fields bag for the current key.");
27
+ throw new Error(`${action}: fields[${index}].field is ${String(f.field)}: the field key it reads does not exist. ${missingFieldHint(target)}`);
13
28
  }
14
29
  const updateMode = "updateMode" in f ? f.updateMode : undefined;
15
30
  const fieldType = "fieldType" in f.field ? f.field.fieldType : undefined;
@@ -60,7 +75,7 @@ export function createRecord(opts) {
60
75
  key: "createRecord",
61
76
  config: {
62
77
  aspectId: opts.app,
63
- workflowFields: workflowFields(opts.fields),
78
+ workflowFields: workflowFields("createRecord", opts.app, opts.fields),
64
79
  relateToRecord: opts.relateToRecord ?? false,
65
80
  ...(opts.record !== undefined ? { recordReference: serializeValueOrRef(opts.record) } : {}),
66
81
  },
@@ -77,7 +92,7 @@ export function updateField(opts) {
77
92
  config: {
78
93
  aspectId: opts.app,
79
94
  recordReference: serializeValueOrRef(opts.record),
80
- workflowFields: workflowFields(opts.fields),
95
+ workflowFields: workflowFields("updateField", opts.app, opts.fields),
81
96
  },
82
97
  __recordApp: opts.app.refName,
83
98
  ...recordKindOf(opts.app),
@@ -95,7 +110,7 @@ export function bulkUpdateFields(opts) {
95
110
  config: {
96
111
  aspectId: opts.app,
97
112
  filter: opts.filter,
98
- workflowFields: workflowFields(opts.fields),
113
+ workflowFields: workflowFields("bulkUpdateFields", opts.app, opts.fields),
99
114
  },
100
115
  __recordApp: opts.app.refName,
101
116
  ...recordKindOf(opts.app),
@@ -131,8 +146,18 @@ export function relateRecords(opts) {
131
146
  function refList(values) {
132
147
  return values === undefined ? undefined : values.map((v) => typeof v === "object" && v !== null && "__kind" in v && v.__kind === "user" ? v : serializeValueOrRef(v));
133
148
  }
149
+ const EMAIL_ATTACHMENT_KEYS = ["attachment", "file", "record"];
134
150
  function serializeEmailAttachment(a) {
135
- return "file" in a ? { file: serializeValueOrRef(a.file) } : { record: serializeValueOrRef(a.fromRecord) };
151
+ const unknownKeys = Object.keys(a).filter((key) => !EMAIL_ATTACHMENT_KEYS.includes(key));
152
+ if (unknownKeys.length > 0) {
153
+ throw new Error(`sendEmail attachment has unsupported key ${unknownKeys.map((k) => `"${k}"`).join(", ")}; set exactly one of attachment, file, or record.`);
154
+ }
155
+ const present = EMAIL_ATTACHMENT_KEYS.filter((key) => a[key] !== undefined);
156
+ if (present.length !== 1) {
157
+ throw new Error("sendEmail attachment must set exactly one of attachment, file, or record.");
158
+ }
159
+ const key = present[0];
160
+ return { [key]: serializeValueOrRef(a[key]) };
136
161
  }
137
162
  export function sendEmail(opts) {
138
163
  if (!opts.toUsers?.length && !opts.toGroups?.length && !opts.toAddresses?.length) {
@@ -151,6 +176,7 @@ export function sendEmail(opts) {
151
176
  ...(opts.attachments !== undefined
152
177
  ? { emailAttachments: opts.attachments.map(serializeEmailAttachment) }
153
178
  : {}),
179
+ ...(opts.emailSendDomainId !== undefined ? { emailSendDomainId: opts.emailSendDomainId } : {}),
154
180
  },
155
181
  };
156
182
  }
@@ -310,9 +336,12 @@ const EXECUTE_SCRIPT_LIST_INPUT_MARKER = "__edkExecuteScriptListInput";
310
336
  * can read - which fields, and under what alias. The value is a whole record
311
337
  * or a list of records (a prior task's `.records`, read per item).
312
338
  *
313
- * Inside this wrapper these deploy the whole record: a record trigger's
314
- * `ctx.trigger.record`, and the `.record` of `recordSearch`, `createRecord`
315
- * and `updateField`. Elsewhere they are the record ID a `record:` slot takes.
339
+ * Inside this wrapper a record trigger's `ctx.trigger.record` deploys the
340
+ * whole record. The `.record` of `recordSearch`, `createRecord` and
341
+ * `updateField` is the whole record in any script input, wrapped or not.
342
+ * `.record.recordId` is the ID for `recordSearch` and `createRecord`. An
343
+ * Update Field `.record.recordId` does not build. Elsewhere they are the
344
+ * record ID a `record:` slot takes.
316
345
  * An on-demand record parameter and `findRelatedRecords`' `.record` expose
317
346
  * only the record ID, so they stay the ID here too.
318
347
  */
@@ -477,12 +506,16 @@ export function aiSummarize(opts) {
477
506
  };
478
507
  }
479
508
  export function aiTransform(opts) {
509
+ if (opts.dimensions !== undefined && (!Number.isInteger(opts.dimensions) || opts.dimensions < 1)) {
510
+ throw new Error(`aiTransform dimensions must be a whole number ≥ 1 (got ${String(opts.dimensions)}).`);
511
+ }
480
512
  return {
481
513
  key: "aiTransform",
482
514
  config: {
483
515
  prompt: serializeValueOrRef(opts.prompt),
484
516
  fieldType: opts.fieldType,
485
517
  ...connectorSlot(opts.connector),
518
+ ...(opts.dimensions !== undefined ? { dimensions: opts.dimensions } : {}),
486
519
  },
487
520
  };
488
521
  }
@@ -578,14 +611,16 @@ export function assignGroup(opts) {
578
611
  return { key: "assignGroup", config: { fieldId: opts.field, groupId: opts.groupId } };
579
612
  }
580
613
  export function addWatcher(opts) {
581
- if (!opts.userIds?.length && !opts.groupIds?.length) {
582
- throw new Error("addWatcher requires at least one of: userIds or groupIds.");
614
+ if (!opts.userIds?.length && !opts.groupIds?.length && !opts.userRefs?.length && !opts.groupRefs?.length) {
615
+ throw new Error("addWatcher requires at least one of: userIds, groupIds, userRefs, or groupRefs.");
583
616
  }
584
617
  return {
585
618
  key: "addWatcher",
586
619
  config: {
587
620
  ...(opts.userIds?.length ? { userIds: opts.userIds } : {}),
588
621
  ...(opts.groupIds?.length ? { groupIds: opts.groupIds } : {}),
622
+ ...(opts.userRefs?.length ? { users: refList(opts.userRefs) } : {}),
623
+ ...(opts.groupRefs?.length ? { groups: refList(opts.groupRefs) } : {}),
589
624
  ...(opts.record !== undefined ? { recordReference: serializeValueOrRef(opts.record) } : {}),
590
625
  },
591
626
  };
@@ -832,7 +867,8 @@ export function approvalStatusUpdate(opts) {
832
867
  return {
833
868
  key: "approvalStatusUpdate",
834
869
  config: {
835
- approvalReference: serializeValueOrRef(opts.approvalReference),
870
+ approvalReference: opts.approvalReference,
871
+ recordReference: serializeValueOrRef(opts.record),
836
872
  status: opts.status,
837
873
  ...(opts.reason !== undefined ? { reason: serializeValueOrRef(opts.reason) } : {}),
838
874
  },
@@ -901,6 +937,7 @@ export function approvalChain(opts) {
901
937
  ...(opts.approvers !== undefined ? { approverReferences: opts.approvers.map((a) => serializeValueOrRef(a)) } : {}),
902
938
  ...(opts.reason !== undefined ? { reason: serializeValueOrRef(opts.reason) } : {}),
903
939
  ...(opts.summary !== undefined ? { summary: serializeValueOrRef(opts.summary) } : {}),
940
+ ...(opts.tag !== undefined ? { tags: serializeValueOrRef(opts.tag) } : {}),
904
941
  },
905
942
  };
906
943
  }
@@ -4,6 +4,7 @@ import { type TfBlock, type TfValue } from "../../engine/tf/index.js";
4
4
  import { type ForeignRootIdentity, type OrgRefLookup, type WorkspaceAspect } from "../../engine/build/context.js";
5
5
  import type { BuildFieldMetadata } from "../../graph/types.js";
6
6
  import type { AppServiceAccount } from "../service-account/build.js";
7
+ import type { OptionIdIndex } from "../../engine/pull/field-refs-registry.js";
7
8
  export interface AutomationToTfContext {
8
9
  /** The owning app or element's refName. */
9
10
  readonly appRefName?: string;
@@ -42,6 +43,8 @@ export interface AutomationToTfContext {
42
43
  readonly authoredAspectKeys?: ReadonlySet<string>;
43
44
  /** Build-time tolerance for stale labels retained by pulled automations. */
44
45
  readonly allowUnknownPicklistOptions?: boolean;
46
+ /** Option ids known offline, so a raw id's warning can name its label (#1733). */
47
+ readonly optionIds?: OptionIdIndex;
45
48
  readonly orgRefs?: OrgRefLookup;
46
49
  readonly diagnostics?: string[];
47
50
  readonly serviceAccounts?: Readonly<Record<string, AppServiceAccount>>;