@elementumai/edk 0.9.18 → 0.9.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +154 -9
- package/dist-sdk/src/catalog/factories.d.ts +35 -1
- package/dist-sdk/src/catalog/factories.js +36 -0
- package/dist-sdk/src/catalog/from-authoring.d.ts +13 -8
- package/dist-sdk/src/catalog/from-authoring.js +34 -9
- package/dist-sdk/src/catalog/index.d.ts +2 -2
- package/dist-sdk/src/catalog/index.js +2 -2
- package/dist-sdk/src/catalog/org.d.ts +39 -1
- package/dist-sdk/src/catalog/org.js +460 -50
- package/dist-sdk/src/catalog/render.js +6 -6
- package/dist-sdk/src/catalog/token.js +7 -0
- package/dist-sdk/src/catalog/types.d.ts +44 -1
- package/dist-sdk/src/catalog/types.js +13 -0
- package/dist-sdk/src/core/triggers/on-demand.d.ts +39 -3
- package/dist-sdk/src/core/triggers/on-demand.js +10 -2
- package/dist-sdk/src/engine/build/context.d.ts +1 -1
- package/dist-sdk/src/engine/ei/run.d.ts +149 -0
- package/dist-sdk/src/engine/ei/run.js +1132 -0
- package/dist-sdk/src/engine/logging.d.ts +17 -0
- package/dist-sdk/src/engine/logging.js +18 -0
- package/dist-sdk/src/engine/pull/ref-only.d.ts +5 -0
- package/dist-sdk/src/engine/pull/ref-only.js +64 -27
- package/dist-sdk/src/engine/pull/result-output.d.ts +8 -0
- package/dist-sdk/src/engine/pull/result-output.js +88 -4
- package/dist-sdk/src/engine/tf/expr.js +39 -14
- package/dist-sdk/src/engine/tf/index.d.ts +3 -3
- package/dist-sdk/src/engine/tf/index.js +2 -2
- package/dist-sdk/src/engine/tf/labels.d.ts +8 -0
- package/dist-sdk/src/engine/tf/labels.js +13 -0
- package/dist-sdk/src/engine/tf/model.d.ts +22 -1
- package/dist-sdk/src/engine/tf/parse.d.ts +19 -0
- package/dist-sdk/src/engine/tf/parse.js +197 -10
- package/dist-sdk/src/engine/tf/render.d.ts +4 -2
- package/dist-sdk/src/engine/tf/render.js +41 -7
- package/dist-sdk/src/engine/validation.d.ts +39 -0
- package/dist-sdk/src/engine/validation.js +85 -0
- package/dist-sdk/src/engine/workspace/loader.js +49 -12
- package/dist-sdk/src/entities/access-policy/from-tf.d.ts +11 -1
- package/dist-sdk/src/entities/access-policy/from-tf.js +6 -1
- package/dist-sdk/src/entities/access-policy/to-tf.d.ts +11 -0
- package/dist-sdk/src/entities/access-policy/to-tf.js +16 -6
- package/dist-sdk/src/entities/agent/build.d.ts +4 -16
- package/dist-sdk/src/entities/agent/build.js +40 -5
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +4 -2
- package/dist-sdk/src/entities/agent/to-tf.js +6 -3
- package/dist-sdk/src/entities/agent-tool/from-tf.d.ts +2 -0
- package/dist-sdk/src/entities/agent-tool/from-tf.js +7 -1
- package/dist-sdk/src/entities/agent-tool/to-tf.d.ts +2 -2
- package/dist-sdk/src/entities/agent-tool/to-tf.js +29 -6
- package/dist-sdk/src/entities/app/build.d.ts +98 -19
- package/dist-sdk/src/entities/app/build.js +51 -19
- package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +22 -1
- package/dist-sdk/src/entities/app/from-tf.d.ts +1 -0
- package/dist-sdk/src/entities/app/from-tf.js +11 -5
- package/dist-sdk/src/entities/app/index.d.ts +6 -5
- package/dist-sdk/src/entities/app/index.js +2 -0
- package/dist-sdk/src/entities/app/module.js +18 -2
- package/dist-sdk/src/entities/app/to-tf.js +21 -11
- package/dist-sdk/src/entities/automation/build.d.ts +49 -6
- package/dist-sdk/src/entities/automation/build.js +163 -19
- package/dist-sdk/src/entities/automation/deserializer/print-automation.d.ts +24 -1
- package/dist-sdk/src/entities/automation/deserializer/print-automation.js +320 -39
- package/dist-sdk/src/entities/automation/from-tf.d.ts +28 -6
- package/dist-sdk/src/entities/automation/from-tf.js +563 -74
- package/dist-sdk/src/entities/automation/generated/task-output-contracts.d.ts +33 -0
- package/dist-sdk/src/entities/automation/generated/task-output-contracts.js +183 -0
- package/dist-sdk/src/entities/automation/index.d.ts +2 -2
- package/dist-sdk/src/entities/automation/index.js +1 -1
- package/dist-sdk/src/entities/automation/module.d.ts +2 -0
- package/dist-sdk/src/entities/automation/module.js +93 -8
- package/dist-sdk/src/entities/automation/output-field-types.d.ts +7 -0
- package/dist-sdk/src/entities/automation/output-field-types.js +36 -0
- package/dist-sdk/src/entities/automation/output-key-wire-name.d.ts +9 -0
- package/dist-sdk/src/entities/automation/output-key-wire-name.js +13 -0
- package/dist-sdk/src/entities/automation/script-code.d.ts +17 -0
- package/dist-sdk/src/entities/automation/script-code.js +91 -5
- package/dist-sdk/src/entities/automation/system-ref-name.d.ts +16 -0
- package/dist-sdk/src/entities/automation/system-ref-name.js +48 -0
- package/dist-sdk/src/entities/automation/task-output-labels.d.ts +17 -0
- package/dist-sdk/src/entities/automation/task-output-labels.js +47 -0
- package/dist-sdk/src/entities/automation/tasks.d.ts +53 -4
- package/dist-sdk/src/entities/automation/tasks.js +38 -9
- package/dist-sdk/src/entities/automation/to-tf.d.ts +4 -0
- package/dist-sdk/src/entities/automation/to-tf.js +647 -167
- package/dist-sdk/src/entities/automation/triggers.d.ts +4 -2
- package/dist-sdk/src/entities/automation/triggers.js +4 -0
- package/dist-sdk/src/entities/automation/types.js +1 -0
- package/dist-sdk/src/entities/chart/from-tf.js +33 -17
- package/dist-sdk/src/entities/chart/module.js +3 -1
- package/dist-sdk/src/entities/chart/printer.d.ts +1 -0
- package/dist-sdk/src/entities/chart/printer.js +26 -16
- package/dist-sdk/src/entities/chart/rebind-owner.d.ts +3 -0
- package/dist-sdk/src/entities/chart/rebind-owner.js +42 -0
- package/dist-sdk/src/entities/chart/to-tf.js +21 -12
- package/dist-sdk/src/entities/dashboard/build.d.ts +4 -0
- package/dist-sdk/src/entities/dashboard/from-tf.js +15 -4
- package/dist-sdk/src/entities/dashboard/to-tf.d.ts +2 -0
- package/dist-sdk/src/entities/dashboard/to-tf.js +13 -0
- package/dist-sdk/src/entities/dashboard-widget/module.js +4 -0
- package/dist-sdk/src/entities/dynamic-layout/build.d.ts +72 -30
- package/dist-sdk/src/entities/dynamic-layout/dialect.d.ts +3 -0
- package/dist-sdk/src/entities/dynamic-layout/dialect.js +5 -0
- package/dist-sdk/src/entities/dynamic-layout/from-tf.d.ts +9 -6
- package/dist-sdk/src/entities/dynamic-layout/from-tf.js +188 -26
- package/dist-sdk/src/entities/dynamic-layout/module.js +4 -1
- package/dist-sdk/src/entities/dynamic-layout/to-tf.d.ts +5 -1
- package/dist-sdk/src/entities/dynamic-layout/to-tf.js +254 -23
- package/dist-sdk/src/entities/element/build.d.ts +33 -13
- package/dist-sdk/src/entities/element/build.js +5 -1
- package/dist-sdk/src/entities/element/from-tf.d.ts +12 -0
- package/dist-sdk/src/entities/element/from-tf.js +64 -3
- package/dist-sdk/src/entities/element/index.d.ts +5 -2
- package/dist-sdk/src/entities/element/index.js +2 -0
- package/dist-sdk/src/entities/element/module.js +11 -3
- package/dist-sdk/src/entities/element/to-tf.js +20 -2
- package/dist-sdk/src/entities/field/build.d.ts +14 -1
- package/dist-sdk/src/entities/field/build.js +3 -0
- package/dist-sdk/src/entities/field/from-tf.d.ts +3 -0
- package/dist-sdk/src/entities/field/from-tf.js +50 -1
- package/dist-sdk/src/entities/field/media-types.d.ts +6 -0
- package/dist-sdk/src/entities/field/media-types.js +30 -0
- package/dist-sdk/src/entities/field/module.js +1 -0
- package/dist-sdk/src/entities/field/to-tf.d.ts +23 -2
- package/dist-sdk/src/entities/field/to-tf.js +142 -22
- package/dist-sdk/src/entities/file-reader/from-tf.js +14 -5
- package/dist-sdk/src/entities/file-reader/module.js +1 -0
- package/dist-sdk/src/entities/file-reader/types.d.ts +2 -0
- package/dist-sdk/src/entities/file-reader/types.js +1 -1
- package/dist-sdk/src/entities/portal/build.d.ts +26 -0
- package/dist-sdk/src/entities/portal/build.js +37 -0
- package/dist-sdk/src/entities/portal/from-tf.d.ts +27 -0
- package/dist-sdk/src/entities/portal/from-tf.js +75 -0
- package/dist-sdk/src/entities/portal/index.d.ts +1 -0
- package/dist-sdk/src/entities/portal/index.js +1 -0
- package/dist-sdk/src/entities/portal/module.d.ts +3 -0
- package/dist-sdk/src/entities/portal/module.js +28 -0
- package/dist-sdk/src/entities/portal/to-tf.d.ts +12 -0
- package/dist-sdk/src/entities/portal/to-tf.js +73 -0
- package/dist-sdk/src/entities/portal/types.d.ts +1 -0
- package/dist-sdk/src/entities/portal/types.js +1 -0
- package/dist-sdk/src/entities/relationship/from-tf.d.ts +8 -1
- package/dist-sdk/src/entities/relationship/from-tf.js +53 -10
- package/dist-sdk/src/entities/relationship/module.js +2 -0
- package/dist-sdk/src/entities/relationship/pair-check.d.ts +7 -0
- package/dist-sdk/src/entities/relationship/pair-check.js +68 -0
- package/dist-sdk/src/entities/relationship/to-tf.d.ts +10 -0
- package/dist-sdk/src/entities/relationship/to-tf.js +31 -13
- package/dist-sdk/src/entities/search-table/module.js +1 -0
- package/dist-sdk/src/entities/search-table/to-tf.d.ts +1 -0
- package/dist-sdk/src/entities/search-table/to-tf.js +1 -1
- package/dist-sdk/src/entities/service-account/build.d.ts +15 -2
- package/dist-sdk/src/entities/service-account/from-tf.d.ts +2 -4
- package/dist-sdk/src/entities/service-account/from-tf.js +17 -5
- package/dist-sdk/src/entities/service-account/role-fidelity.d.ts +56 -0
- package/dist-sdk/src/entities/service-account/role-fidelity.js +243 -0
- package/dist-sdk/src/entities/service-account/to-tf.d.ts +14 -0
- package/dist-sdk/src/entities/service-account/to-tf.js +17 -0
- package/dist-sdk/src/entities/shared/aspect-target-from-tf.d.ts +1 -1
- package/dist-sdk/src/entities/shared/aspect-target-from-tf.js +5 -2
- package/dist-sdk/src/entities/shared/filters/ast.d.ts +15 -2
- package/dist-sdk/src/entities/shared/filters/index.d.ts +25 -2
- package/dist-sdk/src/entities/shared/filters/index.js +38 -5
- package/dist-sdk/src/entities/shared/filters/print.js +31 -3
- package/dist-sdk/src/entities/shared/filters/tf-codec.d.ts +25 -3
- package/dist-sdk/src/entities/shared/filters/tf-codec.js +51 -15
- package/dist-sdk/src/entities/shared/filters/types.d.ts +22 -5
- package/dist-sdk/src/entities/shared/foreign-ref.d.ts +16 -0
- package/dist-sdk/src/entities/shared/foreign-ref.js +17 -1
- package/dist-sdk/src/entities/shared/tool-field-ref.js +6 -9
- package/dist-sdk/src/entities/shared/types/field-types.d.ts +10 -5
- package/dist-sdk/src/entities/shared/types/field-types.js +4 -0
- package/dist-sdk/src/entities/skill/access-policy.d.ts +17 -0
- package/dist-sdk/src/entities/skill/access-policy.js +101 -0
- package/dist-sdk/src/entities/skill/build.d.ts +3 -0
- package/dist-sdk/src/entities/skill/build.js +3 -0
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.d.ts +4 -1
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +23 -1
- package/dist-sdk/src/entities/skill/from-tf.d.ts +2 -0
- package/dist-sdk/src/entities/skill/from-tf.js +70 -22
- package/dist-sdk/src/entities/skill/index.d.ts +2 -0
- package/dist-sdk/src/entities/skill/index.js +1 -0
- package/dist-sdk/src/entities/skill/input-coverage.d.ts +7 -0
- package/dist-sdk/src/entities/skill/input-coverage.js +11 -0
- package/dist-sdk/src/entities/skill/module.js +1 -0
- package/dist-sdk/src/entities/skill/to-tf.d.ts +2 -2
- package/dist-sdk/src/entities/skill/to-tf.js +19 -6
- package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +2 -0
- package/dist-sdk/src/entities/skill-tool/from-tf.js +8 -2
- package/dist-sdk/src/entities/skill-tool/to-tf.d.ts +2 -2
- package/dist-sdk/src/entities/skill-tool/to-tf.js +29 -6
- package/dist-sdk/src/entities/table/catalog.d.ts +14 -0
- package/dist-sdk/src/entities/table/catalog.js +66 -0
- package/dist-sdk/src/entities/table/module.js +2 -1
- package/dist-sdk/src/entities/table/to-tf.js +5 -5
- package/dist-sdk/src/entities/view/agent-view-layout-from-tf.d.ts +89 -0
- package/dist-sdk/src/entities/view/agent-view-layout-from-tf.js +277 -0
- package/dist-sdk/src/entities/view/agent-view-layout-to-tf.d.ts +51 -0
- package/dist-sdk/src/entities/view/agent-view-layout-to-tf.js +360 -0
- package/dist-sdk/src/entities/view/agent-view-layout.d.ts +151 -0
- package/dist-sdk/src/entities/view/agent-view-layout.js +21 -0
- package/dist-sdk/src/entities/view/from-tf.d.ts +6 -3
- package/dist-sdk/src/entities/view/from-tf.js +161 -14
- package/dist-sdk/src/entities/view/module.js +30 -3
- package/dist-sdk/src/entities/view/to-tf.d.ts +24 -2
- package/dist-sdk/src/entities/view/to-tf.js +95 -9
- package/dist-sdk/src/entities/view/types.d.ts +4 -15
- package/dist-sdk/src/entities/view/types.js +17 -15
- package/dist-sdk/src/entities/widget/build.d.ts +16 -1
- package/dist-sdk/src/entities/widget/build.js +11 -1
- package/dist-sdk/src/entities/widget/to-tf.js +36 -10
- package/dist-sdk/src/generated/ragnarok/ragnarok-spec.d.ts +38 -10
- package/dist-sdk/src/generated/ragnarok/ragnarok-spec.js +2 -2
- package/dist-sdk/src/graph/index.d.ts +54 -0
- package/dist-sdk/src/graph/index.js +30 -0
- package/dist-sdk/src/graph/modules.js +2 -0
- package/dist-sdk/src/graph/types.d.ts +133 -2
- package/dist-sdk/src/internal/sdk-package.d.ts +1 -1
- package/dist-sdk/src/internal/sdk-package.js +1 -0
- package/package.json +11 -1
package/README.md
CHANGED
|
@@ -186,17 +186,19 @@ 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
|
-
elementum pull app <namespace> [--root <orgRoot>] [--no-adopt]
|
|
195
|
-
elementum pull element <namespace> [--root <orgRoot>] [--no-adopt]
|
|
194
|
+
elementum pull app <namespace> [--root <orgRoot>] [--no-adopt] [--skip-unsupported-layouts]
|
|
195
|
+
elementum pull element <namespace> [--root <orgRoot>] [--no-adopt] [--skip-unsupported-layouts]
|
|
196
196
|
elementum clone app <namespace> --as <newName> [--namespace <newns>] [--root <orgRoot>]
|
|
197
197
|
elementum build [orgRoot]
|
|
198
198
|
elementum plan [orgRoot-or-nested-target] [--json] [bridge args...]
|
|
199
199
|
elementum apply [orgRoot-or-nested-target] [--json] [bridge args...]
|
|
200
|
+
elementum plan --smart [--base <branch>] [orgRoot-or-nested-target] [bridge args...]
|
|
201
|
+
elementum apply --smart [--base <branch>] [orgRoot-or-nested-target] [-auto-approve] [bridge args...]
|
|
200
202
|
|
|
201
203
|
elementum list apps|elements|users|groups|categories|cloud-links
|
|
202
204
|
elementum list ai-provider-connectors|automations|tables
|
|
@@ -244,7 +246,9 @@ source is currently on disk — the fix for hand-editing an existing file
|
|
|
244
246
|
key) rather than running one of the `new`/`pull`/`clone` commands that
|
|
245
247
|
regenerate the catalog as a side effect of writing a brand-new file. Pass a
|
|
246
248
|
path to scope it to one app/element; omit it to resync the whole workspace.
|
|
247
|
-
It always refreshes the org-level barrel too.
|
|
249
|
+
It always refreshes the org-level barrel too. That barrel is gitignored, so
|
|
250
|
+
run `generate` after cloning for `tsc` and the editor to resolve `@catalog`;
|
|
251
|
+
`build` writes it as well.
|
|
248
252
|
|
|
249
253
|
Coding-agent guidance is packaged separately as
|
|
250
254
|
**playbooks** (Agent Skills-standard `SKILL.md` directories):
|
|
@@ -345,6 +349,9 @@ backend providing platform identity:
|
|
|
345
349
|
resources into the required locking remote backend.
|
|
346
350
|
3. `generated/catalog.ts` is a pure barrel derived from the authored file tree.
|
|
347
351
|
Import app/entity tokens from `@catalog`; import org tokens from `org.ts`.
|
|
352
|
+
The org-root barrel is local derived state: gitignored, and written by
|
|
353
|
+
`build` (and so `plan`/`apply` unless `--skip-build`) or `generate`. Each
|
|
354
|
+
app/element/table's own `generated/catalog.ts` stays committed.
|
|
348
355
|
4. `build` converts TypeScript to the one supported HCL dialect in `.tf/out/`.
|
|
349
356
|
5. OpenTofu resolves references and computes create/update/replace/destroy
|
|
350
357
|
behavior during `plan` and `apply`.
|
|
@@ -400,7 +407,12 @@ export default automation({
|
|
|
400
407
|
The file path supplies the automation ref; `app` is the strongly typed owning app ref.
|
|
401
408
|
`revision` is required SemVer and is the explicit publish gate. Editing
|
|
402
409
|
actions or triggers updates the draft; bump the revision only when that draft
|
|
403
|
-
should be published.
|
|
410
|
+
should be published. `elementum build` warns when an automation's compiled
|
|
411
|
+
steps changed since the last apply but its revision did not. Applies record the
|
|
412
|
+
applied revisions in `applied-automation-revisions.json`, next to
|
|
413
|
+
`terraform.tfstate` in the org root; commit it so the whole team and CI share
|
|
414
|
+
that baseline. Before any apply is recorded, build compares against the
|
|
415
|
+
previous build, kept locally under `.tf/`.
|
|
404
416
|
|
|
405
417
|
## Agent example
|
|
406
418
|
|
|
@@ -461,6 +473,10 @@ Use `--json` for automation and log ingestion. It disables the interactive
|
|
|
461
473
|
spinner/progress renderer and emits technical diagnostics as one JSON object per
|
|
462
474
|
line on stderr; do not parse human-facing stdout as a log stream.
|
|
463
475
|
|
|
476
|
+
A normal `apply` makes the whole org match your working folder. When several
|
|
477
|
+
developers apply work in progress to the same org, use `--smart` instead (see
|
|
478
|
+
[Several developers on one org](#several-developers-on-one-org-smart-apply)).
|
|
479
|
+
|
|
464
480
|
## Identity and state recovery
|
|
465
481
|
|
|
466
482
|
Terraform state is the durable binding between authored labels and live
|
|
@@ -532,9 +548,9 @@ re-binding a changed backend; use the guarded migration command instead.
|
|
|
532
548
|
|
|
533
549
|
Create the backend infrastructure first, then add and review `backend.tf`.
|
|
534
550
|
The migration uses native `tofu init -migrate-state`, takes an ignored recovery
|
|
535
|
-
snapshot, refuses to overwrite unrelated destination state
|
|
536
|
-
|
|
537
|
-
|
|
551
|
+
snapshot, refuses to overwrite unrelated destination state (a never-written
|
|
552
|
+
destination, including the blank snapshot `pg` returns, counts as empty),
|
|
553
|
+
verifies lineage/resources, and removes the obsolete root copy:
|
|
538
554
|
|
|
539
555
|
```sh
|
|
540
556
|
elementum migrate backend <orgRoot> --check
|
|
@@ -543,10 +559,28 @@ elementum migrate backend <orgRoot> --auto-approve
|
|
|
543
559
|
elementum --profile=<profile> plan <orgRoot>
|
|
544
560
|
```
|
|
545
561
|
|
|
562
|
+
OpenTofu assigns a new lineage (serial 1) on the first write to an empty remote
|
|
563
|
+
backend; that copy is accepted as `content-matched` only when resources,
|
|
564
|
+
outputs, and check results are identical to the recovery snapshot, and the
|
|
565
|
+
lineage change is reported as a warning. Once the copy is verified the result
|
|
566
|
+
is `migrated`. A post-migration plan then
|
|
567
|
+
runs as a separate check and is reported under `verification` (`clean`,
|
|
568
|
+
`changes`, `failed`, or `skipped`); pending changes are warnings, not a reason
|
|
569
|
+
to roll back. Limit that plan with repeatable `--verify-target <address>` or
|
|
570
|
+
skip it with `--no-verify-plan` for large workspaces with intentional pending
|
|
571
|
+
changes.
|
|
572
|
+
|
|
546
573
|
For a remote-to-remote change, edit `backend.tf` and run the same migration.
|
|
547
574
|
Use `--reconfigure` only to bind an already-populated destination without
|
|
548
575
|
copying the currently bound state. It is rejected while local committed state
|
|
549
|
-
still exists.
|
|
576
|
+
still exists. When `.tf/out` is still bound to the local backend but no local
|
|
577
|
+
`terraform.tfstate` exists, every mode refuses with "no local state found;
|
|
578
|
+
nothing to migrate". Restore the file from Git, or, only in a checkout that
|
|
579
|
+
merged a completed local-to-remote migration (so the state already lives in the
|
|
580
|
+
declared backend), pass `--reconfigure`. `--reconfigure` first reads the
|
|
581
|
+
declared backend and refuses if it holds no state, because the next apply would
|
|
582
|
+
create a second copy of the org's resources. Pass `--allow-empty-backend` only
|
|
583
|
+
for a new org with nothing applied yet.
|
|
550
584
|
|
|
551
585
|
Recovery snapshots and exact rollback commands are printed on failure and kept
|
|
552
586
|
under `.tf/migration-backups/backend/`. The command updates `.gitignore` but
|
|
@@ -612,6 +646,112 @@ The command sequence and environment contract are identical on a noninteractive
|
|
|
612
646
|
Linux runner when your organization supplies the Linux toolchain artifact;
|
|
613
647
|
the public installer does not yet distribute Linux binaries.
|
|
614
648
|
|
|
649
|
+
When developers also apply from their own branches (below), the deployment job
|
|
650
|
+
should use `apply --smart --base <last applied main commit>` so it never undoes
|
|
651
|
+
their live, unmerged work. Keep that commit somewhere the job can read it —
|
|
652
|
+
for example a git tag the job moves after each successful apply.
|
|
653
|
+
|
|
654
|
+
## Several developers on one org (smart apply)
|
|
655
|
+
|
|
656
|
+
`elementum plan --smart` and `elementum apply --smart` let several developers
|
|
657
|
+
plan and apply against the same org and the same hosted state without undoing
|
|
658
|
+
each other's work. A normal apply makes every item in the org match your
|
|
659
|
+
folder, so applying a branch that lacks a colleague's applied change quietly
|
|
660
|
+
changes it back. A smart apply changes only the items your branch changed.
|
|
661
|
+
|
|
662
|
+
It needs a declared, locking `backend.tf` and the org folder in a git
|
|
663
|
+
repository. Options that would weaken its checks are refused: `-target`,
|
|
664
|
+
`-replace`, `-destroy`, `-refresh-only`, `-out`, `-state`, `-state-out`,
|
|
665
|
+
`-refresh=false`, `-lock=false` and `--skip-build`.
|
|
666
|
+
|
|
667
|
+
### How it works
|
|
668
|
+
|
|
669
|
+
Smart apply compares three versions of every item:
|
|
670
|
+
|
|
671
|
+
- **start** — the build of the commit your branch left the base branch at
|
|
672
|
+
(`git merge-base <base> HEAD`; `--base` defaults to `origin/main`, else
|
|
673
|
+
`main`);
|
|
674
|
+
- **mine** — the build of your working folder, committed or not;
|
|
675
|
+
- **live** — the state file plus OpenTofu's fresh read.
|
|
676
|
+
|
|
677
|
+
Then, for one run:
|
|
678
|
+
|
|
679
|
+
1. Items whose start and mine builds differ are **your items**. Each item's
|
|
680
|
+
`depends_on` wait list is ignored for this comparison.
|
|
681
|
+
2. Every other resource is written with `lifecycle { ignore_changes = all }`
|
|
682
|
+
in that run's generated `.tf/out` only: OpenTofu still reads and links to
|
|
683
|
+
it, but never changes it.
|
|
684
|
+
3. Your items are planned with `-target` and the plan is saved. If the plan
|
|
685
|
+
would touch anything that isn't yours, the apply is refused.
|
|
686
|
+
4. The start build is planned for your items. Anything it reports changed live
|
|
687
|
+
since your branch started — a conflict, unless the shared record shows live,
|
|
688
|
+
as OpenTofu just read it, still holds the settings of your own earlier
|
|
689
|
+
apply.
|
|
690
|
+
5. The saved plan is applied. OpenTofu refuses a saved plan once the state has
|
|
691
|
+
changed, so if another apply lands in between, smart apply starts again (up
|
|
692
|
+
to three times).
|
|
693
|
+
6. Each item the apply changed is added to the shared record, then the same
|
|
694
|
+
after-apply steps as a normal apply run: app TypeScript is refreshed, and
|
|
695
|
+
triggers the platform left without field references are repaired (with one
|
|
696
|
+
more smart attempt when any were).
|
|
697
|
+
7. `.tf/out` is rebuilt normally and the temporary start build
|
|
698
|
+
(`<orgRoot>/.tf/smart/`, git-ignored with the rest of `.tf/`) is removed,
|
|
699
|
+
including after Ctrl-C.
|
|
700
|
+
|
|
701
|
+
| Your item | Result |
|
|
702
|
+
| --- | --- |
|
|
703
|
+
| Changed live since your branch started, by someone else | Refused, naming who |
|
|
704
|
+
| Changed live, and live is still what *you* applied earlier | Applied (you are iterating) |
|
|
705
|
+
| You applied it earlier, but a setting your code sets was since edited outside OpenTofu (Elementum screens) | Refused |
|
|
706
|
+
| Already live exactly as your version | Nothing to do |
|
|
707
|
+
| You changed it, but it was deleted live | Refused |
|
|
708
|
+
| You are adding it, but it already exists live | Refused |
|
|
709
|
+
|
|
710
|
+
Items someone else deleted live that your code still has are handled without
|
|
711
|
+
recreating them: if your items only wait on such an item, it is left out of
|
|
712
|
+
the run; if one of your items — or something your change depends on — really
|
|
713
|
+
uses it, the apply is refused. Items your change depends on that differ live
|
|
714
|
+
from what you tested against are listed as a warning.
|
|
715
|
+
|
|
716
|
+
Two developers changing different settings of the same app (its name and its
|
|
717
|
+
stages, for example) both change the one app item, so the second is refused.
|
|
718
|
+
|
|
719
|
+
OpenTofu prints a warning whenever `-target` is used; smart apply relies on it
|
|
720
|
+
deliberately and its checks cover the case the warning describes.
|
|
721
|
+
|
|
722
|
+
### The shared record: who applied what
|
|
723
|
+
|
|
724
|
+
To tell your own earlier apply from someone else's change — and to name the
|
|
725
|
+
other developer — smart apply keeps a shared record on an HTTP server. Commit
|
|
726
|
+
`<orgRoot>/smart-apply.json`:
|
|
727
|
+
|
|
728
|
+
```json
|
|
729
|
+
{ "records": "https://state.example.com/records/acme" }
|
|
730
|
+
```
|
|
731
|
+
|
|
732
|
+
The address must not contain credentials or query parameters. If the server
|
|
733
|
+
needs a token, set `ELEMENTUM_SMART_RECORDS_TOKEN`; it is sent as
|
|
734
|
+
`Authorization: Bearer <token>`, and only over https (or to this machine).
|
|
735
|
+
|
|
736
|
+
The server holds one JSON document at that address:
|
|
737
|
+
|
|
738
|
+
- `GET` returns the document with a strong `ETag` header, or `404` when
|
|
739
|
+
nothing is recorded yet.
|
|
740
|
+
- `PUT` saves it only when `If-Match` carries the current `ETag` (or
|
|
741
|
+
`If-None-Match: *` for the first save); otherwise it answers `412`, and smart
|
|
742
|
+
apply re-reads, merges its entries and tries again. A `PUT` with neither
|
|
743
|
+
header is refused (`428`). The check and the write
|
|
744
|
+
must be one step, so two overlapping saves can never both succeed.
|
|
745
|
+
|
|
746
|
+
After each apply, every item whose live state changed is recorded with who
|
|
747
|
+
applied it (git `user.name` and `user.email`), the branch, the commit, the time
|
|
748
|
+
and a fingerprint of the settings its code sets as live held them. A failed
|
|
749
|
+
save is a warning, not a failure. `integration/tools/http-records-backend.mjs`
|
|
750
|
+
is a small reference server.
|
|
751
|
+
|
|
752
|
+
Without `smart-apply.json`, smart apply still works, but your own earlier
|
|
753
|
+
applies look like someone else's changes and conflicts cannot name anyone.
|
|
754
|
+
|
|
615
755
|
## Create and update semantics
|
|
616
756
|
|
|
617
757
|
Terraform owns lifecycle decisions; EDK has no second deployment state machine:
|
|
@@ -622,6 +762,11 @@ Terraform owns lifecycle decisions; EDK has no second deployment state machine:
|
|
|
622
762
|
- Resource present in state but absent from built config: destroy.
|
|
623
763
|
- Existing platform resource mapped into state by pull: adopt.
|
|
624
764
|
|
|
765
|
+
With `--smart`, only the developer's own items are planned: other resources
|
|
766
|
+
are protected for that run, and one that someone else deleted is left out
|
|
767
|
+
rather than recreated (see
|
|
768
|
+
[Several developers on one org](#several-developers-on-one-org-smart-apply)).
|
|
769
|
+
|
|
625
770
|
Pull adoption's zero-write gates prevent an existing resource from being
|
|
626
771
|
mistaken for a create. Build diagnostics are part of the safety contract:
|
|
627
772
|
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, 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: {
|
|
@@ -52,6 +52,17 @@ export declare const usersCatalog: {
|
|
|
52
52
|
};
|
|
53
53
|
};
|
|
54
54
|
};
|
|
55
|
+
/** Fixed platform user-group schema used by userGroupSearch filters. */
|
|
56
|
+
export declare const userGroupsCatalog: {
|
|
57
|
+
readonly fields: {
|
|
58
|
+
readonly name: {
|
|
59
|
+
readonly __kind: "userGroupField";
|
|
60
|
+
readonly refName: "name";
|
|
61
|
+
readonly name: "name";
|
|
62
|
+
readonly fieldType: "TEXT";
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
};
|
|
55
66
|
/** Lightweight typed owner token for tests and generated bootstrap code. Prefer the generated catalog in app source. */
|
|
56
67
|
export declare function appRef<const RefName extends string>(refName: RefName, name?: string, namespace?: string): CatalogRef<"app", RefName> & {
|
|
57
68
|
readonly namespace?: string;
|
|
@@ -65,6 +76,7 @@ export declare function taskRef<const RefName extends string>(refName: RefName,
|
|
|
65
76
|
/** An app/element catalog's bags: reference-only kinds plus behavioral kinds sourced from authoring files. */
|
|
66
77
|
interface AppCatalogBags {
|
|
67
78
|
readonly fields?: Record<string, FieldRef>;
|
|
79
|
+
readonly views?: Record<string, ViewRef>;
|
|
68
80
|
readonly searchTables?: Record<string, SearchTableRef>;
|
|
69
81
|
readonly fileReaders?: Record<string, FileReaderCatalogRef>;
|
|
70
82
|
readonly automations?: Record<string, AutomationCatalogRef>;
|
|
@@ -319,6 +331,28 @@ export declare const fieldRef: <const T extends Omit<FieldRef, "__kind" | "refNa
|
|
|
319
331
|
readonly __kind: "field";
|
|
320
332
|
readonly refName: string;
|
|
321
333
|
};
|
|
334
|
+
/** A view entry of a generated catalog: its owner's ref name and the bag that holds it. */
|
|
335
|
+
export interface CatalogViewRefOptions {
|
|
336
|
+
readonly name: string;
|
|
337
|
+
readonly parent: string;
|
|
338
|
+
readonly viewType: ViewType;
|
|
339
|
+
readonly parentKind?: never;
|
|
340
|
+
readonly parentNamespace?: never;
|
|
341
|
+
}
|
|
342
|
+
/** A view of an app or element outside this workspace, by its owner's namespace and its name. */
|
|
343
|
+
export interface OutsideViewRefOptions {
|
|
344
|
+
readonly name: string;
|
|
345
|
+
readonly parentKind: "app" | "element";
|
|
346
|
+
readonly parentNamespace: string;
|
|
347
|
+
readonly parent?: never;
|
|
348
|
+
readonly viewType?: never;
|
|
349
|
+
}
|
|
350
|
+
/**
|
|
351
|
+
* A view by its owner and name. Inside the workspace, use the generated
|
|
352
|
+
* catalog (`catalog.<app>.views.<view>`); for a view of an app or element
|
|
353
|
+
* outside it, pass `{ name, parentKind, parentNamespace }`.
|
|
354
|
+
*/
|
|
355
|
+
export declare function viewRef(opts: CatalogViewRefOptions | OutsideViewRefOptions): ViewRef;
|
|
322
356
|
/**
|
|
323
357
|
* Assemble an app catalog object. Injects `__kind: "app"` so the result
|
|
324
358
|
* satisfies `CatalogRef<"app">` (accepted by aspect-ref parameters) without
|
|
@@ -10,6 +10,12 @@ export const usersCatalog = {
|
|
|
10
10
|
lastName: { __kind: "userField", refName: "lastName", name: "lastName", fieldType: "TEXT" },
|
|
11
11
|
},
|
|
12
12
|
};
|
|
13
|
+
/** Fixed platform user-group schema used by userGroupSearch filters. */
|
|
14
|
+
export const userGroupsCatalog = {
|
|
15
|
+
fields: {
|
|
16
|
+
name: { __kind: "userGroupField", refName: "name", name: "name", fieldType: "TEXT" },
|
|
17
|
+
},
|
|
18
|
+
};
|
|
13
19
|
/** Lightweight typed owner token for tests and generated bootstrap code. Prefer the generated catalog in app source. */
|
|
14
20
|
export function appRef(refName, name = refName, namespace) {
|
|
15
21
|
return { __kind: "app", refName, name, ...(namespace !== undefined ? { namespace } : {}) };
|
|
@@ -290,6 +296,17 @@ export function tableRef(opts) {
|
|
|
290
296
|
* to discriminate per-field value types from a catalog app's `fields` bag.
|
|
291
297
|
*/
|
|
292
298
|
export const fieldRef = (opts) => ({ __kind: "field", ...opts, refName: opts.refName ?? opts.name });
|
|
299
|
+
/**
|
|
300
|
+
* A view by its owner and name. Inside the workspace, use the generated
|
|
301
|
+
* catalog (`catalog.<app>.views.<view>`); for a view of an app or element
|
|
302
|
+
* outside it, pass `{ name, parentKind, parentNamespace }`.
|
|
303
|
+
*/
|
|
304
|
+
export function viewRef(opts) {
|
|
305
|
+
if (opts.parentNamespace !== undefined) {
|
|
306
|
+
return { __kind: "view", refName: opts.name, name: opts.name, parent: opts.parentNamespace, parentKind: opts.parentKind, parentNamespace: opts.parentNamespace };
|
|
307
|
+
}
|
|
308
|
+
return { __kind: "view", refName: opts.name, name: opts.name, parent: opts.parent, viewType: opts.viewType };
|
|
309
|
+
}
|
|
293
310
|
/**
|
|
294
311
|
* Stamp each bag entry's `.handle` to match its own object key — the one place a ref name is
|
|
295
312
|
* actually carried. For field/automation/agent/skill/searchTable bags `injectParent` is the
|
|
@@ -393,6 +410,23 @@ function stampTableRefs(bag) {
|
|
|
393
410
|
}
|
|
394
411
|
return out;
|
|
395
412
|
}
|
|
413
|
+
/** Stamp each view with its key and its owner's identity (see {@link ViewRef}). */
|
|
414
|
+
function stampViewRefs(bag, identity, parentKind) {
|
|
415
|
+
if (bag === undefined)
|
|
416
|
+
return undefined;
|
|
417
|
+
const out = {};
|
|
418
|
+
for (const [refName, ref] of Object.entries(bag)) {
|
|
419
|
+
out[refName] = {
|
|
420
|
+
...ref,
|
|
421
|
+
refName,
|
|
422
|
+
parent: identity.refName,
|
|
423
|
+
parentKind,
|
|
424
|
+
parentName: identity.name,
|
|
425
|
+
...(identity.namespace !== undefined ? { parentNamespace: identity.namespace } : {}),
|
|
426
|
+
};
|
|
427
|
+
}
|
|
428
|
+
return out;
|
|
429
|
+
}
|
|
396
430
|
/**
|
|
397
431
|
* Assemble an app catalog object. Injects `__kind: "app"` so the result
|
|
398
432
|
* satisfies `CatalogRef<"app">` (accepted by aspect-ref parameters) without
|
|
@@ -411,6 +445,7 @@ export function appCatalog(identity, bags) {
|
|
|
411
445
|
...(identity.namespace !== undefined ? { namespace: identity.namespace } : {}),
|
|
412
446
|
...bags,
|
|
413
447
|
fields: stampFieldRefs(bags.fields, identity, "app") ?? {},
|
|
448
|
+
views: stampViewRefs(bags.views, identity, "app") ?? {},
|
|
414
449
|
searchTables: withOwnKeyAsHandle(bags.searchTables, identity.refName) ?? {},
|
|
415
450
|
fileReaders: withOwnKeyAsHandle(bags.fileReaders, identity.refName) ?? {},
|
|
416
451
|
automations: stampOwnedRefs(bags.automations, identity, "app") ?? {},
|
|
@@ -431,6 +466,7 @@ export function elementCatalog(identity, bags) {
|
|
|
431
466
|
...(identity.namespace !== undefined ? { namespace: identity.namespace } : {}),
|
|
432
467
|
...bags,
|
|
433
468
|
fields: stampFieldRefs(bags.fields, identity, "element") ?? {},
|
|
469
|
+
views: stampViewRefs(bags.views, identity, "element") ?? {},
|
|
434
470
|
searchTables: withOwnKeyAsHandle(bags.searchTables, identity.refName) ?? {},
|
|
435
471
|
fileReaders: withOwnKeyAsHandle(bags.fileReaders, identity.refName) ?? {},
|
|
436
472
|
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, } 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 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, usersCatalog, } from "./factories.js";
|
|
12
|
+
export { agentRef, agentEvaluationRef, appRef, appCatalog, approvalChainRef, automationRef, categoryRef, chartRef, dashboardRef, widgetRef, cloudLinkRef, connectorRef, aiProvider, groupRef, linkedSearchTableRef, phoneProviderRef, phoneServiceRef, procedureRef, documentModelFieldRef, documentModelRef, elementCatalog, elementRef, fieldRef, orgCatalog, outputPropertyRef, recordIdentity, searchTableRef, datamineRef, skillRef, storedFunctionRef, tableColumnRef, tableRef, tableSearchTableRef, 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, } 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, usersCatalog, } from "./factories.js";
|
|
12
|
+
export { agentRef, agentEvaluationRef, appRef, appCatalog, approvalChainRef, automationRef, categoryRef, chartRef, dashboardRef, widgetRef, cloudLinkRef, connectorRef, aiProvider, groupRef, linkedSearchTableRef, phoneProviderRef, phoneServiceRef, procedureRef, documentModelFieldRef, documentModelRef, elementCatalog, elementRef, fieldRef, orgCatalog, outputPropertyRef, recordIdentity, searchTableRef, datamineRef, skillRef, storedFunctionRef, tableColumnRef, tableRef, tableSearchTableRef, taskRef, triggerParameterRef, userGroupsCatalog, usersCatalog, viewRef, } from "./factories.js";
|
|
@@ -6,6 +6,44 @@ export declare function writeOrgCatalogFromExtract(root: string, extract: OrgExt
|
|
|
6
6
|
/**
|
|
7
7
|
* Rewrite generated/catalog.ts ALONE from the current file tree — org.ts is
|
|
8
8
|
* untouched (it belongs to `pull org`). Called after a pull writes new
|
|
9
|
-
* authoring (apps/agents) so `@catalog` resolves the fresh entries.
|
|
9
|
+
* authoring (apps/agents) so `@catalog` resolves the fresh entries. While
|
|
10
|
+
* git may still track the barrel, entries it lists are kept even when their
|
|
11
|
+
* folder is not checked out (see {@link refreshCatalogBarrel}).
|
|
10
12
|
*/
|
|
11
13
|
export declare function writeCatalogBarrel(root: string): Promise<string>;
|
|
14
|
+
export declare const ORG_BARREL_IGNORE_COMMENT = "# org catalog barrel \u2014 local derived state, written by elementum build/plan/apply and elementum generate";
|
|
15
|
+
export declare const ORG_BARREL_IGNORE_RULE = "/generated/catalog.ts";
|
|
16
|
+
export interface CatalogBarrelDrift {
|
|
17
|
+
/** `<bag>/<handle>` catalogs on disk that the barrel does not list (all of them when there is no barrel). */
|
|
18
|
+
readonly missing: readonly string[];
|
|
19
|
+
/** `<bag>/<handle>` entries the barrel lists with no catalog on disk. */
|
|
20
|
+
readonly stale: readonly string[];
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Compare generated/catalog.ts against the catalogs `writeCatalogBarrel`
|
|
24
|
+
* would list today. Entries are matched by their `../<bag>/<handle>/generated/catalog.js`
|
|
25
|
+
* path so older barrel renderings compare the same.
|
|
26
|
+
*/
|
|
27
|
+
export declare function findCatalogBarrelDrift(root: string): Promise<CatalogBarrelDrift>;
|
|
28
|
+
export interface CatalogBarrelRefresh extends CatalogBarrelDrift {
|
|
29
|
+
/** There was no barrel in the worktree; one was written. */
|
|
30
|
+
readonly created: boolean;
|
|
31
|
+
readonly written: boolean;
|
|
32
|
+
/** Entries in the barrel after the refresh. */
|
|
33
|
+
readonly entries: number;
|
|
34
|
+
/** `stale` entries were left in place rather than dropped. */
|
|
35
|
+
readonly keptStale: boolean;
|
|
36
|
+
/** Why `stale` entries were kept, when they were. */
|
|
37
|
+
readonly keptReason?: string;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Bring generated/catalog.ts in line with the catalogs on disk when it is
|
|
41
|
+
* absent or lists a different set of entries, and make sure the org
|
|
42
|
+
* .gitignore covers it. While git may still track the barrel, a missing
|
|
43
|
+
* folder may just not be checked out, so entries are only added, never
|
|
44
|
+
* dropped — otherwise a partial tree would commit the very truncation this
|
|
45
|
+
* guards. Every barrel writer shares that rule.
|
|
46
|
+
*/
|
|
47
|
+
export declare function refreshCatalogBarrel(root: string): Promise<CatalogBarrelRefresh>;
|
|
48
|
+
/** Element keys, reserving all app/element catalogs about to be written. */
|
|
49
|
+
export declare function readElementCatalogKeys(root: string, pendingAppHandles?: Iterable<string>, pendingElementHandles?: Iterable<string>): Promise<ReadonlyMap<string, string>>;
|