@elementumai/edk 0.9.19 → 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 +146 -6
- package/dist-sdk/src/catalog/factories.d.ts +24 -1
- package/dist-sdk/src/catalog/factories.js +30 -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/render.js +6 -6
- package/dist-sdk/src/catalog/token.js +7 -0
- package/dist-sdk/src/catalog/types.d.ts +34 -1
- package/dist-sdk/src/catalog/types.js +11 -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 +10 -7
- package/dist-sdk/src/engine/pull/result-output.d.ts +6 -0
- package/dist-sdk/src/engine/pull/result-output.js +87 -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 +6 -0
- package/dist-sdk/src/engine/tf/labels.js +9 -0
- package/dist-sdk/src/engine/tf/model.d.ts +22 -1
- package/dist-sdk/src/engine/tf/parse.js +92 -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 +39 -0
- package/dist-sdk/src/engine/validation.js +85 -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.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 +27 -5
- package/dist-sdk/src/entities/app/build.d.ts +89 -20
- package/dist-sdk/src/entities/app/build.js +51 -6
- package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +16 -0
- package/dist-sdk/src/entities/app/from-tf.d.ts +1 -0
- package/dist-sdk/src/entities/app/from-tf.js +7 -2
- package/dist-sdk/src/entities/app/index.d.ts +6 -6
- package/dist-sdk/src/entities/app/index.js +1 -0
- package/dist-sdk/src/entities/app/module.js +5 -2
- package/dist-sdk/src/entities/app/to-tf.js +19 -11
- package/dist-sdk/src/entities/automation/build.d.ts +47 -5
- package/dist-sdk/src/entities/automation/build.js +137 -20
- package/dist-sdk/src/entities/automation/deserializer/print-automation.d.ts +24 -1
- package/dist-sdk/src/entities/automation/deserializer/print-automation.js +314 -39
- package/dist-sdk/src/entities/automation/from-tf.d.ts +28 -6
- package/dist-sdk/src/entities/automation/from-tf.js +428 -48
- 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.js +37 -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.js +4 -0
- package/dist-sdk/src/entities/automation/task-output-labels.d.ts +2 -0
- package/dist-sdk/src/entities/automation/task-output-labels.js +9 -0
- package/dist-sdk/src/entities/automation/tasks.d.ts +24 -2
- 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 +489 -83
- 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/chart/to-tf.js +10 -3
- package/dist-sdk/src/entities/dynamic-layout/build.d.ts +24 -31
- package/dist-sdk/src/entities/element/build.d.ts +25 -13
- package/dist-sdk/src/entities/element/build.js +4 -1
- package/dist-sdk/src/entities/element/from-tf.d.ts +11 -0
- package/dist-sdk/src/entities/element/from-tf.js +58 -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.js +8 -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 +1 -0
- package/dist-sdk/src/entities/field/from-tf.js +39 -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 +130 -14
- 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/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 +8 -0
- package/dist-sdk/src/entities/shared/filters/index.d.ts +2 -0
- package/dist-sdk/src/entities/shared/filters/index.js +14 -4
- package/dist-sdk/src/entities/shared/filters/print.js +17 -1
- package/dist-sdk/src/entities/shared/filters/tf-codec.d.ts +2 -0
- package/dist-sdk/src/entities/shared/filters/tf-codec.js +5 -1
- package/dist-sdk/src/entities/shared/filters/types.d.ts +9 -1
- 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/deserializer/print-skill-v2.js +2 -1
- package/dist-sdk/src/entities/skill/from-tf.js +66 -13
- 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/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 +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 +27 -5
- 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/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 +124 -12
- package/dist-sdk/src/entities/view/module.js +30 -3
- package/dist-sdk/src/entities/view/to-tf.d.ts +14 -1
- package/dist-sdk/src/entities/view/to-tf.js +67 -10
- 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/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 +34 -8
- package/dist-sdk/src/generated/ragnarok/ragnarok-spec.d.ts +16 -5
- package/dist-sdk/src/generated/ragnarok/ragnarok-spec.js +2 -2
- package/dist-sdk/src/graph/index.d.ts +11 -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 +55 -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 +10 -1
package/README.md
CHANGED
|
@@ -186,7 +186,7 @@ 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]
|
|
@@ -197,6 +197,8 @@ elementum clone app <namespace> --as <newName> [--namespace <newns>] [--root <or
|
|
|
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
|
|
@@ -405,7 +407,12 @@ export default automation({
|
|
|
405
407
|
The file path supplies the automation ref; `app` is the strongly typed owning app ref.
|
|
406
408
|
`revision` is required SemVer and is the explicit publish gate. Editing
|
|
407
409
|
actions or triggers updates the draft; bump the revision only when that draft
|
|
408
|
-
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/`.
|
|
409
416
|
|
|
410
417
|
## Agent example
|
|
411
418
|
|
|
@@ -466,6 +473,10 @@ Use `--json` for automation and log ingestion. It disables the interactive
|
|
|
466
473
|
spinner/progress renderer and emits technical diagnostics as one JSON object per
|
|
467
474
|
line on stderr; do not parse human-facing stdout as a log stream.
|
|
468
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
|
+
|
|
469
480
|
## Identity and state recovery
|
|
470
481
|
|
|
471
482
|
Terraform state is the durable binding between authored labels and live
|
|
@@ -537,9 +548,9 @@ re-binding a changed backend; use the guarded migration command instead.
|
|
|
537
548
|
|
|
538
549
|
Create the backend infrastructure first, then add and review `backend.tf`.
|
|
539
550
|
The migration uses native `tofu init -migrate-state`, takes an ignored recovery
|
|
540
|
-
snapshot, refuses to overwrite unrelated destination state
|
|
541
|
-
|
|
542
|
-
|
|
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:
|
|
543
554
|
|
|
544
555
|
```sh
|
|
545
556
|
elementum migrate backend <orgRoot> --check
|
|
@@ -548,10 +559,28 @@ elementum migrate backend <orgRoot> --auto-approve
|
|
|
548
559
|
elementum --profile=<profile> plan <orgRoot>
|
|
549
560
|
```
|
|
550
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
|
+
|
|
551
573
|
For a remote-to-remote change, edit `backend.tf` and run the same migration.
|
|
552
574
|
Use `--reconfigure` only to bind an already-populated destination without
|
|
553
575
|
copying the currently bound state. It is rejected while local committed state
|
|
554
|
-
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.
|
|
555
584
|
|
|
556
585
|
Recovery snapshots and exact rollback commands are printed on failure and kept
|
|
557
586
|
under `.tf/migration-backups/backend/`. The command updates `.gitignore` but
|
|
@@ -617,6 +646,112 @@ The command sequence and environment contract are identical on a noninteractive
|
|
|
617
646
|
Linux runner when your organization supplies the Linux toolchain artifact;
|
|
618
647
|
the public installer does not yet distribute Linux binaries.
|
|
619
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
|
+
|
|
620
755
|
## Create and update semantics
|
|
621
756
|
|
|
622
757
|
Terraform owns lifecycle decisions; EDK has no second deployment state machine:
|
|
@@ -627,6 +762,11 @@ Terraform owns lifecycle decisions; EDK has no second deployment state machine:
|
|
|
627
762
|
- Resource present in state but absent from built config: destroy.
|
|
628
763
|
- Existing platform resource mapped into state by pull: adopt.
|
|
629
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
|
+
|
|
630
770
|
Pull adoption's zero-write gates prevent an existing resource from being
|
|
631
771
|
mistaken for a create. Build diagnostics are part of the safety contract:
|
|
632
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: {
|
|
@@ -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>;
|
|
@@ -330,6 +331,28 @@ export declare const fieldRef: <const T extends Omit<FieldRef, "__kind" | "refNa
|
|
|
330
331
|
readonly __kind: "field";
|
|
331
332
|
readonly refName: string;
|
|
332
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;
|
|
333
356
|
/**
|
|
334
357
|
* Assemble an app catalog object. Injects `__kind: "app"` so the result
|
|
335
358
|
* satisfies `CatalogRef<"app">` (accepted by aspect-ref parameters) without
|
|
@@ -296,6 +296,17 @@ export function tableRef(opts) {
|
|
|
296
296
|
* to discriminate per-field value types from a catalog app's `fields` bag.
|
|
297
297
|
*/
|
|
298
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
|
+
}
|
|
299
310
|
/**
|
|
300
311
|
* Stamp each bag entry's `.handle` to match its own object key — the one place a ref name is
|
|
301
312
|
* actually carried. For field/automation/agent/skill/searchTable bags `injectParent` is the
|
|
@@ -399,6 +410,23 @@ function stampTableRefs(bag) {
|
|
|
399
410
|
}
|
|
400
411
|
return out;
|
|
401
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
|
+
}
|
|
402
430
|
/**
|
|
403
431
|
* Assemble an app catalog object. Injects `__kind: "app"` so the result
|
|
404
432
|
* satisfies `CatalogRef<"app">` (accepted by aspect-ref parameters) without
|
|
@@ -417,6 +445,7 @@ export function appCatalog(identity, bags) {
|
|
|
417
445
|
...(identity.namespace !== undefined ? { namespace: identity.namespace } : {}),
|
|
418
446
|
...bags,
|
|
419
447
|
fields: stampFieldRefs(bags.fields, identity, "app") ?? {},
|
|
448
|
+
views: stampViewRefs(bags.views, identity, "app") ?? {},
|
|
420
449
|
searchTables: withOwnKeyAsHandle(bags.searchTables, identity.refName) ?? {},
|
|
421
450
|
fileReaders: withOwnKeyAsHandle(bags.fileReaders, identity.refName) ?? {},
|
|
422
451
|
automations: stampOwnedRefs(bags.automations, identity, "app") ?? {},
|
|
@@ -437,6 +466,7 @@ export function elementCatalog(identity, bags) {
|
|
|
437
466
|
...(identity.namespace !== undefined ? { namespace: identity.namespace } : {}),
|
|
438
467
|
...bags,
|
|
439
468
|
fields: stampFieldRefs(bags.fields, identity, "element") ?? {},
|
|
469
|
+
views: stampViewRefs(bags.views, identity, "element") ?? {},
|
|
440
470
|
searchTables: withOwnKeyAsHandle(bags.searchTables, identity.refName) ?? {},
|
|
441
471
|
fileReaders: withOwnKeyAsHandle(bags.fileReaders, identity.refName) ?? {},
|
|
442
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, 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 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, 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, 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,10 @@ 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 view's bag decides which resource type backs it when its owner is in
|
|
52
|
+
// the same workspace.
|
|
53
|
+
if (token.__kind === "view" && typeof token.viewType === "string")
|
|
54
|
+
out.viewType = token.viewType;
|
|
51
55
|
// Same reasoning for a file reader: build needs to know which of the
|
|
52
56
|
// excel/json/text/xml/ai resource types backs it to emit the right
|
|
53
57
|
// `elementum_<type>_file_reader.<label>.id` reference - without this,
|
|
@@ -77,6 +81,9 @@ export function slimToken(token) {
|
|
|
77
81
|
(token.__variant === "snowflake" || token.__variant === "linked" || token.__variant === "table")) {
|
|
78
82
|
out.__variant = token.__variant;
|
|
79
83
|
}
|
|
84
|
+
if (token.__kind === "searchTable" && typeof token.id === "string" && token.id !== "") {
|
|
85
|
+
out.id = token.id;
|
|
86
|
+
}
|
|
80
87
|
if (token.__kind === "field" && Array.isArray(token.options)) {
|
|
81
88
|
out.options = token.options.filter((option) => typeof option === "string");
|
|
82
89
|
}
|
|
@@ -36,7 +36,7 @@ import type { AiProviderLlmModel, AiProviderType } from "./ai-provider-models.js
|
|
|
36
36
|
* resolved to the current-version param/output id via the parent
|
|
37
37
|
* automation's state binding.
|
|
38
38
|
*/
|
|
39
|
-
export type CatalogRefKind = "automation" | "agent" | "agent-evaluation" | "chart" | "dashboard" | "widget" | "skill" | "visual-flow" | "approvalChain" | "table" | "tableColumn" | "cloudLink" | "storedFunction" | "procedure" | "field" | "searchTable" | "documentModel" | "documentModelField" | "connector" | "aiProvider" | "category" | "group" | "phoneProvider" | "phone-service" | "datamine" | "app" | "element" | "task" | "triggerParameter" | "outputProperty";
|
|
39
|
+
export type CatalogRefKind = "automation" | "agent" | "agent-evaluation" | "chart" | "dashboard" | "widget" | "skill" | "visual-flow" | "approvalChain" | "table" | "tableColumn" | "cloudLink" | "storedFunction" | "procedure" | "field" | "view" | "searchTable" | "documentModel" | "documentModelField" | "connector" | "aiProvider" | "category" | "group" | "phoneProvider" | "phone-service" | "datamine" | "app" | "element" | "task" | "portal" | "triggerParameter" | "outputProperty";
|
|
40
40
|
/**
|
|
41
41
|
* The reference surface for a catalog entity. `handle` is the stable join key
|
|
42
42
|
* (no id); `name` is for readability/diagnostics, never a match key.
|
|
@@ -116,6 +116,15 @@ export interface TableRef<RefName extends string = string, Columns extends Reado
|
|
|
116
116
|
export interface SearchTableRef<Parent extends string = string, RefName extends string = string> extends CatalogRef<"searchTable", RefName, Parent> {
|
|
117
117
|
/** Display name of a table owner when the reference is outside the workspace. */
|
|
118
118
|
readonly parentName?: string;
|
|
119
|
+
/**
|
|
120
|
+
* Identity of one search table when `name` is not unique on its owner.
|
|
121
|
+
* The id belongs to one organization and only resolves there. A promotion
|
|
122
|
+
* or a fresh org returns Search Table Not Found. Give the rows distinct
|
|
123
|
+
* names when the reference has to move between orgs. Build sends this id
|
|
124
|
+
* on the lookup, where it wins over `name`. Leave it unset when the name
|
|
125
|
+
* is unique.
|
|
126
|
+
*/
|
|
127
|
+
readonly id?: string;
|
|
119
128
|
}
|
|
120
129
|
export type TableOwnedSearchTableRef<Parent extends string = string, RefName extends string = string> = SearchTableRef<Parent, RefName> & {
|
|
121
130
|
readonly __variant: "table";
|
|
@@ -212,6 +221,30 @@ export interface RecordIdentityRef<Target extends AppOrElementRef | TaskCatalogR
|
|
|
212
221
|
readonly name: "Record ID";
|
|
213
222
|
readonly target: Target;
|
|
214
223
|
}
|
|
224
|
+
/** The kinds of managed view an app or element owns, as their authoring bags name them. */
|
|
225
|
+
export declare const viewType: {
|
|
226
|
+
readonly list: "list";
|
|
227
|
+
readonly calendar: "calendar";
|
|
228
|
+
readonly kanban: "kanban";
|
|
229
|
+
readonly dashboard: "dashboard";
|
|
230
|
+
readonly agent: "agent";
|
|
231
|
+
readonly custom: "custom";
|
|
232
|
+
};
|
|
233
|
+
export type ViewType = (typeof viewType)[keyof typeof viewType];
|
|
234
|
+
/**
|
|
235
|
+
* A managed view, by its owner and name (`catalog.<app>.views.<view>`). The
|
|
236
|
+
* owner identity is stamped by `appCatalog`/`elementCatalog`, so a reference
|
|
237
|
+
* from another stream root (a portal's menu) can resolve the view by owner
|
|
238
|
+
* and name without an id.
|
|
239
|
+
*/
|
|
240
|
+
export interface ViewRef<Parent extends string = string, RefName extends string = string> extends CatalogRef<"view", RefName, Parent> {
|
|
241
|
+
readonly parent: Parent;
|
|
242
|
+
/** Which authoring bag holds the view; unset on a view of an owner outside this workspace. */
|
|
243
|
+
readonly viewType?: ViewType;
|
|
244
|
+
readonly parentKind?: "app" | "element";
|
|
245
|
+
readonly parentName?: string;
|
|
246
|
+
readonly parentNamespace?: string;
|
|
247
|
+
}
|
|
215
248
|
/**
|
|
216
249
|
* A field reference. Beyond the shared surface it carries `fieldType` (the
|
|
217
250
|
* platform field type — `"TEXT"`, `"PICKLIST"`, …) so builders can constrain
|