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