@elementumai/edk 0.9.20 → 0.10.2

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 (159) hide show
  1. package/README.md +19 -7
  2. package/dist-sdk/src/catalog/factories.d.ts +10 -2
  3. package/dist-sdk/src/catalog/factories.js +10 -1
  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/token.js +4 -0
  7. package/dist-sdk/src/catalog/types.d.ts +7 -1
  8. package/dist-sdk/src/catalog/types.js +1 -0
  9. package/dist-sdk/src/core/triggers/on-demand.d.ts +2 -2
  10. package/dist-sdk/src/core/triggers/on-demand.js +7 -0
  11. package/dist-sdk/src/core/types/app.d.ts +2 -2
  12. package/dist-sdk/src/engine/coverage-gaps.d.ts +86 -0
  13. package/dist-sdk/src/engine/coverage-gaps.js +156 -0
  14. package/dist-sdk/src/engine/ei/run.d.ts +21 -1
  15. package/dist-sdk/src/engine/ei/run.js +89 -2
  16. package/dist-sdk/src/engine/pull/catalog-ref.d.ts +16 -0
  17. package/dist-sdk/src/engine/pull/catalog-ref.js +24 -0
  18. package/dist-sdk/src/engine/pull/context.d.ts +68 -6
  19. package/dist-sdk/src/engine/pull/context.js +40 -1
  20. package/dist-sdk/src/engine/pull/procedure-refs.d.ts +8 -0
  21. package/dist-sdk/src/engine/pull/procedure-refs.js +28 -0
  22. package/dist-sdk/src/engine/pull/result-output.js +27 -1
  23. package/dist-sdk/src/engine/tf/index.d.ts +1 -1
  24. package/dist-sdk/src/engine/tf/index.js +1 -1
  25. package/dist-sdk/src/engine/tf/labels.d.ts +22 -5
  26. package/dist-sdk/src/engine/tf/labels.js +45 -3
  27. package/dist-sdk/src/engine/tf/parse.js +3 -2
  28. package/dist-sdk/src/engine/validation.d.ts +5 -0
  29. package/dist-sdk/src/engine/validation.js +12 -2
  30. package/dist-sdk/src/entities/access-policy/from-tf.js +38 -1
  31. package/dist-sdk/src/entities/access-policy/principal.d.ts +2 -0
  32. package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.d.ts +3 -0
  33. package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +42 -19
  34. package/dist-sdk/src/entities/agent/from-tf.js +11 -3
  35. package/dist-sdk/src/entities/agent/module.js +2 -0
  36. package/dist-sdk/src/entities/agent/to-tf.js +14 -3
  37. package/dist-sdk/src/entities/agent-tool/from-tf.d.ts +8 -1
  38. package/dist-sdk/src/entities/agent-tool/from-tf.js +11 -5
  39. package/dist-sdk/src/entities/agent-tool/module.js +3 -0
  40. package/dist-sdk/src/entities/app/auto-share.d.ts +38 -0
  41. package/dist-sdk/src/entities/app/auto-share.js +49 -0
  42. package/dist-sdk/src/entities/app/build.d.ts +17 -3
  43. package/dist-sdk/src/entities/app/build.js +56 -4
  44. package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +6 -1
  45. package/dist-sdk/src/entities/app/from-tf.js +4 -0
  46. package/dist-sdk/src/entities/app/index.d.ts +2 -1
  47. package/dist-sdk/src/entities/app/index.js +1 -8
  48. package/dist-sdk/src/entities/app/module.js +2 -1
  49. package/dist-sdk/src/entities/app/to-tf.d.ts +6 -0
  50. package/dist-sdk/src/entities/app/to-tf.js +25 -2
  51. package/dist-sdk/src/entities/automation/build.d.ts +12 -2
  52. package/dist-sdk/src/entities/automation/build.js +105 -17
  53. package/dist-sdk/src/entities/automation/calculation-expression.d.ts +7 -7
  54. package/dist-sdk/src/entities/automation/deserializer/print-automation.d.ts +17 -4
  55. package/dist-sdk/src/entities/automation/deserializer/print-automation.js +187 -27
  56. package/dist-sdk/src/entities/automation/from-tf.d.ts +9 -2
  57. package/dist-sdk/src/entities/automation/from-tf.js +397 -89
  58. package/dist-sdk/src/entities/automation/index.d.ts +1 -1
  59. package/dist-sdk/src/entities/automation/index.js +1 -1
  60. package/dist-sdk/src/entities/automation/module.d.ts +3 -0
  61. package/dist-sdk/src/entities/automation/module.js +70 -7
  62. package/dist-sdk/src/entities/automation/output-key-wire-name.d.ts +21 -0
  63. package/dist-sdk/src/entities/automation/output-key-wire-name.js +38 -0
  64. package/dist-sdk/src/entities/automation/script-code.d.ts +5 -2
  65. package/dist-sdk/src/entities/automation/script-code.js +23 -5
  66. package/dist-sdk/src/entities/automation/task-output-labels.d.ts +37 -0
  67. package/dist-sdk/src/entities/automation/task-output-labels.js +76 -0
  68. package/dist-sdk/src/entities/automation/tasks.d.ts +92 -20
  69. package/dist-sdk/src/entities/automation/tasks.js +48 -15
  70. package/dist-sdk/src/entities/automation/to-tf.d.ts +20 -3
  71. package/dist-sdk/src/entities/automation/to-tf.js +656 -65
  72. package/dist-sdk/src/entities/automation/triggers.d.ts +8 -4
  73. package/dist-sdk/src/entities/automation/types.d.ts +9 -0
  74. package/dist-sdk/src/entities/automation/types.js +19 -0
  75. package/dist-sdk/src/entities/automation/value-ref-tf.d.ts +1 -1
  76. package/dist-sdk/src/entities/automation/value-ref-tf.js +1 -1
  77. package/dist-sdk/src/entities/chart/from-tf.js +9 -1
  78. package/dist-sdk/src/entities/data-lookup/module.js +2 -0
  79. package/dist-sdk/src/entities/dynamic-layout/to-tf.d.ts +1 -0
  80. package/dist-sdk/src/entities/dynamic-layout/to-tf.js +7 -5
  81. package/dist-sdk/src/entities/element/build.d.ts +3 -0
  82. package/dist-sdk/src/entities/element/build.js +1 -0
  83. package/dist-sdk/src/entities/element/from-tf.js +4 -0
  84. package/dist-sdk/src/entities/element/module.js +2 -1
  85. package/dist-sdk/src/entities/element/to-tf.d.ts +1 -1
  86. package/dist-sdk/src/entities/element/to-tf.js +12 -14
  87. package/dist-sdk/src/entities/field/build.d.ts +3 -2
  88. package/dist-sdk/src/entities/field/calc.d.ts +7 -7
  89. package/dist-sdk/src/entities/field/from-tf.d.ts +4 -4
  90. package/dist-sdk/src/entities/field/from-tf.js +255 -80
  91. package/dist-sdk/src/entities/field/module.d.ts +6 -0
  92. package/dist-sdk/src/entities/field/module.js +23 -2
  93. package/dist-sdk/src/entities/field/options.js +6 -1
  94. package/dist-sdk/src/entities/field/order.d.ts +16 -0
  95. package/dist-sdk/src/entities/field/order.js +41 -0
  96. package/dist-sdk/src/entities/field/to-tf.d.ts +4 -4
  97. package/dist-sdk/src/entities/field/to-tf.js +7 -1
  98. package/dist-sdk/src/entities/field/types.d.ts +7 -0
  99. package/dist-sdk/src/entities/field/types.js +32 -0
  100. package/dist-sdk/src/entities/role/from-tf.js +3 -3
  101. package/dist-sdk/src/entities/role/to-tf.d.ts +2 -0
  102. package/dist-sdk/src/entities/role/to-tf.js +12 -4
  103. package/dist-sdk/src/entities/service-account/from-tf.js +3 -3
  104. package/dist-sdk/src/entities/service-account/workspace-owner.d.ts +16 -0
  105. package/dist-sdk/src/entities/service-account/workspace-owner.js +22 -0
  106. package/dist-sdk/src/entities/shared/filters/ast.d.ts +15 -1
  107. package/dist-sdk/src/entities/shared/filters/ast.js +2 -0
  108. package/dist-sdk/src/entities/shared/filters/index.d.ts +5 -0
  109. package/dist-sdk/src/entities/shared/filters/index.js +5 -0
  110. package/dist-sdk/src/entities/shared/filters/print.js +7 -2
  111. package/dist-sdk/src/entities/shared/filters/tf-codec.d.ts +5 -0
  112. package/dist-sdk/src/entities/shared/filters/tf-codec.js +42 -7
  113. package/dist-sdk/src/entities/shared/filters/types.d.ts +8 -3
  114. package/dist-sdk/src/entities/shared/ref.d.ts +5 -7
  115. package/dist-sdk/src/entities/shared/ref.js +5 -7
  116. package/dist-sdk/src/entities/shared/tool-field-ref.d.ts +9 -0
  117. package/dist-sdk/src/entities/shared/tool-field-ref.js +35 -2
  118. package/dist-sdk/src/entities/shared/types/field-types.d.ts +10 -0
  119. package/dist-sdk/src/entities/shared/types/field-types.js +4 -0
  120. package/dist-sdk/src/entities/skill/access-policy.js +3 -3
  121. package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.d.ts +3 -0
  122. package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +12 -5
  123. package/dist-sdk/src/entities/skill/from-tf.js +4 -2
  124. package/dist-sdk/src/entities/skill/module.js +2 -0
  125. package/dist-sdk/src/entities/skill-tool/from-tf.js +41 -8
  126. package/dist-sdk/src/entities/skill-tool/module.js +3 -0
  127. package/dist-sdk/src/entities/skill-tool/to-tf.d.ts +0 -6
  128. package/dist-sdk/src/entities/skill-tool/to-tf.js +22 -9
  129. package/dist-sdk/src/entities/task/build.d.ts +8 -0
  130. package/dist-sdk/src/entities/task/build.js +10 -1
  131. package/dist-sdk/src/entities/task/from-tf.d.ts +4 -2
  132. package/dist-sdk/src/entities/task/from-tf.js +7 -2
  133. package/dist-sdk/src/entities/task/module.js +3 -2
  134. package/dist-sdk/src/entities/task/to-tf.d.ts +8 -4
  135. package/dist-sdk/src/entities/task/to-tf.js +32 -1
  136. package/dist-sdk/src/entities/view/from-tf.js +9 -1
  137. package/dist-sdk/src/entities/view/module.js +4 -1
  138. package/dist-sdk/src/entities/view/to-tf.d.ts +6 -7
  139. package/dist-sdk/src/entities/view/to-tf.js +30 -11
  140. package/dist-sdk/src/entities/view/types.d.ts +6 -0
  141. package/dist-sdk/src/entities/view/types.js +6 -0
  142. package/dist-sdk/src/entities/visual-flow/build.d.ts +16 -1
  143. package/dist-sdk/src/entities/visual-flow/build.js +9 -0
  144. package/dist-sdk/src/entities/visual-flow/from-tf.d.ts +14 -0
  145. package/dist-sdk/src/entities/visual-flow/from-tf.js +51 -3
  146. package/dist-sdk/src/entities/visual-flow/index.d.ts +1 -1
  147. package/dist-sdk/src/entities/visual-flow/index.js +1 -1
  148. package/dist-sdk/src/entities/visual-flow/printer.js +19 -0
  149. package/dist-sdk/src/entities/visual-flow/to-tf.js +87 -3
  150. package/dist-sdk/src/entities/widget/from-tf.js +3 -3
  151. package/dist-sdk/src/entities/widget/to-tf.d.ts +2 -0
  152. package/dist-sdk/src/entities/widget/to-tf.js +7 -6
  153. package/dist-sdk/src/generated/ragnarok/ragnarok-spec.d.ts +133 -9
  154. package/dist-sdk/src/generated/ragnarok/ragnarok-spec.js +2 -2
  155. package/dist-sdk/src/graph/index.d.ts +4 -2
  156. package/dist-sdk/src/graph/index.js +3 -0
  157. package/dist-sdk/src/graph/modules.js +2 -1
  158. package/dist-sdk/src/graph/types.d.ts +41 -3
  159. package/package.json +7 -3
