@sublang/spex 6.0.0 → 7.0.0-beta.2

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 (108) hide show
  1. package/README.md +419 -12
  2. package/dist/cli.js +12 -1
  3. package/dist/commands/add.d.ts +1 -1
  4. package/dist/commands/add.js +2 -2
  5. package/dist/commands/environment.d.ts +3 -3
  6. package/dist/commands/environment.js +5 -7
  7. package/dist/commands/export.js +2 -2
  8. package/dist/commands/home.d.ts +2 -2
  9. package/dist/commands/home.js +3 -3
  10. package/dist/commands/list.js +1 -1
  11. package/dist/commands/login.js +12 -7
  12. package/dist/commands/logout.js +2 -3
  13. package/dist/commands/publish.js +1 -1
  14. package/dist/commands/remove.js +1 -1
  15. package/dist/commands/run.d.ts +1 -1
  16. package/dist/commands/run.js +16 -0
  17. package/dist/commands/settle.d.ts +1 -1
  18. package/dist/commands/settle.js +1 -1
  19. package/dist/guards/approval.d.ts +56 -0
  20. package/dist/guards/approval.js +158 -0
  21. package/dist/guards/checks.d.ts +207 -0
  22. package/dist/guards/checks.js +681 -0
  23. package/dist/guards/commands.d.ts +15 -0
  24. package/dist/guards/commands.js +313 -0
  25. package/dist/guards/copy.d.ts +67 -0
  26. package/dist/guards/copy.js +306 -0
  27. package/dist/guards/declaration.d.ts +45 -0
  28. package/dist/guards/declaration.js +224 -0
  29. package/dist/guards/files.d.ts +137 -0
  30. package/dist/guards/files.js +544 -0
  31. package/dist/guards/harness.d.ts +58 -0
  32. package/dist/guards/harness.js +420 -0
  33. package/dist/guards/items.d.ts +61 -0
  34. package/dist/guards/items.js +161 -0
  35. package/dist/guards/patch.d.ts +55 -0
  36. package/dist/guards/patch.js +258 -0
  37. package/dist/guards/processes.d.ts +49 -0
  38. package/dist/guards/processes.js +233 -0
  39. package/dist/guards/proofs.d.ts +88 -0
  40. package/dist/guards/proofs.js +503 -0
  41. package/dist/guards/records.d.ts +176 -0
  42. package/dist/guards/records.js +513 -0
  43. package/dist/guards/report.d.ts +26 -0
  44. package/dist/guards/report.js +492 -0
  45. package/dist/guards/runner.d.ts +42 -0
  46. package/dist/guards/runner.js +167 -0
  47. package/dist/guards/tla.d.ts +51 -0
  48. package/dist/guards/tla.js +352 -0
  49. package/dist/guards/tlapm.d.ts +81 -0
  50. package/dist/guards/tlapm.js +172 -0
  51. package/dist/guards/tlc.d.ts +191 -0
  52. package/dist/guards/tlc.js +457 -0
  53. package/dist/guards/translation.d.ts +66 -0
  54. package/dist/guards/translation.js +202 -0
  55. package/dist/guards/types.d.ts +185 -0
  56. package/dist/guards/types.js +437 -0
  57. package/dist/guards/verify.d.ts +290 -0
  58. package/dist/guards/verify.js +1191 -0
  59. package/dist/guards/xml.d.ts +18 -0
  60. package/dist/guards/xml.js +105 -0
  61. package/dist/lib/environment/archive.d.ts +2 -2
  62. package/dist/lib/environment/archive.js +1 -1
  63. package/dist/lib/environment/builtins.d.ts +10 -12
  64. package/dist/lib/environment/builtins.js +17 -19
  65. package/dist/lib/environment/exports.d.ts +14 -13
  66. package/dist/lib/environment/exports.js +31 -16
  67. package/dist/lib/environment/format.d.ts +2 -2
  68. package/dist/lib/environment/format.js +3 -3
  69. package/dist/lib/environment/git-source.js +6 -3
  70. package/dist/lib/environment/install.d.ts +14 -16
  71. package/dist/lib/environment/install.js +66 -61
  72. package/dist/lib/environment/lock.d.ts +4 -3
  73. package/dist/lib/environment/lock.js +6 -5
  74. package/dist/lib/environment/marker.js +1 -2
  75. package/dist/lib/environment/own-paths.d.ts +7 -10
  76. package/dist/lib/environment/own-paths.js +10 -13
  77. package/dist/lib/environment/placed-record.d.ts +3 -2
  78. package/dist/lib/environment/placed-record.js +5 -4
  79. package/dist/lib/environment/registry.d.ts +1 -1
  80. package/dist/lib/environment/registry.js +1 -1
  81. package/dist/lib/environment/requests.d.ts +2 -2
  82. package/dist/lib/environment/requests.js +2 -2
  83. package/dist/lib/environment/resolve.d.ts +4 -4
  84. package/dist/lib/environment/resolve.js +3 -4
  85. package/dist/lib/environment/store.d.ts +34 -8
  86. package/dist/lib/environment/store.js +138 -43
  87. package/dist/lib/files.d.ts +72 -12
  88. package/dist/lib/files.js +200 -65
  89. package/dist/lib/git-host.d.ts +52 -258
  90. package/dist/lib/git-host.js +52 -265
  91. package/dist/lib/home-file.d.ts +13 -10
  92. package/dist/lib/home-file.js +28 -18
  93. package/dist/lib/instance.d.ts +1 -1
  94. package/dist/lib/instance.js +1 -1
  95. package/dist/lint.d.ts +22 -0
  96. package/dist/lint.js +36 -0
  97. package/dist/testing/standin-registry.js +1 -1
  98. package/package.json +7 -3
  99. package/scaffold/.file-history.json +14 -7
  100. package/scaffold/i18n/zh/source-pins.json +41 -0
  101. package/scaffold/i18n/zh/specs/decisions/000-spec-structure-format.md +0 -1
  102. package/scaffold/i18n/zh/specs/intents/000-spdx-headers.md +0 -1
  103. package/scaffold/i18n/zh/specs/map.md +0 -1
  104. package/scaffold/i18n/zh/specs/meta.md +18 -35
  105. package/scaffold/i18n/zh/specs/packages/git.md +0 -1
  106. package/scaffold/i18n/zh/specs/packages/licensing.md +0 -1
  107. package/scaffold/specs/meta.md +18 -3
  108. package/scripts/test-exit-guard.mjs +28 -0
