@valbuild/core 0.99.1 → 0.100.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 (32) hide show
  1. package/dist/declarations/src/index.d.ts +5 -0
  2. package/dist/declarations/src/initVal.d.ts +2 -0
  3. package/dist/declarations/src/schema/array.d.ts +2 -1
  4. package/dist/declarations/src/schema/boolean.d.ts +2 -1
  5. package/dist/declarations/src/schema/date.d.ts +2 -1
  6. package/dist/declarations/src/schema/datetime.d.ts +2 -1
  7. package/dist/declarations/src/schema/file.d.ts +2 -1
  8. package/dist/declarations/src/schema/image.d.ts +2 -1
  9. package/dist/declarations/src/schema/index.d.ts +22 -0
  10. package/dist/declarations/src/schema/keyOf.d.ts +2 -1
  11. package/dist/declarations/src/schema/literal.d.ts +2 -1
  12. package/dist/declarations/src/schema/number.d.ts +2 -1
  13. package/dist/declarations/src/schema/object.d.ts +2 -1
  14. package/dist/declarations/src/schema/record.d.ts +46 -3
  15. package/dist/declarations/src/schema/richtext.d.ts +2 -1
  16. package/dist/declarations/src/schema/route.d.ts +2 -1
  17. package/dist/declarations/src/schema/string.d.ts +2 -1
  18. package/dist/declarations/src/schema/union.d.ts +9 -1
  19. package/dist/declarations/src/schema/validation/ValidationFix.d.ts +1 -1
  20. package/dist/declarations/src/selector/index.d.ts +3 -2
  21. package/dist/declarations/src/source/index.d.ts +3 -2
  22. package/dist/declarations/src/source/json.d.ts +73 -0
  23. package/dist/{index-b2601ac3.cjs.dev.js → index-202e48a3.cjs.dev.js} +583 -180
  24. package/dist/{index-28d99c34.cjs.prod.js → index-92ba715b.cjs.prod.js} +583 -180
  25. package/dist/{index-204b5d78.esm.js → index-c9241d81.esm.js} +583 -180
  26. package/dist/valbuild-core.cjs.dev.js +1 -1
  27. package/dist/valbuild-core.cjs.prod.js +1 -1
  28. package/dist/valbuild-core.esm.js +1 -1
  29. package/package.json +1 -1
  30. package/patch/dist/valbuild-core-patch.cjs.dev.js +1 -1
  31. package/patch/dist/valbuild-core-patch.cjs.prod.js +1 -1
  32. package/patch/dist/valbuild-core-patch.esm.js +2 -2
