@elementumai/edk 0.9.19 → 0.9.20

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 (176) hide show
  1. package/README.md +146 -6
  2. package/dist-sdk/src/catalog/factories.d.ts +24 -1
  3. package/dist-sdk/src/catalog/factories.js +30 -0
  4. package/dist-sdk/src/catalog/from-authoring.d.ts +13 -8
  5. package/dist-sdk/src/catalog/from-authoring.js +34 -9
  6. package/dist-sdk/src/catalog/index.d.ts +2 -2
  7. package/dist-sdk/src/catalog/index.js +2 -2
  8. package/dist-sdk/src/catalog/render.js +6 -6
  9. package/dist-sdk/src/catalog/token.js +7 -0
  10. package/dist-sdk/src/catalog/types.d.ts +34 -1
  11. package/dist-sdk/src/catalog/types.js +11 -0
  12. package/dist-sdk/src/core/triggers/on-demand.d.ts +39 -3
  13. package/dist-sdk/src/core/triggers/on-demand.js +10 -2
  14. package/dist-sdk/src/engine/build/context.d.ts +1 -1
  15. package/dist-sdk/src/engine/ei/run.d.ts +149 -0
  16. package/dist-sdk/src/engine/ei/run.js +1132 -0
  17. package/dist-sdk/src/engine/logging.d.ts +17 -0
  18. package/dist-sdk/src/engine/logging.js +18 -0
  19. package/dist-sdk/src/engine/pull/ref-only.d.ts +5 -0
  20. package/dist-sdk/src/engine/pull/ref-only.js +10 -7
  21. package/dist-sdk/src/engine/pull/result-output.d.ts +6 -0
  22. package/dist-sdk/src/engine/pull/result-output.js +87 -3
  23. package/dist-sdk/src/engine/tf/expr.js +1 -1
  24. package/dist-sdk/src/engine/tf/index.d.ts +2 -2
  25. package/dist-sdk/src/engine/tf/index.js +1 -1
  26. package/dist-sdk/src/engine/tf/labels.d.ts +6 -0
  27. package/dist-sdk/src/engine/tf/labels.js +9 -0
  28. package/dist-sdk/src/engine/tf/model.d.ts +22 -1
  29. package/dist-sdk/src/engine/tf/parse.js +92 -4
  30. package/dist-sdk/src/engine/tf/render.d.ts +4 -2
  31. package/dist-sdk/src/engine/tf/render.js +41 -7
  32. package/dist-sdk/src/engine/validation.d.ts +39 -0
  33. package/dist-sdk/src/engine/validation.js +85 -0
  34. package/dist-sdk/src/entities/access-policy/to-tf.js +5 -2
  35. package/dist-sdk/src/entities/agent/build.d.ts +4 -16
  36. package/dist-sdk/src/entities/agent/build.js +40 -5
  37. package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +4 -2
  38. package/dist-sdk/src/entities/agent/to-tf.js +6 -3
  39. package/dist-sdk/src/entities/agent-tool/from-tf.d.ts +2 -0
  40. package/dist-sdk/src/entities/agent-tool/from-tf.js +7 -1
  41. package/dist-sdk/src/entities/agent-tool/to-tf.d.ts +2 -2
  42. package/dist-sdk/src/entities/agent-tool/to-tf.js +27 -5
  43. package/dist-sdk/src/entities/app/build.d.ts +89 -20
  44. package/dist-sdk/src/entities/app/build.js +51 -6
  45. package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +16 -0
  46. package/dist-sdk/src/entities/app/from-tf.d.ts +1 -0
  47. package/dist-sdk/src/entities/app/from-tf.js +7 -2
  48. package/dist-sdk/src/entities/app/index.d.ts +6 -6
  49. package/dist-sdk/src/entities/app/index.js +1 -0
  50. package/dist-sdk/src/entities/app/module.js +5 -2
  51. package/dist-sdk/src/entities/app/to-tf.js +19 -11
  52. package/dist-sdk/src/entities/automation/build.d.ts +47 -5
  53. package/dist-sdk/src/entities/automation/build.js +137 -20
  54. package/dist-sdk/src/entities/automation/deserializer/print-automation.d.ts +24 -1
  55. package/dist-sdk/src/entities/automation/deserializer/print-automation.js +314 -39
  56. package/dist-sdk/src/entities/automation/from-tf.d.ts +28 -6
  57. package/dist-sdk/src/entities/automation/from-tf.js +428 -48
  58. package/dist-sdk/src/entities/automation/generated/task-output-contracts.d.ts +33 -0
  59. package/dist-sdk/src/entities/automation/generated/task-output-contracts.js +183 -0
  60. package/dist-sdk/src/entities/automation/index.d.ts +2 -2
  61. package/dist-sdk/src/entities/automation/index.js +1 -1
  62. package/dist-sdk/src/entities/automation/module.js +37 -8
  63. package/dist-sdk/src/entities/automation/output-field-types.d.ts +7 -0
  64. package/dist-sdk/src/entities/automation/output-field-types.js +36 -0
  65. package/dist-sdk/src/entities/automation/output-key-wire-name.d.ts +9 -0
  66. package/dist-sdk/src/entities/automation/output-key-wire-name.js +13 -0
  67. package/dist-sdk/src/entities/automation/script-code.d.ts +17 -0
  68. package/dist-sdk/src/entities/automation/script-code.js +91 -5
  69. package/dist-sdk/src/entities/automation/system-ref-name.js +4 -0
  70. package/dist-sdk/src/entities/automation/task-output-labels.d.ts +2 -0
  71. package/dist-sdk/src/entities/automation/task-output-labels.js +9 -0
  72. package/dist-sdk/src/entities/automation/tasks.d.ts +24 -2
  73. package/dist-sdk/src/entities/automation/tasks.js +38 -9
  74. package/dist-sdk/src/entities/automation/to-tf.d.ts +4 -0
  75. package/dist-sdk/src/entities/automation/to-tf.js +489 -83
  76. package/dist-sdk/src/entities/automation/triggers.d.ts +4 -2
  77. package/dist-sdk/src/entities/automation/triggers.js +4 -0
  78. package/dist-sdk/src/entities/chart/to-tf.js +10 -3
  79. package/dist-sdk/src/entities/dynamic-layout/build.d.ts +24 -31
  80. package/dist-sdk/src/entities/element/build.d.ts +25 -13
  81. package/dist-sdk/src/entities/element/build.js +4 -1
  82. package/dist-sdk/src/entities/element/from-tf.d.ts +11 -0
  83. package/dist-sdk/src/entities/element/from-tf.js +58 -1
  84. package/dist-sdk/src/entities/element/index.d.ts +5 -3
  85. package/dist-sdk/src/entities/element/index.js +1 -0
  86. package/dist-sdk/src/entities/element/module.js +9 -3
  87. package/dist-sdk/src/entities/element/to-tf.js +8 -2
  88. package/dist-sdk/src/entities/field/build.d.ts +14 -1
  89. package/dist-sdk/src/entities/field/build.js +3 -0
  90. package/dist-sdk/src/entities/field/from-tf.d.ts +1 -0
  91. package/dist-sdk/src/entities/field/from-tf.js +39 -1
  92. package/dist-sdk/src/entities/field/media-types.d.ts +6 -0
  93. package/dist-sdk/src/entities/field/media-types.js +30 -0
  94. package/dist-sdk/src/entities/field/module.js +1 -0
  95. package/dist-sdk/src/entities/field/to-tf.d.ts +23 -2
  96. package/dist-sdk/src/entities/field/to-tf.js +130 -14
  97. package/dist-sdk/src/entities/file-reader/from-tf.js +14 -5
  98. package/dist-sdk/src/entities/file-reader/module.js +1 -0
  99. package/dist-sdk/src/entities/file-reader/types.d.ts +2 -0
  100. package/dist-sdk/src/entities/file-reader/types.js +1 -1
  101. package/dist-sdk/src/entities/portal/build.d.ts +26 -0
  102. package/dist-sdk/src/entities/portal/build.js +37 -0
  103. package/dist-sdk/src/entities/portal/from-tf.d.ts +27 -0
  104. package/dist-sdk/src/entities/portal/from-tf.js +75 -0
  105. package/dist-sdk/src/entities/portal/index.d.ts +1 -0
  106. package/dist-sdk/src/entities/portal/index.js +1 -0
  107. package/dist-sdk/src/entities/portal/module.d.ts +3 -0
  108. package/dist-sdk/src/entities/portal/module.js +28 -0
  109. package/dist-sdk/src/entities/portal/to-tf.d.ts +12 -0
  110. package/dist-sdk/src/entities/portal/to-tf.js +73 -0
  111. package/dist-sdk/src/entities/portal/types.d.ts +1 -0
  112. package/dist-sdk/src/entities/portal/types.js +1 -0
  113. package/dist-sdk/src/entities/relationship/module.js +2 -0
  114. package/dist-sdk/src/entities/relationship/pair-check.d.ts +7 -0
  115. package/dist-sdk/src/entities/relationship/pair-check.js +68 -0
  116. package/dist-sdk/src/entities/relationship/to-tf.d.ts +2 -0
  117. package/dist-sdk/src/entities/relationship/to-tf.js +12 -3
  118. package/dist-sdk/src/entities/search-table/module.js +1 -0
  119. package/dist-sdk/src/entities/search-table/to-tf.d.ts +1 -0
  120. package/dist-sdk/src/entities/search-table/to-tf.js +1 -1
  121. package/dist-sdk/src/entities/service-account/build.d.ts +15 -2
  122. package/dist-sdk/src/entities/service-account/from-tf.d.ts +2 -4
  123. package/dist-sdk/src/entities/service-account/from-tf.js +17 -5
  124. package/dist-sdk/src/entities/service-account/role-fidelity.d.ts +56 -0
  125. package/dist-sdk/src/entities/service-account/role-fidelity.js +243 -0
  126. package/dist-sdk/src/entities/service-account/to-tf.d.ts +14 -0
  127. package/dist-sdk/src/entities/service-account/to-tf.js +17 -0
  128. package/dist-sdk/src/entities/shared/aspect-target-from-tf.d.ts +1 -1
  129. package/dist-sdk/src/entities/shared/aspect-target-from-tf.js +5 -2
  130. package/dist-sdk/src/entities/shared/filters/ast.d.ts +8 -0
  131. package/dist-sdk/src/entities/shared/filters/index.d.ts +2 -0
  132. package/dist-sdk/src/entities/shared/filters/index.js +14 -4
  133. package/dist-sdk/src/entities/shared/filters/print.js +17 -1
  134. package/dist-sdk/src/entities/shared/filters/tf-codec.d.ts +2 -0
  135. package/dist-sdk/src/entities/shared/filters/tf-codec.js +5 -1
  136. package/dist-sdk/src/entities/shared/filters/types.d.ts +9 -1
  137. package/dist-sdk/src/entities/shared/types/field-types.d.ts +10 -5
  138. package/dist-sdk/src/entities/shared/types/field-types.js +4 -0
  139. package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +2 -1
  140. package/dist-sdk/src/entities/skill/from-tf.js +66 -13
  141. package/dist-sdk/src/entities/skill/input-coverage.d.ts +7 -0
  142. package/dist-sdk/src/entities/skill/input-coverage.js +11 -0
  143. package/dist-sdk/src/entities/skill/to-tf.js +14 -4
  144. package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +2 -0
  145. package/dist-sdk/src/entities/skill-tool/from-tf.js +8 -2
  146. package/dist-sdk/src/entities/skill-tool/to-tf.d.ts +2 -2
  147. package/dist-sdk/src/entities/skill-tool/to-tf.js +27 -5
  148. package/dist-sdk/src/entities/table/catalog.d.ts +14 -0
  149. package/dist-sdk/src/entities/table/catalog.js +66 -0
  150. package/dist-sdk/src/entities/table/module.js +2 -1
  151. package/dist-sdk/src/entities/table/to-tf.js +2 -2
  152. package/dist-sdk/src/entities/view/agent-view-layout-from-tf.d.ts +49 -9
  153. package/dist-sdk/src/entities/view/agent-view-layout-from-tf.js +71 -18
  154. package/dist-sdk/src/entities/view/agent-view-layout-to-tf.d.ts +19 -4
  155. package/dist-sdk/src/entities/view/agent-view-layout-to-tf.js +82 -10
  156. package/dist-sdk/src/entities/view/agent-view-layout.d.ts +53 -23
  157. package/dist-sdk/src/entities/view/agent-view-layout.js +1 -1
  158. package/dist-sdk/src/entities/view/from-tf.d.ts +3 -2
  159. package/dist-sdk/src/entities/view/from-tf.js +124 -12
  160. package/dist-sdk/src/entities/view/module.js +30 -3
  161. package/dist-sdk/src/entities/view/to-tf.d.ts +14 -1
  162. package/dist-sdk/src/entities/view/to-tf.js +67 -10
  163. package/dist-sdk/src/entities/view/types.d.ts +4 -15
  164. package/dist-sdk/src/entities/view/types.js +15 -15
  165. package/dist-sdk/src/entities/widget/build.d.ts +16 -1
  166. package/dist-sdk/src/entities/widget/build.js +11 -1
  167. package/dist-sdk/src/entities/widget/to-tf.js +34 -8
  168. package/dist-sdk/src/generated/ragnarok/ragnarok-spec.d.ts +16 -5
  169. package/dist-sdk/src/generated/ragnarok/ragnarok-spec.js +2 -2
  170. package/dist-sdk/src/graph/index.d.ts +11 -0
  171. package/dist-sdk/src/graph/index.js +21 -0
  172. package/dist-sdk/src/graph/modules.js +2 -0
  173. package/dist-sdk/src/graph/types.d.ts +55 -2
  174. package/dist-sdk/src/internal/sdk-package.d.ts +1 -1
  175. package/dist-sdk/src/internal/sdk-package.js +1 -0
  176. package/package.json +10 -1
