@valbuild/core 0.16.0 → 0.18.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.
Files changed (104) hide show
  1. package/ROADMAP.md +106 -0
  2. package/dist/declarations/src/ValApi.d.ts +26 -0
  3. package/dist/declarations/src/expr/eval.d.ts +1 -1
  4. package/dist/declarations/src/future/fetchVal.d.ts +5 -0
  5. package/dist/declarations/src/index.d.ts +36 -9
  6. package/dist/declarations/src/initSchema.d.ts +8 -10
  7. package/dist/declarations/src/initVal.d.ts +3 -21
  8. package/dist/declarations/src/module.d.ts +2 -14
  9. package/dist/declarations/src/schema/image.d.ts +1 -1
  10. package/dist/declarations/src/schema/index.d.ts +3 -5
  11. package/dist/declarations/src/schema/keyOf.d.ts +23 -0
  12. package/dist/declarations/src/schema/record.d.ts +19 -0
  13. package/dist/declarations/src/schema/union.d.ts +1 -0
  14. package/dist/declarations/src/selector/SelectorProxy.d.ts +7 -0
  15. package/dist/declarations/src/selector/array.d.ts +2 -13
  16. package/dist/declarations/src/selector/file.d.ts +1 -4
  17. package/dist/declarations/src/selector/future/array.d.ts +17 -0
  18. package/dist/declarations/src/selector/future/boolean.d.ts +2 -0
  19. package/dist/declarations/src/selector/future/file.d.ts +9 -0
  20. package/dist/declarations/src/selector/{i18n.d.ts → future/i18n.d.ts} +2 -2
  21. package/dist/declarations/src/selector/future/index.d.ts +81 -0
  22. package/dist/declarations/src/selector/future/number.d.ts +2 -0
  23. package/dist/declarations/src/selector/future/object.d.ts +10 -0
  24. package/dist/declarations/src/selector/future/primitive.d.ts +9 -0
  25. package/dist/declarations/src/selector/{remote.d.ts → future/remote.d.ts} +1 -1
  26. package/dist/declarations/src/selector/future/string.d.ts +2 -0
  27. package/dist/declarations/src/selector/index.d.ts +5 -32
  28. package/dist/declarations/src/selector/object.d.ts +2 -9
  29. package/dist/declarations/src/selector/primitive.d.ts +3 -9
  30. package/dist/declarations/src/source/{i18n.d.ts → future/i18n.d.ts} +2 -2
  31. package/dist/declarations/src/source/{remote.d.ts → future/remote.d.ts} +3 -3
  32. package/dist/declarations/src/source/index.d.ts +4 -3
  33. package/dist/declarations/src/val/index.d.ts +2 -2
  34. package/dist/{index-2fff5ca8.cjs.dev.js → index-486c7fbf.cjs.dev.js} +242 -54
  35. package/dist/{index-af761363.esm.js → index-4abf3a1f.esm.js} +189 -1
  36. package/dist/{index-cac9ecbd.cjs.prod.js → index-601a7d73.cjs.prod.js} +242 -54
  37. package/dist/{SelectorProxy-2af1b2b8.cjs.prod.js → index-8706c87e.cjs.prod.js} +25 -199
  38. package/dist/{SelectorProxy-873782a5.cjs.dev.js → index-a6e642dd.cjs.dev.js} +25 -199
  39. package/dist/{SelectorProxy-63c2d0e2.esm.js → index-a9235737.esm.js} +23 -195
  40. package/dist/{ops-1b6e0e35.cjs.prod.js → ops-0d09f8ee.cjs.prod.js} +258 -126
  41. package/dist/{ops-74661336.esm.js → ops-a2a295f8.esm.js} +195 -65
  42. package/dist/{ops-ea4827fc.cjs.dev.js → ops-f3015423.cjs.dev.js} +258 -126
  43. package/dist/valbuild-core.cjs.dev.js +784 -197
  44. package/dist/valbuild-core.cjs.prod.js +784 -197
  45. package/dist/valbuild-core.esm.js +719 -133
  46. package/expr/dist/valbuild-core-expr.cjs.dev.js +8 -8
  47. package/expr/dist/valbuild-core-expr.cjs.prod.js +8 -8
  48. package/expr/dist/valbuild-core-expr.esm.js +2 -2
  49. package/package.json +2 -3
  50. package/patch/dist/valbuild-core-patch.cjs.dev.js +24 -24
  51. package/patch/dist/valbuild-core-patch.cjs.prod.js +24 -24
  52. package/patch/dist/valbuild-core-patch.esm.js +3 -3
  53. package/src/ValApi.ts +85 -0
  54. package/src/expr/eval.test.ts +2 -2
  55. package/src/expr/eval.ts +2 -2
  56. package/src/{fetchVal.test.ts → future/fetchVal.test.ts} +57 -57
  57. package/src/{fetchVal.ts → future/fetchVal.ts} +17 -22
  58. package/src/index.ts +46 -14
  59. package/src/initSchema.ts +17 -12
  60. package/src/initVal.ts +42 -52
  61. package/src/module.test.ts +40 -40
  62. package/src/module.ts +53 -43
  63. package/src/patch/deref.test.ts +1 -1
  64. package/src/patch/deref.ts +1 -1
  65. package/src/patch/json.test.ts +0 -1
  66. package/src/schema/{i18n.ts → future/i18n.ts} +12 -10
  67. package/src/schema/{oneOf.ts → future/oneOf.ts} +19 -17
  68. package/src/schema/image.ts +1 -1
  69. package/src/schema/index.ts +16 -13
  70. package/src/schema/keyOf.ts +167 -0
  71. package/src/schema/record.ts +103 -0
  72. package/src/schema/union.ts +1 -1
  73. package/src/schema/validation.test.ts +195 -130
  74. package/src/selector/SelectorProxy.ts +15 -15
  75. package/src/selector/array.ts +2 -26
  76. package/src/selector/file.ts +1 -9
  77. package/src/selector/{ExprProxy.test.ts → future/ExprProxy.test.ts} +2 -2
  78. package/src/selector/{ExprProxy.ts → future/ExprProxy.ts} +9 -2
  79. package/src/selector/{SelectorProxy.test.ts → future/SelectorProxy.test.ts} +4 -4
  80. package/src/selector/future/SelectorProxy.ts +238 -0
  81. package/src/selector/future/array.ts +37 -0
  82. package/src/selector/future/boolean.ts +4 -0
  83. package/src/selector/future/file.ts +14 -0
  84. package/src/selector/{i18n.ts → future/i18n.ts} +2 -2
  85. package/src/selector/future/index.ts +165 -0
  86. package/src/selector/future/number.ts +4 -0
  87. package/src/selector/future/object.ts +22 -0
  88. package/src/selector/future/primitive.ts +17 -0
  89. package/src/selector/{remote.ts → future/remote.ts} +1 -1
  90. package/src/selector/{selector.test.ts → future/selector.test.ts} +8 -28
  91. package/src/selector/{selectorOf.ts → future/selectorOf.ts} +1 -1
  92. package/src/selector/future/string.ts +4 -0
  93. package/src/selector/index.ts +4 -46
  94. package/src/selector/object.ts +2 -19
  95. package/src/selector/primitive.ts +3 -16
  96. package/src/source/{i18n.ts → future/i18n.ts} +2 -2
  97. package/src/source/{remote.ts → future/remote.ts} +3 -3
  98. package/src/source/index.ts +3 -2
  99. package/src/val/array.ts +1 -1
  100. package/src/val/index.ts +2 -2
  101. package/src/val/object.ts +1 -1
  102. package/dist/declarations/src/fetchVal.d.ts +0 -5
  103. package/dist/declarations/src/schema/i18n.d.ts +0 -22
  104. package/dist/declarations/src/schema/oneOf.d.ts +0 -23