@@ -652,6 +652,13 @@ var FileSchema = /*#__PURE__*/function (_Schema) {
652
652
  value: function hidden() {
653
653
  return new FileSchema(this.options, this.opt, this.isRemote, this.customValidateFunctions, this.moduleMetadata, this.isReadonly, true, this.description);
654
654
  }
655
+ }, {
656
+ key: "executeCustomValidateAt",
657
+ value: function executeCustomValidateAt(path, src) {
658
+ return this.executeCustomValidateFunctions(src, this.customValidateFunctions, {
659
+ path: path
660
+ });
661
+ }
655
662
  }, {
656
663
  key: "executeSerialize",
657
664
  value: function executeSerialize() {
@@ -900,6 +907,13 @@ var StringSchema = /*#__PURE__*/function (_Schema) {
900
907
  value: function raw() {
901
908
  return new StringSchema(this.options, this.opt, true, this.customValidateFunctions, this.renderInput, this.isReadonly, this.isHidden, this.description);
902
909
  }
910
+ }, {
911
+ key: "executeCustomValidateAt",
912
+ value: function executeCustomValidateAt(path, src) {
913
+ return this.executeCustomValidateFunctions(src, this.customValidateFunctions, {
914
+ path: path
915
+ });
916
+ }
903
917
  }, {
904
918
  key: "executeSerialize",
905
919
  value: function executeSerialize() {
@@ -1116,6 +1130,13 @@ var ObjectSchema = /*#__PURE__*/function (_Schema) {
1116
1130
  value: function hidden() {
1117
1131
  return new ObjectSchema(this.items, this.opt, this.customValidateFunctions, this.isReadonly, true, this.description);
1118
1132
  }
1133
+ }, {
1134
+ key: "executeCustomValidateAt",
1135
+ value: function executeCustomValidateAt(path, src) {
1136
+ return this.executeCustomValidateFunctions(src, this.customValidateFunctions, {
1137
+ path: path
1138
+ });
1139
+ }
1119
1140
  }, {
1120
1141
  key: "executeSerialize",
1121
1142
  value: function executeSerialize() {
@@ -1275,6 +1296,13 @@ var ArraySchema = /*#__PURE__*/function (_Schema) {
1275
1296
  value: function hidden() {
1276
1297
  return new ArraySchema(this.item, this.opt, this.customValidateFunctions, this.isReadonly, true, this.description, this.renderInput);
1277
1298
  }
1299
+ }, {
1300
+ key: "executeCustomValidateAt",
1301
+ value: function executeCustomValidateAt(path, src) {
1302
+ return this.executeCustomValidateFunctions(src, this.customValidateFunctions, {
1303
+ path: path
1304
+ });
1305
+ }
1278
1306
  }, {
1279
1307
  key: "executeSerialize",
1280
1308
  value: function executeSerialize() {
@@ -1463,6 +1491,13 @@ var LiteralSchema = /*#__PURE__*/function (_Schema) {
1463
1491
  value: function hidden() {
1464
1492
  return new LiteralSchema(this.value, this.opt, this.customValidateFunctions, this.isReadonly, true, this.description);
1465
1493
  }
1494
+ }, {
1495
+ key: "executeCustomValidateAt",
1496
+ value: function executeCustomValidateAt(path, src) {
1497
+ return this.executeCustomValidateFunctions(src, this.customValidateFunctions, {
1498
+ path: path
1499
+ });
1500
+ }
1466
1501
  }, {
1467
1502
  key: "executeSerialize",
1468
1503
  value: function executeSerialize() {
@@ -1821,6 +1856,64 @@ var UnionSchema = /*#__PURE__*/function (_Schema) {
1821
1856
  value: function hidden() {
1822
1857
  return new UnionSchema(this.key, this.items, this.opt, this.customValidateFunctions, this.isReadonly, true, this.description);
1823
1858
  }
1859
+ }, {
1860
+ key: "executeCustomValidateAt",
1861
+ value: function executeCustomValidateAt(path, src) {
1862
+ var errors = this.executeCustomValidateFunctions(src, this.customValidateFunctions, {
1863
+ path: path
1864
+ });
1865
+ // A tagged union's variants share the union's path, so `Internal.resolvePath`
1866
+ // stops here and a variant's OWN validator would never be reached. Dispatch
1867
+ // into the variant this value takes — the union is the only node that knows
1868
+ // which one that is.
1869
+ var matched = this.matchedVariant(src);
1870
+ if (matched) {
1871
+ errors.push.apply(errors, _toConsumableArray(matched["executeCustomValidateAt"](path, src)));
1872
+ }
1873
+ return errors;
1874
+ }
1875
+
1876
+ /**
1877
+ * The variant schema a value takes, for a TAGGED union (string `key`). `null`
1878
+ * for a literal union (its variants are leaves with nothing to descend into) or
1879
+ * when the value matches none of them — a structural error `executeValidate`
1880
+ * already reports.
1881
+ */
1882
+ }, {
1883
+ key: "matchedVariant",
1884
+ value: function matchedVariant(src) {
1885
+ var key = this.key;
1886
+ if (typeof key !== "string" || !Array.isArray(this.items)) {
1887
+ return null;
1888
+ }
1889
+ if (src === null || _typeof(src) !== "object" || Array.isArray(src)) {
1890
+ return null;
1891
+ }
1892
+ var tag = src[key];
1893
+ if (typeof tag !== "string") {
1894
+ return null;
1895
+ }
1896
+ var objectSchemas = this.items;
1897
+ var _iterator4 = _createForOfIteratorHelper(objectSchemas),
1898
+ _step4;
1899
+ try {
1900
+ for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
1901
+ var item = _step4.value;
1902
+ if (!(item instanceof ObjectSchema)) {
1903
+ continue;
1904
+ }
1905
+ var tagSchema = item["items"][key];
1906
+ if (tagSchema instanceof LiteralSchema && tagSchema["value"] === tag) {
1907
+ return item;
1908
+ }
1909
+ }
1910
+ } catch (err) {
1911
+ _iterator4.e(err);
1912
+ } finally {
1913
+ _iterator4.f();
1914
+ }
1915
+ return null;
1916
+ }
1824
1917
  }, {
1825
1918
  key: "executeSerialize",
1826
1919
  value: function executeSerialize() {
@@ -2132,6 +2225,13 @@ var ImageSchema = /*#__PURE__*/function (_Schema) {
2132
2225
  value: function hidden() {
2133
2226
  return new ImageSchema(this.options, this.opt, this.isRemote, this.customValidateFunctions, this.moduleMetadata, this.isReadonly, true, this.description);
2134
2227
  }
2228
+ }, {
2229
+ key: "executeCustomValidateAt",
2230
+ value: function executeCustomValidateAt(path, src) {
2231
+ return this.executeCustomValidateFunctions(src, this.customValidateFunctions, {
2232
+ path: path
2233
+ });
2234
+ }
2135
2235
  }, {
2136
2236
  key: "executeSerialize",
2137
2237
  value: function executeSerialize() {
@@ -2307,6 +2407,13 @@ var RouteSchema = /*#__PURE__*/function (_Schema) {
2307
2407
  value: function hidden() {
2308
2408
  return new RouteSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, true, this.description);
2309
2409
  }
2410
+ }, {
2411
+ key: "executeCustomValidateAt",
2412
+ value: function executeCustomValidateAt(path, src) {
2413
+ return this.executeCustomValidateFunctions(src, this.customValidateFunctions, {
2414
+ path: path
2415
+ });
2416
+ }
2310
2417
  }, {
2311
2418
  key: "executeSerialize",
2312
2419
  value: function executeSerialize() {
@@ -2845,6 +2952,13 @@ var RichTextSchema = /*#__PURE__*/function (_Schema) {
2845
2952
  value: function hidden() {
2846
2953
  return new RichTextSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, true, this.description);
2847
2954
  }
2955
+ }, {
2956
+ key: "executeCustomValidateAt",
2957
+ value: function executeCustomValidateAt(path, src) {
2958
+ return this.executeCustomValidateFunctions(src, this.customValidateFunctions, {
2959
+ path: path
2960
+ });
2961
+ }
2848
2962
  }, {
2849
2963
  key: "executeSerialize",
2850
2964
  value: function executeSerialize() {
@@ -2894,6 +3008,290 @@ var richtext = function richtext(options) {
2894
3008
  return new RichTextSchema(options !== null && options !== void 0 ? options : {});
2895
3009
  };
2896
3010
 
3011
+ function _regeneratorDefine(e, r, n, t) {
3012
+ var i = Object.defineProperty;
3013
+ try {
3014
+ i({}, "", {});
3015
+ } catch (e) {
3016
+ i = 0;
3017
+ }
3018
+ _regeneratorDefine = function (e, r, n, t) {
3019
+ function o(r, n) {
3020
+ _regeneratorDefine(e, r, function (e) {
3021
+ return this._invoke(r, n, e);
3022
+ });
3023
+ }
3024
+ r ? i ? i(e, r, {
3025
+ value: n,
3026
+ enumerable: !t,
3027
+ configurable: !t,
3028
+ writable: !t
3029
+ }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2));
3030
+ }, _regeneratorDefine(e, r, n, t);
3031
+ }
3032
+
3033
+ function _regenerator() {
3034
+ /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
3035
+ var e,
3036
+ t,
3037
+ r = "function" == typeof Symbol ? Symbol : {},
3038
+ n = r.iterator || "@@iterator",
3039
+ o = r.toStringTag || "@@toStringTag";
3040
+ function i(r, n, o, i) {
3041
+ var c = n && n.prototype instanceof Generator ? n : Generator,
3042
+ u = Object.create(c.prototype);
3043
+ return _regeneratorDefine(u, "_invoke", function (r, n, o) {
3044
+ var i,
3045
+ c,
3046
+ u,
3047
+ f = 0,
3048
+ p = o || [],
3049
+ y = !1,
3050
+ G = {
3051
+ p: 0,
3052
+ n: 0,
3053
+ v: e,
3054
+ a: d,
3055
+ f: d.bind(e, 4),
3056
+ d: function (t, r) {
3057
+ return i = t, c = 0, u = e, G.n = r, a;
3058
+ }
3059
+ };
3060
+ function d(r, n) {
3061
+ for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) {
3062
+ var o,
3063
+ i = p[t],
3064
+ d = G.p,
3065
+ l = i[2];
3066
+ r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0));
3067
+ }
3068
+ if (o || r > 1) return a;
3069
+ throw y = !0, n;
3070
+ }
3071
+ return function (o, p, l) {
3072
+ if (f > 1) throw TypeError("Generator is already running");
3073
+ for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) {
3074
+ i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u);
3075
+ try {
3076
+ if (f = 2, i) {
3077
+ if (c || (o = "next"), t = i[o]) {
3078
+ if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object");
3079
+ if (!t.done) return t;
3080
+ u = t.value, c < 2 && (c = 0);
3081
+ } else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1);
3082
+ i = e;
3083
+ } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break;
3084
+ } catch (t) {
3085
+ i = e, c = 1, u = t;
3086
+ } finally {
3087
+ f = 1;
3088
+ }
3089
+ }
3090
+ return {
3091
+ value: t,
3092
+ done: y
3093
+ };
3094
+ };
3095
+ }(r, o, i), !0), u;
3096
+ }
3097
+ var a = {};
3098
+ function Generator() {}
3099
+ function GeneratorFunction() {}
3100
+ function GeneratorFunctionPrototype() {}
3101
+ t = Object.getPrototypeOf;
3102
+ var c = [][n] ? t(t([][n]())) : (_regeneratorDefine(t = {}, n, function () {
3103
+ return this;
3104
+ }), t),
3105
+ u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c);
3106
+ function f(e) {
3107
+ return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e;
3108
+ }
3109
+ return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine(u), _regeneratorDefine(u, o, "Generator"), _regeneratorDefine(u, n, function () {
3110
+ return this;
3111
+ }), _regeneratorDefine(u, "toString", function () {
3112
+ return "[object Generator]";
3113
+ }), (_regenerator = function () {
3114
+ return {
3115
+ w: i,
3116
+ m: f
3117
+ };
3118
+ })();
3119
+ }
3120
+
3121
+ function asyncGeneratorStep(n, t, e, r, o, a, c) {
3122
+ try {
3123
+ var i = n[a](c),
3124
+ u = i.value;
3125
+ } catch (n) {
3126
+ return void e(n);
3127
+ }
3128
+ i.done ? t(u) : Promise.resolve(u).then(r, o);
3129
+ }
3130
+ function _asyncToGenerator(n) {
3131
+ return function () {
3132
+ var t = this,
3133
+ e = arguments;
3134
+ return new Promise(function (r, o) {
3135
+ var a = n.apply(t, e);
3136
+ function _next(n) {
3137
+ asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
3138
+ }
3139
+ function _throw(n) {
3140
+ asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
3141
+ }
3142
+ _next(void 0);
3143
+ });
3144
+ };
3145
+ }
3146
+
3147
+ /**
3148
+ * The string used as the `_type` discriminator of a {@link JsonSource}.
3149
+ */
3150
+ var JSON_VAL_EXTENSION_TAG = "json";
3151
+
3152
+ /**
3153
+ * The lazy import thunk a {@link JsonSource} carries at runtime. It is NOT part
3154
+ * of the {@link JsonSource} type because `Source` must stay JSON-serializable
3155
+ * (it is sent over the wire as `Json`); the thunk is a runtime-only detail,
3156
+ * read via {@link getJsonImport}.
3157
+ */
3158
+
3159
+ /**
3160
+ * A JSON source represents a record/router entry whose value is stored in a
3161
+ * separate `*.val.json` file and loaded lazily via a dynamic `import()` thunk.
3162
+ *
3163
+ * This is what `c.json(() => import("./entry.val.json"))` returns.
3164
+ *
3165
+ * The *type* is a pure-JSON marker (`{ _type: "json", patch_id? }`) so that
3166
+ * `Source` stays JSON-serializable. At runtime the value additionally carries a
3167
+ * lazy import thunk (read via {@link getJsonImport}); over the wire only the
3168
+ * marker is sent.
3169
+ *
3170
+ * The phantom type parameter `T` is the (loosened, see {@link JsonOf}) type of
3171
+ * the value the JSON file resolves to. It is covariant: a `JsonSource` of a
3172
+ * narrower value type is assignable to a `JsonSource` of a wider one.
3173
+ */
3174
+
3175
+ function json(importThunk) {
3176
+ return _defineProperty(_defineProperty({}, VAL_EXTENSION, JSON_VAL_EXTENSION_TAG), "_import", importThunk);
3177
+ }
3178
+ function isJson(obj) {
3179
+ return _typeof(obj) === "object" && obj !== null && VAL_EXTENSION in obj && obj[VAL_EXTENSION] === JSON_VAL_EXTENSION_TAG;
3180
+ }
3181
+
3182
+ /**
3183
+ * Reads the runtime-only lazy import thunk from a {@link JsonSource}. Returns
3184
+ * `undefined` for a transport marker (sent over the wire without the thunk).
3185
+ */
3186
+ function getJsonImport(source) {
3187
+ var candidate = source._import;
3188
+ return typeof candidate === "function" ? candidate : undefined;
3189
+ }
3190
+
3191
+ /**
3192
+ * Recursively resolves every {@link JsonSource} marker in a source tree by
3193
+ * invoking its lazy import thunk, returning a fully-inlined source. This backs
3194
+ * the eager `fetchVal`/`useVal` path (load everything).
3195
+ *
3196
+ * Markers without a runtime thunk (transport markers received over the wire)
3197
+ * are left as-is — there is nothing to load from them locally. Other branded
3198
+ * leaf sources (file/image/remote/richtext) are returned untouched.
3199
+ */
3200
+ function resolveJsonValues(_x) {
3201
+ return _resolveJsonValues.apply(this, arguments);
3202
+ }
3203
+
3204
+ /**
3205
+ * Loosens a (strict) schema source type `T` into the type that a
3206
+ * `resolveJsonModule` import of the backing `*.val.json` can actually satisfy.
3207
+ *
3208
+ * Why this is needed: TypeScript widens literals when it infers the type of a
3209
+ * JSON module (e.g. `"a"` becomes `string`, `1` becomes `number`, and a branded
3210
+ * `_type: "file"` becomes `_type: string`). A strict schema type (with literal
3211
+ * unions, `RawString` brands, etc.) would therefore reject a perfectly valid
3212
+ * JSON file. `JsonOf<T>` performs the same widening at the type level so the
3213
+ * JSON content typechecks against the schema as strictly as JSON allows. Runtime
3214
+ * validation enforces the rest.
3215
+ *
3216
+ * The transform distributes over unions and recurses through objects/arrays,
3217
+ * preserving structure while widening every leaf literal. Val object-unions are
3218
+ * always discriminated, so distribute-and-recurse is sufficient (the discriminant
3219
+ * literal widens to its base type, but the per-variant shape stays distinct and a
3220
+ * concrete JSON value still matches exactly one variant).
3221
+ */
3222
+ function _resolveJsonValues() {
3223
+ _resolveJsonValues = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(source) {
3224
+ var thunk, loaded, entries;
3225
+ return _regenerator().w(function (_context2) {
3226
+ while (1) switch (_context2.n) {
3227
+ case 0:
3228
+ if (!isJson(source)) {
3229
+ _context2.n = 3;
3230
+ break;
3231
+ }
3232
+ thunk = getJsonImport(source);
3233
+ if (thunk) {
3234
+ _context2.n = 1;
3235
+ break;
3236
+ }
3237
+ return _context2.a(2, source);
3238
+ case 1:
3239
+ _context2.n = 2;
3240
+ return thunk();
3241
+ case 2:
3242
+ loaded = _context2.v["default"];
3243
+ return _context2.a(2, resolveJsonValues(loaded));
3244
+ case 3:
3245
+ if (!Array.isArray(source)) {
3246
+ _context2.n = 4;
3247
+ break;
3248
+ }
3249
+ return _context2.a(2, Promise.all(source.map(function (item) {
3250
+ return resolveJsonValues(item);
3251
+ })));
3252
+ case 4:
3253
+ if (!(source !== null && _typeof(source) === "object")) {
3254
+ _context2.n = 7;
3255
+ break;
3256
+ }
3257
+ if (!(VAL_EXTENSION in source)) {
3258
+ _context2.n = 5;
3259
+ break;
3260
+ }
3261
+ return _context2.a(2, source);
3262
+ case 5:
3263
+ _context2.n = 6;
3264
+ return Promise.all(Object.entries(source).map(/*#__PURE__*/function () {
3265
+ var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref2) {
3266
+ var _ref4, key, value, _t, _t2;
3267
+ return _regenerator().w(function (_context) {
3268
+ while (1) switch (_context.n) {
3269
+ case 0:
3270
+ _ref4 = _slicedToArray(_ref2, 2), key = _ref4[0], value = _ref4[1];
3271
+ _t = key;
3272
+ _context.n = 1;
3273
+ return resolveJsonValues(value);
3274
+ case 1:
3275
+ _t2 = _context.v;
3276
+ return _context.a(2, [_t, _t2]);
3277
+ }
3278
+ }, _callee);
3279
+ }));
3280
+ return function (_x2) {
3281
+ return _ref3.apply(this, arguments);
3282
+ };
3283
+ }()));
3284
+ case 6:
3285
+ entries = _context2.v;
3286
+ return _context2.a(2, Object.fromEntries(entries));
3287
+ case 7:
3288
+ return _context2.a(2, source);
3289
+ }
3290
+ }, _callee2);
3291
+ }));
3292
+ return _resolveJsonValues.apply(this, arguments);
3293
+ }
3294
+
2897
3295
  var RegEx = /^(https?:\/\/[^/]+)\/file\/p\/([^/]+)\/b\/([^/]+)\/v\/([^/]+)\/h\/([^/]+)\/f\/([^/]+)\/p\/(.+)$/;
2898
3296
  function splitRemoteRef(ref) {
2899
3297
  if (ref[0] === "/") {
@@ -2935,6 +3333,20 @@ function splitRemoteRef(ref) {
2935
3333
  };
2936
3334
  }
2937
3335
 
3336
+ /**
3337
+ * The source type of a `.jsonValues()` record: every entry value is EITHER a
3338
+ * lazily loaded {@link JsonSource} whose resolved content is the (loosened, see
3339
+ * {@link JsonOf}) item type, OR the item value written inline.
3340
+ *
3341
+ * Inline values are accepted by the TYPE on purpose: hand-authoring an entry
3342
+ * directly in the `.val.ts` (or copying one in from a non-jsonValues record) is
3343
+ * the natural first thing to write, and a type error there is a dead end — the
3344
+ * author cannot see what to write instead. Validation reports the inline entry
3345
+ * (`jsonValues:extract-entry`) and `val validate --fix` moves it into its own
3346
+ * `*.val.json`, so the mistake is caught and repaired instead of blocking
3347
+ * authoring.
3348
+ */
3349
+
2938
3350
  var RecordSchema = /*#__PURE__*/function (_Schema) {
2939
3351
  function RecordSchema(item) {
2940
3352
  var _this;
@@ -2946,7 +3358,8 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
2946
3358
  var isReadonly = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
2947
3359
  var isHidden = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : false;
2948
3360
  var description = arguments.length > 8 ? arguments[8] : undefined;
2949
- var renderInput = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : null;
3361
+ var isJsonValues = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : false;
3362
+ var renderInput = arguments.length > 10 && arguments[10] !== undefined ? arguments[10] : null;
2950
3363
  _classCallCheck(this, RecordSchema);
2951
3364
  _this = _callSuper(this, RecordSchema);
2952
3365
  _this.item = item;
@@ -2958,6 +3371,7 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
2958
3371
  _this.isReadonly = isReadonly;
2959
3372
  _this.isHidden = isHidden;
2960
3373
  _this.description = description;
3374
+ _this.isJsonValues = isJsonValues;
2961
3375
  _this.renderInput = renderInput;
2962
3376
  return _this;
2963
3377
  }
@@ -2965,12 +3379,12 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
2965
3379
  return _createClass(RecordSchema, [{
2966
3380
  key: "describe",
2967
3381
  value: function describe(description) {
2968
- return new RecordSchema(this.item, this.opt, this.customValidateFunctions, this.currentRouter, this.keySchema, this.mediaOptions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined, this.renderInput);
3382
+ return new RecordSchema(this.item, this.opt, this.customValidateFunctions, this.currentRouter, this.keySchema, this.mediaOptions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined, this.isJsonValues, this.renderInput);
2969
3383
  }
2970
3384
  }, {
2971
3385
  key: "validate",
2972
3386
  value: function validate(validationFunction) {
2973
- return new RecordSchema(this.item, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.currentRouter, this.keySchema, this.mediaOptions, this.isReadonly, this.isHidden, this.description, this.renderInput);
3387
+ return new RecordSchema(this.item, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.currentRouter, this.keySchema, this.mediaOptions, this.isReadonly, this.isHidden, this.description, this.isJsonValues, this.renderInput);
2974
3388
  }
2975
3389
  }, {
2976
3390
  key: "executeValidate",
@@ -3085,7 +3499,10 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
3085
3499
  _this2.markKeyErrorsAtPath(entryErr, subPath);
3086
3500
  }
3087
3501
  error = _this2.mergeValidationErrors(error, entryErr);
3088
- } else {
3502
+ } else if (_this2.isJsonValues && isJson(elem)) ; else {
3503
+ // Falls through for a jsonValues record whose entry content is inlined
3504
+ // (loaded in the UI, or hand-authored): same as a plain record — validate
3505
+ // the value against the item schema.
3089
3506
  var subError = _this2.item["executeValidate"](subPath, elem);
3090
3507
  error = _this2.mergeValidationErrors(error, subError);
3091
3508
  }
@@ -3326,29 +3743,61 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
3326
3743
  }, {
3327
3744
  key: "nullable",
3328
3745
  value: function nullable() {
3329
- return new RecordSchema(this.item, true, this.customValidateFunctions, this.currentRouter, this.keySchema, this.mediaOptions, this.isReadonly, this.isHidden, this.description, this.renderInput);
3746
+ return new RecordSchema(this.item, true, this.customValidateFunctions, this.currentRouter, this.keySchema, this.mediaOptions, this.isReadonly, this.isHidden, this.description, this.isJsonValues, this.renderInput);
3330
3747
  }
3331
3748
  }, {
3332
3749
  key: "readonly",
3333
3750
  value: function readonly() {
3334
- return new RecordSchema(this.item, this.opt, this.customValidateFunctions, this.currentRouter, this.keySchema, this.mediaOptions, true, this.isHidden, this.description, this.renderInput);
3751
+ return new RecordSchema(this.item, this.opt, this.customValidateFunctions, this.currentRouter, this.keySchema, this.mediaOptions, true, this.isHidden, this.description, this.isJsonValues, this.renderInput);
3335
3752
  }
3336
3753
  }, {
3337
3754
  key: "hidden",
3338
3755
  value: function hidden() {
3339
- return new RecordSchema(this.item, this.opt, this.customValidateFunctions, this.currentRouter, this.keySchema, this.mediaOptions, this.isReadonly, true, this.description, this.renderInput);
3756
+ return new RecordSchema(this.item, this.opt, this.customValidateFunctions, this.currentRouter, this.keySchema, this.mediaOptions, this.isReadonly, true, this.description, this.isJsonValues, this.renderInput);
3340
3757
  }
3341
3758
  }, {
3342
3759
  key: "router",
3343
3760
  value: function router(_router) {
3344
- return new RecordSchema(this.item, this.opt, this.customValidateFunctions, _router, this.keySchema, this.mediaOptions, this.isReadonly, this.isHidden, this.description, this.renderInput);
3761
+ return new RecordSchema(this.item, this.opt, this.customValidateFunctions, _router, this.keySchema, this.mediaOptions, this.isReadonly, this.isHidden, this.description, this.isJsonValues, this.renderInput);
3345
3762
  }
3346
3763
  }, {
3347
3764
  key: "remote",
3348
3765
  value: function remote() {
3349
3766
  return new RecordSchema(this.item, this.opt, this.customValidateFunctions, this.currentRouter, this.keySchema, this.mediaOptions ? _objectSpread2(_objectSpread2({}, this.mediaOptions), {}, {
3350
3767
  remote: true
3351
- }) : undefined, this.isReadonly, this.isHidden, this.description, this.renderInput);
3768
+ }) : undefined, this.isReadonly, this.isHidden, this.description, this.isJsonValues, this.renderInput);
3769
+ }
3770
+
3771
+ /**
3772
+ * Store each entry's value in its own lazily-loaded `*.val.json` file instead
3773
+ * of inlining it in the `.val.ts` module. Entry values become
3774
+ * {@link JsonSource} thunks (`c.json(() => import("./entry.val.json"))`),
3775
+ * which lets the runtime, the Studio and validation work one entry at a time
3776
+ * so a record/router can scale to many thousands of entries.
3777
+ *
3778
+ * Not supported on image/file galleries (`s.images()` / `s.files()`).
3779
+ *
3780
+ * Only supported on a module's ROOT record/router — a `.jsonValues()` record
3781
+ * nested inside an object/array/record is rejected at startup with a module
3782
+ * error, because the single-entry fetch endpoint, the Studio's content
3783
+ * substitution and content validation are all root-only.
3784
+ */
3785
+ }, {
3786
+ key: "jsonValues",
3787
+ value: function jsonValues() {
3788
+ if (this.mediaOptions) {
3789
+ throw new Error(".jsonValues() cannot be used with image/file galleries (s.images()/s.files())");
3790
+ }
3791
+ if (this.customValidateFunctions.length > 0) {
3792
+ // `.jsonValues()` changes the source shape to JsonSource entries, so a
3793
+ // validator typed against the previous Src cannot be carried over. Refusing
3794
+ // is the point: silently dropping it left the developer looking at a
3795
+ // `.validate(...)` in their source file that never ran anywhere.
3796
+ throw new Error(".jsonValues() must come BEFORE .validate(): a validator added first is typed against the un-lazy source shape and cannot be carried over. Write s.record(...).jsonValues().validate(...) instead.");
3797
+ }
3798
+ return new RecordSchema(this.item, this.opt,
3799
+ // Empty by construction: the guard above rejects any that were registered.
3800
+ [], this.currentRouter, this.keySchema, this.mediaOptions, this.isReadonly, this.isHidden, this.description, true, this.renderInput);
3352
3801
  }
3353
3802
  }, {
3354
3803
  key: "getRouterValidations",
@@ -3392,6 +3841,13 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
3392
3841
  }
3393
3842
  return false;
3394
3843
  }
