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-esm/index.js
CHANGED
|
@@ -1483,7 +1483,7 @@ var require_parser = __commonJS({
|
|
|
1483
1483
|
Object.defineProperty(exports, "__esModule", {
|
|
1484
1484
|
value: true
|
|
1485
1485
|
});
|
|
1486
|
-
exports.parse =
|
|
1486
|
+
exports.parse = parse6;
|
|
1487
1487
|
exports.parseValue = parseValue;
|
|
1488
1488
|
exports.parseType = parseType;
|
|
1489
1489
|
exports.Parser = void 0;
|
|
@@ -1494,7 +1494,7 @@ var require_parser = __commonJS({
|
|
|
1494
1494
|
var _source = require_source();
|
|
1495
1495
|
var _directiveLocation = require_directiveLocation();
|
|
1496
1496
|
var _lexer = require_lexer();
|
|
1497
|
-
function
|
|
1497
|
+
function parse6(source, options) {
|
|
1498
1498
|
var parser = new Parser(source, options);
|
|
1499
1499
|
return parser.parseDocument();
|
|
1500
1500
|
}
|
|
@@ -32886,14 +32886,14 @@ var require_lib3 = __commonJS({
|
|
|
32886
32886
|
super.checkParams(node, false, true);
|
|
32887
32887
|
this.scope.exit();
|
|
32888
32888
|
}
|
|
32889
|
-
forwardNoArrowParamsConversionAt(node,
|
|
32889
|
+
forwardNoArrowParamsConversionAt(node, parse7) {
|
|
32890
32890
|
let result;
|
|
32891
32891
|
if (this.state.noArrowParamsConversionAt.indexOf(node.start) !== -1) {
|
|
32892
32892
|
this.state.noArrowParamsConversionAt.push(this.state.start);
|
|
32893
|
-
result =
|
|
32893
|
+
result = parse7();
|
|
32894
32894
|
this.state.noArrowParamsConversionAt.pop();
|
|
32895
32895
|
} else {
|
|
32896
|
-
result =
|
|
32896
|
+
result = parse7();
|
|
32897
32897
|
}
|
|
32898
32898
|
return result;
|
|
32899
32899
|
}
|
|
@@ -41948,7 +41948,7 @@ var require_lib3 = __commonJS({
|
|
|
41948
41948
|
}
|
|
41949
41949
|
return pluginMap;
|
|
41950
41950
|
}
|
|
41951
|
-
function
|
|
41951
|
+
function parse6(input, options) {
|
|
41952
41952
|
var _options;
|
|
41953
41953
|
if (((_options = options) == null ? void 0 : _options.sourceType) === "unambiguous") {
|
|
41954
41954
|
options = Object.assign({}, options);
|
|
@@ -42018,7 +42018,7 @@ var require_lib3 = __commonJS({
|
|
|
42018
42018
|
}
|
|
42019
42019
|
return cls;
|
|
42020
42020
|
}
|
|
42021
|
-
exports.parse =
|
|
42021
|
+
exports.parse = parse6;
|
|
42022
42022
|
exports.parseExpression = parseExpression;
|
|
42023
42023
|
exports.tokTypes = tokTypes;
|
|
42024
42024
|
}
|
|
@@ -47964,7 +47964,7 @@ var require_esprima2 = __commonJS({
|
|
|
47964
47964
|
var jsx_parser_1 = __webpack_require__(3);
|
|
47965
47965
|
var parser_1 = __webpack_require__(8);
|
|
47966
47966
|
var tokenizer_1 = __webpack_require__(15);
|
|
47967
|
-
function
|
|
47967
|
+
function parse6(code, options, delegate) {
|
|
47968
47968
|
var commentHandler = null;
|
|
47969
47969
|
var proxyDelegate = function(node, metadata) {
|
|
47970
47970
|
if (delegate) {
|
|
@@ -48009,17 +48009,17 @@ var require_esprima2 = __commonJS({
|
|
|
48009
48009
|
}
|
|
48010
48010
|
return ast;
|
|
48011
48011
|
}
|
|
48012
|
-
exports2.parse =
|
|
48012
|
+
exports2.parse = parse6;
|
|
48013
48013
|
function parseModule(code, options, delegate) {
|
|
48014
48014
|
var parsingOptions = options || {};
|
|
48015
48015
|
parsingOptions.sourceType = "module";
|
|
48016
|
-
return
|
|
48016
|
+
return parse6(code, parsingOptions, delegate);
|
|
48017
48017
|
}
|
|
48018
48018
|
exports2.parseModule = parseModule;
|
|
48019
48019
|
function parseScript(code, options, delegate) {
|
|
48020
48020
|
var parsingOptions = options || {};
|
|
48021
48021
|
parsingOptions.sourceType = "script";
|
|
48022
|
-
return
|
|
48022
|
+
return parse6(code, parsingOptions, delegate);
|
|
48023
48023
|
}
|
|
48024
48024
|
exports2.parseScript = parseScript;
|
|
48025
48025
|
function tokenize(code, options, delegate) {
|
|
@@ -54083,7 +54083,7 @@ var require_esprima3 = __commonJS({
|
|
|
54083
54083
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54084
54084
|
exports.parse = void 0;
|
|
54085
54085
|
var util_1 = require_util2();
|
|
54086
|
-
function
|
|
54086
|
+
function parse6(source, options) {
|
|
54087
54087
|
var comments = [];
|
|
54088
54088
|
var ast = require_esprima2().parse(source, {
|
|
54089
54089
|
loc: true,
|
|
@@ -54101,7 +54101,7 @@ var require_esprima3 = __commonJS({
|
|
|
54101
54101
|
}
|
|
54102
54102
|
return ast;
|
|
54103
54103
|
}
|
|
54104
|
-
exports.parse =
|
|
54104
|
+
exports.parse = parse6;
|
|
54105
54105
|
}
|
|
54106
54106
|
});
|
|
54107
54107
|
|
|
@@ -55223,7 +55223,7 @@ var require_parser2 = __commonJS({
|
|
|
55223
55223
|
var lines_1 = require_lines();
|
|
55224
55224
|
var comments_1 = require_comments();
|
|
55225
55225
|
var util = tslib_1.__importStar(require_util2());
|
|
55226
|
-
function
|
|
55226
|
+
function parse6(source, options) {
|
|
55227
55227
|
options = (0, options_1.normalize)(options);
|
|
55228
55228
|
var lines = (0, lines_1.fromString)(source, options);
|
|
55229
55229
|
var sourceWithoutTabs = lines.toString({
|
|
@@ -55295,7 +55295,7 @@ var require_parser2 = __commonJS({
|
|
|
55295
55295
|
(0, comments_1.attach)(comments, program.body.length ? file.program : file, lines);
|
|
55296
55296
|
return new TreeCopier(lines, tokens).copy(file);
|
|
55297
55297
|
}
|
|
55298
|
-
exports.parse =
|
|
55298
|
+
exports.parse = parse6;
|
|
55299
55299
|
var TreeCopier = function TreeCopier2(lines, tokens) {
|
|
55300
55300
|
assert_1.default.ok(this instanceof TreeCopier2);
|
|
55301
55301
|
this.lines = lines;
|
|
@@ -82246,7 +82246,7 @@ var defaultDirectives = emptySchema.getDirectives().map((dir) => dir.name);
|
|
|
82246
82246
|
|
|
82247
82247
|
// src/lib/graphql.ts
|
|
82248
82248
|
var graphql3 = __toESM(require_graphql2(), 1);
|
|
82249
|
-
import
|
|
82249
|
+
import crypto2 from "node:crypto";
|
|
82250
82250
|
function getRootType(type) {
|
|
82251
82251
|
if (graphql3.isNonNullType(type)) {
|
|
82252
82252
|
return getRootType(type.ofType);
|
|
@@ -82263,7 +82263,7 @@ function hashRaw({ document }) {
|
|
|
82263
82263
|
return hashDocument(document.artifact?.raw);
|
|
82264
82264
|
}
|
|
82265
82265
|
function hashDocument(str) {
|
|
82266
|
-
return
|
|
82266
|
+
return crypto2.createHash("sha256").update(str || "").digest("hex");
|
|
82267
82267
|
}
|
|
82268
82268
|
function parentField(ancestors) {
|
|
82269
82269
|
return walkParentField([...ancestors].sort(() => -1));
|
|
@@ -82766,7 +82766,7 @@ async function find_graphql(config2, parsedScript, walker) {
|
|
|
82766
82766
|
});
|
|
82767
82767
|
}
|
|
82768
82768
|
|
|
82769
|
-
// src/
|
|
82769
|
+
// src/router/conventions.ts
|
|
82770
82770
|
var conventions_exports = {};
|
|
82771
82771
|
__export(conventions_exports, {
|
|
82772
82772
|
fallback_unit_path: () => fallback_unit_path,
|
|
@@ -82884,7 +82884,7 @@ function serialized_manifest_path(config2, base = base_dir(config2)) {
|
|
|
82884
82884
|
return path_exports.join(base, "manifest.json");
|
|
82885
82885
|
}
|
|
82886
82886
|
|
|
82887
|
-
// src/
|
|
82887
|
+
// src/router/manifest.ts
|
|
82888
82888
|
var t2 = __toESM(require_lib6(), 1);
|
|
82889
82889
|
var graphql5 = __toESM(require_graphql2(), 1);
|
|
82890
82890
|
async function load_manifest(args) {
|
|
@@ -83092,6 +83092,251 @@ async function extractQueries(source) {
|
|
|
83092
83092
|
}
|
|
83093
83093
|
return props.filter((p) => p !== "children");
|
|
83094
83094
|
}
|
|
83095
|
+
|
|
83096
|
+
// src/runtime/router/cookies.ts
|
|
83097
|
+
function parse5(str, options) {
|
|
83098
|
+
if (typeof str !== "string") {
|
|
83099
|
+
throw new TypeError("argument str must be a string");
|
|
83100
|
+
}
|
|
83101
|
+
let obj = {};
|
|
83102
|
+
let opt = options || {};
|
|
83103
|
+
let dec = opt.decode || decode;
|
|
83104
|
+
let index = 0;
|
|
83105
|
+
while (index < str.length) {
|
|
83106
|
+
let eqIdx = str.indexOf("=", index);
|
|
83107
|
+
if (eqIdx === -1) {
|
|
83108
|
+
break;
|
|
83109
|
+
}
|
|
83110
|
+
let endIdx = str.indexOf(";", index);
|
|
83111
|
+
if (endIdx === -1) {
|
|
83112
|
+
endIdx = str.length;
|
|
83113
|
+
} else if (endIdx < eqIdx) {
|
|
83114
|
+
index = str.lastIndexOf(";", eqIdx - 1) + 1;
|
|
83115
|
+
continue;
|
|
83116
|
+
}
|
|
83117
|
+
let key = str.slice(index, eqIdx).trim();
|
|
83118
|
+
if (void 0 === obj[key]) {
|
|
83119
|
+
let val = str.slice(eqIdx + 1, endIdx).trim();
|
|
83120
|
+
if (val.charCodeAt(0) === 34) {
|
|
83121
|
+
val = val.slice(1, -1);
|
|
83122
|
+
}
|
|
83123
|
+
obj[key] = tryDecode(val, dec);
|
|
83124
|
+
}
|
|
83125
|
+
index = endIdx + 1;
|
|
83126
|
+
}
|
|
83127
|
+
return obj;
|
|
83128
|
+
}
|
|
83129
|
+
function decode(str) {
|
|
83130
|
+
return str.indexOf("%") !== -1 ? decodeURIComponent(str) : str;
|
|
83131
|
+
}
|
|
83132
|
+
function tryDecode(str, decode3) {
|
|
83133
|
+
try {
|
|
83134
|
+
return decode3(str);
|
|
83135
|
+
} catch (e2) {
|
|
83136
|
+
return str;
|
|
83137
|
+
}
|
|
83138
|
+
}
|
|
83139
|
+
|
|
83140
|
+
// src/runtime/router/jwt.ts
|
|
83141
|
+
function base64UrlParse(s2) {
|
|
83142
|
+
return new Uint8Array(
|
|
83143
|
+
Array.prototype.map.call(
|
|
83144
|
+
atob(s2.replace(/-/g, "+").replace(/_/g, "/").replace(/\s/g, "")),
|
|
83145
|
+
(c) => c.charCodeAt(0)
|
|
83146
|
+
)
|
|
83147
|
+
);
|
|
83148
|
+
}
|
|
83149
|
+
function base64UrlStringify(a) {
|
|
83150
|
+
return btoa(String.fromCharCode.apply(0, a)).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
|
|
83151
|
+
}
|
|
83152
|
+
var algorithms = {
|
|
83153
|
+
ES256: { name: "ECDSA", namedCurve: "P-256", hash: { name: "SHA-256" } },
|
|
83154
|
+
ES384: { name: "ECDSA", namedCurve: "P-384", hash: { name: "SHA-384" } },
|
|
83155
|
+
ES512: { name: "ECDSA", namedCurve: "P-521", hash: { name: "SHA-512" } },
|
|
83156
|
+
HS256: { name: "HMAC", hash: { name: "SHA-256" } },
|
|
83157
|
+
HS384: { name: "HMAC", hash: { name: "SHA-384" } },
|
|
83158
|
+
HS512: { name: "HMAC", hash: { name: "SHA-512" } },
|
|
83159
|
+
RS256: { name: "RSASSA-PKCS1-v1_5", hash: { name: "SHA-256" } },
|
|
83160
|
+
RS384: { name: "RSASSA-PKCS1-v1_5", hash: { name: "SHA-384" } },
|
|
83161
|
+
RS512: { name: "RSASSA-PKCS1-v1_5", hash: { name: "SHA-512" } }
|
|
83162
|
+
};
|
|
83163
|
+
function _utf8ToUint8Array(str) {
|
|
83164
|
+
return base64UrlParse(btoa(unescape(encodeURIComponent(str))));
|
|
83165
|
+
}
|
|
83166
|
+
function _str2ab(str) {
|
|
83167
|
+
str = atob(str);
|
|
83168
|
+
const buf = new ArrayBuffer(str.length);
|
|
83169
|
+
const bufView = new Uint8Array(buf);
|
|
83170
|
+
for (let i2 = 0, strLen = str.length; i2 < strLen; i2++) {
|
|
83171
|
+
bufView[i2] = str.charCodeAt(i2);
|
|
83172
|
+
}
|
|
83173
|
+
return buf;
|
|
83174
|
+
}
|
|
83175
|
+
function _decodePayload(raw) {
|
|
83176
|
+
switch (raw.length % 4) {
|
|
83177
|
+
case 0:
|
|
83178
|
+
break;
|
|
83179
|
+
case 2:
|
|
83180
|
+
raw += "==";
|
|
83181
|
+
break;
|
|
83182
|
+
case 3:
|
|
83183
|
+
raw += "=";
|
|
83184
|
+
break;
|
|
83185
|
+
default:
|
|
83186
|
+
throw new Error("Illegal base64url string!");
|
|
83187
|
+
}
|
|
83188
|
+
try {
|
|
83189
|
+
return JSON.parse(decodeURIComponent(escape(atob(raw))));
|
|
83190
|
+
} catch {
|
|
83191
|
+
return null;
|
|
83192
|
+
}
|
|
83193
|
+
}
|
|
83194
|
+
async function encode(payload, secret, options = { algorithm: "HS256", header: { typ: "JWT" } }) {
|
|
83195
|
+
if (typeof options === "string")
|
|
83196
|
+
options = { algorithm: options, header: { typ: "JWT" } };
|
|
83197
|
+
options = { algorithm: "HS256", header: { typ: "JWT" }, ...options };
|
|
83198
|
+
if (payload === null || typeof payload !== "object")
|
|
83199
|
+
throw new Error("payload must be an object");
|
|
83200
|
+
if (typeof secret !== "string" && typeof secret !== "object")
|
|
83201
|
+
throw new Error("secret must be a string or a JWK object");
|
|
83202
|
+
if (typeof options.algorithm !== "string")
|
|
83203
|
+
throw new Error("options.algorithm must be a string");
|
|
83204
|
+
const algorithm = algorithms[options.algorithm];
|
|
83205
|
+
if (!algorithm)
|
|
83206
|
+
throw new Error("algorithm not found");
|
|
83207
|
+
if (!payload.iat)
|
|
83208
|
+
payload.iat = Math.floor(Date.now() / 1e3);
|
|
83209
|
+
const payloadAsJSON = JSON.stringify(payload);
|
|
83210
|
+
const partialToken = `${base64UrlStringify(
|
|
83211
|
+
_utf8ToUint8Array(JSON.stringify({ ...options.header, alg: options.algorithm }))
|
|
83212
|
+
)}.${base64UrlStringify(_utf8ToUint8Array(payloadAsJSON))}`;
|
|
83213
|
+
let keyFormat = "raw";
|
|
83214
|
+
let keyData;
|
|
83215
|
+
if (typeof secret === "object") {
|
|
83216
|
+
keyFormat = "jwk";
|
|
83217
|
+
keyData = secret;
|
|
83218
|
+
} else if (typeof secret === "string" && secret.startsWith("-----BEGIN")) {
|
|
83219
|
+
keyFormat = "pkcs8";
|
|
83220
|
+
keyData = _str2ab(
|
|
83221
|
+
secret.replace(/-----BEGIN.*?-----/g, "").replace(/-----END.*?-----/g, "").replace(/\s/g, "")
|
|
83222
|
+
);
|
|
83223
|
+
} else
|
|
83224
|
+
keyData = _utf8ToUint8Array(secret);
|
|
83225
|
+
const key = await crypto.subtle.importKey(keyFormat, keyData, algorithm, false, ["sign"]);
|
|
83226
|
+
const signature = await crypto.subtle.sign(algorithm, key, _utf8ToUint8Array(partialToken));
|
|
83227
|
+
return `${partialToken}.${base64UrlStringify(new Uint8Array(signature))}`;
|
|
83228
|
+
}
|
|
83229
|
+
async function verify(token, secret, options = { algorithm: "HS256", throwError: false }) {
|
|
83230
|
+
if (typeof options === "string")
|
|
83231
|
+
options = { algorithm: options, throwError: false };
|
|
83232
|
+
options = { algorithm: "HS256", throwError: false, ...options };
|
|
83233
|
+
if (typeof token !== "string")
|
|
83234
|
+
throw new Error("token must be a string");
|
|
83235
|
+
if (typeof secret !== "string" && typeof secret !== "object")
|
|
83236
|
+
throw new Error("secret must be a string or a JWK object");
|
|
83237
|
+
if (typeof options.algorithm !== "string")
|
|
83238
|
+
throw new Error("options.algorithm must be a string");
|
|
83239
|
+
const tokenParts = token.split(".");
|
|
83240
|
+
if (tokenParts.length !== 3)
|
|
83241
|
+
throw new Error("token must consist of 3 parts");
|
|
83242
|
+
const algorithm = algorithms[options.algorithm];
|
|
83243
|
+
if (!algorithm)
|
|
83244
|
+
throw new Error("algorithm not found");
|
|
83245
|
+
const { payload } = decode2(token);
|
|
83246
|
+
if (!payload) {
|
|
83247
|
+
if (options.throwError)
|
|
83248
|
+
throw "PARSE_ERROR";
|
|
83249
|
+
return false;
|
|
83250
|
+
}
|
|
83251
|
+
if (payload.nbf && payload.nbf > Math.floor(Date.now() / 1e3)) {
|
|
83252
|
+
if (options.throwError)
|
|
83253
|
+
throw "NOT_YET_VALID";
|
|
83254
|
+
return false;
|
|
83255
|
+
}
|
|
83256
|
+
if (payload.exp && payload.exp <= Math.floor(Date.now() / 1e3)) {
|
|
83257
|
+
if (options.throwError)
|
|
83258
|
+
throw "EXPIRED";
|
|
83259
|
+
return false;
|
|
83260
|
+
}
|
|
83261
|
+
let keyFormat = "raw";
|
|
83262
|
+
let keyData;
|
|
83263
|
+
if (typeof secret === "object") {
|
|
83264
|
+
keyFormat = "jwk";
|
|
83265
|
+
keyData = secret;
|
|
83266
|
+
} else if (typeof secret === "string" && secret.startsWith("-----BEGIN")) {
|
|
83267
|
+
keyFormat = "spki";
|
|
83268
|
+
keyData = _str2ab(
|
|
83269
|
+
secret.replace(/-----BEGIN.*?-----/g, "").replace(/-----END.*?-----/g, "").replace(/\s/g, "")
|
|
83270
|
+
);
|
|
83271
|
+
} else
|
|
83272
|
+
keyData = _utf8ToUint8Array(secret);
|
|
83273
|
+
const key = await crypto.subtle.importKey(keyFormat, keyData, algorithm, false, ["verify"]);
|
|
83274
|
+
return await crypto.subtle.verify(
|
|
83275
|
+
algorithm,
|
|
83276
|
+
key,
|
|
83277
|
+
base64UrlParse(tokenParts[2]),
|
|
83278
|
+
_utf8ToUint8Array(`${tokenParts[0]}.${tokenParts[1]}`)
|
|
83279
|
+
);
|
|
83280
|
+
}
|
|
83281
|
+
function decode2(token) {
|
|
83282
|
+
return {
|
|
83283
|
+
header: _decodePayload(
|
|
83284
|
+
token.split(".")[0].replace(/-/g, "+").replace(/_/g, "/")
|
|
83285
|
+
),
|
|
83286
|
+
payload: _decodePayload(
|
|
83287
|
+
token.split(".")[1].replace(/-/g, "+").replace(/_/g, "/")
|
|
83288
|
+
)
|
|
83289
|
+
};
|
|
83290
|
+
}
|
|
83291
|
+
|
|
83292
|
+
// src/runtime/router/server.ts
|
|
83293
|
+
async function handle_request(args) {
|
|
83294
|
+
const plugin_config = args.config.plugins?.["houdini-react"];
|
|
83295
|
+
if (plugin_config.auth && "redirect" in plugin_config.auth && args.url.startsWith(plugin_config.auth.redirect)) {
|
|
83296
|
+
return await redirect_auth(args);
|
|
83297
|
+
}
|
|
83298
|
+
args.next();
|
|
83299
|
+
}
|
|
83300
|
+
async function redirect_auth(args) {
|
|
83301
|
+
const { searchParams } = new URL(args.url, `http://${args.get_header("host")}`);
|
|
83302
|
+
const { redirectTo, ...session } = Object.fromEntries(searchParams.entries());
|
|
83303
|
+
await set_session(args, session);
|
|
83304
|
+
if (redirectTo) {
|
|
83305
|
+
return args.redirect(302, redirectTo);
|
|
83306
|
+
}
|
|
83307
|
+
args.next();
|
|
83308
|
+
}
|
|
83309
|
+
var session_cookie_name = "__houdini__";
|
|
83310
|
+
async function set_session(req, value) {
|
|
83311
|
+
const today = new Date();
|
|
83312
|
+
const expires = new Date(today.getTime() + 7 * 24 * 60 * 60 * 1e3);
|
|
83313
|
+
const serialized = await encode(value, req.session_keys[0]);
|
|
83314
|
+
req.set_header(
|
|
83315
|
+
"Set-Cookie",
|
|
83316
|
+
`${session_cookie_name}=${serialized}; Path=/; HttpOnly; Secure; SameSite=Lax; Expires=${expires.toUTCString()} `
|
|
83317
|
+
);
|
|
83318
|
+
}
|
|
83319
|
+
async function get_session(req, secrets) {
|
|
83320
|
+
const cookies = req.get("cookie");
|
|
83321
|
+
if (!cookies) {
|
|
83322
|
+
return {};
|
|
83323
|
+
}
|
|
83324
|
+
const cookie = parse5(cookies)[session_cookie_name];
|
|
83325
|
+
if (!cookie) {
|
|
83326
|
+
return {};
|
|
83327
|
+
}
|
|
83328
|
+
for (const secret of secrets) {
|
|
83329
|
+
if (!await verify(cookie, secret)) {
|
|
83330
|
+
continue;
|
|
83331
|
+
}
|
|
83332
|
+
const parsed = decode2(cookie);
|
|
83333
|
+
if (!parsed) {
|
|
83334
|
+
return {};
|
|
83335
|
+
}
|
|
83336
|
+
return parsed.payload;
|
|
83337
|
+
}
|
|
83338
|
+
return {};
|
|
83339
|
+
}
|
|
83095
83340
|
export {
|
|
83096
83341
|
ArtifactKind,
|
|
83097
83342
|
Cache,
|
|
@@ -83132,6 +83377,8 @@ export {
|
|
|
83132
83377
|
getCurrentConfig,
|
|
83133
83378
|
getMockConfig,
|
|
83134
83379
|
getRootType,
|
|
83380
|
+
get_session,
|
|
83381
|
+
handle_request,
|
|
83135
83382
|
hashOriginal,
|
|
83136
83383
|
hashRaw,
|
|
83137
83384
|
houdini_mode,
|
|
@@ -83159,6 +83406,12 @@ export {
|
|
|
83159
83406
|
unwrapType,
|
|
83160
83407
|
wrapType
|
|
83161
83408
|
};
|
|
83409
|
+
/*!
|
|
83410
|
+
* cookie
|
|
83411
|
+
* Copyright(c) 2012-2014 Roman Shtylman
|
|
83412
|
+
* Copyright(c) 2015 Douglas Christopher Wilson
|
|
83413
|
+
* MIT Licensed
|
|
83414
|
+
*/
|
|
83162
83415
|
/*! fetch-blob. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */
|
|
83163
83416
|
/*! formdata-polyfill. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */
|
|
83164
83417
|
/*! node-domexception. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */
|