@elementumai/edk 0.9.17 → 0.9.19

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 (130) hide show
  1. package/README.md +8 -3
  2. package/dist-sdk/src/catalog/factories.d.ts +11 -0
  3. package/dist-sdk/src/catalog/factories.js +6 -0
  4. package/dist-sdk/src/catalog/index.d.ts +2 -2
  5. package/dist-sdk/src/catalog/index.js +2 -2
  6. package/dist-sdk/src/catalog/org.d.ts +39 -1
  7. package/dist-sdk/src/catalog/org.js +460 -50
  8. package/dist-sdk/src/catalog/types.d.ts +12 -2
  9. package/dist-sdk/src/catalog/types.js +2 -0
  10. package/dist-sdk/src/engine/pull/ref-only.js +54 -20
  11. package/dist-sdk/src/engine/pull/result-output.d.ts +2 -0
  12. package/dist-sdk/src/engine/pull/result-output.js +1 -1
  13. package/dist-sdk/src/engine/tf/expr.js +38 -13
  14. package/dist-sdk/src/engine/tf/index.d.ts +2 -2
  15. package/dist-sdk/src/engine/tf/index.js +2 -2
  16. package/dist-sdk/src/engine/tf/labels.d.ts +2 -0
  17. package/dist-sdk/src/engine/tf/labels.js +4 -0
  18. package/dist-sdk/src/engine/tf/parse.d.ts +19 -0
  19. package/dist-sdk/src/engine/tf/parse.js +105 -6
  20. package/dist-sdk/src/engine/workspace/loader.js +49 -12
  21. package/dist-sdk/src/entities/access-policy/from-tf.d.ts +11 -1
  22. package/dist-sdk/src/entities/access-policy/from-tf.js +6 -1
  23. package/dist-sdk/src/entities/access-policy/to-tf.d.ts +11 -0
  24. package/dist-sdk/src/entities/access-policy/to-tf.js +11 -4
  25. package/dist-sdk/src/entities/agent-tool/to-tf.js +2 -1
  26. package/dist-sdk/src/entities/app/build.d.ts +10 -0
  27. package/dist-sdk/src/entities/app/build.js +0 -13
  28. package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +6 -1
  29. package/dist-sdk/src/entities/app/from-tf.js +4 -3
  30. package/dist-sdk/src/entities/app/index.d.ts +2 -0
  31. package/dist-sdk/src/entities/app/index.js +1 -0
  32. package/dist-sdk/src/entities/app/module.js +13 -0
  33. package/dist-sdk/src/entities/app/to-tf.js +2 -0
  34. package/dist-sdk/src/entities/automation/build.d.ts +2 -1
  35. package/dist-sdk/src/entities/automation/build.js +27 -0
  36. package/dist-sdk/src/entities/automation/deserializer/print-automation.js +6 -0
  37. package/dist-sdk/src/entities/automation/from-tf.js +156 -26
  38. package/dist-sdk/src/entities/automation/index.d.ts +1 -1
  39. package/dist-sdk/src/entities/automation/module.d.ts +2 -0
  40. package/dist-sdk/src/entities/automation/module.js +56 -0
  41. package/dist-sdk/src/entities/automation/output-field-types.d.ts +5 -4
  42. package/dist-sdk/src/entities/automation/output-field-types.js +23 -5
  43. package/dist-sdk/src/entities/automation/system-ref-name.d.ts +16 -0
  44. package/dist-sdk/src/entities/automation/system-ref-name.js +44 -0
  45. package/dist-sdk/src/entities/automation/task-output-labels.d.ts +15 -0
  46. package/dist-sdk/src/entities/automation/task-output-labels.js +38 -0
  47. package/dist-sdk/src/entities/automation/tasks.d.ts +37 -5
  48. package/dist-sdk/src/entities/automation/tasks.js +23 -1
  49. package/dist-sdk/src/entities/automation/to-tf.js +158 -84
  50. package/dist-sdk/src/entities/automation/types.js +1 -0
  51. package/dist-sdk/src/entities/chart/from-tf.js +33 -17
  52. package/dist-sdk/src/entities/chart/module.js +3 -1
  53. package/dist-sdk/src/entities/chart/printer.d.ts +1 -0
  54. package/dist-sdk/src/entities/chart/printer.js +26 -16
  55. package/dist-sdk/src/entities/chart/rebind-owner.d.ts +3 -0
  56. package/dist-sdk/src/entities/chart/rebind-owner.js +42 -0
  57. package/dist-sdk/src/entities/chart/to-tf.js +12 -10
  58. package/dist-sdk/src/entities/dashboard/build.d.ts +4 -0
  59. package/dist-sdk/src/entities/dashboard/from-tf.js +15 -4
  60. package/dist-sdk/src/entities/dashboard/to-tf.d.ts +2 -0
  61. package/dist-sdk/src/entities/dashboard/to-tf.js +13 -0
  62. package/dist-sdk/src/entities/dashboard-widget/module.js +4 -0
  63. package/dist-sdk/src/entities/dynamic-layout/build.d.ts +51 -2
  64. package/dist-sdk/src/entities/dynamic-layout/dialect.d.ts +3 -0
  65. package/dist-sdk/src/entities/dynamic-layout/dialect.js +5 -0
  66. package/dist-sdk/src/entities/dynamic-layout/from-tf.d.ts +9 -6
  67. package/dist-sdk/src/entities/dynamic-layout/from-tf.js +188 -26
  68. package/dist-sdk/src/entities/dynamic-layout/module.js +4 -1
  69. package/dist-sdk/src/entities/dynamic-layout/to-tf.d.ts +5 -1
  70. package/dist-sdk/src/entities/dynamic-layout/to-tf.js +254 -23
  71. package/dist-sdk/src/entities/element/build.d.ts +8 -0
  72. package/dist-sdk/src/entities/element/build.js +1 -0
  73. package/dist-sdk/src/entities/element/from-tf.d.ts +1 -0
  74. package/dist-sdk/src/entities/element/from-tf.js +6 -2
  75. package/dist-sdk/src/entities/element/index.d.ts +1 -0
  76. package/dist-sdk/src/entities/element/index.js +1 -0
  77. package/dist-sdk/src/entities/element/module.js +2 -0
  78. package/dist-sdk/src/entities/element/to-tf.js +12 -0
  79. package/dist-sdk/src/entities/field/from-tf.d.ts +2 -0
  80. package/dist-sdk/src/entities/field/from-tf.js +11 -0
  81. package/dist-sdk/src/entities/field/to-tf.js +13 -9
  82. package/dist-sdk/src/entities/relationship/from-tf.d.ts +8 -1
  83. package/dist-sdk/src/entities/relationship/from-tf.js +53 -10
  84. package/dist-sdk/src/entities/relationship/to-tf.d.ts +8 -0
  85. package/dist-sdk/src/entities/relationship/to-tf.js +19 -10
  86. package/dist-sdk/src/entities/shared/filters/ast.d.ts +7 -2
  87. package/dist-sdk/src/entities/shared/filters/index.d.ts +23 -2
  88. package/dist-sdk/src/entities/shared/filters/index.js +24 -1
  89. package/dist-sdk/src/entities/shared/filters/print.js +22 -4
  90. package/dist-sdk/src/entities/shared/filters/tf-codec.d.ts +23 -3
  91. package/dist-sdk/src/entities/shared/filters/tf-codec.js +60 -18
  92. package/dist-sdk/src/entities/shared/filters/types.d.ts +13 -4
  93. package/dist-sdk/src/entities/shared/foreign-ref.d.ts +16 -0
  94. package/dist-sdk/src/entities/shared/foreign-ref.js +17 -1
  95. package/dist-sdk/src/entities/shared/tool-field-ref.js +6 -9
  96. package/dist-sdk/src/entities/skill/access-policy.d.ts +17 -0
  97. package/dist-sdk/src/entities/skill/access-policy.js +101 -0
  98. package/dist-sdk/src/entities/skill/build.d.ts +3 -0
  99. package/dist-sdk/src/entities/skill/build.js +3 -0
  100. package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.d.ts +4 -1
  101. package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +21 -0
  102. package/dist-sdk/src/entities/skill/from-tf.d.ts +2 -0
  103. package/dist-sdk/src/entities/skill/from-tf.js +4 -9
  104. package/dist-sdk/src/entities/skill/index.d.ts +2 -0
  105. package/dist-sdk/src/entities/skill/index.js +1 -0
  106. package/dist-sdk/src/entities/skill/module.js +1 -0
  107. package/dist-sdk/src/entities/skill/to-tf.d.ts +2 -2
  108. package/dist-sdk/src/entities/skill/to-tf.js +5 -2
  109. package/dist-sdk/src/entities/skill-tool/to-tf.js +2 -1
  110. package/dist-sdk/src/entities/table/to-tf.js +3 -3
  111. package/dist-sdk/src/entities/view/agent-view-layout-from-tf.d.ts +49 -0
  112. package/dist-sdk/src/entities/view/agent-view-layout-from-tf.js +224 -0
  113. package/dist-sdk/src/entities/view/agent-view-layout-to-tf.d.ts +36 -0
  114. package/dist-sdk/src/entities/view/agent-view-layout-to-tf.js +288 -0
  115. package/dist-sdk/src/entities/view/agent-view-layout.d.ts +121 -0
  116. package/dist-sdk/src/entities/view/agent-view-layout.js +21 -0
  117. package/dist-sdk/src/entities/view/from-tf.d.ts +3 -1
  118. package/dist-sdk/src/entities/view/from-tf.js +42 -7
  119. package/dist-sdk/src/entities/view/ragnarok.d.ts +7 -0
  120. package/dist-sdk/src/entities/view/ragnarok.js +1 -0
  121. package/dist-sdk/src/entities/view/to-tf.d.ts +10 -1
  122. package/dist-sdk/src/entities/view/to-tf.js +30 -1
  123. package/dist-sdk/src/entities/view/types.js +2 -0
  124. package/dist-sdk/src/entities/widget/to-tf.js +2 -2
  125. package/dist-sdk/src/generated/ragnarok/ragnarok-spec.d.ts +815 -0
  126. package/dist-sdk/src/generated/ragnarok/ragnarok-spec.js +5 -0
  127. package/dist-sdk/src/graph/index.d.ts +43 -0
  128. package/dist-sdk/src/graph/index.js +9 -0
  129. package/dist-sdk/src/graph/types.d.ts +78 -0
  130. package/package.json +11 -1