3844
+ }, {
3845
+ key: "executeCustomValidateAt",
3846
+ value: function executeCustomValidateAt(path, src) {
3847
+ return this.executeCustomValidateFunctions(src, this.customValidateFunctions, {
3848
+ path: path
3849
+ });
3850
+ }
3395
3851
  }, {
3396
3852
  key: "executeSerialize",
3397
3853
  value: function executeSerialize() {
@@ -3403,6 +3859,7 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
3403
3859
  opt: this.opt,
3404
3860
  router: (_this$currentRouter = this.currentRouter) === null || _this$currentRouter === void 0 ? void 0 : _this$currentRouter.getRouterId(),
3405
3861
  customValidate: this.customValidateFunctions && ((_this$customValidateF = this.customValidateFunctions) === null || _this$customValidateF === void 0 ? void 0 : _this$customValidateF.length) > 0,
3862
+ jsonValues: this.isJsonValues ? true : undefined,
3406
3863
  readonly: this.isReadonly,
3407
3864
  hidden: this.isHidden,
3408
3865
  description: this.description
@@ -3418,6 +3875,18 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
3418
3875
  }
3419
3876
  return result;
3420
3877
  }
3878
+
3879
+ /**
3880
+ * Validate the loaded content of a single `.jsonValues()` entry against the
3881
+ * item schema. The server calls this once it has loaded the backing
3882
+ * `*.val.json` for an entry (the deep validation that `executeValidate`
3883
+ * defers).
3884
+ */
3885
+ }, {
3886
+ key: "validateJsonEntryContent",
3887
+ value: function validateJsonEntryContent(path, content) {
3888
+ return this.item["executeValidate"](path, content);
3889
+ }
3421
3890
  }, {
3422
3891
  key: "executeRender",
3423
3892
  value: function executeRender(sourcePath, src) {
@@ -3430,6 +3899,13 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
3430
3899
  if (itemSrc === null || itemSrc === undefined) {
3431
3900
  continue;
3432
3901
  }
3902
+ if (isJson(itemSrc)) {
3903
+ // An un-loaded `.jsonValues()` entry: an opaque marker, not the item this
3904
+ // schema describes. Skipping it is what makes rendering a partially
3905
+ // loaded record work — the result comes out covering exactly the loaded
3906
+ // keys, and the caller renders a placeholder for the rest.
3907
+ continue;
3908
+ }
3433
3909
  var subPath = unsafeCreateSourcePath(sourcePath, _key);
3434
3910
  var itemResult = this.item["executeRender"](subPath, itemSrc);
3435
3911
  for (var keyS in itemResult) {
@@ -3447,45 +3923,52 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
3447
3923
  message: "Unknown layout type: " + layout
3448
3924
  };
3449
3925
  }
3450
- try {
3451
- res[sourcePath] = {
3452
- status: "success",
3453
- data: {
3454
- layout: "list",
3455
- parent: "record",
3456
- items: Object.entries(src).map(function (_ref14) {
3457
- var _ref15 = _slicedToArray(_ref14, 2),
3458
- key = _ref15[0],
3459
- val = _ref15[1];
3460
- // NB NB: display is actually defined by the user
3461
- var _prepare = prepare({
3462
- key: key,
3463
- val: val
3464
- }),
3465
- title = _prepare.title,
3466
- subtitle = _prepare.subtitle,
3467
- image = _prepare.image;
3468
- return [key, {
3469
- title: title,
3470
- subtitle: subtitle,
3471
- image: image
3472
- }];
3473
- })
3474
- }
3475
- };
3476
- } catch (e) {
3477
- res[sourcePath] = {
3478
- status: "error",
3479
- message: e instanceof Error ? e.message : "Unknown error"
3480
- };
3926
+ var items = [];
3927
+ for (var _i = 0, _Object$entries = Object.entries(src); _i < _Object$entries.length; _i++) {
3928
+ var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
3929
+ _key3 = _Object$entries$_i[0],
3930
+ val = _Object$entries$_i[1];
3931
+ if (isJson(val)) {
3932
+ continue; // as above: nothing to select from an un-loaded entry
3933
+ }
3934
+ // Per KEY, not per record: `select` is user code, and one entry whose
3935
+ // data trips it up must not take out the whole list.
3936
+ try {
3937
+ // NB NB: display is actually defined by the user
3938
+ var _prepare = prepare({
3939
+ key: _key3,
3940
+ val: val
3941
+ }),
3942
+ title = _prepare.title,
3943
+ subtitle = _prepare.subtitle,
3944
+ image = _prepare.image;
3945
+ items.push([_key3, {
3946
+ title: title,
3947
+ subtitle: subtitle,
3948
+ image: image
3949
+ }]);
3950
+ } catch (e) {
3951
+ res[unsafeCreateSourcePath(sourcePath, _key3)] = {
3952
+ status: "error",
3953
+ message: e instanceof Error ? e.message : "Unknown error"
3954
+ };
3955
+ }
3481
3956
  }
3957
+ res[sourcePath] = {
3958
+ status: "success",
3959
+ data: {
3960
+ layout: "list",
3961
+ parent: "record",
3962
+ items: items
3963
+ }
3964
+ };
3482
3965
  }
3483
3966
  return res;
3484
3967
  }
