@featurevisor/core 4.3.0 → 4.5.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.
Files changed (148) hide show
  1. package/lib/cli/cli.d.ts +2 -1
  2. package/lib/cli/cli.js +9 -6
  3. package/lib/cli/cli.js.map +1 -1
  4. package/lib/cli/options.js +69 -0
  5. package/lib/cli/options.js.map +1 -1
  6. package/lib/cli/plugins.js +7 -1
  7. package/lib/cli/plugins.js.map +1 -1
  8. package/lib/config/projectConfig.d.ts +10 -0
  9. package/lib/config/projectConfig.js +14 -0
  10. package/lib/config/projectConfig.js.map +1 -1
  11. package/lib/convert/check.d.ts +33 -0
  12. package/lib/convert/check.js +411 -0
  13. package/lib/convert/check.js.map +1 -0
  14. package/lib/convert/config.d.ts +20 -0
  15. package/lib/convert/config.js +147 -0
  16. package/lib/convert/config.js.map +1 -0
  17. package/lib/convert/documents.d.ts +40 -0
  18. package/lib/convert/documents.js +154 -0
  19. package/lib/convert/documents.js.map +1 -0
  20. package/lib/convert/index.d.ts +7 -0
  21. package/lib/convert/index.js +47 -0
  22. package/lib/convert/index.js.map +1 -0
  23. package/lib/convert/plan.d.ts +53 -0
  24. package/lib/convert/plan.js +669 -0
  25. package/lib/convert/plan.js.map +1 -0
  26. package/lib/convert/project.d.ts +29 -0
  27. package/lib/convert/project.js +109 -0
  28. package/lib/convert/project.js.map +1 -0
  29. package/lib/convert/run.d.ts +3 -0
  30. package/lib/convert/run.js +241 -0
  31. package/lib/convert/run.js.map +1 -0
  32. package/lib/convert/tests.d.ts +22 -0
  33. package/lib/convert/tests.js +267 -0
  34. package/lib/convert/tests.js.map +1 -0
  35. package/lib/datasource/conditionLocations.d.ts +9 -0
  36. package/lib/datasource/conditionLocations.js +70 -0
  37. package/lib/datasource/conditionLocations.js.map +1 -0
  38. package/lib/datasource/datasource.d.ts +11 -0
  39. package/lib/datasource/datasource.js +26 -6
  40. package/lib/datasource/datasource.js.map +1 -1
  41. package/lib/datasource/expressions.d.ts +36 -0
  42. package/lib/datasource/expressions.js +118 -0
  43. package/lib/datasource/expressions.js.map +1 -0
  44. package/lib/datasource/parseError.d.ts +11 -0
  45. package/lib/datasource/parseError.js +33 -19
  46. package/lib/datasource/parseError.js.map +1 -1
  47. package/lib/diff/conditions.d.ts +23 -0
  48. package/lib/diff/conditions.js +86 -0
  49. package/lib/diff/conditions.js.map +1 -0
  50. package/lib/diff/details.d.ts +7 -1
  51. package/lib/diff/details.js +54 -25
  52. package/lib/diff/details.js.map +1 -1
  53. package/lib/diff/index.d.ts +5 -0
  54. package/lib/diff/index.js +17 -2
  55. package/lib/diff/index.js.map +1 -1
  56. package/lib/evaluate/explain.d.ts +4 -1
  57. package/lib/evaluate/explain.js +35 -14
  58. package/lib/evaluate/explain.js.map +1 -1
  59. package/lib/evaluate/index.js +9 -5
  60. package/lib/evaluate/index.js.map +1 -1
  61. package/lib/formatter/expressions.d.ts +21 -0
  62. package/lib/formatter/expressions.js +79 -0
  63. package/lib/formatter/expressions.js.map +1 -0
  64. package/lib/formatter/formatDefinition.d.ts +46 -0
  65. package/lib/formatter/formatDefinition.js +201 -0
  66. package/lib/formatter/formatDefinition.js.map +1 -0
  67. package/lib/formatter/formatProject.d.ts +70 -0
  68. package/lib/formatter/formatProject.js +186 -0
  69. package/lib/formatter/formatProject.js.map +1 -0
  70. package/lib/formatter/index.d.ts +6 -0
  71. package/lib/formatter/index.js +53 -0
  72. package/lib/formatter/index.js.map +1 -0
  73. package/lib/formatter/layout.d.ts +26 -0
  74. package/lib/formatter/layout.js +175 -0
  75. package/lib/formatter/layout.js.map +1 -0
  76. package/lib/formatter/printFormatResult.d.ts +9 -0
  77. package/lib/formatter/printFormatResult.js +100 -0
  78. package/lib/formatter/printFormatResult.js.map +1 -0
  79. package/lib/formatter/run.d.ts +6 -0
  80. package/lib/formatter/run.js +97 -0
  81. package/lib/formatter/run.js.map +1 -0
  82. package/lib/formatter/simplify.d.ts +14 -0
  83. package/lib/formatter/simplify.js +21 -0
  84. package/lib/formatter/simplify.js.map +1 -0
  85. package/lib/formatter/since.d.ts +6 -0
  86. package/lib/formatter/since.js +80 -0
  87. package/lib/formatter/since.js.map +1 -0
  88. package/lib/formatter/style.d.ts +105 -0
  89. package/lib/formatter/style.js +248 -0
  90. package/lib/formatter/style.js.map +1 -0
  91. package/lib/linter/conditionKinds.js +2 -54
  92. package/lib/linter/conditionKinds.js.map +1 -1
  93. package/lib/linter/conditionSchema.js +42 -13
  94. package/lib/linter/conditionSchema.js.map +1 -1
  95. package/lib/linter/diagnostics.d.ts +14 -14
  96. package/lib/linter/expressionDiagnostics.d.ts +28 -0
  97. package/lib/linter/expressionDiagnostics.js +127 -0
  98. package/lib/linter/expressionDiagnostics.js.map +1 -0
  99. package/lib/linter/featureSchema.d.ts +2 -2
  100. package/lib/linter/featureSchema.js +14 -13
  101. package/lib/linter/featureSchema.js.map +1 -1
  102. package/lib/linter/lintProject.d.ts +7 -0
  103. package/lib/linter/lintProject.js +300 -52
  104. package/lib/linter/lintProject.js.map +1 -1
  105. package/lib/linter/listTypes.d.ts +7 -0
  106. package/lib/linter/listTypes.js +19 -0
  107. package/lib/linter/listTypes.js.map +1 -0
  108. package/lib/linter/printError.d.ts +2 -0
  109. package/lib/linter/printError.js +1 -0
  110. package/lib/linter/printError.js.map +1 -1
  111. package/lib/linter/requiredVariablesSchema.js +129 -13
  112. package/lib/linter/requiredVariablesSchema.js.map +1 -1
  113. package/lib/migrate/definitions.d.ts +46 -0
  114. package/lib/migrate/definitions.js +488 -0
  115. package/lib/migrate/definitions.js.map +1 -0
  116. package/lib/migrate/index.d.ts +6 -0
  117. package/lib/migrate/index.js +30 -0
  118. package/lib/migrate/index.js.map +1 -0
  119. package/lib/migrate/migrateProject.d.ts +33 -0
  120. package/lib/migrate/migrateProject.js +195 -0
  121. package/lib/migrate/migrateProject.js.map +1 -0
  122. package/lib/migrate/project.d.ts +31 -0
  123. package/lib/migrate/project.js +153 -0
  124. package/lib/migrate/project.js.map +1 -0
  125. package/lib/migrate/run.d.ts +3 -0
  126. package/lib/migrate/run.js +81 -0
  127. package/lib/migrate/run.js.map +1 -0
  128. package/lib/migrate/write.d.ts +10 -0
  129. package/lib/migrate/write.js +150 -0
  130. package/lib/migrate/write.js.map +1 -0
  131. package/lib/promoter/index.js +85 -4
  132. package/lib/promoter/index.js.map +1 -1
  133. package/lib/rewrite/conditions.d.ts +73 -0
  134. package/lib/rewrite/conditions.js +485 -0
  135. package/lib/rewrite/conditions.js.map +1 -0
  136. package/lib/rewrite/diff.d.ts +2 -0
  137. package/lib/rewrite/diff.js +76 -0
  138. package/lib/rewrite/diff.js.map +1 -0
  139. package/lib/rewrite/documents.d.ts +25 -0
  140. package/lib/rewrite/documents.js +54 -0
  141. package/lib/rewrite/documents.js.map +1 -0
  142. package/lib/rewrite/files.d.ts +6 -0
  143. package/lib/rewrite/files.js +66 -0
  144. package/lib/rewrite/files.js.map +1 -0
  145. package/lib/rewrite/lines.d.ts +56 -0
  146. package/lib/rewrite/lines.js +205 -0
  147. package/lib/rewrite/lines.js.map +1 -0
  148. package/package.json +5 -4
