@elementumai/edk 0.9.19 → 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 +159 -7
- package/dist-sdk/src/catalog/factories.d.ts +33 -2
- package/dist-sdk/src/catalog/factories.js +40 -1
- package/dist-sdk/src/catalog/from-authoring.d.ts +13 -8
- package/dist-sdk/src/catalog/from-authoring.js +34 -9
- package/dist-sdk/src/catalog/index.d.ts +2 -2
- package/dist-sdk/src/catalog/index.js +2 -2
- package/dist-sdk/src/catalog/render.js +6 -6
- package/dist-sdk/src/catalog/token.js +11 -0
- package/dist-sdk/src/catalog/types.d.ts +40 -1
- package/dist-sdk/src/catalog/types.js +12 -0
- package/dist-sdk/src/core/triggers/on-demand.d.ts +40 -4
- package/dist-sdk/src/core/triggers/on-demand.js +17 -2
- package/dist-sdk/src/core/types/app.d.ts +2 -2
- package/dist-sdk/src/engine/build/context.d.ts +1 -1
- 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 +169 -0
- package/dist-sdk/src/engine/ei/run.js +1219 -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/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/ref-only.d.ts +5 -0
- package/dist-sdk/src/engine/pull/ref-only.js +10 -7
- package/dist-sdk/src/engine/pull/result-output.d.ts +6 -0
- package/dist-sdk/src/engine/pull/result-output.js +113 -3
- package/dist-sdk/src/engine/tf/expr.js +1 -1
- package/dist-sdk/src/engine/tf/index.d.ts +2 -2
- package/dist-sdk/src/engine/tf/index.js +1 -1
- package/dist-sdk/src/engine/tf/labels.d.ts +28 -5
- package/dist-sdk/src/engine/tf/labels.js +54 -3
- package/dist-sdk/src/engine/tf/model.d.ts +22 -1
- package/dist-sdk/src/engine/tf/parse.js +93 -4
- package/dist-sdk/src/engine/tf/render.d.ts +4 -2
- package/dist-sdk/src/engine/tf/render.js +41 -7
- package/dist-sdk/src/engine/validation.d.ts +44 -0
- package/dist-sdk/src/engine/validation.js +95 -0
- 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/access-policy/to-tf.js +5 -2
- package/dist-sdk/src/entities/agent/build.d.ts +4 -16
- package/dist-sdk/src/entities/agent/build.js +40 -5
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.d.ts +3 -0
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +46 -21
- 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 +20 -6
- package/dist-sdk/src/entities/agent-tool/from-tf.d.ts +10 -1
- package/dist-sdk/src/entities/agent-tool/from-tf.js +18 -6
- package/dist-sdk/src/entities/agent-tool/module.js +3 -0
- package/dist-sdk/src/entities/agent-tool/to-tf.d.ts +2 -2
- package/dist-sdk/src/entities/agent-tool/to-tf.js +27 -5
- package/dist-sdk/src/entities/app/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 +105 -22
- package/dist-sdk/src/entities/app/build.js +107 -10
- 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 -2
- package/dist-sdk/src/entities/app/index.d.ts +7 -6
- package/dist-sdk/src/entities/app/index.js +2 -8
- package/dist-sdk/src/entities/app/module.js +5 -2
- package/dist-sdk/src/entities/app/to-tf.d.ts +6 -0
- package/dist-sdk/src/entities/app/to-tf.js +40 -13
- package/dist-sdk/src/entities/automation/build.d.ts +56 -6
- package/dist-sdk/src/entities/automation/build.js +230 -26
- package/dist-sdk/src/entities/automation/calculation-expression.d.ts +7 -7
- package/dist-sdk/src/entities/automation/deserializer/print-automation.d.ts +41 -5
- package/dist-sdk/src/entities/automation/deserializer/print-automation.js +470 -58
- package/dist-sdk/src/entities/automation/from-tf.d.ts +37 -8
- package/dist-sdk/src/entities/automation/from-tf.js +791 -131
- 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 +3 -0
- package/dist-sdk/src/entities/automation/module.js +107 -15
- 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 +20 -0
- package/dist-sdk/src/entities/automation/script-code.js +109 -5
- package/dist-sdk/src/entities/automation/system-ref-name.js +4 -0
- package/dist-sdk/src/entities/automation/task-output-labels.d.ts +39 -0
- package/dist-sdk/src/entities/automation/task-output-labels.js +85 -0
- package/dist-sdk/src/entities/automation/tasks.d.ts +116 -22
- package/dist-sdk/src/entities/automation/tasks.js +86 -24
- package/dist-sdk/src/entities/automation/to-tf.d.ts +24 -3
- package/dist-sdk/src/entities/automation/to-tf.js +1082 -132
- package/dist-sdk/src/entities/automation/triggers.d.ts +12 -6
- package/dist-sdk/src/entities/automation/triggers.js +4 -0
- 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/chart/to-tf.js +10 -3
- package/dist-sdk/src/entities/data-lookup/module.js +2 -0
- package/dist-sdk/src/entities/dynamic-layout/build.d.ts +24 -31
- 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 +28 -13
- package/dist-sdk/src/entities/element/build.js +5 -1
- package/dist-sdk/src/entities/element/from-tf.d.ts +11 -0
- package/dist-sdk/src/entities/element/from-tf.js +62 -1
- package/dist-sdk/src/entities/element/index.d.ts +5 -3
- package/dist-sdk/src/entities/element/index.js +1 -0
- package/dist-sdk/src/entities/element/module.js +9 -3
- package/dist-sdk/src/entities/element/to-tf.d.ts +1 -1
- package/dist-sdk/src/entities/element/to-tf.js +16 -16
- package/dist-sdk/src/entities/field/build.d.ts +17 -3
- package/dist-sdk/src/entities/field/build.js +3 -0
- package/dist-sdk/src/entities/field/calc.d.ts +7 -7
- package/dist-sdk/src/entities/field/from-tf.d.ts +5 -4
- package/dist-sdk/src/entities/field/from-tf.js +244 -49
- 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 +2 -0
- package/dist-sdk/src/entities/field/options.js +6 -1
- package/dist-sdk/src/entities/field/to-tf.d.ts +26 -5
- package/dist-sdk/src/entities/field/to-tf.js +137 -15
- 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/file-reader/from-tf.js +14 -5
- package/dist-sdk/src/entities/file-reader/module.js +1 -0
- package/dist-sdk/src/entities/file-reader/types.d.ts +2 -0
- package/dist-sdk/src/entities/file-reader/types.js +1 -1
- package/dist-sdk/src/entities/portal/build.d.ts +26 -0
- package/dist-sdk/src/entities/portal/build.js +37 -0
- package/dist-sdk/src/entities/portal/from-tf.d.ts +27 -0
- package/dist-sdk/src/entities/portal/from-tf.js +75 -0
- package/dist-sdk/src/entities/portal/index.d.ts +1 -0
- package/dist-sdk/src/entities/portal/index.js +1 -0
- package/dist-sdk/src/entities/portal/module.d.ts +3 -0
- package/dist-sdk/src/entities/portal/module.js +28 -0
- package/dist-sdk/src/entities/portal/to-tf.d.ts +12 -0
- package/dist-sdk/src/entities/portal/to-tf.js +73 -0
- package/dist-sdk/src/entities/portal/types.d.ts +1 -0
- package/dist-sdk/src/entities/portal/types.js +1 -0
- package/dist-sdk/src/entities/relationship/module.js +2 -0
- package/dist-sdk/src/entities/relationship/pair-check.d.ts +7 -0
- package/dist-sdk/src/entities/relationship/pair-check.js +68 -0
- package/dist-sdk/src/entities/relationship/to-tf.d.ts +2 -0
- package/dist-sdk/src/entities/relationship/to-tf.js +12 -3
- package/dist-sdk/src/entities/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/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 +20 -8
- 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/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/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 +23 -1
- package/dist-sdk/src/entities/shared/filters/ast.js +2 -0
- package/dist-sdk/src/entities/shared/filters/index.d.ts +7 -0
- package/dist-sdk/src/entities/shared/filters/index.js +19 -4
- package/dist-sdk/src/entities/shared/filters/print.js +24 -3
- package/dist-sdk/src/entities/shared/filters/tf-codec.d.ts +7 -0
- package/dist-sdk/src/entities/shared/filters/tf-codec.js +46 -7
- package/dist-sdk/src/entities/shared/filters/types.d.ts +15 -2
- 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 +20 -5
- package/dist-sdk/src/entities/shared/types/field-types.js +8 -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 +14 -6
- package/dist-sdk/src/entities/skill/from-tf.js +70 -15
- 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 +2 -0
- package/dist-sdk/src/entities/skill/to-tf.js +14 -4
- package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +2 -0
- package/dist-sdk/src/entities/skill-tool/from-tf.js +49 -10
- package/dist-sdk/src/entities/skill-tool/module.js +3 -0
- package/dist-sdk/src/entities/skill-tool/to-tf.d.ts +2 -8
- package/dist-sdk/src/entities/skill-tool/to-tf.js +49 -14
- package/dist-sdk/src/entities/table/catalog.d.ts +14 -0
- package/dist-sdk/src/entities/table/catalog.js +66 -0
- package/dist-sdk/src/entities/table/module.js +2 -1
- package/dist-sdk/src/entities/table/to-tf.js +2 -2
- package/dist-sdk/src/entities/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/agent-view-layout-from-tf.d.ts +49 -9
- package/dist-sdk/src/entities/view/agent-view-layout-from-tf.js +71 -18
- package/dist-sdk/src/entities/view/agent-view-layout-to-tf.d.ts +19 -4
- package/dist-sdk/src/entities/view/agent-view-layout-to-tf.js +82 -10
- package/dist-sdk/src/entities/view/agent-view-layout.d.ts +53 -23
- package/dist-sdk/src/entities/view/agent-view-layout.js +1 -1
- package/dist-sdk/src/entities/view/from-tf.d.ts +3 -2
- package/dist-sdk/src/entities/view/from-tf.js +133 -13
- package/dist-sdk/src/entities/view/module.js +30 -3
- package/dist-sdk/src/entities/view/to-tf.d.ts +20 -8
- package/dist-sdk/src/entities/view/to-tf.js +86 -18
- package/dist-sdk/src/entities/view/types.d.ts +4 -15
- package/dist-sdk/src/entities/view/types.js +15 -15
- package/dist-sdk/src/entities/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/build.d.ts +16 -1
- package/dist-sdk/src/entities/widget/build.js +11 -1
- 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 +41 -14
- package/dist-sdk/src/generated/ragnarok/ragnarok-spec.d.ts +148 -13
- package/dist-sdk/src/generated/ragnarok/ragnarok-spec.js +2 -2
- package/dist-sdk/src/graph/index.d.ts +12 -0
- package/dist-sdk/src/graph/index.js +21 -0
- package/dist-sdk/src/graph/modules.js +2 -0
- package/dist-sdk/src/graph/types.d.ts +83 -4
- package/dist-sdk/src/internal/sdk-package.d.ts +1 -1
- package/dist-sdk/src/internal/sdk-package.js +1 -0
- package/package.json +16 -3
|
@@ -36,7 +36,7 @@ import type { AiProviderLlmModel, AiProviderType } from "./ai-provider-models.js
|
|
|
36
36
|
* resolved to the current-version param/output id via the parent
|
|
37
37
|
* automation's state binding.
|
|
38
38
|
*/
|
|
39
|
-
export type CatalogRefKind = "automation" | "agent" | "agent-evaluation" | "chart" | "dashboard" | "widget" | "skill" | "visual-flow" | "approvalChain" | "table" | "tableColumn" | "cloudLink" | "storedFunction" | "procedure" | "field" | "searchTable" | "documentModel" | "documentModelField" | "connector" | "aiProvider" | "category" | "group" | "phoneProvider" | "phone-service" | "datamine" | "app" | "element" | "task" | "triggerParameter" | "outputProperty";
|
|
39
|
+
export type CatalogRefKind = "automation" | "agent" | "agent-evaluation" | "chart" | "dashboard" | "widget" | "skill" | "visual-flow" | "approvalChain" | "table" | "tableColumn" | "cloudLink" | "storedFunction" | "procedure" | "field" | "view" | "searchTable" | "documentModel" | "documentModelField" | "connector" | "aiProvider" | "category" | "group" | "phoneProvider" | "phone-service" | "datamine" | "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.
|
|
@@ -116,6 +116,15 @@ export interface TableRef<RefName extends string = string, Columns extends Reado
|
|
|
116
116
|
export interface SearchTableRef<Parent extends string = string, RefName extends string = string> extends CatalogRef<"searchTable", RefName, Parent> {
|
|
117
117
|
/** Display name of a table owner when the reference is outside the workspace. */
|
|
118
118
|
readonly parentName?: string;
|
|
119
|
+
/**
|
|
120
|
+
* Identity of one search table when `name` is not unique on its owner.
|
|
121
|
+
* The id belongs to one organization and only resolves there. A promotion
|
|
122
|
+
* or a fresh org returns Search Table Not Found. Give the rows distinct
|
|
123
|
+
* names when the reference has to move between orgs. Build sends this id
|
|
124
|
+
* on the lookup, where it wins over `name`. Leave it unset when the name
|
|
125
|
+
* is unique.
|
|
126
|
+
*/
|
|
127
|
+
readonly id?: string;
|
|
119
128
|
}
|
|
120
129
|
export type TableOwnedSearchTableRef<Parent extends string = string, RefName extends string = string> = SearchTableRef<Parent, RefName> & {
|
|
121
130
|
readonly __variant: "table";
|
|
@@ -132,6 +141,12 @@ export interface DatamineRef<Parent extends string = string, RefName extends str
|
|
|
132
141
|
/** Map of column refName / sanitized key → display name for column resolution in filters. */
|
|
133
142
|
readonly columnNames?: Readonly<Record<string, string>>;
|
|
134
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>;
|
|
135
150
|
/** Public reference to an AI service/model selected for runtime use. */
|
|
136
151
|
export type AiServiceRef = CatalogRef<"connector">;
|
|
137
152
|
/** @internal Backend compatibility name. Prefer {@link AiServiceRef} on authoring surfaces. */
|
|
@@ -212,6 +227,30 @@ export interface RecordIdentityRef<Target extends AppOrElementRef | TaskCatalogR
|
|
|
212
227
|
readonly name: "Record ID";
|
|
213
228
|
readonly target: Target;
|
|
214
229
|
}
|
|
230
|
+
/** The kinds of managed view an app or element owns, as their authoring bags name them. */
|
|
231
|
+
export declare const viewType: {
|
|
232
|
+
readonly list: "list";
|
|
233
|
+
readonly calendar: "calendar";
|
|
234
|
+
readonly kanban: "kanban";
|
|
235
|
+
readonly dashboard: "dashboard";
|
|
236
|
+
readonly agent: "agent";
|
|
237
|
+
readonly custom: "custom";
|
|
238
|
+
};
|
|
239
|
+
export type ViewType = (typeof viewType)[keyof typeof viewType];
|
|
240
|
+
/**
|
|
241
|
+
* A managed view, by its owner and name (`catalog.<app>.views.<view>`). The
|
|
242
|
+
* owner identity is stamped by `appCatalog`/`elementCatalog`, so a reference
|
|
243
|
+
* from another stream root (a portal's menu) can resolve the view by owner
|
|
244
|
+
* and name without an id.
|
|
245
|
+
*/
|
|
246
|
+
export interface ViewRef<Parent extends string = string, RefName extends string = string> extends CatalogRef<"view", RefName, Parent> {
|
|
247
|
+
readonly parent: Parent;
|
|
248
|
+
/** Which authoring bag holds the view; unset on a view of an owner outside this workspace. */
|
|
249
|
+
readonly viewType?: ViewType;
|
|
250
|
+
readonly parentKind?: "app" | "element";
|
|
251
|
+
readonly parentName?: string;
|
|
252
|
+
readonly parentNamespace?: string;
|
|
253
|
+
}
|
|
215
254
|
/**
|
|
216
255
|
* A field reference. Beyond the shared surface it carries `fieldType` (the
|
|
217
256
|
* platform field type — `"TEXT"`, `"PICKLIST"`, …) so builders can constrain
|
|
@@ -27,6 +27,15 @@
|
|
|
27
27
|
export const PROCEDURE_PARAMETER_TYPES = [
|
|
28
28
|
"BOOLEAN", "DATE", "DATETIME", "DECIMAL", "HANDLE", "JSON", "LONG", "TEXT", "UUID",
|
|
29
29
|
];
|
|
30
|
+
/** The kinds of managed view an app or element owns, as their authoring bags name them. */
|
|
31
|
+
export const viewType = {
|
|
32
|
+
list: "list",
|
|
33
|
+
calendar: "calendar",
|
|
34
|
+
kanban: "kanban",
|
|
35
|
+
dashboard: "dashboard",
|
|
36
|
+
agent: "agent",
|
|
37
|
+
custom: "custom",
|
|
38
|
+
};
|
|
30
39
|
/** Platform-owned user attributes accepted by user-search task filters. */
|
|
31
40
|
export const USER_FIELD_KEYS = ["firstName", "email", "jobTitle", "lastName"];
|
|
32
41
|
/** Platform-owned user-group attributes accepted by user-group-search task filters. */
|
|
@@ -54,8 +63,10 @@ export const REF_SCOPE = {
|
|
|
54
63
|
storedFunction: "org",
|
|
55
64
|
procedure: "org",
|
|
56
65
|
field: "app",
|
|
66
|
+
view: "app",
|
|
57
67
|
searchTable: "app",
|
|
58
68
|
datamine: "app",
|
|
69
|
+
relationship: "app",
|
|
59
70
|
documentModel: "app",
|
|
60
71
|
documentModelField: "app",
|
|
61
72
|
connector: "org",
|
|
@@ -67,6 +78,7 @@ export const REF_SCOPE = {
|
|
|
67
78
|
app: "registry",
|
|
68
79
|
element: "registry",
|
|
69
80
|
task: "registry",
|
|
81
|
+
portal: "registry",
|
|
70
82
|
triggerParameter: "app",
|
|
71
83
|
outputProperty: "app",
|
|
72
84
|
};
|
|
@@ -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,11 +18,23 @@ 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;
|
|
25
25
|
}
|
|
26
|
+
/** A user by email, as `userRef("person@example.com")` builds it. */
|
|
27
|
+
export interface OnDemandUserDefault {
|
|
28
|
+
readonly __kind: "user";
|
|
29
|
+
readonly email: string;
|
|
30
|
+
}
|
|
31
|
+
export interface UserIdTriggerInputFieldDef extends TriggerInputFieldDefBase {
|
|
32
|
+
type: "userId";
|
|
33
|
+
multiple?: boolean;
|
|
34
|
+
/** Resolved by email to the platform user id at apply; raw user ids are refused. */
|
|
35
|
+
defaultValue?: OnDemandUserDefault;
|
|
36
|
+
app?: never;
|
|
37
|
+
}
|
|
26
38
|
export interface RecordTriggerInputFieldDef<A extends AppOrElementRef = AppOrElementRef> extends TriggerInputFieldDefBase {
|
|
27
39
|
type: "record";
|
|
28
40
|
/** App or element whose record this input accepts; supplies the HCL default and typed record shape. */
|
|
@@ -30,7 +42,7 @@ export interface RecordTriggerInputFieldDef<A extends AppOrElementRef = AppOrEle
|
|
|
30
42
|
multiple?: false;
|
|
31
43
|
defaultValue?: never;
|
|
32
44
|
}
|
|
33
|
-
export type TriggerInputFieldDef = ScalarTriggerInputFieldDef | RecordTriggerInputFieldDef;
|
|
45
|
+
export type TriggerInputFieldDef = ScalarTriggerInputFieldDef | UserIdTriggerInputFieldDef | RecordTriggerInputFieldDef;
|
|
34
46
|
/**
|
|
35
47
|
* Schema object mapping field names to their definitions.
|
|
36
48
|
* Example:
|
|
@@ -46,9 +58,33 @@ export type TriggerInputSchema = Record<string, TriggerInputFieldDef>;
|
|
|
46
58
|
* app/element, so `ctx.trigger.<name>` has that target's RecordShape.
|
|
47
59
|
*/
|
|
48
60
|
type TriggerInputFieldToTS<D extends TriggerInputFieldDef> = D extends RecordTriggerInputFieldDef<infer A> ? RecordShape<A> : FieldTypeToTS<D["type"]>;
|
|
61
|
+
/** The user who ran an on-demand automation (the platform's "Triggered By" refs). */
|
|
62
|
+
export interface OnDemandTriggeredBy {
|
|
63
|
+
readonly id: string;
|
|
64
|
+
readonly email: string;
|
|
65
|
+
readonly name: string;
|
|
66
|
+
}
|
|
49
67
|
export type InferTriggerType<S extends TriggerInputSchema> = {
|
|
50
68
|
[K in keyof S]: TriggerInputFieldToTS<S[K]>;
|
|
51
69
|
};
|
|
70
|
+
/** Inputs the platform publishes no reference for: a userId input is only a Run Automation button binding. */
|
|
71
|
+
type UnreadableInputKeys<S> = {
|
|
72
|
+
[K in keyof S]: S[K] extends {
|
|
73
|
+
readonly type: "userId";
|
|
74
|
+
} ? K : never;
|
|
75
|
+
}[keyof S];
|
|
76
|
+
/**
|
|
77
|
+
* The on-demand `ctx.trigger`: readable inputs plus the user who ran the
|
|
78
|
+
* automation. `S` is the normalized authored schema. `triggeredBy` is
|
|
79
|
+
* reserved, so no input can shadow it. A schema with a `userId` input also
|
|
80
|
+
* loses the open string index, which would otherwise still type
|
|
81
|
+
* `ctx.trigger.<thatInput>` as a ref a task input accepts.
|
|
82
|
+
*/
|
|
83
|
+
export type WithOnDemandTriggeredBy<T, S> = {
|
|
84
|
+
[K in keyof T as K extends UnreadableInputKeys<S> ? never : string extends K ? [UnreadableInputKeys<S>] extends [never] ? K : never : K]: T[K];
|
|
85
|
+
} & {
|
|
86
|
+
readonly triggeredBy: OnDemandTriggeredBy;
|
|
87
|
+
};
|
|
52
88
|
export interface OnDemandTriggerDef<T, S extends TriggerInputSchema = TriggerInputSchema> {
|
|
53
89
|
readonly kind: "onDemand";
|
|
54
90
|
readonly schema: S;
|
|
@@ -103,7 +139,7 @@ type WireDefaultValue = {
|
|
|
103
139
|
} | {
|
|
104
140
|
datetime: string;
|
|
105
141
|
} | {
|
|
106
|
-
userId:
|
|
142
|
+
userId: OnDemandUserDefault;
|
|
107
143
|
} | {
|
|
108
144
|
attachmentId: string;
|
|
109
145
|
};
|
|
@@ -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.
|
|
@@ -77,8 +79,16 @@ function wrapDefaultValueForWire(alias, value) {
|
|
|
77
79
|
// Expected wire form: ISO-8601 instant — Jackson's Instant parser.
|
|
78
80
|
return { datetime: value };
|
|
79
81
|
case "user":
|
|
82
|
+
case "userId": {
|
|
80
83
|
// Mobius's record field is named `userId`, not `user`.
|
|
81
|
-
|
|
84
|
+
const user = value;
|
|
85
|
+
if (typeof user !== "object" || user === null || user.__kind !== "user" || typeof user.email !== "string" || !user.email.includes("@")) {
|
|
86
|
+
throw new TypeError(`onDemand input default value for type "userId" must be userRef("person@example.com") ` +
|
|
87
|
+
`(got ${JSON.stringify(value)}). Raw platform user ids are not portable between orgs; ` +
|
|
88
|
+
`the email is resolved to the user's id at apply.`);
|
|
89
|
+
}
|
|
90
|
+
return { userId: { __kind: "user", email: user.email } };
|
|
91
|
+
}
|
|
82
92
|
case "attachmentId":
|
|
83
93
|
return { attachmentId: value };
|
|
84
94
|
case "record":
|
|
@@ -88,12 +98,17 @@ function wrapDefaultValueForWire(alias, value) {
|
|
|
88
98
|
case "object":
|
|
89
99
|
throw new Error(`onDemand input default values are not supported for type "${alias}". ` +
|
|
90
100
|
`Defaults are only accepted for text / number / decimal / boolean / ` +
|
|
91
|
-
`date / datetime /
|
|
101
|
+
`date / datetime / userId. Drop the defaultValue, or pick a supported ` +
|
|
92
102
|
`type for this input.`);
|
|
93
103
|
}
|
|
94
104
|
}
|
|
95
105
|
export function serializeOnDemandTrigger(schema) {
|
|
96
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
|
+
}
|
|
97
112
|
if (def.type === "record") {
|
|
98
113
|
const runtimeDef = def;
|
|
99
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;
|
|
@@ -82,7 +82,7 @@ export interface OrgRefLookup {
|
|
|
82
82
|
* since it's usually the same value also used for the sibling
|
|
83
83
|
* `related_object_id` attribute.
|
|
84
84
|
*/
|
|
85
|
-
foreignField(type: string, tfLabel: string, objectId: TfValue, name: string): void;
|
|
85
|
+
foreignField(type: string, tfLabel: string, objectId: TfValue, name: string, extraAttrs?: Readonly<Record<string, TfValue>>): void;
|
|
86
86
|
}
|
|
87
87
|
/** A stream root discovered elsewhere in THIS workspace build, keyed by {@link workspaceAspectKey}. */
|
|
88
88
|
export interface WorkspaceAspect {
|
|
@@ -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
|
+
}
|