@valbuild/next 0.150.22 → 0.151.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 +174 -0
- package/README.md +82 -1
- package/client/dist/valbuild-next-client.cjs.dev.js +123 -256
- package/client/dist/valbuild-next-client.cjs.prod.js +123 -256
- package/client/dist/valbuild-next-client.esm.js +122 -255
- package/dist/{ValApp-a88a9ded.esm.js → ValApp-69cd599c.esm.js} +3 -3
- package/dist/{ValApp-c718d1a6.cjs.dev.js → ValApp-826dca6c.cjs.dev.js} +3 -3
- package/dist/ValApp-866089f6.cjs.js +7 -0
- package/dist/{ValApp-6c3da222.cjs.prod.js → ValApp-866089f6.cjs.prod.js} +3 -3
- package/dist/{ValCanvasBridge-9d221d32.cjs.dev.js → ValCanvasBridge-4b81f653.cjs.dev.js} +46 -13
- package/dist/ValCanvasBridge-6f568f1d.cjs.js +7 -0
- package/dist/{ValCanvasBridge-134c3ae1.cjs.prod.js → ValCanvasBridge-6f568f1d.cjs.prod.js} +46 -13
- package/dist/{ValCanvasBridge-4a5ef73c.esm.js → ValCanvasBridge-badc186b.esm.js} +46 -13
- package/dist/ValNextProvider-41d622a7.cjs.js +7 -0
- package/dist/{ValNextProvider-35d0b521.cjs.prod.js → ValNextProvider-41d622a7.cjs.prod.js} +124 -234
- package/dist/{ValNextProvider-a85a1d33.cjs.dev.js → ValNextProvider-4b9bcfc0.cjs.dev.js} +124 -234
- package/dist/{ValNextProvider-df6f351e.esm.js → ValNextProvider-745ed99e.esm.js} +124 -234
- package/dist/ValOverlayContext-0c29b6a7.cjs.dev.js +51 -0
- package/dist/ValOverlayContext-0f51d111.cjs.js +7 -0
- package/dist/ValOverlayContext-0f51d111.cjs.prod.js +51 -0
- package/dist/ValOverlayContext-178db68e.esm.js +37 -0
- package/dist/ValVideo-02f43a7c.cjs.js +7 -0
- package/dist/{ValVideo-dcd2b9f8.cjs.prod.js → ValVideo-02f43a7c.cjs.prod.js} +1 -2
- package/dist/{ValVideo-6e410ad8.cjs.dev.js → ValVideo-15e5c4fa.cjs.dev.js} +1 -2
- package/dist/{ValVideo-d377f06e.esm.js → ValVideo-8acf31b6.esm.js} +1 -2
- package/dist/{createForOfIteratorHelper-d4afcad8.cjs.prod.js → createForOfIteratorHelper-8459fbc7.cjs.prod.js} +1 -1
- package/dist/{createForOfIteratorHelper-5758a730.esm.js → createForOfIteratorHelper-9209e9dd.esm.js} +1 -1
- package/dist/{createForOfIteratorHelper-0445603c.cjs.dev.js → createForOfIteratorHelper-9c6aa3c7.cjs.dev.js} +1 -1
- package/dist/declarations/src/ValProvider.d.ts +1 -0
- package/dist/declarations/src/client/initValClient.d.ts +25 -3
- package/dist/declarations/src/external_exempt_from_val_quickjs.d.ts +1 -0
- package/dist/declarations/src/rsc/index.d.ts +1 -0
- package/dist/declarations/src/rsc/initValRsc.d.ts +56 -118
- package/dist/declarations/src/server/initValServer.d.ts +2 -1
- package/dist/{fallbackColors-149dfbc9.esm.js → fallbackColors-0d915c59.esm.js} +1 -1
- package/dist/{fallbackColors-080c1bbc.cjs.dev.js → fallbackColors-38f01ad2.cjs.dev.js} +1 -1
- package/dist/{fallbackColors-e1d73b36.cjs.prod.js → fallbackColors-d9a7b81e.cjs.prod.js} +1 -1
- package/dist/{objectSpread2-13f847a9.cjs.prod.js → objectSpread2-469273e9.cjs.prod.js} +25 -2
- package/dist/{objectSpread2-58024783.cjs.dev.js → objectSpread2-58726b14.cjs.dev.js} +25 -2
- package/dist/{objectSpread2-60d1bd93.esm.js → objectSpread2-f1f0d77a.esm.js} +24 -1
- package/dist/{routeFromVal-64cba2a6.esm.js → routeFromVal-80976677.esm.js} +5 -155
- package/dist/{routeFromVal-4df1157a.cjs.dev.js → routeFromVal-a1e0a8be.cjs.dev.js} +3 -159
- package/dist/{routeFromVal-812be6ea.cjs.prod.js → routeFromVal-c4dace91.cjs.prod.js} +3 -159
- package/dist/{slicedToArray-ce613de6.cjs.prod.js → slicedToArray-0fc63719.cjs.prod.js} +1 -1
- package/dist/{slicedToArray-aa291011.esm.js → slicedToArray-5ff32315.esm.js} +1 -1
- package/dist/{slicedToArray-44036a76.cjs.dev.js → slicedToArray-ed812733.cjs.dev.js} +1 -1
- package/dist/{unsupportedIterableToArray-c8ab77c9.cjs.dev.js → unsupportedIterableToArray-1aadf9fb.cjs.prod.js} +1 -0
- package/dist/{unsupportedIterableToArray-0d2087a2.cjs.prod.js → unsupportedIterableToArray-20a9209f.cjs.dev.js} +1 -0
- package/dist/{unsupportedIterableToArray-5baabfdc.esm.js → unsupportedIterableToArray-f57eb659.esm.js} +1 -1
- package/dist/useHydrated-8e90c7fa.cjs.js +7 -0
- package/dist/useHydrated-8e90c7fa.cjs.prod.js +34 -0
- package/dist/useHydrated-afcdbb66.esm.js +26 -0
- package/dist/useHydrated-ff733777.cjs.dev.js +34 -0
- package/dist/valbuild-next.cjs.dev.js +7 -8
- package/dist/valbuild-next.cjs.prod.js +7 -8
- package/dist/valbuild-next.esm.js +7 -8
- package/dist/{version-18c11a6d.cjs.prod.js → version-114c45b6.cjs.prod.js} +1 -1
- package/dist/{version-70b7333d.cjs.dev.js → version-cc1bc4e5.cjs.dev.js} +1 -1
- package/dist/{version-a2218191.esm.js → version-d8f64e54.esm.js} +1 -1
- package/package.json +8 -8
- package/rsc/dist/valbuild-next-rsc.cjs.dev.js +243 -872
- package/rsc/dist/valbuild-next-rsc.cjs.prod.js +243 -872
- package/rsc/dist/valbuild-next-rsc.esm.js +243 -872
- package/server/dist/valbuild-next-server.cjs.dev.js +4 -5
- package/server/dist/valbuild-next-server.cjs.prod.js +4 -5
- package/server/dist/valbuild-next-server.esm.js +4 -5
- package/dist/ValApp-6c3da222.cjs.js +0 -7
- package/dist/ValCanvasBridge-134c3ae1.cjs.js +0 -7
- package/dist/ValNextProvider-35d0b521.cjs.js +0 -7
- package/dist/ValOverlayContext-1a45e03d.esm.js +0 -290
- package/dist/ValOverlayContext-262899b3.cjs.dev.js +0 -301
- package/dist/ValOverlayContext-405ca70c.cjs.js +0 -7
- package/dist/ValOverlayContext-405ca70c.cjs.prod.js +0 -301
- package/dist/ValVideo-dcd2b9f8.cjs.js +0 -7
- package/dist/defineProperty-8951f469.cjs.prod.js +0 -29
- package/dist/defineProperty-cca5affa.esm.js +0 -26
- package/dist/defineProperty-f90345d7.cjs.dev.js +0 -29
|
@@ -3,810 +3,281 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
require('server-only');
|
|
6
|
-
var routeFromVal = require('../../dist/routeFromVal-812be6ea.cjs.prod.js');
|
|
7
|
-
var defineProperty = require('../../dist/defineProperty-8951f469.cjs.prod.js');
|
|
8
|
-
var objectSpread2 = require('../../dist/objectSpread2-13f847a9.cjs.prod.js');
|
|
9
6
|
var asyncToGenerator = require('../../dist/asyncToGenerator-8e5c36c8.cjs.prod.js');
|
|
7
|
+
var objectSpread2 = require('../../dist/objectSpread2-469273e9.cjs.prod.js');
|
|
10
8
|
var stega = require('@valbuild/react/stega');
|
|
9
|
+
var internal$1 = require('@valbuild/react/internal');
|
|
11
10
|
var core = require('@valbuild/core');
|
|
12
|
-
var
|
|
13
|
-
var
|
|
14
|
-
var
|
|
15
|
-
|
|
16
|
-
require('../../dist/
|
|
17
|
-
require('../../dist/
|
|
18
|
-
require('../../dist/slicedToArray-ce613de6.cjs.prod.js');
|
|
11
|
+
var internal = require('@valbuild/server/internal');
|
|
12
|
+
var version = require('../../dist/version-114c45b6.cjs.prod.js');
|
|
13
|
+
var routeFromVal = require('../../dist/routeFromVal-c4dace91.cjs.prod.js');
|
|
14
|
+
require('../../dist/createForOfIteratorHelper-8459fbc7.cjs.prod.js');
|
|
15
|
+
require('../../dist/unsupportedIterableToArray-1aadf9fb.cjs.prod.js');
|
|
16
|
+
require('../../dist/slicedToArray-0fc63719.cjs.prod.js');
|
|
19
17
|
require('@valbuild/shared/client');
|
|
20
18
|
|
|
21
19
|
stega.SET_RSC(true);
|
|
22
20
|
|
|
23
|
-
|
|
24
|
-
* The
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
21
|
+
/*
|
|
22
|
+
* The readers below are `resolveVal` (`@valbuild/react/stega`) over this
|
|
23
|
+
* request's sources: the draft (`serverDraftSource`, in `@valbuild/server`),
|
|
24
|
+
* then the bundle. Only the sources are Next's; the rule that picks between
|
|
25
|
+
* them is the same in `@valbuild/tanstack` and in the hooks. See
|
|
26
|
+
* `docs/plans/one-content-model.md`, "One way to load".
|
|
28
27
|
*/
|
|
29
28
|
|
|
30
29
|
/**
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
* it says what the dependency IS, and it lets a test drive the reader with a
|
|
35
|
-
* one-route fake instead of casting a partial object to the whole server type.
|
|
30
|
+
* What the readers read: this process's runtime for the app's `val.modules`
|
|
31
|
+
* (`createValRuntime`), the same one the API route's server is built on.
|
|
32
|
+
* Its head is the draft, read with the request's session.
|
|
36
33
|
*/
|
|
37
34
|
|
|
38
|
-
/** What
|
|
35
|
+
/** What a misuse of a reader is told, beside what went wrong. */
|
|
36
|
+
var WHERE = "fetchVal can only be used server-side. Use useVal on clients.";
|
|
39
37
|
|
|
40
38
|
/**
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
* scope its cache to" is part of its contract and a test can supply a scope it
|
|
45
|
-
* controls — in jest, React's non-`react-server` build makes `cache` a
|
|
46
|
-
* pass-through, so the real wiring memoises nothing there.
|
|
39
|
+
* What a read in this request reads, in order: the draft (in draft mode),
|
|
40
|
+
* then -- added by every read -- the bundle. Edit tags are decided here,
|
|
41
|
+
* once, from draft mode.
|
|
47
42
|
*/
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
* See `memoizePerRequest`. `fetchVal` is an RSC API (`SET_RSC(true)` above, and
|
|
58
|
-
* its own error messages say so), so the effective case is the normal one.
|
|
59
|
-
*
|
|
60
|
-
* Built PER `initValRsc` rather than once for the module, because the box is
|
|
61
|
-
* only as specific as the `cache()` it came from: two Val servers in one
|
|
62
|
-
* process sharing one would answer each other's reads within a request, and
|
|
63
|
-
* they hold different content.
|
|
64
|
-
*/
|
|
65
|
-
function createReactCacheScope() {
|
|
66
|
-
var getBox = React.cache(function () {
|
|
67
|
-
return {};
|
|
68
|
-
});
|
|
69
|
-
return /*#__PURE__*/asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function _callee() {
|
|
70
|
-
return asyncToGenerator._regenerator().w(function (_context) {
|
|
71
|
-
while (1) switch (_context.n) {
|
|
72
|
-
case 0:
|
|
73
|
-
return _context.a(2, getBox());
|
|
74
|
-
}
|
|
75
|
-
}, _callee);
|
|
76
|
-
}));
|
|
43
|
+
function requestEnv(enabled, draft) {
|
|
44
|
+
if (enabled) {
|
|
45
|
+
stega.SET_AUTO_TAG_JSX_ENABLED(true);
|
|
46
|
+
}
|
|
47
|
+
return {
|
|
48
|
+
sources: draft === null ? [] : [draft],
|
|
49
|
+
encode: enabled,
|
|
50
|
+
schemaVersionOf: internal.readerSchemaVersion
|
|
51
|
+
};
|
|
77
52
|
}
|
|
78
53
|
|
|
79
|
-
/**
|
|
80
|
-
* ONE read of the whole module tree, for the session in `sessionCookie`.
|
|
81
|
-
*
|
|
82
|
-
* `path` stays `"/"` on purpose, and the measurement is why. `/sources/~`
|
|
83
|
-
* evaluates, previews and validates EVERY module and only THEN filters the
|
|
84
|
-
* response by `req.path` (the two TODOs in `ValServer.ts` say so), so narrowing
|
|
85
|
-
* the path shrinks the answer and changes the work not at all: on a 60-module
|
|
86
|
-
* project, `path: "/"` took 53.6ms and a single-module path 53.5ms. And this is
|
|
87
|
-
* an in-process call rather than a round trip, so the object it builds is never
|
|
88
|
-
* serialised or sent anywhere — the bytes it saves are not bytes anyone pays
|
|
89
|
-
* for. Narrowing would also give each caller a different answer to cache, which
|
|
90
|
-
* is what would cost the saving that IS real (2.7x on the same project).
|
|
91
|
-
*
|
|
92
|
-
* `draftRead.perf.test.ts` prints both numbers; re-run it before believing
|
|
93
|
-
* anything different.
|
|
94
|
-
*
|
|
95
|
-
* Returns `null` when the session is not one the server accepts; the caller
|
|
96
|
-
* then renders published content, which is what it did before.
|
|
97
|
-
*/
|
|
98
|
-
function loadDraftSources(_x, _x2) {
|
|
99
|
-
return _loadDraftSources.apply(this, arguments);
|
|
100
|
-
}
|
|
101
|
-
function _loadDraftSources() {
|
|
102
|
-
_loadDraftSources = asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function _callee19(valServerPromise, sessionCookie) {
|
|
103
|
-
var valServer, treeRes;
|
|
104
|
-
return asyncToGenerator._regenerator().w(function (_context19) {
|
|
105
|
-
while (1) switch (_context19.n) {
|
|
106
|
-
case 0:
|
|
107
|
-
_context19.n = 1;
|
|
108
|
-
return valServerPromise;
|
|
109
|
-
case 1:
|
|
110
|
-
valServer = _context19.v;
|
|
111
|
-
_context19.n = 2;
|
|
112
|
-
return valServer["/sources/~"]["PUT"]({
|
|
113
|
-
path: "/",
|
|
114
|
-
query: {
|
|
115
|
-
validate_sources: true,
|
|
116
|
-
validate_binary_files: false,
|
|
117
|
-
exclude_patches: false,
|
|
118
|
-
// RSC pre-render uses the legacy "server applies patches" path.
|
|
119
|
-
apply_patches: undefined
|
|
120
|
-
},
|
|
121
|
-
cookies: defineProperty._defineProperty({}, internal.VAL_SESSION_COOKIE, sessionCookie)
|
|
122
|
-
});
|
|
123
|
-
case 2:
|
|
124
|
-
treeRes = _context19.v;
|
|
125
|
-
if (!(treeRes.status === 200)) {
|
|
126
|
-
_context19.n = 3;
|
|
127
|
-
break;
|
|
128
|
-
}
|
|
129
|
-
return _context19.a(2, treeRes.json.modules);
|
|
130
|
-
case 3:
|
|
131
|
-
if (!(treeRes.status === 401)) {
|
|
132
|
-
_context19.n = 4;
|
|
133
|
-
break;
|
|
134
|
-
}
|
|
135
|
-
core.Internal.log.debug("authentication error: ", treeRes.json.message);
|
|
136
|
-
return _context19.a(2, null);
|
|
137
|
-
case 4:
|
|
138
|
-
throw Error(JSON.stringify(treeRes.json, null, 2));
|
|
139
|
-
case 5:
|
|
140
|
-
return _context19.a(2);
|
|
141
|
-
}
|
|
142
|
-
}, _callee19);
|
|
143
|
-
}));
|
|
144
|
-
return _loadDraftSources.apply(this, arguments);
|
|
145
|
-
}
|
|
146
|
-
var initFetchValStega = function initFetchValStega(config, valApiEndpoints, valServerPromise, isEnabled, getHeaders, getCookies, getDraftSourcesScope) {
|
|
147
|
-
return function (selector) {
|
|
148
|
-
var exec = /*#__PURE__*/function () {
|
|
149
|
-
var _ref2 = asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function _callee2() {
|
|
150
|
-
var enabled, headers, cookies, host, _cookies, sessionCookie, modules, _t, _t2, _t3, _t4, _t5, _t6, _t7, _t8, _t9, _t0, _t1, _t10;
|
|
151
|
-
return asyncToGenerator._regenerator().w(function (_context2) {
|
|
152
|
-
while (1) switch (_context2.p = _context2.n) {
|
|
153
|
-
case 0:
|
|
154
|
-
enabled = false;
|
|
155
|
-
_context2.p = 1;
|
|
156
|
-
_context2.n = 2;
|
|
157
|
-
return isEnabled();
|
|
158
|
-
case 2:
|
|
159
|
-
enabled = _context2.v;
|
|
160
|
-
_context2.n = 4;
|
|
161
|
-
break;
|
|
162
|
-
case 3:
|
|
163
|
-
_context2.p = 3;
|
|
164
|
-
_t = _context2.v;
|
|
165
|
-
core.Internal.log.error("could not check if Val is enabled! This might be due to an error to check draftMode. fetchVal can only be used server-side. Use useVal on clients.", _t);
|
|
166
|
-
case 4:
|
|
167
|
-
if (!enabled) {
|
|
168
|
-
_context2.n = 16;
|
|
169
|
-
break;
|
|
170
|
-
}
|
|
171
|
-
stega.SET_AUTO_TAG_JSX_ENABLED(true);
|
|
172
|
-
_context2.p = 5;
|
|
173
|
-
_context2.n = 6;
|
|
174
|
-
return getHeaders();
|
|
175
|
-
case 6:
|
|
176
|
-
headers = _context2.v;
|
|
177
|
-
if (!(typeof headers.get !== "function")) {
|
|
178
|
-
_context2.n = 7;
|
|
179
|
-
break;
|
|
180
|
-
}
|
|
181
|
-
throw new Error("Invalid headers");
|
|
182
|
-
case 7:
|
|
183
|
-
_context2.n = 9;
|
|
184
|
-
break;
|
|
185
|
-
case 8:
|
|
186
|
-
_context2.p = 8;
|
|
187
|
-
_t2 = _context2.v;
|
|
188
|
-
core.Internal.log.error("could not read headers! fetchVal can only be used server-side. Use useVal on clients.", _t2);
|
|
189
|
-
headers = null;
|
|
190
|
-
case 9:
|
|
191
|
-
_context2.p = 9;
|
|
192
|
-
_context2.n = 10;
|
|
193
|
-
return getCookies();
|
|
194
|
-
case 10:
|
|
195
|
-
cookies = _context2.v;
|
|
196
|
-
_context2.n = 12;
|
|
197
|
-
break;
|
|
198
|
-
case 11:
|
|
199
|
-
_context2.p = 11;
|
|
200
|
-
_t3 = _context2.v;
|
|
201
|
-
core.Internal.log.error("could not read cookies! fetchVal can only be used server-side. Use useVal on clients.", _t3);
|
|
202
|
-
cookies = null;
|
|
203
|
-
case 12:
|
|
204
|
-
host = headers && getHost(headers);
|
|
205
|
-
if (!(host && cookies)) {
|
|
206
|
-
_context2.n = 16;
|
|
207
|
-
break;
|
|
208
|
-
}
|
|
209
|
-
sessionCookie = (_cookies = cookies) === null || _cookies === void 0 || (_cookies = _cookies.get(internal.VAL_SESSION_COOKIE)) === null || _cookies === void 0 ? void 0 : _cookies.value;
|
|
210
|
-
/*
|
|
211
|
-
* Once per request, however many times the page reads.
|
|
212
|
-
*
|
|
213
|
-
* Every `fetchVal` in one render asks the same question — same query,
|
|
214
|
-
* same session — so the second and third answer were identical and
|
|
215
|
-
* cost the same as the first. `fetchValRouteUrl` made that worse by
|
|
216
|
-
* calling `fetchVal` again on top of the caller's own.
|
|
217
|
-
*
|
|
218
|
-
* The key is the session, so a box that somehow outlived its request
|
|
219
|
-
* misses rather than serving another author's draft. See
|
|
220
|
-
* `memoizePerRequest`.
|
|
221
|
-
*/
|
|
222
|
-
_t4 = internal.memoizePerRequest;
|
|
223
|
-
_context2.n = 13;
|
|
224
|
-
return getDraftSourcesScope();
|
|
225
|
-
case 13:
|
|
226
|
-
_context2.n = 14;
|
|
227
|
-
return _t4(_context2.v, sessionCookie !== null && sessionCookie !== void 0 ? sessionCookie : "", function () {
|
|
228
|
-
return loadDraftSources(valServerPromise, sessionCookie);
|
|
229
|
-
});
|
|
230
|
-
case 14:
|
|
231
|
-
modules = _context2.v;
|
|
232
|
-
if (!modules) {
|
|
233
|
-
_context2.n = 16;
|
|
234
|
-
break;
|
|
235
|
-
}
|
|
236
|
-
_t5 = stega.stegaEncode;
|
|
237
|
-
_t6 = selector;
|
|
238
|
-
_t7 = !enabled;
|
|
239
|
-
_context2.n = 15;
|
|
240
|
-
return withJsonValuesEntries(selector, function (path) {
|
|
241
|
-
var _modules$path;
|
|
242
|
-
return [(_modules$path = modules[path]) === null || _modules$path === void 0 ? void 0 : _modules$path.source];
|
|
243
|
-
});
|
|
244
|
-
case 15:
|
|
245
|
-
_t8 = _context2.v;
|
|
246
|
-
return _context2.a(2, _t5(_t6, {
|
|
247
|
-
disabled: _t7,
|
|
248
|
-
getModule: _t8
|
|
249
|
-
}));
|
|
250
|
-
case 16:
|
|
251
|
-
_t9 = stega.stegaEncode;
|
|
252
|
-
_t0 = selector;
|
|
253
|
-
_t1 = !enabled;
|
|
254
|
-
_context2.n = 17;
|
|
255
|
-
return withJsonValuesEntries(selector, function () {
|
|
256
|
-
return [];
|
|
257
|
-
});
|
|
258
|
-
case 17:
|
|
259
|
-
_t10 = _context2.v;
|
|
260
|
-
return _context2.a(2, _t9(_t0, {
|
|
261
|
-
disabled: _t1,
|
|
262
|
-
getModule: _t10
|
|
263
|
-
}));
|
|
264
|
-
}
|
|
265
|
-
}, _callee2, null, [[9, 11], [5, 8], [1, 3]]);
|
|
266
|
-
}));
|
|
267
|
-
return function exec() {
|
|
268
|
-
return _ref2.apply(this, arguments);
|
|
269
|
-
};
|
|
270
|
-
}();
|
|
271
|
-
return exec()["catch"](/*#__PURE__*/function () {
|
|
272
|
-
var _ref3 = asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function _callee3(err) {
|
|
273
|
-
var _t11, _t12, _t13;
|
|
274
|
-
return asyncToGenerator._regenerator().w(function (_context3) {
|
|
275
|
-
while (1) switch (_context3.n) {
|
|
276
|
-
case 0:
|
|
277
|
-
core.Internal.log.error("failed to fetch ", err);
|
|
278
|
-
_t11 = stega.stegaEncode;
|
|
279
|
-
_t12 = selector;
|
|
280
|
-
_context3.n = 1;
|
|
281
|
-
return withJsonValuesEntries(selector, function () {
|
|
282
|
-
return [];
|
|
283
|
-
})["catch"](function () {
|
|
284
|
-
return function () {
|
|
285
|
-
return undefined;
|
|
286
|
-
};
|
|
287
|
-
});
|
|
288
|
-
case 1:
|
|
289
|
-
_t13 = _context3.v;
|
|
290
|
-
return _context3.a(2, _t11(_t12, {
|
|
291
|
-
getModule: _t13
|
|
292
|
-
}));
|
|
293
|
-
}
|
|
294
|
-
}, _callee3);
|
|
295
|
-
}));
|
|
296
|
-
return function (_x3) {
|
|
297
|
-
return _ref3.apply(this, arguments);
|
|
298
|
-
};
|
|
299
|
-
}());
|
|
300
|
-
};
|
|
301
|
-
};
|
|
54
|
+
/** What a reader needs from the app and the request. */
|
|
302
55
|
|
|
303
|
-
/**
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
case 0:
|
|
321
|
-
first = function first(path) {
|
|
322
|
-
return sourcesOf(path).find(function (source) {
|
|
323
|
-
return source !== undefined;
|
|
56
|
+
/** `fetchVal`, with what it read: see `readsOfFetchVal`. */
|
|
57
|
+
function fetchValWithReads(deps) {
|
|
58
|
+
return /*#__PURE__*/function () {
|
|
59
|
+
var _ref = asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function _callee(selector, opts) {
|
|
60
|
+
var _yield$draftForReques, enabled, draft, env;
|
|
61
|
+
return asyncToGenerator._regenerator().w(function (_context) {
|
|
62
|
+
while (1) switch (_context.n) {
|
|
63
|
+
case 0:
|
|
64
|
+
_context.n = 1;
|
|
65
|
+
return internal.draftForRequest({
|
|
66
|
+
runtime: deps.runtime,
|
|
67
|
+
isEnabled: deps.isEnabled,
|
|
68
|
+
getCookies: deps.getCookies,
|
|
69
|
+
modules: {
|
|
70
|
+
getHeaders: deps.getHeaders
|
|
71
|
+
},
|
|
72
|
+
where: WHERE
|
|
324
73
|
});
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
_context21.n = 2;
|
|
335
|
-
return Promise.all(plan.load.map(/*#__PURE__*/function () {
|
|
336
|
-
var _ref16 = asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function _callee20(key) {
|
|
337
|
-
var thunk, _t19, _t20, _t21;
|
|
338
|
-
return asyncToGenerator._regenerator().w(function (_context20) {
|
|
339
|
-
while (1) switch (_context20.n) {
|
|
340
|
-
case 0:
|
|
341
|
-
thunk = routeFromVal.bundledJsonEntryImport(plan.module, key);
|
|
342
|
-
_t19 = key;
|
|
343
|
-
if (!thunk) {
|
|
344
|
-
_context20.n = 2;
|
|
345
|
-
break;
|
|
346
|
-
}
|
|
347
|
-
_context20.n = 1;
|
|
348
|
-
return thunk();
|
|
349
|
-
case 1:
|
|
350
|
-
_t20 = _context20.v["default"];
|
|
351
|
-
_context20.n = 3;
|
|
352
|
-
break;
|
|
353
|
-
case 2:
|
|
354
|
-
_t20 = undefined;
|
|
355
|
-
case 3:
|
|
356
|
-
_t21 = _t20;
|
|
357
|
-
return _context20.a(2, [_t19, _t21]);
|
|
358
|
-
}
|
|
359
|
-
}, _callee20);
|
|
74
|
+
case 1:
|
|
75
|
+
_yield$draftForReques = _context.v;
|
|
76
|
+
enabled = _yield$draftForReques.enabled;
|
|
77
|
+
draft = _yield$draftForReques.draft;
|
|
78
|
+
env = requestEnv(enabled, draft);
|
|
79
|
+
return _context.a(2, internal$1.awaitResolved(function (settled) {
|
|
80
|
+
return internal$1.resolveVal(selector, env, objectSpread2._objectSpread2({
|
|
81
|
+
settled: settled
|
|
82
|
+
}, opts));
|
|
360
83
|
}));
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
return _context21.a(2, function (path) {
|
|
369
|
-
return path === plan.modulePath ? filled : first(path);
|
|
370
|
-
});
|
|
371
|
-
}
|
|
372
|
-
}, _callee21);
|
|
373
|
-
}));
|
|
374
|
-
return _withJsonValuesEntries.apply(this, arguments);
|
|
375
|
-
}
|
|
376
|
-
function getHost(headers) {
|
|
377
|
-
var _headers$get;
|
|
378
|
-
// TODO: does NextJs have a way to determine this?
|
|
379
|
-
var host = headers === null || headers === void 0 ? void 0 : headers.get("host");
|
|
380
|
-
var proto = "https";
|
|
381
|
-
if ((headers === null || headers === void 0 ? void 0 : headers.get("x-forwarded-proto")) === "http") {
|
|
382
|
-
proto = "http";
|
|
383
|
-
} else if (headers !== null && headers !== void 0 && (_headers$get = headers.get("referer")) !== null && _headers$get !== void 0 && _headers$get.startsWith("http://")) {
|
|
384
|
-
proto = "http";
|
|
385
|
-
} else if (host !== null && host !== void 0 && host.startsWith("localhost")) {
|
|
386
|
-
proto = "http";
|
|
387
|
-
}
|
|
388
|
-
if (host && proto) {
|
|
389
|
-
return "".concat(proto, "://").concat(host);
|
|
390
|
-
}
|
|
391
|
-
return null;
|
|
84
|
+
}
|
|
85
|
+
}, _callee);
|
|
86
|
+
}));
|
|
87
|
+
return function (_x, _x2) {
|
|
88
|
+
return _ref.apply(this, arguments);
|
|
89
|
+
};
|
|
90
|
+
}();
|
|
392
91
|
}
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
// const session = cookies.get(Internal.VAL_SESSION_COOKIE);
|
|
400
|
-
// if (session) {
|
|
401
|
-
// return {
|
|
402
|
-
// Cookie: `${Internal.VAL_SESSION_COOKIE}=${encodeURIComponent(
|
|
403
|
-
// session.value
|
|
404
|
-
// )}`,
|
|
405
|
-
// };
|
|
406
|
-
// }
|
|
407
|
-
// return {};
|
|
408
|
-
// } catch (err) {
|
|
409
|
-
// console.error(
|
|
410
|
-
// "Val: could not read cookies! fetchVal can only be used server-side. Use useVal on clients.",
|
|
411
|
-
// err
|
|
412
|
-
// );
|
|
413
|
-
// return {};
|
|
414
|
-
// }
|
|
415
|
-
// }
|
|
416
|
-
|
|
417
|
-
var initFetchValRouteStega = function initFetchValRouteStega(config, valApiEndpoints, valServerPromise, isEnabled, getHeaders, getCookies, getDraftSourcesScope) {
|
|
92
|
+
var initFetchValStega = function initFetchValStega(deps) {
|
|
93
|
+
return internal$1.fetchValFrom(fetchValWithReads(deps));
|
|
94
|
+
};
|
|
95
|
+
var initFetchValRouteStega = function initFetchValRouteStega(deps) {
|
|
96
|
+
var fetchVal = fetchValWithReads(deps);
|
|
97
|
+
var fetchValKey = initFetchValKeyStega(deps);
|
|
418
98
|
return /*#__PURE__*/function () {
|
|
419
|
-
var
|
|
420
|
-
var resolvedParams, valModule, path, schema,
|
|
421
|
-
return asyncToGenerator._regenerator().w(function (
|
|
422
|
-
while (1) switch (
|
|
99
|
+
var _ref2 = asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function _callee2(selector, params) {
|
|
100
|
+
var resolvedParams, valModule, path, schema, url, content, val, _t;
|
|
101
|
+
return asyncToGenerator._regenerator().w(function (_context2) {
|
|
102
|
+
while (1) switch (_context2.n) {
|
|
423
103
|
case 0:
|
|
424
|
-
|
|
104
|
+
_context2.n = 1;
|
|
425
105
|
return Promise.resolve(params);
|
|
426
106
|
case 1:
|
|
427
|
-
resolvedParams =
|
|
107
|
+
resolvedParams = _context2.v;
|
|
428
108
|
// A view is a pointer: everything below reads a path, a schema and a source
|
|
429
109
|
// off this, and a pointer has none of them. See `resolveViewedModule`.
|
|
430
110
|
valModule = core.Internal.resolveViewedModule(selector);
|
|
431
111
|
path = valModule && core.Internal.getValPath(valModule);
|
|
432
112
|
schema = valModule && core.Internal.getSchema(valModule); // `.jsonValues()` router: map params → the entry key and load ONLY that
|
|
433
|
-
// entry
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
_context4.n = 11;
|
|
113
|
+
// entry, instead of the whole record.
|
|
114
|
+
if (!internal$1.isJsonValuesRecordSchema(schema)) {
|
|
115
|
+
_context2.n = 4;
|
|
437
116
|
break;
|
|
438
117
|
}
|
|
439
|
-
|
|
440
|
-
url = routeFromVal.getValRouteUrlFromVal(resolvedParams, "fetchValRoute", path, schema, source);
|
|
118
|
+
url = routeFromVal.getValRouteUrlFromVal(resolvedParams, "fetchValRoute", path, schema, valModule && core.Internal.getSource(valModule));
|
|
441
119
|
if (url) {
|
|
442
|
-
|
|
120
|
+
_context2.n = 2;
|
|
443
121
|
break;
|
|
444
122
|
}
|
|
445
|
-
return
|
|
123
|
+
return _context2.a(2, null);
|
|
446
124
|
case 2:
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
125
|
+
_context2.n = 3;
|
|
126
|
+
return fetchValKey(valModule, url);
|
|
127
|
+
case 3:
|
|
128
|
+
content = _context2.v;
|
|
129
|
+
return _context2.a(2, content === undefined ? null : content);
|
|
451
130
|
case 4:
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
case 5:
|
|
456
|
-
_context4.p = 5;
|
|
457
|
-
_context4.v;
|
|
458
|
-
case 6:
|
|
459
|
-
draft = {
|
|
460
|
-
status: "unavailable"
|
|
461
|
-
};
|
|
462
|
-
if (!(enabled && path)) {
|
|
463
|
-
_context4.n = 8;
|
|
464
|
-
break;
|
|
465
|
-
}
|
|
466
|
-
stega.SET_AUTO_TAG_JSX_ENABLED(true);
|
|
467
|
-
_context4.n = 7;
|
|
468
|
-
return loadDraftJsonEntry(valServerPromise, getCookies, path, url);
|
|
469
|
-
case 7:
|
|
470
|
-
draft = _context4.v;
|
|
471
|
-
case 8:
|
|
472
|
-
_context4.n = 9;
|
|
473
|
-
return resolveDraftOrCommittedEntry(draft, function () {
|
|
474
|
-
return loadJsonEntryContent(source, url);
|
|
475
|
-
});
|
|
476
|
-
case 9:
|
|
477
|
-
content = _context4.v;
|
|
478
|
-
if (!(content === undefined)) {
|
|
479
|
-
_context4.n = 10;
|
|
480
|
-
break;
|
|
481
|
-
}
|
|
482
|
-
return _context4.a(2, null);
|
|
483
|
-
case 10:
|
|
484
|
-
return _context4.a(2, stega.stegaEncode(content, {
|
|
485
|
-
disabled: !enabled,
|
|
486
|
-
root: routeFromVal.getJsonEntryStegaRoot(valModule, url)
|
|
487
|
-
}));
|
|
488
|
-
case 11:
|
|
489
|
-
fetchVal = initFetchValStega(config, valApiEndpoints, valServerPromise, isEnabled, getHeaders, getCookies, getDraftSourcesScope);
|
|
490
|
-
_t15 = valModule;
|
|
491
|
-
if (!_t15) {
|
|
492
|
-
_context4.n = 13;
|
|
131
|
+
_t = valModule;
|
|
132
|
+
if (!_t) {
|
|
133
|
+
_context2.n = 6;
|
|
493
134
|
break;
|
|
494
135
|
}
|
|
495
|
-
|
|
136
|
+
_context2.n = 5;
|
|
496
137
|
return fetchVal(valModule);
|
|
497
|
-
case
|
|
498
|
-
|
|
499
|
-
case
|
|
500
|
-
val =
|
|
501
|
-
|
|
502
|
-
return _context4.a(2, route);
|
|
138
|
+
case 5:
|
|
139
|
+
_t = _context2.v.value;
|
|
140
|
+
case 6:
|
|
141
|
+
val = _t;
|
|
142
|
+
return _context2.a(2, routeFromVal.initValRouteFromVal(resolvedParams, "fetchValRoute", path, schema, val));
|
|
503
143
|
}
|
|
504
|
-
},
|
|
144
|
+
}, _callee2);
|
|
505
145
|
}));
|
|
506
|
-
return function (
|
|
507
|
-
return
|
|
146
|
+
return function (_x3, _x4) {
|
|
147
|
+
return _ref2.apply(this, arguments);
|
|
508
148
|
};
|
|
509
149
|
}();
|
|
510
150
|
};
|
|
511
151
|
|
|
512
|
-
/**
|
|
513
|
-
* Resolves a single `.jsonValues()` entry's content by key from a module's local
|
|
514
|
-
* source markers (one dynamic import). Returns `undefined` when the key is
|
|
515
|
-
* missing or its marker has no runtime thunk (transport marker / draft entry).
|
|
516
|
-
*/
|
|
517
|
-
function loadJsonEntryContent(_x8, _x9) {
|
|
518
|
-
return _loadJsonEntryContent.apply(this, arguments);
|
|
519
|
-
}
|
|
520
|
-
/**
|
|
521
|
-
* Loads a single `.jsonValues()` entry's DRAFT content via the in-process
|
|
522
|
-
* `/json` endpoint (which replays pending patches). Returns `undefined` when the
|
|
523
|
-
* entry has no draft content to serve — the caller then falls back to the
|
|
524
|
-
* locally-bundled committed content.
|
|
525
|
-
*/
|
|
526
|
-
/**
|
|
527
|
-
* What the draft state says about an entry.
|
|
528
|
-
*
|
|
529
|
-
* The three cases have to stay distinct: `absent` is an ANSWER — the entry is not
|
|
530
|
-
* there in the draft state, e.g. a pending patch removed it — while `unavailable`
|
|
531
|
-
* means we could not ask. Collapsing them into `undefined` is what made a
|
|
532
|
-
* draft-deleted entry keep rendering its committed content: the caller could not
|
|
533
|
-
* tell "it is gone" from "ask the committed source instead".
|
|
534
|
-
*/
|
|
535
|
-
/**
|
|
536
|
-
* The slice of `ValServer` the single-entry readers actually use. Narrower than
|
|
537
|
-
* `ValServer` on purpose: it says what the dependency IS, and it lets a test
|
|
538
|
-
* drive these readers with a one-route fake instead of casting a partial object
|
|
539
|
-
* to the whole server type.
|
|
540
|
-
*/
|
|
541
|
-
function _loadJsonEntryContent() {
|
|
542
|
-
_loadJsonEntryContent = asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function _callee22(source, key) {
|
|
543
|
-
var marker, thunk;
|
|
544
|
-
return asyncToGenerator._regenerator().w(function (_context22) {
|
|
545
|
-
while (1) switch (_context22.n) {
|
|
546
|
-
case 0:
|
|
547
|
-
if (!(!source || routeFromVal._typeof(source) !== "object")) {
|
|
548
|
-
_context22.n = 1;
|
|
549
|
-
break;
|
|
550
|
-
}
|
|
551
|
-
return _context22.a(2, undefined);
|
|
552
|
-
case 1:
|
|
553
|
-
marker = source[key];
|
|
554
|
-
if (core.Internal.isJson(marker)) {
|
|
555
|
-
_context22.n = 2;
|
|
556
|
-
break;
|
|
557
|
-
}
|
|
558
|
-
return _context22.a(2, undefined);
|
|
559
|
-
case 2:
|
|
560
|
-
thunk = core.Internal.getJsonImport(marker);
|
|
561
|
-
if (thunk) {
|
|
562
|
-
_context22.n = 3;
|
|
563
|
-
break;
|
|
564
|
-
}
|
|
565
|
-
return _context22.a(2, undefined);
|
|
566
|
-
case 3:
|
|
567
|
-
_context22.n = 4;
|
|
568
|
-
return thunk();
|
|
569
|
-
case 4:
|
|
570
|
-
return _context22.a(2, _context22.v["default"]);
|
|
571
|
-
}
|
|
572
|
-
}, _callee22);
|
|
573
|
-
}));
|
|
574
|
-
return _loadJsonEntryContent.apply(this, arguments);
|
|
575
|
-
}
|
|
576
|
-
/**
|
|
577
|
-
* Picks the content a draft-aware single-entry read should render.
|
|
578
|
-
*
|
|
579
|
-
* The rule the two callers share: the draft state WINS when it has an answer —
|
|
580
|
-
* including the answer "this entry is gone" — and the committed content is used
|
|
581
|
-
* only when there is no draft answer to be had (Val disabled, or we could not
|
|
582
|
-
* ask). Returning `undefined` means "render nothing"; both callers turn that into
|
|
583
|
-
* a null/undefined result.
|
|
584
|
-
*/
|
|
585
|
-
function resolveDraftOrCommittedEntry(_x0, _x1) {
|
|
586
|
-
return _resolveDraftOrCommittedEntry.apply(this, arguments);
|
|
587
|
-
}
|
|
588
|
-
function _resolveDraftOrCommittedEntry() {
|
|
589
|
-
_resolveDraftOrCommittedEntry = asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function _callee23(draft, loadCommitted) {
|
|
590
|
-
return asyncToGenerator._regenerator().w(function (_context23) {
|
|
591
|
-
while (1) switch (_context23.n) {
|
|
592
|
-
case 0:
|
|
593
|
-
if (!(draft.status === "content")) {
|
|
594
|
-
_context23.n = 1;
|
|
595
|
-
break;
|
|
596
|
-
}
|
|
597
|
-
return _context23.a(2, draft.content);
|
|
598
|
-
case 1:
|
|
599
|
-
if (!(draft.status === "absent")) {
|
|
600
|
-
_context23.n = 2;
|
|
601
|
-
break;
|
|
602
|
-
}
|
|
603
|
-
return _context23.a(2, undefined);
|
|
604
|
-
case 2:
|
|
605
|
-
return _context23.a(2, loadCommitted());
|
|
606
|
-
}
|
|
607
|
-
}, _callee23);
|
|
608
|
-
}));
|
|
609
|
-
return _resolveDraftOrCommittedEntry.apply(this, arguments);
|
|
610
|
-
}
|
|
611
|
-
function loadDraftJsonEntry(_x10, _x11, _x12, _x13) {
|
|
612
|
-
return _loadDraftJsonEntry.apply(this, arguments);
|
|
613
|
-
}
|
|
614
152
|
/**
|
|
615
153
|
* Resolves ONE `.jsonValues()` entry by key, loading only that entry instead of
|
|
616
154
|
* the whole record — the runtime-scaling counterpart to the eager `fetchVal`.
|
|
617
155
|
*
|
|
618
|
-
* Production (Val disabled):
|
|
619
|
-
*
|
|
156
|
+
* Production (Val disabled): the entry's lazy import from the bundle. One
|
|
157
|
+
* dynamic import, no server round-trip.
|
|
620
158
|
*
|
|
621
|
-
*
|
|
622
|
-
*
|
|
623
|
-
*
|
|
159
|
+
* Draft mode: the entry from the runtime's head, with the pending patches the
|
|
160
|
+
* draft holds for it, so uncommitted Studio edits show up; an entry the draft
|
|
161
|
+
* deleted is not there. An entry of a record no patch touched is the bundle's.
|
|
624
162
|
*/
|
|
625
|
-
function
|
|
626
|
-
_loadDraftJsonEntry = asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function _callee24(valServerPromise, getCookies, moduleFilePath, key) {
|
|
627
|
-
var _cookies3;
|
|
628
|
-
var cookies, valServer, res;
|
|
629
|
-
return asyncToGenerator._regenerator().w(function (_context24) {
|
|
630
|
-
while (1) switch (_context24.p = _context24.n) {
|
|
631
|
-
case 0:
|
|
632
|
-
_context24.p = 0;
|
|
633
|
-
_context24.n = 1;
|
|
634
|
-
return getCookies();
|
|
635
|
-
case 1:
|
|
636
|
-
cookies = _context24.v;
|
|
637
|
-
_context24.n = 3;
|
|
638
|
-
break;
|
|
639
|
-
case 2:
|
|
640
|
-
_context24.p = 2;
|
|
641
|
-
_context24.v;
|
|
642
|
-
return _context24.a(2, {
|
|
643
|
-
status: "unavailable"
|
|
644
|
-
});
|
|
645
|
-
case 3:
|
|
646
|
-
_context24.n = 4;
|
|
647
|
-
return valServerPromise;
|
|
648
|
-
case 4:
|
|
649
|
-
valServer = _context24.v;
|
|
650
|
-
_context24.n = 5;
|
|
651
|
-
return valServer["/json"]["GET"]({
|
|
652
|
-
query: {
|
|
653
|
-
path: moduleFilePath,
|
|
654
|
-
key: key,
|
|
655
|
-
keys: undefined,
|
|
656
|
-
// single-entry shape
|
|
657
|
-
offset: undefined,
|
|
658
|
-
limit: undefined,
|
|
659
|
-
apply_patches: true
|
|
660
|
-
},
|
|
661
|
-
cookies: defineProperty._defineProperty({}, internal.VAL_SESSION_COOKIE, (_cookies3 = cookies) === null || _cookies3 === void 0 || (_cookies3 = _cookies3.get(internal.VAL_SESSION_COOKIE)) === null || _cookies3 === void 0 ? void 0 : _cookies3.value)
|
|
662
|
-
});
|
|
663
|
-
case 5:
|
|
664
|
-
res = _context24.v;
|
|
665
|
-
if (!(res.status === 200 && "content" in res.json)) {
|
|
666
|
-
_context24.n = 6;
|
|
667
|
-
break;
|
|
668
|
-
}
|
|
669
|
-
return _context24.a(2, {
|
|
670
|
-
status: "content",
|
|
671
|
-
content: res.json.content
|
|
672
|
-
});
|
|
673
|
-
case 6:
|
|
674
|
-
if (!(res.status === 401)) {
|
|
675
|
-
_context24.n = 7;
|
|
676
|
-
break;
|
|
677
|
-
}
|
|
678
|
-
core.Internal.log.debug("authentication error: ", res.json.message);
|
|
679
|
-
return _context24.a(2, {
|
|
680
|
-
status: "unavailable"
|
|
681
|
-
});
|
|
682
|
-
case 7:
|
|
683
|
-
if (!(res.status === 404)) {
|
|
684
|
-
_context24.n = 8;
|
|
685
|
-
break;
|
|
686
|
-
}
|
|
687
|
-
return _context24.a(2, {
|
|
688
|
-
status: "absent"
|
|
689
|
-
});
|
|
690
|
-
case 8:
|
|
691
|
-
core.Internal.log.error("could not load draft JSON entry: ", "message" in res.json ? res.json.message : "status ".concat(res.status));
|
|
692
|
-
return _context24.a(2, {
|
|
693
|
-
status: "unavailable"
|
|
694
|
-
});
|
|
695
|
-
}
|
|
696
|
-
}, _callee24, null, [[0, 2]]);
|
|
697
|
-
}));
|
|
698
|
-
return _loadDraftJsonEntry.apply(this, arguments);
|
|
699
|
-
}
|
|
700
|
-
var initFetchValKeyStega = function initFetchValKeyStega(valServerPromise, isEnabled, getCookies) {
|
|
163
|
+
var initFetchValKeyStega = function initFetchValKeyStega(deps) {
|
|
701
164
|
return /*#__PURE__*/function () {
|
|
702
|
-
var
|
|
703
|
-
var
|
|
704
|
-
return asyncToGenerator._regenerator().w(function (
|
|
705
|
-
while (1) switch (
|
|
165
|
+
var _ref3 = asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function _callee3(selector, key) {
|
|
166
|
+
var _yield$draftForReques2, enabled, draft, env;
|
|
167
|
+
return asyncToGenerator._regenerator().w(function (_context3) {
|
|
168
|
+
while (1) switch (_context3.n) {
|
|
706
169
|
case 0:
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
enabled = _context5.v;
|
|
713
|
-
_context5.n = 4;
|
|
714
|
-
break;
|
|
715
|
-
case 3:
|
|
716
|
-
_context5.p = 3;
|
|
717
|
-
_context5.v;
|
|
718
|
-
case 4:
|
|
719
|
-
// A view is a pointer: everything below reads a path and a source off this,
|
|
720
|
-
// and a pointer has neither. See `resolveViewedModule`.
|
|
721
|
-
valModule = core.Internal.resolveViewedModule(selector);
|
|
722
|
-
source = valModule && core.Internal.getSource(valModule);
|
|
723
|
-
moduleFilePath = valModule && core.Internal.getValPath(valModule);
|
|
724
|
-
draft = {
|
|
725
|
-
status: "unavailable"
|
|
726
|
-
};
|
|
727
|
-
if (!(enabled && moduleFilePath)) {
|
|
728
|
-
_context5.n = 6;
|
|
729
|
-
break;
|
|
730
|
-
}
|
|
731
|
-
stega.SET_AUTO_TAG_JSX_ENABLED(true);
|
|
732
|
-
_context5.n = 5;
|
|
733
|
-
return loadDraftJsonEntry(valServerPromise, getCookies, moduleFilePath, key);
|
|
734
|
-
case 5:
|
|
735
|
-
draft = _context5.v;
|
|
736
|
-
case 6:
|
|
737
|
-
_context5.n = 7;
|
|
738
|
-
return resolveDraftOrCommittedEntry(draft, function () {
|
|
739
|
-
return loadJsonEntryContent(source, key);
|
|
170
|
+
_context3.n = 1;
|
|
171
|
+
return internal.draftForRequest({
|
|
172
|
+
runtime: deps.runtime,
|
|
173
|
+
isEnabled: deps.isEnabled,
|
|
174
|
+
getCookies: deps.getCookies
|
|
740
175
|
});
|
|
741
|
-
case
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
return
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
176
|
+
case 1:
|
|
177
|
+
_yield$draftForReques2 = _context3.v;
|
|
178
|
+
enabled = _yield$draftForReques2.enabled;
|
|
179
|
+
draft = _yield$draftForReques2.draft;
|
|
180
|
+
env = requestEnv(enabled, draft);
|
|
181
|
+
_context3.n = 2;
|
|
182
|
+
return internal$1.awaitResolved(function (settled) {
|
|
183
|
+
return internal$1.resolveValEntry(selector, key, env, {
|
|
184
|
+
settled: settled
|
|
185
|
+
});
|
|
186
|
+
});
|
|
187
|
+
case 2:
|
|
188
|
+
return _context3.a(2, _context3.v.value);
|
|
753
189
|
}
|
|
754
|
-
},
|
|
190
|
+
}, _callee3);
|
|
755
191
|
}));
|
|
756
|
-
return function (
|
|
757
|
-
return
|
|
192
|
+
return function (_x5, _x6) {
|
|
193
|
+
return _ref3.apply(this, arguments);
|
|
758
194
|
};
|
|
759
195
|
}();
|
|
760
196
|
};
|
|
761
|
-
var initFetchValRouteUrl = function initFetchValRouteUrl(
|
|
197
|
+
var initFetchValRouteUrl = function initFetchValRouteUrl(deps) {
|
|
198
|
+
var fetchVal = fetchValWithReads(deps);
|
|
762
199
|
return /*#__PURE__*/function () {
|
|
763
|
-
var
|
|
764
|
-
var
|
|
765
|
-
return asyncToGenerator._regenerator().w(function (
|
|
766
|
-
while (1) switch (
|
|
200
|
+
var _ref4 = asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function _callee4(selector, params) {
|
|
201
|
+
var resolvedParams, valModule, val, _t2, _t3;
|
|
202
|
+
return asyncToGenerator._regenerator().w(function (_context4) {
|
|
203
|
+
while (1) switch (_context4.n) {
|
|
767
204
|
case 0:
|
|
768
|
-
fetchVal = initFetchValStega(config, valApiEndpoints, valServerPromise, isEnabled, getHeaders, getCookies, getDraftSourcesScope);
|
|
769
205
|
if (!(params === undefined)) {
|
|
770
|
-
|
|
206
|
+
_context4.n = 1;
|
|
771
207
|
break;
|
|
772
208
|
}
|
|
773
|
-
|
|
774
|
-
|
|
209
|
+
_t2 = undefined;
|
|
210
|
+
_context4.n = 3;
|
|
775
211
|
break;
|
|
776
212
|
case 1:
|
|
777
|
-
|
|
213
|
+
_context4.n = 2;
|
|
778
214
|
return Promise.resolve(params);
|
|
779
215
|
case 2:
|
|
780
|
-
|
|
216
|
+
_t2 = _context4.v;
|
|
781
217
|
case 3:
|
|
782
|
-
resolvedParams =
|
|
218
|
+
resolvedParams = _t2;
|
|
783
219
|
// A view is a pointer: everything below reads a path, a schema and a source
|
|
784
220
|
// off this, and a pointer has none of them. See `resolveViewedModule`.
|
|
785
|
-
valModule = core.Internal.resolveViewedModule(selector);
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
_context6.n = 5;
|
|
221
|
+
valModule = core.Internal.resolveViewedModule(selector); // The url is made of the params and the module's path: a `.jsonValues()`
|
|
222
|
+
// router's entries are not imported for it.
|
|
223
|
+
_t3 = valModule;
|
|
224
|
+
if (!_t3) {
|
|
225
|
+
_context4.n = 5;
|
|
791
226
|
break;
|
|
792
227
|
}
|
|
793
|
-
|
|
794
|
-
return fetchVal(valModule
|
|
228
|
+
_context4.n = 4;
|
|
229
|
+
return fetchVal(valModule, {
|
|
230
|
+
entries: false
|
|
231
|
+
});
|
|
795
232
|
case 4:
|
|
796
|
-
|
|
233
|
+
_t3 = _context4.v.value;
|
|
797
234
|
case 5:
|
|
798
|
-
val =
|
|
799
|
-
|
|
800
|
-
return _context6.a(2, route);
|
|
235
|
+
val = _t3;
|
|
236
|
+
return _context4.a(2, routeFromVal.getValRouteUrlFromVal(resolvedParams, "fetchValRouteUrl", valModule && core.Internal.getValPath(valModule), valModule && core.Internal.getSchema(valModule), val));
|
|
801
237
|
}
|
|
802
|
-
},
|
|
238
|
+
}, _callee4);
|
|
803
239
|
}));
|
|
804
|
-
return function (
|
|
805
|
-
return
|
|
240
|
+
return function (_x7, _x8) {
|
|
241
|
+
return _ref4.apply(this, arguments);
|
|
806
242
|
};
|
|
807
243
|
}();
|
|
808
244
|
};
|
|
809
|
-
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* The draft a page in this request should start from, or `null` for none:
|
|
248
|
+
* what `<ValProvider draft>` takes. See `ValDraft`.
|
|
249
|
+
*
|
|
250
|
+
* `null` -- and no read at all -- unless the request is in draft mode: a
|
|
251
|
+
* visitor pays one `draftMode()` lookup, which does not make a static route
|
|
252
|
+
* dynamic. In draft mode it is the source of every module the editor's draft
|
|
253
|
+
* changes, from the runtime's head -- the one every `fetchVal` reads -- so
|
|
254
|
+
* the server renders the draft and the browser hydrates the same thing, with
|
|
255
|
+
* the version of each, so the page compares versions with what the Studio
|
|
256
|
+
* relays rather than content. Also `null` when the session is not one Val
|
|
257
|
+
* accepts, or the draft could not be read (logged): the published page.
|
|
258
|
+
*
|
|
259
|
+
* The read is `readDraftChanges` in `@valbuild/server`, which
|
|
260
|
+
* `@valbuild/tanstack/server`'s `fetchValDraft` is too; only where draft mode
|
|
261
|
+
* and the cookies come from is Next's.
|
|
262
|
+
*/
|
|
263
|
+
var initFetchValDraft = function initFetchValDraft(deps) {
|
|
264
|
+
return /*#__PURE__*/asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function _callee5() {
|
|
265
|
+
var changes;
|
|
266
|
+
return asyncToGenerator._regenerator().w(function (_context5) {
|
|
267
|
+
while (1) switch (_context5.n) {
|
|
268
|
+
case 0:
|
|
269
|
+
_context5.n = 1;
|
|
270
|
+
return internal.readDraftChanges(deps);
|
|
271
|
+
case 1:
|
|
272
|
+
changes = _context5.v;
|
|
273
|
+
return _context5.a(2, changes === null ? null : {
|
|
274
|
+
sources: changes.sources,
|
|
275
|
+
versions: changes.versions
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
}, _callee5);
|
|
279
|
+
}));
|
|
280
|
+
};
|
|
810
281
|
function initValRsc(config, valModules, rscNextConfig) {
|
|
811
282
|
var coreVersion = core.Internal.VERSION.core;
|
|
812
283
|
if (!coreVersion) {
|
|
@@ -816,175 +287,75 @@ function initValRsc(config, valModules, rscNextConfig) {
|
|
|
816
287
|
if (!nextVersion) {
|
|
817
288
|
throw new Error("Could not get @valbuild/next package version");
|
|
818
289
|
}
|
|
819
|
-
|
|
820
|
-
|
|
290
|
+
// One runtime per process for these modules: the API route's server is
|
|
291
|
+
// built on the same one, so a save through it moves what these read.
|
|
292
|
+
var runtime = internal.createValRuntime(valModules, "/api/val", objectSpread2._objectSpread2({
|
|
821
293
|
versions: {
|
|
822
294
|
next: nextVersion,
|
|
823
295
|
core: coreVersion,
|
|
824
296
|
framework: "next"
|
|
825
297
|
}
|
|
826
|
-
}, config), config
|
|
827
|
-
|
|
828
|
-
|
|
298
|
+
}, config), config);
|
|
299
|
+
var deps = {
|
|
300
|
+
runtime: runtime,
|
|
301
|
+
isEnabled: function () {
|
|
302
|
+
var _isEnabled = asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function _callee6() {
|
|
303
|
+
return asyncToGenerator._regenerator().w(function (_context6) {
|
|
304
|
+
while (1) switch (_context6.n) {
|
|
305
|
+
case 0:
|
|
306
|
+
_context6.n = 1;
|
|
307
|
+
return rscNextConfig.draftMode();
|
|
308
|
+
case 1:
|
|
309
|
+
return _context6.a(2, _context6.v.isEnabled);
|
|
310
|
+
}
|
|
311
|
+
}, _callee6);
|
|
312
|
+
}));
|
|
313
|
+
function isEnabled() {
|
|
314
|
+
return _isEnabled.apply(this, arguments);
|
|
315
|
+
}
|
|
316
|
+
return isEnabled;
|
|
317
|
+
}(),
|
|
318
|
+
getHeaders: function () {
|
|
319
|
+
var _getHeaders = asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function _callee7() {
|
|
829
320
|
return asyncToGenerator._regenerator().w(function (_context7) {
|
|
830
321
|
while (1) switch (_context7.n) {
|
|
831
322
|
case 0:
|
|
832
323
|
_context7.n = 1;
|
|
833
|
-
return rscNextConfig.
|
|
324
|
+
return rscNextConfig.headers();
|
|
834
325
|
case 1:
|
|
835
|
-
return _context7.a(2, _context7.v
|
|
326
|
+
return _context7.a(2, _context7.v);
|
|
836
327
|
}
|
|
837
328
|
}, _callee7);
|
|
838
|
-
}))
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
329
|
+
}));
|
|
330
|
+
function getHeaders() {
|
|
331
|
+
return _getHeaders.apply(this, arguments);
|
|
332
|
+
}
|
|
333
|
+
return getHeaders;
|
|
334
|
+
}(),
|
|
335
|
+
getCookies: function () {
|
|
336
|
+
var _getCookies = asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function _callee8() {
|
|
842
337
|
return asyncToGenerator._regenerator().w(function (_context8) {
|
|
843
338
|
while (1) switch (_context8.n) {
|
|
844
339
|
case 0:
|
|
845
340
|
_context8.n = 1;
|
|
846
|
-
return rscNextConfig.
|
|
341
|
+
return rscNextConfig.cookies();
|
|
847
342
|
case 1:
|
|
848
|
-
_context8.v
|
|
849
|
-
case 2:
|
|
850
|
-
return _context8.a(2);
|
|
343
|
+
return _context8.a(2, _context8.v);
|
|
851
344
|
}
|
|
852
345
|
}, _callee8);
|
|
853
|
-
}))
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
_context9.n = 1;
|
|
861
|
-
return rscNextConfig.draftMode();
|
|
862
|
-
case 1:
|
|
863
|
-
_context9.v.disable();
|
|
864
|
-
case 2:
|
|
865
|
-
return _context9.a(2);
|
|
866
|
-
}
|
|
867
|
-
}, _callee9);
|
|
868
|
-
}))();
|
|
869
|
-
}
|
|
870
|
-
});
|
|
346
|
+
}));
|
|
347
|
+
function getCookies() {
|
|
348
|
+
return _getCookies.apply(this, arguments);
|
|
349
|
+
}
|
|
350
|
+
return getCookies;
|
|
351
|
+
}()
|
|
352
|
+
};
|
|
871
353
|
return {
|
|
872
|
-
fetchValStega: initFetchValStega(
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
case 0:
|
|
878
|
-
_context0.n = 1;
|
|
879
|
-
return rscNextConfig.draftMode();
|
|
880
|
-
case 1:
|
|
881
|
-
return _context0.a(2, _context0.v.isEnabled);
|
|
882
|
-
}
|
|
883
|
-
}, _callee0);
|
|
884
|
-
})), /*#__PURE__*/asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function _callee1() {
|
|
885
|
-
return asyncToGenerator._regenerator().w(function (_context1) {
|
|
886
|
-
while (1) switch (_context1.n) {
|
|
887
|
-
case 0:
|
|
888
|
-
_context1.n = 1;
|
|
889
|
-
return rscNextConfig.headers();
|
|
890
|
-
case 1:
|
|
891
|
-
return _context1.a(2, _context1.v);
|
|
892
|
-
}
|
|
893
|
-
}, _callee1);
|
|
894
|
-
})), /*#__PURE__*/asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function _callee10() {
|
|
895
|
-
return asyncToGenerator._regenerator().w(function (_context10) {
|
|
896
|
-
while (1) switch (_context10.n) {
|
|
897
|
-
case 0:
|
|
898
|
-
_context10.n = 1;
|
|
899
|
-
return rscNextConfig.cookies();
|
|
900
|
-
case 1:
|
|
901
|
-
return _context10.a(2, _context10.v);
|
|
902
|
-
}
|
|
903
|
-
}, _callee10);
|
|
904
|
-
})), draftSourcesScope),
|
|
905
|
-
fetchValKeyStega: initFetchValKeyStega(valServerPromise, /*#__PURE__*/asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function _callee11() {
|
|
906
|
-
return asyncToGenerator._regenerator().w(function (_context11) {
|
|
907
|
-
while (1) switch (_context11.n) {
|
|
908
|
-
case 0:
|
|
909
|
-
_context11.n = 1;
|
|
910
|
-
return rscNextConfig.draftMode();
|
|
911
|
-
case 1:
|
|
912
|
-
return _context11.a(2, _context11.v.isEnabled);
|
|
913
|
-
}
|
|
914
|
-
}, _callee11);
|
|
915
|
-
})), /*#__PURE__*/asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function _callee12() {
|
|
916
|
-
return asyncToGenerator._regenerator().w(function (_context12) {
|
|
917
|
-
while (1) switch (_context12.n) {
|
|
918
|
-
case 0:
|
|
919
|
-
_context12.n = 1;
|
|
920
|
-
return rscNextConfig.cookies();
|
|
921
|
-
case 1:
|
|
922
|
-
return _context12.a(2, _context12.v);
|
|
923
|
-
}
|
|
924
|
-
}, _callee12);
|
|
925
|
-
}))),
|
|
926
|
-
fetchValRouteStega: initFetchValRouteStega(config, valApiEndpoints, valServerPromise, /*#__PURE__*/asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function _callee13() {
|
|
927
|
-
return asyncToGenerator._regenerator().w(function (_context13) {
|
|
928
|
-
while (1) switch (_context13.n) {
|
|
929
|
-
case 0:
|
|
930
|
-
_context13.n = 1;
|
|
931
|
-
return rscNextConfig.draftMode();
|
|
932
|
-
case 1:
|
|
933
|
-
return _context13.a(2, _context13.v.isEnabled);
|
|
934
|
-
}
|
|
935
|
-
}, _callee13);
|
|
936
|
-
})), /*#__PURE__*/asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function _callee14() {
|
|
937
|
-
return asyncToGenerator._regenerator().w(function (_context14) {
|
|
938
|
-
while (1) switch (_context14.n) {
|
|
939
|
-
case 0:
|
|
940
|
-
_context14.n = 1;
|
|
941
|
-
return rscNextConfig.headers();
|
|
942
|
-
case 1:
|
|
943
|
-
return _context14.a(2, _context14.v);
|
|
944
|
-
}
|
|
945
|
-
}, _callee14);
|
|
946
|
-
})), /*#__PURE__*/asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function _callee15() {
|
|
947
|
-
return asyncToGenerator._regenerator().w(function (_context15) {
|
|
948
|
-
while (1) switch (_context15.n) {
|
|
949
|
-
case 0:
|
|
950
|
-
_context15.n = 1;
|
|
951
|
-
return rscNextConfig.cookies();
|
|
952
|
-
case 1:
|
|
953
|
-
return _context15.a(2, _context15.v);
|
|
954
|
-
}
|
|
955
|
-
}, _callee15);
|
|
956
|
-
})), draftSourcesScope),
|
|
957
|
-
fetchValRouteUrl: initFetchValRouteUrl(config, valApiEndpoints, valServerPromise, /*#__PURE__*/asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function _callee16() {
|
|
958
|
-
return asyncToGenerator._regenerator().w(function (_context16) {
|
|
959
|
-
while (1) switch (_context16.n) {
|
|
960
|
-
case 0:
|
|
961
|
-
_context16.n = 1;
|
|
962
|
-
return rscNextConfig.draftMode();
|
|
963
|
-
case 1:
|
|
964
|
-
return _context16.a(2, _context16.v.isEnabled);
|
|
965
|
-
}
|
|
966
|
-
}, _callee16);
|
|
967
|
-
})), /*#__PURE__*/asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function _callee17() {
|
|
968
|
-
return asyncToGenerator._regenerator().w(function (_context17) {
|
|
969
|
-
while (1) switch (_context17.n) {
|
|
970
|
-
case 0:
|
|
971
|
-
_context17.n = 1;
|
|
972
|
-
return rscNextConfig.headers();
|
|
973
|
-
case 1:
|
|
974
|
-
return _context17.a(2, _context17.v);
|
|
975
|
-
}
|
|
976
|
-
}, _callee17);
|
|
977
|
-
})), /*#__PURE__*/asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function _callee18() {
|
|
978
|
-
return asyncToGenerator._regenerator().w(function (_context18) {
|
|
979
|
-
while (1) switch (_context18.n) {
|
|
980
|
-
case 0:
|
|
981
|
-
_context18.n = 1;
|
|
982
|
-
return rscNextConfig.cookies();
|
|
983
|
-
case 1:
|
|
984
|
-
return _context18.a(2, _context18.v);
|
|
985
|
-
}
|
|
986
|
-
}, _callee18);
|
|
987
|
-
})), draftSourcesScope)
|
|
354
|
+
fetchValStega: initFetchValStega(deps),
|
|
355
|
+
fetchValKeyStega: initFetchValKeyStega(deps),
|
|
356
|
+
fetchValRouteStega: initFetchValRouteStega(deps),
|
|
357
|
+
fetchValRouteUrl: initFetchValRouteUrl(deps),
|
|
358
|
+
fetchValDraft: initFetchValDraft(deps)
|
|
988
359
|
};
|
|
989
360
|
}
|
|
990
361
|
|