@@ -4,6 +4,7 @@ import { renderAutomationCatalogEntry } from "./catalog-render.js";
4
4
  import { preserveAuthoredAutomationPullMeta, printAutomationV2WithScriptFiles, SCRIPT_FILES_DIR } from "./deserializer/print-automation.js";
5
5
  import { automationFromTf, automationOwnedAddresses, UnsupportedMultiTriggerError } from "./from-tf.js";
6
6
  import { scriptFileRefs } from "./script-code.js";
7
+ import { TASK_OUTPUT_REFERENCE_NAMES } from "./task-output-labels.js";
7
8
  import { automationToTf } from "./to-tf.js";
8
9
  import { ALL_AUTOMATION_SUB_TYPES, AUTOMATION_RESOURCE_TYPE, WORKFLOW_PUBLISH_RESOURCE_TYPE, } from "./types.js";
9
10
  function isConfigured(value) {
@@ -237,4 +238,59 @@ export const automationModule = {
237
238
  stubRef: automationStubRef,
238
239
  refFromAuthoring: automationRefFromAuthoring,
239
240
  },
241
+ roundtrip: {
242
+ referenceAliases: [],
243
+ managedLookupAttributes: [{
244
+ lookupType: AUTOMATION_RESOURCE_TYPE,
245
+ attribute: "parameter_ids",
246
+ ownerType: "elementum_on_demand_trigger",
247
+ ownerReference: "automation",
248
+ }],
249
+ taskOutputReferenceNames: TASK_OUTPUT_REFERENCE_NAMES,
250
+ recordFieldOutputKeys: [{ nameAttribute: "name", ownerAttribute: "object_id" }],
251
+ computedReferenceMaps: [{
252
+ resourceType: "elementum_on_demand_trigger",
253
+ attribute: "filter_refs",
254
+ listAttribute: "parameters",
255
+ nameAttribute: "name",
256
+ value: (name) => `trigger.${onDemandFilterRefName(name)}`,
257
+ }],
258
+ exportedAttributeLocals: [{
259
+ resourceType: "elementum_variable_task",
260
+ attribute: "variable_id",
261
+ localPrefix: "edk_variable_id_",
262
+ }],
263
+ },
240
264
  };
