@clerk/backend 3.0.0-snapshot.v20251218165926 → 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-CQISAXJE.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-CQISAXJE.mjs.map +0 -1
- package/dist/chunk-RPS7XK5K.mjs +0 -12
- /package/dist/{chunk-RPS7XK5K.mjs.map → chunk-3SCGTTJP.mjs.map} +0 -0
package/dist/index.mjs
CHANGED
|
@@ -2,14 +2,14 @@ import {
|
|
|
2
2
|
createAuthenticateRequest,
|
|
3
3
|
createBackendApiClient,
|
|
4
4
|
verifyToken
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-QP27WD36.mjs";
|
|
6
6
|
import "./chunk-YBVFDYDR.mjs";
|
|
7
7
|
import {
|
|
8
8
|
withLegacyReturn
|
|
9
9
|
} from "./chunk-P263NW7Z.mjs";
|
|
10
10
|
import "./chunk-SNA7AD3D.mjs";
|
|
11
11
|
import "./chunk-TCIXZLLW.mjs";
|
|
12
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-3SCGTTJP.mjs";
|
|
13
13
|
|
|
14
14
|
// src/index.ts
|
|
15
15
|
import { TelemetryCollector } from "@clerk/shared/telemetry";
|
package/dist/internal.js
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
8
|
var __typeError = (msg) => {
|
|
7
9
|
throw TypeError(msg);
|
|
8
10
|
};
|
|
11
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
12
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
13
|
+
};
|
|
9
14
|
var __export = (target, all) => {
|
|
10
15
|
for (var name in all)
|
|
11
16
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -18,11 +23,178 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
23
|
}
|
|
19
24
|
return to;
|
|
20
25
|
};
|
|
26
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
27
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
28
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
29
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
30
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
31
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
32
|
+
mod
|
|
33
|
+
));
|
|
21
34
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
22
35
|
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
23
36
|
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);
|
|
24
37
|
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
25
38
|
|
|
39
|
+
// ../../node_modules/.pnpm/cookie@1.0.2/node_modules/cookie/dist/index.js
|
|
40
|
+
var require_dist = __commonJS({
|
|
41
|
+
"../../node_modules/.pnpm/cookie@1.0.2/node_modules/cookie/dist/index.js"(exports2) {
|
|
42
|
+
"use strict";
|
|
43
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
44
|
+
exports2.parse = parse3;
|
|
45
|
+
exports2.serialize = serialize;
|
|
46
|
+
var cookieNameRegExp = /^[\u0021-\u003A\u003C\u003E-\u007E]+$/;
|
|
47
|
+
var cookieValueRegExp = /^[\u0021-\u003A\u003C-\u007E]*$/;
|
|
48
|
+
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;
|
|
49
|
+
var pathValueRegExp = /^[\u0020-\u003A\u003D-\u007E]*$/;
|
|
50
|
+
var __toString = Object.prototype.toString;
|
|
51
|
+
var NullObject = /* @__PURE__ */ (() => {
|
|
52
|
+
const C = function() {
|
|
53
|
+
};
|
|
54
|
+
C.prototype = /* @__PURE__ */ Object.create(null);
|
|
55
|
+
return C;
|
|
56
|
+
})();
|
|
57
|
+
function parse3(str, options) {
|
|
58
|
+
const obj = new NullObject();
|
|
59
|
+
const len = str.length;
|
|
60
|
+
if (len < 2)
|
|
61
|
+
return obj;
|
|
62
|
+
const dec = options?.decode || decode;
|
|
63
|
+
let index = 0;
|
|
64
|
+
do {
|
|
65
|
+
const eqIdx = str.indexOf("=", index);
|
|
66
|
+
if (eqIdx === -1)
|
|
67
|
+
break;
|
|
68
|
+
const colonIdx = str.indexOf(";", index);
|
|
69
|
+
const endIdx = colonIdx === -1 ? len : colonIdx;
|
|
70
|
+
if (eqIdx > endIdx) {
|
|
71
|
+
index = str.lastIndexOf(";", eqIdx - 1) + 1;
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
const keyStartIdx = startIndex(str, index, eqIdx);
|
|
75
|
+
const keyEndIdx = endIndex(str, eqIdx, keyStartIdx);
|
|
76
|
+
const key = str.slice(keyStartIdx, keyEndIdx);
|
|
77
|
+
if (obj[key] === void 0) {
|
|
78
|
+
let valStartIdx = startIndex(str, eqIdx + 1, endIdx);
|
|
79
|
+
let valEndIdx = endIndex(str, endIdx, valStartIdx);
|
|
80
|
+
const value = dec(str.slice(valStartIdx, valEndIdx));
|
|
81
|
+
obj[key] = value;
|
|
82
|
+
}
|
|
83
|
+
index = endIdx + 1;
|
|
84
|
+
} while (index < len);
|
|
85
|
+
return obj;
|
|
86
|
+
}
|
|
87
|
+
function startIndex(str, index, max) {
|
|
88
|
+
do {
|
|
89
|
+
const code = str.charCodeAt(index);
|
|
90
|
+
if (code !== 32 && code !== 9)
|
|
91
|
+
return index;
|
|
92
|
+
} while (++index < max);
|
|
93
|
+
return max;
|
|
94
|
+
}
|
|
95
|
+
function endIndex(str, index, min) {
|
|
96
|
+
while (index > min) {
|
|
97
|
+
const code = str.charCodeAt(--index);
|
|
98
|
+
if (code !== 32 && code !== 9)
|
|
99
|
+
return index + 1;
|
|
100
|
+
}
|
|
101
|
+
return min;
|
|
102
|
+
}
|
|
103
|
+
function serialize(name, val, options) {
|
|
104
|
+
const enc = options?.encode || encodeURIComponent;
|
|
105
|
+
if (!cookieNameRegExp.test(name)) {
|
|
106
|
+
throw new TypeError(`argument name is invalid: ${name}`);
|
|
107
|
+
}
|
|
108
|
+
const value = enc(val);
|
|
109
|
+
if (!cookieValueRegExp.test(value)) {
|
|
110
|
+
throw new TypeError(`argument val is invalid: ${val}`);
|
|
111
|
+
}
|
|
112
|
+
let str = name + "=" + value;
|
|
113
|
+
if (!options)
|
|
114
|
+
return str;
|
|
115
|
+
if (options.maxAge !== void 0) {
|
|
116
|
+
if (!Number.isInteger(options.maxAge)) {
|
|
117
|
+
throw new TypeError(`option maxAge is invalid: ${options.maxAge}`);
|
|
118
|
+
}
|
|
119
|
+
str += "; Max-Age=" + options.maxAge;
|
|
120
|
+
}
|
|
121
|
+
if (options.domain) {
|
|
122
|
+
if (!domainValueRegExp.test(options.domain)) {
|
|
123
|
+
throw new TypeError(`option domain is invalid: ${options.domain}`);
|
|
124
|
+
}
|
|
125
|
+
str += "; Domain=" + options.domain;
|
|
126
|
+
}
|
|
127
|
+
if (options.path) {
|
|
128
|
+
if (!pathValueRegExp.test(options.path)) {
|
|
129
|
+
throw new TypeError(`option path is invalid: ${options.path}`);
|
|
130
|
+
}
|
|
131
|
+
str += "; Path=" + options.path;
|
|
132
|
+
}
|
|
133
|
+
if (options.expires) {
|
|
134
|
+
if (!isDate(options.expires) || !Number.isFinite(options.expires.valueOf())) {
|
|
135
|
+
throw new TypeError(`option expires is invalid: ${options.expires}`);
|
|
136
|
+
}
|
|
137
|
+
str += "; Expires=" + options.expires.toUTCString();
|
|
138
|
+
}
|
|
139
|
+
if (options.httpOnly) {
|
|
140
|
+
str += "; HttpOnly";
|
|
141
|
+
}
|
|
142
|
+
if (options.secure) {
|
|
143
|
+
str += "; Secure";
|
|
144
|
+
}
|
|
145
|
+
if (options.partitioned) {
|
|
146
|
+
str += "; Partitioned";
|
|
147
|
+
}
|
|
148
|
+
if (options.priority) {
|
|
149
|
+
const priority = typeof options.priority === "string" ? options.priority.toLowerCase() : void 0;
|
|
150
|
+
switch (priority) {
|
|
151
|
+
case "low":
|
|
152
|
+
str += "; Priority=Low";
|
|
153
|
+
break;
|
|
154
|
+
case "medium":
|
|
155
|
+
str += "; Priority=Medium";
|
|
156
|
+
break;
|
|
157
|
+
case "high":
|
|
158
|
+
str += "; Priority=High";
|
|
159
|
+
break;
|
|
160
|
+
default:
|
|
161
|
+
throw new TypeError(`option priority is invalid: ${options.priority}`);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
if (options.sameSite) {
|
|
165
|
+
const sameSite = typeof options.sameSite === "string" ? options.sameSite.toLowerCase() : options.sameSite;
|
|
166
|
+
switch (sameSite) {
|
|
167
|
+
case true:
|
|
168
|
+
case "strict":
|
|
169
|
+
str += "; SameSite=Strict";
|
|
170
|
+
break;
|
|
171
|
+
case "lax":
|
|
172
|
+
str += "; SameSite=Lax";
|
|
173
|
+
break;
|
|
174
|
+
case "none":
|
|
175
|
+
str += "; SameSite=None";
|
|
176
|
+
break;
|
|
177
|
+
default:
|
|
178
|
+
throw new TypeError(`option sameSite is invalid: ${options.sameSite}`);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
return str;
|
|
182
|
+
}
|
|
183
|
+
function decode(str) {
|
|
184
|
+
if (str.indexOf("%") === -1)
|
|
185
|
+
return str;
|
|
186
|
+
try {
|
|
187
|
+
return decodeURIComponent(str);
|
|
188
|
+
} catch (e) {
|
|
189
|
+
return str;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
function isDate(val) {
|
|
193
|
+
return __toString.call(val) === "[object Date]";
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
|
|
26
198
|
// src/internal.ts
|
|
27
199
|
var internal_exports = {};
|
|
28
200
|
__export(internal_exports, {
|
|
@@ -56,7 +228,7 @@ module.exports = __toCommonJS(internal_exports);
|
|
|
56
228
|
// src/constants.ts
|
|
57
229
|
var API_URL = "https://api.clerk.com";
|
|
58
230
|
var API_VERSION = "v1";
|
|
59
|
-
var USER_AGENT = `${"@clerk/backend"}@${"3.0.0-snapshot.
|
|
231
|
+
var USER_AGENT = `${"@clerk/backend"}@${"3.0.0-snapshot.v20251224145055"}`;
|
|
60
232
|
var MAX_CACHE_LAST_UPDATED_AT_SECONDS = 5 * 60;
|
|
61
233
|
var SUPPORTED_BAPI_VERSION = "2025-11-10";
|
|
62
234
|
var Attributes = {
|
|
@@ -87,7 +259,8 @@ var QueryParameters = {
|
|
|
87
259
|
LegacyDevBrowser: "__dev_session",
|
|
88
260
|
HandshakeReason: "__clerk_hs_reason",
|
|
89
261
|
HandshakeNonce: Cookies.HandshakeNonce,
|
|
90
|
-
HandshakeFormat: "format"
|
|
262
|
+
HandshakeFormat: "format",
|
|
263
|
+
Session: "__session"
|
|
91
264
|
};
|
|
92
265
|
var Headers2 = {
|
|
93
266
|
Accept: "accept",
|
|
@@ -4796,7 +4969,7 @@ var withDebugHeaders = (requestState) => {
|
|
|
4796
4969
|
};
|
|
4797
4970
|
|
|
4798
4971
|
// src/tokens/clerkRequest.ts
|
|
4799
|
-
var import_cookie =
|
|
4972
|
+
var import_cookie = __toESM(require_dist());
|
|
4800
4973
|
|
|
4801
4974
|
// src/tokens/clerkUrl.ts
|
|
4802
4975
|
var ClerkUrl = class extends URL {
|
|
@@ -5282,6 +5455,9 @@ var HandshakeService = class {
|
|
|
5282
5455
|
);
|
|
5283
5456
|
url.searchParams.append(constants.QueryParameters.HandshakeReason, reason);
|
|
5284
5457
|
url.searchParams.append(constants.QueryParameters.HandshakeFormat, "nonce");
|
|
5458
|
+
if (this.authenticateContext.sessionToken) {
|
|
5459
|
+
url.searchParams.append(constants.QueryParameters.Session, this.authenticateContext.sessionToken);
|
|
5460
|
+
}
|
|
5285
5461
|
if (this.authenticateContext.instanceType === "development" && this.authenticateContext.devBrowserToken) {
|
|
5286
5462
|
url.searchParams.append(constants.QueryParameters.DevBrowser, this.authenticateContext.devBrowserToken);
|
|
5287
5463
|
}
|