@@ -18,6 +18,12 @@ import { type ToTfContext } from "../../engine/build/context.js";
18
18
  import type { BuildFieldMetadata } from "../../graph/types.js";
19
19
  import { type DeployableEntity } from "../../engine/entity.js";
20
20
  import { type TfBlock } from "../../engine/tf/index.js";
21
+ /**
22
+ * The named gap for a system-field tag with no canonical key (edk#1480).
23
+ * Defensive: every tag in SYSTEM_FIELD_TAGS maps today, so a new tag lands
24
+ * here until SYSTEM_FIELD_TAG_BY_KEY learns it.
25
+ */
26
+ export declare function unsupportedSystemTagGap(systemTag: string): string;
21
27
  /** System-field tags that fold into the app resource instead of emitting a field resource. */
22
28
  export declare const SYSTEM_FIELD_TAGS: ReadonlySet<string>;
23
29
  export interface AppToTfResult {
@@ -14,6 +14,9 @@
14
14
  * Unsupported authoring shapes degrade through `diagnostics` — reported,
15
15
  * never silent, never thrown (plan §4.3).
16
16
  */
17
+ import { managedFieldOrderToTf } from "../field/order.js";
18
+ import { typedCoverageGap } from "../../engine/coverage-gaps.js";
19
+ import { autoShareToTf } from "./auto-share.js";
17
20
  import { workspaceAspectKey } from "../../engine/build/context.js";
18
21
  import { DEPLOY_DEFAULT_STATUS_OPTION_VALUES, SYSTEM_FIELD_HCL_KEY_BY_KEY, SYSTEM_FIELD_KEY_BY_TAG, SYSTEM_FIELD_REQUIRED } from "../../core/system-fields.js";
19
22
  import { EntityTfError } from "../../engine/entity.js";
@@ -29,11 +32,25 @@ import { categoryIdExpr, missingCategoryDiagnostic } from "../org/category-ref.j
29
32
  import { CLOUD_LINK_ORG_BAG } from "../org/cloud-link.js";
30
33
  import { recordCreateFormToTf } from "../record-create-form/to-tf.js";
31
34
  import { relationshipsToTf } from "../relationship/to-tf.js";
35
+ import { workspaceServiceAccountAppResolver } from "../service-account/workspace-owner.js";
32
36
  import { rolesToTf } from "../role/to-tf.js";
33
37
  import { appServiceAccountBlocks } from "../service-account/to-tf.js";
34
38
  import { relationshipTargetsFromBag, widgetsToTf } from "../widget/to-tf.js";
35
39
  import { viewToTf } from "../view/to-tf.js";
36
40
  import { APP_RESOURCE_TYPE } from "./module.js";
41
+ /**
42
+ * The named gap for a system-field tag with no canonical key (edk#1480).
43
+ * Defensive: every tag in SYSTEM_FIELD_TAGS maps today, so a new tag lands
44
+ * here until SYSTEM_FIELD_TAG_BY_KEY learns it.
45
+ */
46
+ export function unsupportedSystemTagGap(systemTag) {
47
+ return typedCoverageGap({
48
+ kind: "dropped",
49
+ entity: "systemFields",
50
+ detail: `unsupported semantic tag ${systemTag}; validation flags dropped`,
51
+ consequence: "the field's required/validation flags are not applied, so that validation is not enforced",
52
+ });
53
+ }
37
54
  /** System-field tags that fold into the app resource instead of emitting a field resource. */
38
55
  export const SYSTEM_FIELD_TAGS = new Set([
39
56
  "TITLE",
@@ -82,6 +99,8 @@ export function appToTf(entity, ctx) {
82
99
  appAttrs["comments_enabled"] = payload.commentsEnabled;
83
100
  if (payload.lockStages !== undefined)
84
101
  appAttrs["lock_stages"] = payload.lockStages;
102
+ if (payload.autoShare !== undefined)
103
+ appAttrs["auto_share"] = autoShareToTf(payload.autoShare);
85
104
  const categoryName = payload.category?.name;
86
105
  if (categoryName !== undefined && categoryName !== "") {
87
106
  const category = ctx.orgRefs.byName(CATEGORY_ORG_BAG, categoryName);
@@ -136,7 +155,7 @@ export function appToTf(entity, ctx) {
136
155
  if (systemTag !== undefined) {
137
156
  const systemKey = SYSTEM_FIELD_KEY_BY_TAG[systemTag];
138
157
  if (systemKey === undefined) {
139
- ctx.diagnostics.push(`systemFields: unsupported semantic tag ${systemTag}; validation flags dropped`);
158
+ ctx.diagnostics.push(unsupportedSystemTagGap(systemTag));
140
159
  }
141
160
  else {
142
161
  // Canonical system key (title/id/status/…) must map to the display
@@ -223,6 +242,9 @@ export function appToTf(entity, ctx) {
223
242
  blocks.push(field.block);
224
243
  fieldAddresses.set(field.bagKey, field.address);
225
244
  }
245
+ const fieldOrder = managedFieldOrderToTf(ctx.appTfLabel, "app", objectId, fieldAddresses);
246
+ if (fieldOrder !== undefined)
247
+ blocks.push(fieldOrder);
226
248
  if (Object.keys(systemFieldConfig).length > 0) {
227
249
  appAttrs["system_field_config"] = systemFieldConfig;
228
250
  }
@@ -271,7 +293,6 @@ export function appToTf(entity, ctx) {
271
293
  const { blocks: viewBlocks } = viewToTf(payload.layouts, payload.listViews, payload.calendarViews, payload.kanbanViews, payload.dashboardViews, payload.agentViews, payload.viewOrder, {
272
294
  ownerRefName: ctx.appRefName,
273
295
  ownerTfLabel: ctx.appTfLabel,
274
- aspectName: payload.name ?? "",
275
296
  objectId,
276
297
  stageTfLabels,
277
298
  dashboardKeys: new Set(Object.keys(payload.dashboards ?? {})),
@@ -328,6 +349,7 @@ export function appToTf(entity, ctx) {
328
349
  appRefName: ctx.appRefName,
329
350
  serviceAccounts: payload.serviceAccounts,
330
351
  fieldAddresses,
352
+ resolveServiceAccountApp: workspaceServiceAccountAppResolver(ctx.workspaceAspects),
331
353
  });
332
354
  blocks.push(block);
333
355
  }
@@ -339,6 +361,7 @@ export function appToTf(entity, ctx) {
339
361
  serviceAccounts: payload.serviceAccounts,
340
362
  orgRefs: ctx.orgRefs,
341
363
  diagnostics: ctx.diagnostics,
364
+ resolveServiceAccountApp: workspaceServiceAccountAppResolver(ctx.workspaceAspects),
342
365
  }));
343
366
  blocks.push(...appServiceAccountBlocks(payload, {
344
367
  ownerTfLabel: ctx.appTfLabel,
@@ -97,7 +97,7 @@ export declare const FOR_EACH_PLACEHOLDER = "__forEach__";
97
97
  * accessor → canonical; identity for most kinds. Validated against
98
98
  * TASK_OUTPUT_CONTRACTS by canonical-reference-model.test.ts.
99
99
  */
100
- export declare function rewriteCanonicalOutputRefName(taskKey: string | undefined, name: string, taskRefKey?: string): string;
100
+ export declare function rewriteCanonicalOutputRefName(taskKey: string | undefined, name: string, taskRefKey?: string, schema?: unknown): string;
101
101
  /** One finalized automation-level output property (already serialized to wire). */
102
102
  export interface OutputEntry {
103
103
  readonly name: string;
@@ -234,6 +234,8 @@ interface ActionMethods<TTrigger, TActions extends Record<string, unknown>, TVar
234
234
  }, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, {
235
235
  result: R;
236
236
  textResult: string;
237
+ stringArrayResult: readonly string[];
238
+ numberArrayResult: readonly number[];
237
239
  }>;
238
240
  /**
239
241
  * Fluent setVariable: one variable, named the same as its action — read
@@ -258,6 +260,7 @@ interface ActionMethods<TTrigger, TActions extends Record<string, unknown>, TVar
258
260
  updateField<TName extends string, A extends AppOrElementOrTaskRef, const Fields extends readonly import("./tasks.js").FieldAssignment[]>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").UpdateFieldOptions<A, Fields>>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, {
259
261
  record: RecordShape<A>;
260
262
  }>;
263
+ bulkUpdateFields<TName extends string, A extends AppOrElementOrTaskRef, const Fields extends readonly import("./tasks.js").FieldAssignment[]>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").BulkUpdateFieldsOptions<A, Fields>>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, import("./tasks.js").BulkUpdateFieldsOutput>;
261
264
  findRelatedRecords<TName extends string, A extends AppOrElementOrTaskRef>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").FindRelatedRecordsOptions<A>>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, import("./tasks.js").FindRelatedRecordsOutput<A>>;
262
265
  relateRecords<TName extends string>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").RelateRecordsOptions>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, EmptyObject>;
263
266
  sendEmail<TName extends string>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").SendEmailOptions>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, EmptyObject>;
@@ -285,12 +288,13 @@ interface ActionMethods<TTrigger, TActions extends Record<string, unknown>, TVar
285
288
  calculation<TName extends string, const Entries extends readonly import("./tasks.js").CalculationEntry[]>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").LegacyCalculationOptions<Entries>>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, import("./tasks.js").CalculationOutputs<Entries>>;
286
289
  procedure<TName extends string, const Parameters extends readonly import("../../catalog/types.js").ProcedureParameterType[]>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").TypedProcedureOptions<Parameters>>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, Record<string, unknown>>;
287
290
  procedure<TName extends string>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").LegacyProcedureOptions>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, Record<string, unknown>>;
288
- runAutomation<TName extends string, const A extends AutomationCatalogRef>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").RunAutomationOptions<A>>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, import("./tasks.js").RunAutomationOutput<A>>;
291
+ runAutomation<TName extends string, const O extends import("./tasks.js").RunAutomationStaticOptions<AutomationCatalogRef> | import("./tasks.js").RunAutomationDynamicReferenceOptions<readonly string[] | undefined>>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, O>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, import("./tasks.js").RunAutomationStepResult<O>>;
289
292
  readFile<TName extends string>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").ReadFileOptions>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, Record<string, unknown>>;
290
293
  approvalChain<TName extends string>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").ApprovalChainOptions>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, EmptyObject>;
291
294
  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>;
292
295
  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>;
293
296
  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>;
297
+ unzip<TName extends string>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").UnzipOptions>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, EmptyObject>;
294
298
  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>;
295
299
  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>;
296
300
  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>;
@@ -402,4 +406,10 @@ export interface AutomationConfigured {
402
406
  * `AutomationConfigured` with `ref(refName)` and `def(refName)`.
403
407
  */
404
408
  export declare function automation(opts: AutomationOptions): AutomationConfigured;
409
+ /**
410
+ * A record trigger carries no aspect of its own on the wire: it always fires
411
+ * on the automation's owning app or element. A trigger authored against any
412
+ * other app would silently attach to the owner, so it is a build error (#1594).
413
+ */
414
+ export declare function assertTriggerOnOwningAspect(automationRefName: string, ownerRefName: string, triggerAppRefName: string | undefined): void;
405
415
  export {};
@@ -39,7 +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 { AI_SEARCH_TABLE_OUTPUT_NAMES, USER_SEARCH_REF_WIRE_NAMES, WHOLE_RECORD_REF_WIRE_NAMES } from "./task-output-labels.js";
42
+ import { AI_SEARCH_TABLE_OUTPUT_NAMES, TRIGGER_WHOLE_RECORD_MARKER, TRIGGER_WHOLE_RECORD_REF_NAME, USER_SEARCH_REF_WIRE_NAMES, WHOLE_RECORD_REF_WIRE_NAMES, } from "./task-output-labels.js";
43
43
  import { isWorkflowOutputDeclaration, workflowOutputFieldType, } from "./workflow-output.js";
44
44
  /** Placeholder `forEachTaskRefKey` the forEach item proxy emits; replaced with the real refKey. */
45
45
  export const FOR_EACH_PLACEHOLDER = "__forEach__";
@@ -229,6 +229,66 @@ function assertKnownSearchOutput(taskKey, wireNames, name, taskRefKey) {
229
229
  const outputs = Object.keys(wireNames).join(", ");
230
230
  throw new EntityTfError(`${taskKey}${taskRefKey === undefined ? "" : ` task "${taskRefKey}"`} has no output "${name}"; its outputs are ${outputs}.`);
231
231
  }
232
+ /**
233
+ * Contract outputs that are not schema properties under `result`.
234
+ * `stringArrayResult` / `numberArrayResult` are real reads (a filter's
235
+ * `task.<id>.stringArrayResult`), not a missing `.result.` hop (#1656).
236
+ */
237
+ const EXECUTE_SCRIPT_CONTRACT_OUTPUT_NAMES = new Set(["stringArrayResult", "numberArrayResult"]);
238
+ /**
239
+ * Top-level property names on a wire `output_schema` object. `undefined` means
240
+ * the script declared no schema, so a `result.<prop>` cannot be checked.
241
+ */
242
+ function declaredScriptResultProperties(schema) {
243
+ if (typeof schema !== "object" || schema === null || !("object" in schema))
244
+ return undefined;
245
+ const object = schema.object;
246
+ if (typeof object !== "object" || object === null)
247
+ return undefined;
248
+ const properties = object.properties;
249
+ if (!Array.isArray(properties))
250
+ return new Set();
251
+ const names = new Set();
252
+ for (const property of properties) {
253
+ if (typeof property !== "object" || property === null)
254
+ continue;
255
+ for (const node of Object.values(property)) {
256
+ if (typeof node === "object" && node !== null && typeof node.name === "string") {
257
+ names.add(node.name);
258
+ }
259
+ }
260
+ }
261
+ return names;
262
+ }
263
+ /**
264
+ * A script's declared outputs are read under `result`. A bare
265
+ * `ctx.actions.<script>.<name>` would compile to a `refs["<name>"]` key the
266
+ * platform never sets, so apply fails with "Invalid index". When the script
267
+ * declares an output schema, `result.<prop>` is checked against that schema
268
+ * too. Authoring names are `result`, `textResult`, `stringArrayResult`,
269
+ * `numberArrayResult`, and `result.<prop>`. `Text Result` / `Result` /
270
+ * `Text List Result` are refs-map keys, not names someone authors (#1656).
271
+ */
272
+ function assertKnownScriptOutput(name, taskRefKey, schema, checkDeclaredResult) {
273
+ if (name === "result" || name === "textResult" || EXECUTE_SCRIPT_CONTRACT_OUTPUT_NAMES.has(name))
274
+ return;
275
+ if (name.startsWith("result.")) {
276
+ // Filter `{type:"TASK"}` shapes are not refs-map reads. A switch left_value
277
+ // whose script does not declare the property stays a typed envelope on the
278
+ // task `.id` (#1151), which to-tf emits with a diagnostic.
279
+ if (!checkDeclaredResult)
280
+ return;
281
+ const declared = declaredScriptResultProperties(schema);
282
+ const property = name.slice("result.".length).split(".")[0] ?? "";
283
+ if (declared === undefined || declared.has(property))
284
+ return;
285
+ const listed = [...declared].join(", ");
286
+ throw new EntityTfError(`executeScript${taskRefKey === undefined ? "" : ` task "${taskRefKey}"`} has no output "${name}"; ` +
287
+ `declared result properties are ${listed === "" ? "(none)" : listed}.`);
288
+ }
289
+ throw new EntityTfError(`executeScript${taskRefKey === undefined ? "" : ` task "${taskRefKey}"`} has no output "${name}"; ` +
290
+ `script outputs are read under result. Use ctx.actions.${taskRefKey ?? "<script>"}.result.${name}.`);
291
+ }
232
292
  /**
233
293
  * Forward output-name rewrites, the inverse of the deserializer's read-side
234
294
  * normalization (`applyOutputNameInverseRewrites` in
@@ -257,7 +317,7 @@ function assertKnownSearchOutput(taskKey, wireNames, name, taskRefKey) {
257
317
  * - single-scalar-output tasks (see `OUTPUT_KEY_WIRE_NAME`): `output` →
258
318
  * the platform's actual output name for that task kind.
259
319
  */
260
- function rewriteForwardTaskRefName(taskKey, name, taskRefKey) {
320
+ function rewriteForwardTaskRefName(taskKey, name, taskRefKey, schema, checkDeclaredScriptResult = true) {
261
321
  if (taskKey === "findRelatedRecords" && FIND_RELATED_RECORDS_COUNT_REF_NAMES.has(name.split(".")[0])) {
262
322
  throw findRelatedRecordsTotalCountError(taskRefKey);
263
323
  }
@@ -275,8 +335,10 @@ function rewriteForwardTaskRefName(taskKey, name, taskRefKey) {
275
335
  assertKnownSearchOutput("userSearch", USER_SEARCH_REF_WIRE_NAMES, name, taskRefKey);
276
336
  return USER_SEARCH_REF_WIRE_NAMES[name] ?? name;
277
337
  }
278
- if (taskKey === "executeScript" && name === "textResult") {
279
- return "Text Result";
338
+ if (taskKey === "executeScript") {
339
+ assertKnownScriptOutput(name, taskRefKey, schema, checkDeclaredScriptResult);
340
+ if (name === "textResult")
341
+ return "Text Result";
280
342
  }
281
343
  if (taskKey === "aiSearchTable" && AI_SEARCH_TABLE_OUTPUT_NAMES[name] !== undefined) {
282
344
  return AI_SEARCH_TABLE_OUTPUT_NAMES[name][0];
@@ -314,17 +376,19 @@ function rewriteForwardTaskRefName(taskKey, name, taskRefKey) {
314
376
  * accessor → canonical; identity for most kinds. Validated against
315
377
  * TASK_OUTPUT_CONTRACTS by canonical-reference-model.test.ts.
316
378
  */
317
- export function rewriteCanonicalOutputRefName(taskKey, name, taskRefKey) {
379
+ export function rewriteCanonicalOutputRefName(taskKey, name, taskRefKey, schema) {
318
380
  if (taskKey === "findRelatedRecords" && FIND_RELATED_RECORDS_COUNT_REF_NAMES.has(name.split(".")[0])) {
319
381
  throw findRelatedRecordsTotalCountError(taskRefKey);
320
382
  }
383
+ if (taskKey === "executeScript")
384
+ assertKnownScriptOutput(name, taskRefKey, schema, true);
321
385
  if (taskKey === "api" && name.startsWith("file.")) {
322
386
  // apiRequest's file SUB-refs (.file.content / .contentType / .name) have no
323
387
  // canonical service_tasks output name of their own — they resolve by the
324
388
  // provider's refs-map DISPLAY label ("Content" / "Content Type" / "Name", via
325
389
  // API_TASK_REF_WIRE_NAMES). Keep the base display rewrite. Top-level api
326
390
  // outputs ARE contract names and ride the envelope as identity.
327
- return rewriteForwardTaskRefName(taskKey, name, taskRefKey);
391
+ return rewriteForwardTaskRefName(taskKey, name, taskRefKey, schema);
328
392
  }
329
393
  if ((taskKey === "recordSearch" || taskKey === "tableRecordsSearch") && name === "totalCount") {
330
394
  // Both expose a `totalCount` accessor, but the executors' canonical count
@@ -359,12 +423,12 @@ export function rewriteCanonicalOutputRefName(taskKey, name, taskRefKey) {
359
423
  // aiAgent is NOT a #835 display-label victim: base already emits the correct
360
424
  // platform reference via rewriteForwardTaskRefName + to-tf's
361
425
  // aiAgentPlatformRefName. Keep that intact by delegating to the forward rewrite.
362
- return rewriteForwardTaskRefName(taskKey, name, taskRefKey);
426
+ return rewriteForwardTaskRefName(taskKey, name, taskRefKey, schema);
363
427
  }
364
428
  if (taskKey === "documentModel") {
365
429
  // file_reader's published output wire name is "text" (confirmed live wire
366
430
  // data), NOT a #835 display-label victim. Keep base behavior.
367
- return rewriteForwardTaskRefName(taskKey, name, taskRefKey);
431
+ return rewriteForwardTaskRefName(taskKey, name, taskRefKey, schema);
368
432
  }
369
433
  if (taskKey === "recordSearch" && name === "record.recordId") {
370
434
  // recordSearch exposes a real canonical `recordId` output (service_tasks
@@ -375,7 +439,7 @@ export function rewriteCanonicalOutputRefName(taskKey, name, taskRefKey) {
375
439
  // createRecord/findRelatedRecords do NOT expose a `recordId` output
376
440
  // (find_related_records has none in service_tasks). Their record-id reference
377
441
  // is "Record" (ASPECT_RECORD_ID) — the base behavior. Keep via forward rewrite.
378
- return rewriteForwardTaskRefName(taskKey, name, taskRefKey);
442
+ return rewriteForwardTaskRefName(taskKey, name, taskRefKey, schema);
379
443
  }
380
444
  const canonicalOutputKey = taskKey ? OUTPUT_KEY_CANONICAL[taskKey] : undefined;
381
445
  if (canonicalOutputKey) {
@@ -395,7 +459,7 @@ export function rewriteCanonicalOutputRefName(taskKey, name, taskRefKey) {
395
459
  * the `ref*` filter helpers) — both need the same rewrite. Runs at finalize,
396
460
  * when the full refKey→kind map is known.
397
461
  */
398
- function rewriteTaskOutputRefs(node, taskKindByRefKey,
462
+ function rewriteTaskOutputRefs(node, taskKindByRefKey, scriptSchemas,
399
463
  // Workflow OUTPUTS pass canonical=true: a `taskReference.name` becomes the
400
464
  // platform's CANONICAL service_tasks output name (edk#835). Task inputs and
401
465
  // filters (canonical=false, the default) keep the display rewrite — #1271 owns
@@ -403,7 +467,7 @@ function rewriteTaskOutputRefs(node, taskKindByRefKey,
403
467
  canonical = false) {
404
468
  if (Array.isArray(node)) {
405
469
  for (const item of node)
406
- rewriteTaskOutputRefs(item, taskKindByRefKey, canonical);
470
+ rewriteTaskOutputRefs(item, taskKindByRefKey, scriptSchemas, canonical);
407
471
  return;
408
472
  }
409
473
  if (node === null || typeof node !== "object")
@@ -416,23 +480,29 @@ canonical = false) {
416
480
  : undefined;
417
481
  if (wholeRecord !== undefined)
418
482
  mapped.name = wholeRecord;
483
+ // Field mappings read a trigger's whole record too, which shares its
484
+ // display name with the record ID (edk#1284); see TRIGGER_WHOLE_RECORD_MARKER.
485
+ const value = rec.value;
486
+ if (value?.triggerReference?.name === TRIGGER_WHOLE_RECORD_REF_NAME) {
487
+ rec.value = { ...value, [TRIGGER_WHOLE_RECORD_MARKER]: true };
488
+ }
419
489
  }
420
490
  const ref = rec.taskReference;
421
491
  if (ref && typeof ref.taskRefKey === "string" && typeof ref.name === "string") {
422
492
  const rewrite = canonical ? rewriteCanonicalOutputRefName : rewriteForwardTaskRefName;
423
- ref.name = rewrite(taskKindByRefKey.get(ref.taskRefKey), ref.name, ref.taskRefKey);
493
+ ref.name = rewrite(taskKindByRefKey.get(ref.taskRefKey), ref.name, ref.taskRefKey, scriptSchemas.get(ref.taskRefKey));
424
494
  }
425
495
  if (rec.type === "TASK" && typeof rec.taskRefKey === "string" && typeof rec.name === "string") {
426
496
  // Filter `{type:"TASK"}` shapes never appear in a workflow OUTPUT subtree;
427
497
  // keep the display rewrite (#1271's filter path) regardless of `canonical`.
428
- rec.name = rewriteForwardTaskRefName(taskKindByRefKey.get(rec.taskRefKey), rec.name, rec.taskRefKey);
498
+ rec.name = rewriteForwardTaskRefName(taskKindByRefKey.get(rec.taskRefKey), rec.name, rec.taskRefKey, scriptSchemas.get(rec.taskRefKey), false);
429
499
  }
430
500
  for (const [key, v] of Object.entries(rec)) {
431
501
  // A calc-engine mustache subtree (`calculationReference` → templateReference)
432
502
  // keeps the display/forward rewrite even under an output, so its decode
433
503
  // (decodeCalculationTaskMustache) stays idempotent.
434
504
  const childCanonical = key === "calculationReference" ? false : canonical;
435
- rewriteTaskOutputRefs(v, taskKindByRefKey, childCanonical);
505
+ rewriteTaskOutputRefs(v, taskKindByRefKey, scriptSchemas, childCanonical);
436
506
  }
437
507
  }
438
508
  /**
@@ -541,6 +611,7 @@ function makeActionBuilder(state, mode = "root", item, loops = {}) {
541
611
  tableRecordsSearch: actionFactories.tableRecordsSearch,
542
612
  createRecord: actionFactories.createRecord,
543
613
  updateField: actionFactories.updateField,
614
+ bulkUpdateFields: actionFactories.bulkUpdateFields,
544
615
  findRelatedRecords: actionFactories.findRelatedRecords,
545
616
  relateRecords: actionFactories.relateRecords,
546
617
  sendEmail: actionFactories.sendEmail,
@@ -561,6 +632,7 @@ function makeActionBuilder(state, mode = "root", item, loops = {}) {
561
632
  approvalStatusUpdate: actionFactories.approvalStatusUpdate,
562
633
  addWatcher: actionFactories.addWatcher,
563
634
  saveAttachment: actionFactories.saveAttachment,
635
+ unzip: actionFactories.unzip,
564
636
  userSearch: actionFactories.userSearch,
565
637
  userGroupSearch: actionFactories.userGroupSearch,
566
638
  initiateCall: actionFactories.initiateCall,
@@ -681,13 +753,16 @@ function makeActionBuilder(state, mode = "root", item, loops = {}) {
681
753
  },
682
754
  __finalize() {
683
755
  const taskKindByRefKey = collectTaskKinds(state.tasks);
756
+ const scriptSchemas = collectExecuteScriptOutputSchemas(state.tasks);
684
757
  const tasks = state.tasks.map((t) => serializeTaskEntry(t.name, t.def, t.displayName, t.hclParent));
685
- const outputs = state.outputs?.map((o) => ({ ...o }));
686
- rewriteTaskOutputRefs(tasks, taskKindByRefKey);
758
+ // Deep copy: the rewrites below mutate in place, and `state.outputs` is
759
+ // shared by every build of this definition (#1536).
760
+ const outputs = state.outputs?.map((o) => structuredClone(o));
761
+ rewriteTaskOutputRefs(tasks, taskKindByRefKey, scriptSchemas);
687
762
  // Workflow OUTPUTS emit the platform's CANONICAL output name (edk#835);
688
763
  // task inputs/filters above stay on the display path (#1271 owns them).
689
764
  if (outputs)
690
- rewriteTaskOutputRefs(outputs, taskKindByRefKey, /* canonical */ true);
765
+ rewriteTaskOutputRefs(outputs, taskKindByRefKey, scriptSchemas, /* canonical */ true);
691
766
  // Trigger reference names are NOT canonicalized: the authored name is
692
767
  // the name, everywhere in EDK. (Mobius canonicalizes reference names in
693
768
  // ITS storage — `ValueReference.ofTriggerReference` — but on the tf
@@ -802,6 +877,7 @@ export function automation(opts) {
802
877
  def(refName) {
803
878
  const sequence = opts.actions.__finalize();
804
879
  const recordFieldContext = mergeOnDemandRecordFieldContext(sequence.recordFieldContext, sequence.trigger);
880
+ assertTriggerOnOwningAspect(refName, opts.app.refName, sequence.recordFieldContext?.triggerAppRefName);
805
881
  // `recordFieldContext` is a structural extension, not a declared `DeployableEntity`
806
882
  // property (see `RecordFieldContext`'s doc comment) — assigning to `entity`
807
883
  // first (rather than returning the literal directly) avoids an excess-property
@@ -854,3 +930,15 @@ function soleOnDemandRecordTargetRefName(trigger) {
854
930
  });
855
931
  return targets.length === 1 ? targets[0] : undefined;
856
932
  }
933
+ /**
934
+ * A record trigger carries no aspect of its own on the wire: it always fires
935
+ * on the automation's owning app or element. A trigger authored against any
936
+ * other app would silently attach to the owner, so it is a build error (#1594).
937
+ */
938
+ export function assertTriggerOnOwningAspect(automationRefName, ownerRefName, triggerAppRefName) {
939
+ if (triggerAppRefName === undefined || triggerAppRefName === ownerRefName)
940
+ return;
941
+ throw new Error(`automation "${automationRefName}": its trigger is on "${triggerAppRefName}", but the automation is owned by "${ownerRefName}". ` +
942
+ `Record triggers always fire on the owning app or element; move this automation under "${triggerAppRefName}" ` +
943
+ `(set app: to it) or trigger on "${ownerRefName}".`);
944
+ }
@@ -84,33 +84,33 @@ export declare const calc: {
84
84
  readonly dividedBy: <const A extends import("../field/calc/types.js").NumericLike, const B extends import("../field/calc/types.js").NumericLike>(a: A, b: B) => import("../field/calc/types.js").ComposedExpr<"decimal", [A, B]>;
85
85
  readonly gt: {
86
86
  <const A extends import("../field/calc/types.js").NumericLike, const B extends import("../field/calc/types.js").NumericLike>(a: A, b: B): import("../field/calc/types.js").ComposedExpr<"bool", [A, B]>;
87
- <T extends "date" | "datetime" | "handle" | "text" | "html", const A extends import("../field/calc/types.js").ExprLike<T>, const B extends import("../field/calc/types.js").ExprLike<NoInfer<T>>>(a: A, b: B): import("../field/calc/types.js").ComposedExpr<"bool", [A, B]>;
87
+ <T extends "text" | "date" | "datetime" | "handle" | "html", const A extends import("../field/calc/types.js").ExprLike<T>, const B extends import("../field/calc/types.js").ExprLike<NoInfer<T>>>(a: A, b: B): import("../field/calc/types.js").ComposedExpr<"bool", [A, B]>;
88
88
  };
89
89
  readonly lt: {
90
90
  <const A extends import("../field/calc/types.js").NumericLike, const B extends import("../field/calc/types.js").NumericLike>(a: A, b: B): import("../field/calc/types.js").ComposedExpr<"bool", [A, B]>;
91
- <T extends "date" | "datetime" | "handle" | "text" | "html", const A extends import("../field/calc/types.js").ExprLike<T>, const B extends import("../field/calc/types.js").ExprLike<NoInfer<T>>>(a: A, b: B): import("../field/calc/types.js").ComposedExpr<"bool", [A, B]>;
91
+ <T extends "text" | "date" | "datetime" | "handle" | "html", const A extends import("../field/calc/types.js").ExprLike<T>, const B extends import("../field/calc/types.js").ExprLike<NoInfer<T>>>(a: A, b: B): import("../field/calc/types.js").ComposedExpr<"bool", [A, B]>;
92
92
  };
93
93
  readonly gte: {
94
94
  <const A extends import("../field/calc/types.js").NumericLike, const B extends import("../field/calc/types.js").NumericLike>(a: A, b: B): import("../field/calc/types.js").ComposedExpr<"bool", [A, B]>;
95
- <T extends "date" | "datetime" | "handle" | "text" | "html", const A extends import("../field/calc/types.js").ExprLike<T>, const B extends import("../field/calc/types.js").ExprLike<NoInfer<T>>>(a: A, b: B): import("../field/calc/types.js").ComposedExpr<"bool", [A, B]>;
95
+ <T extends "text" | "date" | "datetime" | "handle" | "html", const A extends import("../field/calc/types.js").ExprLike<T>, const B extends import("../field/calc/types.js").ExprLike<NoInfer<T>>>(a: A, b: B): import("../field/calc/types.js").ComposedExpr<"bool", [A, B]>;
96
96
  };
97
97
  readonly lte: {
98
98
  <const A extends import("../field/calc/types.js").NumericLike, const B extends import("../field/calc/types.js").NumericLike>(a: A, b: B): import("../field/calc/types.js").ComposedExpr<"bool", [A, B]>;
99
- <T extends "date" | "datetime" | "handle" | "text" | "html", const A extends import("../field/calc/types.js").ExprLike<T>, const B extends import("../field/calc/types.js").ExprLike<NoInfer<T>>>(a: A, b: B): import("../field/calc/types.js").ComposedExpr<"bool", [A, B]>;
99
+ <T extends "text" | "date" | "datetime" | "handle" | "html", const A extends import("../field/calc/types.js").ExprLike<T>, const B extends import("../field/calc/types.js").ExprLike<NoInfer<T>>>(a: A, b: B): import("../field/calc/types.js").ComposedExpr<"bool", [A, B]>;
100
100
  };
101
101
  readonly eq: {
102
102
  <const A extends import("../field/calc/types.js").NumericLike, const B extends import("../field/calc/types.js").NumericLike>(a: A, b: B): import("../field/calc/types.js").ComposedExpr<"bool", [A, B]>;
103
- <T extends "group" | "bool" | "date" | "datetime" | "handle" | "json" | "text" | "user" | "html" | "attachment" | "picklist" | "multiPicklist" | "uuid", const A extends import("../field/calc/types.js").ExprLike<T>, const B extends import("../field/calc/types.js").ExprLike<NoInfer<T>>>(a: A, b: B): import("../field/calc/types.js").ComposedExpr<"bool", [A, B]>;
103
+ <T extends "text" | "group" | "bool" | "date" | "datetime" | "handle" | "json" | "user" | "html" | "attachment" | "picklist" | "multiPicklist" | "uuid", const A extends import("../field/calc/types.js").ExprLike<T>, const B extends import("../field/calc/types.js").ExprLike<NoInfer<T>>>(a: A, b: B): import("../field/calc/types.js").ComposedExpr<"bool", [A, B]>;
104
104
  };
105
105
  readonly ne: {
106
106
  <const A extends import("../field/calc/types.js").NumericLike, const B extends import("../field/calc/types.js").NumericLike>(a: A, b: B): import("../field/calc/types.js").ComposedExpr<"bool", [A, B]>;
107
- <T extends "group" | "bool" | "date" | "datetime" | "handle" | "json" | "text" | "user" | "html" | "attachment" | "picklist" | "multiPicklist" | "uuid", const A extends import("../field/calc/types.js").ExprLike<T>, const B extends import("../field/calc/types.js").ExprLike<NoInfer<T>>>(a: A, b: B): import("../field/calc/types.js").ComposedExpr<"bool", [A, B]>;
107
+ <T extends "text" | "group" | "bool" | "date" | "datetime" | "handle" | "json" | "user" | "html" | "attachment" | "picklist" | "multiPicklist" | "uuid", const A extends import("../field/calc/types.js").ExprLike<T>, const B extends import("../field/calc/types.js").ExprLike<NoInfer<T>>>(a: A, b: B): import("../field/calc/types.js").ComposedExpr<"bool", [A, B]>;
108
108
  };
109
109
  readonly and: <const A extends import("../field/calc/types.js").BoolLike, const B extends import("../field/calc/types.js").BoolLike, const Rest extends readonly import("../field/calc/types.js").BoolLike[]>(a: A, b: B, ...rest: Rest) => import("../field/calc/types.js").ComposedExpr<"bool", [A, B, ...Rest]>;
110
110
  readonly or: <const A extends import("../field/calc/types.js").BoolLike, const B extends import("../field/calc/types.js").BoolLike, const Rest extends readonly import("../field/calc/types.js").BoolLike[]>(a: A, b: B, ...rest: Rest) => import("../field/calc/types.js").ComposedExpr<"bool", [A, B, ...Rest]>;
111
111
  readonly if: {
112
112
  <const Condition extends import("../field/calc/types.js").BoolLike, const Then extends import("../field/calc/types.js").NumericLike, const Else extends import("../field/calc/types.js").NumericLike>(cond: Condition, thenArm: Then, elseArm: Else): import("../field/calc/types.js").ComposedExpr<import("../field/calc/types.js").NumericPromotion<Then, Else>, [Condition, Then, Else]>;
113
- <T extends "group" | "bool" | "date" | "datetime" | "handle" | "json" | "text" | "user" | "html" | "attachment" | "picklist" | "multiPicklist" | "uuid", const Condition extends import("../field/calc/types.js").BoolLike, const Then extends import("../field/calc/types.js").ExprLike<T>, const Else extends import("../field/calc/types.js").ExprLike<NoInfer<T>>>(cond: Condition, thenArm: Then, elseArm: Else): import("../field/calc/types.js").ComposedExpr<T, [Condition, Then, Else]>;
113
+ <T extends "text" | "group" | "bool" | "date" | "datetime" | "handle" | "json" | "user" | "html" | "attachment" | "picklist" | "multiPicklist" | "uuid", const Condition extends import("../field/calc/types.js").BoolLike, const Then extends import("../field/calc/types.js").ExprLike<T>, const Else extends import("../field/calc/types.js").ExprLike<NoInfer<T>>>(cond: Condition, thenArm: Then, elseArm: Else): import("../field/calc/types.js").ComposedExpr<T, [Condition, Then, Else]>;
114
114
  };
115
115
  readonly ifs: <T extends ExprType, const Rest extends readonly unknown[]>(condition: import("../field/calc/types.js").BoolLike, value: import("../field/calc/types.js").ExprLike<T>, ...rest: Rest & (Rest extends readonly [] ? readonly [] : Rest extends readonly [infer Condition, infer Value, ...infer Rest_1] ? readonly [Condition & import("../field/calc/types.js").BoolLike, Value & import("../field/calc/types.js").ExprLike<NoInfer<T>>, ...Rest_1 extends readonly [] ? readonly [] : Rest_1 extends readonly [infer Condition, infer Value, ...infer Rest_1] ? readonly [Condition & import("../field/calc/types.js").BoolLike, Value & import("../field/calc/types.js").ExprLike<NoInfer<T>>, ...Rest_1 extends readonly [] ? readonly [] : Rest_1 extends readonly [infer Condition, infer Value, ...infer Rest_1] ? readonly [Condition & import("../field/calc/types.js").BoolLike, Value & import("../field/calc/types.js").ExprLike<NoInfer<T>>, ...Rest_1 extends readonly [] ? readonly [] : Rest_1 extends readonly [infer Condition, infer Value, ...infer Rest_1] ? readonly [Condition & import("../field/calc/types.js").BoolLike, Value & import("../field/calc/types.js").ExprLike<NoInfer<T>>, ...Rest_1 extends readonly [] ? readonly [] : Rest_1 extends readonly [infer Condition, infer Value, ...infer Rest_1] ? readonly [Condition & import("../field/calc/types.js").BoolLike, Value & import("../field/calc/types.js").ExprLike<NoInfer<T>>, ...Rest_1 extends readonly [] ? readonly [] : Rest_1 extends readonly [infer Condition, infer Value, ...infer Rest_1] ? readonly [Condition & import("../field/calc/types.js").BoolLike, Value & import("../field/calc/types.js").ExprLike<NoInfer<T>>, ...Rest_1 extends readonly [] ? readonly [] : Rest_1 extends readonly [infer Condition, infer Value, ...infer Rest_1] ? readonly [Condition & import("../field/calc/types.js").BoolLike, Value & import("../field/calc/types.js").ExprLike<NoInfer<T>>, ...Rest_1 extends readonly [] ? readonly [] : Rest_1 extends readonly [infer Condition, infer Value, ...infer Rest_1] ? readonly [Condition & import("../field/calc/types.js").BoolLike, Value & import("../field/calc/types.js").ExprLike<NoInfer<T>>, ...Rest_1 extends readonly [] ? readonly [] : Rest_1 extends readonly [infer Condition, infer Value, ...infer Rest_1] ? readonly [Condition & import("../field/calc/types.js").BoolLike, Value & import("../field/calc/types.js").ExprLike<NoInfer<T>>, ...Rest_1 extends readonly [] ? readonly [] : Rest_1 extends readonly [infer Condition, infer Value, ...infer Rest_1] ? readonly [Condition & import("../field/calc/types.js").BoolLike, Value & import("../field/calc/types.js").ExprLike<NoInfer<T>>, ...Rest_1 extends readonly [] ? readonly [] : Rest_1 extends readonly [infer Condition, infer Value, ...infer Rest_1] ? readonly [Condition & import("../field/calc/types.js").BoolLike, Value & import("../field/calc/types.js").ExprLike<NoInfer<T>>, .../*elided*/ any] : never] : never] : never] : never] : never] : never] : never] : never] : never] : never] : never)) => import("../field/calc/types.js").ComposedExpr<T, [typeof condition, typeof value, ...Rest]>;
116
116
  readonly isBlank: <T extends ExprType, const Value extends import("../field/calc/types.js").ExprLike<T>>(value: Value) => import("../field/calc/types.js").ComposedExpr<"bool", [Value]>;
@@ -31,9 +31,19 @@
31
31
  * explicit `unsafePlatformId(...)` escape hatch and retain bridge diagnostics.
32
32
  */
33
33
  import type { AutomationAst } from "./ast.js";
34
- import type { UnresolvedReferenceDiagnostic } from "../../../graph/types.js";
35
- /** Keep the authored publish token across pull; live workflow versions are not author intent. */
36
- export declare function preserveAuthoredAutomationRevision(freshSource: string, existingSource: string): string;
34
+ import type { MergePulledSourceContext, UnresolvedReferenceDiagnostic } from "../../../graph/types.js";
35
+ /**
36
+ * Keep the authored publish token across pull; live workflow versions are not
37
+ * author intent (#693). The token must still agree with what state tracks, or a
38
+ * fresh-state pull + adopt plans a republish that downgrades the live revision
39
+ * (#1590): adoption imports the live revision, and the provider's Read keeps
40
+ * whatever revision state holds. So the authored token wins only when it is at
41
+ * least the baseline — the state revision, or the freshly printed live revision
42
+ * when state has no entry yet (adoption is about to import it). An older
43
+ * authored token is replaced by that baseline. Without readable state the
44
+ * pre-#1590 behaviour (always keep authored) is unchanged.
45
+ */
46
+ export declare function preserveAuthoredAutomationRevision(freshSource: string, existingSource: string, context?: MergePulledSourceContext): string;
37
47
  /**
38
48
  * Extract a string-literal (or `+`-concatenated literals) description from
39
49
  * authored automation source. Pull reprints often omit description entirely
@@ -67,7 +77,7 @@ export declare function extractAuthoredAutomationDescription(source: string): st
67
77
  */
68
78
  export declare function preserveAuthoredAutomationDescription(freshSource: string, existingSource: string): string;
69
79
  /** Pull merge: preserve authored revision + description across live reprint. */
70
- export declare function preserveAuthoredAutomationPullMeta(freshSource: string, existingSource: string): string;
80
+ export declare function preserveAuthoredAutomationPullMeta(freshSource: string, existingSource: string, context?: MergePulledSourceContext): string;
71
81
  /** A plain-JS script file printed beside the automation, relative to the automations folder. */
72
82
  export interface PrintedScriptFile {
73
83
  readonly path: string;
@@ -99,6 +109,9 @@ export interface PrintAutomationV2Options {
99
109
  */
100
110
  readonly foreignAppRefNames?: ReadonlyMap<string, string>;
101
111
  readonly foreignElementRefNames?: ReadonlyMap<string, string>;
112
+ /** Namespace → refName, for owners ei exports with only a `namespace`. */
113
+ readonly foreignAppRefNamespaces?: ReadonlyMap<string, string>;
114
+ readonly foreignElementRefNamespaces?: ReadonlyMap<string, string>;
102
115
  readonly foreignTaskRefNames?: ReadonlyMap<string, string>;
103
116
  /** Diagnostics emitted by the bridge for raw UUIDs retained in this pull. */
104
117
  readonly unresolvedReferences?: readonly UnresolvedReferenceDiagnostic[];