@elementumai/edk 0.11.0 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (222) hide show
  1. package/README.md +40 -6
  2. package/dist-sdk/src/catalog/factories.d.ts +7 -1
  3. package/dist-sdk/src/catalog/factories.js +2 -0
  4. package/dist-sdk/src/catalog/index.d.ts +2 -2
  5. package/dist-sdk/src/catalog/index.js +1 -1
  6. package/dist-sdk/src/catalog/org.js +79 -34
  7. package/dist-sdk/src/catalog/token.js +5 -0
  8. package/dist-sdk/src/catalog/types.d.ts +7 -1
  9. package/dist-sdk/src/catalog/types.js +3 -0
  10. package/dist-sdk/src/core/system-fields.d.ts +1 -1
  11. package/dist-sdk/src/core/system-fields.js +1 -1
  12. package/dist-sdk/src/core/triggers/on-demand.d.ts +2 -0
  13. package/dist-sdk/src/core/triggers/on-demand.js +3 -0
  14. package/dist-sdk/src/core/types/app.d.ts +6 -0
  15. package/dist-sdk/src/engine/build/context.d.ts +3 -0
  16. package/dist-sdk/src/engine/coverage-gaps.d.ts +5 -0
  17. package/dist-sdk/src/engine/coverage-gaps.js +9 -0
  18. package/dist-sdk/src/engine/ei/run.d.ts +20 -1
  19. package/dist-sdk/src/engine/ei/run.js +102 -14
  20. package/dist-sdk/src/engine/pull/authored-address.js +42 -6
  21. package/dist-sdk/src/engine/pull/authored-root.d.ts +88 -0
  22. package/dist-sdk/src/engine/pull/authored-root.js +306 -0
  23. package/dist-sdk/src/engine/pull/context.d.ts +10 -0
  24. package/dist-sdk/src/engine/pull/field-refs-registry.d.ts +114 -0
  25. package/dist-sdk/src/engine/pull/field-refs-registry.js +501 -0
  26. package/dist-sdk/src/engine/pull/org.d.ts +1 -0
  27. package/dist-sdk/src/engine/pull/org.js +2 -0
  28. package/dist-sdk/src/engine/pull/partition.d.ts +8 -0
  29. package/dist-sdk/src/engine/pull/partition.js +43 -0
  30. package/dist-sdk/src/engine/pull/pulled-roots.d.ts +89 -0
  31. package/dist-sdk/src/engine/pull/pulled-roots.js +203 -0
  32. package/dist-sdk/src/engine/pull/ref-only.d.ts +22 -0
  33. package/dist-sdk/src/engine/pull/ref-only.js +59 -1
  34. package/dist-sdk/src/engine/pull/source-resources.d.ts +39 -0
  35. package/dist-sdk/src/engine/pull/source-resources.js +110 -0
  36. package/dist-sdk/src/engine/pull/stream-root.d.ts +148 -0
  37. package/dist-sdk/src/engine/pull/stream-root.js +563 -0
  38. package/dist-sdk/src/engine/workspace/reserved-catalog-keys.d.ts +47 -0
  39. package/dist-sdk/src/engine/workspace/reserved-catalog-keys.js +115 -0
  40. package/dist-sdk/src/entities/access-policy/build.d.ts +2 -1
  41. package/dist-sdk/src/entities/access-policy/from-tf.d.ts +9 -1
  42. package/dist-sdk/src/entities/access-policy/from-tf.js +25 -4
  43. package/dist-sdk/src/entities/access-policy/module.js +5 -0
  44. package/dist-sdk/src/entities/access-policy/to-tf.d.ts +19 -0
  45. package/dist-sdk/src/entities/access-policy/to-tf.js +65 -8
  46. package/dist-sdk/src/entities/agent/build.d.ts +52 -1
  47. package/dist-sdk/src/entities/agent/build.js +34 -0
  48. package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +68 -0
  49. package/dist-sdk/src/entities/agent/from-tf.d.ts +34 -1
  50. package/dist-sdk/src/entities/agent/from-tf.js +262 -2
  51. package/dist-sdk/src/entities/agent/index.d.ts +1 -1
  52. package/dist-sdk/src/entities/agent/to-tf.d.ts +8 -10
  53. package/dist-sdk/src/entities/agent/to-tf.js +158 -14
  54. package/dist-sdk/src/entities/agent-tool/from-tf.js +6 -0
  55. package/dist-sdk/src/entities/agent-tool/to-tf.d.ts +2 -2
  56. package/dist-sdk/src/entities/agent-tool/to-tf.js +2 -2
  57. package/dist-sdk/src/entities/app/build.d.ts +34 -14
  58. package/dist-sdk/src/entities/app/build.js +93 -16
  59. package/dist-sdk/src/entities/app/from-tf.js +25 -11
  60. package/dist-sdk/src/entities/app/index.d.ts +1 -0
  61. package/dist-sdk/src/entities/app/index.js +1 -0
  62. package/dist-sdk/src/entities/app/module.js +1 -0
  63. package/dist-sdk/src/entities/app/stage-keys.d.ts +20 -5
  64. package/dist-sdk/src/entities/app/stage-keys.js +43 -9
  65. package/dist-sdk/src/entities/app/to-tf.js +2 -0
  66. package/dist-sdk/src/entities/approval-chain/build.d.ts +46 -11
  67. package/dist-sdk/src/entities/approval-chain/build.js +120 -8
  68. package/dist-sdk/src/entities/approval-chain/from-tf.d.ts +24 -2
  69. package/dist-sdk/src/entities/approval-chain/from-tf.js +148 -6
  70. package/dist-sdk/src/entities/approval-chain/index.d.ts +4 -1
  71. package/dist-sdk/src/entities/approval-chain/index.js +4 -1
  72. package/dist-sdk/src/entities/approval-chain/module.js +23 -5
  73. package/dist-sdk/src/entities/approval-chain/printer.d.ts +1 -1
  74. package/dist-sdk/src/entities/approval-chain/printer.js +91 -5
  75. package/dist-sdk/src/entities/approval-chain/steps-tf.d.ts +77 -0
  76. package/dist-sdk/src/entities/approval-chain/steps-tf.js +255 -0
  77. package/dist-sdk/src/entities/approval-chain/steps.d.ts +71 -0
  78. package/dist-sdk/src/entities/approval-chain/steps.js +83 -0
  79. package/dist-sdk/src/entities/approval-chain/to-tf.d.ts +16 -6
  80. package/dist-sdk/src/entities/approval-chain/to-tf.js +37 -4
  81. package/dist-sdk/src/entities/automation/build.d.ts +50 -24
  82. package/dist-sdk/src/entities/automation/build.js +86 -33
  83. package/dist-sdk/src/entities/automation/deserializer/print-automation.js +52 -8
  84. package/dist-sdk/src/entities/automation/from-tf.d.ts +38 -6
  85. package/dist-sdk/src/entities/automation/from-tf.js +855 -157
  86. package/dist-sdk/src/entities/automation/index.d.ts +2 -1
  87. package/dist-sdk/src/entities/automation/index.js +1 -0
  88. package/dist-sdk/src/entities/automation/module.d.ts +4 -3
  89. package/dist-sdk/src/entities/automation/module.js +33 -12
  90. package/dist-sdk/src/entities/automation/refs-read.d.ts +19 -0
  91. package/dist-sdk/src/entities/automation/refs-read.js +48 -0
  92. package/dist-sdk/src/entities/automation/run-target.d.ts +2 -0
  93. package/dist-sdk/src/entities/automation/run-target.js +5 -0
  94. package/dist-sdk/src/entities/automation/script-code.d.ts +2 -1
  95. package/dist-sdk/src/entities/automation/script-code.js +82 -1
  96. package/dist-sdk/src/entities/automation/script-lint.d.ts +13 -0
  97. package/dist-sdk/src/entities/automation/script-lint.js +418 -0
  98. package/dist-sdk/src/entities/automation/slack-message-refs.d.ts +9 -0
  99. package/dist-sdk/src/entities/automation/slack-message-refs.js +75 -0
  100. package/dist-sdk/src/entities/automation/task-output-labels.d.ts +12 -1
  101. package/dist-sdk/src/entities/automation/task-output-labels.js +32 -1
  102. package/dist-sdk/src/entities/automation/tasks.d.ts +76 -18
  103. package/dist-sdk/src/entities/automation/tasks.js +52 -15
  104. package/dist-sdk/src/entities/automation/to-tf.d.ts +3 -0
  105. package/dist-sdk/src/entities/automation/to-tf.js +585 -97
  106. package/dist-sdk/src/entities/automation/triggers.d.ts +48 -23
  107. package/dist-sdk/src/entities/automation/triggers.js +27 -12
  108. package/dist-sdk/src/entities/automation/unsafe-script-output.d.ts +50 -0
  109. package/dist-sdk/src/entities/automation/unsafe-script-output.js +92 -0
  110. package/dist-sdk/src/entities/chart/build.d.ts +18 -2
  111. package/dist-sdk/src/entities/chart/from-tf.d.ts +2 -2
  112. package/dist-sdk/src/entities/chart/from-tf.js +28 -1
  113. package/dist-sdk/src/entities/chart/index.d.ts +1 -1
  114. package/dist-sdk/src/entities/chart/printer.js +5 -2
  115. package/dist-sdk/src/entities/chart/to-tf.js +38 -3
  116. package/dist-sdk/src/entities/dynamic-layout/build.d.ts +3 -0
  117. package/dist-sdk/src/entities/dynamic-layout/condition-keys.d.ts +48 -0
  118. package/dist-sdk/src/entities/dynamic-layout/condition-keys.js +261 -0
  119. package/dist-sdk/src/entities/dynamic-layout/from-tf.js +45 -6
  120. package/dist-sdk/src/entities/dynamic-layout/module.js +2 -1
  121. package/dist-sdk/src/entities/dynamic-layout/to-tf.js +46 -12
  122. package/dist-sdk/src/entities/element/audit-field-guard.d.ts +9 -0
  123. package/dist-sdk/src/entities/element/audit-field-guard.js +88 -0
  124. package/dist-sdk/src/entities/element/build.js +2 -1
  125. package/dist-sdk/src/entities/element/from-tf.js +15 -2
  126. package/dist-sdk/src/entities/element/module.js +3 -0
  127. package/dist-sdk/src/entities/element/system-fields.d.ts +13 -0
  128. package/dist-sdk/src/entities/element/system-fields.js +23 -0
  129. package/dist-sdk/src/entities/element/to-tf.js +2 -0
  130. package/dist-sdk/src/entities/field/build.d.ts +9 -0
  131. package/dist-sdk/src/entities/field/from-tf.d.ts +29 -1
  132. package/dist-sdk/src/entities/field/from-tf.js +99 -6
  133. package/dist-sdk/src/entities/field/module.js +12 -2
  134. package/dist-sdk/src/entities/field/to-tf.d.ts +13 -3
  135. package/dist-sdk/src/entities/field/to-tf.js +90 -46
  136. package/dist-sdk/src/entities/org/category.js +1 -0
  137. package/dist-sdk/src/entities/org/index.d.ts +1 -0
  138. package/dist-sdk/src/entities/org/index.js +1 -0
  139. package/dist-sdk/src/entities/org/role.js +5 -0
  140. package/dist-sdk/src/entities/org/voice-auth.d.ts +5 -0
  141. package/dist-sdk/src/entities/org/voice-auth.js +33 -0
  142. package/dist-sdk/src/entities/organization/build.d.ts +3 -0
  143. package/dist-sdk/src/entities/organization/build.js +2 -0
  144. package/dist-sdk/src/entities/organization/index.d.ts +1 -0
  145. package/dist-sdk/src/entities/organization/index.js +1 -0
  146. package/dist-sdk/src/entities/organization/to-tf.d.ts +2 -0
  147. package/dist-sdk/src/entities/organization/to-tf.js +59 -1
  148. package/dist-sdk/src/entities/organization/voice-auth.d.ts +60 -0
  149. package/dist-sdk/src/entities/organization/voice-auth.js +60 -0
  150. package/dist-sdk/src/entities/phone-service/build.d.ts +9 -1
  151. package/dist-sdk/src/entities/phone-service/build.js +1 -0
  152. package/dist-sdk/src/entities/phone-service/deserializer/print-phone-service.js +3 -0
  153. package/dist-sdk/src/entities/phone-service/from-tf.d.ts +1 -0
  154. package/dist-sdk/src/entities/phone-service/from-tf.js +8 -1
  155. package/dist-sdk/src/entities/phone-service/to-tf.js +16 -0
  156. package/dist-sdk/src/entities/record-create-form/from-tf.js +2 -2
  157. package/dist-sdk/src/entities/relationship/from-tf.js +7 -2
  158. package/dist-sdk/src/entities/relationship/module.js +2 -2
  159. package/dist-sdk/src/entities/relationship/pair-check.d.ts +6 -2
  160. package/dist-sdk/src/entities/relationship/pair-check.js +105 -18
  161. package/dist-sdk/src/entities/relationship/to-tf.js +5 -2
  162. package/dist-sdk/src/entities/role/permission-levels.d.ts +7 -0
  163. package/dist-sdk/src/entities/role/permission-levels.js +78 -0
  164. package/dist-sdk/src/entities/role/to-tf.js +32 -2
  165. package/dist-sdk/src/entities/service-account/module.d.ts +2 -1
  166. package/dist-sdk/src/entities/service-account/module.js +9 -1
  167. package/dist-sdk/src/entities/service-account/resource-type.d.ts +2 -0
  168. package/dist-sdk/src/entities/service-account/resource-type.js +2 -0
  169. package/dist-sdk/src/entities/service-account/role-fidelity.d.ts +5 -5
  170. package/dist-sdk/src/entities/service-account/role-fidelity.js +21 -13
  171. package/dist-sdk/src/entities/service-account/role-membership-check.d.ts +20 -0
  172. package/dist-sdk/src/entities/service-account/role-membership-check.js +80 -0
  173. package/dist-sdk/src/entities/shared/aspect-target-from-tf.d.ts +15 -0
  174. package/dist-sdk/src/entities/shared/aspect-target-from-tf.js +36 -0
  175. package/dist-sdk/src/entities/shared/filters/ast.d.ts +4 -0
  176. package/dist-sdk/src/entities/shared/filters/index.d.ts +85 -14
  177. package/dist-sdk/src/entities/shared/filters/index.js +18 -6
  178. package/dist-sdk/src/entities/shared/filters/option-lookups.d.ts +57 -0
  179. package/dist-sdk/src/entities/shared/filters/option-lookups.js +108 -0
  180. package/dist-sdk/src/entities/shared/filters/print.js +9 -5
  181. package/dist-sdk/src/entities/shared/filters/tf-codec.d.ts +12 -7
  182. package/dist-sdk/src/entities/shared/filters/tf-codec.js +9 -5
  183. package/dist-sdk/src/entities/shared/raw-option-id.d.ts +30 -0
  184. package/dist-sdk/src/entities/shared/raw-option-id.js +41 -0
  185. package/dist-sdk/src/entities/shared/tool-field-ref.js +6 -2
  186. package/dist-sdk/src/entities/shared/types/field-types.d.ts +6 -3
  187. package/dist-sdk/src/entities/shared/types/field-types.js +3 -1
  188. package/dist-sdk/src/entities/skill/input-coverage.js +5 -2
  189. package/dist-sdk/src/entities/skill/module.js +2 -0
  190. package/dist-sdk/src/entities/sla/build.d.ts +96 -0
  191. package/dist-sdk/src/entities/sla/build.js +124 -0
  192. package/dist-sdk/src/entities/sla/from-tf.d.ts +40 -0
  193. package/dist-sdk/src/entities/sla/from-tf.js +164 -0
  194. package/dist-sdk/src/entities/sla/index.d.ts +1 -0
  195. package/dist-sdk/src/entities/sla/index.js +1 -0
  196. package/dist-sdk/src/entities/sla/module.d.ts +4 -0
  197. package/dist-sdk/src/entities/sla/module.js +73 -0
  198. package/dist-sdk/src/entities/sla/printer.d.ts +2 -0
  199. package/dist-sdk/src/entities/sla/printer.js +84 -0
  200. package/dist-sdk/src/entities/sla/to-tf.d.ts +12 -0
  201. package/dist-sdk/src/entities/sla/to-tf.js +81 -0
  202. package/dist-sdk/src/entities/table/build.d.ts +7 -2
  203. package/dist-sdk/src/entities/table/build.js +22 -1
  204. package/dist-sdk/src/entities/table/deserializer/normalize.d.ts +4 -1
  205. package/dist-sdk/src/entities/table/from-tf.js +89 -14
  206. package/dist-sdk/src/entities/table/index.d.ts +1 -1
  207. package/dist-sdk/src/entities/table/to-tf.js +41 -2
  208. package/dist-sdk/src/entities/task/from-tf.js +2 -1
  209. package/dist-sdk/src/entities/task/to-tf.js +1 -0
  210. package/dist-sdk/src/entities/view/from-tf.d.ts +8 -4
  211. package/dist-sdk/src/entities/view/from-tf.js +10 -9
  212. package/dist-sdk/src/entities/view/module.js +5 -0
  213. package/dist-sdk/src/entities/widget/from-tf.js +15 -4
  214. package/dist-sdk/src/generated/ragnarok/ragnarok-spec.d.ts +51 -4
  215. package/dist-sdk/src/generated/ragnarok/ragnarok-spec.js +2 -2
  216. package/dist-sdk/src/graph/index.d.ts +20 -2
  217. package/dist-sdk/src/graph/index.js +19 -0
  218. package/dist-sdk/src/graph/modules.js +11 -1
  219. package/dist-sdk/src/graph/resource-types.d.ts +47 -0
  220. package/dist-sdk/src/graph/resource-types.js +62 -0
  221. package/dist-sdk/src/graph/types.d.ts +116 -6
  222. package/package.json +6 -3
