@mark1russell7/room-view 0.2.4 → 0.3.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/README.md +64 -34
- package/build/{anchors-Ba3OUmhF.js → check-lFfxIUS3.js} +11 -260
- package/build/check-lFfxIUS3.js.map +1 -0
- package/build/index.d.ts +5 -5
- package/build/index.js +6 -5
- package/build/index.js.map +1 -1
- package/build/{layers-BO_MMtQJ.d.ts → layers-BiiyFJwZ.d.ts} +35 -9
- package/build/layers-BiiyFJwZ.d.ts.map +1 -0
- package/build/{layers-B5nL_lVW.js → layers-DmTro5Ny.js} +158 -26
- package/build/layers-DmTro5Ny.js.map +1 -0
- package/build/{level-CXCIX08K.js → level-CvbiwvhH.js} +12 -37
- package/build/level-CvbiwvhH.js.map +1 -0
- package/build/{level-Cjcf3u20.d.ts → level-DmEftWYn.d.ts} +11 -19
- package/build/level-DmEftWYn.d.ts.map +1 -0
- package/build/marks.d.ts +2 -2
- package/build/marks.js +1 -2
- package/build/marks.js.map +1 -1
- package/build/plan-import.d.ts +325 -0
- package/build/plan-import.d.ts.map +1 -0
- package/build/plan-import.js +855 -0
- package/build/plan-import.js.map +1 -0
- package/build/room-BQua5eSs.d.ts +124 -0
- package/build/room-BQua5eSs.d.ts.map +1 -0
- package/build/room-CiVZ_07s.js +29 -0
- package/build/room-CiVZ_07s.js.map +1 -0
- package/build/sample.d.ts +4 -4
- package/build/sample.d.ts.map +1 -1
- package/build/sample.js +21 -217
- package/build/sample.js.map +1 -1
- package/build/schema.d.ts +59 -9
- package/build/schema.d.ts.map +1 -1
- package/build/schema.js +251 -91
- package/build/schema.js.map +1 -1
- package/build/solids-CdJf0U39.d.ts +148 -0
- package/build/solids-CdJf0U39.d.ts.map +1 -0
- package/build/three.d.ts +9 -16
- package/build/three.d.ts.map +1 -1
- package/build/three.js +13 -106
- package/build/three.js.map +1 -1
- package/build/units-BZmvVyu4.js +30 -0
- package/build/units-BZmvVyu4.js.map +1 -0
- package/package.json +7 -1
- package/build/anchors-Ba3OUmhF.js.map +0 -1
- package/build/layers-B5nL_lVW.js.map +0 -1
- package/build/layers-BO_MMtQJ.d.ts.map +0 -1
- package/build/level-CXCIX08K.js.map +0 -1
- package/build/level-Cjcf3u20.d.ts.map +0 -1
- package/build/loads-CtHa4EHo.js +0 -103
- package/build/loads-CtHa4EHo.js.map +0 -1
- package/build/loads-Diy6-Ekz.d.ts +0 -73
- package/build/loads-Diy6-Ekz.d.ts.map +0 -1
- package/build/solids-S_j17vFJ.d.ts +0 -313
- package/build/solids-S_j17vFJ.d.ts.map +0 -1
package/build/schema.js
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { t as FILE_KINDS } from "./layers-DmTro5Ny.js";
|
|
2
|
+
import { c as SQUARE_TURNS, i as LEVEL_SCHEMA, u as SURVEY_SCHEMA } from "./level-CvbiwvhH.js";
|
|
3
|
+
import { a as WALL_SIDES, i as WALL_FACES, n as ROOM_SCHEMA, o as isLayerName, r as SCENE_SCHEMA, t as OPENING_KINDS } from "./room-CiVZ_07s.js";
|
|
4
|
+
import { n as LENGTH_UNITS } from "./units-BZmvVyu4.js";
|
|
5
|
+
import * as z from "zod/mini";
|
|
6
|
+
import en from "zod/v4/locales/en.js";
|
|
5
7
|
// src/schema.ts
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
const
|
|
8
|
+
/** The parse context of each read of this entry and of each add-on: the faults have the English messages of zod. */
|
|
9
|
+
const READ_CONTEXT = { error: en().localeError };
|
|
10
|
+
const id = z.string().check(z.minLength(1));
|
|
11
|
+
const planPoint = z.readonly(z.tuple([z.number(), z.number()]));
|
|
12
|
+
const point3 = z.readonly(z.tuple([
|
|
9
13
|
z.number(),
|
|
10
14
|
z.number(),
|
|
11
15
|
z.number()
|
|
12
|
-
])
|
|
16
|
+
]));
|
|
13
17
|
/**
|
|
14
18
|
* The schema of an anchor. It examines the form of the record, and it refuses a field that the surface of the anchor does not have.
|
|
15
19
|
* The schema of an add-on uses it for the anchor of each record. `checkAnchor` examines the meaning of an anchor with a correct form.
|
|
@@ -25,27 +29,27 @@ const anchorSchema = z.discriminatedUnion("on", [
|
|
|
25
29
|
z.strictObject({
|
|
26
30
|
on: z.literal("floor"),
|
|
27
31
|
at: planPoint,
|
|
28
|
-
floor:
|
|
32
|
+
floor: z.optional(id)
|
|
29
33
|
}),
|
|
30
34
|
z.strictObject({
|
|
31
35
|
on: z.literal("ceiling"),
|
|
32
36
|
at: planPoint,
|
|
33
|
-
floor:
|
|
37
|
+
floor: z.optional(id)
|
|
34
38
|
}),
|
|
35
39
|
z.strictObject({
|
|
36
40
|
on: z.literal("object"),
|
|
37
41
|
object: id,
|
|
38
|
-
at:
|
|
39
|
-
out:
|
|
42
|
+
at: z.optional(point3),
|
|
43
|
+
out: z.optional(point3)
|
|
40
44
|
})
|
|
41
45
|
]);
|
|
42
46
|
const wall = z.strictObject({
|
|
43
47
|
id,
|
|
44
48
|
from: planPoint,
|
|
45
49
|
to: planPoint,
|
|
46
|
-
thickness: z.
|
|
47
|
-
height: z.
|
|
48
|
-
side: z.enum(WALL_SIDES)
|
|
50
|
+
thickness: z.optional(z.number()),
|
|
51
|
+
height: z.optional(z.number()),
|
|
52
|
+
side: z.optional(z.enum(WALL_SIDES))
|
|
49
53
|
});
|
|
50
54
|
const opening = z.strictObject({
|
|
51
55
|
id,
|
|
@@ -53,28 +57,13 @@ const opening = z.strictObject({
|
|
|
53
57
|
kind: z.enum(OPENING_KINDS),
|
|
54
58
|
offset: z.number(),
|
|
55
59
|
width: z.number(),
|
|
56
|
-
sill: z.
|
|
60
|
+
sill: z.optional(z.number()),
|
|
57
61
|
height: z.number()
|
|
58
62
|
});
|
|
59
63
|
const floor = z.strictObject({
|
|
60
64
|
id,
|
|
61
|
-
name: z.
|
|
62
|
-
ring: z.array(planPoint)
|
|
63
|
-
});
|
|
64
|
-
const outlet = z.strictObject({
|
|
65
|
-
id,
|
|
66
|
-
wall: id,
|
|
67
|
-
face: z.enum(WALL_FACES),
|
|
68
|
-
offset: z.number(),
|
|
69
|
-
height: z.number(),
|
|
70
|
-
circuit: id.optional()
|
|
71
|
-
});
|
|
72
|
-
const circuit = z.strictObject({
|
|
73
|
-
id,
|
|
74
|
-
name: z.string().optional(),
|
|
75
|
-
breaker: z.number().optional(),
|
|
76
|
-
voltage: z.number().optional(),
|
|
77
|
-
limit: z.number()
|
|
65
|
+
name: z.optional(z.string()),
|
|
66
|
+
ring: z.readonly(z.array(planPoint))
|
|
78
67
|
});
|
|
79
68
|
/**
|
|
80
69
|
* The schema of a room record. It examines the form of the record: the fields, their types and the finite numbers.
|
|
@@ -82,54 +71,43 @@ const circuit = z.strictObject({
|
|
|
82
71
|
*/
|
|
83
72
|
const roomSchema = z.strictObject({
|
|
84
73
|
schema: z.literal(ROOM_SCHEMA),
|
|
85
|
-
name: z.
|
|
74
|
+
name: z.optional(z.string()),
|
|
86
75
|
unit: z.enum(LENGTH_UNITS),
|
|
87
76
|
height: z.number(),
|
|
88
77
|
wallThickness: z.number(),
|
|
89
|
-
walls: z.array(wall)
|
|
90
|
-
openings: z.
|
|
91
|
-
floors: z.
|
|
92
|
-
outlets: z.array(outlet).readonly().optional(),
|
|
93
|
-
circuits: z.array(circuit).readonly().optional()
|
|
78
|
+
walls: z.readonly(z.array(wall)),
|
|
79
|
+
openings: z.optional(z.readonly(z.array(opening))),
|
|
80
|
+
floors: z.optional(z.readonly(z.array(floor)))
|
|
94
81
|
});
|
|
95
82
|
const placedObject = z.strictObject({
|
|
96
83
|
id,
|
|
97
|
-
kind:
|
|
98
|
-
name: z.
|
|
99
|
-
size:
|
|
100
|
-
z.number(),
|
|
101
|
-
z.number(),
|
|
102
|
-
z.number()
|
|
103
|
-
]).readonly(),
|
|
84
|
+
kind: id,
|
|
85
|
+
name: z.optional(z.string()),
|
|
86
|
+
size: point3,
|
|
104
87
|
at: planPoint,
|
|
105
|
-
lift: z.
|
|
106
|
-
turn: z.
|
|
107
|
-
parent:
|
|
108
|
-
outlet: id.optional()
|
|
109
|
-
});
|
|
110
|
-
const circuitLoad = z.strictObject({
|
|
111
|
-
circuit: id,
|
|
112
|
-
watts: z.number()
|
|
88
|
+
lift: z.optional(z.number()),
|
|
89
|
+
turn: z.optional(z.number()),
|
|
90
|
+
parent: z.optional(id)
|
|
113
91
|
});
|
|
114
|
-
const
|
|
92
|
+
const layerName = z.string().check(z.refine(isLayerName, "A layer name is a word, a slash and a version, for example electrical/1."));
|
|
93
|
+
const layers = z.optional(z.readonly(z.record(layerName, z.unknown())));
|
|
115
94
|
/**
|
|
116
95
|
* The schema of a scene record. It examines the form of the record, and it refuses a field that the format does not have.
|
|
117
96
|
* `checkScene` examines the meaning of a record with a correct form.
|
|
118
97
|
*/
|
|
119
98
|
const sceneSchema = z.strictObject({
|
|
120
99
|
schema: z.literal(SCENE_SCHEMA),
|
|
121
|
-
name: z.
|
|
100
|
+
name: z.optional(z.string()),
|
|
122
101
|
room: roomSchema,
|
|
123
|
-
objects: z.
|
|
124
|
-
loads: z.array(circuitLoad).readonly().optional(),
|
|
102
|
+
objects: z.optional(z.readonly(z.array(placedObject))),
|
|
125
103
|
layers
|
|
126
104
|
});
|
|
127
105
|
const surveySide = z.strictObject({
|
|
128
106
|
id,
|
|
129
107
|
length: z.number(),
|
|
130
108
|
turn: z.union([z.enum(SQUARE_TURNS), z.number()]),
|
|
131
|
-
thickness: z.
|
|
132
|
-
height: z.
|
|
109
|
+
thickness: z.optional(z.number()),
|
|
110
|
+
height: z.optional(z.number())
|
|
133
111
|
});
|
|
134
112
|
const surveyCheck = z.strictObject({
|
|
135
113
|
id,
|
|
@@ -137,26 +115,18 @@ const surveyCheck = z.strictObject({
|
|
|
137
115
|
to: id,
|
|
138
116
|
length: z.number()
|
|
139
117
|
});
|
|
140
|
-
const surveyOutlet = z.strictObject({
|
|
141
|
-
id,
|
|
142
|
-
wall: id,
|
|
143
|
-
offset: z.number(),
|
|
144
|
-
height: z.number(),
|
|
145
|
-
circuit: id.optional()
|
|
146
|
-
});
|
|
147
118
|
const surveyObject = z.strictObject({
|
|
148
119
|
id,
|
|
149
|
-
kind:
|
|
150
|
-
name: z.
|
|
151
|
-
wall:
|
|
152
|
-
on:
|
|
120
|
+
kind: id,
|
|
121
|
+
name: z.optional(z.string()),
|
|
122
|
+
wall: z.optional(id),
|
|
123
|
+
on: z.optional(id),
|
|
153
124
|
offset: z.number(),
|
|
154
125
|
width: z.number(),
|
|
155
126
|
depth: z.number(),
|
|
156
127
|
height: z.number(),
|
|
157
|
-
gap: z.
|
|
158
|
-
lift: z.
|
|
159
|
-
outlet: id.optional()
|
|
128
|
+
gap: z.optional(z.number()),
|
|
129
|
+
lift: z.optional(z.number())
|
|
160
130
|
});
|
|
161
131
|
/**
|
|
162
132
|
* The schema of a survey record. It examines the form of the record, and it refuses a field that the format does not have.
|
|
@@ -164,18 +134,16 @@ const surveyObject = z.strictObject({
|
|
|
164
134
|
*/
|
|
165
135
|
const surveySchema = z.strictObject({
|
|
166
136
|
schema: z.literal(SURVEY_SCHEMA),
|
|
167
|
-
name: z.
|
|
137
|
+
name: z.optional(z.string()),
|
|
168
138
|
unit: z.enum(LENGTH_UNITS),
|
|
169
139
|
height: z.number(),
|
|
170
140
|
wallThickness: z.number(),
|
|
171
|
-
sides: z.array(surveySide)
|
|
172
|
-
start:
|
|
173
|
-
heading: z.
|
|
174
|
-
checks: z.
|
|
175
|
-
openings: z.
|
|
176
|
-
|
|
177
|
-
circuits: z.array(circuit).readonly().optional(),
|
|
178
|
-
objects: z.array(surveyObject).readonly().optional(),
|
|
141
|
+
sides: z.readonly(z.array(surveySide)),
|
|
142
|
+
start: z.optional(planPoint),
|
|
143
|
+
heading: z.optional(z.number()),
|
|
144
|
+
checks: z.optional(z.readonly(z.array(surveyCheck))),
|
|
145
|
+
openings: z.optional(z.readonly(z.array(opening))),
|
|
146
|
+
objects: z.optional(z.readonly(z.array(surveyObject))),
|
|
179
147
|
layers
|
|
180
148
|
});
|
|
181
149
|
const connectionEnd = z.strictObject({
|
|
@@ -188,21 +156,213 @@ const connectionEnd = z.strictObject({
|
|
|
188
156
|
*/
|
|
189
157
|
const levelSchema = z.strictObject({
|
|
190
158
|
schema: z.literal(LEVEL_SCHEMA),
|
|
191
|
-
name: z.
|
|
159
|
+
name: z.optional(z.string()),
|
|
192
160
|
unit: z.enum(LENGTH_UNITS),
|
|
193
|
-
rooms: z.array(z.strictObject({
|
|
161
|
+
rooms: z.readonly(z.array(z.strictObject({
|
|
194
162
|
id,
|
|
195
163
|
survey: surveySchema
|
|
196
|
-
}))
|
|
197
|
-
connections: z.array(z.strictObject({
|
|
164
|
+
}))),
|
|
165
|
+
connections: z.optional(z.readonly(z.array(z.strictObject({
|
|
198
166
|
id,
|
|
199
167
|
from: connectionEnd,
|
|
200
168
|
to: connectionEnd,
|
|
201
|
-
thickness: z.
|
|
202
|
-
}))
|
|
203
|
-
circuits: z.array(circuit).readonly().optional(),
|
|
169
|
+
thickness: z.optional(z.number())
|
|
170
|
+
})))),
|
|
204
171
|
layers
|
|
205
172
|
});
|
|
206
|
-
|
|
173
|
+
/** These are the codes of the findings of `readRecord`. */
|
|
174
|
+
const READ_CODES = ["read-both"];
|
|
175
|
+
const KIND_NAMES = {
|
|
176
|
+
room: ROOM_SCHEMA,
|
|
177
|
+
scene: SCENE_SCHEMA,
|
|
178
|
+
survey: SURVEY_SCHEMA,
|
|
179
|
+
level: LEVEL_SCHEMA
|
|
180
|
+
};
|
|
181
|
+
/** This function tells if a value is a JSON object. */
|
|
182
|
+
function isJson(value) {
|
|
183
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
184
|
+
}
|
|
185
|
+
/** This function gives the schema name of version 2 for a nested record of version 1. A different name stays, so the read tells its fault. */
|
|
186
|
+
function newName(record, kind) {
|
|
187
|
+
return record["schema"] === `${kind}/1` ? KIND_NAMES[kind] : record["schema"];
|
|
188
|
+
}
|
|
189
|
+
/** This function gives the faults of a zod read. Each fault names its place in the record, for example `rooms.0.survey.sides`. */
|
|
190
|
+
function faultsOf(error) {
|
|
191
|
+
return error.issues.map((issue) => `${issue.path.length === 0 ? "The record" : `"${issue.path.map(String).join(".")}"`}: ${issue.message}`);
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* This function reads the JSON of a record of the core in version 1 or in version 2. The record is a room, a scene, a survey or a level.
|
|
195
|
+
* The result is the record in version 2. The schemas of this entry examine its form.
|
|
196
|
+
*
|
|
197
|
+
* A record of version 1 kept the records of some topics in fields of its own. For each add-on of the list with the read `v1`:
|
|
198
|
+
*
|
|
199
|
+
* - The read removes the fields of the add-on from the record, from each object and from each nested record.
|
|
200
|
+
* - The function `read` of the add-on gives the layer of these fields. For a scene, this layer has the records of its room too.
|
|
201
|
+
* For a level, the level record and the survey of each room get a layer.
|
|
202
|
+
* - A record that has the layer and the old fields keeps the layer. The finding `read-both` tells it.
|
|
203
|
+
*
|
|
204
|
+
* A field of version 1 that no add-on of the list removes is a fault of the form. A room record has no layers.
|
|
205
|
+
* Thus a `room/1` with old records gives a `scene/2` with the room and the layers, and a `room/1` with none gives a `room/2`.
|
|
206
|
+
*/
|
|
207
|
+
function readRecord(value, addOns = []) {
|
|
208
|
+
if (!isJson(value)) return {
|
|
209
|
+
ok: false,
|
|
210
|
+
errors: ["The record is not a JSON object."]
|
|
211
|
+
};
|
|
212
|
+
const name = value["schema"];
|
|
213
|
+
const kind = FILE_KINDS.find((each) => KIND_NAMES[each] === name);
|
|
214
|
+
if (kind !== void 0) return parsed(kind, value, 2, []);
|
|
215
|
+
const old = FILE_KINDS.find((each) => `${each}/1` === name);
|
|
216
|
+
if (old === void 0) return {
|
|
217
|
+
ok: false,
|
|
218
|
+
errors: [`The record has no known format: "schema" is ${JSON.stringify(name) ?? "missing"}.`]
|
|
219
|
+
};
|
|
220
|
+
const readers = addOns.filter((addOn) => addOn.v1 !== void 0);
|
|
221
|
+
const findings = [];
|
|
222
|
+
const errors = [];
|
|
223
|
+
const without = (record, of) => {
|
|
224
|
+
const gone = new Set(readers.flatMap((addOn) => addOn.v1?.fields[of] ?? []));
|
|
225
|
+
return Object.fromEntries(Object.entries(record).filter(([key]) => !gone.has(key)));
|
|
226
|
+
};
|
|
227
|
+
const objectsOf = (record) => {
|
|
228
|
+
const objects = record["objects"];
|
|
229
|
+
if (Array.isArray(objects)) record["objects"] = objects.map((object) => isJson(object) ? without(object, "object") : object);
|
|
230
|
+
};
|
|
231
|
+
const withLayers = (record, raw, of, room) => {
|
|
232
|
+
const given = isJson(raw["layers"]) ? raw["layers"] : {};
|
|
233
|
+
const layers = { ...given };
|
|
234
|
+
for (const addOn of readers) {
|
|
235
|
+
const read = addOn.v1?.read(raw, of);
|
|
236
|
+
if (read === void 0) continue;
|
|
237
|
+
if (!read.ok) {
|
|
238
|
+
errors.push(...read.errors);
|
|
239
|
+
continue;
|
|
240
|
+
}
|
|
241
|
+
if (Object.hasOwn(given, addOn.schema)) {
|
|
242
|
+
findings.push({
|
|
243
|
+
level: "warning",
|
|
244
|
+
code: "read-both",
|
|
245
|
+
layer: addOn.schema,
|
|
246
|
+
...room === void 0 ? {} : { room },
|
|
247
|
+
message: `The record has the layer "${addOn.schema}" and its old fields. The layer stays, and the old fields go.`
|
|
248
|
+
});
|
|
249
|
+
continue;
|
|
250
|
+
}
|
|
251
|
+
layers[addOn.schema] = read.layer;
|
|
252
|
+
}
|
|
253
|
+
if (Object.keys(layers).length > 0) record["layers"] = layers;
|
|
254
|
+
};
|
|
255
|
+
const surveyOf = (raw, room) => {
|
|
256
|
+
const record = {
|
|
257
|
+
...without(raw, "survey"),
|
|
258
|
+
schema: newName(raw, "survey")
|
|
259
|
+
};
|
|
260
|
+
objectsOf(record);
|
|
261
|
+
withLayers(record, raw, "survey", room);
|
|
262
|
+
return record;
|
|
263
|
+
};
|
|
264
|
+
const roomOf = (raw) => isJson(raw) ? {
|
|
265
|
+
...without(raw, "room"),
|
|
266
|
+
schema: newName(raw, "room")
|
|
267
|
+
} : raw;
|
|
268
|
+
let next;
|
|
269
|
+
let made = old;
|
|
270
|
+
if (old === "survey") next = surveyOf(value);
|
|
271
|
+
else if (old === "level") {
|
|
272
|
+
const level = {
|
|
273
|
+
...without(value, "level"),
|
|
274
|
+
schema: LEVEL_SCHEMA
|
|
275
|
+
};
|
|
276
|
+
const rooms = value["rooms"];
|
|
277
|
+
if (Array.isArray(rooms)) level["rooms"] = rooms.map((room) => {
|
|
278
|
+
if (!isJson(room) || !isJson(room["survey"])) return room;
|
|
279
|
+
return {
|
|
280
|
+
...room,
|
|
281
|
+
survey: surveyOf(room["survey"], typeof room["id"] === "string" ? room["id"] : void 0)
|
|
282
|
+
};
|
|
283
|
+
});
|
|
284
|
+
withLayers(level, value, "level");
|
|
285
|
+
next = level;
|
|
286
|
+
} else if (old === "scene") {
|
|
287
|
+
const scene = {
|
|
288
|
+
...without(value, "scene"),
|
|
289
|
+
schema: SCENE_SCHEMA,
|
|
290
|
+
room: roomOf(value["room"])
|
|
291
|
+
};
|
|
292
|
+
objectsOf(scene);
|
|
293
|
+
withLayers(scene, value, "scene");
|
|
294
|
+
next = scene;
|
|
295
|
+
} else {
|
|
296
|
+
const scene = {
|
|
297
|
+
schema: SCENE_SCHEMA,
|
|
298
|
+
room: roomOf(value)
|
|
299
|
+
};
|
|
300
|
+
withLayers(scene, value, "room");
|
|
301
|
+
if (scene["layers"] === void 0) next = scene["room"];
|
|
302
|
+
else {
|
|
303
|
+
next = scene;
|
|
304
|
+
made = "scene";
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
if (errors.length > 0) return {
|
|
308
|
+
ok: false,
|
|
309
|
+
errors
|
|
310
|
+
};
|
|
311
|
+
return parsed(made, next, 1, findings);
|
|
312
|
+
}
|
|
313
|
+
/** This function reads a record of version 2 with the schema of its kind. */
|
|
314
|
+
function parsed(kind, value, version, findings) {
|
|
315
|
+
if (kind === "room") {
|
|
316
|
+
const read = roomSchema.safeParse(value, READ_CONTEXT);
|
|
317
|
+
return read.success ? {
|
|
318
|
+
ok: true,
|
|
319
|
+
kind,
|
|
320
|
+
record: read.data,
|
|
321
|
+
version,
|
|
322
|
+
findings
|
|
323
|
+
} : {
|
|
324
|
+
ok: false,
|
|
325
|
+
errors: faultsOf(read.error)
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
if (kind === "scene") {
|
|
329
|
+
const read = sceneSchema.safeParse(value, READ_CONTEXT);
|
|
330
|
+
return read.success ? {
|
|
331
|
+
ok: true,
|
|
332
|
+
kind,
|
|
333
|
+
record: read.data,
|
|
334
|
+
version,
|
|
335
|
+
findings
|
|
336
|
+
} : {
|
|
337
|
+
ok: false,
|
|
338
|
+
errors: faultsOf(read.error)
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
if (kind === "survey") {
|
|
342
|
+
const read = surveySchema.safeParse(value, READ_CONTEXT);
|
|
343
|
+
return read.success ? {
|
|
344
|
+
ok: true,
|
|
345
|
+
kind,
|
|
346
|
+
record: read.data,
|
|
347
|
+
version,
|
|
348
|
+
findings
|
|
349
|
+
} : {
|
|
350
|
+
ok: false,
|
|
351
|
+
errors: faultsOf(read.error)
|
|
352
|
+
};
|
|
353
|
+
}
|
|
354
|
+
const read = levelSchema.safeParse(value, READ_CONTEXT);
|
|
355
|
+
return read.success ? {
|
|
356
|
+
ok: true,
|
|
357
|
+
kind,
|
|
358
|
+
record: read.data,
|
|
359
|
+
version,
|
|
360
|
+
findings
|
|
361
|
+
} : {
|
|
362
|
+
ok: false,
|
|
363
|
+
errors: faultsOf(read.error)
|
|
364
|
+
};
|
|
365
|
+
}
|
|
366
|
+
export { READ_CODES, READ_CONTEXT, anchorSchema, levelSchema, readRecord, roomSchema, sceneSchema, surveySchema };
|
|
207
367
|
|
|
208
368
|
//# sourceMappingURL=schema.js.map
|
package/build/schema.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","names":[],"sources":["../src/schema.ts"],"sourcesContent":["import { z } from \"zod\";\nimport type { Anchor } from \"./anchors.ts\";\nimport { LEVEL_SCHEMA, type Level } from \"./level.ts\";\nimport { isLayerName, OPENING_KINDS, ROOM_SCHEMA, SCENE_SCHEMA, WALL_FACES, WALL_SIDES, type Room, type Scene } from \"./room.ts\";\nimport { SQUARE_TURNS, SURVEY_SCHEMA, type Survey } from \"./survey.ts\";\nimport { LENGTH_UNITS } from \"./units.ts\";\n\nconst id = z.string().min(1);\nconst planPoint = z.tuple([z.number(), z.number()]).readonly();\n\nconst point3 = z.tuple([z.number(), z.number(), z.number()]).readonly();\n\n/**\n * The schema of an anchor. It examines the form of the record, and it refuses a field that the surface of the anchor does not have.\n * The schema of an add-on uses it for the anchor of each record. `checkAnchor` examines the meaning of an anchor with a correct form.\n */\nexport const anchorSchema: z.ZodType<Anchor> = z.discriminatedUnion(\"on\", [\n z.strictObject({ on: z.literal(\"wall\"), wall: id, face: z.enum(WALL_FACES), offset: z.number(), height: z.number() }),\n z.strictObject({ on: z.literal(\"floor\"), at: planPoint, floor: id.optional() }),\n z.strictObject({ on: z.literal(\"ceiling\"), at: planPoint, floor: id.optional() }),\n z.strictObject({ on: z.literal(\"object\"), object: id, at: point3.optional(), out: point3.optional() }),\n]);\n\nconst wall = z.strictObject({\n id,\n from: planPoint,\n to: planPoint,\n thickness: z.number().optional(),\n height: z.number().optional(),\n side: z.enum(WALL_SIDES).optional(),\n});\n\nconst opening = z.strictObject({\n id,\n wall: id,\n kind: z.enum(OPENING_KINDS),\n offset: z.number(),\n width: z.number(),\n sill: z.number().optional(),\n height: z.number(),\n});\n\nconst floor = z.strictObject({\n id,\n name: z.string().optional(),\n ring: z.array(planPoint).readonly(),\n});\n\nconst outlet = z.strictObject({\n id,\n wall: id,\n face: z.enum(WALL_FACES),\n offset: z.number(),\n height: z.number(),\n circuit: id.optional(),\n});\n\nconst circuit = z.strictObject({\n id,\n name: z.string().optional(),\n breaker: z.number().optional(),\n voltage: z.number().optional(),\n limit: z.number(),\n});\n\n/**\n * The schema of a room record. It examines the form of the record: the fields, their types and the finite numbers.\n * It refuses a field that the format does not have. `checkRoom` examines the meaning of a record with a correct form.\n */\nexport const roomSchema: z.ZodType<Room> = z.strictObject({\n schema: z.literal(ROOM_SCHEMA),\n name: z.string().optional(),\n unit: z.enum(LENGTH_UNITS),\n height: z.number(),\n wallThickness: z.number(),\n walls: z.array(wall).readonly(),\n openings: z.array(opening).readonly().optional(),\n floors: z.array(floor).readonly().optional(),\n outlets: z.array(outlet).readonly().optional(),\n circuits: z.array(circuit).readonly().optional(),\n});\n\nconst placedObject = z.strictObject({\n id,\n kind: z.string().min(1),\n name: z.string().optional(),\n size: z.tuple([z.number(), z.number(), z.number()]).readonly(),\n at: planPoint,\n lift: z.number().optional(),\n turn: z.number().optional(),\n parent: id.optional(),\n outlet: id.optional(),\n});\n\nconst circuitLoad = z.strictObject({\n circuit: id,\n watts: z.number(),\n});\n\n// The layers of a scene, of a survey or of a level. The core does not read a layer, so it keeps each value. The add-on of a layer examines its form.\nconst layers = z.record(z.string().refine(isLayerName, \"A layer name is a word, a slash and a version, for example electrical/1.\"), z.unknown()).readonly().optional();\n\n/**\n * The schema of a scene record. It examines the form of the record, and it refuses a field that the format does not have.\n * `checkScene` examines the meaning of a record with a correct form.\n */\nexport const sceneSchema: z.ZodType<Scene> = z.strictObject({\n schema: z.literal(SCENE_SCHEMA),\n name: z.string().optional(),\n room: roomSchema,\n objects: z.array(placedObject).readonly().optional(),\n loads: z.array(circuitLoad).readonly().optional(),\n layers,\n});\n\nconst surveySide = z.strictObject({\n id,\n length: z.number(),\n turn: z.union([z.enum(SQUARE_TURNS), z.number()]),\n thickness: z.number().optional(),\n height: z.number().optional(),\n});\n\nconst surveyCheck = z.strictObject({\n id,\n from: id,\n to: id,\n length: z.number(),\n});\n\nconst surveyOutlet = z.strictObject({\n id,\n wall: id,\n offset: z.number(),\n height: z.number(),\n circuit: id.optional(),\n});\n\nconst surveyObject = z.strictObject({\n id,\n kind: z.string().min(1),\n name: z.string().optional(),\n wall: id.optional(),\n on: id.optional(),\n offset: z.number(),\n width: z.number(),\n depth: z.number(),\n height: z.number(),\n gap: z.number().optional(),\n lift: z.number().optional(),\n outlet: id.optional(),\n});\n\n/**\n * The schema of a survey record. It examines the form of the record, and it refuses a field that the format does not have.\n * `expandSurvey` makes the room record of a survey with a correct form, and `checkRoom` examines that room record.\n */\nexport const surveySchema: z.ZodType<Survey> = z.strictObject({\n schema: z.literal(SURVEY_SCHEMA),\n name: z.string().optional(),\n unit: z.enum(LENGTH_UNITS),\n height: z.number(),\n wallThickness: z.number(),\n sides: z.array(surveySide).readonly(),\n start: planPoint.optional(),\n heading: z.number().optional(),\n checks: z.array(surveyCheck).readonly().optional(),\n openings: z.array(opening).readonly().optional(),\n outlets: z.array(surveyOutlet).readonly().optional(),\n circuits: z.array(circuit).readonly().optional(),\n objects: z.array(surveyObject).readonly().optional(),\n layers,\n});\n\nconst connectionEnd = z.strictObject({\n room: id,\n opening: id,\n});\n\n/**\n * The schema of a level record. It examines the form of the record and of each survey, and it refuses a field that the format does not have.\n * `expandLevel` makes the room record of a level with a correct form, and `checkRoom` examines that room record.\n */\nexport const levelSchema: z.ZodType<Level> = z.strictObject({\n schema: z.literal(LEVEL_SCHEMA),\n name: z.string().optional(),\n unit: z.enum(LENGTH_UNITS),\n rooms: z.array(z.strictObject({ id, survey: surveySchema })).readonly(),\n connections: z\n .array(z.strictObject({ id, from: connectionEnd, to: connectionEnd, thickness: z.number().optional() }))\n .readonly()\n .optional(),\n circuits: z.array(circuit).readonly().optional(),\n layers,\n});\n"],"mappings":";;;;;AAOA,MAAM,KAAK,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;AAC3B,MAAM,YAAY,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS;AAE7D,MAAM,SAAS,EAAE,MAAM;CAAC,EAAE,OAAO;CAAG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C,CAAC,SAAS,CAAC,CAAC,SAAS;CAC/C;AACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"schema.js","names":[],"sources":["../src/schema.ts"],"sourcesContent":["import * as z from \"zod/mini\";\nimport en from \"zod/v4/locales/en.js\";\nimport type { Anchor } from \"./anchors.ts\";\nimport type { FindingLevel } from \"./check.ts\";\nimport { FILE_KINDS, type AddOn, type FileKind } from \"./layers.ts\";\nimport { LEVEL_SCHEMA, type Level } from \"./level.ts\";\nimport { isLayerName, OPENING_KINDS, ROOM_SCHEMA, SCENE_SCHEMA, WALL_FACES, WALL_SIDES, type Room, type Scene } from \"./room.ts\";\nimport { SQUARE_TURNS, SURVEY_SCHEMA, type Survey } from \"./survey.ts\";\nimport { LENGTH_UNITS } from \"./units.ts\";\n\n// The schemas use `zod/mini`: a page gets only the parts of zod that the schemas use.\n// `zod/mini` has no messages, so each read gives the English messages of zod with `READ_CONTEXT`. It changes no setting of zod.\n\n/** The parse context of each read of this entry and of each add-on: the faults have the English messages of zod. */\nexport const READ_CONTEXT: z.core.ParseContext<z.core.$ZodIssue> = { error: en().localeError };\n\nconst id = z.string().check(z.minLength(1));\nconst planPoint = z.readonly(z.tuple([z.number(), z.number()]));\n\nconst point3 = z.readonly(z.tuple([z.number(), z.number(), z.number()]));\n\n/**\n * The schema of an anchor. It examines the form of the record, and it refuses a field that the surface of the anchor does not have.\n * The schema of an add-on uses it for the anchor of each record. `checkAnchor` examines the meaning of an anchor with a correct form.\n */\nexport const anchorSchema: z.ZodMiniType<Anchor> = z.discriminatedUnion(\"on\", [\n z.strictObject({ on: z.literal(\"wall\"), wall: id, face: z.enum(WALL_FACES), offset: z.number(), height: z.number() }),\n z.strictObject({ on: z.literal(\"floor\"), at: planPoint, floor: z.optional(id) }),\n z.strictObject({ on: z.literal(\"ceiling\"), at: planPoint, floor: z.optional(id) }),\n z.strictObject({ on: z.literal(\"object\"), object: id, at: z.optional(point3), out: z.optional(point3) }),\n]);\n\nconst wall = z.strictObject({\n id,\n from: planPoint,\n to: planPoint,\n thickness: z.optional(z.number()),\n height: z.optional(z.number()),\n side: z.optional(z.enum(WALL_SIDES)),\n});\n\nconst opening = z.strictObject({\n id,\n wall: id,\n kind: z.enum(OPENING_KINDS),\n offset: z.number(),\n width: z.number(),\n sill: z.optional(z.number()),\n height: z.number(),\n});\n\nconst floor = z.strictObject({\n id,\n name: z.optional(z.string()),\n ring: z.readonly(z.array(planPoint)),\n});\n\n/**\n * The schema of a room record. It examines the form of the record: the fields, their types and the finite numbers.\n * It refuses a field that the format does not have. `checkRoom` examines the meaning of a record with a correct form.\n */\nexport const roomSchema: z.ZodMiniType<Room> = z.strictObject({\n schema: z.literal(ROOM_SCHEMA),\n name: z.optional(z.string()),\n unit: z.enum(LENGTH_UNITS),\n height: z.number(),\n wallThickness: z.number(),\n walls: z.readonly(z.array(wall)),\n openings: z.optional(z.readonly(z.array(opening))),\n floors: z.optional(z.readonly(z.array(floor))),\n});\n\nconst placedObject = z.strictObject({\n id,\n kind: id,\n name: z.optional(z.string()),\n size: point3,\n at: planPoint,\n lift: z.optional(z.number()),\n turn: z.optional(z.number()),\n parent: z.optional(id),\n});\n\n// The layers of a scene, of a survey or of a level. The core does not read a layer, so it keeps each value. The add-on of a layer examines its form.\nconst layerName = z.string().check(z.refine(isLayerName, \"A layer name is a word, a slash and a version, for example electrical/1.\"));\nconst layers = z.optional(z.readonly(z.record(layerName, z.unknown())));\n\n/**\n * The schema of a scene record. It examines the form of the record, and it refuses a field that the format does not have.\n * `checkScene` examines the meaning of a record with a correct form.\n */\nexport const sceneSchema: z.ZodMiniType<Scene> = z.strictObject({\n schema: z.literal(SCENE_SCHEMA),\n name: z.optional(z.string()),\n room: roomSchema,\n objects: z.optional(z.readonly(z.array(placedObject))),\n layers,\n});\n\nconst surveySide = z.strictObject({\n id,\n length: z.number(),\n turn: z.union([z.enum(SQUARE_TURNS), z.number()]),\n thickness: z.optional(z.number()),\n height: z.optional(z.number()),\n});\n\nconst surveyCheck = z.strictObject({\n id,\n from: id,\n to: id,\n length: z.number(),\n});\n\nconst surveyObject = z.strictObject({\n id,\n kind: id,\n name: z.optional(z.string()),\n wall: z.optional(id),\n on: z.optional(id),\n offset: z.number(),\n width: z.number(),\n depth: z.number(),\n height: z.number(),\n gap: z.optional(z.number()),\n lift: z.optional(z.number()),\n});\n\n/**\n * The schema of a survey record. It examines the form of the record, and it refuses a field that the format does not have.\n * `expandSurvey` makes the room record of a survey with a correct form, and `checkRoom` examines that room record.\n */\nexport const surveySchema: z.ZodMiniType<Survey> = z.strictObject({\n schema: z.literal(SURVEY_SCHEMA),\n name: z.optional(z.string()),\n unit: z.enum(LENGTH_UNITS),\n height: z.number(),\n wallThickness: z.number(),\n sides: z.readonly(z.array(surveySide)),\n start: z.optional(planPoint),\n heading: z.optional(z.number()),\n checks: z.optional(z.readonly(z.array(surveyCheck))),\n openings: z.optional(z.readonly(z.array(opening))),\n objects: z.optional(z.readonly(z.array(surveyObject))),\n layers,\n});\n\nconst connectionEnd = z.strictObject({\n room: id,\n opening: id,\n});\n\n/**\n * The schema of a level record. It examines the form of the record and of each survey, and it refuses a field that the format does not have.\n * `expandLevel` makes the room record of a level with a correct form, and `checkRoom` examines that room record.\n */\nexport const levelSchema: z.ZodMiniType<Level> = z.strictObject({\n schema: z.literal(LEVEL_SCHEMA),\n name: z.optional(z.string()),\n unit: z.enum(LENGTH_UNITS),\n rooms: z.readonly(z.array(z.strictObject({ id, survey: surveySchema }))),\n connections: z.optional(z.readonly(z.array(z.strictObject({ id, from: connectionEnd, to: connectionEnd, thickness: z.optional(z.number()) })))),\n layers,\n});\n\n/** The record of each kind, in version 2. */\nexport interface KindRecords {\n readonly room: Room;\n readonly scene: Scene;\n readonly survey: Survey;\n readonly level: Level;\n}\n\n/** These are the codes of the findings of `readRecord`. */\nexport const READ_CODES: readonly [\"read-both\"] = [\"read-both\"];\n\n/** A finding of the read of a record of version 1. The read keeps the record, so a finding is not an error. */\nexport interface ReadFinding {\n readonly level: FindingLevel;\n /** A code of `READ_CODES`. */\n readonly code: string;\n /** The key of the layer in the record. */\n readonly layer: string;\n /** The `id` of the room of a level with the finding. A finding of the record has none. */\n readonly room?: string | undefined;\n /** The finding in plain words. */\n readonly message: string;\n}\n\n/** The result of `readRecord`: the record in version 2, its kind and its version in the file, or the faults of its form. */\nexport type RecordRead =\n | {\n readonly [Kind in FileKind]: {\n readonly ok: true;\n readonly kind: Kind;\n readonly record: KindRecords[Kind];\n /** The version of the format in the file. */\n readonly version: 1 | 2;\n readonly findings: readonly ReadFinding[];\n };\n }[FileKind]\n | { readonly ok: false; readonly errors: readonly string[] };\n\nconst KIND_NAMES: { readonly [Kind in FileKind]: string } = { room: ROOM_SCHEMA, scene: SCENE_SCHEMA, survey: SURVEY_SCHEMA, level: LEVEL_SCHEMA };\n\ntype Json = Readonly<Record<string, unknown>>;\n\n/** This function tells if a value is a JSON object. */\nfunction isJson(value: unknown): value is Json {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\n/** This function gives the schema name of version 2 for a nested record of version 1. A different name stays, so the read tells its fault. */\nfunction newName(record: Json, kind: FileKind): unknown {\n return record[\"schema\"] === `${kind}/1` ? KIND_NAMES[kind] : record[\"schema\"];\n}\n\n/** This function gives the faults of a zod read. Each fault names its place in the record, for example `rooms.0.survey.sides`. */\nfunction faultsOf(error: z.core.$ZodError): readonly string[] {\n return error.issues.map((issue) => `${issue.path.length === 0 ? \"The record\" : `\"${issue.path.map(String).join(\".\")}\"`}: ${issue.message}`);\n}\n\n/**\n * This function reads the JSON of a record of the core in version 1 or in version 2. The record is a room, a scene, a survey or a level.\n * The result is the record in version 2. The schemas of this entry examine its form.\n *\n * A record of version 1 kept the records of some topics in fields of its own. For each add-on of the list with the read `v1`:\n *\n * - The read removes the fields of the add-on from the record, from each object and from each nested record.\n * - The function `read` of the add-on gives the layer of these fields. For a scene, this layer has the records of its room too.\n * For a level, the level record and the survey of each room get a layer.\n * - A record that has the layer and the old fields keeps the layer. The finding `read-both` tells it.\n *\n * A field of version 1 that no add-on of the list removes is a fault of the form. A room record has no layers.\n * Thus a `room/1` with old records gives a `scene/2` with the room and the layers, and a `room/1` with none gives a `room/2`.\n */\nexport function readRecord(value: unknown, addOns: readonly AddOn<unknown>[] = []): RecordRead {\n if (!isJson(value)) return { ok: false, errors: [\"The record is not a JSON object.\"] };\n const name = value[\"schema\"];\n const kind = FILE_KINDS.find((each) => KIND_NAMES[each] === name);\n if (kind !== undefined) return parsed(kind, value, 2, []);\n const old = FILE_KINDS.find((each) => `${each}/1` === name);\n if (old === undefined) return { ok: false, errors: [`The record has no known format: \"schema\" is ${JSON.stringify(name) ?? \"missing\"}.`] };\n const readers = addOns.filter((addOn) => addOn.v1 !== undefined);\n const findings: ReadFinding[] = [];\n const errors: string[] = [];\n const without = (record: Json, of: FileKind | \"object\"): Record<string, unknown> => {\n const gone = new Set(readers.flatMap((addOn) => addOn.v1?.fields[of] ?? []));\n return Object.fromEntries(Object.entries(record).filter(([key]) => !gone.has(key)));\n };\n const objectsOf = (record: Record<string, unknown>): void => {\n const objects = record[\"objects\"];\n if (Array.isArray(objects)) record[\"objects\"] = objects.map((object: unknown) => (isJson(object) ? without(object, \"object\") : object));\n };\n // The layers of the old fields of one record. A layer that the record has already stays.\n const withLayers = (record: Record<string, unknown>, raw: Json, of: FileKind, room?: string): void => {\n const given = isJson(raw[\"layers\"]) ? raw[\"layers\"] : {};\n const layers: Record<string, unknown> = { ...given };\n for (const addOn of readers) {\n const read = addOn.v1?.read(raw, of);\n if (read === undefined) continue;\n if (!read.ok) {\n errors.push(...read.errors);\n continue;\n }\n if (Object.hasOwn(given, addOn.schema)) {\n findings.push({\n level: \"warning\",\n code: \"read-both\",\n layer: addOn.schema,\n ...(room === undefined ? {} : { room }),\n message: `The record has the layer \"${addOn.schema}\" and its old fields. The layer stays, and the old fields go.`,\n });\n continue;\n }\n layers[addOn.schema] = read.layer;\n }\n if (Object.keys(layers).length > 0) record[\"layers\"] = layers;\n };\n const surveyOf = (raw: Json, room?: string): Record<string, unknown> => {\n const record = { ...without(raw, \"survey\"), schema: newName(raw, \"survey\") };\n objectsOf(record);\n withLayers(record, raw, \"survey\", room);\n return record;\n };\n const roomOf = (raw: unknown): unknown => (isJson(raw) ? { ...without(raw, \"room\"), schema: newName(raw, \"room\") } : raw);\n let next: unknown;\n let made: FileKind = old;\n if (old === \"survey\") next = surveyOf(value);\n else if (old === \"level\") {\n const level: Record<string, unknown> = { ...without(value, \"level\"), schema: LEVEL_SCHEMA };\n const rooms = value[\"rooms\"];\n if (Array.isArray(rooms)) {\n level[\"rooms\"] = rooms.map((room: unknown) => {\n if (!isJson(room) || !isJson(room[\"survey\"])) return room;\n return { ...room, survey: surveyOf(room[\"survey\"], typeof room[\"id\"] === \"string\" ? room[\"id\"] : undefined) };\n });\n }\n withLayers(level, value, \"level\");\n next = level;\n } else if (old === \"scene\") {\n const scene: Record<string, unknown> = { ...without(value, \"scene\"), schema: SCENE_SCHEMA, room: roomOf(value[\"room\"]) };\n objectsOf(scene);\n withLayers(scene, value, \"scene\");\n next = scene;\n } else {\n // A room record has no layers, so the layers of its old fields need a scene.\n const scene: Record<string, unknown> = { schema: SCENE_SCHEMA, room: roomOf(value) };\n withLayers(scene, value, \"room\");\n if (scene[\"layers\"] === undefined) next = scene[\"room\"];\n else {\n next = scene;\n made = \"scene\";\n }\n }\n if (errors.length > 0) return { ok: false, errors };\n return parsed(made, next, 1, findings);\n}\n\n/** This function reads a record of version 2 with the schema of its kind. */\nfunction parsed(kind: FileKind, value: unknown, version: 1 | 2, findings: readonly ReadFinding[]): RecordRead {\n if (kind === \"room\") {\n const read = roomSchema.safeParse(value, READ_CONTEXT);\n return read.success ? { ok: true, kind, record: read.data, version, findings } : { ok: false, errors: faultsOf(read.error) };\n }\n if (kind === \"scene\") {\n const read = sceneSchema.safeParse(value, READ_CONTEXT);\n return read.success ? { ok: true, kind, record: read.data, version, findings } : { ok: false, errors: faultsOf(read.error) };\n }\n if (kind === \"survey\") {\n const read = surveySchema.safeParse(value, READ_CONTEXT);\n return read.success ? { ok: true, kind, record: read.data, version, findings } : { ok: false, errors: faultsOf(read.error) };\n }\n const read = levelSchema.safeParse(value, READ_CONTEXT);\n return read.success ? { ok: true, kind, record: read.data, version, findings } : { ok: false, errors: faultsOf(read.error) };\n}\n"],"mappings":";;;;;;;;AAcA,MAAa,eAAsD,EAAE,OAAO,GAAG,CAAC,CAAC,YAAY;AAE7F,MAAM,KAAK,EAAE,OAAO,CAAC,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;AAC1C,MAAM,YAAY,EAAE,SAAS,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC;AAE9D,MAAM,SAAS,EAAE,SAAS,EAAE,MAAM;CAAC,EAAE,OAAO;CAAG,EAAE,OAAO;CAAG,EAAE,OAAO;AAAC,CAAC,CAAC;;;;;AAMvE,MAAa,eAAsC,EAAE,mBAAmB,MAAM;CAC5E,EAAE,aAAa;EAAE,IAAI,EAAE,QAAQ,MAAM;EAAG,MAAM;EAAI,MAAM,EAAE,KAAK,UAAU;EAAG,QAAQ,EAAE,OAAO;EAAG,QAAQ,EAAE,OAAO;CAAE,CAAC;CACpH,EAAE,aAAa;EAAE,IAAI,EAAE,QAAQ,OAAO;EAAG,IAAI;EAAW,OAAO,EAAE,SAAS,EAAE;CAAE,CAAC;CAC/E,EAAE,aAAa;EAAE,IAAI,EAAE,QAAQ,SAAS;EAAG,IAAI;EAAW,OAAO,EAAE,SAAS,EAAE;CAAE,CAAC;CACjF,EAAE,aAAa;EAAE,IAAI,EAAE,QAAQ,QAAQ;EAAG,QAAQ;EAAI,IAAI,EAAE,SAAS,MAAM;EAAG,KAAK,EAAE,SAAS,MAAM;CAAE,CAAC;AACzG,CAAC;AAED,MAAM,OAAO,EAAE,aAAa;CAC1B;CACA,MAAM;CACN,IAAI;CACJ,WAAW,EAAE,SAAS,EAAE,OAAO,CAAC;CAChC,QAAQ,EAAE,S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