@@ -0,0 +1,105 @@
1
+ export declare const HOUSE_STYLE: {
2
+ /** Spaces per level of nesting. Prettier's tabWidth must match. */
3
+ indent: number;
4
+ /**
5
+ * The line endings fmt writes: "auto" keeps each file's own, judged by its first line break,
6
+ * and "lf" or "crlf" writes every file with that one, as Prettier's endOfLine does.
7
+ */
8
+ endOfLine: "auto" | "lf" | "crlf";
9
+ /**
10
+ * Keep a blank line the author wrote between two entries or two items, besides the ones
11
+ * blankLines asks for, as Prettier does. A run of blank lines becomes one, and a blank line
12
+ * moves with the entry below it. false keeps only the ones blankLines asks for.
13
+ */
14
+ keepBlankLines: boolean;
15
+ /**
16
+ * How expressions in `conditions` are written, in projects with `conditionExpressions: true`: one
17
+ * condition a line, with a group's conditions between its parentheses, indented by `indent`.
18
+ * A single condition stays on one line. fmt rewrites an expression only when it reads back
19
+ * to exactly the same tree, so nothing here can change a datafile either. Comment lines stay
20
+ * above the condition below them.
21
+ */
22
+ expressions: {
23
+ /** End an expression over several lines with a line break, which YAML writes as `|` */
24
+ finalNewline: boolean;
25
+ };
26
+ /**
27
+ * The order of Featurevisor's own keys in each kind of object. Keys an object has that its
28
+ * list leaves out keep their written order, after the listed ones.
29
+ */
30
+ keyOrder: {
31
+ feature: string[];
32
+ rule: string[];
33
+ force: string[];
34
+ variation: string[];
35
+ /** A variable in a feature's variablesSchema */
36
+ variableSchema: string[];
37
+ /** An override in a variation's or a rule's variableOverrides */
38
+ featureVariableOverride: string[];
39
+ /** A global variable */
40
+ variable: string[];
41
+ /** An override of a global variable, nested ones too */
42
+ variableOverride: string[];
43
+ segment: string[];
44
+ attribute: string[];
45
+ /** A schema file, and every schema nested in a schema, attribute or variable */
46
+ schema: string[];
47
+ target: string[];
48
+ /** A feature, segment or variable test spec */
49
+ test: string[];
50
+ /** An assertion, its children, and a scenario spec, which is one assertion */
51
+ assertion: string[];
52
+ /** A check, and the checks inside its and, or and not groups */
53
+ check: string[];
54
+ };
55
+ /** Where a blank line separates the entries of a map or the items of a list */
56
+ blankLines: {
57
+ /** Between the top level keys of every definition and spec */
58
+ topLevelKeys: boolean;
59
+ /** Between a feature's rules, in a list or under each environment */
60
+ rules: boolean;
61
+ /** Between the environments that group a feature's rules */
62
+ ruleEnvironments: boolean;
63
+ /** Between a feature's force entries, in a list or under each environment */
64
+ force: boolean;
65
+ /** Between the environments that group a feature's force entries */
66
+ forceEnvironments: boolean;
67
+ /** Between the environments under a feature's expose */
68
+ exposeEnvironments: boolean;
69
+ /** Between a feature's variations */
70
+ variations: boolean;
71
+ /** Between the variables of a feature's variablesSchema */
72
+ variablesSchema: boolean;
73
+ /** Between the overrides in a variation's or a rule's variableOverrides */
74
+ featureVariableOverrides: boolean;
75
+ /** Between a global variable's overrides, nested ones too */
76
+ variableOverrides: boolean;
77
+ /** Between the environments that group a global variable's overrides */
78
+ variableOverrideEnvironments: boolean;
79
+ /** Between the properties of a schema */
80
+ schemaProperties: boolean;
81
+ /** Between a spec's assertions */
82
+ assertions: boolean;
83
+ /** Between the children of an assertion or a scenario */
84
+ assertionChildren: boolean;
85
+ /** Between checks, and between the checks in a group */
86
+ checks: boolean;
87
+ };
88
+ /** Choices only one file format can express, by parser extension. `yaml` uses yml's. */
89
+ formats: {
90
+ yml: {
91
+ /** "single" needs Prettier's singleQuote too */
92
+ quote: "double";
93
+ quoteYaml11Types: true;
94
+ lineWidth: number;
95
+ /** false fights Prettier, which always indents list items under their key */
96
+ indentSequences: true;
97
+ /** Each alias written out in full, without anchors, so a value reads where it is used */
98
+ expandAliases: true;
99
+ };
100
+ json: {
101
+ /** Prettier's printWidth must match */
102
+ lineWidth: number;
103
+ };
104
+ };
105
+ };
@@ -0,0 +1,248 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HOUSE_STYLE = void 0;
4
+ /**
5
+ * Featurevisor's house style for definitions. Every opinion `featurevisor fmt` applies lives
6
+ * here, so a change of style is an edit to this file alone.
7
+ *
8
+ * Anything here is safe to change. Key order only reaches the objects layout.ts places, which
9
+ * the builder rebuilds key by key, so no choice in this file can change a datafile. To change
10
+ * the style:
11
+ *
12
+ * 1. Edit this file.
13
+ * 2. Rebuild Core and run `make fmt-examples` to restyle the examples.
14
+ * 3. Update the expectations in style.spec.ts and the Formatting page in the docs.
15
+ *
16
+ * A change fails users' `fmt --check` once they upgrade, so note it in the release notes.
17
+ *
18
+ * Projects often run Prettier over the same files. Prettier leaves fmt's output as it is today,
19
+ * and the notes below say which values keep it that way.
20
+ */
21
+ const LIFECYCLE = ["archived", "deprecated", "promotable"];
22
+ const SCHEMA_KEYS = [
23
+ "type",
24
+ "schema",
25
+ "oneOf",
26
+ "format",
27
+ "enum",
28
+ "const",
29
+ "minimum",
30
+ "maximum",
31
+ "minLength",
32
+ "maxLength",
33
+ "pattern",
34
+ "items",
35
+ "minItems",
36
+ "maxItems",
37
+ "uniqueItems",
38
+ "properties",
39
+ "required",
40
+ "additionalProperties",
41
+ ];
42
+ exports.HOUSE_STYLE = {
43
+ /** Spaces per level of nesting. Prettier's tabWidth must match. */
44
+ indent: 2,
45
+ /**
46
+ * The line endings fmt writes: "auto" keeps each file's own, judged by its first line break,
47
+ * and "lf" or "crlf" writes every file with that one, as Prettier's endOfLine does.
48
+ */
49
+ endOfLine: "auto",
50
+ /**
51
+ * Keep a blank line the author wrote between two entries or two items, besides the ones
52
+ * blankLines asks for, as Prettier does. A run of blank lines becomes one, and a blank line
53
+ * moves with the entry below it. false keeps only the ones blankLines asks for.
54
+ */
55
+ keepBlankLines: true,
56
+ /**
57
+ * How expressions in `conditions` are written, in projects with `conditionExpressions: true`: one
58
+ * condition a line, with a group's conditions between its parentheses, indented by `indent`.
59
+ * A single condition stays on one line. fmt rewrites an expression only when it reads back
60
+ * to exactly the same tree, so nothing here can change a datafile either. Comment lines stay
61
+ * above the condition below them.
62
+ */
63
+ expressions: {
64
+ /** End an expression over several lines with a line break, which YAML writes as `|` */
65
+ finalNewline: true,
66
+ },
67
+ /**
68
+ * The order of Featurevisor's own keys in each kind of object. Keys an object has that its
69
+ * list leaves out keep their written order, after the listed ones.
70
+ */
71
+ keyOrder: {
72
+ feature: [
73
+ ...LIFECYCLE,
74
+ "description",
75
+ "tags",
76
+ "bucketBy",
77
+ "conditions",
78
+ "disabledVariationValue",
79
+ "variablesSchema",
80
+ "variations",
81
+ "force",
82
+ "rules",
83
+ "expose",
84
+ ],
85
+ rule: [
86
+ "key",
87
+ "description",
88
+ "promotable",
89
+ "conditions",
90
+ "percentage",
91
+ "enabled",
92
+ "variation",
93
+ "variationWeights",
94
+ "variables",
95
+ "variableOverrides",
96
+ ],
97
+ force: ["conditions", "enabled", "variation", "variables"],
98
+ variation: ["value", "description", "weight", "variables", "variableOverrides"],
99
+ /** A variable in a feature's variablesSchema */
100
+ variableSchema: [
101
+ "description",
102
+ "deprecated",
103
+ ...SCHEMA_KEYS,
104
+ "defaultValue",
105
+ "disabledValue",
106
+ "useDefaultWhenDisabled",
107
+ ],
108
+ /** An override in a variation's or a rule's variableOverrides */
109
+ featureVariableOverride: ["key", "description", "promotable", "conditions", "value", "mutate"],
110
+ /** A global variable */
111
+ variable: [
112
+ ...LIFECYCLE,
113
+ "description",
114
+ "tags",
115
+ "compose",
116
+ ...SCHEMA_KEYS,
117
+ "defaultValue",
118
+ "conditions",
119
+ "disabledValue",
120
+ "useDefaultWhenDisabled",
121
+ "overrides",
122
+ ],
123
+ /** An override of a global variable, nested ones too */
124
+ variableOverride: [
125
+ "key",
126
+ "description",
127
+ "promotable",
128
+ "conditions",
129
+ "continue",
130
+ "value",
131
+ "mutate",
132
+ "overrides",
133
+ ],
134
+ segment: [...LIFECYCLE, "description", "conditions"],
135
+ attribute: [...LIFECYCLE, "description", ...SCHEMA_KEYS],
136
+ /** A schema file, and every schema nested in a schema, attribute or variable */
137
+ schema: [...LIFECYCLE, "description", ...SCHEMA_KEYS],
138
+ target: [
139
+ "promotable",
140
+ "description",
141
+ "tag",
142
+ "tags",
143
+ "includeFeatures",
144
+ "excludeFeatures",
145
+ "includeVariables",
146
+ "excludeVariables",
147
+ "context",
148
+ "schemaVersion",
149
+ ],
150
+ /** A feature, segment or variable test spec */
151
+ test: ["feature", "segment", "variable", "promotable", "assertions"],
152
+ /** An assertion, its children, and a scenario spec, which is one assertion */
153
+ assertion: [
154
+ "key",
155
+ "description",
156
+ "promotable",
157
+ "matrix",
158
+ "environment",
159
+ "target",
160
+ "at",
161
+ "context",
162
+ "stickyFeatures",
163
+ "stickyVariables",
164
+ "defaultVariationValue",
165
+ "defaultVariableValues",
166
+ "defaultVariableValue",
167
+ "expectedToBeEnabled",
168
+ "expectedToMatch",
169
+ "expectedVariation",
170
+ "expectedVariables",
171
+ "expectedValue",
172
+ "expectedEvaluations",
173
+ "expectedEvaluation",
174
+ "checks",
175
+ "children",
176
+ ],
177
+ /** A check, and the checks inside its and, or and not groups */
178
+ check: [
179
+ "feature",
180
+ "segment",
181
+ "variable",
182
+ "key",
183
+ "description",
184
+ "path",
185
+ "operator",
186
+ "value",
187
+ "compareTo",
188
+ "regexFlags",
189
+ "enabled",
190
+ "variation",
191
+ "matches",
192
+ "and",
193
+ "or",
194
+ "not",
195
+ ],
196
+ },
197
+ /** Where a blank line separates the entries of a map or the items of a list */
198
+ blankLines: {
199
+ /** Between the top level keys of every definition and spec */
200
+ topLevelKeys: true,
201
+ /** Between a feature's rules, in a list or under each environment */
202
+ rules: true,
203
+ /** Between the environments that group a feature's rules */
204
+ ruleEnvironments: true,
205
+ /** Between a feature's force entries, in a list or under each environment */
206
+ force: true,
207
+ /** Between the environments that group a feature's force entries */
208
+ forceEnvironments: true,
209
+ /** Between the environments under a feature's expose */
210
+ exposeEnvironments: true,
211
+ /** Between a feature's variations */
212
+ variations: true,
213
+ /** Between the variables of a feature's variablesSchema */
214
+ variablesSchema: false,
215
+ /** Between the overrides in a variation's or a rule's variableOverrides */
216
+ featureVariableOverrides: false,
217
+ /** Between a global variable's overrides, nested ones too */
218
+ variableOverrides: true,
219
+ /** Between the environments that group a global variable's overrides */
220
+ variableOverrideEnvironments: true,
221
+ /** Between the properties of a schema */
222
+ schemaProperties: false,
223
+ /** Between a spec's assertions */
224
+ assertions: true,
225
+ /** Between the children of an assertion or a scenario */
226
+ assertionChildren: true,
227
+ /** Between checks, and between the checks in a group */
228
+ checks: false,
229
+ },
230
+ /** Choices only one file format can express, by parser extension. `yaml` uses yml's. */
231
+ formats: {
232
+ yml: {
233
+ /** "single" needs Prettier's singleQuote too */
234
+ quote: "double",
235
+ quoteYaml11Types: true,
236
+ lineWidth: 0,
237
+ /** false fights Prettier, which always indents list items under their key */
238
+ indentSequences: true,
239
+ /** Each alias written out in full, without anchors, so a value reads where it is used */
240
+ expandAliases: true,
241
+ },
242
+ json: {
243
+ /** Prettier's printWidth must match */
244
+ lineWidth: 80,
245
+ },
246
+ },
247
+ };
248
+ //# sourceMappingURL=style.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"style.js","sourceRoot":"","sources":["../../src/formatter/style.ts"],"names":[],"mappings":";;;AAEA;;;;;;;;;;;;;;;;GAgBG;AAEH,MAAM,SAAS,GAAG,CAAC,UAAU,EAAE,YAAY,EAAE,YAAY,CAAC,CAAC;AAE3D,MAAM,WAAW,GAAG;IAClB,MAAM;IACN,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,MAAM;IACN,OAAO;IACP,SAAS;IACT,SAAS;IACT,WAAW;IACX,WAAW;IACX,SAAS;IACT,OAAO;IACP,UAAU;IACV,UAAU;IACV,aAAa;IACb,YAAY;IACZ,UAAU;IACV,sBAAsB;CACvB,CAAC;AAEW,QAAA,WAAW,GAAG;IACzB,mEAAmE;IACnE,MAAM,EAAE,CAAC;IAET;;;OAGG;IACH,SAAS,EAAE,MAAgC;IAE3C;;;;OAIG;IACH,cAAc,EAAE,IAAI;IAEpB;;;;;;OAMG;IACH,WAAW,EAAE;QACX,uFAAuF;QACvF,YAAY,EAAE,IAAI;KACnB;IAED;;;OAGG;IACH,QAAQ,EAAE;QACR,OAAO,EAAE;YACP,GAAG,SAAS;YACZ,aAAa;YACb,MAAM;YACN,UAAU;YACV,YAAY;YACZ,wBAAwB;YACxB,iBAAiB;YACjB,YAAY;YACZ,OAAO;YACP,OAAO;YACP,QAAQ;SACT;QACD,IAAI,EAAE;YACJ,KAAK;YACL,aAAa;YACb,YAAY;YACZ,YAAY;YACZ,YAAY;YACZ,SAAS;YACT,WAAW;YACX,kBAAkB;YAClB,WAAW;YACX,mBAAmB;SACpB;QACD,KAAK,EAAE,CAAC,YAAY,EAAE,SAAS,EAAE,WAAW,EAAE,WAAW,CAAC;QAC1D,SAAS,EAAE,CAAC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,WAAW,EAAE,mBAAmB,CAAC;QAC/E,gDAAgD;QAChD,cAAc,EAAE;YACd,aAAa;YACb,YAAY;YACZ,GAAG,WAAW;YACd,cAAc;YACd,eAAe;YACf,wBA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E,KAAK,EAAE;YACL,SAAS;YACT,SAAS;YACT,UAAU;YACV,KAAK;YACL,aAAa;YACb,MAAM;YACN,UAAU;YACV,OAAO;YACP,WAAW;YACX,YAAY;YACZ,SAAS;YACT,WAAW;YACX,SAAS;YACT,KAAK;YACL,IAAI;YACJ,KAAK;SACN;KACF;IAED,+EAA+E;IAC/E,UAAU,EAAE;QACV,8DAA8D;QAC9D,YAAY,EAAE,IAAI;QAClB,qEAAqE;QACrE,KAAK,EAAE,IAAI;QACX,4DAA4D;QAC5D,gBAAgB,EAAE,IAAI;QACtB,6EAA6E;QAC7E,KAAK,EAAE,IAAI;QACX,oEAAoE;QACpE,iBAAiB,EAAE,IAAI;QACvB,wDAAwD;QACxD,kBAAkB,EAAE,IAAI;QACxB,qCAAqC;QACrC,UAAU,EAAE,IAAI;QAChB,2DAA2D;QAC3D,eAAe,EAAE,KAAK;QACtB,2EAA2E;QAC3E,wBAAwB,EAAE,KAAK;QAC/B,6DAA6D;QAC7D,iBAAiB,EAAE,IAAI;QACvB,wEAAwE;QACxE,4BAA4B,EAAE,IAAI;QAClC,yCAAyC;QACzC,gBAAgB,EAAE,KAAK;QACvB,kCAAkC;QAClC,UAAU,EAAE,IAAI;QAChB,yDAAyD;QACzD,iBAAiB,EAAE,IAAI;QACvB,wDAAwD;QACxD,MAAM,EAAE,KAAK;KACd;IAED,wFAAwF;IACxF,OAAO,EAAE;QACP,GAAG,EAAE;YACH,gDAAgD;YAChD,KAAK,EAAE,QAAQ;YACf,gBAAgB,EAAE,IAAI;YACtB,SAAS,EAAE,CAAC;YACZ,6EAA6E;YAC7E,eAAe,EAAE,IAAI;YACrB,yFAAyF;YACzF,aAAa,EAAE,IAAI;SACO;QAC5B,IAAI,EAAE;YACJ,uCAAuC;YACvC,SAAS,EAAE,EAAE;SACc;KAC9B;CACF,CAAC"}
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getConditionKindIssues = getConditionKindIssues;
4
+ const conditionLocations_1 = require("../datasource/conditionLocations");
4
5
  const conditions_1 = require("../datasource/conditions");
