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