@valbuild/core 0.21.1 → 0.22.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.
- package/dist/declarations/src/ValApi.d.ts +2 -1
- package/dist/declarations/src/index.d.ts +21 -3
- package/dist/declarations/src/module.d.ts +11 -5
- package/dist/declarations/src/patch/deref.d.ts +0 -3
- package/dist/declarations/src/patch/operation.d.ts +2 -0
- package/dist/declarations/src/schema/string.d.ts +5 -1
- package/dist/{index-75b79c89.cjs.prod.js → index-30eee5ec.cjs.prod.js} +47 -43
- package/dist/{index-067cff4a.cjs.prod.js → index-425d164d.cjs.prod.js} +1 -1
- package/dist/{index-31991dd7.cjs.dev.js → index-43369070.cjs.dev.js} +47 -43
- package/dist/{index-4bb14a92.esm.js → index-499b9e87.esm.js} +47 -43
- package/dist/{index-d17f9503.cjs.dev.js → index-a0f36fe3.cjs.dev.js} +1 -1
- package/dist/{index-870205b5.esm.js → index-f0475164.esm.js} +1 -1
- package/dist/{ops-9b396073.esm.js → ops-1225f750.esm.js} +5 -2
- package/dist/{ops-0f7617a0.cjs.dev.js → ops-558f07b7.cjs.dev.js} +5 -2
- package/dist/{ops-451ffb3f.cjs.prod.js → ops-b263963e.cjs.prod.js} +5 -2
- package/dist/valbuild-core.cjs.dev.js +251 -240
- package/dist/valbuild-core.cjs.prod.js +251 -240
- package/dist/valbuild-core.esm.js +252 -241
- package/expr/dist/valbuild-core-expr.cjs.dev.js +2 -2
- package/expr/dist/valbuild-core-expr.cjs.prod.js +2 -2
- package/expr/dist/valbuild-core-expr.esm.js +2 -2
- package/package.json +1 -1
- package/patch/dist/valbuild-core-patch.cjs.dev.js +13 -3
- package/patch/dist/valbuild-core-patch.cjs.prod.js +13 -3
- package/patch/dist/valbuild-core-patch.esm.js +14 -4
- package/src/ValApi.ts +9 -13
- package/src/index.ts +23 -3
- package/src/module.ts +40 -14
- package/src/patch/deref.test.ts +130 -132
- package/src/patch/deref.ts +12 -17
- package/src/patch/operation.ts +2 -0
- package/src/patch/parse.ts +15 -1
- package/src/schema/image.ts +5 -3
- package/src/schema/string.ts +27 -2
@@ -2,9 +2,9 @@
|
|
2
2
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
4
4
|
|
5
|
-
var index = require('./index-
|
6
|
-
var ops = require('./ops-
|
7
|
-
var expr_dist_valbuildCoreExpr = require('./index-
|
5
|
+
var index = require('./index-43369070.cjs.dev.js');
|
6
|
+
var ops = require('./ops-558f07b7.cjs.dev.js');
|
7
|
+
var expr_dist_valbuildCoreExpr = require('./index-a0f36fe3.cjs.dev.js');
|
8
8
|
var result = require('./result-48320acd.cjs.dev.js');
|
9
9
|
|
10
10
|
var NumberSchema = /*#__PURE__*/function (_Schema) {
|
@@ -79,6 +79,7 @@ var StringSchema = /*#__PURE__*/function (_Schema) {
|
|
79
79
|
index._createClass(StringSchema, [{
|
80
80
|
key: "validate",
|
81
81
|
value: function validate(path, src) {
|
82
|
+
var _this$options, _this$options2;
|
82
83
|
if (this.opt && (src === null || src === undefined)) {
|
83
84
|
return false;
|
84
85
|
}
|
@@ -88,6 +89,22 @@ var StringSchema = /*#__PURE__*/function (_Schema) {
|
|
88
89
|
value: src
|
89
90
|
}]);
|
90
91
|
}
|
92
|
+
var errors = [];
|
93
|
+
if ((_this$options = this.options) !== null && _this$options !== void 0 && _this$options.maxLength && src.length > this.options.maxLength) {
|
94
|
+
errors.push({
|
95
|
+
message: "Expected string to be at most ".concat(this.options.maxLength, " characters long, got ").concat(src.length),
|
96
|
+
value: src
|
97
|
+
});
|
98
|
+
}
|
99
|
+
if ((_this$options2 = this.options) !== null && _this$options2 !== void 0 && _this$options2.minLength && src.length < this.options.minLength) {
|
100
|
+
errors.push({
|
101
|
+
message: "Expected string to be at least ".concat(this.options.minLength, " characters long, got ").concat(src.length),
|
102
|
+
value: src
|
103
|
+
});
|
104
|
+
}
|
105
|
+
if (errors.length > 0) {
|
106
|
+
return index._defineProperty({}, path, errors);
|
107
|
+
}
|
91
108
|
return false;
|
92
109
|
}
|
93
110
|
}, {
|
@@ -454,15 +471,6 @@ var initVal = function initVal() {
|
|
454
471
|
};
|
455
472
|
};
|
456
473
|
|
457
|
-
/**
|
458
|
-
* Remote sources cannot include other remote sources.
|
459
|
-
*/
|
460
|
-
|
461
|
-
var REMOTE_REF_PROP = "_ref"; // TODO: same as FILE_REF_PROP so use same prop?
|
462
|
-
function isRemote(obj) {
|
463
|
-
return index._typeof(obj) === "object" && obj !== null && index.VAL_EXTENSION in obj && obj[index.VAL_EXTENSION] === "remote" && REMOTE_REF_PROP in obj && typeof obj[REMOTE_REF_PROP] === "string";
|
464
|
-
}
|
465
|
-
|
466
474
|
function derefPath(path) {
|
467
475
|
var dereffedPath = [];
|
468
476
|
var referencedPath = null;
|
@@ -503,7 +511,6 @@ function derefPath(path) {
|
|
503
511
|
return result.ok([dereffedPath, referencedPath]);
|
504
512
|
}
|
505
513
|
function derefPatch(patch, document, ops$1) {
|
506
|
-
var remotePatches = {};
|
507
514
|
var fileUpdates = {};
|
508
515
|
var dereferencedPatch = [];
|
509
516
|
var _iterator3 = result._createForOfIteratorHelper(patch),
|
@@ -531,15 +538,15 @@ function derefPatch(patch, document, ops$1) {
|
|
531
538
|
return result.err(new ops.PatchError("Expected base64 encoded string value for file reference, got ".concat(JSON.stringify(op.value))));
|
532
539
|
}
|
533
540
|
fileUpdates[value[index.FILE_REF_PROP]] = op.value;
|
534
|
-
|
535
|
-
if (!remotePatches[value[REMOTE_REF_PROP]]) {
|
536
|
-
|
537
|
-
}
|
538
|
-
remotePatches[value[REMOTE_REF_PROP]].push({
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
});
|
541
|
+
// } else if (isRemote(value)) {
|
542
|
+
// if (!remotePatches[value[REMOTE_REF_PROP]]) {
|
543
|
+
// remotePatches[value[REMOTE_REF_PROP]] = [];
|
544
|
+
// }
|
545
|
+
// remotePatches[value[REMOTE_REF_PROP]].push({
|
546
|
+
// op: "replace",
|
547
|
+
// path: referencedPath,
|
548
|
+
// value: op.value,
|
549
|
+
// });
|
543
550
|
} else {
|
544
551
|
return result.err(new ops.PatchError("Unknown reference: ".concat(JSON.stringify(op), " at path: ").concat(dereffedPath.join("/"))));
|
545
552
|
}
|
@@ -550,13 +557,13 @@ function derefPatch(patch, document, ops$1) {
|
|
550
557
|
dereferencedPatch.push(op);
|
551
558
|
}
|
552
559
|
} else if (op.op === "file") {
|
553
|
-
if (op.
|
554
|
-
return result.err(new ops.PatchError("Path must start with public"));
|
560
|
+
if (!op.filePath.startsWith("/public")) {
|
561
|
+
return result.err(new ops.PatchError("Path must start with /public"));
|
555
562
|
}
|
556
563
|
if (typeof op.value !== "string") {
|
557
564
|
return result.err(new ops.PatchError("File operation must have a value that is typeof string. Found: ".concat(index._typeof(op.value))));
|
558
565
|
}
|
559
|
-
fileUpdates[
|
566
|
+
fileUpdates[op.filePath] = op.value;
|
560
567
|
} else {
|
561
568
|
var _maybeDerefRes = derefPath(op.path);
|
562
569
|
if (result.isErr(_maybeDerefRes)) {
|
@@ -576,7 +583,6 @@ function derefPatch(patch, document, ops$1) {
|
|
576
583
|
_iterator3.f();
|
577
584
|
}
|
578
585
|
return result.ok({
|
579
|
-
remotePatches: remotePatches,
|
580
586
|
fileUpdates: fileUpdates,
|
581
587
|
dereferencedPatch: dereferencedPatch
|
582
588
|
});
|
@@ -719,304 +725,304 @@ function hasOwn(obj, prop) {
|
|
719
725
|
|
720
726
|
function _regeneratorRuntime() {
|
721
727
|
_regeneratorRuntime = function () {
|
722
|
-
return
|
728
|
+
return e;
|
723
729
|
};
|
724
|
-
var
|
725
|
-
|
726
|
-
|
727
|
-
|
728
|
-
|
730
|
+
var t,
|
731
|
+
e = {},
|
732
|
+
r = Object.prototype,
|
733
|
+
n = r.hasOwnProperty,
|
734
|
+
o = Object.defineProperty || function (t, e, r) {
|
735
|
+
t[e] = r.value;
|
729
736
|
},
|
730
|
-
|
731
|
-
|
732
|
-
|
733
|
-
|
734
|
-
function define(
|
735
|
-
return Object.defineProperty(
|
736
|
-
value:
|
737
|
+
i = "function" == typeof Symbol ? Symbol : {},
|
738
|
+
a = i.iterator || "@@iterator",
|
739
|
+
c = i.asyncIterator || "@@asyncIterator",
|
740
|
+
u = i.toStringTag || "@@toStringTag";
|
741
|
+
function define(t, e, r) {
|
742
|
+
return Object.defineProperty(t, e, {
|
743
|
+
value: r,
|
737
744
|
enumerable: !0,
|
738
745
|
configurable: !0,
|
739
746
|
writable: !0
|
740
|
-
}),
|
747
|
+
}), t[e];
|
741
748
|
}
|
742
749
|
try {
|
743
750
|
define({}, "");
|
744
|
-
} catch (
|
745
|
-
define = function (
|
746
|
-
return
|
751
|
+
} catch (t) {
|
752
|
+
define = function (t, e, r) {
|
753
|
+
return t[e] = r;
|
747
754
|
};
|
748
755
|
}
|
749
|
-
function wrap(
|
750
|
-
var
|
751
|
-
|
752
|
-
|
753
|
-
return
|
754
|
-
value: makeInvokeMethod(
|
755
|
-
}),
|
756
|
+
function wrap(t, e, r, n) {
|
757
|
+
var i = e && e.prototype instanceof Generator ? e : Generator,
|
758
|
+
a = Object.create(i.prototype),
|
759
|
+
c = new Context(n || []);
|
760
|
+
return o(a, "_invoke", {
|
761
|
+
value: makeInvokeMethod(t, r, c)
|
762
|
+
}), a;
|
756
763
|
}
|
757
|
-
function tryCatch(
|
764
|
+
function tryCatch(t, e, r) {
|
758
765
|
try {
|
759
766
|
return {
|
760
767
|
type: "normal",
|
761
|
-
arg:
|
768
|
+
arg: t.call(e, r)
|
762
769
|
};
|
763
|
-
} catch (
|
770
|
+
} catch (t) {
|
764
771
|
return {
|
765
772
|
type: "throw",
|
766
|
-
arg:
|
773
|
+
arg: t
|
767
774
|
};
|
768
775
|
}
|
769
776
|
}
|
770
|
-
|
771
|
-
var
|
777
|
+
e.wrap = wrap;
|
778
|
+
var h = "suspendedStart",
|
779
|
+
l = "suspendedYield",
|
780
|
+
f = "executing",
|
781
|
+
s = "completed",
|
782
|
+
y = {};
|
772
783
|
function Generator() {}
|
773
784
|
function GeneratorFunction() {}
|
774
785
|
function GeneratorFunctionPrototype() {}
|
775
|
-
var
|
776
|
-
define(
|
786
|
+
var p = {};
|
787
|
+
define(p, a, function () {
|
777
788
|
return this;
|
778
789
|
});
|
779
|
-
var
|
780
|
-
|
781
|
-
|
782
|
-
var
|
783
|
-
function defineIteratorMethods(
|
784
|
-
["next", "throw", "return"].forEach(function (
|
785
|
-
define(
|
786
|
-
return this._invoke(
|
790
|
+
var d = Object.getPrototypeOf,
|
791
|
+
v = d && d(d(values([])));
|
792
|
+
v && v !== r && n.call(v, a) && (p = v);
|
793
|
+
var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
|
794
|
+
function defineIteratorMethods(t) {
|
795
|
+
["next", "throw", "return"].forEach(function (e) {
|
796
|
+
define(t, e, function (t) {
|
797
|
+
return this._invoke(e, t);
|
787
798
|
});
|
788
799
|
});
|
789
800
|
}
|
790
|
-
function AsyncIterator(
|
791
|
-
function invoke(
|
792
|
-
var
|
793
|
-
if ("throw" !==
|
794
|
-
var
|
795
|
-
|
796
|
-
return
|
797
|
-
invoke("next",
|
798
|
-
}, function (
|
799
|
-
invoke("throw",
|
800
|
-
}) :
|
801
|
-
|
802
|
-
}, function (
|
803
|
-
return invoke("throw",
|
801
|
+
function AsyncIterator(t, e) {
|
802
|
+
function invoke(r, o, i, a) {
|
803
|
+
var c = tryCatch(t[r], t, o);
|
804
|
+
if ("throw" !== c.type) {
|
805
|
+
var u = c.arg,
|
806
|
+
h = u.value;
|
807
|
+
return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
|
808
|
+
invoke("next", t, i, a);
|
809
|
+
}, function (t) {
|
810
|
+
invoke("throw", t, i, a);
|
811
|
+
}) : e.resolve(h).then(function (t) {
|
812
|
+
u.value = t, i(u);
|
813
|
+
}, function (t) {
|
814
|
+
return invoke("throw", t, i, a);
|
804
815
|
});
|
805
816
|
}
|
806
|
-
|
817
|
+
a(c.arg);
|
807
818
|
}
|
808
|
-
var
|
809
|
-
|
810
|
-
value: function (
|
819
|
+
var r;
|
820
|
+
o(this, "_invoke", {
|
821
|
+
value: function (t, n) {
|
811
822
|
function callInvokeWithMethodAndArg() {
|
812
|
-
return new
|
813
|
-
invoke(
|
823
|
+
return new e(function (e, r) {
|
824
|
+
invoke(t, n, e, r);
|
814
825
|
});
|
815
826
|
}
|
816
|
-
return
|
827
|
+
return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
817
828
|
}
|
818
829
|
});
|
819
830
|
}
|
820
|
-
function makeInvokeMethod(
|
821
|
-
var
|
822
|
-
return function (
|
823
|
-
if (
|
824
|
-
if (
|
825
|
-
if ("throw" ===
|
826
|
-
return
|
831
|
+
function makeInvokeMethod(e, r, n) {
|
832
|
+
var o = h;
|
833
|
+
return function (i, a) {
|
834
|
+
if (o === f) throw new Error("Generator is already running");
|
835
|
+
if (o === s) {
|
836
|
+
if ("throw" === i) throw a;
|
837
|
+
return {
|
838
|
+
value: t,
|
839
|
+
done: !0
|
840
|
+
};
|
827
841
|
}
|
828
|
-
for (
|
829
|
-
var
|
830
|
-
if (
|
831
|
-
var
|
832
|
-
if (
|
833
|
-
if (
|
834
|
-
return
|
842
|
+
for (n.method = i, n.arg = a;;) {
|
843
|
+
var c = n.delegate;
|
844
|
+
if (c) {
|
845
|
+
var u = maybeInvokeDelegate(c, n);
|
846
|
+
if (u) {
|
847
|
+
if (u === y) continue;
|
848
|
+
return u;
|
835
849
|
}
|
836
850
|
}
|
837
|
-
if ("next" ===
|
838
|
-
if (
|
839
|
-
|
840
|
-
} else "return" ===
|
841
|
-
|
842
|
-
var
|
843
|
-
if ("normal" ===
|
844
|
-
if (
|
851
|
+
if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
|
852
|
+
if (o === h) throw o = s, n.arg;
|
853
|
+
n.dispatchException(n.arg);
|
854
|
+
} else "return" === n.method && n.abrupt("return", n.arg);
|
855
|
+
o = f;
|
856
|
+
var p = tryCatch(e, r, n);
|
857
|
+
if ("normal" === p.type) {
|
858
|
+
if (o = n.done ? s : l, p.arg === y) continue;
|
845
859
|
return {
|
846
|
-
value:
|
847
|
-
done:
|
860
|
+
value: p.arg,
|
861
|
+
done: n.done
|
848
862
|
};
|
849
863
|
}
|
850
|
-
"throw" ===
|
864
|
+
"throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
|
851
865
|
}
|
852
866
|
};
|
853
867
|
}
|
854
|
-
function maybeInvokeDelegate(
|
855
|
-
var
|
856
|
-
|
857
|
-
if (
|
858
|
-
var
|
859
|
-
if ("throw" ===
|
860
|
-
var
|
861
|
-
return
|
868
|
+
function maybeInvokeDelegate(e, r) {
|
869
|
+
var n = r.method,
|
870
|
+
o = e.iterator[n];
|
871
|
+
if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y;
|
872
|
+
var i = tryCatch(o, e.iterator, r.arg);
|
873
|
+
if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
|
874
|
+
var a = i.arg;
|
875
|
+
return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y);
|
862
876
|
}
|
863
|
-
function pushTryEntry(
|
864
|
-
var
|
865
|
-
tryLoc:
|
877
|
+
function pushTryEntry(t) {
|
878
|
+
var e = {
|
879
|
+
tryLoc: t[0]
|
866
880
|
};
|
867
|
-
1 in
|
881
|
+
1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
|
868
882
|
}
|
869
|
-
function resetTryEntry(
|
870
|
-
var
|
871
|
-
|
883
|
+
function resetTryEntry(t) {
|
884
|
+
var e = t.completion || {};
|
885
|
+
e.type = "normal", delete e.arg, t.completion = e;
|
872
886
|
}
|
873
|
-
function Context(
|
887
|
+
function Context(t) {
|
874
888
|
this.tryEntries = [{
|
875
889
|
tryLoc: "root"
|
876
|
-
}],
|
890
|
+
}], t.forEach(pushTryEntry, this), this.reset(!0);
|
877
891
|
}
|
878
|
-
function values(
|
879
|
-
if (
|
880
|
-
var
|
881
|
-
if (
|
882
|
-
if ("function" == typeof
|
883
|
-
if (!isNaN(
|
884
|
-
var
|
885
|
-
|
886
|
-
for (; ++
|
887
|
-
return next.value =
|
892
|
+
function values(e) {
|
893
|
+
if (e || "" === e) {
|
894
|
+
var r = e[a];
|
895
|
+
if (r) return r.call(e);
|
896
|
+
if ("function" == typeof e.next) return e;
|
897
|
+
if (!isNaN(e.length)) {
|
898
|
+
var o = -1,
|
899
|
+
i = function next() {
|
900
|
+
for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
|
901
|
+
return next.value = t, next.done = !0, next;
|
888
902
|
};
|
889
|
-
return
|
903
|
+
return i.next = i;
|
890
904
|
}
|
891
905
|
}
|
892
|
-
|
893
|
-
next: doneResult
|
894
|
-
};
|
895
|
-
}
|
896
|
-
function doneResult() {
|
897
|
-
return {
|
898
|
-
value: undefined,
|
899
|
-
done: !0
|
900
|
-
};
|
906
|
+
throw new TypeError(typeof e + " is not iterable");
|
901
907
|
}
|
902
|
-
return GeneratorFunction.prototype = GeneratorFunctionPrototype,
|
908
|
+
return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
|
903
909
|
value: GeneratorFunctionPrototype,
|
904
910
|
configurable: !0
|
905
|
-
}),
|
911
|
+
}), o(GeneratorFunctionPrototype, "constructor", {
|
906
912
|
value: GeneratorFunction,
|
907
913
|
configurable: !0
|
908
|
-
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype,
|
909
|
-
var
|
910
|
-
return !!
|
911
|
-
},
|
912
|
-
return Object.setPrototypeOf ? Object.setPrototypeOf(
|
913
|
-
},
|
914
|
+
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
|
915
|
+
var e = "function" == typeof t && t.constructor;
|
916
|
+
return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
|
917
|
+
}, e.mark = function (t) {
|
918
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
|
919
|
+
}, e.awrap = function (t) {
|
914
920
|
return {
|
915
|
-
__await:
|
921
|
+
__await: t
|
916
922
|
};
|
917
|
-
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype,
|
923
|
+
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
|
918
924
|
return this;
|
919
|
-
}),
|
920
|
-
void 0 ===
|
921
|
-
var
|
922
|
-
return
|
923
|
-
return
|
925
|
+
}), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
|
926
|
+
void 0 === i && (i = Promise);
|
927
|
+
var a = new AsyncIterator(wrap(t, r, n, o), i);
|
928
|
+
return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
|
929
|
+
return t.done ? t.value : a.next();
|
924
930
|
});
|
925
|
-
}, defineIteratorMethods(
|
931
|
+
}, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
|
926
932
|
return this;
|
927
|
-
}), define(
|
933
|
+
}), define(g, "toString", function () {
|
928
934
|
return "[object Generator]";
|
929
|
-
}),
|
930
|
-
var
|
931
|
-
|
932
|
-
for (var
|
933
|
-
return
|
934
|
-
for (;
|
935
|
-
var
|
936
|
-
if (
|
935
|
+
}), e.keys = function (t) {
|
936
|
+
var e = Object(t),
|
937
|
+
r = [];
|
938
|
+
for (var n in e) r.push(n);
|
939
|
+
return r.reverse(), function next() {
|
940
|
+
for (; r.length;) {
|
941
|
+
var t = r.pop();
|
942
|
+
if (t in e) return next.value = t, next.done = !1, next;
|
937
943
|
}
|
938
944
|
return next.done = !0, next;
|
939
945
|
};
|
940
|
-
},
|
946
|
+
}, e.values = values, Context.prototype = {
|
941
947
|
constructor: Context,
|
942
|
-
reset: function (
|
943
|
-
if (this.prev = 0, this.next = 0, this.sent = this._sent =
|
948
|
+
reset: function (e) {
|
949
|
+
if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
|
944
950
|
},
|
945
951
|
stop: function () {
|
946
952
|
this.done = !0;
|
947
|
-
var
|
948
|
-
if ("throw" ===
|
953
|
+
var t = this.tryEntries[0].completion;
|
954
|
+
if ("throw" === t.type) throw t.arg;
|
949
955
|
return this.rval;
|
950
956
|
},
|
951
|
-
dispatchException: function (
|
952
|
-
if (this.done) throw
|
953
|
-
var
|
954
|
-
function handle(
|
955
|
-
return
|
957
|
+
dispatchException: function (e) {
|
958
|
+
if (this.done) throw e;
|
959
|
+
var r = this;
|
960
|
+
function handle(n, o) {
|
961
|
+
return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
|
956
962
|
}
|
957
|
-
for (var
|
958
|
-
var
|
959
|
-
|
960
|
-
if ("root" ===
|
961
|
-
if (
|
962
|
-
var
|
963
|
-
|
964
|
-
if (
|
965
|
-
if (this.prev <
|
966
|
-
if (this.prev <
|
967
|
-
} else if (
|
968
|
-
if (this.prev <
|
963
|
+
for (var o = this.tryEntries.length - 1; o >= 0; --o) {
|
964
|
+
var i = this.tryEntries[o],
|
965
|
+
a = i.completion;
|
966
|
+
if ("root" === i.tryLoc) return handle("end");
|
967
|
+
if (i.tryLoc <= this.prev) {
|
968
|
+
var c = n.call(i, "catchLoc"),
|
969
|
+
u = n.call(i, "finallyLoc");
|
970
|
+
if (c && u) {
|
971
|
+
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
972
|
+
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
973
|
+
} else if (c) {
|
974
|
+
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
969
975
|
} else {
|
970
|
-
if (!
|
971
|
-
if (this.prev <
|
976
|
+
if (!u) throw new Error("try statement without catch or finally");
|
977
|
+
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
972
978
|
}
|
973
979
|
}
|
974
980
|
}
|
975
981
|
},
|
976
|
-
abrupt: function (
|
977
|
-
for (var
|
978
|
-
var
|
979
|
-
if (
|
980
|
-
var
|
982
|
+
abrupt: function (t, e) {
|
983
|
+
for (var r = this.tryEntries.length - 1; r >= 0; --r) {
|
984
|
+
var o = this.tryEntries[r];
|
985
|
+
if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
|
986
|
+
var i = o;
|
981
987
|
break;
|
982
988
|
}
|
983
989
|
}
|
984
|
-
|
985
|
-
var
|
986
|
-
return
|
990
|
+
i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
|
991
|
+
var a = i ? i.completion : {};
|
992
|
+
return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
|
987
993
|
},
|
988
|
-
complete: function (
|
989
|
-
if ("throw" ===
|
990
|
-
return "break" ===
|
994
|
+
complete: function (t, e) {
|
995
|
+
if ("throw" === t.type) throw t.arg;
|
996
|
+
return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y;
|
991
997
|
},
|
992
|
-
finish: function (
|
993
|
-
for (var
|
994
|
-
var
|
995
|
-
if (
|
998
|
+
finish: function (t) {
|
999
|
+
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
1000
|
+
var r = this.tryEntries[e];
|
1001
|
+
if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
|
996
1002
|
}
|
997
1003
|
},
|
998
|
-
catch: function (
|
999
|
-
for (var
|
1000
|
-
var
|
1001
|
-
if (
|
1002
|
-
var
|
1003
|
-
if ("throw" ===
|
1004
|
-
var
|
1005
|
-
resetTryEntry(
|
1004
|
+
catch: function (t) {
|
1005
|
+
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
1006
|
+
var r = this.tryEntries[e];
|
1007
|
+
if (r.tryLoc === t) {
|
1008
|
+
var n = r.completion;
|
1009
|
+
if ("throw" === n.type) {
|
1010
|
+
var o = n.arg;
|
1011
|
+
resetTryEntry(r);
|
1006
1012
|
}
|
1007
|
-
return
|
1013
|
+
return o;
|
1008
1014
|
}
|
1009
1015
|
}
|
1010
1016
|
throw new Error("illegal catch attempt");
|
1011
1017
|
},
|
1012
|
-
delegateYield: function (
|
1018
|
+
delegateYield: function (e, r, n) {
|
1013
1019
|
return this.delegate = {
|
1014
|
-
iterator: values(
|
1015
|
-
resultName:
|
1016
|
-
nextLoc:
|
1017
|
-
}, "next" === this.method && (this.arg =
|
1020
|
+
iterator: values(e),
|
1021
|
+
resultName: r,
|
1022
|
+
nextLoc: n
|
1023
|
+
}, "next" === this.method && (this.arg = t), y;
|
1018
1024
|
}
|
1019
|
-
},
|
1025
|
+
}, e;
|
1020
1026
|
}
|
1021
1027
|
|
1022
1028
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
@@ -1087,27 +1093,30 @@ var ValApi = /*#__PURE__*/function () {
|
|
1087
1093
|
value: function getDisableUrl() {
|
1088
1094
|
return "".concat(this.host, "/disable");
|
1089
1095
|
}
|
1096
|
+
}, {
|
1097
|
+
key: "getEditUrl",
|
1098
|
+
value: function getEditUrl() {
|
1099
|
+
return "".concat(this.host, "/static/edit");
|
1100
|
+
}
|
1090
1101
|
}, {
|
1091
1102
|
key: "postPatches",
|
1092
|
-
value: function postPatches(moduleId, patches,
|
1093
|
-
|
1094
|
-
if (commit) {
|
1095
|
-
var p = new URLSearchParams();
|
1096
|
-
p.set("commit", commit);
|
1097
|
-
params = "?".concat(p.toString());
|
1098
|
-
}
|
1099
|
-
return fetch("".concat(this.host, "/patches/~").concat(moduleId).concat(params), {
|
1103
|
+
value: function postPatches(moduleId, patches, headers) {
|
1104
|
+
return fetch("".concat(this.host, "/patches/~"), {
|
1100
1105
|
headers: headers || {
|
1101
1106
|
"Content-Type": "application/json"
|
1102
1107
|
},
|
1103
1108
|
method: "POST",
|
1104
|
-
body: JSON.stringify(patches)
|
1105
|
-
}).then(
|
1109
|
+
body: JSON.stringify(index._defineProperty({}, moduleId, patches))
|
1110
|
+
}).then(function (res) {
|
1111
|
+
return parse(res);
|
1112
|
+
});
|
1106
1113
|
}
|
1107
1114
|
}, {
|
1108
1115
|
key: "getSession",
|
1109
1116
|
value: function getSession() {
|
1110
|
-
return fetch("".concat(this.host, "/session")).then(
|
1117
|
+
return fetch("".concat(this.host, "/session")).then(function (res) {
|
1118
|
+
return parse(res);
|
1119
|
+
});
|
1111
1120
|
}
|
1112
1121
|
}, {
|
1113
1122
|
key: "getModules",
|
@@ -1127,7 +1136,9 @@ var ValApi = /*#__PURE__*/function () {
|
|
1127
1136
|
params.set("source", includeSource.toString());
|
1128
1137
|
return fetch("".concat(this.host, "/tree/~").concat(treePath, "?").concat(params.toString()), {
|
1129
1138
|
headers: headers
|
1130
|
-
}).then(
|
1139
|
+
}).then(function (res) {
|
1140
|
+
return parse(res);
|
1141
|
+
});
|
1131
1142
|
}
|
1132
1143
|
}]);
|
1133
1144
|
return ValApi;
|