@valbuild/tanstack 0.139.2 → 0.140.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +48 -0
- package/README.md +51 -4
- package/client/dist/valbuild-tanstack-client.cjs.dev.js +53 -6
- package/client/dist/valbuild-tanstack-client.cjs.prod.js +53 -6
- package/client/dist/valbuild-tanstack-client.esm.js +53 -6
- package/dist/{ValOverlayContext-5f1d8da4.cjs.prod.js → ValOverlayContext-2739cc60.cjs.prod.js} +4 -2
- package/dist/{ValOverlayContext-5bc3830f.esm.js → ValOverlayContext-28101df3.esm.js} +4 -2
- package/dist/{ValOverlayContext-3ec15518.cjs.dev.js → ValOverlayContext-bafe3de9.cjs.dev.js} +4 -2
- package/dist/{createForOfIteratorHelper-e75681d7.cjs.dev.js → createForOfIteratorHelper-4497beef.cjs.dev.js} +2 -0
- package/dist/{createForOfIteratorHelper-485c2ce1.esm.js → createForOfIteratorHelper-93a62170.esm.js} +1 -1
- package/dist/{createForOfIteratorHelper-0324e063.cjs.prod.js → createForOfIteratorHelper-9afd7d2d.cjs.prod.js} +2 -0
- package/dist/declarations/src/ValDraft.d.ts +21 -0
- package/dist/declarations/src/ValProvider.d.ts +1 -0
- package/dist/declarations/src/external_exempt_from_val_quickjs.d.ts +1 -0
- package/dist/declarations/src/server/index.d.ts +1 -0
- package/dist/declarations/src/server/initValContent.d.ts +30 -0
- package/dist/{routeFromVal-6693e037.cjs.prod.js → routeFromVal-0b39e8e3.cjs.prod.js} +1 -1
- package/dist/{routeFromVal-728295a0.esm.js → routeFromVal-1221e70d.esm.js} +1 -1
- package/dist/{routeFromVal-a9147ceb.cjs.dev.js → routeFromVal-97111bfd.cjs.dev.js} +1 -1
- package/dist/valbuild-tanstack.cjs.dev.js +50 -12
- package/dist/valbuild-tanstack.cjs.prod.js +50 -12
- package/dist/valbuild-tanstack.esm.js +50 -12
- package/dist/{version-f6f044c2.cjs.prod.js → version-0cfddc38.cjs.dev.js} +1 -1
- package/dist/{version-4cc54e05.cjs.dev.js → version-24675097.cjs.prod.js} +1 -1
- package/dist/{version-d0b1c2c5.esm.js → version-e61be600.esm.js} +1 -1
- package/package.json +7 -7
- package/server/dist/valbuild-tanstack-server.cjs.dev.js +478 -152
- package/server/dist/valbuild-tanstack-server.cjs.prod.js +478 -152
- package/server/dist/valbuild-tanstack-server.esm.js +479 -153
|
@@ -1,11 +1,11 @@
|
|
|
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-e61be600.esm.js';
|
|
2
2
|
import { Internal } from '@valbuild/core';
|
|
3
|
-
import { _ as _objectSpread2, a as _slicedToArray, d as _defineProperty } from '../../dist/createForOfIteratorHelper-
|
|
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 } from '@valbuild/server';
|
|
5
5
|
export { InMemoryPatchStore, createPrettierFormatter } from '@valbuild/server';
|
|
6
|
-
import { b as initValRouteFromVal, g as getJsonEntryStegaRoot, i as isJsonValuesRecordSchema, a as getValRouteUrlFromVal
|
|
6
|
+
import { _ as _typeof, b as initValRouteFromVal, g as getJsonEntryStegaRoot, i as isJsonValuesRecordSchema, a as getValRouteUrlFromVal } from '../../dist/routeFromVal-1221e70d.esm.js';
|
|
7
7
|
import { stegaEncode, SET_AUTO_TAG_JSX_ENABLED } from '@valbuild/react/stega';
|
|
8
|
-
import { VAL_SESSION_COOKIE,
|
|
8
|
+
import { memoizePerRequest, VAL_SESSION_COOKIE, JSON_ENTRIES_BATCH_MAX } from '@valbuild/shared/internal';
|
|
9
9
|
import { initValMcp as initValMcp$1 } from '@valbuild/mcp';
|
|
10
10
|
import '@valbuild/shared/client';
|
|
11
11
|
|
|
@@ -296,6 +296,22 @@ function initValServer(valModules, config, opts) {
|
|
|
296
296
|
};
|
|
297
297
|
}
|
|
298
298
|
|
|
299
|
+
function _arrayWithoutHoles(r) {
|
|
300
|
+
if (Array.isArray(r)) return _arrayLikeToArray(r);
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
function _iterableToArray(r) {
|
|
304
|
+
if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
function _nonIterableSpread() {
|
|
308
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
function _toConsumableArray(r) {
|
|
312
|
+
return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
|
|
313
|
+
}
|
|
314
|
+
|
|
299
315
|
/*
|
|
300
316
|
* NOTE: no `SET_RSC(true)` here, unlike the Next package.
|
|
301
317
|
*
|
|
@@ -407,16 +423,16 @@ function loadDraftSources(_x, _x2) {
|
|
|
407
423
|
return _loadDraftSources.apply(this, arguments);
|
|
408
424
|
}
|
|
409
425
|
function _loadDraftSources() {
|
|
410
|
-
_loadDraftSources = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
426
|
+
_loadDraftSources = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(valServerPromise, sessionCookie) {
|
|
411
427
|
var valServer, treeRes;
|
|
412
|
-
return _regenerator().w(function (
|
|
413
|
-
while (1) switch (
|
|
428
|
+
return _regenerator().w(function (_context7) {
|
|
429
|
+
while (1) switch (_context7.n) {
|
|
414
430
|
case 0:
|
|
415
|
-
|
|
431
|
+
_context7.n = 1;
|
|
416
432
|
return valServerPromise;
|
|
417
433
|
case 1:
|
|
418
|
-
valServer =
|
|
419
|
-
|
|
434
|
+
valServer = _context7.v;
|
|
435
|
+
_context7.n = 2;
|
|
420
436
|
return valServer["/sources/~"]["PUT"]({
|
|
421
437
|
path: "/",
|
|
422
438
|
query: {
|
|
@@ -445,25 +461,25 @@ function _loadDraftSources() {
|
|
|
445
461
|
cookies: _defineProperty({}, VAL_SESSION_COOKIE, sessionCookie)
|
|
446
462
|
});
|
|
447
463
|
case 2:
|
|
448
|
-
treeRes =
|
|
464
|
+
treeRes = _context7.v;
|
|
449
465
|
if (!(treeRes.status === 200)) {
|
|
450
|
-
|
|
466
|
+
_context7.n = 3;
|
|
451
467
|
break;
|
|
452
468
|
}
|
|
453
|
-
return
|
|
469
|
+
return _context7.a(2, treeRes.json.modules);
|
|
454
470
|
case 3:
|
|
455
471
|
if (!(treeRes.status === 401)) {
|
|
456
|
-
|
|
472
|
+
_context7.n = 4;
|
|
457
473
|
break;
|
|
458
474
|
}
|
|
459
475
|
console.warn("Val: authentication error: ", treeRes.json.message);
|
|
460
|
-
return
|
|
476
|
+
return _context7.a(2, null);
|
|
461
477
|
case 4:
|
|
462
478
|
throw Error(JSON.stringify(treeRes.json, null, 2));
|
|
463
479
|
case 5:
|
|
464
|
-
return
|
|
480
|
+
return _context7.a(2);
|
|
465
481
|
}
|
|
466
|
-
},
|
|
482
|
+
}, _callee7);
|
|
467
483
|
}));
|
|
468
484
|
return _loadDraftSources.apply(this, arguments);
|
|
469
485
|
}
|
|
@@ -583,6 +599,315 @@ var initFetchValStega = function initFetchValStega(config, valApiEndpoints, valS
|
|
|
583
599
|
});
|
|
584
600
|
};
|
|
585
601
|
};
|
|
602
|
+
|
|
603
|
+
/** What `fetchValDraft` reads: the tree, the entries, and the patches' ops. */
|
|
604
|
+
|
|
605
|
+
/**
|
|
606
|
+
* The draft a page in this request should start from, or `null` for none.
|
|
607
|
+
*
|
|
608
|
+
* `null` -- and no read at all -- unless draft mode is on: a visitor pays one
|
|
609
|
+
* cookie lookup. Otherwise the SAME read every
|
|
610
|
+
* `fetchVal` in the request shares (`loadDraftSources`, memoised per request),
|
|
611
|
+
* cut down to the modules the draft changes. See `ValDraft`.
|
|
612
|
+
*
|
|
613
|
+
* Exists because the hooks render on the server too, and had no draft there:
|
|
614
|
+
* a draft page was rendered as the published site and only then replaced, in
|
|
615
|
+
* the browser, by what the editor holds -- old text first on every load.
|
|
616
|
+
*/
|
|
617
|
+
var initFetchValDraft = function initFetchValDraft(valServerPromise, isEnabled, getCookies, getDraftSourcesScope) {
|
|
618
|
+
return /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
|
|
619
|
+
var _yield$getCookies$get, sessionCookie, modules, sources, _i, _Object$entries, _Object$entries$_i, path, module, source, _t6, _t7, _t8, _t9, _t0;
|
|
620
|
+
return _regenerator().w(function (_context3) {
|
|
621
|
+
while (1) switch (_context3.p = _context3.n) {
|
|
622
|
+
case 0:
|
|
623
|
+
_context3.p = 0;
|
|
624
|
+
_context3.n = 1;
|
|
625
|
+
return isEnabled();
|
|
626
|
+
case 1:
|
|
627
|
+
if (_context3.v) {
|
|
628
|
+
_context3.n = 2;
|
|
629
|
+
break;
|
|
630
|
+
}
|
|
631
|
+
return _context3.a(2, null);
|
|
632
|
+
case 2:
|
|
633
|
+
_context3.n = 3;
|
|
634
|
+
return getCookies();
|
|
635
|
+
case 3:
|
|
636
|
+
_t7 = _yield$getCookies$get = _context3.v.get(VAL_SESSION_COOKIE);
|
|
637
|
+
_t6 = _t7 === null;
|
|
638
|
+
if (_t6) {
|
|
639
|
+
_context3.n = 4;
|
|
640
|
+
break;
|
|
641
|
+
}
|
|
642
|
+
_t6 = _yield$getCookies$get === void 0;
|
|
643
|
+
case 4:
|
|
644
|
+
if (!_t6) {
|
|
645
|
+
_context3.n = 5;
|
|
646
|
+
break;
|
|
647
|
+
}
|
|
648
|
+
_t8 = void 0;
|
|
649
|
+
_context3.n = 6;
|
|
650
|
+
break;
|
|
651
|
+
case 5:
|
|
652
|
+
_t8 = _yield$getCookies$get.value;
|
|
653
|
+
case 6:
|
|
654
|
+
sessionCookie = _t8;
|
|
655
|
+
_t9 = memoizePerRequest;
|
|
656
|
+
_context3.n = 7;
|
|
657
|
+
return getDraftSourcesScope();
|
|
658
|
+
case 7:
|
|
659
|
+
_context3.n = 8;
|
|
660
|
+
return _t9(_context3.v, sessionCookie !== null && sessionCookie !== void 0 ? sessionCookie : "", function () {
|
|
661
|
+
return loadDraftSources(valServerPromise, sessionCookie);
|
|
662
|
+
});
|
|
663
|
+
case 8:
|
|
664
|
+
modules = _context3.v;
|
|
665
|
+
if (modules) {
|
|
666
|
+
_context3.n = 9;
|
|
667
|
+
break;
|
|
668
|
+
}
|
|
669
|
+
return _context3.a(2, null);
|
|
670
|
+
case 9:
|
|
671
|
+
sources = {};
|
|
672
|
+
_i = 0, _Object$entries = Object.entries(modules);
|
|
673
|
+
case 10:
|
|
674
|
+
if (!(_i < _Object$entries.length)) {
|
|
675
|
+
_context3.n = 14;
|
|
676
|
+
break;
|
|
677
|
+
}
|
|
678
|
+
_Object$entries$_i = _slicedToArray(_Object$entries[_i], 2), path = _Object$entries$_i[0], module = _Object$entries$_i[1];
|
|
679
|
+
if (!(module.patches === undefined)) {
|
|
680
|
+
_context3.n = 11;
|
|
681
|
+
break;
|
|
682
|
+
}
|
|
683
|
+
return _context3.a(3, 13);
|
|
684
|
+
case 11:
|
|
685
|
+
_context3.n = 12;
|
|
686
|
+
return withDraftJsonEntries(valServerPromise, sessionCookie, path, module.source, module.patches.applied);
|
|
687
|
+
case 12:
|
|
688
|
+
source = _context3.v;
|
|
689
|
+
if (source !== undefined) {
|
|
690
|
+
sources[path] = source;
|
|
691
|
+
}
|
|
692
|
+
case 13:
|
|
693
|
+
_i++;
|
|
694
|
+
_context3.n = 10;
|
|
695
|
+
break;
|
|
696
|
+
case 14:
|
|
697
|
+
return _context3.a(2, {
|
|
698
|
+
sources: sources
|
|
699
|
+
});
|
|
700
|
+
case 15:
|
|
701
|
+
_context3.p = 15;
|
|
702
|
+
_t0 = _context3.v;
|
|
703
|
+
// Published content, as before this existed: a draft page that renders
|
|
704
|
+
// the site is a degraded preview, one that fails to render is an outage.
|
|
705
|
+
console.error("Val: could not read the draft", _t0);
|
|
706
|
+
return _context3.a(2, null);
|
|
707
|
+
}
|
|
708
|
+
}, _callee3, null, [[0, 15]]);
|
|
709
|
+
}));
|
|
710
|
+
};
|
|
711
|
+
|
|
712
|
+
/**
|
|
713
|
+
* A module's draft source, as the browser would have received it, with the
|
|
714
|
+
* `.jsonValues()` entries the draft edits filled in -- or `undefined` when
|
|
715
|
+
* they could not all be read, so the module is left out of the draft.
|
|
716
|
+
*
|
|
717
|
+
* Two things, both because `/sources/~` keeps each such entry as a MARKER
|
|
718
|
+
* (its content lives in its own file):
|
|
719
|
+
*
|
|
720
|
+
* - Read in-process, a marker still carries its `import()` thunk, which no
|
|
721
|
+
* serializer can send. So the source is put in its wire shape first, the
|
|
722
|
+
* same one the Studio gets over HTTP: a marker without its thunk, which the
|
|
723
|
+
* hooks read as "no draft for this entry" and resolve from the bundle.
|
|
724
|
+
* - An entry edited in the draft is still a marker there, so the page would
|
|
725
|
+
* render the published entry and swap it once the Studio loads it. Those
|
|
726
|
+
* entries -- the ones an applied patch touches, and only those -- are read
|
|
727
|
+
* through `/json` and put in place of their markers, which is the shape
|
|
728
|
+
* the Studio's own store gives them once it has.
|
|
729
|
+
*
|
|
730
|
+
* Leaving the module out is the published render that existed before the
|
|
731
|
+
* draft did: worse than this, and never wrong for long.
|
|
732
|
+
*/
|
|
733
|
+
function withDraftJsonEntries(_x3, _x4, _x5, _x6, _x7) {
|
|
734
|
+
return _withDraftJsonEntries.apply(this, arguments);
|
|
735
|
+
}
|
|
736
|
+
function _withDraftJsonEntries() {
|
|
737
|
+
_withDraftJsonEntries = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(valServerPromise, sessionCookie, moduleFilePath, source, appliedPatchIds) {
|
|
738
|
+
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, _t14, _t15;
|
|
739
|
+
return _regenerator().w(function (_context8) {
|
|
740
|
+
while (1) switch (_context8.p = _context8.n) {
|
|
741
|
+
case 0:
|
|
742
|
+
if (!(source === undefined)) {
|
|
743
|
+
_context8.n = 1;
|
|
744
|
+
break;
|
|
745
|
+
}
|
|
746
|
+
return _context8.a(2, undefined);
|
|
747
|
+
case 1:
|
|
748
|
+
wire = JSON.parse(JSON.stringify(source));
|
|
749
|
+
if (!(!isRecordOfJsonMarkers(source) || appliedPatchIds.length === 0)) {
|
|
750
|
+
_context8.n = 2;
|
|
751
|
+
break;
|
|
752
|
+
}
|
|
753
|
+
return _context8.a(2, wire);
|
|
754
|
+
case 2:
|
|
755
|
+
_context8.n = 3;
|
|
756
|
+
return valServerPromise;
|
|
757
|
+
case 3:
|
|
758
|
+
valServer = _context8.v;
|
|
759
|
+
cookies = _defineProperty({}, VAL_SESSION_COOKIE, sessionCookie);
|
|
760
|
+
_context8.n = 4;
|
|
761
|
+
return valServer["/patches"]["GET"]({
|
|
762
|
+
query: {
|
|
763
|
+
patch_id: appliedPatchIds,
|
|
764
|
+
exclude_patch_ops: false,
|
|
765
|
+
include_patch_groups: undefined
|
|
766
|
+
},
|
|
767
|
+
cookies: cookies
|
|
768
|
+
});
|
|
769
|
+
case 4:
|
|
770
|
+
patchesRes = _context8.v;
|
|
771
|
+
if (!(patchesRes.status !== 200)) {
|
|
772
|
+
_context8.n = 5;
|
|
773
|
+
break;
|
|
774
|
+
}
|
|
775
|
+
return _context8.a(2, undefined);
|
|
776
|
+
case 5:
|
|
777
|
+
edited = new Set();
|
|
778
|
+
_iterator = _createForOfIteratorHelper(patchesRes.json.patches);
|
|
779
|
+
_context8.p = 6;
|
|
780
|
+
_iterator.s();
|
|
781
|
+
case 7:
|
|
782
|
+
if ((_step = _iterator.n()).done) {
|
|
783
|
+
_context8.n = 19;
|
|
784
|
+
break;
|
|
785
|
+
}
|
|
786
|
+
_step$value = _step.value, path = _step$value.path, patch = _step$value.patch;
|
|
787
|
+
if (!(path !== moduleFilePath)) {
|
|
788
|
+
_context8.n = 8;
|
|
789
|
+
break;
|
|
790
|
+
}
|
|
791
|
+
return _context8.a(3, 18);
|
|
792
|
+
case 8:
|
|
793
|
+
_iterator3 = _createForOfIteratorHelper(patch !== null && patch !== void 0 ? patch : []);
|
|
794
|
+
_context8.p = 9;
|
|
795
|
+
_iterator3.s();
|
|
796
|
+
case 10:
|
|
797
|
+
if ((_step3 = _iterator3.n()).done) {
|
|
798
|
+
_context8.n = 15;
|
|
799
|
+
break;
|
|
800
|
+
}
|
|
801
|
+
op = _step3.value;
|
|
802
|
+
touched = [op.path[0]];
|
|
803
|
+
if (op.op === "move" || op.op === "copy") {
|
|
804
|
+
touched.push(op.from[0]);
|
|
805
|
+
}
|
|
806
|
+
_i2 = 0, _touched = touched;
|
|
807
|
+
case 11:
|
|
808
|
+
if (!(_i2 < _touched.length)) {
|
|
809
|
+
_context8.n = 14;
|
|
810
|
+
break;
|
|
811
|
+
}
|
|
812
|
+
_key = _touched[_i2];
|
|
813
|
+
if (!(_key === undefined)) {
|
|
814
|
+
_context8.n = 12;
|
|
815
|
+
break;
|
|
816
|
+
}
|
|
817
|
+
return _context8.a(2, undefined);
|
|
818
|
+
case 12:
|
|
819
|
+
if (Internal.isJson(source[_key])) {
|
|
820
|
+
edited.add(_key);
|
|
821
|
+
}
|
|
822
|
+
case 13:
|
|
823
|
+
_i2++;
|
|
824
|
+
_context8.n = 11;
|
|
825
|
+
break;
|
|
826
|
+
case 14:
|
|
827
|
+
_context8.n = 10;
|
|
828
|
+
break;
|
|
829
|
+
case 15:
|
|
830
|
+
_context8.n = 17;
|
|
831
|
+
break;
|
|
832
|
+
case 16:
|
|
833
|
+
_context8.p = 16;
|
|
834
|
+
_t14 = _context8.v;
|
|
835
|
+
_iterator3.e(_t14);
|
|
836
|
+
case 17:
|
|
837
|
+
_context8.p = 17;
|
|
838
|
+
_iterator3.f();
|
|
839
|
+
return _context8.f(17);
|
|
840
|
+
case 18:
|
|
841
|
+
_context8.n = 7;
|
|
842
|
+
break;
|
|
843
|
+
case 19:
|
|
844
|
+
_context8.n = 21;
|
|
845
|
+
break;
|
|
846
|
+
case 20:
|
|
847
|
+
_context8.p = 20;
|
|
848
|
+
_t15 = _context8.v;
|
|
849
|
+
_iterator.e(_t15);
|
|
850
|
+
case 21:
|
|
851
|
+
_context8.p = 21;
|
|
852
|
+
_iterator.f();
|
|
853
|
+
return _context8.f(21);
|
|
854
|
+
case 22:
|
|
855
|
+
keys = _toConsumableArray(edited);
|
|
856
|
+
draft = wire;
|
|
857
|
+
i = 0;
|
|
858
|
+
case 23:
|
|
859
|
+
if (!(i < keys.length)) {
|
|
860
|
+
_context8.n = 27;
|
|
861
|
+
break;
|
|
862
|
+
}
|
|
863
|
+
_context8.n = 24;
|
|
864
|
+
return valServer["/json"]["GET"]({
|
|
865
|
+
query: {
|
|
866
|
+
path: moduleFilePath,
|
|
867
|
+
key: undefined,
|
|
868
|
+
keys: keys.slice(i, i + JSON_ENTRIES_BATCH_MAX),
|
|
869
|
+
offset: undefined,
|
|
870
|
+
limit: undefined,
|
|
871
|
+
apply_patches: true,
|
|
872
|
+
own_patch_groups_only: true
|
|
873
|
+
},
|
|
874
|
+
cookies: cookies
|
|
875
|
+
});
|
|
876
|
+
case 24:
|
|
877
|
+
res = _context8.v;
|
|
878
|
+
if (!(res.status !== 200 || !("entries" in res.json) || res.json.errors.length > 0 || res.json.missing.length > 0)) {
|
|
879
|
+
_context8.n = 25;
|
|
880
|
+
break;
|
|
881
|
+
}
|
|
882
|
+
return _context8.a(2, undefined);
|
|
883
|
+
case 25:
|
|
884
|
+
_iterator2 = _createForOfIteratorHelper(res.json.entries);
|
|
885
|
+
try {
|
|
886
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
887
|
+
_step2$value = _step2.value, key = _step2$value.key, content = _step2$value.content;
|
|
888
|
+
draft[key] = content;
|
|
889
|
+
}
|
|
890
|
+
} catch (err) {
|
|
891
|
+
_iterator2.e(err);
|
|
892
|
+
} finally {
|
|
893
|
+
_iterator2.f();
|
|
894
|
+
}
|
|
895
|
+
case 26:
|
|
896
|
+
i += JSON_ENTRIES_BATCH_MAX;
|
|
897
|
+
_context8.n = 23;
|
|
898
|
+
break;
|
|
899
|
+
case 27:
|
|
900
|
+
return _context8.a(2, draft);
|
|
901
|
+
}
|
|
902
|
+
}, _callee8, null, [[9, 16, 17, 18], [6, 20, 21, 22]]);
|
|
903
|
+
}));
|
|
904
|
+
return _withDraftJsonEntries.apply(this, arguments);
|
|
905
|
+
}
|
|
906
|
+
function isRecordOfJsonMarkers(source) {
|
|
907
|
+
return _typeof(source) === "object" && source !== null && !Array.isArray(source) && Object.values(source).some(function (value) {
|
|
908
|
+
return Internal.isJson(value);
|
|
909
|
+
});
|
|
910
|
+
}
|
|
586
911
|
function getHost(headers) {
|
|
587
912
|
var _headers$get;
|
|
588
913
|
var host = headers === null || headers === void 0 ? void 0 : headers.get("host");
|
|
@@ -625,15 +950,15 @@ function getHost(headers) {
|
|
|
625
950
|
|
|
626
951
|
var initFetchValRouteStega = function initFetchValRouteStega(config, valApiEndpoints, valServerPromise, isEnabled, getHeaders, getCookies, getDraftSourcesScope) {
|
|
627
952
|
return /*#__PURE__*/function () {
|
|
628
|
-
var
|
|
629
|
-
var resolvedParams, valModule, path, schema, source, url, enabled, draft, content, fetchVal, val, route,
|
|
630
|
-
return _regenerator().w(function (
|
|
631
|
-
while (1) switch (
|
|
953
|
+
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(selector, params) {
|
|
954
|
+
var resolvedParams, valModule, path, schema, source, url, enabled, draft, content, fetchVal, val, route, _t10;
|
|
955
|
+
return _regenerator().w(function (_context4) {
|
|
956
|
+
while (1) switch (_context4.p = _context4.n) {
|
|
632
957
|
case 0:
|
|
633
|
-
|
|
958
|
+
_context4.n = 1;
|
|
634
959
|
return Promise.resolve(params);
|
|
635
960
|
case 1:
|
|
636
|
-
resolvedParams =
|
|
961
|
+
resolvedParams = _context4.v;
|
|
637
962
|
// A view is a pointer: everything below reads a path, a schema and a source
|
|
638
963
|
// off this, and a pointer has none of them. See `resolveViewedModule`.
|
|
639
964
|
valModule = Internal.resolveViewedModule(selector);
|
|
@@ -642,78 +967,78 @@ var initFetchValRouteStega = function initFetchValRouteStega(config, valApiEndpo
|
|
|
642
967
|
// entry's backing `*.val.json`, instead of eagerly resolving the whole
|
|
643
968
|
// record via `fetchVal`.
|
|
644
969
|
if (!isJsonValuesRecordSchema(schema)) {
|
|
645
|
-
|
|
970
|
+
_context4.n = 11;
|
|
646
971
|
break;
|
|
647
972
|
}
|
|
648
973
|
source = valModule && Internal.getSource(valModule);
|
|
649
974
|
url = getValRouteUrlFromVal(resolvedParams, "fetchValRoute", path, schema, source);
|
|
650
975
|
if (url) {
|
|
651
|
-
|
|
976
|
+
_context4.n = 2;
|
|
652
977
|
break;
|
|
653
978
|
}
|
|
654
|
-
return
|
|
979
|
+
return _context4.a(2, null);
|
|
655
980
|
case 2:
|
|
656
981
|
enabled = false;
|
|
657
|
-
|
|
658
|
-
|
|
982
|
+
_context4.p = 3;
|
|
983
|
+
_context4.n = 4;
|
|
659
984
|
return isEnabled();
|
|
660
985
|
case 4:
|
|
661
|
-
enabled =
|
|
662
|
-
|
|
986
|
+
enabled = _context4.v;
|
|
987
|
+
_context4.n = 6;
|
|
663
988
|
break;
|
|
664
989
|
case 5:
|
|
665
|
-
|
|
666
|
-
|
|
990
|
+
_context4.p = 5;
|
|
991
|
+
_context4.v;
|
|
667
992
|
case 6:
|
|
668
993
|
draft = {
|
|
669
994
|
status: "unavailable"
|
|
670
995
|
};
|
|
671
996
|
if (!(enabled && path)) {
|
|
672
|
-
|
|
997
|
+
_context4.n = 8;
|
|
673
998
|
break;
|
|
674
999
|
}
|
|
675
1000
|
SET_AUTO_TAG_JSX_ENABLED(true);
|
|
676
|
-
|
|
1001
|
+
_context4.n = 7;
|
|
677
1002
|
return loadDraftJsonEntry(valServerPromise, getCookies, path, url);
|
|
678
1003
|
case 7:
|
|
679
|
-
draft =
|
|
1004
|
+
draft = _context4.v;
|
|
680
1005
|
case 8:
|
|
681
|
-
|
|
1006
|
+
_context4.n = 9;
|
|
682
1007
|
return resolveDraftOrCommittedEntry(draft, function () {
|
|
683
1008
|
return loadJsonEntryContent(source, url);
|
|
684
1009
|
});
|
|
685
1010
|
case 9:
|
|
686
|
-
content =
|
|
1011
|
+
content = _context4.v;
|
|
687
1012
|
if (!(content === undefined)) {
|
|
688
|
-
|
|
1013
|
+
_context4.n = 10;
|
|
689
1014
|
break;
|
|
690
1015
|
}
|
|
691
|
-
return
|
|
1016
|
+
return _context4.a(2, null);
|
|
692
1017
|
case 10:
|
|
693
|
-
return
|
|
1018
|
+
return _context4.a(2, stegaEncode(content, {
|
|
694
1019
|
disabled: !enabled,
|
|
695
1020
|
root: getJsonEntryStegaRoot(valModule, url)
|
|
696
1021
|
}));
|
|
697
1022
|
case 11:
|
|
698
1023
|
fetchVal = initFetchValStega(config, valApiEndpoints, valServerPromise, isEnabled, getHeaders, getCookies, getDraftSourcesScope);
|
|
699
|
-
|
|
700
|
-
if (!
|
|
701
|
-
|
|
1024
|
+
_t10 = valModule;
|
|
1025
|
+
if (!_t10) {
|
|
1026
|
+
_context4.n = 13;
|
|
702
1027
|
break;
|
|
703
1028
|
}
|
|
704
|
-
|
|
1029
|
+
_context4.n = 12;
|
|
705
1030
|
return fetchVal(valModule);
|
|
706
1031
|
case 12:
|
|
707
|
-
|
|
1032
|
+
_t10 = _context4.v;
|
|
708
1033
|
case 13:
|
|
709
|
-
val =
|
|
1034
|
+
val = _t10;
|
|
710
1035
|
route = initValRouteFromVal(resolvedParams, "fetchValRoute", path, schema, val);
|
|
711
|
-
return
|
|
1036
|
+
return _context4.a(2, route);
|
|
712
1037
|
}
|
|
713
|
-
},
|
|
1038
|
+
}, _callee4, null, [[3, 5]]);
|
|
714
1039
|
}));
|
|
715
|
-
return function (
|
|
716
|
-
return
|
|
1040
|
+
return function (_x8, _x9) {
|
|
1041
|
+
return _ref4.apply(this, arguments);
|
|
717
1042
|
};
|
|
718
1043
|
}();
|
|
719
1044
|
};
|
|
@@ -723,7 +1048,7 @@ var initFetchValRouteStega = function initFetchValRouteStega(config, valApiEndpo
|
|
|
723
1048
|
* source markers (one dynamic import). Returns `undefined` when the key is
|
|
724
1049
|
* missing or its marker has no runtime thunk (transport marker / draft entry).
|
|
725
1050
|
*/
|
|
726
|
-
function loadJsonEntryContent(
|
|
1051
|
+
function loadJsonEntryContent(_x0, _x1) {
|
|
727
1052
|
return _loadJsonEntryContent.apply(this, arguments);
|
|
728
1053
|
}
|
|
729
1054
|
/**
|
|
@@ -748,37 +1073,37 @@ function loadJsonEntryContent(_x5, _x6) {
|
|
|
748
1073
|
* to the whole server type.
|
|
749
1074
|
*/
|
|
750
1075
|
function _loadJsonEntryContent() {
|
|
751
|
-
_loadJsonEntryContent = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1076
|
+
_loadJsonEntryContent = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(source, key) {
|
|
752
1077
|
var marker, thunk;
|
|
753
|
-
return _regenerator().w(function (
|
|
754
|
-
while (1) switch (
|
|
1078
|
+
return _regenerator().w(function (_context9) {
|
|
1079
|
+
while (1) switch (_context9.n) {
|
|
755
1080
|
case 0:
|
|
756
1081
|
if (!(!source || _typeof(source) !== "object")) {
|
|
757
|
-
|
|
1082
|
+
_context9.n = 1;
|
|
758
1083
|
break;
|
|
759
1084
|
}
|
|
760
|
-
return
|
|
1085
|
+
return _context9.a(2, undefined);
|
|
761
1086
|
case 1:
|
|
762
1087
|
marker = source[key];
|
|
763
1088
|
if (Internal.isJson(marker)) {
|
|
764
|
-
|
|
1089
|
+
_context9.n = 2;
|
|
765
1090
|
break;
|
|
766
1091
|
}
|
|
767
|
-
return
|
|
1092
|
+
return _context9.a(2, undefined);
|
|
768
1093
|
case 2:
|
|
769
1094
|
thunk = Internal.getJsonImport(marker);
|
|
770
1095
|
if (thunk) {
|
|
771
|
-
|
|
1096
|
+
_context9.n = 3;
|
|
772
1097
|
break;
|
|
773
1098
|
}
|
|
774
|
-
return
|
|
1099
|
+
return _context9.a(2, undefined);
|
|
775
1100
|
case 3:
|
|
776
|
-
|
|
1101
|
+
_context9.n = 4;
|
|
777
1102
|
return thunk();
|
|
778
1103
|
case 4:
|
|
779
|
-
return
|
|
1104
|
+
return _context9.a(2, _context9.v["default"]);
|
|
780
1105
|
}
|
|
781
|
-
},
|
|
1106
|
+
}, _callee9);
|
|
782
1107
|
}));
|
|
783
1108
|
return _loadJsonEntryContent.apply(this, arguments);
|
|
784
1109
|
}
|
|
@@ -791,33 +1116,33 @@ function _loadJsonEntryContent() {
|
|
|
791
1116
|
* ask). Returning `undefined` means "render nothing"; both callers turn that into
|
|
792
1117
|
* a null/undefined result.
|
|
793
1118
|
*/
|
|
794
|
-
function resolveDraftOrCommittedEntry(
|
|
1119
|
+
function resolveDraftOrCommittedEntry(_x10, _x11) {
|
|
795
1120
|
return _resolveDraftOrCommittedEntry.apply(this, arguments);
|
|
796
1121
|
}
|
|
797
1122
|
function _resolveDraftOrCommittedEntry() {
|
|
798
|
-
_resolveDraftOrCommittedEntry = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
799
|
-
return _regenerator().w(function (
|
|
800
|
-
while (1) switch (
|
|
1123
|
+
_resolveDraftOrCommittedEntry = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(draft, loadCommitted) {
|
|
1124
|
+
return _regenerator().w(function (_context0) {
|
|
1125
|
+
while (1) switch (_context0.n) {
|
|
801
1126
|
case 0:
|
|
802
1127
|
if (!(draft.status === "content")) {
|
|
803
|
-
|
|
1128
|
+
_context0.n = 1;
|
|
804
1129
|
break;
|
|
805
1130
|
}
|
|
806
|
-
return
|
|
1131
|
+
return _context0.a(2, draft.content);
|
|
807
1132
|
case 1:
|
|
808
1133
|
if (!(draft.status === "absent")) {
|
|
809
|
-
|
|
1134
|
+
_context0.n = 2;
|
|
810
1135
|
break;
|
|
811
1136
|
}
|
|
812
|
-
return
|
|
1137
|
+
return _context0.a(2, undefined);
|
|
813
1138
|
case 2:
|
|
814
|
-
return
|
|
1139
|
+
return _context0.a(2, loadCommitted());
|
|
815
1140
|
}
|
|
816
|
-
},
|
|
1141
|
+
}, _callee0);
|
|
817
1142
|
}));
|
|
818
1143
|
return _resolveDraftOrCommittedEntry.apply(this, arguments);
|
|
819
1144
|
}
|
|
820
|
-
function loadDraftJsonEntry(
|
|
1145
|
+
function loadDraftJsonEntry(_x12, _x13, _x14, _x15) {
|
|
821
1146
|
return _loadDraftJsonEntry.apply(this, arguments);
|
|
822
1147
|
}
|
|
823
1148
|
/**
|
|
@@ -832,31 +1157,31 @@ function loadDraftJsonEntry(_x9, _x0, _x1, _x10) {
|
|
|
832
1157
|
* the draft read yields nothing.
|
|
833
1158
|
*/
|
|
834
1159
|
function _loadDraftJsonEntry() {
|
|
835
|
-
_loadDraftJsonEntry = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
836
|
-
var
|
|
1160
|
+
_loadDraftJsonEntry = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1(valServerPromise, getCookies, moduleFilePath, key) {
|
|
1161
|
+
var _cookies4;
|
|
837
1162
|
var cookies, valServer, res;
|
|
838
|
-
return _regenerator().w(function (
|
|
839
|
-
while (1) switch (
|
|
1163
|
+
return _regenerator().w(function (_context1) {
|
|
1164
|
+
while (1) switch (_context1.p = _context1.n) {
|
|
840
1165
|
case 0:
|
|
841
|
-
|
|
842
|
-
|
|
1166
|
+
_context1.p = 0;
|
|
1167
|
+
_context1.n = 1;
|
|
843
1168
|
return getCookies();
|
|
844
1169
|
case 1:
|
|
845
|
-
cookies =
|
|
846
|
-
|
|
1170
|
+
cookies = _context1.v;
|
|
1171
|
+
_context1.n = 3;
|
|
847
1172
|
break;
|
|
848
1173
|
case 2:
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
return
|
|
1174
|
+
_context1.p = 2;
|
|
1175
|
+
_context1.v;
|
|
1176
|
+
return _context1.a(2, {
|
|
852
1177
|
status: "unavailable"
|
|
853
1178
|
});
|
|
854
1179
|
case 3:
|
|
855
|
-
|
|
1180
|
+
_context1.n = 4;
|
|
856
1181
|
return valServerPromise;
|
|
857
1182
|
case 4:
|
|
858
|
-
valServer =
|
|
859
|
-
|
|
1183
|
+
valServer = _context1.v;
|
|
1184
|
+
_context1.n = 5;
|
|
860
1185
|
return valServer["/json"]["GET"]({
|
|
861
1186
|
query: {
|
|
862
1187
|
path: moduleFilePath,
|
|
@@ -876,63 +1201,63 @@ function _loadDraftJsonEntry() {
|
|
|
876
1201
|
*/
|
|
877
1202
|
own_patch_groups_only: true
|
|
878
1203
|
},
|
|
879
|
-
cookies: _defineProperty({}, VAL_SESSION_COOKIE, (
|
|
1204
|
+
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)
|
|
880
1205
|
});
|
|
881
1206
|
case 5:
|
|
882
|
-
res =
|
|
1207
|
+
res = _context1.v;
|
|
883
1208
|
if (!(res.status === 200 && "content" in res.json)) {
|
|
884
|
-
|
|
1209
|
+
_context1.n = 6;
|
|
885
1210
|
break;
|
|
886
1211
|
}
|
|
887
|
-
return
|
|
1212
|
+
return _context1.a(2, {
|
|
888
1213
|
status: "content",
|
|
889
1214
|
content: res.json.content
|
|
890
1215
|
});
|
|
891
1216
|
case 6:
|
|
892
1217
|
if (!(res.status === 401)) {
|
|
893
|
-
|
|
1218
|
+
_context1.n = 7;
|
|
894
1219
|
break;
|
|
895
1220
|
}
|
|
896
1221
|
console.warn("Val: authentication error: ", res.json.message);
|
|
897
|
-
return
|
|
1222
|
+
return _context1.a(2, {
|
|
898
1223
|
status: "unavailable"
|
|
899
1224
|
});
|
|
900
1225
|
case 7:
|
|
901
1226
|
if (!(res.status === 404)) {
|
|
902
|
-
|
|
1227
|
+
_context1.n = 8;
|
|
903
1228
|
break;
|
|
904
1229
|
}
|
|
905
|
-
return
|
|
1230
|
+
return _context1.a(2, {
|
|
906
1231
|
status: "absent"
|
|
907
1232
|
});
|
|
908
1233
|
case 8:
|
|
909
1234
|
console.error("Val: could not load draft JSON entry: ", "message" in res.json ? res.json.message : "status ".concat(res.status));
|
|
910
|
-
return
|
|
1235
|
+
return _context1.a(2, {
|
|
911
1236
|
status: "unavailable"
|
|
912
1237
|
});
|
|
913
1238
|
}
|
|
914
|
-
},
|
|
1239
|
+
}, _callee1, null, [[0, 2]]);
|
|
915
1240
|
}));
|
|
916
1241
|
return _loadDraftJsonEntry.apply(this, arguments);
|
|
917
1242
|
}
|
|
918
1243
|
var initFetchValKeyStega = function initFetchValKeyStega(valServerPromise, isEnabled, getCookies) {
|
|
919
1244
|
return /*#__PURE__*/function () {
|
|
920
|
-
var
|
|
1245
|
+
var _ref5 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(selector, key) {
|
|
921
1246
|
var enabled, valModule, source, moduleFilePath, draft, content;
|
|
922
|
-
return _regenerator().w(function (
|
|
923
|
-
while (1) switch (
|
|
1247
|
+
return _regenerator().w(function (_context5) {
|
|
1248
|
+
while (1) switch (_context5.p = _context5.n) {
|
|
924
1249
|
case 0:
|
|
925
1250
|
enabled = false;
|
|
926
|
-
|
|
927
|
-
|
|
1251
|
+
_context5.p = 1;
|
|
1252
|
+
_context5.n = 2;
|
|
928
1253
|
return isEnabled();
|
|
929
1254
|
case 2:
|
|
930
|
-
enabled =
|
|
931
|
-
|
|
1255
|
+
enabled = _context5.v;
|
|
1256
|
+
_context5.n = 4;
|
|
932
1257
|
break;
|
|
933
1258
|
case 3:
|
|
934
|
-
|
|
935
|
-
|
|
1259
|
+
_context5.p = 3;
|
|
1260
|
+
_context5.v;
|
|
936
1261
|
case 4:
|
|
937
1262
|
// A view is a pointer: everything below reads a path and a source off this,
|
|
938
1263
|
// and a pointer has neither. See `resolveViewedModule`.
|
|
@@ -943,84 +1268,84 @@ var initFetchValKeyStega = function initFetchValKeyStega(valServerPromise, isEna
|
|
|
943
1268
|
status: "unavailable"
|
|
944
1269
|
};
|
|
945
1270
|
if (!(enabled && moduleFilePath)) {
|
|
946
|
-
|
|
1271
|
+
_context5.n = 6;
|
|
947
1272
|
break;
|
|
948
1273
|
}
|
|
949
1274
|
SET_AUTO_TAG_JSX_ENABLED(true);
|
|
950
|
-
|
|
1275
|
+
_context5.n = 5;
|
|
951
1276
|
return loadDraftJsonEntry(valServerPromise, getCookies, moduleFilePath, key);
|
|
952
1277
|
case 5:
|
|
953
|
-
draft =
|
|
1278
|
+
draft = _context5.v;
|
|
954
1279
|
case 6:
|
|
955
|
-
|
|
1280
|
+
_context5.n = 7;
|
|
956
1281
|
return resolveDraftOrCommittedEntry(draft, function () {
|
|
957
1282
|
return loadJsonEntryContent(source, key);
|
|
958
1283
|
});
|
|
959
1284
|
case 7:
|
|
960
|
-
content =
|
|
1285
|
+
content = _context5.v;
|
|
961
1286
|
if (!(content === undefined)) {
|
|
962
|
-
|
|
1287
|
+
_context5.n = 8;
|
|
963
1288
|
break;
|
|
964
1289
|
}
|
|
965
|
-
return
|
|
1290
|
+
return _context5.a(2, undefined);
|
|
966
1291
|
case 8:
|
|
967
|
-
return
|
|
1292
|
+
return _context5.a(2, stegaEncode(content, {
|
|
968
1293
|
disabled: !enabled,
|
|
969
1294
|
root: getJsonEntryStegaRoot(valModule, key)
|
|
970
1295
|
}));
|
|
971
1296
|
}
|
|
972
|
-
},
|
|
1297
|
+
}, _callee5, null, [[1, 3]]);
|
|
973
1298
|
}));
|
|
974
|
-
return function (
|
|
975
|
-
return
|
|
1299
|
+
return function (_x16, _x17) {
|
|
1300
|
+
return _ref5.apply(this, arguments);
|
|
976
1301
|
};
|
|
977
1302
|
}();
|
|
978
1303
|
};
|
|
979
1304
|
var initFetchValRouteUrl = function initFetchValRouteUrl(config, valApiEndpoints, valServerPromise, isEnabled, getHeaders, getCookies, getDraftSourcesScope) {
|
|
980
1305
|
return /*#__PURE__*/function () {
|
|
981
|
-
var
|
|
982
|
-
var fetchVal, resolvedParams, valModule, path, schema, val, route,
|
|
983
|
-
return _regenerator().w(function (
|
|
984
|
-
while (1) switch (
|
|
1306
|
+
var _ref6 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(selector, params) {
|
|
1307
|
+
var fetchVal, resolvedParams, valModule, path, schema, val, route, _t12, _t13;
|
|
1308
|
+
return _regenerator().w(function (_context6) {
|
|
1309
|
+
while (1) switch (_context6.n) {
|
|
985
1310
|
case 0:
|
|
986
1311
|
fetchVal = initFetchValStega(config, valApiEndpoints, valServerPromise, isEnabled, getHeaders, getCookies, getDraftSourcesScope);
|
|
987
1312
|
if (!(params === undefined)) {
|
|
988
|
-
|
|
1313
|
+
_context6.n = 1;
|
|
989
1314
|
break;
|
|
990
1315
|
}
|
|
991
|
-
|
|
992
|
-
|
|
1316
|
+
_t12 = undefined;
|
|
1317
|
+
_context6.n = 3;
|
|
993
1318
|
break;
|
|
994
1319
|
case 1:
|
|
995
|
-
|
|
1320
|
+
_context6.n = 2;
|
|
996
1321
|
return Promise.resolve(params);
|
|
997
1322
|
case 2:
|
|
998
|
-
|
|
1323
|
+
_t12 = _context6.v;
|
|
999
1324
|
case 3:
|
|
1000
|
-
resolvedParams =
|
|
1325
|
+
resolvedParams = _t12;
|
|
1001
1326
|
// A view is a pointer: everything below reads a path, a schema and a source
|
|
1002
1327
|
// off this, and a pointer has none of them. See `resolveViewedModule`.
|
|
1003
1328
|
valModule = Internal.resolveViewedModule(selector);
|
|
1004
1329
|
path = valModule && Internal.getValPath(valModule);
|
|
1005
1330
|
schema = valModule && Internal.getSchema(valModule);
|
|
1006
|
-
|
|
1007
|
-
if (!
|
|
1008
|
-
|
|
1331
|
+
_t13 = valModule;
|
|
1332
|
+
if (!_t13) {
|
|
1333
|
+
_context6.n = 5;
|
|
1009
1334
|
break;
|
|
1010
1335
|
}
|
|
1011
|
-
|
|
1336
|
+
_context6.n = 4;
|
|
1012
1337
|
return fetchVal(valModule);
|
|
1013
1338
|
case 4:
|
|
1014
|
-
|
|
1339
|
+
_t13 = _context6.v;
|
|
1015
1340
|
case 5:
|
|
1016
|
-
val =
|
|
1341
|
+
val = _t13;
|
|
1017
1342
|
route = getValRouteUrlFromVal(resolvedParams, "fetchValRouteUrl", path, schema, val);
|
|
1018
|
-
return
|
|
1343
|
+
return _context6.a(2, route);
|
|
1019
1344
|
}
|
|
1020
|
-
},
|
|
1345
|
+
}, _callee6);
|
|
1021
1346
|
}));
|
|
1022
|
-
return function (
|
|
1023
|
-
return
|
|
1347
|
+
return function (_x18, _x19) {
|
|
1348
|
+
return _ref6.apply(this, arguments);
|
|
1024
1349
|
};
|
|
1025
1350
|
}();
|
|
1026
1351
|
};
|
|
@@ -1038,25 +1363,25 @@ function requestHeaders() {
|
|
|
1038
1363
|
}
|
|
1039
1364
|
/** The request's cookies, in the `{ name, value }` shape the readers want. */
|
|
1040
1365
|
function _requestHeaders() {
|
|
1041
|
-
_requestHeaders = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1366
|
+
_requestHeaders = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10() {
|
|
1042
1367
|
var _yield$import2, getRequestHeaders, headers;
|
|
1043
|
-
return _regenerator().w(function (
|
|
1044
|
-
while (1) switch (
|
|
1368
|
+
return _regenerator().w(function (_context10) {
|
|
1369
|
+
while (1) switch (_context10.n) {
|
|
1045
1370
|
case 0:
|
|
1046
|
-
|
|
1371
|
+
_context10.n = 1;
|
|
1047
1372
|
return import('@tanstack/react-start/server');
|
|
1048
1373
|
case 1:
|
|
1049
|
-
_yield$import2 =
|
|
1374
|
+
_yield$import2 = _context10.v;
|
|
1050
1375
|
getRequestHeaders = _yield$import2.getRequestHeaders;
|
|
1051
1376
|
headers = getRequestHeaders();
|
|
1052
|
-
return
|
|
1377
|
+
return _context10.a(2, {
|
|
1053
1378
|
get: function get(name) {
|
|
1054
1379
|
var _headers$get2;
|
|
1055
1380
|
return (_headers$get2 = headers.get(name)) !== null && _headers$get2 !== void 0 ? _headers$get2 : null;
|
|
1056
1381
|
}
|
|
1057
1382
|
});
|
|
1058
1383
|
}
|
|
1059
|
-
},
|
|
1384
|
+
}, _callee10);
|
|
1060
1385
|
}));
|
|
1061
1386
|
return _requestHeaders.apply(this, arguments);
|
|
1062
1387
|
}
|
|
@@ -1084,17 +1409,17 @@ function requestCookies() {
|
|
|
1084
1409
|
* } = initValContent(config, valModules);
|
|
1085
1410
|
*/
|
|
1086
1411
|
function _requestCookies() {
|
|
1087
|
-
_requestCookies = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1412
|
+
_requestCookies = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11() {
|
|
1088
1413
|
var _yield$import3, getCookie;
|
|
1089
|
-
return _regenerator().w(function (
|
|
1090
|
-
while (1) switch (
|
|
1414
|
+
return _regenerator().w(function (_context11) {
|
|
1415
|
+
while (1) switch (_context11.n) {
|
|
1091
1416
|
case 0:
|
|
1092
|
-
|
|
1417
|
+
_context11.n = 1;
|
|
1093
1418
|
return import('@tanstack/react-start/server');
|
|
1094
1419
|
case 1:
|
|
1095
|
-
_yield$import3 =
|
|
1420
|
+
_yield$import3 = _context11.v;
|
|
1096
1421
|
getCookie = _yield$import3.getCookie;
|
|
1097
|
-
return
|
|
1422
|
+
return _context11.a(2, {
|
|
1098
1423
|
get: function get(name) {
|
|
1099
1424
|
var value = getCookie(name);
|
|
1100
1425
|
return value === undefined ? undefined : {
|
|
@@ -1104,7 +1429,7 @@ function _requestCookies() {
|
|
|
1104
1429
|
}
|
|
1105
1430
|
});
|
|
1106
1431
|
}
|
|
1107
|
-
},
|
|
1432
|
+
}, _callee11);
|
|
1108
1433
|
}));
|
|
1109
1434
|
return _requestCookies.apply(this, arguments);
|
|
1110
1435
|
}
|
|
@@ -1150,7 +1475,8 @@ function initValContent(config, valModules, opts) {
|
|
|
1150
1475
|
valServerPromise, isEnabled, requestHeaders, requestCookies, draftSourcesScope),
|
|
1151
1476
|
fetchValKeyStega: initFetchValKeyStega(valServerPromise, isEnabled, requestCookies),
|
|
1152
1477
|
fetchValRouteStega: initFetchValRouteStega(config, valApiEndpoints, valServerPromise, isEnabled, requestHeaders, requestCookies, draftSourcesScope),
|
|
1153
|
-
fetchValRouteUrl: initFetchValRouteUrl(config, valApiEndpoints, valServerPromise, isEnabled, requestHeaders, requestCookies, draftSourcesScope)
|
|
1478
|
+
fetchValRouteUrl: initFetchValRouteUrl(config, valApiEndpoints, valServerPromise, isEnabled, requestHeaders, requestCookies, draftSourcesScope),
|
|
1479
|
+
fetchValDraft: initFetchValDraft(valServerPromise, isEnabled, requestCookies, draftSourcesScope)
|
|
1154
1480
|
};
|
|
1155
1481
|
}
|
|
1156
1482
|
|