5
6
  const KIND_LABELS = {
6
7
  attribute: "Attribute conditions",
@@ -70,60 +71,7 @@ function getConditionKindIssues(entityType, definition, allowedConditions) {
70
71
  });
71
72
  });
72
73
  };
73
- // Lists of rules, force entries and overrides, keyed by environment or not.
74
- const visitList = (value, path, each) => {
75
- if (Array.isArray(value)) {
76
- value.forEach((entry, i) => isObject(entry) && each(entry, [...path, i]));
77
- }
78
- else if (isObject(value)) {
79
- for (const [environment, entries] of Object.entries(value)) {
80
- if (Array.isArray(entries))
81
- entries.forEach((entry, i) => isObject(entry) && each(entry, [...path, environment, i]));
82
- }
83
- }
84
- };
85
- const visitFeatureVariableOverrides = (value, path) => {
86
- if (!isObject(value))
87
- return;
88
- for (const [variableKey, overrides] of Object.entries(value)) {
89
- if (!Array.isArray(overrides))
90
- continue;
91
- overrides.forEach((override, i) => isObject(override) &&
92
- visit("featureVariableOverrides", override.conditions, [
93
- ...path,
94
- variableKey,
95
- i,
96
- "conditions",
97
- ]));
98
- }
99
- };
100
- const visitGlobalOverrides = (value, path) => visitList(value, path, (override, at) => {
101
- visit("variableOverrides", override.conditions, [...at, "conditions"]);
102
- if (override.overrides !== undefined)
103
- visitGlobalOverrides(override.overrides, [...at, "overrides"]);
104
- });
105
- if (entityType === "segment") {
106
- visit("segments", definition.conditions, ["conditions"]);
107
- }
108
- if (entityType === "feature") {
109
- visit("features", definition.conditions, ["conditions"]);
110
- visitList(definition.rules, ["rules"], (rule, at) => {
111
- visit("rules", rule.conditions, [...at, "conditions"]);
112
- visitFeatureVariableOverrides(rule.variableOverrides, [...at, "variableOverrides"]);
113
- });
114
- visitList(definition.force, ["force"], (entry, at) => visit("force", entry.conditions, [...at, "conditions"]));
115
- if (Array.isArray(definition.variations))
116
- definition.variations.forEach((variation, i) => isObject(variation) &&
117
- visitFeatureVariableOverrides(variation.variableOverrides, [
118
- "variations",
119
- i,
120
- "variableOverrides",
121
- ]));
122
- }
123
- if (entityType === "variable") {
124
- visit("variables", definition.conditions, ["conditions"]);
125
- visitGlobalOverrides(definition.overrides, ["overrides"]);
126
- }
74
+ (0, conditionLocations_1.visitConditionLocations)(entityType, definition, visit);
127
75
  return issues;
