@elementumai/edk 0.9.6 → 0.9.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +34 -3
- package/dist-sdk/src/catalog/factories.d.ts +26 -6
- package/dist-sdk/src/catalog/factories.js +41 -6
- package/dist-sdk/src/catalog/from-authoring.js +27 -33
- package/dist-sdk/src/catalog/index.d.ts +2 -2
- package/dist-sdk/src/catalog/index.js +2 -2
- package/dist-sdk/src/catalog/org.js +93 -42
- package/dist-sdk/src/catalog/token.js +10 -0
- package/dist-sdk/src/catalog/types.d.ts +42 -3
- package/dist-sdk/src/catalog/types.js +5 -0
- package/dist-sdk/src/core/index.d.ts +2 -2
- package/dist-sdk/src/core/index.js +1 -1
- package/dist-sdk/src/core/platform-id.d.ts +2 -0
- package/dist-sdk/src/core/platform-id.js +4 -0
- package/dist-sdk/src/core/system-fields.d.ts +18 -0
- package/dist-sdk/src/core/system-fields.js +21 -0
- package/dist-sdk/src/core/triggers/on-demand.d.ts +27 -24
- package/dist-sdk/src/core/triggers/on-demand.js +33 -12
- package/dist-sdk/src/core/types/app.d.ts +14 -9
- package/dist-sdk/src/core/types/aspect-category.d.ts +1 -0
- package/dist-sdk/src/core/types/aspect-category.js +1 -0
- package/dist-sdk/src/core/types/platform.d.ts +1 -1
- package/dist-sdk/src/engine/build/context.d.ts +24 -8
- package/dist-sdk/src/engine/build/source-context.d.ts +14 -17
- package/dist-sdk/src/engine/build/source-context.js +1 -1
- package/dist-sdk/src/engine/pull/context.d.ts +18 -0
- package/dist-sdk/src/engine/pull/org.d.ts +4 -0
- package/dist-sdk/src/engine/pull/org.js +17 -2
- package/dist-sdk/src/engine/pull/procedure-refs.d.ts +16 -0
- package/dist-sdk/src/engine/pull/procedure-refs.js +69 -0
- package/dist-sdk/src/engine/pull/ref-only.d.ts +14 -0
- package/dist-sdk/src/engine/pull/ref-only.js +35 -2
- package/dist-sdk/src/engine/tf/expr.js +1 -1
- package/dist-sdk/src/engine/workspace/authoring-layout.d.ts +15 -0
- package/dist-sdk/src/engine/workspace/authoring-layout.js +33 -1
- package/dist-sdk/src/engine/workspace/loader.d.ts +40 -0
- package/dist-sdk/src/engine/workspace/loader.js +328 -0
- package/dist-sdk/src/entities/access-policy/from-tf.d.ts +4 -0
- package/dist-sdk/src/entities/access-policy/from-tf.js +24 -4
- package/dist-sdk/src/entities/access-policy/to-tf.d.ts +7 -0
- package/dist-sdk/src/entities/access-policy/to-tf.js +11 -3
- package/dist-sdk/src/entities/agent/build.d.ts +54 -8
- package/dist-sdk/src/entities/agent/build.js +36 -1
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +144 -3
- package/dist-sdk/src/entities/agent/from-tf.d.ts +7 -6
- package/dist-sdk/src/entities/agent/from-tf.js +176 -5
- package/dist-sdk/src/entities/agent/index.d.ts +2 -2
- package/dist-sdk/src/entities/agent/index.js +1 -1
- package/dist-sdk/src/entities/agent/module.js +1 -0
- package/dist-sdk/src/entities/agent/to-tf.d.ts +5 -4
- package/dist-sdk/src/entities/agent/to-tf.js +186 -11
- package/dist-sdk/src/entities/agent/tools.d.ts +16 -5
- package/dist-sdk/src/entities/agent/tools.js +13 -1
- package/dist-sdk/src/entities/agent-tool/from-tf.d.ts +16 -0
- package/dist-sdk/src/entities/agent-tool/from-tf.js +39 -6
- package/dist-sdk/src/entities/agent-tool/to-tf.d.ts +2 -0
- package/dist-sdk/src/entities/agent-tool/to-tf.js +12 -12
- package/dist-sdk/src/entities/agent-tool/types.js +1 -0
- package/dist-sdk/src/entities/app/build.d.ts +44 -24
- package/dist-sdk/src/entities/app/build.js +18 -8
- package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +15 -0
- package/dist-sdk/src/entities/app/display-blocks-to-layout.d.ts +45 -0
- package/dist-sdk/src/entities/app/display-blocks-to-layout.js +98 -0
- package/dist-sdk/src/entities/app/display-blocks-to-record-create-form.d.ts +55 -0
- package/dist-sdk/src/entities/app/display-blocks-to-record-create-form.js +99 -0
- package/dist-sdk/src/entities/app/from-tf.js +79 -14
- package/dist-sdk/src/entities/app/index.d.ts +3 -2
- package/dist-sdk/src/entities/app/index.js +2 -1
- package/dist-sdk/src/entities/app/to-tf.js +30 -6
- package/dist-sdk/src/entities/automation/build.d.ts +37 -18
- package/dist-sdk/src/entities/automation/build.js +121 -12
- package/dist-sdk/src/entities/automation/catalog-render.js +5 -2
- package/dist-sdk/src/entities/automation/deserializer/ast.d.ts +8 -10
- package/dist-sdk/src/entities/automation/deserializer/print-automation.d.ts +2 -0
- package/dist-sdk/src/entities/automation/deserializer/print-automation.js +103 -20
- package/dist-sdk/src/entities/automation/from-tf.d.ts +10 -1
- package/dist-sdk/src/entities/automation/from-tf.js +1165 -91
- package/dist-sdk/src/entities/automation/index.d.ts +1 -1
- package/dist-sdk/src/entities/automation/module.js +15 -5
- package/dist-sdk/src/entities/automation/operators.d.ts +2 -2
- package/dist-sdk/src/entities/automation/operators.js +1 -0
- package/dist-sdk/src/entities/automation/output-field-types.d.ts +17 -0
- package/dist-sdk/src/entities/automation/output-field-types.js +45 -0
- package/dist-sdk/src/entities/automation/output-key-wire-name.d.ts +20 -4
- package/dist-sdk/src/entities/automation/output-key-wire-name.js +33 -6
- package/dist-sdk/src/entities/automation/script-code.d.ts +1 -1
- package/dist-sdk/src/entities/automation/script-code.js +168 -36
- package/dist-sdk/src/entities/automation/task-label.d.ts +2 -0
- package/dist-sdk/src/entities/automation/task-label.js +18 -0
- package/dist-sdk/src/entities/automation/tasks.d.ts +159 -45
- package/dist-sdk/src/entities/automation/tasks.js +60 -47
- package/dist-sdk/src/entities/automation/to-tf.d.ts +7 -1
- package/dist-sdk/src/entities/automation/to-tf.js +816 -87
- package/dist-sdk/src/entities/automation/triggers.d.ts +14 -5
- package/dist-sdk/src/entities/automation/triggers.js +1 -1
- package/dist-sdk/src/entities/automation/value-ref-tf.d.ts +78 -0
- package/dist-sdk/src/entities/automation/value-ref-tf.js +193 -0
- package/dist-sdk/src/entities/dashboard/from-tf.js +1 -1
- package/dist-sdk/src/entities/dynamic-layout/to-tf.d.ts +1 -0
- package/dist-sdk/src/entities/dynamic-layout/to-tf.js +1 -1
- package/dist-sdk/src/entities/element/build.d.ts +30 -7
- package/dist-sdk/src/entities/element/build.js +7 -3
- package/dist-sdk/src/entities/element/from-tf.js +7 -3
- package/dist-sdk/src/entities/element/index.d.ts +3 -2
- package/dist-sdk/src/entities/element/index.js +3 -2
- package/dist-sdk/src/entities/element/to-tf.js +49 -8
- package/dist-sdk/src/entities/field/build.d.ts +94 -3
- package/dist-sdk/src/entities/field/build.js +82 -3
- package/dist-sdk/src/entities/field/from-tf.d.ts +6 -0
- package/dist-sdk/src/entities/field/from-tf.js +104 -1
- package/dist-sdk/src/entities/field/locals.js +6 -7
- package/dist-sdk/src/entities/field/module.js +1 -0
- package/dist-sdk/src/entities/field/options.d.ts +2 -0
- package/dist-sdk/src/entities/field/options.js +12 -2
- package/dist-sdk/src/entities/field/record-shape.d.ts +12 -15
- package/dist-sdk/src/entities/field/to-tf.d.ts +13 -3
- package/dist-sdk/src/entities/field/to-tf.js +191 -56
- package/dist-sdk/src/entities/field/types.js +2 -0
- package/dist-sdk/src/entities/org/category-ref.d.ts +5 -0
- package/dist-sdk/src/entities/org/category-ref.js +12 -0
- package/dist-sdk/src/entities/record-create-form/from-tf.js +3 -3
- package/dist-sdk/src/entities/record-create-form/to-tf.d.ts +1 -0
- package/dist-sdk/src/entities/record-create-form/to-tf.js +18 -13
- package/dist-sdk/src/entities/relationship/from-tf.js +100 -7
- package/dist-sdk/src/entities/role/from-tf.js +10 -4
- package/dist-sdk/src/entities/search-table/build.d.ts +1 -1
- package/dist-sdk/src/entities/search-table/from-tf.d.ts +1 -0
- package/dist-sdk/src/entities/search-table/from-tf.js +6 -0
- package/dist-sdk/src/entities/search-table/printer.js +3 -1
- package/dist-sdk/src/entities/search-table/to-tf.js +3 -3
- package/dist-sdk/src/entities/search-table/types.js +1 -0
- package/dist-sdk/src/entities/service-account/from-tf.js +10 -4
- package/dist-sdk/src/entities/service-account/to-tf.d.ts +2 -1
- package/dist-sdk/src/entities/service-account/to-tf.js +7 -0
- package/dist-sdk/src/entities/shared/aspect-target-from-tf.d.ts +9 -0
- package/dist-sdk/src/entities/shared/aspect-target-from-tf.js +39 -0
- package/dist-sdk/src/entities/shared/filters/ast.d.ts +24 -1
- package/dist-sdk/src/entities/shared/filters/ast.js +4 -0
- package/dist-sdk/src/entities/shared/filters/tf-codec.d.ts +13 -2
- package/dist-sdk/src/entities/shared/filters/tf-codec.js +14 -8
- package/dist-sdk/src/entities/shared/handle-description.d.ts +12 -0
- package/dist-sdk/src/entities/shared/handle-description.js +20 -0
- package/dist-sdk/src/entities/shared/tool-field-ref.d.ts +5 -3
- package/dist-sdk/src/entities/shared/tool-field-ref.js +11 -16
- package/dist-sdk/src/entities/shared/types/common.d.ts +7 -5
- package/dist-sdk/src/entities/shared/types/field-types.d.ts +6 -1
- package/dist-sdk/src/entities/shared/types/field-types.js +5 -8
- package/dist-sdk/src/entities/shared/types/platform.d.ts +15 -2
- package/dist-sdk/src/entities/skill/build.d.ts +51 -2
- package/dist-sdk/src/entities/skill/build.js +65 -8
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.d.ts +1 -1
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +79 -18
- package/dist-sdk/src/entities/skill/from-tf.d.ts +11 -0
- package/dist-sdk/src/entities/skill/from-tf.js +47 -5
- package/dist-sdk/src/entities/skill/index.d.ts +1 -1
- package/dist-sdk/src/entities/skill/index.js +1 -1
- package/dist-sdk/src/entities/skill/input-coverage.d.ts +89 -0
- package/dist-sdk/src/entities/skill/input-coverage.js +327 -0
- package/dist-sdk/src/entities/skill/module.js +2 -0
- package/dist-sdk/src/entities/skill/to-tf.d.ts +9 -25
- package/dist-sdk/src/entities/skill/to-tf.js +29 -40
- package/dist-sdk/src/entities/skill/tools.d.ts +12 -2
- package/dist-sdk/src/entities/skill/tools.js +3 -6
- package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +19 -0
- package/dist-sdk/src/entities/skill-tool/from-tf.js +50 -14
- package/dist-sdk/src/entities/skill-tool/to-tf.d.ts +9 -7
- package/dist-sdk/src/entities/skill-tool/to-tf.js +29 -23
- package/dist-sdk/src/entities/table/to-tf.js +21 -5
- package/dist-sdk/src/entities/task/to-tf.js +3 -2
- package/dist-sdk/src/entities/view/from-tf.js +36 -10
- package/dist-sdk/src/entities/view/to-tf.d.ts +2 -0
- package/dist-sdk/src/entities/view/to-tf.js +49 -30
- package/dist-sdk/src/entities/visual-flow/from-tf.js +6 -2
- package/dist-sdk/src/entities/widget/from-tf.js +2 -2
- package/dist-sdk/src/entities/widget/to-tf.d.ts +1 -0
- package/dist-sdk/src/entities/widget/to-tf.js +52 -23
- package/dist-sdk/src/graph/index.d.ts +19 -1
- package/dist-sdk/src/graph/index.js +20 -0
- package/dist-sdk/src/graph/types.d.ts +22 -0
- package/package.json +11 -5
|
@@ -42,6 +42,8 @@ export interface PicklistOption {
|
|
|
42
42
|
readonly id: string;
|
|
43
43
|
readonly label: string;
|
|
44
44
|
readonly parentValues?: readonly PicklistOption[];
|
|
45
|
+
readonly active?: boolean;
|
|
46
|
+
readonly icon?: string;
|
|
45
47
|
/**
|
|
46
48
|
* Optional tags on this option. See {@link PicklistOptionTag}
|
|
47
49
|
* for the supported values and what they drive on the platform.
|
|
@@ -212,7 +214,12 @@ export interface NormalizedPicklistDynamicConfig {
|
|
|
212
214
|
readonly relatedAspectId: AppOrElementRef | string;
|
|
213
215
|
readonly relatedLabelFieldId: string | {
|
|
214
216
|
readonly ownerRefName: string;
|
|
217
|
+
readonly ownerKind?: "app" | "element";
|
|
218
|
+
readonly ownerName?: string;
|
|
219
|
+
readonly ownerNamespace?: string;
|
|
215
220
|
readonly fieldKey: string;
|
|
221
|
+
readonly fieldName?: string;
|
|
222
|
+
readonly fieldType?: string;
|
|
216
223
|
};
|
|
217
224
|
/**
|
|
218
225
|
* A field on the SAME owning aspect (not `relatedAspectId`'s target) — the
|
|
@@ -221,16 +228,16 @@ export interface NormalizedPicklistDynamicConfig {
|
|
|
221
228
|
* `fieldKeyFromTfRef`, same as `AppField.parentField`'s sibling mechanism).
|
|
222
229
|
*/
|
|
223
230
|
readonly parentFieldId?: string;
|
|
231
|
+
readonly parentMappings?: readonly {
|
|
232
|
+
readonly parentAspectFieldId: FieldRef | string;
|
|
233
|
+
readonly relatedAspectFieldId: FieldRef | string;
|
|
234
|
+
}[];
|
|
224
235
|
readonly autoRelate?: boolean;
|
|
225
236
|
readonly valuesRenderType?: string;
|
|
226
237
|
readonly filter?: Filter<RefExpr, RefExpr>;
|
|
227
238
|
readonly sort?: Readonly<Record<string, unknown>>;
|
|
228
239
|
}
|
|
229
|
-
/**
|
|
230
|
-
* Only `dynamic` round-trips through the terraform path today — a `static`
|
|
231
|
-
* variant exists on the platform (filter/sort/parentFieldId over a fixed
|
|
232
|
-
* option list) but has no terraform attribute yet (see `field/to-tf.ts`).
|
|
233
|
-
*/
|
|
240
|
+
/** Pulled dynamic configuration. Static dependency metadata is carried on `NormalizedField.parentLinkage`. */
|
|
234
241
|
export interface NormalizedPicklistConfig {
|
|
235
242
|
readonly dynamic?: NormalizedPicklistDynamicConfig;
|
|
236
243
|
}
|
|
@@ -266,10 +273,8 @@ export interface NormalizedPicklistConfig {
|
|
|
266
273
|
* } satisfies PicklistAppField;
|
|
267
274
|
* ```
|
|
268
275
|
*
|
|
269
|
-
* This dependent-option-link mechanism (`parentField`/`parentValues`) is
|
|
270
|
-
*
|
|
271
|
-
* `parentFieldId` (a dynamic picklist's cascading-parent trigger) — see
|
|
272
|
-
* `field/to-tf.ts`'s handling of `relatedParentValues`.
|
|
276
|
+
* This dependent-option-link mechanism (`parentField`/`parentValues`) is
|
|
277
|
+
* distinct from `config.dynamic`'s cascading parent/source-field mappings.
|
|
273
278
|
*/
|
|
274
279
|
export interface PicklistAppFieldBase<Scope extends FieldScope = "unscoped"> extends AspectFieldBase<Scope> {
|
|
275
280
|
readonly options?: Readonly<Record<string, PicklistOption>>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** Re-export — canonical home is `src/entities/shared/types/platform.ts`. */
|
|
2
|
-
export type { Attachment, Employee, Group, Manager,
|
|
2
|
+
export type { Attachment, Employee, Group, Manager, DropdownValue, DynamicDropdownValue, RecordId, RichText, User, } from "../../entities/shared/types/platform.js";
|
|
@@ -22,25 +22,31 @@ export interface ResolvedForeignRoot {
|
|
|
22
22
|
* `"categories"`, …) — the engine never names a specific org identity kind.
|
|
23
23
|
* Entity to-tf passes the bag it authors against.
|
|
24
24
|
*/
|
|
25
|
+
/**
|
|
26
|
+
* A resolved org-identity address. `managed` means the identity is created in
|
|
27
|
+
* this build from `organization.ts` — callers must emit a resource attribute,
|
|
28
|
+
* not a data lookup (a data source can only see something already live).
|
|
29
|
+
*/
|
|
30
|
+
export interface OrgRefResolution {
|
|
31
|
+
readonly tfLabel: string;
|
|
32
|
+
readonly managed?: true;
|
|
33
|
+
}
|
|
25
34
|
export interface OrgRefLookup {
|
|
26
35
|
/** Resolve a root reference according to its graph-declared referenceLookups strategy. */
|
|
27
36
|
resolveForeignRoot(kind: KindId, identity: ForeignRootIdentity, options?: {
|
|
28
37
|
readonly record?: boolean;
|
|
29
38
|
}): ResolvedForeignRoot;
|
|
30
39
|
/**
|
|
31
|
-
* Resolve by org.ts bag key (tsLabel). Records a data block when found
|
|
40
|
+
* Resolve by org.ts bag key (tsLabel). Records a data block when found
|
|
41
|
+
* unless the hit is `managed` (authored in organization.ts this build).
|
|
32
42
|
* Used by token-bearing refs (cloud links, connectors, …).
|
|
33
43
|
*/
|
|
34
|
-
byTsLabel(bag: string, tsLabel: string):
|
|
35
|
-
readonly tfLabel: string;
|
|
36
|
-
} | undefined;
|
|
44
|
+
byTsLabel(bag: string, tsLabel: string): OrgRefResolution | undefined;
|
|
37
45
|
/**
|
|
38
46
|
* Resolve by display name within a bag. Used when authoring carries a plain
|
|
39
47
|
* name (categories today) rather than a catalog token.
|
|
40
48
|
*/
|
|
41
|
-
byName(bag: string, name: string):
|
|
42
|
-
readonly tfLabel: string;
|
|
43
|
-
} | undefined;
|
|
49
|
+
byName(bag: string, name: string): OrgRefResolution | undefined;
|
|
44
50
|
/** Legacy typed convenience routed through app's graph-declared root strategy. */
|
|
45
51
|
foreignApp(tfLabel: string, name: string, namespace?: string): void;
|
|
46
52
|
/**
|
|
@@ -76,10 +82,16 @@ export interface OrgRefLookup {
|
|
|
76
82
|
*/
|
|
77
83
|
foreignField(type: string, tfLabel: string, objectId: TfValue, name: string): void;
|
|
78
84
|
}
|
|
79
|
-
/** A stream root discovered elsewhere in THIS workspace build
|
|
85
|
+
/** A stream root discovered elsewhere in THIS workspace build, keyed by {@link workspaceAspectKey}. */
|
|
80
86
|
export interface WorkspaceAspect {
|
|
81
87
|
readonly kind: ChildResourceScope | "table";
|
|
82
88
|
readonly tfLabel: string;
|
|
89
|
+
/** ACTIVE authored automations owned by this root, keyed by source refName with their display name. */
|
|
90
|
+
readonly activeAutomationNamesByRefName?: ReadonlyMap<string, string>;
|
|
91
|
+
/** Sole on-demand record parameter targeting this same owner, keyed by automation refName, for CURRENT_RECORD widget binding. */
|
|
92
|
+
readonly onDemandRecordParamByAutomationRefName?: ReadonlyMap<string, string>;
|
|
93
|
+
/** Terraform labels of datamines managed by a table in this workspace. */
|
|
94
|
+
readonly managedDatamineLabels?: ReadonlySet<string>;
|
|
83
95
|
}
|
|
84
96
|
/**
|
|
85
97
|
* Key for the `workspaceAspects` map: an app and an element MAY share a
|
|
@@ -98,6 +110,8 @@ export interface ToTfContext {
|
|
|
98
110
|
readonly orgRefs: OrgRefLookup;
|
|
99
111
|
/** Degradations land here — reported by the caller, never silent. */
|
|
100
112
|
readonly diagnostics: string[];
|
|
113
|
+
/** Informational build reports, kept separate from warnings. */
|
|
114
|
+
readonly reports?: string[];
|
|
101
115
|
/**
|
|
102
116
|
* Every app/element stream root discovered in THIS build, keyed by
|
|
103
117
|
* {@link workspaceAspectKey} — lets a cross-aspect reference (e.g. a
|
|
@@ -111,4 +125,6 @@ export interface ToTfContext {
|
|
|
111
125
|
* supply it.
|
|
112
126
|
*/
|
|
113
127
|
readonly workspaceAspects?: ReadonlyMap<string, WorkspaceAspect>;
|
|
128
|
+
/** App-local automations whose workflow_publish block is emitted in this build. */
|
|
129
|
+
readonly activeAutomationRefNames?: ReadonlySet<string>;
|
|
114
130
|
}
|
|
@@ -1,29 +1,26 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Generic "what file is
|
|
3
|
-
*
|
|
2
|
+
* Generic "what file is the workspace loader currently importing, and what is
|
|
3
|
+
* its own on-disk text" context for `elementum build`'s own-file-child loader.
|
|
4
4
|
*
|
|
5
5
|
* Entity-agnostic on purpose: `engine/` may not import from `entities/`
|
|
6
6
|
* (`__tests__/engine/no-entity-types-in-engine.test.ts`), so this exists
|
|
7
7
|
* purely as plumbing — it knows nothing about automations or any other
|
|
8
8
|
* entity kind. An entity module (e.g. `entities/automation/script-code.ts`)
|
|
9
|
-
* that needs
|
|
10
|
-
*
|
|
11
|
-
* imports {@link currentSourceText} from here (entities/
|
|
12
|
-
* the normal direction; only the reverse is forbidden).
|
|
9
|
+
* that needs the file's real text — a `toString()` on a loaded function
|
|
10
|
+
* returns source with every type annotation blanked out by Node's type
|
|
11
|
+
* stripping — imports {@link currentSourceText} from here (entities/
|
|
12
|
+
* importing engine/ is the normal direction; only the reverse is forbidden).
|
|
13
13
|
*
|
|
14
14
|
* State lives on `globalThis` (via a `Symbol.for` registry key), not a plain
|
|
15
15
|
* module-scoped variable, for two independent reasons:
|
|
16
|
-
* - `AsyncLocalStorage` was tried first and rejected:
|
|
17
|
-
*
|
|
18
|
-
* scheduling, which does not reliably propagate ALS continuation context
|
|
19
|
-
* through to where the imported module's top-level code actually runs
|
|
16
|
+
* - `AsyncLocalStorage` was tried first and rejected: the continuation
|
|
17
|
+
* context did not reliably reach the imported module's top-level code
|
|
20
18
|
* (confirmed empirically — that version silently lost context there).
|
|
21
|
-
* - A plain module-scoped variable has a SEPARATE failure mode:
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* (natively-loaded) code holds, so writes through one are invisible to
|
|
19
|
+
* - A plain module-scoped variable has a SEPARATE failure mode: the same
|
|
20
|
+
* module can be instantiated twice in one process whenever something
|
|
21
|
+
* other than plain Node also loads it — Vitest's module runner is the
|
|
22
|
+
* live example, since the workspace loader is externalized and the test
|
|
23
|
+
* file's own imports are not. Writes through one copy are invisible to
|
|
27
24
|
* reads through the other. `globalThis` is the one thing guaranteed
|
|
28
25
|
* shared across however many separate module instances end up loaded in
|
|
29
26
|
* the same process.
|
|
@@ -37,7 +34,7 @@ export interface SourceTextContext {
|
|
|
37
34
|
readonly text: string;
|
|
38
35
|
}
|
|
39
36
|
/**
|
|
40
|
-
* Run `fn` (a
|
|
37
|
+
* Run `fn` (a workspace module import) with `filePath`'s own text available via
|
|
41
38
|
* {@link currentSourceText} for the duration of the returned promise.
|
|
42
39
|
*/
|
|
43
40
|
export declare function withSourceText<T>(filePath: string, text: string, fn: () => Promise<T>): Promise<T>;
|
|
@@ -3,7 +3,7 @@ function slot() {
|
|
|
3
3
|
return globalThis;
|
|
4
4
|
}
|
|
5
5
|
/**
|
|
6
|
-
* Run `fn` (a
|
|
6
|
+
* Run `fn` (a workspace module import) with `filePath`'s own text available via
|
|
7
7
|
* {@link currentSourceText} for the duration of the returned promise.
|
|
8
8
|
*/
|
|
9
9
|
export async function withSourceText(filePath, text, fn) {
|
|
@@ -56,8 +56,24 @@ export interface FromTfContext {
|
|
|
56
56
|
/** `data.<field-type>.<label>` → generated ref-only catalog member. */
|
|
57
57
|
readonly foreignFieldRefsByDataAddress?: ReadonlyMap<string, {
|
|
58
58
|
readonly ownerRefName: string;
|
|
59
|
+
readonly ownerKind?: "app" | "element";
|
|
60
|
+
readonly ownerName?: string;
|
|
61
|
+
readonly ownerNamespace?: string;
|
|
59
62
|
readonly fieldKey: string;
|
|
63
|
+
readonly fieldName?: string;
|
|
64
|
+
readonly fieldType?: string;
|
|
60
65
|
}>;
|
|
66
|
+
/** Lower-cased field display name -> typed field key for each on-disk app/element catalog. */
|
|
67
|
+
readonly fieldNamesByOwnerRefName?: ReadonlyMap<string, ReadonlyMap<string, string>>;
|
|
68
|
+
/**
|
|
69
|
+
* Procedure discriminator (CloudLink + name + database + schema + ordered
|
|
70
|
+
* parameter types, via `procedureDiscriminator` in `pull/procedure-refs.ts`)
|
|
71
|
+
* → the already-pulled org catalog's disambiguated procedure bag key. Lets
|
|
72
|
+
* an automation's Run Function task reconstruct the exact overload
|
|
73
|
+
* `src/catalog/org.ts` assigned instead of the base sanitized name, which
|
|
74
|
+
* only the FIRST same-name procedure under a CloudLink actually owns.
|
|
75
|
+
*/
|
|
76
|
+
readonly procedureKeysByDiscriminator?: ReadonlyMap<string, string>;
|
|
61
77
|
/**
|
|
62
78
|
* Foreign app/element display names this stream saw referenced (currently:
|
|
63
79
|
* a RELATION field's `related_object_id` as a `data.elementum_app`/
|
|
@@ -91,6 +107,8 @@ export interface FromTfContext {
|
|
|
91
107
|
resourcesOfType?(type: string): readonly ImportedResourceRef[];
|
|
92
108
|
/** Degradations land here — reported by the caller, never silent. */
|
|
93
109
|
readonly diagnostics: string[];
|
|
110
|
+
/** Informational extraction reports, kept separate from warnings. */
|
|
111
|
+
readonly reports?: string[];
|
|
94
112
|
/**
|
|
95
113
|
* Resource addresses that must NOT be adopted - nothing in authored
|
|
96
114
|
* source can reproduce them (e.g. a known-but-unimplemented field
|
|
@@ -42,6 +42,8 @@ export interface OrgIdentity {
|
|
|
42
42
|
export interface OrgStoredFunction {
|
|
43
43
|
readonly cloudLinkName: string;
|
|
44
44
|
readonly name: string;
|
|
45
|
+
readonly databaseName: string;
|
|
46
|
+
readonly schemaName: string;
|
|
45
47
|
readonly functionType: string;
|
|
46
48
|
readonly configured: boolean;
|
|
47
49
|
readonly parameterTypes: readonly string[];
|
|
@@ -55,6 +57,8 @@ export interface OrgExtract {
|
|
|
55
57
|
readonly groups: readonly OrgIdentity[];
|
|
56
58
|
readonly phoneProviders: readonly OrgIdentity[];
|
|
57
59
|
readonly storedFunctions?: readonly OrgStoredFunction[];
|
|
60
|
+
/** Non-fatal export anomalies; callers report these and continue the pull. */
|
|
61
|
+
readonly diagnostics?: readonly string[];
|
|
58
62
|
/** The org app directory (namespace → platform id) from locals.org_apps. */
|
|
59
63
|
readonly apps: Readonly<Record<string, string>>;
|
|
60
64
|
}
|
|
@@ -81,14 +81,27 @@ export function extractOrg(doc) {
|
|
|
81
81
|
if (apps === undefined) {
|
|
82
82
|
throw new OrgExtractError("org export stream has no locals.org_apps — is this really an org export?");
|
|
83
83
|
}
|
|
84
|
+
const connectors = withTsLabels(raw.connectors);
|
|
85
|
+
const aiProviders = withTsLabels(raw.aiProviders);
|
|
86
|
+
const providerRefs = new Set(aiProviders.map((provider) => `${provider.resourceType}.${provider.tfLabel}`));
|
|
87
|
+
const diagnostics = connectors.flatMap((connector) => {
|
|
88
|
+
if (connector.providerRef === undefined) {
|
|
89
|
+
return [`connector "${connector.name}" (${connector.tfLabel}) has no resolved provider reference; skipped`];
|
|
90
|
+
}
|
|
91
|
+
const providerRefKey = `${connector.providerRef.resourceType}.${connector.providerRef.tfLabel}`;
|
|
92
|
+
return providerRefs.has(providerRefKey)
|
|
93
|
+
? []
|
|
94
|
+
: [`connector "${connector.name}" (${connector.tfLabel}) references provider "${providerRefKey}" which was not exported; skipped`];
|
|
95
|
+
});
|
|
84
96
|
return {
|
|
85
97
|
cloudLinks: withTsLabels(raw.cloudLinks),
|
|
86
98
|
categories: withTsLabels(raw.categories),
|
|
87
|
-
connectors
|
|
88
|
-
aiProviders
|
|
99
|
+
connectors,
|
|
100
|
+
aiProviders,
|
|
89
101
|
groups: withTsLabels(raw.groups),
|
|
90
102
|
phoneProviders: withTsLabels(raw.phoneProviders),
|
|
91
103
|
storedFunctions,
|
|
104
|
+
diagnostics,
|
|
92
105
|
apps,
|
|
93
106
|
};
|
|
94
107
|
}
|
|
@@ -113,6 +126,8 @@ function requireStoredFunctions(value) {
|
|
|
113
126
|
return {
|
|
114
127
|
cloudLinkName: stringValue("cloud_link_name"),
|
|
115
128
|
name: stringValue("name"),
|
|
129
|
+
databaseName: stringValue("database_name"),
|
|
130
|
+
schemaName: stringValue("schema_name"),
|
|
116
131
|
functionType: stringValue("function_type"),
|
|
117
132
|
configured: row.configured,
|
|
118
133
|
parameterTypes: row.parameter_types,
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CloudLink display name + exact Snowflake signature → one discriminator
|
|
3
|
+
* string. Shared by the org.ts reader below and
|
|
4
|
+
* `entities/automation/from-tf.ts`'s `elementum_stored_function` decode
|
|
5
|
+
* branch — both MUST derive it the same way, or a pulled reference silently
|
|
6
|
+
* resolves to the wrong overload's key.
|
|
7
|
+
*/
|
|
8
|
+
export declare function procedureDiscriminator(cloudLinkName: string, name: string, database: string, schema: string, parameterTypes: readonly string[]): string;
|
|
9
|
+
/**
|
|
10
|
+
* Discriminator → the org catalog's disambiguated procedure bag key, read
|
|
11
|
+
* back from the already-pulled `<orgRoot>/org.ts`. Empty when org.ts is
|
|
12
|
+
* missing or carries no procedures — callers degrade to the base
|
|
13
|
+
* `sanitizeName` key, which is already correct whenever there's no
|
|
14
|
+
* same-name overload to disambiguate.
|
|
15
|
+
*/
|
|
16
|
+
export declare function loadProcedureCatalogKeys(orgRoot: string): Promise<ReadonlyMap<string, string>>;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolve a pulled automation's Run Function `procedure` task to the exact
|
|
3
|
+
* catalog bag key `src/catalog/org.ts` assigned it — `uniqueCatalogKey`
|
|
4
|
+
* there disambiguates same-name overloaded Snowflake procedures with a
|
|
5
|
+
* numeric suffix (`shippingRate`, `shippingRate2`, …) across the WHOLE
|
|
6
|
+
* CloudLink's procedure list, a decision `entities/automation/from-tf.ts`
|
|
7
|
+
* cannot reconstruct from one `data.elementum_stored_function` block alone.
|
|
8
|
+
*
|
|
9
|
+
* `elementum pull app`/`pull element` both require a prior `pull org
|
|
10
|
+
* --data-only` (org.ts is a hard prerequisite), so the already-pulled
|
|
11
|
+
* org.ts always carries the current, authoritative key assignment. Loading
|
|
12
|
+
* it through the same native workspace loader `elementum build` uses for
|
|
13
|
+
* the same file (`engine/build/build.ts`'s `loadOrgRefs`) gives back real
|
|
14
|
+
* `ProcedureRef` objects — no text parsing, no drift from the renderer's
|
|
15
|
+
* exact output format.
|
|
16
|
+
*/
|
|
17
|
+
import { existsSync } from "node:fs";
|
|
18
|
+
import { join } from "node:path";
|
|
19
|
+
import { createWorkspaceLoader } from "../workspace/loader.js";
|
|
20
|
+
/**
|
|
21
|
+
* CloudLink display name + exact Snowflake signature → one discriminator
|
|
22
|
+
* string. Shared by the org.ts reader below and
|
|
23
|
+
* `entities/automation/from-tf.ts`'s `elementum_stored_function` decode
|
|
24
|
+
* branch — both MUST derive it the same way, or a pulled reference silently
|
|
25
|
+
* resolves to the wrong overload's key.
|
|
26
|
+
*/
|
|
27
|
+
export function procedureDiscriminator(cloudLinkName, name, database, schema, parameterTypes) {
|
|
28
|
+
return [cloudLinkName, name, database, schema, parameterTypes.join(",")].join("\0");
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Discriminator → the org catalog's disambiguated procedure bag key, read
|
|
32
|
+
* back from the already-pulled `<orgRoot>/org.ts`. Empty when org.ts is
|
|
33
|
+
* missing or carries no procedures — callers degrade to the base
|
|
34
|
+
* `sanitizeName` key, which is already correct whenever there's no
|
|
35
|
+
* same-name overload to disambiguate.
|
|
36
|
+
*/
|
|
37
|
+
export async function loadProcedureCatalogKeys(orgRoot) {
|
|
38
|
+
const map = new Map();
|
|
39
|
+
const orgPath = join(orgRoot, "org.ts");
|
|
40
|
+
if (!existsSync(orgPath))
|
|
41
|
+
return map;
|
|
42
|
+
let mod;
|
|
43
|
+
try {
|
|
44
|
+
mod = (await createWorkspaceLoader(orgRoot).import(orgPath));
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
// A broken/unparseable org.ts is reported loudly by pull app's own
|
|
48
|
+
// earlier sentinel checks elsewhere; degrade quietly here rather than
|
|
49
|
+
// pile a second failure onto an unrelated resolution step.
|
|
50
|
+
return map;
|
|
51
|
+
}
|
|
52
|
+
for (const cloudLink of Object.values(mod.org?.cloudLinks ?? {})) {
|
|
53
|
+
const cloudLinkName = cloudLink.name;
|
|
54
|
+
if (typeof cloudLinkName !== "string")
|
|
55
|
+
continue;
|
|
56
|
+
for (const [key, procedure] of Object.entries(cloudLink.procedures ?? {})) {
|
|
57
|
+
const { name, databaseName, schemaName, parameterTypes } = procedure;
|
|
58
|
+
if (typeof name !== "string" ||
|
|
59
|
+
typeof databaseName !== "string" ||
|
|
60
|
+
typeof schemaName !== "string" ||
|
|
61
|
+
!Array.isArray(parameterTypes) ||
|
|
62
|
+
!parameterTypes.every((p) => typeof p === "string")) {
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
map.set(procedureDiscriminator(cloudLinkName, name, databaseName, schemaName, parameterTypes), key);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return map;
|
|
69
|
+
}
|
|
@@ -19,6 +19,15 @@ export interface DirectReferenceRoot {
|
|
|
19
19
|
readonly automations: readonly {
|
|
20
20
|
readonly refName: string;
|
|
21
21
|
readonly name: string;
|
|
22
|
+
readonly trigger: readonly {
|
|
23
|
+
readonly refName: string;
|
|
24
|
+
readonly name: string;
|
|
25
|
+
readonly required?: true;
|
|
26
|
+
}[];
|
|
27
|
+
readonly outputs: readonly {
|
|
28
|
+
readonly refName: string;
|
|
29
|
+
readonly name: string;
|
|
30
|
+
}[];
|
|
22
31
|
}[];
|
|
23
32
|
}
|
|
24
33
|
export type UnresolvedReference = UnresolvedReferenceDiagnostic;
|
|
@@ -33,5 +42,10 @@ export interface RefOnlyMetadata {
|
|
|
33
42
|
export declare function readRefOnlyMetadata(doc: TfDocument): RefOnlyMetadata;
|
|
34
43
|
export declare function fieldDataReferenceMap(doc: TfDocument, roots: readonly DirectReferenceRoot[]): ReadonlyMap<string, {
|
|
35
44
|
readonly ownerRefName: string;
|
|
45
|
+
readonly ownerKind?: "app" | "element";
|
|
46
|
+
readonly ownerName?: string;
|
|
47
|
+
readonly ownerNamespace?: string;
|
|
36
48
|
readonly fieldKey: string;
|
|
49
|
+
readonly fieldName?: string;
|
|
50
|
+
readonly fieldType?: string;
|
|
37
51
|
}>;
|
|
@@ -86,7 +86,32 @@ function parseRoot(payload) {
|
|
|
86
86
|
return [];
|
|
87
87
|
const automationName = stringAt(automation, "name");
|
|
88
88
|
const automationRefName = stringAt(automation, "refName");
|
|
89
|
-
|
|
89
|
+
if (automationName === undefined || automationRefName === undefined)
|
|
90
|
+
return [];
|
|
91
|
+
const trigger = (Array.isArray(automation.trigger) ? automation.trigger : []).flatMap((rawParam) => {
|
|
92
|
+
const param = record(rawParam);
|
|
93
|
+
if (param === undefined)
|
|
94
|
+
return [];
|
|
95
|
+
const name = stringAt(param, "name");
|
|
96
|
+
const refName = stringAt(param, "refName");
|
|
97
|
+
return name === undefined || refName === undefined
|
|
98
|
+
? []
|
|
99
|
+
: [{ refName: tfLabelToTsLabel(refName), name, ...(param.required === true ? { required: true } : {}) }];
|
|
100
|
+
});
|
|
101
|
+
const outputs = (Array.isArray(automation.outputs) ? automation.outputs : []).flatMap((rawOutput) => {
|
|
102
|
+
const output = record(rawOutput);
|
|
103
|
+
if (output === undefined)
|
|
104
|
+
return [];
|
|
105
|
+
const name = stringAt(output, "name");
|
|
106
|
+
const refName = stringAt(output, "refName");
|
|
107
|
+
return name === undefined || refName === undefined ? [] : [{ refName: tfLabelToTsLabel(refName), name }];
|
|
108
|
+
});
|
|
109
|
+
return [{
|
|
110
|
+
refName: tfLabelToTsLabel(automationRefName),
|
|
111
|
+
name: automationName,
|
|
112
|
+
trigger,
|
|
113
|
+
outputs,
|
|
114
|
+
}];
|
|
90
115
|
});
|
|
91
116
|
return {
|
|
92
117
|
kind,
|
|
@@ -198,7 +223,15 @@ export function fieldDataReferenceMap(doc, roots) {
|
|
|
198
223
|
const owner = ownerByDataAddress.get(`${ownerExpr.type}.${ownerExpr.label}`);
|
|
199
224
|
const field = owner?.fields.find((candidate) => candidate.name === block.attrs.name);
|
|
200
225
|
if (owner !== undefined && field !== undefined)
|
|
201
|
-
out.set(`${block.type}.${block.label}`, {
|
|
226
|
+
out.set(`${block.type}.${block.label}`, {
|
|
227
|
+
ownerRefName: owner.refName,
|
|
228
|
+
...(owner.kind === "app" || owner.kind === "element" ? { ownerKind: owner.kind } : {}),
|
|
229
|
+
ownerName: owner.name,
|
|
230
|
+
...(owner.namespace !== undefined ? { ownerNamespace: owner.namespace } : {}),
|
|
231
|
+
fieldKey: field.refName,
|
|
232
|
+
fieldName: field.name,
|
|
233
|
+
fieldType: field.fieldType,
|
|
234
|
+
});
|
|
202
235
|
}
|
|
203
236
|
return out;
|
|
204
237
|
}
|
|
@@ -110,9 +110,9 @@ export function parseExpression(src, options = {}) {
|
|
|
110
110
|
}
|
|
111
111
|
const IDENT_RE = /^[A-Za-z_][A-Za-z0-9_-]*/;
|
|
112
112
|
class Parser {
|
|
113
|
+
pos = 0;
|
|
113
114
|
src;
|
|
114
115
|
options;
|
|
115
|
-
pos = 0;
|
|
116
116
|
constructor(src, options) {
|
|
117
117
|
this.src = src;
|
|
118
118
|
this.options = options;
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Driver/helper convention: underscore-prefixed source files are helpers, except
|
|
3
|
+
* digit-leading entity refs where ei's SanitizeName leading `_` survives into the
|
|
4
|
+
* tsLabel (`_1GenerateJson` from `1. Generate JSON`). Those remain discoverable
|
|
5
|
+
* own-file children — see issue #751.
|
|
6
|
+
*/
|
|
7
|
+
export declare function isAuthoringHelperFile(fileName: string): boolean;
|
|
1
8
|
export interface AuthoringTenantContext {
|
|
2
9
|
/** Organization slug from `ei auth` (folder basename). */
|
|
3
10
|
readonly organization: string;
|
|
@@ -11,6 +18,14 @@ export declare function findOrgWorkspaceByTsconfig(startDir: string): string | u
|
|
|
11
18
|
* Example: `elements/tag/tag.ts`, `apps/incident/automations/triage.ts`.
|
|
12
19
|
*/
|
|
13
20
|
export declare function assertRelativeAuthoringPath(relPath: string): void;
|
|
21
|
+
/**
|
|
22
|
+
* True for stream-root authoring files only — `apps/<ref>/<ref>.ts`,
|
|
23
|
+
* `elements/<ref>/<ref>.ts`, or `tables/<ref>/<ref>.ts`. Own-file children
|
|
24
|
+
* under a bag (`automations/`, `agents/`, …) are excluded so catalog
|
|
25
|
+
* regeneration does not treat them as stream roots when passed an app/element
|
|
26
|
+
* directory (issue #751).
|
|
27
|
+
*/
|
|
28
|
+
export declare function isStreamRootAuthoringFile(file: string): boolean;
|
|
14
29
|
/**
|
|
15
30
|
* Org root directory must be `<org>` or `<instance>/<org>` for this tenant.
|
|
16
31
|
*/
|
|
@@ -39,6 +39,20 @@ const CHILD_BAGS = new Set([
|
|
|
39
39
|
]);
|
|
40
40
|
/** Instance folder names used in multi-instance parent workspaces. */
|
|
41
41
|
const INSTANCE_FOLDER_NAMES = new Set(["us", "eu", "stage", "dev", "local"]);
|
|
42
|
+
/**
|
|
43
|
+
* Driver/helper convention: underscore-prefixed source files are helpers, except
|
|
44
|
+
* digit-leading entity refs where ei's SanitizeName leading `_` survives into the
|
|
45
|
+
* tsLabel (`_1GenerateJson` from `1. Generate JSON`). Those remain discoverable
|
|
46
|
+
* own-file children — see issue #751.
|
|
47
|
+
*/
|
|
48
|
+
export function isAuthoringHelperFile(fileName) {
|
|
49
|
+
const base = basename(fileName);
|
|
50
|
+
if (!base.startsWith("_"))
|
|
51
|
+
return false;
|
|
52
|
+
const stem = base.replace(/\.(ts|js|mjs)$/, "");
|
|
53
|
+
// `_1Foo`, `_3_1Bar` — managed entity refs, not helpers.
|
|
54
|
+
return !/^\d/.test(stem.slice(1));
|
|
55
|
+
}
|
|
42
56
|
/** Walk up from `startDir` to the nearest directory that contains `tsconfig.json`. */
|
|
43
57
|
export function findOrgWorkspaceByTsconfig(startDir) {
|
|
44
58
|
let cur = resolve(startDir);
|
|
@@ -65,7 +79,7 @@ export function assertRelativeAuthoringPath(relPath) {
|
|
|
65
79
|
if (!/\.(ts|js|mjs)$/.test(file) || file.endsWith(".d.ts") || file.endsWith(".test.ts")) {
|
|
66
80
|
throw new Error(`Not an entity source file: ${relPath}`);
|
|
67
81
|
}
|
|
68
|
-
if (file
|
|
82
|
+
if (isAuthoringHelperFile(file)) {
|
|
69
83
|
throw new Error(`Not an entity source file: ${relPath}`);
|
|
70
84
|
}
|
|
71
85
|
const stem = file.replace(/\.(ts|js|mjs)$/, "");
|
|
@@ -112,6 +126,24 @@ export function assertRelativeAuthoringPath(relPath) {
|
|
|
112
126
|
}
|
|
113
127
|
throw new Error(`Authoring path is too deep or malformed: ${rel}`);
|
|
114
128
|
}
|
|
129
|
+
/**
|
|
130
|
+
* True for stream-root authoring files only — `apps/<ref>/<ref>.ts`,
|
|
131
|
+
* `elements/<ref>/<ref>.ts`, or `tables/<ref>/<ref>.ts`. Own-file children
|
|
132
|
+
* under a bag (`automations/`, `agents/`, …) are excluded so catalog
|
|
133
|
+
* regeneration does not treat them as stream roots when passed an app/element
|
|
134
|
+
* directory (issue #751).
|
|
135
|
+
*/
|
|
136
|
+
export function isStreamRootAuthoringFile(file) {
|
|
137
|
+
const normalized = resolve(file).replace(/\.(ts|js|mjs)$/, "");
|
|
138
|
+
const parts = normalized.split(sep);
|
|
139
|
+
const rootIdx = Math.max(parts.lastIndexOf("apps"), parts.lastIndexOf("elements"), parts.lastIndexOf("tables"));
|
|
140
|
+
if (rootIdx === -1)
|
|
141
|
+
return false;
|
|
142
|
+
const after = parts.slice(rootIdx);
|
|
143
|
+
if (after.length !== 3)
|
|
144
|
+
return false;
|
|
145
|
+
return after[1] === after[2];
|
|
146
|
+
}
|
|
115
147
|
/**
|
|
116
148
|
* Org root directory must be `<org>` or `<instance>/<org>` for this tenant.
|
|
117
149
|
*/
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolve an installed SDK subpath from the package's ESM export map.
|
|
3
|
+
*
|
|
4
|
+
* The Bun fallback transforms authored ESM to CommonJS. Most imports enter
|
|
5
|
+
* through `jiti.import` and use ESM conditions, but the generated org barrel
|
|
6
|
+
* deliberately uses `createRequire` to break catalog cycles. A per-entity
|
|
7
|
+
* catalog reached through that getter is therefore evaluated on jiti's
|
|
8
|
+
* require path, which cannot resolve this ESM-only package (`exports` has an
|
|
9
|
+
* `import` condition, not `require`). Pointing that one public subpath at its
|
|
10
|
+
* exported file preserves the package boundary without adding a misleading
|
|
11
|
+
* CommonJS export to the SDK.
|
|
12
|
+
*/
|
|
13
|
+
export declare function findInstalledSdkSubpath(root: string, subpath: string): string | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* Upgrade the short-lived #730 barrel shape before Bun/jiti evaluates it.
|
|
16
|
+
* Generated catalogs are CLI-owned, and this writes exactly the lazy-require
|
|
17
|
+
* form emitted by the current generator. Without the migration an existing
|
|
18
|
+
* workspace remains unloadable even after installing the fixed binary.
|
|
19
|
+
*/
|
|
20
|
+
export declare function upgradeGeneratedCatalogForJiti(root: string): void;
|
|
21
|
+
export interface WorkspaceLoader {
|
|
22
|
+
/**
|
|
23
|
+
* Import an authored workspace file. Repeated imports of the same file
|
|
24
|
+
* through the SAME loader return the same module; a new loader re-evaluates.
|
|
25
|
+
*
|
|
26
|
+
* Native imports are serialized process-wide. The generation stamp lives on
|
|
27
|
+
* a process global the resolve hook reads, the same constraint
|
|
28
|
+
* `withSourceText` documents. The generation id is assigned on first
|
|
29
|
+
* `import()`, not on construction, so creating a loader (canvas debounce)
|
|
30
|
+
* cannot change an in-flight graph's stamp.
|
|
31
|
+
*/
|
|
32
|
+
import(file: string): Promise<{
|
|
33
|
+
default?: unknown;
|
|
34
|
+
}>;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* A loader scoped to one org root and one generation. Create one per build —
|
|
38
|
+
* that is what makes a rebuild see edited files.
|
|
39
|
+
*/
|
|
40
|
+
export declare function createWorkspaceLoader(orgRoot: string): WorkspaceLoader;
|