@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.
@@ -68,6 +68,7 @@ export declare const constants: {
68
68
  readonly HandshakeReason: "__clerk_hs_reason";
69
69
  readonly HandshakeNonce: "__clerk_handshake_nonce";
70
70
  readonly HandshakeFormat: "format";
71
+ readonly Session: "__session";
71
72
  };
72
73
  };
73
74
  export type Constants = typeof constants;
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,0BAA0B,CAAC;AAC/C,eAAO,MAAM,WAAW,OAAO,CAAC;AAEhC,eAAO,MAAM,UAAU,QAAuC,CAAC;AAC/D,eAAO,MAAM,iCAAiC,QAAS,CAAC;AACxD,eAAO,MAAM,sBAAsB,eAAe,CAAC;AAsEnD;;GAEG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAMZ,CAAC;AAEX,MAAM,MAAM,SAAS,GAAG,OAAO,SAAS,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,0BAA0B,CAAC;AAC/C,eAAO,MAAM,WAAW,OAAO,CAAC;AAEhC,eAAO,MAAM,UAAU,QAAuC,CAAC;AAC/D,eAAO,MAAM,iCAAiC,QAAS,CAAC;AACxD,eAAO,MAAM,sBAAsB,eAAe,CAAC;AAuEnD;;GAEG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAMZ,CAAC;AAEX,MAAM,MAAM,SAAS,GAAG,OAAO,SAAS,CAAC"}
package/dist/errors.mjs CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  TokenVerificationErrorCode,
8
8
  TokenVerificationErrorReason
9
9
  } from "./chunk-TCIXZLLW.mjs";
10
- import "./chunk-RPS7XK5K.mjs";
10
+ import "./chunk-3SCGTTJP.mjs";
11
11
  export {
12
12
  MachineTokenVerificationError,
13
13
  MachineTokenVerificationErrorCode,
package/dist/index.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/index.ts
27
199
  var index_exports = {};
28
200
  __export(index_exports, {
@@ -1698,7 +1870,7 @@ var snakecase_keys_default = snakecaseKeys;
1698
1870
  // src/constants.ts
1699
1871
  var API_URL = "https://api.clerk.com";
1700
1872
  var API_VERSION = "v1";
1701
- var USER_AGENT = `${"@clerk/backend"}@${"3.0.0-snapshot.v20251218183643"}`;
1873
+ var USER_AGENT = `${"@clerk/backend"}@${"3.0.0-snapshot.v20251224145055"}`;
1702
1874
  var MAX_CACHE_LAST_UPDATED_AT_SECONDS = 5 * 60;
1703
1875
  var SUPPORTED_BAPI_VERSION = "2025-11-10";
1704
1876
  var Attributes = {
@@ -1729,7 +1901,8 @@ var QueryParameters = {
1729
1901
  LegacyDevBrowser: "__dev_session",
1730
1902
  HandshakeReason: "__clerk_hs_reason",
1731
1903
  HandshakeNonce: Cookies.HandshakeNonce,
1732
- HandshakeFormat: "format"
1904
+ HandshakeFormat: "format",
1905
+ Session: "__session"
1733
1906
  };
1734
1907
  var Headers2 = {
1735
1908
  Accept: "accept",
@@ -4293,7 +4466,7 @@ var import_jwtPayloadParser = require("@clerk/shared/jwtPayloadParser");
4293
4466
  var import_buildAccountsBaseUrl2 = require("@clerk/shared/buildAccountsBaseUrl");
4294
4467
 
4295
4468
  // src/tokens/clerkRequest.ts
4296
- var import_cookie = require("cookie");
4469
+ var import_cookie = __toESM(require_dist());
4297
4470
 
4298
4471
  // src/tokens/clerkUrl.ts
4299
4472
  var ClerkUrl = class extends URL {
@@ -5161,6 +5334,9 @@ var HandshakeService = class {
5161
5334
  );
5162
5335
  url.searchParams.append(constants.QueryParameters.HandshakeReason, reason);
5163
5336
  url.searchParams.append(constants.QueryParameters.HandshakeFormat, "nonce");
5337
+ if (this.authenticateContext.sessionToken) {
5338
+ url.searchParams.append(constants.QueryParameters.Session, this.authenticateContext.sessionToken);
5339
+ }
5164
5340
  if (this.authenticateContext.instanceType === "development" && this.authenticateContext.devBrowserToken) {
5165
5341
  url.searchParams.append(constants.QueryParameters.DevBrowser, this.authenticateContext.devBrowserToken);
5166
5342
  }