@@ -1,74 +1,8 @@
1
- import { _ as _inherits, a as _createSuper, b as _classCallCheck, c as _createClass, g as getValPath, S as Schema, d as _objectSpread2, e as _defineProperty, V as VAL_EXTENSION, f as _typeof, i as image, h as file, j as _slicedToArray, k as isFile, F as FILE_REF_PROP, n as newSelectorProxy, P as Path, l as createValPathOfItem, m as SourceOrExpr, o as isSelector, p as isSerializedVal, q as convertImageSource, r as getSchema, s as isVal } from './SelectorProxy-63c2d0e2.esm.js';
2
- export { F as FILE_REF_PROP, G as GenericSelector, S as Schema, V as VAL_EXTENSION } from './SelectorProxy-63c2d0e2.esm.js';
3
- import { a as array, o as object, u as union, r as richtext$1, i as i18n$1, c as content, P as PatchError, g as getRawSource, b as resolvePath, s as splitModuleIdAndModulePath } from './ops-74661336.esm.js';
4
- export { i as expr } from './index-af761363.esm.js';
5
- import { _ as _createForOfIteratorHelper, i as isErr, a as isOk, e as err, o as ok } from './result-b96df128.esm.js';
6
-
7
- var OneOfSchema = /*#__PURE__*/function (_Schema) {
8
- _inherits(OneOfSchema, _Schema);
9
- var _super = _createSuper(OneOfSchema);
10
- function OneOfSchema(selector) {
11
- var _this;
12
- var opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
13
- _classCallCheck(this, OneOfSchema);
14
- _this = _super.call(this);
15
- _this.selector = selector;
16
- _this.opt = opt;
17
- return _this;
18
- }
19
- _createClass(OneOfSchema, [{
20
- key: "validate",
21
- value: function validate(path, src) {
22
- throw new Error("Method not implemented.");
23
- }
24
- }, {
25
- key: "assert",
26
- value: function assert(src) {
27
- throw new Error("Method not implemented.");
28
- }
29
- }, {
30
- key: "optional",
31
- value: function optional() {
32
- return new OneOfSchema(this.selector, true);
33
- }
34
- }, {
35
- key: "serialize",
36
- value: function serialize() {
37
- var path = getValPath(this.selector);
38
- if (!path) {
39
- throw new Error("Cannot serialize oneOf schema with empty selector. Make sure a Val module is used.");
40
- }
41
- return {
42
- type: "oneOf",
43
- selector: path,
44
- opt: this.opt
45
- };
46
- }
47
- }]);
48
- return OneOfSchema;
49
- }(Schema);
50
- var oneOf = function oneOf(valModule) {
51
- return new OneOfSchema(valModule);
52
- };
53
-
54
- /**
55
- * I18n sources cannot have nested remote sources.
56
- */
57
-
58
- /**
59
- * An i18n source is a map of locales to sources.
60
- *
61
- * Its selector will default to the underlying source. It is possible to call `.all` on i18n sources, which returns an object with all the locales
62
- *
63
- */
64
-
65
- function i18n(
66
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
67
- locales) {
68
- return function (source) {
69
- return _objectSpread2(_objectSpread2({}, source), {}, _defineProperty({}, VAL_EXTENSION, "i18n"));
70
- };
71
- }
1
+ import { _ as _inherits, a as _createSuper, b as _classCallCheck, c as _createClass, d as _defineProperty, e as _typeof, S as Schema, G as GetSchema, g as getValPath, f as _slicedToArray, h as _objectSpread2, i as image, V as VAL_EXTENSION, j as file, k as isFile, F as FILE_REF_PROP, P as Path, l as GetSource, m as isSerializedVal, n as convertFileSource, o as getSchema, p as isVal } from './index-a9235737.esm.js';
2
+ export { F as FILE_REF_PROP, q as GenericSelector, S as Schema, V as VAL_EXTENSION } from './index-a9235737.esm.js';
3
+ import { c as createValPathOfItem, a as array, o as object, u as union, r as richtext$1, b as content, P as PatchError, n as newSelectorProxy, i as isSelector, g as getSource, d as resolvePath, s as splitModuleIdAndModulePath } from './ops-a2a295f8.esm.js';
4
+ export { i as expr } from './index-4abf3a1f.esm.js';
5
+ import { _ as _createForOfIteratorHelper, i as isErr, a as isOk, e as err, o as ok, r as result } from './result-b96df128.esm.js';
72
6
 
