@lbdudc/linea-core 0.1.0 → 0.1.2
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 +230 -358
- package/dist/analysis/analyze.d.ts +0 -54
- package/dist/analysis/analyze.js +1 -70
- package/dist/analysis/analyze.js.map +1 -1
- package/dist/analysis/runtime.d.ts +4 -73
- package/dist/analysis/runtime.js +7 -100
- package/dist/analysis/runtime.js.map +1 -1
- package/dist/analysis/uvl-text.d.ts +8 -0
- package/dist/analysis/uvl-text.js +70 -0
- package/dist/analysis/uvl-text.js.map +1 -0
- package/dist/assets.d.ts +0 -12
- package/dist/assets.js +0 -25
- package/dist/assets.js.map +1 -1
- package/dist/ci/annotations.d.ts +6 -0
- package/dist/ci/annotations.js +12 -0
- package/dist/ci/annotations.js.map +1 -0
- package/dist/ci/leftovers.d.ts +25 -0
- package/dist/ci/leftovers.js +50 -0
- package/dist/ci/leftovers.js.map +1 -0
- package/dist/ci/pairwise.d.ts +11 -0
- package/dist/ci/pairwise.js +35 -0
- package/dist/ci/pairwise.js.map +1 -0
- package/dist/ci/pipeline.d.ts +18 -0
- package/dist/ci/pipeline.js +26 -0
- package/dist/ci/pipeline.js.map +1 -0
- package/dist/ci/select.d.ts +28 -0
- package/dist/ci/select.js +43 -0
- package/dist/ci/select.js.map +1 -0
- package/dist/ci/validate-specs.d.ts +52 -0
- package/dist/ci/validate-specs.js +212 -0
- package/dist/ci/validate-specs.js.map +1 -0
- package/dist/constants.d.ts +1 -60
- package/dist/constants.js +1 -58
- package/dist/constants.js.map +1 -1
- package/dist/derivation/derive.d.ts +0 -56
- package/dist/derivation/derive.js +21 -72
- package/dist/derivation/derive.js.map +1 -1
- package/dist/derivation/engine.d.ts +10 -42
- package/dist/derivation/engine.js +37 -68
- package/dist/derivation/engine.js.map +1 -1
- package/dist/derivation/selection-error.d.ts +7 -0
- package/dist/derivation/selection-error.js +13 -0
- package/dist/derivation/selection-error.js.map +1 -0
- package/dist/errors.d.ts +19 -47
- package/dist/errors.js +28 -47
- package/dist/errors.js.map +1 -1
- package/dist/feature-model/uvl.d.ts +52 -0
- package/dist/feature-model/uvl.js +191 -0
- package/dist/feature-model/uvl.js.map +1 -0
- package/dist/fs/archive.d.ts +0 -16
- package/dist/fs/archive.js +0 -36
- package/dist/fs/archive.js.map +1 -1
- package/dist/fs/diff.d.ts +0 -30
- package/dist/fs/diff.js +4 -65
- package/dist/fs/diff.js.map +1 -1
- package/dist/fs/format.d.ts +0 -16
- package/dist/fs/format.js +0 -52
- package/dist/fs/format.js.map +1 -1
- package/dist/fs/workspace.d.ts +0 -52
- package/dist/fs/workspace.js +0 -56
- package/dist/fs/workspace.js.map +1 -1
- package/dist/index.d.ts +23 -29
- package/dist/index.js +15 -35
- package/dist/index.js.map +1 -1
- package/dist/internal/guards.d.ts +0 -13
- package/dist/internal/guards.js +0 -13
- package/dist/internal/guards.js.map +1 -1
- package/dist/line/deletion.d.ts +33 -0
- package/dist/line/deletion.js +23 -0
- package/dist/line/deletion.js.map +1 -0
- package/dist/line/platform-files.d.ts +15 -64
- package/dist/line/platform-files.js +18 -94
- package/dist/line/platform-files.js.map +1 -1
- package/dist/line/restoration.d.ts +27 -0
- package/dist/line/restoration.js +27 -0
- package/dist/line/restoration.js.map +1 -0
- package/dist/line/scaffold.d.ts +26 -57
- package/dist/line/scaffold.js +32 -93
- package/dist/line/scaffold.js.map +1 -1
- package/dist/line/templates/core/extra.js +54 -54
- package/dist/line/templates/core/transformation.js +208 -196
- package/dist/line/templates/pipeline/.gitlab-ci.yml +51 -51
- package/dist/line/templates/pipeline/ci/test-client.sh +16 -16
- package/dist/line/templates/pipeline/ci/test-server.sh +16 -16
- package/dist/line/templates/pipeline/github-ci.yml +50 -0
- package/dist/line/templates/pipeline/spl-gitlab-ci.yml +182 -0
- package/dist/modules/configuration/configure.d.ts +52 -0
- package/dist/modules/configuration/configure.js +101 -0
- package/dist/modules/configuration/configure.js.map +1 -0
- package/dist/modules/configuration/constants.d.ts +17 -0
- package/dist/modules/configuration/constants.js +14 -0
- package/dist/modules/configuration/constants.js.map +1 -0
- package/dist/modules/configuration/index.d.ts +6 -0
- package/dist/modules/configuration/index.js +5 -0
- package/dist/modules/configuration/index.js.map +1 -0
- package/dist/modules/configuration/names.d.ts +9 -0
- package/dist/modules/configuration/names.js +7 -0
- package/dist/modules/configuration/names.js.map +1 -0
- package/dist/modules/configuration/selection.d.ts +32 -0
- package/dist/modules/configuration/selection.js +49 -0
- package/dist/modules/configuration/selection.js.map +1 -0
- package/dist/modules/diagnostics.d.ts +2 -0
- package/dist/modules/diagnostics.js +2 -0
- package/dist/modules/diagnostics.js.map +1 -0
- package/dist/modules/index.d.ts +18 -0
- package/dist/modules/index.js +18 -0
- package/dist/modules/index.js.map +1 -0
- package/dist/modules/metamodels/engine.d.ts +93 -0
- package/dist/modules/metamodels/engine.js +10 -0
- package/dist/modules/metamodels/engine.js.map +1 -0
- package/dist/modules/metamodels/files.d.ts +40 -0
- package/dist/modules/metamodels/files.js +58 -0
- package/dist/modules/metamodels/files.js.map +1 -0
- package/dist/modules/metamodels/index.d.ts +8 -0
- package/dist/modules/metamodels/index.js +5 -0
- package/dist/modules/metamodels/index.js.map +1 -0
- package/dist/modules/metamodels/layout.d.ts +23 -0
- package/dist/modules/metamodels/layout.js +29 -0
- package/dist/modules/metamodels/layout.js.map +1 -0
- package/dist/modules/metamodels/offered.d.ts +15 -0
- package/dist/modules/metamodels/offered.js +14 -0
- package/dist/modules/metamodels/offered.js.map +1 -0
- package/dist/modules/metamodels/prepare.d.ts +20 -0
- package/dist/modules/metamodels/prepare.js +155 -0
- package/dist/modules/metamodels/prepare.js.map +1 -0
- package/dist/modules/packages/index.d.ts +4 -0
- package/dist/modules/packages/index.js +4 -0
- package/dist/modules/packages/index.js.map +1 -0
- package/dist/modules/packages/location.d.ts +21 -0
- package/dist/modules/packages/location.js +34 -0
- package/dist/modules/packages/location.js.map +1 -0
- package/dist/modules/packages/manifests.d.ts +33 -0
- package/dist/modules/packages/manifests.js +231 -0
- package/dist/modules/packages/manifests.js.map +1 -0
- package/dist/modules/packages/source.d.ts +34 -0
- package/dist/modules/packages/source.js +128 -0
- package/dist/modules/packages/source.js.map +1 -0
- package/dist/modules/products/check.d.ts +28 -0
- package/dist/modules/products/check.js +61 -0
- package/dist/modules/products/check.js.map +1 -0
- package/dist/modules/products/derive.d.ts +30 -0
- package/dist/modules/products/derive.js +56 -0
- package/dist/modules/products/derive.js.map +1 -0
- package/dist/modules/products/index.d.ts +5 -0
- package/dist/modules/products/index.js +4 -0
- package/dist/modules/products/index.js.map +1 -0
- package/dist/modules/products/seed.d.ts +18 -0
- package/dist/modules/products/seed.js +23 -0
- package/dist/modules/products/seed.js.map +1 -0
- package/dist/modules/registry/catalog.d.ts +64 -0
- package/dist/modules/registry/catalog.js +91 -0
- package/dist/modules/registry/catalog.js.map +1 -0
- package/dist/modules/registry/index.d.ts +5 -0
- package/dist/modules/registry/index.js +4 -0
- package/dist/modules/registry/index.js.map +1 -0
- package/dist/modules/registry/registry.d.ts +34 -0
- package/dist/modules/registry/registry.js +37 -0
- package/dist/modules/registry/registry.js.map +1 -0
- package/dist/modules/registry/routing.d.ts +8 -0
- package/dist/modules/registry/routing.js +23 -0
- package/dist/modules/registry/routing.js.map +1 -0
- package/dist/modules/resolution/closure.d.ts +28 -0
- package/dist/modules/resolution/closure.js +105 -0
- package/dist/modules/resolution/closure.js.map +1 -0
- package/dist/modules/resolution/index.d.ts +4 -0
- package/dist/modules/resolution/index.js +3 -0
- package/dist/modules/resolution/index.js.map +1 -0
- package/dist/modules/resolution/resolve.d.ts +33 -0
- package/dist/modules/resolution/resolve.js +59 -0
- package/dist/modules/resolution/resolve.js.map +1 -0
- package/dist/modules/resolution/resolvers.d.ts +23 -0
- package/dist/modules/resolution/resolvers.js +34 -0
- package/dist/modules/resolution/resolvers.js.map +1 -0
- package/dist/modules/spl/check.d.ts +25 -0
- package/dist/modules/spl/check.js +21 -0
- package/dist/modules/spl/check.js.map +1 -0
- package/dist/modules/spl/cip.d.ts +67 -0
- package/dist/modules/spl/cip.js +98 -0
- package/dist/modules/spl/cip.js.map +1 -0
- package/dist/modules/spl/feature-model.d.ts +39 -0
- package/dist/modules/spl/feature-model.js +106 -0
- package/dist/modules/spl/feature-model.js.map +1 -0
- package/dist/modules/spl/index.d.ts +6 -0
- package/dist/modules/spl/index.js +4 -0
- package/dist/modules/spl/index.js.map +1 -0
- package/dist/modules/spl/platform.d.ts +49 -0
- package/dist/modules/spl/platform.js +316 -0
- package/dist/modules/spl/platform.js.map +1 -0
- package/dist/modules/types.d.ts +132 -0
- package/dist/modules/types.js +2 -0
- package/dist/modules/types.js.map +1 -0
- package/dist/product/engine-spec.d.ts +0 -16
- package/dist/product/engine-spec.js +4 -50
- package/dist/product/engine-spec.js.map +1 -1
- package/dist/product/spec.d.ts +0 -82
- package/dist/product/spec.js +0 -79
- package/dist/product/spec.js.map +1 -1
- package/dist/product/version.d.ts +0 -23
- package/dist/product/version.js +0 -28
- package/dist/product/version.js.map +1 -1
- package/dist/products-index/products-index.d.ts +0 -165
- package/dist/products-index/products-index.js +0 -176
- package/dist/products-index/products-index.js.map +1 -1
- package/dist/workspace/context.d.ts +25 -0
- package/dist/workspace/context.js +43 -0
- package/dist/workspace/context.js.map +1 -0
- package/dist/workspace/gitExclude.d.ts +2 -0
- package/dist/workspace/gitExclude.js +19 -0
- package/dist/workspace/gitExclude.js.map +1 -0
- package/dist/workspace/host.d.ts +14 -0
- package/dist/workspace/host.js +13 -0
- package/dist/workspace/host.js.map +1 -0
- package/dist/workspace/index.d.ts +12 -0
- package/dist/workspace/index.js +12 -0
- package/dist/workspace/index.js.map +1 -0
- package/dist/workspace/local.d.ts +81 -0
- package/dist/workspace/local.js +287 -0
- package/dist/workspace/local.js.map +1 -0
- package/dist/workspace/modular.d.ts +95 -0
- package/dist/workspace/modular.js +301 -0
- package/dist/workspace/modular.js.map +1 -0
- package/dist/workspace/operations.d.ts +35 -0
- package/dist/workspace/operations.js +57 -0
- package/dist/workspace/operations.js.map +1 -0
- package/dist/workspace/origin.d.ts +20 -0
- package/dist/workspace/origin.js +19 -0
- package/dist/workspace/origin.js.map +1 -0
- package/package.json +82 -67
- package/dist/feature-model/convert.d.ts +0 -35
- package/dist/feature-model/convert.js +0 -47
- package/dist/feature-model/convert.js.map +0 -1
- package/dist/feature-model/engine.d.ts +0 -60
- package/dist/feature-model/engine.js +0 -139
- package/dist/feature-model/engine.js.map +0 -1
- package/dist/feature-model/inspect.d.ts +0 -67
- package/dist/feature-model/inspect.js +0 -113
- package/dist/feature-model/inspect.js.map +0 -1
- package/dist/feature-model/io.d.ts +0 -66
- package/dist/feature-model/io.js +0 -92
- package/dist/feature-model/io.js.map +0 -1
- package/dist/feature-model/parse.d.ts +0 -30
- package/dist/feature-model/parse.js +0 -36
- package/dist/feature-model/parse.js.map +0 -1
- package/dist/feature-model/text.d.ts +0 -54
- package/dist/feature-model/text.js +0 -126
- package/dist/feature-model/text.js.map +0 -1
- package/dist/line/templates/metamodels/dataModel/extra.js +0 -328
- package/dist/line/templates/metamodels/dataModel/transformation.js +0 -211
- package/dist/line/templates/metamodels/sensor/extra.js +0 -36
- package/dist/line/templates/metamodels/sensor/transformation.js +0 -47
- package/dist/selection/selection.d.ts +0 -126
- package/dist/selection/selection.js +0 -152
- package/dist/selection/selection.js.map +0 -1
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
import { type FeatureModelValue } from '../feature-model/engine.js';
|
|
2
|
-
/** The three historical shapes of `spec.features` accepted by the monolith. */
|
|
3
|
-
export type FeatureSelectionInput = string[] | Record<string, boolean> | undefined;
|
|
4
|
-
/** Minimal view of a product spec needed to read its feature selection. */
|
|
5
|
-
export interface SelectionBearingSpec {
|
|
6
|
-
features?: FeatureSelectionInput;
|
|
7
|
-
/** Deprecated field name, still present in old specs. */
|
|
8
|
-
selection?: string[];
|
|
9
|
-
[key: string]: unknown;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Normalises a spec's feature selection into a plain string array.
|
|
13
|
-
*
|
|
14
|
-
* Verbatim behaviour of `utils.js:normalizeFeatureSelection`, covering all three
|
|
15
|
-
* historical shapes:
|
|
16
|
-
* - `string[]` — canonical form.
|
|
17
|
-
* - `{ FeatureName: true | false }` — object map used by early client builds;
|
|
18
|
-
* only truthy keys are kept.
|
|
19
|
-
* - `spec.selection` — legacy field name, used as a fallback when `features` is
|
|
20
|
-
* absent **or an empty array**. That second condition is easy to miss and is
|
|
21
|
-
* load-bearing: a spec with `features: []` and a populated `selection` must
|
|
22
|
-
* resolve to `selection`.
|
|
23
|
-
*
|
|
24
|
-
* @param params.spec Product spec (or anything spec-shaped). May be nullish.
|
|
25
|
-
* @returns The selected feature names. Always an array, never `undefined`.
|
|
26
|
-
*/
|
|
27
|
-
export declare const normalizeFeatureSelection: ({ spec }: {
|
|
28
|
-
spec: SelectionBearingSpec | null | undefined;
|
|
29
|
-
}) => string[];
|
|
30
|
-
/** Outcome of checking a selection against a feature model. */
|
|
31
|
-
export interface FeatureSelectionVerdict {
|
|
32
|
-
/** Whether the selection is satisfiable under the model. */
|
|
33
|
-
readonly valid: boolean;
|
|
34
|
-
/** The expanded selection when valid, `null` otherwise. */
|
|
35
|
-
readonly completed: string[] | null;
|
|
36
|
-
/** Failure reason when invalid, `null` otherwise. */
|
|
37
|
-
readonly error: string | null;
|
|
38
|
-
/**
|
|
39
|
-
* Engine discriminator when invalid: `'TOO_MANY_CHILDS'`, `'MISSING_CHILD'`,
|
|
40
|
-
* or `null` when the engine did not supply one.
|
|
41
|
-
*/
|
|
42
|
-
readonly errorType: string | null;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Checks a feature selection against a model **without throwing**.
|
|
46
|
-
*
|
|
47
|
-
* Same contract as `ProductService.js:getProductHealth`, which reports
|
|
48
|
-
* `{ valid, error, errorType }` so the UI can show why a product no longer fits
|
|
49
|
-
* its line. `completed` is the expansion that `completeFeatureSelection` returns,
|
|
50
|
-
* exposed so callers do not have to validate twice.
|
|
51
|
-
*
|
|
52
|
-
* @param params.model A model returned by `parseFeatureModel`.
|
|
53
|
-
* @param params.features Selected feature names.
|
|
54
|
-
* @returns The verdict. Never throws for an invalid selection.
|
|
55
|
-
* @throws {InvalidArgumentError} only when the arguments themselves are wrong.
|
|
56
|
-
*/
|
|
57
|
-
export declare const validateFeatureSelection: ({ model, features }: {
|
|
58
|
-
model: FeatureModelValue;
|
|
59
|
-
features: string[];
|
|
60
|
-
}) => FeatureSelectionVerdict;
|
|
61
|
-
/**
|
|
62
|
-
* Checks a feature selection and throws when it is invalid.
|
|
63
|
-
*
|
|
64
|
-
* This is the guard `ProductService.js:#validateSpecFeatures` puts on
|
|
65
|
-
* create/update so a bad selection surfaces at the door instead of blowing up
|
|
66
|
-
* during generation. The monolith lets the engine's raw `FeatureSelectionError`
|
|
67
|
-
* escape (its `onError` maps it to a 400); linea-core wraps it in
|
|
68
|
-
* `FeatureSelectionInvalidError` so callers get the `LineaCoreError` taxonomy
|
|
69
|
-
* with a stable `.code` (ADR-018) — and, unlike the engine's class, a real
|
|
70
|
-
* `Error` with a stack.
|
|
71
|
-
*
|
|
72
|
-
* Note the monolith's guard is best-effort in a different sense: it *skips*
|
|
73
|
-
* validation when the selection is empty or the model cannot be read. That
|
|
74
|
-
* skipping is a caller policy (it depends on GitLab availability), so it stays
|
|
75
|
-
* in linea-server; here an empty selection is validated like any other.
|
|
76
|
-
*
|
|
77
|
-
* @param params.model A model returned by `parseFeatureModel`.
|
|
78
|
-
* @param params.features Selected feature names.
|
|
79
|
-
* @returns The expanded selection.
|
|
80
|
-
* @throws {FeatureSelectionInvalidError} when the selection is not satisfiable.
|
|
81
|
-
* @throws {InvalidArgumentError} when the arguments themselves are wrong.
|
|
82
|
-
*/
|
|
83
|
-
export declare const assertFeatureSelection: ({ model, features }: {
|
|
84
|
-
model: FeatureModelValue;
|
|
85
|
-
features: string[];
|
|
86
|
-
}) => string[];
|
|
87
|
-
/** A named feature selection, e.g. one product's. */
|
|
88
|
-
export interface NamedSelection {
|
|
89
|
-
/** Identifier reported back in `broken`. */
|
|
90
|
-
readonly name: string;
|
|
91
|
-
/** Selected feature names. */
|
|
92
|
-
readonly features: string[];
|
|
93
|
-
}
|
|
94
|
-
/** Why a particular named selection no longer fits the model. */
|
|
95
|
-
export interface BrokenSelection {
|
|
96
|
-
readonly name: string;
|
|
97
|
-
readonly reason: string;
|
|
98
|
-
}
|
|
99
|
-
/** Result of checking a whole portfolio of selections against one model. */
|
|
100
|
-
export interface ModelAgainstSelectionsVerdict {
|
|
101
|
-
readonly valid: boolean;
|
|
102
|
-
readonly broken: BrokenSelection[];
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Answers "does this model still admit every one of these selections?".
|
|
106
|
-
*
|
|
107
|
-
* Migrated from `harvest.js:validateModelAgainstProducts` (~113-133), used to
|
|
108
|
-
* decide whether a proposed feature-model edit would break existing products.
|
|
109
|
-
*
|
|
110
|
-
* DELIBERATE SIGNATURE CHANGE (ADR-014): the monolith takes Mongo product
|
|
111
|
-
* documents and digs out `product.spec` and `product.spec.basicData.name`
|
|
112
|
-
* itself. linea-core knows nothing about persisted products, so it takes
|
|
113
|
-
* `[{ name, features }]`. Whoever reads them — from `products.json` (ADR-011) or
|
|
114
|
-
* from GitLab — is linea-server; pair this with `normalizeFeatureSelection` to
|
|
115
|
-
* go from a spec to `features`.
|
|
116
|
-
*
|
|
117
|
-
* @param params.model A model returned by `parseFeatureModel`.
|
|
118
|
-
* @param params.selections The named selections to check.
|
|
119
|
-
* @returns `valid` plus one entry per broken selection. Never throws for a
|
|
120
|
-
* broken selection.
|
|
121
|
-
* @throws {InvalidArgumentError} when the arguments themselves are wrong.
|
|
122
|
-
*/
|
|
123
|
-
export declare const validateModelAgainstSelections: ({ model, selections }: {
|
|
124
|
-
model: FeatureModelValue;
|
|
125
|
-
selections: readonly NamedSelection[];
|
|
126
|
-
}) => ModelAgainstSelectionsVerdict;
|
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Feature selection normalisation and validation.
|
|
3
|
-
*
|
|
4
|
-
* Migrated from:
|
|
5
|
-
* - `linea/server/src/model/services/utils.js:normalizeFeatureSelection` (~172-186)
|
|
6
|
-
* - `linea/server/src/model/services/ProductService.js:#validateSpecFeatures` (~37-58)
|
|
7
|
-
* - `linea/server/src/model/services/ProductService.js:getProductHealth` (~481-519),
|
|
8
|
-
* which is where the `{ valid, features, error, errorType }` shape comes from
|
|
9
|
-
* - `linea/server/src/agents/tools/harvest.js:validateModelAgainstProducts` (~113-133)
|
|
10
|
-
*
|
|
11
|
-
* The monolith spreads this logic across a service that also reads GitLab and a
|
|
12
|
-
* Mongo-backed agent tool. Here it is pure: the caller supplies the parsed model
|
|
13
|
-
* and the selections, and nothing reaches the network or a database.
|
|
14
|
-
*/
|
|
15
|
-
import { InvalidArgumentError, FeatureSelectionInvalidError } from '../errors.js';
|
|
16
|
-
import { completeSelection, describeSelectionFailure } from '../feature-model/engine.js';
|
|
17
|
-
import { isArray } from '../internal/guards.js';
|
|
18
|
-
const assertModel = (model) => {
|
|
19
|
-
if (model === null || typeof model !== 'object') {
|
|
20
|
-
throw new InvalidArgumentError('"model" must be a value returned by parseFeatureModel().');
|
|
21
|
-
}
|
|
22
|
-
return model;
|
|
23
|
-
};
|
|
24
|
-
const assertFeatureArray = (features) => {
|
|
25
|
-
if (!Array.isArray(features) || features.some((f) => typeof f !== 'string')) {
|
|
26
|
-
throw new InvalidArgumentError('"features" must be an array of strings.');
|
|
27
|
-
}
|
|
28
|
-
return features;
|
|
29
|
-
};
|
|
30
|
-
/**
|
|
31
|
-
* Normalises a spec's feature selection into a plain string array.
|
|
32
|
-
*
|
|
33
|
-
* Verbatim behaviour of `utils.js:normalizeFeatureSelection`, covering all three
|
|
34
|
-
* historical shapes:
|
|
35
|
-
* - `string[]` — canonical form.
|
|
36
|
-
* - `{ FeatureName: true | false }` — object map used by early client builds;
|
|
37
|
-
* only truthy keys are kept.
|
|
38
|
-
* - `spec.selection` — legacy field name, used as a fallback when `features` is
|
|
39
|
-
* absent **or an empty array**. That second condition is easy to miss and is
|
|
40
|
-
* load-bearing: a spec with `features: []` and a populated `selection` must
|
|
41
|
-
* resolve to `selection`.
|
|
42
|
-
*
|
|
43
|
-
* @param params.spec Product spec (or anything spec-shaped). May be nullish.
|
|
44
|
-
* @returns The selected feature names. Always an array, never `undefined`.
|
|
45
|
-
*/
|
|
46
|
-
export const normalizeFeatureSelection = ({ spec }) => {
|
|
47
|
-
let features = spec?.features;
|
|
48
|
-
// Object-map shape: { FeatureName: true/false }
|
|
49
|
-
if (features !== null && typeof features === 'object' && !Array.isArray(features)) {
|
|
50
|
-
const map = features;
|
|
51
|
-
features = Object.keys(map).filter((key) => map[key]);
|
|
52
|
-
}
|
|
53
|
-
// Fall back to spec.selection when features is absent OR empty.
|
|
54
|
-
if (!Array.isArray(features) || features.length === 0) {
|
|
55
|
-
features = spec?.selection ?? [];
|
|
56
|
-
}
|
|
57
|
-
return Array.isArray(features) ? features : [];
|
|
58
|
-
};
|
|
59
|
-
/**
|
|
60
|
-
* Checks a feature selection against a model **without throwing**.
|
|
61
|
-
*
|
|
62
|
-
* Same contract as `ProductService.js:getProductHealth`, which reports
|
|
63
|
-
* `{ valid, error, errorType }` so the UI can show why a product no longer fits
|
|
64
|
-
* its line. `completed` is the expansion that `completeFeatureSelection` returns,
|
|
65
|
-
* exposed so callers do not have to validate twice.
|
|
66
|
-
*
|
|
67
|
-
* @param params.model A model returned by `parseFeatureModel`.
|
|
68
|
-
* @param params.features Selected feature names.
|
|
69
|
-
* @returns The verdict. Never throws for an invalid selection.
|
|
70
|
-
* @throws {InvalidArgumentError} only when the arguments themselves are wrong.
|
|
71
|
-
*/
|
|
72
|
-
export const validateFeatureSelection = ({ model, features }) => {
|
|
73
|
-
const checked = assertModel(model);
|
|
74
|
-
const selection = assertFeatureArray(features);
|
|
75
|
-
try {
|
|
76
|
-
const completed = completeSelection(checked, selection);
|
|
77
|
-
return { valid: true, completed, error: null, errorType: null };
|
|
78
|
-
}
|
|
79
|
-
catch (error) {
|
|
80
|
-
const { message, errorType } = describeSelectionFailure(error);
|
|
81
|
-
return { valid: false, completed: null, error: message, errorType };
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
/**
|
|
85
|
-
* Checks a feature selection and throws when it is invalid.
|
|
86
|
-
*
|
|
87
|
-
* This is the guard `ProductService.js:#validateSpecFeatures` puts on
|
|
88
|
-
* create/update so a bad selection surfaces at the door instead of blowing up
|
|
89
|
-
* during generation. The monolith lets the engine's raw `FeatureSelectionError`
|
|
90
|
-
* escape (its `onError` maps it to a 400); linea-core wraps it in
|
|
91
|
-
* `FeatureSelectionInvalidError` so callers get the `LineaCoreError` taxonomy
|
|
92
|
-
* with a stable `.code` (ADR-018) — and, unlike the engine's class, a real
|
|
93
|
-
* `Error` with a stack.
|
|
94
|
-
*
|
|
95
|
-
* Note the monolith's guard is best-effort in a different sense: it *skips*
|
|
96
|
-
* validation when the selection is empty or the model cannot be read. That
|
|
97
|
-
* skipping is a caller policy (it depends on GitLab availability), so it stays
|
|
98
|
-
* in linea-server; here an empty selection is validated like any other.
|
|
99
|
-
*
|
|
100
|
-
* @param params.model A model returned by `parseFeatureModel`.
|
|
101
|
-
* @param params.features Selected feature names.
|
|
102
|
-
* @returns The expanded selection.
|
|
103
|
-
* @throws {FeatureSelectionInvalidError} when the selection is not satisfiable.
|
|
104
|
-
* @throws {InvalidArgumentError} when the arguments themselves are wrong.
|
|
105
|
-
*/
|
|
106
|
-
export const assertFeatureSelection = ({ model, features }) => {
|
|
107
|
-
const verdict = validateFeatureSelection({ model, features });
|
|
108
|
-
if (!verdict.valid || verdict.completed === null) {
|
|
109
|
-
throw new FeatureSelectionInvalidError(verdict.error ?? 'The feature selection is not valid for this feature model.');
|
|
110
|
-
}
|
|
111
|
-
return verdict.completed;
|
|
112
|
-
};
|
|
113
|
-
/**
|
|
114
|
-
* Answers "does this model still admit every one of these selections?".
|
|
115
|
-
*
|
|
116
|
-
* Migrated from `harvest.js:validateModelAgainstProducts` (~113-133), used to
|
|
117
|
-
* decide whether a proposed feature-model edit would break existing products.
|
|
118
|
-
*
|
|
119
|
-
* DELIBERATE SIGNATURE CHANGE (ADR-014): the monolith takes Mongo product
|
|
120
|
-
* documents and digs out `product.spec` and `product.spec.basicData.name`
|
|
121
|
-
* itself. linea-core knows nothing about persisted products, so it takes
|
|
122
|
-
* `[{ name, features }]`. Whoever reads them — from `products.json` (ADR-011) or
|
|
123
|
-
* from GitLab — is linea-server; pair this with `normalizeFeatureSelection` to
|
|
124
|
-
* go from a spec to `features`.
|
|
125
|
-
*
|
|
126
|
-
* @param params.model A model returned by `parseFeatureModel`.
|
|
127
|
-
* @param params.selections The named selections to check.
|
|
128
|
-
* @returns `valid` plus one entry per broken selection. Never throws for a
|
|
129
|
-
* broken selection.
|
|
130
|
-
* @throws {InvalidArgumentError} when the arguments themselves are wrong.
|
|
131
|
-
*/
|
|
132
|
-
export const validateModelAgainstSelections = ({ model, selections }) => {
|
|
133
|
-
const checked = assertModel(model);
|
|
134
|
-
if (!isArray(selections)) {
|
|
135
|
-
throw new InvalidArgumentError('"selections" must be an array of { name, features }.');
|
|
136
|
-
}
|
|
137
|
-
const broken = [];
|
|
138
|
-
for (const selection of selections) {
|
|
139
|
-
if (selection === null || typeof selection !== 'object') {
|
|
140
|
-
throw new InvalidArgumentError('Every entry of "selections" must be an object.');
|
|
141
|
-
}
|
|
142
|
-
if (typeof selection.name !== 'string' || selection.name === '') {
|
|
143
|
-
throw new InvalidArgumentError('Every entry of "selections" needs a non-empty "name".');
|
|
144
|
-
}
|
|
145
|
-
const verdict = validateFeatureSelection({ model: checked, features: selection.features });
|
|
146
|
-
if (!verdict.valid) {
|
|
147
|
-
broken.push({ name: selection.name, reason: verdict.error ?? 'unknown reason' });
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
return { valid: broken.length === 0, broken };
|
|
151
|
-
};
|
|
152
|
-
//# sourceMappingURL=selection.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"selection.js","sourceRoot":"","sources":["../../src/selection/selection.ts"],"names":[],"mappings":"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","sourcesContent":["/**\r\n * Feature selection normalisation and validation.\r\n *\r\n * Migrated from:\r\n * - `linea/server/src/model/services/utils.js:normalizeFeatureSelection` (~172-186)\r\n * - `linea/server/src/model/services/ProductService.js:#validateSpecFeatures` (~37-58)\r\n * - `linea/server/src/model/services/ProductService.js:getProductHealth` (~481-519),\r\n * which is where the `{ valid, features, error, errorType }` shape comes from\r\n * - `linea/server/src/agents/tools/harvest.js:validateModelAgainstProducts` (~113-133)\r\n *\r\n * The monolith spreads this logic across a service that also reads GitLab and a\r\n * Mongo-backed agent tool. Here it is pure: the caller supplies the parsed model\r\n * and the selections, and nothing reaches the network or a database.\r\n */\r\nimport { InvalidArgumentError, FeatureSelectionInvalidError } from '../errors.js'\r\nimport {\r\n completeSelection,\r\n describeSelectionFailure,\r\n type FeatureModelValue\r\n} from '../feature-model/engine.js'\r\nimport { isArray } from '../internal/guards.js'\r\n\r\n/** The three historical shapes of `spec.features` accepted by the monolith. */\r\nexport type FeatureSelectionInput = string[] | Record<string, boolean> | undefined\r\n\r\n/** Minimal view of a product spec needed to read its feature selection. */\r\nexport interface SelectionBearingSpec {\r\n features?: FeatureSelectionInput\r\n /** Deprecated field name, still present in old specs. */\r\n selection?: string[]\r\n [key: string]: unknown\r\n}\r\n\r\nconst assertModel = (model: unknown): FeatureModelValue => {\r\n if (model === null || typeof model !== 'object') {\r\n throw new InvalidArgumentError('\"model\" must be a value returned by parseFeatureModel().')\r\n }\r\n return model as FeatureModelValue\r\n}\r\n\r\nconst assertFeatureArray = (features: unknown): string[] => {\r\n if (!Array.isArray(features) || features.some((f) => typeof f !== 'string')) {\r\n throw new InvalidArgumentError('\"features\" must be an array of strings.')\r\n }\r\n return features as string[]\r\n}\r\n\r\n/**\r\n * Normalises a spec's feature selection into a plain string array.\r\n *\r\n * Verbatim behaviour of `utils.js:normalizeFeatureSelection`, covering all three\r\n * historical shapes:\r\n * - `string[]` — canonical form.\r\n * - `{ FeatureName: true | false }` — object map used by early client builds;\r\n * only truthy keys are kept.\r\n * - `spec.selection` — legacy field name, used as a fallback when `features` is\r\n * absent **or an empty array**. That second condition is easy to miss and is\r\n * load-bearing: a spec with `features: []` and a populated `selection` must\r\n * resolve to `selection`.\r\n *\r\n * @param params.spec Product spec (or anything spec-shaped). May be nullish.\r\n * @returns The selected feature names. Always an array, never `undefined`.\r\n */\r\nexport const normalizeFeatureSelection = ({\r\n spec\r\n}: {\r\n spec: SelectionBearingSpec | null | undefined\r\n}): string[] => {\r\n let features: unknown = spec?.features\r\n\r\n // Object-map shape: { FeatureName: true/false }\r\n if (features !== null && typeof features === 'object' && !Array.isArray(features)) {\r\n const map = features as Record<string, boolean>\r\n features = Object.keys(map).filter((key) => map[key])\r\n }\r\n\r\n // Fall back to spec.selection when features is absent OR empty.\r\n if (!Array.isArray(features) || features.length === 0) {\r\n features = spec?.selection ?? []\r\n }\r\n\r\n return Array.isArray(features) ? (features as string[]) : []\r\n}\r\n\r\n/** Outcome of checking a selection against a feature model. */\r\nexport interface FeatureSelectionVerdict {\r\n /** Whether the selection is satisfiable under the model. */\r\n readonly valid: boolean\r\n /** The expanded selection when valid, `null` otherwise. */\r\n readonly completed: string[] | null\r\n /** Failure reason when invalid, `null` otherwise. */\r\n readonly error: string | null\r\n /**\r\n * Engine discriminator when invalid: `'TOO_MANY_CHILDS'`, `'MISSING_CHILD'`,\r\n * or `null` when the engine did not supply one.\r\n */\r\n readonly errorType: string | null\r\n}\r\n\r\n/**\r\n * Checks a feature selection against a model **without throwing**.\r\n *\r\n * Same contract as `ProductService.js:getProductHealth`, which reports\r\n * `{ valid, error, errorType }` so the UI can show why a product no longer fits\r\n * its line. `completed` is the expansion that `completeFeatureSelection` returns,\r\n * exposed so callers do not have to validate twice.\r\n *\r\n * @param params.model A model returned by `parseFeatureModel`.\r\n * @param params.features Selected feature names.\r\n * @returns The verdict. Never throws for an invalid selection.\r\n * @throws {InvalidArgumentError} only when the arguments themselves are wrong.\r\n */\r\nexport const validateFeatureSelection = ({\r\n model,\r\n features\r\n}: {\r\n model: FeatureModelValue\r\n features: string[]\r\n}): FeatureSelectionVerdict => {\r\n const checked = assertModel(model)\r\n const selection = assertFeatureArray(features)\r\n try {\r\n const completed = completeSelection(checked, selection)\r\n return { valid: true, completed, error: null, errorType: null }\r\n } catch (error) {\r\n const { message, errorType } = describeSelectionFailure(error)\r\n return { valid: false, completed: null, error: message, errorType }\r\n }\r\n}\r\n\r\n/**\r\n * Checks a feature selection and throws when it is invalid.\r\n *\r\n * This is the guard `ProductService.js:#validateSpecFeatures` puts on\r\n * create/update so a bad selection surfaces at the door instead of blowing up\r\n * during generation. The monolith lets the engine's raw `FeatureSelectionError`\r\n * escape (its `onError` maps it to a 400); linea-core wraps it in\r\n * `FeatureSelectionInvalidError` so callers get the `LineaCoreError` taxonomy\r\n * with a stable `.code` (ADR-018) — and, unlike the engine's class, a real\r\n * `Error` with a stack.\r\n *\r\n * Note the monolith's guard is best-effort in a different sense: it *skips*\r\n * validation when the selection is empty or the model cannot be read. That\r\n * skipping is a caller policy (it depends on GitLab availability), so it stays\r\n * in linea-server; here an empty selection is validated like any other.\r\n *\r\n * @param params.model A model returned by `parseFeatureModel`.\r\n * @param params.features Selected feature names.\r\n * @returns The expanded selection.\r\n * @throws {FeatureSelectionInvalidError} when the selection is not satisfiable.\r\n * @throws {InvalidArgumentError} when the arguments themselves are wrong.\r\n */\r\nexport const assertFeatureSelection = ({\r\n model,\r\n features\r\n}: {\r\n model: FeatureModelValue\r\n features: string[]\r\n}): string[] => {\r\n const verdict = validateFeatureSelection({ model, features })\r\n if (!verdict.valid || verdict.completed === null) {\r\n throw new FeatureSelectionInvalidError(\r\n verdict.error ?? 'The feature selection is not valid for this feature model.'\r\n )\r\n }\r\n return verdict.completed\r\n}\r\n\r\n/** A named feature selection, e.g. one product's. */\r\nexport interface NamedSelection {\r\n /** Identifier reported back in `broken`. */\r\n readonly name: string\r\n /** Selected feature names. */\r\n readonly features: string[]\r\n}\r\n\r\n/** Why a particular named selection no longer fits the model. */\r\nexport interface BrokenSelection {\r\n readonly name: string\r\n readonly reason: string\r\n}\r\n\r\n/** Result of checking a whole portfolio of selections against one model. */\r\nexport interface ModelAgainstSelectionsVerdict {\r\n readonly valid: boolean\r\n readonly broken: BrokenSelection[]\r\n}\r\n\r\n/**\r\n * Answers \"does this model still admit every one of these selections?\".\r\n *\r\n * Migrated from `harvest.js:validateModelAgainstProducts` (~113-133), used to\r\n * decide whether a proposed feature-model edit would break existing products.\r\n *\r\n * DELIBERATE SIGNATURE CHANGE (ADR-014): the monolith takes Mongo product\r\n * documents and digs out `product.spec` and `product.spec.basicData.name`\r\n * itself. linea-core knows nothing about persisted products, so it takes\r\n * `[{ name, features }]`. Whoever reads them — from `products.json` (ADR-011) or\r\n * from GitLab — is linea-server; pair this with `normalizeFeatureSelection` to\r\n * go from a spec to `features`.\r\n *\r\n * @param params.model A model returned by `parseFeatureModel`.\r\n * @param params.selections The named selections to check.\r\n * @returns `valid` plus one entry per broken selection. Never throws for a\r\n * broken selection.\r\n * @throws {InvalidArgumentError} when the arguments themselves are wrong.\r\n */\r\nexport const validateModelAgainstSelections = ({\r\n model,\r\n selections\r\n}: {\r\n model: FeatureModelValue\r\n selections: readonly NamedSelection[]\r\n}): ModelAgainstSelectionsVerdict => {\r\n const checked = assertModel(model)\r\n if (!isArray(selections)) {\r\n throw new InvalidArgumentError('\"selections\" must be an array of { name, features }.')\r\n }\r\n\r\n const broken: BrokenSelection[] = []\r\n for (const selection of selections) {\r\n if (selection === null || typeof selection !== 'object') {\r\n throw new InvalidArgumentError('Every entry of \"selections\" must be an object.')\r\n }\r\n if (typeof selection.name !== 'string' || selection.name === '') {\r\n throw new InvalidArgumentError('Every entry of \"selections\" needs a non-empty \"name\".')\r\n }\r\n const verdict = validateFeatureSelection({ model: checked, features: selection.features })\r\n if (!verdict.valid) {\r\n broken.push({ name: selection.name, reason: verdict.error ?? 'unknown reason' })\r\n }\r\n }\r\n\r\n return { valid: broken.length === 0, broken }\r\n}\r\n"]}
|