@@ -0,0 +1,437 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ // SPDX-FileCopyrightText: 2026 SubLang International <https://sublang.ai>
3
+ /*
4
+ * Guards package, DR-252: the declared types a binding is written in,
5
+ * the values of those types as the guard file and the binding's module
6
+ * hold them, and how such a value is read from YAML or JSON and
7
+ * printed. Nothing here knows TLA+: `tla.ts` turns these values into
8
+ * TLA+ text and back.
9
+ *
10
+ * A value in memory is plain JSON in one fixed form, so two equal
11
+ * values always print and compare the same:
12
+ * bool -> boolean, a whole number -> number, a named value -> its
13
+ * string, the missing value -> null, a set -> array in declared
14
+ * order without repeats.
15
+ */
16
+ import { parseDocument } from "yaml";
17
+ /** The one error the guards library throws on purpose. Its message is
18
+ * plain words, ready to print; nothing else of it is for a person. */
19
+ export class GuardError extends Error {
20
+ constructor(message) {
21
+ super(message);
22
+ this.name = "GuardError";
23
+ }
24
+ }
25
+ /** Run `work`, and put `where` before the message of a GuardError it
26
+ * throws: `<where>: <cause>`. */
27
+ export function within(where, work) {
28
+ try {
29
+ return work();
30
+ }
31
+ catch (error) {
32
+ if (error instanceof GuardError)
33
+ throw new GuardError(`${where}: ${error.message}`);
34
+ throw error;
35
+ }
36
+ }
37
+ /** Order two texts by their code units, the same on every machine. */
38
+ export function byText(a, b) {
39
+ return a < b ? -1 : a > b ? 1 : 0;
40
+ }
41
+ // ---------------------------------------------------------------
42
+ // Names
43
+ // ---------------------------------------------------------------
44
+ /** A values set, a param or an effect field: these become names of
45
+ * the declaration in TLA+. */
46
+ const FIELD_RE = /^[a-z][A-Za-z0-9]*$/;
47
+ /** An event's name, which TLA+ holds as a string. */
48
+ const EVENT_RE = /^[A-Za-z][A-Za-z0-9_]*$/;
49
+ /** Why `name` cannot name a values set, a param or an effect field,
50
+ * or null when it can. */
51
+ export function fieldFault(name) {
52
+ return FIELD_RE.test(name)
53
+ ? null
54
+ : `'${name}' is not a name (a lowercase letter, then letters and digits)`;
55
+ }
56
+ /** Why `name` cannot name an event, or null when it can. */
57
+ export function eventFault(name) {
58
+ return EVENT_RE.test(name) ? null : `'${name}' is not a name (a letter, then letters, digits and _)`;
59
+ }
60
+ /** The words a type is written with; none may name a values set. */
61
+ const TYPE_WORDS = new Set(["bool", "set", "of"]);
62
+ /**
63
+ * Compare two values of a set by its order: negative where `a` comes
64
+ * first, positive where `b` does, zero where they are the same. It
65
+ * reads the values alone, so it orders values a binding never
66
+ * declared as well as those it did.
67
+ */
68
+ export function compareInOrder(order, a, b) {
69
+ if (order.rule === "text")
70
+ return byText(a, b);
71
+ const x = a.split(order.separator);
72
+ const y = b.split(order.separator);
73
+ for (let at = 0; at < Math.min(x.length, y.length); at += 1) {
74
+ const found = byText(x[at], y[at]);
75
+ if (found !== 0)
76
+ return found;
77
+ }
78
+ return x.length - y.length;
79
+ }
80
+ /** An order as binding.yaml writes it. */
81
+ export function showOrder(order) {
82
+ return order.rule === "text" ? "text" : `{ parts: ${JSON.stringify(order.separator)} }`;
83
+ }
84
+ /** Why a string cannot be a value of a values set, or null where it
85
+ * can: it is printable ASCII, not empty, with no space at either end,
86
+ * and not `none`, `true` or `false`. */
87
+ export function valueFault(value) {
88
+ if (value === "none" || value === "true" || value === "false")
89
+ return `'${value}' cannot be a value`;
90
+ if (value === "" || value !== value.trim() || !/^[\x20-\x7e]*$/.test(value)) {
91
+ return `${JSON.stringify(value)} cannot be a value (printable ASCII, no space at either end)`;
92
+ }
93
+ if (value.includes("`"))
94
+ return `${JSON.stringify(value)} cannot be a value (no backtick: TLC does not read one in a string as written)`;
95
+ return null;
96
+ }
97
+ /**
98
+ * Build a vocabulary from the declared values of each set and the
99
+ * orders of those that have one. Where a set has an order its
100
+ * declared values must be listed in it, so the list is that order
101
+ * for TLC as well.
102
+ */
103
+ export function vocabulary(values, orders = {}) {
104
+ const sets = {};
105
+ const ordered = {};
106
+ const home = new Map();
107
+ for (const [set, members] of Object.entries(values)) {
108
+ const fault = fieldFault(set);
109
+ if (fault !== null)
110
+ throw new GuardError(`values: ${fault}`);
111
+ if (TYPE_WORDS.has(set))
112
+ throw new GuardError(`values: '${set}' is a word types are written with`);
113
+ if (members.length === 0)
114
+ throw new GuardError(`values ${set}: a set needs at least one value`);
115
+ members.forEach((value, rank) => {
116
+ const where = `values ${set}`;
117
+ if (typeof value !== "string") {
118
+ throw new GuardError(`${where}: a value is a plain string, found ${showData(value)}`);
119
+ }
120
+ const fault = valueFault(value);
121
+ if (fault !== null)
122
+ throw new GuardError(`${where}: ${fault}`);
123
+ const other = home.get(value);
124
+ if (other !== undefined) {
125
+ throw new GuardError(other.set === set
126
+ ? `${where}: '${value}' is listed twice`
127
+ : `${where}: '${value}' is also in values ${other.set}; a value belongs to one set`);
128
+ }
129
+ home.set(value, { set, rank });
130
+ });
131
+ const order = Object.hasOwn(orders, set) ? orders[set] : undefined;
132
+ if (order !== undefined) {
133
+ for (let at = 1; at < members.length; at += 1) {
134
+ const [before, after] = [members[at - 1], members[at]];
135
+ if (compareInOrder(order, before, after) >= 0) {
136
+ throw new GuardError(`values ${set}: '${before}' is listed before '${after}', which comes first in the order ${showOrder(order)}; list the declared values in that order`);
137
+ }
138
+ }
139
+ ordered[set] = order;
140
+ }
141
+ sets[set] = [...members];
142
+ }
143
+ return { sets, orders: ordered, home };
144
+ }
145
+ /** Whether `name` is one of the vocabulary's sets. */
146
+ export function isValuesSet(vocab, name) {
147
+ return Object.hasOwn(vocab.sets, name);
148
+ }
149
+ // ---------------------------------------------------------------
150
+ // Reading and writing a type
151
+ // ---------------------------------------------------------------
152
+ /**
153
+ * Read a type as binding.yaml writes it: `bool`, `<a>..<b>`, a values
154
+ * name, `set of <values name>`, `set of <a>..<b>`, and `<type>?`.
155
+ * After `set of …` the `?` makes the set optional.
156
+ */
157
+ export function parseType(text, vocab) {
158
+ if (typeof text !== "string") {
159
+ throw new GuardError(`write the type as text, found ${showData(text)}`);
160
+ }
161
+ const bad = (cause) => {
162
+ throw new GuardError(`${cause} in type "${text}"`);
163
+ };
164
+ let rest = text.trim();
165
+ let optional = false;
166
+ if (rest.endsWith("?")) {
167
+ optional = true;
168
+ rest = rest.slice(0, -1).trim();
169
+ if (rest.endsWith("?"))
170
+ bad("a type takes one '?'");
171
+ }
172
+ const plain = (word) => {
173
+ const range = /^(-?\d+)\s*\.\.\s*(-?\d+)$/.exec(word);
174
+ if (range !== null) {
175
+ const min = Number(range[1]);
176
+ const max = Number(range[2]);
177
+ // TLC's whole numbers are 32 bits wide.
178
+ if (Math.abs(min) > 2147483647 || Math.abs(max) > 2147483647)
179
+ bad("a number is beyond what TLC holds");
180
+ if (min > max)
181
+ bad(`${min}..${max} holds no number`);
182
+ return { kind: "int", min, max };
183
+ }
184
+ if (!/^[A-Za-z][A-Za-z0-9]*$/.test(word))
185
+ bad(word === "" ? "something is left out" : `unexpected '${word}'`);
186
+ if (!isValuesSet(vocab, word))
187
+ bad(`'${word}' is not a type or a values name`);
188
+ return { kind: "value", set: word };
189
+ };
190
+ let type;
191
+ const set = /^set\s+of\s+(.*)$/.exec(rest);
192
+ if (set !== null) {
193
+ if (set[1].trim() === "bool")
194
+ bad("a set holds whole numbers or named values");
195
+ type = { kind: "set", of: plain(set[1].trim()) };
196
+ }
197
+ else if (rest === "bool") {
198
+ type = { kind: "bool" };
199
+ }
200
+ else {
201
+ type = plain(rest);
202
+ }
203
+ return optional ? { kind: "optional", of: type } : type;
204
+ }
205
+ /** A type as it is written. */
206
+ export function showType(type) {
207
+ switch (type.kind) {
208
+ case "bool":
209
+ return "bool";
210
+ case "int":
211
+ return `${type.min}..${type.max}`;
212
+ case "value":
213
+ return type.set;
214
+ case "set":
215
+ return `set of ${showType(type.of)}`;
216
+ case "optional":
217
+ return `${showType(type.of)}?`;
218
+ }
219
+ }
220
+ // ---------------------------------------------------------------
221
+ // Values
222
+ // ---------------------------------------------------------------
223
+ /** Data that is not yet a value, printed for a message. */
224
+ export function showData(data) {
225
+ if (data === undefined)
226
+ return "nothing";
227
+ let text;
228
+ try {
229
+ text = JSON.stringify(data);
230
+ }
231
+ catch {
232
+ text = undefined;
233
+ }
234
+ if (text === undefined)
235
+ text = String(data);
236
+ return text.length > 80 ? `${text.slice(0, 77)}...` : text;
237
+ }
238
+ function isRecord(data) {
239
+ return typeof data === "object" && data !== null && !Array.isArray(data);
240
+ }
241
+ /** Put a set's members in declared order: whole numbers rising, named
242
+ * values as their set lists them. */
243
+ export function inOrder(members, vocab) {
244
+ const rank = (member) => typeof member === "number" ? member : (vocab.home.get(member)?.rank ?? 0);
245
+ return [...members].sort((a, b) => rank(a) - rank(b));
246
+ }
247
+ /**
248
+ * Read data written as YAML or JSON as a value of `type`: a step's
249
+ * params and effects, what a binding returns. Throws a GuardError
250
+ * saying what was expected and what was found.
251
+ */
252
+ export function decodeValue(type, data, vocab) {
253
+ return decodeAs(type, data, vocab, type);
254
+ }
255
+ /** `shown` is the type a message names: the optional type where
256
+ * `type` is what it holds. */
257
+ function decodeAs(type, data, vocab, shown) {
258
+ const bad = () => {
259
+ throw new GuardError(`expected ${showType(shown)}, found ${showData(data)}`);
260
+ };
261
+ switch (type.kind) {
262
+ case "optional":
263
+ return data === null ? null : decodeAs(type.of, data, vocab, type);
264
+ case "bool":
265
+ return typeof data === "boolean" ? data : bad();
266
+ case "int":
267
+ return typeof data === "number" && Number.isSafeInteger(data) && data >= type.min && data <= type.max
268
+ ? data
269
+ : bad();
270
+ case "value":
271
+ return typeof data === "string" && vocab.home.get(data)?.set === type.set ? data : bad();
272
+ case "set": {
273
+ if (!Array.isArray(data))
274
+ return bad();
275
+ const members = data.map((member) => {
276
+ try {
277
+ return decodeValue(type.of, member, vocab);
278
+ }
279
+ catch (error) {
280
+ if (error instanceof GuardError)
281
+ return bad();
282
+ throw error;
283
+ }
284
+ });
285
+ if (new Set(members).size !== members.length) {
286
+ throw new GuardError(`a value repeats in ${showData(data)}`);
287
+ }
288
+ return inOrder(members, vocab);
289
+ }
290
+ }
291
+ }
292
+ /**
293
+ * Read a record of named values against its declared fields. Every
294
+ * declared field must be there unless `partial`; no other field may
295
+ * be. The result keeps the declared order.
296
+ */
297
+ export function decodeFields(declared, data, vocab, options = {}) {
298
+ if (!isRecord(data)) {
299
+ throw new GuardError(`expected named fields, found ${showData(data)}`);
300
+ }
301
+ for (const name of Object.keys(data)) {
302
+ if (!Object.hasOwn(declared, name))
303
+ throw new GuardError(`'${name}' is not declared`);
304
+ }
305
+ const fields = {};
306
+ for (const [name, type] of Object.entries(declared)) {
307
+ if (!Object.hasOwn(data, name) || data[name] === undefined) {
308
+ if (options.partial === true)
309
+ continue;
310
+ throw new GuardError(`no value for '${name}'`);
311
+ }
312
+ fields[name] = within(name, () => decodeValue(type, data[name], vocab));
313
+ }
314
+ return fields;
315
+ }
316
+ /** Whether two values are the same. */
317
+ export function sameValue(a, b) {
318
+ return JSON.stringify(a) === JSON.stringify(b);
319
+ }
320
+ /** Whether two records of named values are the same, field by field. */
321
+ export function sameFields(a, b) {
322
+ const names = Object.keys(a);
323
+ return (names.length === Object.keys(b).length &&
324
+ names.every((name) => Object.hasOwn(b, name) && sameValue(a[name], b[name])));
325
+ }
326
+ /** The stated fields whose observed value is another: what a step
327
+ * states of an effect against what the code produced. Fields the step
328
+ * leaves out are not compared. In the stated order. */
329
+ export function differences(stated, observed) {
330
+ const found = [];
331
+ for (const [field, value] of Object.entries(stated)) {
332
+ const seen = Object.hasOwn(observed, field) ? observed[field] : null;
333
+ if (!Object.hasOwn(observed, field) || !sameValue(value, seen)) {
334
+ found.push({ field, stated: value, observed: seen });
335
+ }
336
+ }
337
+ return found;
338
+ }
339
+ /**
340
+ * Order two values of one declared type: the missing value first,
341
+ * false before true, whole numbers rising, a values set in its
342
+ * declared order, sets by size and then by their members in order.
343
+ */
344
+ export function compareValues(type, a, b, vocab) {
345
+ switch (type.kind) {
346
+ case "optional":
347
+ if (a === null || b === null)
348
+ return a === b ? 0 : a === null ? -1 : 1;
349
+ return compareValues(type.of, a, b, vocab);
350
+ case "bool":
351
+ return Number(a) - Number(b);
352
+ case "int":
353
+ return a - b;
354
+ case "value":
355
+ return (vocab.home.get(a)?.rank ?? 0) - (vocab.home.get(b)?.rank ?? 0);
356
+ case "set": {
357
+ const [x, y] = [a, b];
358
+ if (x.length !== y.length)
359
+ return x.length - y.length;
360
+ for (let at = 0; at < x.length; at += 1) {
361
+ const order = compareValues(type.of, x[at], y[at], vocab);
362
+ if (order !== 0)
363
+ return order;
364
+ }
365
+ return 0;
366
+ }
367
+ }
368
+ }
369
+ /** Order two records of the same declared fields: by the first
370
+ * field's value, then the second's, and so on. */
371
+ export function compareFields(declared, a, b, vocab) {
372
+ for (const [name, type] of Object.entries(declared)) {
373
+ const order = compareValues(type, a[name], b[name], vocab);
374
+ if (order !== 0)
375
+ return order;
376
+ }
377
+ return 0;
378
+ }
379
+ /** A value as output prints it: `none`, `{a, b}` for a set. */
380
+ export function showValue(value) {
381
+ if (value === null)
382
+ return "none";
383
+ if (Array.isArray(value))
384
+ return `{${value.map(showValue).join(", ")}}`;
385
+ return typeof value === "string" ? showText(value) : String(value);
386
+ }
387
+ /**
388
+ * A string as a report prints it: itself where it can be read as
389
+ * nothing else, and as JSON writes it where it is empty, holds white
390
+ * space or a mark the printed forms are built of, or reads as another
391
+ * value, so that a string never prints as another value does: the set
392
+ * of `"ann, zed"` is `{"ann, zed"}`, and the string `true` is `"true"`.
393
+ */
394
+ export function showText(text) {
395
+ // A number prints as JavaScript writes it, so a string is read as one
396
+ // exactly where it is what some number prints as.
397
+ const other = text === "true" || text === "false" || text === "none" || String(Number(text)) === text;
398
+ return /^[^\s,{}<>=:"]+$/.test(text) && !other ? text : JSON.stringify(text);
399
+ }
400
+ /** Named values on one line: `selected={zeta/kit} providing={}`. */
401
+ export function showFields(fields) {
402
+ return Object.entries(fields)
403
+ .map(([name, value]) => `${name}=${showValue(value)}`)
404
+ .join(" ");
405
+ }
406
+ // ---------------------------------------------------------------
407
+ // YAML
408
+ // ---------------------------------------------------------------
409
+ /** Parse one YAML file's text. A syntax error or a repeated key is a
410
+ * GuardError. */
411
+ export function parseYaml(text) {
412
+ const document = parseDocument(text, { prettyErrors: true });
413
+ const problem = document.errors[0];
414
+ if (problem !== undefined) {
415
+ throw new GuardError(`not readable as YAML — ${problem.message.split("\n")[0]}`);
416
+ }
417
+ return document.toJS();
418
+ }
419
+ /** `data` as a mapping, with only the `allowed` keys when they are
420
+ * given; else a GuardError naming the unknown key. */
421
+ export function mapping(data, allowed) {
422
+ if (!isRecord(data)) {
423
+ throw new GuardError(`expected a mapping, found ${showData(data)}`);
424
+ }
425
+ if (allowed !== undefined) {
426
+ for (const key of Object.keys(data)) {
427
+ if (!allowed.includes(key))
428
+ throw new GuardError(`unknown key '${key}'`);
429
+ }
430
+ }
431
+ return data;
432
+ }
433
+ /** `data` as a mapping, or an empty one where the key was left out. */
434
+ export function mappingOrNone(data, allowed) {
435
+ return data === undefined || data === null ? {} : mapping(data, allowed);
436
+ }
437
+ //# sourceMappingURL=types.js.map