73
7
  var NumberSchema = /*#__PURE__*/function (_Schema) {
74
8
  _inherits(NumberSchema, _Schema);
@@ -294,7 +228,212 @@ var literal = function literal(value) {
294
228
  return new LiteralSchema(value);
295
229
  };
296
230
 
297
- function initSchema(locales) {
231
+ var KeyOfSchema = /*#__PURE__*/function (_Schema) {
232
+ _inherits(KeyOfSchema, _Schema);
233
+ var _super = _createSuper(KeyOfSchema);
234
+ function KeyOfSchema(selector) {
235
+ var _this;
236
+ var opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
237
+ _classCallCheck(this, KeyOfSchema);
238
+ _this = _super.call(this);
239
+ _this.selector = selector;
240
+ _this.opt = opt;
241
+ return _this;
242
+ }
243
+ _createClass(KeyOfSchema, [{
244
+ key: "validate",
245
+ value: function validate(path, src) {
246
+ if (this.opt && (src === null || src === undefined)) {
247
+ return false;
248
+ }
249
+ var schema = this.selector[GetSchema];
250
+ if (!schema) {
251
+ return _defineProperty({}, path, [{
252
+ message: "Schema not found for module. keyOf must be used with a Val Module"
253
+ }]);
254
+ }
255
+ var serializedSchema = schema.serialize();
256
+ if (!(serializedSchema.type === "array" || serializedSchema.type === "object" || serializedSchema.type === "record")) {
257
+ return _defineProperty({}, path, [{
258
+ message: "Schema in keyOf must be an 'array', 'object' or 'record'. Found '".concat(serializedSchema.type, "'")
259
+ }]);
260
+ }
261
+ if (serializedSchema.opt && (src === null || src === undefined)) {
262
+ return false;
263
+ }
264
+ if (serializedSchema.type === "array" && typeof src !== "number") {
265
+ return _defineProperty({}, path, [{
266
+ message: "Type of value in keyof (array) must be 'number'"
267
+ }]);
268
+ }
269
+ if (serializedSchema.type === "record" && typeof src !== "string") {
270
+ return _defineProperty({}, path, [{
271
+ message: "Type of value in keyof (record) must be 'string'"
272
+ }]);
273
+ }
274
+ if (serializedSchema.type === "object") {
275
+ var keys = Object.keys(serializedSchema.items);
276
+ if (!keys.includes(src)) {
277
+ return _defineProperty({}, path, [{
278
+ message: "Value of keyOf (object) must be: ".concat(keys.join(", "), ". Found: ").concat(src)
279
+ }]);
280
+ }
281
+ }
282
+ return false;
283
+ }
284
+ }, {
285
+ key: "assert",
286
+ value: function assert(src) {
287
+ if (this.opt && (src === null || src === undefined)) {
288
+ return true;
289
+ }
290
+ var schema = this.selector[GetSchema];
291
+ if (!schema) {
292
+ return false;
293
+ }
294
+ var serializedSchema = schema.serialize();
295
+ if (!(serializedSchema.type === "array" || serializedSchema.type === "object" || serializedSchema.type === "record")) {
296
+ return false;
297
+ }
298
+ if (serializedSchema.opt && (src === null || src === undefined)) {
299
+ return true;
300
+ }
301
+ if (serializedSchema.type === "array" && typeof src !== "number") {
302
+ return false;
303
+ }
304
+ if (serializedSchema.type === "record" && typeof src !== "string") {
305
+ return false;
306
+ }
307
+ if (serializedSchema.type === "object") {
308
+ var keys = Object.keys(serializedSchema.items);
309
+ if (!keys.includes(src)) {
310
+ return false;
311
+ }
312
+ }
313
+ return true;
314
+ }
315
+ }, {
316
+ key: "optional",
317
+ value: function optional() {
318
+ return new KeyOfSchema(this.selector, true);
319
+ }
320
+ }, {
321
+ key: "serialize",
322
+ value: function serialize() {
323
+ var path = getValPath(this.selector);
324
+ if (!path) {
325
+ throw new Error("Cannot serialize oneOf schema with empty selector. keyOf must be used with a Val Module.");
326
+ }
327
+ return {
328
+ type: "keyOf",
329
+ selector: path,
330
+ opt: this.opt
331
+ };
332
+ }
333
+ }]);
334
+ return KeyOfSchema;
335
+ }(Schema);
336
+ var keyOf = function keyOf(valModule) {
337
+ return new KeyOfSchema(valModule);
338
+ };
339
+
340
+ var RecordSchema = /*#__PURE__*/function (_Schema) {
341
+ _inherits(RecordSchema, _Schema);
342
+ var _super = _createSuper(RecordSchema);
343
+ function RecordSchema(item) {
344
+ var _this;
345
+ var opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
346
+ _classCallCheck(this, RecordSchema);
347
+ _this = _super.call(this);
348
+ _this.item = item;
349
+ _this.opt = opt;
350
+ return _this;
351
+ }
352
+ _createClass(RecordSchema, [{
353
+ key: "validate",
354
+ value: function validate(path, src) {
355
+ var _this2 = this;
356
+ var error = false;
357
+ if (this.opt && (src === null || src === undefined)) {
358
+ return false;
359
+ }
360
+ if (_typeof(src) !== "object") {
361
+ return _defineProperty({}, path, [{
362
+ message: "Expected 'object', got '".concat(_typeof(src), "'")
363
+ }]);
364
+ }
365
+ if (Array.isArray(src)) {
366
+ return _defineProperty({}, path, [{
367
+ message: "Expected 'object', got 'array'"
368
+ }]);
369
+ }
370
+ Object.entries(src).forEach(function (_ref3) {
371
+ var _ref4 = _slicedToArray(_ref3, 2),
372
+ key = _ref4[0],
373
+ elem = _ref4[1];
374
+ var subPath = createValPathOfItem(path, key);
375
+ if (!subPath) {
376
+ error = _this2.appendValidationError(error, path, "Internal error: could not create path at ".concat(!path && typeof path === "string" ? "<empty string>" : path, " at key ").concat(elem),
377
+ // Should! never happen
378
+ src);
379
+ } else {
380
+ var subError = _this2.item.validate(subPath, elem);
381
+ if (subError && error) {
382
+ error = _objectSpread2(_objectSpread2({}, subError), error);
383
+ } else if (subError) {
384
+ error = subError;
385
+ }
386
+ }
387
+ });
388
+ return error;
389
+ }
390
+ }, {
391
+ key: "assert",
392
+ value: function assert(src) {
393
+ if (this.opt && (src === null || src === undefined)) {
394
+ return true;
395
+ }
396
+ if (!src) {
397
+ return false;
398
+ }
399
+ for (var _i = 0, _Object$entries = Object.entries(src); _i < _Object$entries.length; _i++) {
400
+ var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
401
+ _item = _Object$entries$_i[1];
402
+ if (!this.item.assert(_item)) {
403
+ return false;
404
+ }
405
+ }
406
+ return _typeof(src) === "object" && !Array.isArray(src);
407
+ }
408
+ }, {
409
+ key: "optional",
410
+ value: function optional() {
411
+ return new RecordSchema(this.item, true);
412
+ }
413
+ }, {
414
+ key: "serialize",
415
+ value: function serialize() {
416
+ return {
417
+ type: "record",
418
+ item: this.item.serialize(),
419
+ opt: this.opt
420
+ };
421
+ }
422
+ }]);
423
+ return RecordSchema;
424
+ }(Schema);
425
+ var record = function record(schema) {
426
+ return new RecordSchema(schema);
427
+ };
428
+
429
+ // import type { F } from "ts-toolbelt";
430
+ // import { i18n, I18n } from "./schema/future/i18n";
431
+ // import { oneOf } from "./schema/future/oneOf";
432
+ // export type InitSchemaLocalized<Locales extends readonly string[]> = {
433
+ // readonly i18n: I18n<Locales>;
434
+ // };
435
+ function initSchema() {
436
+ // locales: F.Narrow<Locales>
298
437
  return {
299
438
  string: string,
300
439
  "boolean": _boolean,
@@ -302,34 +441,16 @@ function initSchema(locales) {
302
441
  object: object,
303
442
  number: number,
304
443
  union: union,
305
- oneOf: oneOf,
444
+ // oneOf,
306
445
  richtext: richtext$1,
307
446
  image: image,
308
447
  literal: literal,
309
- i18n: i18n$1(locales)
448
+ keyOf: keyOf,
449
+ record: record
450
+ // i18n: i18n(locales),
310
451
  };
311
452
  }
312
453
 
313
- /**
314
- * Remote sources cannot include other remote sources.
315
- */
316
-
317
- var REMOTE_REF_PROP = "_ref"; // TODO: same as FILE_REF_PROP so use same prop?
318
-
319
- /**
320
- * A remote source is a hash that represents a remote object.
321
- *
322
- * It will be resolved into a ValRemote object.
323
- */
324
-
325
- function remote(ref) {
326
- var _ref;
327
- return _ref = {}, _defineProperty(_ref, REMOTE_REF_PROP, ref), _defineProperty(_ref, VAL_EXTENSION, "remote"), _ref;
328
- }
329
- function isRemote(obj) {
330
- return _typeof(obj) === "object" && obj !== null && VAL_EXTENSION in obj && obj[VAL_EXTENSION] === "remote" && REMOTE_REF_PROP in obj && typeof obj[REMOTE_REF_PROP] === "string";
331
- }
332
-
333
454
  function richtext(data) {
334
455
  if (typeof data === "string") {
335
456
  var _ref;
@@ -344,40 +465,55 @@ function richtext(data) {
344
465
  return _objectSpread2(_objectSpread2({}, data), {}, _defineProperty({}, VAL_EXTENSION, "richtext"));
345
466
  }
346
467
 
347
- var initVal = function initVal(options) {
348
- var locales = options === null || options === void 0 ? void 0 : options.locales;
349
- var s = initSchema(locales === null || locales === void 0 ? void 0 : locales.required);
350
- if (locales !== null && locales !== void 0 && locales.required) {
351
- console.error("Locales / i18n currently not implemented");
352
- return {
353
- val: {
354
- content: content,
355
- i18n: i18n,
356
- remote: remote,
357
- getPath: getValPath,
358
- file: file,
359
- richtext: richtext
360
- },
361
- s: s
362
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
363
- };
364
- }
365
-
468
+ // import { i18n, I18n } from "./source/future/i18n";
469
+ // import { remote } from "./source/future/remote";
470
+ // type NarrowStrings<A> =
471
+ // | (A extends [] ? [] : never)
472
+ // | (A extends string ? A : never)
473
+ // | {
474
+ // [K in keyof A]: NarrowStrings<A[K]>;
475
+ // };
476
+ // TODO: Rename to createValSystem (only to be used by internal things), we can then export * from '@valbuild/core' in the next package then.
477
+ var initVal = function initVal() {
478
+ // const locales = options?.locales;
479
+ var s = initSchema();
480
+ // if (locales?.required) {
481
+ // console.error("Locales / i18n currently not implemented");
482
+ // return {
483
+ // val: {
484
+ // content,
485
+ // i18n,
486
+ // remote,
487
+ // getPath,
488
+ // file,
489
+ // richtext,
490
+ // },
491
+ // s,
492
+ // // eslint-disable-next-line @typescript-eslint/no-explicit-any
493
+ // } as any;
494
+ // }
366
495
  return {
367
496
  val: {
368
497
  content: content,
369
- remote: remote,
498
+ // remote,
370
499
  getPath: getValPath,
371
500
  file: file,
372
501
  richtext: richtext
373
502
  },
374
- s: _objectSpread2(_objectSpread2({}, s), {}, {
375
- i18n: undefined
376
- })
503
+ s: _objectSpread2({}, s)
377
504
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
378
505
  };
379
506
  };
380
507
 
508
+ /**
509
+ * Remote sources cannot include other remote sources.
510
+ */
511
+
512
+ var REMOTE_REF_PROP = "_ref"; // TODO: same as FILE_REF_PROP so use same prop?
513
+ function isRemote(obj) {
514
+ return _typeof(obj) === "object" && obj !== null && VAL_EXTENSION in obj && obj[VAL_EXTENSION] === "remote" && REMOTE_REF_PROP in obj && typeof obj[REMOTE_REF_PROP] === "string";
515
+ }
516
+
381
517
  function derefPath(path) {
382
518
  var dereffedPath = [];
383
519
  var referencedPath = null;
@@ -489,19 +625,14 @@ function derefPatch(patch, document, ops) {
489
625
  });
490
626
  }
491
627
 
492
- function fetchVal(selector, locale) {
493
- return Promise.resolve(getVal(selector));
494
- }
495
- function getVal(selector,
496
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
497
- locale) {
628
+ function getVal(selector) {
498
629
  return newValProxy(serializedValOfSelectorSource(selector));
499
630
  }
500
631
 
501
632
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
502
633
  function isArrayOrArraySelector(child) {
503
634
  if (isSelector(child)) {
504
- return _typeof(child[SourceOrExpr]) === "object" && _typeof(child[SourceOrExpr]) !== null && Array.isArray(child[SourceOrExpr]);
635
+ return _typeof(child[GetSource]) === "object" && _typeof(child[GetSource]) !== null && Array.isArray(child[GetSource]);
505
636
  }
506
637
  return Array.isArray(child);
507
638
  }
@@ -509,7 +640,7 @@ function isArrayOrArraySelector(child) {
509
640
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
510
641
  function isObjectOrObjectSelector(child) {
511
642
  if (isSelector(child)) {
512
- return _typeof(child[SourceOrExpr]) === "object" && _typeof(child[SourceOrExpr]) !== null && !Array.isArray(child[SourceOrExpr]);
643
+ return _typeof(child[GetSource]) === "object" && _typeof(child[GetSource]) !== null && !Array.isArray(child[GetSource]);
513
644
  }
514
645
  return _typeof(child) === "object";
515
646
  }
@@ -520,7 +651,7 @@ function serializedValOfSelectorSource(selector) {
520
651
  var isArray = isArrayOrArraySelector(child);
521
652
  var isObject = isObjectOrObjectSelector(child);
522
653
  if (isArray) {
523
- var array = SourceOrExpr in child ? child[SourceOrExpr] : child;
654
+ var array = GetSource in child ? child[GetSource] : child;
524
655
  var valPath = Path in child ? child[Path] : undefined;
525
656
  return {
526
657
  val: array.map(function (item, i) {
@@ -530,7 +661,7 @@ function serializedValOfSelectorSource(selector) {
530
661
  valPath: valPath
531
662
  };
532
663
  } else if (isObject) {
533
- var obj = SourceOrExpr in child ? child[SourceOrExpr] : child;
664
+ var obj = GetSource in child ? child[GetSource] : child;
534
665
  var _valPath = Path in child ? child[Path] : undefined;
535
666
  return {
536
667
  val: obj !== null && Object.fromEntries(Object.entries(obj).map(function (_ref) {
@@ -544,7 +675,7 @@ function serializedValOfSelectorSource(selector) {
544
675
  };
545
676
  } else if (isSelector(child)) {
546
677
  return {
547
- val: rec(child[SourceOrExpr]),
678
+ val: rec(child[GetSource]),
548
679
  valPath: child[Path]
549
680
  };
550
681
  } else {
@@ -629,16 +760,471 @@ function hasOwn(obj, prop) {
629
760
  return Object.prototype.hasOwnProperty.call(obj, prop);
630
761
  }
631
762
 
763
+ function _regeneratorRuntime() {
764
+ _regeneratorRuntime = function () {
765
+ return exports;
766
+ };
767
+ var exports = {},
768
+ Op = Object.prototype,
769
+ hasOwn = Op.hasOwnProperty,
770
+ defineProperty = Object.defineProperty || function (obj, key, desc) {
771
+ obj[key] = desc.value;
772
+ },
773
+ $Symbol = "function" == typeof Symbol ? Symbol : {},
774
+ iteratorSymbol = $Symbol.iterator || "@@iterator",
775
+ asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
776
+ toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
777
+ function define(obj, key, value) {
778
+ return Object.defineProperty(obj, key, {
779
+ value: value,
780
+ enumerable: !0,
781
+ configurable: !0,
782
+ writable: !0
783
+ }), obj[key];
784
+ }
785
+ try {
786
+ define({}, "");
787
+ } catch (err) {
788
+ define = function (obj, key, value) {
789
+ return obj[key] = value;
790
+ };
791
+ }
792
+ function wrap(innerFn, outerFn, self, tryLocsList) {
793
+ var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
794
+ generator = Object.create(protoGenerator.prototype),
795
+ context = new Context(tryLocsList || []);
796
+ return defineProperty(generator, "_invoke", {
797
+ value: makeInvokeMethod(innerFn, self, context)
798
+ }), generator;
799
+ }
800
+ function tryCatch(fn, obj, arg) {
801
+ try {
802
+ return {
803
+ type: "normal",
804
+ arg: fn.call(obj, arg)
805
+ };
806
+ } catch (err) {
807
+ return {
808
+ type: "throw",
809
+ arg: err
810
+ };
811
+ }
812
+ }
813
+ exports.wrap = wrap;
814
+ var ContinueSentinel = {};
815
+ function Generator() {}
816
+ function GeneratorFunction() {}
817
+ function GeneratorFunctionPrototype() {}
818
+ var IteratorPrototype = {};
819
+ define(IteratorPrototype, iteratorSymbol, function () {
820
+ return this;
821
+ });
822
+ var getProto = Object.getPrototypeOf,
823
+ NativeIteratorPrototype = getProto && getProto(getProto(values([])));
824
+ NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
825
+ var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
826
+ function defineIteratorMethods(prototype) {
827
+ ["next", "throw", "return"].forEach(function (method) {
828
+ define(prototype, method, function (arg) {
829
+ return this._invoke(method, arg);
830
+ });
831
+ });
832
+ }
833
+ function AsyncIterator(generator, PromiseImpl) {
834
+ function invoke(method, arg, resolve, reject) {
835
+ var record = tryCatch(generator[method], generator, arg);
836
+ if ("throw" !== record.type) {
837
+ var result = record.arg,
838
+ value = result.value;
839
+ return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
840
+ invoke("next", value, resolve, reject);
841
+ }, function (err) {
842
+ invoke("throw", err, resolve, reject);
843
+ }) : PromiseImpl.resolve(value).then(function (unwrapped) {
844
+ result.value = unwrapped, resolve(result);
845
+ }, function (error) {
846
+ return invoke("throw", error, resolve, reject);
847
+ });
848
+ }
849
+ reject(record.arg);
850
+ }
851
+ var previousPromise;
852
+ defineProperty(this, "_invoke", {
853
+ value: function (method, arg) {
854
+ function callInvokeWithMethodAndArg() {
855
+ return new PromiseImpl(function (resolve, reject) {
856
+ invoke(method, arg, resolve, reject);
857
+ });
858
+ }
859
+ return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
860
+ }
861
+ });
862
+ }
863
+ function makeInvokeMethod(innerFn, self, context) {
864
+ var state = "suspendedStart";
865
+ return function (method, arg) {
866
+ if ("executing" === state) throw new Error("Generator is already running");
867
+ if ("completed" === state) {
868
+ if ("throw" === method) throw arg;
869
+ return doneResult();
870
+ }
871
+ for (context.method = method, context.arg = arg;;) {
872
+ var delegate = context.delegate;
873
+ if (delegate) {
874
+ var delegateResult = maybeInvokeDelegate(delegate, context);
875
+ if (delegateResult) {
876
+ if (delegateResult === ContinueSentinel) continue;
877
+ return delegateResult;
878
+ }
879
+ }
880
+ if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
881
+ if ("suspendedStart" === state) throw state = "completed", context.arg;
882
+ context.dispatchException(context.arg);
883
+ } else "return" === context.method && context.abrupt("return", context.arg);
884
+ state = "executing";
885
+ var record = tryCatch(innerFn, self, context);
886
+ if ("normal" === record.type) {
887
+ if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
888
+ return {
889
+ value: record.arg,
890
+ done: context.done
891
+ };
892
+ }
893
+ "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
894
+ }
895
+ };
896
+ }
897
+ function maybeInvokeDelegate(delegate, context) {
898
+ var methodName = context.method,
899
+ method = delegate.iterator[methodName];
900
+ if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel;
901
+ var record = tryCatch(method, delegate.iterator, context.arg);
902
+ if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
903
+ var info = record.arg;
904
+ return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
905
+ }
906
+ function pushTryEntry(locs) {
907
+ var entry = {
908
+ tryLoc: locs[0]
909
+ };
910
+ 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
911
+ }
912
+ function resetTryEntry(entry) {
913
+ var record = entry.completion || {};
914
+ record.type = "normal", delete record.arg, entry.completion = record;
915
+ }
916
+ function Context(tryLocsList) {
917
+ this.tryEntries = [{
918
+ tryLoc: "root"
919
+ }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
920
+ }
921
+ function values(iterable) {
922
+ if (iterable) {
923
+ var iteratorMethod = iterable[iteratorSymbol];
924
+ if (iteratorMethod) return iteratorMethod.call(iterable);
925
+ if ("function" == typeof iterable.next) return iterable;
926
+ if (!isNaN(iterable.length)) {
927
+ var i = -1,
928
+ next = function next() {
929
+ for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
930
+ return next.value = undefined, next.done = !0, next;
931
+ };
932
+ return next.next = next;
933
+ }
934
+ }
935
+ return {
936
+ next: doneResult
937
+ };
938
+ }
939
+ function doneResult() {
940
+ return {
941
+ value: undefined,
942
+ done: !0
943
+ };
944
+ }
945
+ return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", {
946
+ value: GeneratorFunctionPrototype,
947
+ configurable: !0
948
+ }), defineProperty(GeneratorFunctionPrototype, "constructor", {
949
+ value: GeneratorFunction,
950
+ configurable: !0
951
+ }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
952
+ var ctor = "function" == typeof genFun && genFun.constructor;
953
+ return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
954
+ }, exports.mark = function (genFun) {
955
+ return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
956
+ }, exports.awrap = function (arg) {
957
+ return {
958
+ __await: arg
959
+ };
960
+ }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
961
+ return this;
962
+ }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
963
+ void 0 === PromiseImpl && (PromiseImpl = Promise);
964
+ var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
965
+ return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
966
+ return result.done ? result.value : iter.next();
967
+ });
968
+ }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
969
+ return this;
970
+ }), define(Gp, "toString", function () {
971
+ return "[object Generator]";
972
+ }), exports.keys = function (val) {
973
+ var object = Object(val),
974
+ keys = [];
975
+ for (var key in object) keys.push(key);
976
+ return keys.reverse(), function next() {
977
+ for (; keys.length;) {
978
+ var key = keys.pop();
979
+ if (key in object) return next.value = key, next.done = !1, next;
980
+ }
981
+ return next.done = !0, next;
982
+ };
983
+ }, exports.values = values, Context.prototype = {
984
+ constructor: Context,
985
+ reset: function (skipTempReset) {
986
+ if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
987
+ },
988
+ stop: function () {
989
+ this.done = !0;
990
+ var rootRecord = this.tryEntries[0].completion;
991
+ if ("throw" === rootRecord.type) throw rootRecord.arg;
992
+ return this.rval;
993
+ },
994
+ dispatchException: function (exception) {
995
+ if (this.done) throw exception;
996
+ var context = this;
997
+ function handle(loc, caught) {
998
+ return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
999
+ }
1000
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
1001
+ var entry = this.tryEntries[i],
1002
+ record = entry.completion;
1003
+ if ("root" === entry.tryLoc) return handle("end");
1004
+ if (entry.tryLoc <= this.prev) {
1005
+ var hasCatch = hasOwn.call(entry, "catchLoc"),
1006
+ hasFinally = hasOwn.call(entry, "finallyLoc");
1007
+ if (hasCatch && hasFinally) {
1008
+ if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
1009
+ if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
1010
+ } else if (hasCatch) {
1011
+ if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
1012
+ } else {
1013
+ if (!hasFinally) throw new Error("try statement without catch or finally");
1014
+ if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
1015
+ }
1016
+ }
1017
+ }
1018
+ },
1019
+ abrupt: function (type, arg) {
1020
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
1021
+ var entry = this.tryEntries[i];
1022
+ if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
1023
+ var finallyEntry = entry;
1024
+ break;
1025
+ }
1026
+ }
1027
+ finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
1028
+ var record = finallyEntry ? finallyEntry.completion : {};
1029
+ return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
1030
+ },
1031
+ complete: function (record, afterLoc) {
1032
+ if ("throw" === record.type) throw record.arg;
1033
+ return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
1034
+ },
1035
+ finish: function (finallyLoc) {
1036
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
1037
+ var entry = this.tryEntries[i];
1038
+ if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
1039
+ }
1040
+ },
1041
+ catch: function (tryLoc) {
1042
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
1043
+ var entry = this.tryEntries[i];
1044
+ if (entry.tryLoc === tryLoc) {
1045
+ var record = entry.completion;
1046
+ if ("throw" === record.type) {
1047
+ var thrown = record.arg;
1048
+ resetTryEntry(entry);
1049
+ }
1050
+ return thrown;
1051
+ }
1052
+ }
1053
+ throw new Error("illegal catch attempt");
1054
+ },
1055
+ delegateYield: function (iterable, resultName, nextLoc) {
1056
+ return this.delegate = {
1057
+ iterator: values(iterable),
1058
+ resultName: resultName,
1059
+ nextLoc: nextLoc
1060
+ }, "next" === this.method && (this.arg = undefined), ContinueSentinel;
1061
+ }
1062
+ }, exports;
1063
+ }
1064
+
1065
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
1066
+ try {
1067
+ var info = gen[key](arg);
1068
+ var value = info.value;
1069
+ } catch (error) {
1070
+ reject(error);
1071
+ return;
1072
+ }
1073
+ if (info.done) {
1074
+ resolve(value);
1075
+ } else {
1076
+ Promise.resolve(value).then(_next, _throw);
1077
+ }
1078
+ }
1079
+ function _asyncToGenerator(fn) {
1080
+ return function () {
1081
+ var self = this,
1082
+ args = arguments;
1083
+ return new Promise(function (resolve, reject) {
1084
+ var gen = fn.apply(self, args);
1085
+ function _next(value) {
1086
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
1087
+ }
1088
+ function _throw(err) {
1089
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
1090
+ }
1091
+ _next(undefined);
1092
+ });
1093
+ };
1094
+ }
1095
+
1096
+ // TODO: move this to internal, only reason this is here is that react, ui and server all depend on it
1097
+ var ValApi = /*#__PURE__*/function () {
1098
+ function ValApi(host) {
1099
+ _classCallCheck(this, ValApi);
1100
+ this.host = host;
1101
+ }
1102
+ _createClass(ValApi, [{
1103
+ key: "getDisableUrl",
1104
+ value: function getDisableUrl() {
1105
+ return "".concat(this.host, "/disable");
1106
+ }
1107
+ }, {
1108
+ key: "postPatches",
1109
+ value: function postPatches(moduleId, patches, commit, headers) {
1110
+ var params = "";
1111
+ if (commit) {
1112
+ var p = new URLSearchParams();
1113
+ p.set("commit", commit);
1114
+ params = "?".concat(p.toString());
1115
+ }
1116
+ return fetch("".concat(this.host, "/patches/~").concat(moduleId).concat(params), {
1117
+ headers: headers || {
1118
+ "Content-Type": "application/json"
1119
+ },
1120
+ method: "POST",
1121
+ body: JSON.stringify(patches)
1122
+ }).then(parse);
1123
+ }
1124
+ }, {
1125
+ key: "getSession",
1126
+ value: function getSession() {
1127
+ return fetch("".concat(this.host, "/session")).then(parse);
1128
+ }
1129
+ }, {
1130
+ key: "getModules",
1131
+ value: function getModules(_ref) {
1132
+ var _ref$patch = _ref.patch,
1133
+ patch = _ref$patch === void 0 ? false : _ref$patch,
1134
+ _ref$includeSchema = _ref.includeSchema,
1135
+ includeSchema = _ref$includeSchema === void 0 ? false : _ref$includeSchema,
1136
+ _ref$includeSource = _ref.includeSource,
1137
+ includeSource = _ref$includeSource === void 0 ? false : _ref$includeSource,
1138
+ _ref$treePath = _ref.treePath,
1139
+ treePath = _ref$treePath === void 0 ? "/" : _ref$treePath,
1140
+ headers = _ref.headers;
1141
+ var params = new URLSearchParams();
1142
+ params.set("patch", patch.toString());
1143
+ params.set("schema", includeSchema.toString());
1144
+ params.set("source", includeSource.toString());
1145
+ return fetch("".concat(this.host, "/tree/~").concat(treePath, "?").concat(params.toString()), {
1146
+ headers: headers
1147
+ }).then(parse);
1148
+ }
1149
+ }]);
1150
+ return ValApi;
1151
+ }();
1152
+
1153
+ // TODO: validate
1154
+ function parse(_x) {
1155
+ return _parse.apply(this, arguments);
1156
+ }
1157
+ function _parse() {
1158
+ _parse = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(res) {
1159
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
1160
+ while (1) switch (_context.prev = _context.next) {
1161
+ case 0:
1162
+ _context.prev = 0;
1163
+ if (!res.ok) {
1164
+ _context.next = 9;
1165
+ break;
1166
+ }
1167
+ _context.t0 = result;
1168
+ _context.next = 5;
1169
+ return res.json();
1170
+ case 5:
1171
+ _context.t1 = _context.sent;
1172
+ return _context.abrupt("return", _context.t0.ok.call(_context.t0, _context.t1));
1173
+ case 9:
1174
+ _context.t2 = result;
1175
+ _context.t3 = res.status;
1176
+ _context.next = 13;
1177
+ return res.text();
1178
+ case 13:
1179
+ _context.t4 = _context.sent;
1180
+ _context.t5 = {
1181
+ statusCode: _context.t3,
1182
+ message: _context.t4
1183
+ };
1184
+ return _context.abrupt("return", _context.t2.err.call(_context.t2, _context.t5));
1185
+ case 16:
1186
+ _context.next = 21;
1187
+ break;
1188
+ case 18:
1189
+ _context.prev = 18;
1190
+ _context.t6 = _context["catch"](0);
1191
+ return _context.abrupt("return", err({
1192
+ message: _context.t6 instanceof Error ? _context.t6.message : "Unknown error"
1193
+ }));
1194
+ case 21:
1195
+ case "end":
1196
+ return _context.stop();
1197
+ }
1198
+ }, _callee, null, [[0, 18]]);
1199
+ }));
1200
+ return _parse.apply(this, arguments);
1201
+ }
1202
+
632
1203
  var Internal = {
633
- convertImageSource: convertImageSource,
1204
+ convertFileSource: convertFileSource,
634
1205
  getSchema: getSchema,
635
1206
  getValPath: getValPath,
636
1207
  getVal: getVal,
637
- getRawSource: getRawSource,
1208
+ getSource: getSource,
638
1209
  resolvePath: resolvePath,
639
1210
  splitModuleIdAndModulePath: splitModuleIdAndModulePath,
640
- fetchVal: fetchVal,
641
- isVal: isVal
1211
+ isVal: isVal,
1212
+ createValPathOfItem: createValPathOfItem,
1213
+ createPatchJSONPath: function createPatchJSONPath(modulePath) {
1214
+ return "/".concat(modulePath.split(".").map(function (segment) {
1215
+ return JSON.parse(segment);
1216
+ }).join("/"));
1217
+ },
1218
+ /**
1219
+ * Enables draft mode: updates all Val modules with patches
1220
+ */
1221
+ VAL_DRAFT_MODE_COOKIE: "val_draft_mode",
1222
+ /**
1223
+ * Enables Val: show the overlay / menu
1224
+ */
1225
+ VAL_ENABLE_COOKIE_NAME: "val_enable",
1226
+ VAL_STATE_COOKIE: "val_state",
1227
+ VAL_SESSION_COOKIE: "val_session"
642
1228
  };
643
1229
 
644
- export { Internal, derefPatch, initVal };
1230
+ export { Internal, ValApi, derefPatch, initVal };