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