@@ -388,6 +388,18 @@ export interface ApiRequestHeader {
388
388
  readonly name: string;
389
389
  readonly value: ValueOrRef<unknown>;
390
390
  }
391
+ /**
392
+ * A required sensitive Terraform variable for a write-only value the export
393
+ * could not read (an API header, or basic auth's username). Plan refuses
394
+ * until `TF_VAR_<variable>` is a non-empty string. This is not a vault
395
+ * secret — vault-entry references are a separate contract.
396
+ */
397
+ export interface RequiredSecret {
398
+ readonly kind: "requiredSecret";
399
+ readonly variable: string;
400
+ }
401
+ export declare function requiredSecret(variable: string): RequiredSecret;
402
+ export declare function isRequiredSecret(value: unknown): value is RequiredSecret;
391
403
  export interface ApiRequestBasicAuth {
392
404
  readonly username: ValueOrRef<unknown>;
393
405
  /**
@@ -494,6 +506,14 @@ export interface AiSearchTableOptions {
494
506
  */
495
507
  export interface AiSearchTableOutput {
496
508
  readonly records: readonly unknown[];
509
+ /** `refs["All Records Text"]`: every found record rendered as text (e.g. for an AI prompt). */
510
+ readonly recordsText: string;
511
+ /** `refs["All Records JSON"]`. */
512
+ readonly recordsJson: unknown;
513
+ /** `refs["First Record Text"]`. */
514
+ readonly firstRecordText: string;
515
+ /** `refs["First Record JSON"]`. */
516
+ readonly firstRecordJson: unknown;
497
517
  }
498
518
  export declare function aiSearchTable(opts: AiSearchTableOptions): ActionDef<AiSearchTableOutput>;
499
519
  export interface AiSummarizeOptions {
@@ -566,8 +586,8 @@ type Empty = Record<string, never>;
566
586
  export interface NotificationOptions {
567
587
  readonly title: ValueOrRef<string>;
568
588
  readonly message: ValueOrRef<string>;
569
- /** Plain-text description shown in the notification's metadata (not templated). */
570
- readonly description?: string;
589
+ /** Description shown in the notification's metadata. Supports templates with value references. */
590
+ readonly description?: ValueOrRef<string>;
571
591
  readonly userIds?: readonly string[];
572
592
  readonly groupIds?: readonly string[];
573
593
  readonly userRefs?: readonly ValueOrRef<string>[];
@@ -613,6 +633,8 @@ export interface FoundUserShape {
613
633
  }
614
634
  /** Outputs of a user search (the platform's "User's Id", "Manager Email", "All found users", …). */
615
635
  export interface UserSearchOutput {
636
+ /** `refs["Users Size"]`: how many users matched. */
637
+ readonly count: number;
616
638
  readonly user: FoundUserShape;
617
639
  readonly users: readonly unknown[];
618
640
  }
@@ -1,7 +1,7 @@
1
1
  import { serializeValueOrRef } from "../../core/wire/ref-serializer.js";
2
2
  import { isExpr } from "../field/calc/runtime.js";
3
3
  import { renderCalculationExpression, } from "./calculation-expression.js";
4
- import { extractScriptBody, isScriptFile, readScriptFile } from "./script-code.js";
4
+ import { extractScriptBody, isScriptFile, readScriptFile, toPlatformScriptBody } from "./script-code.js";
5
5
  function workflowFields(fields) {
6
6
  return fields.map((f) => {
7
7
  const updateMode = "updateMode" in f ? f.updateMode : undefined;
@@ -17,6 +17,9 @@ function workflowFields(fields) {
17
17
  };
18
18
  });
19
19
  }
20
+ function recordKindOf(target) {
21
+ return target.__kind === "app" || target.__kind === "element" ? { __recordKind: target.__kind } : {};
22
+ }
20
23
  export function recordSearch(opts) {
21
24
  return {
22
25
  key: "recordSearch",
@@ -27,6 +30,7 @@ export function recordSearch(opts) {
27
30
  ...(opts.limit !== undefined ? { limit: opts.limit } : {}),
28
31
  },
29
32
  __recordApp: opts.app.refName,
33
+ ...recordKindOf(opts.app),
30
34
  };
31
35
  }
32
36
  export function tableRecordsSearch(opts) {
@@ -54,6 +58,7 @@ export function createRecord(opts) {
54
58
  ...(opts.record !== undefined ? { recordReference: serializeValueOrRef(opts.record) } : {}),
55
59
  },
56
60
  __recordApp: opts.app.refName,
61
+ ...recordKindOf(opts.app),
57
62
  };
58
63
  }
59
64
  /** Update fields on an existing record. `value: ""` or `value: null` clears a nullable field (including Dropdown). */
@@ -68,6 +73,7 @@ export function updateField(opts) {
68
73
  workflowFields: workflowFields(opts.fields),
69
74
  },
70
75
  __recordApp: opts.app.refName,
76
+ ...recordKindOf(opts.app),
71
77
  };
72
78
  }
