@elementumai/edk 0.9.20 → 0.10.1

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 (147) 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/to-tf.d.ts +6 -0
  49. package/dist-sdk/src/entities/app/to-tf.js +21 -2
  50. package/dist-sdk/src/entities/automation/build.d.ts +10 -2
  51. package/dist-sdk/src/entities/automation/build.js +104 -17
  52. package/dist-sdk/src/entities/automation/calculation-expression.d.ts +7 -7
  53. package/dist-sdk/src/entities/automation/deserializer/print-automation.d.ts +17 -4
  54. package/dist-sdk/src/entities/automation/deserializer/print-automation.js +156 -19
  55. package/dist-sdk/src/entities/automation/from-tf.d.ts +9 -2
  56. package/dist-sdk/src/entities/automation/from-tf.js +366 -86
  57. package/dist-sdk/src/entities/automation/index.d.ts +1 -1
  58. package/dist-sdk/src/entities/automation/index.js +1 -1
  59. package/dist-sdk/src/entities/automation/module.d.ts +3 -0
  60. package/dist-sdk/src/entities/automation/module.js +70 -7
  61. package/dist-sdk/src/entities/automation/script-code.d.ts +5 -2
  62. package/dist-sdk/src/entities/automation/script-code.js +23 -5
  63. package/dist-sdk/src/entities/automation/task-output-labels.d.ts +37 -0
  64. package/dist-sdk/src/entities/automation/task-output-labels.js +76 -0
  65. package/dist-sdk/src/entities/automation/tasks.d.ts +92 -20
  66. package/dist-sdk/src/entities/automation/tasks.js +48 -15
  67. package/dist-sdk/src/entities/automation/to-tf.d.ts +20 -3
  68. package/dist-sdk/src/entities/automation/to-tf.js +606 -62
  69. package/dist-sdk/src/entities/automation/triggers.d.ts +8 -4
  70. package/dist-sdk/src/entities/automation/types.d.ts +9 -0
  71. package/dist-sdk/src/entities/automation/types.js +19 -0
  72. package/dist-sdk/src/entities/automation/value-ref-tf.d.ts +1 -1
  73. package/dist-sdk/src/entities/automation/value-ref-tf.js +1 -1
  74. package/dist-sdk/src/entities/chart/from-tf.js +9 -1
  75. package/dist-sdk/src/entities/data-lookup/module.js +2 -0
  76. package/dist-sdk/src/entities/dynamic-layout/to-tf.d.ts +1 -0
  77. package/dist-sdk/src/entities/dynamic-layout/to-tf.js +7 -5
  78. package/dist-sdk/src/entities/element/build.d.ts +3 -0
  79. package/dist-sdk/src/entities/element/build.js +1 -0
  80. package/dist-sdk/src/entities/element/from-tf.js +4 -0
  81. package/dist-sdk/src/entities/element/to-tf.d.ts +1 -1
  82. package/dist-sdk/src/entities/element/to-tf.js +8 -14
  83. package/dist-sdk/src/entities/field/build.d.ts +3 -2
  84. package/dist-sdk/src/entities/field/calc.d.ts +7 -7
  85. package/dist-sdk/src/entities/field/from-tf.d.ts +4 -4
  86. package/dist-sdk/src/entities/field/from-tf.js +205 -48
  87. package/dist-sdk/src/entities/field/module.js +1 -0
  88. package/dist-sdk/src/entities/field/options.js +6 -1
  89. package/dist-sdk/src/entities/field/to-tf.d.ts +4 -4
  90. package/dist-sdk/src/entities/field/to-tf.js +7 -1
  91. package/dist-sdk/src/entities/field/types.d.ts +2 -0
  92. package/dist-sdk/src/entities/field/types.js +27 -0
  93. package/dist-sdk/src/entities/role/from-tf.js +3 -3
  94. package/dist-sdk/src/entities/role/to-tf.d.ts +2 -0
  95. package/dist-sdk/src/entities/role/to-tf.js +12 -4
  96. package/dist-sdk/src/entities/service-account/from-tf.js +3 -3
  97. package/dist-sdk/src/entities/service-account/workspace-owner.d.ts +16 -0
  98. package/dist-sdk/src/entities/service-account/workspace-owner.js +22 -0
  99. package/dist-sdk/src/entities/shared/filters/ast.d.ts +15 -1
  100. package/dist-sdk/src/entities/shared/filters/ast.js +2 -0
  101. package/dist-sdk/src/entities/shared/filters/index.d.ts +5 -0
  102. package/dist-sdk/src/entities/shared/filters/index.js +5 -0
  103. package/dist-sdk/src/entities/shared/filters/print.js +7 -2
  104. package/dist-sdk/src/entities/shared/filters/tf-codec.d.ts +5 -0
  105. package/dist-sdk/src/entities/shared/filters/tf-codec.js +42 -7
  106. package/dist-sdk/src/entities/shared/filters/types.d.ts +8 -3
  107. package/dist-sdk/src/entities/shared/ref.d.ts +5 -7
  108. package/dist-sdk/src/entities/shared/ref.js +5 -7
  109. package/dist-sdk/src/entities/shared/tool-field-ref.d.ts +9 -0
  110. package/dist-sdk/src/entities/shared/tool-field-ref.js +35 -2
  111. package/dist-sdk/src/entities/shared/types/field-types.d.ts +10 -0
  112. package/dist-sdk/src/entities/shared/types/field-types.js +4 -0
  113. package/dist-sdk/src/entities/skill/access-policy.js +3 -3
  114. package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.d.ts +3 -0
  115. package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +12 -5
  116. package/dist-sdk/src/entities/skill/from-tf.js +4 -2
  117. package/dist-sdk/src/entities/skill/module.js +2 -0
  118. package/dist-sdk/src/entities/skill-tool/from-tf.js +41 -8
  119. package/dist-sdk/src/entities/skill-tool/module.js +3 -0
  120. package/dist-sdk/src/entities/skill-tool/to-tf.d.ts +0 -6
  121. package/dist-sdk/src/entities/skill-tool/to-tf.js +22 -9
  122. package/dist-sdk/src/entities/task/build.d.ts +8 -0
  123. package/dist-sdk/src/entities/task/build.js +10 -1
  124. package/dist-sdk/src/entities/task/from-tf.d.ts +4 -2
  125. package/dist-sdk/src/entities/task/from-tf.js +7 -2
  126. package/dist-sdk/src/entities/task/module.js +2 -2
  127. package/dist-sdk/src/entities/task/to-tf.d.ts +8 -4
  128. package/dist-sdk/src/entities/task/to-tf.js +28 -1
  129. package/dist-sdk/src/entities/view/from-tf.js +9 -1
  130. package/dist-sdk/src/entities/view/to-tf.d.ts +6 -7
  131. package/dist-sdk/src/entities/view/to-tf.js +19 -8
  132. package/dist-sdk/src/entities/visual-flow/build.d.ts +16 -1
  133. package/dist-sdk/src/entities/visual-flow/build.js +9 -0
  134. package/dist-sdk/src/entities/visual-flow/from-tf.d.ts +14 -0
  135. package/dist-sdk/src/entities/visual-flow/from-tf.js +51 -3
  136. package/dist-sdk/src/entities/visual-flow/index.d.ts +1 -1
  137. package/dist-sdk/src/entities/visual-flow/index.js +1 -1
  138. package/dist-sdk/src/entities/visual-flow/printer.js +19 -0
  139. package/dist-sdk/src/entities/visual-flow/to-tf.js +87 -3
  140. package/dist-sdk/src/entities/widget/from-tf.js +3 -3
  141. package/dist-sdk/src/entities/widget/to-tf.d.ts +2 -0
  142. package/dist-sdk/src/entities/widget/to-tf.js +7 -6
  143. package/dist-sdk/src/generated/ragnarok/ragnarok-spec.d.ts +133 -9
  144. package/dist-sdk/src/generated/ragnarok/ragnarok-spec.js +2 -2
  145. package/dist-sdk/src/graph/index.d.ts +1 -0
  146. package/dist-sdk/src/graph/types.d.ts +29 -3
  147. package/package.json +7 -3