265
+ /** The provider's `normalizeOnDemandFilterRefName`, which computes `filter_refs` at plan time. */
266
+ export function onDemandFilterRefName(name) {
267
+ const runes = [...name];
268
+ const isWordRune = (rune) => /^[\p{L}\p{Nd}]$/u.test(rune);
269
+ // Go's unicode.ToUpper/ToLower map one rune to one rune; JS case mapping
270
+ // can expand (ß → SS, İ → i + U+0307). An expanded upper case keeps the
271
+ // rune; an expanded lower case keeps its first rune (İ → i).
272
+ const toUpper = (rune) => {
273
+ const upper = rune.toUpperCase();
274
+ return [...upper].length === 1 ? upper : rune;
275
+ };
276
+ const toLower = (rune) => [...rune.toLowerCase()][0] ?? rune;
277
+ if (runes.length === 0)
278
+ return "";
279
+ if (runes.every(isWordRune))
280
+ return toLower(runes[0]) + runes.slice(1).join("");
281
+ let normalized = "";
282
+ let nextIsUpper = false;
283
+ for (const rune of runes) {
284
+ if (!isWordRune(rune)) {
285
+ nextIsUpper = true;
286
+ }
287
+ else if (nextIsUpper) {
288
+ normalized += toUpper(rune);
289
+ nextIsUpper = false;
290
+ }
291
+ else {
292
+ normalized += toLower(rune);
293
+ }
294
+ }
295
+ return normalized;
296
+ }
@@ -4,10 +4,11 @@
4
4
  * workflow field type each declared property resolves to.
