@featurevisor/core 4.13.0 → 4.14.0
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/lib/builder/applyContextToDatafile.js +21 -1
- package/lib/builder/applyContextToDatafile.js.map +1 -1
- package/lib/builder/buildDatafile.d.ts +15 -1
- package/lib/builder/buildDatafile.js +48 -13
- package/lib/builder/buildDatafile.js.map +1 -1
- package/lib/builder/buildProject.js +9 -0
- package/lib/builder/buildProject.js.map +1 -1
- package/lib/builder/environments.d.ts +1 -2
- package/lib/builder/hashes.d.ts +9 -0
- package/lib/builder/hashes.js +16 -0
- package/lib/builder/hashes.js.map +1 -1
- package/lib/builder/schemas.d.ts +76 -0
- package/lib/builder/schemas.js +406 -0
- package/lib/builder/schemas.js.map +1 -0
- package/lib/catalog.d.ts +2 -0
- package/lib/catalog.js +3 -0
- package/lib/catalog.js.map +1 -1
- package/lib/cli/options.js +31 -4
- package/lib/cli/options.js.map +1 -1
- package/lib/config/allowedConditions.d.ts +6 -3
- package/lib/config/allowedConditions.js +9 -2
- package/lib/config/allowedConditions.js.map +1 -1
- package/lib/convert/check.js +5 -1
- package/lib/convert/check.js.map +1 -1
- package/lib/convert/plan.js +8 -2
- package/lib/convert/plan.js.map +1 -1
- package/lib/datasource/conditionLocations.d.ts +1 -1
- package/lib/datasource/conditionLocations.js +26 -0
- package/lib/datasource/conditionLocations.js.map +1 -1
- package/lib/datasource/datasource.d.ts +2 -0
- package/lib/datasource/datasource.js +5 -3
- package/lib/datasource/datasource.js.map +1 -1
- package/lib/datasource/expressions.d.ts +1 -1
- package/lib/datasource/testSpecs.js +3 -3
- package/lib/datasource/testSpecs.js.map +1 -1
- package/lib/diff/conditions.js +1 -1
- package/lib/diff/conditions.js.map +1 -1
- package/lib/diff/index.js +68 -1
- package/lib/diff/index.js.map +1 -1
- package/lib/diff/schemaWidening.d.ts +15 -0
- package/lib/diff/schemaWidening.js +275 -0
- package/lib/diff/schemaWidening.js.map +1 -0
- package/lib/find-usage/index.d.ts +16 -2
- package/lib/find-usage/index.js +114 -10
- package/lib/find-usage/index.js.map +1 -1
- package/lib/formatter/expressions.js +5 -2
- package/lib/formatter/expressions.js.map +1 -1
- package/lib/formatter/layout.d.ts +3 -2
- package/lib/formatter/layout.js +23 -4
- package/lib/formatter/layout.js.map +1 -1
- package/lib/formatter/style.d.ts +20 -2
- package/lib/formatter/style.js +49 -4
- package/lib/formatter/style.js.map +1 -1
- package/lib/generate-code/index.d.ts +4 -0
- package/lib/generate-code/index.js +10 -0
- package/lib/generate-code/index.js.map +1 -1
- package/lib/generate-code/typescript.d.ts +5 -0
- package/lib/generate-code/typescript.js +265 -25
- package/lib/generate-code/typescript.js.map +1 -1
- package/lib/generate-code/widenMutations.d.ts +9 -0
- package/lib/generate-code/widenMutations.js +134 -0
- package/lib/generate-code/widenMutations.js.map +1 -0
- package/lib/linter/composedOverrideSchema.js +3 -0
- package/lib/linter/composedOverrideSchema.js.map +1 -1
- package/lib/linter/conditionKinds.d.ts +1 -1
- package/lib/linter/conditionKinds.js +4 -0
- package/lib/linter/conditionKinds.js.map +1 -1
- package/lib/linter/conditionSchema.d.ts +21 -1
- package/lib/linter/conditionSchema.js +261 -135
- package/lib/linter/conditionSchema.js.map +1 -1
- package/lib/linter/contextWarnings.js +2 -0
- package/lib/linter/contextWarnings.js.map +1 -1
- package/lib/linter/diagnostics.d.ts +10 -3
- package/lib/linter/diagnostics.js +16 -2
- package/lib/linter/diagnostics.js.map +1 -1
- package/lib/linter/expressionDiagnostics.js +2 -2
- package/lib/linter/expressionDiagnostics.js.map +1 -1
- package/lib/linter/featureSchema.d.ts +10 -9
- package/lib/linter/featureSchema.js +60 -158
- package/lib/linter/featureSchema.js.map +1 -1
- package/lib/linter/lintProject.js +229 -2
- package/lib/linter/lintProject.js.map +1 -1
- package/lib/linter/messageWarnings.d.ts +16 -0
- package/lib/linter/messageWarnings.js +181 -0
- package/lib/linter/messageWarnings.js.map +1 -0
- package/lib/linter/regexSafety.d.ts +17 -2
- package/lib/linter/regexSafety.js +257 -13
- package/lib/linter/regexSafety.js.map +1 -1
- package/lib/linter/reservedNames.d.ts +21 -0
- package/lib/linter/reservedNames.js +79 -0
- package/lib/linter/reservedNames.js.map +1 -1
- package/lib/linter/schema.d.ts +45 -3
- package/lib/linter/schema.js +341 -35
- package/lib/linter/schema.js.map +1 -1
- package/lib/linter/schemaAnnotations.d.ts +34 -0
- package/lib/linter/schemaAnnotations.js +409 -0
- package/lib/linter/schemaAnnotations.js.map +1 -0
- package/lib/linter/schemaEngine.d.ts +7 -0
- package/lib/linter/schemaEngine.js +80 -0
- package/lib/linter/schemaEngine.js.map +1 -0
- package/lib/linter/schemaFormats.d.ts +6 -0
- package/lib/linter/schemaFormats.js +20 -0
- package/lib/linter/schemaFormats.js.map +1 -1
- package/lib/linter/schemaMutations.d.ts +38 -0
- package/lib/linter/schemaMutations.js +617 -0
- package/lib/linter/schemaMutations.js.map +1 -0
- package/lib/linter/schemaPatterns.d.ts +26 -0
- package/lib/linter/schemaPatterns.js +316 -0
- package/lib/linter/schemaPatterns.js.map +1 -0
- package/lib/linter/schemaReferences.d.ts +18 -0
- package/lib/linter/schemaReferences.js +43 -0
- package/lib/linter/schemaReferences.js.map +1 -0
- package/lib/linter/targetSchema.d.ts +3 -0
- package/lib/linter/targetSchema.js +3 -0
- package/lib/linter/targetSchema.js.map +1 -1
- package/lib/linter/testSchema.d.ts +1 -1
- package/lib/linter/testSchema.js +70 -11
- package/lib/linter/testSchema.js.map +1 -1
- package/lib/linter/variableSchema.d.ts +5 -5
- package/lib/linter/variableSchema.js +5 -5
- package/lib/linter/variableSchema.js.map +1 -1
- package/lib/linter/warningCodes.d.ts +1 -1
- package/lib/linter/warningCodes.js +4 -0
- package/lib/linter/warningCodes.js.map +1 -1
- package/lib/list/index.js +45 -4
- package/lib/list/index.js.map +1 -1
- package/lib/list/matrix.d.ts +6 -1
- package/lib/list/matrix.js +31 -0
- package/lib/list/matrix.js.map +1 -1
- package/lib/promoter/index.js +15 -0
- package/lib/promoter/index.js.map +1 -1
- package/lib/rewrite/conditions.d.ts +2 -1
- package/lib/rewrite/conditions.js +1 -0
- package/lib/rewrite/conditions.js.map +1 -1
- package/lib/schemaNodes.d.ts +50 -0
- package/lib/schemaNodes.js +146 -0
- package/lib/schemaNodes.js.map +1 -0
- package/lib/targeting.d.ts +28 -1
- package/lib/targeting.js +111 -0
- package/lib/targeting.js.map +1 -1
- package/lib/tester/segments.d.ts +3 -0
- package/lib/tester/testProject.d.ts +1 -1
- package/lib/tester/testProject.js +16 -3
- package/lib/tester/testProject.js.map +1 -1
- package/lib/tester/testSchema.d.ts +9 -0
- package/lib/tester/testSchema.js +130 -0
- package/lib/tester/testSchema.js.map +1 -0
- package/package.json +7 -6
|
@@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.INHERITED_PROPERTY_NAMES = void 0;
|
|
4
4
|
exports.getInheritedPropertyNameError = getInheritedPropertyNameError;
|
|
5
5
|
exports.findInheritedPropertyNames = findInheritedPropertyNames;
|
|
6
|
+
exports.getReservedSchemaNameError = getReservedSchemaNameError;
|
|
7
|
+
exports.findReservedSchemaNames = findReservedSchemaNames;
|
|
6
8
|
/**
|
|
7
9
|
* JavaScript objects inherit these names, so a context lookup can find a value the
|
|
8
10
|
* application never supplied. Dictionary based SDKs do not, which would make one
|
|
@@ -49,4 +51,81 @@ function findInheritedPropertyNames(schema, path = []) {
|
|
|
49
51
|
node.oneOf.forEach((branch, index) => found.push(...findInheritedPropertyNames(branch, [...path, "oneOf", index])));
|
|
50
52
|
return found;
|
|
51
53
|
}
|
|
54
|
+
/** Characters with a meaning of their own in paths: steps, list items, and an open object's values. */
|
|
55
|
+
const PATH_CHARACTERS = [".", "[", "]", "*"];
|
|
56
|
+
/**
|
|
57
|
+
* Why a name in a schema file is reserved, or null when it is not: a name
|
|
58
|
+
* JavaScript objects inherit, or one no path can name, being empty, holding a
|
|
59
|
+
* character paths read as their own, or made of digits only, which paths read
|
|
60
|
+
* as a list index and YAML as a number. Fields, keys of mutations and issues,
|
|
61
|
+
* and schema keys take it. A schema key passes `dots`, since a dot separates
|
|
62
|
+
* its namespaces.
|
|
63
|
+
*/
|
|
64
|
+
function getReservedSchemaNameError(name, kind, { dots = false } = {}) {
|
|
65
|
+
const inherited = getInheritedPropertyNameError(name, kind);
|
|
66
|
+
if (inherited)
|
|
67
|
+
return inherited;
|
|
68
|
+
if (name === "")
|
|
69
|
+
return `${kind} "" is reserved because no path can name it. Choose another name.`;
|
|
70
|
+
const character = PATH_CHARACTERS.find((candidate) => (!dots || candidate !== ".") && name.includes(candidate));
|
|
71
|
+
if (character) {
|
|
72
|
+
return `${kind} "${name}" is reserved because "${character}" has a meaning of its own in paths, so no path can name it. Choose another name.`;
|
|
73
|
+
}
|
|
74
|
+
if (/^[0-9]+$/.test(name)) {
|
|
75
|
+
return `${kind} "${name}" is reserved because a name of digits only reads as a list index in paths, and as a number in YAML. Choose another name.`;
|
|
76
|
+
}
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
function isMap(value) {
|
|
80
|
+
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* The reserved names a schema file holds, with where each sits and why: its
|
|
84
|
+
* fields at any depth, in `annotationsSchema` and `optionSchema` vocabularies
|
|
85
|
+
* too, and the keys of its mutations and issues, nested ones included. An
|
|
86
|
+
* empty key is the key's own schema error.
|
|
87
|
+
*/
|
|
88
|
+
function findReservedSchemaNames(schema, path = []) {
|
|
89
|
+
const found = [];
|
|
90
|
+
const entries = (list, at, kind, nested) => {
|
|
91
|
+
if (!Array.isArray(list))
|
|
92
|
+
return;
|
|
93
|
+
list.forEach((entry, index) => {
|
|
94
|
+
if (!isMap(entry))
|
|
95
|
+
return;
|
|
96
|
+
const message = typeof entry.key === "string" && entry.key !== ""
|
|
97
|
+
? getReservedSchemaNameError(entry.key, kind)
|
|
98
|
+
: null;
|
|
99
|
+
if (message)
|
|
100
|
+
found.push({ path: [...at, index, "key"], message });
|
|
101
|
+
entries(entry[nested], [...at, index, nested], kind, nested);
|
|
102
|
+
});
|
|
103
|
+
};
|
|
104
|
+
const visit = (node, at) => {
|
|
105
|
+
if (!isMap(node))
|
|
106
|
+
return;
|
|
107
|
+
if (isMap(node.properties)) {
|
|
108
|
+
for (const name of Object.keys(node.properties)) {
|
|
109
|
+
const message = getReservedSchemaNameError(name, "Field name");
|
|
110
|
+
if (message)
|
|
111
|
+
found.push({ path: [...at, "properties", name], message });
|
|
112
|
+
visit(node.properties[name], [...at, "properties", name]);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
for (const key of ["items", "additionalProperties", "annotationsSchema", "optionSchema"])
|
|
116
|
+
visit(node[key], [...at, key]);
|
|
117
|
+
if (Array.isArray(node.oneOf))
|
|
118
|
+
node.oneOf.forEach((branch, index) => visit(branch, [...at, "oneOf", index]));
|
|
119
|
+
// A list, or at a schema's root a list per environment.
|
|
120
|
+
if (isMap(node.mutations)) {
|
|
121
|
+
for (const [environment, list] of Object.entries(node.mutations))
|
|
122
|
+
entries(list, [...at, "mutations", environment], "Mutation key", "mutations");
|
|
123
|
+
}
|
|
124
|
+
else
|
|
125
|
+
entries(node.mutations, [...at, "mutations"], "Mutation key", "mutations");
|
|
126
|
+
entries(node.issues, [...at, "issues"], "Issue key", "issues");
|
|
127
|
+
};
|
|
128
|
+
visit(schema, path);
|
|
129
|
+
return found;
|
|
130
|
+
}
|
|
52
131
|
//# sourceMappingURL=reservedNames.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reservedNames.js","sourceRoot":"","sources":["../../src/linter/reservedNames.ts"],"names":[],"mappings":";;;AAqBA,sEAIC;AAGD,gEAwBC;
|
|
1
|
+
{"version":3,"file":"reservedNames.js","sourceRoot":"","sources":["../../src/linter/reservedNames.ts"],"names":[],"mappings":";;;AAqBA,sEAIC;AAGD,g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AS,CAAC;gBAC9D,OAAO,CAAC,IAAI,EAAE,CAAC,GAAG,EAAE,EAAE,WAAW,EAAE,WAAW,CAAC,EAAE,cAAc,EAAE,WAAW,CAAC,CAAC;QAClF,CAAC;;YAAM,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,GAAG,EAAE,EAAE,WAAW,CAAC,EAAE,cAAc,EAAE,WAAW,CAAC,CAAC;QAClF,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,QAAQ,CAAC,EAAE,WAAW,EAAE,QAAQ,CAAC,CAAC;IACjE,CAAC,CAAC;IACF,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IACpB,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/lib/linter/schema.d.ts
CHANGED
|
@@ -36,15 +36,57 @@ export declare function refineEnumMatchesType(schema: SchemaLike, pathPrefix: (s
|
|
|
36
36
|
export declare function refineMinimumMaximum(schema: SchemaLike, pathPrefix: (string | number)[], ctx: z.RefinementCtx): void;
|
|
37
37
|
/** Validate the format declaration and its literal values at this schema node. */
|
|
38
38
|
export declare function refineSchemaFormat(schema: SchemaLike, pathPrefix: (string | number)[], ctx: z.RefinementCtx, schemasByKey?: Record<string, Schema>): void;
|
|
39
|
-
/**
|
|
40
|
-
|
|
39
|
+
/**
|
|
40
|
+
* Validate string lengths, patterns and their literal values recursively.
|
|
41
|
+
* Patterns compile with the `u` flag, as `@featurevisor/schemas` reads them. A
|
|
42
|
+
* pattern that compiles only without it is an error in a schema file, and a
|
|
43
|
+
* warning in a variable's schema until the next major version, which lint
|
|
44
|
+
* reads as its rewrite meanwhile.
|
|
45
|
+
*/
|
|
46
|
+
export declare function refineStringLengthPattern(schema: SchemaLike, pathPrefix: (string | number)[], ctx: z.RefinementCtx, withoutUnicode?: "error" | "warning"): void;
|
|
47
|
+
/**
|
|
48
|
+
* In a schema file, an object that takes no keys beyond its `properties`, as
|
|
49
|
+
* objects are by default, can require only those: a value could never hold
|
|
50
|
+
* another. One whose `additionalProperties` allows other keys may require
|
|
51
|
+
* keys it does not list, and an object without `properties` takes any keys.
|
|
52
|
+
* A vocabulary also requires `builtIns`, the built in names its annotations
|
|
53
|
+
* or choices carry, which it cannot declare, such as `title`.
|
|
54
|
+
*/
|
|
55
|
+
export declare function refineRequiredInClosedObject(schema: SchemaLike & {
|
|
56
|
+
required?: unknown;
|
|
57
|
+
}, ctx: z.RefinementCtx, builtIns?: readonly string[]): void;
|
|
41
58
|
/**
|
|
42
59
|
* Validates that when a schema has type "array", minItems <= maxItems when both set,
|
|
43
60
|
* and const/enum array values (if present) satisfy length and uniqueItems.
|
|
44
61
|
*/
|
|
45
62
|
export declare function refineArrayItems(schema: SchemaLike, pathPrefix: (string | number)[], ctx: z.RefinementCtx): void;
|
|
63
|
+
/**
|
|
64
|
+
* The params each issue code fills a message's placeholders from, as
|
|
65
|
+
* `@featurevisor/schemas` reports them, with `title` when the field has one. A
|
|
66
|
+
* text message in a schema's `messages` is keyed by one of these codes.
|
|
67
|
+
*/
|
|
68
|
+
export declare const SCHEMA_ISSUE_PARAMS: Record<string, readonly string[]>;
|
|
69
|
+
/** The placeholders of a message template: `{name}`, with `{{` and `}}` for literal braces. */
|
|
70
|
+
export declare function getMessagePlaceholders(template: string): string[];
|
|
71
|
+
/**
|
|
72
|
+
* Checks a node's `messages`: a text value is a message for one of the node's
|
|
73
|
+
* issue codes, with placeholders from that code's params, and a map is a field
|
|
74
|
+
* of the node, `"[]"` for an array's items or `"*"` for the values an open
|
|
75
|
+
* object allows, holding that field's messages the same way.
|
|
76
|
+
*/
|
|
77
|
+
export declare function refineSchemaMessages(node: SchemaLike & {
|
|
78
|
+
messages?: unknown;
|
|
79
|
+
}, ctx: z.RefinementCtx, schemasByKey?: Record<string, Schema>): void;
|
|
46
80
|
export declare const valueZodSchema: z.ZodType<Value>;
|
|
47
81
|
export declare const propertyTypeEnum: z.ZodType<"string" | "number" | "boolean" | "object" | "integer" | "array", unknown, z.core.$ZodTypeInternals<"string" | "number" | "boolean" | "object" | "integer" | "array", unknown>>;
|
|
82
|
+
/**
|
|
83
|
+
* A reference to a schema by key. A variable's schema stays the same
|
|
84
|
+
* everywhere and for everyone, so unless `mayVary`, nothing it references may
|
|
85
|
+
* vary by environment or under conditions.
|
|
86
|
+
*/
|
|
87
|
+
export declare function getSchemaReferenceZodSchema(keys: string[], schemasByKey: Record<string, Schema>, mayVary?: boolean): z.ZodType<string, unknown, z.core.$ZodTypeInternals<string, unknown>>;
|
|
48
88
|
export declare function getSchemaZodSchema(schemaKeys?: SchemaKey[], schemasByKey?: Record<string, Schema>,
|
|
49
89
|
/** Given when parsing a schema definition, whose root alone can have `metadata` */
|
|
50
|
-
projectConfig?: ProjectConfig
|
|
90
|
+
projectConfig?: ProjectConfig,
|
|
91
|
+
/** For a definition other files reference as a vocabulary, the built in names its root may require. */
|
|
92
|
+
vocabularyBuiltIns?: readonly string[]): z.ZodType<Schema, unknown, z.core.$ZodTypeInternals<Schema, unknown>>;
|