@valbuild/core 0.43.1 → 0.45.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 (31) hide show
  1. package/dist/declarations/src/index.d.ts +3 -4
  2. package/dist/declarations/src/initSchema.d.ts +1 -1
  3. package/dist/declarations/src/module.d.ts +3 -1
  4. package/dist/declarations/src/schema/file.d.ts +10 -0
  5. package/dist/declarations/src/schema/image.d.ts +11 -7
  6. package/dist/declarations/src/schema/validation/ValidationError.d.ts +1 -0
  7. package/dist/declarations/src/selector/file.d.ts +6 -2
  8. package/dist/declarations/src/selector/image.d.ts +3 -0
  9. package/dist/declarations/src/selector/index.d.ts +3 -1
  10. package/dist/declarations/src/source/file.d.ts +8 -9
  11. package/dist/declarations/src/source/image.d.ts +7 -0
  12. package/dist/declarations/src/source/richtext.d.ts +4 -4
  13. package/dist/{index-6deb169d.cjs.dev.js → index-00276955.cjs.dev.js} +1 -1
  14. package/dist/{index-c83918b8.esm.js → index-5750c299.esm.js} +3 -81
  15. package/dist/{index-4f821892.esm.js → index-799bcf49.esm.js} +1 -1
  16. package/dist/{index-5bdaa229.cjs.prod.js → index-7b467ee6.cjs.prod.js} +2 -82
  17. package/dist/{index-a5295001.cjs.dev.js → index-d23e237a.cjs.dev.js} +2 -82
  18. package/dist/{index-216627d7.cjs.prod.js → index-db60fc1d.cjs.prod.js} +1 -1
  19. package/dist/{ops-266faf09.esm.js → ops-117cb796.esm.js} +281 -4
  20. package/dist/{ops-d88e99cd.cjs.prod.js → ops-18aded72.cjs.prod.js} +283 -4
  21. package/dist/{ops-e02ab215.cjs.dev.js → ops-453cddfc.cjs.dev.js} +283 -4
  22. package/dist/valbuild-core.cjs.dev.js +5 -66
  23. package/dist/valbuild-core.cjs.prod.js +5 -66
  24. package/dist/valbuild-core.esm.js +4 -65
  25. package/expr/dist/valbuild-core-expr.cjs.dev.js +2 -2
  26. package/expr/dist/valbuild-core-expr.cjs.prod.js +2 -2
  27. package/expr/dist/valbuild-core-expr.esm.js +2 -2
  28. package/package.json +1 -1
  29. package/patch/dist/valbuild-core-patch.cjs.dev.js +2 -2
  30. package/patch/dist/valbuild-core-patch.cjs.prod.js +2 -2
  31. package/patch/dist/valbuild-core-patch.esm.js +3 -3
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-a5295001.cjs.dev.js');
3
+ var index = require('./index-d23e237a.cjs.dev.js');
4
4
  var result = require('./result-48320acd.cjs.dev.js');
5
5
 
