@elementumai/edk 0.9.20 → 0.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -7
- package/dist-sdk/src/catalog/factories.d.ts +10 -2
- package/dist-sdk/src/catalog/factories.js +10 -1
- package/dist-sdk/src/catalog/index.d.ts +2 -2
- package/dist-sdk/src/catalog/index.js +1 -1
- package/dist-sdk/src/catalog/token.js +4 -0
- package/dist-sdk/src/catalog/types.d.ts +7 -1
- package/dist-sdk/src/catalog/types.js +1 -0
- package/dist-sdk/src/core/triggers/on-demand.d.ts +2 -2
- package/dist-sdk/src/core/triggers/on-demand.js +7 -0
- package/dist-sdk/src/core/types/app.d.ts +2 -2
- package/dist-sdk/src/engine/coverage-gaps.d.ts +86 -0
- package/dist-sdk/src/engine/coverage-gaps.js +156 -0
- package/dist-sdk/src/engine/ei/run.d.ts +21 -1
- package/dist-sdk/src/engine/ei/run.js +89 -2
- package/dist-sdk/src/engine/pull/catalog-ref.d.ts +16 -0
- package/dist-sdk/src/engine/pull/catalog-ref.js +24 -0
- package/dist-sdk/src/engine/pull/context.d.ts +68 -6
- package/dist-sdk/src/engine/pull/context.js +40 -1
- package/dist-sdk/src/engine/pull/procedure-refs.d.ts +8 -0
- package/dist-sdk/src/engine/pull/procedure-refs.js +28 -0
- package/dist-sdk/src/engine/pull/result-output.js +27 -1
- package/dist-sdk/src/engine/tf/index.d.ts +1 -1
- package/dist-sdk/src/engine/tf/index.js +1 -1
- package/dist-sdk/src/engine/tf/labels.d.ts +22 -5
- package/dist-sdk/src/engine/tf/labels.js +45 -3
- package/dist-sdk/src/engine/tf/parse.js +3 -2
- package/dist-sdk/src/engine/validation.d.ts +5 -0
- package/dist-sdk/src/engine/validation.js +12 -2
- package/dist-sdk/src/entities/access-policy/from-tf.js +38 -1
- package/dist-sdk/src/entities/access-policy/principal.d.ts +2 -0
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.d.ts +3 -0
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +42 -19
- package/dist-sdk/src/entities/agent/from-tf.js +11 -3
- package/dist-sdk/src/entities/agent/module.js +2 -0
- package/dist-sdk/src/entities/agent/to-tf.js +14 -3
- package/dist-sdk/src/entities/agent-tool/from-tf.d.ts +8 -1
- package/dist-sdk/src/entities/agent-tool/from-tf.js +11 -5
- package/dist-sdk/src/entities/agent-tool/module.js +3 -0
- package/dist-sdk/src/entities/app/auto-share.d.ts +38 -0
- package/dist-sdk/src/entities/app/auto-share.js +49 -0
- package/dist-sdk/src/entities/app/build.d.ts +17 -3
- package/dist-sdk/src/entities/app/build.js +56 -4
- package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +6 -1
- package/dist-sdk/src/entities/app/from-tf.js +4 -0
- package/dist-sdk/src/entities/app/index.d.ts +2 -1
- package/dist-sdk/src/entities/app/index.js +1 -8
- package/dist-sdk/src/entities/app/to-tf.d.ts +6 -0
- package/dist-sdk/src/entities/app/to-tf.js +21 -2
- package/dist-sdk/src/entities/automation/build.d.ts +10 -2
- package/dist-sdk/src/entities/automation/build.js +104 -17
- package/dist-sdk/src/entities/automation/calculation-expression.d.ts +7 -7
- package/dist-sdk/src/entities/automation/deserializer/print-automation.d.ts +17 -4
- package/dist-sdk/src/entities/automation/deserializer/print-automation.js +156 -19
- package/dist-sdk/src/entities/automation/from-tf.d.ts +9 -2
- package/dist-sdk/src/entities/automation/from-tf.js +366 -86
- package/dist-sdk/src/entities/automation/index.d.ts +1 -1
- package/dist-sdk/src/entities/automation/index.js +1 -1
- package/dist-sdk/src/entities/automation/module.d.ts +3 -0
- package/dist-sdk/src/entities/automation/module.js +70 -7
- package/dist-sdk/src/entities/automation/script-code.d.ts +5 -2
- package/dist-sdk/src/entities/automation/script-code.js +23 -5
- package/dist-sdk/src/entities/automation/task-output-labels.d.ts +37 -0
- package/dist-sdk/src/entities/automation/task-output-labels.js +76 -0
- package/dist-sdk/src/entities/automation/tasks.d.ts +92 -20
- package/dist-sdk/src/entities/automation/tasks.js +48 -15
- package/dist-sdk/src/entities/automation/to-tf.d.ts +20 -3
- package/dist-sdk/src/entities/automation/to-tf.js +606 -62
- package/dist-sdk/src/entities/automation/triggers.d.ts +8 -4
- package/dist-sdk/src/entities/automation/types.d.ts +9 -0
- package/dist-sdk/src/entities/automation/types.js +19 -0
- package/dist-sdk/src/entities/automation/value-ref-tf.d.ts +1 -1
- package/dist-sdk/src/entities/automation/value-ref-tf.js +1 -1
- package/dist-sdk/src/entities/chart/from-tf.js +9 -1
- package/dist-sdk/src/entities/data-lookup/module.js +2 -0
- package/dist-sdk/src/entities/dynamic-layout/to-tf.d.ts +1 -0
- package/dist-sdk/src/entities/dynamic-layout/to-tf.js +7 -5
- package/dist-sdk/src/entities/element/build.d.ts +3 -0
- package/dist-sdk/src/entities/element/build.js +1 -0
- package/dist-sdk/src/entities/element/from-tf.js +4 -0
- package/dist-sdk/src/entities/element/to-tf.d.ts +1 -1
- package/dist-sdk/src/entities/element/to-tf.js +8 -14
- package/dist-sdk/src/entities/field/build.d.ts +3 -2
- package/dist-sdk/src/entities/field/calc.d.ts +7 -7
- package/dist-sdk/src/entities/field/from-tf.d.ts +4 -4
- package/dist-sdk/src/entities/field/from-tf.js +205 -48
- package/dist-sdk/src/entities/field/module.js +1 -0
- package/dist-sdk/src/entities/field/options.js +6 -1
- package/dist-sdk/src/entities/field/to-tf.d.ts +4 -4
- package/dist-sdk/src/entities/field/to-tf.js +7 -1
- package/dist-sdk/src/entities/field/types.d.ts +2 -0
- package/dist-sdk/src/entities/field/types.js +27 -0
- package/dist-sdk/src/entities/role/from-tf.js +3 -3
- package/dist-sdk/src/entities/role/to-tf.d.ts +2 -0
- package/dist-sdk/src/entities/role/to-tf.js +12 -4
- package/dist-sdk/src/entities/service-account/from-tf.js +3 -3
- package/dist-sdk/src/entities/service-account/workspace-owner.d.ts +16 -0
- package/dist-sdk/src/entities/service-account/workspace-owner.js +22 -0
- package/dist-sdk/src/entities/shared/filters/ast.d.ts +15 -1
- package/dist-sdk/src/entities/shared/filters/ast.js +2 -0
- package/dist-sdk/src/entities/shared/filters/index.d.ts +5 -0
- package/dist-sdk/src/entities/shared/filters/index.js +5 -0
- package/dist-sdk/src/entities/shared/filters/print.js +7 -2
- package/dist-sdk/src/entities/shared/filters/tf-codec.d.ts +5 -0
- package/dist-sdk/src/entities/shared/filters/tf-codec.js +42 -7
- package/dist-sdk/src/entities/shared/filters/types.d.ts +8 -3
- package/dist-sdk/src/entities/shared/ref.d.ts +5 -7
- package/dist-sdk/src/entities/shared/ref.js +5 -7
- package/dist-sdk/src/entities/shared/tool-field-ref.d.ts +9 -0
- package/dist-sdk/src/entities/shared/tool-field-ref.js +35 -2
- package/dist-sdk/src/entities/shared/types/field-types.d.ts +10 -0
- package/dist-sdk/src/entities/shared/types/field-types.js +4 -0
- package/dist-sdk/src/entities/skill/access-policy.js +3 -3
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.d.ts +3 -0
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +12 -5
- package/dist-sdk/src/entities/skill/from-tf.js +4 -2
- package/dist-sdk/src/entities/skill/module.js +2 -0
- package/dist-sdk/src/entities/skill-tool/from-tf.js +41 -8
- package/dist-sdk/src/entities/skill-tool/module.js +3 -0
- package/dist-sdk/src/entities/skill-tool/to-tf.d.ts +0 -6
- package/dist-sdk/src/entities/skill-tool/to-tf.js +22 -9
- package/dist-sdk/src/entities/task/build.d.ts +8 -0
- package/dist-sdk/src/entities/task/build.js +10 -1
- package/dist-sdk/src/entities/task/from-tf.d.ts +4 -2
- package/dist-sdk/src/entities/task/from-tf.js +7 -2
- package/dist-sdk/src/entities/task/module.js +2 -2
- package/dist-sdk/src/entities/task/to-tf.d.ts +8 -4
- package/dist-sdk/src/entities/task/to-tf.js +28 -1
- package/dist-sdk/src/entities/view/from-tf.js +9 -1
- package/dist-sdk/src/entities/view/to-tf.d.ts +6 -7
- package/dist-sdk/src/entities/view/to-tf.js +19 -8
- package/dist-sdk/src/entities/visual-flow/build.d.ts +16 -1
- package/dist-sdk/src/entities/visual-flow/build.js +9 -0
- package/dist-sdk/src/entities/visual-flow/from-tf.d.ts +14 -0
- package/dist-sdk/src/entities/visual-flow/from-tf.js +51 -3
- package/dist-sdk/src/entities/visual-flow/index.d.ts +1 -1
- package/dist-sdk/src/entities/visual-flow/index.js +1 -1
- package/dist-sdk/src/entities/visual-flow/printer.js +19 -0
- package/dist-sdk/src/entities/visual-flow/to-tf.js +87 -3
- package/dist-sdk/src/entities/widget/from-tf.js +3 -3
- package/dist-sdk/src/entities/widget/to-tf.d.ts +2 -0
- package/dist-sdk/src/entities/widget/to-tf.js +7 -6
- package/dist-sdk/src/generated/ragnarok/ragnarok-spec.d.ts +133 -9
- package/dist-sdk/src/generated/ragnarok/ragnarok-spec.js +2 -2
- package/dist-sdk/src/graph/index.d.ts +1 -0
- package/dist-sdk/src/graph/types.d.ts +29 -3
- package/package.json +7 -3
package/README.md
CHANGED
|
@@ -193,6 +193,7 @@ elementum pull org [--root <orgRoot>] [--no-adopt]
|
|
|
193
193
|
elementum pull org --data-only [--root <orgRoot>]
|
|
194
194
|
elementum pull app <namespace> [--root <orgRoot>] [--no-adopt] [--skip-unsupported-layouts]
|
|
195
195
|
elementum pull element <namespace> [--root <orgRoot>] [--no-adopt] [--skip-unsupported-layouts]
|
|
196
|
+
elementum pull --restore-previous [--root <orgRoot>] # after a failed pull: .tf/in.previous -> .tf/in (failed copy kept as .tf/in.failed); never automatic
|
|
196
197
|
elementum clone app <namespace> --as <newName> [--namespace <newns>] [--root <orgRoot>]
|
|
197
198
|
elementum build [orgRoot]
|
|
198
199
|
elementum plan [orgRoot-or-nested-target] [--json] [bridge args...]
|
|
@@ -407,12 +408,23 @@ export default automation({
|
|
|
407
408
|
The file path supplies the automation ref; `app` is the strongly typed owning app ref.
|
|
408
409
|
`revision` is required SemVer and is the explicit publish gate. Editing
|
|
409
410
|
actions or triggers updates the draft; bump the revision only when that draft
|
|
410
|
-
should be published. `elementum build` warns
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
411
|
+
should be published. `elementum build` warns ("compiled steps changed since
|
|
412
|
+
the last apply but its revision is still …") when an automation's steps differ
|
|
413
|
+
from its recorded baseline while its revision does not. Applies, and pulls
|
|
414
|
+
whose adoption succeeded, record that baseline in
|
|
415
|
+
`applied-automation-revisions.json`, next to `terraform.tfstate` in the org
|
|
416
|
+
root; commit it so the whole team and CI share that baseline. An automation
|
|
417
|
+
with no recorded entry, such as one that was never applied or pulled, does not
|
|
418
|
+
warn. A pull records the draft it printed at the revision state says was last
|
|
419
|
+
published, so changes already unpublished before the pull are not flagged, and
|
|
420
|
+
a workflow republished from the Elementum screens without a new revision keeps
|
|
421
|
+
warning until the revision is bumped. The hash is workspace-independent: adding or removing a referenced app or
|
|
422
|
+
element does not change it (those refs are hashed as foreign `data.*` lookups).
|
|
423
|
+
For one release, a previously recorded workspace-dependent hash is still
|
|
424
|
+
accepted (dual-hash); apply and pull write the independent hash going forward,
|
|
425
|
+
and dual-hash acceptance will be removed next release. If the file does not
|
|
426
|
+
parse (for example a merge conflict), build says so and checks nothing, and
|
|
427
|
+
apply and pull leave it untouched until it is fixed.
|
|
416
428
|
|
|
417
429
|
## Agent example
|
|
418
430
|
|
|
@@ -531,7 +543,7 @@ read a Terraform-managed secret. EDK does not accept `-backend-config` secrets
|
|
|
531
543
|
and never writes backend credentials into generated HCL.
|
|
532
544
|
|
|
533
545
|
OpenTofu owns locking. EDK does not implement a weaker parallel lock or disable
|
|
534
|
-
native locking: `plan`, `apply`, adoption imports, rename `
|
|
546
|
+
native locking: `plan`, `apply`, adoption imports, rename `moved` plans, and
|
|
535
547
|
state-repair operations use the declared backend. Standard options such as
|
|
536
548
|
`-lock-timeout=5m` pass through:
|
|
537
549
|
|
|
@@ -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, ViewRef, ViewType, OutputPropertyRef, RecordIdentityRef, SearchTableRef, StoredFunctionRef, StoredFunctionScalarType, SkillRef, TableColumnRef, TableOwnedSearchTableRef, TableRef, TaskCatalogRef, TriggerParameterRef } from "./types.js";
|
|
24
|
+
import type { AgentEvaluationRef, AgentRef, AppCatalogRef, AppOrElementRef, AiProviderRef, ApprovalChainRef, AutomationCatalogRef, CatalogRef, CategoryRef, ChartRef, DashboardRef, WidgetRef, CloudLinkRef, ConnectorRef, DatamineRef, RelationshipRef, GroupRef, PhoneProviderRef, PhoneServiceRef, ProcedureParameterType, ProcedureRef, FileReaderCatalogRef, DocumentModelFieldRef, ElementCatalogRef, FieldRef, ViewRef, ViewType, OutputPropertyRef, RecordIdentityRef, SearchTableRef, StoredFunctionRef, StoredFunctionScalarType, SkillRef, TableColumnRef, TableOwnedSearchTableRef, TableRef, TaskCatalogRef, TriggerParameterRef } from "./types.js";
|
|
25
25
|
export declare function recordIdentity<const Target extends AppOrElementRef | TaskCatalogRef | TableRef>(target: Target): RecordIdentityRef<Target>;
|
|
26
26
|
/** Fixed platform user-directory schema used by userSearch filters. */
|
|
27
27
|
export declare const usersCatalog: {
|
|
@@ -207,7 +207,10 @@ export declare function widgetRef<const Parent extends string = string, const Re
|
|
|
207
207
|
readonly refName?: RefName;
|
|
208
208
|
readonly name?: string;
|
|
209
209
|
readonly parent?: Parent;
|
|
210
|
-
|
|
210
|
+
readonly at?: number;
|
|
211
|
+
}): WidgetRef<Parent, RefName> & {
|
|
212
|
+
readonly at?: number;
|
|
213
|
+
};
|
|
211
214
|
/**
|
|
212
215
|
* Skill ref — no required arguments, same shape as {@link agentRef}. `handle` and `parent`
|
|
213
216
|
* are injected by the enclosing `appCatalog`/`elementCatalog`; `name` defaults to `""`.
|
|
@@ -232,6 +235,11 @@ export declare function datamineRef(opts?: {
|
|
|
232
235
|
readonly parentName?: string;
|
|
233
236
|
readonly columnNames?: Readonly<Record<string, string>>;
|
|
234
237
|
}): DatamineRef;
|
|
238
|
+
/** Minimal relationship ref for visual-flow chip actions (edk#1663). */
|
|
239
|
+
export declare function relationshipRef(opts?: {
|
|
240
|
+
readonly name?: string;
|
|
241
|
+
readonly parent?: string;
|
|
242
|
+
}): RelationshipRef;
|
|
235
243
|
export declare const approvalChainRef: (opts: Omit<ApprovalChainRef<string, string>, "parent" | "refName" | "__kind">) => Omit<ApprovalChainRef<string, string>, "parent" | "refName" | "__kind"> & {
|
|
236
244
|
readonly __kind: "approvalChain";
|
|
237
245
|
readonly refName: string;
|
|
@@ -112,7 +112,7 @@ export function dashboardRef(opts) {
|
|
|
112
112
|
return { __kind: "dashboard", refName: opts?.refName ?? "", name: opts?.name ?? "", ...(opts?.parent !== undefined ? { parent: opts.parent } : {}) };
|
|
113
113
|
}
|
|
114
114
|
export function widgetRef(opts) {
|
|
115
|
-
return { __kind: "widget", refName: opts?.refName ?? "", name: opts?.name ?? "", ...(opts?.parent !== undefined ? { parent: opts.parent } : {}) };
|
|
115
|
+
return { __kind: "widget", refName: opts?.refName ?? "", name: opts?.name ?? "", ...(opts?.parent !== undefined ? { parent: opts.parent } : {}), ...(opts?.at !== undefined ? { at: opts.at } : {}) };
|
|
116
116
|
}
|
|
117
117
|
/**
|
|
118
118
|
* Skill ref — no required arguments, same shape as {@link agentRef}. `handle` and `parent`
|
|
@@ -145,6 +145,15 @@ export function datamineRef(opts) {
|
|
|
145
145
|
...(opts?.columnNames !== undefined ? { columnNames: opts.columnNames } : {}),
|
|
146
146
|
};
|
|
147
147
|
}
|
|
148
|
+
/** Minimal relationship ref for visual-flow chip actions (edk#1663). */
|
|
149
|
+
export function relationshipRef(opts) {
|
|
150
|
+
return {
|
|
151
|
+
__kind: "relationship",
|
|
152
|
+
refName: "",
|
|
153
|
+
name: opts?.name ?? "",
|
|
154
|
+
...(opts?.parent !== undefined ? { parent: opts.parent } : {}),
|
|
155
|
+
};
|
|
156
|
+
}
|
|
148
157
|
export const approvalChainRef = refFactory("approvalChain");
|
|
149
158
|
function searchTableRefFor(opts, variant) {
|
|
150
159
|
return {
|
|
@@ -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, viewType, type ViewRef, type ViewType, } from "./types.js";
|
|
7
|
+
export { REF_SCOPE, REF_UPDATABLE, type AgentRef, type AgentEvaluationRef, type AiProviderRef, type ApprovalChainRef, type ApprovalProcessRef, type AppCatalogRef, type AppOrElementRef, type AutomationCatalogRef, type AutomationRef, type CatalogRef, type CatalogRefKind, type CategoryRef, type ChartRef, type DashboardRef, type WidgetRef, type CloudLinkRef, type AiServiceRef, type ConnectorRef, type GroupRef, type PhoneProviderRef, type PhoneServiceRef, PROCEDURE_PARAMETER_TYPES, type ProcedureParameterType, type ProcedureRef, type FileReaderCatalogRef, type DocumentModelFieldRef, type ElementCatalogRef, type TaskCatalogRef, type AppOrElementOrTaskRef, type FieldRef, type OutputPropertyRef, type RecordIdentityRef, type SearchTableRef, type TableOwnedSearchTableRef, type StoredFunctionRef, type StoredFunctionScalarType, type DatamineRef, type RelationshipRef, type SkillRef, type TableColumnRef, type TableRef, type TriggerParameterRef, USER_FIELD_KEYS, type UserFieldKey, type UserFieldRef, USER_GROUP_FIELD_KEYS, type UserGroupFieldKey, type UserGroupFieldRef, viewType, type ViewRef, type ViewType, } from "./types.js";
|
|
8
8
|
export { renderBarrel, renderCatalog, renderFragment, type BarrelEntry, type BarrelRoot, } from "./render.js";
|
|
9
9
|
export { appCatalogTarget, barrelPathFor, orgCatalogTarget, regenerateBarrel, writeCatalog, writeFlatCatalog, writeFragment, type CatalogTarget, } from "./write.js";
|
|
10
10
|
export { isCatalogToken, slimToken, slimTokens } from "./token.js";
|
|
11
11
|
export { buildAppCatalogFromAuthoring, listEntityFilesFromPaths, refNameOf, regenerateAppCatalogsUnder, writeAppCatalog, writeAppCatalogFromAuthoring, type AppAuthoringCatalog, type AppCatalogRegenResult, type ConfiguredEntity, } from "./from-authoring.js";
|
|
12
|
-
export { agentRef, agentEvaluationRef, appRef, appCatalog, approvalChainRef, automationRef, categoryRef, chartRef, dashboardRef, widgetRef, cloudLinkRef, connectorRef, aiProvider, groupRef, linkedSearchTableRef, phoneProviderRef, phoneServiceRef, procedureRef, documentModelFieldRef, documentModelRef, elementCatalog, elementRef, fieldRef, orgCatalog, outputPropertyRef, recordIdentity, searchTableRef, datamineRef, skillRef, storedFunctionRef, tableColumnRef, tableRef, tableSearchTableRef, taskRef, triggerParameterRef, userGroupsCatalog, usersCatalog, viewRef, type CatalogViewRefOptions, type OutsideViewRefOptions, } from "./factories.js";
|
|
12
|
+
export { agentRef, agentEvaluationRef, appRef, appCatalog, approvalChainRef, automationRef, categoryRef, chartRef, dashboardRef, widgetRef, cloudLinkRef, connectorRef, aiProvider, groupRef, linkedSearchTableRef, phoneProviderRef, phoneServiceRef, procedureRef, documentModelFieldRef, documentModelRef, elementCatalog, elementRef, fieldRef, orgCatalog, outputPropertyRef, recordIdentity, searchTableRef, datamineRef, relationshipRef, skillRef, storedFunctionRef, tableColumnRef, tableRef, tableSearchTableRef, taskRef, triggerParameterRef, userGroupsCatalog, usersCatalog, viewRef, type CatalogViewRefOptions, type OutsideViewRefOptions, } from "./factories.js";
|
|
@@ -9,4 +9,4 @@ 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, viewRef, } from "./factories.js";
|
|
12
|
+
export { agentRef, agentEvaluationRef, appRef, appCatalog, approvalChainRef, automationRef, categoryRef, chartRef, dashboardRef, widgetRef, cloudLinkRef, connectorRef, aiProvider, groupRef, linkedSearchTableRef, phoneProviderRef, phoneServiceRef, procedureRef, documentModelFieldRef, documentModelRef, elementCatalog, elementRef, fieldRef, orgCatalog, outputPropertyRef, recordIdentity, searchTableRef, datamineRef, relationshipRef, skillRef, storedFunctionRef, tableColumnRef, tableRef, tableSearchTableRef, taskRef, triggerParameterRef, userGroupsCatalog, usersCatalog, viewRef, } from "./factories.js";
|
|
@@ -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 layout widget's place in the group's field list. Dropping it always
|
|
52
|
+
// appends the widget and replaces any layout where the button sits between fields.
|
|
53
|
+
if (token.__kind === "widget" && typeof token.at === "number")
|
|
54
|
+
out.at = token.at;
|
|
51
55
|
// A view's bag decides which resource type backs it when its owner is in
|
|
52
56
|
// the same workspace.
|
|
53
57
|
if (token.__kind === "view" && typeof token.viewType === "string")
|
|
@@ -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" | "view" | "searchTable" | "documentModel" | "documentModelField" | "connector" | "aiProvider" | "category" | "group" | "phoneProvider" | "phone-service" | "datamine" | "app" | "element" | "task" | "portal" | "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" | "relationship" | "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.
|
|
@@ -141,6 +141,12 @@ export interface DatamineRef<Parent extends string = string, RefName extends str
|
|
|
141
141
|
/** Map of column refName / sanitized key → display name for column resolution in filters. */
|
|
142
142
|
readonly columnNames?: Readonly<Record<string, string>>;
|
|
143
143
|
}
|
|
144
|
+
/**
|
|
145
|
+
* Minimal reference to an app- or element-owned relationship (`elementum_relationship`).
|
|
146
|
+
* Relationships are not rendered into the org/app catalog bag yet (NO_CATALOG on the
|
|
147
|
+
* entity module); visual-flow chip actions use this ref shape for typed round-trip (edk#1663).
|
|
148
|
+
*/
|
|
149
|
+
export type RelationshipRef<Parent extends string = string, RefName extends string = string> = CatalogRef<"relationship", RefName, Parent>;
|
|
144
150
|
/** Public reference to an AI service/model selected for runtime use. */
|
|
145
151
|
export type AiServiceRef = CatalogRef<"connector">;
|
|
146
152
|
/** @internal Backend compatibility name. Prefer {@link AiServiceRef} on authoring surfaces. */
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import type { AppOrElementRef } from "../../catalog/types.js";
|
|
9
9
|
import type { RecordShape } from "../../entities/field/record-shape.js";
|
|
10
|
-
import type { FieldTypeToTS,
|
|
10
|
+
import type { FieldTypeToTS, OnDemandParamTypeAlias } from "../../entities/shared/types/field-types.js";
|
|
11
11
|
/**
|
|
12
12
|
* Scalar `type` values are constrained to the aliases Mobius accepts.
|
|
13
13
|
* A `record` input additionally requires the app/element whose record is
|
|
@@ -18,7 +18,7 @@ interface TriggerInputFieldDefBase {
|
|
|
18
18
|
description?: string;
|
|
19
19
|
}
|
|
20
20
|
export interface ScalarTriggerInputFieldDef extends TriggerInputFieldDefBase {
|
|
21
|
-
type: Exclude<
|
|
21
|
+
type: Exclude<OnDemandParamTypeAlias, "record" | "userId">;
|
|
22
22
|
multiple?: boolean;
|
|
23
23
|
defaultValue?: unknown;
|
|
24
24
|
app?: never;
|
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
* Each input becomes a ServiceTaskParam that downstream tasks can
|
|
6
6
|
* reference via ctx.trigger.<paramName>.
|
|
7
7
|
*/
|
|
8
|
+
import { ON_DEMAND_PARAM_TYPES } from "../../entities/shared/types/field-types.js";
|
|
9
|
+
import { EdkValidationError } from "../../../elementum-entity-client/errors.js";
|
|
8
10
|
import { FIELD_TYPE_MAP } from "../../entities/shared/types/field-types.js";
|
|
9
11
|
/**
|
|
10
12
|
* Define an ON_DEMAND trigger with typed input parameters.
|
|
@@ -102,6 +104,11 @@ function wrapDefaultValueForWire(alias, value) {
|
|
|
102
104
|
}
|
|
103
105
|
export function serializeOnDemandTrigger(schema) {
|
|
104
106
|
const inputs = Object.entries(schema).map(([name, def]) => {
|
|
107
|
+
const runtimeType = def.type;
|
|
108
|
+
if (runtimeType === "json" || runtimeType === "object") {
|
|
109
|
+
throw new EdkValidationError(`onDemand input "${name}" has type ${JSON.stringify(def.type)}, which on-demand triggers do not support. ` +
|
|
110
|
+
`Use one of: ${ON_DEMAND_PARAM_TYPES.join(", ")} (e.g. "text" for a JSON string).`);
|
|
111
|
+
}
|
|
105
112
|
if (def.type === "record") {
|
|
106
113
|
const runtimeDef = def;
|
|
107
114
|
if (runtimeDef.multiple === true) {
|
|
@@ -229,8 +229,8 @@ export interface NormalizedPicklistDynamicConfig {
|
|
|
229
229
|
*/
|
|
230
230
|
readonly parentFieldId?: string;
|
|
231
231
|
readonly parentMappings?: readonly {
|
|
232
|
-
readonly parentAspectFieldId: FieldRef | string
|
|
233
|
-
readonly relatedAspectFieldId: FieldRef | string
|
|
232
|
+
readonly parentAspectFieldId: FieldRef | string | Exclude<NormalizedPicklistDynamicConfig["relatedLabelFieldId"], string>;
|
|
233
|
+
readonly relatedAspectFieldId: FieldRef | string | Exclude<NormalizedPicklistDynamicConfig["relatedLabelFieldId"], string>;
|
|
234
234
|
}[];
|
|
235
235
|
readonly autoRelate?: boolean;
|
|
236
236
|
readonly valuesRenderType?: string;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* edk#914 / edk#1473: which build/pull diagnostics are coverage gaps (config
|
|
3
|
+
* EDK dropped, skipped, defaulted, or could not carry), and one typed event
|
|
4
|
+
* per gap.
|
|
5
|
+
*
|
|
6
|
+
* Every command counts gaps with the same definition, {@link coverageGapMessages}:
|
|
7
|
+
* the distinct diagnostics minus advisories. Plan/apply status, build status,
|
|
8
|
+
* and the `coverageGapCount` in build and pull JSON all use it.
|
|
9
|
+
*
|
|
10
|
+
* Advisory diagnostics are not gaps. They are still printed as warnings, but
|
|
11
|
+
* the config they mention is built and applied as authored:
|
|
12
|
+
* - skill input-coverage lint (`skill "x" input coverage gap [input-schema-missing]: …`)
|
|
13
|
+
* - the unbumped-automation revision reminder
|
|
14
|
+
*
|
|
15
|
+
* The ~600 emit sites push free-form `"<where>: <what>; dropped"` strings.
|
|
16
|
+
* Rather than rewrite every site, they are classified here, where they leave
|
|
17
|
+
* the engine. A gap's event goes away when its site stops pushing the
|
|
18
|
+
* diagnostic.
|
|
19
|
+
*/
|
|
20
|
+
export declare function isAdvisoryDiagnostic(message: string): boolean;
|
|
21
|
+
/** The distinct, non-advisory diagnostics: one entry per coverage gap. */
|
|
22
|
+
export declare function coverageGapMessages(diagnostics: readonly string[]): string[];
|
|
23
|
+
export type CoverageGapKind = "dropped" | "skipped" | "defaulted" | "unsupported" | "degraded" | "advisory";
|
|
24
|
+
export interface CoverageGapEvent {
|
|
25
|
+
readonly kind: CoverageGapKind;
|
|
26
|
+
/** The entity or address the gap is on (`automation "x"'s task "y"`, `skill "z"`), when the message names one. */
|
|
27
|
+
readonly entity?: string;
|
|
28
|
+
/** What was dropped or skipped, plus why, as written by the emitting site. */
|
|
29
|
+
readonly detail: string;
|
|
30
|
+
/** What the user will observe because of the gap. */
|
|
31
|
+
readonly consequence: string;
|
|
32
|
+
/** The original diagnostic, unchanged. */
|
|
33
|
+
readonly message: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* edk#1480: typed coverage gaps. A site with a specific consequence (a tool
|
|
37
|
+
* the agent can't call, a validation rule that isn't enforced, an automation
|
|
38
|
+
* that isn't written to source) builds its diagnostic with
|
|
39
|
+
* {@link typedCoverageGap}. It still travels as a diagnostic string, so it
|
|
40
|
+
* is counted, logged, and fails `--strict-coverage` like every other gap,
|
|
41
|
+
* but its event carries the site's own kind and consequence instead of the
|
|
42
|
+
* ones guessed from the wording.
|
|
43
|
+
*/
|
|
44
|
+
export interface TypedCoverageGap {
|
|
45
|
+
readonly kind: Exclude<CoverageGapKind, "advisory">;
|
|
46
|
+
/** Who the gap is on, e.g. `skill tool "Lookup"`, `automation "Invite User"`. */
|
|
47
|
+
readonly entity: string;
|
|
48
|
+
/** What was dropped or skipped, and why. */
|
|
49
|
+
readonly detail: string;
|
|
50
|
+
/** What the user will observe, stated by the site. */
|
|
51
|
+
readonly consequence: string;
|
|
52
|
+
}
|
|
53
|
+
/** The diagnostic for a typed gap: `<entity>: <detail> — <consequence>`. Push it like any diagnostic. */
|
|
54
|
+
export declare function typedCoverageGap(gap: TypedCoverageGap): string;
|
|
55
|
+
/**
|
|
56
|
+
* Forget the typed gaps of earlier commands. The CLI calls this at the start
|
|
57
|
+
* of every command so a long-lived process (the MCP server, tests) does not
|
|
58
|
+
* accumulate them.
|
|
59
|
+
*/
|
|
60
|
+
export declare function resetTypedCoverageGaps(): void;
|
|
61
|
+
export declare function coverageGapEvent(message: string): CoverageGapEvent;
|
|
62
|
+
export declare function coverageGapEvents(messages: readonly string[]): CoverageGapEvent[];
|
|
63
|
+
/** One log line per diagnostic: `coverage gap (<kind>): <message> — <consequence>`, or `advisory: …`. */
|
|
64
|
+
export declare function formatCoverageGap(event: CoverageGapEvent): string;
|
|
65
|
+
/** Machine-readable fields every command result carries alongside its `diagnostics`. */
|
|
66
|
+
export declare function coverageGapResultFields(diagnostics: readonly string[]): {
|
|
67
|
+
coverageGapCount: number;
|
|
68
|
+
coverageGaps: CoverageGapEvent[];
|
|
69
|
+
};
|
|
70
|
+
/** "dropped", "dropped or skipped", "dropped, skipped, or defaulted" for the kinds present. */
|
|
71
|
+
export declare function describeGapKinds(events: readonly CoverageGapEvent[]): string;
|
|
72
|
+
/**
|
|
73
|
+
* edk#1477: opt-in strict coverage. With `--strict-coverage` (or
|
|
74
|
+
* `ELEMENTUM_STRICT_COVERAGE=1`), a command that would otherwise succeed with
|
|
75
|
+
* coverage gaps exits {@link STRICT_COVERAGE_EXIT_CODE} instead. The default is
|
|
76
|
+
* unchanged: gaps are warnings and the exit code is 0.
|
|
77
|
+
*/
|
|
78
|
+
export declare const STRICT_COVERAGE_ENV = "ELEMENTUM_STRICT_COVERAGE";
|
|
79
|
+
export declare const STRICT_COVERAGE_EXIT_CODE = 1;
|
|
80
|
+
export declare function strictCoverageEnabled(env?: NodeJS.ProcessEnv): boolean;
|
|
81
|
+
/** The exit code to use: a failing code is kept; a success with gaps becomes non-zero only in strict mode. */
|
|
82
|
+
export declare function strictCoverageExitCode(code: number, coverageGapCount: number, env?: NodeJS.ProcessEnv): number;
|
|
83
|
+
/** The message logged when strict mode turns a successful command into a failure. */
|
|
84
|
+
export declare function strictCoverageFailureMessage(command: string, coverageGapCount: number): string;
|
|
85
|
+
/** Why a strict apply was refused before touching the platform (edk#1477). */
|
|
86
|
+
export declare function strictCoverageApplyRefusalMessage(coverageGapCount: number): string;
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* edk#914 / edk#1473: which build/pull diagnostics are coverage gaps (config
|
|
3
|
+
* EDK dropped, skipped, defaulted, or could not carry), and one typed event
|
|
4
|
+
* per gap.
|
|
5
|
+
*
|
|
6
|
+
* Every command counts gaps with the same definition, {@link coverageGapMessages}:
|
|
7
|
+
* the distinct diagnostics minus advisories. Plan/apply status, build status,
|
|
8
|
+
* and the `coverageGapCount` in build and pull JSON all use it.
|
|
9
|
+
*
|
|
10
|
+
* Advisory diagnostics are not gaps. They are still printed as warnings, but
|
|
11
|
+
* the config they mention is built and applied as authored:
|
|
12
|
+
* - skill input-coverage lint (`skill "x" input coverage gap [input-schema-missing]: …`)
|
|
13
|
+
* - the unbumped-automation revision reminder
|
|
14
|
+
*
|
|
15
|
+
* The ~600 emit sites push free-form `"<where>: <what>; dropped"` strings.
|
|
16
|
+
* Rather than rewrite every site, they are classified here, where they leave
|
|
17
|
+
* the engine. A gap's event goes away when its site stops pushing the
|
|
18
|
+
* diagnostic.
|
|
19
|
+
*/
|
|
20
|
+
const INPUT_COVERAGE = /^(skill "[^"]*") input coverage gap \[([a-z-]+)\]: /;
|
|
21
|
+
const ADVISORY_DIAGNOSTICS = [
|
|
22
|
+
INPUT_COVERAGE,
|
|
23
|
+
/^automation \S+: compiled steps changed since the last apply but its revision is still /,
|
|
24
|
+
/^applied-automation-revisions\.json .*; until then no automation is checked for an edit without a revision bump$/,
|
|
25
|
+
];
|
|
26
|
+
export function isAdvisoryDiagnostic(message) {
|
|
27
|
+
return ADVISORY_DIAGNOSTICS.some((pattern) => pattern.test(message));
|
|
28
|
+
}
|
|
29
|
+
/** The distinct, non-advisory diagnostics: one entry per coverage gap. */
|
|
30
|
+
export function coverageGapMessages(diagnostics) {
|
|
31
|
+
return [...new Set(diagnostics.filter((message) => !isAdvisoryDiagnostic(message)))];
|
|
32
|
+
}
|
|
33
|
+
const CONSEQUENCE = {
|
|
34
|
+
dropped: "this setting is not built or applied; the platform keeps its current value",
|
|
35
|
+
skipped: "this item is not built or applied",
|
|
36
|
+
defaulted: "a default is used instead of the authored or live value",
|
|
37
|
+
unsupported: "EDK cannot carry this yet; it is not built or applied",
|
|
38
|
+
degraded: "the built config may not match the platform; check this before applying",
|
|
39
|
+
advisory: "nothing is dropped; the config is built and applied as authored",
|
|
40
|
+
};
|
|
41
|
+
function classify(message) {
|
|
42
|
+
if (isAdvisoryDiagnostic(message))
|
|
43
|
+
return "advisory";
|
|
44
|
+
// A negated outcome ("not dropped", "was not skipped") is not that outcome.
|
|
45
|
+
const m = message.toLowerCase().replace(/\b(?:not|never|n't) (?:be |been |was |were |is )?(?:dropped|omitted|skipped|defaulted)\b/g, "");
|
|
46
|
+
if (/not (yet )?supported|unsupported|not carried by|no terraform-path encoding|without extractors/.test(m))
|
|
47
|
+
return "unsupported";
|
|
48
|
+
if (/\b(dropped|omitted)\b/.test(m))
|
|
49
|
+
return "dropped";
|
|
50
|
+
if (/\bskipped\b|was not printed|not included/.test(m))
|
|
51
|
+
return "skipped";
|
|
52
|
+
if (/\bdefaulted to\b|\bdefaulting to\b/.test(m))
|
|
53
|
+
return "defaulted";
|
|
54
|
+
return "degraded";
|
|
55
|
+
}
|
|
56
|
+
/** Split `"<entity>: <detail>"`; an entity is a short leading label with no sentence punctuation. */
|
|
57
|
+
function splitEntity(message) {
|
|
58
|
+
const coverage = INPUT_COVERAGE.exec(message);
|
|
59
|
+
if (coverage !== null)
|
|
60
|
+
return { entity: coverage[1], detail: message.slice(coverage[1].length + 1) };
|
|
61
|
+
const index = message.indexOf(": ");
|
|
62
|
+
if (index <= 0 || index > 160)
|
|
63
|
+
return { detail: message };
|
|
64
|
+
const head = message.slice(0, index);
|
|
65
|
+
if (/[;.!?]\s/.test(head))
|
|
66
|
+
return { detail: message };
|
|
67
|
+
return { entity: head, detail: message.slice(index + 2) };
|
|
68
|
+
}
|
|
69
|
+
const typedGaps = new Map();
|
|
70
|
+
/** The diagnostic for a typed gap: `<entity>: <detail> — <consequence>`. Push it like any diagnostic. */
|
|
71
|
+
export function typedCoverageGap(gap) {
|
|
72
|
+
const message = `${gap.entity}: ${gap.detail} — ${gap.consequence}`;
|
|
73
|
+
typedGaps.set(message, gap);
|
|
74
|
+
return message;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Forget the typed gaps of earlier commands. The CLI calls this at the start
|
|
78
|
+
* of every command so a long-lived process (the MCP server, tests) does not
|
|
79
|
+
* accumulate them.
|
|
80
|
+
*/
|
|
81
|
+
export function resetTypedCoverageGaps() {
|
|
82
|
+
typedGaps.clear();
|
|
83
|
+
}
|
|
84
|
+
/** The typed gap a diagnostic was built from, also when a caller prefixed it (`"<label>: <typed message>"`). */
|
|
85
|
+
function typedGapFor(message) {
|
|
86
|
+
const exact = typedGaps.get(message);
|
|
87
|
+
if (exact !== undefined)
|
|
88
|
+
return exact;
|
|
89
|
+
for (const [typed, gap] of typedGaps)
|
|
90
|
+
if (message.endsWith(`: ${typed}`))
|
|
91
|
+
return gap;
|
|
92
|
+
return undefined;
|
|
93
|
+
}
|
|
94
|
+
export function coverageGapEvent(message) {
|
|
95
|
+
const typed = typedGapFor(message);
|
|
96
|
+
if (typed !== undefined) {
|
|
97
|
+
return { kind: typed.kind, entity: typed.entity, detail: typed.detail, consequence: typed.consequence, message };
|
|
98
|
+
}
|
|
99
|
+
const kind = classify(message);
|
|
100
|
+
const { entity, detail } = splitEntity(message);
|
|
101
|
+
return { kind, ...(entity === undefined ? {} : { entity }), detail, consequence: CONSEQUENCE[kind], message };
|
|
102
|
+
}
|
|
103
|
+
export function coverageGapEvents(messages) {
|
|
104
|
+
return messages.map(coverageGapEvent);
|
|
105
|
+
}
|
|
106
|
+
/** One log line per diagnostic: `coverage gap (<kind>): <message> — <consequence>`, or `advisory: …`. */
|
|
107
|
+
export function formatCoverageGap(event) {
|
|
108
|
+
return event.kind === "advisory"
|
|
109
|
+
? `advisory: ${event.message}`
|
|
110
|
+
: event.message.endsWith(` — ${event.consequence}`)
|
|
111
|
+
? `coverage gap (${event.kind}): ${event.message}`
|
|
112
|
+
: `coverage gap (${event.kind}): ${event.message} — ${event.consequence}`;
|
|
113
|
+
}
|
|
114
|
+
/** Machine-readable fields every command result carries alongside its `diagnostics`. */
|
|
115
|
+
export function coverageGapResultFields(diagnostics) {
|
|
116
|
+
const coverageGaps = coverageGapEvents(coverageGapMessages(diagnostics));
|
|
117
|
+
return { coverageGapCount: coverageGaps.length, coverageGaps };
|
|
118
|
+
}
|
|
119
|
+
/** "dropped", "dropped or skipped", "dropped, skipped, or defaulted" for the kinds present. */
|
|
120
|
+
export function describeGapKinds(events) {
|
|
121
|
+
const words = {
|
|
122
|
+
dropped: "dropped", skipped: "skipped", defaulted: "defaulted", unsupported: "not carried by EDK", degraded: "possibly built differently from live", advisory: "",
|
|
123
|
+
};
|
|
124
|
+
const kinds = [...new Set(events.map((event) => event.kind).filter((kind) => kind !== "advisory"))].map((kind) => words[kind]);
|
|
125
|
+
if (kinds.length <= 1)
|
|
126
|
+
return kinds[0] ?? "";
|
|
127
|
+
if (kinds.length === 2)
|
|
128
|
+
return `${kinds[0]} or ${kinds[1]}`;
|
|
129
|
+
return `${kinds.slice(0, -1).join(", ")}, or ${kinds.at(-1)}`;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* edk#1477: opt-in strict coverage. With `--strict-coverage` (or
|
|
133
|
+
* `ELEMENTUM_STRICT_COVERAGE=1`), a command that would otherwise succeed with
|
|
134
|
+
* coverage gaps exits {@link STRICT_COVERAGE_EXIT_CODE} instead. The default is
|
|
135
|
+
* unchanged: gaps are warnings and the exit code is 0.
|
|
136
|
+
*/
|
|
137
|
+
export const STRICT_COVERAGE_ENV = "ELEMENTUM_STRICT_COVERAGE";
|
|
138
|
+
export const STRICT_COVERAGE_EXIT_CODE = 1;
|
|
139
|
+
export function strictCoverageEnabled(env = process.env) {
|
|
140
|
+
const value = env[STRICT_COVERAGE_ENV]?.trim().toLowerCase();
|
|
141
|
+
return value === "1" || value === "true" || value === "yes";
|
|
142
|
+
}
|
|
143
|
+
/** The exit code to use: a failing code is kept; a success with gaps becomes non-zero only in strict mode. */
|
|
144
|
+
export function strictCoverageExitCode(code, coverageGapCount, env = process.env) {
|
|
145
|
+
if (code !== 0 || coverageGapCount === 0 || !strictCoverageEnabled(env))
|
|
146
|
+
return code;
|
|
147
|
+
return STRICT_COVERAGE_EXIT_CODE;
|
|
148
|
+
}
|
|
149
|
+
/** The message logged when strict mode turns a successful command into a failure. */
|
|
150
|
+
export function strictCoverageFailureMessage(command, coverageGapCount) {
|
|
151
|
+
return `${command}: --strict-coverage: ${coverageGapCount} coverage gap${coverageGapCount === 1 ? "" : "s"} (see the warnings above); exiting ${STRICT_COVERAGE_EXIT_CODE}`;
|
|
152
|
+
}
|
|
153
|
+
/** Why a strict apply was refused before touching the platform (edk#1477). */
|
|
154
|
+
export function strictCoverageApplyRefusalMessage(coverageGapCount) {
|
|
155
|
+
return `apply: --strict-coverage: build reported ${coverageGapCount} coverage gap${coverageGapCount === 1 ? "" : "s"} (see the warnings above); refusing to apply, nothing was changed on the platform`;
|
|
156
|
+
}
|
|
@@ -22,7 +22,13 @@ import { type PartialReadEvent, type ProgressEvent } from "../logging.js";
|
|
|
22
22
|
export declare class EiRunError extends Error {
|
|
23
23
|
readonly exitCode: number | null;
|
|
24
24
|
readonly stderr?: string;
|
|
25
|
-
|
|
25
|
+
/**
|
|
26
|
+
* Captured stdout of the failed run, when the caller asked for it to be
|
|
27
|
+
* captured (runEiCapture). For `plan -json` this carries OpenTofu's
|
|
28
|
+
* `diagnostic` events — the actual reason the plan failed (edk#1402).
|
|
29
|
+
*/
|
|
30
|
+
readonly stdout?: string;
|
|
31
|
+
constructor(message: string, exitCode: number | null, stderr?: string, stdout?: string);
|
|
26
32
|
}
|
|
27
33
|
export declare function configureBridgeProfile(profile: string | undefined): void;
|
|
28
34
|
export declare function configuredBridgeProfile(): string | undefined;
|
|
@@ -124,6 +130,7 @@ export declare function runOpenTofuCapture(args: readonly string[], opts?: {
|
|
|
124
130
|
*/
|
|
125
131
|
export declare function runEiCapture(args: readonly string[], opts?: {
|
|
126
132
|
cwd?: string;
|
|
133
|
+
env?: NodeJS.ProcessEnv;
|
|
127
134
|
suppressStderr?: boolean;
|
|
128
135
|
echoStdout?: boolean;
|
|
129
136
|
tofuJsonProgress?: {
|
|
@@ -147,3 +154,16 @@ export declare function parseTofuJsonEvent(line: string): TofuJsonEvent;
|
|
|
147
154
|
export declare function runEiCaptureCombined(args: readonly string[], opts?: {
|
|
148
155
|
cwd?: string;
|
|
149
156
|
}): Promise<string>;
|
|
157
|
+
/** Max characters kept per diagnostic (edk#1402). */
|
|
158
|
+
export declare const TOFU_DIAGNOSTIC_MAX_CHARS = 1000;
|
|
159
|
+
/** Max diagnostics reported after a failed plan (edk#1402). */
|
|
160
|
+
export declare const TOFU_DIAGNOSTIC_MAX_ENTRIES = 50;
|
|
161
|
+
/** Cap a diagnostic list to `max` entries, adding an "… and N more" line. */
|
|
162
|
+
export declare function capTofuDiagnostics(diagnostics: readonly string[], max?: number): string[];
|
|
163
|
+
/**
|
|
164
|
+
* Error diagnostics from a failed OpenTofu run: `diagnostic` events with
|
|
165
|
+
* severity error from `-json` stdout, plus human `Error:` blocks from stderr.
|
|
166
|
+
* Deduplicated, in order. Used to explain why `ei plan` failed instead of
|
|
167
|
+
* discarding its output (edk#1402).
|
|
168
|
+
*/
|
|
169
|
+
export declare function tofuErrorDiagnostics(stdout: string | undefined, stderr: string | undefined): string[];
|
|
@@ -40,10 +40,17 @@ function exitCodeFor(code, signal) {
|
|
|
40
40
|
export class EiRunError extends Error {
|
|
41
41
|
exitCode;
|
|
42
42
|
stderr;
|
|
43
|
-
|
|
43
|
+
/**
|
|
44
|
+
* Captured stdout of the failed run, when the caller asked for it to be
|
|
45
|
+
* captured (runEiCapture). For `plan -json` this carries OpenTofu's
|
|
46
|
+
* `diagnostic` events — the actual reason the plan failed (edk#1402).
|
|
47
|
+
*/
|
|
48
|
+
stdout;
|
|
49
|
+
constructor(message, exitCode, stderr, stdout) {
|
|
44
50
|
super(message);
|
|
45
51
|
this.exitCode = exitCode;
|
|
46
52
|
this.stderr = stderr;
|
|
53
|
+
this.stdout = stdout;
|
|
47
54
|
this.name = "EiRunError";
|
|
48
55
|
}
|
|
49
56
|
}
|
|
@@ -810,6 +817,7 @@ export function runEiCapture(args, opts) {
|
|
|
810
817
|
child = spawnBridge(args, {
|
|
811
818
|
stdio: ["ignore", "pipe", "pipe"],
|
|
812
819
|
cwd: opts?.cwd,
|
|
820
|
+
env: opts?.env,
|
|
813
821
|
});
|
|
814
822
|
}
|
|
815
823
|
catch (error) {
|
|
@@ -905,7 +913,7 @@ export function runEiCapture(args, opts) {
|
|
|
905
913
|
const exit = exitCodeFor(code, signal);
|
|
906
914
|
const stderr = Buffer.concat(stderrChunks).toString("utf8");
|
|
907
915
|
if (exit !== 0) {
|
|
908
|
-
reject(new EiRunError(`ei ${args.join(" ")} exited with code ${exit}
|
|
916
|
+
reject(new EiRunError(`ei ${args.join(" ")} exited with code ${exit}`, exit, stderr, Buffer.concat(chunks).toString("utf8")));
|
|
909
917
|
return;
|
|
910
918
|
}
|
|
911
919
|
resolvePromise(Buffer.concat(chunks).toString("utf8"));
|
|
@@ -1130,3 +1138,82 @@ function wrapOpenTofuSpawnError(e) {
|
|
|
1130
1138
|
}
|
|
1131
1139
|
return new EiRunError(`failed to run managed OpenTofu: ${e.message}`, null);
|
|
1132
1140
|
}
|
|
1141
|
+
/** Max characters kept per diagnostic (edk#1402). */
|
|
1142
|
+
export const TOFU_DIAGNOSTIC_MAX_CHARS = 1000;
|
|
1143
|
+
/** Max diagnostics reported after a failed plan (edk#1402). */
|
|
1144
|
+
export const TOFU_DIAGNOSTIC_MAX_ENTRIES = 50;
|
|
1145
|
+
/** Source-snippet / expression-value lines in a human Error: block. */
|
|
1146
|
+
const TOFU_SNIPPET_LINE = /^(?:\d+:|[\u251c\u2502\u2514]|\(and \d+ more\))/;
|
|
1147
|
+
/** `with var.x,` / `on main.tf line 4, in …:` lines; only dropped inside the leading location block. */
|
|
1148
|
+
const TOFU_WITH_LINE = /^with [^ ]+,$/;
|
|
1149
|
+
const TOFU_LOCATION_LINE = /^on .+ line \d+(?:, in .+)?:$/;
|
|
1150
|
+
/** Cap a diagnostic list to `max` entries, adding an "… and N more" line. */
|
|
1151
|
+
export function capTofuDiagnostics(diagnostics, max = TOFU_DIAGNOSTIC_MAX_ENTRIES) {
|
|
1152
|
+
if (diagnostics.length <= max)
|
|
1153
|
+
return [...diagnostics];
|
|
1154
|
+
return [...diagnostics.slice(0, max), `… and ${diagnostics.length - max} more error(s)`];
|
|
1155
|
+
}
|
|
1156
|
+
/**
|
|
1157
|
+
* Error diagnostics from a failed OpenTofu run: `diagnostic` events with
|
|
1158
|
+
* severity error from `-json` stdout, plus human `Error:` blocks from stderr.
|
|
1159
|
+
* Deduplicated, in order. Used to explain why `ei plan` failed instead of
|
|
1160
|
+
* discarding its output (edk#1402).
|
|
1161
|
+
*/
|
|
1162
|
+
export function tofuErrorDiagnostics(stdout, stderr) {
|
|
1163
|
+
const out = [];
|
|
1164
|
+
const seen = new Set();
|
|
1165
|
+
const add = (message) => {
|
|
1166
|
+
let trimmed = message.replace(/\s+/g, " ").trim();
|
|
1167
|
+
if (trimmed.length > TOFU_DIAGNOSTIC_MAX_CHARS)
|
|
1168
|
+
trimmed = `${trimmed.slice(0, TOFU_DIAGNOSTIC_MAX_CHARS)}… (truncated)`;
|
|
1169
|
+
if (trimmed === "" || seen.has(trimmed))
|
|
1170
|
+
return;
|
|
1171
|
+
seen.add(trimmed);
|
|
1172
|
+
out.push(trimmed);
|
|
1173
|
+
};
|
|
1174
|
+
for (const line of (stdout ?? "").split("\n")) {
|
|
1175
|
+
if (line.trim() === "")
|
|
1176
|
+
continue;
|
|
1177
|
+
const event = parseTofuJsonEvent(line);
|
|
1178
|
+
if (event.type === "diagnostic" && event.level === "ERROR")
|
|
1179
|
+
add(event.message);
|
|
1180
|
+
}
|
|
1181
|
+
const lines = (stderr ?? "").split("\n").map((l) => l.replace(ANSI_SEQUENCE, "").replace(/\r$/, ""));
|
|
1182
|
+
for (let i = 0; i < lines.length; i++) {
|
|
1183
|
+
const match = /^(?:\u2502\s*)?Error:\s*(.+)$/.exec(lines[i].trim());
|
|
1184
|
+
if (match === null)
|
|
1185
|
+
continue;
|
|
1186
|
+
// Split the block body into blank-line-separated paragraphs. Real OpenTofu
|
|
1187
|
+
// text output is: Error line, blank, location + source snippet (+ optional
|
|
1188
|
+
// ├──/│ expression values), blank, explanation. Drop the location paragraph
|
|
1189
|
+
// and any snippet/value lines so only the explanation is kept; snippets can
|
|
1190
|
+
// carry config literals and non-sensitive variable values.
|
|
1191
|
+
const paragraphs = [[]];
|
|
1192
|
+
for (let j = i + 1; j < lines.length; j++) {
|
|
1193
|
+
const raw = lines[j];
|
|
1194
|
+
const next = raw.replace(/^\s*\u2502\s?/, "").trim();
|
|
1195
|
+
if (/^Error:/.test(next) || raw.trim().startsWith("\u2575"))
|
|
1196
|
+
break;
|
|
1197
|
+
if (next === "") {
|
|
1198
|
+
if (paragraphs[paragraphs.length - 1].length > 0)
|
|
1199
|
+
paragraphs.push([]);
|
|
1200
|
+
continue;
|
|
1201
|
+
}
|
|
1202
|
+
paragraphs[paragraphs.length - 1].push(next);
|
|
1203
|
+
}
|
|
1204
|
+
const nonEmpty = paragraphs.filter((p) => p.length > 0);
|
|
1205
|
+
// The leading location block (with/on + snippet + expression values) is
|
|
1206
|
+
// dropped whole: multi-line values and heredocs have unprefixed lines that
|
|
1207
|
+
// no line filter can recognise. Line filters remain a second layer for
|
|
1208
|
+
// snippet/value lines elsewhere.
|
|
1209
|
+
const isLocationBlock = (p) => TOFU_WITH_LINE.test(p[0]) || TOFU_LOCATION_LINE.test(p[0]);
|
|
1210
|
+
const detail = nonEmpty
|
|
1211
|
+
.filter((p, idx) => !(idx === 0 && isLocationBlock(p)))
|
|
1212
|
+
.map((p) => p.filter((l) => !TOFU_SNIPPET_LINE.test(l)))
|
|
1213
|
+
.filter((p) => p.length > 0)
|
|
1214
|
+
.map((p) => p.join(" "))
|
|
1215
|
+
.join(" ");
|
|
1216
|
+
add(detail !== "" ? `${match[1]}: ${detail}` : match[1]);
|
|
1217
|
+
}
|
|
1218
|
+
return out;
|
|
1219
|
+
}
|