3485
3968
  }, {
3486
3969
  key: "render",
3487
3970
  value: function render(input) {
3488
- return new RecordSchema(this.item, this.opt, this.customValidateFunctions, this.currentRouter, this.keySchema, this.mediaOptions, this.isReadonly, this.isHidden, this.description, {
3971
+ return new RecordSchema(this.item, this.opt, this.customValidateFunctions, this.currentRouter, this.keySchema, this.mediaOptions, this.isReadonly, this.isHidden, this.description, this.isJsonValues, {
3489
3972
  layout: input.as,
3490
3973
  select: input.select
3491
3974
  });
@@ -3603,6 +4086,13 @@ function resolvePath(path, valModule, schema) {
3603
4086
  }
3604
4087
  resolvedSource = resolvedSource[part];
3605
4088
  resolvedSchema = resolvedSchema instanceof RecordSchema ? (_resolvedSchema2 = resolvedSchema) === null || _resolvedSchema2 === void 0 ? void 0 : _resolvedSchema2["item"] : resolvedSchema.item;
4089
+ // A `.jsonValues()` entry value is a lazily-loaded JsonSource marker. We
4090
+ // can resolve the entry itself (schema is now `item`), but we cannot
4091
+ // descend deeper until the backing `*.val.json` content has been loaded
4092
+ // and substituted into the source tree (done by the UI/server layer).
4093
+ if (isJson(resolvedSource) && parts.length > 0) {
4094
+ throw Error("Cannot resolve path into a jsonValues entry until its content is loaded. Path: ".concat(path));
4095
+ }
3606
4096
  } else if (isObjectSchema(resolvedSchema)) {
3607
4097
  if (_typeof(resolvedSource) !== "object") {
3608
4098
  throw Error("Schema type error: expected source to be type of object, but got ".concat(_typeof(resolvedSource)));
@@ -3807,6 +4297,16 @@ function safeResolvePath(path, valModule, schema) {
3807
4297
  }
3808
4298
  resolvedSource = resolvedSource[part];
3809
4299
  resolvedSchema = resolvedSchema instanceof RecordSchema ? (_resolvedSchema4 = resolvedSchema) === null || _resolvedSchema4 === void 0 ? void 0 : _resolvedSchema4["item"] : resolvedSchema.item;
4300
+ // jsonValues entry: cannot descend deeper until the backing `*.val.json`
4301
+ // content is loaded into the source tree.
4302
+ if (isJson(resolvedSource) && parts.length > 0) {
4303
+ return {
4304
+ v: {
4305
+ status: "error",
4306
+ message: "Cannot resolve path into a jsonValues entry until its content is loaded. Path: ".concat(path)
4307
+ }
4308
+ };
4309
+ }
3810
4310
  } else if (isObjectSchema(resolvedSchema)) {
3811
4311
  if (resolvedSource === undefined) {
3812
4312
  return {
@@ -4142,6 +4642,13 @@ var NumberSchema = /*#__PURE__*/function (_Schema) {
4142
4642
  min: _min
4143
4643
  }), this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description);
4144
4644
  }
4645
+ }, {
4646
+ key: "executeCustomValidateAt",
4647
+ value: function executeCustomValidateAt(path, src) {
4648
+ return this.executeCustomValidateFunctions(src, this.customValidateFunctions, {
4649
+ path: path
4650
+ });
4651
+ }
4145
4652
  }, {
4146
4653
  key: "executeSerialize",
4147
4654
  value: function executeSerialize() {
@@ -4256,6 +4763,13 @@ var BooleanSchema = /*#__PURE__*/function (_Schema) {
4256
4763
  value: function hidden() {
4257
4764
  return new BooleanSchema(this.opt, this.customValidateFunctions, this.isReadonly, true, this.description);
4258
4765
  }
4766
+ }, {
4767
+ key: "executeCustomValidateAt",
4768
+ value: function executeCustomValidateAt(path, src) {
4769
+ return this.executeCustomValidateFunctions(src, this.customValidateFunctions, {
4770
+ path: path
4771
+ });
4772
+ }
4259
4773
  }, {
4260
4774
  key: "executeSerialize",
4261
4775
  value: function executeSerialize() {
@@ -4450,6 +4964,13 @@ var KeyOfSchema = /*#__PURE__*/function (_Schema) {
4450
4964
  value: function hidden() {
4451
4965
  return new KeyOfSchema(this.schema, this.sourcePath, this.opt, this.customValidateFunctions, this.isReadonly, true, this.description);
4452
4966
  }
4967
+ }, {
4968
+ key: "executeCustomValidateAt",
4969
+ value: function executeCustomValidateAt(path, src) {
4970
+ return this.executeCustomValidateFunctions(src, this.customValidateFunctions, {
4971
+ path: path
4972
+ });
4973
+ }
4453
4974
  }, {
4454
4975
  key: "executeSerialize",
4455
4976
  value: function executeSerialize() {
@@ -4695,6 +5216,13 @@ var DateSchema = /*#__PURE__*/function (_Schema) {
4695
5216
  value: function hidden() {
4696
5217
  return new DateSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, true, this.description);
4697
5218
  }
5219
+ }, {
5220
+ key: "executeCustomValidateAt",
5221
+ value: function executeCustomValidateAt(path, src) {
5222
+ return this.executeCustomValidateFunctions(src, this.customValidateFunctions, {
5223
+ path: path
5224
+ });
5225
+ }
4698
5226
  }, {
4699
5227
  key: "executeSerialize",
4700
5228
  value: function executeSerialize() {
@@ -4892,6 +5420,13 @@ var DateTimeSchema = /*#__PURE__*/function (_Schema) {
4892
5420
  value: function hidden() {
4893
5421
  return new DateTimeSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, true, this.description);
4894
5422
  }
5423
+ }, {
5424
+ key: "executeCustomValidateAt",
5425
+ value: function executeCustomValidateAt(path, src) {
5426
+ return this.executeCustomValidateFunctions(src, this.customValidateFunctions, {
5427
+ path: path
5428
+ });
5429
+ }
4895
5430
  }, {
4896
5431
  key: "executeSerialize",
4897
5432
  value: function executeSerialize() {
@@ -5133,7 +5668,8 @@ var initVal = function initVal(config) {
5133
5668
  define: define,
5134
5669
  remote: initRemote(),
5135
5670
  file: initFile(config),
5136
- image: initImage(config)
5671
+ image: initImage(config),
5672
+ json: json
5137
5673
  },
5138
5674
  s: s,
5139
5675
  config: config
@@ -5160,142 +5696,6 @@ function modules(config, modules) {
5160
5696
  };
5161
5697
  }
5162
5698
 
5163
- function _regeneratorDefine(e, r, n, t) {
5164
- var i = Object.defineProperty;
5165
- try {
5166
- i({}, "", {});
5167
- } catch (e) {
5168
- i = 0;
5169
- }
5170
- _regeneratorDefine = function (e, r, n, t) {
5171
- function o(r, n) {
5172
- _regeneratorDefine(e, r, function (e) {
5173
- return this._invoke(r, n, e);
5174
- });
5175
- }
5176
- r ? i ? i(e, r, {
5177
- value: n,
5178
- enumerable: !t,
5179
- configurable: !t,
5180
- writable: !t
5181
- }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2));
5182
- }, _regeneratorDefine(e, r, n, t);
5183
- }
5184
-
5185
- function _regenerator() {
5186
- /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
5187
- var e,
5188
- t,
5189
- r = "function" == typeof Symbol ? Symbol : {},
5190
- n = r.iterator || "@@iterator",
5191
- o = r.toStringTag || "@@toStringTag";
5192
- function i(r, n, o, i) {
5193
- var c = n && n.prototype instanceof Generator ? n : Generator,
5194
- u = Object.create(c.prototype);
5195
- return _regeneratorDefine(u, "_invoke", function (r, n, o) {
5196
- var i,
5197
- c,
5198
- u,
5199
- f = 0,
5200
- p = o || [],
5201
- y = !1,
5202
- G = {
5203
- p: 0,
5204
- n: 0,
5205
- v: e,
5206
- a: d,
5207
- f: d.bind(e, 4),
5208
- d: function (t, r) {
5209
- return i = t, c = 0, u = e, G.n = r, a;
5210
- }
5211
- };
5212
- function d(r, n) {
5213
- for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) {
5214
- var o,
5215
- i = p[t],
5216
- d = G.p,
5217
- l = i[2];
5218
- r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0));
5219
- }
5220
- if (o || r > 1) return a;
5221
- throw y = !0, n;
5222
- }
5223
- return function (o, p, l) {
5224
- if (f > 1) throw TypeError("Generator is already running");
5225
- for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) {
5226
- i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u);
5227
- try {
5228
- if (f = 2, i) {
5229
- if (c || (o = "next"), t = i[o]) {
5230
- if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object");
5231
- if (!t.done) return t;
5232
- u = t.value, c < 2 && (c = 0);
5233
- } else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1);
5234
- i = e;
5235
- } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break;
5236
- } catch (t) {
5237
- i = e, c = 1, u = t;
5238
- } finally {
5239
- f = 1;
5240
- }
5241
- }
5242
- return {
5243
- value: t,
5244
- done: y
5245
- };
5246
- };
5247
- }(r, o, i), !0), u;
5248
- }
5249
- var a = {};
5250
- function Generator() {}
5251
- function GeneratorFunction() {}
5252
- function GeneratorFunctionPrototype() {}
5253
- t = Object.getPrototypeOf;
5254
- var c = [][n] ? t(t([][n]())) : (_regeneratorDefine(t = {}, n, function () {
5255
- return this;
5256
- }), t),
5257
- u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c);
5258
- function f(e) {
5259
- return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e;
5260
- }
5261
- return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine(u), _regeneratorDefine(u, o, "Generator"), _regeneratorDefine(u, n, function () {
5262
- return this;
5263
- }), _regeneratorDefine(u, "toString", function () {
5264
- return "[object Generator]";
5265
- }), (_regenerator = function () {
5266
- return {
5267
- w: i,
5268
- m: f
5269
- };
5270
- })();
5271
- }
5272
-
5273
- function asyncGeneratorStep(n, t, e, r, o, a, c) {
5274
- try {
5275
- var i = n[a](c),
5276
- u = i.value;
5277
- } catch (n) {
5278
- return void e(n);
5279
- }
5280
- i.done ? t(u) : Promise.resolve(u).then(r, o);
5281
- }
5282
- function _asyncToGenerator(n) {
5283
- return function () {
5284
- var t = this,
5285
- e = arguments;
5286
- return new Promise(function (r, o) {
5287
- var a = n.apply(t, e);
5288
- function _next(n) {
5289
- asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
5290
- }
5291
- function _throw(n) {
5292
- asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
5293
- }
5294
- _next(void 0);
5295
- });
5296
- };
5297
- }
5298
-
5299
5699
  /**
5300
5700
  * From: https://github.com/kawanet/sha256-uint8array/commit/a035f83824c319d01ca1e7559fdcf1632c0cd6c4
5301
5701
  *
@@ -6795,7 +7195,7 @@ function deserializeSchema(serialized) {
6795
7195
  return schema;
6796
7196
  }
6797
7197
  function deserializeSchemaImpl(serialized) {
6798
- var _serialized$options, _serialized$options2, _serialized$accept, _serialized$directory, _serialized$remote;
7198
+ var _serialized$options, _serialized$options2, _serialized$accept, _serialized$directory, _serialized$remote, _serialized$jsonValue;
6799
7199
  switch (serialized.type) {
6800
7200
  case "string":
6801
7201
  return new StringSchema(_objectSpread2(_objectSpread2({}, serialized.options), {}, {
@@ -6844,7 +7244,7 @@ function deserializeSchemaImpl(serialized) {
6844
7244
  directory: (_serialized$directory = serialized.directory) !== null && _serialized$directory !== void 0 ? _serialized$directory : "/public/val",
6845
7245
  remote: (_serialized$remote = serialized.remote) !== null && _serialized$remote !== void 0 ? _serialized$remote : false,
6846
7246
  altSchema: serialized.alt ? deserializeSchema(serialized.alt) : undefined
6847
- } : undefined, false, false, serialized.description);
7247
+ } : undefined, false, false, serialized.description, (_serialized$jsonValue = serialized.jsonValues) !== null && _serialized$jsonValue !== void 0 ? _serialized$jsonValue : false);
6848
7248
  case "keyOf":
6849
7249
  return new KeyOfSchema(serialized.schema, serialized.path, serialized.opt, [], false, false, serialized.description);
6850
7250
  case "route":
@@ -7163,6 +7563,9 @@ var Internal = {
7163
7563
  },
7164
7564
  isVal: isVal,
7165
7565
  isFile: isFile,
7566
+ isJson: isJson,
7567
+ getJsonImport: getJsonImport,
7568
+ resolveJsonValues: resolveJsonValues,
7166
7569
  createValPathOfItem: createValPathOfItem,
7167
7570
  getSHA256Hash: getSHA256Hash,
7168
7571
  initSchema: initSchema,