@elementumai/edk 0.9.19 → 0.10.1
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 +159 -7
- package/dist-sdk/src/catalog/factories.d.ts +33 -2
- package/dist-sdk/src/catalog/factories.js +40 -1
- 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/render.js +6 -6
- package/dist-sdk/src/catalog/token.js +11 -0
- package/dist-sdk/src/catalog/types.d.ts +40 -1
- package/dist-sdk/src/catalog/types.js +12 -0
- package/dist-sdk/src/core/triggers/on-demand.d.ts +40 -4
- package/dist-sdk/src/core/triggers/on-demand.js +17 -2
- package/dist-sdk/src/core/types/app.d.ts +2 -2
- package/dist-sdk/src/engine/build/context.d.ts +1 -1
- package/dist-sdk/src/engine/coverage-gaps.d.ts +86 -0
- package/dist-sdk/src/engine/coverage-gaps.js +156 -0
- package/dist-sdk/src/engine/ei/run.d.ts +169 -0
- package/dist-sdk/src/engine/ei/run.js +1219 -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/catalog-ref.d.ts +16 -0
- package/dist-sdk/src/engine/pull/catalog-ref.js +24 -0
- package/dist-sdk/src/engine/pull/context.d.ts +68 -6
- package/dist-sdk/src/engine/pull/context.js +40 -1
- package/dist-sdk/src/engine/pull/procedure-refs.d.ts +8 -0
- package/dist-sdk/src/engine/pull/procedure-refs.js +28 -0
- package/dist-sdk/src/engine/pull/ref-only.d.ts +5 -0
- package/dist-sdk/src/engine/pull/ref-only.js +10 -7
- package/dist-sdk/src/engine/pull/result-output.d.ts +6 -0
- package/dist-sdk/src/engine/pull/result-output.js +113 -3
- package/dist-sdk/src/engine/tf/expr.js +1 -1
- package/dist-sdk/src/engine/tf/index.d.ts +2 -2
- package/dist-sdk/src/engine/tf/index.js +1 -1
- package/dist-sdk/src/engine/tf/labels.d.ts +28 -5
- package/dist-sdk/src/engine/tf/labels.js +54 -3
- package/dist-sdk/src/engine/tf/model.d.ts +22 -1
- package/dist-sdk/src/engine/tf/parse.js +93 -4
- 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 +44 -0
- package/dist-sdk/src/engine/validation.js +95 -0
- package/dist-sdk/src/entities/access-policy/from-tf.js +38 -1
- package/dist-sdk/src/entities/access-policy/principal.d.ts +2 -0
- package/dist-sdk/src/entities/access-policy/to-tf.js +5 -2
- 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.d.ts +3 -0
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +46 -21
- package/dist-sdk/src/entities/agent/from-tf.js +11 -3
- package/dist-sdk/src/entities/agent/module.js +2 -0
- package/dist-sdk/src/entities/agent/to-tf.js +20 -6
- package/dist-sdk/src/entities/agent-tool/from-tf.d.ts +10 -1
- package/dist-sdk/src/entities/agent-tool/from-tf.js +18 -6
- package/dist-sdk/src/entities/agent-tool/module.js +3 -0
- package/dist-sdk/src/entities/agent-tool/to-tf.d.ts +2 -2
- package/dist-sdk/src/entities/agent-tool/to-tf.js +27 -5
- package/dist-sdk/src/entities/app/auto-share.d.ts +38 -0
- package/dist-sdk/src/entities/app/auto-share.js +49 -0
- package/dist-sdk/src/entities/app/build.d.ts +105 -22
- package/dist-sdk/src/entities/app/build.js +107 -10
- 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 -2
- package/dist-sdk/src/entities/app/index.d.ts +7 -6
- package/dist-sdk/src/entities/app/index.js +2 -8
- package/dist-sdk/src/entities/app/module.js +5 -2
- package/dist-sdk/src/entities/app/to-tf.d.ts +6 -0
- package/dist-sdk/src/entities/app/to-tf.js +40 -13
- package/dist-sdk/src/entities/automation/build.d.ts +56 -6
- package/dist-sdk/src/entities/automation/build.js +230 -26
- package/dist-sdk/src/entities/automation/calculation-expression.d.ts +7 -7
- package/dist-sdk/src/entities/automation/deserializer/print-automation.d.ts +41 -5
- package/dist-sdk/src/entities/automation/deserializer/print-automation.js +470 -58
- package/dist-sdk/src/entities/automation/from-tf.d.ts +37 -8
- package/dist-sdk/src/entities/automation/from-tf.js +791 -131
- 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 +3 -0
- package/dist-sdk/src/entities/automation/module.js +107 -15
- 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 +20 -0
- package/dist-sdk/src/entities/automation/script-code.js +109 -5
- package/dist-sdk/src/entities/automation/system-ref-name.js +4 -0
- package/dist-sdk/src/entities/automation/task-output-labels.d.ts +39 -0
- package/dist-sdk/src/entities/automation/task-output-labels.js +85 -0
- package/dist-sdk/src/entities/automation/tasks.d.ts +116 -22
- package/dist-sdk/src/entities/automation/tasks.js +86 -24
- package/dist-sdk/src/entities/automation/to-tf.d.ts +24 -3
- package/dist-sdk/src/entities/automation/to-tf.js +1082 -132
- package/dist-sdk/src/entities/automation/triggers.d.ts +12 -6
- package/dist-sdk/src/entities/automation/triggers.js +4 -0
- package/dist-sdk/src/entities/automation/types.d.ts +9 -0
- package/dist-sdk/src/entities/automation/types.js +19 -0
- package/dist-sdk/src/entities/automation/value-ref-tf.d.ts +1 -1
- package/dist-sdk/src/entities/automation/value-ref-tf.js +1 -1
- package/dist-sdk/src/entities/chart/from-tf.js +9 -1
- package/dist-sdk/src/entities/chart/to-tf.js +10 -3
- package/dist-sdk/src/entities/data-lookup/module.js +2 -0
- package/dist-sdk/src/entities/dynamic-layout/build.d.ts +24 -31
- package/dist-sdk/src/entities/dynamic-layout/to-tf.d.ts +1 -0
- package/dist-sdk/src/entities/dynamic-layout/to-tf.js +7 -5
- package/dist-sdk/src/entities/element/build.d.ts +28 -13
- package/dist-sdk/src/entities/element/build.js +5 -1
- package/dist-sdk/src/entities/element/from-tf.d.ts +11 -0
- package/dist-sdk/src/entities/element/from-tf.js +62 -1
- package/dist-sdk/src/entities/element/index.d.ts +5 -3
- package/dist-sdk/src/entities/element/index.js +1 -0
- package/dist-sdk/src/entities/element/module.js +9 -3
- package/dist-sdk/src/entities/element/to-tf.d.ts +1 -1
- package/dist-sdk/src/entities/element/to-tf.js +16 -16
- package/dist-sdk/src/entities/field/build.d.ts +17 -3
- package/dist-sdk/src/entities/field/build.js +3 -0
- package/dist-sdk/src/entities/field/calc.d.ts +7 -7
- package/dist-sdk/src/entities/field/from-tf.d.ts +5 -4
- package/dist-sdk/src/entities/field/from-tf.js +244 -49
- 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 +2 -0
- package/dist-sdk/src/entities/field/options.js +6 -1
- package/dist-sdk/src/entities/field/to-tf.d.ts +26 -5
- package/dist-sdk/src/entities/field/to-tf.js +137 -15
- package/dist-sdk/src/entities/field/types.d.ts +2 -0
- package/dist-sdk/src/entities/field/types.js +27 -0
- 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/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 +2 -0
- package/dist-sdk/src/entities/relationship/to-tf.js +12 -3
- package/dist-sdk/src/entities/role/from-tf.js +3 -3
- package/dist-sdk/src/entities/role/to-tf.d.ts +2 -0
- package/dist-sdk/src/entities/role/to-tf.js +12 -4
- 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 +20 -8
- 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/service-account/workspace-owner.d.ts +16 -0
- package/dist-sdk/src/entities/service-account/workspace-owner.js +22 -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 +23 -1
- package/dist-sdk/src/entities/shared/filters/ast.js +2 -0
- package/dist-sdk/src/entities/shared/filters/index.d.ts +7 -0
- package/dist-sdk/src/entities/shared/filters/index.js +19 -4
- package/dist-sdk/src/entities/shared/filters/print.js +24 -3
- package/dist-sdk/src/entities/shared/filters/tf-codec.d.ts +7 -0
- package/dist-sdk/src/entities/shared/filters/tf-codec.js +46 -7
- package/dist-sdk/src/entities/shared/filters/types.d.ts +15 -2
- package/dist-sdk/src/entities/shared/ref.d.ts +5 -7
- package/dist-sdk/src/entities/shared/ref.js +5 -7
- package/dist-sdk/src/entities/shared/tool-field-ref.d.ts +9 -0
- package/dist-sdk/src/entities/shared/tool-field-ref.js +35 -2
- package/dist-sdk/src/entities/shared/types/field-types.d.ts +20 -5
- package/dist-sdk/src/entities/shared/types/field-types.js +8 -0
- package/dist-sdk/src/entities/skill/access-policy.js +3 -3
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.d.ts +3 -0
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +14 -6
- package/dist-sdk/src/entities/skill/from-tf.js +70 -15
- 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 +2 -0
- package/dist-sdk/src/entities/skill/to-tf.js +14 -4
- package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +2 -0
- package/dist-sdk/src/entities/skill-tool/from-tf.js +49 -10
- package/dist-sdk/src/entities/skill-tool/module.js +3 -0
- package/dist-sdk/src/entities/skill-tool/to-tf.d.ts +2 -8
- package/dist-sdk/src/entities/skill-tool/to-tf.js +49 -14
- 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 +2 -2
- package/dist-sdk/src/entities/task/build.d.ts +8 -0
- package/dist-sdk/src/entities/task/build.js +10 -1
- package/dist-sdk/src/entities/task/from-tf.d.ts +4 -2
- package/dist-sdk/src/entities/task/from-tf.js +7 -2
- package/dist-sdk/src/entities/task/module.js +2 -2
- package/dist-sdk/src/entities/task/to-tf.d.ts +8 -4
- package/dist-sdk/src/entities/task/to-tf.js +28 -1
- package/dist-sdk/src/entities/view/agent-view-layout-from-tf.d.ts +49 -9
- package/dist-sdk/src/entities/view/agent-view-layout-from-tf.js +71 -18
- package/dist-sdk/src/entities/view/agent-view-layout-to-tf.d.ts +19 -4
- package/dist-sdk/src/entities/view/agent-view-layout-to-tf.js +82 -10
- package/dist-sdk/src/entities/view/agent-view-layout.d.ts +53 -23
- package/dist-sdk/src/entities/view/agent-view-layout.js +1 -1
- package/dist-sdk/src/entities/view/from-tf.d.ts +3 -2
- package/dist-sdk/src/entities/view/from-tf.js +133 -13
- package/dist-sdk/src/entities/view/module.js +30 -3
- package/dist-sdk/src/entities/view/to-tf.d.ts +20 -8
- package/dist-sdk/src/entities/view/to-tf.js +86 -18
- package/dist-sdk/src/entities/view/types.d.ts +4 -15
- package/dist-sdk/src/entities/view/types.js +15 -15
- package/dist-sdk/src/entities/visual-flow/build.d.ts +16 -1
- package/dist-sdk/src/entities/visual-flow/build.js +9 -0
- package/dist-sdk/src/entities/visual-flow/from-tf.d.ts +14 -0
- package/dist-sdk/src/entities/visual-flow/from-tf.js +51 -3
- package/dist-sdk/src/entities/visual-flow/index.d.ts +1 -1
- package/dist-sdk/src/entities/visual-flow/index.js +1 -1
- package/dist-sdk/src/entities/visual-flow/printer.js +19 -0
- package/dist-sdk/src/entities/visual-flow/to-tf.js +87 -3
- 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/from-tf.js +3 -3
- package/dist-sdk/src/entities/widget/to-tf.d.ts +2 -0
- package/dist-sdk/src/entities/widget/to-tf.js +41 -14
- package/dist-sdk/src/generated/ragnarok/ragnarok-spec.d.ts +148 -13
- package/dist-sdk/src/generated/ragnarok/ragnarok-spec.js +2 -2
- package/dist-sdk/src/graph/index.d.ts +12 -0
- package/dist-sdk/src/graph/index.js +21 -0
- package/dist-sdk/src/graph/modules.js +2 -0
- package/dist-sdk/src/graph/types.d.ts +83 -4
- package/dist-sdk/src/internal/sdk-package.d.ts +1 -1
- package/dist-sdk/src/internal/sdk-package.js +1 -0
- package/package.json +16 -3
package/README.md
CHANGED
|
@@ -186,17 +186,20 @@ The TypeScript-owned command surface is:
|
|
|
186
186
|
```sh
|
|
187
187
|
elementum init [--check] [--json]
|
|
188
188
|
elementum update [--check | --dry-run] [--channel stable|preview] [--version <semver>] [--json]
|
|
189
|
-
elementum migrate backend [orgRoot] [--check | --dry-run | --auto-approve] [--reconfigure]
|
|
189
|
+
elementum migrate backend [orgRoot] [--check | --dry-run | --auto-approve] [--reconfigure [--allow-empty-backend]] [--no-verify-plan | --verify-target <address>...]
|
|
190
190
|
elementum migrate provider-source [orgRoot] [--check | --dry-run | --auto-approve]
|
|
191
191
|
|
|
192
192
|
elementum pull org [--root <orgRoot>] [--no-adopt]
|
|
193
193
|
elementum pull org --data-only [--root <orgRoot>]
|
|
194
194
|
elementum pull app <namespace> [--root <orgRoot>] [--no-adopt] [--skip-unsupported-layouts]
|
|
195
195
|
elementum pull element <namespace> [--root <orgRoot>] [--no-adopt] [--skip-unsupported-layouts]
|
|
196
|
+
elementum pull --restore-previous [--root <orgRoot>] # after a failed pull: .tf/in.previous -> .tf/in (failed copy kept as .tf/in.failed); never automatic
|
|
196
197
|
elementum clone app <namespace> --as <newName> [--namespace <newns>] [--root <orgRoot>]
|
|
197
198
|
elementum build [orgRoot]
|
|
198
199
|
elementum plan [orgRoot-or-nested-target] [--json] [bridge args...]
|
|
199
200
|
elementum apply [orgRoot-or-nested-target] [--json] [bridge args...]
|
|
201
|
+
elementum plan --smart [--base <branch>] [orgRoot-or-nested-target] [bridge args...]
|
|
202
|
+
elementum apply --smart [--base <branch>] [orgRoot-or-nested-target] [-auto-approve] [bridge args...]
|
|
200
203
|
|
|
201
204
|
elementum list apps|elements|users|groups|categories|cloud-links
|
|
202
205
|
elementum list ai-provider-connectors|automations|tables
|
|
@@ -405,7 +408,23 @@ export default automation({
|
|
|
405
408
|
The file path supplies the automation ref; `app` is the strongly typed owning app ref.
|
|
406
409
|
`revision` is required SemVer and is the explicit publish gate. Editing
|
|
407
410
|
actions or triggers updates the draft; bump the revision only when that draft
|
|
408
|
-
should be published.
|
|
411
|
+
should be published. `elementum build` warns ("compiled steps changed since
|
|
412
|
+
the last apply but its revision is still …") when an automation's steps differ
|
|
413
|
+
from its recorded baseline while its revision does not. Applies, and pulls
|
|
414
|
+
whose adoption succeeded, record that baseline in
|
|
415
|
+
`applied-automation-revisions.json`, next to `terraform.tfstate` in the org
|
|
416
|
+
root; commit it so the whole team and CI share that baseline. An automation
|
|
417
|
+
with no recorded entry, such as one that was never applied or pulled, does not
|
|
418
|
+
warn. A pull records the draft it printed at the revision state says was last
|
|
419
|
+
published, so changes already unpublished before the pull are not flagged, and
|
|
420
|
+
a workflow republished from the Elementum screens without a new revision keeps
|
|
421
|
+
warning until the revision is bumped. The hash is workspace-independent: adding or removing a referenced app or
|
|
422
|
+
element does not change it (those refs are hashed as foreign `data.*` lookups).
|
|
423
|
+
For one release, a previously recorded workspace-dependent hash is still
|
|
424
|
+
accepted (dual-hash); apply and pull write the independent hash going forward,
|
|
425
|
+
and dual-hash acceptance will be removed next release. If the file does not
|
|
426
|
+
parse (for example a merge conflict), build says so and checks nothing, and
|
|
427
|
+
apply and pull leave it untouched until it is fixed.
|
|
409
428
|
|
|
410
429
|
## Agent example
|
|
411
430
|
|
|
@@ -466,6 +485,10 @@ Use `--json` for automation and log ingestion. It disables the interactive
|
|
|
466
485
|
spinner/progress renderer and emits technical diagnostics as one JSON object per
|
|
467
486
|
line on stderr; do not parse human-facing stdout as a log stream.
|
|
468
487
|
|
|
488
|
+
A normal `apply` makes the whole org match your working folder. When several
|
|
489
|
+
developers apply work in progress to the same org, use `--smart` instead (see
|
|
490
|
+
[Several developers on one org](#several-developers-on-one-org-smart-apply)).
|
|
491
|
+
|
|
469
492
|
## Identity and state recovery
|
|
470
493
|
|
|
471
494
|
Terraform state is the durable binding between authored labels and live
|
|
@@ -520,7 +543,7 @@ read a Terraform-managed secret. EDK does not accept `-backend-config` secrets
|
|
|
520
543
|
and never writes backend credentials into generated HCL.
|
|
521
544
|
|
|
522
545
|
OpenTofu owns locking. EDK does not implement a weaker parallel lock or disable
|
|
523
|
-
native locking: `plan`, `apply`, adoption imports, rename `
|
|
546
|
+
native locking: `plan`, `apply`, adoption imports, rename `moved` plans, and
|
|
524
547
|
state-repair operations use the declared backend. Standard options such as
|
|
525
548
|
`-lock-timeout=5m` pass through:
|
|
526
549
|
|
|
@@ -537,9 +560,9 @@ re-binding a changed backend; use the guarded migration command instead.
|
|
|
537
560
|
|
|
538
561
|
Create the backend infrastructure first, then add and review `backend.tf`.
|
|
539
562
|
The migration uses native `tofu init -migrate-state`, takes an ignored recovery
|
|
540
|
-
snapshot, refuses to overwrite unrelated destination state
|
|
541
|
-
|
|
542
|
-
|
|
563
|
+
snapshot, refuses to overwrite unrelated destination state (a never-written
|
|
564
|
+
destination, including the blank snapshot `pg` returns, counts as empty),
|
|
565
|
+
verifies lineage/resources, and removes the obsolete root copy:
|
|
543
566
|
|
|
544
567
|
```sh
|
|
545
568
|
elementum migrate backend <orgRoot> --check
|
|
@@ -548,10 +571,28 @@ elementum migrate backend <orgRoot> --auto-approve
|
|
|
548
571
|
elementum --profile=<profile> plan <orgRoot>
|
|
549
572
|
```
|
|
550
573
|
|
|
574
|
+
OpenTofu assigns a new lineage (serial 1) on the first write to an empty remote
|
|
575
|
+
backend; that copy is accepted as `content-matched` only when resources,
|
|
576
|
+
outputs, and check results are identical to the recovery snapshot, and the
|
|
577
|
+
lineage change is reported as a warning. Once the copy is verified the result
|
|
578
|
+
is `migrated`. A post-migration plan then
|
|
579
|
+
runs as a separate check and is reported under `verification` (`clean`,
|
|
580
|
+
`changes`, `failed`, or `skipped`); pending changes are warnings, not a reason
|
|
581
|
+
to roll back. Limit that plan with repeatable `--verify-target <address>` or
|
|
582
|
+
skip it with `--no-verify-plan` for large workspaces with intentional pending
|
|
583
|
+
changes.
|
|
584
|
+
|
|
551
585
|
For a remote-to-remote change, edit `backend.tf` and run the same migration.
|
|
552
586
|
Use `--reconfigure` only to bind an already-populated destination without
|
|
553
587
|
copying the currently bound state. It is rejected while local committed state
|
|
554
|
-
still exists.
|
|
588
|
+
still exists. When `.tf/out` is still bound to the local backend but no local
|
|
589
|
+
`terraform.tfstate` exists, every mode refuses with "no local state found;
|
|
590
|
+
nothing to migrate". Restore the file from Git, or, only in a checkout that
|
|
591
|
+
merged a completed local-to-remote migration (so the state already lives in the
|
|
592
|
+
declared backend), pass `--reconfigure`. `--reconfigure` first reads the
|
|
593
|
+
declared backend and refuses if it holds no state, because the next apply would
|
|
594
|
+
create a second copy of the org's resources. Pass `--allow-empty-backend` only
|
|
595
|
+
for a new org with nothing applied yet.
|
|
555
596
|
|
|
556
597
|
Recovery snapshots and exact rollback commands are printed on failure and kept
|
|
557
598
|
under `.tf/migration-backups/backend/`. The command updates `.gitignore` but
|
|
@@ -617,6 +658,112 @@ The command sequence and environment contract are identical on a noninteractive
|
|
|
617
658
|
Linux runner when your organization supplies the Linux toolchain artifact;
|
|
618
659
|
the public installer does not yet distribute Linux binaries.
|
|
619
660
|
|
|
661
|
+
When developers also apply from their own branches (below), the deployment job
|
|
662
|
+
should use `apply --smart --base <last applied main commit>` so it never undoes
|
|
663
|
+
their live, unmerged work. Keep that commit somewhere the job can read it —
|
|
664
|
+
for example a git tag the job moves after each successful apply.
|
|
665
|
+
|
|
666
|
+
## Several developers on one org (smart apply)
|
|
667
|
+
|
|
668
|
+
`elementum plan --smart` and `elementum apply --smart` let several developers
|
|
669
|
+
plan and apply against the same org and the same hosted state without undoing
|
|
670
|
+
each other's work. A normal apply makes every item in the org match your
|
|
671
|
+
folder, so applying a branch that lacks a colleague's applied change quietly
|
|
672
|
+
changes it back. A smart apply changes only the items your branch changed.
|
|
673
|
+
|
|
674
|
+
It needs a declared, locking `backend.tf` and the org folder in a git
|
|
675
|
+
repository. Options that would weaken its checks are refused: `-target`,
|
|
676
|
+
`-replace`, `-destroy`, `-refresh-only`, `-out`, `-state`, `-state-out`,
|
|
677
|
+
`-refresh=false`, `-lock=false` and `--skip-build`.
|
|
678
|
+
|
|
679
|
+
### How it works
|
|
680
|
+
|
|
681
|
+
Smart apply compares three versions of every item:
|
|
682
|
+
|
|
683
|
+
- **start** — the build of the commit your branch left the base branch at
|
|
684
|
+
(`git merge-base <base> HEAD`; `--base` defaults to `origin/main`, else
|
|
685
|
+
`main`);
|
|
686
|
+
- **mine** — the build of your working folder, committed or not;
|
|
687
|
+
- **live** — the state file plus OpenTofu's fresh read.
|
|
688
|
+
|
|
689
|
+
Then, for one run:
|
|
690
|
+
|
|
691
|
+
1. Items whose start and mine builds differ are **your items**. Each item's
|
|
692
|
+
`depends_on` wait list is ignored for this comparison.
|
|
693
|
+
2. Every other resource is written with `lifecycle { ignore_changes = all }`
|
|
694
|
+
in that run's generated `.tf/out` only: OpenTofu still reads and links to
|
|
695
|
+
it, but never changes it.
|
|
696
|
+
3. Your items are planned with `-target` and the plan is saved. If the plan
|
|
697
|
+
would touch anything that isn't yours, the apply is refused.
|
|
698
|
+
4. The start build is planned for your items. Anything it reports changed live
|
|
699
|
+
since your branch started — a conflict, unless the shared record shows live,
|
|
700
|
+
as OpenTofu just read it, still holds the settings of your own earlier
|
|
701
|
+
apply.
|
|
702
|
+
5. The saved plan is applied. OpenTofu refuses a saved plan once the state has
|
|
703
|
+
changed, so if another apply lands in between, smart apply starts again (up
|
|
704
|
+
to three times).
|
|
705
|
+
6. Each item the apply changed is added to the shared record, then the same
|
|
706
|
+
after-apply steps as a normal apply run: app TypeScript is refreshed, and
|
|
707
|
+
triggers the platform left without field references are repaired (with one
|
|
708
|
+
more smart attempt when any were).
|
|
709
|
+
7. `.tf/out` is rebuilt normally and the temporary start build
|
|
710
|
+
(`<orgRoot>/.tf/smart/`, git-ignored with the rest of `.tf/`) is removed,
|
|
711
|
+
including after Ctrl-C.
|
|
712
|
+
|
|
713
|
+
| Your item | Result |
|
|
714
|
+
| --- | --- |
|
|
715
|
+
| Changed live since your branch started, by someone else | Refused, naming who |
|
|
716
|
+
| Changed live, and live is still what *you* applied earlier | Applied (you are iterating) |
|
|
717
|
+
| You applied it earlier, but a setting your code sets was since edited outside OpenTofu (Elementum screens) | Refused |
|
|
718
|
+
| Already live exactly as your version | Nothing to do |
|
|
719
|
+
| You changed it, but it was deleted live | Refused |
|
|
720
|
+
| You are adding it, but it already exists live | Refused |
|
|
721
|
+
|
|
722
|
+
Items someone else deleted live that your code still has are handled without
|
|
723
|
+
recreating them: if your items only wait on such an item, it is left out of
|
|
724
|
+
the run; if one of your items — or something your change depends on — really
|
|
725
|
+
uses it, the apply is refused. Items your change depends on that differ live
|
|
726
|
+
from what you tested against are listed as a warning.
|
|
727
|
+
|
|
728
|
+
Two developers changing different settings of the same app (its name and its
|
|
729
|
+
stages, for example) both change the one app item, so the second is refused.
|
|
730
|
+
|
|
731
|
+
OpenTofu prints a warning whenever `-target` is used; smart apply relies on it
|
|
732
|
+
deliberately and its checks cover the case the warning describes.
|
|
733
|
+
|
|
734
|
+
### The shared record: who applied what
|
|
735
|
+
|
|
736
|
+
To tell your own earlier apply from someone else's change — and to name the
|
|
737
|
+
other developer — smart apply keeps a shared record on an HTTP server. Commit
|
|
738
|
+
`<orgRoot>/smart-apply.json`:
|
|
739
|
+
|
|
740
|
+
```json
|
|
741
|
+
{ "records": "https://state.example.com/records/acme" }
|
|
742
|
+
```
|
|
743
|
+
|
|
744
|
+
The address must not contain credentials or query parameters. If the server
|
|
745
|
+
needs a token, set `ELEMENTUM_SMART_RECORDS_TOKEN`; it is sent as
|
|
746
|
+
`Authorization: Bearer <token>`, and only over https (or to this machine).
|
|
747
|
+
|
|
748
|
+
The server holds one JSON document at that address:
|
|
749
|
+
|
|
750
|
+
- `GET` returns the document with a strong `ETag` header, or `404` when
|
|
751
|
+
nothing is recorded yet.
|
|
752
|
+
- `PUT` saves it only when `If-Match` carries the current `ETag` (or
|
|
753
|
+
`If-None-Match: *` for the first save); otherwise it answers `412`, and smart
|
|
754
|
+
apply re-reads, merges its entries and tries again. A `PUT` with neither
|
|
755
|
+
header is refused (`428`). The check and the write
|
|
756
|
+
must be one step, so two overlapping saves can never both succeed.
|
|
757
|
+
|
|
758
|
+
After each apply, every item whose live state changed is recorded with who
|
|
759
|
+
applied it (git `user.name` and `user.email`), the branch, the commit, the time
|
|
760
|
+
and a fingerprint of the settings its code sets as live held them. A failed
|
|
761
|
+
save is a warning, not a failure. `integration/tools/http-records-backend.mjs`
|
|
762
|
+
is a small reference server.
|
|
763
|
+
|
|
764
|
+
Without `smart-apply.json`, smart apply still works, but your own earlier
|
|
765
|
+
applies look like someone else's changes and conflicts cannot name anyone.
|
|
766
|
+
|
|
620
767
|
## Create and update semantics
|
|
621
768
|
|
|
622
769
|
Terraform owns lifecycle decisions; EDK has no second deployment state machine:
|
|
@@ -627,6 +774,11 @@ Terraform owns lifecycle decisions; EDK has no second deployment state machine:
|
|
|
627
774
|
- Resource present in state but absent from built config: destroy.
|
|
628
775
|
- Existing platform resource mapped into state by pull: adopt.
|
|
629
776
|
|
|
777
|
+
With `--smart`, only the developer's own items are planned: other resources
|
|
778
|
+
are protected for that run, and one that someone else deleted is left out
|
|
779
|
+
rather than recreated (see
|
|
780
|
+
[Several developers on one org](#several-developers-on-one-org-smart-apply)).
|
|
781
|
+
|
|
630
782
|
Pull adoption's zero-write gates prevent an existing resource from being
|
|
631
783
|
mistaken for a create. Build diagnostics are part of the safety contract:
|
|
632
784
|
unsupported stream kinds are never silently adopted or emitted. Renames that
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
* nothing reads those interim values.
|
|
22
22
|
*/
|
|
23
23
|
import type { AiProviderLlmModel, AiProviderType } from "./ai-provider-models.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, TaskCatalogRef, TriggerParameterRef } from "./types.js";
|
|
24
|
+
import type { AgentEvaluationRef, AgentRef, AppCatalogRef, AppOrElementRef, AiProviderRef, ApprovalChainRef, AutomationCatalogRef, CatalogRef, CategoryRef, ChartRef, DashboardRef, WidgetRef, CloudLinkRef, ConnectorRef, DatamineRef, RelationshipRef, GroupRef, PhoneProviderRef, PhoneServiceRef, ProcedureParameterType, ProcedureRef, FileReaderCatalogRef, DocumentModelFieldRef, ElementCatalogRef, FieldRef, ViewRef, ViewType, OutputPropertyRef, RecordIdentityRef, SearchTableRef, StoredFunctionRef, StoredFunctionScalarType, SkillRef, TableColumnRef, TableOwnedSearchTableRef, TableRef, TaskCatalogRef, TriggerParameterRef } from "./types.js";
|
|
25
25
|
export declare function recordIdentity<const Target extends AppOrElementRef | TaskCatalogRef | TableRef>(target: Target): RecordIdentityRef<Target>;
|
|
26
26
|
/** Fixed platform user-directory schema used by userSearch filters. */
|
|
27
27
|
export declare const usersCatalog: {
|
|
@@ -76,6 +76,7 @@ export declare function taskRef<const RefName extends string>(refName: RefName,
|
|
|
76
76
|
/** An app/element catalog's bags: reference-only kinds plus behavioral kinds sourced from authoring files. */
|
|
77
77
|
interface AppCatalogBags {
|
|
78
78
|
readonly fields?: Record<string, FieldRef>;
|
|
79
|
+
readonly views?: Record<string, ViewRef>;
|
|
79
80
|
readonly searchTables?: Record<string, SearchTableRef>;
|
|
80
81
|
readonly fileReaders?: Record<string, FileReaderCatalogRef>;
|
|
81
82
|
readonly automations?: Record<string, AutomationCatalogRef>;
|
|
@@ -206,7 +207,10 @@ export declare function widgetRef<const Parent extends string = string, const Re
|
|
|
206
207
|
readonly refName?: RefName;
|
|
207
208
|
readonly name?: string;
|
|
208
209
|
readonly parent?: Parent;
|
|
209
|
-
|
|
210
|
+
readonly at?: number;
|
|
211
|
+
}): WidgetRef<Parent, RefName> & {
|
|
212
|
+
readonly at?: number;
|
|
213
|
+
};
|
|
210
214
|
/**
|
|
211
215
|
* Skill ref — no required arguments, same shape as {@link agentRef}. `handle` and `parent`
|
|
212
216
|
* are injected by the enclosing `appCatalog`/`elementCatalog`; `name` defaults to `""`.
|
|
@@ -231,6 +235,11 @@ export declare function datamineRef(opts?: {
|
|
|
231
235
|
readonly parentName?: string;
|
|
232
236
|
readonly columnNames?: Readonly<Record<string, string>>;
|
|
233
237
|
}): DatamineRef;
|
|
238
|
+
/** Minimal relationship ref for visual-flow chip actions (edk#1663). */
|
|
239
|
+
export declare function relationshipRef(opts?: {
|
|
240
|
+
readonly name?: string;
|
|
241
|
+
readonly parent?: string;
|
|
242
|
+
}): RelationshipRef;
|
|
234
243
|
export declare const approvalChainRef: (opts: Omit<ApprovalChainRef<string, string>, "parent" | "refName" | "__kind">) => Omit<ApprovalChainRef<string, string>, "parent" | "refName" | "__kind"> & {
|
|
235
244
|
readonly __kind: "approvalChain";
|
|
236
245
|
readonly refName: string;
|
|
@@ -330,6 +339,28 @@ export declare const fieldRef: <const T extends Omit<FieldRef, "__kind" | "refNa
|
|
|
330
339
|
readonly __kind: "field";
|
|
331
340
|
readonly refName: string;
|
|
332
341
|
};
|
|
342
|
+
/** A view entry of a generated catalog: its owner's ref name and the bag that holds it. */
|
|
343
|
+
export interface CatalogViewRefOptions {
|
|
344
|
+
readonly name: string;
|
|
345
|
+
readonly parent: string;
|
|
346
|
+
readonly viewType: ViewType;
|
|
347
|
+
readonly parentKind?: never;
|
|
348
|
+
readonly parentNamespace?: never;
|
|
349
|
+
}
|
|
350
|
+
/** A view of an app or element outside this workspace, by its owner's namespace and its name. */
|
|
351
|
+
export interface OutsideViewRefOptions {
|
|
352
|
+
readonly name: string;
|
|
353
|
+
readonly parentKind: "app" | "element";
|
|
354
|
+
readonly parentNamespace: string;
|
|
355
|
+
readonly parent?: never;
|
|
356
|
+
readonly viewType?: never;
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* A view by its owner and name. Inside the workspace, use the generated
|
|
360
|
+
* catalog (`catalog.<app>.views.<view>`); for a view of an app or element
|
|
361
|
+
* outside it, pass `{ name, parentKind, parentNamespace }`.
|
|
362
|
+
*/
|
|
363
|
+
export declare function viewRef(opts: CatalogViewRefOptions | OutsideViewRefOptions): ViewRef;
|
|
333
364
|
/**
|
|
334
365
|
* Assemble an app catalog object. Injects `__kind: "app"` so the result
|
|
335
366
|
* satisfies `CatalogRef<"app">` (accepted by aspect-ref parameters) without
|
|
@@ -112,7 +112,7 @@ export function dashboardRef(opts) {
|
|
|
112
112
|
return { __kind: "dashboard", refName: opts?.refName ?? "", name: opts?.name ?? "", ...(opts?.parent !== undefined ? { parent: opts.parent } : {}) };
|
|
113
113
|
}
|
|
114
114
|
export function widgetRef(opts) {
|
|
115
|
-
return { __kind: "widget", refName: opts?.refName ?? "", name: opts?.name ?? "", ...(opts?.parent !== undefined ? { parent: opts.parent } : {}) };
|
|
115
|
+
return { __kind: "widget", refName: opts?.refName ?? "", name: opts?.name ?? "", ...(opts?.parent !== undefined ? { parent: opts.parent } : {}), ...(opts?.at !== undefined ? { at: opts.at } : {}) };
|
|
116
116
|
}
|
|
117
117
|
/**
|
|
118
118
|
* Skill ref — no required arguments, same shape as {@link agentRef}. `handle` and `parent`
|
|
@@ -145,6 +145,15 @@ export function datamineRef(opts) {
|
|
|
145
145
|
...(opts?.columnNames !== undefined ? { columnNames: opts.columnNames } : {}),
|
|
146
146
|
};
|
|
147
147
|
}
|
|
148
|
+
/** Minimal relationship ref for visual-flow chip actions (edk#1663). */
|
|
149
|
+
export function relationshipRef(opts) {
|
|
150
|
+
return {
|
|
151
|
+
__kind: "relationship",
|
|
152
|
+
refName: "",
|
|
153
|
+
name: opts?.name ?? "",
|
|
154
|
+
...(opts?.parent !== undefined ? { parent: opts.parent } : {}),
|
|
155
|
+
};
|
|
156
|
+
}
|
|
148
157
|
export const approvalChainRef = refFactory("approvalChain");
|
|
149
158
|
function searchTableRefFor(opts, variant) {
|
|
150
159
|
return {
|
|
@@ -296,6 +305,17 @@ export function tableRef(opts) {
|
|
|
296
305
|
* to discriminate per-field value types from a catalog app's `fields` bag.
|
|
297
306
|
*/
|
|
298
307
|
export const fieldRef = (opts) => ({ __kind: "field", ...opts, refName: opts.refName ?? opts.name });
|
|
308
|
+
/**
|
|
309
|
+
* A view by its owner and name. Inside the workspace, use the generated
|
|
310
|
+
* catalog (`catalog.<app>.views.<view>`); for a view of an app or element
|
|
311
|
+
* outside it, pass `{ name, parentKind, parentNamespace }`.
|
|
312
|
+
*/
|
|
313
|
+
export function viewRef(opts) {
|
|
314
|
+
if (opts.parentNamespace !== undefined) {
|
|
315
|
+
return { __kind: "view", refName: opts.name, name: opts.name, parent: opts.parentNamespace, parentKind: opts.parentKind, parentNamespace: opts.parentNamespace };
|
|
316
|
+
}
|
|
317
|
+
return { __kind: "view", refName: opts.name, name: opts.name, parent: opts.parent, viewType: opts.viewType };
|
|
318
|
+
}
|
|
299
319
|
/**
|
|
300
320
|
* Stamp each bag entry's `.handle` to match its own object key — the one place a ref name is
|
|
301
321
|
* actually carried. For field/automation/agent/skill/searchTable bags `injectParent` is the
|
|
@@ -399,6 +419,23 @@ function stampTableRefs(bag) {
|
|
|
399
419
|
}
|
|
400
420
|
return out;
|
|
401
421
|
}
|
|
422
|
+
/** Stamp each view with its key and its owner's identity (see {@link ViewRef}). */
|
|
423
|
+
function stampViewRefs(bag, identity, parentKind) {
|
|
424
|
+
if (bag === undefined)
|
|
425
|
+
return undefined;
|
|
426
|
+
const out = {};
|
|
427
|
+
for (const [refName, ref] of Object.entries(bag)) {
|
|
428
|
+
out[refName] = {
|
|
429
|
+
...ref,
|
|
430
|
+
refName,
|
|
431
|
+
parent: identity.refName,
|
|
432
|
+
parentKind,
|
|
433
|
+
parentName: identity.name,
|
|
434
|
+
...(identity.namespace !== undefined ? { parentNamespace: identity.namespace } : {}),
|
|
435
|
+
};
|
|
436
|
+
}
|
|
437
|
+
return out;
|
|
438
|
+
}
|
|
402
439
|
/**
|
|
403
440
|
* Assemble an app catalog object. Injects `__kind: "app"` so the result
|
|
404
441
|
* satisfies `CatalogRef<"app">` (accepted by aspect-ref parameters) without
|
|
@@ -417,6 +454,7 @@ export function appCatalog(identity, bags) {
|
|
|
417
454
|
...(identity.namespace !== undefined ? { namespace: identity.namespace } : {}),
|
|
418
455
|
...bags,
|
|
419
456
|
fields: stampFieldRefs(bags.fields, identity, "app") ?? {},
|
|
457
|
+
views: stampViewRefs(bags.views, identity, "app") ?? {},
|
|
420
458
|
searchTables: withOwnKeyAsHandle(bags.searchTables, identity.refName) ?? {},
|
|
421
459
|
fileReaders: withOwnKeyAsHandle(bags.fileReaders, identity.refName) ?? {},
|
|
422
460
|
automations: stampOwnedRefs(bags.automations, identity, "app") ?? {},
|
|
@@ -437,6 +475,7 @@ export function elementCatalog(identity, bags) {
|
|
|
437
475
|
...(identity.namespace !== undefined ? { namespace: identity.namespace } : {}),
|
|
438
476
|
...bags,
|
|
439
477
|
fields: stampFieldRefs(bags.fields, identity, "element") ?? {},
|
|
478
|
+
views: stampViewRefs(bags.views, identity, "element") ?? {},
|
|
440
479
|
searchTables: withOwnKeyAsHandle(bags.searchTables, identity.refName) ?? {},
|
|
441
480
|
fileReaders: withOwnKeyAsHandle(bags.fileReaders, identity.refName) ?? {},
|
|
442
481
|
automations: stampOwnedRefs(bags.automations, identity, "element") ?? {},
|
|
@@ -74,25 +74,28 @@ export declare function writeAppCatalogFromAuthoring(appDir: string, appRefName:
|
|
|
74
74
|
export declare function writeAppCatalog(appDir: string, appRefName: string, appName: string, appFile: string, importRefs?: readonly CatalogRef[], kind?: "app" | "element", namespace?: string): Promise<{
|
|
75
75
|
catalogPath: string;
|
|
76
76
|
}>;
|
|
77
|
-
/** One app's catalog regenerated by {@link regenerateAppCatalogsUnder}. */
|
|
78
77
|
export interface AppCatalogRegenResult {
|
|
79
78
|
readonly appRefName: string;
|
|
80
79
|
readonly appName: string;
|
|
81
|
-
readonly kind: "app" | "element";
|
|
82
|
-
/** The regenerated per-app/per-element catalog file path. */
|
|
80
|
+
readonly kind: "app" | "element" | "table";
|
|
81
|
+
/** The regenerated per-app/per-element/per-table catalog file path. */
|
|
83
82
|
readonly catalogPath: string;
|
|
84
83
|
}
|
|
85
84
|
/**
|
|
86
|
-
* Regenerate the per-entity catalog for every app/element authoring file
|
|
85
|
+
* Regenerate the per-entity catalog for every app/element/table authoring file
|
|
87
86
|
* found anywhere under `dir` — the same kind of file `edk plan`/`edk apply`
|
|
88
87
|
* discover as deployable entities. Run this **before** plan/apply discovery:
|
|
89
88
|
* an automation file that imports its owning app's/element's `catalog.ts`
|
|
90
89
|
* needs that file to reflect whatever own-file children exist on disk right
|
|
91
90
|
* now, not a stale snapshot from the last time the catalog was written.
|
|
92
91
|
*
|
|
93
|
-
* A file that fails to load is
|
|
94
|
-
*
|
|
95
|
-
*
|
|
92
|
+
* A file that fails to load is skipped here — `discoverV2Entities` (run right
|
|
93
|
+
* after this, by plan/apply) is what surfaces load errors to the user. A
|
|
94
|
+
* caller with no such later step (`elementum generate`) passes
|
|
95
|
+
* `onLoadFailure` to report them instead.
|
|
96
|
+
*
|
|
97
|
+
* A table's catalog is written from its authored definition, so pulled source
|
|
98
|
+
* that reaches it through `org.tables.<ref>` can be laid down fresh.
|
|
96
99
|
*
|
|
97
100
|
* `pathOrPaths` may be one directory (historical), one authoring file, or a
|
|
98
101
|
* mix of files and directories — same expansion rules as plan/apply discovery.
|
|
@@ -100,4 +103,6 @@ export interface AppCatalogRegenResult {
|
|
|
100
103
|
* Pass `tenant` from plan/apply so paths are gated to the authenticated
|
|
101
104
|
* org/instance workspace.
|
|
102
105
|
*/
|
|
103
|
-
export declare function regenerateAppCatalogsUnder(pathOrPaths: string | readonly string[], tenant?: AuthoringTenantContext
|
|
106
|
+
export declare function regenerateAppCatalogsUnder(pathOrPaths: string | readonly string[], tenant?: AuthoringTenantContext, options?: {
|
|
107
|
+
readonly onLoadFailure?: (file: string, error: unknown) => void;
|
|
108
|
+
}): Promise<AppCatalogRegenResult[]>;
|
|
@@ -24,6 +24,7 @@ import { basename, dirname, join, resolve } from "node:path";
|
|
|
24
24
|
import { createWorkspaceLoader } from "../engine/workspace/loader.js";
|
|
25
25
|
import { writeTechnicalLog } from "../engine/progress.js";
|
|
26
26
|
import { companionDirsByBag, KIND_BY_ID, ownFileCatalogChildrenOf, } from "../graph/index.js";
|
|
27
|
+
import { writeTableCatalog } from "../entities/table/catalog.js";
|
|
27
28
|
import { writeCatalogBarrel } from "./org.js";
|
|
28
29
|
import { renderCatalog } from "./render.js";
|
|
29
30
|
import { assertAuthoringPathForTenant, assertValidAuthoringLayout, isAuthoringHelperFile, isStreamRootAuthoringFile, } from "../engine/workspace/authoring-layout.js";
|
|
@@ -268,10 +269,10 @@ function dedupeCatalogRefs(refs) {
|
|
|
268
269
|
* generated/catalog.js"` picks it up. Immediately overwritten by
|
|
269
270
|
* `writeAppCatalogFromAuthoring`'s real write once child bags resolve.
|
|
270
271
|
*/
|
|
271
|
-
async function writeStubCatalog(appDir, appRefName, appName, kind, fields, childBags) {
|
|
272
|
+
async function writeStubCatalog(appDir, appRefName, appName, kind, fields, childBags, views = {}) {
|
|
272
273
|
const generatedDir = join(appDir, "generated");
|
|
273
274
|
await mkdir(generatedDir, { recursive: true });
|
|
274
|
-
const body = { __kind: kind, refName: appRefName, name: appName, fields, ...childBags };
|
|
275
|
+
const body = { __kind: kind, refName: appRefName, name: appName, fields, views, ...childBags };
|
|
275
276
|
await writeFile(join(generatedDir, CATALOG_FILENAME), `export const ${appRefName} = ${JSON.stringify(body)};\n`, "utf8");
|
|
276
277
|
}
|
|
277
278
|
/**
|
|
@@ -297,6 +298,7 @@ export async function buildAppCatalogFromAuthoring(appDir, appFile, orgCatalogPa
|
|
|
297
298
|
const appRefName = refNameOf(appFile);
|
|
298
299
|
const appRef = app.ref(appRefName);
|
|
299
300
|
const fields = appRef.fields ?? {};
|
|
301
|
+
const views = appRef.views ?? {};
|
|
300
302
|
const parentKind = (appRef.__kind === "element" ? "element" : "app");
|
|
301
303
|
const children = catalogChildrenOf(parentKind);
|
|
302
304
|
const stubBags = {};
|
|
@@ -305,7 +307,7 @@ export async function buildAppCatalogFromAuthoring(appDir, appFile, orgCatalogPa
|
|
|
305
307
|
continue;
|
|
306
308
|
stubBags[child.catalog.catalogBag] = await stubRefsForChild(appDir, child, appRefName);
|
|
307
309
|
}
|
|
308
|
-
await writeStubCatalog(appDir, appRefName, appRef.name, appRef.__kind, fields, stubBags);
|
|
310
|
+
await writeStubCatalog(appDir, appRefName, appRef.name, appRef.__kind, fields, stubBags, views);
|
|
309
311
|
// The stub above makes THIS app's own generated/catalog.ts self-consistent
|
|
310
312
|
// for intra-app sibling references (e.g. one agent referencing another's
|
|
311
313
|
// catalog entry) — but a sibling file resolves `@catalog` through the ORG
|
|
@@ -330,6 +332,7 @@ export async function buildAppCatalogFromAuthoring(appDir, appFile, orgCatalogPa
|
|
|
330
332
|
refName: appRefName,
|
|
331
333
|
name: appRef.name,
|
|
332
334
|
fields,
|
|
335
|
+
views,
|
|
333
336
|
...childRefBags,
|
|
334
337
|
};
|
|
335
338
|
const defs = {
|
|
@@ -358,6 +361,7 @@ export async function writeAppCatalogFromAuthoring(appDir, appRefName, appName,
|
|
|
358
361
|
const orgCatalogPath = join(dirname(dirname(appDir)), "generated", "catalog.ts");
|
|
359
362
|
const { refs, defs } = await buildAppCatalogFromAuthoring(appDir, appFile, orgCatalogPath);
|
|
360
363
|
const fields = refs.fields ?? {};
|
|
364
|
+
const views = refs.views ?? {};
|
|
361
365
|
const parentKind = (refs.__kind === "element" ? "element" : "app");
|
|
362
366
|
const fromBags = [];
|
|
363
367
|
for (const child of catalogChildrenOf(parentKind)) {
|
|
@@ -368,7 +372,7 @@ export async function writeAppCatalogFromAuthoring(appDir, appRefName, appName,
|
|
|
368
372
|
continue;
|
|
369
373
|
fromBags.push(...Object.values(bag));
|
|
370
374
|
}
|
|
371
|
-
const flatRefs = dedupeCatalogRefs([...Object.values(fields), ...fromBags, ...extraRefs]);
|
|
375
|
+
const flatRefs = dedupeCatalogRefs([...Object.values(fields), ...Object.values(views), ...fromBags, ...extraRefs]);
|
|
372
376
|
// Fields resolve live off the app's own file (see `renderCatalog`'s `ownFile`
|
|
373
377
|
// param) — never baked, so adding/editing/removing a field never requires
|
|
374
378
|
// re-running this writer. `flatRefs`' field entries still flow through
|
|
@@ -428,16 +432,20 @@ export async function writeAppCatalog(appDir, appRefName, appName, appFile, impo
|
|
|
428
432
|
return { catalogPath };
|
|
429
433
|
}
|
|
430
434
|
/**
|
|
431
|
-
* Regenerate the per-entity catalog for every app/element authoring file
|
|
435
|
+
* Regenerate the per-entity catalog for every app/element/table authoring file
|
|
432
436
|
* found anywhere under `dir` — the same kind of file `edk plan`/`edk apply`
|
|
433
437
|
* discover as deployable entities. Run this **before** plan/apply discovery:
|
|
434
438
|
* an automation file that imports its owning app's/element's `catalog.ts`
|
|
435
439
|
* needs that file to reflect whatever own-file children exist on disk right
|
|
436
440
|
* now, not a stale snapshot from the last time the catalog was written.
|
|
437
441
|
*
|
|
438
|
-
* A file that fails to load is
|
|
439
|
-
*
|
|
440
|
-
*
|
|
442
|
+
* A file that fails to load is skipped here — `discoverV2Entities` (run right
|
|
443
|
+
* after this, by plan/apply) is what surfaces load errors to the user. A
|
|
444
|
+
* caller with no such later step (`elementum generate`) passes
|
|
445
|
+
* `onLoadFailure` to report them instead.
|
|
446
|
+
*
|
|
447
|
+
* A table's catalog is written from its authored definition, so pulled source
|
|
448
|
+
* that reaches it through `org.tables.<ref>` can be laid down fresh.
|
|
441
449
|
*
|
|
442
450
|
* `pathOrPaths` may be one directory (historical), one authoring file, or a
|
|
443
451
|
* mix of files and directories — same expansion rules as plan/apply discovery.
|
|
@@ -445,7 +453,7 @@ export async function writeAppCatalog(appDir, appRefName, appName, appFile, impo
|
|
|
445
453
|
* Pass `tenant` from plan/apply so paths are gated to the authenticated
|
|
446
454
|
* org/instance workspace.
|
|
447
455
|
*/
|
|
448
|
-
export async function regenerateAppCatalogsUnder(pathOrPaths, tenant) {
|
|
456
|
+
export async function regenerateAppCatalogsUnder(pathOrPaths, tenant, options) {
|
|
449
457
|
const paths = typeof pathOrPaths === "string" ? [pathOrPaths] : pathOrPaths;
|
|
450
458
|
const out = [];
|
|
451
459
|
for (const file of await listEntityFilesFromPaths(paths, tenant)) {
|
|
@@ -472,12 +480,29 @@ export async function regenerateAppCatalogsUnder(pathOrPaths, tenant) {
|
|
|
472
480
|
if (process.env.EDK_DEBUG) {
|
|
473
481
|
writeTechnicalLog("DEBUG", "edk", `Failed to import ${file}: ${String(err)}`);
|
|
474
482
|
}
|
|
483
|
+
options?.onLoadFailure?.(file, err);
|
|
475
484
|
continue;
|
|
476
485
|
}
|
|
477
486
|
if (!isConfiguredEntity(mod.default))
|
|
478
487
|
continue;
|
|
479
488
|
const appRefName = refNameOf(file);
|
|
480
489
|
const ref = mod.default.ref(appRefName);
|
|
490
|
+
if (ref.__kind === "table") {
|
|
491
|
+
const table = ref;
|
|
492
|
+
const { catalogPath } = await writeTableCatalog(orgRoot, {
|
|
493
|
+
handle: appRefName,
|
|
494
|
+
name: table.name,
|
|
495
|
+
tableColumns: Object.fromEntries(Object.entries(table.columns ?? {}).map(([key, column]) => [key, {
|
|
496
|
+
id: "",
|
|
497
|
+
name: column.name,
|
|
498
|
+
...(column.fieldType !== undefined && { fieldType: column.fieldType }),
|
|
499
|
+
...(column.tags !== undefined && { tags: column.tags }),
|
|
500
|
+
}])),
|
|
501
|
+
datamines: Object.fromEntries(Object.entries(table.datamines ?? {}).map(([key, datamine]) => [key, { name: datamine.name }])),
|
|
502
|
+
});
|
|
503
|
+
out.push({ appRefName, appName: table.name, kind: "table", catalogPath });
|
|
504
|
+
continue;
|
|
505
|
+
}
|
|
481
506
|
if (ref.__kind !== "app" && ref.__kind !== "element")
|
|
482
507
|
continue;
|
|
483
508
|
const { catalogPath } = await writeAppCatalogFromAuthoring(dirname(file), appRefName, ref.name, file, []);
|
|
@@ -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 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 TaskCatalogRef, type AppOrElementOrTaskRef, 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, USER_GROUP_FIELD_KEYS, type UserGroupFieldKey, type UserGroupFieldRef, } 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 TaskCatalogRef, type AppOrElementOrTaskRef, type FieldRef, type OutputPropertyRef, type RecordIdentityRef, type SearchTableRef, type TableOwnedSearchTableRef, type StoredFunctionRef, type StoredFunctionScalarType, type DatamineRef, type RelationshipRef, type SkillRef, type TableColumnRef, type TableRef, type TriggerParameterRef, USER_FIELD_KEYS, type UserFieldKey, type UserFieldRef, USER_GROUP_FIELD_KEYS, type UserGroupFieldKey, type UserGroupFieldRef, viewType, type ViewRef, type ViewType, } 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, widgetRef, cloudLinkRef, connectorRef, aiProvider, groupRef, linkedSearchTableRef, phoneProviderRef, phoneServiceRef, procedureRef, documentModelFieldRef, documentModelRef, elementCatalog, elementRef, fieldRef, orgCatalog, outputPropertyRef, recordIdentity, searchTableRef, datamineRef, skillRef, storedFunctionRef, tableColumnRef, tableRef, tableSearchTableRef, taskRef, triggerParameterRef, userGroupsCatalog, 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, relationshipRef, skillRef, storedFunctionRef, tableColumnRef, tableRef, tableSearchTableRef, taskRef, triggerParameterRef, userGroupsCatalog, usersCatalog, viewRef, type CatalogViewRefOptions, type OutsideViewRefOptions, } 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, PROCEDURE_PARAMETER_TYPES, USER_FIELD_KEYS, USER_GROUP_FIELD_KEYS, } from "./types.js";
|
|
7
|
+
export { REF_SCOPE, REF_UPDATABLE, PROCEDURE_PARAMETER_TYPES, USER_FIELD_KEYS, USER_GROUP_FIELD_KEYS, viewType, } 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, widgetRef, cloudLinkRef, connectorRef, aiProvider, groupRef, linkedSearchTableRef, phoneProviderRef, phoneServiceRef, procedureRef, documentModelFieldRef, documentModelRef, elementCatalog, elementRef, fieldRef, orgCatalog, outputPropertyRef, recordIdentity, searchTableRef, datamineRef, skillRef, storedFunctionRef, tableColumnRef, tableRef, tableSearchTableRef, taskRef, triggerParameterRef, userGroupsCatalog, 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, relationshipRef, skillRef, storedFunctionRef, tableColumnRef, tableRef, tableSearchTableRef, taskRef, triggerParameterRef, userGroupsCatalog, usersCatalog, viewRef, } from "./factories.js";
|
|
@@ -31,10 +31,10 @@ export function renderCatalog(root, refs, _automationTriggerKinds, ownFile) {
|
|
|
31
31
|
// Graph CatalogFacet (+ deferred meta) drives which kinds belong on this root
|
|
32
32
|
// and their emission order — no hard-wired KIND_ORDER / bag lists here.
|
|
33
33
|
const usedMeta = catalogKindsForRoot(root.kind).filter((m) => refs.some((r) => r.__kind === m.refKind));
|
|
34
|
-
//
|
|
35
|
-
//
|
|
36
|
-
//
|
|
37
|
-
const liveMeta = ownFile !== undefined ? usedMeta.filter((m) => m.
|
|
34
|
+
// Bags authored inline in the app/element file (fields, views) resolve live
|
|
35
|
+
// off `ownFile`'s own `.ref()` call — never rendered as baked entries, so
|
|
36
|
+
// their factories never need importing and the per-entry loop skips them.
|
|
37
|
+
const liveMeta = ownFile !== undefined ? usedMeta.filter((m) => m.fromOwnRef !== true) : usedMeta;
|
|
38
38
|
const factoryNames = new Set();
|
|
39
39
|
if (isApp) {
|
|
40
40
|
factoryNames.add(root.kind === "element" ? "elementCatalog" : "appCatalog");
|
|
@@ -82,8 +82,8 @@ export function renderCatalog(root, refs, _automationTriggerKinds, ownFile) {
|
|
|
82
82
|
lines.push(` {`);
|
|
83
83
|
for (const m of usedMeta) {
|
|
84
84
|
const bag = bagName(m.refKind);
|
|
85
|
-
if (m.
|
|
86
|
-
lines.push(` ${bag}: __own
|
|
85
|
+
if (m.fromOwnRef === true && ownFile !== undefined) {
|
|
86
|
+
lines.push(` ${bag}: __own.${bag},`);
|
|
87
87
|
continue;
|
|
88
88
|
}
|
|
89
89
|
const kindRefs = refs
|
|
@@ -48,6 +48,14 @@ export function slimToken(token) {
|
|
|
48
48
|
// type — canonical field metadata, not a barrel bag.
|
|
49
49
|
if (token.__kind === "field" && typeof token.fieldType === "string")
|
|
50
50
|
out.fieldType = token.fieldType;
|
|
51
|
+
// A layout widget's place in the group's field list. Dropping it always
|
|
52
|
+
// appends the widget and replaces any layout where the button sits between fields.
|
|
53
|
+
if (token.__kind === "widget" && typeof token.at === "number")
|
|
54
|
+
out.at = token.at;
|
|
55
|
+
// A view's bag decides which resource type backs it when its owner is in
|
|
56
|
+
// the same workspace.
|
|
57
|
+
if (token.__kind === "view" && typeof token.viewType === "string")
|
|
58
|
+
out.viewType = token.viewType;
|
|
51
59
|
// Same reasoning for a file reader: build needs to know which of the
|
|
52
60
|
// excel/json/text/xml/ai resource types backs it to emit the right
|
|
53
61
|
// `elementum_<type>_file_reader.<label>.id` reference - without this,
|
|
@@ -77,6 +85,9 @@ export function slimToken(token) {
|
|
|
77
85
|
(token.__variant === "snowflake" || token.__variant === "linked" || token.__variant === "table")) {
|
|
78
86
|
out.__variant = token.__variant;
|
|
79
87
|
}
|
|
88
|
+
if (token.__kind === "searchTable" && typeof token.id === "string" && token.id !== "") {
|
|
89
|
+
out.id = token.id;
|
|
90
|
+
}
|
|
80
91
|
if (token.__kind === "field" && Array.isArray(token.options)) {
|
|
81
92
|
out.options = token.options.filter((option) => typeof option === "string");
|
|
82
93
|
}
|