5
5
  *
6
6
  * Used by `to-tf.ts` (forward: building the `elementum_workflow_publish`
7
- * outputs' `fieldType` envelope) and `build.ts` (authoring-time: stamping
8
- * `OutputPropertyRef.valueType` on the catalog ref) — kept dependency-free
9
- * like `output-key-wire-name.ts` so importing it from either side can never
10
- * introduce a cycle.
7
+ * outputs' `fieldType` envelope), `build.ts` (authoring-time: stamping
8
+ * `OutputPropertyRef.valueType` on the catalog ref), and `from-tf.ts`
9
+ * (a filter reference whose export omitted `real_type`) — kept
10
+ * dependency-free like `output-key-wire-name.ts` so importing it from
11
+ * either side can never introduce a cycle.
11
12
  */
12
13
  /** Map executeScript output_schema properties to refs keys (`result.<name>`). */
13
14
  export declare function outputFieldTypesFromScriptSchema(schema: unknown): Map<string, {
@@ -4,14 +4,29 @@
4
4
  * workflow field type each declared property resolves to.
5
5
  *
6
6
  * Used by `to-tf.ts` (forward: building the `elementum_workflow_publish`
7
- * outputs' `fieldType` envelope) and `build.ts` (authoring-time: stamping
8
- * `OutputPropertyRef.valueType` on the catalog ref) — kept dependency-free
9
- * like `output-key-wire-name.ts` so importing it from either side can never
10
- * introduce a cycle.
7
+ * outputs' `fieldType` envelope), `build.ts` (authoring-time: stamping
8
+ * `OutputPropertyRef.valueType` on the catalog ref), and `from-tf.ts`
9
+ * (a filter reference whose export omitted `real_type`) — kept
10
+ * dependency-free like `output-key-wire-name.ts` so importing it from
11
+ * either side can never introduce a cycle.
11
12
  */
12
13
  function isObject(value) {
13
14
  return value !== null && typeof value === "object" && !Array.isArray(value);
14
15
  }
16
+ /**
17
+ * DATE and DATETIME string formats project to those workflow field types.
18
+ * EMAIL, UUID4, and a missing or other format stay TEXT.
19
+ *
20
+ * Publish envelopes use this projection for `fieldType`. A filter uses it
21
+ * only when the export omitted `real_type`. A stored `real_type`, including
22
+ * `text` on a DATETIME output, is kept so a text comparison is not rewritten
23
+ * as a datetime literal.
24
+ */
25
+ function stringFormatFieldType(format) {
26
+ if (format === "DATE" || format === "DATETIME")
27
+ return format;
28
+ return "TEXT";
29
+ }
15
30
  /** Map executeScript output_schema properties to refs keys (`result.<name>`). */