73
79
  export function findRelatedRecords(opts) {
@@ -249,21 +255,29 @@ function outputSchemaNode(name, type) {
249
255
  },
250
256
  };
251
257
  }
252
- const properties = type.properties === undefined
253
- ? undefined
254
- : Object.entries(type.properties).map(([propertyName, propertyType]) => outputSchemaNode(propertyName, propertyType));
258
+ return outputSchemaObjectNode(name, type.properties);
259
+ }
260
+ /**
261
+ * The platform's object node. An object with no properties carries no
262
+ * `properties` key: live GraphQL returns `properties: []`, and both ei export
263
+ * and provider import omit the empty list, so emitting `properties = []`
264
+ * would differ from imported state and plan an in-place update. The provider
265
+ * sends the required empty list itself when the key is absent.
266
+ */
267
+ function outputSchemaObjectNode(name, declared) {
268
+ const properties = Object.entries(declared ?? {})
269
+ .map(([propertyName, propertyType]) => outputSchemaNode(propertyName, propertyType));
255
270
  return {
256
271
  object: {
257
272
  ...(name === undefined ? {} : { name }),
258
- ...(properties === undefined ? {} : { properties }),
273
+ ...(properties.length === 0 ? {} : { properties }),
259
274
  },
260
275
  };
261
276
  }