128
76
  }
129
77
  //# sourceMappingURL=conditionKinds.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"conditionKinds.js","sourceRoot":"","sources":["../../src/linter/conditionKinds.ts"],"names":[],"mappings":";;AA+CA,wDAgHC;AA5JD,yDAA+D;AAS/D,MAAM,WAAW,GAAkC;IACjD,SAAS,EAAE,sBAAsB;IACjC,OAAO,EAAE,oBAAoB;IAC7B,OAAO,EAAE,oBAAoB;IAC7B,QAAQ,EAAE,4BAA4B;CACvC,CAAC;AAEF,MAAM,eAAe,GAAsC;IACzD,QAAQ,EAAE,UAAU;IACpB,QAAQ,EAAE,yBAAyB;IACnC,KAAK,EAAE,OAAO;IACd,KAAK,EAAE,eAAe;IACtB,wBAAwB,EAAE,4BAA4B;IACtD,SAAS,EAAE,iCAAiC;IAC5C,iBAAiB,EAAE,2BAA2B;CAC/C,CAAC;AAEF,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,CAAC,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AACvE,CAAC;AAED,8FAA8F;AAC9F,SAAS,gBAAgB,CAAC,IAAa;IACrC,IAAI,OAAO,IAAI,KAAK,QAAQ;QAAE,OAAO,SAAS,CAAC;IAC/C,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;QAAE,OAAO,SAAS,CAAC;IACtC,IAAI,OAAO,IAAI,CAAC,SAAS,KAAK,QAAQ;QAAE,OAAO,WAAW,CAAC;IAC3D,IAAI,OAAO,IAAI,CAAC,OAAO,KAAK,QAAQ;QAAE,OAAO,SAAS,CAAC;IACvD,IAAI,OAAO,IAAI,CAAC,QAAQ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AC,QAAQ,CAAC,KAAK,IAAI,CACpF,QAAQ,EACR,IAAI,CACL,eAAe,IAAI,0BAA0B,QAAQ,GAAG;aAC1D,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;IAEF,IAAA,4CAAuB,EAAC,UAAU,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC;IAEvD,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -9,6 +9,7 @@ const schemaFormats_1 = require("./schemaFormats");