@@ -14,6 +14,8 @@
14
14
  * Unsupported authoring shapes degrade through `diagnostics` — reported,
15
15
  * never silent, never thrown (plan §4.3).
16
16
  */
17
+ import { typedCoverageGap } from "../../engine/coverage-gaps.js";
18
+ import { autoShareToTf } from "./auto-share.js";
17
19
  import { workspaceAspectKey } from "../../engine/build/context.js";
18
20
  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
21
  import { EntityTfError } from "../../engine/entity.js";
@@ -29,11 +31,25 @@ import { categoryIdExpr, missingCategoryDiagnostic } from "../org/category-ref.j
29
31
  import { CLOUD_LINK_ORG_BAG } from "../org/cloud-link.js";
30
32
  import { recordCreateFormToTf } from "../record-create-form/to-tf.js";
31
33
  import { relationshipsToTf } from "../relationship/to-tf.js";
34
+ import { workspaceServiceAccountAppResolver } from "../service-account/workspace-owner.js";
32
35
  import { rolesToTf } from "../role/to-tf.js";
33
36
  import { appServiceAccountBlocks } from "../service-account/to-tf.js";
34
37
  import { relationshipTargetsFromBag, widgetsToTf } from "../widget/to-tf.js";
35
38
  import { viewToTf } from "../view/to-tf.js";
