zarr-metadata 0.7.0 → 0.8.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/README.md +8 -5
- package/dist/chunk-grids.d.ts +40 -0
- package/dist/chunk-grids.d.ts.map +1 -0
- package/dist/chunk-grids.js +133 -0
- package/dist/chunk-grids.js.map +1 -0
- package/dist/codecs.d.ts +37 -0
- package/dist/codecs.d.ts.map +1 -0
- package/dist/codecs.js +182 -0
- package/dist/codecs.js.map +1 -0
- package/dist/data-types.d.ts +12 -0
- package/dist/data-types.d.ts.map +1 -0
- package/dist/data-types.js +70 -0
- package/dist/data-types.js.map +1 -0
- package/dist/guards.d.ts +21 -0
- package/dist/guards.d.ts.map +1 -0
- package/dist/guards.js +39 -0
- package/dist/guards.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/semantics.d.ts +14 -42
- package/dist/semantics.d.ts.map +1 -1
- package/dist/semantics.js +21 -409
- package/dist/semantics.js.map +1 -1
- package/package.json +1 -1
- package/src/chunk-grids.ts +158 -0
- package/src/codecs.ts +214 -0
- package/src/data-types.ts +81 -0
- package/src/guards.ts +48 -0
- package/src/index.ts +11 -0
- package/src/semantics.ts +23 -437
package/dist/semantics.d.ts
CHANGED
|
@@ -1,49 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Semantic (cross-field) validation for v3 array metadata
|
|
2
|
+
* Semantic (cross-field) validation for v3 array metadata: the
|
|
3
|
+
* orchestrator. The rules themselves live with their content —
|
|
4
|
+
* `chunk-grids.ts`, `codecs.ts`, and `data-types.ts` each hold the syntax
|
|
5
|
+
* (types) and semantics (procedures) for the names this package
|
|
6
|
+
* interprets, mirroring how the spec, the Python reference's type layout,
|
|
7
|
+
* and the zarr-extensions registry are organized. This module only walks
|
|
8
|
+
* documents: extract shape, ask each content module for its verdicts,
|
|
9
|
+
* thread the chunk-size context into codec pipelines, and descend into a
|
|
10
|
+
* group's inline consolidated entries.
|
|
3
11
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* extension points to enforce the cross-field rules the specs state in
|
|
7
|
-
* prose:
|
|
8
|
-
*
|
|
9
|
-
* - the `regular` chunk grid REQUIRES a configuration with `chunk_shape`,
|
|
10
|
-
* which has one length per dimension of `shape`;
|
|
11
|
-
* - the `rectilinear` chunk grid requires a configuration with `kind` and
|
|
12
|
-
* `chunk_shapes`; `chunk_shapes` has one entry per dimension, and each
|
|
13
|
-
* explicit chunk list (integers and `[size, count]` run-length pairs)
|
|
14
|
-
* sums exactly to that dimension's length (the bare-integer uniform
|
|
15
|
-
* shorthand carries no sum constraint, like the regular grid);
|
|
16
|
-
* - a `transpose` codec requires a configuration with `order`, a
|
|
17
|
-
* permutation of `0..n-1` with one entry per array dimension;
|
|
18
|
-
* - a `sharding_indexed` codec requires a configuration with
|
|
19
|
-
* `chunk_shape`, `codecs`, and `index_codecs`; its inner `chunk_shape`
|
|
20
|
-
* matches the array's
|
|
21
|
-
* dimensionality and evenly divides every chunk it shards — the grid's
|
|
22
|
-
* chunk at the top level (each distinct per-dimension size, for
|
|
23
|
-
* rectilinear grids), the parent shard's inner chunk when sharding
|
|
24
|
-
* nests;
|
|
25
|
-
* - `fill_value` has a JSON shape permitted for the named core data type
|
|
26
|
-
* (booleans for `bool`, ranged integers for the int types, numbers /
|
|
27
|
-
* the "NaN"-family sentinels / width-checked "0x…" strings for the
|
|
28
|
-
* float types, two-element arrays for the complex types).
|
|
29
|
-
*
|
|
30
|
-
* Dimensional context is THREADED through codec pipelines rather than
|
|
31
|
-
* assumed constant (mirroring zarr-python's chunk-spec threading): a valid
|
|
32
|
-
* `transpose` permutes the per-dimension chunk sizes for the codecs after
|
|
33
|
-
* it, and any codec this layer cannot reason about — `reshape` may change
|
|
34
|
-
* a chunk's rank, and unknown codecs may do anything — invalidates the
|
|
35
|
-
* dimensional context for the rest of the pipeline instead of letting
|
|
36
|
-
* stale array-level facts produce false verdicts.
|
|
37
|
-
*
|
|
38
|
-
* Required-configuration rules cover ONLY the names this layer interprets
|
|
39
|
-
* (the two grids, transpose, sharding). Other extensions' required fields
|
|
40
|
-
* are registry-schema facts — the editor's registry layer enforces them
|
|
41
|
-
* from the vendored schemas, and duplicating that knowledge here as
|
|
42
|
-
* hardcoded rules would drift. Unrecognized names are skipped everywhere —
|
|
43
|
-
* the extension name space is open, and a rule that guessed would lie. This layer has no counterpart
|
|
12
|
+
* Unrecognized names are skipped everywhere — the extension name space is
|
|
13
|
+
* open, and a rule that guessed would lie. This layer has no counterpart
|
|
44
14
|
* in the Python reference implementation (which stops at structure), so it
|
|
45
15
|
* is covered by this package's own tests rather than the conformance
|
|
46
|
-
* corpus.
|
|
16
|
+
* corpus. The structural document layer (validation.ts) stays
|
|
17
|
+
* content-agnostic and corpus-governed; it never reads the content
|
|
18
|
+
* modules.
|
|
47
19
|
*/
|
|
48
20
|
import { type ErrorTree } from "./errors.js";
|
|
49
21
|
/**
|
package/dist/semantics.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"semantics.d.ts","sourceRoot":"","sources":["../src/semantics.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"semantics.d.ts","sourceRoot":"","sources":["../src/semantics.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAKH,OAAO,EAAU,KAAK,SAAS,EAAoB,MAAM,aAAa,CAAC;AA4BvE;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,SAAS,CAElE;AA0BD;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,SAAS,CAE7D"}
|
package/dist/semantics.js
CHANGED
|
@@ -1,422 +1,34 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Semantic (cross-field) validation for v3 array metadata
|
|
2
|
+
* Semantic (cross-field) validation for v3 array metadata: the
|
|
3
|
+
* orchestrator. The rules themselves live with their content —
|
|
4
|
+
* `chunk-grids.ts`, `codecs.ts`, and `data-types.ts` each hold the syntax
|
|
5
|
+
* (types) and semantics (procedures) for the names this package
|
|
6
|
+
* interprets, mirroring how the spec, the Python reference's type layout,
|
|
7
|
+
* and the zarr-extensions registry are organized. This module only walks
|
|
8
|
+
* documents: extract shape, ask each content module for its verdicts,
|
|
9
|
+
* thread the chunk-size context into codec pipelines, and descend into a
|
|
10
|
+
* group's inline consolidated entries.
|
|
3
11
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* extension points to enforce the cross-field rules the specs state in
|
|
7
|
-
* prose:
|
|
8
|
-
*
|
|
9
|
-
* - the `regular` chunk grid REQUIRES a configuration with `chunk_shape`,
|
|
10
|
-
* which has one length per dimension of `shape`;
|
|
11
|
-
* - the `rectilinear` chunk grid requires a configuration with `kind` and
|
|
12
|
-
* `chunk_shapes`; `chunk_shapes` has one entry per dimension, and each
|
|
13
|
-
* explicit chunk list (integers and `[size, count]` run-length pairs)
|
|
14
|
-
* sums exactly to that dimension's length (the bare-integer uniform
|
|
15
|
-
* shorthand carries no sum constraint, like the regular grid);
|
|
16
|
-
* - a `transpose` codec requires a configuration with `order`, a
|
|
17
|
-
* permutation of `0..n-1` with one entry per array dimension;
|
|
18
|
-
* - a `sharding_indexed` codec requires a configuration with
|
|
19
|
-
* `chunk_shape`, `codecs`, and `index_codecs`; its inner `chunk_shape`
|
|
20
|
-
* matches the array's
|
|
21
|
-
* dimensionality and evenly divides every chunk it shards — the grid's
|
|
22
|
-
* chunk at the top level (each distinct per-dimension size, for
|
|
23
|
-
* rectilinear grids), the parent shard's inner chunk when sharding
|
|
24
|
-
* nests;
|
|
25
|
-
* - `fill_value` has a JSON shape permitted for the named core data type
|
|
26
|
-
* (booleans for `bool`, ranged integers for the int types, numbers /
|
|
27
|
-
* the "NaN"-family sentinels / width-checked "0x…" strings for the
|
|
28
|
-
* float types, two-element arrays for the complex types).
|
|
29
|
-
*
|
|
30
|
-
* Dimensional context is THREADED through codec pipelines rather than
|
|
31
|
-
* assumed constant (mirroring zarr-python's chunk-spec threading): a valid
|
|
32
|
-
* `transpose` permutes the per-dimension chunk sizes for the codecs after
|
|
33
|
-
* it, and any codec this layer cannot reason about — `reshape` may change
|
|
34
|
-
* a chunk's rank, and unknown codecs may do anything — invalidates the
|
|
35
|
-
* dimensional context for the rest of the pipeline instead of letting
|
|
36
|
-
* stale array-level facts produce false verdicts.
|
|
37
|
-
*
|
|
38
|
-
* Required-configuration rules cover ONLY the names this layer interprets
|
|
39
|
-
* (the two grids, transpose, sharding). Other extensions' required fields
|
|
40
|
-
* are registry-schema facts — the editor's registry layer enforces them
|
|
41
|
-
* from the vendored schemas, and duplicating that knowledge here as
|
|
42
|
-
* hardcoded rules would drift. Unrecognized names are skipped everywhere —
|
|
43
|
-
* the extension name space is open, and a rule that guessed would lie. This layer has no counterpart
|
|
12
|
+
* Unrecognized names are skipped everywhere — the extension name space is
|
|
13
|
+
* open, and a rule that guessed would lie. This layer has no counterpart
|
|
44
14
|
* in the Python reference implementation (which stops at structure), so it
|
|
45
15
|
* is covered by this package's own tests rather than the conformance
|
|
46
|
-
* corpus.
|
|
16
|
+
* corpus. The structural document layer (validation.ts) stays
|
|
17
|
+
* content-agnostic and corpus-governed; it never reads the content
|
|
18
|
+
* modules.
|
|
47
19
|
*/
|
|
20
|
+
import { chunkGridVerdict } from "./chunk-grids.js";
|
|
21
|
+
import { pipelineIssues } from "./codecs.js";
|
|
22
|
+
import { fillValueIssue } from "./data-types.js";
|
|
48
23
|
import { treeOf } from "./errors.js";
|
|
49
|
-
|
|
50
|
-
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
51
|
-
return false;
|
|
52
|
-
const proto = Object.getPrototypeOf(value);
|
|
53
|
-
return proto === null || proto === Object.prototype;
|
|
54
|
-
}
|
|
55
|
-
function isIntArray(value) {
|
|
56
|
-
return (Array.isArray(value) &&
|
|
57
|
-
Object.keys(value).length === value.length &&
|
|
58
|
-
value.every((item) => Number.isInteger(item)));
|
|
59
|
-
}
|
|
60
|
-
/** The `{name, configuration}` of a metadata field, when extractable. */
|
|
61
|
-
function fieldParts(field) {
|
|
62
|
-
if (typeof field === "string")
|
|
63
|
-
return { name: field, configuration: undefined };
|
|
64
|
-
if (isPlainObject(field) && typeof field["name"] === "string") {
|
|
65
|
-
const configuration = field["configuration"];
|
|
66
|
-
return {
|
|
67
|
-
name: field["name"],
|
|
68
|
-
configuration: isPlainObject(configuration) ? configuration : undefined,
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
return undefined;
|
|
72
|
-
}
|
|
73
|
-
// --- fill_value vs data_type ----------------------------------------------
|
|
74
|
-
const INT_RANGES = {
|
|
75
|
-
int8: [-128, 127],
|
|
76
|
-
int16: [-32768, 32767],
|
|
77
|
-
int32: [-2147483648, 2147483647],
|
|
78
|
-
int64: [-9223372036854775808, 9223372036854775807],
|
|
79
|
-
uint8: [0, 255],
|
|
80
|
-
uint16: [0, 65535],
|
|
81
|
-
uint32: [0, 4294967295],
|
|
82
|
-
uint64: [0, 18446744073709551615],
|
|
83
|
-
};
|
|
84
|
-
const FLOAT_HEX_DIGITS = {
|
|
85
|
-
float16: 4,
|
|
86
|
-
float32: 8,
|
|
87
|
-
float64: 16,
|
|
88
|
-
};
|
|
89
|
-
/** Hex digit width of each complex type's component floats. */
|
|
90
|
-
const COMPLEX_COMPONENT_HEX_DIGITS = {
|
|
91
|
-
complex64: 8,
|
|
92
|
-
complex128: 16,
|
|
93
|
-
};
|
|
94
|
-
function isFloatFill(value, hexDigits) {
|
|
95
|
-
if (typeof value === "number")
|
|
96
|
-
return true;
|
|
97
|
-
if (typeof value !== "string")
|
|
98
|
-
return false;
|
|
99
|
-
if (value === "NaN" || value === "Infinity" || value === "-Infinity")
|
|
100
|
-
return true;
|
|
101
|
-
return new RegExp(`^0x[0-9a-fA-F]{${hexDigits}}$`).test(value);
|
|
102
|
-
}
|
|
103
|
-
function floatFillMessage(name, hexDigits) {
|
|
104
|
-
return (`expected a number, "NaN", "Infinity", "-Infinity", or a ` +
|
|
105
|
-
`${hexDigits}-hex-digit "0x..." string for data type ${JSON.stringify(name)}`);
|
|
106
|
-
}
|
|
107
|
-
/** The fill_value issue for a KNOWN core data type, if any; undefined otherwise. */
|
|
108
|
-
function fillValueIssue(dataTypeName, fill) {
|
|
109
|
-
if (dataTypeName === "bool") {
|
|
110
|
-
return typeof fill === "boolean"
|
|
111
|
-
? undefined
|
|
112
|
-
: 'expected a boolean fill value for data type "bool"';
|
|
113
|
-
}
|
|
114
|
-
const intRange = INT_RANGES[dataTypeName];
|
|
115
|
-
if (intRange !== undefined) {
|
|
116
|
-
const [low, high] = intRange;
|
|
117
|
-
return Number.isInteger(fill) && fill >= low && fill <= high
|
|
118
|
-
? undefined
|
|
119
|
-
: `expected an integer in [${low}, ${high}] for data type ${JSON.stringify(dataTypeName)}`;
|
|
120
|
-
}
|
|
121
|
-
const floatDigits = FLOAT_HEX_DIGITS[dataTypeName];
|
|
122
|
-
if (floatDigits !== undefined) {
|
|
123
|
-
return isFloatFill(fill, floatDigits)
|
|
124
|
-
? undefined
|
|
125
|
-
: floatFillMessage(dataTypeName, floatDigits);
|
|
126
|
-
}
|
|
127
|
-
const complexDigits = COMPLEX_COMPONENT_HEX_DIGITS[dataTypeName];
|
|
128
|
-
if (complexDigits !== undefined) {
|
|
129
|
-
const ok = Array.isArray(fill) &&
|
|
130
|
-
fill.length === 2 &&
|
|
131
|
-
fill.every((part) => isFloatFill(part, complexDigits));
|
|
132
|
-
return ok
|
|
133
|
-
? undefined
|
|
134
|
-
: `expected a two-element [real, imaginary] array for data type ${JSON.stringify(dataTypeName)}`;
|
|
135
|
-
}
|
|
136
|
-
return undefined; // unrecognized data type: no verdict
|
|
137
|
-
}
|
|
138
|
-
// --- codec pipelines (transpose / sharding) --------------------------------
|
|
139
|
-
function isPermutation(order) {
|
|
140
|
-
const seen = new Set(order);
|
|
141
|
-
return seen.size === order.length && order.every((entry) => entry >= 0 && entry < order.length);
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* Walk one codec pipeline. `dims` is the array dimensionality at this point
|
|
145
|
-
* (undefined when unknowable); `outerChunkSizes` holds the distinct chunk
|
|
146
|
-
* lengths per dimension this pipeline may encode — what a sharding codec's
|
|
147
|
-
* inner chunks must divide. A regular grid contributes one size per
|
|
148
|
-
* dimension; a rectilinear grid may contribute several.
|
|
149
|
-
*/
|
|
150
|
-
function pipelineIssues(pipeline, path, initialDims, initialChunkSizes) {
|
|
151
|
-
const issues = [];
|
|
152
|
-
// The dimensional context THREADS through the pipeline: transpose permutes
|
|
153
|
-
// it, and anything this layer cannot reason about invalidates it for the
|
|
154
|
-
// remaining codecs.
|
|
155
|
-
let dims = initialDims;
|
|
156
|
-
let chunkSizes = initialChunkSizes;
|
|
157
|
-
const dropContext = () => {
|
|
158
|
-
dims = undefined;
|
|
159
|
-
chunkSizes = undefined;
|
|
160
|
-
};
|
|
161
|
-
pipeline.forEach((entry, index) => {
|
|
162
|
-
const parts = fieldParts(entry);
|
|
163
|
-
if (parts === undefined) {
|
|
164
|
-
dropContext(); // structurally invalid entry: no further reasoning
|
|
165
|
-
return;
|
|
166
|
-
}
|
|
167
|
-
const { name, configuration } = parts;
|
|
168
|
-
// Whether the entry genuinely lacks a configuration member (a malformed
|
|
169
|
-
// one is the structural layer's complaint, not ours).
|
|
170
|
-
const configMissing = typeof entry === "string" ||
|
|
171
|
-
(isPlainObject(entry) && !Object.hasOwn(entry, "configuration"));
|
|
172
|
-
if (name === "transpose") {
|
|
173
|
-
if (configMissing) {
|
|
174
|
-
issues.push({
|
|
175
|
-
path: [...path, index],
|
|
176
|
-
message: '"transpose" requires a configuration with "order"',
|
|
177
|
-
kind: "missing_key",
|
|
178
|
-
});
|
|
179
|
-
dropContext();
|
|
180
|
-
return;
|
|
181
|
-
}
|
|
182
|
-
if (configuration !== undefined && !Object.hasOwn(configuration, "order")) {
|
|
183
|
-
issues.push({
|
|
184
|
-
path: [...path, index, "configuration", "order"],
|
|
185
|
-
message: "missing required key",
|
|
186
|
-
kind: "missing_key",
|
|
187
|
-
});
|
|
188
|
-
dropContext();
|
|
189
|
-
return;
|
|
190
|
-
}
|
|
191
|
-
const order = configuration?.["order"];
|
|
192
|
-
if (!isIntArray(order)) {
|
|
193
|
-
dropContext(); // shape errors are the schema layer's
|
|
194
|
-
return;
|
|
195
|
-
}
|
|
196
|
-
const orderPath = [...path, index, "configuration", "order"];
|
|
197
|
-
let sound = true;
|
|
198
|
-
if (!isPermutation(order)) {
|
|
199
|
-
sound = false;
|
|
200
|
-
issues.push({
|
|
201
|
-
path: orderPath,
|
|
202
|
-
message: `expected a permutation of the integers 0..${order.length - 1}`,
|
|
203
|
-
kind: "invalid_value",
|
|
204
|
-
});
|
|
205
|
-
}
|
|
206
|
-
if (dims !== undefined && order.length !== dims) {
|
|
207
|
-
sound = false;
|
|
208
|
-
issues.push({
|
|
209
|
-
path: orderPath,
|
|
210
|
-
message: `expected one entry per array dimension (${dims})`,
|
|
211
|
-
kind: "invalid_value",
|
|
212
|
-
});
|
|
213
|
-
}
|
|
214
|
-
if (!sound) {
|
|
215
|
-
dropContext();
|
|
216
|
-
}
|
|
217
|
-
else if (chunkSizes !== undefined) {
|
|
218
|
-
const sizes = chunkSizes;
|
|
219
|
-
chunkSizes =
|
|
220
|
-
order.length === sizes.length
|
|
221
|
-
? order.map((axis) => sizes[axis])
|
|
222
|
-
: undefined;
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
else if (name === "sharding_indexed") {
|
|
226
|
-
if (configMissing) {
|
|
227
|
-
issues.push({
|
|
228
|
-
path: [...path, index],
|
|
229
|
-
message: '"sharding_indexed" requires a configuration with "chunk_shape", "codecs", and "index_codecs"',
|
|
230
|
-
kind: "missing_key",
|
|
231
|
-
});
|
|
232
|
-
dropContext();
|
|
233
|
-
return;
|
|
234
|
-
}
|
|
235
|
-
if (configuration !== undefined) {
|
|
236
|
-
for (const key of ["chunk_shape", "codecs", "index_codecs"]) {
|
|
237
|
-
if (!Object.hasOwn(configuration, key)) {
|
|
238
|
-
issues.push({
|
|
239
|
-
path: [...path, index, "configuration", key],
|
|
240
|
-
message: "missing required key",
|
|
241
|
-
kind: "missing_key",
|
|
242
|
-
});
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
const chunkShape = configuration?.["chunk_shape"];
|
|
247
|
-
if (!isIntArray(chunkShape)) {
|
|
248
|
-
// Still walk a present inner pipeline (entries deserve their own
|
|
249
|
-
// verdicts) before the context becomes unknowable.
|
|
250
|
-
const inner = configuration?.["codecs"];
|
|
251
|
-
if (Array.isArray(inner)) {
|
|
252
|
-
issues.push(...pipelineIssues(inner, [...path, index, "configuration", "codecs"], undefined, undefined));
|
|
253
|
-
}
|
|
254
|
-
dropContext();
|
|
255
|
-
return;
|
|
256
|
-
}
|
|
257
|
-
const chunkShapePath = [...path, index, "configuration", "chunk_shape"];
|
|
258
|
-
if (dims !== undefined && chunkShape.length !== dims) {
|
|
259
|
-
issues.push({
|
|
260
|
-
path: chunkShapePath,
|
|
261
|
-
message: `expected one length per array dimension (${dims})`,
|
|
262
|
-
kind: "invalid_value",
|
|
263
|
-
});
|
|
264
|
-
}
|
|
265
|
-
else if (chunkSizes !== undefined &&
|
|
266
|
-
chunkShape.length === chunkSizes.length &&
|
|
267
|
-
chunkShape.every((length) => length > 0)) {
|
|
268
|
-
let violation;
|
|
269
|
-
chunkSizes.forEach((sizes, axis) => {
|
|
270
|
-
if (violation !== undefined)
|
|
271
|
-
return;
|
|
272
|
-
const bad = sizes.find((size) => size % chunkShape[axis] !== 0);
|
|
273
|
-
if (bad !== undefined)
|
|
274
|
-
violation = { axis, size: bad };
|
|
275
|
-
});
|
|
276
|
-
if (violation !== undefined) {
|
|
277
|
-
const { axis, size } = violation;
|
|
278
|
-
const sizesNow = chunkSizes;
|
|
279
|
-
const uniform = sizesNow.every((sizes) => sizes.length === 1);
|
|
280
|
-
issues.push({
|
|
281
|
-
path: chunkShapePath,
|
|
282
|
-
message: uniform
|
|
283
|
-
? `expected ${JSON.stringify(chunkShape)} to evenly divide the outer chunk shape ${JSON.stringify(sizesNow.map((sizes) => sizes[0]))}`
|
|
284
|
-
: `expected ${JSON.stringify(chunkShape)} to evenly divide every chunk size of the grid (dimension ${axis} has chunk size ${size})`,
|
|
285
|
-
kind: "invalid_value",
|
|
286
|
-
});
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
const inner = configuration?.["codecs"];
|
|
290
|
-
if (Array.isArray(inner)) {
|
|
291
|
-
issues.push(...pipelineIssues(inner, [...path, index, "configuration", "codecs"], chunkShape.length, chunkShape.map((length) => [length])));
|
|
292
|
-
}
|
|
293
|
-
// index_codecs encode the shard index, whose shape differs from the
|
|
294
|
-
// array's — no dimensional context applies there. After the
|
|
295
|
-
// array -> bytes boundary the dimensional context is spent.
|
|
296
|
-
dropContext();
|
|
297
|
-
}
|
|
298
|
-
else {
|
|
299
|
-
// A codec this layer cannot reason about (reshape may change a
|
|
300
|
-
// chunk's rank; unknown codecs may do anything): stale array-level
|
|
301
|
-
// facts must not judge the codecs after it.
|
|
302
|
-
dropContext();
|
|
303
|
-
}
|
|
304
|
-
});
|
|
305
|
-
return issues;
|
|
306
|
-
}
|
|
24
|
+
import { fieldParts, isIntArray, isPlainObject } from "./guards.js";
|
|
307
25
|
function arraySemanticsIssues(value) {
|
|
308
26
|
if (!isPlainObject(value) || value["node_type"] !== "array")
|
|
309
27
|
return [];
|
|
310
28
|
const issues = [];
|
|
311
29
|
const shape = isIntArray(value["shape"]) ? value["shape"] : undefined;
|
|
312
|
-
const
|
|
313
|
-
|
|
314
|
-
const grid = fieldParts(rawGrid);
|
|
315
|
-
// Whether the field genuinely lacks a configuration member (a malformed
|
|
316
|
-
// one — configuration: 5 — is the structural layer's complaint, not ours).
|
|
317
|
-
const configMissing = typeof rawGrid === "string" ||
|
|
318
|
-
(isPlainObject(rawGrid) && !Object.hasOwn(rawGrid, "configuration"));
|
|
319
|
-
let chunkSizes;
|
|
320
|
-
if (grid?.name === "regular") {
|
|
321
|
-
if (configMissing) {
|
|
322
|
-
issues.push({
|
|
323
|
-
path: ["chunk_grid"],
|
|
324
|
-
message: '"regular" requires a configuration with "chunk_shape"',
|
|
325
|
-
kind: "missing_key",
|
|
326
|
-
});
|
|
327
|
-
}
|
|
328
|
-
else if (grid.configuration !== undefined && !Object.hasOwn(grid.configuration, "chunk_shape")) {
|
|
329
|
-
issues.push({
|
|
330
|
-
path: ["chunk_grid", "configuration", "chunk_shape"],
|
|
331
|
-
message: "missing required key",
|
|
332
|
-
kind: "missing_key",
|
|
333
|
-
});
|
|
334
|
-
}
|
|
335
|
-
const configured = grid.configuration?.["chunk_shape"];
|
|
336
|
-
if (isIntArray(configured)) {
|
|
337
|
-
if (dims !== undefined && configured.length !== dims) {
|
|
338
|
-
issues.push({
|
|
339
|
-
path: ["chunk_grid", "configuration", "chunk_shape"],
|
|
340
|
-
message: `expected one length per dimension of shape (${dims})`,
|
|
341
|
-
kind: "invalid_value",
|
|
342
|
-
});
|
|
343
|
-
// wrong arity: unusable as division context
|
|
344
|
-
}
|
|
345
|
-
else {
|
|
346
|
-
chunkSizes = configured.map((length) => [length]);
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
else if (grid?.name === "rectilinear") {
|
|
351
|
-
if (configMissing) {
|
|
352
|
-
issues.push({
|
|
353
|
-
path: ["chunk_grid"],
|
|
354
|
-
message: '"rectilinear" requires a configuration with "kind" and "chunk_shapes"',
|
|
355
|
-
kind: "missing_key",
|
|
356
|
-
});
|
|
357
|
-
}
|
|
358
|
-
else if (grid.configuration !== undefined) {
|
|
359
|
-
for (const key of ["kind", "chunk_shapes"]) {
|
|
360
|
-
if (!Object.hasOwn(grid.configuration, key)) {
|
|
361
|
-
issues.push({
|
|
362
|
-
path: ["chunk_grid", "configuration", key],
|
|
363
|
-
message: "missing required key",
|
|
364
|
-
kind: "missing_key",
|
|
365
|
-
});
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
const specs = grid.configuration?.["chunk_shapes"];
|
|
370
|
-
if (Array.isArray(specs)) {
|
|
371
|
-
if (dims !== undefined && specs.length !== dims) {
|
|
372
|
-
issues.push({
|
|
373
|
-
path: ["chunk_grid", "configuration", "chunk_shapes"],
|
|
374
|
-
message: `expected one entry per dimension of shape (${dims})`,
|
|
375
|
-
kind: "invalid_value",
|
|
376
|
-
});
|
|
377
|
-
}
|
|
378
|
-
else {
|
|
379
|
-
const perDim = specs.map((spec, dim) => {
|
|
380
|
-
// Bare integer: uniform shorthand, no sum constraint (edge chunks
|
|
381
|
-
// are permitted, as with the regular grid).
|
|
382
|
-
if (Number.isInteger(spec))
|
|
383
|
-
return spec > 0 ? [spec] : undefined;
|
|
384
|
-
if (!Array.isArray(spec))
|
|
385
|
-
return undefined; // registry schema's problem
|
|
386
|
-
const sizes = new Set();
|
|
387
|
-
let total = 0;
|
|
388
|
-
for (const entry of spec) {
|
|
389
|
-
if (Number.isInteger(entry)) {
|
|
390
|
-
sizes.add(entry);
|
|
391
|
-
total += entry;
|
|
392
|
-
}
|
|
393
|
-
else if (Array.isArray(entry) &&
|
|
394
|
-
entry.length === 2 &&
|
|
395
|
-
Number.isInteger(entry[0]) &&
|
|
396
|
-
Number.isInteger(entry[1])) {
|
|
397
|
-
sizes.add(entry[0]);
|
|
398
|
-
total += entry[0] * entry[1];
|
|
399
|
-
}
|
|
400
|
-
else {
|
|
401
|
-
return undefined; // malformed entry: registry schema's problem
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
const extent = shape?.[dim];
|
|
405
|
-
if (extent !== undefined && total !== extent) {
|
|
406
|
-
issues.push({
|
|
407
|
-
path: ["chunk_grid", "configuration", "chunk_shapes", dim],
|
|
408
|
-
message: `expected chunk sizes summing to ${extent} along dimension ${dim}, got ${total}`,
|
|
409
|
-
kind: "invalid_value",
|
|
410
|
-
});
|
|
411
|
-
}
|
|
412
|
-
return [...sizes];
|
|
413
|
-
});
|
|
414
|
-
if (perDim.every((sizes) => sizes !== undefined)) {
|
|
415
|
-
chunkSizes = perDim;
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
}
|
|
30
|
+
const grid = chunkGridVerdict(value["chunk_grid"], shape);
|
|
31
|
+
issues.push(...grid.issues.map((issue) => ({ ...issue, path: ["chunk_grid", ...issue.path] })));
|
|
420
32
|
const dataType = fieldParts(value["data_type"]);
|
|
421
33
|
if (dataType !== undefined && "fill_value" in value) {
|
|
422
34
|
const message = fillValueIssue(dataType.name, value["fill_value"]);
|
|
@@ -426,7 +38,7 @@ function arraySemanticsIssues(value) {
|
|
|
426
38
|
}
|
|
427
39
|
const codecs = value["codecs"];
|
|
428
40
|
if (Array.isArray(codecs)) {
|
|
429
|
-
issues.push(...pipelineIssues(codecs, ["codecs"],
|
|
41
|
+
issues.push(...pipelineIssues(codecs, ["codecs"], shape?.length, grid.chunkSizes));
|
|
430
42
|
}
|
|
431
43
|
return issues;
|
|
432
44
|
}
|
package/dist/semantics.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"semantics.js","sourceRoot":"","sources":["../src/semantics.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AAEH,OAAO,EAAE,MAAM,EAAoC,MAAM,aAAa,CAAC;AAIvE,SAAS,aAAa,CAAC,KAAc;IACnC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IACtF,MAAM,KAAK,GAAY,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IACpD,OAAO,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,MAAM,CAA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