262
277
  /** Map an output schema to the platform's tagged object shape. */
263
278
  function outputSchema(outputs) {
264
279
  const { name: rootName, properties: declared } = normalizeScriptOutputs(outputs);
265
- const properties = Object.entries(declared).map(([name, type]) => outputSchemaNode(name, type));
266
- return { object: { ...(rootName !== undefined ? { name: rootName } : {}), properties } };
280
+ return outputSchemaObjectNode(rootName, declared);
267
281
  }
268
282
  const EXECUTE_SCRIPT_LIST_INPUT_MARKER = "__edkExecuteScriptListInput";
269
283
  /**
@@ -308,7 +322,22 @@ export function executeScriptActionDefWithBody(body, opts) {
308
322
  };
309
323
  }
310
324
  export function executeScript(opts) {
311
- return executeScriptActionDefWithBody(isScriptFile(opts.code) ? readScriptFile(opts.code) : extractScriptBody(opts.code), opts);
325
+ const body = isScriptFile(opts.code)
326
+ ? toPlatformScriptBody(readScriptFile(opts.code), `executeScript scriptFile("${opts.code.path}")`, { stripTypes: false })
327
+ : toPlatformScriptBody(extractScriptBody(opts.code), "executeScript");
328
+ return executeScriptActionDefWithBody(body, opts);
329
+ }
330
+ const TF_VARIABLE_NAME = /^[A-Za-z_][A-Za-z0-9_]*$/;
331
+ export function requiredSecret(variable) {
332
+ if (!TF_VARIABLE_NAME.test(variable)) {
333
+ throw new Error(`requiredSecret() needs a Terraform variable name (letters, digits, underscore; no leading digit), got ${JSON.stringify(variable)}`);
334
+ }
335
+ return { kind: "requiredSecret", variable };
336
+ }
337
+ export function isRequiredSecret(value) {
338
+ return typeof value === "object" && value !== null &&
339
+ value.kind === "requiredSecret" &&
340
+ typeof value.variable === "string";
312
341
  }
313
342
  function apiRequestHeaders(headers) {
314
343
  return (headers ?? []).map((h) => ({ name: h.name, value: serializeValueOrRef(h.value) }));
@@ -506,7 +535,7 @@ export function notification(opts) {
506
535
  config: {
507
536
  titleReference: serializeValueOrRef(opts.title),
508
537
  messageReference: serializeValueOrRef(opts.message),
509
- ...(opts.description !== undefined ? { description: opts.description } : {}),
538
+ ...(opts.description !== undefined ? { descriptionReference: serializeValueOrRef(opts.description) } : {}),
510
539
  ...(opts.userIds?.length ? { userIds: opts.userIds } : {}),
511
540
  ...(opts.groupIds?.length ? { groupIds: opts.groupIds } : {}),
512
541
  ...(opts.userRefs !== undefined ? { users: refList(opts.userRefs) } : {}),
@@ -8,6 +8,10 @@ export interface AutomationToTfContext {
8
8
  readonly appRefName?: string;
9
9
  /** The product owner kind; defaults to app for direct legacy callers. */
10
10
  readonly parentScope?: "app" | "element";
11
+ /** Element owners only: the element declares `systemFields.audit`. */
12
+ readonly ownerAuditFields?: boolean;
13
+ /** RefNames of the workspace's elements without `systemFields.audit`. */
14
+ readonly elementsWithoutAuditFields?: ReadonlySet<string>;
11
15
  readonly appTfLabel: string;
12
16
  readonly fieldAddresses?: ReadonlyMap<string, string>;
13
17
  readonly fieldNames?: ReadonlyMap<string, string>;