@valbuild/tanstack 0.144.11 → 0.144.12
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/CHANGELOG.md +12 -0
- package/client/dist/valbuild-tanstack-client.cjs.dev.js +59 -19
- package/client/dist/valbuild-tanstack-client.cjs.prod.js +59 -19
- package/client/dist/valbuild-tanstack-client.esm.js +59 -19
- package/dist/{routeFromVal-97111bfd.cjs.dev.js → routeFromVal-385ee69c.cjs.dev.js} +113 -0
- package/dist/{routeFromVal-1221e70d.esm.js → routeFromVal-ae54a17e.esm.js} +112 -2
- package/dist/{routeFromVal-0b39e8e3.cjs.prod.js → routeFromVal-ffa948ef.cjs.prod.js} +113 -0
- package/dist/valbuild-tanstack.cjs.dev.js +1 -1
- package/dist/valbuild-tanstack.cjs.prod.js +1 -1
- package/dist/valbuild-tanstack.esm.js +1 -1
- package/dist/{version-e2b90a42.esm.js → version-3f098960.esm.js} +1 -1
- package/dist/{version-c09cd870.cjs.dev.js → version-656fbc67.cjs.prod.js} +1 -1
- package/dist/{version-4c9ab17f.cjs.prod.js → version-70bf0fb4.cjs.dev.js} +1 -1
- package/package.json +7 -7
- package/server/dist/valbuild-tanstack-server.cjs.dev.js +368 -265
- package/server/dist/valbuild-tanstack-server.cjs.prod.js +368 -265
- package/server/dist/valbuild-tanstack-server.esm.js +368 -265
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var version = require('../../dist/version-
|
|
5
|
+
var version = require('../../dist/version-70bf0fb4.cjs.dev.js');
|
|
6
6
|
var core = require('@valbuild/core');
|
|
7
7
|
var createForOfIteratorHelper = require('../../dist/createForOfIteratorHelper-4497beef.cjs.dev.js');
|
|
8
8
|
var server = require('@valbuild/server');
|
|
9
|
-
var routeFromVal = require('../../dist/routeFromVal-
|
|
9
|
+
var routeFromVal = require('../../dist/routeFromVal-385ee69c.cjs.dev.js');
|
|
10
10
|
var stega = require('@valbuild/react/stega');
|
|
11
11
|
var internal = require('@valbuild/shared/internal');
|
|
12
12
|
var mcp = require('@valbuild/mcp');
|
|
@@ -444,16 +444,16 @@ function loadDraftSources(_x, _x2) {
|
|
|
444
444
|
return _loadDraftSources.apply(this, arguments);
|
|
445
445
|
}
|
|
446
446
|
function _loadDraftSources() {
|
|
447
|
-
_loadDraftSources = version._asyncToGenerator(/*#__PURE__*/version._regenerator().m(function
|
|
447
|
+
_loadDraftSources = version._asyncToGenerator(/*#__PURE__*/version._regenerator().m(function _callee8(valServerPromise, sessionCookie) {
|
|
448
448
|
var valServer, treeRes;
|
|
449
|
-
return version._regenerator().w(function (
|
|
450
|
-
while (1) switch (
|
|
449
|
+
return version._regenerator().w(function (_context8) {
|
|
450
|
+
while (1) switch (_context8.n) {
|
|
451
451
|
case 0:
|
|
452
|
-
|
|
452
|
+
_context8.n = 1;
|
|
453
453
|
return valServerPromise;
|
|
454
454
|
case 1:
|
|
455
|
-
valServer =
|
|
456
|
-
|
|
455
|
+
valServer = _context8.v;
|
|
456
|
+
_context8.n = 2;
|
|
457
457
|
return valServer["/sources/~"]["PUT"]({
|
|
458
458
|
path: "/",
|
|
459
459
|
query: {
|
|
@@ -482,25 +482,25 @@ function _loadDraftSources() {
|
|
|
482
482
|
cookies: createForOfIteratorHelper._defineProperty({}, internal.VAL_SESSION_COOKIE, sessionCookie)
|
|
483
483
|
});
|
|
484
484
|
case 2:
|
|
485
|
-
treeRes =
|
|
485
|
+
treeRes = _context8.v;
|
|
486
486
|
if (!(treeRes.status === 200)) {
|
|
487
|
-
|
|
487
|
+
_context8.n = 3;
|
|
488
488
|
break;
|
|
489
489
|
}
|
|
490
|
-
return
|
|
490
|
+
return _context8.a(2, treeRes.json.modules);
|
|
491
491
|
case 3:
|
|
492
492
|
if (!(treeRes.status === 401)) {
|
|
493
|
-
|
|
493
|
+
_context8.n = 4;
|
|
494
494
|
break;
|
|
495
495
|
}
|
|
496
496
|
console.warn("Val: authentication error: ", treeRes.json.message);
|
|
497
|
-
return
|
|
497
|
+
return _context8.a(2, null);
|
|
498
498
|
case 4:
|
|
499
499
|
throw Error(JSON.stringify(treeRes.json, null, 2));
|
|
500
500
|
case 5:
|
|
501
|
-
return
|
|
501
|
+
return _context8.a(2);
|
|
502
502
|
}
|
|
503
|
-
},
|
|
503
|
+
}, _callee8);
|
|
504
504
|
}));
|
|
505
505
|
return _loadDraftSources.apply(this, arguments);
|
|
506
506
|
}
|
|
@@ -508,7 +508,7 @@ var initFetchValStega = function initFetchValStega(config, valApiEndpoints, valS
|
|
|
508
508
|
return function (selector) {
|
|
509
509
|
var exec = /*#__PURE__*/function () {
|
|
510
510
|
var _ref2 = version._asyncToGenerator(/*#__PURE__*/version._regenerator().m(function _callee2() {
|
|
511
|
-
var enabled, headers, cookies, host, _cookies, sessionCookie, modules, _t2, _t3, _t4, _t5;
|
|
511
|
+
var enabled, headers, cookies, host, _cookies, sessionCookie, modules, _t2, _t3, _t4, _t5, _t6, _t7, _t8, _t9, _t0, _t1, _t10, _t11;
|
|
512
512
|
return version._regenerator().w(function (_context2) {
|
|
513
513
|
while (1) switch (_context2.p = _context2.n) {
|
|
514
514
|
case 0:
|
|
@@ -526,7 +526,7 @@ var initFetchValStega = function initFetchValStega(config, valApiEndpoints, valS
|
|
|
526
526
|
console.error("Val: could not check if Val is enabled! This might be due to an error reading draft mode. fetchVal can only be used server-side (in a loader, a server function, or a server route). Use useVal in components.", _t2);
|
|
527
527
|
case 4:
|
|
528
528
|
if (!enabled) {
|
|
529
|
-
_context2.n =
|
|
529
|
+
_context2.n = 16;
|
|
530
530
|
break;
|
|
531
531
|
}
|
|
532
532
|
stega.SET_AUTO_TAG_JSX_ENABLED(true);
|
|
@@ -564,7 +564,7 @@ var initFetchValStega = function initFetchValStega(config, valApiEndpoints, valS
|
|
|
564
564
|
case 12:
|
|
565
565
|
host = headers && getHost(headers);
|
|
566
566
|
if (!(host && cookies)) {
|
|
567
|
-
_context2.n =
|
|
567
|
+
_context2.n = 16;
|
|
568
568
|
break;
|
|
569
569
|
}
|
|
570
570
|
sessionCookie = (_cookies = cookies) === null || _cookies === void 0 || (_cookies = _cookies.get(internal.VAL_SESSION_COOKIE)) === null || _cookies === void 0 ? void 0 : _cookies.value;
|
|
@@ -591,27 +591,37 @@ var initFetchValStega = function initFetchValStega(config, valApiEndpoints, valS
|
|
|
591
591
|
case 14:
|
|
592
592
|
modules = _context2.v;
|
|
593
593
|
if (!modules) {
|
|
594
|
-
_context2.n =
|
|
594
|
+
_context2.n = 16;
|
|
595
595
|
break;
|
|
596
596
|
}
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
}
|
|
606
|
-
}));
|
|
597
|
+
_t6 = stega.stegaEncode;
|
|
598
|
+
_t7 = selector;
|
|
599
|
+
_t8 = !enabled;
|
|
600
|
+
_context2.n = 15;
|
|
601
|
+
return withJsonValuesEntries(selector, function (path) {
|
|
602
|
+
var _modules$path;
|
|
603
|
+
return [(_modules$path = modules[path]) === null || _modules$path === void 0 ? void 0 : _modules$path.source, snapshot === null || snapshot === void 0 ? void 0 : snapshot[path]];
|
|
604
|
+
});
|
|
607
605
|
case 15:
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
getModule:
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
606
|
+
_t9 = _context2.v;
|
|
607
|
+
return _context2.a(2, _t6(_t7, {
|
|
608
|
+
disabled: _t8,
|
|
609
|
+
getModule: _t9
|
|
610
|
+
}));
|
|
611
|
+
case 16:
|
|
612
|
+
_t0 = stega.stegaEncode;
|
|
613
|
+
_t1 = selector;
|
|
614
|
+
_t10 = !enabled;
|
|
615
|
+
_context2.n = 17;
|
|
616
|
+
return withJsonValuesEntries(selector, function (path) {
|
|
617
|
+
return [snapshot === null || snapshot === void 0 ? void 0 : snapshot[path]];
|
|
618
|
+
});
|
|
619
|
+
case 17:
|
|
620
|
+
_t11 = _context2.v;
|
|
621
|
+
return _context2.a(2, _t0(_t1, {
|
|
622
|
+
disabled: _t10,
|
|
623
|
+
getModule: _t11
|
|
624
|
+
}));
|
|
615
625
|
}
|
|
616
626
|
}, _callee2, null, [[9, 11], [5, 8], [1, 3]]);
|
|
617
627
|
}));
|
|
@@ -619,19 +629,112 @@ var initFetchValStega = function initFetchValStega(config, valApiEndpoints, valS
|
|
|
619
629
|
return _ref2.apply(this, arguments);
|
|
620
630
|
};
|
|
621
631
|
}();
|
|
622
|
-
return exec()["catch"](function (
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
632
|
+
return exec()["catch"](/*#__PURE__*/function () {
|
|
633
|
+
var _ref3 = version._asyncToGenerator(/*#__PURE__*/version._regenerator().m(function _callee3(err) {
|
|
634
|
+
var _t12, _t13, _t14;
|
|
635
|
+
return version._regenerator().w(function (_context3) {
|
|
636
|
+
while (1) switch (_context3.n) {
|
|
637
|
+
case 0:
|
|
638
|
+
console.error("Val: failed to fetch ", err);
|
|
639
|
+
_t12 = stega.stegaEncode;
|
|
640
|
+
_t13 = selector;
|
|
641
|
+
_context3.n = 1;
|
|
642
|
+
return withJsonValuesEntries(selector, function (path) {
|
|
643
|
+
return [snapshot === null || snapshot === void 0 ? void 0 : snapshot[path]];
|
|
644
|
+
})["catch"](function () {
|
|
645
|
+
return function (path) {
|
|
646
|
+
return snapshot === null || snapshot === void 0 ? void 0 : snapshot[path];
|
|
647
|
+
};
|
|
648
|
+
});
|
|
649
|
+
case 1:
|
|
650
|
+
_t14 = _context3.v;
|
|
651
|
+
return _context3.a(2, _t12(_t13, {
|
|
652
|
+
getModule: _t14
|
|
653
|
+
}));
|
|
654
|
+
}
|
|
655
|
+
}, _callee3);
|
|
656
|
+
}));
|
|
657
|
+
return function (_x3) {
|
|
658
|
+
return _ref3.apply(this, arguments);
|
|
659
|
+
};
|
|
660
|
+
}());
|
|
630
661
|
};
|
|
631
662
|
};
|
|
632
663
|
|
|
664
|
+
/**
|
|
665
|
+
* `getModule` for `stegaEncode`, with a whole `.jsonValues()` record's entries
|
|
666
|
+
* filled in: its own source holds only lazy markers, so the entries no draft or
|
|
667
|
+
* snapshot has are imported from the bundle, together. Every other module, and
|
|
668
|
+
* a selector that is not such a record, reads the first of `sourcesOf` that has
|
|
669
|
+
* it, as before. `fetchValKey` is the reader for one entry.
|
|
670
|
+
*/
|
|
671
|
+
function withJsonValuesEntries(_x4, _x5) {
|
|
672
|
+
return _withJsonValuesEntries.apply(this, arguments);
|
|
673
|
+
}
|
|
633
674
|
/** A proposal's saved Source, by module: see `ValProposal` in `@valbuild/server`. */
|
|
634
|
-
|
|
675
|
+
function _withJsonValuesEntries() {
|
|
676
|
+
_withJsonValuesEntries = version._asyncToGenerator(/*#__PURE__*/version._regenerator().m(function _callee0(
|
|
677
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
678
|
+
selector, sourcesOf) {
|
|
679
|
+
var first, plan, loaded, filled, _t28;
|
|
680
|
+
return version._regenerator().w(function (_context0) {
|
|
681
|
+
while (1) switch (_context0.n) {
|
|
682
|
+
case 0:
|
|
683
|
+
first = function first(path) {
|
|
684
|
+
return sourcesOf(path).find(function (source) {
|
|
685
|
+
return source !== undefined;
|
|
686
|
+
});
|
|
687
|
+
};
|
|
688
|
+
plan = routeFromVal.jsonValuesRecordToFill(selector, sourcesOf);
|
|
689
|
+
if (!(plan === null)) {
|
|
690
|
+
_context0.n = 1;
|
|
691
|
+
break;
|
|
692
|
+
}
|
|
693
|
+
return _context0.a(2, first);
|
|
694
|
+
case 1:
|
|
695
|
+
_t28 = Object;
|
|
696
|
+
_context0.n = 2;
|
|
697
|
+
return Promise.all(plan.load.map(/*#__PURE__*/function () {
|
|
698
|
+
var _ref8 = version._asyncToGenerator(/*#__PURE__*/version._regenerator().m(function _callee9(key) {
|
|
699
|
+
var thunk, _t25, _t26, _t27;
|
|
700
|
+
return version._regenerator().w(function (_context9) {
|
|
701
|
+
while (1) switch (_context9.n) {
|
|
702
|
+
case 0:
|
|
703
|
+
thunk = routeFromVal.bundledJsonEntryImport(plan.module, key);
|
|
704
|
+
_t25 = key;
|
|
705
|
+
if (!thunk) {
|
|
706
|
+
_context9.n = 2;
|
|
707
|
+
break;
|
|
708
|
+
}
|
|
709
|
+
_context9.n = 1;
|
|
710
|
+
return thunk();
|
|
711
|
+
case 1:
|
|
712
|
+
_t26 = _context9.v["default"];
|
|
713
|
+
_context9.n = 3;
|
|
714
|
+
break;
|
|
715
|
+
case 2:
|
|
716
|
+
_t26 = undefined;
|
|
717
|
+
case 3:
|
|
718
|
+
_t27 = _t26;
|
|
719
|
+
return _context9.a(2, [_t25, _t27]);
|
|
720
|
+
}
|
|
721
|
+
}, _callee9);
|
|
722
|
+
}));
|
|
723
|
+
return function (_x23) {
|
|
724
|
+
return _ref8.apply(this, arguments);
|
|
725
|
+
};
|
|
726
|
+
}()));
|
|
727
|
+
case 2:
|
|
728
|
+
loaded = _t28.fromEntries.call(_t28, _context0.v);
|
|
729
|
+
filled = routeFromVal.fillJsonValuesRecord(plan.record, loaded);
|
|
730
|
+
return _context0.a(2, function (path) {
|
|
731
|
+
return path === plan.modulePath ? filled : first(path);
|
|
732
|
+
});
|
|
733
|
+
}
|
|
734
|
+
}, _callee0);
|
|
735
|
+
}));
|
|
736
|
+
return _withJsonValuesEntries.apply(this, arguments);
|
|
737
|
+
}
|
|
635
738
|
/**
|
|
636
739
|
* What the readers render over the bundle: a proposal's saves over the
|
|
637
740
|
* content version the site serves (`layeredSnapshot` in @valbuild/server),
|
|
@@ -688,10 +791,10 @@ function markContentApplied(http) {
|
|
|
688
791
|
* the browser, by what the editor holds -- old text first on every load.
|
|
689
792
|
*/
|
|
690
793
|
var initFetchValDraft = function initFetchValDraft(valServerPromise, isEnabled, getCookies, getDraftSourcesScope, snapshot, base) {
|
|
691
|
-
return /*#__PURE__*/version._asyncToGenerator(/*#__PURE__*/version._regenerator().m(function
|
|
692
|
-
var onlySnapshot, _yield$getCookies$get, sessionCookie, modules, sources, _i, _Object$entries, _Object$entries$_i, path, module, source,
|
|
693
|
-
return version._regenerator().w(function (
|
|
694
|
-
while (1) switch (
|
|
794
|
+
return /*#__PURE__*/version._asyncToGenerator(/*#__PURE__*/version._regenerator().m(function _callee4() {
|
|
795
|
+
var onlySnapshot, _yield$getCookies$get, sessionCookie, modules, sources, _i, _Object$entries, _Object$entries$_i, path, module, source, _t15, _t16, _t17, _t18, _t19;
|
|
796
|
+
return version._regenerator().w(function (_context4) {
|
|
797
|
+
while (1) switch (_context4.p = _context4.n) {
|
|
695
798
|
case 0:
|
|
696
799
|
// At a proposal's address the page needs the snapshot whatever draft mode
|
|
697
800
|
// says, so a reviewer who is not editing sees the proposal too.
|
|
@@ -700,81 +803,81 @@ var initFetchValDraft = function initFetchValDraft(valServerPromise, isEnabled,
|
|
|
700
803
|
snapshot: snapshot,
|
|
701
804
|
draftMode: false
|
|
702
805
|
} : null;
|
|
703
|
-
|
|
704
|
-
|
|
806
|
+
_context4.p = 1;
|
|
807
|
+
_context4.n = 2;
|
|
705
808
|
return isEnabled();
|
|
706
809
|
case 2:
|
|
707
|
-
if (
|
|
708
|
-
|
|
810
|
+
if (_context4.v) {
|
|
811
|
+
_context4.n = 3;
|
|
709
812
|
break;
|
|
710
813
|
}
|
|
711
|
-
return
|
|
814
|
+
return _context4.a(2, onlySnapshot);
|
|
712
815
|
case 3:
|
|
713
|
-
|
|
816
|
+
_context4.n = 4;
|
|
714
817
|
return getCookies();
|
|
715
818
|
case 4:
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
if (
|
|
719
|
-
|
|
819
|
+
_t16 = _yield$getCookies$get = _context4.v.get(internal.VAL_SESSION_COOKIE);
|
|
820
|
+
_t15 = _t16 === null;
|
|
821
|
+
if (_t15) {
|
|
822
|
+
_context4.n = 5;
|
|
720
823
|
break;
|
|
721
824
|
}
|
|
722
|
-
|
|
825
|
+
_t15 = _yield$getCookies$get === void 0;
|
|
723
826
|
case 5:
|
|
724
|
-
if (!
|
|
725
|
-
|
|
827
|
+
if (!_t15) {
|
|
828
|
+
_context4.n = 6;
|
|
726
829
|
break;
|
|
727
830
|
}
|
|
728
|
-
|
|
729
|
-
|
|
831
|
+
_t17 = void 0;
|
|
832
|
+
_context4.n = 7;
|
|
730
833
|
break;
|
|
731
834
|
case 6:
|
|
732
|
-
|
|
835
|
+
_t17 = _yield$getCookies$get.value;
|
|
733
836
|
case 7:
|
|
734
|
-
sessionCookie =
|
|
735
|
-
|
|
736
|
-
|
|
837
|
+
sessionCookie = _t17;
|
|
838
|
+
_t18 = internal.memoizePerRequest;
|
|
839
|
+
_context4.n = 8;
|
|
737
840
|
return getDraftSourcesScope();
|
|
738
841
|
case 8:
|
|
739
|
-
|
|
740
|
-
return
|
|
842
|
+
_context4.n = 9;
|
|
843
|
+
return _t18(_context4.v, sessionCookie !== null && sessionCookie !== void 0 ? sessionCookie : "", function () {
|
|
741
844
|
return loadDraftSources(valServerPromise, sessionCookie);
|
|
742
845
|
});
|
|
743
846
|
case 9:
|
|
744
|
-
modules =
|
|
847
|
+
modules = _context4.v;
|
|
745
848
|
if (modules) {
|
|
746
|
-
|
|
849
|
+
_context4.n = 10;
|
|
747
850
|
break;
|
|
748
851
|
}
|
|
749
|
-
return
|
|
852
|
+
return _context4.a(2, onlySnapshot);
|
|
750
853
|
case 10:
|
|
751
854
|
sources = {};
|
|
752
855
|
_i = 0, _Object$entries = Object.entries(modules);
|
|
753
856
|
case 11:
|
|
754
857
|
if (!(_i < _Object$entries.length)) {
|
|
755
|
-
|
|
858
|
+
_context4.n = 15;
|
|
756
859
|
break;
|
|
757
860
|
}
|
|
758
861
|
_Object$entries$_i = createForOfIteratorHelper._slicedToArray(_Object$entries[_i], 2), path = _Object$entries$_i[0], module = _Object$entries$_i[1];
|
|
759
862
|
if (!(module.patches === undefined)) {
|
|
760
|
-
|
|
863
|
+
_context4.n = 12;
|
|
761
864
|
break;
|
|
762
865
|
}
|
|
763
|
-
return
|
|
866
|
+
return _context4.a(3, 14);
|
|
764
867
|
case 12:
|
|
765
|
-
|
|
868
|
+
_context4.n = 13;
|
|
766
869
|
return withDraftJsonEntries(valServerPromise, sessionCookie, path, module.source, module.patches.applied);
|
|
767
870
|
case 13:
|
|
768
|
-
source =
|
|
871
|
+
source = _context4.v;
|
|
769
872
|
if (source !== undefined) {
|
|
770
873
|
sources[path] = source;
|
|
771
874
|
}
|
|
772
875
|
case 14:
|
|
773
876
|
_i++;
|
|
774
|
-
|
|
877
|
+
_context4.n = 11;
|
|
775
878
|
break;
|
|
776
879
|
case 15:
|
|
777
|
-
return
|
|
880
|
+
return _context4.a(2, createForOfIteratorHelper._objectSpread2(createForOfIteratorHelper._objectSpread2({
|
|
778
881
|
sources: sources
|
|
779
882
|
}, snapshot !== undefined ? {
|
|
780
883
|
snapshot: snapshot
|
|
@@ -782,14 +885,14 @@ var initFetchValDraft = function initFetchValDraft(valServerPromise, isEnabled,
|
|
|
782
885
|
base: base
|
|
783
886
|
} : {}));
|
|
784
887
|
case 16:
|
|
785
|
-
|
|
786
|
-
|
|
888
|
+
_context4.p = 16;
|
|
889
|
+
_t19 = _context4.v;
|
|
787
890
|
// Published content, as before this existed: a draft page that renders
|
|
788
891
|
// the site is a degraded preview, one that fails to render is an outage.
|
|
789
|
-
console.error("Val: could not read the draft",
|
|
790
|
-
return
|
|
892
|
+
console.error("Val: could not read the draft", _t19);
|
|
893
|
+
return _context4.a(2, onlySnapshot);
|
|
791
894
|
}
|
|
792
|
-
},
|
|
895
|
+
}, _callee4, null, [[1, 16]]);
|
|
793
896
|
}));
|
|
794
897
|
};
|
|
795
898
|
|
|
@@ -814,34 +917,34 @@ var initFetchValDraft = function initFetchValDraft(valServerPromise, isEnabled,
|
|
|
814
917
|
* Leaving the module out is the published render that existed before the
|
|
815
918
|
* draft did: worse than this, and never wrong for long.
|
|
816
919
|
*/
|
|
817
|
-
function withDraftJsonEntries(
|
|
920
|
+
function withDraftJsonEntries(_x6, _x7, _x8, _x9, _x0) {
|
|
818
921
|
return _withDraftJsonEntries.apply(this, arguments);
|
|
819
922
|
}
|
|
820
923
|
function _withDraftJsonEntries() {
|
|
821
|
-
_withDraftJsonEntries = version._asyncToGenerator(/*#__PURE__*/version._regenerator().m(function
|
|
822
|
-
var wire, valServer, cookies, patchesRes, edited, _iterator, _step, _step$value, path, patch, _iterator3, _step3, op, touched, _i2, _touched, _key, keys, draft, i, res, _iterator2, _step2, _step2$value, key, content,
|
|
823
|
-
return version._regenerator().w(function (
|
|
824
|
-
while (1) switch (
|
|
924
|
+
_withDraftJsonEntries = version._asyncToGenerator(/*#__PURE__*/version._regenerator().m(function _callee1(valServerPromise, sessionCookie, moduleFilePath, source, appliedPatchIds) {
|
|
925
|
+
var wire, valServer, cookies, patchesRes, edited, _iterator, _step, _step$value, path, patch, _iterator3, _step3, op, touched, _i2, _touched, _key, keys, draft, i, res, _iterator2, _step2, _step2$value, key, content, _t29, _t30;
|
|
926
|
+
return version._regenerator().w(function (_context1) {
|
|
927
|
+
while (1) switch (_context1.p = _context1.n) {
|
|
825
928
|
case 0:
|
|
826
929
|
if (!(source === undefined)) {
|
|
827
|
-
|
|
930
|
+
_context1.n = 1;
|
|
828
931
|
break;
|
|
829
932
|
}
|
|
830
|
-
return
|
|
933
|
+
return _context1.a(2, undefined);
|
|
831
934
|
case 1:
|
|
832
935
|
wire = JSON.parse(JSON.stringify(source));
|
|
833
936
|
if (!(!isRecordOfJsonMarkers(source) || appliedPatchIds.length === 0)) {
|
|
834
|
-
|
|
937
|
+
_context1.n = 2;
|
|
835
938
|
break;
|
|
836
939
|
}
|
|
837
|
-
return
|
|
940
|
+
return _context1.a(2, wire);
|
|
838
941
|
case 2:
|
|
839
|
-
|
|
942
|
+
_context1.n = 3;
|
|
840
943
|
return valServerPromise;
|
|
841
944
|
case 3:
|
|
842
|
-
valServer =
|
|
945
|
+
valServer = _context1.v;
|
|
843
946
|
cookies = createForOfIteratorHelper._defineProperty({}, internal.VAL_SESSION_COOKIE, sessionCookie);
|
|
844
|
-
|
|
947
|
+
_context1.n = 4;
|
|
845
948
|
return valServer["/patches"]["GET"]({
|
|
846
949
|
query: {
|
|
847
950
|
patch_id: appliedPatchIds,
|
|
@@ -851,35 +954,35 @@ function _withDraftJsonEntries() {
|
|
|
851
954
|
cookies: cookies
|
|
852
955
|
});
|
|
853
956
|
case 4:
|
|
854
|
-
patchesRes =
|
|
957
|
+
patchesRes = _context1.v;
|
|
855
958
|
if (!(patchesRes.status !== 200)) {
|
|
856
|
-
|
|
959
|
+
_context1.n = 5;
|
|
857
960
|
break;
|
|
858
961
|
}
|
|
859
|
-
return
|
|
962
|
+
return _context1.a(2, undefined);
|
|
860
963
|
case 5:
|
|
861
964
|
edited = new Set();
|
|
862
965
|
_iterator = createForOfIteratorHelper._createForOfIteratorHelper(patchesRes.json.patches);
|
|
863
|
-
|
|
966
|
+
_context1.p = 6;
|
|
864
967
|
_iterator.s();
|
|
865
968
|
case 7:
|
|
866
969
|
if ((_step = _iterator.n()).done) {
|
|
867
|
-
|
|
970
|
+
_context1.n = 19;
|
|
868
971
|
break;
|
|
869
972
|
}
|
|
870
973
|
_step$value = _step.value, path = _step$value.path, patch = _step$value.patch;
|
|
871
974
|
if (!(path !== moduleFilePath)) {
|
|
872
|
-
|
|
975
|
+
_context1.n = 8;
|
|
873
976
|
break;
|
|
874
977
|
}
|
|
875
|
-
return
|
|
978
|
+
return _context1.a(3, 18);
|
|
876
979
|
case 8:
|
|
877
980
|
_iterator3 = createForOfIteratorHelper._createForOfIteratorHelper(patch !== null && patch !== void 0 ? patch : []);
|
|
878
|
-
|
|
981
|
+
_context1.p = 9;
|
|
879
982
|
_iterator3.s();
|
|
880
983
|
case 10:
|
|
881
984
|
if ((_step3 = _iterator3.n()).done) {
|
|
882
|
-
|
|
985
|
+
_context1.n = 15;
|
|
883
986
|
break;
|
|
884
987
|
}
|
|
885
988
|
op = _step3.value;
|
|
@@ -890,61 +993,61 @@ function _withDraftJsonEntries() {
|
|
|
890
993
|
_i2 = 0, _touched = touched;
|
|
891
994
|
case 11:
|
|
892
995
|
if (!(_i2 < _touched.length)) {
|
|
893
|
-
|
|
996
|
+
_context1.n = 14;
|
|
894
997
|
break;
|
|
895
998
|
}
|
|
896
999
|
_key = _touched[_i2];
|
|
897
1000
|
if (!(_key === undefined)) {
|
|
898
|
-
|
|
1001
|
+
_context1.n = 12;
|
|
899
1002
|
break;
|
|
900
1003
|
}
|
|
901
|
-
return
|
|
1004
|
+
return _context1.a(2, undefined);
|
|
902
1005
|
case 12:
|
|
903
1006
|
if (core.Internal.isJson(source[_key])) {
|
|
904
1007
|
edited.add(_key);
|
|
905
1008
|
}
|
|
906
1009
|
case 13:
|
|
907
1010
|
_i2++;
|
|
908
|
-
|
|
1011
|
+
_context1.n = 11;
|
|
909
1012
|
break;
|
|
910
1013
|
case 14:
|
|
911
|
-
|
|
1014
|
+
_context1.n = 10;
|
|
912
1015
|
break;
|
|
913
1016
|
case 15:
|
|
914
|
-
|
|
1017
|
+
_context1.n = 17;
|
|
915
1018
|
break;
|
|
916
1019
|
case 16:
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
_iterator3.e(
|
|
1020
|
+
_context1.p = 16;
|
|
1021
|
+
_t29 = _context1.v;
|
|
1022
|
+
_iterator3.e(_t29);
|
|
920
1023
|
case 17:
|
|
921
|
-
|
|
1024
|
+
_context1.p = 17;
|
|
922
1025
|
_iterator3.f();
|
|
923
|
-
return
|
|
1026
|
+
return _context1.f(17);
|
|
924
1027
|
case 18:
|
|
925
|
-
|
|
1028
|
+
_context1.n = 7;
|
|
926
1029
|
break;
|
|
927
1030
|
case 19:
|
|
928
|
-
|
|
1031
|
+
_context1.n = 21;
|
|
929
1032
|
break;
|
|
930
1033
|
case 20:
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
_iterator.e(
|
|
1034
|
+
_context1.p = 20;
|
|
1035
|
+
_t30 = _context1.v;
|
|
1036
|
+
_iterator.e(_t30);
|
|
934
1037
|
case 21:
|
|
935
|
-
|
|
1038
|
+
_context1.p = 21;
|
|
936
1039
|
_iterator.f();
|
|
937
|
-
return
|
|
1040
|
+
return _context1.f(21);
|
|
938
1041
|
case 22:
|
|
939
1042
|
keys = _toConsumableArray(edited);
|
|
940
1043
|
draft = wire;
|
|
941
1044
|
i = 0;
|
|
942
1045
|
case 23:
|
|
943
1046
|
if (!(i < keys.length)) {
|
|
944
|
-
|
|
1047
|
+
_context1.n = 27;
|
|
945
1048
|
break;
|
|
946
1049
|
}
|
|
947
|
-
|
|
1050
|
+
_context1.n = 24;
|
|
948
1051
|
return valServer["/json"]["GET"]({
|
|
949
1052
|
query: {
|
|
950
1053
|
path: moduleFilePath,
|
|
@@ -958,12 +1061,12 @@ function _withDraftJsonEntries() {
|
|
|
958
1061
|
cookies: cookies
|
|
959
1062
|
});
|
|
960
1063
|
case 24:
|
|
961
|
-
res =
|
|
1064
|
+
res = _context1.v;
|
|
962
1065
|
if (!(res.status !== 200 || !("entries" in res.json) || res.json.errors.length > 0 || res.json.missing.length > 0)) {
|
|
963
|
-
|
|
1066
|
+
_context1.n = 25;
|
|
964
1067
|
break;
|
|
965
1068
|
}
|
|
966
|
-
return
|
|
1069
|
+
return _context1.a(2, undefined);
|
|
967
1070
|
case 25:
|
|
968
1071
|
_iterator2 = createForOfIteratorHelper._createForOfIteratorHelper(res.json.entries);
|
|
969
1072
|
try {
|
|
@@ -978,12 +1081,12 @@ function _withDraftJsonEntries() {
|
|
|
978
1081
|
}
|
|
979
1082
|
case 26:
|
|
980
1083
|
i += internal.JSON_ENTRIES_BATCH_MAX;
|
|
981
|
-
|
|
1084
|
+
_context1.n = 23;
|
|
982
1085
|
break;
|
|
983
1086
|
case 27:
|
|
984
|
-
return
|
|
1087
|
+
return _context1.a(2, draft);
|
|
985
1088
|
}
|
|
986
|
-
},
|
|
1089
|
+
}, _callee1, null, [[9, 16, 17, 18], [6, 20, 21, 22]]);
|
|
987
1090
|
}));
|
|
988
1091
|
return _withDraftJsonEntries.apply(this, arguments);
|
|
989
1092
|
}
|
|
@@ -1034,15 +1137,15 @@ function getHost(headers) {
|
|
|
1034
1137
|
|
|
1035
1138
|
var initFetchValRouteStega = function initFetchValRouteStega(config, valApiEndpoints, valServerPromise, isEnabled, getHeaders, getCookies, getDraftSourcesScope, snapshot) {
|
|
1036
1139
|
return /*#__PURE__*/function () {
|
|
1037
|
-
var
|
|
1038
|
-
var resolvedParams, valModule, path, schema, source, url, enabled, draft, content, fetchVal, val, route,
|
|
1039
|
-
return version._regenerator().w(function (
|
|
1040
|
-
while (1) switch (
|
|
1140
|
+
var _ref5 = version._asyncToGenerator(/*#__PURE__*/version._regenerator().m(function _callee5(selector, params) {
|
|
1141
|
+
var resolvedParams, valModule, path, schema, source, url, enabled, draft, content, fetchVal, val, route, _t21;
|
|
1142
|
+
return version._regenerator().w(function (_context5) {
|
|
1143
|
+
while (1) switch (_context5.p = _context5.n) {
|
|
1041
1144
|
case 0:
|
|
1042
|
-
|
|
1145
|
+
_context5.n = 1;
|
|
1043
1146
|
return Promise.resolve(params);
|
|
1044
1147
|
case 1:
|
|
1045
|
-
resolvedParams =
|
|
1148
|
+
resolvedParams = _context5.v;
|
|
1046
1149
|
// A view is a pointer: everything below reads a path, a schema and a source
|
|
1047
1150
|
// off this, and a pointer has none of them. See `resolveViewedModule`.
|
|
1048
1151
|
valModule = core.Internal.resolveViewedModule(selector);
|
|
@@ -1051,78 +1154,78 @@ var initFetchValRouteStega = function initFetchValRouteStega(config, valApiEndpo
|
|
|
1051
1154
|
// entry's backing `*.val.json`, instead of eagerly resolving the whole
|
|
1052
1155
|
// record via `fetchVal`.
|
|
1053
1156
|
if (!routeFromVal.isJsonValuesRecordSchema(schema)) {
|
|
1054
|
-
|
|
1157
|
+
_context5.n = 11;
|
|
1055
1158
|
break;
|
|
1056
1159
|
}
|
|
1057
1160
|
source = valModule && core.Internal.getSource(valModule);
|
|
1058
1161
|
url = routeFromVal.getValRouteUrlFromVal(resolvedParams, "fetchValRoute", path, schema, source);
|
|
1059
1162
|
if (url) {
|
|
1060
|
-
|
|
1163
|
+
_context5.n = 2;
|
|
1061
1164
|
break;
|
|
1062
1165
|
}
|
|
1063
|
-
return
|
|
1166
|
+
return _context5.a(2, null);
|
|
1064
1167
|
case 2:
|
|
1065
1168
|
enabled = false;
|
|
1066
|
-
|
|
1067
|
-
|
|
1169
|
+
_context5.p = 3;
|
|
1170
|
+
_context5.n = 4;
|
|
1068
1171
|
return isEnabled();
|
|
1069
1172
|
case 4:
|
|
1070
|
-
enabled =
|
|
1071
|
-
|
|
1173
|
+
enabled = _context5.v;
|
|
1174
|
+
_context5.n = 6;
|
|
1072
1175
|
break;
|
|
1073
1176
|
case 5:
|
|
1074
|
-
|
|
1075
|
-
|
|
1177
|
+
_context5.p = 5;
|
|
1178
|
+
_context5.v;
|
|
1076
1179
|
case 6:
|
|
1077
1180
|
draft = {
|
|
1078
1181
|
status: "unavailable"
|
|
1079
1182
|
};
|
|
1080
1183
|
if (!(enabled && path)) {
|
|
1081
|
-
|
|
1184
|
+
_context5.n = 8;
|
|
1082
1185
|
break;
|
|
1083
1186
|
}
|
|
1084
1187
|
stega.SET_AUTO_TAG_JSX_ENABLED(true);
|
|
1085
|
-
|
|
1188
|
+
_context5.n = 7;
|
|
1086
1189
|
return loadDraftJsonEntry(valServerPromise, getCookies, path, url);
|
|
1087
1190
|
case 7:
|
|
1088
|
-
draft =
|
|
1191
|
+
draft = _context5.v;
|
|
1089
1192
|
case 8:
|
|
1090
|
-
|
|
1193
|
+
_context5.n = 9;
|
|
1091
1194
|
return resolveDraftOrCommittedEntry(draft.status === "unavailable" && path ? snapshotJsonEntry(snapshot, path, url) : draft, function () {
|
|
1092
1195
|
return loadJsonEntryContent(source, url);
|
|
1093
1196
|
});
|
|
1094
1197
|
case 9:
|
|
1095
|
-
content =
|
|
1198
|
+
content = _context5.v;
|
|
1096
1199
|
if (!(content === undefined)) {
|
|
1097
|
-
|
|
1200
|
+
_context5.n = 10;
|
|
1098
1201
|
break;
|
|
1099
1202
|
}
|
|
1100
|
-
return
|
|
1203
|
+
return _context5.a(2, null);
|
|
1101
1204
|
case 10:
|
|
1102
|
-
return
|
|
1205
|
+
return _context5.a(2, stega.stegaEncode(content, {
|
|
1103
1206
|
disabled: !enabled,
|
|
1104
1207
|
root: routeFromVal.getJsonEntryStegaRoot(valModule, url)
|
|
1105
1208
|
}));
|
|
1106
1209
|
case 11:
|
|
1107
1210
|
fetchVal = initFetchValStega(config, valApiEndpoints, valServerPromise, isEnabled, getHeaders, getCookies, getDraftSourcesScope, snapshot);
|
|
1108
|
-
|
|
1109
|
-
if (!
|
|
1110
|
-
|
|
1211
|
+
_t21 = valModule;
|
|
1212
|
+
if (!_t21) {
|
|
1213
|
+
_context5.n = 13;
|
|
1111
1214
|
break;
|
|
1112
1215
|
}
|
|
1113
|
-
|
|
1216
|
+
_context5.n = 12;
|
|
1114
1217
|
return fetchVal(valModule);
|
|
1115
1218
|
case 12:
|
|
1116
|
-
|
|
1219
|
+
_t21 = _context5.v;
|
|
1117
1220
|
case 13:
|
|
1118
|
-
val =
|
|
1221
|
+
val = _t21;
|
|
1119
1222
|
route = routeFromVal.initValRouteFromVal(resolvedParams, "fetchValRoute", path, schema, val);
|
|
1120
|
-
return
|
|
1223
|
+
return _context5.a(2, route);
|
|
1121
1224
|
}
|
|
1122
|
-
},
|
|
1225
|
+
}, _callee5, null, [[3, 5]]);
|
|
1123
1226
|
}));
|
|
1124
|
-
return function (
|
|
1125
|
-
return
|
|
1227
|
+
return function (_x1, _x10) {
|
|
1228
|
+
return _ref5.apply(this, arguments);
|
|
1126
1229
|
};
|
|
1127
1230
|
}();
|
|
1128
1231
|
};
|
|
@@ -1132,7 +1235,7 @@ var initFetchValRouteStega = function initFetchValRouteStega(config, valApiEndpo
|
|
|
1132
1235
|
* source markers (one dynamic import). Returns `undefined` when the key is
|
|
1133
1236
|
* missing or its marker has no runtime thunk (transport marker / draft entry).
|
|
1134
1237
|
*/
|
|
1135
|
-
function loadJsonEntryContent(
|
|
1238
|
+
function loadJsonEntryContent(_x11, _x12) {
|
|
1136
1239
|
return _loadJsonEntryContent.apply(this, arguments);
|
|
1137
1240
|
}
|
|
1138
1241
|
/**
|
|
@@ -1157,37 +1260,37 @@ function loadJsonEntryContent(_x0, _x1) {
|
|
|
1157
1260
|
* to the whole server type.
|
|
1158
1261
|
*/
|
|
1159
1262
|
function _loadJsonEntryContent() {
|
|
1160
|
-
_loadJsonEntryContent = version._asyncToGenerator(/*#__PURE__*/version._regenerator().m(function
|
|
1263
|
+
_loadJsonEntryContent = version._asyncToGenerator(/*#__PURE__*/version._regenerator().m(function _callee10(source, key) {
|
|
1161
1264
|
var marker, thunk;
|
|
1162
|
-
return version._regenerator().w(function (
|
|
1163
|
-
while (1) switch (
|
|
1265
|
+
return version._regenerator().w(function (_context10) {
|
|
1266
|
+
while (1) switch (_context10.n) {
|
|
1164
1267
|
case 0:
|
|
1165
1268
|
if (!(!source || routeFromVal._typeof(source) !== "object")) {
|
|
1166
|
-
|
|
1269
|
+
_context10.n = 1;
|
|
1167
1270
|
break;
|
|
1168
1271
|
}
|
|
1169
|
-
return
|
|
1272
|
+
return _context10.a(2, undefined);
|
|
1170
1273
|
case 1:
|
|
1171
1274
|
marker = source[key];
|
|
1172
1275
|
if (core.Internal.isJson(marker)) {
|
|
1173
|
-
|
|
1276
|
+
_context10.n = 2;
|
|
1174
1277
|
break;
|
|
1175
1278
|
}
|
|
1176
|
-
return
|
|
1279
|
+
return _context10.a(2, undefined);
|
|
1177
1280
|
case 2:
|
|
1178
1281
|
thunk = core.Internal.getJsonImport(marker);
|
|
1179
1282
|
if (thunk) {
|
|
1180
|
-
|
|
1283
|
+
_context10.n = 3;
|
|
1181
1284
|
break;
|
|
1182
1285
|
}
|
|
1183
|
-
return
|
|
1286
|
+
return _context10.a(2, undefined);
|
|
1184
1287
|
case 3:
|
|
1185
|
-
|
|
1288
|
+
_context10.n = 4;
|
|
1186
1289
|
return thunk();
|
|
1187
1290
|
case 4:
|
|
1188
|
-
return
|
|
1291
|
+
return _context10.a(2, _context10.v["default"]);
|
|
1189
1292
|
}
|
|
1190
|
-
},
|
|
1293
|
+
}, _callee10);
|
|
1191
1294
|
}));
|
|
1192
1295
|
return _loadJsonEntryContent.apply(this, arguments);
|
|
1193
1296
|
}
|
|
@@ -1240,33 +1343,33 @@ function snapshotJsonEntry(snapshot, moduleFilePath, key) {
|
|
|
1240
1343
|
content: entry
|
|
1241
1344
|
};
|
|
1242
1345
|
}
|
|
1243
|
-
function resolveDraftOrCommittedEntry(
|
|
1346
|
+
function resolveDraftOrCommittedEntry(_x13, _x14) {
|
|
1244
1347
|
return _resolveDraftOrCommittedEntry.apply(this, arguments);
|
|
1245
1348
|
}
|
|
1246
1349
|
function _resolveDraftOrCommittedEntry() {
|
|
1247
|
-
_resolveDraftOrCommittedEntry = version._asyncToGenerator(/*#__PURE__*/version._regenerator().m(function
|
|
1248
|
-
return version._regenerator().w(function (
|
|
1249
|
-
while (1) switch (
|
|
1350
|
+
_resolveDraftOrCommittedEntry = version._asyncToGenerator(/*#__PURE__*/version._regenerator().m(function _callee11(draft, loadCommitted) {
|
|
1351
|
+
return version._regenerator().w(function (_context11) {
|
|
1352
|
+
while (1) switch (_context11.n) {
|
|
1250
1353
|
case 0:
|
|
1251
1354
|
if (!(draft.status === "content")) {
|
|
1252
|
-
|
|
1355
|
+
_context11.n = 1;
|
|
1253
1356
|
break;
|
|
1254
1357
|
}
|
|
1255
|
-
return
|
|
1358
|
+
return _context11.a(2, draft.content);
|
|
1256
1359
|
case 1:
|
|
1257
1360
|
if (!(draft.status === "absent")) {
|
|
1258
|
-
|
|
1361
|
+
_context11.n = 2;
|
|
1259
1362
|
break;
|
|
1260
1363
|
}
|
|
1261
|
-
return
|
|
1364
|
+
return _context11.a(2, undefined);
|
|
1262
1365
|
case 2:
|
|
1263
|
-
return
|
|
1366
|
+
return _context11.a(2, loadCommitted());
|
|
1264
1367
|
}
|
|
1265
|
-
},
|
|
1368
|
+
}, _callee11);
|
|
1266
1369
|
}));
|
|
1267
1370
|
return _resolveDraftOrCommittedEntry.apply(this, arguments);
|
|
1268
1371
|
}
|
|
1269
|
-
function loadDraftJsonEntry(
|
|
1372
|
+
function loadDraftJsonEntry(_x15, _x16, _x17, _x18) {
|
|
1270
1373
|
return _loadDraftJsonEntry.apply(this, arguments);
|
|
1271
1374
|
}
|
|
1272
1375
|
/**
|
|
@@ -1281,31 +1384,31 @@ function loadDraftJsonEntry(_x12, _x13, _x14, _x15) {
|
|
|
1281
1384
|
* the draft read yields nothing.
|
|
1282
1385
|
*/
|
|
1283
1386
|
function _loadDraftJsonEntry() {
|
|
1284
|
-
_loadDraftJsonEntry = version._asyncToGenerator(/*#__PURE__*/version._regenerator().m(function
|
|
1387
|
+
_loadDraftJsonEntry = version._asyncToGenerator(/*#__PURE__*/version._regenerator().m(function _callee12(valServerPromise, getCookies, moduleFilePath, key) {
|
|
1285
1388
|
var _cookies4;
|
|
1286
1389
|
var cookies, valServer, res;
|
|
1287
|
-
return version._regenerator().w(function (
|
|
1288
|
-
while (1) switch (
|
|
1390
|
+
return version._regenerator().w(function (_context12) {
|
|
1391
|
+
while (1) switch (_context12.p = _context12.n) {
|
|
1289
1392
|
case 0:
|
|
1290
|
-
|
|
1291
|
-
|
|
1393
|
+
_context12.p = 0;
|
|
1394
|
+
_context12.n = 1;
|
|
1292
1395
|
return getCookies();
|
|
1293
1396
|
case 1:
|
|
1294
|
-
cookies =
|
|
1295
|
-
|
|
1397
|
+
cookies = _context12.v;
|
|
1398
|
+
_context12.n = 3;
|
|
1296
1399
|
break;
|
|
1297
1400
|
case 2:
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
return
|
|
1401
|
+
_context12.p = 2;
|
|
1402
|
+
_context12.v;
|
|
1403
|
+
return _context12.a(2, {
|
|
1301
1404
|
status: "unavailable"
|
|
1302
1405
|
});
|
|
1303
1406
|
case 3:
|
|
1304
|
-
|
|
1407
|
+
_context12.n = 4;
|
|
1305
1408
|
return valServerPromise;
|
|
1306
1409
|
case 4:
|
|
1307
|
-
valServer =
|
|
1308
|
-
|
|
1410
|
+
valServer = _context12.v;
|
|
1411
|
+
_context12.n = 5;
|
|
1309
1412
|
return valServer["/json"]["GET"]({
|
|
1310
1413
|
query: {
|
|
1311
1414
|
path: moduleFilePath,
|
|
@@ -1328,60 +1431,60 @@ function _loadDraftJsonEntry() {
|
|
|
1328
1431
|
cookies: createForOfIteratorHelper._defineProperty({}, internal.VAL_SESSION_COOKIE, (_cookies4 = cookies) === null || _cookies4 === void 0 || (_cookies4 = _cookies4.get(internal.VAL_SESSION_COOKIE)) === null || _cookies4 === void 0 ? void 0 : _cookies4.value)
|
|
1329
1432
|
});
|
|
1330
1433
|
case 5:
|
|
1331
|
-
res =
|
|
1434
|
+
res = _context12.v;
|
|
1332
1435
|
if (!(res.status === 200 && "content" in res.json)) {
|
|
1333
|
-
|
|
1436
|
+
_context12.n = 6;
|
|
1334
1437
|
break;
|
|
1335
1438
|
}
|
|
1336
|
-
return
|
|
1439
|
+
return _context12.a(2, {
|
|
1337
1440
|
status: "content",
|
|
1338
1441
|
content: res.json.content
|
|
1339
1442
|
});
|
|
1340
1443
|
case 6:
|
|
1341
1444
|
if (!(res.status === 401)) {
|
|
1342
|
-
|
|
1445
|
+
_context12.n = 7;
|
|
1343
1446
|
break;
|
|
1344
1447
|
}
|
|
1345
1448
|
console.warn("Val: authentication error: ", res.json.message);
|
|
1346
|
-
return
|
|
1449
|
+
return _context12.a(2, {
|
|
1347
1450
|
status: "unavailable"
|
|
1348
1451
|
});
|
|
1349
1452
|
case 7:
|
|
1350
1453
|
if (!(res.status === 404)) {
|
|
1351
|
-
|
|
1454
|
+
_context12.n = 8;
|
|
1352
1455
|
break;
|
|
1353
1456
|
}
|
|
1354
|
-
return
|
|
1457
|
+
return _context12.a(2, {
|
|
1355
1458
|
status: "absent"
|
|
1356
1459
|
});
|
|
1357
1460
|
case 8:
|
|
1358
1461
|
console.error("Val: could not load draft JSON entry: ", "message" in res.json ? res.json.message : "status ".concat(res.status));
|
|
1359
|
-
return
|
|
1462
|
+
return _context12.a(2, {
|
|
1360
1463
|
status: "unavailable"
|
|
1361
1464
|
});
|
|
1362
1465
|
}
|
|
1363
|
-
},
|
|
1466
|
+
}, _callee12, null, [[0, 2]]);
|
|
1364
1467
|
}));
|
|
1365
1468
|
return _loadDraftJsonEntry.apply(this, arguments);
|
|
1366
1469
|
}
|
|
1367
1470
|
var initFetchValKeyStega = function initFetchValKeyStega(valServerPromise, isEnabled, getCookies, snapshot) {
|
|
1368
1471
|
return /*#__PURE__*/function () {
|
|
1369
|
-
var
|
|
1472
|
+
var _ref6 = version._asyncToGenerator(/*#__PURE__*/version._regenerator().m(function _callee6(selector, key) {
|
|
1370
1473
|
var enabled, valModule, source, moduleFilePath, draft, content;
|
|
1371
|
-
return version._regenerator().w(function (
|
|
1372
|
-
while (1) switch (
|
|
1474
|
+
return version._regenerator().w(function (_context6) {
|
|
1475
|
+
while (1) switch (_context6.p = _context6.n) {
|
|
1373
1476
|
case 0:
|
|
1374
1477
|
enabled = false;
|
|
1375
|
-
|
|
1376
|
-
|
|
1478
|
+
_context6.p = 1;
|
|
1479
|
+
_context6.n = 2;
|
|
1377
1480
|
return isEnabled();
|
|
1378
1481
|
case 2:
|
|
1379
|
-
enabled =
|
|
1380
|
-
|
|
1482
|
+
enabled = _context6.v;
|
|
1483
|
+
_context6.n = 4;
|
|
1381
1484
|
break;
|
|
1382
1485
|
case 3:
|
|
1383
|
-
|
|
1384
|
-
|
|
1486
|
+
_context6.p = 3;
|
|
1487
|
+
_context6.v;
|
|
1385
1488
|
case 4:
|
|
1386
1489
|
// A view is a pointer: everything below reads a path and a source off this,
|
|
1387
1490
|
// and a pointer has neither. See `resolveViewedModule`.
|
|
@@ -1392,84 +1495,84 @@ var initFetchValKeyStega = function initFetchValKeyStega(valServerPromise, isEna
|
|
|
1392
1495
|
status: "unavailable"
|
|
1393
1496
|
};
|
|
1394
1497
|
if (!(enabled && moduleFilePath)) {
|
|
1395
|
-
|
|
1498
|
+
_context6.n = 6;
|
|
1396
1499
|
break;
|
|
1397
1500
|
}
|
|
1398
1501
|
stega.SET_AUTO_TAG_JSX_ENABLED(true);
|
|
1399
|
-
|
|
1502
|
+
_context6.n = 5;
|
|
1400
1503
|
return loadDraftJsonEntry(valServerPromise, getCookies, moduleFilePath, key);
|
|
1401
1504
|
case 5:
|
|
1402
|
-
draft =
|
|
1505
|
+
draft = _context6.v;
|
|
1403
1506
|
case 6:
|
|
1404
|
-
|
|
1507
|
+
_context6.n = 7;
|
|
1405
1508
|
return resolveDraftOrCommittedEntry(draft.status === "unavailable" && moduleFilePath ? snapshotJsonEntry(snapshot, moduleFilePath, key) : draft, function () {
|
|
1406
1509
|
return loadJsonEntryContent(source, key);
|
|
1407
1510
|
});
|
|
1408
1511
|
case 7:
|
|
1409
|
-
content =
|
|
1512
|
+
content = _context6.v;
|
|
1410
1513
|
if (!(content === undefined)) {
|
|
1411
|
-
|
|
1514
|
+
_context6.n = 8;
|
|
1412
1515
|
break;
|
|
1413
1516
|
}
|
|
1414
|
-
return
|
|
1517
|
+
return _context6.a(2, undefined);
|
|
1415
1518
|
case 8:
|
|
1416
|
-
return
|
|
1519
|
+
return _context6.a(2, stega.stegaEncode(content, {
|
|
1417
1520
|
disabled: !enabled,
|
|
1418
1521
|
root: routeFromVal.getJsonEntryStegaRoot(valModule, key)
|
|
1419
1522
|
}));
|
|
1420
1523
|
}
|
|
1421
|
-
},
|
|
1524
|
+
}, _callee6, null, [[1, 3]]);
|
|
1422
1525
|
}));
|
|
1423
|
-
return function (
|
|
1424
|
-
return
|
|
1526
|
+
return function (_x19, _x20) {
|
|
1527
|
+
return _ref6.apply(this, arguments);
|
|
1425
1528
|
};
|
|
1426
1529
|
}();
|
|
1427
1530
|
};
|
|
1428
1531
|
var initFetchValRouteUrl = function initFetchValRouteUrl(config, valApiEndpoints, valServerPromise, isEnabled, getHeaders, getCookies, getDraftSourcesScope, snapshot) {
|
|
1429
1532
|
return /*#__PURE__*/function () {
|
|
1430
|
-
var
|
|
1431
|
-
var fetchVal, resolvedParams, valModule, path, schema, val, route,
|
|
1432
|
-
return version._regenerator().w(function (
|
|
1433
|
-
while (1) switch (
|
|
1533
|
+
var _ref7 = version._asyncToGenerator(/*#__PURE__*/version._regenerator().m(function _callee7(selector, params) {
|
|
1534
|
+
var fetchVal, resolvedParams, valModule, path, schema, val, route, _t23, _t24;
|
|
1535
|
+
return version._regenerator().w(function (_context7) {
|
|
1536
|
+
while (1) switch (_context7.n) {
|
|
1434
1537
|
case 0:
|
|
1435
1538
|
fetchVal = initFetchValStega(config, valApiEndpoints, valServerPromise, isEnabled, getHeaders, getCookies, getDraftSourcesScope, snapshot);
|
|
1436
1539
|
if (!(params === undefined)) {
|
|
1437
|
-
|
|
1540
|
+
_context7.n = 1;
|
|
1438
1541
|
break;
|
|
1439
1542
|
}
|
|
1440
|
-
|
|
1441
|
-
|
|
1543
|
+
_t23 = undefined;
|
|
1544
|
+
_context7.n = 3;
|
|
1442
1545
|
break;
|
|
1443
1546
|
case 1:
|
|
1444
|
-
|
|
1547
|
+
_context7.n = 2;
|
|
1445
1548
|
return Promise.resolve(params);
|
|
1446
1549
|
case 2:
|
|
1447
|
-
|
|
1550
|
+
_t23 = _context7.v;
|
|
1448
1551
|
case 3:
|
|
1449
|
-
resolvedParams =
|
|
1552
|
+
resolvedParams = _t23;
|
|
1450
1553
|
// A view is a pointer: everything below reads a path, a schema and a source
|
|
1451
1554
|
// off this, and a pointer has none of them. See `resolveViewedModule`.
|
|
1452
1555
|
valModule = core.Internal.resolveViewedModule(selector);
|
|
1453
1556
|
path = valModule && core.Internal.getValPath(valModule);
|
|
1454
1557
|
schema = valModule && core.Internal.getSchema(valModule);
|
|
1455
|
-
|
|
1456
|
-
if (!
|
|
1457
|
-
|
|
1558
|
+
_t24 = valModule;
|
|
1559
|
+
if (!_t24) {
|
|
1560
|
+
_context7.n = 5;
|
|
1458
1561
|
break;
|
|
1459
1562
|
}
|
|
1460
|
-
|
|
1563
|
+
_context7.n = 4;
|
|
1461
1564
|
return fetchVal(valModule);
|
|
1462
1565
|
case 4:
|
|
1463
|
-
|
|
1566
|
+
_t24 = _context7.v;
|
|
1464
1567
|
case 5:
|
|
1465
|
-
val =
|
|
1568
|
+
val = _t24;
|
|
1466
1569
|
route = routeFromVal.getValRouteUrlFromVal(resolvedParams, "fetchValRouteUrl", path, schema, val);
|
|
1467
|
-
return
|
|
1570
|
+
return _context7.a(2, route);
|
|
1468
1571
|
}
|
|
1469
|
-
},
|
|
1572
|
+
}, _callee7);
|
|
1470
1573
|
}));
|
|
1471
|
-
return function (
|
|
1472
|
-
return
|
|
1574
|
+
return function (_x21, _x22) {
|
|
1575
|
+
return _ref7.apply(this, arguments);
|
|
1473
1576
|
};
|
|
1474
1577
|
}();
|
|
1475
1578
|
};
|
|
@@ -1487,25 +1590,25 @@ function requestHeaders() {
|
|
|
1487
1590
|
}
|
|
1488
1591
|
/** The request's cookies, in the `{ name, value }` shape the readers want. */
|
|
1489
1592
|
function _requestHeaders() {
|
|
1490
|
-
_requestHeaders = version._asyncToGenerator(/*#__PURE__*/version._regenerator().m(function
|
|
1593
|
+
_requestHeaders = version._asyncToGenerator(/*#__PURE__*/version._regenerator().m(function _callee13() {
|
|
1491
1594
|
var _yield$import2, getRequestHeaders, headers;
|
|
1492
|
-
return version._regenerator().w(function (
|
|
1493
|
-
while (1) switch (
|
|
1595
|
+
return version._regenerator().w(function (_context13) {
|
|
1596
|
+
while (1) switch (_context13.n) {
|
|
1494
1597
|
case 0:
|
|
1495
|
-
|
|
1598
|
+
_context13.n = 1;
|
|
1496
1599
|
return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('@tanstack/react-start/server')); });
|
|
1497
1600
|
case 1:
|
|
1498
|
-
_yield$import2 =
|
|
1601
|
+
_yield$import2 = _context13.v;
|
|
1499
1602
|
getRequestHeaders = _yield$import2.getRequestHeaders;
|
|
1500
1603
|
headers = getRequestHeaders();
|
|
1501
|
-
return
|
|
1604
|
+
return _context13.a(2, {
|
|
1502
1605
|
get: function get(name) {
|
|
1503
1606
|
var _headers$get2;
|
|
1504
1607
|
return (_headers$get2 = headers.get(name)) !== null && _headers$get2 !== void 0 ? _headers$get2 : null;
|
|
1505
1608
|
}
|
|
1506
1609
|
});
|
|
1507
1610
|
}
|
|
1508
|
-
},
|
|
1611
|
+
}, _callee13);
|
|
1509
1612
|
}));
|
|
1510
1613
|
return _requestHeaders.apply(this, arguments);
|
|
1511
1614
|
}
|
|
@@ -1533,17 +1636,17 @@ function requestCookies() {
|
|
|
1533
1636
|
* } = initValContent(config, valModules);
|
|
1534
1637
|
*/
|
|
1535
1638
|
function _requestCookies() {
|
|
1536
|
-
_requestCookies = version._asyncToGenerator(/*#__PURE__*/version._regenerator().m(function
|
|
1639
|
+
_requestCookies = version._asyncToGenerator(/*#__PURE__*/version._regenerator().m(function _callee14() {
|
|
1537
1640
|
var _yield$import3, getCookie;
|
|
1538
|
-
return version._regenerator().w(function (
|
|
1539
|
-
while (1) switch (
|
|
1641
|
+
return version._regenerator().w(function (_context14) {
|
|
1642
|
+
while (1) switch (_context14.n) {
|
|
1540
1643
|
case 0:
|
|
1541
|
-
|
|
1644
|
+
_context14.n = 1;
|
|
1542
1645
|
return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('@tanstack/react-start/server')); });
|
|
1543
1646
|
case 1:
|
|
1544
|
-
_yield$import3 =
|
|
1647
|
+
_yield$import3 = _context14.v;
|
|
1545
1648
|
getCookie = _yield$import3.getCookie;
|
|
1546
|
-
return
|
|
1649
|
+
return _context14.a(2, {
|
|
1547
1650
|
get: function get(name) {
|
|
1548
1651
|
var value = getCookie(name);
|
|
1549
1652
|
return value === undefined ? undefined : {
|
|
@@ -1553,7 +1656,7 @@ function _requestCookies() {
|
|
|
1553
1656
|
}
|
|
1554
1657
|
});
|
|
1555
1658
|
}
|
|
1556
|
-
},
|
|
1659
|
+
}, _callee14);
|
|
1557
1660
|
}));
|
|
1558
1661
|
return _requestCookies.apply(this, arguments);
|
|
1559
1662
|
}
|