9
9
  const zodHelpers_1 = require("./zodHelpers");
10
10
  const diagnostics_1 = require("./diagnostics");
11
11
  const comparisonOperators_1 = require("./comparisonOperators");
12
+ const listTypes_1 = require("./listTypes");
12
13
  const requiredFeaturesSchema_1 = require("./requiredFeaturesSchema");
13
14
  const requiredVariablesSchema_1 = require("./requiredVariablesSchema");
14
15
  const commonOperators = ["equals", "notEquals"];
@@ -45,8 +46,18 @@ function isPrimitiveAttributeValue(value) {
45
46
  typeof value === "number" ||
46
47
  typeof value === "boolean");
47
48
  }
48
- function isStringArray(value) {
49
- return Array.isArray(value) && value.every((entry) => typeof entry === "string");
49
+ /** `in` and `notIn` compare with string attributes, or with integer and number attributes. */
50
+ function supportsMembership(types) {
51
+ return (types.length > 0 &&
52
+ (types.every((type) => type === "string") ||
53
+ types.every((type) => type === "integer" || type === "number")));
54
+ }
55
+ /** A list of strings or of numbers, with null allowed beside either. */
56
+ function isMembershipList(value) {
57
+ return (Array.isArray(value) &&
58
+ value.every((entry) => entry === null ||
59
+ typeof entry === "string" ||
60
+ (typeof entry === "number" && Number.isFinite(entry))));
50
61
  }
51
62
  function getPortableRegexError(pattern) {
52
63
  try {
@@ -336,6 +347,10 @@ function addIssue(context, message, path = ["value"], code) {
336
347
  ...(code ? { params: { code } } : {}),
337
348
  });
338
349
  }
350
+ /** An issue lint reports as a warning, such as a check stricter than earlier versions had */
351
+ function addWarning(context, message, code, path = ["value"]) {
352
+ context.addIssue({ code: zod_1.z.ZodIssueCode.custom, message, path, params: { warning: true, code } });
353
+ }
339
354
  function getDateOperatorError(attribute, operator, attributesByKey, schemasByKey) {
340
355
  const leaf = resolveAttributePath(attribute, attributesByKey, schemasByKey);
341
356
  const isDateSchema = (schema) => {
@@ -396,18 +411,23 @@ function validateAttributeAwareCondition(data, context, attributesByKey, schemas
396
411
  return;
397
412
  }
398
413
  if (arrayMembershipOperators.includes(data.operator)) {
399
- if (leafTypes.length === 0 || leafTypes.some((type) => type !== "string")) {
400
- addIssue(context, `Operator "${data.operator}" can only be used with string attributes or nested paths declared as strings. ${data.operator === "notIn" ? "Use a not group containing an or group of equals conditions for numbers." : "Use an or group of equals conditions for numbers."}`);
414
+ if (!supportsMembership(leafTypes)) {
415
+ addIssue(context, `Operator "${data.operator}" can only be used with string, integer or number attributes, or nested paths declared as one of them.`);
401
416
  return;
402
417
  }
403
418
  if (!Array.isArray(data.value)) {
404
419
  return;
405
420
  }
421
+ let entryIssue = false;
406
422
  data.value.forEach((entry, index) => {
407
- if (!matchesLeafValue(resolvedLeaf, entry, schemasByKey)) {
423
+ if (entry !== null && !matchesLeafValue(resolvedLeaf, entry, schemasByKey)) {
424
+ entryIssue = true;
408
425
  addIssue(context, `Value at index ${index} does not match the schema of attribute "${data.attribute}".`, ["value", index]);
409
426
  }
410
427
  });
428
+ const mixed = !entryIssue && (0, listTypes_1.getMixedListMessage)(data.operator, data.value);
429
+ if (mixed)
430
+ addWarning(context, mixed, "mixed_list");
411
431
  return;
412
432
  }
413
433
  if ([...arrayOperators, ...arrayListOperators].includes(data.operator)) {
@@ -422,16 +442,23 @@ function validateAttributeAwareCondition(data, context, attributesByKey, schemas
422
442
  return;
423
443
  }
424
444
  if (arrayListOperators.includes(data.operator)) {
445
+ let entryIssue = false;
425
446
  if (Array.isArray(data.value))
426
447
  data.value.forEach((value, index) => {
427
448
  // Malformed candidates already have an indexed operand diagnostic.
428
449
  if (!isPrimitiveAttributeValue(value) ||
429
- (typeof value === "number" && !Number.isFinite(value)))
450
+ (typeof value === "number" && !Number.isFinite(value))) {
451
+ entryIssue = true;
430
452
  return;
453
+ }
431
454
  if (!matchesLeafValue(itemLeaf, value, schemasByKey)) {
455
+ entryIssue = true;
432
456
  addIssue(context, `Value at index ${index} does not match the item schema of attribute "${data.attribute}".`, ["value", index]);
433
457
  }
434
458
  });
459
+ const mixed = !entryIssue && (0, listTypes_1.getMixedListMessage)(data.operator, data.value);
460
+ if (mixed)
461
+ addWarning(context, mixed, "mixed_list");
435
462
  }
436
463
  else if (!matchesLeafValue(itemLeaf, data.value, schemasByKey)) {
437
464
  addIssue(context, `Value does not match the item schema of attribute "${data.attribute}".`);
@@ -496,7 +523,7 @@ function getConditionsZodSchema(projectConfig, attributesByKey, schemasByKey = {
496
523
  if (arrayMembershipOperators.includes(data.operator)) {
497
524
  const leaf = resolveAttributePath(data.attribute, attributesByKey, schemasByKey);
498
525
  const types = leaf ? getLeafTypes(leaf, schemasByKey) : [];
499
- if (leaf && (types.length === 0 || types.some((type) => type !== "string"))) {
526
+ if (leaf && !supportsMembership(types)) {
500
527
  validateAttributeAwareCondition(data, context, attributesByKey, schemasByKey);
501
528
  return;
502
529
  }
@@ -541,13 +568,15 @@ function getConditionsZodSchema(projectConfig, attributesByKey, schemasByKey = {
541
568
  addIssue(context, `when operator is "${data.operator}", use an ISO 8601 timestamp YYYY-MM-DDTHH:mm:ss with Z or ±HH:mm and optional 1 to 9 fractional digits, for example 2026-11-27T00:00:00.123456Z`);
542
569
  }
543
570
  }
544
- if (arrayMembershipOperators.includes(data.operator) && !Array.isArray(data.value)) {
545
- addIssue(context, `when operator is "${data.operator}", value must be an array of strings`);
571
+ if (arrayMembershipOperators.includes(data.operator) && !isMembershipList(data.value)) {
572
+ addIssue(context, `when operator is "${data.operator}", value must be a list of strings or of numbers`);
546
573
  }
547
- if (arrayMembershipOperators.includes(data.operator) &&
548
- Array.isArray(data.value) &&
549
- !isStringArray(data.value)) {
550
- addIssue(context, `when operator is "${data.operator}", value must be an array of strings`);
574
+ else if (arrayMembershipOperators.includes(data.operator)) {
575
+ const leaf = resolveAttributePath(data.attribute, attributesByKey, schemasByKey);
576
+ // Without a known attribute, the list's own types still have to agree.
577
+ const mixed = !leaf && (0, listTypes_1.getMixedListMessage)(data.operator, data.value);
578
+ if (mixed)
579
+ addWarning(context, mixed, "mixed_list");
551
580
  }
552
581
  if (arrayListOperators.includes(data.operator)) {
553
582
  if (!Array.isArray(data.value)) {