@elementumai/edk 0.9.10 → 0.9.12
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 +39 -5
- package/dist-sdk/src/catalog/factories.d.ts +42 -14
- package/dist-sdk/src/catalog/factories.js +77 -14
- package/dist-sdk/src/catalog/from-authoring.js +4 -4
- package/dist-sdk/src/catalog/index.d.ts +2 -2
- package/dist-sdk/src/catalog/index.js +1 -1
- package/dist-sdk/src/catalog/org.js +3 -2
- package/dist-sdk/src/catalog/token.js +4 -0
- package/dist-sdk/src/catalog/types.d.ts +32 -5
- package/dist-sdk/src/catalog/types.js +1 -0
- package/dist-sdk/src/core/triggers/on-demand.d.ts +4 -28
- package/dist-sdk/src/core/triggers/on-demand.js +2 -4
- package/dist-sdk/src/engine/build/context.d.ts +3 -0
- package/dist-sdk/src/engine/entity.d.ts +2 -0
- package/dist-sdk/src/engine/logging.d.ts +90 -0
- package/dist-sdk/src/engine/logging.js +124 -0
- package/dist-sdk/src/engine/progress.d.ts +119 -0
- package/dist-sdk/src/engine/progress.js +647 -0
- package/dist-sdk/src/engine/pull/result-output.d.ts +24 -0
- package/dist-sdk/src/engine/pull/result-output.js +48 -0
- package/dist-sdk/src/entities/access-policy/from-tf.d.ts +3 -3
- package/dist-sdk/src/entities/access-policy/from-tf.js +27 -8
- package/dist-sdk/src/entities/access-policy/to-tf.d.ts +13 -0
- package/dist-sdk/src/entities/access-policy/to-tf.js +34 -3
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +13 -7
- package/dist-sdk/src/entities/agent/tools.d.ts +2 -2
- package/dist-sdk/src/entities/agent-tool/to-tf.js +13 -0
- package/dist-sdk/src/entities/app/build.d.ts +22 -2
- package/dist-sdk/src/entities/app/build.js +6 -0
- package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +13 -3
- package/dist-sdk/src/entities/app/from-tf.js +10 -7
- package/dist-sdk/src/entities/app/to-tf.js +14 -14
- package/dist-sdk/src/entities/automation/build.d.ts +11 -16
- package/dist-sdk/src/entities/automation/build.js +38 -8
- package/dist-sdk/src/entities/automation/catalog-render.js +1 -1
- package/dist-sdk/src/entities/automation/deserializer/ast.d.ts +1 -2
- package/dist-sdk/src/entities/automation/deserializer/print-automation.d.ts +23 -5
- package/dist-sdk/src/entities/automation/deserializer/print-automation.js +239 -34
- package/dist-sdk/src/entities/automation/from-tf.js +276 -19
- package/dist-sdk/src/entities/automation/index.d.ts +2 -2
- package/dist-sdk/src/entities/automation/module.js +3 -2
- package/dist-sdk/src/entities/automation/output-field-types.js +25 -13
- package/dist-sdk/src/entities/automation/script-code.d.ts +12 -4
- package/dist-sdk/src/entities/automation/script-code.js +659 -101
- package/dist-sdk/src/entities/automation/tasks.d.ts +60 -28
- package/dist-sdk/src/entities/automation/tasks.js +48 -15
- package/dist-sdk/src/entities/automation/to-tf.d.ts +8 -0
- package/dist-sdk/src/entities/automation/to-tf.js +514 -103
- package/dist-sdk/src/entities/automation/triggers.d.ts +15 -9
- package/dist-sdk/src/entities/automation/triggers.js +4 -2
- package/dist-sdk/src/entities/automation/types.js +1 -0
- package/dist-sdk/src/entities/chart/build.d.ts +15 -3
- package/dist-sdk/src/entities/chart/build.js +6 -1
- package/dist-sdk/src/entities/chart/from-tf.d.ts +8 -2
- package/dist-sdk/src/entities/chart/from-tf.js +71 -8
- package/dist-sdk/src/entities/chart/index.d.ts +1 -1
- package/dist-sdk/src/entities/chart/index.js +1 -1
- package/dist-sdk/src/entities/chart/printer.js +27 -7
- package/dist-sdk/src/entities/chart/to-tf.js +56 -2
- package/dist-sdk/src/entities/dashboard/from-tf.js +11 -2
- package/dist-sdk/src/entities/datamine/from-tf.js +11 -1
- package/dist-sdk/src/entities/dynamic-layout/build.d.ts +2 -1
- package/dist-sdk/src/entities/dynamic-layout/dialect.d.ts +8 -0
- package/dist-sdk/src/entities/dynamic-layout/dialect.js +12 -0
- package/dist-sdk/src/entities/dynamic-layout/from-tf.d.ts +7 -0
- package/dist-sdk/src/entities/dynamic-layout/from-tf.js +64 -10
- package/dist-sdk/src/entities/dynamic-layout/to-tf.js +54 -6
- package/dist-sdk/src/entities/element/build.d.ts +8 -0
- package/dist-sdk/src/entities/element/from-tf.js +4 -3
- package/dist-sdk/src/entities/element/module.js +1 -0
- package/dist-sdk/src/entities/element/to-tf.d.ts +4 -1
- package/dist-sdk/src/entities/element/to-tf.js +28 -2
- package/dist-sdk/src/entities/field/build.d.ts +10 -1
- package/dist-sdk/src/entities/field/build.js +2 -1
- package/dist-sdk/src/entities/field/calc/index.js +7 -7
- package/dist-sdk/src/entities/field/calc/runtime.d.ts +19 -0
- package/dist-sdk/src/entities/field/calc/runtime.js +32 -0
- package/dist-sdk/src/entities/field/calc/types.d.ts +6 -0
- package/dist-sdk/src/entities/field/from-tf.d.ts +24 -0
- package/dist-sdk/src/entities/field/from-tf.js +73 -1
- package/dist-sdk/src/entities/field/metadata.d.ts +18 -0
- package/dist-sdk/src/entities/field/metadata.js +34 -0
- package/dist-sdk/src/entities/file-reader/to-tf.js +10 -2
- package/dist-sdk/src/entities/relationship/build.d.ts +27 -9
- package/dist-sdk/src/entities/relationship/column-contract.d.ts +24 -0
- package/dist-sdk/src/entities/relationship/column-contract.js +41 -0
- package/dist-sdk/src/entities/relationship/from-tf.js +33 -48
- package/dist-sdk/src/entities/relationship/to-tf.d.ts +1 -0
- package/dist-sdk/src/entities/relationship/to-tf.js +33 -2
- package/dist-sdk/src/entities/shared/aspect-target-from-tf.d.ts +15 -0
- package/dist-sdk/src/entities/shared/aspect-target-from-tf.js +21 -0
- package/dist-sdk/src/entities/shared/context.d.ts +6 -3
- package/dist-sdk/src/entities/shared/context.js +19 -1
- package/dist-sdk/src/entities/shared/filters/index.d.ts +7 -0
- package/dist-sdk/src/entities/shared/filters/index.js +28 -0
- package/dist-sdk/src/entities/shared/filters/print.js +2 -0
- package/dist-sdk/src/entities/shared/filters/tf-codec.d.ts +8 -1
- package/dist-sdk/src/entities/shared/filters/tf-codec.js +10 -6
- package/dist-sdk/src/entities/shared/filters/types.d.ts +1 -1
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.d.ts +5 -0
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +52 -27
- package/dist-sdk/src/entities/skill/module.js +1 -0
- package/dist-sdk/src/entities/skill/to-tf.d.ts +1 -1
- package/dist-sdk/src/entities/skill/to-tf.js +17 -0
- package/dist-sdk/src/entities/skill/tools.d.ts +48 -12
- package/dist-sdk/src/entities/skill/tools.js +12 -1
- package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +15 -12
- package/dist-sdk/src/entities/skill-tool/from-tf.js +50 -46
- package/dist-sdk/src/entities/skill-tool/to-tf.d.ts +4 -0
- package/dist-sdk/src/entities/skill-tool/to-tf.js +66 -7
- package/dist-sdk/src/entities/table/build.js +10 -2
- package/dist-sdk/src/entities/table/catalog-render.js +2 -1
- package/dist-sdk/src/entities/view/from-tf.js +9 -0
- package/dist-sdk/src/entities/view/to-tf.d.ts +7 -0
- package/dist-sdk/src/entities/view/to-tf.js +39 -12
- package/dist-sdk/src/entities/widget/build.d.ts +43 -7
- package/dist-sdk/src/entities/widget/from-tf.d.ts +1 -1
- package/dist-sdk/src/entities/widget/from-tf.js +162 -23
- package/dist-sdk/src/entities/widget/to-tf.d.ts +17 -0
- package/dist-sdk/src/entities/widget/to-tf.js +150 -6
- package/dist-sdk/src/graph/types.d.ts +13 -0
- package/package.json +1 -1
- package/dist-sdk/src/core/types/platform.d.ts +0 -2
- package/dist-sdk/src/core/types/platform.js +0 -1
package/README.md
CHANGED
|
@@ -146,8 +146,38 @@ Terraform state. Adoption is gated to exactly the expected imports, zero
|
|
|
146
146
|
create/update/destroy operations, and a clean follow-up plan. Use `--no-adopt`
|
|
147
147
|
only when you deliberately want source without state adoption.
|
|
148
148
|
|
|
149
|
-
|
|
150
|
-
|
|
149
|
+
Interactive pull commands finish with a concise stdout summary of what was
|
|
150
|
+
written and where. When stdout is piped or redirected, that summary remains one
|
|
151
|
+
machine-readable JSON object. Diagnostics and stream kinds that do not yet have
|
|
152
|
+
an extractor are reported rather than silently discarded.
|
|
153
|
+
|
|
154
|
+
### Output and live feedback contract
|
|
155
|
+
|
|
156
|
+
Pull, plan, and adoption commands use one terminal-aware live status renderer.
|
|
157
|
+
The live spinner or progress bar is shown only on a TTY, is kept immediately
|
|
158
|
+
below durable output, and yields to messages arriving from `ei`, OpenTofu, or
|
|
159
|
+
the provider. It is removed cleanly when the operation ends or is interrupted;
|
|
160
|
+
`CTRL+C` restores the cursor.
|
|
161
|
+
|
|
162
|
+
Technical output is separated from user-facing output:
|
|
163
|
+
|
|
164
|
+
- stderr contains only newline-delimited JSON technical events when the EDK
|
|
165
|
+
bridge is active (logs, progress lifecycle, and protocol fallbacks);
|
|
166
|
+
- stdout contains user-facing messages and command results;
|
|
167
|
+
- `--json` enables machine-readable technical logging and disables live
|
|
168
|
+
progress, while keeping command result data on stdout;
|
|
169
|
+
- `--bridge` is an instruction to `ei` to use the EDK communication protocol,
|
|
170
|
+
not a log-format switch. Standalone `ei` output remains human-readable.
|
|
171
|
+
|
|
172
|
+
The bridge carries progress sections (`progress_enter`, `progress_update`, and
|
|
173
|
+
`progress_leave`) as well as structured logs. Text effects are sent as ordered
|
|
174
|
+
ranges and are rendered only for TTY output. ANSI styles from provider output
|
|
175
|
+
are converted into the same structured representation where possible.
|
|
176
|
+
OpenTofu lifecycle lines are logged as `tofu`, provider `tflog` lines as
|
|
177
|
+
`provider`, and malformed or unexpected child output is retained as a
|
|
178
|
+
structured fallback event instead of leaking raw text onto the technical
|
|
179
|
+
channel. Update failures are ordinary user messages; in JSON mode they are
|
|
180
|
+
included in the result object.
|
|
151
181
|
|
|
152
182
|
## CLI commands
|
|
153
183
|
|
|
@@ -155,7 +185,7 @@ The TypeScript-owned command surface is:
|
|
|
155
185
|
|
|
156
186
|
```sh
|
|
157
187
|
elementum init [--check] [--json]
|
|
158
|
-
elementum update [--check | --dry-run] [--channel stable|preview] [--version <semver>]
|
|
188
|
+
elementum update [--check | --dry-run] [--channel stable|preview] [--version <semver>] [--json]
|
|
159
189
|
elementum migrate backend [orgRoot] [--check | --dry-run | --auto-approve] [--reconfigure]
|
|
160
190
|
elementum migrate provider-source [orgRoot] [--check | --dry-run | --auto-approve]
|
|
161
191
|
|
|
@@ -165,8 +195,8 @@ elementum pull app <namespace> [--root <orgRoot>] [--no-adopt]
|
|
|
165
195
|
elementum pull element <namespace> [--root <orgRoot>] [--no-adopt]
|
|
166
196
|
elementum clone app <namespace> --as <newName> [--namespace <newns>] [--root <orgRoot>]
|
|
167
197
|
elementum build [orgRoot]
|
|
168
|
-
elementum plan [orgRoot-or-nested-target] [bridge args...]
|
|
169
|
-
elementum apply [orgRoot-or-nested-target] [bridge args...]
|
|
198
|
+
elementum plan [orgRoot-or-nested-target] [--json] [bridge args...]
|
|
199
|
+
elementum apply [orgRoot-or-nested-target] [--json] [bridge args...]
|
|
170
200
|
|
|
171
201
|
elementum list apps|elements|users|groups|categories|cloud-links
|
|
172
202
|
elementum list ai-provider-connectors|automations|tables
|
|
@@ -427,6 +457,10 @@ stdio. With no explicit profile, the CLI selects the unique saved profile
|
|
|
427
457
|
matching the org root's `<instance>/<organization>` path. Review destroy and
|
|
428
458
|
replacement actions just as you would in any Terraform plan.
|
|
429
459
|
|
|
460
|
+
Use `--json` for automation and log ingestion. It disables the interactive
|
|
461
|
+
spinner/progress renderer and emits technical diagnostics as one JSON object per
|
|
462
|
+
line on stderr; do not parse human-facing stdout as a log stream.
|
|
463
|
+
|
|
430
464
|
## Identity and state recovery
|
|
431
465
|
|
|
432
466
|
Terraform state is the durable binding between authored labels and live
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Typed factory functions for every catalog ref kind.
|
|
3
3
|
*
|
|
4
4
|
* Each function accepts all fields except `__kind` and `handle`, so generated
|
|
5
|
-
* and authored code never contains a raw `__kind` string literal
|
|
6
|
-
*
|
|
5
|
+
* and authored code never contains a raw `__kind` string literal. Inside catalog
|
|
6
|
+
* bags, authored calls need no identity properties either. `resolveRef`
|
|
7
7
|
* (`src/deploy/resolve/resolve.ts`) and `resolvePayload` read `.handle`
|
|
8
8
|
* directly off an embedded ref with no other context available once it's been
|
|
9
9
|
* destructured out of its parent bag, so that property has to keep existing
|
|
@@ -11,15 +11,18 @@
|
|
|
11
11
|
* constructed as a bag entry (`agents: { agent11: agentRef() }`), and the
|
|
12
12
|
* bag's own object-literal key *is* the ref name. `appCatalog`/`elementCatalog`/
|
|
13
13
|
* `orgCatalog` read that key, stamp it onto `.handle`, and also inject `parent`
|
|
14
|
-
* from the catalog root's own identity — so
|
|
15
|
-
* agents
|
|
14
|
+
* from the catalog root's own identity — so catalog-embedded factory calls for
|
|
15
|
+
* automations or agents need not restate either property. Standalone
|
|
16
|
+
* {@link automationRef} / {@link widgetRef} calls consumed directly (e.g. a
|
|
17
|
+
* `runAutomation` widget) should pass `refName` and `parent`.
|
|
16
18
|
*
|
|
17
19
|
* Each factory still sets `.handle`/`.name` to something internally purely so
|
|
18
20
|
* the object satisfies `CatalogRef`'s structural shape before bag-level stamping;
|
|
19
21
|
* nothing reads those interim values.
|
|
20
22
|
*/
|
|
21
23
|
import type { AiProviderLlmModel, AiProviderType } from "./ai-provider-models.js";
|
|
22
|
-
import type { AgentEvaluationRef, AgentRef, AppCatalogRef, AiProviderRef, ApprovalChainRef, AutomationCatalogRef, CatalogRef, CategoryRef, ChartRef, DashboardRef, CloudLinkRef, ConnectorRef, DatamineRef, GroupRef, PhoneProviderRef, PhoneServiceRef, ProcedureParameterType, ProcedureRef, FileReaderCatalogRef, DocumentModelFieldRef, ElementCatalogRef, FieldRef, OutputPropertyRef, SearchTableRef, StoredFunctionRef, StoredFunctionScalarType, SkillRef, TableColumnRef, TableRef, TriggerParameterRef } from "./types.js";
|
|
24
|
+
import type { AgentEvaluationRef, AgentRef, AppCatalogRef, AppOrElementRef, AiProviderRef, ApprovalChainRef, AutomationCatalogRef, CatalogRef, CategoryRef, ChartRef, DashboardRef, WidgetRef, CloudLinkRef, ConnectorRef, DatamineRef, GroupRef, PhoneProviderRef, PhoneServiceRef, ProcedureParameterType, ProcedureRef, FileReaderCatalogRef, DocumentModelFieldRef, ElementCatalogRef, FieldRef, OutputPropertyRef, RecordIdentityRef, SearchTableRef, StoredFunctionRef, StoredFunctionScalarType, SkillRef, TableColumnRef, TableOwnedSearchTableRef, TableRef, TriggerParameterRef } from "./types.js";
|
|
25
|
+
export declare function recordIdentity<const Target extends AppOrElementRef | TableRef>(target: Target): RecordIdentityRef<Target>;
|
|
23
26
|
/** Fixed platform user-directory schema used by userSearch filters. */
|
|
24
27
|
export declare const usersCatalog: {
|
|
25
28
|
readonly fields: {
|
|
@@ -88,20 +91,32 @@ type WithOwnedCharts<B extends AppCatalogBags, Parent extends string> = B extend
|
|
|
88
91
|
} : B;
|
|
89
92
|
type WithOwnedCatalogChildren<B extends AppCatalogBags, Parent extends string> = WithOwnedCharts<WithOwnedAgents<B, Parent>, Parent>;
|
|
90
93
|
/**
|
|
91
|
-
* Automation ref
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
* `
|
|
94
|
+
* Automation ref — same identity knobs as {@link widgetRef}: optional `refName`
|
|
95
|
+
* and `parent`, plus optional `trigger`/`outputs` bags of typed parameter/
|
|
96
|
+
* property refs.
|
|
97
|
+
*
|
|
98
|
+
* Standalone use (a `runAutomation` widget or task outside a generated
|
|
99
|
+
* catalog) must pass `refName` (the automation file's bag key) and `parent`
|
|
100
|
+
* (the owning app/element refName). Empty `refName` is dropped at build.
|
|
101
|
+
*
|
|
102
|
+
* Inside `appCatalog`/`elementCatalog`, the bag key and catalog identity
|
|
103
|
+
* overwrite `refName`/`parent` after the factory returns — those call sites
|
|
104
|
+
* can keep passing only `name`/`trigger`/`outputs`. Prefer
|
|
105
|
+
* `catalog.<app>.automations.<refName>` or `app().withRefs((self) =>
|
|
106
|
+
* self.automation(refName, name))` when that owner file is in scope.
|
|
107
|
+
* Elements have no `withRefs` helper yet.
|
|
96
108
|
*
|
|
97
109
|
* Generic parameters `T`/`O` preserve specific key shapes on the returned ref so TypeScript can
|
|
98
|
-
* narrow `.trigger.<name>` and `.outputs.<name>` at the call site.
|
|
110
|
+
* narrow `.trigger.<name>` and `.outputs.<name>` at the call site. `Parent`/
|
|
111
|
+
* `RefName` match {@link widgetRef}.
|
|
99
112
|
*/
|
|
100
|
-
export declare function automationRef<T extends Readonly<Record<string, TriggerParameterRef>> | undefined = undefined, O extends Readonly<Record<string, OutputPropertyRef>> | undefined = undefined>(opts?: {
|
|
113
|
+
export declare function automationRef<T extends Readonly<Record<string, TriggerParameterRef>> | undefined = undefined, O extends Readonly<Record<string, OutputPropertyRef>> | undefined = undefined, const Parent extends string = string, const RefName extends string = string>(opts?: {
|
|
114
|
+
readonly refName?: RefName;
|
|
101
115
|
readonly name?: string;
|
|
116
|
+
readonly parent?: Parent;
|
|
102
117
|
readonly trigger?: T;
|
|
103
118
|
readonly outputs?: O;
|
|
104
|
-
}): AutomationCatalogRef & {
|
|
119
|
+
}): AutomationCatalogRef<Parent, RefName> & {
|
|
105
120
|
readonly trigger: T;
|
|
106
121
|
readonly outputs: O;
|
|
107
122
|
};
|
|
@@ -147,6 +162,7 @@ export declare const outputPropertyRef: <const T extends {
|
|
|
147
162
|
readonly name: string;
|
|
148
163
|
readonly parent: string;
|
|
149
164
|
readonly valueType?: string;
|
|
165
|
+
readonly multiple?: boolean;
|
|
150
166
|
}>(opts: T) => T & {
|
|
151
167
|
readonly __kind: "outputProperty";
|
|
152
168
|
readonly refName: string;
|
|
@@ -173,6 +189,11 @@ export declare function dashboardRef<const Parent extends string = string, const
|
|
|
173
189
|
readonly name?: string;
|
|
174
190
|
readonly parent?: Parent;
|
|
175
191
|
}): DashboardRef<Parent, RefName>;
|
|
192
|
+
export declare function widgetRef<const Parent extends string = string, const RefName extends string = string>(opts?: {
|
|
193
|
+
readonly refName?: RefName;
|
|
194
|
+
readonly name?: string;
|
|
195
|
+
readonly parent?: Parent;
|
|
196
|
+
}): WidgetRef<Parent, RefName>;
|
|
176
197
|
/**
|
|
177
198
|
* Skill ref — no required arguments, same shape as {@link agentRef}. `handle` and `parent`
|
|
178
199
|
* are injected by the enclosing `appCatalog`/`elementCatalog`; `name` defaults to `""`.
|
|
@@ -186,9 +207,16 @@ export declare function phoneServiceRef(opts?: {
|
|
|
186
207
|
readonly name?: string;
|
|
187
208
|
readonly parent?: string;
|
|
188
209
|
}): PhoneServiceRef;
|
|
210
|
+
/**
|
|
211
|
+
* Datamine reference factory.
|
|
212
|
+
* `columnNames` is populated automatically by `tableRef`, `stampTableRefs`, and `table().ref()`
|
|
213
|
+
* from the parent table's columns, but explicit overrides may be provided.
|
|
214
|
+
*/
|
|
189
215
|
export declare function datamineRef(opts?: {
|
|
190
216
|
readonly name?: string;
|
|
191
217
|
readonly parent?: string;
|
|
218
|
+
readonly parentName?: string;
|
|
219
|
+
readonly columnNames?: Readonly<Record<string, string>>;
|
|
192
220
|
}): DatamineRef;
|
|
193
221
|
export declare const approvalChainRef: (opts: Omit<ApprovalChainRef<string, string>, "parent" | "refName" | "__kind">) => Omit<ApprovalChainRef<string, string>, "parent" | "refName" | "__kind"> & {
|
|
194
222
|
readonly __kind: "approvalChain";
|
|
@@ -199,7 +227,7 @@ export declare function searchTableRef(opts: Omit<SearchTableRef, "__kind" | "re
|
|
|
199
227
|
/** Reference to an existing linked Cortex Search Service. */
|
|
200
228
|
export declare function linkedSearchTableRef(opts: Omit<SearchTableRef, "__kind" | "refName" | "parent">): SearchTableRef;
|
|
201
229
|
/** Reference to a managed search table owned by an Elementum Table. */
|
|
202
|
-
export declare function tableSearchTableRef(opts: Omit<SearchTableRef, "__kind" | "refName"
|
|
230
|
+
export declare function tableSearchTableRef(opts: Omit<SearchTableRef, "__kind" | "refName">): TableOwnedSearchTableRef;
|
|
203
231
|
export declare const connectorRef: (opts: Omit<import("./types.js").AiServiceRef, "refName" | "__kind">) => Omit<import("./types.js").AiServiceRef, "refName" | "__kind"> & {
|
|
204
232
|
readonly __kind: "connector";
|
|
205
233
|
readonly refName: string;
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
export function recordIdentity(target) {
|
|
2
|
+
return { __kind: "recordIdentity", refName: "id", name: "Record ID", target };
|
|
3
|
+
}
|
|
1
4
|
/** Fixed platform user-directory schema used by userSearch filters. */
|
|
2
5
|
export const usersCatalog = {
|
|
3
6
|
fields: {
|
|
@@ -20,20 +23,31 @@ function refFactory(kind) {
|
|
|
20
23
|
return (opts) => ({ __kind: kind, refName: opts.name, ...opts });
|
|
21
24
|
}
|
|
22
25
|
/**
|
|
23
|
-
* Automation ref
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
* `
|
|
26
|
+
* Automation ref — same identity knobs as {@link widgetRef}: optional `refName`
|
|
27
|
+
* and `parent`, plus optional `trigger`/`outputs` bags of typed parameter/
|
|
28
|
+
* property refs.
|
|
29
|
+
*
|
|
30
|
+
* Standalone use (a `runAutomation` widget or task outside a generated
|
|
31
|
+
* catalog) must pass `refName` (the automation file's bag key) and `parent`
|
|
32
|
+
* (the owning app/element refName). Empty `refName` is dropped at build.
|
|
33
|
+
*
|
|
34
|
+
* Inside `appCatalog`/`elementCatalog`, the bag key and catalog identity
|
|
35
|
+
* overwrite `refName`/`parent` after the factory returns — those call sites
|
|
36
|
+
* can keep passing only `name`/`trigger`/`outputs`. Prefer
|
|
37
|
+
* `catalog.<app>.automations.<refName>` or `app().withRefs((self) =>
|
|
38
|
+
* self.automation(refName, name))` when that owner file is in scope.
|
|
39
|
+
* Elements have no `withRefs` helper yet.
|
|
28
40
|
*
|
|
29
41
|
* Generic parameters `T`/`O` preserve specific key shapes on the returned ref so TypeScript can
|
|
30
|
-
* narrow `.trigger.<name>` and `.outputs.<name>` at the call site.
|
|
42
|
+
* narrow `.trigger.<name>` and `.outputs.<name>` at the call site. `Parent`/
|
|
43
|
+
* `RefName` match {@link widgetRef}.
|
|
31
44
|
*/
|
|
32
45
|
export function automationRef(opts) {
|
|
33
46
|
return {
|
|
34
47
|
__kind: "automation",
|
|
35
|
-
refName: "",
|
|
48
|
+
refName: opts?.refName ?? "",
|
|
36
49
|
name: opts?.name ?? "",
|
|
50
|
+
...(opts?.parent !== undefined ? { parent: opts.parent } : {}),
|
|
37
51
|
...(opts?.trigger !== undefined ? { trigger: opts.trigger } : {}),
|
|
38
52
|
...(opts?.outputs !== undefined ? { outputs: opts.outputs } : {}),
|
|
39
53
|
};
|
|
@@ -87,6 +101,9 @@ export function chartRef(opts) {
|
|
|
87
101
|
export function dashboardRef(opts) {
|
|
88
102
|
return { __kind: "dashboard", refName: opts?.refName ?? "", name: opts?.name ?? "", ...(opts?.parent !== undefined ? { parent: opts.parent } : {}) };
|
|
89
103
|
}
|
|
104
|
+
export function widgetRef(opts) {
|
|
105
|
+
return { __kind: "widget", refName: opts?.refName ?? "", name: opts?.name ?? "", ...(opts?.parent !== undefined ? { parent: opts.parent } : {}) };
|
|
106
|
+
}
|
|
90
107
|
/**
|
|
91
108
|
* Skill ref — no required arguments, same shape as {@link agentRef}. `handle` and `parent`
|
|
92
109
|
* are injected by the enclosing `appCatalog`/`elementCatalog`; `name` defaults to `""`.
|
|
@@ -103,8 +120,20 @@ export function skillRef(opts) {
|
|
|
103
120
|
export function phoneServiceRef(opts) {
|
|
104
121
|
return { __kind: "phone-service", refName: "", name: opts?.name ?? "", ...(opts?.parent !== undefined ? { parent: opts.parent } : {}) };
|
|
105
122
|
}
|
|
123
|
+
/**
|
|
124
|
+
* Datamine reference factory.
|
|
125
|
+
* `columnNames` is populated automatically by `tableRef`, `stampTableRefs`, and `table().ref()`
|
|
126
|
+
* from the parent table's columns, but explicit overrides may be provided.
|
|
127
|
+
*/
|
|
106
128
|
export function datamineRef(opts) {
|
|
107
|
-
return {
|
|
129
|
+
return {
|
|
130
|
+
__kind: "datamine",
|
|
131
|
+
refName: "",
|
|
132
|
+
name: opts?.name ?? "",
|
|
133
|
+
...(opts?.parent !== undefined ? { parent: opts.parent } : {}),
|
|
134
|
+
...(opts?.parentName !== undefined ? { parentName: opts.parentName } : {}),
|
|
135
|
+
...(opts?.columnNames !== undefined ? { columnNames: opts.columnNames } : {}),
|
|
136
|
+
};
|
|
108
137
|
}
|
|
109
138
|
export const approvalChainRef = refFactory("approvalChain");
|
|
110
139
|
function searchTableRefFor(opts, variant) {
|
|
@@ -214,12 +243,26 @@ export function tableRef(opts) {
|
|
|
214
243
|
refName,
|
|
215
244
|
{ ...column, refName, parent: opts.refName ?? opts.name, parentName: opts.name },
|
|
216
245
|
]));
|
|
246
|
+
const derivedColumnNames = opts.columns === undefined
|
|
247
|
+
? undefined
|
|
248
|
+
: Object.fromEntries(Object.entries(opts.columns).map(([colKey, col]) => [colKey, col.name ?? colKey]));
|
|
217
249
|
const datamines = opts.datamines === undefined
|
|
218
250
|
? undefined
|
|
219
|
-
: Object.fromEntries(Object.entries(opts.datamines).map(([refName, datamine]) =>
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
251
|
+
: Object.fromEntries(Object.entries(opts.datamines).map(([refName, datamine]) => {
|
|
252
|
+
const mergedColumnNames = derivedColumnNames === undefined && datamine.columnNames === undefined
|
|
253
|
+
? undefined
|
|
254
|
+
: { ...derivedColumnNames, ...datamine.columnNames };
|
|
255
|
+
return [
|
|
256
|
+
refName,
|
|
257
|
+
{
|
|
258
|
+
...datamine,
|
|
259
|
+
refName,
|
|
260
|
+
parent: opts.refName ?? opts.name,
|
|
261
|
+
parentName: opts.name,
|
|
262
|
+
...(mergedColumnNames !== undefined ? { columnNames: mergedColumnNames } : {}),
|
|
263
|
+
},
|
|
264
|
+
];
|
|
265
|
+
}));
|
|
223
266
|
return {
|
|
224
267
|
__kind: "table",
|
|
225
268
|
refName,
|
|
@@ -314,9 +357,29 @@ function stampTableRefs(bag) {
|
|
|
314
357
|
? undefined
|
|
315
358
|
: Object.fromEntries(Object.entries(ref.columns).map(([columnRefName, column]) => [
|
|
316
359
|
columnRefName,
|
|
317
|
-
{ ...column, refName: columnRefName, parent: tableRefName },
|
|
360
|
+
{ ...column, refName: columnRefName, parent: tableRefName, ...(ref.name !== undefined ? { parentName: ref.name } : {}) },
|
|
318
361
|
]));
|
|
319
|
-
const
|
|
362
|
+
const parentName = ref.name;
|
|
363
|
+
const derivedColumnNames = ref.columns === undefined
|
|
364
|
+
? undefined
|
|
365
|
+
: Object.fromEntries(Object.entries(ref.columns).map(([colKey, col]) => [colKey, col.name ?? colKey]));
|
|
366
|
+
const datamines = ref.datamines === undefined
|
|
367
|
+
? undefined
|
|
368
|
+
: Object.fromEntries(Object.entries(ref.datamines).map(([datamineRefName, datamine]) => {
|
|
369
|
+
const mergedColumnNames = derivedColumnNames === undefined && datamine.columnNames === undefined
|
|
370
|
+
? undefined
|
|
371
|
+
: { ...derivedColumnNames, ...datamine.columnNames };
|
|
372
|
+
return [
|
|
373
|
+
datamineRefName,
|
|
374
|
+
{
|
|
375
|
+
...datamine,
|
|
376
|
+
refName: datamineRefName,
|
|
377
|
+
parent: tableRefName,
|
|
378
|
+
...(parentName !== undefined ? { parentName } : {}),
|
|
379
|
+
...(mergedColumnNames !== undefined ? { columnNames: mergedColumnNames } : {}),
|
|
380
|
+
},
|
|
381
|
+
];
|
|
382
|
+
}));
|
|
320
383
|
out[tableRefName] = {
|
|
321
384
|
...ref,
|
|
322
385
|
refName: tableRefName,
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
import { mkdir, readdir, stat, writeFile } from "node:fs/promises";
|
|
23
23
|
import { basename, dirname, join, resolve } from "node:path";
|
|
24
24
|
import { createWorkspaceLoader } from "../engine/workspace/loader.js";
|
|
25
|
+
import { writeTechnicalLog } from "../engine/progress.js";
|
|
25
26
|
import { KIND_BY_ID, ownFileCatalogChildrenOf, } from "../graph/index.js";
|
|
26
27
|
import { writeCatalogBarrel } from "./org.js";
|
|
27
28
|
import { renderCatalog } from "./render.js";
|
|
@@ -207,10 +208,9 @@ async function loadCatalogChildBag(appDir, child, parent, catalogPath, defsOut)
|
|
|
207
208
|
}
|
|
208
209
|
catch (err) {
|
|
209
210
|
const message = err instanceof Error ? err.message : String(err);
|
|
210
|
-
|
|
211
|
-
`using typed stub ${parent}.${refName}: ${message}`);
|
|
211
|
+
writeTechnicalLog("WARN", "edk", `could not load catalog child ${file}; using typed stub ${parent}.${refName}: ${message}`);
|
|
212
212
|
if (process.env.EDK_DEBUG) {
|
|
213
|
-
|
|
213
|
+
writeTechnicalLog("DEBUG", "edk", `Failed to import ${file}: ${String(err)}`);
|
|
214
214
|
}
|
|
215
215
|
// Keep the on-disk child visible to sibling authoring even when its full
|
|
216
216
|
// module cannot load yet (for example, a skill that references an
|
|
@@ -466,7 +466,7 @@ export async function regenerateAppCatalogsUnder(pathOrPaths, tenant) {
|
|
|
466
466
|
}
|
|
467
467
|
catch (err) {
|
|
468
468
|
if (process.env.EDK_DEBUG) {
|
|
469
|
-
|
|
469
|
+
writeTechnicalLog("DEBUG", "edk", `Failed to import ${file}: ${String(err)}`);
|
|
470
470
|
}
|
|
471
471
|
continue;
|
|
472
472
|
}
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
* ids appear here (identity lives in `src/deploy/state`).
|
|
5
5
|
*/
|
|
6
6
|
export { AI_PROVIDER_LLM_MODELS, type AiProviderLlmModel, type AiProviderType } from "./ai-provider-models.js";
|
|
7
|
-
export { REF_SCOPE, REF_UPDATABLE, type AgentRef, type AgentEvaluationRef, type AiProviderRef, type ApprovalChainRef, type ApprovalProcessRef, type AppCatalogRef, type AppOrElementRef, type AutomationCatalogRef, type AutomationRef, type CatalogRef, type CatalogRefKind, type CategoryRef, type ChartRef, type DashboardRef, type CloudLinkRef, type AiServiceRef, type ConnectorRef, type GroupRef, type PhoneProviderRef, type PhoneServiceRef, PROCEDURE_PARAMETER_TYPES, type ProcedureParameterType, type ProcedureRef, type FileReaderCatalogRef, type DocumentModelFieldRef, type ElementCatalogRef, type FieldRef, type OutputPropertyRef, type SearchTableRef, type StoredFunctionRef, type StoredFunctionScalarType, type DatamineRef, type SkillRef, type TableColumnRef, type TableRef, type TriggerParameterRef, USER_FIELD_KEYS, type UserFieldKey, type UserFieldRef, } from "./types.js";
|
|
7
|
+
export { REF_SCOPE, REF_UPDATABLE, type AgentRef, type AgentEvaluationRef, type AiProviderRef, type ApprovalChainRef, type ApprovalProcessRef, type AppCatalogRef, type AppOrElementRef, type AutomationCatalogRef, type AutomationRef, type CatalogRef, type CatalogRefKind, type CategoryRef, type ChartRef, type DashboardRef, type WidgetRef, type CloudLinkRef, type AiServiceRef, type ConnectorRef, type GroupRef, type PhoneProviderRef, type PhoneServiceRef, PROCEDURE_PARAMETER_TYPES, type ProcedureParameterType, type ProcedureRef, type FileReaderCatalogRef, type DocumentModelFieldRef, type ElementCatalogRef, type FieldRef, type OutputPropertyRef, type RecordIdentityRef, type SearchTableRef, type TableOwnedSearchTableRef, type StoredFunctionRef, type StoredFunctionScalarType, type DatamineRef, type SkillRef, type TableColumnRef, type TableRef, type TriggerParameterRef, USER_FIELD_KEYS, type UserFieldKey, type UserFieldRef, } from "./types.js";
|
|
8
8
|
export { renderBarrel, renderCatalog, renderFragment, type BarrelEntry, type BarrelRoot, } from "./render.js";
|
|
9
9
|
export { appCatalogTarget, barrelPathFor, orgCatalogTarget, regenerateBarrel, writeCatalog, writeFlatCatalog, writeFragment, type CatalogTarget, } from "./write.js";
|
|
10
10
|
export { isCatalogToken, slimToken, slimTokens } from "./token.js";
|
|
11
11
|
export { buildAppCatalogFromAuthoring, listEntityFilesFromPaths, refNameOf, regenerateAppCatalogsUnder, writeAppCatalog, writeAppCatalogFromAuthoring, type AppAuthoringCatalog, type AppCatalogRegenResult, type ConfiguredEntity, } from "./from-authoring.js";
|
|
12
|
-
export { agentRef, agentEvaluationRef, appRef, appCatalog, approvalChainRef, automationRef, categoryRef, chartRef, dashboardRef, cloudLinkRef, connectorRef, aiProvider, groupRef, linkedSearchTableRef, phoneProviderRef, phoneServiceRef, procedureRef, documentModelFieldRef, documentModelRef, elementCatalog, elementRef, fieldRef, orgCatalog, outputPropertyRef, searchTableRef, datamineRef, skillRef, storedFunctionRef, tableColumnRef, tableRef, tableSearchTableRef, triggerParameterRef, usersCatalog, } from "./factories.js";
|
|
12
|
+
export { agentRef, agentEvaluationRef, appRef, appCatalog, approvalChainRef, automationRef, categoryRef, chartRef, dashboardRef, widgetRef, cloudLinkRef, connectorRef, aiProvider, groupRef, linkedSearchTableRef, phoneProviderRef, phoneServiceRef, procedureRef, documentModelFieldRef, documentModelRef, elementCatalog, elementRef, fieldRef, orgCatalog, outputPropertyRef, recordIdentity, searchTableRef, datamineRef, skillRef, storedFunctionRef, tableColumnRef, tableRef, tableSearchTableRef, triggerParameterRef, usersCatalog, } from "./factories.js";
|
|
@@ -9,4 +9,4 @@ export { renderBarrel, renderCatalog, renderFragment, } from "./render.js";
|
|
|
9
9
|
export { appCatalogTarget, barrelPathFor, orgCatalogTarget, regenerateBarrel, writeCatalog, writeFlatCatalog, writeFragment, } from "./write.js";
|
|
10
10
|
export { isCatalogToken, slimToken, slimTokens } from "./token.js";
|
|
11
11
|
export { buildAppCatalogFromAuthoring, listEntityFilesFromPaths, refNameOf, regenerateAppCatalogsUnder, writeAppCatalog, writeAppCatalogFromAuthoring, } from "./from-authoring.js";
|
|
12
|
-
export { agentRef, agentEvaluationRef, appRef, appCatalog, approvalChainRef, automationRef, categoryRef, chartRef, dashboardRef, cloudLinkRef, connectorRef, aiProvider, groupRef, linkedSearchTableRef, phoneProviderRef, phoneServiceRef, procedureRef, documentModelFieldRef, documentModelRef, elementCatalog, elementRef, fieldRef, orgCatalog, outputPropertyRef, searchTableRef, datamineRef, skillRef, storedFunctionRef, tableColumnRef, tableRef, tableSearchTableRef, triggerParameterRef, usersCatalog, } from "./factories.js";
|
|
12
|
+
export { agentRef, agentEvaluationRef, appRef, appCatalog, approvalChainRef, automationRef, categoryRef, chartRef, dashboardRef, widgetRef, cloudLinkRef, connectorRef, aiProvider, groupRef, linkedSearchTableRef, phoneProviderRef, phoneServiceRef, procedureRef, documentModelFieldRef, documentModelRef, elementCatalog, elementRef, fieldRef, orgCatalog, outputPropertyRef, recordIdentity, searchTableRef, datamineRef, skillRef, storedFunctionRef, tableColumnRef, tableRef, tableSearchTableRef, triggerParameterRef, usersCatalog, } from "./factories.js";
|
|
@@ -24,6 +24,7 @@ import { AI_PROVIDER_TYPE_BY_RESOURCE_TYPE, ORG_IDENTITY_BAGS, orgRootOwnFileBag
|
|
|
24
24
|
import { sanitizeName, tfLabelToTsLabel, tsLabelToTfLabel } from "../engine/tf/index.js";
|
|
25
25
|
import { sdkPackageSpecifier } from "../internal/sdk-package.js";
|
|
26
26
|
import { OrgExtractError } from "../engine/pull/org.js";
|
|
27
|
+
import { writeTechnicalLog } from "../engine/progress.js";
|
|
27
28
|
// ---------------------------------------------------------------------------
|
|
28
29
|
// Public entry points
|
|
29
30
|
// ---------------------------------------------------------------------------
|
|
@@ -159,7 +160,7 @@ function supportedStoredFunction(fn) {
|
|
|
159
160
|
: fn.parameterTypes.some((type) => STORED_FUNCTION_TYPE[type] === undefined) ? `unsupported argument in ${fn.parameterTypes.join(", ")}`
|
|
160
161
|
: undefined;
|
|
161
162
|
if (problem !== undefined) {
|
|
162
|
-
|
|
163
|
+
writeTechnicalLog("WARN", "edk", `skipping stored function ${fn.name}: ${problem}`);
|
|
163
164
|
return undefined;
|
|
164
165
|
}
|
|
165
166
|
return {
|
|
@@ -334,7 +335,7 @@ function computeElementKeys(appHandles, elementHandles) {
|
|
|
334
335
|
}
|
|
335
336
|
elementKeys.set(h, candidate);
|
|
336
337
|
used.add(candidate);
|
|
337
|
-
|
|
338
|
+
writeTechnicalLog("WARN", "edk", `"${h}" names both an app and an element — the element is exposed as catalog.${candidate} (the app keeps catalog.${h}) to avoid a collision.`);
|
|
338
339
|
}
|
|
339
340
|
return elementKeys;
|
|
340
341
|
}
|
|
@@ -66,6 +66,10 @@ export function slimToken(token) {
|
|
|
66
66
|
out.databaseName = token.databaseName;
|
|
67
67
|
if (token.__kind === "procedure" && typeof token.schemaName === "string")
|
|
68
68
|
out.schemaName = token.schemaName;
|
|
69
|
+
// Datamines carry table column names so trigger filters can resolve ctx.trigger.record.<col>.
|
|
70
|
+
if (token.__kind === "datamine" && typeof token.columnNames === "object" && token.columnNames !== null) {
|
|
71
|
+
out.columnNames = token.columnNames;
|
|
72
|
+
}
|
|
69
73
|
// Search-table resource selection is generated by catalog factories, not
|
|
70
74
|
// authored as public API. Preserve the private discriminator so tool HCL
|
|
71
75
|
// can reference the correct resource family.
|
|
@@ -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" | "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" | "searchTable" | "documentModel" | "documentModelField" | "connector" | "aiProvider" | "category" | "group" | "phoneProvider" | "phone-service" | "datamine" | "app" | "element" | "task" | "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.
|
|
@@ -70,6 +70,7 @@ export type AgentRef<Parent extends string = string, RefName extends string = st
|
|
|
70
70
|
export type AgentEvaluationRef<Parent extends string = string, RefName extends string = string> = CatalogRef<"agent-evaluation", RefName, Parent>;
|
|
71
71
|
export type ChartRef<Parent extends string = string, RefName extends string = string> = CatalogRef<"chart", RefName, Parent>;
|
|
72
72
|
export type DashboardRef<Parent extends string = string, RefName extends string = string> = CatalogRef<"dashboard", RefName, Parent>;
|
|
73
|
+
export type WidgetRef<Parent extends string = string, RefName extends string = string> = CatalogRef<"widget", RefName, Parent>;
|
|
73
74
|
export interface SkillRef extends CatalogRef<"skill"> {
|
|
74
75
|
/**
|
|
75
76
|
* Display name of the app that owns this skill. Generated app catalogs
|
|
@@ -112,8 +113,25 @@ export interface TableRef<RefName extends string = string, Columns extends Reado
|
|
|
112
113
|
/** Raw category id, when imported. Categories are not tokenized yet. */
|
|
113
114
|
readonly categoryId?: string;
|
|
114
115
|
}
|
|
115
|
-
export
|
|
116
|
-
|
|
116
|
+
export interface SearchTableRef<Parent extends string = string, RefName extends string = string> extends CatalogRef<"searchTable", RefName, Parent> {
|
|
117
|
+
/** Display name of a table owner when the reference is outside the workspace. */
|
|
118
|
+
readonly parentName?: string;
|
|
119
|
+
}
|
|
120
|
+
export type TableOwnedSearchTableRef<Parent extends string = string, RefName extends string = string> = SearchTableRef<Parent, RefName> & {
|
|
121
|
+
readonly __variant: "table";
|
|
122
|
+
};
|
|
123
|
+
export interface DatamineRef<Parent extends string = string, RefName extends string = string> extends CatalogRef<"datamine", RefName, Parent> {
|
|
124
|
+
/**
|
|
125
|
+
* The owning table's display NAME, stamped alongside `parent` for the same
|
|
126
|
+
* reason `FieldRef.parentName`/`TableColumnRef.parentName` are — a
|
|
127
|
+
* datamine trigger referencing a table outside this workspace builds to
|
|
128
|
+
* `data.elementum_table.<t>`, and that lookup keys by the table's display
|
|
129
|
+
* name, which `parent` (a refName) doesn't carry.
|
|
130
|
+
*/
|
|
131
|
+
readonly parentName?: string;
|
|
132
|
+
/** Map of column refName / sanitized key → display name for column resolution in filters. */
|
|
133
|
+
readonly columnNames?: Readonly<Record<string, string>>;
|
|
134
|
+
}
|
|
117
135
|
/** Public reference to an AI service/model selected for runtime use. */
|
|
118
136
|
export type AiServiceRef = CatalogRef<"connector">;
|
|
119
137
|
/** @internal Backend compatibility name. Prefer {@link AiServiceRef} on authoring surfaces. */
|
|
@@ -182,6 +200,13 @@ export type ElementCatalogRef<RefName extends string = string> = CatalogRef<"ele
|
|
|
182
200
|
readonly namespace?: string;
|
|
183
201
|
};
|
|
184
202
|
export type AppOrElementRef<RefName extends string = string> = AppCatalogRef<RefName> | ElementCatalogRef<RefName>;
|
|
203
|
+
/** A record's own identity, referenceable without exposing its platform id. */
|
|
204
|
+
export interface RecordIdentityRef<Target extends AppOrElementRef | TableRef = AppOrElementRef | TableRef> {
|
|
205
|
+
readonly __kind: "recordIdentity";
|
|
206
|
+
readonly refName: "id";
|
|
207
|
+
readonly name: "Record ID";
|
|
208
|
+
readonly target: Target;
|
|
209
|
+
}
|
|
185
210
|
/**
|
|
186
211
|
* A field reference. Beyond the shared surface it carries `fieldType` (the
|
|
187
212
|
* platform field type — `"TEXT"`, `"PICKLIST"`, …) so builders can constrain
|
|
@@ -247,8 +272,10 @@ export interface TriggerParameterRef extends CatalogRef<"triggerParameter"> {
|
|
|
247
272
|
* a non-executeScript task). Kept a bare generic `string` here (no import
|
|
248
273
|
* from `entities/`) — same decoupling as {@link FieldRef}'s `fieldType`.
|
|
249
274
|
*/
|
|
250
|
-
export interface OutputPropertyRef<ValueType extends string = string> extends CatalogRef<"outputProperty"> {
|
|
275
|
+
export interface OutputPropertyRef<ValueType extends string = string, Multiple extends boolean = boolean> extends CatalogRef<"outputProperty"> {
|
|
251
276
|
readonly valueType?: ValueType;
|
|
277
|
+
/** True when the output resolves to a list of values rather than one value. */
|
|
278
|
+
readonly multiple?: Multiple;
|
|
252
279
|
}
|
|
253
280
|
export type DocumentModelFieldRef = CatalogRef<"documentModelField">;
|
|
254
281
|
/**
|
|
@@ -273,7 +300,7 @@ export interface FileReaderCatalogRef extends CatalogRef<"documentModel"> {
|
|
|
273
300
|
* fragment renders for an automation and the form `app.automations.<auto>` takes
|
|
274
301
|
* in the barrel. `parent` on each nested ref is this automation's handle.
|
|
275
302
|
*/
|
|
276
|
-
export interface AutomationCatalogRef extends CatalogRef<"automation"> {
|
|
303
|
+
export interface AutomationCatalogRef<Parent extends string = string, RefName extends string = string> extends CatalogRef<"automation", RefName, Parent> {
|
|
277
304
|
readonly parentKind?: "app" | "element";
|
|
278
305
|
readonly parentName?: string;
|
|
279
306
|
readonly parentNamespace?: string;
|
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
import type { AppOrElementRef } from "../../catalog/types.js";
|
|
9
9
|
import type { RecordShape } from "../../entities/field/record-shape.js";
|
|
10
10
|
import type { FieldTypeToTS, TriggerFieldTypeAlias } from "../../entities/shared/types/field-types.js";
|
|
11
|
-
import type { User } from "../types/platform.js";
|
|
12
11
|
/**
|
|
13
12
|
* Scalar `type` values are constrained to the aliases Mobius accepts.
|
|
14
13
|
* A `record` input additionally requires the app/element whose record is
|
|
@@ -38,43 +37,21 @@ export type TriggerInputFieldDef = ScalarTriggerInputFieldDef | RecordTriggerInp
|
|
|
38
37
|
* { invoiceId: { type: "text", required: true }, amount: { type: "number" } }
|
|
39
38
|
*/
|
|
40
39
|
export type TriggerInputSchema = Record<string, TriggerInputFieldDef>;
|
|
41
|
-
/**
|
|
42
|
-
* Options carried alongside the schema. `ShowTriggeredBy` defaults to
|
|
43
|
-
* `false`; when true, the built-in `triggeredBy` parameter is
|
|
44
|
-
* referenceable from tasks via `ctx.trigger.triggeredBy` and the
|
|
45
|
-
* conditional in {@link InferTriggerType} adds it to the typed context.
|
|
46
|
-
*
|
|
47
|
-
* Record-detail context is a schema entry (`type: "record"`), not an option.
|
|
48
|
-
*/
|
|
49
|
-
export interface OnDemandTriggerOptions {
|
|
50
|
-
showTriggeredBy?: boolean;
|
|
51
|
-
}
|
|
52
40
|
/**
|
|
53
41
|
* Given a TriggerInputSchema, derive the TypeScript object type
|
|
54
42
|
* where each key maps to its TS type based on the field's `type`.
|
|
55
43
|
* This becomes the TTrigger generic on the builder chain.
|
|
56
44
|
*
|
|
57
|
-
* When `Options.showTriggeredBy` is the literal type `true`, merge a
|
|
58
|
-
* `triggeredBy: User` key so tasks can `ctx.trigger.triggeredBy.email`
|
|
59
|
-
* with full type safety. When omitted or `false`, the key is absent
|
|
60
|
-
* and the reference is a `tsc` error.
|
|
61
|
-
*
|
|
62
45
|
* Record entries preserve both their authored parameter key and target
|
|
63
46
|
* app/element, so `ctx.trigger.<name>` has that target's RecordShape.
|
|
64
47
|
*/
|
|
65
48
|
type TriggerInputFieldToTS<D extends TriggerInputFieldDef> = D extends RecordTriggerInputFieldDef<infer A> ? RecordShape<A> : FieldTypeToTS<D["type"]>;
|
|
66
|
-
export type InferTriggerType<S extends TriggerInputSchema
|
|
49
|
+
export type InferTriggerType<S extends TriggerInputSchema> = {
|
|
67
50
|
[K in keyof S]: TriggerInputFieldToTS<S[K]>;
|
|
68
|
-
}
|
|
69
|
-
showTriggeredBy: true;
|
|
70
|
-
} ? {
|
|
71
|
-
triggeredBy: User;
|
|
72
|
-
} : {});
|
|
51
|
+
};
|
|
73
52
|
export interface OnDemandTriggerDef<T, S extends TriggerInputSchema = TriggerInputSchema> {
|
|
74
53
|
readonly kind: "onDemand";
|
|
75
54
|
readonly schema: S;
|
|
76
|
-
/** When true, mobius exposes the built-in `triggeredBy` parameter. */
|
|
77
|
-
readonly showTriggeredBy?: boolean;
|
|
78
55
|
/** Phantom — carries the inferred TS type for the builder chain. */
|
|
79
56
|
readonly __triggerType: T;
|
|
80
57
|
/** Phantom — carries the raw schema type so downstream builders can infer param shapes. */
|
|
@@ -92,7 +69,7 @@ export interface OnDemandTriggerDef<T, S extends TriggerInputSchema = TriggerInp
|
|
|
92
69
|
* })
|
|
93
70
|
* ```
|
|
94
71
|
*/
|
|
95
|
-
export declare function onDemand<S extends TriggerInputSchema
|
|
72
|
+
export declare function onDemand<S extends TriggerInputSchema>(schema: S): OnDemandTriggerDef<InferTriggerType<S>, S>;
|
|
96
73
|
/**
|
|
97
74
|
* Wire shape for an onDemand `defaultValue`. Mirrors mobius's
|
|
98
75
|
* `WorkflowTriggerParameterDefaultValueInput` Java record — a
|
|
@@ -140,8 +117,7 @@ export interface SerializedOnDemandTrigger {
|
|
|
140
117
|
defaultValue?: WireDefaultValue;
|
|
141
118
|
app?: AppOrElementRef;
|
|
142
119
|
}>;
|
|
143
|
-
showTriggeredBy?: boolean;
|
|
144
120
|
};
|
|
145
121
|
}
|
|
146
|
-
export declare function serializeOnDemandTrigger(schema: TriggerInputSchema
|
|
122
|
+
export declare function serializeOnDemandTrigger(schema: TriggerInputSchema): SerializedOnDemandTrigger;
|
|
147
123
|
export {};
|
|
@@ -18,11 +18,10 @@ import { FIELD_TYPE_MAP } from "../../entities/shared/types/field-types.js";
|
|
|
18
18
|
* })
|
|
19
19
|
* ```
|
|
20
20
|
*/
|
|
21
|
-
export function onDemand(schema
|
|
21
|
+
export function onDemand(schema) {
|
|
22
22
|
return {
|
|
23
23
|
kind: "onDemand",
|
|
24
24
|
schema,
|
|
25
|
-
...(options?.showTriggeredBy && { showTriggeredBy: true }),
|
|
26
25
|
__triggerType: undefined,
|
|
27
26
|
};
|
|
28
27
|
}
|
|
@@ -93,7 +92,7 @@ function wrapDefaultValueForWire(alias, value) {
|
|
|
93
92
|
`type for this input.`);
|
|
94
93
|
}
|
|
95
94
|
}
|
|
96
|
-
export function serializeOnDemandTrigger(schema
|
|
95
|
+
export function serializeOnDemandTrigger(schema) {
|
|
97
96
|
const inputs = Object.entries(schema).map(([name, def]) => {
|
|
98
97
|
if (def.type === "record") {
|
|
99
98
|
const runtimeDef = def;
|
|
@@ -127,7 +126,6 @@ export function serializeOnDemandTrigger(schema, options) {
|
|
|
127
126
|
return {
|
|
128
127
|
onDemand: {
|
|
129
128
|
inputs,
|
|
130
|
-
...(options?.showTriggeredBy && { showTriggeredBy: true }),
|
|
131
129
|
},
|
|
132
130
|
};
|
|
133
131
|
}
|