@elementumai/edk 0.9.18 → 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.
- package/README.md +154 -9
- package/dist-sdk/src/catalog/factories.d.ts +35 -1
- package/dist-sdk/src/catalog/factories.js +36 -0
- package/dist-sdk/src/catalog/from-authoring.d.ts +13 -8
- package/dist-sdk/src/catalog/from-authoring.js +34 -9
- package/dist-sdk/src/catalog/index.d.ts +2 -2
- package/dist-sdk/src/catalog/index.js +2 -2
- package/dist-sdk/src/catalog/org.d.ts +39 -1
- package/dist-sdk/src/catalog/org.js +460 -50
- package/dist-sdk/src/catalog/render.js +6 -6
- package/dist-sdk/src/catalog/token.js +7 -0
- package/dist-sdk/src/catalog/types.d.ts +44 -1
- package/dist-sdk/src/catalog/types.js +13 -0
- package/dist-sdk/src/core/triggers/on-demand.d.ts +39 -3
- package/dist-sdk/src/core/triggers/on-demand.js +10 -2
- package/dist-sdk/src/engine/build/context.d.ts +1 -1
- package/dist-sdk/src/engine/ei/run.d.ts +149 -0
- package/dist-sdk/src/engine/ei/run.js +1132 -0
- package/dist-sdk/src/engine/logging.d.ts +17 -0
- package/dist-sdk/src/engine/logging.js +18 -0
- package/dist-sdk/src/engine/pull/ref-only.d.ts +5 -0
- package/dist-sdk/src/engine/pull/ref-only.js +64 -27
- package/dist-sdk/src/engine/pull/result-output.d.ts +8 -0
- package/dist-sdk/src/engine/pull/result-output.js +88 -4
- package/dist-sdk/src/engine/tf/expr.js +39 -14
- package/dist-sdk/src/engine/tf/index.d.ts +3 -3
- package/dist-sdk/src/engine/tf/index.js +2 -2
- package/dist-sdk/src/engine/tf/labels.d.ts +8 -0
- package/dist-sdk/src/engine/tf/labels.js +13 -0
- package/dist-sdk/src/engine/tf/model.d.ts +22 -1
- package/dist-sdk/src/engine/tf/parse.d.ts +19 -0
- package/dist-sdk/src/engine/tf/parse.js +197 -10
- package/dist-sdk/src/engine/tf/render.d.ts +4 -2
- package/dist-sdk/src/engine/tf/render.js +41 -7
- package/dist-sdk/src/engine/validation.d.ts +39 -0
- package/dist-sdk/src/engine/validation.js +85 -0
- package/dist-sdk/src/engine/workspace/loader.js +49 -12
- package/dist-sdk/src/entities/access-policy/from-tf.d.ts +11 -1
- package/dist-sdk/src/entities/access-policy/from-tf.js +6 -1
- package/dist-sdk/src/entities/access-policy/to-tf.d.ts +11 -0
- package/dist-sdk/src/entities/access-policy/to-tf.js +16 -6
- package/dist-sdk/src/entities/agent/build.d.ts +4 -16
- package/dist-sdk/src/entities/agent/build.js +40 -5
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +4 -2
- package/dist-sdk/src/entities/agent/to-tf.js +6 -3
- package/dist-sdk/src/entities/agent-tool/from-tf.d.ts +2 -0
- package/dist-sdk/src/entities/agent-tool/from-tf.js +7 -1
- package/dist-sdk/src/entities/agent-tool/to-tf.d.ts +2 -2
- package/dist-sdk/src/entities/agent-tool/to-tf.js +29 -6
- package/dist-sdk/src/entities/app/build.d.ts +98 -19
- package/dist-sdk/src/entities/app/build.js +51 -19
- package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +22 -1
- package/dist-sdk/src/entities/app/from-tf.d.ts +1 -0
- package/dist-sdk/src/entities/app/from-tf.js +11 -5
- package/dist-sdk/src/entities/app/index.d.ts +6 -5
- package/dist-sdk/src/entities/app/index.js +2 -0
- package/dist-sdk/src/entities/app/module.js +18 -2
- package/dist-sdk/src/entities/app/to-tf.js +21 -11
- package/dist-sdk/src/entities/automation/build.d.ts +49 -6
- package/dist-sdk/src/entities/automation/build.js +163 -19
- package/dist-sdk/src/entities/automation/deserializer/print-automation.d.ts +24 -1
- package/dist-sdk/src/entities/automation/deserializer/print-automation.js +320 -39
- package/dist-sdk/src/entities/automation/from-tf.d.ts +28 -6
- package/dist-sdk/src/entities/automation/from-tf.js +563 -74
- package/dist-sdk/src/entities/automation/generated/task-output-contracts.d.ts +33 -0
- package/dist-sdk/src/entities/automation/generated/task-output-contracts.js +183 -0
- package/dist-sdk/src/entities/automation/index.d.ts +2 -2
- package/dist-sdk/src/entities/automation/index.js +1 -1
- package/dist-sdk/src/entities/automation/module.d.ts +2 -0
- package/dist-sdk/src/entities/automation/module.js +93 -8
- package/dist-sdk/src/entities/automation/output-field-types.d.ts +7 -0
- package/dist-sdk/src/entities/automation/output-field-types.js +36 -0
- package/dist-sdk/src/entities/automation/output-key-wire-name.d.ts +9 -0
- package/dist-sdk/src/entities/automation/output-key-wire-name.js +13 -0
- package/dist-sdk/src/entities/automation/script-code.d.ts +17 -0
- package/dist-sdk/src/entities/automation/script-code.js +91 -5
- package/dist-sdk/src/entities/automation/system-ref-name.d.ts +16 -0
- package/dist-sdk/src/entities/automation/system-ref-name.js +48 -0
- package/dist-sdk/src/entities/automation/task-output-labels.d.ts +17 -0
- package/dist-sdk/src/entities/automation/task-output-labels.js +47 -0
- package/dist-sdk/src/entities/automation/tasks.d.ts +53 -4
- package/dist-sdk/src/entities/automation/tasks.js +38 -9
- package/dist-sdk/src/entities/automation/to-tf.d.ts +4 -0
- package/dist-sdk/src/entities/automation/to-tf.js +647 -167
- package/dist-sdk/src/entities/automation/triggers.d.ts +4 -2
- package/dist-sdk/src/entities/automation/triggers.js +4 -0
- package/dist-sdk/src/entities/automation/types.js +1 -0
- package/dist-sdk/src/entities/chart/from-tf.js +33 -17
- package/dist-sdk/src/entities/chart/module.js +3 -1
- package/dist-sdk/src/entities/chart/printer.d.ts +1 -0
- package/dist-sdk/src/entities/chart/printer.js +26 -16
- package/dist-sdk/src/entities/chart/rebind-owner.d.ts +3 -0
- package/dist-sdk/src/entities/chart/rebind-owner.js +42 -0
- package/dist-sdk/src/entities/chart/to-tf.js +21 -12
- package/dist-sdk/src/entities/dashboard/build.d.ts +4 -0
- package/dist-sdk/src/entities/dashboard/from-tf.js +15 -4
- package/dist-sdk/src/entities/dashboard/to-tf.d.ts +2 -0
- package/dist-sdk/src/entities/dashboard/to-tf.js +13 -0
- package/dist-sdk/src/entities/dashboard-widget/module.js +4 -0
- package/dist-sdk/src/entities/dynamic-layout/build.d.ts +72 -30
- package/dist-sdk/src/entities/dynamic-layout/dialect.d.ts +3 -0
- package/dist-sdk/src/entities/dynamic-layout/dialect.js +5 -0
- package/dist-sdk/src/entities/dynamic-layout/from-tf.d.ts +9 -6
- package/dist-sdk/src/entities/dynamic-layout/from-tf.js +188 -26
- package/dist-sdk/src/entities/dynamic-layout/module.js +4 -1
- package/dist-sdk/src/entities/dynamic-layout/to-tf.d.ts +5 -1
- package/dist-sdk/src/entities/dynamic-layout/to-tf.js +254 -23
- package/dist-sdk/src/entities/element/build.d.ts +33 -13
- package/dist-sdk/src/entities/element/build.js +5 -1
- package/dist-sdk/src/entities/element/from-tf.d.ts +12 -0
- package/dist-sdk/src/entities/element/from-tf.js +64 -3
- package/dist-sdk/src/entities/element/index.d.ts +5 -2
- package/dist-sdk/src/entities/element/index.js +2 -0
- package/dist-sdk/src/entities/element/module.js +11 -3
- package/dist-sdk/src/entities/element/to-tf.js +20 -2
- package/dist-sdk/src/entities/field/build.d.ts +14 -1
- package/dist-sdk/src/entities/field/build.js +3 -0
- package/dist-sdk/src/entities/field/from-tf.d.ts +3 -0
- package/dist-sdk/src/entities/field/from-tf.js +50 -1
- package/dist-sdk/src/entities/field/media-types.d.ts +6 -0
- package/dist-sdk/src/entities/field/media-types.js +30 -0
- package/dist-sdk/src/entities/field/module.js +1 -0
- package/dist-sdk/src/entities/field/to-tf.d.ts +23 -2
- package/dist-sdk/src/entities/field/to-tf.js +142 -22
- package/dist-sdk/src/entities/file-reader/from-tf.js +14 -5
- package/dist-sdk/src/entities/file-reader/module.js +1 -0
- package/dist-sdk/src/entities/file-reader/types.d.ts +2 -0
- package/dist-sdk/src/entities/file-reader/types.js +1 -1
- package/dist-sdk/src/entities/portal/build.d.ts +26 -0
- package/dist-sdk/src/entities/portal/build.js +37 -0
- package/dist-sdk/src/entities/portal/from-tf.d.ts +27 -0
- package/dist-sdk/src/entities/portal/from-tf.js +75 -0
- package/dist-sdk/src/entities/portal/index.d.ts +1 -0
- package/dist-sdk/src/entities/portal/index.js +1 -0
- package/dist-sdk/src/entities/portal/module.d.ts +3 -0
- package/dist-sdk/src/entities/portal/module.js +28 -0
- package/dist-sdk/src/entities/portal/to-tf.d.ts +12 -0
- package/dist-sdk/src/entities/portal/to-tf.js +73 -0
- package/dist-sdk/src/entities/portal/types.d.ts +1 -0
- package/dist-sdk/src/entities/portal/types.js +1 -0
- package/dist-sdk/src/entities/relationship/from-tf.d.ts +8 -1
- package/dist-sdk/src/entities/relationship/from-tf.js +53 -10
- package/dist-sdk/src/entities/relationship/module.js +2 -0
- package/dist-sdk/src/entities/relationship/pair-check.d.ts +7 -0
- package/dist-sdk/src/entities/relationship/pair-check.js +68 -0
- package/dist-sdk/src/entities/relationship/to-tf.d.ts +10 -0
- package/dist-sdk/src/entities/relationship/to-tf.js +31 -13
- package/dist-sdk/src/entities/search-table/module.js +1 -0
- package/dist-sdk/src/entities/search-table/to-tf.d.ts +1 -0
- package/dist-sdk/src/entities/search-table/to-tf.js +1 -1
- package/dist-sdk/src/entities/service-account/build.d.ts +15 -2
- package/dist-sdk/src/entities/service-account/from-tf.d.ts +2 -4
- package/dist-sdk/src/entities/service-account/from-tf.js +17 -5
- package/dist-sdk/src/entities/service-account/role-fidelity.d.ts +56 -0
- package/dist-sdk/src/entities/service-account/role-fidelity.js +243 -0
- package/dist-sdk/src/entities/service-account/to-tf.d.ts +14 -0
- package/dist-sdk/src/entities/service-account/to-tf.js +17 -0
- package/dist-sdk/src/entities/shared/aspect-target-from-tf.d.ts +1 -1
- package/dist-sdk/src/entities/shared/aspect-target-from-tf.js +5 -2
- package/dist-sdk/src/entities/shared/filters/ast.d.ts +15 -2
- package/dist-sdk/src/entities/shared/filters/index.d.ts +25 -2
- package/dist-sdk/src/entities/shared/filters/index.js +38 -5
- package/dist-sdk/src/entities/shared/filters/print.js +31 -3
- package/dist-sdk/src/entities/shared/filters/tf-codec.d.ts +25 -3
- package/dist-sdk/src/entities/shared/filters/tf-codec.js +51 -15
- package/dist-sdk/src/entities/shared/filters/types.d.ts +22 -5
- package/dist-sdk/src/entities/shared/foreign-ref.d.ts +16 -0
- package/dist-sdk/src/entities/shared/foreign-ref.js +17 -1
- package/dist-sdk/src/entities/shared/tool-field-ref.js +6 -9
- package/dist-sdk/src/entities/shared/types/field-types.d.ts +10 -5
- package/dist-sdk/src/entities/shared/types/field-types.js +4 -0
- package/dist-sdk/src/entities/skill/access-policy.d.ts +17 -0
- package/dist-sdk/src/entities/skill/access-policy.js +101 -0
- package/dist-sdk/src/entities/skill/build.d.ts +3 -0
- package/dist-sdk/src/entities/skill/build.js +3 -0
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.d.ts +4 -1
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +23 -1
- package/dist-sdk/src/entities/skill/from-tf.d.ts +2 -0
- package/dist-sdk/src/entities/skill/from-tf.js +70 -22
- package/dist-sdk/src/entities/skill/index.d.ts +2 -0
- package/dist-sdk/src/entities/skill/index.js +1 -0
- package/dist-sdk/src/entities/skill/input-coverage.d.ts +7 -0
- package/dist-sdk/src/entities/skill/input-coverage.js +11 -0
- package/dist-sdk/src/entities/skill/module.js +1 -0
- package/dist-sdk/src/entities/skill/to-tf.d.ts +2 -2
- package/dist-sdk/src/entities/skill/to-tf.js +19 -6
- package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +2 -0
- package/dist-sdk/src/entities/skill-tool/from-tf.js +8 -2
- package/dist-sdk/src/entities/skill-tool/to-tf.d.ts +2 -2
- package/dist-sdk/src/entities/skill-tool/to-tf.js +29 -6
- package/dist-sdk/src/entities/table/catalog.d.ts +14 -0
- package/dist-sdk/src/entities/table/catalog.js +66 -0
- package/dist-sdk/src/entities/table/module.js +2 -1
- package/dist-sdk/src/entities/table/to-tf.js +5 -5
- package/dist-sdk/src/entities/view/agent-view-layout-from-tf.d.ts +89 -0
- package/dist-sdk/src/entities/view/agent-view-layout-from-tf.js +277 -0
- package/dist-sdk/src/entities/view/agent-view-layout-to-tf.d.ts +51 -0
- package/dist-sdk/src/entities/view/agent-view-layout-to-tf.js +360 -0
- package/dist-sdk/src/entities/view/agent-view-layout.d.ts +151 -0
- package/dist-sdk/src/entities/view/agent-view-layout.js +21 -0
- package/dist-sdk/src/entities/view/from-tf.d.ts +6 -3
- package/dist-sdk/src/entities/view/from-tf.js +161 -14
- package/dist-sdk/src/entities/view/module.js +30 -3
- package/dist-sdk/src/entities/view/to-tf.d.ts +24 -2
- package/dist-sdk/src/entities/view/to-tf.js +95 -9
- package/dist-sdk/src/entities/view/types.d.ts +4 -15
- package/dist-sdk/src/entities/view/types.js +17 -15
- package/dist-sdk/src/entities/widget/build.d.ts +16 -1
- package/dist-sdk/src/entities/widget/build.js +11 -1
- package/dist-sdk/src/entities/widget/to-tf.js +36 -10
- package/dist-sdk/src/generated/ragnarok/ragnarok-spec.d.ts +38 -10
- package/dist-sdk/src/generated/ragnarok/ragnarok-spec.js +2 -2
- package/dist-sdk/src/graph/index.d.ts +54 -0
- package/dist-sdk/src/graph/index.js +30 -0
- package/dist-sdk/src/graph/modules.js +2 -0
- package/dist-sdk/src/graph/types.d.ts +133 -2
- package/dist-sdk/src/internal/sdk-package.d.ts +1 -1
- package/dist-sdk/src/internal/sdk-package.js +1 -0
- package/package.json +11 -1
|
@@ -36,7 +36,7 @@ import type { AiProviderLlmModel, AiProviderType } from "./ai-provider-models.js
|
|
|
36
36
|
* resolved to the current-version param/output id via the parent
|
|
37
37
|
* automation's state binding.
|
|
38
38
|
*/
|
|
39
|
-
export type CatalogRefKind = "automation" | "agent" | "agent-evaluation" | "chart" | "dashboard" | "widget" | "skill" | "visual-flow" | "approvalChain" | "table" | "tableColumn" | "cloudLink" | "storedFunction" | "procedure" | "field" | "searchTable" | "documentModel" | "documentModelField" | "connector" | "aiProvider" | "category" | "group" | "phoneProvider" | "phone-service" | "datamine" | "app" | "element" | "task" | "triggerParameter" | "outputProperty";
|
|
39
|
+
export type CatalogRefKind = "automation" | "agent" | "agent-evaluation" | "chart" | "dashboard" | "widget" | "skill" | "visual-flow" | "approvalChain" | "table" | "tableColumn" | "cloudLink" | "storedFunction" | "procedure" | "field" | "view" | "searchTable" | "documentModel" | "documentModelField" | "connector" | "aiProvider" | "category" | "group" | "phoneProvider" | "phone-service" | "datamine" | "app" | "element" | "task" | "portal" | "triggerParameter" | "outputProperty";
|
|
40
40
|
/**
|
|
41
41
|
* The reference surface for a catalog entity. `handle` is the stable join key
|
|
42
42
|
* (no id); `name` is for readability/diagnostics, never a match key.
|
|
@@ -116,6 +116,15 @@ export interface TableRef<RefName extends string = string, Columns extends Reado
|
|
|
116
116
|
export interface SearchTableRef<Parent extends string = string, RefName extends string = string> extends CatalogRef<"searchTable", RefName, Parent> {
|
|
117
117
|
/** Display name of a table owner when the reference is outside the workspace. */
|
|
118
118
|
readonly parentName?: string;
|
|
119
|
+
/**
|
|
120
|
+
* Identity of one search table when `name` is not unique on its owner.
|
|
121
|
+
* The id belongs to one organization and only resolves there. A promotion
|
|
122
|
+
* or a fresh org returns Search Table Not Found. Give the rows distinct
|
|
123
|
+
* names when the reference has to move between orgs. Build sends this id
|
|
124
|
+
* on the lookup, where it wins over `name`. Leave it unset when the name
|
|
125
|
+
* is unique.
|
|
126
|
+
*/
|
|
127
|
+
readonly id?: string;
|
|
119
128
|
}
|
|
120
129
|
export type TableOwnedSearchTableRef<Parent extends string = string, RefName extends string = string> = SearchTableRef<Parent, RefName> & {
|
|
121
130
|
readonly __variant: "table";
|
|
@@ -212,6 +221,30 @@ export interface RecordIdentityRef<Target extends AppOrElementRef | TaskCatalogR
|
|
|
212
221
|
readonly name: "Record ID";
|
|
213
222
|
readonly target: Target;
|
|
214
223
|
}
|
|
224
|
+
/** The kinds of managed view an app or element owns, as their authoring bags name them. */
|
|
225
|
+
export declare const viewType: {
|
|
226
|
+
readonly list: "list";
|
|
227
|
+
readonly calendar: "calendar";
|
|
228
|
+
readonly kanban: "kanban";
|
|
229
|
+
readonly dashboard: "dashboard";
|
|
230
|
+
readonly agent: "agent";
|
|
231
|
+
readonly custom: "custom";
|
|
232
|
+
};
|
|
233
|
+
export type ViewType = (typeof viewType)[keyof typeof viewType];
|
|
234
|
+
/**
|
|
235
|
+
* A managed view, by its owner and name (`catalog.<app>.views.<view>`). The
|
|
236
|
+
* owner identity is stamped by `appCatalog`/`elementCatalog`, so a reference
|
|
237
|
+
* from another stream root (a portal's menu) can resolve the view by owner
|
|
238
|
+
* and name without an id.
|
|
239
|
+
*/
|
|
240
|
+
export interface ViewRef<Parent extends string = string, RefName extends string = string> extends CatalogRef<"view", RefName, Parent> {
|
|
241
|
+
readonly parent: Parent;
|
|
242
|
+
/** Which authoring bag holds the view; unset on a view of an owner outside this workspace. */
|
|
243
|
+
readonly viewType?: ViewType;
|
|
244
|
+
readonly parentKind?: "app" | "element";
|
|
245
|
+
readonly parentName?: string;
|
|
246
|
+
readonly parentNamespace?: string;
|
|
247
|
+
}
|
|
215
248
|
/**
|
|
216
249
|
* A field reference. Beyond the shared surface it carries `fieldType` (the
|
|
217
250
|
* platform field type — `"TEXT"`, `"PICKLIST"`, …) so builders can constrain
|
|
@@ -257,6 +290,16 @@ export interface UserFieldRef {
|
|
|
257
290
|
readonly name: UserFieldKey;
|
|
258
291
|
readonly fieldType: "TEXT";
|
|
259
292
|
}
|
|
293
|
+
/** Platform-owned user-group attributes accepted by user-group-search task filters. */
|
|
294
|
+
export declare const USER_GROUP_FIELD_KEYS: readonly ["name"];
|
|
295
|
+
export type UserGroupFieldKey = (typeof USER_GROUP_FIELD_KEYS)[number];
|
|
296
|
+
/** The user-group counterpart of {@link UserFieldRef}; serializes to its literal platform key. */
|
|
297
|
+
export interface UserGroupFieldRef {
|
|
298
|
+
readonly __kind: "userGroupField";
|
|
299
|
+
readonly refName: UserGroupFieldKey;
|
|
300
|
+
readonly name: UserGroupFieldKey;
|
|
301
|
+
readonly fieldType: "TEXT";
|
|
302
|
+
}
|
|
260
303
|
export interface TriggerParameterRef extends CatalogRef<"triggerParameter"> {
|
|
261
304
|
/**
|
|
262
305
|
* True when the automation's onDemand trigger declares this parameter
|
|
@@ -27,8 +27,19 @@
|
|
|
27
27
|
export const PROCEDURE_PARAMETER_TYPES = [
|
|
28
28
|
"BOOLEAN", "DATE", "DATETIME", "DECIMAL", "HANDLE", "JSON", "LONG", "TEXT", "UUID",
|
|
29
29
|
];
|
|
30
|
+
/** The kinds of managed view an app or element owns, as their authoring bags name them. */
|
|
31
|
+
export const viewType = {
|
|
32
|
+
list: "list",
|
|
33
|
+
calendar: "calendar",
|
|
34
|
+
kanban: "kanban",
|
|
35
|
+
dashboard: "dashboard",
|
|
36
|
+
agent: "agent",
|
|
37
|
+
custom: "custom",
|
|
38
|
+
};
|
|
30
39
|
/** Platform-owned user attributes accepted by user-search task filters. */
|
|
31
40
|
export const USER_FIELD_KEYS = ["firstName", "email", "jobTitle", "lastName"];
|
|
41
|
+
/** Platform-owned user-group attributes accepted by user-group-search task filters. */
|
|
42
|
+
export const USER_GROUP_FIELD_KEYS = ["name"];
|
|
32
43
|
/**
|
|
33
44
|
* Which scope resolves a kind's id at deploy:
|
|
34
45
|
* - `"app"` — the app's v2 state (app-owned entities + fields/tables);
|
|
@@ -52,6 +63,7 @@ export const REF_SCOPE = {
|
|
|
52
63
|
storedFunction: "org",
|
|
53
64
|
procedure: "org",
|
|
54
65
|
field: "app",
|
|
66
|
+
view: "app",
|
|
55
67
|
searchTable: "app",
|
|
56
68
|
datamine: "app",
|
|
57
69
|
documentModel: "app",
|
|
@@ -65,6 +77,7 @@ export const REF_SCOPE = {
|
|
|
65
77
|
app: "registry",
|
|
66
78
|
element: "registry",
|
|
67
79
|
task: "registry",
|
|
80
|
+
portal: "registry",
|
|
68
81
|
triggerParameter: "app",
|
|
69
82
|
outputProperty: "app",
|
|
70
83
|
};
|
|
@@ -18,11 +18,23 @@ interface TriggerInputFieldDefBase {
|
|
|
18
18
|
description?: string;
|
|
19
19
|
}
|
|
20
20
|
export interface ScalarTriggerInputFieldDef extends TriggerInputFieldDefBase {
|
|
21
|
-
type: Exclude<TriggerFieldTypeAlias, "record">;
|
|
21
|
+
type: Exclude<TriggerFieldTypeAlias, "record" | "userId">;
|
|
22
22
|
multiple?: boolean;
|
|
23
23
|
defaultValue?: unknown;
|
|
24
24
|
app?: never;
|
|
25
25
|
}
|
|
26
|
+
/** A user by email, as `userRef("person@example.com")` builds it. */
|
|
27
|
+
export interface OnDemandUserDefault {
|
|
28
|
+
readonly __kind: "user";
|
|
29
|
+
readonly email: string;
|
|
30
|
+
}
|
|
31
|
+
export interface UserIdTriggerInputFieldDef extends TriggerInputFieldDefBase {
|
|
32
|
+
type: "userId";
|
|
33
|
+
multiple?: boolean;
|
|
34
|
+
/** Resolved by email to the platform user id at apply; raw user ids are refused. */
|
|
35
|
+
defaultValue?: OnDemandUserDefault;
|
|
36
|
+
app?: never;
|
|
37
|
+
}
|
|
26
38
|
export interface RecordTriggerInputFieldDef<A extends AppOrElementRef = AppOrElementRef> extends TriggerInputFieldDefBase {
|
|
27
39
|
type: "record";
|
|
28
40
|
/** App or element whose record this input accepts; supplies the HCL default and typed record shape. */
|
|
@@ -30,7 +42,7 @@ export interface RecordTriggerInputFieldDef<A extends AppOrElementRef = AppOrEle
|
|
|
30
42
|
multiple?: false;
|
|
31
43
|
defaultValue?: never;
|
|
32
44
|
}
|
|
33
|
-
export type TriggerInputFieldDef = ScalarTriggerInputFieldDef | RecordTriggerInputFieldDef;
|
|
45
|
+
export type TriggerInputFieldDef = ScalarTriggerInputFieldDef | UserIdTriggerInputFieldDef | RecordTriggerInputFieldDef;
|
|
34
46
|
/**
|
|
35
47
|
* Schema object mapping field names to their definitions.
|
|
36
48
|
* Example:
|
|
@@ -46,9 +58,33 @@ export type TriggerInputSchema = Record<string, TriggerInputFieldDef>;
|
|
|
46
58
|
* app/element, so `ctx.trigger.<name>` has that target's RecordShape.
|
|
47
59
|
*/
|
|
48
60
|
type TriggerInputFieldToTS<D extends TriggerInputFieldDef> = D extends RecordTriggerInputFieldDef<infer A> ? RecordShape<A> : FieldTypeToTS<D["type"]>;
|
|
61
|
+
/** The user who ran an on-demand automation (the platform's "Triggered By" refs). */
|
|
62
|
+
export interface OnDemandTriggeredBy {
|
|
63
|
+
readonly id: string;
|
|
64
|
+
readonly email: string;
|
|
65
|
+
readonly name: string;
|
|
66
|
+
}
|
|
49
67
|
export type InferTriggerType<S extends TriggerInputSchema> = {
|
|
50
68
|
[K in keyof S]: TriggerInputFieldToTS<S[K]>;
|
|
51
69
|
};
|
|
70
|
+
/** Inputs the platform publishes no reference for: a userId input is only a Run Automation button binding. */
|
|
71
|
+
type UnreadableInputKeys<S> = {
|
|
72
|
+
[K in keyof S]: S[K] extends {
|
|
73
|
+
readonly type: "userId";
|
|
74
|
+
} ? K : never;
|
|
75
|
+
}[keyof S];
|
|
76
|
+
/**
|
|
77
|
+
* The on-demand `ctx.trigger`: readable inputs plus the user who ran the
|
|
78
|
+
* automation. `S` is the normalized authored schema. `triggeredBy` is
|
|
79
|
+
* reserved, so no input can shadow it. A schema with a `userId` input also
|
|
80
|
+
* loses the open string index, which would otherwise still type
|
|
81
|
+
* `ctx.trigger.<thatInput>` as a ref a task input accepts.
|
|
82
|
+
*/
|
|
83
|
+
export type WithOnDemandTriggeredBy<T, S> = {
|
|
84
|
+
[K in keyof T as K extends UnreadableInputKeys<S> ? never : string extends K ? [UnreadableInputKeys<S>] extends [never] ? K : never : K]: T[K];
|
|
85
|
+
} & {
|
|
86
|
+
readonly triggeredBy: OnDemandTriggeredBy;
|
|
87
|
+
};
|
|
52
88
|
export interface OnDemandTriggerDef<T, S extends TriggerInputSchema = TriggerInputSchema> {
|
|
53
89
|
readonly kind: "onDemand";
|
|
54
90
|
readonly schema: S;
|
|
@@ -103,7 +139,7 @@ type WireDefaultValue = {
|
|
|
103
139
|
} | {
|
|
104
140
|
datetime: string;
|
|
105
141
|
} | {
|
|
106
|
-
userId:
|
|
142
|
+
userId: OnDemandUserDefault;
|
|
107
143
|
} | {
|
|
108
144
|
attachmentId: string;
|
|
109
145
|
};
|
|
@@ -77,8 +77,16 @@ function wrapDefaultValueForWire(alias, value) {
|
|
|
77
77
|
// Expected wire form: ISO-8601 instant — Jackson's Instant parser.
|
|
78
78
|
return { datetime: value };
|
|
79
79
|
case "user":
|
|
80
|
+
case "userId": {
|
|
80
81
|
// Mobius's record field is named `userId`, not `user`.
|
|
81
|
-
|
|
82
|
+
const user = value;
|
|
83
|
+
if (typeof user !== "object" || user === null || user.__kind !== "user" || typeof user.email !== "string" || !user.email.includes("@")) {
|
|
84
|
+
throw new TypeError(`onDemand input default value for type "userId" must be userRef("person@example.com") ` +
|
|
85
|
+
`(got ${JSON.stringify(value)}). Raw platform user ids are not portable between orgs; ` +
|
|
86
|
+
`the email is resolved to the user's id at apply.`);
|
|
87
|
+
}
|
|
88
|
+
return { userId: { __kind: "user", email: user.email } };
|
|
89
|
+
}
|
|
82
90
|
case "attachmentId":
|
|
83
91
|
return { attachmentId: value };
|
|
84
92
|
case "record":
|
|
@@ -88,7 +96,7 @@ function wrapDefaultValueForWire(alias, value) {
|
|
|
88
96
|
case "object":
|
|
89
97
|
throw new Error(`onDemand input default values are not supported for type "${alias}". ` +
|
|
90
98
|
`Defaults are only accepted for text / number / decimal / boolean / ` +
|
|
91
|
-
`date / datetime /
|
|
99
|
+
`date / datetime / userId. Drop the defaultValue, or pick a supported ` +
|
|
92
100
|
`type for this input.`);
|
|
93
101
|
}
|
|
94
102
|
}
|
|
@@ -82,7 +82,7 @@ export interface OrgRefLookup {
|
|
|
82
82
|
* since it's usually the same value also used for the sibling
|
|
83
83
|
* `related_object_id` attribute.
|
|
84
84
|
*/
|
|
85
|
-
foreignField(type: string, tfLabel: string, objectId: TfValue, name: string): void;
|
|
85
|
+
foreignField(type: string, tfLabel: string, objectId: TfValue, name: string, extraAttrs?: Readonly<Record<string, TfValue>>): void;
|
|
86
86
|
}
|
|
87
87
|
/** A stream root discovered elsewhere in THIS workspace build, keyed by {@link workspaceAspectKey}. */
|
|
88
88
|
export interface WorkspaceAspect {
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Subprocess rules for the `ei` Go CLI (plan §4.8):
|
|
3
|
+
*
|
|
4
|
+
* - Pass-throughs (plan/apply/list): EDK owns both child streams and routes
|
|
5
|
+
* incoming messages to the output layer. stdio remains the transport to the
|
|
6
|
+
* user, but never bypasses EDK's timing/renderer boundary. One exception: a
|
|
7
|
+
* non-bridge pass-through with no caller-supplied streams, whose stdin and
|
|
8
|
+
* stdout are both a terminal, inherits the terminal so interactive `ei`
|
|
9
|
+
* prompts can draw themselves (#1146). Bridge mode (`plan`'s progress) and
|
|
10
|
+
* captures keep the pipes.
|
|
11
|
+
* - Export calls (file mode, results land in `.tf/in/`): ei's stdout is
|
|
12
|
+
* status text — routed to OUR progress stream (see `engine/progress.ts`), so
|
|
13
|
+
* an Elementum command's stdout stays one pure JSON summary whenever anything
|
|
14
|
+
* is actually reading it.
|
|
15
|
+
* - Capture calls (machine-consumed stdout, e.g. adoption's plan output):
|
|
16
|
+
* stdout captured bounded, stderr routed through EDK's diagnostics sink.
|
|
17
|
+
*
|
|
18
|
+
* ei owns auth (`ei auth login`) — Elementum sets no credentials and never talks
|
|
19
|
+
* to the platform itself.
|
|
20
|
+
*/
|
|
21
|
+
import { type PartialReadEvent, type ProgressEvent } from "../logging.js";
|
|
22
|
+
export declare class EiRunError extends Error {
|
|
23
|
+
readonly exitCode: number | null;
|
|
24
|
+
readonly stderr?: string;
|
|
25
|
+
constructor(message: string, exitCode: number | null, stderr?: string);
|
|
26
|
+
}
|
|
27
|
+
export declare function configureBridgeProfile(profile: string | undefined): void;
|
|
28
|
+
export declare function configuredBridgeProfile(): string | undefined;
|
|
29
|
+
export declare function managedElementumRoot(): string;
|
|
30
|
+
/**
|
|
31
|
+
* Resolve the private Go bridge.
|
|
32
|
+
*
|
|
33
|
+
* 1. `ELEMENTUM_BRIDGE_PATH` — explicit pin, always honored (relative paths
|
|
34
|
+
* resolve against cwd). Empty/whitespace is treated as unset.
|
|
35
|
+
* 2. Managed libexec — `~/.elementum/libexec/elementum/ei` (or `$ELEMENTUM_HOME/...`).
|
|
36
|
+
* Installed toolchains keep `ei` here, not on PATH (`~/.elementum/bin` only
|
|
37
|
+
* has `elementum`). Preferring this over PATH keeps the CLI on the
|
|
38
|
+
* version-locked train when a source-built or leftover `ei` is also on PATH.
|
|
39
|
+
* 3. PATH — OS-native lookup for `ei`. Used when there is no managed install
|
|
40
|
+
* (source-built bridge on PATH, no installer).
|
|
41
|
+
*/
|
|
42
|
+
export declare function resolveEiBinary(): string;
|
|
43
|
+
/**
|
|
44
|
+
* Resolve the OpenTofu binary shipped in the same managed Elementum train.
|
|
45
|
+
* Source development may explicitly select an engine for tests/local work;
|
|
46
|
+
* installed executions never fall back to a globally installed tofu binary.
|
|
47
|
+
*/
|
|
48
|
+
export declare function resolveOpenTofuBinary(): string;
|
|
49
|
+
/**
|
|
50
|
+
* Whether the bridge will resolve the plan engine to OpenTofu. OpenTofu is
|
|
51
|
+
* the only supported engine for `-target-file`; keep the adoption fallback
|
|
52
|
+
* conservative when an explicit Terraform command or a PATH-only install is
|
|
53
|
+
* in use.
|
|
54
|
+
*/
|
|
55
|
+
export declare function usesOpenTofuTargetFile(): boolean;
|
|
56
|
+
/**
|
|
57
|
+
* The OpenTofu the bridge plans with: `ELEMENTUM_TERRAFORM_COMMAND`, else the
|
|
58
|
+
* managed OpenTofu, else `tofu` on PATH. Undefined when none is executable.
|
|
59
|
+
*/
|
|
60
|
+
export declare function resolveBridgeOpenTofu(): string | undefined;
|
|
61
|
+
/**
|
|
62
|
+
* Read Cobra's root help without auth/profile resolution. This deliberately
|
|
63
|
+
* bypasses bridgeArgs: root discovery must stay local even when the Elementum
|
|
64
|
+
* invocation includes a global --profile.
|
|
65
|
+
*/
|
|
66
|
+
export declare function runEiLocalHelp(): Promise<string>;
|
|
67
|
+
/**
|
|
68
|
+
* Run a local (no auth, no profile) bridge command that reads `input` on stdin
|
|
69
|
+
* and returns stdout. Non-zero exit rejects with the captured stderr.
|
|
70
|
+
*/
|
|
71
|
+
export declare function runEiLocalWithInput(args: readonly string[], input: string): Promise<string>;
|
|
72
|
+
/**
|
|
73
|
+
* Run `ei` with EDK-owned streaming and return its exit code. The caller (a
|
|
74
|
+
* CLI pass-through) should `process.exit(code)` with it. Output is streamed
|
|
75
|
+
* rather than buffered so large OpenTofu plans do not hit a capture limit or
|
|
76
|
+
* deadlock the child. An interactive terminal run hands the child the
|
|
77
|
+
* terminal instead (see {@link passthroughNeedsTerminal}).
|
|
78
|
+
*/
|
|
79
|
+
export declare function runEiPassthrough(args: readonly string[], opts?: {
|
|
80
|
+
cwd?: string;
|
|
81
|
+
stdout?: NodeJS.WritableStream;
|
|
82
|
+
stderr?: NodeJS.WritableStream;
|
|
83
|
+
bridge?: boolean;
|
|
84
|
+
progressTotal?: number;
|
|
85
|
+
}): Promise<number>;
|
|
86
|
+
/** Returns and clears the partial reads reported by `runEiWithStatus` exports. */
|
|
87
|
+
export declare function takePartialReads(): PartialReadEvent[];
|
|
88
|
+
/**
|
|
89
|
+
* Run `ei` with EDK-owned streaming: stdout (status text) is routed to OUR
|
|
90
|
+
* progress stream and stderr to the diagnostics sink. For file-mode export
|
|
91
|
+
* calls — the caller's own stdout stays a single JSON summary whenever it is
|
|
92
|
+
* piped.
|
|
93
|
+
*/
|
|
94
|
+
export declare function runEiWithStatus(args: readonly string[], opts?: {
|
|
95
|
+
cwd?: string;
|
|
96
|
+
bridge?: boolean;
|
|
97
|
+
env?: NodeJS.ProcessEnv;
|
|
98
|
+
onProgress?: (event: ProgressEvent) => void;
|
|
99
|
+
userOutput?: NodeJS.WritableStream;
|
|
100
|
+
}): Promise<void>;
|
|
101
|
+
/**
|
|
102
|
+
* Run the managed OpenTofu binary while reserving a piped stdout for the
|
|
103
|
+
* Elementum command's single result. Arguments are passed directly, never
|
|
104
|
+
* through a shell, so provider source addresses cannot be reinterpreted.
|
|
105
|
+
*/
|
|
106
|
+
export declare function runOpenTofuWithStatus(args: readonly string[], opts?: {
|
|
107
|
+
cwd?: string;
|
|
108
|
+
}): Promise<void>;
|
|
109
|
+
/** Capture bounded, machine-consumed OpenTofu stdout while preserving stderr. */
|
|
110
|
+
export declare function runOpenTofuCapture(args: readonly string[], opts?: {
|
|
111
|
+
cwd?: string;
|
|
112
|
+
suppressStderr?: boolean;
|
|
113
|
+
binary?: string;
|
|
114
|
+
}): Promise<string>;
|
|
115
|
+
/**
|
|
116
|
+
* Run `ei` capturing stdout (the machine-consumed stream); stderr is routed by
|
|
117
|
+
* EDK to the diagnostics sink. Non-zero exit rejects — partial output must be
|
|
118
|
+
* discarded.
|
|
119
|
+
*
|
|
120
|
+
* `echoStdout` additionally tees stdout to OUR stderr as it arrives, for long
|
|
121
|
+
* captured commands whose output is also the user's only progress signal
|
|
122
|
+
* (adoption's `ei plan`). It never moves anything onto our stdout, so the
|
|
123
|
+
* caller's single-JSON-summary contract holds.
|
|
124
|
+
*/
|
|
125
|
+
export declare function runEiCapture(args: readonly string[], opts?: {
|
|
126
|
+
cwd?: string;
|
|
127
|
+
suppressStderr?: boolean;
|
|
128
|
+
echoStdout?: boolean;
|
|
129
|
+
tofuJsonProgress?: {
|
|
130
|
+
readonly expectedAddresses: ReadonlySet<string>;
|
|
131
|
+
};
|
|
132
|
+
}): Promise<string>;
|
|
133
|
+
export type TofuJsonEvent = {
|
|
134
|
+
readonly type: "refresh_start" | "refresh_complete";
|
|
135
|
+
readonly address: string;
|
|
136
|
+
readonly message?: string;
|
|
137
|
+
} | {
|
|
138
|
+
readonly type: "diagnostic";
|
|
139
|
+
readonly level: "INFO" | "WARN" | "ERROR";
|
|
140
|
+
readonly message: string;
|
|
141
|
+
} | {
|
|
142
|
+
readonly type: "other";
|
|
143
|
+
};
|
|
144
|
+
/** Parse the stable subset of OpenTofu's line-delimited JSON UI used by adoption. */
|
|
145
|
+
export declare function parseTofuJsonEvent(line: string): TofuJsonEvent;
|
|
146
|
+
/** Capture both bridge output streams for small machine-inspection commands. */
|
|
147
|
+
export declare function runEiCaptureCombined(args: readonly string[], opts?: {
|
|
148
|
+
cwd?: string;
|
|
149
|
+
}): Promise<string>;
|