16
31
  export function outputFieldTypesFromScriptSchema(schema) {
17
32
  if (!isObject(schema))
@@ -33,10 +48,13 @@ export function outputFieldTypesFromScriptSchema(schema) {
33
48
  }
34
49
  if (kind === "object")
35
50
  return { fieldType: "TEXT", multiple: false, kind };
51
+ // Live EDK/dev capture (edkdatetimecap, 2026-09-30): DATE and DATETIME
52
+ // string formats publish as those field types. EMAIL, UUID4, and an
53
+ // unformatted string stay TEXT.
36
54
  const fieldType = kind === "bool" ? "BOOLEAN"
37
55
  : kind === "integer" ? "NUMBER"
38
56
  : kind === "number" ? "DECIMAL"
39
- : kind === "string" ? "TEXT"
57
+ : kind === "string" ? stringFormatFieldType(body.format)
40
58
  : undefined;
41
59
  return fieldType === undefined ? undefined : { fieldType, multiple: false, kind };
42
60
  };
@@ -0,0 +1,16 @@
1
+ import { type SystemFieldKey } from "../../core/system-fields.js";
2
+ /**
3
+ * System fields the provider cannot rename. Their ref names are always built
4
+ * from DEPLOY_DEFAULT_SYSTEM_FIELD_NAMES, whatever the app authored.
5
+ */
6
+ export declare const PROVIDER_FIXED_SYSTEM_FIELD_KEYS: ReadonlySet<SystemFieldKey>;
7
+ /** The refs-map key a build emits for a record field display name plus wire suffix. */
8
+ export declare function recordFieldWireRefName(fieldName: string, wireSuffix: string): string;
9
+ /**
10
+ * Whether decoding `wireName` as `<key><wireSuffix>` is lossless: a build of
11
+ * the typed path must emit a key the live refs map resolves identically.
12
+ * Older organizations name audit fields "Closed by" / "Created on"; decoding
13
+ * those to a typed key would rebuild as "Closed By" / "Created At", which is a
14
+ * different (missing) map key.
15
+ */
16
+ export declare function systemRefNameRoundTrips(key: SystemFieldKey, wireSuffix: string, wireName: string): boolean;
@@ -0,0 +1,44 @@
1
+ import { DEPLOY_DEFAULT_SYSTEM_FIELD_NAMES } from "../../core/system-fields.js";
2
+ /**
3
+ * System fields the provider cannot rename. Their ref names are always built
4
+ * from DEPLOY_DEFAULT_SYSTEM_FIELD_NAMES, whatever the app authored.
5
+ */
6
+ export const PROVIDER_FIXED_SYSTEM_FIELD_KEYS = new Set([
7
+ "stage",
8
+ "createdAt",
9
+ "createdBy",
10
+ "updatedAt",
11
+ "updatedBy",
12
+ "closedAt",
13
+ "closedBy",
14
+ ]);
15
+ /** Ref keys the provider publishes under both spellings (see withAuditEmailRefAliases). */
16
+ const PROVIDER_ALIASED_REF_NAMES = new Map([
17
+ ["Created by Email", "Created By Email"],
18
+ ["Created By Email", "Created by Email"],
19
+ ["Updated by Manager Email", "Updated By Manager Email"],
20
+ ["Updated By Manager Email", "Updated by Manager Email"],
21
+ ]);
22
+ /** The refs-map key a build emits for a record field display name plus wire suffix. */
23
+ export function recordFieldWireRefName(fieldName, wireSuffix) {
24
+ const refName = `${fieldName}${wireSuffix}`;
25
+ // Email audit refs have historically varied in the capitalization of "by"
26
+ // between organizations. The provider exposes both spellings as aliases,
27
+ // so author the established lowercase wire name consistently.
28
+ return /^(Created|Updated) By (?:Manager )?Email$/.test(refName)
29
+ ? refName.replace(/ By(?= (?:Manager )?Email$)/, " by")
30
+ : refName;
31
+ }
32
+ /**
33
+ * Whether decoding `wireName` as `<key><wireSuffix>` is lossless: a build of
34
+ * the typed path must emit a key the live refs map resolves identically.
35
+ * Older organizations name audit fields "Closed by" / "Created on"; decoding
36
+ * those to a typed key would rebuild as "Closed By" / "Created At", which is a
37
+ * different (missing) map key.
38
+ */
39
+ export function systemRefNameRoundTrips(key, wireSuffix, wireName) {
40
+ if (!PROVIDER_FIXED_SYSTEM_FIELD_KEYS.has(key))
41
+ return true;
42
+ const emitted = recordFieldWireRefName(DEPLOY_DEFAULT_SYSTEM_FIELD_NAMES[key], wireSuffix);
43
+ return emitted === wireName || PROVIDER_ALIASED_REF_NAMES.get(emitted) === wireName;
44
+ }
@@ -0,0 +1,15 @@
1
+ /** userSearch authoring output → provider refs-map key (as exported from live user-search tasks). */
2
+ export declare const USER_SEARCH_REF_WIRE_NAMES: Readonly<Record<string, string>>;
3
+ /**
4
+ * Task-own outputs whose WorkflowTaskReference name (what an exported
5
+ * envelope and a calculation mustache carry) differs from the provider
6
+ * refs-map key, per resource type. Captured live with `ei refs --from-remote`
7
+ * and matching mobius' `shared.json` label tables.
8
+ */
9
+ export declare const TASK_OUTPUT_REFERENCE_NAMES: Readonly<Record<string, Readonly<Record<string, string>>>>;
10
+ /**
11
+ * A record-bearing task's whole-record output (ASPECT_RECORD). The bare
12
+ * `.record` accessor otherwise builds the ASPECT_RECORD_ID `Record` key a
13
+ * `record_reference` needs; a field-mapped input needs the record itself.
14
+ */
15
+ export declare const WHOLE_RECORD_REF_WIRE_NAMES: Readonly<Record<string, string>>;
@@ -0,0 +1,38 @@
1
+ /** userSearch authoring output → provider refs-map key (as exported from live user-search tasks). */
2
+ export const USER_SEARCH_REF_WIRE_NAMES = {
3
+ "user.id": "User's Id",
4
+ "user.name": "User's Name",
5
+ "user.email": "User's Email",
6
+ "user.managerName": "Manager Name",
7
+ "user.managerEmail": "Manager Email",
8
+ users: "All found users",
9
+ };
10
+ /**
11
+ * Task-own outputs whose WorkflowTaskReference name (what an exported
12
+ * envelope and a calculation mustache carry) differs from the provider
13
+ * refs-map key, per resource type. Captured live with `ei refs --from-remote`
14
+ * and matching mobius' `shared.json` label tables.
15
+ */
16
+ export const TASK_OUTPUT_REFERENCE_NAMES = {
17
+ elementum_record_search_task: {
18
+ "Records Size": "count",
19
+ "First found record id": "recordId",
20
+ },
21
+ elementum_user_group_search_task: {
22
+ "Groups Size": "count",
23
+ "First found group": "group",
24
+ ID: "group.id",
25
+ Name: "group.name",
26
+ "All found groups": "groups",
27
+ },
28
+ };
29
+ /**
30
+ * A record-bearing task's whole-record output (ASPECT_RECORD). The bare
31
+ * `.record` accessor otherwise builds the ASPECT_RECORD_ID `Record` key a
32
+ * `record_reference` needs; a field-mapped input needs the record itself.
33
+ */
34
+ export const WHOLE_RECORD_REF_WIRE_NAMES = {
35
+ recordSearch: "First found record",
36
+ createRecord: "Created record",
37
+ updateField: "Updated record",
38
+ };
@@ -250,8 +250,13 @@ export interface SetVariableOptions {
250
250
  readonly update?: readonly VariableAssign[];
251
251
  }