@@ -0,0 +1,30 @@
1
+ /**
2
+ * A raw option id where an option is selected (#1733). Dax, 2026-11-03: "both
3
+ * should be supported. Anything that references ids should warn and mention
4
+ * the preferred method". A raw id builds as written, and build warns with the
5
+ * `filter.textOption(label)` spelling, naming the label when it is known.
6
+ */
7
+ import type { OptionIdIndex } from "../../engine/pull/field-refs-registry.js";
8
+ export interface RawOptionIdInput {
9
+ /** Where the id is used, e.g. `automation field "Club"`. */
10
+ readonly slot: string;
11
+ readonly fieldName: string;
12
+ readonly id: string;
13
+ /** The field's current option labels from source. */
14
+ readonly options: readonly string[];
15
+ /** The field's `<label>_options_by_label` local, when it has one in this workspace. */
16
+ readonly localName?: string;
17
+ readonly index?: OptionIdIndex;
18
+ }
19
+ /**
20
+ * The warning for a plain string compared with a Dropdown or Multi-Select
21
+ * with static options (#1733). Dax, 2026-11-03: "1733: warn on plain-string
22
+ * dropdown filters and point to textOption". `resolvesLabels` says what the
23
+ * filter's owner does with a string that matches an option label: access
24
+ * policies, dashboards, relationships and dynamic layouts resolve it to the
25
+ * option id, while automations and views send the word as written. A raw
26
+ * option id gets {@link rawOptionIdWarning} instead.
27
+ */
28
+ export declare function plainOptionStringWarning(slot: string, fieldName: string, value: string, options: readonly string[], resolvesLabels: boolean): string;
29
+ /** The warning for a raw option id: its option's label, a deleted option, or an unknown label. */
30
+ export declare function rawOptionIdWarning(input: RawOptionIdInput): string;
@@ -0,0 +1,41 @@
1
+ /**
2
+ * A raw option id where an option is selected (#1733). Dax, 2026-11-03: "both
3
+ * should be supported. Anything that references ids should warn and mention
4
+ * the preferred method". A raw id builds as written, and build warns with the
5
+ * `filter.textOption(label)` spelling, naming the label when it is known.
6
+ */
7
+ /**
8
+ * The warning for a plain string compared with a Dropdown or Multi-Select
9
+ * with static options (#1733). Dax, 2026-11-03: "1733: warn on plain-string
10
+ * dropdown filters and point to textOption". `resolvesLabels` says what the
11
+ * filter's owner does with a string that matches an option label: access
12
+ * policies, dashboards, relationships and dynamic layouts resolve it to the
13
+ * option id, while automations and views send the word as written. A raw
14
+ * option id gets {@link rawOptionIdWarning} instead.
15
+ */
16
+ export function plainOptionStringWarning(slot, fieldName, value, options, resolvesLabels) {
17
+ const isLabel = options.includes(value);
18
+ const outcome = isLabel && resolvesLabels
19
+ ? "Build resolves it to that option's id"
20
+ : `It is sent as the literal text ${JSON.stringify(value)}, not an option id`;
21
+ return `${slot} compares field "${fieldName}" with the plain string ${JSON.stringify(value)}. ` +
22
+ `${outcome}; the preferred form for an option is filter.textOption(${JSON.stringify(isLabel ? value : "<label>")})`;
23
+ }
24
+ /** The warning for a raw option id: its option's label, a deleted option, or an unknown label. */
25
+ export function rawOptionIdWarning(input) {
26
+ const { slot, fieldName, id, options, localName, index } = input;
27
+ const fieldIds = localName === undefined ? undefined : index?.idsByLocal.get(localName);
28
+ const label = fieldIds !== undefined
29
+ ? [...fieldIds].find(([, optionId]) => optionId === id)?.[0]
30
+ : index?.labelById.get(id);
31
+ if (label !== undefined && options.includes(label)) {
32
+ return `${slot} uses raw option id ${JSON.stringify(id)}, the option ${JSON.stringify(label)} of field "${fieldName}". ` +
33
+ `Raw ids still build; the preferred form is filter.textOption(${JSON.stringify(label)})`;
34
+ }
35
+ if (fieldIds !== undefined || label !== undefined) {
36
+ return `${slot} uses raw option id ${JSON.stringify(id)}, which is no longer an option of field "${fieldName}", so the option no longer exists. ` +
37
+ `It builds as written; select a current option with filter.textOption("<label>")`;
38
+ }
39
+ return `${slot} uses raw option id ${JSON.stringify(id)} on field "${fieldName}", whose label is not known locally. ` +
40
+ `Raw ids still build; the preferred form is filter.textOption("<label>")`;
41
+ }
@@ -1,4 +1,7 @@
1
- import { isTfExpr, ownerFromScopedChildLabel, scopedLabelToBagKey, tfLabelToTsLabel } from "../../engine/tf/index.js";
1
+ import { isTfExpr, ownerFromScopedChildLabel, tfLabelToTsLabel } from "../../engine/tf/index.js";
2
+ import { SYSTEM_FIELD_KEY_SET } from "../../core/system-fields.js";
3
+ import { bagKeyForPulledCustomField } from "../field/from-tf.js";
4
+ import { ELEMENT_SYSTEM_FIELD_KEYS } from "../element/system-fields.js";
2
5
  import { SUB_TYPE_BY_RESOURCE as FIELD_SUB_TYPE_BY_RESOURCE } from "../field/types.js";
