@valbuild/core 0.61.0 → 0.62.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.
@@ -1,1823 +1,2 @@
1
- import { a as array, o as object, u as union, r as richtext$1, i as image$1, l as literal, b as record, d as define, P as PatchError, n as newSelectorProxy, c as createValPathOfItem, e as isSelector, I as ImageSchema, R as RecordSchema, f as RichTextSchema, U as UnionSchema, A as ArraySchema, O as ObjectSchema, L as LiteralSchema, g as getSource, h as resolvePath, s as splitModuleIdAndModulePath, p as parsePath } from './ops-9262cf01.esm.js';
2
- export { A as ArraySchema, I as ImageSchema, L as LiteralSchema, O as ObjectSchema, R as RecordSchema, f as RichTextSchema, U as UnionSchema } from './ops-9262cf01.esm.js';
3
- import { _ as _inherits, a as _classCallCheck, b as _callSuper, c as _createClass, d as _defineProperty, e as _typeof, S as Schema, f as _objectSpread2, G as GetSchema, g as getValPath, h as file, V as VAL_EXTENSION, F as FILE_REF_PROP, i as FILE_REF_SUBTYPE_TAG, j as file$1, k as _slicedToArray, l as isFile, P as Path, m as GetSource, n as isSerializedVal, o as FileSchema, p as convertFileSource, q as getSchema, r as isVal } from './index-051c34f3.esm.js';
4
- export { F as FILE_REF_PROP, i as FILE_REF_SUBTYPE_TAG, o as FileSchema, s as GenericSelector, S as Schema, V as VAL_EXTENSION } from './index-051c34f3.esm.js';
5
- export { i as expr } from './index-ed5767a3.esm.js';
6
- import { _ as _createForOfIteratorHelper, i as isErr, a as isOk, e as err, o as ok, r as result } from './result-b96df128.esm.js';
7
-
8
- var NumberSchema = /*#__PURE__*/function (_Schema) {
9
- _inherits(NumberSchema, _Schema);
10
- function NumberSchema(options) {
11
- var _this;
12
- var opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
13
- _classCallCheck(this, NumberSchema);
14
- _this = _callSuper(this, NumberSchema);
15
- _this.options = options;
16
- _this.opt = opt;
17
- return _this;
18
- }
19
- _createClass(NumberSchema, [{
20
- key: "validate",
21
- value: function validate(path, src) {
22
- if (this.opt && (src === null || src === undefined)) {
23
- return false;
24
- }
25
- if (typeof src !== "number") {
26
- return _defineProperty({}, path, [{
27
- message: "Expected 'number', got '".concat(_typeof(src), "'"),
28
- value: src
29
- }]);
30
- }
31
- return false;
32
- }
33
- }, {
34
- key: "assert",
35
- value: function assert(src) {
36
- if (this.opt && (src === null || src === undefined)) {
37
- return true;
38
- }
39
- return typeof src === "number";
40
- }
41
- }, {
42
- key: "nullable",
43
- value: function nullable() {
44
- return new NumberSchema(this.options, true);
45
- }
46
- }, {
47
- key: "serialize",
48
- value: function serialize() {
49
- return {
50
- type: "number",
51
- options: this.options,
52
- opt: this.opt
53
- };
54
- }
55
- }]);
56
- return NumberSchema;
57
- }(Schema);
58
- var number = function number(options) {
59
- return new NumberSchema(options);
60
- };
61
-
62
- var StringSchema = /*#__PURE__*/function (_Schema) {
63
- _inherits(StringSchema, _Schema);
64
- function StringSchema(options) {
65
- var _this;
66
- var opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
67
- var isRaw = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
68
- _classCallCheck(this, StringSchema);
69
- _this = _callSuper(this, StringSchema);
70
- _this.options = options;
71
- _this.opt = opt;
72
- _this.isRaw = isRaw;
73
- return _this;
74
- }
75
- _createClass(StringSchema, [{
76
- key: "min",
77
- value: function min(minLength) {
78
- return new StringSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
79
- minLength: minLength
80
- }), this.opt, this.isRaw);
81
- }
82
- }, {
83
- key: "max",
84
- value: function max(maxLength) {
85
- return new StringSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
86
- maxLength: maxLength
87
- }), this.opt, this.isRaw);
88
- }
89
- }, {
90
- key: "regexp",
91
- value: function regexp(_regexp) {
92
- return new StringSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
93
- regexp: _regexp
94
- }), this.opt, this.isRaw);
95
- }
96
- }, {
97
- key: "validate",
98
- value: function validate(path, src) {
99
- var _this$options, _this$options2, _this$options3;
100
- if (this.opt && (src === null || src === undefined)) {
101
- return false;
102
- }
103
- if (typeof src !== "string") {
104
- return _defineProperty({}, path, [{
105
- message: "Expected 'string', got '".concat(_typeof(src), "'"),
106
- value: src
107
- }]);
108
- }
109
- var errors = [];
110
- if ((_this$options = this.options) !== null && _this$options !== void 0 && _this$options.maxLength && src.length > this.options.maxLength) {
111
- errors.push({
112
- message: "Expected string to be at most ".concat(this.options.maxLength, " characters long, got ").concat(src.length),
113
- value: src
114
- });
115
- }
116
- if ((_this$options2 = this.options) !== null && _this$options2 !== void 0 && _this$options2.minLength && src.length < this.options.minLength) {
117
- errors.push({
118
- message: "Expected string to be at least ".concat(this.options.minLength, " characters long, got ").concat(src.length),
119
- value: src
120
- });
121
- }
122
- if ((_this$options3 = this.options) !== null && _this$options3 !== void 0 && _this$options3.regexp && !this.options.regexp.test(src)) {
123
- errors.push({
124
- message: "Expected string to match reg exp: ".concat(this.options.regexp.toString(), ", got '").concat(src, "'"),
125
- value: src
126
- });
127
- }
128
- if (errors.length > 0) {
129
- return _defineProperty({}, path, errors);
130
- }
131
- return false;
132
- }
133
- }, {
134
- key: "assert",
135
- value: function assert(src) {
136
- if (this.opt && (src === null || src === undefined)) {
137
- return true;
138
- }
139
- return typeof src === "string";
140
- }
141
- }, {
142
- key: "nullable",
143
- value: function nullable() {
144
- return new StringSchema(this.options, true, this.isRaw);
145
- }
146
- }, {
147
- key: "raw",
148
- value: function raw() {
149
- return new StringSchema(this.options, this.opt, true);
150
- }
151
- }, {
152
- key: "serialize",
153
- value: function serialize() {
154
- var _this$options4, _this$options5, _this$options6;
155
- return {
156
- type: "string",
157
- options: {
158
- maxLength: (_this$options4 = this.options) === null || _this$options4 === void 0 ? void 0 : _this$options4.maxLength,
159
- minLength: (_this$options5 = this.options) === null || _this$options5 === void 0 ? void 0 : _this$options5.minLength,
160
- regexp: ((_this$options6 = this.options) === null || _this$options6 === void 0 ? void 0 : _this$options6.regexp) && {
161
- source: this.options.regexp.source,
162
- flags: this.options.regexp.flags
163
- }
164
- },
165
- opt: this.opt,
166
- raw: this.isRaw
167
- };
168
- }
169
- }]);
170
- return StringSchema;
171
- }(Schema);
172
- var string = function string(options) {
173
- return new StringSchema(options);
174
- };
175
-
176
- var BooleanSchema = /*#__PURE__*/function (_Schema) {
177
- _inherits(BooleanSchema, _Schema);
178
- function BooleanSchema() {
179
- var _this;
180
- var opt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
181
- _classCallCheck(this, BooleanSchema);
182
- _this = _callSuper(this, BooleanSchema);
183
- _this.opt = opt;
184
- return _this;
185
- }
186
- _createClass(BooleanSchema, [{
187
- key: "validate",
188
- value: function validate(path, src) {
189
- if (this.opt && (src === null || src === undefined)) {
190
- return false;
191
- }
192
- if (typeof src !== "boolean") {
193
- return _defineProperty({}, path, [{
194
- message: "Expected 'boolean', got '".concat(_typeof(src), "'"),
195
- value: src
196
- }]);
197
- }
198
- return false;
199
- }
200
- }, {
201
- key: "assert",
202
- value: function assert(src) {
203
- if (this.opt && (src === null || src === undefined)) {
204
- return true;
205
- }
206
- return typeof src === "boolean";
207
- }
208
- }, {
209
- key: "nullable",
210
- value: function nullable() {
211
- return new BooleanSchema(true);
212
- }
213
- }, {
214
- key: "serialize",
215
- value: function serialize() {
216
- return {
217
- type: "boolean",
218
- opt: this.opt
219
- };
220
- }
221
- }]);
222
- return BooleanSchema;
223
- }(Schema);
224
- var _boolean = function _boolean() {
225
- return new BooleanSchema();
226
- };
227
-
228
- var KeyOfSchema = /*#__PURE__*/function (_Schema) {
229
- _inherits(KeyOfSchema, _Schema);
230
- function KeyOfSchema(schema, sourcePath) {
231
- var _this;
232
- var opt = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
233
- _classCallCheck(this, KeyOfSchema);
234
- _this = _callSuper(this, KeyOfSchema);
235
- _this.schema = schema;
236
- _this.sourcePath = sourcePath;
237
- _this.opt = opt;
238
- return _this;
239
- }
240
- _createClass(KeyOfSchema, [{
241
- key: "validate",
242
- value: function validate(path, src) {
243
- if (this.opt && (src === null || src === undefined)) {
244
- return false;
245
- }
246
- if (!this.schema) {
247
- return _defineProperty({}, path, [{
248
- message: "Schema not found for module. keyOf must be used with a Val Module"
249
- }]);
250
- }
251
- var serializedSchema = this.schema;
252
- if (!(serializedSchema.type === "array" || serializedSchema.type === "object" || serializedSchema.type === "record")) {
253
- return _defineProperty({}, path, [{
254
- message: "Schema in keyOf must be an 'array', 'object' or 'record'. Found '".concat(serializedSchema.type, "'")
255
- }]);
256
- }
257
- if (serializedSchema.opt && (src === null || src === undefined)) {
258
- return false;
259
- }
260
- if (serializedSchema.type === "array" && typeof src !== "number") {
261
- return _defineProperty({}, path, [{
262
- message: "Type of value in keyof (array) must be 'number'"
263
- }]);
264
- }
265
- if (serializedSchema.type === "record" && typeof src !== "string") {
266
- return _defineProperty({}, path, [{
267
- message: "Type of value in keyof (record) must be 'string'"
268
- }]);
269
- }
270
- if (serializedSchema.type === "object") {
271
- var keys = Object.keys(serializedSchema.items);
272
- if (!keys.includes(src)) {
273
- return _defineProperty({}, path, [{
274
- message: "Value of keyOf (object) must be: ".concat(keys.join(", "), ". Found: ").concat(src)
275
- }]);
276
- }
277
- }
278
- return false;
279
- }
280
- }, {
281
- key: "assert",
282
- value: function assert(src) {
283
- if (this.opt && (src === null || src === undefined)) {
284
- return true;
285
- }
286
- var schema = this.schema;
287
- if (!schema) {
288
- return false;
289
- }
290
- var serializedSchema = schema;
291
- if (!(serializedSchema.type === "array" || serializedSchema.type === "object" || serializedSchema.type === "record")) {
292
- return false;
293
- }
294
- if (serializedSchema.opt && (src === null || src === undefined)) {
295
- return true;
296
- }
297
- if (serializedSchema.type === "array" && typeof src !== "number") {
298
- return false;
299
- }
300
- if (serializedSchema.type === "record" && typeof src !== "string") {
301
- return false;
302
- }
303
- if (serializedSchema.type === "object") {
304
- var keys = Object.keys(serializedSchema.items);
305
- if (!keys.includes(src)) {
306
- return false;
307
- }
308
- }
309
- return true;
310
- }
311
- }, {
312
- key: "nullable",
313
- value: function nullable() {
314
- return new KeyOfSchema(this.schema, this.sourcePath, true);
315
- }
316
- }, {
317
- key: "serialize",
318
- value: function serialize() {
319
- var path = this.sourcePath;
320
- if (!path) {
321
- throw new Error("Cannot serialize keyOf schema with empty selector. TIP: keyOf must be used with a Val Module.");
322
- }
323
- var serializedSchema = this.schema;
324
- if (!serializedSchema) {
325
- throw new Error("Cannot serialize keyOf schema with empty selector.");
326
- }
327
- var values;
328
- switch (serializedSchema.type) {
329
- case "array":
330
- values = "number";
331
- break;
332
- case "record":
333
- values = "string";
334
- break;
335
- case "object":
336
- values = Object.keys(serializedSchema.items);
337
- break;
338
- default:
339
- throw new Error("Cannot serialize keyOf schema with selector of type '".concat(serializedSchema.type, "'. keyOf must be used with a Val Module."));
340
- }
341
- return {
342
- type: "keyOf",
343
- path: path,
344
- schema: serializedSchema,
345
- opt: this.opt,
346
- values: values
347
- };
348
- }
349
- }]);
350
- return KeyOfSchema;
351
- }(Schema);
352
- var keyOf = function keyOf(valModule) {
353
- var _valModule$GetSchema;
354
- return new KeyOfSchema(valModule === null || valModule === void 0 || (_valModule$GetSchema = valModule[GetSchema]) === null || _valModule$GetSchema === void 0 ? void 0 : _valModule$GetSchema.serialize(), getValPath(valModule));
355
- };
356
-
357
- // import type { F } from "ts-toolbelt";
358
- // import { i18n, I18n } from "./schema/future/i18n";
359
- // import { oneOf } from "./schema/future/oneOf";
360
-
361
- // export type InitSchemaLocalized<Locales extends readonly string[]> = {
362
- // readonly i18n: I18n<Locales>;
363
- // };
364
- function initSchema() {
365
- // locales: F.Narrow<Locales>
366
- return {
367
- string: string,
368
- "boolean": _boolean,
369
- array: array,
370
- object: object,
371
- number: number,
372
- union: union,
373
- // oneOf,
374
- richtext: richtext$1,
375
- image: image$1,
376
- literal: literal,
377
- keyOf: keyOf,
378
- record: record,
379
- file: file
380
- // i18n: i18n(locales),
381
- };
382
- }
383
-
384
- // Classes
385
-
386
- /// Paragraph
387
-
388
- /// Break
389
-
390
- /// Span
391
-
392
- /// Image
393
-
394
- /// Link
395
-
396
- /// List
397
-
398
- /// Heading
399
-
400
- /// Root and nodes
401
-
402
- /// Main types
403
-
404
- /**
405
- * RichTextSource is defined in ValModules
406
- **/
407
-
408
- /**
409
- * RichText is accessible by users (after conversion via useVal / fetchVal)
410
- * Internally it is a Selector
411
- **/
412
-
413
- function richtext(templateStrings) {
414
- for (var _len = arguments.length, nodes = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
415
- nodes[_key - 1] = arguments[_key];
416
- }
417
- return _defineProperty(_defineProperty(_defineProperty({}, VAL_EXTENSION, "richtext"), "templateStrings", templateStrings), "exprs", nodes);
418
- }
419
- var RT_IMAGE_TAG = "rt_image";
420
- function image(ref, metadata) {
421
- return _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, FILE_REF_PROP, ref), FILE_REF_SUBTYPE_TAG, RT_IMAGE_TAG), VAL_EXTENSION, "file"), "metadata", metadata);
422
- }
423
-
424
- function link(text, _ref) {
425
- var href = _ref.href;
426
- return _defineProperty(_defineProperty(_defineProperty({}, VAL_EXTENSION, "link"), "href", href), "children", [text]);
427
- }
428
-
429
- /* eslint-disable @typescript-eslint/ban-types */
430
- // import { i18n, I18n } from "./source/future/i18n";
431
- // import { remote } from "./source/future/remote";
432
-
433
- // type NarrowStrings<A> =
434
- // | (A extends [] ? [] : never)
435
- // | (A extends string ? A : never)
436
- // | {
437
- // [K in keyof A]: NarrowStrings<A[K]>;
438
- // };
439
-
440
- // TODO: Rename to createValSystem (only to be used by internal things), we can then export * from '@valbuild/core' in the next package then.
441
- var initVal = function initVal(config) {
442
- // const locales = options?.locales;
443
- var s = initSchema();
444
- // if (locales?.required) {
445
- // console.error("Locales / i18n currently not implemented");
446
- // return {
447
- // val: {
448
- // content,
449
- // i18n,
450
- // remote,
451
- // getPath,
452
- // file,
453
- // richtext,
454
- // },
455
- // s,
456
- // config: {},
457
- // // eslint-disable-next-line @typescript-eslint/no-explicit-any
458
- // } as any;
459
- // }
460
- return {
461
- val: {
462
- getPath: getValPath
463
- },
464
- c: {
465
- define: define,
466
- // remote,
467
- file: file$1,
468
- richtext: richtext,
469
- rt: {
470
- image: image,
471
- link: link
472
- }
473
- },
474
- s: s,
475
- config: config
476
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
477
- };
478
- };
479
-
480
- /**
481
- * Define the set of modules that can be edited using the Val UI.
482
- *
483
- * @example
484
- * import { modules } from "@valbuild/next";
485
- * import { config } from "./val.config";
486
- *
487
- * export default modules(config, [
488
- * { def: () => import("./app/page.val.ts") },
489
- * { def: () => import("./app/another/page.val.ts") },
490
- * ]);
491
- */
492
- function modules(config, modules) {
493
- return {
494
- config: config,
495
- modules: modules
496
- };
497
- }
498
-
499
- function derefPath(path) {
500
- var dereffedPath = [];
501
- var referencedPath = null;
502
- var _iterator = _createForOfIteratorHelper(path),
503
- _step;
504
- try {
505
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
506
- var segment = _step.value;
507
- if (segment.startsWith("$")) {
508
- var dereffedSegment = segment.slice(1);
509
- dereffedPath.push(dereffedSegment);
510
- referencedPath = [];
511
- var _iterator2 = _createForOfIteratorHelper(path.slice(dereffedPath.length)),
512
- _step2;
513
- try {
514
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
515
- var _segment = _step2.value;
516
- if (_segment.startsWith("$")) {
517
- return err(new PatchError("Cannot reference within reference: ".concat(_segment, ". Path: ").concat(path.join("/"))));
518
- }
519
- referencedPath.push(_segment);
520
- }
521
- } catch (err) {
522
- _iterator2.e(err);
523
- } finally {
524
- _iterator2.f();
525
- }
526
- break;
527
- } else {
528
- dereffedPath.push(segment);
529
- }
530
- }
531
- } catch (err) {
532
- _iterator.e(err);
533
- } finally {
534
- _iterator.f();
535
- }
536
- return ok([dereffedPath, referencedPath]);
537
- }
538
- function derefPatch(patch, document, ops) {
539
- var fileUpdates = {};
540
- var dereferencedPatch = [];
541
- var _iterator3 = _createForOfIteratorHelper(patch),
542
- _step3;
543
- try {
544
- for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
545
- var op = _step3.value;
546
- if (op.op === "replace") {
547
- var maybeDerefRes = derefPath(op.path);
548
- if (isErr(maybeDerefRes)) {
549
- return maybeDerefRes;
550
- }
551
- var _maybeDerefRes$value = _slicedToArray(maybeDerefRes.value, 2),
552
- dereffedPath = _maybeDerefRes$value[0],
553
- referencedPath = _maybeDerefRes$value[1];
554
- if (referencedPath) {
555
- var maybeValue = ops.get(document, dereffedPath);
556
- if (isOk(maybeValue)) {
557
- var value = maybeValue.value;
558
- if (isFile(value)) {
559
- if (referencedPath.length > 0) {
560
- return err(new PatchError("Cannot sub-reference file reference at path: ".concat(dereffedPath.join("/"))));
561
- }
562
- if (typeof op.value !== "string") {
563
- return err(new PatchError("Expected base64 encoded string value for file reference, got ".concat(JSON.stringify(op.value))));
564
- }
565
- fileUpdates[value[FILE_REF_PROP]] = op.value;
566
- // } else if (isRemote(value)) {
567
- // if (!remotePatches[value[REMOTE_REF_PROP]]) {
568
- // remotePatches[value[REMOTE_REF_PROP]] = [];
569
- // }
570
- // remotePatches[value[REMOTE_REF_PROP]].push({
571
- // op: "replace",
572
- // path: referencedPath,
573
- // value: op.value,
574
- // });
575
- } else {
576
- return err(new PatchError("Unknown reference: ".concat(JSON.stringify(op), " at path: ").concat(dereffedPath.join("/"))));
577
- }
578
- } else {
579
- return maybeValue;
580
- }
581
- } else {
582
- dereferencedPatch.push(op);
583
- }
584
- } else if (op.op === "file") {
585
- if (!op.filePath.startsWith("/public")) {
586
- return err(new PatchError("Path must start with /public"));
587
- }
588
- if (typeof op.value !== "string") {
589
- return err(new PatchError("File operation must have a value that is typeof string. Found: ".concat(_typeof(op.value))));
590
- }
591
- fileUpdates[op.filePath] = op.value;
592
- } else {
593
- var _maybeDerefRes = derefPath(op.path);
594
- if (isErr(_maybeDerefRes)) {
595
- return _maybeDerefRes;
596
- }
597
- var _maybeDerefRes$value2 = _slicedToArray(_maybeDerefRes.value, 2),
598
- _referencedPath = _maybeDerefRes$value2[1];
599
- if (_referencedPath) {
600
- throw new Error("Unimplemented operation: ".concat(JSON.stringify(op)));
601
- }
602
- dereferencedPatch.push(op);
603
- }
604
- }
605
- } catch (err) {
606
- _iterator3.e(err);
607
- } finally {
608
- _iterator3.f();
609
- }
610
- return ok({
611
- fileUpdates: fileUpdates,
612
- dereferencedPatch: dereferencedPatch
613
- });
614
- }
615
-
616
- function getVal(selector) {
617
- return newValProxy(serializedValOfSelectorSource(selector));
618
- }
619
-
620
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
621
- function isArrayOrArraySelector(child) {
622
- if (isSelector(child)) {
623
- return _typeof(child[GetSource]) === "object" && child[GetSource] !== null && Array.isArray(child[GetSource]);
624
- }
625
- return Array.isArray(child);
626
- }
627
-
628
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
629
- function isObjectOrObjectSelector(child) {
630
- if (isSelector(child)) {
631
- return _typeof(child[GetSource]) === "object" && child[GetSource] !== null && !Array.isArray(child[GetSource]);
632
- }
633
- return _typeof(child) === "object";
634
- }
635
- function serializedValOfSelectorSource(selector) {
636
- var wrappedSelector = newSelectorProxy(selector); // NOTE: we do this if call-site uses a literal with selectors inside
637
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
638
- function rec(child) {
639
- var isArray = isArrayOrArraySelector(child);
640
- var isObject = isObjectOrObjectSelector(child);
641
- if (isArray) {
642
- var array = GetSource in child ? child[GetSource] : child;
643
- var valPath = Path in child ? child[Path] : undefined;
644
- return {
645
- val: array.map(function (item, i) {
646
- return rec(isSelector(item) // NOTE: We do this since selectors currently do not create selectors of items unless specifically required.
647
- ? item : newSelectorProxy(item, createValPathOfItem(valPath, i)));
648
- }),
649
- valPath: valPath
650
- };
651
- } else if (isObject) {
652
- var obj = GetSource in child ? child[GetSource] : child;
653
- var _valPath = Path in child ? child[Path] : undefined;
654
- return {
655
- val: obj !== null && Object.fromEntries(Object.entries(obj).map(function (_ref) {
656
- var _ref2 = _slicedToArray(_ref, 2),
657
- key = _ref2[0],
658
- value = _ref2[1];
659
- return [key, rec(isSelector(value) // NOTE: We do this since selectors currently do not create selectors of items unless specifically required.
660
- ? value : newSelectorProxy(value, createValPathOfItem(_valPath, key)))];
661
- })),
662
- valPath: _valPath
663
- };
664
- } else if (isSelector(child)) {
665
- return {
666
- val: rec(child[GetSource]),
667
- valPath: child[Path]
668
- };
669
- } else {
670
- return child;
671
- }
672
- }
673
- return rec(wrappedSelector);
674
- }
675
- function strip(value) {
676
- var val = isSerializedVal(value) ? value.val : value;
677
- switch (_typeof(val)) {
678
- case "function":
679
- case "symbol":
680
- throw Error("Invalid val type: ".concat(_typeof(val)));
681
- case "object":
682
- if (val === null) {
683
- return null;
684
- } else if (Array.isArray(val)) {
685
- return val.map(strip);
686
- } else {
687
- return Object.fromEntries(Object.entries(val).map(function (_ref3) {
688
- var _ref4 = _slicedToArray(_ref3, 2),
689
- key = _ref4[0],
690
- value = _ref4[1];
691
- return [key, value && strip(value)];
692
- }));
693
- }
694
- // intentional fallthrough
695
- // eslint-disable-next-line no-fallthrough
696
- default:
697
- return val;
698
- }
699
- }
700
- function newValProxy(val) {
701
- var source = val.val;
702
- switch (_typeof(source)) {
703
- case "function":
704
- case "symbol":
705
- throw Error("Invalid val type: ".concat(_typeof(source)));
706
- case "object":
707
- if (source !== null) {
708
- // Handles both objects and arrays!
709
- return new Proxy(source, {
710
- has: function has(target, prop) {
711
- if (prop === "val") {
712
- return true;
713
- }
714
- if (prop === Path) {
715
- return true;
716
- }
717
- return hasOwn(target, prop);
718
- },
719
- get: function get(target, prop) {
720
- if (prop === Path) {
721
- return val.valPath;
722
- }
723
- if (prop === "val") {
724
- return strip(val);
725
- }
726
- if (Array.isArray(target) && prop === "length") {
727
- return target.length;
728
- }
729
- if (hasOwn(source, prop)) {
730
- var _Reflect$get$valPath, _Reflect$get;
731
- return newValProxy({
732
- val: Reflect.get(target, prop).val,
733
- valPath: (_Reflect$get$valPath = (_Reflect$get = Reflect.get(target, prop)) === null || _Reflect$get === void 0 ? void 0 : _Reflect$get.valPath) !== null && _Reflect$get$valPath !== void 0 ? _Reflect$get$valPath : createValPathOfItem(val.valPath, Array.isArray(target) ? Number(prop) : prop)
734
- });
735
- }
736
- return Reflect.get(target, prop);
737
- }
738
- });
739
- }
740
- // intentional fallthrough
741
- // eslint-disable-next-line no-fallthrough
742
- default:
743
- return _defineProperty(_defineProperty({}, Path, val.valPath), "val", val.val);
744
- }
745
- }
746
- function hasOwn(obj, prop) {
747
- return Object.prototype.hasOwnProperty.call(obj, prop);
748
- }
749
-
750
- /**
751
- * From: https://github.com/kawanet/sha256-uint8array/commit/a035f83824c319d01ca1e7559fdcf1632c0cd6c4
752
- *
753
- * LICENSE:
754
- *
755
- * MIT License
756
- * Copyright (c) 2020-2023 Yusuke Kawasaki
757
- *
758
- * Permission is hereby granted, free of charge, to any person obtaining a copy
759
- * of this software and associated documentation files (the "Software"), to deal
760
- * in the Software without restriction, including without limitation the rights
761
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
762
- * copies of the Software, and to permit persons to whom the Software is
763
- * furnished to do so, subject to the following conditions:
764
- *
765
- * The above copyright notice and this permission notice shall be included in all
766
- * copies or substantial portions of the Software.
767
- *
768
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
769
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
770
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
771
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
772
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
773
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
774
- * SOFTWARE.
775
- *
776
- * sha256-uint8array.ts
777
- */
778
-
779
- // first 32 bits of the fractional parts of the cube roots of the first 64 primes 2..311
780
- var K = [0x428a2f98 | 0, 0x71374491 | 0, 0xb5c0fbcf | 0, 0xe9b5dba5 | 0, 0x3956c25b | 0, 0x59f111f1 | 0, 0x923f82a4 | 0, 0xab1c5ed5 | 0, 0xd807aa98 | 0, 0x12835b01 | 0, 0x243185be | 0, 0x550c7dc3 | 0, 0x72be5d74 | 0, 0x80deb1fe | 0, 0x9bdc06a7 | 0, 0xc19bf174 | 0, 0xe49b69c1 | 0, 0xefbe4786 | 0, 0x0fc19dc6 | 0, 0x240ca1cc | 0, 0x2de92c6f | 0, 0x4a7484aa | 0, 0x5cb0a9dc | 0, 0x76f988da | 0, 0x983e5152 | 0, 0xa831c66d | 0, 0xb00327c8 | 0, 0xbf597fc7 | 0, 0xc6e00bf3 | 0, 0xd5a79147 | 0, 0x06ca6351 | 0, 0x14292967 | 0, 0x27b70a85 | 0, 0x2e1b2138 | 0, 0x4d2c6dfc | 0, 0x53380d13 | 0, 0x650a7354 | 0, 0x766a0abb | 0, 0x81c2c92e | 0, 0x92722c85 | 0, 0xa2bfe8a1 | 0, 0xa81a664b | 0, 0xc24b8b70 | 0, 0xc76c51a3 | 0, 0xd192e819 | 0, 0xd6990624 | 0, 0xf40e3585 | 0, 0x106aa070 | 0, 0x19a4c116 | 0, 0x1e376c08 | 0, 0x2748774c | 0, 0x34b0bcb5 | 0, 0x391c0cb3 | 0, 0x4ed8aa4a | 0, 0x5b9cca4f | 0, 0x682e6ff3 | 0, 0x748f82ee | 0, 0x78a5636f | 0, 0x84c87814 | 0, 0x8cc70208 | 0, 0x90befffa | 0, 0xa4506ceb | 0, 0xbef9a3f7 | 0, 0xc67178f2 | 0];
781
- var N = /*#__PURE__*/function (N) {
782
- N[N["inputBytes"] = 64] = "inputBytes";
783
- N[N["inputWords"] = 16] = "inputWords";
784
- N[N["highIndex"] = 14] = "highIndex";
785
- N[N["lowIndex"] = 15] = "lowIndex";
786
- N[N["workWords"] = 64] = "workWords";
787
- N[N["allocBytes"] = 80] = "allocBytes";
788
- N[N["allocWords"] = 20] = "allocWords";
789
- N[N["allocTotal"] = 8000] = "allocTotal";
790
- return N;
791
- }(N || {});
792
- var algorithms = {
793
- sha256: 1
794
- };
795
- function createHash(algorithm) {
796
- if (algorithm && !algorithms[algorithm] && !algorithms[algorithm.toLowerCase()]) {
797
- throw new Error("Digest method not supported");
798
- }
799
- return new Hash();
800
- }
801
- var Hash = /*#__PURE__*/function () {
802
- // surrogate pair
803
-
804
- function Hash() {
805
- _classCallCheck(this, Hash);
806
- // first 32 bits of the fractional parts of the square roots of the first 8 primes 2..19
807
- _defineProperty(this, "A", 0x6a09e667 | 0);
808
- _defineProperty(this, "B", 0xbb67ae85 | 0);
809
- _defineProperty(this, "C", 0x3c6ef372 | 0);
810
- _defineProperty(this, "D", 0xa54ff53a | 0);
811
- _defineProperty(this, "E", 0x510e527f | 0);
812
- _defineProperty(this, "F", 0x9b05688c | 0);
813
- _defineProperty(this, "G", 0x1f83d9ab | 0);
814
- _defineProperty(this, "H", 0x5be0cd19 | 0);
815
- _defineProperty(this, "_size", 0);
816
- _defineProperty(this, "_sp", 0);
817
- if (!sharedBuffer || sharedOffset >= N.allocTotal) {
818
- sharedBuffer = new ArrayBuffer(N.allocTotal);
819
- sharedOffset = 0;
820
- }
821
- this._byte = new Uint8Array(sharedBuffer, sharedOffset, N.allocBytes);
822
- this._word = new Int32Array(sharedBuffer, sharedOffset, N.allocWords);
823
- sharedOffset += N.allocBytes;
824
- }
825
- _createClass(Hash, [{
826
- key: "update",
827
- value: function update(data) {
828
- // data: string
829
- if ("string" === typeof data) {
830
- return this._utf8(data);
831
- }
832
-
833
- // data: undefined
834
- if (data == null) {
835
- throw new TypeError("Invalid type: " + _typeof(data));
836
- }
837
- var byteOffset = data.byteOffset;
838
- var length = data.byteLength;
839
- var blocks = length / N.inputBytes | 0;
840
- var offset = 0;
841
-
842
- // longer than 1 block
843
- if (blocks && !(byteOffset & 3) && !(this._size % N.inputBytes)) {
844
- var block = new Int32Array(data.buffer, byteOffset, blocks * N.inputWords);
845
- while (blocks--) {
846
- this._int32(block, offset >> 2);
847
- offset += N.inputBytes;
848
- }
849
- this._size += offset;
850
- }
851
-
852
- // data: TypedArray | DataView
853
- var BYTES_PER_ELEMENT = data.BYTES_PER_ELEMENT;
854
- if (BYTES_PER_ELEMENT !== 1 && data.buffer) {
855
- var rest = new Uint8Array(data.buffer, byteOffset + offset, length - offset);
856
- return this._uint8(rest);
857
- }
858
-
859
- // no more bytes
860
- if (offset === length) return this;
861
-
862
- // data: Uint8Array | Int8Array
863
- return this._uint8(data, offset);
864
- }
865
- }, {
866
- key: "_uint8",
867
- value: function _uint8(data, offset) {
868
- var _byte = this._byte,
869
- _word = this._word;
870
- var length = data.length;
871
- offset = offset | 0;
872
- while (offset < length) {
873
- var start = this._size % N.inputBytes;
874
- var index = start;
875
- while (offset < length && index < N.inputBytes) {
876
- _byte[index++] = data[offset++];
877
- }
878
- if (index >= N.inputBytes) {
879
- this._int32(_word);
880
- }
881
- this._size += index - start;
882
- }
883
- return this;
884
- }
885
- }, {
886
- key: "_utf8",
887
- value: function _utf8(text) {
888
- var _byte = this._byte,
889
- _word = this._word;
890
- var length = text.length;
891
- var surrogate = this._sp;
892
- for (var offset = 0; offset < length;) {
893
- var start = this._size % N.inputBytes;
894
- var index = start;
895
- while (offset < length && index < N.inputBytes) {
896
- var code = text.charCodeAt(offset++) | 0;
897
- if (code < 0x80) {
898
- // ASCII characters
899
- _byte[index++] = code;
900
- } else if (code < 0x800) {
901
- // 2 bytes
902
- _byte[index++] = 0xc0 | code >>> 6;
903
- _byte[index++] = 0x80 | code & 0x3f;
904
- } else if (code < 0xd800 || code > 0xdfff) {
905
- // 3 bytes
906
- _byte[index++] = 0xe0 | code >>> 12;
907
- _byte[index++] = 0x80 | code >>> 6 & 0x3f;
908
- _byte[index++] = 0x80 | code & 0x3f;
909
- } else if (surrogate) {
910
- // 4 bytes - surrogate pair
911
- code = ((surrogate & 0x3ff) << 10) + (code & 0x3ff) + 0x10000;
912
- _byte[index++] = 0xf0 | code >>> 18;
913
- _byte[index++] = 0x80 | code >>> 12 & 0x3f;
914
- _byte[index++] = 0x80 | code >>> 6 & 0x3f;
915
- _byte[index++] = 0x80 | code & 0x3f;
916
- surrogate = 0;
917
- } else {
918
- surrogate = code;
919
- }
920
- }
921
- if (index >= N.inputBytes) {
922
- this._int32(_word);
923
- _word[0] = _word[N.inputWords];
924
- }
925
- this._size += index - start;
926
- }
927
- this._sp = surrogate;
928
- return this;
929
- }
930
- }, {
931
- key: "_int32",
932
- value: function _int32(data, offset) {
933
- var A = this.A,
934
- B = this.B,
935
- C = this.C,
936
- D = this.D,
937
- E = this.E,
938
- F = this.F,
939
- G = this.G,
940
- H = this.H;
941
- var i = 0;
942
- offset = offset | 0;
943
- while (i < N.inputWords) {
944
- W[i++] = swap32(data[offset++]);
945
- }
946
- for (i = N.inputWords; i < N.workWords; i++) {
947
- W[i] = gamma1(W[i - 2]) + W[i - 7] + gamma0(W[i - 15]) + W[i - 16] | 0;
948
- }
949
- for (i = 0; i < N.workWords; i++) {
950
- var T1 = H + sigma1(E) + ch(E, F, G) + K[i] + W[i] | 0;
951
- var T2 = sigma0(A) + maj(A, B, C) | 0;
952
- H = G;
953
- G = F;
954
- F = E;
955
- E = D + T1 | 0;
956
- D = C;
957
- C = B;
958
- B = A;
959
- A = T1 + T2 | 0;
960
- }
961
- this.A = A + this.A | 0;
962
- this.B = B + this.B | 0;
963
- this.C = C + this.C | 0;
964
- this.D = D + this.D | 0;
965
- this.E = E + this.E | 0;
966
- this.F = F + this.F | 0;
967
- this.G = G + this.G | 0;
968
- this.H = H + this.H | 0;
969
- }
970
- }, {
971
- key: "digest",
972
- value: function digest(encoding) {
973
- var _byte = this._byte,
974
- _word = this._word;
975
- var i = this._size % N.inputBytes | 0;
976
- _byte[i++] = 0x80;
977
-
978
- // pad 0 for current word
979
- while (i & 3) {
980
- _byte[i++] = 0;
981
- }
982
- i >>= 2;
983
- if (i > N.highIndex) {
984
- while (i < N.inputWords) {
985
- _word[i++] = 0;
986
- }
987
- i = 0;
988
- this._int32(_word);
989
- }
990
-
991
- // pad 0 for rest words
992
- while (i < N.inputWords) {
993
- _word[i++] = 0;
994
- }
995
-
996
- // input size
997
- var bits64 = this._size * 8;
998
- var low32 = (bits64 & 0xffffffff) >>> 0;
999
- var high32 = (bits64 - low32) / 0x100000000;
1000
- if (high32) _word[N.highIndex] = swap32(high32);
1001
- if (low32) _word[N.lowIndex] = swap32(low32);
1002
- this._int32(_word);
1003
- return encoding === "hex" ? this._hex() : this._bin();
1004
- }
1005
- }, {
1006
- key: "_hex",
1007
- value: function _hex() {
1008
- var A = this.A,
1009
- B = this.B,
1010
- C = this.C,
1011
- D = this.D,
1012
- E = this.E,
1013
- F = this.F,
1014
- G = this.G,
1015
- H = this.H;
1016
- return hex32(A) + hex32(B) + hex32(C) + hex32(D) + hex32(E) + hex32(F) + hex32(G) + hex32(H);
1017
- }
1018
- }, {
1019
- key: "_bin",
1020
- value: function _bin() {
1021
- var A = this.A,
1022
- B = this.B,
1023
- C = this.C,
1024
- D = this.D,
1025
- E = this.E,
1026
- F = this.F,
1027
- G = this.G,
1028
- H = this.H,
1029
- _byte = this._byte,
1030
- _word = this._word;
1031
- _word[0] = swap32(A);
1032
- _word[1] = swap32(B);
1033
- _word[2] = swap32(C);
1034
- _word[3] = swap32(D);
1035
- _word[4] = swap32(E);
1036
- _word[5] = swap32(F);
1037
- _word[6] = swap32(G);
1038
- _word[7] = swap32(H);
1039
- return _byte.slice(0, 32);
1040
- }
1041
- }]);
1042
- return Hash;
1043
- }();
1044
- var W = new Int32Array(N.workWords);
1045
- var sharedBuffer;
1046
- var sharedOffset = 0;
1047
- var hex32 = function hex32(num) {
1048
- return (num + 0x100000000).toString(16).substr(-8);
1049
- };
1050
- var swapLE = function swapLE(c) {
1051
- return c << 24 & 0xff000000 | c << 8 & 0xff0000 | c >> 8 & 0xff00 | c >> 24 & 0xff;
1052
- };
1053
- var swapBE = function swapBE(c) {
1054
- return c;
1055
- };
1056
- var swap32 = isBE() ? swapBE : swapLE;
1057
- var ch = function ch(x, y, z) {
1058
- return z ^ x & (y ^ z);
1059
- };
1060
- var maj = function maj(x, y, z) {
1061
- return x & y | z & (x | y);
1062
- };
1063
- var sigma0 = function sigma0(x) {
1064
- return (x >>> 2 | x << 30) ^ (x >>> 13 | x << 19) ^ (x >>> 22 | x << 10);
1065
- };
1066
- var sigma1 = function sigma1(x) {
1067
- return (x >>> 6 | x << 26) ^ (x >>> 11 | x << 21) ^ (x >>> 25 | x << 7);
1068
- };
1069
- var gamma0 = function gamma0(x) {
1070
- return (x >>> 7 | x << 25) ^ (x >>> 18 | x << 14) ^ x >>> 3;
1071
- };
1072
- var gamma1 = function gamma1(x) {
1073
- return (x >>> 17 | x << 15) ^ (x >>> 19 | x << 13) ^ x >>> 10;
1074
- };
1075
- function isBE() {
1076
- var buf = new Uint8Array(new Uint16Array([0xfeff]).buffer); // BOM
1077
- return buf[0] === 0xfe;
1078
- }
1079
- var getSHA256Hash = function getSHA256Hash(bits) {
1080
- return createHash().update(bits).digest("hex");
1081
- };
1082
-
1083
- function deserializeSchema(serialized) {
1084
- var _serialized$options;
1085
- switch (serialized.type) {
1086
- case "string":
1087
- return new StringSchema(_objectSpread2(_objectSpread2({}, serialized.options), {}, {
1088
- regexp: ((_serialized$options = serialized.options) === null || _serialized$options === void 0 ? void 0 : _serialized$options.regexp) && new RegExp(serialized.options.regexp.source, serialized.options.regexp.flags)
1089
- }), serialized.opt);
1090
- case "literal":
1091
- return new LiteralSchema(serialized.value, serialized.opt);
1092
- case "boolean":
1093
- return new BooleanSchema(serialized.opt);
1094
- case "number":
1095
- return new NumberSchema(serialized.options, serialized.opt);
1096
- case "object":
1097
- return new ObjectSchema(Object.fromEntries(Object.entries(serialized.items).map(function (_ref) {
1098
- var _ref2 = _slicedToArray(_ref, 2),
1099
- key = _ref2[0],
1100
- item = _ref2[1];
1101
- return [key, deserializeSchema(item)];
1102
- })), serialized.opt);
1103
- case "array":
1104
- return new ArraySchema(deserializeSchema(serialized.item), serialized.opt);
1105
- case "union":
1106
- return new UnionSchema(typeof serialized.key === "string" ? serialized.key : deserializeSchema(serialized.key), serialized.items.map(deserializeSchema), serialized.opt);
1107
- case "richtext":
1108
- return new RichTextSchema(serialized.options, serialized.opt);
1109
- case "record":
1110
- return new RecordSchema(deserializeSchema(serialized.item), serialized.opt);
1111
- case "keyOf":
1112
- return new KeyOfSchema(serialized.schema, serialized.path, serialized.opt);
1113
- case "file":
1114
- return new FileSchema(serialized.options, serialized.opt);
1115
- case "image":
1116
- return new ImageSchema(serialized.options, serialized.opt);
1117
- default:
1118
- {
1119
- var exhaustiveCheck = serialized;
1120
- var unknownSerialized = exhaustiveCheck;
1121
- if (unknownSerialized && _typeof(unknownSerialized) === "object" && "type" in unknownSerialized) {
1122
- throw new Error("Unknown schema type: ".concat(unknownSerialized.type));
1123
- } else {
1124
- throw new Error("Unknown schema: ".concat(JSON.stringify(unknownSerialized, null, 2)));
1125
- }
1126
- }
1127
- }
1128
- }
1129
-
1130
- function _regeneratorRuntime() {
1131
- _regeneratorRuntime = function () {
1132
- return e;
1133
- };
1134
- var t,
1135
- e = {},
1136
- r = Object.prototype,
1137
- n = r.hasOwnProperty,
1138
- o = Object.defineProperty || function (t, e, r) {
1139
- t[e] = r.value;
1140
- },
1141
- i = "function" == typeof Symbol ? Symbol : {},
1142
- a = i.iterator || "@@iterator",
1143
- c = i.asyncIterator || "@@asyncIterator",
1144
- u = i.toStringTag || "@@toStringTag";
1145
- function define(t, e, r) {
1146
- return Object.defineProperty(t, e, {
1147
- value: r,
1148
- enumerable: !0,
1149
- configurable: !0,
1150
- writable: !0
1151
- }), t[e];
1152
- }
1153
- try {
1154
- define({}, "");
1155
- } catch (t) {
1156
- define = function (t, e, r) {
1157
- return t[e] = r;
1158
- };
1159
- }
1160
- function wrap(t, e, r, n) {
1161
- var i = e && e.prototype instanceof Generator ? e : Generator,
1162
- a = Object.create(i.prototype),
1163
- c = new Context(n || []);
1164
- return o(a, "_invoke", {
1165
- value: makeInvokeMethod(t, r, c)
1166
- }), a;
1167
- }
1168
- function tryCatch(t, e, r) {
1169
- try {
1170
- return {
1171
- type: "normal",
1172
- arg: t.call(e, r)
1173
- };
1174
- } catch (t) {
1175
- return {
1176
- type: "throw",
1177
- arg: t
1178
- };
1179
- }
1180
- }
1181
- e.wrap = wrap;
1182
- var h = "suspendedStart",
1183
- l = "suspendedYield",
1184
- f = "executing",
1185
- s = "completed",
1186
- y = {};
1187
- function Generator() {}
1188
- function GeneratorFunction() {}
1189
- function GeneratorFunctionPrototype() {}
1190
- var p = {};
1191
- define(p, a, function () {
1192
- return this;
1193
- });
1194
- var d = Object.getPrototypeOf,
1195
- v = d && d(d(values([])));
1196
- v && v !== r && n.call(v, a) && (p = v);
1197
- var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
1198
- function defineIteratorMethods(t) {
1199
- ["next", "throw", "return"].forEach(function (e) {
1200
- define(t, e, function (t) {
1201
- return this._invoke(e, t);
1202
- });
1203
- });
1204
- }
1205
- function AsyncIterator(t, e) {
1206
- function invoke(r, o, i, a) {
1207
- var c = tryCatch(t[r], t, o);
1208
- if ("throw" !== c.type) {
1209
- var u = c.arg,
1210
- h = u.value;
1211
- return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
1212
- invoke("next", t, i, a);
1213
- }, function (t) {
1214
- invoke("throw", t, i, a);
1215
- }) : e.resolve(h).then(function (t) {
1216
- u.value = t, i(u);
1217
- }, function (t) {
1218
- return invoke("throw", t, i, a);
1219
- });
1220
- }
1221
- a(c.arg);
1222
- }
1223
- var r;
1224
- o(this, "_invoke", {
1225
- value: function (t, n) {
1226
- function callInvokeWithMethodAndArg() {
1227
- return new e(function (e, r) {
1228
- invoke(t, n, e, r);
1229
- });
1230
- }
1231
- return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
1232
- }
1233
- });
1234
- }
1235
- function makeInvokeMethod(e, r, n) {
1236
- var o = h;
1237
- return function (i, a) {
1238
- if (o === f) throw new Error("Generator is already running");
1239
- if (o === s) {
1240
- if ("throw" === i) throw a;
1241
- return {
1242
- value: t,
1243
- done: !0
1244
- };
1245
- }
1246
- for (n.method = i, n.arg = a;;) {
1247
- var c = n.delegate;
1248
- if (c) {
1249
- var u = maybeInvokeDelegate(c, n);
1250
- if (u) {
1251
- if (u === y) continue;
1252
- return u;
1253
- }
1254
- }
1255
- if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
1256
- if (o === h) throw o = s, n.arg;
1257
- n.dispatchException(n.arg);
1258
- } else "return" === n.method && n.abrupt("return", n.arg);
1259
- o = f;
1260
- var p = tryCatch(e, r, n);
1261
- if ("normal" === p.type) {
1262
- if (o = n.done ? s : l, p.arg === y) continue;
1263
- return {
1264
- value: p.arg,
1265
- done: n.done
1266
- };
1267
- }
1268
- "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
1269
- }
1270
- };
1271
- }
1272
- function maybeInvokeDelegate(e, r) {
1273
- var n = r.method,
1274
- o = e.iterator[n];
1275
- if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y;
1276
- var i = tryCatch(o, e.iterator, r.arg);
1277
- if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
1278
- var a = i.arg;
1279
- return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y);
1280
- }
1281
- function pushTryEntry(t) {
1282
- var e = {
1283
- tryLoc: t[0]
1284
- };
1285
- 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
1286
- }
1287
- function resetTryEntry(t) {
1288
- var e = t.completion || {};
1289
- e.type = "normal", delete e.arg, t.completion = e;
1290
- }
1291
- function Context(t) {
1292
- this.tryEntries = [{
1293
- tryLoc: "root"
1294
- }], t.forEach(pushTryEntry, this), this.reset(!0);
1295
- }
1296
- function values(e) {
1297
- if (e || "" === e) {
1298
- var r = e[a];
1299
- if (r) return r.call(e);
1300
- if ("function" == typeof e.next) return e;
1301
- if (!isNaN(e.length)) {
1302
- var o = -1,
1303
- i = function next() {
1304
- for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
1305
- return next.value = t, next.done = !0, next;
1306
- };
1307
- return i.next = i;
1308
- }
1309
- }
1310
- throw new TypeError(typeof e + " is not iterable");
1311
- }
1312
- return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
1313
- value: GeneratorFunctionPrototype,
1314
- configurable: !0
1315
- }), o(GeneratorFunctionPrototype, "constructor", {
1316
- value: GeneratorFunction,
1317
- configurable: !0
1318
- }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
1319
- var e = "function" == typeof t && t.constructor;
1320
- return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
1321
- }, e.mark = function (t) {
1322
- return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
1323
- }, e.awrap = function (t) {
1324
- return {
1325
- __await: t
1326
- };
1327
- }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
1328
- return this;
1329
- }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
1330
- void 0 === i && (i = Promise);
1331
- var a = new AsyncIterator(wrap(t, r, n, o), i);
1332
- return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
1333
- return t.done ? t.value : a.next();
1334
- });
1335
- }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
1336
- return this;
1337
- }), define(g, "toString", function () {
1338
- return "[object Generator]";
1339
- }), e.keys = function (t) {
1340
- var e = Object(t),
1341
- r = [];
1342
- for (var n in e) r.push(n);
1343
- return r.reverse(), function next() {
1344
- for (; r.length;) {
1345
- var t = r.pop();
1346
- if (t in e) return next.value = t, next.done = !1, next;
1347
- }
1348
- return next.done = !0, next;
1349
- };
1350
- }, e.values = values, Context.prototype = {
1351
- constructor: Context,
1352
- reset: function (e) {
1353
- if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
1354
- },
1355
- stop: function () {
1356
- this.done = !0;
1357
- var t = this.tryEntries[0].completion;
1358
- if ("throw" === t.type) throw t.arg;
1359
- return this.rval;
1360
- },
1361
- dispatchException: function (e) {
1362
- if (this.done) throw e;
1363
- var r = this;
1364
- function handle(n, o) {
1365
- return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
1366
- }
1367
- for (var o = this.tryEntries.length - 1; o >= 0; --o) {
1368
- var i = this.tryEntries[o],
1369
- a = i.completion;
1370
- if ("root" === i.tryLoc) return handle("end");
1371
- if (i.tryLoc <= this.prev) {
1372
- var c = n.call(i, "catchLoc"),
1373
- u = n.call(i, "finallyLoc");
1374
- if (c && u) {
1375
- if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
1376
- if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
1377
- } else if (c) {
1378
- if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
1379
- } else {
1380
- if (!u) throw new Error("try statement without catch or finally");
1381
- if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
1382
- }
1383
- }
1384
- }
1385
- },
1386
- abrupt: function (t, e) {
1387
- for (var r = this.tryEntries.length - 1; r >= 0; --r) {
1388
- var o = this.tryEntries[r];
1389
- if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
1390
- var i = o;
1391
- break;
1392
- }
1393
- }
1394
- i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
1395
- var a = i ? i.completion : {};
1396
- return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
1397
- },
1398
- complete: function (t, e) {
1399
- if ("throw" === t.type) throw t.arg;
1400
- return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y;
1401
- },
1402
- finish: function (t) {
1403
- for (var e = this.tryEntries.length - 1; e >= 0; --e) {
1404
- var r = this.tryEntries[e];
1405
- if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
1406
- }
1407
- },
1408
- catch: function (t) {
1409
- for (var e = this.tryEntries.length - 1; e >= 0; --e) {
1410
- var r = this.tryEntries[e];
1411
- if (r.tryLoc === t) {
1412
- var n = r.completion;
1413
- if ("throw" === n.type) {
1414
- var o = n.arg;
1415
- resetTryEntry(r);
1416
- }
1417
- return o;
1418
- }
1419
- }
1420
- throw new Error("illegal catch attempt");
1421
- },
1422
- delegateYield: function (e, r, n) {
1423
- return this.delegate = {
1424
- iterator: values(e),
1425
- resultName: r,
1426
- nextLoc: n
1427
- }, "next" === this.method && (this.arg = t), y;
1428
- }
1429
- }, e;
1430
- }
1431
-
1432
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
1433
- try {
1434
- var info = gen[key](arg);
1435
- var value = info.value;
1436
- } catch (error) {
1437
- reject(error);
1438
- return;
1439
- }
1440
- if (info.done) {
1441
- resolve(value);
1442
- } else {
1443
- Promise.resolve(value).then(_next, _throw);
1444
- }
1445
- }
1446
- function _asyncToGenerator(fn) {
1447
- return function () {
1448
- var self = this,
1449
- args = arguments;
1450
- return new Promise(function (resolve, reject) {
1451
- var gen = fn.apply(self, args);
1452
- function _next(value) {
1453
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
1454
- }
1455
- function _throw(err) {
1456
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
1457
- }
1458
- _next(undefined);
1459
- });
1460
- };
1461
- }
1462
-
1463
- // TODO: move this to internal, only reason this is here is that react, ui and server all depend on it
1464
- var ValApi = /*#__PURE__*/function () {
1465
- function ValApi(host) {
1466
- _classCallCheck(this, ValApi);
1467
- this.host = host;
1468
- }
1469
- _createClass(ValApi, [{
1470
- key: "getDisableUrl",
1471
- value: function getDisableUrl(redirectTo) {
1472
- return "".concat(this.host, "/disable?redirect_to=").concat(encodeURIComponent(redirectTo));
1473
- }
1474
- }, {
1475
- key: "getLoginUrl",
1476
- value: function getLoginUrl(redirectTo) {
1477
- return "".concat(this.host, "/authorize?redirect_to=").concat(encodeURIComponent(redirectTo));
1478
- }
1479
- }, {
1480
- key: "getEnableUrl",
1481
- value: function getEnableUrl(redirectTo) {
1482
- return "".concat(this.host, "/enable?redirect_to=").concat(encodeURIComponent(redirectTo));
1483
- }
1484
- }, {
1485
- key: "getPatches",
1486
- value: function () {
1487
- var _getPatches = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
1488
- var patchIds, headers, patchIdsParam;
1489
- return _regeneratorRuntime().wrap(function _callee$(_context) {
1490
- while (1) switch (_context.prev = _context.next) {
1491
- case 0:
1492
- patchIds = _ref.patchIds, headers = _ref.headers;
1493
- patchIdsParam = patchIds ? "?".concat(patchIds.map(function (id) {
1494
- return "".concat(id, "=").concat(encodeURIComponent(id));
1495
- }).join("&")) : "";
1496
- return _context.abrupt("return", fetch("".concat(this.host, "/patches/~").concat(patchIdsParam), {
1497
- headers: headers || {
1498
- "Content-Type": "application/json"
1499
- }
1500
- }).then(function (res) {
1501
- return parse(res);
1502
- })["catch"](createError));
1503
- case 3:
1504
- case "end":
1505
- return _context.stop();
1506
- }
1507
- }, _callee, this);
1508
- }));
1509
- function getPatches(_x) {
1510
- return _getPatches.apply(this, arguments);
1511
- }
1512
- return getPatches;
1513
- }()
1514
- }, {
1515
- key: "deletePatches",
1516
- value: function () {
1517
- var _deletePatches = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(ids, headers) {
1518
- var params;
1519
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
1520
- while (1) switch (_context2.prev = _context2.next) {
1521
- case 0:
1522
- params = new URLSearchParams();
1523
- ids.forEach(function (id) {
1524
- return params.append("id", id);
1525
- });
1526
- return _context2.abrupt("return", fetch("".concat(this.host, "/patches/~?").concat(params), {
1527
- method: "DELETE",
1528
- headers: headers || {
1529
- "Content-Type": "application/json"
1530
- }
1531
- }).then(function (res) {
1532
- return parse(res);
1533
- })["catch"](createError));
1534
- case 3:
1535
- case "end":
1536
- return _context2.stop();
1537
- }
1538
- }, _callee2, this);
1539
- }));
1540
- function deletePatches(_x2, _x3) {
1541
- return _deletePatches.apply(this, arguments);
1542
- }
1543
- return deletePatches;
1544
- }()
1545
- }, {
1546
- key: "getEditUrl",
1547
- value: function getEditUrl() {
1548
- return "/val";
1549
- }
1550
- }, {
1551
- key: "postPatches",
1552
- value: function postPatches(moduleId, patches, headers) {
1553
- return fetch("".concat(this.host, "/patches/~"), {
1554
- headers: headers || {
1555
- "Content-Type": "application/json"
1556
- },
1557
- method: "POST",
1558
- body: JSON.stringify(_defineProperty({}, moduleId, patches))
1559
- }).then( /*#__PURE__*/function () {
1560
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(res) {
1561
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
1562
- while (1) switch (_context3.prev = _context3.next) {
1563
- case 0:
1564
- return _context3.abrupt("return", parse(res));
1565
- case 1:
1566
- case "end":
1567
- return _context3.stop();
1568
- }
1569
- }, _callee3);
1570
- }));
1571
- return function (_x4) {
1572
- return _ref2.apply(this, arguments);
1573
- };
1574
- }())["catch"](createError);
1575
- }
1576
- }, {
1577
- key: "getSession",
1578
- value: function getSession() {
1579
- return fetch("".concat(this.host, "/session")).then(function (res) {
1580
- return parse(res)["catch"](createError);
1581
- });
1582
- }
1583
- }, {
1584
- key: "getTree",
1585
- value: function getTree(_ref3) {
1586
- var _ref3$patch = _ref3.patch,
1587
- patch = _ref3$patch === void 0 ? false : _ref3$patch,
1588
- _ref3$includeSchema = _ref3.includeSchema,
1589
- includeSchema = _ref3$includeSchema === void 0 ? false : _ref3$includeSchema,
1590
- _ref3$includeSource = _ref3.includeSource,
1591
- includeSource = _ref3$includeSource === void 0 ? false : _ref3$includeSource,
1592
- _ref3$treePath = _ref3.treePath,
1593
- treePath = _ref3$treePath === void 0 ? "/" : _ref3$treePath,
1594
- headers = _ref3.headers;
1595
- var params = new URLSearchParams();
1596
- params.set("patch", patch.toString());
1597
- params.set("schema", includeSchema.toString());
1598
- params.set("source", includeSource.toString());
1599
- return fetch("".concat(this.host, "/tree/~").concat(treePath, "?").concat(params.toString()), {
1600
- headers: headers
1601
- }).then(function (res) {
1602
- return parse(res);
1603
- })["catch"](createError);
1604
- }
1605
- }, {
1606
- key: "postCommit",
1607
- value: function postCommit(_ref4) {
1608
- var patches = _ref4.patches,
1609
- headers = _ref4.headers;
1610
- return fetch("".concat(this.host, "/commit"), {
1611
- method: "POST",
1612
- body: JSON.stringify({
1613
- patches: patches
1614
- }),
1615
- headers: headers || {
1616
- "Content-Type": "application/json"
1617
- }
1618
- }).then( /*#__PURE__*/function () {
1619
- var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(res) {
1620
- var jsonRes;
1621
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
1622
- while (1) switch (_context4.prev = _context4.next) {
1623
- case 0:
1624
- if (!res.ok) {
1625
- _context4.next = 4;
1626
- break;
1627
- }
1628
- return _context4.abrupt("return", parse(res));
1629
- case 4:
1630
- if (!(res.status === 400 && res.headers.get("content-type") === "application/json")) {
1631
- _context4.next = 13;
1632
- break;
1633
- }
1634
- _context4.next = 7;
1635
- return res.json();
1636
- case 7:
1637
- jsonRes = _context4.sent;
1638
- if (!("validationErrors" in jsonRes)) {
1639
- _context4.next = 12;
1640
- break;
1641
- }
1642
- return _context4.abrupt("return", err(jsonRes));
1643
- case 12:
1644
- return _context4.abrupt("return", formatError(res.status, jsonRes, res.statusText));
1645
- case 13:
1646
- return _context4.abrupt("return", parse(res));
1647
- case 14:
1648
- case "end":
1649
- return _context4.stop();
1650
- }
1651
- }, _callee4);
1652
- }));
1653
- return function (_x5) {
1654
- return _ref5.apply(this, arguments);
1655
- };
1656
- }())["catch"](createError);
1657
- }
1658
- }, {
1659
- key: "postValidate",
1660
- value: function postValidate(_ref6) {
1661
- var patches = _ref6.patches,
1662
- headers = _ref6.headers;
1663
- return fetch("".concat(this.host, "/validate"), {
1664
- method: "POST",
1665
- body: JSON.stringify({
1666
- patches: patches
1667
- }),
1668
- headers: headers || {
1669
- "Content-Type": "application/json"
1670
- }
1671
- }).then( /*#__PURE__*/function () {
1672
- var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(res) {
1673
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
1674
- while (1) switch (_context5.prev = _context5.next) {
1675
- case 0:
1676
- return _context5.abrupt("return", parse(res));
1677
- case 1:
1678
- case "end":
1679
- return _context5.stop();
1680
- }
1681
- }, _callee5);
1682
- }));
1683
- return function (_x6) {
1684
- return _ref7.apply(this, arguments);
1685
- };
1686
- }())["catch"](createError);
1687
- }
1688
- }]);
1689
- return ValApi;
1690
- }();
1691
- function createError(err$1) {
1692
- return err({
1693
- statusCode: 500,
1694
- message: err$1 instanceof Error ? err$1.message : _typeof(err$1) === "object" && err$1 && "message" in err$1 && typeof err$1.message === "string" ? err$1.message : "Unknown error",
1695
- details: _typeof(err$1) === "object" && err$1 && "details" in err$1 ? err$1.details : undefined
1696
- });
1697
- }
1698
-
1699
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1700
- function formatError(status, json, statusText) {
1701
- return err({
1702
- statusCode: status,
1703
- message: json.message || statusText,
1704
- details: json.details || Object.fromEntries(Object.entries(json).filter(function (_ref8) {
1705
- var _ref9 = _slicedToArray(_ref8, 1),
1706
- key = _ref9[0];
1707
- return key !== "message";
1708
- }))
1709
- });
1710
- }
1711
-
1712
- // TODO: validate
1713
- function parse(_x7) {
1714
- return _parse.apply(this, arguments);
1715
- }
1716
- function _parse() {
1717
- _parse = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(res) {
1718
- var json;
1719
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
1720
- while (1) switch (_context6.prev = _context6.next) {
1721
- case 0:
1722
- _context6.prev = 0;
1723
- if (!res.ok) {
1724
- _context6.next = 9;
1725
- break;
1726
- }
1727
- _context6.t0 = result;
1728
- _context6.next = 5;
1729
- return res.json();
1730
- case 5:
1731
- _context6.t1 = _context6.sent;
1732
- return _context6.abrupt("return", _context6.t0.ok.call(_context6.t0, _context6.t1));
1733
- case 9:
1734
- _context6.prev = 9;
1735
- _context6.next = 12;
1736
- return res.json();
1737
- case 12:
1738
- json = _context6.sent;
1739
- return _context6.abrupt("return", formatError(res.status, json, res.statusText));
1740
- case 16:
1741
- _context6.prev = 16;
1742
- _context6.t2 = _context6["catch"](9);
1743
- return _context6.abrupt("return", err({
1744
- statusCode: res.status,
1745
- message: res.statusText
1746
- }));
1747
- case 19:
1748
- _context6.next = 24;
1749
- break;
1750
- case 21:
1751
- _context6.prev = 21;
1752
- _context6.t3 = _context6["catch"](0);
1753
- return _context6.abrupt("return", err({
1754
- message: _context6.t3 instanceof Error ? _context6.t3.message : "Unknown error"
1755
- }));
1756
- case 24:
1757
- case "end":
1758
- return _context6.stop();
1759
- }
1760
- }, _callee6, null, [[0, 21], [9, 16]]);
1761
- }));
1762
- return _parse.apply(this, arguments);
1763
- }
1764
-
1765
- var FATAL_ERROR_TYPES = ["no-schema", "no-source", "invalid-id", "no-module", "invalid-patch"];
1766
- var Internal = {
1767
- VERSION: {
1768
- core: function () {
1769
- try {
1770
- // eslint-disable-next-line @typescript-eslint/no-var-requires
1771
- return require("../package.json").version;
1772
- } catch (_unused) {
1773
- return null;
1774
- }
1775
- }()
1776
- },
1777
- convertFileSource: convertFileSource,
1778
- getSchema: getSchema,
1779
- getValPath: getValPath,
1780
- getVal: getVal,
1781
- getSource: getSource,
1782
- resolvePath: resolvePath,
1783
- splitModuleIdAndModulePath: splitModuleIdAndModulePath,
1784
- isVal: isVal,
1785
- createValPathOfItem: createValPathOfItem,
1786
- getSHA256Hash: getSHA256Hash,
1787
- initSchema: initSchema,
1788
- notFileOp: function notFileOp(op) {
1789
- return op.op !== "file";
1790
- },
1791
- isFileOp: function isFileOp(op) {
1792
- return op.op === "file" && typeof op.filePath === "string";
1793
- },
1794
- createPatchJSONPath: function createPatchJSONPath(modulePath) {
1795
- return "/".concat(modulePath.split(".").map(function (segment) {
1796
- return segment && tryJsonParse(segment);
1797
- }).join("/"));
1798
- },
1799
- createPatchPath: function createPatchPath(modulePath) {
1800
- return parsePath(modulePath);
1801
- },
1802
- patchPathToModulePath: function patchPathToModulePath(patchPath) {
1803
- return patchPath.map(function (segment) {
1804
- // TODO: I am worried that something is lost here: what if the segment is a string that happens to be a parsable as a number? We could make those keys illegal?
1805
- if (Number.isInteger(Number(segment))) {
1806
- return segment;
1807
- }
1808
- return JSON.stringify(segment);
1809
- }).join(".");
1810
- },
1811
- VAL_ENABLE_COOKIE_NAME: "val_enable",
1812
- VAL_STATE_COOKIE: "val_state",
1813
- VAL_SESSION_COOKIE: "val_session"
1814
- };
1815
- function tryJsonParse(str) {
1816
- try {
1817
- return JSON.parse(str);
1818
- } catch (err) {
1819
- return str;
1820
- }
1821
- }
1822
-
1823
- export { BooleanSchema, FATAL_ERROR_TYPES, Internal, NumberSchema, RT_IMAGE_TAG, StringSchema, ValApi, derefPatch, deserializeSchema, initVal, modules };
1
+ export { A as ArraySchema, B as BooleanSchema, F as FATAL_ERROR_TYPES, k as FILE_REF_PROP, l as FILE_REF_SUBTYPE_TAG, u as FileSchema, G as GenericSelector, t as ImageSchema, I as Internal, L as LiteralSchema, r as NumberSchema, O as ObjectSchema, R as RT_IMAGE_TAG, o as RecordSchema, v as RichTextSchema, j as Schema, q as StringSchema, U as UnionSchema, V as VAL_EXTENSION, x as ValApi, n as derefPatch, w as deserializeSchema, i as expr, h as initVal, m as modules } from './index-316f5dd8.esm.js';
2
+ import './result-a8316efa.esm.js';