@valbuild/tanstack 0.135.0 → 0.136.1
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 +53 -0
- package/dist/declarations/src/server/initValContent.d.ts +53 -6
- 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-a940a26b.cjs.prod.js → version-abf2eb56.cjs.prod.js} +1 -1
- package/dist/{version-d7ff1ff7.cjs.dev.js → version-e63e1b48.cjs.dev.js} +1 -1
- package/dist/{version-78c09a89.esm.js → version-eb1cf21e.esm.js} +1 -1
- package/package.json +8 -8
- package/server/dist/valbuild-tanstack-server.cjs.dev.js +364 -222
- package/server/dist/valbuild-tanstack-server.cjs.prod.js +364 -222
- package/server/dist/valbuild-tanstack-server.esm.js +365 -223
|
@@ -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-eb1cf21e.esm.js';
|
|
2
2
|
import { Internal } from '@valbuild/core';
|
|
3
3
|
import { _ as _objectSpread2, a as _slicedToArray, d as _defineProperty } from '../../dist/createForOfIteratorHelper-485c2ce1.esm.js';
|
|
4
4
|
import { createValApiRouter, createValServer } from '@valbuild/server';
|
|
5
5
|
export { InMemoryPatchStore, createPrettierFormatter } from '@valbuild/server';
|
|
6
6
|
import { b as initValRouteFromVal, g as getJsonEntryStegaRoot, i as isJsonValuesRecordSchema, a as getValRouteUrlFromVal, _ as _typeof } from '../../dist/routeFromVal-728295a0.esm.js';
|
|
7
7
|
import { stegaEncode, SET_AUTO_TAG_JSX_ENABLED } from '@valbuild/react/stega';
|
|
8
|
-
import { VAL_SESSION_COOKIE } from '@valbuild/shared/internal';
|
|
8
|
+
import { VAL_SESSION_COOKIE, memoizePerRequest } from '@valbuild/shared/internal';
|
|
9
9
|
import { initValMcp as initValMcp$1 } from '@valbuild/mcp';
|
|
10
10
|
import '@valbuild/shared/client';
|
|
11
11
|
|
|
@@ -304,109 +304,260 @@ function initValServer(valModules, config, opts) {
|
|
|
304
304
|
* is server-RENDERED and then hydrated, so every element it produces is a
|
|
305
305
|
* normal client element and the distinction does not exist.
|
|
306
306
|
*/
|
|
307
|
-
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* The `modules` map every `fetchVal` in one request shares.
|
|
310
|
+
*
|
|
311
|
+
* Derived from the route's own response type rather than restated, so it cannot
|
|
312
|
+
* drift from what `/sources/~` actually returns.
|
|
313
|
+
*/
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* The slice of `ValServer` the draft-sources reader uses.
|
|
317
|
+
*
|
|
318
|
+
* Narrower than `ValServer` for the same reason `JsonEntryValServer` below is:
|
|
319
|
+
* it says what the dependency IS, and it lets a test drive the reader with a
|
|
320
|
+
* one-route fake instead of casting a partial object to the whole server type.
|
|
321
|
+
*/
|
|
322
|
+
|
|
323
|
+
/** What the route readers need: the tree, plus the single-entry route. */
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
* Where the reader gets its per-request memo box.
|
|
327
|
+
*
|
|
328
|
+
* Injected rather than reached for, so that "this reader needs a request to
|
|
329
|
+
* scope its cache to" is part of its contract and a test can supply a scope it
|
|
330
|
+
* controls — there is no TanStack request in jest.
|
|
331
|
+
*/
|
|
332
|
+
|
|
333
|
+
/**
|
|
334
|
+
* A per-request memo box, keyed on the `Request` itself.
|
|
335
|
+
*
|
|
336
|
+
* That is what makes this safe: TanStack resolves one `Request` object per
|
|
337
|
+
* in-flight request out of async local storage, so two visitors cannot collide,
|
|
338
|
+
* and a `WeakMap` lets the entry go when the request does. This is the TanStack
|
|
339
|
+
* half of the Next package's `cache()` — there is no RSC here, so React's
|
|
340
|
+
* request memoisation does not exist (see the note at the top of this file).
|
|
341
|
+
*
|
|
342
|
+
* Outside a request there is nothing to scope to and `getRequest` throws;
|
|
343
|
+
* `null` then means "compute every time", which is what this did before the
|
|
344
|
+
* memo existed. See `memoizePerRequest`.
|
|
345
|
+
*
|
|
346
|
+
* Built PER `initValContent` rather than once for the module, because the box
|
|
347
|
+
* is only as specific as the map it came from: two Val servers in one process
|
|
348
|
+
* sharing one would answer each other's reads within a request, and they hold
|
|
349
|
+
* different content.
|
|
350
|
+
*/
|
|
351
|
+
function createTanStackRequestScope() {
|
|
352
|
+
var boxes = new WeakMap();
|
|
353
|
+
return /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
354
|
+
var request, _yield$import, getRequest, existing, box;
|
|
355
|
+
return _regenerator().w(function (_context) {
|
|
356
|
+
while (1) switch (_context.p = _context.n) {
|
|
357
|
+
case 0:
|
|
358
|
+
_context.p = 0;
|
|
359
|
+
_context.n = 1;
|
|
360
|
+
return import('@tanstack/react-start/server');
|
|
361
|
+
case 1:
|
|
362
|
+
_yield$import = _context.v;
|
|
363
|
+
getRequest = _yield$import.getRequest;
|
|
364
|
+
request = getRequest();
|
|
365
|
+
_context.n = 3;
|
|
366
|
+
break;
|
|
367
|
+
case 2:
|
|
368
|
+
_context.p = 2;
|
|
369
|
+
_context.v;
|
|
370
|
+
return _context.a(2, null);
|
|
371
|
+
case 3:
|
|
372
|
+
existing = boxes.get(request);
|
|
373
|
+
if (!existing) {
|
|
374
|
+
_context.n = 4;
|
|
375
|
+
break;
|
|
376
|
+
}
|
|
377
|
+
return _context.a(2, existing);
|
|
378
|
+
case 4:
|
|
379
|
+
box = {};
|
|
380
|
+
boxes.set(request, box);
|
|
381
|
+
return _context.a(2, box);
|
|
382
|
+
}
|
|
383
|
+
}, _callee, null, [[0, 2]]);
|
|
384
|
+
}));
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
/**
|
|
388
|
+
* ONE read of the whole module tree, for the session in `sessionCookie`.
|
|
389
|
+
*
|
|
390
|
+
* `path` stays `"/"` on purpose, and the measurement is why. `/sources/~`
|
|
391
|
+
* evaluates, previews and validates EVERY module and only THEN filters the
|
|
392
|
+
* response by `req.path` (the two TODOs in `ValServer.ts` say so), so narrowing
|
|
393
|
+
* the path shrinks the answer and changes the work not at all: on a 60-module
|
|
394
|
+
* project, `path: "/"` took 53.6ms and a single-module path 53.5ms. And this is
|
|
395
|
+
* an in-process call rather than a round trip, so the object it builds is never
|
|
396
|
+
* serialised or sent anywhere — the bytes it saves are not bytes anyone pays
|
|
397
|
+
* for. Narrowing would also give each caller a different answer to cache, which
|
|
398
|
+
* is what would cost the saving that IS real (2.7x on the same project).
|
|
399
|
+
*
|
|
400
|
+
* `draftRead.perf.test.ts` prints both numbers; re-run it before believing
|
|
401
|
+
* anything different.
|
|
402
|
+
*
|
|
403
|
+
* Returns `null` when the session is not one the server accepts; the caller
|
|
404
|
+
* then renders published content, which is what it did before.
|
|
405
|
+
*/
|
|
406
|
+
function loadDraftSources(_x, _x2) {
|
|
407
|
+
return _loadDraftSources.apply(this, arguments);
|
|
408
|
+
}
|
|
409
|
+
function _loadDraftSources() {
|
|
410
|
+
_loadDraftSources = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(valServerPromise, sessionCookie) {
|
|
411
|
+
var valServer, treeRes;
|
|
412
|
+
return _regenerator().w(function (_context6) {
|
|
413
|
+
while (1) switch (_context6.n) {
|
|
414
|
+
case 0:
|
|
415
|
+
_context6.n = 1;
|
|
416
|
+
return valServerPromise;
|
|
417
|
+
case 1:
|
|
418
|
+
valServer = _context6.v;
|
|
419
|
+
_context6.n = 2;
|
|
420
|
+
return valServer["/sources/~"]["PUT"]({
|
|
421
|
+
path: "/",
|
|
422
|
+
query: {
|
|
423
|
+
validate_sources: true,
|
|
424
|
+
validate_binary_files: false,
|
|
425
|
+
exclude_patches: false,
|
|
426
|
+
// The server-side read uses the legacy "server applies patches"
|
|
427
|
+
// path, same as the Next package's.
|
|
428
|
+
apply_patches: undefined,
|
|
429
|
+
/*
|
|
430
|
+
* The caller's own staged work, and nobody else's.
|
|
431
|
+
*
|
|
432
|
+
* A draft render cannot name its group ids — it has no client
|
|
433
|
+
* state — so it asks for "mine" and the server resolves them from
|
|
434
|
+
* the session. Without this a preview shows base + every pending
|
|
435
|
+
* patch on the branch, so one person's half-finished edit appears
|
|
436
|
+
* in another person's draft.
|
|
437
|
+
*
|
|
438
|
+
* `patch_id` stays `undefined`: naming an explicit list is for a
|
|
439
|
+
* caller that already knows what it wants, and it would override
|
|
440
|
+
* the resolution rather than intersect with it.
|
|
441
|
+
*/
|
|
442
|
+
patch_id: undefined,
|
|
443
|
+
own_patch_groups_only: true
|
|
444
|
+
},
|
|
445
|
+
cookies: _defineProperty({}, VAL_SESSION_COOKIE, sessionCookie)
|
|
446
|
+
});
|
|
447
|
+
case 2:
|
|
448
|
+
treeRes = _context6.v;
|
|
449
|
+
if (!(treeRes.status === 200)) {
|
|
450
|
+
_context6.n = 3;
|
|
451
|
+
break;
|
|
452
|
+
}
|
|
453
|
+
return _context6.a(2, treeRes.json.modules);
|
|
454
|
+
case 3:
|
|
455
|
+
if (!(treeRes.status === 401)) {
|
|
456
|
+
_context6.n = 4;
|
|
457
|
+
break;
|
|
458
|
+
}
|
|
459
|
+
console.warn("Val: authentication error: ", treeRes.json.message);
|
|
460
|
+
return _context6.a(2, null);
|
|
461
|
+
case 4:
|
|
462
|
+
throw Error(JSON.stringify(treeRes.json, null, 2));
|
|
463
|
+
case 5:
|
|
464
|
+
return _context6.a(2);
|
|
465
|
+
}
|
|
466
|
+
}, _callee6);
|
|
467
|
+
}));
|
|
468
|
+
return _loadDraftSources.apply(this, arguments);
|
|
469
|
+
}
|
|
470
|
+
var initFetchValStega = function initFetchValStega(config, valApiEndpoints, valServerPromise, isEnabled, getHeaders, getCookies, getDraftSourcesScope) {
|
|
308
471
|
return function (selector) {
|
|
309
472
|
var exec = /*#__PURE__*/function () {
|
|
310
|
-
var
|
|
311
|
-
var enabled, headers, cookies, host, _cookies,
|
|
312
|
-
return _regenerator().w(function (
|
|
313
|
-
while (1) switch (
|
|
473
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
|
|
474
|
+
var enabled, headers, cookies, host, _cookies, sessionCookie, modules, _t2, _t3, _t4, _t5;
|
|
475
|
+
return _regenerator().w(function (_context2) {
|
|
476
|
+
while (1) switch (_context2.p = _context2.n) {
|
|
314
477
|
case 0:
|
|
315
478
|
enabled = false;
|
|
316
|
-
|
|
317
|
-
|
|
479
|
+
_context2.p = 1;
|
|
480
|
+
_context2.n = 2;
|
|
318
481
|
return isEnabled();
|
|
319
482
|
case 2:
|
|
320
|
-
enabled =
|
|
321
|
-
|
|
483
|
+
enabled = _context2.v;
|
|
484
|
+
_context2.n = 4;
|
|
322
485
|
break;
|
|
323
486
|
case 3:
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
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.",
|
|
487
|
+
_context2.p = 3;
|
|
488
|
+
_t2 = _context2.v;
|
|
489
|
+
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);
|
|
327
490
|
case 4:
|
|
328
491
|
if (!enabled) {
|
|
329
|
-
|
|
492
|
+
_context2.n = 15;
|
|
330
493
|
break;
|
|
331
494
|
}
|
|
332
495
|
SET_AUTO_TAG_JSX_ENABLED(true);
|
|
333
|
-
|
|
334
|
-
|
|
496
|
+
_context2.p = 5;
|
|
497
|
+
_context2.n = 6;
|
|
335
498
|
return getHeaders();
|
|
336
499
|
case 6:
|
|
337
|
-
headers =
|
|
500
|
+
headers = _context2.v;
|
|
338
501
|
if (!(typeof headers.get !== "function")) {
|
|
339
|
-
|
|
502
|
+
_context2.n = 7;
|
|
340
503
|
break;
|
|
341
504
|
}
|
|
342
505
|
throw new Error("Invalid headers");
|
|
343
506
|
case 7:
|
|
344
|
-
|
|
507
|
+
_context2.n = 9;
|
|
345
508
|
break;
|
|
346
509
|
case 8:
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
console.error("Val: could not read headers! fetchVal can only be used server-side (in a loader, a server function, or a server route). Use useVal in components.",
|
|
510
|
+
_context2.p = 8;
|
|
511
|
+
_t3 = _context2.v;
|
|
512
|
+
console.error("Val: could not read headers! fetchVal can only be used server-side (in a loader, a server function, or a server route). Use useVal in components.", _t3);
|
|
350
513
|
headers = null;
|
|
351
514
|
case 9:
|
|
352
|
-
|
|
353
|
-
|
|
515
|
+
_context2.p = 9;
|
|
516
|
+
_context2.n = 10;
|
|
354
517
|
return getCookies();
|
|
355
518
|
case 10:
|
|
356
|
-
cookies =
|
|
357
|
-
|
|
519
|
+
cookies = _context2.v;
|
|
520
|
+
_context2.n = 12;
|
|
358
521
|
break;
|
|
359
522
|
case 11:
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
console.error("Val: could not read cookies! fetchVal can only be used server-side (in a loader, a server function, or a server route). Use useVal in components.",
|
|
523
|
+
_context2.p = 11;
|
|
524
|
+
_t4 = _context2.v;
|
|
525
|
+
console.error("Val: could not read cookies! fetchVal can only be used server-side (in a loader, a server function, or a server route). Use useVal in components.", _t4);
|
|
363
526
|
cookies = null;
|
|
364
527
|
case 12:
|
|
365
528
|
host = headers && getHost(headers);
|
|
366
529
|
if (!(host && cookies)) {
|
|
367
|
-
|
|
530
|
+
_context2.n = 15;
|
|
368
531
|
break;
|
|
369
532
|
}
|
|
370
|
-
|
|
371
|
-
|
|
533
|
+
sessionCookie = (_cookies = cookies) === null || _cookies === void 0 || (_cookies = _cookies.get(VAL_SESSION_COOKIE)) === null || _cookies === void 0 ? void 0 : _cookies.value;
|
|
534
|
+
/*
|
|
535
|
+
* Once per request, however many times the page reads.
|
|
536
|
+
*
|
|
537
|
+
* Every `fetchVal` in one request asks the same question — same
|
|
538
|
+
* query, same session — so the second and third answer were identical
|
|
539
|
+
* and cost the same as the first. `fetchValRouteUrl` made that worse
|
|
540
|
+
* by calling `fetchVal` again on top of the caller's own.
|
|
541
|
+
*
|
|
542
|
+
* The key is the session, so a box that somehow outlived its request
|
|
543
|
+
* misses rather than serving another author's draft. See
|
|
544
|
+
* `memoizePerRequest`.
|
|
545
|
+
*/
|
|
546
|
+
_t5 = memoizePerRequest;
|
|
547
|
+
_context2.n = 13;
|
|
548
|
+
return getDraftSourcesScope();
|
|
372
549
|
case 13:
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
path: "/",
|
|
377
|
-
query: {
|
|
378
|
-
validate_sources: true,
|
|
379
|
-
validate_binary_files: false,
|
|
380
|
-
exclude_patches: false,
|
|
381
|
-
// The server-side read uses the legacy "server applies patches"
|
|
382
|
-
// path, same as the Next package's.
|
|
383
|
-
apply_patches: undefined,
|
|
384
|
-
/*
|
|
385
|
-
* The caller's own staged work, and nobody else's.
|
|
386
|
-
*
|
|
387
|
-
* A draft render cannot name its group ids — it has no client
|
|
388
|
-
* state — so it asks for "mine" and the server resolves them from
|
|
389
|
-
* the session. Without this a preview shows base + every pending
|
|
390
|
-
* patch on the branch, so one person's half-finished edit appears
|
|
391
|
-
* in another person's draft.
|
|
392
|
-
*
|
|
393
|
-
* `patch_id` stays `undefined`: naming an explicit list is for a
|
|
394
|
-
* caller that already knows what it wants, and it would override
|
|
395
|
-
* the resolution rather than intersect with it.
|
|
396
|
-
*/
|
|
397
|
-
patch_id: undefined,
|
|
398
|
-
own_patch_groups_only: true
|
|
399
|
-
},
|
|
400
|
-
cookies: _defineProperty({}, VAL_SESSION_COOKIE, (_cookies = cookies) === null || _cookies === void 0 || (_cookies = _cookies.get(VAL_SESSION_COOKIE)) === null || _cookies === void 0 ? void 0 : _cookies.value)
|
|
550
|
+
_context2.n = 14;
|
|
551
|
+
return _t5(_context2.v, sessionCookie !== null && sessionCookie !== void 0 ? sessionCookie : "", function () {
|
|
552
|
+
return loadDraftSources(valServerPromise, sessionCookie);
|
|
401
553
|
});
|
|
402
554
|
case 14:
|
|
403
|
-
|
|
404
|
-
if (!
|
|
405
|
-
|
|
555
|
+
modules = _context2.v;
|
|
556
|
+
if (!modules) {
|
|
557
|
+
_context2.n = 15;
|
|
406
558
|
break;
|
|
407
559
|
}
|
|
408
|
-
|
|
409
|
-
return _context.a(2, stegaEncode(selector, {
|
|
560
|
+
return _context2.a(2, stegaEncode(selector, {
|
|
410
561
|
disabled: !enabled,
|
|
411
562
|
getModule: function getModule(path) {
|
|
412
563
|
var module = modules[path];
|
|
@@ -416,24 +567,14 @@ var initFetchValStega = function initFetchValStega(config, valApiEndpoints, valS
|
|
|
416
567
|
}
|
|
417
568
|
}));
|
|
418
569
|
case 15:
|
|
419
|
-
|
|
420
|
-
_context.n = 16;
|
|
421
|
-
break;
|
|
422
|
-
}
|
|
423
|
-
console.warn("Val: authentication error: ", treeRes.json.message);
|
|
424
|
-
_context.n = 17;
|
|
425
|
-
break;
|
|
426
|
-
case 16:
|
|
427
|
-
throw Error(JSON.stringify(treeRes.json, null, 2));
|
|
428
|
-
case 17:
|
|
429
|
-
return _context.a(2, stegaEncode(selector, {
|
|
570
|
+
return _context2.a(2, stegaEncode(selector, {
|
|
430
571
|
disabled: !enabled
|
|
431
572
|
}));
|
|
432
573
|
}
|
|
433
|
-
},
|
|
574
|
+
}, _callee2, null, [[9, 11], [5, 8], [1, 3]]);
|
|
434
575
|
}));
|
|
435
576
|
return function exec() {
|
|
436
|
-
return
|
|
577
|
+
return _ref2.apply(this, arguments);
|
|
437
578
|
};
|
|
438
579
|
}();
|
|
439
580
|
return exec()["catch"](function (err) {
|
|
@@ -482,17 +623,17 @@ function getHost(headers) {
|
|
|
482
623
|
// }
|
|
483
624
|
// }
|
|
484
625
|
|
|
485
|
-
var initFetchValRouteStega = function initFetchValRouteStega(config, valApiEndpoints, valServerPromise, isEnabled, getHeaders, getCookies) {
|
|
626
|
+
var initFetchValRouteStega = function initFetchValRouteStega(config, valApiEndpoints, valServerPromise, isEnabled, getHeaders, getCookies, getDraftSourcesScope) {
|
|
486
627
|
return /*#__PURE__*/function () {
|
|
487
|
-
var
|
|
488
|
-
var resolvedParams, valModule, path, schema, source, url, enabled, draft, content, fetchVal, val, route,
|
|
489
|
-
return _regenerator().w(function (
|
|
490
|
-
while (1) switch (
|
|
628
|
+
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(selector, params) {
|
|
629
|
+
var resolvedParams, valModule, path, schema, source, url, enabled, draft, content, fetchVal, val, route, _t7;
|
|
630
|
+
return _regenerator().w(function (_context3) {
|
|
631
|
+
while (1) switch (_context3.p = _context3.n) {
|
|
491
632
|
case 0:
|
|
492
|
-
|
|
633
|
+
_context3.n = 1;
|
|
493
634
|
return Promise.resolve(params);
|
|
494
635
|
case 1:
|
|
495
|
-
resolvedParams =
|
|
636
|
+
resolvedParams = _context3.v;
|
|
496
637
|
// A view is a pointer: everything below reads a path, a schema and a source
|
|
497
638
|
// off this, and a pointer has none of them. See `resolveViewedModule`.
|
|
498
639
|
valModule = Internal.resolveViewedModule(selector);
|
|
@@ -501,78 +642,78 @@ var initFetchValRouteStega = function initFetchValRouteStega(config, valApiEndpo
|
|
|
501
642
|
// entry's backing `*.val.json`, instead of eagerly resolving the whole
|
|
502
643
|
// record via `fetchVal`.
|
|
503
644
|
if (!isJsonValuesRecordSchema(schema)) {
|
|
504
|
-
|
|
645
|
+
_context3.n = 11;
|
|
505
646
|
break;
|
|
506
647
|
}
|
|
507
648
|
source = valModule && Internal.getSource(valModule);
|
|
508
649
|
url = getValRouteUrlFromVal(resolvedParams, "fetchValRoute", path, schema, source);
|
|
509
650
|
if (url) {
|
|
510
|
-
|
|
651
|
+
_context3.n = 2;
|
|
511
652
|
break;
|
|
512
653
|
}
|
|
513
|
-
return
|
|
654
|
+
return _context3.a(2, null);
|
|
514
655
|
case 2:
|
|
515
656
|
enabled = false;
|
|
516
|
-
|
|
517
|
-
|
|
657
|
+
_context3.p = 3;
|
|
658
|
+
_context3.n = 4;
|
|
518
659
|
return isEnabled();
|
|
519
660
|
case 4:
|
|
520
|
-
enabled =
|
|
521
|
-
|
|
661
|
+
enabled = _context3.v;
|
|
662
|
+
_context3.n = 6;
|
|
522
663
|
break;
|
|
523
664
|
case 5:
|
|
524
|
-
|
|
525
|
-
|
|
665
|
+
_context3.p = 5;
|
|
666
|
+
_context3.v;
|
|
526
667
|
case 6:
|
|
527
668
|
draft = {
|
|
528
669
|
status: "unavailable"
|
|
529
670
|
};
|
|
530
671
|
if (!(enabled && path)) {
|
|
531
|
-
|
|
672
|
+
_context3.n = 8;
|
|
532
673
|
break;
|
|
533
674
|
}
|
|
534
675
|
SET_AUTO_TAG_JSX_ENABLED(true);
|
|
535
|
-
|
|
676
|
+
_context3.n = 7;
|
|
536
677
|
return loadDraftJsonEntry(valServerPromise, getCookies, path, url);
|
|
537
678
|
case 7:
|
|
538
|
-
draft =
|
|
679
|
+
draft = _context3.v;
|
|
539
680
|
case 8:
|
|
540
|
-
|
|
681
|
+
_context3.n = 9;
|
|
541
682
|
return resolveDraftOrCommittedEntry(draft, function () {
|
|
542
683
|
return loadJsonEntryContent(source, url);
|
|
543
684
|
});
|
|
544
685
|
case 9:
|
|
545
|
-
content =
|
|
686
|
+
content = _context3.v;
|
|
546
687
|
if (!(content === undefined)) {
|
|
547
|
-
|
|
688
|
+
_context3.n = 10;
|
|
548
689
|
break;
|
|
549
690
|
}
|
|
550
|
-
return
|
|
691
|
+
return _context3.a(2, null);
|
|
551
692
|
case 10:
|
|
552
|
-
return
|
|
693
|
+
return _context3.a(2, stegaEncode(content, {
|
|
553
694
|
disabled: !enabled,
|
|
554
695
|
root: getJsonEntryStegaRoot(valModule, url)
|
|
555
696
|
}));
|
|
556
697
|
case 11:
|
|
557
|
-
fetchVal = initFetchValStega(config, valApiEndpoints, valServerPromise, isEnabled, getHeaders, getCookies);
|
|
558
|
-
|
|
559
|
-
if (!
|
|
560
|
-
|
|
698
|
+
fetchVal = initFetchValStega(config, valApiEndpoints, valServerPromise, isEnabled, getHeaders, getCookies, getDraftSourcesScope);
|
|
699
|
+
_t7 = valModule;
|
|
700
|
+
if (!_t7) {
|
|
701
|
+
_context3.n = 13;
|
|
561
702
|
break;
|
|
562
703
|
}
|
|
563
|
-
|
|
704
|
+
_context3.n = 12;
|
|
564
705
|
return fetchVal(valModule);
|
|
565
706
|
case 12:
|
|
566
|
-
|
|
707
|
+
_t7 = _context3.v;
|
|
567
708
|
case 13:
|
|
568
|
-
val =
|
|
709
|
+
val = _t7;
|
|
569
710
|
route = initValRouteFromVal(resolvedParams, "fetchValRoute", path, schema, val);
|
|
570
|
-
return
|
|
711
|
+
return _context3.a(2, route);
|
|
571
712
|
}
|
|
572
|
-
},
|
|
713
|
+
}, _callee3, null, [[3, 5]]);
|
|
573
714
|
}));
|
|
574
|
-
return function (
|
|
575
|
-
return
|
|
715
|
+
return function (_x3, _x4) {
|
|
716
|
+
return _ref3.apply(this, arguments);
|
|
576
717
|
};
|
|
577
718
|
}();
|
|
578
719
|
};
|
|
@@ -582,7 +723,7 @@ var initFetchValRouteStega = function initFetchValRouteStega(config, valApiEndpo
|
|
|
582
723
|
* source markers (one dynamic import). Returns `undefined` when the key is
|
|
583
724
|
* missing or its marker has no runtime thunk (transport marker / draft entry).
|
|
584
725
|
*/
|
|
585
|
-
function loadJsonEntryContent(
|
|
726
|
+
function loadJsonEntryContent(_x5, _x6) {
|
|
586
727
|
return _loadJsonEntryContent.apply(this, arguments);
|
|
587
728
|
}
|
|
588
729
|
/**
|
|
@@ -607,37 +748,37 @@ function loadJsonEntryContent(_x3, _x4) {
|
|
|
607
748
|
* to the whole server type.
|
|
608
749
|
*/
|
|
609
750
|
function _loadJsonEntryContent() {
|
|
610
|
-
_loadJsonEntryContent = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
751
|
+
_loadJsonEntryContent = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(source, key) {
|
|
611
752
|
var marker, thunk;
|
|
612
|
-
return _regenerator().w(function (
|
|
613
|
-
while (1) switch (
|
|
753
|
+
return _regenerator().w(function (_context7) {
|
|
754
|
+
while (1) switch (_context7.n) {
|
|
614
755
|
case 0:
|
|
615
756
|
if (!(!source || _typeof(source) !== "object")) {
|
|
616
|
-
|
|
757
|
+
_context7.n = 1;
|
|
617
758
|
break;
|
|
618
759
|
}
|
|
619
|
-
return
|
|
760
|
+
return _context7.a(2, undefined);
|
|
620
761
|
case 1:
|
|
621
762
|
marker = source[key];
|
|
622
763
|
if (Internal.isJson(marker)) {
|
|
623
|
-
|
|
764
|
+
_context7.n = 2;
|
|
624
765
|
break;
|
|
625
766
|
}
|
|
626
|
-
return
|
|
767
|
+
return _context7.a(2, undefined);
|
|
627
768
|
case 2:
|
|
628
769
|
thunk = Internal.getJsonImport(marker);
|
|
629
770
|
if (thunk) {
|
|
630
|
-
|
|
771
|
+
_context7.n = 3;
|
|
631
772
|
break;
|
|
632
773
|
}
|
|
633
|
-
return
|
|
774
|
+
return _context7.a(2, undefined);
|
|
634
775
|
case 3:
|
|
635
|
-
|
|
776
|
+
_context7.n = 4;
|
|
636
777
|
return thunk();
|
|
637
778
|
case 4:
|
|
638
|
-
return
|
|
779
|
+
return _context7.a(2, _context7.v["default"]);
|
|
639
780
|
}
|
|
640
|
-
},
|
|
781
|
+
}, _callee7);
|
|
641
782
|
}));
|
|
642
783
|
return _loadJsonEntryContent.apply(this, arguments);
|
|
643
784
|
}
|
|
@@ -650,33 +791,33 @@ function _loadJsonEntryContent() {
|
|
|
650
791
|
* ask). Returning `undefined` means "render nothing"; both callers turn that into
|
|
651
792
|
* a null/undefined result.
|
|
652
793
|
*/
|
|
653
|
-
function resolveDraftOrCommittedEntry(
|
|
794
|
+
function resolveDraftOrCommittedEntry(_x7, _x8) {
|
|
654
795
|
return _resolveDraftOrCommittedEntry.apply(this, arguments);
|
|
655
796
|
}
|
|
656
797
|
function _resolveDraftOrCommittedEntry() {
|
|
657
|
-
_resolveDraftOrCommittedEntry = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
658
|
-
return _regenerator().w(function (
|
|
659
|
-
while (1) switch (
|
|
798
|
+
_resolveDraftOrCommittedEntry = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(draft, loadCommitted) {
|
|
799
|
+
return _regenerator().w(function (_context8) {
|
|
800
|
+
while (1) switch (_context8.n) {
|
|
660
801
|
case 0:
|
|
661
802
|
if (!(draft.status === "content")) {
|
|
662
|
-
|
|
803
|
+
_context8.n = 1;
|
|
663
804
|
break;
|
|
664
805
|
}
|
|
665
|
-
return
|
|
806
|
+
return _context8.a(2, draft.content);
|
|
666
807
|
case 1:
|
|
667
808
|
if (!(draft.status === "absent")) {
|
|
668
|
-
|
|
809
|
+
_context8.n = 2;
|
|
669
810
|
break;
|
|
670
811
|
}
|
|
671
|
-
return
|
|
812
|
+
return _context8.a(2, undefined);
|
|
672
813
|
case 2:
|
|
673
|
-
return
|
|
814
|
+
return _context8.a(2, loadCommitted());
|
|
674
815
|
}
|
|
675
|
-
},
|
|
816
|
+
}, _callee8);
|
|
676
817
|
}));
|
|
677
818
|
return _resolveDraftOrCommittedEntry.apply(this, arguments);
|
|
678
819
|
}
|
|
679
|
-
function loadDraftJsonEntry(
|
|
820
|
+
function loadDraftJsonEntry(_x9, _x0, _x1, _x10) {
|
|
680
821
|
return _loadDraftJsonEntry.apply(this, arguments);
|
|
681
822
|
}
|
|
682
823
|
/**
|
|
@@ -691,31 +832,31 @@ function loadDraftJsonEntry(_x7, _x8, _x9, _x0) {
|
|
|
691
832
|
* the draft read yields nothing.
|
|
692
833
|
*/
|
|
693
834
|
function _loadDraftJsonEntry() {
|
|
694
|
-
_loadDraftJsonEntry = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
835
|
+
_loadDraftJsonEntry = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(valServerPromise, getCookies, moduleFilePath, key) {
|
|
695
836
|
var _cookies3;
|
|
696
837
|
var cookies, valServer, res;
|
|
697
|
-
return _regenerator().w(function (
|
|
698
|
-
while (1) switch (
|
|
838
|
+
return _regenerator().w(function (_context9) {
|
|
839
|
+
while (1) switch (_context9.p = _context9.n) {
|
|
699
840
|
case 0:
|
|
700
|
-
|
|
701
|
-
|
|
841
|
+
_context9.p = 0;
|
|
842
|
+
_context9.n = 1;
|
|
702
843
|
return getCookies();
|
|
703
844
|
case 1:
|
|
704
|
-
cookies =
|
|
705
|
-
|
|
845
|
+
cookies = _context9.v;
|
|
846
|
+
_context9.n = 3;
|
|
706
847
|
break;
|
|
707
848
|
case 2:
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
return
|
|
849
|
+
_context9.p = 2;
|
|
850
|
+
_context9.v;
|
|
851
|
+
return _context9.a(2, {
|
|
711
852
|
status: "unavailable"
|
|
712
853
|
});
|
|
713
854
|
case 3:
|
|
714
|
-
|
|
855
|
+
_context9.n = 4;
|
|
715
856
|
return valServerPromise;
|
|
716
857
|
case 4:
|
|
717
|
-
valServer =
|
|
718
|
-
|
|
858
|
+
valServer = _context9.v;
|
|
859
|
+
_context9.n = 5;
|
|
719
860
|
return valServer["/json"]["GET"]({
|
|
720
861
|
query: {
|
|
721
862
|
path: moduleFilePath,
|
|
@@ -738,60 +879,60 @@ function _loadDraftJsonEntry() {
|
|
|
738
879
|
cookies: _defineProperty({}, VAL_SESSION_COOKIE, (_cookies3 = cookies) === null || _cookies3 === void 0 || (_cookies3 = _cookies3.get(VAL_SESSION_COOKIE)) === null || _cookies3 === void 0 ? void 0 : _cookies3.value)
|
|
739
880
|
});
|
|
740
881
|
case 5:
|
|
741
|
-
res =
|
|
882
|
+
res = _context9.v;
|
|
742
883
|
if (!(res.status === 200 && "content" in res.json)) {
|
|
743
|
-
|
|
884
|
+
_context9.n = 6;
|
|
744
885
|
break;
|
|
745
886
|
}
|
|
746
|
-
return
|
|
887
|
+
return _context9.a(2, {
|
|
747
888
|
status: "content",
|
|
748
889
|
content: res.json.content
|
|
749
890
|
});
|
|
750
891
|
case 6:
|
|
751
892
|
if (!(res.status === 401)) {
|
|
752
|
-
|
|
893
|
+
_context9.n = 7;
|
|
753
894
|
break;
|
|
754
895
|
}
|
|
755
896
|
console.warn("Val: authentication error: ", res.json.message);
|
|
756
|
-
return
|
|
897
|
+
return _context9.a(2, {
|
|
757
898
|
status: "unavailable"
|
|
758
899
|
});
|
|
759
900
|
case 7:
|
|
760
901
|
if (!(res.status === 404)) {
|
|
761
|
-
|
|
902
|
+
_context9.n = 8;
|
|
762
903
|
break;
|
|
763
904
|
}
|
|
764
|
-
return
|
|
905
|
+
return _context9.a(2, {
|
|
765
906
|
status: "absent"
|
|
766
907
|
});
|
|
767
908
|
case 8:
|
|
768
909
|
console.error("Val: could not load draft JSON entry: ", "message" in res.json ? res.json.message : "status ".concat(res.status));
|
|
769
|
-
return
|
|
910
|
+
return _context9.a(2, {
|
|
770
911
|
status: "unavailable"
|
|
771
912
|
});
|
|
772
913
|
}
|
|
773
|
-
},
|
|
914
|
+
}, _callee9, null, [[0, 2]]);
|
|
774
915
|
}));
|
|
775
916
|
return _loadDraftJsonEntry.apply(this, arguments);
|
|
776
917
|
}
|
|
777
918
|
var initFetchValKeyStega = function initFetchValKeyStega(valServerPromise, isEnabled, getCookies) {
|
|
778
919
|
return /*#__PURE__*/function () {
|
|
779
|
-
var
|
|
920
|
+
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(selector, key) {
|
|
780
921
|
var enabled, valModule, source, moduleFilePath, draft, content;
|
|
781
|
-
return _regenerator().w(function (
|
|
782
|
-
while (1) switch (
|
|
922
|
+
return _regenerator().w(function (_context4) {
|
|
923
|
+
while (1) switch (_context4.p = _context4.n) {
|
|
783
924
|
case 0:
|
|
784
925
|
enabled = false;
|
|
785
|
-
|
|
786
|
-
|
|
926
|
+
_context4.p = 1;
|
|
927
|
+
_context4.n = 2;
|
|
787
928
|
return isEnabled();
|
|
788
929
|
case 2:
|
|
789
|
-
enabled =
|
|
790
|
-
|
|
930
|
+
enabled = _context4.v;
|
|
931
|
+
_context4.n = 4;
|
|
791
932
|
break;
|
|
792
933
|
case 3:
|
|
793
|
-
|
|
794
|
-
|
|
934
|
+
_context4.p = 3;
|
|
935
|
+
_context4.v;
|
|
795
936
|
case 4:
|
|
796
937
|
// A view is a pointer: everything below reads a path and a source off this,
|
|
797
938
|
// and a pointer has neither. See `resolveViewedModule`.
|
|
@@ -802,84 +943,84 @@ var initFetchValKeyStega = function initFetchValKeyStega(valServerPromise, isEna
|
|
|
802
943
|
status: "unavailable"
|
|
803
944
|
};
|
|
804
945
|
if (!(enabled && moduleFilePath)) {
|
|
805
|
-
|
|
946
|
+
_context4.n = 6;
|
|
806
947
|
break;
|
|
807
948
|
}
|
|
808
949
|
SET_AUTO_TAG_JSX_ENABLED(true);
|
|
809
|
-
|
|
950
|
+
_context4.n = 5;
|
|
810
951
|
return loadDraftJsonEntry(valServerPromise, getCookies, moduleFilePath, key);
|
|
811
952
|
case 5:
|
|
812
|
-
draft =
|
|
953
|
+
draft = _context4.v;
|
|
813
954
|
case 6:
|
|
814
|
-
|
|
955
|
+
_context4.n = 7;
|
|
815
956
|
return resolveDraftOrCommittedEntry(draft, function () {
|
|
816
957
|
return loadJsonEntryContent(source, key);
|
|
817
958
|
});
|
|
818
959
|
case 7:
|
|
819
|
-
content =
|
|
960
|
+
content = _context4.v;
|
|
820
961
|
if (!(content === undefined)) {
|
|
821
|
-
|
|
962
|
+
_context4.n = 8;
|
|
822
963
|
break;
|
|
823
964
|
}
|
|
824
|
-
return
|
|
965
|
+
return _context4.a(2, undefined);
|
|
825
966
|
case 8:
|
|
826
|
-
return
|
|
967
|
+
return _context4.a(2, stegaEncode(content, {
|
|
827
968
|
disabled: !enabled,
|
|
828
969
|
root: getJsonEntryStegaRoot(valModule, key)
|
|
829
970
|
}));
|
|
830
971
|
}
|
|
831
|
-
},
|
|
972
|
+
}, _callee4, null, [[1, 3]]);
|
|
832
973
|
}));
|
|
833
|
-
return function (
|
|
834
|
-
return
|
|
974
|
+
return function (_x11, _x12) {
|
|
975
|
+
return _ref4.apply(this, arguments);
|
|
835
976
|
};
|
|
836
977
|
}();
|
|
837
978
|
};
|
|
838
|
-
var initFetchValRouteUrl = function initFetchValRouteUrl(config, valApiEndpoints, valServerPromise, isEnabled, getHeaders, getCookies) {
|
|
979
|
+
var initFetchValRouteUrl = function initFetchValRouteUrl(config, valApiEndpoints, valServerPromise, isEnabled, getHeaders, getCookies, getDraftSourcesScope) {
|
|
839
980
|
return /*#__PURE__*/function () {
|
|
840
|
-
var
|
|
841
|
-
var fetchVal, resolvedParams, valModule, path, schema, val, route,
|
|
842
|
-
return _regenerator().w(function (
|
|
843
|
-
while (1) switch (
|
|
981
|
+
var _ref5 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(selector, params) {
|
|
982
|
+
var fetchVal, resolvedParams, valModule, path, schema, val, route, _t9, _t0;
|
|
983
|
+
return _regenerator().w(function (_context5) {
|
|
984
|
+
while (1) switch (_context5.n) {
|
|
844
985
|
case 0:
|
|
845
|
-
fetchVal = initFetchValStega(config, valApiEndpoints, valServerPromise, isEnabled, getHeaders, getCookies);
|
|
986
|
+
fetchVal = initFetchValStega(config, valApiEndpoints, valServerPromise, isEnabled, getHeaders, getCookies, getDraftSourcesScope);
|
|
846
987
|
if (!(params === undefined)) {
|
|
847
|
-
|
|
988
|
+
_context5.n = 1;
|
|
848
989
|
break;
|
|
849
990
|
}
|
|
850
|
-
|
|
851
|
-
|
|
991
|
+
_t9 = undefined;
|
|
992
|
+
_context5.n = 3;
|
|
852
993
|
break;
|
|
853
994
|
case 1:
|
|
854
|
-
|
|
995
|
+
_context5.n = 2;
|
|
855
996
|
return Promise.resolve(params);
|
|
856
997
|
case 2:
|
|
857
|
-
|
|
998
|
+
_t9 = _context5.v;
|
|
858
999
|
case 3:
|
|
859
|
-
resolvedParams =
|
|
1000
|
+
resolvedParams = _t9;
|
|
860
1001
|
// A view is a pointer: everything below reads a path, a schema and a source
|
|
861
1002
|
// off this, and a pointer has none of them. See `resolveViewedModule`.
|
|
862
1003
|
valModule = Internal.resolveViewedModule(selector);
|
|
863
1004
|
path = valModule && Internal.getValPath(valModule);
|
|
864
1005
|
schema = valModule && Internal.getSchema(valModule);
|
|
865
|
-
|
|
866
|
-
if (!
|
|
867
|
-
|
|
1006
|
+
_t0 = valModule;
|
|
1007
|
+
if (!_t0) {
|
|
1008
|
+
_context5.n = 5;
|
|
868
1009
|
break;
|
|
869
1010
|
}
|
|
870
|
-
|
|
1011
|
+
_context5.n = 4;
|
|
871
1012
|
return fetchVal(valModule);
|
|
872
1013
|
case 4:
|
|
873
|
-
|
|
1014
|
+
_t0 = _context5.v;
|
|
874
1015
|
case 5:
|
|
875
|
-
val =
|
|
1016
|
+
val = _t0;
|
|
876
1017
|
route = getValRouteUrlFromVal(resolvedParams, "fetchValRouteUrl", path, schema, val);
|
|
877
|
-
return
|
|
1018
|
+
return _context5.a(2, route);
|
|
878
1019
|
}
|
|
879
|
-
},
|
|
1020
|
+
}, _callee5);
|
|
880
1021
|
}));
|
|
881
|
-
return function (
|
|
882
|
-
return
|
|
1022
|
+
return function (_x13, _x14) {
|
|
1023
|
+
return _ref5.apply(this, arguments);
|
|
883
1024
|
};
|
|
884
1025
|
}();
|
|
885
1026
|
};
|
|
@@ -897,25 +1038,25 @@ function requestHeaders() {
|
|
|
897
1038
|
}
|
|
898
1039
|
/** The request's cookies, in the `{ name, value }` shape the readers want. */
|
|
899
1040
|
function _requestHeaders() {
|
|
900
|
-
_requestHeaders = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
901
|
-
var _yield$
|
|
902
|
-
return _regenerator().w(function (
|
|
903
|
-
while (1) switch (
|
|
1041
|
+
_requestHeaders = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0() {
|
|
1042
|
+
var _yield$import2, getRequestHeaders, headers;
|
|
1043
|
+
return _regenerator().w(function (_context0) {
|
|
1044
|
+
while (1) switch (_context0.n) {
|
|
904
1045
|
case 0:
|
|
905
|
-
|
|
1046
|
+
_context0.n = 1;
|
|
906
1047
|
return import('@tanstack/react-start/server');
|
|
907
1048
|
case 1:
|
|
908
|
-
_yield$
|
|
909
|
-
getRequestHeaders = _yield$
|
|
1049
|
+
_yield$import2 = _context0.v;
|
|
1050
|
+
getRequestHeaders = _yield$import2.getRequestHeaders;
|
|
910
1051
|
headers = getRequestHeaders();
|
|
911
|
-
return
|
|
1052
|
+
return _context0.a(2, {
|
|
912
1053
|
get: function get(name) {
|
|
913
1054
|
var _headers$get2;
|
|
914
1055
|
return (_headers$get2 = headers.get(name)) !== null && _headers$get2 !== void 0 ? _headers$get2 : null;
|
|
915
1056
|
}
|
|
916
1057
|
});
|
|
917
1058
|
}
|
|
918
|
-
},
|
|
1059
|
+
}, _callee0);
|
|
919
1060
|
}));
|
|
920
1061
|
return _requestHeaders.apply(this, arguments);
|
|
921
1062
|
}
|
|
@@ -943,17 +1084,17 @@ function requestCookies() {
|
|
|
943
1084
|
* } = initValContent(config, valModules);
|
|
944
1085
|
*/
|
|
945
1086
|
function _requestCookies() {
|
|
946
|
-
_requestCookies = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
947
|
-
var _yield$
|
|
948
|
-
return _regenerator().w(function (
|
|
949
|
-
while (1) switch (
|
|
1087
|
+
_requestCookies = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1() {
|
|
1088
|
+
var _yield$import3, getCookie;
|
|
1089
|
+
return _regenerator().w(function (_context1) {
|
|
1090
|
+
while (1) switch (_context1.n) {
|
|
950
1091
|
case 0:
|
|
951
|
-
|
|
1092
|
+
_context1.n = 1;
|
|
952
1093
|
return import('@tanstack/react-start/server');
|
|
953
1094
|
case 1:
|
|
954
|
-
_yield$
|
|
955
|
-
getCookie = _yield$
|
|
956
|
-
return
|
|
1095
|
+
_yield$import3 = _context1.v;
|
|
1096
|
+
getCookie = _yield$import3.getCookie;
|
|
1097
|
+
return _context1.a(2, {
|
|
957
1098
|
get: function get(name) {
|
|
958
1099
|
var value = getCookie(name);
|
|
959
1100
|
return value === undefined ? undefined : {
|
|
@@ -963,7 +1104,7 @@ function _requestCookies() {
|
|
|
963
1104
|
}
|
|
964
1105
|
});
|
|
965
1106
|
}
|
|
966
|
-
},
|
|
1107
|
+
}, _callee1);
|
|
967
1108
|
}));
|
|
968
1109
|
return _requestCookies.apply(this, arguments);
|
|
969
1110
|
}
|
|
@@ -977,6 +1118,7 @@ function initValContent(config, valModules, opts) {
|
|
|
977
1118
|
if (!tanstackVersion) {
|
|
978
1119
|
throw new Error("Could not get @valbuild/tanstack package version");
|
|
979
1120
|
}
|
|
1121
|
+
var draftSourcesScope = createTanStackRequestScope();
|
|
980
1122
|
var draftMode = (_opts$draftMode = opts === null || opts === void 0 ? void 0 : opts.draftMode) !== null && _opts$draftMode !== void 0 ? _opts$draftMode : valDraftMode();
|
|
981
1123
|
var isEnabled = function isEnabled() {
|
|
982
1124
|
return draftMode.isEnabled();
|
|
@@ -1005,10 +1147,10 @@ function initValContent(config, valModules, opts) {
|
|
|
1005
1147
|
return {
|
|
1006
1148
|
fetchValStega: initFetchValStega(config, valApiEndpoints,
|
|
1007
1149
|
// TODO: get from config
|
|
1008
|
-
valServerPromise, isEnabled, requestHeaders, requestCookies),
|
|
1150
|
+
valServerPromise, isEnabled, requestHeaders, requestCookies, draftSourcesScope),
|
|
1009
1151
|
fetchValKeyStega: initFetchValKeyStega(valServerPromise, isEnabled, requestCookies),
|
|
1010
|
-
fetchValRouteStega: initFetchValRouteStega(config, valApiEndpoints, valServerPromise, isEnabled, requestHeaders, requestCookies),
|
|
1011
|
-
fetchValRouteUrl: initFetchValRouteUrl(config, valApiEndpoints, valServerPromise, isEnabled, requestHeaders, requestCookies)
|
|
1152
|
+
fetchValRouteStega: initFetchValRouteStega(config, valApiEndpoints, valServerPromise, isEnabled, requestHeaders, requestCookies, draftSourcesScope),
|
|
1153
|
+
fetchValRouteUrl: initFetchValRouteUrl(config, valApiEndpoints, valServerPromise, isEnabled, requestHeaders, requestCookies, draftSourcesScope)
|
|
1012
1154
|
};
|
|
1013
1155
|
}
|
|
1014
1156
|
|