@elementumai/edk 0.9.6 → 0.9.9
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 +34 -3
- package/dist-sdk/src/catalog/factories.d.ts +26 -6
- package/dist-sdk/src/catalog/factories.js +41 -6
- package/dist-sdk/src/catalog/from-authoring.js +27 -33
- 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.js +93 -42
- package/dist-sdk/src/catalog/token.js +10 -0
- package/dist-sdk/src/catalog/types.d.ts +42 -3
- package/dist-sdk/src/catalog/types.js +5 -0
- package/dist-sdk/src/core/index.d.ts +2 -2
- package/dist-sdk/src/core/index.js +1 -1
- package/dist-sdk/src/core/platform-id.d.ts +2 -0
- package/dist-sdk/src/core/platform-id.js +4 -0
- package/dist-sdk/src/core/system-fields.d.ts +18 -0
- package/dist-sdk/src/core/system-fields.js +21 -0
- package/dist-sdk/src/core/triggers/on-demand.d.ts +27 -24
- package/dist-sdk/src/core/triggers/on-demand.js +33 -12
- package/dist-sdk/src/core/types/app.d.ts +14 -9
- package/dist-sdk/src/core/types/aspect-category.d.ts +1 -0
- package/dist-sdk/src/core/types/aspect-category.js +1 -0
- package/dist-sdk/src/core/types/platform.d.ts +1 -1
- package/dist-sdk/src/engine/build/context.d.ts +24 -8
- package/dist-sdk/src/engine/build/source-context.d.ts +14 -17
- package/dist-sdk/src/engine/build/source-context.js +1 -1
- package/dist-sdk/src/engine/pull/context.d.ts +18 -0
- package/dist-sdk/src/engine/pull/org.d.ts +4 -0
- package/dist-sdk/src/engine/pull/org.js +17 -2
- package/dist-sdk/src/engine/pull/procedure-refs.d.ts +16 -0
- package/dist-sdk/src/engine/pull/procedure-refs.js +69 -0
- package/dist-sdk/src/engine/pull/ref-only.d.ts +14 -0
- package/dist-sdk/src/engine/pull/ref-only.js +35 -2
- package/dist-sdk/src/engine/tf/expr.js +1 -1
- package/dist-sdk/src/engine/workspace/authoring-layout.d.ts +15 -0
- package/dist-sdk/src/engine/workspace/authoring-layout.js +33 -1
- package/dist-sdk/src/engine/workspace/loader.d.ts +40 -0
- package/dist-sdk/src/engine/workspace/loader.js +328 -0
- package/dist-sdk/src/entities/access-policy/from-tf.d.ts +4 -0
- package/dist-sdk/src/entities/access-policy/from-tf.js +24 -4
- package/dist-sdk/src/entities/access-policy/to-tf.d.ts +7 -0
- package/dist-sdk/src/entities/access-policy/to-tf.js +11 -3
- package/dist-sdk/src/entities/agent/build.d.ts +54 -8
- package/dist-sdk/src/entities/agent/build.js +36 -1
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +144 -3
- package/dist-sdk/src/entities/agent/from-tf.d.ts +7 -6
- package/dist-sdk/src/entities/agent/from-tf.js +176 -5
- package/dist-sdk/src/entities/agent/index.d.ts +2 -2
- package/dist-sdk/src/entities/agent/index.js +1 -1
- package/dist-sdk/src/entities/agent/module.js +1 -0
- package/dist-sdk/src/entities/agent/to-tf.d.ts +5 -4
- package/dist-sdk/src/entities/agent/to-tf.js +186 -11
- package/dist-sdk/src/entities/agent/tools.d.ts +16 -5
- package/dist-sdk/src/entities/agent/tools.js +13 -1
- package/dist-sdk/src/entities/agent-tool/from-tf.d.ts +16 -0
- package/dist-sdk/src/entities/agent-tool/from-tf.js +39 -6
- package/dist-sdk/src/entities/agent-tool/to-tf.d.ts +2 -0
- package/dist-sdk/src/entities/agent-tool/to-tf.js +12 -12
- package/dist-sdk/src/entities/agent-tool/types.js +1 -0
- package/dist-sdk/src/entities/app/build.d.ts +44 -24
- package/dist-sdk/src/entities/app/build.js +18 -8
- package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +15 -0
- package/dist-sdk/src/entities/app/display-blocks-to-layout.d.ts +45 -0
- package/dist-sdk/src/entities/app/display-blocks-to-layout.js +98 -0
- package/dist-sdk/src/entities/app/display-blocks-to-record-create-form.d.ts +55 -0
- package/dist-sdk/src/entities/app/display-blocks-to-record-create-form.js +99 -0
- package/dist-sdk/src/entities/app/from-tf.js +79 -14
- package/dist-sdk/src/entities/app/index.d.ts +3 -2
- package/dist-sdk/src/entities/app/index.js +2 -1
- package/dist-sdk/src/entities/app/to-tf.js +30 -6
- package/dist-sdk/src/entities/automation/build.d.ts +37 -18
- package/dist-sdk/src/entities/automation/build.js +121 -12
- package/dist-sdk/src/entities/automation/catalog-render.js +5 -2
- package/dist-sdk/src/entities/automation/deserializer/ast.d.ts +8 -10
- package/dist-sdk/src/entities/automation/deserializer/print-automation.d.ts +2 -0
- package/dist-sdk/src/entities/automation/deserializer/print-automation.js +103 -20
- package/dist-sdk/src/entities/automation/from-tf.d.ts +10 -1
- package/dist-sdk/src/entities/automation/from-tf.js +1165 -91
- package/dist-sdk/src/entities/automation/index.d.ts +1 -1
- package/dist-sdk/src/entities/automation/module.js +15 -5
- package/dist-sdk/src/entities/automation/operators.d.ts +2 -2
- package/dist-sdk/src/entities/automation/operators.js +1 -0
- package/dist-sdk/src/entities/automation/output-field-types.d.ts +17 -0
- package/dist-sdk/src/entities/automation/output-field-types.js +45 -0
- package/dist-sdk/src/entities/automation/output-key-wire-name.d.ts +20 -4
- package/dist-sdk/src/entities/automation/output-key-wire-name.js +33 -6
- package/dist-sdk/src/entities/automation/script-code.d.ts +1 -1
- package/dist-sdk/src/entities/automation/script-code.js +168 -36
- package/dist-sdk/src/entities/automation/task-label.d.ts +2 -0
- package/dist-sdk/src/entities/automation/task-label.js +18 -0
- package/dist-sdk/src/entities/automation/tasks.d.ts +159 -45
- package/dist-sdk/src/entities/automation/tasks.js +60 -47
- package/dist-sdk/src/entities/automation/to-tf.d.ts +7 -1
- package/dist-sdk/src/entities/automation/to-tf.js +816 -87
- package/dist-sdk/src/entities/automation/triggers.d.ts +14 -5
- package/dist-sdk/src/entities/automation/triggers.js +1 -1
- package/dist-sdk/src/entities/automation/value-ref-tf.d.ts +78 -0
- package/dist-sdk/src/entities/automation/value-ref-tf.js +193 -0
- package/dist-sdk/src/entities/dashboard/from-tf.js +1 -1
- package/dist-sdk/src/entities/dynamic-layout/to-tf.d.ts +1 -0
- package/dist-sdk/src/entities/dynamic-layout/to-tf.js +1 -1
- package/dist-sdk/src/entities/element/build.d.ts +30 -7
- package/dist-sdk/src/entities/element/build.js +7 -3
- package/dist-sdk/src/entities/element/from-tf.js +7 -3
- package/dist-sdk/src/entities/element/index.d.ts +3 -2
- package/dist-sdk/src/entities/element/index.js +3 -2
- package/dist-sdk/src/entities/element/to-tf.js +49 -8
- package/dist-sdk/src/entities/field/build.d.ts +94 -3
- package/dist-sdk/src/entities/field/build.js +82 -3
- package/dist-sdk/src/entities/field/from-tf.d.ts +6 -0
- package/dist-sdk/src/entities/field/from-tf.js +104 -1
- package/dist-sdk/src/entities/field/locals.js +6 -7
- package/dist-sdk/src/entities/field/module.js +1 -0
- package/dist-sdk/src/entities/field/options.d.ts +2 -0
- package/dist-sdk/src/entities/field/options.js +12 -2
- package/dist-sdk/src/entities/field/record-shape.d.ts +12 -15
- package/dist-sdk/src/entities/field/to-tf.d.ts +13 -3
- package/dist-sdk/src/entities/field/to-tf.js +191 -56
- package/dist-sdk/src/entities/field/types.js +2 -0
- package/dist-sdk/src/entities/org/category-ref.d.ts +5 -0
- package/dist-sdk/src/entities/org/category-ref.js +12 -0
- package/dist-sdk/src/entities/record-create-form/from-tf.js +3 -3
- package/dist-sdk/src/entities/record-create-form/to-tf.d.ts +1 -0
- package/dist-sdk/src/entities/record-create-form/to-tf.js +18 -13
- package/dist-sdk/src/entities/relationship/from-tf.js +100 -7
- package/dist-sdk/src/entities/role/from-tf.js +10 -4
- package/dist-sdk/src/entities/search-table/build.d.ts +1 -1
- package/dist-sdk/src/entities/search-table/from-tf.d.ts +1 -0
- package/dist-sdk/src/entities/search-table/from-tf.js +6 -0
- package/dist-sdk/src/entities/search-table/printer.js +3 -1
- package/dist-sdk/src/entities/search-table/to-tf.js +3 -3
- package/dist-sdk/src/entities/search-table/types.js +1 -0
- package/dist-sdk/src/entities/service-account/from-tf.js +10 -4
- package/dist-sdk/src/entities/service-account/to-tf.d.ts +2 -1
- package/dist-sdk/src/entities/service-account/to-tf.js +7 -0
- package/dist-sdk/src/entities/shared/aspect-target-from-tf.d.ts +9 -0
- package/dist-sdk/src/entities/shared/aspect-target-from-tf.js +39 -0
- package/dist-sdk/src/entities/shared/filters/ast.d.ts +24 -1
- package/dist-sdk/src/entities/shared/filters/ast.js +4 -0
- package/dist-sdk/src/entities/shared/filters/tf-codec.d.ts +13 -2
- package/dist-sdk/src/entities/shared/filters/tf-codec.js +14 -8
- package/dist-sdk/src/entities/shared/handle-description.d.ts +12 -0
- package/dist-sdk/src/entities/shared/handle-description.js +20 -0
- package/dist-sdk/src/entities/shared/tool-field-ref.d.ts +5 -3
- package/dist-sdk/src/entities/shared/tool-field-ref.js +11 -16
- package/dist-sdk/src/entities/shared/types/common.d.ts +7 -5
- package/dist-sdk/src/entities/shared/types/field-types.d.ts +6 -1
- package/dist-sdk/src/entities/shared/types/field-types.js +5 -8
- package/dist-sdk/src/entities/shared/types/platform.d.ts +15 -2
- package/dist-sdk/src/entities/skill/build.d.ts +51 -2
- package/dist-sdk/src/entities/skill/build.js +65 -8
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.d.ts +1 -1
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +79 -18
- package/dist-sdk/src/entities/skill/from-tf.d.ts +11 -0
- package/dist-sdk/src/entities/skill/from-tf.js +47 -5
- package/dist-sdk/src/entities/skill/index.d.ts +1 -1
- package/dist-sdk/src/entities/skill/index.js +1 -1
- package/dist-sdk/src/entities/skill/input-coverage.d.ts +89 -0
- package/dist-sdk/src/entities/skill/input-coverage.js +327 -0
- package/dist-sdk/src/entities/skill/module.js +2 -0
- package/dist-sdk/src/entities/skill/to-tf.d.ts +9 -25
- package/dist-sdk/src/entities/skill/to-tf.js +29 -40
- package/dist-sdk/src/entities/skill/tools.d.ts +12 -2
- package/dist-sdk/src/entities/skill/tools.js +3 -6
- package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +19 -0
- package/dist-sdk/src/entities/skill-tool/from-tf.js +50 -14
- package/dist-sdk/src/entities/skill-tool/to-tf.d.ts +9 -7
- package/dist-sdk/src/entities/skill-tool/to-tf.js +29 -23
- package/dist-sdk/src/entities/table/to-tf.js +21 -5
- package/dist-sdk/src/entities/task/to-tf.js +3 -2
- package/dist-sdk/src/entities/view/from-tf.js +36 -10
- package/dist-sdk/src/entities/view/to-tf.d.ts +2 -0
- package/dist-sdk/src/entities/view/to-tf.js +49 -30
- package/dist-sdk/src/entities/visual-flow/from-tf.js +6 -2
- package/dist-sdk/src/entities/widget/from-tf.js +2 -2
- package/dist-sdk/src/entities/widget/to-tf.d.ts +1 -0
- package/dist-sdk/src/entities/widget/to-tf.js +52 -23
- package/dist-sdk/src/graph/index.d.ts +19 -1
- package/dist-sdk/src/graph/index.js +20 -0
- package/dist-sdk/src/graph/types.d.ts +22 -0
- package/package.json +11 -5
package/README.md
CHANGED
|
@@ -170,13 +170,15 @@ elementum apply [orgRoot-or-nested-target] [bridge args...]
|
|
|
170
170
|
|
|
171
171
|
elementum list apps|elements|users|groups|categories|cloud-links
|
|
172
172
|
elementum list ai-provider-connectors|automations|tables
|
|
173
|
-
elementum new
|
|
174
|
-
elementum new
|
|
173
|
+
elementum new category --name "Operations"
|
|
174
|
+
elementum new app --name "Support Tickets" --namespace support --category "Operations" --handle SUPPORT
|
|
175
|
+
elementum new element --name "Locations" --namespace locations --category "Operations" --handle LOCATION
|
|
175
176
|
elementum new agent --app <appRef> --name "Triage Bot"
|
|
176
177
|
elementum new skill --app <appRef> --name "Lookup Ticket"
|
|
177
178
|
elementum new automation --app <appRef> --name "Escalate Ticket"
|
|
178
179
|
elementum generate [path] [--root <orgRoot>]
|
|
179
180
|
elementum canvas <orgRoot-or-file> [--port <port>] [--no-open]
|
|
181
|
+
elementum mcp [--cwd <dir>]
|
|
180
182
|
elementum playbooks list|install|status|path|print
|
|
181
183
|
```
|
|
182
184
|
|
|
@@ -227,6 +229,35 @@ The installed slash commands are `/elementum`, `/elementum-uat`,
|
|
|
227
229
|
`elementum skills ...` remains the platform command family for agentic-skill
|
|
228
230
|
operations.
|
|
229
231
|
|
|
232
|
+
## MCP
|
|
233
|
+
|
|
234
|
+
`elementum mcp` starts a local MCP server on stdin/stdout so a coding agent on
|
|
235
|
+
this machine can run the same CLI. Start it from the org workspace (or pass
|
|
236
|
+
`--cwd`) and point the agent's MCP config at:
|
|
237
|
+
|
|
238
|
+
```json
|
|
239
|
+
{
|
|
240
|
+
"mcpServers": {
|
|
241
|
+
"elementum": {
|
|
242
|
+
"command": "elementum",
|
|
243
|
+
"args": ["mcp"]
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
The server exposes `run` (any CLI command as argument tokens after
|
|
250
|
+
`elementum`) and `help`. `initialize.instructions` tells the agent how to
|
|
251
|
+
login, auth-check, pull/build/plan/apply, and pass profiles. Nested
|
|
252
|
+
`mcp`/`canvas`/`chat` are refused, as are `auth env` / `auth export` /
|
|
253
|
+
`auth import` (credential dump or passphrase TTY). `auth login` over MCP is
|
|
254
|
+
non-interactive: it reads `ELEMENTUM_ORGANIZATION`, `ELEMENTUM_INSTANCE`,
|
|
255
|
+
`ELEMENTUM_CLIENT_ID`, `ELEMENTUM_CLIENT_SECRET`, and optional
|
|
256
|
+
`ELEMENTUM_PROFILE` (or the matching flags) and persists a profile. A human
|
|
257
|
+
TTY login still uses the form. `apply` still goes through the real CLI; after
|
|
258
|
+
the user reviews the plan, use `["apply", "-auto-approve"]` (stdin is not a
|
|
259
|
+
TTY, so a bare apply cannot prompt).
|
|
260
|
+
|
|
230
261
|
## Canvas
|
|
231
262
|
|
|
232
263
|
Canvas is an offline, live-reloading view of authored source:
|
|
@@ -570,7 +601,7 @@ The repository builds three distinct output trees:
|
|
|
570
601
|
- `dist-sdk/` — `tsc -p tsconfig.sdk.json` output, the sole source tree packed
|
|
571
602
|
into the `@elementumai/edk` SDK package;
|
|
572
603
|
- `dist-cli/` — Node-compatible `tsc -p tsconfig.cli.json` output used by local
|
|
573
|
-
development, tests, integration tooling, and the binary build script; it is
|
|
604
|
+
development, tests, integration tooling, and the binary build script; it is <!-- // pragma: allowlist secret -->
|
|
574
605
|
not part of the SDK package or the final release payload;
|
|
575
606
|
- `dist-bin/` — standalone `elementum` executables produced from `dist-cli` by
|
|
576
607
|
the locked local Bun dependency; these are the CLI release inputs distributed
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
* nothing reads those interim values.
|
|
20
20
|
*/
|
|
21
21
|
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, FileReaderCatalogRef, DocumentModelFieldRef, ElementCatalogRef, FieldRef, OutputPropertyRef, SearchTableRef, StoredFunctionRef, StoredFunctionScalarType, SkillRef, TableColumnRef, TableRef, TriggerParameterRef } from "./types.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";
|
|
23
23
|
/** Fixed platform user-directory schema used by userSearch filters. */
|
|
24
24
|
export declare const usersCatalog: {
|
|
25
25
|
readonly fields: {
|
|
@@ -98,6 +98,7 @@ type WithOwnedCatalogChildren<B extends AppCatalogBags, Parent extends string> =
|
|
|
98
98
|
* narrow `.trigger.<name>` and `.outputs.<name>` at the call site.
|
|
99
99
|
*/
|
|
100
100
|
export declare function automationRef<T extends Readonly<Record<string, TriggerParameterRef>> | undefined = undefined, O extends Readonly<Record<string, OutputPropertyRef>> | undefined = undefined>(opts?: {
|
|
101
|
+
readonly name?: string;
|
|
101
102
|
readonly trigger?: T;
|
|
102
103
|
readonly outputs?: O;
|
|
103
104
|
}): AutomationCatalogRef & {
|
|
@@ -137,11 +138,19 @@ export declare function documentModelFieldRef(opts: {
|
|
|
137
138
|
readonly name: string;
|
|
138
139
|
readonly parent: string;
|
|
139
140
|
}): DocumentModelFieldRef;
|
|
140
|
-
/**
|
|
141
|
-
|
|
141
|
+
/**
|
|
142
|
+
* Build an output property ref — keyed by property name; `parent` is the owning automation's
|
|
143
|
+
* refName. `const T` (not plain `T`) so `valueType` infers as the LITERAL — same trick as
|
|
144
|
+
* {@link fieldRef}'s `fieldType` and {@link triggerParameterRef}'s `required: true`.
|
|
145
|
+
*/
|
|
146
|
+
export declare const outputPropertyRef: <const T extends {
|
|
142
147
|
readonly name: string;
|
|
143
148
|
readonly parent: string;
|
|
144
|
-
|
|
149
|
+
readonly valueType?: string;
|
|
150
|
+
}>(opts: T) => T & {
|
|
151
|
+
readonly __kind: "outputProperty";
|
|
152
|
+
readonly refName: string;
|
|
153
|
+
};
|
|
145
154
|
/**
|
|
146
155
|
* Agent ref — no required arguments. `handle` and `parent` are injected by the enclosing
|
|
147
156
|
* `appCatalog`/`elementCatalog`; `name` defaults to `""`.
|
|
@@ -217,17 +226,26 @@ export declare function aiProvider<T extends AiProviderType, M extends Readonly<
|
|
|
217
226
|
}): AiProviderRef<T> & {
|
|
218
227
|
readonly models: M;
|
|
219
228
|
};
|
|
220
|
-
export declare function cloudLinkRef<const Functions extends Readonly<Record<string, StoredFunctionRef>> | undefined = undefined>(opts: {
|
|
229
|
+
export declare function cloudLinkRef<const Functions extends Readonly<Record<string, StoredFunctionRef>> | undefined = undefined, const Procedures extends Readonly<Record<string, ProcedureRef>> | undefined = undefined>(opts: {
|
|
221
230
|
readonly name: string;
|
|
222
231
|
readonly storedFunctions?: Functions;
|
|
232
|
+
readonly procedures?: Procedures;
|
|
223
233
|
}): CloudLinkRef & {
|
|
224
234
|
readonly storedFunctions: Functions;
|
|
235
|
+
readonly procedures: Procedures;
|
|
225
236
|
};
|
|
226
237
|
export declare function storedFunctionRef<const Parameters extends readonly StoredFunctionScalarType[], const Result extends StoredFunctionScalarType>(opts: {
|
|
227
238
|
readonly name: string;
|
|
228
239
|
readonly parameters: Parameters;
|
|
229
240
|
readonly result: Result;
|
|
230
241
|
}): StoredFunctionRef<Parameters, Result>;
|
|
242
|
+
export declare function procedureRef<const Parameters extends readonly ProcedureParameterType[], const Result extends StoredFunctionScalarType>(opts: {
|
|
243
|
+
readonly name: string;
|
|
244
|
+
readonly database: string;
|
|
245
|
+
readonly schema: string;
|
|
246
|
+
readonly parameters: Parameters;
|
|
247
|
+
readonly result: Result;
|
|
248
|
+
}): ProcedureRef<Parameters, Result>;
|
|
231
249
|
export declare const categoryRef: (opts: Omit<CategoryRef, "refName" | "__kind">) => Omit<CategoryRef, "refName" | "__kind"> & {
|
|
232
250
|
readonly __kind: "category";
|
|
233
251
|
readonly refName: string;
|
|
@@ -243,12 +261,14 @@ export declare const phoneProviderRef: (opts: Omit<PhoneProviderRef, "refName" |
|
|
|
243
261
|
export declare function tableColumnRef(opts: Omit<TableColumnRef, "__kind" | "refName" | "parent"> & {
|
|
244
262
|
readonly parent?: string;
|
|
245
263
|
}): TableColumnRef;
|
|
246
|
-
export declare function tableRef<const Columns extends Readonly<Record<string, TableColumnRef>> | undefined = undefined, const RefName extends string = string>(opts: Omit<TableRef, "__kind" | "refName" | "columns"> & {
|
|
264
|
+
export declare function tableRef<const Columns extends Readonly<Record<string, TableColumnRef>> | undefined = undefined, const Datamines extends Readonly<Record<string, DatamineRef>> | undefined = undefined, const RefName extends string = string>(opts: Omit<TableRef, "__kind" | "refName" | "columns" | "datamines"> & {
|
|
247
265
|
readonly refName?: RefName;
|
|
248
266
|
readonly columns?: Columns;
|
|
267
|
+
readonly datamines?: Datamines;
|
|
249
268
|
}): TableRef & {
|
|
250
269
|
readonly refName: RefName;
|
|
251
270
|
readonly columns: Columns;
|
|
271
|
+
readonly datamines: Datamines;
|
|
252
272
|
};
|
|
253
273
|
/**
|
|
254
274
|
* `refName` is optional and defaults to `name` — for a caller with no bag-key
|
|
@@ -33,7 +33,7 @@ export function automationRef(opts) {
|
|
|
33
33
|
return {
|
|
34
34
|
__kind: "automation",
|
|
35
35
|
refName: "",
|
|
36
|
-
name: "",
|
|
36
|
+
name: opts?.name ?? "",
|
|
37
37
|
...(opts?.trigger !== undefined ? { trigger: opts.trigger } : {}),
|
|
38
38
|
...(opts?.outputs !== undefined ? { outputs: opts.outputs } : {}),
|
|
39
39
|
};
|
|
@@ -65,10 +65,12 @@ export function documentModelRef(opts) {
|
|
|
65
65
|
export function documentModelFieldRef(opts) {
|
|
66
66
|
return { __kind: "documentModelField", refName: opts.name, name: opts.name, parent: opts.parent };
|
|
67
67
|
}
|
|
68
|
-
/**
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
68
|
+
/**
|
|
69
|
+
* Build an output property ref — keyed by property name; `parent` is the owning automation's
|
|
70
|
+
* refName. `const T` (not plain `T`) so `valueType` infers as the LITERAL — same trick as
|
|
71
|
+
* {@link fieldRef}'s `fieldType` and {@link triggerParameterRef}'s `required: true`.
|
|
72
|
+
*/
|
|
73
|
+
export const outputPropertyRef = (opts) => ({ __kind: "outputProperty", refName: opts.name, ...opts });
|
|
72
74
|
/**
|
|
73
75
|
* Agent ref — no required arguments. `handle` and `parent` are injected by the enclosing
|
|
74
76
|
* `appCatalog`/`elementCatalog`; `name` defaults to `""`.
|
|
@@ -154,11 +156,18 @@ export function cloudLinkRef(opts) {
|
|
|
154
156
|
const functions = opts.storedFunctions === undefined
|
|
155
157
|
? undefined
|
|
156
158
|
: Object.fromEntries(Object.entries(opts.storedFunctions).map(([refName, fn]) => [refName, { ...fn, refName, parent: "" }]));
|
|
159
|
+
const procedures = opts.procedures === undefined
|
|
160
|
+
? undefined
|
|
161
|
+
: Object.fromEntries(Object.entries(opts.procedures).map(([refName, procedure]) => [
|
|
162
|
+
refName,
|
|
163
|
+
{ ...procedure, refName, parent: "", parentName: opts.name },
|
|
164
|
+
]));
|
|
157
165
|
return {
|
|
158
166
|
__kind: "cloudLink",
|
|
159
167
|
refName: opts.name,
|
|
160
168
|
name: opts.name,
|
|
161
169
|
...(functions !== undefined ? { storedFunctions: functions } : {}),
|
|
170
|
+
...(procedures !== undefined ? { procedures } : {}),
|
|
162
171
|
};
|
|
163
172
|
}
|
|
164
173
|
export function storedFunctionRef(opts) {
|
|
@@ -171,6 +180,18 @@ export function storedFunctionRef(opts) {
|
|
|
171
180
|
resultType: opts.result,
|
|
172
181
|
};
|
|
173
182
|
}
|
|
183
|
+
export function procedureRef(opts) {
|
|
184
|
+
return {
|
|
185
|
+
__kind: "procedure",
|
|
186
|
+
refName: opts.name,
|
|
187
|
+
name: opts.name,
|
|
188
|
+
parent: "",
|
|
189
|
+
databaseName: opts.database,
|
|
190
|
+
schemaName: opts.schema,
|
|
191
|
+
parameterTypes: opts.parameters,
|
|
192
|
+
resultType: opts.result,
|
|
193
|
+
};
|
|
194
|
+
}
|
|
174
195
|
export const categoryRef = refFactory("category");
|
|
175
196
|
export const groupRef = refFactory("group");
|
|
176
197
|
export const phoneProviderRef = refFactory("phoneProvider");
|
|
@@ -180,6 +201,7 @@ export function tableColumnRef(opts) {
|
|
|
180
201
|
refName: opts.name,
|
|
181
202
|
parent: opts.parent ?? "",
|
|
182
203
|
name: opts.name,
|
|
204
|
+
...(opts.parentName !== undefined ? { parentName: opts.parentName } : {}),
|
|
183
205
|
...(opts.fieldType !== undefined ? { fieldType: opts.fieldType } : {}),
|
|
184
206
|
...(opts.tags !== undefined ? { tags: opts.tags } : {}),
|
|
185
207
|
};
|
|
@@ -190,13 +212,20 @@ export function tableRef(opts) {
|
|
|
190
212
|
? undefined
|
|
191
213
|
: Object.fromEntries(Object.entries(opts.columns).map(([refName, column]) => [
|
|
192
214
|
refName,
|
|
193
|
-
{ ...column, refName, parent: opts.refName ?? opts.name },
|
|
215
|
+
{ ...column, refName, parent: opts.refName ?? opts.name, parentName: opts.name },
|
|
216
|
+
]));
|
|
217
|
+
const datamines = opts.datamines === undefined
|
|
218
|
+
? undefined
|
|
219
|
+
: Object.fromEntries(Object.entries(opts.datamines).map(([refName, datamine]) => [
|
|
220
|
+
refName,
|
|
221
|
+
{ ...datamine, refName, parent: opts.refName ?? opts.name },
|
|
194
222
|
]));
|
|
195
223
|
return {
|
|
196
224
|
__kind: "table",
|
|
197
225
|
refName,
|
|
198
226
|
name: opts.name,
|
|
199
227
|
...(columns !== undefined ? { columns } : {}),
|
|
228
|
+
...(datamines !== undefined ? { datamines } : {}),
|
|
200
229
|
...(opts.categoryId !== undefined ? { categoryId: opts.categoryId } : {}),
|
|
201
230
|
};
|
|
202
231
|
}
|
|
@@ -367,6 +396,12 @@ function stampCloudLinks(bag) {
|
|
|
367
396
|
{
|
|
368
397
|
...cloudLink,
|
|
369
398
|
storedFunctions: withOwnKeyAsHandle(cloudLink.storedFunctions, cloudLinkKey) ?? {},
|
|
399
|
+
procedures: cloudLink.procedures === undefined
|
|
400
|
+
? {}
|
|
401
|
+
: Object.fromEntries(Object.entries(cloudLink.procedures).map(([procedureKey, procedure]) => [
|
|
402
|
+
procedureKey,
|
|
403
|
+
{ ...procedure, refName: procedureKey, parent: cloudLinkKey, parentName: cloudLink.name },
|
|
404
|
+
])),
|
|
370
405
|
},
|
|
371
406
|
]));
|
|
372
407
|
}
|
|
@@ -21,40 +21,32 @@
|
|
|
21
21
|
*/
|
|
22
22
|
import { mkdir, readdir, stat, writeFile } from "node:fs/promises";
|
|
23
23
|
import { basename, dirname, join, resolve } from "node:path";
|
|
24
|
-
import {
|
|
24
|
+
import { createWorkspaceLoader } from "../engine/workspace/loader.js";
|
|
25
25
|
import { KIND_BY_ID, ownFileCatalogChildrenOf, } from "../graph/index.js";
|
|
26
26
|
import { writeCatalogBarrel } from "./org.js";
|
|
27
27
|
import { renderCatalog } from "./render.js";
|
|
28
|
-
import { assertAuthoringPathForTenant, assertValidAuthoringLayout, } from "../engine/workspace/authoring-layout.js";
|
|
28
|
+
import { assertAuthoringPathForTenant, assertValidAuthoringLayout, isAuthoringHelperFile, isStreamRootAuthoringFile, } from "../engine/workspace/authoring-layout.js";
|
|
29
29
|
function isConfiguredEntity(value) {
|
|
30
30
|
return (typeof value === "object" &&
|
|
31
31
|
value !== null &&
|
|
32
32
|
typeof value.ref === "function" &&
|
|
33
33
|
typeof value.def === "function");
|
|
34
34
|
}
|
|
35
|
-
//
|
|
36
|
-
//
|
|
37
|
-
//
|
|
38
|
-
//
|
|
39
|
-
//
|
|
40
|
-
// imported here again. A cached jiti would return the stale pre-overwrite
|
|
35
|
+
// Every function in this module exists to reflect whatever's *currently* on
|
|
36
|
+
// disk. Within a single `edk pull` an app's own file gets imported here once
|
|
37
|
+
// while it's still the import-time reference-only stub (no default export),
|
|
38
|
+
// then overwritten with the real `app(...)` call via plain `writeFile`, then
|
|
39
|
+
// imported here again. A cached module would return the stale pre-overwrite
|
|
41
40
|
// result for that second import — exactly the "does not default-export a
|
|
42
|
-
// configured app" failure this avoids.
|
|
43
|
-
// deliberate tradeoff; this isn't a hot path.
|
|
41
|
+
// configured app" failure this avoids.
|
|
44
42
|
//
|
|
45
|
-
//
|
|
46
|
-
//
|
|
47
|
-
//
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
if (jiti === undefined) {
|
|
53
|
-
const alias = catalogPath !== undefined ? { "@catalog": catalogPath } : {};
|
|
54
|
-
jiti = createJiti(import.meta.url, { moduleCache: false, alias });
|
|
55
|
-
jitiByAlias.set(key, jiti);
|
|
56
|
-
}
|
|
57
|
-
return jiti;
|
|
43
|
+
// A FRESH loader per call, which is what buys the freshness described above:
|
|
44
|
+
// each one re-reads every workspace file, while the SDK modules behind them
|
|
45
|
+
// stay evaluated once for the life of the process.
|
|
46
|
+
function authoringLoader(catalogPath) {
|
|
47
|
+
// `catalogPath` is `<wsRoot>/generated/catalog.ts`.
|
|
48
|
+
const root = catalogPath !== undefined ? dirname(dirname(catalogPath)) : process.cwd();
|
|
49
|
+
return createWorkspaceLoader(root);
|
|
58
50
|
}
|
|
59
51
|
/** The generated catalog's own filename — never treated as an authoring file. */
|
|
60
52
|
const CATALOG_FILENAME = "catalog.ts";
|
|
@@ -65,8 +57,8 @@ function isEntityFile(name) {
|
|
|
65
57
|
return false;
|
|
66
58
|
if (name.endsWith(".d.ts") || name.endsWith(".test.ts"))
|
|
67
59
|
return false;
|
|
68
|
-
if (name
|
|
69
|
-
return false;
|
|
60
|
+
if (isAuthoringHelperFile(name))
|
|
61
|
+
return false;
|
|
70
62
|
return name.endsWith(".ts") || name.endsWith(".js") || name.endsWith(".mjs");
|
|
71
63
|
}
|
|
72
64
|
async function listEntityFiles(dir) {
|
|
@@ -204,14 +196,14 @@ async function loadCatalogChildBag(appDir, child, parent, catalogPath, defsOut)
|
|
|
204
196
|
const facet = child.catalog;
|
|
205
197
|
if (!facet.participates)
|
|
206
198
|
return {};
|
|
207
|
-
const
|
|
199
|
+
const loader = authoringLoader(catalogPath);
|
|
208
200
|
const refs = {};
|
|
209
201
|
const defs = {};
|
|
210
202
|
for (const file of await listEntityFiles(catalogChildDir(appDir, child))) {
|
|
211
203
|
const refName = refNameOf(file);
|
|
212
204
|
let mod;
|
|
213
205
|
try {
|
|
214
|
-
mod = (await
|
|
206
|
+
mod = (await loader.import(file));
|
|
215
207
|
}
|
|
216
208
|
catch (err) {
|
|
217
209
|
const message = err instanceof Error ? err.message : String(err);
|
|
@@ -292,8 +284,8 @@ async function writeStubCatalog(appDir, appRefName, appName, kind, fields, child
|
|
|
292
284
|
export async function buildAppCatalogFromAuthoring(appDir, appFile, orgCatalogPath) {
|
|
293
285
|
// `appDir` is `<wsRoot>/apps/<handle>` or `<wsRoot>/elements/<handle>`.
|
|
294
286
|
const resolvedOrgCatalogPath = orgCatalogPath ?? join(dirname(dirname(appDir)), "generated", "catalog.ts");
|
|
295
|
-
const
|
|
296
|
-
const appMod = (await
|
|
287
|
+
const loader = authoringLoader(resolvedOrgCatalogPath);
|
|
288
|
+
const appMod = (await loader.import(appFile));
|
|
297
289
|
if (!isConfiguredEntity(appMod.default)) {
|
|
298
290
|
throw new Error(`${appFile} does not default-export a configured app (a app(...) result)`);
|
|
299
291
|
}
|
|
@@ -400,10 +392,10 @@ export async function writeAppCatalog(appDir, appRefName, appName, appFile, impo
|
|
|
400
392
|
// `<wsRoot>/apps/<handle>`; the org catalog lives at `<wsRoot>/generated/catalog.ts`.
|
|
401
393
|
const wsRoot = dirname(dirname(appDir));
|
|
402
394
|
const orgCatalogPath = join(wsRoot, "generated", "catalog.ts");
|
|
403
|
-
const
|
|
395
|
+
const loader = authoringLoader(orgCatalogPath);
|
|
404
396
|
let appMod;
|
|
405
397
|
try {
|
|
406
|
-
appMod = (await
|
|
398
|
+
appMod = (await loader.import(appFile));
|
|
407
399
|
}
|
|
408
400
|
catch {
|
|
409
401
|
appMod = undefined;
|
|
@@ -453,6 +445,8 @@ export async function regenerateAppCatalogsUnder(pathOrPaths, tenant) {
|
|
|
453
445
|
const paths = typeof pathOrPaths === "string" ? [pathOrPaths] : pathOrPaths;
|
|
454
446
|
const out = [];
|
|
455
447
|
for (const file of await listEntityFilesFromPaths(paths, tenant)) {
|
|
448
|
+
if (!isStreamRootAuthoringFile(file))
|
|
449
|
+
continue;
|
|
456
450
|
// A root app/element file may itself `import catalog from "@catalog"`
|
|
457
451
|
// (e.g. a relation field referencing another workspace entity by
|
|
458
452
|
// token) — without this alias that import fails to resolve and the
|
|
@@ -465,10 +459,10 @@ export async function regenerateAppCatalogsUnder(pathOrPaths, tenant) {
|
|
|
465
459
|
// file's `ref.__kind` is never "app"/"element" and its result is
|
|
466
460
|
// discarded below regardless of whether it loaded at all.
|
|
467
461
|
const orgRoot = dirname(dirname(dirname(file)));
|
|
468
|
-
const
|
|
462
|
+
const loader = authoringLoader(join(orgRoot, "generated", CATALOG_FILENAME));
|
|
469
463
|
let mod;
|
|
470
464
|
try {
|
|
471
|
-
mod = (await
|
|
465
|
+
mod = (await loader.import(file));
|
|
472
466
|
}
|
|
473
467
|
catch (err) {
|
|
474
468
|
if (process.env.EDK_DEBUG) {
|
|
@@ -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, 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 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";
|
|
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, 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, 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";
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
* ids appear here (identity lives in `src/deploy/state`).
|
|
5
5
|
*/
|
|
6
6
|
export { AI_PROVIDER_LLM_MODELS } from "./ai-provider-models.js";
|
|
7
|
-
export { REF_SCOPE, REF_UPDATABLE, USER_FIELD_KEYS, } from "./types.js";
|
|
7
|
+
export { REF_SCOPE, REF_UPDATABLE, PROCEDURE_PARAMETER_TYPES, USER_FIELD_KEYS, } from "./types.js";
|
|
8
8
|
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, 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, 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";
|