@mapbox/mapbox-gl-style-spec 14.31.0 → 14.32.0-rc.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/dist/index.cjs +173 -188
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +34 -15
- package/dist/index.es.js +173 -188
- package/dist/index.es.js.map +1 -1
- package/expression/definitions/index.ts +3 -2
- package/expression/expression_dependencies.ts +20 -23
- package/expression/index.ts +23 -30
- package/expression/is_constant.ts +20 -1
- package/expression/parsing_context.ts +73 -57
- package/expression/types.ts +14 -32
- package/feature_filter/index.ts +2 -1
- package/format.ts +10 -17
- package/function/index.ts +106 -155
- package/migrate/v8.ts +49 -80
- package/migrate/v9.ts +13 -13
- package/migrate.ts +2 -3
- package/package.json +1 -1
- package/reference/v8.json +39 -26
- package/validate/validate_appearance.ts +1 -2
- package/validate/validate_expression.ts +12 -11
- package/validate_mapbox_api_supported.ts +1 -1
|
@@ -103,34 +103,35 @@ export function disallowedFilterParameters(e: Expression, options: any): Validat
|
|
|
103
103
|
return errors;
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
-
const FEATURE_OPERATORS = new Set(['get', 'has', 'properties', 'geometry-type', 'id']);
|
|
107
|
-
const APPEARANCES_DISALLOWED_PARAMETERS = new Set([
|
|
108
|
-
'zoom', 'pitch', 'distance-from-center',
|
|
109
|
-
'feature', 'feature-state',
|
|
110
|
-
'measure-light',
|
|
111
|
-
'heatmap-density', 'line-progress',
|
|
112
|
-
'raster-value', 'raster-particle-speed', 'sky-radial-progress',
|
|
113
|
-
]);
|
|
106
|
+
const FEATURE_OPERATORS: ReadonlySet<string> = new Set(['get', 'has', 'properties', 'geometry-type', 'id']);
|
|
114
107
|
|
|
115
108
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
116
109
|
function checkDisallowedAppearancesParameters(e: Expression, options: any): ValidationError[] {
|
|
110
|
+
const disallowedParameters = new Set([
|
|
111
|
+
'zoom', 'pitch', 'distance-from-center',
|
|
112
|
+
'feature', 'feature-state',
|
|
113
|
+
'measure-light',
|
|
114
|
+
'heatmap-density', 'line-progress',
|
|
115
|
+
'raster-value', 'raster-particle-speed', 'sky-radial-progress',
|
|
116
|
+
]);
|
|
117
|
+
|
|
117
118
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
118
119
|
if (options.valueSpec && options.valueSpec.expression) {
|
|
119
120
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
120
121
|
for (const param of options.valueSpec.expression.parameters) {
|
|
121
122
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
122
|
-
|
|
123
|
+
disallowedParameters.delete(param);
|
|
123
124
|
}
|
|
124
125
|
}
|
|
125
126
|
|
|
126
|
-
if (
|
|
127
|
+
if (disallowedParameters.size === 0) {
|
|
127
128
|
return [];
|
|
128
129
|
}
|
|
129
130
|
const errors: ValidationError[] = [];
|
|
130
131
|
|
|
131
132
|
if (e instanceof CompoundExpression) {
|
|
132
133
|
const param = FEATURE_OPERATORS.has(e.name) ? 'feature' : e.name;
|
|
133
|
-
if (
|
|
134
|
+
if (disallowedParameters.has(param)) {
|
|
134
135
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access
|
|
135
136
|
return [new ValidationError(options.key, options.value, `["${e.name}"] is not an allowed parameter`)];
|
|
136
137
|
}
|
|
@@ -52,7 +52,7 @@ function getAllowedKeyErrors(obj: Record<string, unknown>, keys: string[], path?
|
|
|
52
52
|
return errors;
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
const acceptedSourceTypes = new Set<SourceSpecification['type']>(['vector', 'raster', 'raster-dem', 'raster-array', 'model', 'batched-model']);
|
|
55
|
+
const acceptedSourceTypes: ReadonlySet<SourceSpecification['type']> = new Set<SourceSpecification['type']>(['vector', 'raster', 'raster-dem', 'raster-array', 'model', 'batched-model']);
|
|
56
56
|
function getSourceErrors(source: SourceSpecification, i: number): Array<ValidationError> {
|
|
57
57
|
const errors: ValidationError[] = [];
|
|
58
58
|
|