3
6
  export function resolveToolFieldKey(fieldRef, scopeTfLabel, scope = "app", ctx) {
4
7
  if (fieldRef === undefined)
@@ -8,7 +11,8 @@ export function resolveToolFieldKey(fieldRef, scopeTfLabel, scope = "app", ctx)
8
11
  // into a key on this tool's target (edk#1403 review S1).
9
12
  if (toolFieldRefOtherOwner(fieldRef, scopeTfLabel, scope) !== undefined)
10
13
  return undefined;
11
- return scopedLabelToBagKey(scopeTfLabel, fieldRef.label, scope);
14
+ const reserved = scope === "element" ? new Set(ELEMENT_SYSTEM_FIELD_KEYS) : SYSTEM_FIELD_KEY_SET;
15
+ return bagKeyForPulledCustomField(scopeTfLabel, fieldRef.label, scope, reserved);
12
16
  }
13
17
  if (isTfExpr(fieldRef) && fieldRef.$expr === "data-attr" && fieldRef.type === "elementum_field") {
14
18
  const fieldAttrs = ctx?.dataAttrs?.("elementum_field", fieldRef.label);
@@ -25,6 +25,7 @@ export type WorkflowFieldType = "TEXT" | "HANDLE" | "NUMBER" | "DECIMAL" | "BOOL
25
25
  *
26
26
  * `userId` follows the same rule: the provider's attribute spells USER_ID as
27
27
  * a bare "user", so to-tf maps USER_ID -> "user" and from-tf maps it back.
28
+ * So does `groupId` (GROUP_ID, the provider's "group"; #2204).
28
29
  */
29
30
  export declare const FIELD_TYPE_MAP: {
30
31
  readonly text: "TEXT";
@@ -35,6 +36,7 @@ export declare const FIELD_TYPE_MAP: {
35
36
  readonly datetime: "DATETIME";
36
37
  readonly user: "USER";
37
38
  readonly userId: "USER_ID";
39
+ readonly groupId: "GROUP_ID";
38
40
  readonly json: "JSON";
39
41
  readonly object: "OBJECT";
40
42
  readonly attachmentId: "ATTACHMENT_ID";
@@ -60,12 +62,13 @@ export type TriggerFieldTypeAlias = Exclude<FieldTypeAlias, "user">;
60
62
  * Subset of {@link TriggerFieldTypeAlias} that an `onDemand` input may
61
63
  * declare. Mirrors the provider's `elementum_on_demand_trigger`
62
64
  * `parameters[].type` enum (text, number, decimal, boolean, date, datetime,
63
- * user, group, attachment, record): `json` and `object` have no provider
65
+ * user, group, attachment, record), with USER_ID, GROUP_ID and ATTACHMENT_ID
66
+ * authored as `userId`, `groupId` and `attachmentId`: `json` and `object` have no provider
64
67
  * spelling, so OpenTofu rejects the generated config at plan time (#1415).
65
68
  */
66
69
  export type OnDemandParamTypeAlias = Exclude<TriggerFieldTypeAlias, "json" | "object">;
67
70
  /** Runtime list of {@link OnDemandParamTypeAlias} values. */
68
- export declare const ON_DEMAND_PARAM_TYPES: readonly ["text", "number", "decimal", "boolean", "date", "datetime", "userId", "attachmentId", "record"];
71
+ export declare const ON_DEMAND_PARAM_TYPES: readonly ["text", "number", "decimal", "boolean", "date", "datetime", "userId", "groupId", "attachmentId", "record"];
69
72
  /**
70
73
  * Maps a user-friendly FieldTypeAlias to the TypeScript type it represents.
71
74
  * Used to derive the phantom T in Ref<T> for trigger inputs.
@@ -75,4 +78,4 @@ export declare const ON_DEMAND_PARAM_TYPES: readonly ["text", "number", "decimal
75
78
  * Used when generating app definitions from Hydra's field metadata.
76
79
  */
77
80
  export declare const ASPECT_FIELD_TYPE_NAME_TO_WORKFLOW_FIELD_TYPE: Record<string, WorkflowFieldType>;
78
- export type FieldTypeToTS<A extends FieldTypeAlias> = A extends "text" ? string : A extends "number" | "decimal" ? number : A extends "boolean" ? boolean : A extends "date" | "datetime" ? string : A extends "user" ? string : A extends "userId" ? CalculationTypedValue<string, "user"> : A extends "attachmentId" ? string : A extends "json" | "object" ? unknown : A extends "record" ? RecordShape<AppOrElementRef> : unknown;
81
+ export type FieldTypeToTS<A extends FieldTypeAlias> = A extends "text" ? string : A extends "number" | "decimal" ? number : A extends "boolean" ? boolean : A extends "date" | "datetime" ? string : A extends "user" ? string : A extends "userId" ? CalculationTypedValue<string, "user"> : A extends "attachmentId" ? string : A extends "groupId" ? string : A extends "json" | "object" ? unknown : A extends "record" ? RecordShape<AppOrElementRef> : unknown;
@@ -13,6 +13,7 @@
13
13
  *
14
14
  * `userId` follows the same rule: the provider's attribute spells USER_ID as
15
15
  * a bare "user", so to-tf maps USER_ID -> "user" and from-tf maps it back.
16
+ * So does `groupId` (GROUP_ID, the provider's "group"; #2204).
16
17
  */
17
18
  export const FIELD_TYPE_MAP = {
18
19
  text: "TEXT",
@@ -23,6 +24,7 @@ export const FIELD_TYPE_MAP = {
23
24
  datetime: "DATETIME",
24
25
  user: "USER",
25
26
  userId: "USER_ID",
27
+ groupId: "GROUP_ID",
26
28
  json: "JSON",
27
29
  object: "OBJECT",
28
30
  attachmentId: "ATTACHMENT_ID",
@@ -34,7 +36,7 @@ export function isOnDemandRecordType(type) {
34
36
  }
35
37
  /** Runtime list of {@link OnDemandParamTypeAlias} values. */
36
38
  export const ON_DEMAND_PARAM_TYPES = [
37
- "text", "number", "decimal", "boolean", "date", "datetime", "userId", "attachmentId", "record",
39
+ "text", "number", "decimal", "boolean", "date", "datetime", "userId", "groupId", "attachmentId", "record",
38
40
  ];
39
41
  /**
40
42
  * Maps a user-friendly FieldTypeAlias to the TypeScript type it represents.
@@ -104,10 +104,13 @@ export function formatSkillLookupNotes(lookups) {
104
104
  return lines.join("\n");
105
105
  }
106
106
  export function deriveSkillInstructions(baseProse, inputs, lookups) {
107
- const raw = baseProse?.trim() ?? "";
107
+ // With nothing to generate, send the text exactly as written: pull keeps the
108
+ // platform's instructions byte for byte, so trimming here planned a diff for
109
+ // every skill whose instructions end in a newline (edk#2512).
108
110
  if (inputs === undefined && lookups === undefined) {
109
- return raw;
111
+ return baseProse ?? "";
110
112
  }
113
+ const raw = baseProse?.trim() ?? "";
111
114
  const decomposed = decomposeSkillInstructions(raw);
112
115
  const effectiveInputs = inputs !== undefined
113
116
  ? inputs
@@ -142,6 +142,8 @@ export const skillModule = {
142
142
  },
143
143
  roundtrip: {
144
144
  referenceAliases: [],
145
+ // Provider set attributes (edk#2437): order carries no meaning.
146
+ unorderedListAttributes: ["user_ids", "group_ids"],
145
147
  stringSuffixAliases: [
146
148
  {
147
149
  attribute: "instructions",
@@ -0,0 +1,96 @@
1
+ import type { Filter } from "../shared/filters/types.js";
2
+ import type { CatalogRef } from "../../catalog/index.js";
3
+ import type { DeployableEntity, EntityDeployOptions } from "../../engine/entity.js";
4
+ declare const slaTimeUnitBrand: unique symbol;
5
+ /** The unit of an SLA target's allowed time. Use {@link slaTimeUnit}. */
6
+ export type SlaTimeUnit = string & {
7
+ readonly [slaTimeUnitBrand]: "SlaTimeUnit";
8
+ };
9
+ export declare const slaTimeUnit: {
10
+ readonly seconds: SlaTimeUnit;
11
+ readonly minutes: SlaTimeUnit;
12
+ readonly hours: SlaTimeUnit;
13
+ readonly days: SlaTimeUnit;
14
+ readonly weeks: SlaTimeUnit;
15
+ readonly months: SlaTimeUnit;
16
+ readonly years: SlaTimeUnit;
17
+ };
18
+ declare const slaWeekDayBrand: unique symbol;
19
+ /** A working day of an SLA target. Use {@link slaWeekDay}. */
20
+ export type SlaWeekDay = string & {
21
+ readonly [slaWeekDayBrand]: "SlaWeekDay";
22
+ };
23
+ export declare const slaWeekDay: {
24
+ readonly monday: SlaWeekDay;
25
+ readonly tuesday: SlaWeekDay;
26
+ readonly wednesday: SlaWeekDay;
27
+ readonly thursday: SlaWeekDay;
28
+ readonly friday: SlaWeekDay;
29
+ readonly saturday: SlaWeekDay;
30
+ readonly sunday: SlaWeekDay;
31
+ };
32
+ /** A 24-hour `HH:MM` or `HH:MM:SS` time. */
33
+ export declare const SLA_LOCAL_TIME: RegExp;
34
+ /** One record target: the time allowed and the working hours that count toward it. */
35
+ export interface SlaTarget {
36
+ readonly name: string;
37
+ /** Time allowed, counted only during working hours. */
38
+ readonly time: {
39
+ readonly amount: number;
40
+ readonly unit: SlaTimeUnit;
41
+ };
42
+ readonly workingHours: {
43
+ readonly days: readonly SlaWeekDay[];
44
+ /** 24-hour start time, `HH:MM` or `HH:MM:SS`, such as `"08:00:00"`. */
45
+ readonly start: string;
46
+ /** 24-hour end time, `HH:MM` or `HH:MM:SS`, such as `"17:00:00"`. */
47
+ readonly end: string;
48
+ /** IANA time zone, such as `"America/Denver"`. Omit to let the platform choose. */
49
+ readonly timezone?: string;
50
+ };
51
+ /** Optional record filter; same typed DSL as views and tables. Omit to keep a live filter. App-owned SLAs only. */
52
+ readonly filter?: Filter;
53
+ /**
54
+ * Approval entity this target sits on (edk#373). Approval-process-owned SLAs
55
+ * only; omit to target the whole process. Forbidden on app-owned SLAs.
56
+ */
57
+ readonly approval?: {
58
+ readonly entityId?: string;
59
+ readonly entityType?: "APPROVAL_CHAIN_TEMPLATE" | "APPROVAL_TEMPLATE_PRIORITY_GROUP" | "APPROVAL_TEMPLATE_CONDITIONAL";
60
+ };
61
+ }
62
+ export interface SlaAppOptions<AppRefName extends string = string> extends EntityDeployOptions {
63
+ /** The app that owns the SLA. */
64
+ readonly app: CatalogRef<"app", AppRefName>;
65
+ readonly approvalProcess?: never;
66
+ readonly name: string;
67
+ readonly description?: string;
68
+ /** Whether the clock runs. Defaults to `true`. */
69
+ readonly active?: boolean;
70
+ /** Keys of the app stages the clock runs in, as authored on the app's `stages`. */
71
+ readonly stages: readonly string[];
72
+ readonly targets: readonly SlaTarget[];
73
+ }
74
+ export interface SlaApprovalOptions<AppRefName extends string = string> extends EntityDeployOptions {
75
+ /** The approval process that owns the SLA (edk#373). */
76
+ readonly approvalProcess: CatalogRef<"approvalChain"> & {
77
+ readonly parent: AppRefName;
78
+ };
79
+ readonly app?: never;
80
+ readonly name: string;
81
+ readonly description?: string;
82
+ readonly active?: boolean;
83
+ readonly stages?: never;
84
+ readonly targets: readonly SlaTarget[];
85
+ }
86
+ export type SlaOptions<AppRefName extends string = string> = SlaAppOptions<AppRefName> | SlaApprovalOptions<AppRefName>;
87
+ export interface SlaConfigured {
88
+ def(refName: string): DeployableEntity;
89
+ }
90
+ /**
91
+ * Define an app SLA clock: a timer that runs while a record is in one of
92
+ * `stages`, with ordered record targets. Place it at
93
+ * `apps/<appRef>/slas/<slaRef>.ts`.
94
+ */
95
+ export declare function sla<const AppRefName extends string>(opts: SlaOptions<AppRefName>): SlaConfigured;
96
+ export {};
@@ -0,0 +1,124 @@
1
+ import { EdkValidationError } from "../../../elementum-entity-client/errors.js";
2
+ export const slaTimeUnit = {
3
+ seconds: "SECOND",
4
+ minutes: "MINUTE",
5
+ hours: "HOUR",
6
+ days: "DAY",
7
+ weeks: "WEEK",
8
+ months: "MONTH",
9
+ years: "YEAR",
10
+ };
11
+ export const slaWeekDay = {
12
+ monday: "MONDAY",
13
+ tuesday: "TUESDAY",
14
+ wednesday: "WEDNESDAY",
15
+ thursday: "THURSDAY",
16
+ friday: "FRIDAY",
17
+ saturday: "SATURDAY",
18
+ sunday: "SUNDAY",
19
+ };
20
+ const TIME_UNITS = new Set(Object.values(slaTimeUnit));
21
+ const WEEK_DAYS = new Set(Object.values(slaWeekDay));
22
+ /** A 24-hour `HH:MM` or `HH:MM:SS` time. */
23
+ export const SLA_LOCAL_TIME = /^([01][0-9]|2[0-3]):[0-5][0-9](:[0-5][0-9])?$/;
24
+ function validateSla(refName, opts) {
25
+ const fail = (message) => {
26
+ throw new EdkValidationError(`sla "${refName}": ${message}`);
27
+ };
28
+ const approvalOwned = opts.approvalProcess !== undefined;
29
+ if (approvalOwned) {
30
+ if (opts.approvalProcess.__kind !== "approvalChain")
31
+ fail("approvalProcess must be an approval-chain catalog ref");
32
+ }
33
+ else if (opts.app.__kind !== "app") {
34
+ fail("app must be an app catalog ref");
35
+ }
36
+ if (opts.name.trim() === "")
37
+ fail("name must not be empty");
38
+ if (opts.description !== undefined && opts.description.trim() === "")
39
+ fail("description must not be empty when set");
40
+ if (!approvalOwned) {
41
+ const stages = new Set();
42
+ for (const stage of opts.stages) {
43
+ if (stage.trim() === "")
44
+ fail("stage keys must not be empty");
45
+ if (stages.has(stage))
46
+ fail(`stage "${stage}" is listed twice`);
47
+ stages.add(stage);
48
+ }
49
+ }
50
+ if (opts.targets.length === 0)
51
+ fail("targets must list at least one target");
52
+ opts.targets.forEach((target, index) => {
53
+ const where = `target ${index} ("${target.name}")`;
54
+ if (target.name.trim() === "")
55
+ fail(`target ${index}: name must not be empty`);
56
+ if (!Number.isInteger(target.time.amount) || target.time.amount < 1)
57
+ fail(`${where}: time.amount must be a whole number of at least 1`);
58
+ if (!TIME_UNITS.has(target.time.unit))
59
+ fail(`${where}: time.unit must be a slaTimeUnit constant`);
60
+ const hours = target.workingHours;
61
+ if (!SLA_LOCAL_TIME.test(hours.start))
62
+ fail(`${where}: workingHours.start must be a 24-hour HH:MM or HH:MM:SS time`);
63
+ if (!SLA_LOCAL_TIME.test(hours.end))
64
+ fail(`${where}: workingHours.end must be a 24-hour HH:MM or HH:MM:SS time`);
65
+ if (hours.timezone !== undefined && hours.timezone.trim() === "")
66
+ fail(`${where}: workingHours.timezone must not be empty when set`);
67
+ if (hours.days.length === 0)
68
+ fail(`${where}: workingHours.days must list at least one day`);
69
+ const days = new Set();
70
+ for (const day of hours.days) {
71
+ if (!WEEK_DAYS.has(day))
72
+ fail(`${where}: workingHours.days must use slaWeekDay constants`);
73
+ if (days.has(day))
74
+ fail(`${where}: day ${day} is listed twice`);
75
+ days.add(day);
76
+ }
77
+ if (approvalOwned && target.filter !== undefined)
78
+ fail(`${where}: filter is only for app-owned SLAs`);
79
+ if (!approvalOwned && target.approval !== undefined)
80
+ fail(`${where}: approval is only for approval-process-owned SLAs`);
81
+ if (target.approval?.entityId !== undefined) {
82
+ fail(`${where}: approval.entityId is a raw platform id; omit it or use a typed approver/conditional ref (entityType alone / empty approval remains allowed)`);
83
+ }
84
+ });
85
+ }
86
+ /**
87
+ * Define an app SLA clock: a timer that runs while a record is in one of
88
+ * `stages`, with ordered record targets. Place it at
89
+ * `apps/<appRef>/slas/<slaRef>.ts`.
90
+ */
91
+ export function sla(opts) {
92
+ return {
93
+ def(refName) {
94
+ validateSla(refName, opts);
95
+ const approvalOwned = opts.approvalProcess !== undefined;
96
+ const parent = approvalOwned ? opts.approvalProcess.parent : opts.app.refName;
97
+ return {
98
+ kind: "sla",
99
+ parent,
100
+ refName,
101
+ payload: {
102
+ ...(approvalOwned
103
+ ? { approvalProcess: { refName: opts.approvalProcess.refName, parent: opts.approvalProcess.parent } }
104
+ : { app: { refName: opts.app.refName }, stages: [...opts.stages] }),
105
+ name: opts.name,
106
+ ...(opts.description !== undefined ? { description: opts.description } : {}),
107
+ active: opts.active ?? true,
108
+ targets: opts.targets.map((target) => ({
109
+ name: target.name,
110
+ timePeriod: target.time.amount,
111
+ timeUnit: target.time.unit,
112
+ workingStartTime: target.workingHours.start,
113
+ workingEndTime: target.workingHours.end,
114
+ ...(target.workingHours.timezone !== undefined ? { workingTimezone: target.workingHours.timezone } : {}),
115
+ workingWeekDays: [...target.workingHours.days],
116
+ ...(target.filter !== undefined ? { filter: target.filter } : {}),
117
+ ...(target.approval !== undefined ? { approval: target.approval } : {}),
118
+ })),
119
+ },
120
+ ...(opts.enabled !== undefined ? { enabled: opts.enabled } : {}),
121
+ };
122
+ },
123
+ };
124
+ }
@@ -0,0 +1,40 @@
1
+ import { EntityTfError } from "../../engine/entity.js";
2
+ import type { FromTfContext } from "../../engine/pull/context.js";
3
+ import type { RefExpr } from "../shared/filters/ast.js";
4
+ import type { Filter } from "../shared/filters/types.js";
5
+ import { type TfBlock } from "../../engine/tf/index.js";
6
+ import { type StageHandleIndex } from "../app/stage-keys.js";
7
+ /**
8
+ * An SLA the public API cannot express, such as one with no record targets.
9
+ * Like a lost stage handle, it is reported, released and its file archived.
10
+ */
11
+ export declare class UnmanagedSlaError extends EntityTfError {
12
+ constructor(message: string);
13
+ }
14
+ export interface NormalizedSlaTarget {
15
+ readonly name: string;
16
+ readonly timePeriod: number;
17
+ readonly timeUnit: string;
18
+ readonly workingStartTime: string;
19
+ readonly workingEndTime: string;
20
+ readonly workingTimezone?: string;
21
+ readonly workingWeekDays: readonly string[];
22
+ readonly filter?: Filter<RefExpr, RefExpr>;
23
+ readonly approval?: NormalizedSlaApproval;
24
+ }
25
+ export interface NormalizedSlaApproval {
26
+ readonly entityId?: string;
27
+ readonly entityType?: string;
28
+ }
29
+ export interface NormalizedSla {
30
+ readonly refName: string;
31
+ readonly name: string;
32
+ readonly description?: string;
33
+ readonly active: boolean;
34
+ /** Stage handles for app-owned SLAs; empty for approval-owned. */
35
+ readonly stages: readonly string[];
36
+ /** Approval process TF label when approval-owned (edk#373). */
37
+ readonly approvalProcessTfLabel?: string;
38
+ readonly targets: readonly NormalizedSlaTarget[];
39
+ }
40
+ export declare function slaFromTf(block: TfBlock, appTfLabel: string, stageHandles: StageHandleIndex | undefined, ctx?: FromTfContext): NormalizedSla;
@@ -0,0 +1,164 @@
1
+ import { EntityTfError } from "../../engine/entity.js";
2
+ import { filterFromTf } from "../access-policy/from-tf.js";
3
+ import { resourceRefLabel } from "../../engine/pull/context.js";
4
+ import { isTfExpr, scopedLabelToBagKey, tfLabelToTsLabel } from "../../engine/tf/index.js";
5
+ import { LostStageHandleError, lostStageMessage, pulledStageHandle } from "../app/stage-keys.js";
6
+ import { APP_RESOURCE_TYPE } from "../app/module.js";
7
+ import { APPROVAL_PROCESS_RESOURCE_TYPE } from "../approval-chain/module.js";
8
+ import { SLA_RESOURCE_TYPE } from "./module.js";
9
+ const KNOWN = new Set(["id", "app_id", "approval_process_id", "owner_aspect_id", "name", "description", "active", "stage_ids", "targets"]);
10
+ const TARGET_KNOWN = new Set([
11
+ "name", "time_period", "time_unit", "working_start_time", "working_end_time", "working_timezone", "working_week_days", "filter", "approval",
12
+ ]);
13
+ /**
14
+ * An SLA the public API cannot express, such as one with no record targets.
15
+ * Like a lost stage handle, it is reported, released and its file archived.
16
+ */
17
+ export class UnmanagedSlaError extends EntityTfError {
18
+ constructor(message) {
19
+ super(message);
20
+ this.name = "UnmanagedSlaError";
21
+ }
22
+ }
23
+ function isRecord(value) {
24
+ return typeof value === "object" && value !== null && !Array.isArray(value) && !isTfExpr(value);
25
+ }
26
+ export function slaFromTf(block, appTfLabel, stageHandles, ctx) {
27
+ const where = `${block.type}.${block.label ?? ""}`;
28
+ if (block.type !== SLA_RESOURCE_TYPE || block.label === undefined)
29
+ throw new EntityTfError(`expected ${SLA_RESOURCE_TYPE}`);
30
+ for (const key of Object.keys(block.attrs)) {
31
+ if (!KNOWN.has(key))
32
+ throw new EntityTfError(`${where}: unknown attribute ${key} — extend slaFromTf deliberately`);
33
+ }
34
+ const approvalProcessTfLabel = resourceRefLabel(block.attrs["approval_process_id"], APPROVAL_PROCESS_RESOURCE_TYPE);
35
+ const appOwned = block.attrs["app_id"] !== undefined;
36
+ if (appOwned && approvalProcessTfLabel !== undefined) {
37
+ throw new EntityTfError(`${where}: set exactly one of app_id or approval_process_id`);
38
+ }
39
+ if (appOwned) {
40
+ if (resourceRefLabel(block.attrs["app_id"], APP_RESOURCE_TYPE) !== appTfLabel) {
41
+ throw new EntityTfError(`${where}: app_id does not reference ${APP_RESOURCE_TYPE}.${appTfLabel}`);
42
+ }
43
+ }
44
+ else if (approvalProcessTfLabel === undefined) {
45
+ throw new EntityTfError(`${where}: expected app_id or approval_process_id`);
46
+ }
47
+ const name = block.attrs["name"];
48
+ if (typeof name !== "string" || name === "")
49
+ throw new EntityTfError(`${where}: name must be a literal string`);
50
+ const description = block.attrs["description"];
51
+ if (description !== undefined && typeof description !== "string")
52
+ throw new EntityTfError(`${where}: description must be a literal string`);
53
+ const active = block.attrs["active"] ?? true;
54
+ if (typeof active !== "boolean")
55
+ throw new EntityTfError(`${where}: active must be a literal boolean`);
56
+ const stages = [];
57
+ if (appOwned) {
58
+ const rawStages = block.attrs["stage_ids"];
59
+ if (!Array.isArray(rawStages))
60
+ throw new EntityTfError(`${where}: stage_ids must be a list`);
61
+ for (const value of rawStages) {
62
+ if (!isTfExpr(value) || value.$expr !== "local" || value.name !== `${appTfLabel}_stage_ids_by_key`) {
63
+ throw new LostStageHandleError(`${where}: stage ${typeof value === "string" ? JSON.stringify(value) : "reference"} is not one of the app's authored stages; the SLA is left unmanaged`);
64
+ }
65
+ const index = value.path[0];
66
+ if (typeof index !== "object" || typeof index.index !== "string")
67
+ throw new EntityTfError(`${where}: unsupported stage_ids expression`);
68
+ const pulled = pulledStageHandle(index.index, stageHandles);
69
+ if (pulled.kind === "lost")
70
+ throw new LostStageHandleError(lostStageMessage(where, index.index, pulled, "the SLA is left unmanaged"));
71
+ if (pulled.kind !== "handle")
72
+ throw new EntityTfError(`${where}: stage key ${JSON.stringify(index.index)} has no terraform label handle`);
73
+ stages.push(tfLabelToTsLabel(pulled.handle));
74
+ }
75
+ }
76
+ else if (block.attrs["stage_ids"] !== undefined) {
77
+ throw new EntityTfError(`${where}: stage_ids is not allowed on an approval-process-owned SLA`);
78
+ }
79
+ const rawTargets = block.attrs["targets"] ?? [];
80
+ if (!Array.isArray(rawTargets))
81
+ throw new EntityTfError(`${where}: targets must be a list`);
82
+ if (rawTargets.length === 0) {
83
+ throw new UnmanagedSlaError(`${where}: the SLA has no record targets, which source cannot express (an SLA needs at least one); the SLA is left unmanaged`);
84
+ }
85
+ const targets = rawTargets.map((value, index) => {
86
+ const at = `${where}: target ${index}`;
87
+ if (!isRecord(value))
88
+ throw new EntityTfError(`${at} must be an object`);
89
+ const raw = value;
90
+ for (const key of Object.keys(raw)) {
91
+ if (!TARGET_KNOWN.has(key))
92
+ throw new EntityTfError(`${at}: unknown attribute ${key} — extend slaFromTf deliberately`);
93
+ }
94
+ const str = (key) => {
95
+ const value = raw[key];
96
+ if (typeof value !== "string")
97
+ throw new EntityTfError(`${at}: ${key} must be a literal string`);
98
+ return value;
99
+ };
100
+ const period = raw["time_period"];
101
+ if (typeof period !== "number")
102
+ throw new EntityTfError(`${at}: time_period must be a literal number`);
103
+ const days = raw["working_week_days"];
104
+ if (!Array.isArray(days) || !days.every((day) => typeof day === "string")) {
105
+ throw new EntityTfError(`${at}: working_week_days must be a list of literal strings`);
106
+ }
107
+ const timezone = raw["working_timezone"];
108
+ if (timezone !== undefined && typeof timezone !== "string")
109
+ throw new EntityTfError(`${at}: working_timezone must be a literal string`);
110
+ let filter;
111
+ if (raw["filter"] !== undefined) {
112
+ if (!appOwned)
113
+ throw new EntityTfError(`${at}: filter is only for app-owned SLAs`);
114
+ filter = filterFromTf(raw["filter"], {
115
+ type: "elementum_app",
116
+ label: appTfLabel,
117
+ ownerRefName: tfLabelToTsLabel(appTfLabel),
118
+ ownerTfLabel: appTfLabel,
119
+ scope: "app",
120
+ foreignFieldRefsById: ctx?.foreignFieldRefsById,
121
+ }, `${at}.filter`, ctx, { optionLookupsAsTextOption: true });
122
+ }
123
+ let approval;
124
+ if (raw["approval"] !== undefined) {
125
+ if (appOwned)
126
+ throw new EntityTfError(`${at}: approval is only for approval-process-owned SLAs`);
127
+ if (!isRecord(raw["approval"]))
128
+ throw new EntityTfError(`${at}.approval must be an object`);
129
+ const ap = raw["approval"];
130
+ const entityId = ap["entity_id"];
131
+ const entityType = ap["entity_type"];
132
+ // Fail-closed: a raw platform id in authored source is not a typed
133
+ // approver/conditional ref (edk#373 follow-up). Leave the SLA unmanaged.
134
+ if (entityId !== undefined) {
135
+ throw new UnmanagedSlaError(`${at}.approval.entity_id is a raw platform id; export cannot yet name a non-process approval entity as a typed approver or conditional ref, so the SLA is left unmanaged`);
136
+ }
137
+ if (entityType !== undefined && typeof entityType !== "string")
138
+ throw new EntityTfError(`${at}.approval.entity_type must be a literal string`);
139
+ approval = {
140
+ ...(entityType !== undefined && entityType !== "" ? { entityType } : {}),
141
+ };
142
+ }
143
+ return {
144
+ name: str("name"),
145
+ timePeriod: period,
146
+ timeUnit: str("time_unit"),
147
+ workingStartTime: str("working_start_time"),
148
+ workingEndTime: str("working_end_time"),
149
+ ...(timezone !== undefined && timezone !== "" ? { workingTimezone: timezone } : {}),
150
+ workingWeekDays: days,
151
+ ...(filter !== undefined ? { filter } : {}),
152
+ ...(approval !== undefined ? { approval } : {}),
153
+ };
154
+ });
155
+ return {
156
+ refName: scopedLabelToBagKey(appTfLabel, block.label, "app"),
157
+ name,
158
+ ...(description !== undefined && description !== "" ? { description } : {}),
159
+ active,
160
+ stages,
161
+ ...(approvalProcessTfLabel !== undefined ? { approvalProcessTfLabel } : {}),
162
+ targets,
163
+ };
164
+ }
@@ -0,0 +1 @@
1
+ export { sla, slaTimeUnit, slaWeekDay, type SlaAppOptions, type SlaApprovalOptions, type SlaConfigured, type SlaOptions, type SlaTarget, type SlaTimeUnit, type SlaWeekDay, } from "./build.js";
@@ -0,0 +1 @@
1
+ export { sla, slaTimeUnit, slaWeekDay, } from "./build.js";
@@ -0,0 +1,4 @@
1
+ import { type EntityKindModule } from "../../graph/types.js";
2
+ export declare const SLA_RESOURCE_TYPE = "elementum_sla";
3
+ /** App SLA clocks (edk#600): `apps/<appRef>/slas/<slaRef>.ts`. */
4
+ export declare const slaModule: EntityKindModule;