@elementumai/edk 0.9.18 → 0.9.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +154 -9
- package/dist-sdk/src/catalog/factories.d.ts +35 -1
- package/dist-sdk/src/catalog/factories.js +36 -0
- package/dist-sdk/src/catalog/from-authoring.d.ts +13 -8
- package/dist-sdk/src/catalog/from-authoring.js +34 -9
- package/dist-sdk/src/catalog/index.d.ts +2 -2
- package/dist-sdk/src/catalog/index.js +2 -2
- package/dist-sdk/src/catalog/org.d.ts +39 -1
- package/dist-sdk/src/catalog/org.js +460 -50
- package/dist-sdk/src/catalog/render.js +6 -6
- package/dist-sdk/src/catalog/token.js +7 -0
- package/dist-sdk/src/catalog/types.d.ts +44 -1
- package/dist-sdk/src/catalog/types.js +13 -0
- package/dist-sdk/src/core/triggers/on-demand.d.ts +39 -3
- package/dist-sdk/src/core/triggers/on-demand.js +10 -2
- package/dist-sdk/src/engine/build/context.d.ts +1 -1
- package/dist-sdk/src/engine/ei/run.d.ts +149 -0
- package/dist-sdk/src/engine/ei/run.js +1132 -0
- package/dist-sdk/src/engine/logging.d.ts +17 -0
- package/dist-sdk/src/engine/logging.js +18 -0
- package/dist-sdk/src/engine/pull/ref-only.d.ts +5 -0
- package/dist-sdk/src/engine/pull/ref-only.js +64 -27
- package/dist-sdk/src/engine/pull/result-output.d.ts +8 -0
- package/dist-sdk/src/engine/pull/result-output.js +88 -4
- package/dist-sdk/src/engine/tf/expr.js +39 -14
- package/dist-sdk/src/engine/tf/index.d.ts +3 -3
- package/dist-sdk/src/engine/tf/index.js +2 -2
- package/dist-sdk/src/engine/tf/labels.d.ts +8 -0
- package/dist-sdk/src/engine/tf/labels.js +13 -0
- package/dist-sdk/src/engine/tf/model.d.ts +22 -1
- package/dist-sdk/src/engine/tf/parse.d.ts +19 -0
- package/dist-sdk/src/engine/tf/parse.js +197 -10
- package/dist-sdk/src/engine/tf/render.d.ts +4 -2
- package/dist-sdk/src/engine/tf/render.js +41 -7
- package/dist-sdk/src/engine/validation.d.ts +39 -0
- package/dist-sdk/src/engine/validation.js +85 -0
- package/dist-sdk/src/engine/workspace/loader.js +49 -12
- package/dist-sdk/src/entities/access-policy/from-tf.d.ts +11 -1
- package/dist-sdk/src/entities/access-policy/from-tf.js +6 -1
- package/dist-sdk/src/entities/access-policy/to-tf.d.ts +11 -0
- package/dist-sdk/src/entities/access-policy/to-tf.js +16 -6
- package/dist-sdk/src/entities/agent/build.d.ts +4 -16
- package/dist-sdk/src/entities/agent/build.js +40 -5
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +4 -2
- package/dist-sdk/src/entities/agent/to-tf.js +6 -3
- package/dist-sdk/src/entities/agent-tool/from-tf.d.ts +2 -0
- package/dist-sdk/src/entities/agent-tool/from-tf.js +7 -1
- package/dist-sdk/src/entities/agent-tool/to-tf.d.ts +2 -2
- package/dist-sdk/src/entities/agent-tool/to-tf.js +29 -6
- package/dist-sdk/src/entities/app/build.d.ts +98 -19
- package/dist-sdk/src/entities/app/build.js +51 -19
- package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +22 -1
- package/dist-sdk/src/entities/app/from-tf.d.ts +1 -0
- package/dist-sdk/src/entities/app/from-tf.js +11 -5
- package/dist-sdk/src/entities/app/index.d.ts +6 -5
- package/dist-sdk/src/entities/app/index.js +2 -0
- package/dist-sdk/src/entities/app/module.js +18 -2
- package/dist-sdk/src/entities/app/to-tf.js +21 -11
- package/dist-sdk/src/entities/automation/build.d.ts +49 -6
- package/dist-sdk/src/entities/automation/build.js +163 -19
- package/dist-sdk/src/entities/automation/deserializer/print-automation.d.ts +24 -1
- package/dist-sdk/src/entities/automation/deserializer/print-automation.js +320 -39
- package/dist-sdk/src/entities/automation/from-tf.d.ts +28 -6
- package/dist-sdk/src/entities/automation/from-tf.js +563 -74
- package/dist-sdk/src/entities/automation/generated/task-output-contracts.d.ts +33 -0
- package/dist-sdk/src/entities/automation/generated/task-output-contracts.js +183 -0
- package/dist-sdk/src/entities/automation/index.d.ts +2 -2
- package/dist-sdk/src/entities/automation/index.js +1 -1
- package/dist-sdk/src/entities/automation/module.d.ts +2 -0
- package/dist-sdk/src/entities/automation/module.js +93 -8
- package/dist-sdk/src/entities/automation/output-field-types.d.ts +7 -0
- package/dist-sdk/src/entities/automation/output-field-types.js +36 -0
- package/dist-sdk/src/entities/automation/output-key-wire-name.d.ts +9 -0
- package/dist-sdk/src/entities/automation/output-key-wire-name.js +13 -0
- package/dist-sdk/src/entities/automation/script-code.d.ts +17 -0
- package/dist-sdk/src/entities/automation/script-code.js +91 -5
- package/dist-sdk/src/entities/automation/system-ref-name.d.ts +16 -0
- package/dist-sdk/src/entities/automation/system-ref-name.js +48 -0
- package/dist-sdk/src/entities/automation/task-output-labels.d.ts +17 -0
- package/dist-sdk/src/entities/automation/task-output-labels.js +47 -0
- package/dist-sdk/src/entities/automation/tasks.d.ts +53 -4
- package/dist-sdk/src/entities/automation/tasks.js +38 -9
- package/dist-sdk/src/entities/automation/to-tf.d.ts +4 -0
- package/dist-sdk/src/entities/automation/to-tf.js +647 -167
- package/dist-sdk/src/entities/automation/triggers.d.ts +4 -2
- package/dist-sdk/src/entities/automation/triggers.js +4 -0
- package/dist-sdk/src/entities/automation/types.js +1 -0
- package/dist-sdk/src/entities/chart/from-tf.js +33 -17
- package/dist-sdk/src/entities/chart/module.js +3 -1
- package/dist-sdk/src/entities/chart/printer.d.ts +1 -0
- package/dist-sdk/src/entities/chart/printer.js +26 -16
- package/dist-sdk/src/entities/chart/rebind-owner.d.ts +3 -0
- package/dist-sdk/src/entities/chart/rebind-owner.js +42 -0
- package/dist-sdk/src/entities/chart/to-tf.js +21 -12
- package/dist-sdk/src/entities/dashboard/build.d.ts +4 -0
- package/dist-sdk/src/entities/dashboard/from-tf.js +15 -4
- package/dist-sdk/src/entities/dashboard/to-tf.d.ts +2 -0
- package/dist-sdk/src/entities/dashboard/to-tf.js +13 -0
- package/dist-sdk/src/entities/dashboard-widget/module.js +4 -0
- package/dist-sdk/src/entities/dynamic-layout/build.d.ts +72 -30
- package/dist-sdk/src/entities/dynamic-layout/dialect.d.ts +3 -0
- package/dist-sdk/src/entities/dynamic-layout/dialect.js +5 -0
- package/dist-sdk/src/entities/dynamic-layout/from-tf.d.ts +9 -6
- package/dist-sdk/src/entities/dynamic-layout/from-tf.js +188 -26
- package/dist-sdk/src/entities/dynamic-layout/module.js +4 -1
- package/dist-sdk/src/entities/dynamic-layout/to-tf.d.ts +5 -1
- package/dist-sdk/src/entities/dynamic-layout/to-tf.js +254 -23
- package/dist-sdk/src/entities/element/build.d.ts +33 -13
- package/dist-sdk/src/entities/element/build.js +5 -1
- package/dist-sdk/src/entities/element/from-tf.d.ts +12 -0
- package/dist-sdk/src/entities/element/from-tf.js +64 -3
- package/dist-sdk/src/entities/element/index.d.ts +5 -2
- package/dist-sdk/src/entities/element/index.js +2 -0
- package/dist-sdk/src/entities/element/module.js +11 -3
- package/dist-sdk/src/entities/element/to-tf.js +20 -2
- package/dist-sdk/src/entities/field/build.d.ts +14 -1
- package/dist-sdk/src/entities/field/build.js +3 -0
- package/dist-sdk/src/entities/field/from-tf.d.ts +3 -0
- package/dist-sdk/src/entities/field/from-tf.js +50 -1
- package/dist-sdk/src/entities/field/media-types.d.ts +6 -0
- package/dist-sdk/src/entities/field/media-types.js +30 -0
- package/dist-sdk/src/entities/field/module.js +1 -0
- package/dist-sdk/src/entities/field/to-tf.d.ts +23 -2
- package/dist-sdk/src/entities/field/to-tf.js +142 -22
- package/dist-sdk/src/entities/file-reader/from-tf.js +14 -5
- package/dist-sdk/src/entities/file-reader/module.js +1 -0
- package/dist-sdk/src/entities/file-reader/types.d.ts +2 -0
- package/dist-sdk/src/entities/file-reader/types.js +1 -1
- package/dist-sdk/src/entities/portal/build.d.ts +26 -0
- package/dist-sdk/src/entities/portal/build.js +37 -0
- package/dist-sdk/src/entities/portal/from-tf.d.ts +27 -0
- package/dist-sdk/src/entities/portal/from-tf.js +75 -0
- package/dist-sdk/src/entities/portal/index.d.ts +1 -0
- package/dist-sdk/src/entities/portal/index.js +1 -0
- package/dist-sdk/src/entities/portal/module.d.ts +3 -0
- package/dist-sdk/src/entities/portal/module.js +28 -0
- package/dist-sdk/src/entities/portal/to-tf.d.ts +12 -0
- package/dist-sdk/src/entities/portal/to-tf.js +73 -0
- package/dist-sdk/src/entities/portal/types.d.ts +1 -0
- package/dist-sdk/src/entities/portal/types.js +1 -0
- package/dist-sdk/src/entities/relationship/from-tf.d.ts +8 -1
- package/dist-sdk/src/entities/relationship/from-tf.js +53 -10
- package/dist-sdk/src/entities/relationship/module.js +2 -0
- package/dist-sdk/src/entities/relationship/pair-check.d.ts +7 -0
- package/dist-sdk/src/entities/relationship/pair-check.js +68 -0
- package/dist-sdk/src/entities/relationship/to-tf.d.ts +10 -0
- package/dist-sdk/src/entities/relationship/to-tf.js +31 -13
- package/dist-sdk/src/entities/search-table/module.js +1 -0
- package/dist-sdk/src/entities/search-table/to-tf.d.ts +1 -0
- package/dist-sdk/src/entities/search-table/to-tf.js +1 -1
- package/dist-sdk/src/entities/service-account/build.d.ts +15 -2
- package/dist-sdk/src/entities/service-account/from-tf.d.ts +2 -4
- package/dist-sdk/src/entities/service-account/from-tf.js +17 -5
- package/dist-sdk/src/entities/service-account/role-fidelity.d.ts +56 -0
- package/dist-sdk/src/entities/service-account/role-fidelity.js +243 -0
- package/dist-sdk/src/entities/service-account/to-tf.d.ts +14 -0
- package/dist-sdk/src/entities/service-account/to-tf.js +17 -0
- package/dist-sdk/src/entities/shared/aspect-target-from-tf.d.ts +1 -1
- package/dist-sdk/src/entities/shared/aspect-target-from-tf.js +5 -2
- package/dist-sdk/src/entities/shared/filters/ast.d.ts +15 -2
- package/dist-sdk/src/entities/shared/filters/index.d.ts +25 -2
- package/dist-sdk/src/entities/shared/filters/index.js +38 -5
- package/dist-sdk/src/entities/shared/filters/print.js +31 -3
- package/dist-sdk/src/entities/shared/filters/tf-codec.d.ts +25 -3
- package/dist-sdk/src/entities/shared/filters/tf-codec.js +51 -15
- package/dist-sdk/src/entities/shared/filters/types.d.ts +22 -5
- package/dist-sdk/src/entities/shared/foreign-ref.d.ts +16 -0
- package/dist-sdk/src/entities/shared/foreign-ref.js +17 -1
- package/dist-sdk/src/entities/shared/tool-field-ref.js +6 -9
- package/dist-sdk/src/entities/shared/types/field-types.d.ts +10 -5
- package/dist-sdk/src/entities/shared/types/field-types.js +4 -0
- package/dist-sdk/src/entities/skill/access-policy.d.ts +17 -0
- package/dist-sdk/src/entities/skill/access-policy.js +101 -0
- package/dist-sdk/src/entities/skill/build.d.ts +3 -0
- package/dist-sdk/src/entities/skill/build.js +3 -0
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.d.ts +4 -1
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +23 -1
- package/dist-sdk/src/entities/skill/from-tf.d.ts +2 -0
- package/dist-sdk/src/entities/skill/from-tf.js +70 -22
- package/dist-sdk/src/entities/skill/index.d.ts +2 -0
- package/dist-sdk/src/entities/skill/index.js +1 -0
- package/dist-sdk/src/entities/skill/input-coverage.d.ts +7 -0
- package/dist-sdk/src/entities/skill/input-coverage.js +11 -0
- package/dist-sdk/src/entities/skill/module.js +1 -0
- package/dist-sdk/src/entities/skill/to-tf.d.ts +2 -2
- package/dist-sdk/src/entities/skill/to-tf.js +19 -6
- package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +2 -0
- package/dist-sdk/src/entities/skill-tool/from-tf.js +8 -2
- package/dist-sdk/src/entities/skill-tool/to-tf.d.ts +2 -2
- package/dist-sdk/src/entities/skill-tool/to-tf.js +29 -6
- package/dist-sdk/src/entities/table/catalog.d.ts +14 -0
- package/dist-sdk/src/entities/table/catalog.js +66 -0
- package/dist-sdk/src/entities/table/module.js +2 -1
- package/dist-sdk/src/entities/table/to-tf.js +5 -5
- package/dist-sdk/src/entities/view/agent-view-layout-from-tf.d.ts +89 -0
- package/dist-sdk/src/entities/view/agent-view-layout-from-tf.js +277 -0
- package/dist-sdk/src/entities/view/agent-view-layout-to-tf.d.ts +51 -0
- package/dist-sdk/src/entities/view/agent-view-layout-to-tf.js +360 -0
- package/dist-sdk/src/entities/view/agent-view-layout.d.ts +151 -0
- package/dist-sdk/src/entities/view/agent-view-layout.js +21 -0
- package/dist-sdk/src/entities/view/from-tf.d.ts +6 -3
- package/dist-sdk/src/entities/view/from-tf.js +161 -14
- package/dist-sdk/src/entities/view/module.js +30 -3
- package/dist-sdk/src/entities/view/to-tf.d.ts +24 -2
- package/dist-sdk/src/entities/view/to-tf.js +95 -9
- package/dist-sdk/src/entities/view/types.d.ts +4 -15
- package/dist-sdk/src/entities/view/types.js +17 -15
- package/dist-sdk/src/entities/widget/build.d.ts +16 -1
- package/dist-sdk/src/entities/widget/build.js +11 -1
- package/dist-sdk/src/entities/widget/to-tf.js +36 -10
- package/dist-sdk/src/generated/ragnarok/ragnarok-spec.d.ts +38 -10
- package/dist-sdk/src/generated/ragnarok/ragnarok-spec.js +2 -2
- package/dist-sdk/src/graph/index.d.ts +54 -0
- package/dist-sdk/src/graph/index.js +30 -0
- package/dist-sdk/src/graph/modules.js +2 -0
- package/dist-sdk/src/graph/types.d.ts +133 -2
- package/dist-sdk/src/internal/sdk-package.d.ts +1 -1
- package/dist-sdk/src/internal/sdk-package.js +1 -0
- package/package.json +11 -1
|
@@ -67,6 +67,23 @@ export interface BridgeLogEvent {
|
|
|
67
67
|
readonly message: string;
|
|
68
68
|
readonly text_effects?: readonly TextEffect[];
|
|
69
69
|
}
|
|
70
|
+
/**
|
|
71
|
+
* A GraphQL error the bridge read alongside query data: the field at `path` was
|
|
72
|
+
* not read (docs/design/graphql-error-standard.md).
|
|
73
|
+
*/
|
|
74
|
+
export interface PartialReadEvent {
|
|
75
|
+
readonly protocol_version: number;
|
|
76
|
+
readonly sequence: number;
|
|
77
|
+
readonly timestamp: string;
|
|
78
|
+
readonly event: "partial_read";
|
|
79
|
+
readonly operation: string;
|
|
80
|
+
readonly path: readonly (string | number)[];
|
|
81
|
+
readonly code?: string;
|
|
82
|
+
readonly message: string;
|
|
83
|
+
readonly category: "source" | "platform";
|
|
84
|
+
readonly guidance: string;
|
|
85
|
+
}
|
|
86
|
+
export declare function parsePartialReadEvent(line: string): PartialReadEvent | undefined;
|
|
70
87
|
export declare function parseProgressEvent(line: string): ProgressEvent | undefined;
|
|
71
88
|
export declare function parseBridgeLogEvent(line: string): BridgeLogEvent | undefined;
|
|
72
89
|
/** Convert common JS camelCase keys to the contract's flat snake_case keys. */
|
|
@@ -7,6 +7,24 @@ export const LOG_LEVELS = ["DEBUG", "INFO", "WARN", "ERROR"];
|
|
|
7
7
|
export const LOG_COMPONENTS = ["edk", "ei", "provider", "tofu"];
|
|
8
8
|
/** Diagnostic rendering defaults to structured plaintext; JSON is explicit. */
|
|
9
9
|
export const LOG_FORMATS = ["text", "json"];
|
|
10
|
+
export function parsePartialReadEvent(line) {
|
|
11
|
+
try {
|
|
12
|
+
const value = JSON.parse(line);
|
|
13
|
+
if (typeof value !== "object" || value === null)
|
|
14
|
+
return undefined;
|
|
15
|
+
const event = value;
|
|
16
|
+
if (event.protocol_version !== 1 || event.event !== "partial_read" || typeof event.sequence !== "number" ||
|
|
17
|
+
typeof event.timestamp !== "string" || typeof event.operation !== "string" || typeof event.message !== "string" ||
|
|
18
|
+
typeof event.guidance !== "string" || (event.category !== "source" && event.category !== "platform") ||
|
|
19
|
+
!Array.isArray(event.path) || !event.path.every((segment) => typeof segment === "string" || typeof segment === "number") ||
|
|
20
|
+
(event.code !== undefined && typeof event.code !== "string"))
|
|
21
|
+
return undefined;
|
|
22
|
+
return value;
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
return undefined;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
10
28
|
export function parseProgressEvent(line) {
|
|
11
29
|
try {
|
|
12
30
|
const value = JSON.parse(line);
|
|
@@ -33,6 +33,11 @@ export interface DirectReferenceRoot {
|
|
|
33
33
|
readonly refName: string;
|
|
34
34
|
readonly name: string;
|
|
35
35
|
}[];
|
|
36
|
+
/** The owner's AI search tables, keyed as the owner's own export keys them. */
|
|
37
|
+
readonly searchTables?: readonly {
|
|
38
|
+
readonly refName: string;
|
|
39
|
+
readonly name: string;
|
|
40
|
+
}[];
|
|
36
41
|
}
|
|
37
42
|
export type UnresolvedReference = UnresolvedReferenceDiagnostic;
|
|
38
43
|
/** Format the diagnostic suffix printed beside an existing `unsafePlatformId(...)` call. */
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SYSTEM_FIELD_KEY_BY_TAG, systemFieldTag } from "../../core/system-fields.js";
|
|
1
2
|
import { isTfExpr, tfLabelToTsLabel } from "../tf/index.js";
|
|
2
3
|
function singleLineComment(value) {
|
|
3
4
|
return value.replace(/\*\//g, "* /").replace(/\s+/g, " ").trim();
|
|
@@ -39,7 +40,7 @@ function parseRoot(payload) {
|
|
|
39
40
|
const wireRefName = stringAt(obj, "refName");
|
|
40
41
|
if ((kind !== "app" && kind !== "element" && kind !== "table" && kind !== "task") || name === undefined || wireRefName === undefined)
|
|
41
42
|
return undefined;
|
|
42
|
-
const
|
|
43
|
+
const pending = [];
|
|
43
44
|
for (const rawField of Array.isArray(obj.fields) ? obj.fields : []) {
|
|
44
45
|
const field = record(rawField);
|
|
45
46
|
if (field === undefined)
|
|
@@ -51,14 +52,43 @@ function parseRoot(payload) {
|
|
|
51
52
|
continue;
|
|
52
53
|
const tags = Array.isArray(field.tags) && field.tags.every((v) => typeof v === "string") ? field.tags : undefined;
|
|
53
54
|
const options = Array.isArray(field.options) && field.options.every((v) => typeof v === "string") ? field.options : undefined;
|
|
55
|
+
const systemTag = systemFieldTag({ tags });
|
|
56
|
+
const systemKey = systemTag === undefined ? undefined : SYSTEM_FIELD_KEY_BY_TAG[systemTag];
|
|
57
|
+
pending.push({ fieldName, fieldRefName, fieldType, tags, options, systemKey, systemTag });
|
|
58
|
+
}
|
|
59
|
+
// Owning apps print TITLE into systemFields.title and a custom "Title"
|
|
60
|
+
// into fields.title. Ref-only catalogs flatten both into one bag, so the
|
|
61
|
+
// tagged system field must keep the canonical key. The owner does not
|
|
62
|
+
// suffix the custom field (title2), so inventing that key would not match
|
|
63
|
+
// catalog.fields; omit the custom field and diagnose instead.
|
|
64
|
+
const systemKeyByCanonical = new Map();
|
|
65
|
+
for (const field of pending) {
|
|
66
|
+
if (field.systemKey === undefined || field.systemTag === undefined || systemKeyByCanonical.has(field.systemKey))
|
|
67
|
+
continue;
|
|
68
|
+
systemKeyByCanonical.set(field.systemKey, field.systemTag);
|
|
69
|
+
}
|
|
70
|
+
const fields = [];
|
|
71
|
+
const diagnostics = [];
|
|
72
|
+
const emittedSystemKeys = new Set();
|
|
73
|
+
for (const field of pending) {
|
|
74
|
+
const key = field.systemKey ?? tfLabelToTsLabel(field.fieldRefName);
|
|
75
|
+
if (field.systemKey !== undefined) {
|
|
76
|
+
if (emittedSystemKeys.has(field.systemKey))
|
|
77
|
+
continue;
|
|
78
|
+
emittedSystemKeys.add(field.systemKey);
|
|
79
|
+
}
|
|
80
|
+
else if (systemKeyByCanonical.has(key)) {
|
|
81
|
+
diagnostics.push(`ref-only ${kind} "${name}": custom field "${field.fieldName}" (wire ref "${field.fieldRefName}") collides with the ${systemKeyByCanonical.get(key)} system field key "${key}"; omitted it rather than inventing a catalog key the owning app would not use`);
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
54
84
|
fields.push({
|
|
55
85
|
__kind: "field",
|
|
56
|
-
refName:
|
|
57
|
-
name: fieldName,
|
|
86
|
+
refName: key,
|
|
87
|
+
name: field.fieldName,
|
|
58
88
|
parent: tfLabelToTsLabel(wireRefName),
|
|
59
|
-
fieldType,
|
|
60
|
-
...(tags !== undefined && tags.length > 0 ? { tags } : {}),
|
|
61
|
-
...(options !== undefined && options.length > 0 ? { options } : {}),
|
|
89
|
+
fieldType: field.fieldType,
|
|
90
|
+
...(field.tags !== undefined && field.tags.length > 0 ? { tags: field.tags } : {}),
|
|
91
|
+
...(field.options !== undefined && field.options.length > 0 ? { options: field.options } : {}),
|
|
62
92
|
});
|
|
63
93
|
}
|
|
64
94
|
const columns = (Array.isArray(obj.columns) ? obj.columns : []).flatMap((rawColumn) => {
|
|
@@ -113,26 +143,32 @@ function parseRoot(payload) {
|
|
|
113
143
|
outputs,
|
|
114
144
|
}];
|
|
115
145
|
});
|
|
116
|
-
const
|
|
117
|
-
const
|
|
118
|
-
if (
|
|
146
|
+
const namedItems = (raw) => (Array.isArray(raw) ? raw : []).flatMap((rawItem) => {
|
|
147
|
+
const item = record(rawItem);
|
|
148
|
+
if (item === undefined)
|
|
119
149
|
return [];
|
|
120
|
-
const
|
|
121
|
-
const
|
|
122
|
-
return
|
|
150
|
+
const itemName = stringAt(item, "name");
|
|
151
|
+
const itemRefName = stringAt(item, "refName");
|
|
152
|
+
return itemName === undefined || itemRefName === undefined
|
|
123
153
|
? []
|
|
124
|
-
: [{ refName: tfLabelToTsLabel(
|
|
154
|
+
: [{ refName: tfLabelToTsLabel(itemRefName), name: itemName }];
|
|
125
155
|
});
|
|
156
|
+
const skills = namedItems(obj.skills);
|
|
157
|
+
const searchTables = namedItems(obj.searchTables);
|
|
126
158
|
return {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
159
|
+
root: {
|
|
160
|
+
kind,
|
|
161
|
+
refName: tfLabelToTsLabel(wireRefName),
|
|
162
|
+
name,
|
|
163
|
+
...(stringAt(obj, "namespace") !== undefined ? { namespace: stringAt(obj, "namespace") } : {}),
|
|
164
|
+
fields,
|
|
165
|
+
columns,
|
|
166
|
+
datamines,
|
|
167
|
+
automations,
|
|
168
|
+
skills,
|
|
169
|
+
...(searchTables.length > 0 ? { searchTables } : {}),
|
|
170
|
+
},
|
|
171
|
+
diagnostics,
|
|
136
172
|
};
|
|
137
173
|
}
|
|
138
174
|
function parseUnresolved(payload) {
|
|
@@ -164,13 +200,14 @@ export function readRefOnlyMetadata(doc) {
|
|
|
164
200
|
if (typeof value !== "string")
|
|
165
201
|
continue;
|
|
166
202
|
if (key.startsWith("edk_ref_only_")) {
|
|
167
|
-
const
|
|
168
|
-
if (
|
|
169
|
-
|
|
170
|
-
|
|
203
|
+
const parsed = parseRoot(value);
|
|
204
|
+
if (parsed !== undefined) {
|
|
205
|
+
diagnostics.push(...parsed.diagnostics);
|
|
206
|
+
if ((parsed.root.kind === "app" || parsed.root.kind === "element") && (parsed.root.namespace === undefined || parsed.root.namespace === "")) {
|
|
207
|
+
diagnostics.push(`ref-only ${parsed.root.kind} "${parsed.root.name}" is missing its required namespace; catalog materialization was skipped`);
|
|
171
208
|
}
|
|
172
209
|
else {
|
|
173
|
-
roots.push(root);
|
|
210
|
+
roots.push(parsed.root);
|
|
174
211
|
}
|
|
175
212
|
}
|
|
176
213
|
}
|
|
@@ -13,6 +13,8 @@ export interface ManagedResultVerdict {
|
|
|
13
13
|
readonly failed?: boolean;
|
|
14
14
|
readonly skipped?: number;
|
|
15
15
|
readonly gaps?: number;
|
|
16
|
+
/** Live configuration left out of source on request (e.g. `--skip-unsupported-layouts`). */
|
|
17
|
+
readonly omitted?: number;
|
|
16
18
|
}
|
|
17
19
|
export declare function managedResultStatus(operation: string, verdict: ManagedResultVerdict): ManagedResultStatus;
|
|
18
20
|
/**
|
|
@@ -21,4 +23,10 @@ export declare function managedResultStatus(operation: string, verdict: ManagedR
|
|
|
21
23
|
* redirect gets the complete machine-readable result object.
|
|
22
24
|
*/
|
|
23
25
|
export declare function writePullResult(result: unknown, humanLines: readonly PullResultLine[], status?: ManagedResultStatus): void;
|
|
26
|
+
/**
|
|
27
|
+
* Reports partial reads no pull summary took: exports outside `pull` (clone,
|
|
28
|
+
* the refresh after apply) and a pull that failed before its summary. Called
|
|
29
|
+
* once when a CLI command ends.
|
|
30
|
+
*/
|
|
31
|
+
export declare function reportPendingPartialReads(): void;
|
|
24
32
|
export declare function countSummary(entries: readonly (readonly [singular: string, count: number, plural?: string])[]): string;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { takePartialReads } from "../ei/run.js";
|
|
2
|
+
import { flushRepeatedTechnicalLogs, machineReadableLogsEnabled, renderTextEffects, writeTechnicalLog, writeUserOutput } from "../progress.js";
|
|
2
3
|
export function managedResultStatus(operation, verdict) {
|
|
3
4
|
const outcome = verdict.failed === true
|
|
4
5
|
? "failure"
|
|
5
|
-
: (verdict.skipped ?? 0) > 0 || (verdict.gaps ?? 0) > 0
|
|
6
|
+
: (verdict.skipped ?? 0) > 0 || (verdict.gaps ?? 0) > 0 || (verdict.omitted ?? 0) > 0
|
|
6
7
|
? "warning"
|
|
7
8
|
: "success";
|
|
8
9
|
return { operation, outcome };
|
|
@@ -16,11 +17,27 @@ export function writePullResult(result, humanLines, status) {
|
|
|
16
17
|
// Put duplicate-warning summaries before the final success/warning/failure
|
|
17
18
|
// marker, so the marker remains the last diagnostic signal of the command.
|
|
18
19
|
flushRepeatedTechnicalLogs();
|
|
19
|
-
const
|
|
20
|
-
|
|
20
|
+
const reads = takeReads();
|
|
21
|
+
const partialReads = groupPartialReads(reads);
|
|
22
|
+
const detail = partialReadDetail();
|
|
23
|
+
// A partial read means some fields were never read: the pull is incomplete
|
|
24
|
+
// even when everything that was read was written (docs/design/graphql-error-standard.md).
|
|
25
|
+
const effectiveStatus = status !== undefined && status.outcome === "success" && reads.length > 0
|
|
26
|
+
? { ...status, outcome: "warning" }
|
|
27
|
+
: status;
|
|
28
|
+
const resultWithStatus = result !== null && typeof result === "object"
|
|
29
|
+
? {
|
|
30
|
+
...result,
|
|
31
|
+
partialReads,
|
|
32
|
+
...(detail === "verbose" ? { partialReadDetails: reads } : {}),
|
|
33
|
+
...(reads.length > 0 && "exportComplete" in result ? { exportComplete: false } : {}),
|
|
34
|
+
...(effectiveStatus === undefined ? {} : { status: effectiveStatus.outcome }),
|
|
35
|
+
}
|
|
21
36
|
: result;
|
|
37
|
+
status = effectiveStatus;
|
|
22
38
|
if (process.stdout.isTTY === true && !machineReadableLogsEnabled()) {
|
|
23
39
|
const renderedLines = humanLines.flatMap((line) => Array.isArray(line) && line.length === 0 ? [] : [renderPullResultLine(line)]);
|
|
40
|
+
renderedLines.push(...partialReadLines(reads, detail));
|
|
24
41
|
if (status !== undefined) {
|
|
25
42
|
const message = status.outcome === "success"
|
|
26
43
|
? `${status.operation} completed successfully`
|
|
@@ -47,6 +64,73 @@ export function writePullResult(result, humanLines, status) {
|
|
|
47
64
|
}
|
|
48
65
|
process.stdout.write(`${JSON.stringify(resultWithStatus, null, 2)}\n`);
|
|
49
66
|
}
|
|
67
|
+
/**
|
|
68
|
+
* Reports partial reads no pull summary took: exports outside `pull` (clone,
|
|
69
|
+
* the refresh after apply) and a pull that failed before its summary. Called
|
|
70
|
+
* once when a CLI command ends.
|
|
71
|
+
*/
|
|
72
|
+
export function reportPendingPartialReads() {
|
|
73
|
+
const reads = takeReads();
|
|
74
|
+
partialReadLines(reads, partialReadDetail()).forEach((line, index) => {
|
|
75
|
+
if (machineReadableLogsEnabled())
|
|
76
|
+
writeTechnicalLog("WARN", "edk", line);
|
|
77
|
+
else
|
|
78
|
+
console.error(index === 0 ? `Warning: ${line}` : line);
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
function takeReads() {
|
|
82
|
+
return takePartialReads().map(({ operation, path, code, message, category, guidance }) => ({ operation, path, ...(code === undefined ? {} : { code }), message, category, guidance }));
|
|
83
|
+
}
|
|
84
|
+
/** The human lines for partial reads at a detail level; off hides the listing, not the fact. */
|
|
85
|
+
function partialReadLines(reads, detail) {
|
|
86
|
+
if (reads.length === 0)
|
|
87
|
+
return [];
|
|
88
|
+
if (detail === "verbose") {
|
|
89
|
+
return reads.flatMap((read) => [
|
|
90
|
+
`Incomplete read of ${pathText(read.path)} in ${read.operation}: ${read.message}`,
|
|
91
|
+
` [${read.category}] ${read.guidance}`,
|
|
92
|
+
]);
|
|
93
|
+
}
|
|
94
|
+
if (detail === "summary") {
|
|
95
|
+
const groups = groupPartialReads(reads);
|
|
96
|
+
const allPlatform = groups.every((group) => group.category === "platform");
|
|
97
|
+
return [
|
|
98
|
+
`${reads.length} field(s) were not read (${groups.length} kind(s)${allPlatform ? ", platform-side" : ""}); rerun with --partial-reads=verbose for every path:`,
|
|
99
|
+
...groups.map((group) => ` - ${group.field} in ${group.operation} (${group.count}) [${group.category}] ${group.guidance}`),
|
|
100
|
+
];
|
|
101
|
+
}
|
|
102
|
+
return [`${reads.length} field(s) were not read; rerun with --partial-reads=summary to see which`];
|
|
103
|
+
}
|
|
104
|
+
function partialReadDetail() {
|
|
105
|
+
const value = process.env["ELEMENTUM_PARTIAL_READS"]?.toLowerCase();
|
|
106
|
+
return value === "off" || value === "verbose" ? value : "summary";
|
|
107
|
+
}
|
|
108
|
+
/** One entry per operation and field (list indexes ignored), in first-seen order. */
|
|
109
|
+
function groupPartialReads(reads) {
|
|
110
|
+
const groups = new Map();
|
|
111
|
+
for (const read of reads) {
|
|
112
|
+
const field = read.path.map((segment) => typeof segment === "number" ? "[]" : segment).join(".").replace(/\.\[\]/g, "[]");
|
|
113
|
+
const key = `${read.operation}\u0000${field}`;
|
|
114
|
+
const group = groups.get(key);
|
|
115
|
+
if (group !== undefined) {
|
|
116
|
+
group.count += 1;
|
|
117
|
+
continue;
|
|
118
|
+
}
|
|
119
|
+
groups.set(key, {
|
|
120
|
+
operation: read.operation,
|
|
121
|
+
field,
|
|
122
|
+
count: 1,
|
|
123
|
+
...(read.code === undefined ? {} : { code: read.code }),
|
|
124
|
+
message: read.message,
|
|
125
|
+
category: read.category,
|
|
126
|
+
guidance: read.guidance,
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
return [...groups.values()];
|
|
130
|
+
}
|
|
131
|
+
function pathText(path) {
|
|
132
|
+
return path.map((segment, index) => typeof segment === "number" ? `[${segment}]` : `${index === 0 ? "" : "."}${segment}`).join("");
|
|
133
|
+
}
|
|
50
134
|
function renderPullResultLine(line) {
|
|
51
135
|
if (typeof line === "string")
|
|
52
136
|
return line;
|
|
@@ -98,6 +98,17 @@ function skipQuotedString(s, openQuote) {
|
|
|
98
98
|
}
|
|
99
99
|
throw new TfExprError("unterminated string literal", s);
|
|
100
100
|
}
|
|
101
|
+
function hasLiveInterpolation(rawInner) {
|
|
102
|
+
for (let i = 0; i < rawInner.length; i++) {
|
|
103
|
+
if (rawInner.startsWith("$${", i) || rawInner.startsWith("%%{", i)) {
|
|
104
|
+
i += 2;
|
|
105
|
+
continue;
|
|
106
|
+
}
|
|
107
|
+
if (rawInner.startsWith("${", i) || rawInner.startsWith("%{", i))
|
|
108
|
+
return true;
|
|
109
|
+
}
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
101
112
|
/** Parse the inside of a ${...} interpolation. */
|
|
102
113
|
export function parseExpression(src, options = {}) {
|
|
103
114
|
const p = new Parser(src, options);
|
|
@@ -179,7 +190,7 @@ class Parser {
|
|
|
179
190
|
}
|
|
180
191
|
if (first === "var") {
|
|
181
192
|
if (this.options.allowVariables !== true) {
|
|
182
|
-
throw new TfExprError("Terraform variables are only supported in modeled credential attributes", this.src);
|
|
193
|
+
throw new TfExprError("Terraform variables are only supported in modeled credential attributes and write-only API secrets", this.src);
|
|
183
194
|
}
|
|
184
195
|
this.expect(".");
|
|
185
196
|
const name = this.takeIdent();
|
|
@@ -236,7 +247,7 @@ class Parser {
|
|
|
236
247
|
if (c === "[")
|
|
237
248
|
return this.parseArrayLiteral();
|
|
238
249
|
if (c === '"')
|
|
239
|
-
return this.
|
|
250
|
+
return this.parseQuotedValue();
|
|
240
251
|
if (c === "-" || (c !== undefined && c >= "0" && c <= "9"))
|
|
241
252
|
return this.parseNumber();
|
|
242
253
|
const identStart = this.pos;
|
|
@@ -296,6 +307,26 @@ class Parser {
|
|
|
296
307
|
}
|
|
297
308
|
return Number(m[0]);
|
|
298
309
|
}
|
|
310
|
+
/**
|
|
311
|
+
* A payload value may be a template — the renderer writes one for a
|
|
312
|
+
* reference embedded in jsonencoded text (`"variable|${…id}"`). It parses
|
|
313
|
+
* to a template expression, never to literal text.
|
|
314
|
+
*/
|
|
315
|
+
parseQuotedValue() {
|
|
316
|
+
const start = this.pos;
|
|
317
|
+
const end = skipQuotedString(this.src, this.pos);
|
|
318
|
+
const rawInner = this.src.slice(this.pos + 1, end - 1);
|
|
319
|
+
if (!hasLiveInterpolation(rawInner))
|
|
320
|
+
return this.parseQuotedString();
|
|
321
|
+
this.pos = end;
|
|
322
|
+
try {
|
|
323
|
+
return parseStringValue(decodeStringEscapes(rawInner, this.src), this.options);
|
|
324
|
+
}
|
|
325
|
+
catch (error) {
|
|
326
|
+
this.pos = start;
|
|
327
|
+
throw error;
|
|
328
|
+
}
|
|
329
|
+
}
|
|
299
330
|
parseQuotedString() {
|
|
300
331
|
if (this.peek() !== '"') {
|
|
301
332
|
throw new TfExprError(`expected string at "${this.rest().slice(0, 20)}"`, this.src);
|
|
@@ -303,18 +334,12 @@ class Parser {
|
|
|
303
334
|
const end = skipQuotedString(this.src, this.pos);
|
|
304
335
|
const rawInner = this.src.slice(this.pos + 1, end - 1);
|
|
305
336
|
this.pos = end;
|
|
306
|
-
// Live interpolations
|
|
307
|
-
//
|
|
308
|
-
//
|
|
309
|
-
//
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
i += 2;
|
|
313
|
-
continue;
|
|
314
|
-
}
|
|
315
|
-
if (rawInner.startsWith("${", i) || rawInner.startsWith("%{", i)) {
|
|
316
|
-
throw new TfExprError("interpolation inside an expression string is outside the supported grammar", this.src);
|
|
317
|
-
}
|
|
337
|
+
// Live interpolations in keys and indexes (a dynamic index key, a
|
|
338
|
+
// computed object key) are OUTSIDE the closed grammar — silently
|
|
339
|
+
// literalizing them would change semantics while the structural
|
|
340
|
+
// round-trip stayed green. Loud instead.
|
|
341
|
+
if (hasLiveInterpolation(rawInner)) {
|
|
342
|
+
throw new TfExprError("interpolation inside an expression string is outside the supported grammar", this.src);
|
|
318
343
|
}
|
|
319
344
|
// Every string crossing the parse boundary follows the same rule:
|
|
320
345
|
// standard escapes decode, then template escapes decode (render is the
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
* A second dialect must not exist: extractors consume TfBlock from parseHcl;
|
|
4
4
|
* toHcl emitters produce TfBlock rendered by renderDocument.
|
|
5
5
|
*/
|
|
6
|
-
export type { PathSeg, TfBlock, TfBlockKind, TfDocument, TfExpr, TfValue } from "./model.js";
|
|
6
|
+
export type { PathSeg, TfBlock, TfBlockKind, TfDocument, TfExpr, TfLifecycle, TfValue, TfVariableValidation } from "./model.js";
|
|
7
7
|
export { expr, isTfExpr } from "./model.js";
|
|
8
8
|
export { decodeTemplateEscapes, encodeTemplateEscapes, quoteHclString } from "./escape.js";
|
|
9
9
|
export { parseExpression, parseStringValue, TfExprError } from "./expr.js";
|
|
10
|
-
export { assertNoUnsafeIntegers, inspectBackendHcl, parseHcl, TfParseError, type BackendHclInspection, } from "./parse.js";
|
|
10
|
+
export { assertNoUnsafeIntegers, inspectBackendHcl, parseHcl, parseHclDocuments, TfParseError, type BackendHclInspection, } from "./parse.js";
|
|
11
11
|
export { renderBlock, renderDocument } from "./render.js";
|
|
12
|
-
export { appResourceLabelPrefix, appScopedResourceLabel, bareChildResourceLabel, childPartFromScopedLabel, elementResourceLabelPrefix, elementScopedResourceLabel, isCanonicalTsLabel, isUuid, sanitizeName, scopedLabelToBagKey, scopedResourceLabel, snakeSlug, splitCamelCase, tfLabelToTsLabel, tsLabelToTfLabel, type ChildResourceScope, } from "./labels.js";
|
|
12
|
+
export { appResourceLabelPrefix, appScopedResourceLabel, bareChildResourceLabel, childPartFromScopedLabel, elementResourceLabelPrefix, elementScopedResourceLabel, isCanonicalTsLabel, isTfLabel, isUuid, sanitizeName, scopedLabelToBagKey, scopedResourceLabel, snakeSlug, splitCamelCase, stableIdSuffix, tfLabelToTsLabel, tsLabelToTfLabel, type ChildResourceScope, } from "./labels.js";
|
|
@@ -6,6 +6,6 @@
|
|
|
6
6
|
export { expr, isTfExpr } from "./model.js";
|
|
7
7
|
export { decodeTemplateEscapes, encodeTemplateEscapes, quoteHclString } from "./escape.js";
|
|
8
8
|
export { parseExpression, parseStringValue, TfExprError } from "./expr.js";
|
|
9
|
-
export { assertNoUnsafeIntegers, inspectBackendHcl, parseHcl, TfParseError, } from "./parse.js";
|
|
9
|
+
export { assertNoUnsafeIntegers, inspectBackendHcl, parseHcl, parseHclDocuments, TfParseError, } from "./parse.js";
|
|
10
10
|
export { renderBlock, renderDocument } from "./render.js";
|
|
11
|
-
export { appResourceLabelPrefix, appScopedResourceLabel, bareChildResourceLabel, childPartFromScopedLabel, elementResourceLabelPrefix, elementScopedResourceLabel, isCanonicalTsLabel, isUuid, sanitizeName, scopedLabelToBagKey, scopedResourceLabel, snakeSlug, splitCamelCase, tfLabelToTsLabel, tsLabelToTfLabel, } from "./labels.js";
|
|
11
|
+
export { appResourceLabelPrefix, appScopedResourceLabel, bareChildResourceLabel, childPartFromScopedLabel, elementResourceLabelPrefix, elementScopedResourceLabel, isCanonicalTsLabel, isTfLabel, isUuid, sanitizeName, scopedLabelToBagKey, scopedResourceLabel, snakeSlug, splitCamelCase, stableIdSuffix, tfLabelToTsLabel, tsLabelToTfLabel, } from "./labels.js";
|
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
* "WaaS Request", "DLUpdate" → "DL Update", "A2ATranscript" → "A2A Transcript").
|
|
13
13
|
*/
|
|
14
14
|
export declare function splitCamelCase(name: string): string;
|
|
15
|
+
/** Whether `value` is in the domain {@link tfLabelToTsLabel} accepts. */
|
|
16
|
+
export declare function isTfLabel(value: string): boolean;
|
|
15
17
|
export declare function tfLabelToTsLabel(tfLabel: string): string;
|
|
16
18
|
export declare function tsLabelToTfLabel(tsLabel: string): string;
|
|
17
19
|
/**
|
|
@@ -81,5 +83,11 @@ export declare function bareChildResourceLabel(ownerTfLabel: string, scopedLabel
|
|
|
81
83
|
* kept only to no-op on unprefixed input.
|
|
82
84
|
*/
|
|
83
85
|
export declare function childPartFromScopedLabel(ownerTfLabel: string, scopedLabel: string, scope: ChildResourceScope): string;
|
|
86
|
+
/**
|
|
87
|
+
* First 8 alphanumeric characters of `id`, lowercased. ei export's
|
|
88
|
+
* `stableIDSuffix` (cmd/elementum/export/search_table_refs.go) must stay
|
|
89
|
+
* identical so an id-keyed data source address matches on both sides.
|
|
90
|
+
*/
|
|
91
|
+
export declare function stableIdSuffix(id: string): string;
|
|
84
92
|
/** Scoped terraform label → authoring bag key / ref key. */
|
|
85
93
|
export declare function scopedLabelToBagKey(ownerTfLabel: string, scopedLabel: string, scope?: ChildResourceScope): string;
|
|
@@ -56,6 +56,10 @@ export function splitCamelCase(name) {
|
|
|
56
56
|
*/
|
|
57
57
|
/** The alphabet ei's SanitizeName emits — the bijection's valid domain. */
|
|
58
58
|
const TF_LABEL_RE = /^[a-z_][a-z0-9_]*$/;
|
|
59
|
+
/** Whether `value` is in the domain {@link tfLabelToTsLabel} accepts. */
|
|
60
|
+
export function isTfLabel(value) {
|
|
61
|
+
return TF_LABEL_RE.test(value);
|
|
62
|
+
}
|
|
59
63
|
export function tfLabelToTsLabel(tfLabel) {
|
|
60
64
|
if (!TF_LABEL_RE.test(tfLabel)) {
|
|
61
65
|
// Outside [a-z0-9_] the conversion is not a bijection (an uppercase
|
|
@@ -194,6 +198,15 @@ export function childPartFromScopedLabel(ownerTfLabel, scopedLabel, scope) {
|
|
|
194
198
|
const nsPrefix = `${ownerTfLabel}_`;
|
|
195
199
|
return bare.startsWith(nsPrefix) ? bare.slice(nsPrefix.length) : bare;
|
|
196
200
|
}
|
|
201
|
+
/**
|
|
202
|
+
* First 8 alphanumeric characters of `id`, lowercased. ei export's
|
|
203
|
+
* `stableIDSuffix` (cmd/elementum/export/search_table_refs.go) must stay
|
|
204
|
+
* identical so an id-keyed data source address matches on both sides.
|
|
205
|
+
*/
|
|
206
|
+
export function stableIdSuffix(id) {
|
|
207
|
+
const normalized = id.toLowerCase().replace(/[^a-z0-9]/g, "");
|
|
208
|
+
return normalized.slice(0, 8);
|
|
209
|
+
}
|
|
197
210
|
/** Scoped terraform label → authoring bag key / ref key. */
|
|
198
211
|
export function scopedLabelToBagKey(ownerTfLabel, scopedLabel, scope = "app") {
|
|
199
212
|
return tfLabelToTsLabel(childPartFromScopedLabel(ownerTfLabel, scopedLabel, scope));
|
|
@@ -67,13 +67,34 @@ export type TfValue = string | number | boolean | null | TfValue[] | {
|
|
|
67
67
|
[k: string]: TfValue;
|
|
68
68
|
} | TfExpr;
|
|
69
69
|
export type TfBlockKind = "resource" | "data" | "locals" | "import" | "provider" | "terraform" | "variable";
|
|
70
|
+
/**
|
|
71
|
+
* A resource's nested `lifecycle { ignore_changes = ... }` block — `"all"` or
|
|
72
|
+
* named top-level attributes. Never part of the ei dialect: only smart apply
|
|
73
|
+
* emits it, to stop a limited plan changing items that aren't the caller's.
|
|
74
|
+
*/
|
|
75
|
+
export interface TfLifecycle {
|
|
76
|
+
ignoreChanges: "all" | readonly string[];
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* A variable's nested `validation` block. The condition is raw HCL, not a
|
|
80
|
+
* closed-grammar expression: `var.name != ""` is outside that grammar, and
|
|
81
|
+
* pull must still accept the block. Only required write-only secrets emit it.
|
|
82
|
+
*/
|
|
83
|
+
export interface TfVariableValidation {
|
|
84
|
+
readonly condition: string;
|
|
85
|
+
readonly errorMessage: string;
|
|
86
|
+
}
|
|
70
87
|
export interface TfBlock {
|
|
71
88
|
kind: TfBlockKind;
|
|
72
89
|
/** resource/data only: the terraform type, e.g. "elementum_app" */
|
|
73
90
|
type?: string;
|
|
74
|
-
/** resource/data: the label; provider: the provider name */
|
|
91
|
+
/** resource/data: the label; provider: the provider name; variable: the variable name */
|
|
75
92
|
label?: string;
|
|
76
93
|
attrs: Record<string, TfValue>;
|
|
94
|
+
/** resource only: rendered as a nested `lifecycle` block after the attributes. */
|
|
95
|
+
lifecycle?: TfLifecycle;
|
|
96
|
+
/** variable only: rendered as a nested `validation` block. */
|
|
97
|
+
variableValidation?: TfVariableValidation;
|
|
77
98
|
}
|
|
78
99
|
export interface TfDocument {
|
|
79
100
|
blocks: TfBlock[];
|
|
@@ -12,6 +12,20 @@
|
|
|
12
12
|
*/
|
|
13
13
|
import type { TfDocument } from "./model.js";
|
|
14
14
|
type Hcl2JsonParser = (filename: string, contents: string) => Promise<Record<string, unknown>>;
|
|
15
|
+
export interface Hcl2JsonInput {
|
|
16
|
+
readonly filename: string;
|
|
17
|
+
readonly contents: string;
|
|
18
|
+
}
|
|
19
|
+
/** Converts many documents in one call; a per-document failure is an Error entry. */
|
|
20
|
+
export type Hcl2JsonBatchParser = (inputs: readonly Hcl2JsonInput[]) => Promise<ReadonlyArray<Record<string, unknown> | Error>>;
|
|
21
|
+
/** Test seam: forget cached conversions. */
|
|
22
|
+
export declare function clearHclParseCache(): void;
|
|
23
|
+
/**
|
|
24
|
+
* Install a batch converter (the CLI's native bridge). Batch reads prefer it;
|
|
25
|
+
* when it throws, parsing falls back to the WASM parser for the rest of the
|
|
26
|
+
* process.
|
|
27
|
+
*/
|
|
28
|
+
export declare function installHcl2JsonBatchRuntime(parser: Hcl2JsonBatchParser | undefined): void;
|
|
15
29
|
/**
|
|
16
30
|
* The Bun executable installs an embedded-WASM parser before loading the CLI.
|
|
17
31
|
* Node/SDK consumers keep using the upstream package directly.
|
|
@@ -40,6 +54,11 @@ export interface BackendHclInspection {
|
|
|
40
54
|
*/
|
|
41
55
|
export declare function inspectBackendHcl(text: string): Promise<BackendHclInspection>;
|
|
42
56
|
export declare function parseHcl(text: string): Promise<TfDocument>;
|
|
57
|
+
/**
|
|
58
|
+
* Parse many HCL texts, in order. A document that fails yields its
|
|
59
|
+
* TfParseError in place so one bad file never hides the others.
|
|
60
|
+
*/
|
|
61
|
+
export declare function parseHclDocuments(texts: readonly string[]): Promise<Array<TfDocument | TfParseError>>;
|
|
43
62
|
/**
|
|
44
63
|
* Refuse to parse text whose integer literals exceed Number.MAX_SAFE_INTEGER —
|
|
45
64
|
* hcl2json would round them silently (verified: 2^53+1 → 2^53).
|