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