houdini 1.2.10 → 1.2.11
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/build/cmd-cjs/index.js +24 -18
- package/build/cmd-esm/index.js +26 -20
- package/build/codegen-cjs/index.js +22 -16
- package/build/codegen-esm/index.js +24 -18
- package/build/lib/index.d.ts +1 -1
- package/build/lib/types.d.ts +1 -1
- package/build/lib-cjs/index.js +272 -17
- package/build/lib-esm/index.js +272 -19
- package/build/{lib/router → router}/conventions.d.ts +1 -1
- package/build/{lib/router → router}/index.d.ts +1 -0
- package/build/{lib/router → router}/manifest.d.ts +1 -1
- package/build/{lib/router → router}/types.d.ts +1 -1
- package/build/router-cjs/index.js +72353 -0
- package/build/router-cjs/package.json +1 -0
- package/build/router-esm/index.js +72345 -0
- package/build/router-esm/package.json +1 -0
- package/build/runtime/router/cookies.d.ts +41 -0
- package/build/runtime/router/jwt.d.ts +117 -0
- package/build/runtime/router/server.d.ts +25 -0
- package/build/runtime-cjs/router/cookies.d.ts +41 -0
- package/build/runtime-cjs/router/cookies.js +168 -0
- package/build/runtime-cjs/router/jwt.d.ts +117 -0
- package/build/runtime-cjs/router/jwt.js +181 -0
- package/build/runtime-cjs/router/server.d.ts +25 -0
- package/build/runtime-cjs/router/server.js +78 -0
- package/build/runtime-esm/router/cookies.d.ts +41 -0
- package/build/runtime-esm/router/cookies.js +143 -0
- package/build/runtime-esm/router/jwt.d.ts +117 -0
- package/build/runtime-esm/router/jwt.js +155 -0
- package/build/runtime-esm/router/server.d.ts +25 -0
- package/build/runtime-esm/router/server.js +53 -0
- package/build/test-cjs/index.js +22 -16
- package/build/test-esm/index.js +24 -18
- package/build/vite-cjs/index.js +38 -30
- package/build/vite-esm/index.js +40 -32
- package/package.json +9 -1
package/build/lib-cjs/index.js
CHANGED
|
@@ -1478,7 +1478,7 @@ var require_parser = __commonJS({
|
|
|
1478
1478
|
Object.defineProperty(exports, "__esModule", {
|
|
1479
1479
|
value: true
|
|
1480
1480
|
});
|
|
1481
|
-
exports.parse =
|
|
1481
|
+
exports.parse = parse6;
|
|
1482
1482
|
exports.parseValue = parseValue;
|
|
1483
1483
|
exports.parseType = parseType;
|
|
1484
1484
|
exports.Parser = void 0;
|
|
@@ -1489,7 +1489,7 @@ var require_parser = __commonJS({
|
|
|
1489
1489
|
var _source = require_source();
|
|
1490
1490
|
var _directiveLocation = require_directiveLocation();
|
|
1491
1491
|
var _lexer = require_lexer();
|
|
1492
|
-
function
|
|
1492
|
+
function parse6(source, options) {
|
|
1493
1493
|
var parser = new Parser(source, options);
|
|
1494
1494
|
return parser.parseDocument();
|
|
1495
1495
|
}
|
|
@@ -32881,14 +32881,14 @@ var require_lib3 = __commonJS({
|
|
|
32881
32881
|
super.checkParams(node, false, true);
|
|
32882
32882
|
this.scope.exit();
|
|
32883
32883
|
}
|
|
32884
|
-
forwardNoArrowParamsConversionAt(node,
|
|
32884
|
+
forwardNoArrowParamsConversionAt(node, parse7) {
|
|
32885
32885
|
let result;
|
|
32886
32886
|
if (this.state.noArrowParamsConversionAt.indexOf(node.start) !== -1) {
|
|
32887
32887
|
this.state.noArrowParamsConversionAt.push(this.state.start);
|
|
32888
|
-
result =
|
|
32888
|
+
result = parse7();
|
|
32889
32889
|
this.state.noArrowParamsConversionAt.pop();
|
|
32890
32890
|
} else {
|
|
32891
|
-
result =
|
|
32891
|
+
result = parse7();
|
|
32892
32892
|
}
|
|
32893
32893
|
return result;
|
|
32894
32894
|
}
|
|
@@ -41943,7 +41943,7 @@ var require_lib3 = __commonJS({
|
|
|
41943
41943
|
}
|
|
41944
41944
|
return pluginMap;
|
|
41945
41945
|
}
|
|
41946
|
-
function
|
|
41946
|
+
function parse6(input, options) {
|
|
41947
41947
|
var _options;
|
|
41948
41948
|
if (((_options = options) == null ? void 0 : _options.sourceType) === "unambiguous") {
|
|
41949
41949
|
options = Object.assign({}, options);
|
|
@@ -42013,7 +42013,7 @@ var require_lib3 = __commonJS({
|
|
|
42013
42013
|
}
|
|
42014
42014
|
return cls;
|
|
42015
42015
|
}
|
|
42016
|
-
exports.parse =
|
|
42016
|
+
exports.parse = parse6;
|
|
42017
42017
|
exports.parseExpression = parseExpression;
|
|
42018
42018
|
exports.tokTypes = tokTypes;
|
|
42019
42019
|
}
|
|
@@ -47959,7 +47959,7 @@ var require_esprima2 = __commonJS({
|
|
|
47959
47959
|
var jsx_parser_1 = __webpack_require__(3);
|
|
47960
47960
|
var parser_1 = __webpack_require__(8);
|
|
47961
47961
|
var tokenizer_1 = __webpack_require__(15);
|
|
47962
|
-
function
|
|
47962
|
+
function parse6(code, options, delegate) {
|
|
47963
47963
|
var commentHandler = null;
|
|
47964
47964
|
var proxyDelegate = function(node, metadata) {
|
|
47965
47965
|
if (delegate) {
|
|
@@ -48004,17 +48004,17 @@ var require_esprima2 = __commonJS({
|
|
|
48004
48004
|
}
|
|
48005
48005
|
return ast;
|
|
48006
48006
|
}
|
|
48007
|
-
exports2.parse =
|
|
48007
|
+
exports2.parse = parse6;
|
|
48008
48008
|
function parseModule(code, options, delegate) {
|
|
48009
48009
|
var parsingOptions = options || {};
|
|
48010
48010
|
parsingOptions.sourceType = "module";
|
|
48011
|
-
return
|
|
48011
|
+
return parse6(code, parsingOptions, delegate);
|
|
48012
48012
|
}
|
|
48013
48013
|
exports2.parseModule = parseModule;
|
|
48014
48014
|
function parseScript(code, options, delegate) {
|
|
48015
48015
|
var parsingOptions = options || {};
|
|
48016
48016
|
parsingOptions.sourceType = "script";
|
|
48017
|
-
return
|
|
48017
|
+
return parse6(code, parsingOptions, delegate);
|
|
48018
48018
|
}
|
|
48019
48019
|
exports2.parseScript = parseScript;
|
|
48020
48020
|
function tokenize(code, options, delegate) {
|
|
@@ -54078,7 +54078,7 @@ var require_esprima3 = __commonJS({
|
|
|
54078
54078
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54079
54079
|
exports.parse = void 0;
|
|
54080
54080
|
var util_1 = require_util2();
|
|
54081
|
-
function
|
|
54081
|
+
function parse6(source, options) {
|
|
54082
54082
|
var comments = [];
|
|
54083
54083
|
var ast = require_esprima2().parse(source, {
|
|
54084
54084
|
loc: true,
|
|
@@ -54096,7 +54096,7 @@ var require_esprima3 = __commonJS({
|
|
|
54096
54096
|
}
|
|
54097
54097
|
return ast;
|
|
54098
54098
|
}
|
|
54099
|
-
exports.parse =
|
|
54099
|
+
exports.parse = parse6;
|
|
54100
54100
|
}
|
|
54101
54101
|
});
|
|
54102
54102
|
|
|
@@ -55218,7 +55218,7 @@ var require_parser2 = __commonJS({
|
|
|
55218
55218
|
var lines_1 = require_lines();
|
|
55219
55219
|
var comments_1 = require_comments();
|
|
55220
55220
|
var util = tslib_1.__importStar(require_util2());
|
|
55221
|
-
function
|
|
55221
|
+
function parse6(source, options) {
|
|
55222
55222
|
options = (0, options_1.normalize)(options);
|
|
55223
55223
|
var lines = (0, lines_1.fromString)(source, options);
|
|
55224
55224
|
var sourceWithoutTabs = lines.toString({
|
|
@@ -55290,7 +55290,7 @@ var require_parser2 = __commonJS({
|
|
|
55290
55290
|
(0, comments_1.attach)(comments, program.body.length ? file.program : file, lines);
|
|
55291
55291
|
return new TreeCopier(lines, tokens).copy(file);
|
|
55292
55292
|
}
|
|
55293
|
-
exports.parse =
|
|
55293
|
+
exports.parse = parse6;
|
|
55294
55294
|
var TreeCopier = function TreeCopier2(lines, tokens) {
|
|
55295
55295
|
assert_1.default.ok(this instanceof TreeCopier2);
|
|
55296
55296
|
this.lines = lines;
|
|
@@ -73302,6 +73302,8 @@ __export(lib_exports, {
|
|
|
73302
73302
|
getCurrentConfig: () => getCurrentConfig,
|
|
73303
73303
|
getMockConfig: () => getMockConfig,
|
|
73304
73304
|
getRootType: () => getRootType,
|
|
73305
|
+
get_session: () => get_session,
|
|
73306
|
+
handle_request: () => handle_request,
|
|
73305
73307
|
hashOriginal: () => hashOriginal,
|
|
73306
73308
|
hashRaw: () => hashRaw,
|
|
73307
73309
|
houdini_mode: () => houdini_mode,
|
|
@@ -82833,7 +82835,7 @@ async function find_graphql(config2, parsedScript, walker) {
|
|
|
82833
82835
|
});
|
|
82834
82836
|
}
|
|
82835
82837
|
|
|
82836
|
-
// src/
|
|
82838
|
+
// src/router/conventions.ts
|
|
82837
82839
|
var conventions_exports = {};
|
|
82838
82840
|
__export(conventions_exports, {
|
|
82839
82841
|
fallback_unit_path: () => fallback_unit_path,
|
|
@@ -82951,7 +82953,7 @@ function serialized_manifest_path(config2, base = base_dir(config2)) {
|
|
|
82951
82953
|
return path_exports.join(base, "manifest.json");
|
|
82952
82954
|
}
|
|
82953
82955
|
|
|
82954
|
-
// src/
|
|
82956
|
+
// src/router/manifest.ts
|
|
82955
82957
|
var t2 = __toESM(require_lib6(), 1);
|
|
82956
82958
|
var graphql5 = __toESM(require_graphql2(), 1);
|
|
82957
82959
|
async function load_manifest(args) {
|
|
@@ -83159,6 +83161,251 @@ async function extractQueries(source) {
|
|
|
83159
83161
|
}
|
|
83160
83162
|
return props.filter((p) => p !== "children");
|
|
83161
83163
|
}
|
|
83164
|
+
|
|
83165
|
+
// src/runtime/router/cookies.ts
|
|
83166
|
+
function parse5(str, options) {
|
|
83167
|
+
if (typeof str !== "string") {
|
|
83168
|
+
throw new TypeError("argument str must be a string");
|
|
83169
|
+
}
|
|
83170
|
+
let obj = {};
|
|
83171
|
+
let opt = options || {};
|
|
83172
|
+
let dec = opt.decode || decode;
|
|
83173
|
+
let index = 0;
|
|
83174
|
+
while (index < str.length) {
|
|
83175
|
+
let eqIdx = str.indexOf("=", index);
|
|
83176
|
+
if (eqIdx === -1) {
|
|
83177
|
+
break;
|
|
83178
|
+
}
|
|
83179
|
+
let endIdx = str.indexOf(";", index);
|
|
83180
|
+
if (endIdx === -1) {
|
|
83181
|
+
endIdx = str.length;
|
|
83182
|
+
} else if (endIdx < eqIdx) {
|
|
83183
|
+
index = str.lastIndexOf(";", eqIdx - 1) + 1;
|
|
83184
|
+
continue;
|
|
83185
|
+
}
|
|
83186
|
+
let key = str.slice(index, eqIdx).trim();
|
|
83187
|
+
if (void 0 === obj[key]) {
|
|
83188
|
+
let val = str.slice(eqIdx + 1, endIdx).trim();
|
|
83189
|
+
if (val.charCodeAt(0) === 34) {
|
|
83190
|
+
val = val.slice(1, -1);
|
|
83191
|
+
}
|
|
83192
|
+
obj[key] = tryDecode(val, dec);
|
|
83193
|
+
}
|
|
83194
|
+
index = endIdx + 1;
|
|
83195
|
+
}
|
|
83196
|
+
return obj;
|
|
83197
|
+
}
|
|
83198
|
+
function decode(str) {
|
|
83199
|
+
return str.indexOf("%") !== -1 ? decodeURIComponent(str) : str;
|
|
83200
|
+
}
|
|
83201
|
+
function tryDecode(str, decode3) {
|
|
83202
|
+
try {
|
|
83203
|
+
return decode3(str);
|
|
83204
|
+
} catch (e2) {
|
|
83205
|
+
return str;
|
|
83206
|
+
}
|
|
83207
|
+
}
|
|
83208
|
+
|
|
83209
|
+
// src/runtime/router/jwt.ts
|
|
83210
|
+
function base64UrlParse(s2) {
|
|
83211
|
+
return new Uint8Array(
|
|
83212
|
+
Array.prototype.map.call(
|
|
83213
|
+
atob(s2.replace(/-/g, "+").replace(/_/g, "/").replace(/\s/g, "")),
|
|
83214
|
+
(c) => c.charCodeAt(0)
|
|
83215
|
+
)
|
|
83216
|
+
);
|
|
83217
|
+
}
|
|
83218
|
+
function base64UrlStringify(a) {
|
|
83219
|
+
return btoa(String.fromCharCode.apply(0, a)).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
|
|
83220
|
+
}
|
|
83221
|
+
var algorithms = {
|
|
83222
|
+
ES256: { name: "ECDSA", namedCurve: "P-256", hash: { name: "SHA-256" } },
|
|
83223
|
+
ES384: { name: "ECDSA", namedCurve: "P-384", hash: { name: "SHA-384" } },
|
|
83224
|
+
ES512: { name: "ECDSA", namedCurve: "P-521", hash: { name: "SHA-512" } },
|
|
83225
|
+
HS256: { name: "HMAC", hash: { name: "SHA-256" } },
|
|
83226
|
+
HS384: { name: "HMAC", hash: { name: "SHA-384" } },
|
|
83227
|
+
HS512: { name: "HMAC", hash: { name: "SHA-512" } },
|
|
83228
|
+
RS256: { name: "RSASSA-PKCS1-v1_5", hash: { name: "SHA-256" } },
|
|
83229
|
+
RS384: { name: "RSASSA-PKCS1-v1_5", hash: { name: "SHA-384" } },
|
|
83230
|
+
RS512: { name: "RSASSA-PKCS1-v1_5", hash: { name: "SHA-512" } }
|
|
83231
|
+
};
|
|
83232
|
+
function _utf8ToUint8Array(str) {
|
|
83233
|
+
return base64UrlParse(btoa(unescape(encodeURIComponent(str))));
|
|
83234
|
+
}
|
|
83235
|
+
function _str2ab(str) {
|
|
83236
|
+
str = atob(str);
|
|
83237
|
+
const buf = new ArrayBuffer(str.length);
|
|
83238
|
+
const bufView = new Uint8Array(buf);
|
|
83239
|
+
for (let i2 = 0, strLen = str.length; i2 < strLen; i2++) {
|
|
83240
|
+
bufView[i2] = str.charCodeAt(i2);
|
|
83241
|
+
}
|
|
83242
|
+
return buf;
|
|
83243
|
+
}
|
|
83244
|
+
function _decodePayload(raw) {
|
|
83245
|
+
switch (raw.length % 4) {
|
|
83246
|
+
case 0:
|
|
83247
|
+
break;
|
|
83248
|
+
case 2:
|
|
83249
|
+
raw += "==";
|
|
83250
|
+
break;
|
|
83251
|
+
case 3:
|
|
83252
|
+
raw += "=";
|
|
83253
|
+
break;
|
|
83254
|
+
default:
|
|
83255
|
+
throw new Error("Illegal base64url string!");
|
|
83256
|
+
}
|
|
83257
|
+
try {
|
|
83258
|
+
return JSON.parse(decodeURIComponent(escape(atob(raw))));
|
|
83259
|
+
} catch {
|
|
83260
|
+
return null;
|
|
83261
|
+
}
|
|
83262
|
+
}
|
|
83263
|
+
async function encode(payload, secret, options = { algorithm: "HS256", header: { typ: "JWT" } }) {
|
|
83264
|
+
if (typeof options === "string")
|
|
83265
|
+
options = { algorithm: options, header: { typ: "JWT" } };
|
|
83266
|
+
options = { algorithm: "HS256", header: { typ: "JWT" }, ...options };
|
|
83267
|
+
if (payload === null || typeof payload !== "object")
|
|
83268
|
+
throw new Error("payload must be an object");
|
|
83269
|
+
if (typeof secret !== "string" && typeof secret !== "object")
|
|
83270
|
+
throw new Error("secret must be a string or a JWK object");
|
|
83271
|
+
if (typeof options.algorithm !== "string")
|
|
83272
|
+
throw new Error("options.algorithm must be a string");
|
|
83273
|
+
const algorithm = algorithms[options.algorithm];
|
|
83274
|
+
if (!algorithm)
|
|
83275
|
+
throw new Error("algorithm not found");
|
|
83276
|
+
if (!payload.iat)
|
|
83277
|
+
payload.iat = Math.floor(Date.now() / 1e3);
|
|
83278
|
+
const payloadAsJSON = JSON.stringify(payload);
|
|
83279
|
+
const partialToken = `${base64UrlStringify(
|
|
83280
|
+
_utf8ToUint8Array(JSON.stringify({ ...options.header, alg: options.algorithm }))
|
|
83281
|
+
)}.${base64UrlStringify(_utf8ToUint8Array(payloadAsJSON))}`;
|
|
83282
|
+
let keyFormat = "raw";
|
|
83283
|
+
let keyData;
|
|
83284
|
+
if (typeof secret === "object") {
|
|
83285
|
+
keyFormat = "jwk";
|
|
83286
|
+
keyData = secret;
|
|
83287
|
+
} else if (typeof secret === "string" && secret.startsWith("-----BEGIN")) {
|
|
83288
|
+
keyFormat = "pkcs8";
|
|
83289
|
+
keyData = _str2ab(
|
|
83290
|
+
secret.replace(/-----BEGIN.*?-----/g, "").replace(/-----END.*?-----/g, "").replace(/\s/g, "")
|
|
83291
|
+
);
|
|
83292
|
+
} else
|
|
83293
|
+
keyData = _utf8ToUint8Array(secret);
|
|
83294
|
+
const key = await crypto.subtle.importKey(keyFormat, keyData, algorithm, false, ["sign"]);
|
|
83295
|
+
const signature = await crypto.subtle.sign(algorithm, key, _utf8ToUint8Array(partialToken));
|
|
83296
|
+
return `${partialToken}.${base64UrlStringify(new Uint8Array(signature))}`;
|
|
83297
|
+
}
|
|
83298
|
+
async function verify(token, secret, options = { algorithm: "HS256", throwError: false }) {
|
|
83299
|
+
if (typeof options === "string")
|
|
83300
|
+
options = { algorithm: options, throwError: false };
|
|
83301
|
+
options = { algorithm: "HS256", throwError: false, ...options };
|
|
83302
|
+
if (typeof token !== "string")
|
|
83303
|
+
throw new Error("token must be a string");
|
|
83304
|
+
if (typeof secret !== "string" && typeof secret !== "object")
|
|
83305
|
+
throw new Error("secret must be a string or a JWK object");
|
|
83306
|
+
if (typeof options.algorithm !== "string")
|
|
83307
|
+
throw new Error("options.algorithm must be a string");
|
|
83308
|
+
const tokenParts = token.split(".");
|
|
83309
|
+
if (tokenParts.length !== 3)
|
|
83310
|
+
throw new Error("token must consist of 3 parts");
|
|
83311
|
+
const algorithm = algorithms[options.algorithm];
|
|
83312
|
+
if (!algorithm)
|
|
83313
|
+
throw new Error("algorithm not found");
|
|
83314
|
+
const { payload } = decode2(token);
|
|
83315
|
+
if (!payload) {
|
|
83316
|
+
if (options.throwError)
|
|
83317
|
+
throw "PARSE_ERROR";
|
|
83318
|
+
return false;
|
|
83319
|
+
}
|
|
83320
|
+
if (payload.nbf && payload.nbf > Math.floor(Date.now() / 1e3)) {
|
|
83321
|
+
if (options.throwError)
|
|
83322
|
+
throw "NOT_YET_VALID";
|
|
83323
|
+
return false;
|
|
83324
|
+
}
|
|
83325
|
+
if (payload.exp && payload.exp <= Math.floor(Date.now() / 1e3)) {
|
|
83326
|
+
if (options.throwError)
|
|
83327
|
+
throw "EXPIRED";
|
|
83328
|
+
return false;
|
|
83329
|
+
}
|
|
83330
|
+
let keyFormat = "raw";
|
|
83331
|
+
let keyData;
|
|
83332
|
+
if (typeof secret === "object") {
|
|
83333
|
+
keyFormat = "jwk";
|
|
83334
|
+
keyData = secret;
|
|
83335
|
+
} else if (typeof secret === "string" && secret.startsWith("-----BEGIN")) {
|
|
83336
|
+
keyFormat = "spki";
|
|
83337
|
+
keyData = _str2ab(
|
|
83338
|
+
secret.replace(/-----BEGIN.*?-----/g, "").replace(/-----END.*?-----/g, "").replace(/\s/g, "")
|
|
83339
|
+
);
|
|
83340
|
+
} else
|
|
83341
|
+
keyData = _utf8ToUint8Array(secret);
|
|
83342
|
+
const key = await crypto.subtle.importKey(keyFormat, keyData, algorithm, false, ["verify"]);
|
|
83343
|
+
return await crypto.subtle.verify(
|
|
83344
|
+
algorithm,
|
|
83345
|
+
key,
|
|
83346
|
+
base64UrlParse(tokenParts[2]),
|
|
83347
|
+
_utf8ToUint8Array(`${tokenParts[0]}.${tokenParts[1]}`)
|
|
83348
|
+
);
|
|
83349
|
+
}
|
|
83350
|
+
function decode2(token) {
|
|
83351
|
+
return {
|
|
83352
|
+
header: _decodePayload(
|
|
83353
|
+
token.split(".")[0].replace(/-/g, "+").replace(/_/g, "/")
|
|
83354
|
+
),
|
|
83355
|
+
payload: _decodePayload(
|
|
83356
|
+
token.split(".")[1].replace(/-/g, "+").replace(/_/g, "/")
|
|
83357
|
+
)
|
|
83358
|
+
};
|
|
83359
|
+
}
|
|
83360
|
+
|
|
83361
|
+
// src/runtime/router/server.ts
|
|
83362
|
+
async function handle_request(args) {
|
|
83363
|
+
const plugin_config = args.config.plugins?.["houdini-react"];
|
|
83364
|
+
if (plugin_config.auth && "redirect" in plugin_config.auth && args.url.startsWith(plugin_config.auth.redirect)) {
|
|
83365
|
+
return await redirect_auth(args);
|
|
83366
|
+
}
|
|
83367
|
+
args.next();
|
|
83368
|
+
}
|
|
83369
|
+
async function redirect_auth(args) {
|
|
83370
|
+
const { searchParams } = new URL(args.url, `http://${args.get_header("host")}`);
|
|
83371
|
+
const { redirectTo, ...session } = Object.fromEntries(searchParams.entries());
|
|
83372
|
+
await set_session(args, session);
|
|
83373
|
+
if (redirectTo) {
|
|
83374
|
+
return args.redirect(302, redirectTo);
|
|
83375
|
+
}
|
|
83376
|
+
args.next();
|
|
83377
|
+
}
|
|
83378
|
+
var session_cookie_name = "__houdini__";
|
|
83379
|
+
async function set_session(req, value) {
|
|
83380
|
+
const today = new Date();
|
|
83381
|
+
const expires = new Date(today.getTime() + 7 * 24 * 60 * 60 * 1e3);
|
|
83382
|
+
const serialized = await encode(value, req.session_keys[0]);
|
|
83383
|
+
req.set_header(
|
|
83384
|
+
"Set-Cookie",
|
|
83385
|
+
`${session_cookie_name}=${serialized}; Path=/; HttpOnly; Secure; SameSite=Lax; Expires=${expires.toUTCString()} `
|
|
83386
|
+
);
|
|
83387
|
+
}
|
|
83388
|
+
async function get_session(req, secrets) {
|
|
83389
|
+
const cookies = req.get("cookie");
|
|
83390
|
+
if (!cookies) {
|
|
83391
|
+
return {};
|
|
83392
|
+
}
|
|
83393
|
+
const cookie = parse5(cookies)[session_cookie_name];
|
|
83394
|
+
if (!cookie) {
|
|
83395
|
+
return {};
|
|
83396
|
+
}
|
|
83397
|
+
for (const secret of secrets) {
|
|
83398
|
+
if (!await verify(cookie, secret)) {
|
|
83399
|
+
continue;
|
|
83400
|
+
}
|
|
83401
|
+
const parsed = decode2(cookie);
|
|
83402
|
+
if (!parsed) {
|
|
83403
|
+
return {};
|
|
83404
|
+
}
|
|
83405
|
+
return parsed.payload;
|
|
83406
|
+
}
|
|
83407
|
+
return {};
|
|
83408
|
+
}
|
|
83162
83409
|
// Annotate the CommonJS export names for ESM import in node:
|
|
83163
83410
|
0 && (module.exports = {
|
|
83164
83411
|
ArtifactKind,
|
|
@@ -83200,6 +83447,8 @@ async function extractQueries(source) {
|
|
|
83200
83447
|
getCurrentConfig,
|
|
83201
83448
|
getMockConfig,
|
|
83202
83449
|
getRootType,
|
|
83450
|
+
get_session,
|
|
83451
|
+
handle_request,
|
|
83203
83452
|
hashOriginal,
|
|
83204
83453
|
hashRaw,
|
|
83205
83454
|
houdini_mode,
|
|
@@ -83227,6 +83476,12 @@ async function extractQueries(source) {
|
|
|
83227
83476
|
unwrapType,
|
|
83228
83477
|
wrapType
|
|
83229
83478
|
});
|
|
83479
|
+
/*!
|
|
83480
|
+
* cookie
|
|
83481
|
+
* Copyright(c) 2012-2014 Roman Shtylman
|
|
83482
|
+
* Copyright(c) 2015 Douglas Christopher Wilson
|
|
83483
|
+
* MIT Licensed
|
|
83484
|
+
*/
|
|
83230
83485
|
/*! fetch-blob. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */
|
|
83231
83486
|
/*! formdata-polyfill. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */
|
|
83232
83487
|
/*! node-domexception. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */
|