36
39
  import { APP_RESOURCE_TYPE } from "./module.js";
40
+ /**
41
+ * The named gap for a system-field tag with no canonical key (edk#1480).
42
+ * Defensive: every tag in SYSTEM_FIELD_TAGS maps today, so a new tag lands
43
+ * here until SYSTEM_FIELD_TAG_BY_KEY learns it.
44
+ */
45
+ export function unsupportedSystemTagGap(systemTag) {
46
+ return typedCoverageGap({
47
+ kind: "dropped",
48
+ entity: "systemFields",
49
+ detail: `unsupported semantic tag ${systemTag}; validation flags dropped`,
50
+ consequence: "the field's required/validation flags are not applied, so that validation is not enforced",
51
+ });
52
+ }
37
53
  /** System-field tags that fold into the app resource instead of emitting a field resource. */
38
54
  export const SYSTEM_FIELD_TAGS = new Set([
39
55
  "TITLE",
@@ -82,6 +98,8 @@ export function appToTf(entity, ctx) {
82
98
  appAttrs["comments_enabled"] = payload.commentsEnabled;
83
99
  if (payload.lockStages !== undefined)
84
100
  appAttrs["lock_stages"] = payload.lockStages;
101
+ if (payload.autoShare !== undefined)
102
+ appAttrs["auto_share"] = autoShareToTf(payload.autoShare);
85
103
  const categoryName = payload.category?.name;
86
104
  if (categoryName !== undefined && categoryName !== "") {
87
105
  const category = ctx.orgRefs.byName(CATEGORY_ORG_BAG, categoryName);
@@ -136,7 +154,7 @@ export function appToTf(entity, ctx) {
136
154
  if (systemTag !== undefined) {
137
155
  const systemKey = SYSTEM_FIELD_KEY_BY_TAG[systemTag];
138
156
  if (systemKey === undefined) {
139
- ctx.diagnostics.push(`systemFields: unsupported semantic tag ${systemTag}; validation flags dropped`);
157
+ ctx.diagnostics.push(unsupportedSystemTagGap(systemTag));
140
158
  }
141
159
  else {
142
160
  // Canonical system key (title/id/status/…) must map to the display
@@ -271,7 +289,6 @@ export function appToTf(entity, ctx) {
271
289
  const { blocks: viewBlocks } = viewToTf(payload.layouts, payload.listViews, payload.calendarViews, payload.kanbanViews, payload.dashboardViews, payload.agentViews, payload.viewOrder, {
272
290
  ownerRefName: ctx.appRefName,
273
291
  ownerTfLabel: ctx.appTfLabel,
274
- aspectName: payload.name ?? "",
275
292
  objectId,
276
293
  stageTfLabels,
277
294
  dashboardKeys: new Set(Object.keys(payload.dashboards ?? {})),
@@ -328,6 +345,7 @@ export function appToTf(entity, ctx) {
328
345
  appRefName: ctx.appRefName,
329
346
  serviceAccounts: payload.serviceAccounts,
330
347
  fieldAddresses,
348
+ resolveServiceAccountApp: workspaceServiceAccountAppResolver(ctx.workspaceAspects),
331
349
  });
332
350
  blocks.push(block);
333
351
  }
@@ -339,6 +357,7 @@ export function appToTf(entity, ctx) {
339
357
  serviceAccounts: payload.serviceAccounts,
340
358
  orgRefs: ctx.orgRefs,
341
359
  diagnostics: ctx.diagnostics,
360
+ resolveServiceAccountApp: workspaceServiceAccountAppResolver(ctx.workspaceAspects),
342
361
  }));
343
362
  blocks.push(...appServiceAccountBlocks(payload, {
344
363
  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;
@@ -258,6 +258,7 @@ interface ActionMethods<TTrigger, TActions extends Record<string, unknown>, TVar
258
258
  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
259
  record: RecordShape<A>;
260
260
  }>;
261
+ 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
262
  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
263
  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
264
  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 +286,13 @@ interface ActionMethods<TTrigger, TActions extends Record<string, unknown>, TVar
285
286
  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
287
  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
288
  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>>;
289
+ 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
290
  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
291
  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
292
  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
293
  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
294
  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>;
295
+ 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
296
  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
297
  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
298
  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 +404,10 @@ export interface AutomationConfigured {
402
404
  * `AutomationConfigured` with `ref(refName)` and `def(refName)`.
403
405
  */
404
406
  export declare function automation(opts: AutomationOptions): AutomationConfigured;
407
+ /**
408
+ * A record trigger carries no aspect of its own on the wire: it always fires
409
+ * on the automation's owning app or element. A trigger authored against any
410
+ * other app would silently attach to the owner, so it is a build error (#1594).
411
+ */
412
+ export declare function assertTriggerOnOwningAspect(automationRefName: string, ownerRefName: string, triggerAppRefName: string | undefined): void;
405
413
  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,65 @@ 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
+ /** Canonical service_tasks names. They are not authoring accessors. */
233
+ const EXECUTE_SCRIPT_CANONICAL_OUTPUT_NAMES = new Set(["stringArrayResult", "numberArrayResult"]);
234
+ /**
235
+ * Top-level property names on a wire `output_schema` object. `undefined` means
236
+ * the script declared no schema, so a `result.<prop>` cannot be checked.
237
+ */
238
+ function declaredScriptResultProperties(schema) {
239
+ if (typeof schema !== "object" || schema === null || !("object" in schema))
240
+ return undefined;
241
+ const object = schema.object;
242
+ if (typeof object !== "object" || object === null)
243
+ return undefined;
244
+ const properties = object.properties;
245
+ if (!Array.isArray(properties))
246
+ return new Set();
247
+ const names = new Set();
248
+ for (const property of properties) {
249
+ if (typeof property !== "object" || property === null)
250
+ continue;
251
+ for (const node of Object.values(property)) {
252
+ if (typeof node === "object" && node !== null && typeof node.name === "string") {
253
+ names.add(node.name);
254
+ }
255
+ }
256
+ }
257
+ return names;
258
+ }
259
+ /**
260
+ * A script's declared outputs are read under `result`. A bare
261
+ * `ctx.actions.<script>.<name>` would compile to a `refs["<name>"]` key the
262
+ * platform never sets, so apply fails with "Invalid index". When the script
263
+ * declares an output schema, `result.<prop>` is checked against that schema
264
+ * too. Authoring names are `result`, `textResult`, and `result.<prop>`.
265
+ * `Text Result` is the refs-map key `textResult` rewrites to, not a name
266
+ * someone authors. The canonical publish path also accepts the service_tasks
267
+ * contract names.
268
+ */
269
+ function assertKnownScriptOutput(name, taskRefKey, schema, canonical, checkDeclaredResult) {
270
+ if (name === "result" || name === "textResult")
271
+ return;
272
+ if (canonical && EXECUTE_SCRIPT_CANONICAL_OUTPUT_NAMES.has(name))
273
+ return;
274
+ if (name.startsWith("result.")) {
275
+ // Filter `{type:"TASK"}` shapes are not refs-map reads. A switch left_value
276
+ // whose script does not declare the property stays a typed envelope on the
277
+ // task `.id` (#1151), which to-tf emits with a diagnostic.
278
+ if (!checkDeclaredResult)
279
+ return;
280
+ const declared = declaredScriptResultProperties(schema);
281
+ const property = name.slice("result.".length).split(".")[0] ?? "";
282
+ if (declared === undefined || declared.has(property))
283
+ return;
284
+ const listed = [...declared].join(", ");
285
+ throw new EntityTfError(`executeScript${taskRefKey === undefined ? "" : ` task "${taskRefKey}"`} has no output "${name}"; ` +
286
+ `declared result properties are ${listed === "" ? "(none)" : listed}.`);
287
+ }
288
+ throw new EntityTfError(`executeScript${taskRefKey === undefined ? "" : ` task "${taskRefKey}"`} has no output "${name}"; ` +
289
+ `script outputs are read under result. Use ctx.actions.${taskRefKey ?? "<script>"}.result.${name}.`);
290
+ }
232
291
  /**
233
292
  * Forward output-name rewrites, the inverse of the deserializer's read-side
234
293
  * normalization (`applyOutputNameInverseRewrites` in
@@ -257,7 +316,7 @@ function assertKnownSearchOutput(taskKey, wireNames, name, taskRefKey) {
257
316
  * - single-scalar-output tasks (see `OUTPUT_KEY_WIRE_NAME`): `output` →
258
317
  * the platform's actual output name for that task kind.
259
318
  */
260
- function rewriteForwardTaskRefName(taskKey, name, taskRefKey) {
319
+ function rewriteForwardTaskRefName(taskKey, name, taskRefKey, schema, checkDeclaredScriptResult = true) {
261
320
  if (taskKey === "findRelatedRecords" && FIND_RELATED_RECORDS_COUNT_REF_NAMES.has(name.split(".")[0])) {
262
321
  throw findRelatedRecordsTotalCountError(taskRefKey);
263
322
  }
@@ -275,8 +334,10 @@ function rewriteForwardTaskRefName(taskKey, name, taskRefKey) {
275
334
  assertKnownSearchOutput("userSearch", USER_SEARCH_REF_WIRE_NAMES, name, taskRefKey);
276
335
  return USER_SEARCH_REF_WIRE_NAMES[name] ?? name;
277
336
  }
278
- if (taskKey === "executeScript" && name === "textResult") {
279
- return "Text Result";
337
+ if (taskKey === "executeScript") {
338
+ assertKnownScriptOutput(name, taskRefKey, schema, false, checkDeclaredScriptResult);
339
+ if (name === "textResult")
340
+ return "Text Result";
280
341
  }
281
342
  if (taskKey === "aiSearchTable" && AI_SEARCH_TABLE_OUTPUT_NAMES[name] !== undefined) {
282
343
  return AI_SEARCH_TABLE_OUTPUT_NAMES[name][0];
@@ -314,17 +375,19 @@ function rewriteForwardTaskRefName(taskKey, name, taskRefKey) {
314
375
  * accessor → canonical; identity for most kinds. Validated against
315
376
  * TASK_OUTPUT_CONTRACTS by canonical-reference-model.test.ts.
316
377
  */
317
- export function rewriteCanonicalOutputRefName(taskKey, name, taskRefKey) {
378
+ export function rewriteCanonicalOutputRefName(taskKey, name, taskRefKey, schema) {
318
379
  if (taskKey === "findRelatedRecords" && FIND_RELATED_RECORDS_COUNT_REF_NAMES.has(name.split(".")[0])) {
319
380
  throw findRelatedRecordsTotalCountError(taskRefKey);
320
381
  }
382
+ if (taskKey === "executeScript")
383
+ assertKnownScriptOutput(name, taskRefKey, schema, true, true);
321
384
  if (taskKey === "api" && name.startsWith("file.")) {
322
385
  // apiRequest's file SUB-refs (.file.content / .contentType / .name) have no
323
386
  // canonical service_tasks output name of their own — they resolve by the
324
387
  // provider's refs-map DISPLAY label ("Content" / "Content Type" / "Name", via
325
388
  // API_TASK_REF_WIRE_NAMES). Keep the base display rewrite. Top-level api
326
389
  // outputs ARE contract names and ride the envelope as identity.
327
- return rewriteForwardTaskRefName(taskKey, name, taskRefKey);
390
+ return rewriteForwardTaskRefName(taskKey, name, taskRefKey, schema);
328
391
  }
329
392
  if ((taskKey === "recordSearch" || taskKey === "tableRecordsSearch") && name === "totalCount") {
330
393
  // Both expose a `totalCount` accessor, but the executors' canonical count
@@ -359,12 +422,12 @@ export function rewriteCanonicalOutputRefName(taskKey, name, taskRefKey) {
359
422
  // aiAgent is NOT a #835 display-label victim: base already emits the correct
360
423
  // platform reference via rewriteForwardTaskRefName + to-tf's
361
424
  // aiAgentPlatformRefName. Keep that intact by delegating to the forward rewrite.
362
- return rewriteForwardTaskRefName(taskKey, name, taskRefKey);
425
+ return rewriteForwardTaskRefName(taskKey, name, taskRefKey, schema);
363
426
  }
364
427
  if (taskKey === "documentModel") {
365
428
  // file_reader's published output wire name is "text" (confirmed live wire
366
429
  // data), NOT a #835 display-label victim. Keep base behavior.
367
- return rewriteForwardTaskRefName(taskKey, name, taskRefKey);
430
+ return rewriteForwardTaskRefName(taskKey, name, taskRefKey, schema);
368
431
  }
369
432
  if (taskKey === "recordSearch" && name === "record.recordId") {
370
433
  // recordSearch exposes a real canonical `recordId` output (service_tasks
@@ -375,7 +438,7 @@ export function rewriteCanonicalOutputRefName(taskKey, name, taskRefKey) {
375
438
  // createRecord/findRelatedRecords do NOT expose a `recordId` output
376
439
  // (find_related_records has none in service_tasks). Their record-id reference
377
440
  // is "Record" (ASPECT_RECORD_ID) — the base behavior. Keep via forward rewrite.
378
- return rewriteForwardTaskRefName(taskKey, name, taskRefKey);
441
+ return rewriteForwardTaskRefName(taskKey, name, taskRefKey, schema);
379
442
  }
380
443
  const canonicalOutputKey = taskKey ? OUTPUT_KEY_CANONICAL[taskKey] : undefined;
381
444
  if (canonicalOutputKey) {
@@ -395,7 +458,7 @@ export function rewriteCanonicalOutputRefName(taskKey, name, taskRefKey) {
395
458
  * the `ref*` filter helpers) — both need the same rewrite. Runs at finalize,
396
459
  * when the full refKey→kind map is known.
397
460
  */
398
- function rewriteTaskOutputRefs(node, taskKindByRefKey,
461
+ function rewriteTaskOutputRefs(node, taskKindByRefKey, scriptSchemas,
399
462
  // Workflow OUTPUTS pass canonical=true: a `taskReference.name` becomes the
400
463
  // platform's CANONICAL service_tasks output name (edk#835). Task inputs and
401
464
  // filters (canonical=false, the default) keep the display rewrite — #1271 owns
@@ -403,7 +466,7 @@ function rewriteTaskOutputRefs(node, taskKindByRefKey,
403
466
  canonical = false) {
404
467
  if (Array.isArray(node)) {
405
468
  for (const item of node)
406
- rewriteTaskOutputRefs(item, taskKindByRefKey, canonical);
469
+ rewriteTaskOutputRefs(item, taskKindByRefKey, scriptSchemas, canonical);
407
470
  return;
408
471
  }
409
472
  if (node === null || typeof node !== "object")
@@ -416,23 +479,29 @@ canonical = false) {
416
479
  : undefined;
417
480
  if (wholeRecord !== undefined)
418
481
  mapped.name = wholeRecord;
482
+ // Field mappings read a trigger's whole record too, which shares its
483
+ // display name with the record ID (edk#1284); see TRIGGER_WHOLE_RECORD_MARKER.
484
+ const value = rec.value;
485
+ if (value?.triggerReference?.name === TRIGGER_WHOLE_RECORD_REF_NAME) {
486
+ rec.value = { ...value, [TRIGGER_WHOLE_RECORD_MARKER]: true };
487
+ }
419
488
  }
420
489
  const ref = rec.taskReference;
421
490
  if (ref && typeof ref.taskRefKey === "string" && typeof ref.name === "string") {
422
491
  const rewrite = canonical ? rewriteCanonicalOutputRefName : rewriteForwardTaskRefName;
423
- ref.name = rewrite(taskKindByRefKey.get(ref.taskRefKey), ref.name, ref.taskRefKey);
492
+ ref.name = rewrite(taskKindByRefKey.get(ref.taskRefKey), ref.name, ref.taskRefKey, scriptSchemas.get(ref.taskRefKey));
424
493
  }
425
494
  if (rec.type === "TASK" && typeof rec.taskRefKey === "string" && typeof rec.name === "string") {
426
495
  // Filter `{type:"TASK"}` shapes never appear in a workflow OUTPUT subtree;
427
496
  // keep the display rewrite (#1271's filter path) regardless of `canonical`.
428
- rec.name = rewriteForwardTaskRefName(taskKindByRefKey.get(rec.taskRefKey), rec.name, rec.taskRefKey);
497
+ rec.name = rewriteForwardTaskRefName(taskKindByRefKey.get(rec.taskRefKey), rec.name, rec.taskRefKey, scriptSchemas.get(rec.taskRefKey), false);
429
498
  }
430
499
  for (const [key, v] of Object.entries(rec)) {
431
500
  // A calc-engine mustache subtree (`calculationReference` → templateReference)
432
501
  // keeps the display/forward rewrite even under an output, so its decode
433
502
  // (decodeCalculationTaskMustache) stays idempotent.
434
503
  const childCanonical = key === "calculationReference" ? false : canonical;
435
- rewriteTaskOutputRefs(v, taskKindByRefKey, childCanonical);
504
+ rewriteTaskOutputRefs(v, taskKindByRefKey, scriptSchemas, childCanonical);
436
505
  }
437
506
  }
438
507
  /**
@@ -541,6 +610,7 @@ function makeActionBuilder(state, mode = "root", item, loops = {}) {
541
610
  tableRecordsSearch: actionFactories.tableRecordsSearch,
542
611
  createRecord: actionFactories.createRecord,
543
612
  updateField: actionFactories.updateField,
613
+ bulkUpdateFields: actionFactories.bulkUpdateFields,
544
614
  findRelatedRecords: actionFactories.findRelatedRecords,
545
615
  relateRecords: actionFactories.relateRecords,
546
616
  sendEmail: actionFactories.sendEmail,
@@ -561,6 +631,7 @@ function makeActionBuilder(state, mode = "root", item, loops = {}) {
561
631
  approvalStatusUpdate: actionFactories.approvalStatusUpdate,
562
632
  addWatcher: actionFactories.addWatcher,
563
633
  saveAttachment: actionFactories.saveAttachment,
634
+ unzip: actionFactories.unzip,
564
635
  userSearch: actionFactories.userSearch,
565
636
  userGroupSearch: actionFactories.userGroupSearch,
566
637
  initiateCall: actionFactories.initiateCall,
@@ -681,13 +752,16 @@ function makeActionBuilder(state, mode = "root", item, loops = {}) {
681
752
  },
682
753
  __finalize() {
683
754
  const taskKindByRefKey = collectTaskKinds(state.tasks);
755
+ const scriptSchemas = collectExecuteScriptOutputSchemas(state.tasks);
684
756
  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);
757
+ // Deep copy: the rewrites below mutate in place, and `state.outputs` is
758
+ // shared by every build of this definition (#1536).
759
+ const outputs = state.outputs?.map((o) => structuredClone(o));
760
+ rewriteTaskOutputRefs(tasks, taskKindByRefKey, scriptSchemas);
687
761
  // Workflow OUTPUTS emit the platform's CANONICAL output name (edk#835);
688
762
  // task inputs/filters above stay on the display path (#1271 owns them).
689
763
  if (outputs)
690
- rewriteTaskOutputRefs(outputs, taskKindByRefKey, /* canonical */ true);
764
+ rewriteTaskOutputRefs(outputs, taskKindByRefKey, scriptSchemas, /* canonical */ true);
691
765
  // Trigger reference names are NOT canonicalized: the authored name is
692
766
  // the name, everywhere in EDK. (Mobius canonicalizes reference names in
693
767
  // ITS storage — `ValueReference.ofTriggerReference` — but on the tf
@@ -802,6 +876,7 @@ export function automation(opts) {
802
876
  def(refName) {
803
877
  const sequence = opts.actions.__finalize();
804
878
  const recordFieldContext = mergeOnDemandRecordFieldContext(sequence.recordFieldContext, sequence.trigger);
879
+ assertTriggerOnOwningAspect(refName, opts.app.refName, sequence.recordFieldContext?.triggerAppRefName);
805
880
  // `recordFieldContext` is a structural extension, not a declared `DeployableEntity`
806
881
  // property (see `RecordFieldContext`'s doc comment) — assigning to `entity`
807
882
  // first (rather than returning the literal directly) avoids an excess-property
@@ -854,3 +929,15 @@ function soleOnDemandRecordTargetRefName(trigger) {
854
929
  });
855
930
  return targets.length === 1 ? targets[0] : undefined;
856
931
  }
932
+ /**
933
+ * A record trigger carries no aspect of its own on the wire: it always fires
934
+ * on the automation's owning app or element. A trigger authored against any
935
+ * other app would silently attach to the owner, so it is a build error (#1594).
936
+ */
937
+ export function assertTriggerOnOwningAspect(automationRefName, ownerRefName, triggerAppRefName) {
938
+ if (triggerAppRefName === undefined || triggerAppRefName === ownerRefName)
939
+ return;
940
+ throw new Error(`automation "${automationRefName}": its trigger is on "${triggerAppRefName}", but the automation is owned by "${ownerRefName}". ` +
941
+ `Record triggers always fire on the owning app or element; move this automation under "${triggerAppRefName}" ` +
942
+ `(set app: to it) or trigger on "${ownerRefName}".`);
943
+ }
@@ -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[];