252
252
  export declare function setVariable(opts: SetVariableOptions): ActionDef<Record<string, never>>;
253
- /** Scalar types supported by an executeScript output schema. */
254
- export type ScriptOutputScalarType = "text" | "string" | "integer" | "number" | "decimal" | "boolean" | "object";
253
+ /**
254
+ * Scalar types supported by an executeScript output schema.
255
+ *
256
+ * `date`, `datetime`, `email`, and `uuid4` are string outputs the platform
257
+ * stores with a format. Plain `text` and `string` stay format-less.
258
+ */
259
+ export type ScriptOutputScalarType = "text" | "string" | "integer" | "number" | "decimal" | "boolean" | "object" | "date" | "datetime" | "email" | "uuid4";
255
260
  /** A recursively typed executeScript output schema node. */
256
261
  export type ScriptOutputType = ScriptOutputScalarType | {
257
262
  readonly type: "array";
@@ -598,8 +603,35 @@ export interface UserSearchOptions {
598
603
  /** Pre-built wire filter over user attributes. */
599
604
  readonly filter: Filter;
600
605
  }
601
- export declare function userSearch(opts: UserSearchOptions): ActionDef<RecordSearchOutput>;
602
- export declare function userGroupSearch(opts: UserSearchOptions): ActionDef<RecordSearchOutput>;
606
+ /** The first user a user search found. */
607
+ export interface FoundUserShape {
608
+ readonly id: string;
609
+ readonly name: string;
610
+ readonly email: string;
611
+ readonly managerName: string;
612
+ readonly managerEmail: string;
613
+ }
614
+ /** Outputs of a user search (the platform's "User's Id", "Manager Email", "All found users", …). */
615
+ export interface UserSearchOutput {
616
+ readonly user: FoundUserShape;
617
+ readonly users: readonly unknown[];
618
+ }
619
+ export declare function userSearch(opts: UserSearchOptions): ActionDef<UserSearchOutput>;
620
+ export interface UserGroupShape {
621
+ readonly id: string;
622
+ readonly name: string;
623
+ }
624
+ /** Platform output names of a user-group search (`task.<id>.count`, `.group.id`, `.groups`). */
625
+ export interface UserGroupSearchOutput {
626
+ readonly count: number;
627
+ readonly group: UserGroupShape;
628
+ readonly groups: readonly UserGroupShape[];
629
+ }
630
+ export interface UserGroupSearchOptions {
631
+ /** Pre-built wire filter over user-group attributes (`catalog.userGroups.fields`). */
632
+ readonly filter: Filter;
633
+ }
634
+ export declare function userGroupSearch(opts: UserGroupSearchOptions): ActionDef<UserGroupSearchOutput>;
603
635
  export interface SaveAttachmentOptions {
604
636
  readonly record: ValueOrRef<unknown>;
605
637
  readonly file: ValueOrRef<unknown>;
@@ -779,7 +811,7 @@ export interface RunAutomationInput {
779
811
  * output's source wasn't a typed executeScript result) stays `unknown` —
780
812
  * an honest "we don't know", never a wrong guess.
781
813
  */
782
- type WorkflowOutputScalar<T extends string | undefined> = T extends "BOOLEAN" ? boolean : T extends "NUMBER" | "DECIMAL" ? number : T extends "TEXT" ? string : unknown;
814
+ type WorkflowOutputScalar<T extends string | undefined> = T extends "BOOLEAN" ? boolean : T extends "NUMBER" | "DECIMAL" ? number : T extends "TEXT" | "DATE" | "DATETIME" ? string : unknown;
783
815
  type WorkflowOutputValue<T extends string | undefined, Multiple extends boolean | undefined> = Multiple extends true ? readonly WorkflowOutputScalar<T>[] : WorkflowOutputScalar<T>;
784
816
  /**
785
817
  * A `runAutomation` step's result: flat, one property per key the target
@@ -192,6 +192,13 @@ export function setVariable(opts) {
192
192
  },
193
193
  };
194
194
  }
195
+ /** Platform string formats for the product scalar outputs that carry one. */
196
+ const SCRIPT_OUTPUT_STRING_FORMAT = {
197
+ date: "DATE",
198
+ datetime: "DATETIME",
199
+ email: "EMAIL",
200
+ uuid4: "UUID4",
201
+ };
195
202
  /** Split the authored `outputs` option into the root name and the properties. */
196
203
  function normalizeScriptOutputs(outputs) {
197
204
  const properties = outputs.properties;
@@ -214,9 +221,24 @@ function outputSchemaNode(name, type) {
214
221
  case "decimal": return { number: named };
215
222
  case "boolean": return { bool: named };
216
223
  case "object": return { object: named };
224
+ case "date":
225
+ case "datetime":
226
+ case "email":
227
+ case "uuid4":
228
+ // Live export lists format before name. Terraform jsonencode and
229
+ // encoding/json sort object keys, so this order does not change the
230
+ // plan; it keeps the parsed shape aligned with the capture.
231
+ return { string: { format: SCRIPT_OUTPUT_STRING_FORMAT[type], ...named } };
217
232
  case "text":
218
233
  case "string":
219
- default: return { string: named };
234
+ return { string: named };
235
+ default: {
236
+ // A runtime string outside this union (authored JavaScript) stays a
237
+ // format-less string. Falling through would emit an object node.
238
+ const unexpected = type;
239
+ void unexpected;
240
+ return { string: named };
241
+ }
220
242
  }
221
243
  }
222
244
  if (type.type === "array") {