6
6
  function hasOwn(obj, prop) {
@@ -163,6 +163,8 @@ var ObjectSchema = /*#__PURE__*/function (_Schema) {
163
163
  value: function validate(path, src) {
164
164
  var _this2 = this;
165
165
  var error = false;
166
+
167
+ // TODO: src should never be undefined
166
168
  if (this.opt && (src === null || src === undefined)) {
167
169
  return false;
168
170
  }
@@ -328,6 +330,67 @@ var array = function array(schema) {
328
330
  return new ArraySchema(schema);
329
331
  };
330
332
 
333
+ var LiteralSchema = /*#__PURE__*/function (_Schema) {
334
+ index._inherits(LiteralSchema, _Schema);
335
+ var _super = index._createSuper(LiteralSchema);
336
+ function LiteralSchema(value) {
337
+ var _this;
338
+ var opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
339
+ index._classCallCheck(this, LiteralSchema);
340
+ _this = _super.call(this);
341
+ _this.value = value;
342
+ _this.opt = opt;
343
+ return _this;
344
+ }
345
+ index._createClass(LiteralSchema, [{
346
+ key: "validate",
347
+ value: function validate(path, src) {
348
+ if (this.opt && (src === null || src === undefined)) {
349
+ return false;
350
+ }
351
+ if (typeof src !== "string") {
352
+ return index._defineProperty({}, path, [{
353
+ message: "Expected 'string', got '".concat(index._typeof(src), "'"),
354
+ value: src
355
+ }]);
356
+ }
357
+ if (src !== this.value) {
358
+ return index._defineProperty({}, path, [{
359
+ message: "Expected literal '".concat(this.value, "', got '").concat(src, "'"),
360
+ value: src
361
+ }]);
362
+ }
363
+ return false;
364
+ }
365
+ }, {
366
+ key: "assert",
367
+ value: function assert(src) {
368
+ if (this.opt && (src === null || src === undefined)) {
369
+ return true;
370
+ }
371
+ return typeof src === "string";
372
+ }
373
+ }, {
374
+ key: "optional",
375
+ value: function optional() {
376
+ return new LiteralSchema(this.value, true);
377
+ }
378
+ }, {
379
+ key: "serialize",
380
+ value: function serialize() {
381
+ return {
382
+ type: "literal",
383
+ value: this.value,
384
+ opt: this.opt
385
+ };
386
+ }
387
+ }]);
388
+ return LiteralSchema;
389
+ }(index.Schema);
390
+ var literal = function literal(value) {
391
+ return new LiteralSchema(value);
392
+ };
393
+
331
394
  var UnionSchema = /*#__PURE__*/function (_Schema) {
332
395
  index._inherits(UnionSchema, _Schema);
333
396
  var _super = index._createSuper(UnionSchema);
@@ -344,8 +407,143 @@ var UnionSchema = /*#__PURE__*/function (_Schema) {
344
407
  index._createClass(UnionSchema, [{
345
408
  key: "validate",
346
409
  value: function validate(path, src) {
347
- // TODO:
348
- return false;
410
+ var unknownSrc = src;
411
+ var errors = false;
412
+ if (this.opt && (unknownSrc === null || unknownSrc === undefined)) {
413
+ // TODO: src should never be undefined
414
+ return false;
415
+ }
416
+ if (!this.key) {
417
+ return index._defineProperty({}, path, [{
418
+ message: "Missing required first argument in union"
419
+ }]);
420
+ }
421
+ var key = this.key;
422
+ if (!Array.isArray(this.items)) {
423
+ return index._defineProperty({}, path, [{
424
+ message: "A union schema must take more than 1 schema arguments",
425
+ fatal: true
426
+ }]);
427
+ }
428
+ if (typeof key === "string") {
429
+ // tagged union
430
+ if (this.items.some(function (item) {
431
+ return !(item instanceof ObjectSchema);
432
+ })) {
433
+ return index._defineProperty({}, path, [{
434
+ message: "Key is a string, so all schema items must be objects",
435
+ fatal: true
436
+ }]);
437
+ }
438
+ var objectSchemas = this.items;
439
+ var serializedSchemas = objectSchemas.map(function (schema) {
440
+ return schema.serialize();
441
+ });
442
+ var illegalSchemas = serializedSchemas.filter(function (schema) {
443
+ return !(schema.type === "object") || !(schema.items[key].type === "literal");
444
+ });
445
+ if (illegalSchemas.length > 0) {
446
+ return index._defineProperty({}, path, [{
447
+ message: "All schema items must be objects with a key: ".concat(key, " that is a literal schema. Found: ").concat(JSON.stringify(illegalSchemas, null, 2)),
448
+ fatal: true
449
+ }]);
450
+ }
451
+ var serializedObjectSchemas = serializedSchemas;
452
+ var optionalLiterals = serializedObjectSchemas.filter(function (schema) {
453
+ return schema.items[key].opt;
454
+ });
455
+ if (optionalLiterals.length > 1) {
456
+ return index._defineProperty({}, path, [{
457
+ message: "Schema cannot have an optional keys: ".concat(key),
458
+ fatal: true
459
+ }]);
460
+ }
461
+ if (index._typeof(unknownSrc) !== "object") {
462
+ return index._defineProperty({}, path, [{
463
+ message: "Expected an object"
464
+ }]);
465
+ }
466
+ var objectSrc = unknownSrc;
467
+ if (objectSrc[key] === undefined) {
468
+ return index._defineProperty({}, path, [{
469
+ message: "Missing required key: ".concat(key)
470
+ }]);
471
+ }
472
+ var foundSchemaLiterals = [];
473
+ var _iterator = result._createForOfIteratorHelper(serializedObjectSchemas),
474
+ _step;
475
+ try {
476
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
477
+ var schema = _step.value;
478
+ var schemaKey = schema.items[key];
479
+ if (schemaKey.type === "literal") {
480
+ if (!foundSchemaLiterals.includes(schemaKey.value)) {
481
+ foundSchemaLiterals.push(schemaKey.value);
482
+ } else {
483
+ return index._defineProperty({}, path, [{
484
+ message: "Found duplicate key in schema: ".concat(schemaKey.value),
485
+ fatal: true
486
+ }]);
487
+ }
488
+ }
489
+ }
490
+ } catch (err) {
491
+ _iterator.e(err);
492
+ } finally {
493
+ _iterator.f();
494
+ }
495
+ var objectSchemaAtKey = objectSchemas.find(function (schema) {
496
+ return !schema.items[key].validate(path, objectSrc[key]);
497
+ });
498
+ if (!objectSchemaAtKey) {
499
+ var keyPath = createValPathOfItem(path, key);
500
+ if (!keyPath) {
501
+ throw new Error("Internal error: could not create path at ".concat(!path && typeof path === "string" ? "<empty string>" : path, " at key ").concat(key));
502
+ }
503
+ return index._defineProperty({}, keyPath, [{
504
+ message: "Invalid key: \"".concat(key, "\". Value was: \"").concat(objectSrc[key], "\". Valid values: ").concat(serializedObjectSchemas.map(function (schema) {
505
+ var keySchema = schema.items[key];
506
+ if (keySchema.type === "literal" && keySchema.value) {
507
+ return "\"".concat(keySchema.value, "\"");
508
+ } else {
509
+ // should not happen here, we already checked this
510
+ throw new Error("Expected literal schema, got ".concat(JSON.stringify(keySchema, null, 2)));
511
+ }
512
+ }).join(", "))
513
+ }]);
514
+ }
515
+ var error = objectSchemaAtKey.validate(path, objectSrc);
516
+ if (error) {
517
+ return error;
518
+ }
519
+ } else if (key instanceof LiteralSchema) {
520
+ if (this.items.some(function (item) {
521
+ return !(item instanceof LiteralSchema);
522
+ })) {
523
+ return index._defineProperty({}, path, [{
524
+ message: "Key is a literal schema, so all schema items must be literals",
525
+ fatal: true
526
+ }]);
527
+ }
528
+ var literalItems = [key].concat(index._toConsumableArray(this.items));
529
+ if (typeof unknownSrc === "string") {
530
+ var isMatch = literalItems.some(function (item) {
531
+ return !item.validate(path, unknownSrc);
532
+ });
533
+ if (!isMatch) {
534
+ return index._defineProperty({}, path, [{
535
+ message: "Union must match one of the following: ".concat(literalItems.map(function (item) {
536
+ return "\"".concat(item.value, "\"");
537
+ }).join(", "))
538
+ }]);
539
+ }
540
+ }
541
+ } else {
542
+ return index._defineProperty({}, path, [{
543
+ message: "Expected a string or literal"
544
+ }]);
545
+ }
546
+ return errors;
349
547
  }
350
548
  }, {
351
549
  key: "assert",
@@ -430,6 +628,85 @@ var richtext = function richtext(options) {
430
628
  return new RichTextSchema(options !== null && options !== void 0 ? options : {});
431
629
  };
432
630
 
631
+ var ImageSchema = /*#__PURE__*/function (_Schema) {
632
+ index._inherits(ImageSchema, _Schema);
633
+ var _super = index._createSuper(ImageSchema);
634
+ function ImageSchema(options) {
635
+ var _this;
636
+ var opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
637
+ index._classCallCheck(this, ImageSchema);
638
+ _this = _super.call(this);
639
+ _this.options = options;
640
+ _this.opt = opt;
641
+ return _this;
642
+ }
643
+ index._createClass(ImageSchema, [{
644
+ key: "validate",
645
+ value: function validate(path, src) {
646
+ if (this.opt && (src === null || src === undefined)) {
647
+ return false;
648
+ }
649
+ if (src === null || src === undefined) {
650
+ return index._defineProperty({}, path, [{
651
+ message: "Non-optional image was null or undefined.",
652
+ value: src
653
+ }]);
654
+ }
655
+ if (typeof src[index.FILE_REF_PROP] !== "string") {
656
+ return index._defineProperty({}, path, [{
657
+ message: "Image did not have a file reference string. Got: ".concat(index._typeof(src[index.FILE_REF_PROP])),
658
+ value: src
659
+ }]);
660
+ }
661
+ if (src[index.VAL_EXTENSION] !== "file") {
662
+ return index._defineProperty({}, path, [{
663
+ message: "Image did not have the valid file extension type. Got: ".concat(src[index.VAL_EXTENSION]),
664
+ value: src
665
+ }]);
666
+ }
667
+ if (src.metadata) {
668
+ return index._defineProperty({}, path, [{
669
+ message: "Found metadata, but it could not be validated. Image metadata must be an object with the required props: width (positive number), height (positive number) and sha256 (string of length 64 of the base16 hash).",
670
+ // These validation errors will have to be picked up by logic outside of this package and revalidated. Reasons: 1) we have to read files to verify the metadata, which is handled differently in different runtimes (Browser, QuickJS, Node.js); 2) we want to keep this package dependency free.
671
+ value: src,
672
+ fixes: ["image:replace-metadata"]
673
+ }]);
674
+ }
675
+ return index._defineProperty({}, path, [{
676
+ message: "Could not validate Image metadata.",
677
+ value: src,
678
+ fixes: ["image:add-metadata"]
679
+ }]);
680
+ }
681
+ }, {
682
+ key: "assert",
683
+ value: function assert(src) {
684
+ if (this.opt && (src === null || src === undefined)) {
685
+ return true;
686
+ }
687
+ return (src === null || src === void 0 ? void 0 : src[index.FILE_REF_PROP]) === "image" && (src === null || src === void 0 ? void 0 : src[index.VAL_EXTENSION]) === "file";
688
+ }
689
+ }, {
690
+ key: "optional",
691
+ value: function optional() {
692
+ return new ImageSchema(this.options, true);
693
+ }
694
+ }, {
695
+ key: "serialize",
696
+ value: function serialize() {
697
+ return {
698
+ type: "image",
699
+ options: this.options,
700
+ opt: this.opt
701
+ };
702
+ }
703
+ }]);
704
+ return ImageSchema;
705
+ }(index.Schema);
706
+ var image = function image(options) {
707
+ return new ImageSchema(options);
708
+ };
709
+
433
710
  var RecordSchema = /*#__PURE__*/function (_Schema) {
434
711
  index._inherits(RecordSchema, _Schema);
435
712
  var _super = index._createSuper(RecordSchema);
@@ -570,7 +847,7 @@ function isRichTextSchema(schema) {
570
847
  return schema instanceof RichTextSchema || index._typeof(schema) === "object" && "type" in schema && schema.type === "richtext";
571
848
  }
572
849
  function isImageSchema(schema) {
573
- return schema instanceof index.ImageSchema || index._typeof(schema) === "object" && "type" in schema && schema.type === "image";
850
+ return schema instanceof ImageSchema || index._typeof(schema) === "object" && "type" in schema && schema.type === "image";
574
851
  }
575
852
 
576
853
  // function isOneOfSchema(
@@ -775,7 +1052,9 @@ exports.array = array;
775
1052
  exports.content = content;
776
1053
  exports.createValPathOfItem = createValPathOfItem;
777
1054
  exports.getSource = getSource;
1055
+ exports.image = image;
778
1056
  exports.isSelector = isSelector;
1057
+ exports.literal = literal;
779
1058
  exports.newSelectorProxy = newSelectorProxy;
780
1059
  exports.object = object;
781
1060
  exports.record = record;
@@ -2,9 +2,9 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var ops = require('./ops-e02ab215.cjs.dev.js');
6
- var index = require('./index-a5295001.cjs.dev.js');
7
- var expr_dist_valbuildCoreExpr = require('./index-6deb169d.cjs.dev.js');
5
+ var ops = require('./ops-453cddfc.cjs.dev.js');
6
+ var index = require('./index-d23e237a.cjs.dev.js');
7
+ var expr_dist_valbuildCoreExpr = require('./index-00276955.cjs.dev.js');
8
8
  var result = require('./result-48320acd.cjs.dev.js');
9
9
 
10
10
  var NumberSchema = /*#__PURE__*/function (_Schema) {
@@ -195,67 +195,6 @@ var _boolean = function _boolean() {
195
195
  return new BooleanSchema();
196
196
  };
197
197
 
198
- var LiteralSchema = /*#__PURE__*/function (_Schema) {
199
- index._inherits(LiteralSchema, _Schema);
200
- var _super = index._createSuper(LiteralSchema);
201
- function LiteralSchema(value) {
202
- var _this;
203
- var opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
204
- index._classCallCheck(this, LiteralSchema);
205
- _this = _super.call(this);
206
- _this.value = value;
207
- _this.opt = opt;
208
- return _this;
209
- }
210
- index._createClass(LiteralSchema, [{
211
- key: "validate",
212
- value: function validate(path, src) {
213
- if (this.opt && (src === null || src === undefined)) {
214
- return false;
215
- }
216
- if (typeof src !== "string") {
217
- return index._defineProperty({}, path, [{
218
- message: "Expected 'string', got '".concat(index._typeof(src), "'"),
219
- value: src
220
- }]);
221
- }
222
- if (src !== this.value) {
223
- return index._defineProperty({}, path, [{
224
- message: "Expected literal '".concat(this.value, "', got '").concat(src, "'"),
225
- value: src
226
- }]);
227
- }
228
- return false;
229
- }
230
- }, {
231
- key: "assert",
232
- value: function assert(src) {
233
- if (this.opt && (src === null || src === undefined)) {
234
- return true;
235
- }
236
- return typeof src === "string";
237
- }
238
- }, {
239
- key: "optional",
240
- value: function optional() {
241
- return new LiteralSchema(this.value, true);
242
- }
243
- }, {
244
- key: "serialize",
245
- value: function serialize() {
246
- return {
247
- type: "literal",
248
- value: this.value,
249
- opt: this.opt
250
- };
251
- }
252
- }]);
253
- return LiteralSchema;
254
- }(index.Schema);
255
- var literal = function literal(value) {
256
- return new LiteralSchema(value);
257
- };
258
-
259
198
  var KeyOfSchema = /*#__PURE__*/function (_Schema) {
260
199
  index._inherits(KeyOfSchema, _Schema);
261
200
  var _super = index._createSuper(KeyOfSchema);
@@ -402,8 +341,8 @@ function initSchema() {
402
341
  union: ops.union,
403
342
  // oneOf,
404
343
  richtext: ops.richtext,
405
- image: index.image,
406
- literal: literal,
344
+ image: ops.image,
345
+ literal: ops.literal,
407
346
  keyOf: keyOf,
408
347
  record: ops.record
409
348
  // i18n: i18n(locales),
@@ -2,9 +2,9 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var ops = require('./ops-d88e99cd.cjs.prod.js');
6
- var index = require('./index-5bdaa229.cjs.prod.js');
7
- var expr_dist_valbuildCoreExpr = require('./index-216627d7.cjs.prod.js');
5
+ var ops = require('./ops-18aded72.cjs.prod.js');
6
+ var index = require('./index-7b467ee6.cjs.prod.js');
7
+ var expr_dist_valbuildCoreExpr = require('./index-db60fc1d.cjs.prod.js');
8
8
  var result = require('./result-26f67b40.cjs.prod.js');
9
9
 
10
10
  var NumberSchema = /*#__PURE__*/function (_Schema) {
@@ -195,67 +195,6 @@ var _boolean = function _boolean() {
195
195
  return new BooleanSchema();
196
196
  };
197
197
 
198
- var LiteralSchema = /*#__PURE__*/function (_Schema) {
199
- index._inherits(LiteralSchema, _Schema);
200
- var _super = index._createSuper(LiteralSchema);
201
- function LiteralSchema(value) {
202
- var _this;
203
- var opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
204
- index._classCallCheck(this, LiteralSchema);
205
- _this = _super.call(this);
206
- _this.value = value;
207
- _this.opt = opt;
208
- return _this;
209
- }
210
- index._createClass(LiteralSchema, [{
211
- key: "validate",
212
- value: function validate(path, src) {
213
- if (this.opt && (src === null || src === undefined)) {
214
- return false;
215
- }
216
- if (typeof src !== "string") {
217
- return index._defineProperty({}, path, [{
218
- message: "Expected 'string', got '".concat(index._typeof(src), "'"),
219
- value: src
220
- }]);
221
- }
222
- if (src !== this.value) {
223
- return index._defineProperty({}, path, [{
224
- message: "Expected literal '".concat(this.value, "', got '").concat(src, "'"),
225
- value: src
226
- }]);
227
- }
228
- return false;
229
- }
230
- }, {
231
- key: "assert",
232
- value: function assert(src) {
233
- if (this.opt && (src === null || src === undefined)) {
234
- return true;
235
- }
236
- return typeof src === "string";
237
- }
238
- }, {
239
- key: "optional",
240
- value: function optional() {
241
- return new LiteralSchema(this.value, true);
242
- }
243
- }, {
244
- key: "serialize",
245
- value: function serialize() {
246
- return {
247
- type: "literal",
248
- value: this.value,
249
- opt: this.opt
250
- };
251
- }
252
- }]);
253
- return LiteralSchema;
254
- }(index.Schema);
255
- var literal = function literal(value) {
256
- return new LiteralSchema(value);
257
- };
258
-
259
198
  var KeyOfSchema = /*#__PURE__*/function (_Schema) {
260
199
  index._inherits(KeyOfSchema, _Schema);
261
200
  var _super = index._createSuper(KeyOfSchema);
@@ -402,8 +341,8 @@ function initSchema() {
402
341
  union: ops.union,
403
342
  // oneOf,
404
343
  richtext: ops.richtext,
405
- image: index.image,
406
- literal: literal,
344
+ image: ops.image,
345
+ literal: ops.literal,
407
346
  keyOf: keyOf,
408
347
  record: ops.record
409
348
  // i18n: i18n(locales),
@@ -1,7 +1,7 @@
1
- import { a as array, o as object, u as union, r as richtext$1, b as record, c as content, P as PatchError, n as newSelectorProxy, d as createValPathOfItem, i as isSelector, g as getSource, e as resolvePath, s as splitModuleIdAndModulePath } from './ops-266faf09.esm.js';
2
- 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, i as image, V as VAL_EXTENSION, f as file, h as _slicedToArray, j as isFile, F as FILE_REF_PROP, P as Path, k as GetSource, l as isSerializedVal, m as convertFileSource, n as getSchema, o as isVal } from './index-c83918b8.esm.js';
3
- export { F as FILE_REF_PROP, p as GenericSelector, S as Schema, V as VAL_EXTENSION } from './index-c83918b8.esm.js';
4
- export { i as expr } from './index-4f821892.esm.js';
1
+ import { a as array, o as object, u as union, r as richtext$1, i as image, l as literal, b as record, c as content, P as PatchError, n as newSelectorProxy, d as createValPathOfItem, e as isSelector, g as getSource, f as resolvePath, s as splitModuleIdAndModulePath } from './ops-117cb796.esm.js';
2
+ 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, V as VAL_EXTENSION, f as file, h as _slicedToArray, i as isFile, F as FILE_REF_PROP, P as Path, j as GetSource, k as isSerializedVal, l as convertFileSource, m as getSchema, n as isVal } from './index-5750c299.esm.js';
3
+ export { F as FILE_REF_PROP, o as GenericSelector, S as Schema, V as VAL_EXTENSION } from './index-5750c299.esm.js';
4
+ export { i as expr } from './index-799bcf49.esm.js';
5
5
  import { _ as _createForOfIteratorHelper, i as isErr, a as isOk, e as err, o as ok, r as result } from './result-b96df128.esm.js';
6
6
 
7
7
  var NumberSchema = /*#__PURE__*/function (_Schema) {
@@ -192,67 +192,6 @@ var _boolean = function _boolean() {
192
192
  return new BooleanSchema();
193
193
  };
194
194
 
195
- var LiteralSchema = /*#__PURE__*/function (_Schema) {
196
- _inherits(LiteralSchema, _Schema);
197
- var _super = _createSuper(LiteralSchema);
198
- function LiteralSchema(value) {
199
- var _this;
200
- var opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
201
- _classCallCheck(this, LiteralSchema);
202
- _this = _super.call(this);
203
- _this.value = value;
204
- _this.opt = opt;
205
- return _this;
206
- }
207
- _createClass(LiteralSchema, [{
208
- key: "validate",
209
- value: function validate(path, src) {
210
- if (this.opt && (src === null || src === undefined)) {
211
- return false;
212
- }
213
- if (typeof src !== "string") {
214
- return _defineProperty({}, path, [{
215
- message: "Expected 'string', got '".concat(_typeof(src), "'"),
216
- value: src
217
- }]);
218
- }
219
- if (src !== this.value) {
220
- return _defineProperty({}, path, [{
221
- message: "Expected literal '".concat(this.value, "', got '").concat(src, "'"),
222
- value: src
223
- }]);
224
- }
225
- return false;
226
- }
227
- }, {
228
- key: "assert",
229
- value: function assert(src) {
230
- if (this.opt && (src === null || src === undefined)) {
231
- return true;
232
- }
233
- return typeof src === "string";
234
- }
235
- }, {
236
- key: "optional",
237
- value: function optional() {
238
- return new LiteralSchema(this.value, true);
239
- }
240
- }, {
241
- key: "serialize",
242
- value: function serialize() {
243
- return {
244
- type: "literal",
245
- value: this.value,
246
- opt: this.opt
247
- };
248
- }
249
- }]);
250
- return LiteralSchema;
251
- }(Schema);
252
- var literal = function literal(value) {
253
- return new LiteralSchema(value);
254
- };
255
-
256
195
  var KeyOfSchema = /*#__PURE__*/function (_Schema) {
257
196
  _inherits(KeyOfSchema, _Schema);
258
197
  var _super = _createSuper(KeyOfSchema);
@@ -2,8 +2,8 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var expr_dist_valbuildCoreExpr = require('../../dist/index-6deb169d.cjs.dev.js');
6
- var index = require('../../dist/index-a5295001.cjs.dev.js');
5
+ var expr_dist_valbuildCoreExpr = require('../../dist/index-00276955.cjs.dev.js');
6
+ var index = require('../../dist/index-d23e237a.cjs.dev.js');
7
7
  require('../../dist/result-48320acd.cjs.dev.js');
8
8
 
9
9
 
@@ -2,8 +2,8 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var expr_dist_valbuildCoreExpr = require('../../dist/index-216627d7.cjs.prod.js');
6
- var index = require('../../dist/index-5bdaa229.cjs.prod.js');
5
+ var expr_dist_valbuildCoreExpr = require('../../dist/index-db60fc1d.cjs.prod.js');
6
+ var index = require('../../dist/index-7b467ee6.cjs.prod.js');
7
7
  require('../../dist/result-26f67b40.cjs.prod.js');
8
8
 
9
9
 
@@ -1,3 +1,3 @@
1
- export { e as evaluate, p as parse } from '../../dist/index-4f821892.esm.js';
2
- export { C as Call, E as Expr, N as NilSym, s as StringLiteral, t as StringTemplate, r as Sym } from '../../dist/index-c83918b8.esm.js';
1
+ export { e as evaluate, p as parse } from '../../dist/index-799bcf49.esm.js';
2
+ export { C as Call, E as Expr, N as NilSym, r as StringLiteral, s as StringTemplate, q as Sym } from '../../dist/index-5750c299.esm.js';
3
3
  import '../../dist/result-b96df128.esm.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@valbuild/core",
3
- "version": "0.43.1",
3
+ "version": "0.45.0",
4
4
  "private": false,
5
5
  "description": "Val - supercharged hard-coded content",
6
6
  "scripts": {
@@ -2,10 +2,10 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var index = require('../../dist/index-a5295001.cjs.dev.js');
5
+ var index = require('../../dist/index-d23e237a.cjs.dev.js');
6
6
  var result = require('../../dist/result-48320acd.cjs.dev.js');
7
7
  var util = require('../../dist/util-b213092b.cjs.dev.js');
8
- var ops = require('../../dist/ops-e02ab215.cjs.dev.js');
8
+ var ops = require('../../dist/ops-453cddfc.cjs.dev.js');
9
9
 
10
10
  function isNotRoot(path) {
11
11
  return result.isNonEmpty(path);
@@ -2,10 +2,10 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var index = require('../../dist/index-5bdaa229.cjs.prod.js');
5
+ var index = require('../../dist/index-7b467ee6.cjs.prod.js');
6
6
  var result = require('../../dist/result-26f67b40.cjs.prod.js');
7
7
  var util = require('../../dist/util-030d8a1f.cjs.prod.js');
8
- var ops = require('../../dist/ops-d88e99cd.cjs.prod.js');
8
+ var ops = require('../../dist/ops-18aded72.cjs.prod.js');
9
9
 
10
10
  function isNotRoot(path) {
11
11
  return result.isNonEmpty(path);
@@ -1,8 +1,8 @@
1
- import { e as _typeof, h as _slicedToArray, c as _createClass, b as _classCallCheck, u as _toConsumableArray } from '../../dist/index-c83918b8.esm.js';
1
+ import { e as _typeof, h as _slicedToArray, c as _createClass, b as _classCallCheck, t as _toConsumableArray } from '../../dist/index-5750c299.esm.js';
2
2
  import { f as isNonEmpty, e as err, o as ok, m as map, g as flatMap, i as isErr, h as flatMapReduce, j as filterOrElse, k as mapErr, l as map$1, n as all, p as flatten, q as allT } from '../../dist/result-b96df128.esm.js';
3
3
  import { p as pipe } from '../../dist/util-18613e99.esm.js';
4
- import { P as PatchError, s as splitModuleIdAndModulePath } from '../../dist/ops-266faf09.esm.js';
5
- export { P as PatchError } from '../../dist/ops-266faf09.esm.js';
4
+ import { P as PatchError, s as splitModuleIdAndModulePath } from '../../dist/ops-117cb796.esm.js';
5
+ export { P as PatchError } from '../../dist/ops-117cb796.esm.js';
6
6
 
7
7
  function isNotRoot(path) {
8
8
  return isNonEmpty(path);