@clerk/backend 3.0.0-snapshot.v20251218183643 → 3.0.0-snapshot.v20251224145055
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/dist/chunk-3SCGTTJP.mjs +39 -0
- package/dist/{chunk-HPLBV4ZC.mjs → chunk-QP27WD36.mjs} +172 -7
- package/dist/chunk-QP27WD36.mjs.map +1 -0
- package/dist/constants.d.ts +1 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/errors.mjs +1 -1
- package/dist/index.js +179 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/internal.js +179 -3
- package/dist/internal.js.map +1 -1
- package/dist/internal.mjs +2 -2
- package/dist/jwt/index.mjs +1 -1
- package/dist/tokens/handshake.d.ts.map +1 -1
- package/dist/util/shared.d.ts +1 -1
- package/dist/webhooks.mjs +1 -1
- package/package.json +3 -3
- package/dist/chunk-HPLBV4ZC.mjs.map +0 -1
- package/dist/chunk-RPS7XK5K.mjs +0 -12
- /package/dist/{chunk-RPS7XK5K.mjs.map → chunk-3SCGTTJP.mjs.map} +0 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __typeError = (msg) => {
|
|
8
|
+
throw TypeError(msg);
|
|
9
|
+
};
|
|
10
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
11
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
29
|
+
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
30
|
+
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
31
|
+
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
32
|
+
|
|
33
|
+
export {
|
|
34
|
+
__commonJS,
|
|
35
|
+
__toESM,
|
|
36
|
+
__privateAdd,
|
|
37
|
+
__privateMethod
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=chunk-3SCGTTJP.mjs.map
|
|
@@ -24,14 +24,175 @@ import {
|
|
|
24
24
|
TokenVerificationErrorReason
|
|
25
25
|
} from "./chunk-TCIXZLLW.mjs";
|
|
26
26
|
import {
|
|
27
|
+
__commonJS,
|
|
27
28
|
__privateAdd,
|
|
28
|
-
__privateMethod
|
|
29
|
-
|
|
29
|
+
__privateMethod,
|
|
30
|
+
__toESM
|
|
31
|
+
} from "./chunk-3SCGTTJP.mjs";
|
|
32
|
+
|
|
33
|
+
// ../../node_modules/.pnpm/cookie@1.0.2/node_modules/cookie/dist/index.js
|
|
34
|
+
var require_dist = __commonJS({
|
|
35
|
+
"../../node_modules/.pnpm/cookie@1.0.2/node_modules/cookie/dist/index.js"(exports) {
|
|
36
|
+
"use strict";
|
|
37
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
+
exports.parse = parse2;
|
|
39
|
+
exports.serialize = serialize;
|
|
40
|
+
var cookieNameRegExp = /^[\u0021-\u003A\u003C\u003E-\u007E]+$/;
|
|
41
|
+
var cookieValueRegExp = /^[\u0021-\u003A\u003C-\u007E]*$/;
|
|
42
|
+
var domainValueRegExp = /^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i;
|
|
43
|
+
var pathValueRegExp = /^[\u0020-\u003A\u003D-\u007E]*$/;
|
|
44
|
+
var __toString = Object.prototype.toString;
|
|
45
|
+
var NullObject = /* @__PURE__ */ (() => {
|
|
46
|
+
const C = function() {
|
|
47
|
+
};
|
|
48
|
+
C.prototype = /* @__PURE__ */ Object.create(null);
|
|
49
|
+
return C;
|
|
50
|
+
})();
|
|
51
|
+
function parse2(str, options) {
|
|
52
|
+
const obj = new NullObject();
|
|
53
|
+
const len = str.length;
|
|
54
|
+
if (len < 2)
|
|
55
|
+
return obj;
|
|
56
|
+
const dec = options?.decode || decode;
|
|
57
|
+
let index = 0;
|
|
58
|
+
do {
|
|
59
|
+
const eqIdx = str.indexOf("=", index);
|
|
60
|
+
if (eqIdx === -1)
|
|
61
|
+
break;
|
|
62
|
+
const colonIdx = str.indexOf(";", index);
|
|
63
|
+
const endIdx = colonIdx === -1 ? len : colonIdx;
|
|
64
|
+
if (eqIdx > endIdx) {
|
|
65
|
+
index = str.lastIndexOf(";", eqIdx - 1) + 1;
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
const keyStartIdx = startIndex(str, index, eqIdx);
|
|
69
|
+
const keyEndIdx = endIndex(str, eqIdx, keyStartIdx);
|
|
70
|
+
const key = str.slice(keyStartIdx, keyEndIdx);
|
|
71
|
+
if (obj[key] === void 0) {
|
|
72
|
+
let valStartIdx = startIndex(str, eqIdx + 1, endIdx);
|
|
73
|
+
let valEndIdx = endIndex(str, endIdx, valStartIdx);
|
|
74
|
+
const value = dec(str.slice(valStartIdx, valEndIdx));
|
|
75
|
+
obj[key] = value;
|
|
76
|
+
}
|
|
77
|
+
index = endIdx + 1;
|
|
78
|
+
} while (index < len);
|
|
79
|
+
return obj;
|
|
80
|
+
}
|
|
81
|
+
function startIndex(str, index, max) {
|
|
82
|
+
do {
|
|
83
|
+
const code = str.charCodeAt(index);
|
|
84
|
+
if (code !== 32 && code !== 9)
|
|
85
|
+
return index;
|
|
86
|
+
} while (++index < max);
|
|
87
|
+
return max;
|
|
88
|
+
}
|
|
89
|
+
function endIndex(str, index, min) {
|
|
90
|
+
while (index > min) {
|
|
91
|
+
const code = str.charCodeAt(--index);
|
|
92
|
+
if (code !== 32 && code !== 9)
|
|
93
|
+
return index + 1;
|
|
94
|
+
}
|
|
95
|
+
return min;
|
|
96
|
+
}
|
|
97
|
+
function serialize(name, val, options) {
|
|
98
|
+
const enc = options?.encode || encodeURIComponent;
|
|
99
|
+
if (!cookieNameRegExp.test(name)) {
|
|
100
|
+
throw new TypeError(`argument name is invalid: ${name}`);
|
|
101
|
+
}
|
|
102
|
+
const value = enc(val);
|
|
103
|
+
if (!cookieValueRegExp.test(value)) {
|
|
104
|
+
throw new TypeError(`argument val is invalid: ${val}`);
|
|
105
|
+
}
|
|
106
|
+
let str = name + "=" + value;
|
|
107
|
+
if (!options)
|
|
108
|
+
return str;
|
|
109
|
+
if (options.maxAge !== void 0) {
|
|
110
|
+
if (!Number.isInteger(options.maxAge)) {
|
|
111
|
+
throw new TypeError(`option maxAge is invalid: ${options.maxAge}`);
|
|
112
|
+
}
|
|
113
|
+
str += "; Max-Age=" + options.maxAge;
|
|
114
|
+
}
|
|
115
|
+
if (options.domain) {
|
|
116
|
+
if (!domainValueRegExp.test(options.domain)) {
|
|
117
|
+
throw new TypeError(`option domain is invalid: ${options.domain}`);
|
|
118
|
+
}
|
|
119
|
+
str += "; Domain=" + options.domain;
|
|
120
|
+
}
|
|
121
|
+
if (options.path) {
|
|
122
|
+
if (!pathValueRegExp.test(options.path)) {
|
|
123
|
+
throw new TypeError(`option path is invalid: ${options.path}`);
|
|
124
|
+
}
|
|
125
|
+
str += "; Path=" + options.path;
|
|
126
|
+
}
|
|
127
|
+
if (options.expires) {
|
|
128
|
+
if (!isDate(options.expires) || !Number.isFinite(options.expires.valueOf())) {
|
|
129
|
+
throw new TypeError(`option expires is invalid: ${options.expires}`);
|
|
130
|
+
}
|
|
131
|
+
str += "; Expires=" + options.expires.toUTCString();
|
|
132
|
+
}
|
|
133
|
+
if (options.httpOnly) {
|
|
134
|
+
str += "; HttpOnly";
|
|
135
|
+
}
|
|
136
|
+
if (options.secure) {
|
|
137
|
+
str += "; Secure";
|
|
138
|
+
}
|
|
139
|
+
if (options.partitioned) {
|
|
140
|
+
str += "; Partitioned";
|
|
141
|
+
}
|
|
142
|
+
if (options.priority) {
|
|
143
|
+
const priority = typeof options.priority === "string" ? options.priority.toLowerCase() : void 0;
|
|
144
|
+
switch (priority) {
|
|
145
|
+
case "low":
|
|
146
|
+
str += "; Priority=Low";
|
|
147
|
+
break;
|
|
148
|
+
case "medium":
|
|
149
|
+
str += "; Priority=Medium";
|
|
150
|
+
break;
|
|
151
|
+
case "high":
|
|
152
|
+
str += "; Priority=High";
|
|
153
|
+
break;
|
|
154
|
+
default:
|
|
155
|
+
throw new TypeError(`option priority is invalid: ${options.priority}`);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
if (options.sameSite) {
|
|
159
|
+
const sameSite = typeof options.sameSite === "string" ? options.sameSite.toLowerCase() : options.sameSite;
|
|
160
|
+
switch (sameSite) {
|
|
161
|
+
case true:
|
|
162
|
+
case "strict":
|
|
163
|
+
str += "; SameSite=Strict";
|
|
164
|
+
break;
|
|
165
|
+
case "lax":
|
|
166
|
+
str += "; SameSite=Lax";
|
|
167
|
+
break;
|
|
168
|
+
case "none":
|
|
169
|
+
str += "; SameSite=None";
|
|
170
|
+
break;
|
|
171
|
+
default:
|
|
172
|
+
throw new TypeError(`option sameSite is invalid: ${options.sameSite}`);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
return str;
|
|
176
|
+
}
|
|
177
|
+
function decode(str) {
|
|
178
|
+
if (str.indexOf("%") === -1)
|
|
179
|
+
return str;
|
|
180
|
+
try {
|
|
181
|
+
return decodeURIComponent(str);
|
|
182
|
+
} catch (e) {
|
|
183
|
+
return str;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
function isDate(val) {
|
|
187
|
+
return __toString.call(val) === "[object Date]";
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
});
|
|
30
191
|
|
|
31
192
|
// src/constants.ts
|
|
32
193
|
var API_URL = "https://api.clerk.com";
|
|
33
194
|
var API_VERSION = "v1";
|
|
34
|
-
var USER_AGENT = `${"@clerk/backend"}@${"3.0.0-snapshot.
|
|
195
|
+
var USER_AGENT = `${"@clerk/backend"}@${"3.0.0-snapshot.v20251224145055"}`;
|
|
35
196
|
var MAX_CACHE_LAST_UPDATED_AT_SECONDS = 5 * 60;
|
|
36
197
|
var SUPPORTED_BAPI_VERSION = "2025-11-10";
|
|
37
198
|
var Attributes = {
|
|
@@ -62,7 +223,8 @@ var QueryParameters = {
|
|
|
62
223
|
LegacyDevBrowser: "__dev_session",
|
|
63
224
|
HandshakeReason: "__clerk_hs_reason",
|
|
64
225
|
HandshakeNonce: Cookies.HandshakeNonce,
|
|
65
|
-
HandshakeFormat: "format"
|
|
226
|
+
HandshakeFormat: "format",
|
|
227
|
+
Session: "__session"
|
|
66
228
|
};
|
|
67
229
|
var Headers2 = {
|
|
68
230
|
Accept: "accept",
|
|
@@ -4315,7 +4477,7 @@ var withDebugHeaders = (requestState) => {
|
|
|
4315
4477
|
};
|
|
4316
4478
|
|
|
4317
4479
|
// src/tokens/clerkRequest.ts
|
|
4318
|
-
|
|
4480
|
+
var import_cookie = __toESM(require_dist());
|
|
4319
4481
|
|
|
4320
4482
|
// src/tokens/clerkUrl.ts
|
|
4321
4483
|
var ClerkUrl = class extends URL {
|
|
@@ -4370,7 +4532,7 @@ var ClerkRequest = class extends Request {
|
|
|
4370
4532
|
return value?.split(",")[0];
|
|
4371
4533
|
}
|
|
4372
4534
|
parseCookies(req) {
|
|
4373
|
-
const cookiesRecord = parse(this.decodeCookieValue(req.headers.get("cookie") || ""));
|
|
4535
|
+
const cookiesRecord = (0, import_cookie.parse)(this.decodeCookieValue(req.headers.get("cookie") || ""));
|
|
4374
4536
|
return new Map(Object.entries(cookiesRecord));
|
|
4375
4537
|
}
|
|
4376
4538
|
decodeCookieValue(str) {
|
|
@@ -4801,6 +4963,9 @@ var HandshakeService = class {
|
|
|
4801
4963
|
);
|
|
4802
4964
|
url.searchParams.append(constants.QueryParameters.HandshakeReason, reason);
|
|
4803
4965
|
url.searchParams.append(constants.QueryParameters.HandshakeFormat, "nonce");
|
|
4966
|
+
if (this.authenticateContext.sessionToken) {
|
|
4967
|
+
url.searchParams.append(constants.QueryParameters.Session, this.authenticateContext.sessionToken);
|
|
4968
|
+
}
|
|
4804
4969
|
if (this.authenticateContext.instanceType === "development" && this.authenticateContext.devBrowserToken) {
|
|
4805
4970
|
url.searchParams.append(constants.QueryParameters.DevBrowser, this.authenticateContext.devBrowserToken);
|
|
4806
4971
|
}
|
|
@@ -5705,4 +5870,4 @@ export {
|
|
|
5705
5870
|
debugRequestState,
|
|
5706
5871
|
createAuthenticateRequest
|
|
5707
5872
|
};
|
|
5708
|
-
//# sourceMappingURL=chunk-
|
|
5873
|
+
//# sourceMappingURL=chunk-QP27WD36.mjs.map
|