@shipdit/cli 0.3.2 → 0.4.1
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/index.mjs +504 -392
- package/package.json +10 -11
package/dist/index.mjs
CHANGED
|
@@ -7,6 +7,8 @@ import { z } from "zod";
|
|
|
7
7
|
import { createJiti } from "jiti";
|
|
8
8
|
|
|
9
9
|
//#region src/lib/config.ts
|
|
10
|
+
/** Hosted control plane. Used when no flag, env, project, global, or credential URL is set. */
|
|
11
|
+
const DEFAULT_API_URL = "https://api.useshipd.com";
|
|
10
12
|
function readJsonFile(filePath) {
|
|
11
13
|
if (!fs.existsSync(filePath)) return null;
|
|
12
14
|
return JSON.parse(fs.readFileSync(filePath, "utf8"));
|
|
@@ -60,7 +62,7 @@ function resolveRuntimeConfig(flags, options) {
|
|
|
60
62
|
const ci = flags.ci === true || flags.yes === true || process.env.CI === "1" || process.env.CI === "true" || process.env.SHIPD_CI === "1";
|
|
61
63
|
const defaultConfigFile = fs.existsSync(path.join(projectRoot, "shipd.config.ts")) ? path.join(projectRoot, "shipd.config.ts") : path.join(cwd, "shipd.config.ts");
|
|
62
64
|
return {
|
|
63
|
-
apiUrl: flags.apiUrl ?? process.env.SHIPD_API_URL ?? projectConfig.apiUrl ?? globalConfig.apiUrl ?? credentials.apiUrl ?? options?.defaultApiUrl ?? "
|
|
65
|
+
apiUrl: flags.apiUrl ?? process.env.SHIPD_API_URL ?? projectConfig.apiUrl ?? globalConfig.apiUrl ?? credentials.apiUrl ?? options?.defaultApiUrl ?? "https://api.useshipd.com",
|
|
64
66
|
appUrl: process.env.SHIPD_APP_URL ?? projectConfig.appUrl ?? globalConfig.appUrl ?? "http://localhost:5173",
|
|
65
67
|
apiKey: process.env.SHIPD_API_KEY ?? credentials.apiKey,
|
|
66
68
|
org: flags.org ?? process.env.SHIPD_ORG ?? projectConfig.org ?? globalConfig.org,
|
|
@@ -77,64 +79,21 @@ function resolveRuntimeConfig(flags, options) {
|
|
|
77
79
|
}
|
|
78
80
|
|
|
79
81
|
//#endregion
|
|
80
|
-
//#region ../../node_modules/.pnpm/hono@4.13.
|
|
81
|
-
|
|
82
|
-
var _serialize = (name, value, opt = {}) => {
|
|
83
|
-
if (!validCookieNameRegEx.test(name)) throw new Error("Invalid cookie name");
|
|
84
|
-
let cookie = `${name}=${value}`;
|
|
85
|
-
if (name.startsWith("__Secure-") && !opt.secure) throw new Error("__Secure- Cookie must have Secure attributes");
|
|
86
|
-
if (name.startsWith("__Host-")) {
|
|
87
|
-
if (!opt.secure) throw new Error("__Host- Cookie must have Secure attributes");
|
|
88
|
-
if (opt.path !== "/") throw new Error("__Host- Cookie must have Path attributes with \"/\"");
|
|
89
|
-
if (opt.domain) throw new Error("__Host- Cookie must not have Domain attributes");
|
|
90
|
-
}
|
|
91
|
-
for (const key of [
|
|
92
|
-
"domain",
|
|
93
|
-
"path",
|
|
94
|
-
"sameSite",
|
|
95
|
-
"priority"
|
|
96
|
-
]) if (opt[key] && /[;\r\n]/.test(opt[key])) throw new Error(`${key} must not contain ";", "\\r", or "\\n"`);
|
|
97
|
-
if (opt && typeof opt.maxAge === "number" && opt.maxAge >= 0) {
|
|
98
|
-
if (opt.maxAge > 3456e4) throw new Error("Cookies Max-Age SHOULD NOT be greater than 400 days (34560000 seconds) in duration.");
|
|
99
|
-
cookie += `; Max-Age=${opt.maxAge | 0}`;
|
|
100
|
-
}
|
|
101
|
-
if (opt.domain && opt.prefix !== "host") cookie += `; Domain=${opt.domain}`;
|
|
102
|
-
if (opt.path) cookie += `; Path=${opt.path}`;
|
|
103
|
-
if (opt.expires) {
|
|
104
|
-
if (opt.expires.getTime() - Date.now() > 3456e7) throw new Error("Cookies Expires SHOULD NOT be greater than 400 days (34560000 seconds) in the future.");
|
|
105
|
-
cookie += `; Expires=${opt.expires.toUTCString()}`;
|
|
106
|
-
}
|
|
107
|
-
if (opt.httpOnly) cookie += "; HttpOnly";
|
|
108
|
-
if (opt.secure) cookie += "; Secure";
|
|
109
|
-
if (opt.sameSite) cookie += `; SameSite=${opt.sameSite.charAt(0).toUpperCase() + opt.sameSite.slice(1)}`;
|
|
110
|
-
if (opt.priority) cookie += `; Priority=${opt.priority.charAt(0).toUpperCase() + opt.priority.slice(1)}`;
|
|
111
|
-
if (opt.partitioned) {
|
|
112
|
-
if (!opt.secure) throw new Error("Partitioned Cookie must have Secure attributes");
|
|
113
|
-
cookie += "; Partitioned";
|
|
114
|
-
}
|
|
115
|
-
return cookie;
|
|
116
|
-
};
|
|
117
|
-
var serialize = (name, value, opt) => {
|
|
118
|
-
value = encodeURIComponent(value);
|
|
119
|
-
return _serialize(name, value, opt);
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
//#endregion
|
|
123
|
-
//#region ../../node_modules/.pnpm/hono@4.13.5/node_modules/hono/dist/client/utils.js
|
|
124
|
-
var mergePath = (base, path) => {
|
|
82
|
+
//#region ../../node_modules/.pnpm/hono@4.13.13/node_modules/hono/dist/client/utils.js
|
|
83
|
+
const mergePath = (base, path) => {
|
|
125
84
|
base = base.replace(/\/+$/, "");
|
|
126
85
|
base = base + "/";
|
|
127
86
|
path = path.replace(/^\/+/, "");
|
|
128
87
|
return base + path;
|
|
129
88
|
};
|
|
130
|
-
|
|
89
|
+
const replaceUrlParam = (urlString, params) => {
|
|
131
90
|
for (const [k, v] of Object.entries(params)) {
|
|
132
91
|
const reg = new RegExp("/:" + k + "(?:{[^/]+})?\\??(?=/|$)");
|
|
133
92
|
urlString = urlString.replace(reg, () => v ? `/${v}` : "");
|
|
134
93
|
}
|
|
135
94
|
return urlString;
|
|
136
95
|
};
|
|
137
|
-
|
|
96
|
+
const buildSearchParams = (query) => {
|
|
138
97
|
const searchParams = new URLSearchParams();
|
|
139
98
|
for (const [k, v] of Object.entries(query)) {
|
|
140
99
|
if (v === void 0) continue;
|
|
@@ -146,13 +105,13 @@ var buildSearchParams = (query) => {
|
|
|
146
105
|
}
|
|
147
106
|
return searchParams;
|
|
148
107
|
};
|
|
149
|
-
|
|
108
|
+
const replaceUrlProtocol = (urlString, protocol) => {
|
|
150
109
|
switch (protocol) {
|
|
151
110
|
case "ws": return urlString.replace(/^http/, "ws");
|
|
152
111
|
case "http": return urlString.replace(/^ws/, "http");
|
|
153
112
|
}
|
|
154
113
|
};
|
|
155
|
-
|
|
114
|
+
const removeIndexString = (urlString) => {
|
|
156
115
|
if (/^https?:\/\/[^\/]+?\/index(?=\?|$)/.test(urlString)) return urlString.replace(/\/index(?=\?|$)/, "/");
|
|
157
116
|
return urlString.replace(/\/index(?=\?|$)/, "");
|
|
158
117
|
};
|
|
@@ -171,8 +130,51 @@ function deepMerge(target, source) {
|
|
|
171
130
|
}
|
|
172
131
|
|
|
173
132
|
//#endregion
|
|
174
|
-
//#region ../../node_modules/.pnpm/hono@4.13.
|
|
175
|
-
|
|
133
|
+
//#region ../../node_modules/.pnpm/hono@4.13.13/node_modules/hono/dist/utils/cookie.js
|
|
134
|
+
const validCookieNameRegEx = /^[\w!#$%&'*.^`|~+-]+$/;
|
|
135
|
+
const _serialize = (name, value, opt = {}) => {
|
|
136
|
+
if (!validCookieNameRegEx.test(name)) throw new Error("Invalid cookie name");
|
|
137
|
+
let cookie = `${name}=${value}`;
|
|
138
|
+
if (name.startsWith("__Secure-") && !opt.secure) throw new Error("__Secure- Cookie must have Secure attributes");
|
|
139
|
+
if (name.startsWith("__Host-")) {
|
|
140
|
+
if (!opt.secure) throw new Error("__Host- Cookie must have Secure attributes");
|
|
141
|
+
if (opt.path !== "/") throw new Error("__Host- Cookie must have Path attributes with \"/\"");
|
|
142
|
+
if (opt.domain) throw new Error("__Host- Cookie must not have Domain attributes");
|
|
143
|
+
}
|
|
144
|
+
for (const key of [
|
|
145
|
+
"domain",
|
|
146
|
+
"path",
|
|
147
|
+
"sameSite",
|
|
148
|
+
"priority"
|
|
149
|
+
]) if (opt[key] && /[;\r\n]/.test(opt[key])) throw new Error(`${key} must not contain ";", "\\r", or "\\n"`);
|
|
150
|
+
if (opt && typeof opt.maxAge === "number" && opt.maxAge >= 0) {
|
|
151
|
+
if (opt.maxAge > 3456e4) throw new Error("Cookies Max-Age SHOULD NOT be greater than 400 days (34560000 seconds) in duration.");
|
|
152
|
+
cookie += `; Max-Age=${opt.maxAge | 0}`;
|
|
153
|
+
}
|
|
154
|
+
if (opt.domain && opt.prefix !== "host") cookie += `; Domain=${opt.domain}`;
|
|
155
|
+
if (opt.path) cookie += `; Path=${opt.path}`;
|
|
156
|
+
if (opt.expires) {
|
|
157
|
+
if (opt.expires.getTime() - Date.now() > 3456e7) throw new Error("Cookies Expires SHOULD NOT be greater than 400 days (34560000 seconds) in the future.");
|
|
158
|
+
cookie += `; Expires=${opt.expires.toUTCString()}`;
|
|
159
|
+
}
|
|
160
|
+
if (opt.httpOnly) cookie += "; HttpOnly";
|
|
161
|
+
if (opt.secure) cookie += "; Secure";
|
|
162
|
+
if (opt.sameSite) cookie += `; SameSite=${opt.sameSite.charAt(0).toUpperCase() + opt.sameSite.slice(1)}`;
|
|
163
|
+
if (opt.priority) cookie += `; Priority=${opt.priority.charAt(0).toUpperCase() + opt.priority.slice(1)}`;
|
|
164
|
+
if (opt.partitioned) {
|
|
165
|
+
if (!opt.secure) throw new Error("Partitioned Cookie must have Secure attributes");
|
|
166
|
+
cookie += "; Partitioned";
|
|
167
|
+
}
|
|
168
|
+
return cookie;
|
|
169
|
+
};
|
|
170
|
+
const serialize = (name, value, opt) => {
|
|
171
|
+
value = encodeURIComponent(value);
|
|
172
|
+
return _serialize(name, value, opt);
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
//#endregion
|
|
176
|
+
//#region ../../node_modules/.pnpm/hono@4.13.13/node_modules/hono/dist/client/client.js
|
|
177
|
+
const createProxy = (callback, path) => {
|
|
176
178
|
return new Proxy(() => {}, {
|
|
177
179
|
get(_obj, key) {
|
|
178
180
|
if (typeof key !== "string" || key === "then") return;
|
|
@@ -186,7 +188,7 @@ var createProxy = (callback, path) => {
|
|
|
186
188
|
}
|
|
187
189
|
});
|
|
188
190
|
};
|
|
189
|
-
|
|
191
|
+
const appendQueryParams = (url, searchParams) => {
|
|
190
192
|
const queryString = searchParams.toString();
|
|
191
193
|
return queryString ? `${url}?${queryString}` : url;
|
|
192
194
|
};
|
|
@@ -254,7 +256,7 @@ var ClientRequestImpl = class {
|
|
|
254
256
|
});
|
|
255
257
|
};
|
|
256
258
|
};
|
|
257
|
-
|
|
259
|
+
const hc = (baseUrl, options) => createProxy(function proxyCallback(opts) {
|
|
258
260
|
const buildSearchParamsOption = options?.buildSearchParams ?? buildSearchParams;
|
|
259
261
|
const parts = [...opts.path];
|
|
260
262
|
const lastParts = parts.slice(-3).reverse();
|
|
@@ -274,17 +276,17 @@ var hc = (baseUrl, options) => createProxy(function proxyCallback(opts) {
|
|
|
274
276
|
const path = parts.join("/");
|
|
275
277
|
const url = mergePath(baseUrl, path);
|
|
276
278
|
if (method === "url" || method === "path") {
|
|
277
|
-
let result = url;
|
|
279
|
+
let result = removeIndexString(url);
|
|
278
280
|
if (opts.args[0]) {
|
|
279
|
-
if (opts.args[0].param) result = replaceUrlParam(
|
|
281
|
+
if (opts.args[0].param) result = replaceUrlParam(result, opts.args[0].param);
|
|
280
282
|
if (opts.args[0].query) result = appendQueryParams(result, buildSearchParamsOption(opts.args[0].query));
|
|
281
283
|
}
|
|
282
|
-
result = removeIndexString(result);
|
|
283
284
|
if (method === "url") return new URL(result);
|
|
284
285
|
return result.slice(baseUrl.replace(/\/+$/, "").length).replace(/^\/?/, "/");
|
|
285
286
|
}
|
|
286
287
|
if (method === "ws") {
|
|
287
|
-
const
|
|
288
|
+
const normalizedUrl = removeIndexString(url);
|
|
289
|
+
const webSocketUrl = replaceUrlProtocol(opts.args[0]?.param ? replaceUrlParam(normalizedUrl, opts.args[0].param) : normalizedUrl, "ws");
|
|
288
290
|
const targetUrl = new URL(webSocketUrl);
|
|
289
291
|
const queryParams = opts.args[0]?.query;
|
|
290
292
|
if (queryParams) buildSearchParamsOption(queryParams).forEach((value, key) => {
|
|
@@ -442,6 +444,8 @@ function A$1(e) {
|
|
|
442
444
|
create: (e) => O$1(i.project.create.$post, e),
|
|
443
445
|
update: (e) => O$1(i.project.update.$post, e),
|
|
444
446
|
archive: (e) => O$1(i.project.archive.$post, e),
|
|
447
|
+
listArchived: (e = {}) => O$1(i.project.listArchived.$post, e),
|
|
448
|
+
restore: (e) => O$1(i.project.restore.$post, e),
|
|
445
449
|
listTeams: (e) => O$1(i.project.listTeams.$post, e),
|
|
446
450
|
setTeams: (e) => O$1(i.project.setTeams.$post, e)
|
|
447
451
|
},
|
|
@@ -450,7 +454,9 @@ function A$1(e) {
|
|
|
450
454
|
list: (e) => O$1(a.environment.list.$post, e),
|
|
451
455
|
create: (e) => O$1(a.environment.create.$post, e),
|
|
452
456
|
update: (e) => O$1(a.environment.update.$post, e),
|
|
453
|
-
archive: (e) => O$1(a.environment.archive.$post, e)
|
|
457
|
+
archive: (e) => O$1(a.environment.archive.$post, e),
|
|
458
|
+
listArchived: (e) => O$1(a.environment.listArchived.$post, e),
|
|
459
|
+
restore: (e) => O$1(a.environment.restore.$post, e)
|
|
454
460
|
},
|
|
455
461
|
flag: {
|
|
456
462
|
list: (e) => O$1(A.flag.list.$post, e),
|
|
@@ -458,6 +464,8 @@ function A$1(e) {
|
|
|
458
464
|
create: (e) => O$1(A.flag.create.$post, e),
|
|
459
465
|
update: (e) => O$1(A.flag.update.$post, e),
|
|
460
466
|
archive: (e) => O$1(A.flag.archive.$post, e),
|
|
467
|
+
listArchived: (e) => O$1(A.flag.listArchived.$post, e),
|
|
468
|
+
restore: (e) => O$1(A.flag.restore.$post, e),
|
|
461
469
|
updateEnvironment: (e) => O$1(A.flag.updateEnvironment.$post, e),
|
|
462
470
|
toggleEnvironment: (e) => O$1(A.flag.toggleEnvironment.$post, e),
|
|
463
471
|
listEnvironmentStates: (e) => O$1(A.flag.listEnvironmentStates.$post, e),
|
|
@@ -494,6 +502,8 @@ function A$1(e) {
|
|
|
494
502
|
create: (e) => O$1(I.segment.create.$post, e),
|
|
495
503
|
update: (e) => O$1(I.segment.update.$post, e),
|
|
496
504
|
archive: (e) => O$1(I.segment.archive.$post, e),
|
|
505
|
+
listArchived: (e) => O$1(I.segment.listArchived.$post, e),
|
|
506
|
+
restore: (e) => O$1(I.segment.restore.$post, e),
|
|
497
507
|
listEnvironmentStates: (e) => O$1(I.segment.listEnvironmentStates.$post, e),
|
|
498
508
|
updateEnvironment: (e) => O$1(I.segment.updateEnvironment.$post, e)
|
|
499
509
|
},
|
|
@@ -598,7 +608,7 @@ function A$1(e) {
|
|
|
598
608
|
}
|
|
599
609
|
|
|
600
610
|
//#endregion
|
|
601
|
-
//#region ../../node_modules/.pnpm/@better-auth+core@1.7.
|
|
611
|
+
//#region ../../node_modules/.pnpm/@better-auth+core@1.7.7_@better-auth+utils@0.4.2_@better-fetch+fetch@1.3.2_@opentelemet_e02eb0bf6cc57b8ec4097db90c5ddf37/node_modules/@better-auth/core/dist/utils/error-codes.mjs
|
|
602
612
|
function defineErrorCodes(codes) {
|
|
603
613
|
return Object.fromEntries(Object.entries(codes).map(([key, value]) => [key, {
|
|
604
614
|
code: key,
|
|
@@ -608,7 +618,7 @@ function defineErrorCodes(codes) {
|
|
|
608
618
|
}
|
|
609
619
|
|
|
610
620
|
//#endregion
|
|
611
|
-
//#region ../../node_modules/.pnpm/better-call@1.4.0_zod@4.
|
|
621
|
+
//#region ../../node_modules/.pnpm/better-call@1.4.0_zod@4.6.5/node_modules/better-call/dist/error.mjs
|
|
612
622
|
function isErrorStackTraceLimitWritable() {
|
|
613
623
|
const desc = Object.getOwnPropertyDescriptor(Error, "stackTraceLimit");
|
|
614
624
|
if (desc === void 0) return Object.isExtensible(Error);
|
|
@@ -725,7 +735,7 @@ var InternalAPIError = class extends Error {
|
|
|
725
735
|
const APIError = makeErrorForHideStackFrame(InternalAPIError, Error);
|
|
726
736
|
|
|
727
737
|
//#endregion
|
|
728
|
-
//#region ../../node_modules/.pnpm/@better-auth+core@1.7.
|
|
738
|
+
//#region ../../node_modules/.pnpm/@better-auth+core@1.7.7_@better-auth+utils@0.4.2_@better-fetch+fetch@1.3.2_@opentelemet_e02eb0bf6cc57b8ec4097db90c5ddf37/node_modules/@better-auth/core/dist/error/index.mjs
|
|
729
739
|
var BetterAuthError = class extends Error {
|
|
730
740
|
constructor(message, options) {
|
|
731
741
|
super(message, options);
|
|
@@ -736,7 +746,7 @@ var BetterAuthError = class extends Error {
|
|
|
736
746
|
};
|
|
737
747
|
|
|
738
748
|
//#endregion
|
|
739
|
-
//#region ../../node_modules/.pnpm/better-auth@1.7.
|
|
749
|
+
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.4_drizzle-orm@1.0.0-rc._025f420fe344f13948728b361b367060/node_modules/better-auth/dist/plugins/access/access.mjs
|
|
740
750
|
function unknownResourceResponse(requestedResource) {
|
|
741
751
|
return {
|
|
742
752
|
success: false,
|
|
@@ -813,12 +823,13 @@ function createAccessControl(s) {
|
|
|
813
823
|
}
|
|
814
824
|
|
|
815
825
|
//#endregion
|
|
816
|
-
//#region ../../node_modules/.pnpm/better-auth@1.7.
|
|
826
|
+
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.4_drizzle-orm@1.0.0-rc._025f420fe344f13948728b361b367060/node_modules/better-auth/dist/plugins/two-factor/error-code.mjs
|
|
817
827
|
const TWO_FACTOR_ERROR_CODES = defineErrorCodes({
|
|
818
828
|
OTP_NOT_ENABLED: "OTP not enabled",
|
|
819
829
|
OTP_NOT_CONFIGURED: "OTP is not available",
|
|
820
830
|
OTP_HAS_EXPIRED: "OTP has expired",
|
|
821
831
|
TOTP_NOT_ENABLED: "TOTP not enabled",
|
|
832
|
+
TOTP_ALREADY_ENABLED: "TOTP is already enabled",
|
|
822
833
|
TOTP_NOT_CONFIGURED: "TOTP is not available",
|
|
823
834
|
TWO_FACTOR_NOT_ENABLED: "Two factor isn't enabled",
|
|
824
835
|
BACKUP_CODES_NOT_ENABLED: "Backup codes aren't enabled",
|
|
@@ -830,15 +841,15 @@ const TWO_FACTOR_ERROR_CODES = defineErrorCodes({
|
|
|
830
841
|
});
|
|
831
842
|
|
|
832
843
|
//#endregion
|
|
833
|
-
//#region ../../node_modules/.pnpm/better-auth@1.7.
|
|
834
|
-
var version = "1.7.
|
|
844
|
+
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.4_drizzle-orm@1.0.0-rc._025f420fe344f13948728b361b367060/node_modules/better-auth/dist/package.mjs
|
|
845
|
+
var version = "1.7.7";
|
|
835
846
|
|
|
836
847
|
//#endregion
|
|
837
|
-
//#region ../../node_modules/.pnpm/better-auth@1.7.
|
|
848
|
+
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.4_drizzle-orm@1.0.0-rc._025f420fe344f13948728b361b367060/node_modules/better-auth/dist/version.mjs
|
|
838
849
|
const PACKAGE_VERSION$3 = version;
|
|
839
850
|
|
|
840
851
|
//#endregion
|
|
841
|
-
//#region ../../node_modules/.pnpm/@better-auth+core@1.7.
|
|
852
|
+
//#region ../../node_modules/.pnpm/@better-auth+core@1.7.7_@better-auth+utils@0.4.2_@better-fetch+fetch@1.3.2_@opentelemet_e02eb0bf6cc57b8ec4097db90c5ddf37/node_modules/@better-auth/core/dist/utils/url.mjs
|
|
842
853
|
/**
|
|
843
854
|
* Schemes that execute or embed code when navigated to or accepted as a
|
|
844
855
|
* redirect target. These are never safe as an OAuth `redirect_uri` or as a
|
|
@@ -870,7 +881,7 @@ function isSafeUrlScheme(value) {
|
|
|
870
881
|
}
|
|
871
882
|
|
|
872
883
|
//#endregion
|
|
873
|
-
//#region ../../node_modules/.pnpm/better-auth@1.7.
|
|
884
|
+
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.4_drizzle-orm@1.0.0-rc._025f420fe344f13948728b361b367060/node_modules/better-auth/dist/plugins/two-factor/client.mjs
|
|
874
885
|
const twoFactorClient = (options) => {
|
|
875
886
|
return {
|
|
876
887
|
id: "two-factor",
|
|
@@ -908,7 +919,7 @@ const twoFactorClient = (options) => {
|
|
|
908
919
|
};
|
|
909
920
|
|
|
910
921
|
//#endregion
|
|
911
|
-
//#region ../../node_modules/.pnpm/better-auth@1.7.
|
|
922
|
+
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.4_drizzle-orm@1.0.0-rc._025f420fe344f13948728b361b367060/node_modules/better-auth/dist/plugins/admin/access/statement.mjs
|
|
912
923
|
const defaultStatements$1 = {
|
|
913
924
|
user: [
|
|
914
925
|
"create",
|
|
@@ -959,7 +970,7 @@ const defaultRoles$1 = {
|
|
|
959
970
|
};
|
|
960
971
|
|
|
961
972
|
//#endregion
|
|
962
|
-
//#region ../../node_modules/.pnpm/better-auth@1.7.
|
|
973
|
+
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.4_drizzle-orm@1.0.0-rc._025f420fe344f13948728b361b367060/node_modules/better-auth/dist/plugins/admin/error-codes.mjs
|
|
963
974
|
const ADMIN_ERROR_CODES = defineErrorCodes({
|
|
964
975
|
FAILED_TO_CREATE_USER: "Failed to create user",
|
|
965
976
|
USER_ALREADY_EXISTS: "User already exists.",
|
|
@@ -987,7 +998,7 @@ const ADMIN_ERROR_CODES = defineErrorCodes({
|
|
|
987
998
|
});
|
|
988
999
|
|
|
989
1000
|
//#endregion
|
|
990
|
-
//#region ../../node_modules/.pnpm/@better-auth+core@1.7.
|
|
1001
|
+
//#region ../../node_modules/.pnpm/@better-auth+core@1.7.7_@better-auth+utils@0.4.2_@better-fetch+fetch@1.3.2_@opentelemet_e02eb0bf6cc57b8ec4097db90c5ddf37/node_modules/@better-auth/core/dist/env/env-impl.mjs
|
|
991
1002
|
const _envShim = Object.create(null);
|
|
992
1003
|
const _getEnv = (useShim) => globalThis.process?.env || globalThis.Deno?.env.toObject() || globalThis.__env__ || (useShim ? _envShim : globalThis);
|
|
993
1004
|
const env = new Proxy(_envShim, {
|
|
@@ -1051,7 +1062,7 @@ const ENV = Object.freeze({
|
|
|
1051
1062
|
});
|
|
1052
1063
|
|
|
1053
1064
|
//#endregion
|
|
1054
|
-
//#region ../../node_modules/.pnpm/better-auth@1.7.
|
|
1065
|
+
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.4_drizzle-orm@1.0.0-rc._025f420fe344f13948728b361b367060/node_modules/better-auth/dist/utils/url.mjs
|
|
1055
1066
|
const SLASH_CHAR_CODE = "/".charCodeAt(0);
|
|
1056
1067
|
function trimTrailingSlashes(value) {
|
|
1057
1068
|
let end = value.length;
|
|
@@ -1130,7 +1141,7 @@ function getOrigin(url) {
|
|
|
1130
1141
|
}
|
|
1131
1142
|
|
|
1132
1143
|
//#endregion
|
|
1133
|
-
//#region ../../node_modules/.pnpm/better-auth@1.7.
|
|
1144
|
+
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.4_drizzle-orm@1.0.0-rc._025f420fe344f13948728b361b367060/node_modules/better-auth/dist/plugins/admin/has-permission.mjs
|
|
1134
1145
|
const hasPermission = (input) => {
|
|
1135
1146
|
if (input.userId && input.options?.adminUserIds?.includes(input.userId)) return true;
|
|
1136
1147
|
if (!input.permissions) return false;
|
|
@@ -1182,27 +1193,7 @@ const defuArrayFn = createDefu((object, key, currentValue) => {
|
|
|
1182
1193
|
});
|
|
1183
1194
|
|
|
1184
1195
|
//#endregion
|
|
1185
|
-
//#region ../../node_modules/.pnpm/@better-fetch+fetch@1.3.
|
|
1186
|
-
var __defProp = Object.defineProperty;
|
|
1187
|
-
var __defProps = Object.defineProperties;
|
|
1188
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
1189
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
1190
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
1191
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
1192
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {
|
|
1193
|
-
enumerable: true,
|
|
1194
|
-
configurable: true,
|
|
1195
|
-
writable: true,
|
|
1196
|
-
value
|
|
1197
|
-
}) : obj[key] = value;
|
|
1198
|
-
var __spreadValues = (a, b) => {
|
|
1199
|
-
for (var prop in b || (b = {})) if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]);
|
|
1200
|
-
if (__getOwnPropSymbols) {
|
|
1201
|
-
for (var prop of __getOwnPropSymbols(b)) if (__propIsEnum.call(b, prop)) __defNormalProp(a, prop, b[prop]);
|
|
1202
|
-
}
|
|
1203
|
-
return a;
|
|
1204
|
-
};
|
|
1205
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
1196
|
+
//#region ../../node_modules/.pnpm/@better-fetch+fetch@1.3.2/node_modules/@better-fetch/fetch/dist/index.js
|
|
1206
1197
|
var BetterFetchError = class extends Error {
|
|
1207
1198
|
constructor(status, statusText, error) {
|
|
1208
1199
|
super(statusText || status.toString(), { cause: error });
|
|
@@ -1212,32 +1203,33 @@ var BetterFetchError = class extends Error {
|
|
|
1212
1203
|
Error.captureStackTrace(this, this.constructor);
|
|
1213
1204
|
}
|
|
1214
1205
|
};
|
|
1215
|
-
|
|
1216
|
-
var _a, _b, _c, _d, _e, _f;
|
|
1206
|
+
const initializePlugins = async (url, options) => {
|
|
1217
1207
|
let opts = options || {};
|
|
1218
1208
|
const hooks = {
|
|
1219
|
-
onRequest: [options
|
|
1220
|
-
onResponse: [options
|
|
1221
|
-
onSuccess: [options
|
|
1222
|
-
onError: [options
|
|
1223
|
-
onRetry: [options
|
|
1209
|
+
onRequest: [options === null || options === void 0 ? void 0 : options.onRequest],
|
|
1210
|
+
onResponse: [options === null || options === void 0 ? void 0 : options.onResponse],
|
|
1211
|
+
onSuccess: [options === null || options === void 0 ? void 0 : options.onSuccess],
|
|
1212
|
+
onError: [options === null || options === void 0 ? void 0 : options.onError],
|
|
1213
|
+
onRetry: [options === null || options === void 0 ? void 0 : options.onRetry]
|
|
1224
1214
|
};
|
|
1225
|
-
if (!options || !(options
|
|
1215
|
+
if (!options || !(options === null || options === void 0 ? void 0 : options.plugins)) return {
|
|
1226
1216
|
url,
|
|
1227
1217
|
options: opts,
|
|
1228
1218
|
hooks
|
|
1229
1219
|
};
|
|
1230
|
-
for (const plugin of (options
|
|
1220
|
+
for (const plugin of (options === null || options === void 0 ? void 0 : options.plugins) || []) {
|
|
1221
|
+
var _plugin$hooks, _plugin$hooks2, _plugin$hooks3, _plugin$hooks4, _plugin$hooks5;
|
|
1231
1222
|
if (plugin.init) {
|
|
1232
|
-
|
|
1223
|
+
var _plugin$init;
|
|
1224
|
+
const pluginRes = await ((_plugin$init = plugin.init) === null || _plugin$init === void 0 ? void 0 : _plugin$init.call(plugin, url.toString(), opts));
|
|
1233
1225
|
opts = pluginRes.options || opts;
|
|
1234
1226
|
url = pluginRes.url;
|
|
1235
1227
|
}
|
|
1236
|
-
hooks.onRequest.push((
|
|
1237
|
-
hooks.onResponse.push((
|
|
1238
|
-
hooks.onSuccess.push((
|
|
1239
|
-
hooks.onError.push((
|
|
1240
|
-
hooks.onRetry.push((
|
|
1228
|
+
hooks.onRequest.push((_plugin$hooks = plugin.hooks) === null || _plugin$hooks === void 0 ? void 0 : _plugin$hooks.onRequest);
|
|
1229
|
+
hooks.onResponse.push((_plugin$hooks2 = plugin.hooks) === null || _plugin$hooks2 === void 0 ? void 0 : _plugin$hooks2.onResponse);
|
|
1230
|
+
hooks.onSuccess.push((_plugin$hooks3 = plugin.hooks) === null || _plugin$hooks3 === void 0 ? void 0 : _plugin$hooks3.onSuccess);
|
|
1231
|
+
hooks.onError.push((_plugin$hooks4 = plugin.hooks) === null || _plugin$hooks4 === void 0 ? void 0 : _plugin$hooks4.onError);
|
|
1232
|
+
hooks.onRetry.push((_plugin$hooks5 = plugin.hooks) === null || _plugin$hooks5 === void 0 ? void 0 : _plugin$hooks5.onRetry);
|
|
1241
1233
|
}
|
|
1242
1234
|
return {
|
|
1243
1235
|
url,
|
|
@@ -1281,10 +1273,81 @@ function createRetryStrategy(options) {
|
|
|
1281
1273
|
default: throw new Error("Invalid retry strategy");
|
|
1282
1274
|
}
|
|
1283
1275
|
}
|
|
1284
|
-
|
|
1276
|
+
const methods = [
|
|
1277
|
+
"get",
|
|
1278
|
+
"post",
|
|
1279
|
+
"put",
|
|
1280
|
+
"patch",
|
|
1281
|
+
"delete"
|
|
1282
|
+
];
|
|
1283
|
+
function parseMethodModifier(path) {
|
|
1284
|
+
if (!path.startsWith("@")) return {
|
|
1285
|
+
method: void 0,
|
|
1286
|
+
path
|
|
1287
|
+
};
|
|
1288
|
+
const separator = path.indexOf("/");
|
|
1289
|
+
const method = path.slice(1, separator === -1 ? void 0 : separator);
|
|
1290
|
+
if (!methods.includes(method)) return {
|
|
1291
|
+
method: void 0,
|
|
1292
|
+
path
|
|
1293
|
+
};
|
|
1294
|
+
return {
|
|
1295
|
+
method,
|
|
1296
|
+
path: separator === -1 ? path : path.slice(separator + 1)
|
|
1297
|
+
};
|
|
1298
|
+
}
|
|
1299
|
+
const isReservedPathSegment = (value) => value === "." || value === "..";
|
|
1300
|
+
const encodeLiteralPathSegment = (segment) => segment.split(":").map((part) => encodeURIComponent(part)).join(":");
|
|
1301
|
+
function resolvePathSegment(segment, pathParams) {
|
|
1302
|
+
const pathParam = pathParams.get(segment);
|
|
1303
|
+
if (pathParam === void 0) return encodeLiteralPathSegment(segment);
|
|
1304
|
+
if (isReservedPathSegment(pathParam)) throw new TypeError("Path parameters cannot be reserved path segments");
|
|
1305
|
+
return encodeURIComponent(pathParam);
|
|
1306
|
+
}
|
|
1307
|
+
/**
|
|
1308
|
+
* Normalize URL
|
|
1309
|
+
*/
|
|
1310
|
+
function getURL$1(url, option) {
|
|
1311
|
+
const { baseURL, params, query } = option || {
|
|
1312
|
+
query: {},
|
|
1313
|
+
params: {},
|
|
1314
|
+
baseURL: ""
|
|
1315
|
+
};
|
|
1316
|
+
let basePath = url.startsWith("http") ? url.split("/").slice(0, 3).join("/") : baseURL || "";
|
|
1317
|
+
const { path: requestPath } = parseMethodModifier(url);
|
|
1318
|
+
if (requestPath !== url) url = `/${requestPath}`;
|
|
1319
|
+
if (!basePath.endsWith("/")) basePath += "/";
|
|
1320
|
+
let [path, urlQuery] = url.replace(basePath, "").split("?");
|
|
1321
|
+
const queryParams = new URLSearchParams(urlQuery);
|
|
1322
|
+
for (const [key, value] of Object.entries(query || {})) {
|
|
1323
|
+
if (value == null) continue;
|
|
1324
|
+
let serializedValue;
|
|
1325
|
+
if (typeof value === "string") serializedValue = value;
|
|
1326
|
+
else if (Array.isArray(value)) {
|
|
1327
|
+
for (const val of value) queryParams.append(key, val);
|
|
1328
|
+
continue;
|
|
1329
|
+
} else serializedValue = JSON.stringify(value);
|
|
1330
|
+
queryParams.set(key, serializedValue);
|
|
1331
|
+
}
|
|
1332
|
+
const pathParams = /* @__PURE__ */ new Map();
|
|
1333
|
+
if (params) if (Array.isArray(params)) {
|
|
1334
|
+
const paramPaths = path.split("/").filter((p) => p.startsWith(":"));
|
|
1335
|
+
for (const [index, key] of paramPaths.entries()) {
|
|
1336
|
+
const value = params[index];
|
|
1337
|
+
pathParams.set(key, String(value));
|
|
1338
|
+
}
|
|
1339
|
+
} else for (const [key, value] of Object.entries(params)) pathParams.set(`:${key}`, String(value));
|
|
1340
|
+
path = path.split("/").map((segment) => resolvePathSegment(segment, pathParams)).join("/");
|
|
1341
|
+
path = path.replace(/^\/+/, "");
|
|
1342
|
+
let queryParamString = queryParams.toString();
|
|
1343
|
+
queryParamString = queryParamString.length > 0 ? `?${queryParamString}`.replace(/\+/g, "%20") : "";
|
|
1344
|
+
if (!basePath.startsWith("http")) return `${basePath}${path}${queryParamString}`;
|
|
1345
|
+
return new URL(`${path}${queryParamString}`, basePath);
|
|
1346
|
+
}
|
|
1347
|
+
const getAuthHeader = async (options) => {
|
|
1285
1348
|
const headers = {};
|
|
1286
1349
|
const getValue = async (value) => typeof value === "function" ? await value() : value;
|
|
1287
|
-
if (options
|
|
1350
|
+
if (options === null || options === void 0 ? void 0 : options.auth) {
|
|
1288
1351
|
if (options.auth.type === "Bearer") {
|
|
1289
1352
|
const token = await getValue(options.auth.token);
|
|
1290
1353
|
if (!token) return headers;
|
|
@@ -1296,12 +1359,12 @@ var getAuthHeader = async (options) => {
|
|
|
1296
1359
|
} else if (options.auth.type === "Custom") {
|
|
1297
1360
|
const [prefix, value] = await Promise.all([getValue(options.auth.prefix), getValue(options.auth.value)]);
|
|
1298
1361
|
if (!value) return headers;
|
|
1299
|
-
headers["authorization"] = `${prefix
|
|
1362
|
+
headers["authorization"] = `${prefix !== null && prefix !== void 0 ? prefix : ""} ${value}`;
|
|
1300
1363
|
}
|
|
1301
1364
|
}
|
|
1302
1365
|
return headers;
|
|
1303
1366
|
};
|
|
1304
|
-
|
|
1367
|
+
const JSON_RE = /^application\/(?:[\w!#$%&*.^`~-]*\+)?json(;.+)?$/i;
|
|
1305
1368
|
function detectResponseType(request) {
|
|
1306
1369
|
const _contentType = request.headers.get("content-type");
|
|
1307
1370
|
const textTypes = /* @__PURE__ */ new Set([
|
|
@@ -1344,7 +1407,7 @@ function isFunction(value) {
|
|
|
1344
1407
|
return typeof value === "function";
|
|
1345
1408
|
}
|
|
1346
1409
|
function getFetch(options) {
|
|
1347
|
-
if (options
|
|
1410
|
+
if (options === null || options === void 0 ? void 0 : options.customFetchImpl) return options.customFetchImpl;
|
|
1348
1411
|
if (typeof globalThis !== "undefined" && isFunction(globalThis.fetch)) return globalThis.fetch;
|
|
1349
1412
|
if (typeof window !== "undefined" && isFunction(window.fetch)) return window.fetch;
|
|
1350
1413
|
throw new Error("No fetch implementation found");
|
|
@@ -1364,9 +1427,9 @@ function mergeHeaders(...sources) {
|
|
|
1364
1427
|
return merged;
|
|
1365
1428
|
}
|
|
1366
1429
|
async function getHeaders(opts) {
|
|
1367
|
-
const headers = new Headers(mergeHeaders(opts
|
|
1430
|
+
const headers = new Headers(mergeHeaders(opts === null || opts === void 0 ? void 0 : opts.headers, await getAuthHeader(opts)));
|
|
1368
1431
|
if (!headers.has("content-type")) {
|
|
1369
|
-
const contentType = detectContentType(opts
|
|
1432
|
+
const contentType = detectContentType(opts === null || opts === void 0 ? void 0 : opts.body);
|
|
1370
1433
|
if (contentType) headers.set("content-type", contentType);
|
|
1371
1434
|
}
|
|
1372
1435
|
return headers;
|
|
@@ -1388,18 +1451,14 @@ function getBody(options, headers) {
|
|
|
1388
1451
|
return JSON.stringify(body);
|
|
1389
1452
|
}
|
|
1390
1453
|
function getMethod$1(url, options) {
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
if (
|
|
1394
|
-
|
|
1395
|
-
if (!methods.includes(pMethod)) return (options == null ? void 0 : options.body) ? "POST" : "GET";
|
|
1396
|
-
return pMethod.toUpperCase();
|
|
1397
|
-
}
|
|
1398
|
-
return (options == null ? void 0 : options.body) ? "POST" : "GET";
|
|
1454
|
+
if (options === null || options === void 0 ? void 0 : options.method) return options.method.toUpperCase();
|
|
1455
|
+
const { method } = parseMethodModifier(url);
|
|
1456
|
+
if (method) return method.toUpperCase();
|
|
1457
|
+
return (options === null || options === void 0 ? void 0 : options.body) ? "POST" : "GET";
|
|
1399
1458
|
}
|
|
1400
1459
|
function getTimeout(options, controller) {
|
|
1401
1460
|
let abortTimeout;
|
|
1402
|
-
if (!(options
|
|
1461
|
+
if (!(options === null || options === void 0 ? void 0 : options.signal) && (options === null || options === void 0 ? void 0 : options.timeout)) abortTimeout = setTimeout(() => controller === null || controller === void 0 ? void 0 : controller.abort(), options === null || options === void 0 ? void 0 : options.timeout);
|
|
1403
1462
|
return {
|
|
1404
1463
|
abortTimeout,
|
|
1405
1464
|
clearTimeout: () => {
|
|
@@ -1407,11 +1466,11 @@ function getTimeout(options, controller) {
|
|
|
1407
1466
|
}
|
|
1408
1467
|
};
|
|
1409
1468
|
}
|
|
1410
|
-
var ValidationError = class
|
|
1469
|
+
var ValidationError = class ValidationError extends Error {
|
|
1411
1470
|
constructor(issues, message) {
|
|
1412
1471
|
super(message || JSON.stringify(issues, null, 2));
|
|
1413
1472
|
this.issues = issues;
|
|
1414
|
-
Object.setPrototypeOf(this,
|
|
1473
|
+
Object.setPrototypeOf(this, ValidationError.prototype);
|
|
1415
1474
|
}
|
|
1416
1475
|
};
|
|
1417
1476
|
async function parseStandardSchema(schema, input) {
|
|
@@ -1419,186 +1478,100 @@ async function parseStandardSchema(schema, input) {
|
|
|
1419
1478
|
if (result.issues) throw new ValidationError(result.issues);
|
|
1420
1479
|
return result.value;
|
|
1421
1480
|
}
|
|
1422
|
-
|
|
1423
|
-
"
|
|
1424
|
-
"
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
var
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
return ((_a2 = plugin.schema) == null ? void 0 : _a2.config) ? url.startsWith(plugin.schema.config.baseURL || "") || url.startsWith(plugin.schema.config.prefix || "") : false;
|
|
1438
|
-
})) == null ? void 0 : _b.schema) || config.schema;
|
|
1439
|
-
if (schema) {
|
|
1440
|
-
let urlKey = url;
|
|
1441
|
-
if ((_c = schema.config) == null ? void 0 : _c.prefix) {
|
|
1442
|
-
if (urlKey.startsWith(schema.config.prefix)) {
|
|
1443
|
-
urlKey = urlKey.replace(schema.config.prefix, "");
|
|
1444
|
-
if (schema.config.baseURL) url = url.replace(schema.config.prefix, schema.config.baseURL);
|
|
1445
|
-
}
|
|
1446
|
-
}
|
|
1447
|
-
if ((_d = schema.config) == null ? void 0 : _d.baseURL) {
|
|
1448
|
-
if (urlKey.startsWith(schema.config.baseURL)) urlKey = urlKey.replace(schema.config.baseURL, "");
|
|
1449
|
-
}
|
|
1450
|
-
if (urlKey.startsWith("/") && urlKey.charAt(1) === "@") urlKey = urlKey.substring(1);
|
|
1451
|
-
const keySchema = schema.schema[urlKey];
|
|
1452
|
-
if (keySchema) {
|
|
1453
|
-
let validatedHeaders = options == null ? void 0 : options.headers;
|
|
1454
|
-
if (keySchema.headers && !(options == null ? void 0 : options.disableValidation)) {
|
|
1455
|
-
const normalizedHeaders = {};
|
|
1456
|
-
if (options == null ? void 0 : options.headers) {
|
|
1457
|
-
if (options.headers instanceof Headers) options.headers.forEach((value, key) => {
|
|
1458
|
-
normalizedHeaders[key.toLowerCase()] = value;
|
|
1459
|
-
});
|
|
1460
|
-
else if (typeof options.headers === "object") {
|
|
1461
|
-
for (const [key, value] of Object.entries(options.headers)) if (value !== null && value !== void 0) normalizedHeaders[key.toLowerCase()] = value;
|
|
1462
|
-
}
|
|
1463
|
-
}
|
|
1464
|
-
const validated = await parseStandardSchema(keySchema.headers, normalizedHeaders);
|
|
1465
|
-
const finalHeaders = {};
|
|
1466
|
-
for (const [key, value] of Object.entries(validated)) finalHeaders[key.toLowerCase()] = value;
|
|
1467
|
-
validatedHeaders = finalHeaders;
|
|
1468
|
-
}
|
|
1469
|
-
let opts = __spreadProps(__spreadValues({}, options), {
|
|
1470
|
-
method: keySchema.method,
|
|
1471
|
-
output: keySchema.output,
|
|
1472
|
-
headers: validatedHeaders
|
|
1473
|
-
});
|
|
1474
|
-
if (!(options == null ? void 0 : options.disableValidation)) opts = __spreadProps(__spreadValues({}, opts), {
|
|
1475
|
-
body: keySchema.input ? await parseStandardSchema(keySchema.input, options == null ? void 0 : options.body) : options == null ? void 0 : options.body,
|
|
1476
|
-
params: keySchema.params ? await parseStandardSchema(keySchema.params, options == null ? void 0 : options.params) : options == null ? void 0 : options.params,
|
|
1477
|
-
query: keySchema.query ? await parseStandardSchema(keySchema.query, options == null ? void 0 : options.query) : options == null ? void 0 : options.query
|
|
1478
|
-
});
|
|
1479
|
-
return {
|
|
1480
|
-
url,
|
|
1481
|
-
options: opts
|
|
1482
|
-
};
|
|
1483
|
-
}
|
|
1484
|
-
}
|
|
1485
|
-
return {
|
|
1486
|
-
url,
|
|
1487
|
-
options
|
|
1488
|
-
};
|
|
1481
|
+
function _typeof(o) {
|
|
1482
|
+
"@babel/helpers - typeof";
|
|
1483
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
1484
|
+
return typeof o;
|
|
1485
|
+
} : function(o) {
|
|
1486
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
1487
|
+
}, _typeof(o);
|
|
1488
|
+
}
|
|
1489
|
+
function toPrimitive(t, r) {
|
|
1490
|
+
if ("object" != _typeof(t) || !t) return t;
|
|
1491
|
+
var e = t[Symbol.toPrimitive];
|
|
1492
|
+
if (void 0 !== e) {
|
|
1493
|
+
var i = e.call(t, r || "default");
|
|
1494
|
+
if ("object" != _typeof(i)) return i;
|
|
1495
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1489
1496
|
}
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
}
|
|
1512
|
-
};
|
|
1513
|
-
}
|
|
1514
|
-
return await betterFetch(url, opts);
|
|
1515
|
-
}
|
|
1516
|
-
return $fetch;
|
|
1517
|
-
};
|
|
1518
|
-
var isReservedPathSegment = (value) => value === "." || value === "..";
|
|
1519
|
-
function encodePathSegment(segment, pathParams) {
|
|
1520
|
-
let pathSegment = segment;
|
|
1521
|
-
for (const [key, value] of pathParams) pathSegment = pathSegment.replace(key, value);
|
|
1522
|
-
if (isReservedPathSegment(pathSegment)) throw new TypeError("Path parameters cannot be reserved path segments");
|
|
1523
|
-
return encodeURIComponent(pathSegment);
|
|
1524
|
-
}
|
|
1525
|
-
function getURL2(url, option) {
|
|
1526
|
-
const { baseURL, params, query } = option || {
|
|
1527
|
-
query: {},
|
|
1528
|
-
params: {},
|
|
1529
|
-
baseURL: ""
|
|
1530
|
-
};
|
|
1531
|
-
let basePath = url.startsWith("http") ? url.split("/").slice(0, 3).join("/") : baseURL || "";
|
|
1532
|
-
if (url.startsWith("@")) {
|
|
1533
|
-
const m = url.toString().split("@")[1].split("/")[0];
|
|
1534
|
-
if (methods.includes(m)) url = url.replace(`@${m}/`, "/");
|
|
1497
|
+
return ("string" === r ? String : Number)(t);
|
|
1498
|
+
}
|
|
1499
|
+
function toPropertyKey(t) {
|
|
1500
|
+
var i = toPrimitive(t, "string");
|
|
1501
|
+
return "symbol" == _typeof(i) ? i : i + "";
|
|
1502
|
+
}
|
|
1503
|
+
function _defineProperty(e, r, t) {
|
|
1504
|
+
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
1505
|
+
value: t,
|
|
1506
|
+
enumerable: !0,
|
|
1507
|
+
configurable: !0,
|
|
1508
|
+
writable: !0
|
|
1509
|
+
}) : e[r] = t, e;
|
|
1510
|
+
}
|
|
1511
|
+
function ownKeys(e, r) {
|
|
1512
|
+
var t = Object.keys(e);
|
|
1513
|
+
if (Object.getOwnPropertySymbols) {
|
|
1514
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
1515
|
+
r && (o = o.filter(function(r) {
|
|
1516
|
+
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
1517
|
+
})), t.push.apply(t, o);
|
|
1535
1518
|
}
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
for (
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
} else serializedValue = JSON.stringify(value);
|
|
1547
|
-
queryParams.set(key, serializedValue);
|
|
1548
|
-
}
|
|
1549
|
-
const pathParams = /* @__PURE__ */ new Map();
|
|
1550
|
-
if (params) {
|
|
1551
|
-
if (Array.isArray(params)) {
|
|
1552
|
-
const paramPaths = path.split("/").filter((p) => p.startsWith(":"));
|
|
1553
|
-
for (const [index, key] of paramPaths.entries()) {
|
|
1554
|
-
const value = params[index];
|
|
1555
|
-
pathParams.set(key, String(value));
|
|
1556
|
-
}
|
|
1557
|
-
} else for (const [key, value] of Object.entries(params)) pathParams.set(`:${key}`, String(value));
|
|
1519
|
+
return t;
|
|
1520
|
+
}
|
|
1521
|
+
function _objectSpread2(e) {
|
|
1522
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
1523
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
1524
|
+
r % 2 ? ownKeys(Object(t), !0).forEach(function(r) {
|
|
1525
|
+
_defineProperty(e, r, t[r]);
|
|
1526
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r) {
|
|
1527
|
+
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
1528
|
+
});
|
|
1558
1529
|
}
|
|
1559
|
-
|
|
1560
|
-
path = path.replace(/^\/+/, "");
|
|
1561
|
-
let queryParamString = queryParams.toString();
|
|
1562
|
-
queryParamString = queryParamString.length > 0 ? `?${queryParamString}`.replace(/\+/g, "%20") : "";
|
|
1563
|
-
if (!basePath.startsWith("http")) return `${basePath}${path}${queryParamString}`;
|
|
1564
|
-
return new URL(`${path}${queryParamString}`, basePath);
|
|
1530
|
+
return e;
|
|
1565
1531
|
}
|
|
1566
|
-
|
|
1567
|
-
var
|
|
1532
|
+
const betterFetch = async (url, options) => {
|
|
1533
|
+
var _opts$signal, _options$body, _options$jsonParser;
|
|
1568
1534
|
const { hooks, url: __url, options: opts } = await initializePlugins(url, options);
|
|
1569
1535
|
const fetch = getFetch(opts);
|
|
1570
1536
|
const controller = new AbortController();
|
|
1571
|
-
const signal = (
|
|
1572
|
-
const _url =
|
|
1537
|
+
const signal = (_opts$signal = opts.signal) !== null && _opts$signal !== void 0 ? _opts$signal : controller.signal;
|
|
1538
|
+
const _url = getURL$1(__url, opts);
|
|
1573
1539
|
const headers = await getHeaders(opts);
|
|
1574
1540
|
const body = getBody(opts, headers);
|
|
1575
1541
|
const method = getMethod$1(__url, opts);
|
|
1576
|
-
const context =
|
|
1542
|
+
const context = _objectSpread2(_objectSpread2({}, opts), {}, {
|
|
1577
1543
|
url: _url,
|
|
1578
1544
|
headers,
|
|
1579
1545
|
body,
|
|
1580
1546
|
method,
|
|
1581
1547
|
signal
|
|
1582
1548
|
});
|
|
1549
|
+
/**
|
|
1550
|
+
* Run all on request hooks
|
|
1551
|
+
*/
|
|
1583
1552
|
for (const onRequest of hooks.onRequest) if (onRequest) {
|
|
1584
1553
|
const res = await onRequest(context);
|
|
1585
1554
|
if (typeof res === "object" && res !== null) Object.assign(context, res);
|
|
1586
1555
|
}
|
|
1587
|
-
if ("pipeTo" in context && typeof context.pipeTo === "function" || typeof (
|
|
1556
|
+
if ("pipeTo" in context && typeof context.pipeTo === "function" || typeof (options === null || options === void 0 || (_options$body = options.body) === null || _options$body === void 0 ? void 0 : _options$body.pipe) === "function") {
|
|
1588
1557
|
if (!("duplex" in context)) context.duplex = "half";
|
|
1589
1558
|
}
|
|
1590
|
-
const { clearTimeout
|
|
1559
|
+
const { clearTimeout } = getTimeout(opts, controller);
|
|
1591
1560
|
let response = await fetch(context.url, context);
|
|
1592
|
-
|
|
1561
|
+
clearTimeout();
|
|
1593
1562
|
const responseContext = {
|
|
1594
1563
|
response,
|
|
1595
1564
|
request: context
|
|
1596
1565
|
};
|
|
1597
1566
|
for (const onResponse of hooks.onResponse) if (onResponse) {
|
|
1598
|
-
|
|
1567
|
+
var _options$hookOptions;
|
|
1568
|
+
const r = await onResponse(_objectSpread2(_objectSpread2({}, responseContext), {}, { response: (options === null || options === void 0 || (_options$hookOptions = options.hookOptions) === null || _options$hookOptions === void 0 ? void 0 : _options$hookOptions.cloneResponse) ? response.clone() : response }));
|
|
1599
1569
|
if (r instanceof Response) response = r;
|
|
1600
1570
|
else if (typeof r === "object" && r !== null) response = r.response;
|
|
1601
1571
|
}
|
|
1572
|
+
/**
|
|
1573
|
+
* OK Branch
|
|
1574
|
+
*/
|
|
1602
1575
|
if (response.ok) {
|
|
1603
1576
|
if (!(context.method !== "HEAD")) return {
|
|
1604
1577
|
data: "",
|
|
@@ -1611,55 +1584,166 @@ var betterFetch = async (url, options) => {
|
|
|
1611
1584
|
request: context
|
|
1612
1585
|
};
|
|
1613
1586
|
if (responseType === "json" || responseType === "text") {
|
|
1587
|
+
var _context$jsonParser;
|
|
1614
1588
|
const text = await response.text();
|
|
1615
|
-
successContext.data = await ((
|
|
1589
|
+
successContext.data = await ((_context$jsonParser = context.jsonParser) !== null && _context$jsonParser !== void 0 ? _context$jsonParser : jsonParse)(text);
|
|
1616
1590
|
} else successContext.data = await response[responseType]();
|
|
1617
|
-
|
|
1591
|
+
/**
|
|
1592
|
+
* Parse the data if the output schema is defined
|
|
1593
|
+
*/
|
|
1594
|
+
if (context === null || context === void 0 ? void 0 : context.output) {
|
|
1618
1595
|
if (context.output && !context.disableValidation) successContext.data = await parseStandardSchema(context.output, successContext.data);
|
|
1619
1596
|
}
|
|
1620
|
-
for (const onSuccess of hooks.onSuccess) if (onSuccess)
|
|
1621
|
-
|
|
1597
|
+
for (const onSuccess of hooks.onSuccess) if (onSuccess) {
|
|
1598
|
+
var _options$hookOptions2;
|
|
1599
|
+
await onSuccess(_objectSpread2(_objectSpread2({}, successContext), {}, { response: (options === null || options === void 0 || (_options$hookOptions2 = options.hookOptions) === null || _options$hookOptions2 === void 0 ? void 0 : _options$hookOptions2.cloneResponse) ? response.clone() : response }));
|
|
1600
|
+
}
|
|
1601
|
+
if (options === null || options === void 0 ? void 0 : options.throw) return successContext.data;
|
|
1622
1602
|
return {
|
|
1623
1603
|
data: successContext.data,
|
|
1624
1604
|
error: null
|
|
1625
1605
|
};
|
|
1626
1606
|
}
|
|
1627
|
-
const parser = (
|
|
1607
|
+
const parser = (_options$jsonParser = options === null || options === void 0 ? void 0 : options.jsonParser) !== null && _options$jsonParser !== void 0 ? _options$jsonParser : jsonParse;
|
|
1628
1608
|
const responseText = await response.text();
|
|
1629
1609
|
const isJSONResponse = isJSONParsable(responseText);
|
|
1630
1610
|
const errorObject = isJSONResponse ? await parser(responseText) : null;
|
|
1611
|
+
/**
|
|
1612
|
+
* Error Branch
|
|
1613
|
+
*/
|
|
1631
1614
|
const errorContext = {
|
|
1632
1615
|
response,
|
|
1633
1616
|
responseText,
|
|
1634
1617
|
request: context,
|
|
1635
|
-
error:
|
|
1618
|
+
error: _objectSpread2(_objectSpread2({}, errorObject), {}, {
|
|
1636
1619
|
status: response.status,
|
|
1637
1620
|
statusText: response.statusText
|
|
1638
1621
|
})
|
|
1639
1622
|
};
|
|
1640
|
-
for (const onError of hooks.onError) if (onError)
|
|
1641
|
-
|
|
1623
|
+
for (const onError of hooks.onError) if (onError) {
|
|
1624
|
+
var _options$hookOptions3;
|
|
1625
|
+
await onError(_objectSpread2(_objectSpread2({}, errorContext), {}, { response: (options === null || options === void 0 || (_options$hookOptions3 = options.hookOptions) === null || _options$hookOptions3 === void 0 ? void 0 : _options$hookOptions3.cloneResponse) ? response.clone() : response }));
|
|
1626
|
+
}
|
|
1627
|
+
if (options === null || options === void 0 ? void 0 : options.retry) {
|
|
1628
|
+
var _options$retryAttempt;
|
|
1642
1629
|
const retryStrategy = createRetryStrategy(options.retry);
|
|
1643
|
-
const _retryAttempt = (
|
|
1630
|
+
const _retryAttempt = (_options$retryAttempt = options.retryAttempt) !== null && _options$retryAttempt !== void 0 ? _options$retryAttempt : 0;
|
|
1644
1631
|
if (await retryStrategy.shouldAttemptRetry(_retryAttempt, response)) {
|
|
1645
1632
|
for (const onRetry of hooks.onRetry) if (onRetry) await onRetry(responseContext);
|
|
1646
1633
|
const delay = retryStrategy.getDelay(_retryAttempt);
|
|
1647
1634
|
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
1648
|
-
return await betterFetch(url,
|
|
1635
|
+
return await betterFetch(url, _objectSpread2(_objectSpread2({}, options), {}, { retryAttempt: _retryAttempt + 1 }));
|
|
1649
1636
|
}
|
|
1650
1637
|
}
|
|
1651
|
-
if (options
|
|
1638
|
+
if (options === null || options === void 0 ? void 0 : options.throw) throw new BetterFetchError(response.status, response.statusText, isJSONResponse ? errorObject : responseText);
|
|
1652
1639
|
return {
|
|
1653
1640
|
data: null,
|
|
1654
|
-
error:
|
|
1641
|
+
error: _objectSpread2(_objectSpread2({}, errorObject), {}, {
|
|
1655
1642
|
status: response.status,
|
|
1656
1643
|
statusText: response.statusText
|
|
1657
1644
|
})
|
|
1658
1645
|
};
|
|
1659
1646
|
};
|
|
1647
|
+
const applySchemaPlugin = (config) => ({
|
|
1648
|
+
id: "apply-schema",
|
|
1649
|
+
name: "Apply Schema",
|
|
1650
|
+
version: "1.0.0",
|
|
1651
|
+
async init(url, options) {
|
|
1652
|
+
var _config$plugins;
|
|
1653
|
+
let opts = _objectSpread2(_objectSpread2({}, options), config.query !== void 0 && { query: _objectSpread2(_objectSpread2({}, config.query), options === null || options === void 0 ? void 0 : options.query) });
|
|
1654
|
+
const schema = ((_config$plugins = config.plugins) === null || _config$plugins === void 0 || (_config$plugins = _config$plugins.find((plugin) => {
|
|
1655
|
+
var _plugin$schema;
|
|
1656
|
+
return ((_plugin$schema = plugin.schema) === null || _plugin$schema === void 0 ? void 0 : _plugin$schema.config) ? url.startsWith(plugin.schema.config.baseURL || "") || url.startsWith(plugin.schema.config.prefix || "") : false;
|
|
1657
|
+
})) === null || _config$plugins === void 0 ? void 0 : _config$plugins.schema) || config.schema;
|
|
1658
|
+
if (schema) {
|
|
1659
|
+
var _schema$config, _schema$config2;
|
|
1660
|
+
let urlKey = url;
|
|
1661
|
+
if ((_schema$config = schema.config) === null || _schema$config === void 0 ? void 0 : _schema$config.prefix) {
|
|
1662
|
+
if (urlKey.startsWith(schema.config.prefix)) {
|
|
1663
|
+
urlKey = urlKey.replace(schema.config.prefix, "");
|
|
1664
|
+
if (schema.config.baseURL) url = url.replace(schema.config.prefix, schema.config.baseURL);
|
|
1665
|
+
}
|
|
1666
|
+
}
|
|
1667
|
+
if ((_schema$config2 = schema.config) === null || _schema$config2 === void 0 ? void 0 : _schema$config2.baseURL) {
|
|
1668
|
+
if (urlKey.startsWith(schema.config.baseURL)) urlKey = urlKey.replace(schema.config.baseURL, "");
|
|
1669
|
+
}
|
|
1670
|
+
if (urlKey.startsWith("/") && urlKey.charAt(1) === "@") urlKey = urlKey.substring(1);
|
|
1671
|
+
const keySchema = schema.schema[urlKey];
|
|
1672
|
+
if (keySchema) {
|
|
1673
|
+
var _keySchema$method;
|
|
1674
|
+
const { method: schemaMethod, path } = parseMethodModifier(urlKey);
|
|
1675
|
+
if (schemaMethod) url = url.slice(0, url.length - urlKey.length) + path;
|
|
1676
|
+
let validatedHeaders = options === null || options === void 0 ? void 0 : options.headers;
|
|
1677
|
+
if (keySchema.headers && !(options === null || options === void 0 ? void 0 : options.disableValidation)) {
|
|
1678
|
+
const normalizedHeaders = {};
|
|
1679
|
+
if (options === null || options === void 0 ? void 0 : options.headers) {
|
|
1680
|
+
if (options.headers instanceof Headers) options.headers.forEach((value, key) => {
|
|
1681
|
+
normalizedHeaders[key.toLowerCase()] = value;
|
|
1682
|
+
});
|
|
1683
|
+
else if (typeof options.headers === "object") {
|
|
1684
|
+
for (const [key, value] of Object.entries(options.headers)) if (value !== null && value !== void 0) normalizedHeaders[key.toLowerCase()] = value;
|
|
1685
|
+
}
|
|
1686
|
+
}
|
|
1687
|
+
const validated = await parseStandardSchema(keySchema.headers, normalizedHeaders);
|
|
1688
|
+
const finalHeaders = {};
|
|
1689
|
+
for (const [key, value] of Object.entries(validated)) finalHeaders[key.toLowerCase()] = value;
|
|
1690
|
+
validatedHeaders = finalHeaders;
|
|
1691
|
+
}
|
|
1692
|
+
const method = (_keySchema$method = keySchema.method) !== null && _keySchema$method !== void 0 ? _keySchema$method : schemaMethod;
|
|
1693
|
+
opts = _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, opts), method !== void 0 && { method }), keySchema.output !== void 0 && { output: keySchema.output }), validatedHeaders !== void 0 && { headers: validatedHeaders });
|
|
1694
|
+
if (!(options === null || options === void 0 ? void 0 : options.disableValidation)) {
|
|
1695
|
+
if (keySchema.query) {
|
|
1696
|
+
opts.query = await parseStandardSchema(keySchema.query, options === null || options === void 0 ? void 0 : options.query);
|
|
1697
|
+
if (opts.query !== null && typeof opts.query === "object") {
|
|
1698
|
+
const defaults = _objectSpread2({}, config.query);
|
|
1699
|
+
for (const key of Object.keys(defaults)) if ((options === null || options === void 0 ? void 0 : options.query) && Object.prototype.hasOwnProperty.call(options.query, key)) defaults[key] = options.query[key];
|
|
1700
|
+
opts.query = _objectSpread2(_objectSpread2({}, defaults), opts.query);
|
|
1701
|
+
}
|
|
1702
|
+
}
|
|
1703
|
+
opts = _objectSpread2(_objectSpread2({}, opts), {}, {
|
|
1704
|
+
body: keySchema.input ? await parseStandardSchema(keySchema.input, options === null || options === void 0 ? void 0 : options.body) : options === null || options === void 0 ? void 0 : options.body,
|
|
1705
|
+
params: keySchema.params ? await parseStandardSchema(keySchema.params, options === null || options === void 0 ? void 0 : options.params) : options === null || options === void 0 ? void 0 : options.params
|
|
1706
|
+
});
|
|
1707
|
+
}
|
|
1708
|
+
return {
|
|
1709
|
+
url,
|
|
1710
|
+
options: opts
|
|
1711
|
+
};
|
|
1712
|
+
}
|
|
1713
|
+
}
|
|
1714
|
+
return _objectSpread2({ url }, (options !== void 0 || config.query !== void 0) && { options: opts });
|
|
1715
|
+
}
|
|
1716
|
+
});
|
|
1717
|
+
const createFetch = (config) => {
|
|
1718
|
+
async function $fetch(url, options) {
|
|
1719
|
+
const opts = _objectSpread2(_objectSpread2(_objectSpread2({}, config), options), {}, {
|
|
1720
|
+
headers: mergeHeaders(config === null || config === void 0 ? void 0 : config.headers, options === null || options === void 0 ? void 0 : options.headers),
|
|
1721
|
+
plugins: [
|
|
1722
|
+
...(config === null || config === void 0 ? void 0 : config.plugins) || [],
|
|
1723
|
+
applySchemaPlugin(config || {}),
|
|
1724
|
+
...(options === null || options === void 0 ? void 0 : options.plugins) || []
|
|
1725
|
+
]
|
|
1726
|
+
});
|
|
1727
|
+
if (config === null || config === void 0 ? void 0 : config.catchAllError) try {
|
|
1728
|
+
return await betterFetch(url, opts);
|
|
1729
|
+
} catch (error) {
|
|
1730
|
+
return {
|
|
1731
|
+
data: null,
|
|
1732
|
+
error: {
|
|
1733
|
+
status: 500,
|
|
1734
|
+
statusText: "Fetch Error",
|
|
1735
|
+
message: "Fetch related error. Captured by catchAllError option. See error property for more details.",
|
|
1736
|
+
error
|
|
1737
|
+
}
|
|
1738
|
+
};
|
|
1739
|
+
}
|
|
1740
|
+
return await betterFetch(url, opts);
|
|
1741
|
+
}
|
|
1742
|
+
return $fetch;
|
|
1743
|
+
};
|
|
1660
1744
|
|
|
1661
1745
|
//#endregion
|
|
1662
|
-
//#region ../../node_modules/.pnpm/better-auth@1.7.
|
|
1746
|
+
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.4_drizzle-orm@1.0.0-rc._025f420fe344f13948728b361b367060/node_modules/better-auth/dist/client/parser.mjs
|
|
1663
1747
|
const PROTO_POLLUTION_PATTERNS = {
|
|
1664
1748
|
proto: /"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,
|
|
1665
1749
|
constructor: /"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,
|
|
@@ -1729,7 +1813,7 @@ function parseJSON(value, options = { strict: true }) {
|
|
|
1729
1813
|
}
|
|
1730
1814
|
|
|
1731
1815
|
//#endregion
|
|
1732
|
-
//#region ../../node_modules/.pnpm/better-auth@1.7.
|
|
1816
|
+
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.4_drizzle-orm@1.0.0-rc._025f420fe344f13948728b361b367060/node_modules/better-auth/dist/plugins/organization/access/statement.mjs
|
|
1733
1817
|
const defaultStatements = {
|
|
1734
1818
|
organization: ["update", "delete"],
|
|
1735
1819
|
member: [
|
|
@@ -1805,7 +1889,7 @@ const defaultRoles = {
|
|
|
1805
1889
|
};
|
|
1806
1890
|
|
|
1807
1891
|
//#endregion
|
|
1808
|
-
//#region ../../node_modules/.pnpm/better-auth@1.7.
|
|
1892
|
+
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.4_drizzle-orm@1.0.0-rc._025f420fe344f13948728b361b367060/node_modules/better-auth/dist/plugins/organization/permission.mjs
|
|
1809
1893
|
const hasPermissionFn = (input, acRoles) => {
|
|
1810
1894
|
if (!input.permissions) return false;
|
|
1811
1895
|
const roles = input.role.split(",");
|
|
@@ -1818,7 +1902,7 @@ const hasPermissionFn = (input, acRoles) => {
|
|
|
1818
1902
|
};
|
|
1819
1903
|
|
|
1820
1904
|
//#endregion
|
|
1821
|
-
//#region ../../node_modules/.pnpm/better-auth@1.7.
|
|
1905
|
+
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.4_drizzle-orm@1.0.0-rc._025f420fe344f13948728b361b367060/node_modules/better-auth/dist/plugins/organization/error-codes.mjs
|
|
1822
1906
|
const ORGANIZATION_ERROR_CODES = defineErrorCodes({
|
|
1823
1907
|
YOU_ARE_NOT_ALLOWED_TO_CREATE_A_NEW_ORGANIZATION: "You are not allowed to create a new organization",
|
|
1824
1908
|
YOU_HAVE_REACHED_THE_MAXIMUM_NUMBER_OF_ORGANIZATIONS: "You have reached the maximum number of organizations",
|
|
@@ -1910,6 +1994,7 @@ const t$1 = createAccessControl({
|
|
|
1910
1994
|
`read`,
|
|
1911
1995
|
`update`,
|
|
1912
1996
|
`archive`,
|
|
1997
|
+
`restore`,
|
|
1913
1998
|
`assign_teams`
|
|
1914
1999
|
],
|
|
1915
2000
|
environment: [
|
|
@@ -1917,13 +2002,15 @@ const t$1 = createAccessControl({
|
|
|
1917
2002
|
`read`,
|
|
1918
2003
|
`update`,
|
|
1919
2004
|
`archive`,
|
|
2005
|
+
`restore`,
|
|
1920
2006
|
`set_production`
|
|
1921
2007
|
],
|
|
1922
2008
|
flag: [
|
|
1923
2009
|
`read`,
|
|
1924
2010
|
`create`,
|
|
1925
2011
|
`update`,
|
|
1926
|
-
`archive
|
|
2012
|
+
`archive`,
|
|
2013
|
+
`restore`
|
|
1927
2014
|
],
|
|
1928
2015
|
flag_state: [`update`],
|
|
1929
2016
|
flag_production: [`toggle`],
|
|
@@ -2023,6 +2110,7 @@ const n$1 = {
|
|
|
2023
2110
|
`read`,
|
|
2024
2111
|
`update`,
|
|
2025
2112
|
`archive`,
|
|
2113
|
+
`restore`,
|
|
2026
2114
|
`assign_teams`
|
|
2027
2115
|
],
|
|
2028
2116
|
environment: [
|
|
@@ -2030,13 +2118,15 @@ const n$1 = {
|
|
|
2030
2118
|
`read`,
|
|
2031
2119
|
`update`,
|
|
2032
2120
|
`archive`,
|
|
2121
|
+
`restore`,
|
|
2033
2122
|
`set_production`
|
|
2034
2123
|
],
|
|
2035
2124
|
flag: [
|
|
2036
2125
|
`read`,
|
|
2037
2126
|
`create`,
|
|
2038
2127
|
`update`,
|
|
2039
|
-
`archive
|
|
2128
|
+
`archive`,
|
|
2129
|
+
`restore`
|
|
2040
2130
|
],
|
|
2041
2131
|
flag_state: [`update`],
|
|
2042
2132
|
flag_production: [`toggle`],
|
|
@@ -2095,6 +2185,7 @@ const n$1 = {
|
|
|
2095
2185
|
`read`,
|
|
2096
2186
|
`update`,
|
|
2097
2187
|
`archive`,
|
|
2188
|
+
`restore`,
|
|
2098
2189
|
`assign_teams`
|
|
2099
2190
|
],
|
|
2100
2191
|
environment: [
|
|
@@ -2102,13 +2193,15 @@ const n$1 = {
|
|
|
2102
2193
|
`read`,
|
|
2103
2194
|
`update`,
|
|
2104
2195
|
`archive`,
|
|
2196
|
+
`restore`,
|
|
2105
2197
|
`set_production`
|
|
2106
2198
|
],
|
|
2107
2199
|
flag: [
|
|
2108
2200
|
`read`,
|
|
2109
2201
|
`create`,
|
|
2110
2202
|
`update`,
|
|
2111
|
-
`archive
|
|
2203
|
+
`archive`,
|
|
2204
|
+
`restore`
|
|
2112
2205
|
],
|
|
2113
2206
|
flag_state: [`update`],
|
|
2114
2207
|
flag_production: [`toggle`],
|
|
@@ -2147,7 +2240,7 @@ const n$1 = {
|
|
|
2147
2240
|
};
|
|
2148
2241
|
|
|
2149
2242
|
//#endregion
|
|
2150
|
-
//#region ../../node_modules/.pnpm/better-auth@1.7.
|
|
2243
|
+
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.4_drizzle-orm@1.0.0-rc._025f420fe344f13948728b361b367060/node_modules/better-auth/dist/client/broadcast-channel.mjs
|
|
2151
2244
|
const kBroadcastChannel = Symbol.for("better-auth:broadcast-channel");
|
|
2152
2245
|
const now$1 = () => Math.floor(Date.now() / 1e3);
|
|
2153
2246
|
var WindowBroadcastChannel = class {
|
|
@@ -2371,7 +2464,7 @@ let onMount = ($store, initialize) => {
|
|
|
2371
2464
|
};
|
|
2372
2465
|
|
|
2373
2466
|
//#endregion
|
|
2374
|
-
//#region ../../node_modules/.pnpm/better-auth@1.7.
|
|
2467
|
+
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.4_drizzle-orm@1.0.0-rc._025f420fe344f13948728b361b367060/node_modules/better-auth/dist/client/equality.mjs
|
|
2375
2468
|
function isPlainObject(value) {
|
|
2376
2469
|
if (typeof value !== "object" || value === null) return false;
|
|
2377
2470
|
const prototype = Object.getPrototypeOf(value);
|
|
@@ -2412,7 +2505,7 @@ function withEquality(store, isEqual) {
|
|
|
2412
2505
|
}
|
|
2413
2506
|
|
|
2414
2507
|
//#endregion
|
|
2415
|
-
//#region ../../node_modules/.pnpm/better-auth@1.7.
|
|
2508
|
+
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.4_drizzle-orm@1.0.0-rc._025f420fe344f13948728b361b367060/node_modules/better-auth/dist/client/focus-manager.mjs
|
|
2416
2509
|
const kFocusManager = Symbol.for("better-auth:focus-manager");
|
|
2417
2510
|
var WindowFocusManager = class {
|
|
2418
2511
|
listeners = /* @__PURE__ */ new Set();
|
|
@@ -2442,7 +2535,7 @@ function getGlobalFocusManager() {
|
|
|
2442
2535
|
}
|
|
2443
2536
|
|
|
2444
2537
|
//#endregion
|
|
2445
|
-
//#region ../../node_modules/.pnpm/better-auth@1.7.
|
|
2538
|
+
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.4_drizzle-orm@1.0.0-rc._025f420fe344f13948728b361b367060/node_modules/better-auth/dist/client/online-manager.mjs
|
|
2446
2539
|
const kOnlineManager = Symbol.for("better-auth:online-manager");
|
|
2447
2540
|
var WindowOnlineManager = class {
|
|
2448
2541
|
listeners = /* @__PURE__ */ new Set();
|
|
@@ -2475,13 +2568,22 @@ function getGlobalOnlineManager() {
|
|
|
2475
2568
|
}
|
|
2476
2569
|
|
|
2477
2570
|
//#endregion
|
|
2478
|
-
//#region ../../node_modules/.pnpm/better-auth@1.7.
|
|
2571
|
+
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.4_drizzle-orm@1.0.0-rc._025f420fe344f13948728b361b367060/node_modules/better-auth/dist/client/query-atom.mjs
|
|
2572
|
+
const kAuthQuery = Symbol.for("better-auth:auth-query");
|
|
2573
|
+
function createAuthQueryAtom(initialValue) {
|
|
2574
|
+
const queryAtom = /* @__PURE__ */ atom(initialValue);
|
|
2575
|
+
Object.defineProperty(queryAtom, kAuthQuery, { value: true });
|
|
2576
|
+
return queryAtom;
|
|
2577
|
+
}
|
|
2578
|
+
|
|
2579
|
+
//#endregion
|
|
2580
|
+
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.4_drizzle-orm@1.0.0-rc._025f420fe344f13948728b361b367060/node_modules/better-auth/dist/client/query.mjs
|
|
2479
2581
|
const isServer$1 = () => typeof window === "undefined";
|
|
2480
2582
|
function isAuthQueryStateEqual(a, b) {
|
|
2481
2583
|
return isJsonEqual(a.data, b.data) && a.error === b.error && a.isPending === b.isPending && a.isRefetching === b.isRefetching && a.refetch === b.refetch;
|
|
2482
2584
|
}
|
|
2483
2585
|
const useAuthQuery = (initializedAtom, path, $fetch, options) => {
|
|
2484
|
-
const value =
|
|
2586
|
+
const value = createAuthQueryAtom({
|
|
2485
2587
|
data: null,
|
|
2486
2588
|
error: null,
|
|
2487
2589
|
isPending: true,
|
|
@@ -2489,7 +2591,9 @@ const useAuthQuery = (initializedAtom, path, $fetch, options) => {
|
|
|
2489
2591
|
refetch: (queryParams) => fn(queryParams)
|
|
2490
2592
|
});
|
|
2491
2593
|
onMount(value, () => withEquality(value, isAuthQueryStateEqual));
|
|
2594
|
+
let latestRequestId = 0;
|
|
2492
2595
|
const fn = async (queryParams) => {
|
|
2596
|
+
const requestId = ++latestRequestId;
|
|
2493
2597
|
return new Promise((resolve) => {
|
|
2494
2598
|
const opts = typeof options === "function" ? options({
|
|
2495
2599
|
data: value.get().data,
|
|
@@ -2503,15 +2607,17 @@ const useAuthQuery = (initializedAtom, path, $fetch, options) => {
|
|
|
2503
2607
|
...queryParams?.query
|
|
2504
2608
|
},
|
|
2505
2609
|
async onSuccess(context) {
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2610
|
+
if (requestId === latestRequestId) {
|
|
2611
|
+
const current = value.get();
|
|
2612
|
+
const stableData = current.data != null && context.data != null && isJsonEqual(current.data, context.data) ? current.data : context.data;
|
|
2613
|
+
value.set({
|
|
2614
|
+
data: stableData,
|
|
2615
|
+
error: null,
|
|
2616
|
+
isPending: false,
|
|
2617
|
+
isRefetching: false,
|
|
2618
|
+
refetch: value.value.refetch
|
|
2619
|
+
});
|
|
2620
|
+
}
|
|
2515
2621
|
await opts?.onSuccess?.(context);
|
|
2516
2622
|
},
|
|
2517
2623
|
async onError(context) {
|
|
@@ -2519,28 +2625,33 @@ const useAuthQuery = (initializedAtom, path, $fetch, options) => {
|
|
|
2519
2625
|
const retryAttempts = typeof request.retry === "number" ? request.retry : request.retry?.attempts;
|
|
2520
2626
|
const retryAttempt = request.retryAttempt || 0;
|
|
2521
2627
|
if (retryAttempts && retryAttempt < retryAttempts) return;
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2628
|
+
if (requestId === latestRequestId) {
|
|
2629
|
+
const isUnauthorized = context.error.status === 401;
|
|
2630
|
+
value.set({
|
|
2631
|
+
error: context.error,
|
|
2632
|
+
data: isUnauthorized ? null : value.get().data,
|
|
2633
|
+
isPending: false,
|
|
2634
|
+
isRefetching: false,
|
|
2635
|
+
refetch: value.value.refetch
|
|
2636
|
+
});
|
|
2637
|
+
}
|
|
2530
2638
|
await opts?.onError?.(context);
|
|
2531
2639
|
},
|
|
2532
2640
|
async onRequest(context) {
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2641
|
+
if (requestId === latestRequestId) {
|
|
2642
|
+
const currentValue = value.get();
|
|
2643
|
+
value.set({
|
|
2644
|
+
isPending: currentValue.data === null,
|
|
2645
|
+
data: currentValue.data,
|
|
2646
|
+
error: null,
|
|
2647
|
+
isRefetching: true,
|
|
2648
|
+
refetch: value.value.refetch
|
|
2649
|
+
});
|
|
2650
|
+
}
|
|
2541
2651
|
await opts?.onRequest?.(context);
|
|
2542
2652
|
}
|
|
2543
2653
|
}).catch((error) => {
|
|
2654
|
+
if (requestId !== latestRequestId) return;
|
|
2544
2655
|
value.set({
|
|
2545
2656
|
error,
|
|
2546
2657
|
data: value.get().data,
|
|
@@ -2597,7 +2708,7 @@ const useAuthQuery = (initializedAtom, path, $fetch, options) => {
|
|
|
2597
2708
|
};
|
|
2598
2709
|
|
|
2599
2710
|
//#endregion
|
|
2600
|
-
//#region ../../node_modules/.pnpm/better-auth@1.7.
|
|
2711
|
+
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.4_drizzle-orm@1.0.0-rc._025f420fe344f13948728b361b367060/node_modules/better-auth/dist/client/session-refresh.mjs
|
|
2601
2712
|
const now = () => Math.floor(Date.now() / 1e3);
|
|
2602
2713
|
/**
|
|
2603
2714
|
* Rate limit: don't refetch on focus if a session request was made within this many seconds
|
|
@@ -2725,7 +2836,7 @@ function createSessionRefreshManager(opts) {
|
|
|
2725
2836
|
}
|
|
2726
2837
|
|
|
2727
2838
|
//#endregion
|
|
2728
|
-
//#region ../../node_modules/.pnpm/better-auth@1.7.
|
|
2839
|
+
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.4_drizzle-orm@1.0.0-rc._025f420fe344f13948728b361b367060/node_modules/better-auth/dist/client/fetch-plugins.mjs
|
|
2729
2840
|
const redirectPlugin = {
|
|
2730
2841
|
id: "redirect",
|
|
2731
2842
|
name: "Redirect",
|
|
@@ -2741,7 +2852,7 @@ const redirectPlugin = {
|
|
|
2741
2852
|
};
|
|
2742
2853
|
|
|
2743
2854
|
//#endregion
|
|
2744
|
-
//#region ../../node_modules/.pnpm/better-auth@1.7.
|
|
2855
|
+
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.4_drizzle-orm@1.0.0-rc._025f420fe344f13948728b361b367060/node_modules/better-auth/dist/client/session-atom.mjs
|
|
2745
2856
|
const isServer = () => typeof window === "undefined";
|
|
2746
2857
|
const SESSION_MOUNT_DEDUPE_INTERVAL = STORE_UNMOUNT_DELAY;
|
|
2747
2858
|
function hydrateSessionAtom(sessionAtom, session) {
|
|
@@ -2784,7 +2895,7 @@ function getSessionAtom($fetch, options) {
|
|
|
2784
2895
|
freshUntil = 0;
|
|
2785
2896
|
});
|
|
2786
2897
|
const refetch = (queryParams) => fetchSession(queryParams);
|
|
2787
|
-
const session =
|
|
2898
|
+
const session = createAuthQueryAtom({
|
|
2788
2899
|
data: null,
|
|
2789
2900
|
error: null,
|
|
2790
2901
|
isPending: true,
|
|
@@ -2916,7 +3027,7 @@ function getSessionAtom($fetch, options) {
|
|
|
2916
3027
|
}
|
|
2917
3028
|
|
|
2918
3029
|
//#endregion
|
|
2919
|
-
//#region ../../node_modules/.pnpm/better-auth@1.7.
|
|
3030
|
+
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.4_drizzle-orm@1.0.0-rc._025f420fe344f13948728b361b367060/node_modules/better-auth/dist/client/config.mjs
|
|
2920
3031
|
const resolvePublicAuthUrl = (basePath) => {
|
|
2921
3032
|
if (typeof process === "undefined") return void 0;
|
|
2922
3033
|
const path = basePath ?? "/api/auth";
|
|
@@ -2931,6 +3042,7 @@ const resolvePublicAuthUrl = (basePath) => {
|
|
|
2931
3042
|
} catch {}
|
|
2932
3043
|
}
|
|
2933
3044
|
};
|
|
3045
|
+
const matchesSessionSignal = (path) => path === "/sign-out" || path === "/update-user" || path === "/update-session" || path === "/sign-up/email" || path === "/sign-in/email" || path === "/delete-user" || path === "/verify-email" || path === "/revoke-sessions" || path === "/revoke-session" || path === "/revoke-other-sessions" || path === "/change-email" || path === "/change-password";
|
|
2934
3046
|
const getClientConfig = (options, loadEnv) => {
|
|
2935
3047
|
const isCredentialsSupported = "credentials" in Request.prototype;
|
|
2936
3048
|
const baseURL = getBaseURL(options?.baseURL, options?.basePath, void 0, loadEnv) ?? resolvePublicAuthUrl(options?.basePath) ?? "/api/auth";
|
|
@@ -2984,9 +3096,7 @@ const getClientConfig = (options, loadEnv) => {
|
|
|
2984
3096
|
};
|
|
2985
3097
|
const atomListeners = [{
|
|
2986
3098
|
signal: "$sessionSignal",
|
|
2987
|
-
matcher
|
|
2988
|
-
return path === "/sign-out" || path === "/update-user" || path === "/update-session" || path === "/sign-up/email" || path === "/sign-in/email" || path === "/delete-user" || path === "/verify-email" || path === "/revoke-sessions" || path === "/revoke-session" || path === "/revoke-other-sessions" || path === "/change-email" || path === "/change-password";
|
|
2989
|
-
},
|
|
3099
|
+
matcher: matchesSessionSignal,
|
|
2990
3100
|
callback(path) {
|
|
2991
3101
|
if (path === "/sign-out") broadcastSessionUpdate("signout");
|
|
2992
3102
|
else if (path === "/update-user" || path === "/update-session") broadcastSessionUpdate("updateUser");
|
|
@@ -3016,19 +3126,20 @@ const getClientConfig = (options, loadEnv) => {
|
|
|
3016
3126
|
pluginPathMethods,
|
|
3017
3127
|
atomListeners,
|
|
3018
3128
|
hydrateSession,
|
|
3129
|
+
$sessionSignal,
|
|
3019
3130
|
$fetch,
|
|
3020
3131
|
$store
|
|
3021
3132
|
};
|
|
3022
3133
|
};
|
|
3023
3134
|
|
|
3024
3135
|
//#endregion
|
|
3025
|
-
//#region ../../node_modules/.pnpm/better-auth@1.7.
|
|
3136
|
+
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.4_drizzle-orm@1.0.0-rc._025f420fe344f13948728b361b367060/node_modules/better-auth/dist/utils/is-atom.mjs
|
|
3026
3137
|
function isAtom(value) {
|
|
3027
3138
|
return typeof value === "object" && value !== null && "get" in value && typeof value.get === "function" && "lc" in value && typeof value.lc === "number";
|
|
3028
3139
|
}
|
|
3029
3140
|
|
|
3030
3141
|
//#endregion
|
|
3031
|
-
//#region ../../node_modules/.pnpm/@better-auth+core@1.7.
|
|
3142
|
+
//#region ../../node_modules/.pnpm/@better-auth+core@1.7.7_@better-auth+utils@0.4.2_@better-fetch+fetch@1.3.2_@opentelemet_e02eb0bf6cc57b8ec4097db90c5ddf37/node_modules/@better-auth/core/dist/utils/string.mjs
|
|
3032
3143
|
function capitalizeFirstLetter(str) {
|
|
3033
3144
|
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
3034
3145
|
}
|
|
@@ -3042,7 +3153,7 @@ function toKebabCase(input) {
|
|
|
3042
3153
|
}
|
|
3043
3154
|
|
|
3044
3155
|
//#endregion
|
|
3045
|
-
//#region ../../node_modules/.pnpm/better-auth@1.7.
|
|
3156
|
+
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.4_drizzle-orm@1.0.0-rc._025f420fe344f13948728b361b367060/node_modules/better-auth/dist/client/proxy.mjs
|
|
3046
3157
|
function getMethod(path, knownPathMethods, args) {
|
|
3047
3158
|
const method = knownPathMethods[path];
|
|
3048
3159
|
const { fetchOptions, query: _query, ...body } = args || {};
|
|
@@ -3118,7 +3229,7 @@ function createDynamicPathProxy(routes, client, knownPathMethods, atoms, atomLis
|
|
|
3118
3229
|
}
|
|
3119
3230
|
|
|
3120
3231
|
//#endregion
|
|
3121
|
-
//#region ../../node_modules/.pnpm/better-auth@1.7.
|
|
3232
|
+
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.4_drizzle-orm@1.0.0-rc._025f420fe344f13948728b361b367060/node_modules/better-auth/dist/client/vanilla.mjs
|
|
3122
3233
|
function createAuthClient(options) {
|
|
3123
3234
|
const { pluginPathMethods, pluginsActions, pluginsAtoms, hydrateSession, $fetch, atomListeners, $store } = getClientConfig(options);
|
|
3124
3235
|
const resolvedHooks = {};
|
|
@@ -3133,7 +3244,7 @@ function createAuthClient(options) {
|
|
|
3133
3244
|
}
|
|
3134
3245
|
|
|
3135
3246
|
//#endregion
|
|
3136
|
-
//#region ../../node_modules/.pnpm/better-auth@1.7.
|
|
3247
|
+
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.4_drizzle-orm@1.0.0-rc._025f420fe344f13948728b361b367060/node_modules/better-auth/dist/plugins/additional-fields/client.mjs
|
|
3137
3248
|
const inferAdditionalFields = (schema) => {
|
|
3138
3249
|
return {
|
|
3139
3250
|
id: "additional-fields-client",
|
|
@@ -3143,7 +3254,7 @@ const inferAdditionalFields = (schema) => {
|
|
|
3143
3254
|
};
|
|
3144
3255
|
|
|
3145
3256
|
//#endregion
|
|
3146
|
-
//#region ../../node_modules/.pnpm/better-auth@1.7.
|
|
3257
|
+
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.4_drizzle-orm@1.0.0-rc._025f420fe344f13948728b361b367060/node_modules/better-auth/dist/plugins/admin/client.mjs
|
|
3147
3258
|
const adminClient = (options) => {
|
|
3148
3259
|
const roles = {
|
|
3149
3260
|
admin: adminAc$1,
|
|
@@ -3178,7 +3289,7 @@ const adminClient = (options) => {
|
|
|
3178
3289
|
};
|
|
3179
3290
|
|
|
3180
3291
|
//#endregion
|
|
3181
|
-
//#region ../../node_modules/.pnpm/better-auth@1.7.
|
|
3292
|
+
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.4_drizzle-orm@1.0.0-rc._025f420fe344f13948728b361b367060/node_modules/better-auth/dist/plugins/device-authorization/client.mjs
|
|
3182
3293
|
const deviceAuthorizationClient = () => {
|
|
3183
3294
|
return {
|
|
3184
3295
|
id: "device-authorization",
|
|
@@ -3195,7 +3306,7 @@ const deviceAuthorizationClient = () => {
|
|
|
3195
3306
|
};
|
|
3196
3307
|
|
|
3197
3308
|
//#endregion
|
|
3198
|
-
//#region ../../node_modules/.pnpm/better-auth@1.7.
|
|
3309
|
+
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.4_drizzle-orm@1.0.0-rc._025f420fe344f13948728b361b367060/node_modules/better-auth/dist/plugins/organization/client.mjs
|
|
3199
3310
|
/**
|
|
3200
3311
|
* Using the same `hasPermissionFn` function, but without the need for a `ctx` parameter or the `organizationId` parameter.
|
|
3201
3312
|
*/
|
|
@@ -3262,7 +3373,7 @@ const organizationClient = (options) => {
|
|
|
3262
3373
|
},
|
|
3263
3374
|
{
|
|
3264
3375
|
matcher(path) {
|
|
3265
|
-
return path
|
|
3376
|
+
return matchesSessionSignal(path) || path.startsWith("/organization");
|
|
3266
3377
|
},
|
|
3267
3378
|
signal: "$activeOrgSignal"
|
|
3268
3379
|
},
|
|
@@ -3290,7 +3401,7 @@ const organizationClient = (options) => {
|
|
|
3290
3401
|
};
|
|
3291
3402
|
|
|
3292
3403
|
//#endregion
|
|
3293
|
-
//#region ../../node_modules/.pnpm/@better-auth+api-key@1.7.
|
|
3404
|
+
//#region ../../node_modules/.pnpm/@better-auth+api-key@1.7.7_@better-auth+core@1.7.7_@better-auth+utils@0.4.2_@better-fet_1231755eab9fee363c80bc8eefaed94a/node_modules/@better-auth/api-key/dist/version-CUtTQbZf.mjs
|
|
3294
3405
|
const API_KEY_ERROR_CODES = defineErrorCodes({
|
|
3295
3406
|
INVALID_METADATA_TYPE: "metadata must be an object or undefined",
|
|
3296
3407
|
REFILL_AMOUNT_AND_INTERVAL_REQUIRED: "refillAmount is required when refillInterval is provided",
|
|
@@ -3324,10 +3435,10 @@ const API_KEY_ERROR_CODES = defineErrorCodes({
|
|
|
3324
3435
|
NO_DEFAULT_API_KEY_CONFIGURATION_FOUND: "No default api-key configuration found.",
|
|
3325
3436
|
ORGANIZATION_PLUGIN_REQUIRED: "Organization plugin is required for organization-owned API keys. Please install and configure the organization plugin."
|
|
3326
3437
|
});
|
|
3327
|
-
const PACKAGE_VERSION$2 = "1.7.
|
|
3438
|
+
const PACKAGE_VERSION$2 = "1.7.7";
|
|
3328
3439
|
|
|
3329
3440
|
//#endregion
|
|
3330
|
-
//#region ../../node_modules/.pnpm/@better-auth+api-key@1.7.
|
|
3441
|
+
//#region ../../node_modules/.pnpm/@better-auth+api-key@1.7.7_@better-auth+core@1.7.7_@better-auth+utils@0.4.2_@better-fet_1231755eab9fee363c80bc8eefaed94a/node_modules/@better-auth/api-key/dist/client.mjs
|
|
3331
3442
|
const apiKeyClient = () => {
|
|
3332
3443
|
return {
|
|
3333
3444
|
id: "api-key",
|
|
@@ -3343,7 +3454,7 @@ const apiKeyClient = () => {
|
|
|
3343
3454
|
};
|
|
3344
3455
|
|
|
3345
3456
|
//#endregion
|
|
3346
|
-
//#region ../../node_modules/.pnpm/@better-auth+passkey@1.7.
|
|
3457
|
+
//#region ../../node_modules/.pnpm/@better-auth+passkey@1.7.7_8a2847836f4e26061e61f8849e215b9d/node_modules/@better-auth/passkey/dist/version-Bx477_EO.mjs
|
|
3347
3458
|
const PASSKEY_ERROR_CODES = defineErrorCodes({
|
|
3348
3459
|
CHALLENGE_NOT_FOUND: "Challenge not found",
|
|
3349
3460
|
YOU_ARE_NOT_ALLOWED_TO_REGISTER_THIS_PASSKEY: "You are not allowed to register this passkey",
|
|
@@ -3361,7 +3472,7 @@ const PASSKEY_ERROR_CODES = defineErrorCodes({
|
|
|
3361
3472
|
RESOLVE_USER_REQUIRED: "Passkey registration requires either an authenticated session or a resolveUser callback when requireSession is false",
|
|
3362
3473
|
RESOLVED_USER_INVALID: "Resolved user is invalid"
|
|
3363
3474
|
});
|
|
3364
|
-
const PACKAGE_VERSION$1 = "1.7.
|
|
3475
|
+
const PACKAGE_VERSION$1 = "1.7.7";
|
|
3365
3476
|
|
|
3366
3477
|
//#endregion
|
|
3367
3478
|
//#region ../../node_modules/.pnpm/@simplewebauthn+browser@13.3.0/node_modules/@simplewebauthn/browser/esm/helpers/bufferToBase64URLString.js
|
|
@@ -3833,7 +3944,7 @@ async function startAuthentication(options) {
|
|
|
3833
3944
|
}
|
|
3834
3945
|
|
|
3835
3946
|
//#endregion
|
|
3836
|
-
//#region ../../node_modules/.pnpm/@better-auth+passkey@1.7.
|
|
3947
|
+
//#region ../../node_modules/.pnpm/@better-auth+passkey@1.7.7_8a2847836f4e26061e61f8849e215b9d/node_modules/@better-auth/passkey/dist/client.mjs
|
|
3837
3948
|
const getPasskeyActions = ($fetch, { $listPasskeys, $store }) => {
|
|
3838
3949
|
const signInPasskey = async (opts, options) => {
|
|
3839
3950
|
const response = await $fetch("/passkey/generate-authenticate-options", {
|
|
@@ -4035,11 +4146,11 @@ const passkeyClient = () => {
|
|
|
4035
4146
|
};
|
|
4036
4147
|
|
|
4037
4148
|
//#endregion
|
|
4038
|
-
//#region ../../node_modules/.pnpm/@better-auth+sso@1.7.
|
|
4039
|
-
const PACKAGE_VERSION = "1.7.
|
|
4149
|
+
//#region ../../node_modules/.pnpm/@better-auth+sso@1.7.7_9007e608a51715e1e8e182bfada736ab/node_modules/@better-auth/sso/dist/version-DFla2W8i.mjs
|
|
4150
|
+
const PACKAGE_VERSION = "1.7.7";
|
|
4040
4151
|
|
|
4041
4152
|
//#endregion
|
|
4042
|
-
//#region ../../node_modules/.pnpm/@better-auth+sso@1.7.
|
|
4153
|
+
//#region ../../node_modules/.pnpm/@better-auth+sso@1.7.7_9007e608a51715e1e8e182bfada736ab/node_modules/@better-auth/sso/dist/client.mjs
|
|
4043
4154
|
const ssoClient = (options) => {
|
|
4044
4155
|
return {
|
|
4045
4156
|
id: "sso-client",
|
|
@@ -4275,7 +4386,6 @@ function e(e) {
|
|
|
4275
4386
|
//#region src/commands/auth.ts
|
|
4276
4387
|
const CLIENT_ID = "shipd-cli";
|
|
4277
4388
|
const MANAGEMENT_KEY_PREFIX = "shipd_mgmt_";
|
|
4278
|
-
const DEFAULT_API_URL = "https://api.useshipd.com";
|
|
4279
4389
|
function registerAuthCommands(program) {
|
|
4280
4390
|
program.command("login").description("Authenticate via browser device authorization").addOption(new Option("--api-url <url>", `API origin (default: ${DEFAULT_API_URL})`).env("SHIPD_API_URL")).action(async (_opts, command) => {
|
|
4281
4391
|
const runtime = getRuntime(command, { defaultApiUrl: DEFAULT_API_URL });
|
|
@@ -4520,25 +4630,27 @@ const T = z.object({
|
|
|
4520
4630
|
tags: z.array(z.string()).optional()
|
|
4521
4631
|
});
|
|
4522
4632
|
const E = z.object({ flagId: z.string().min(1) });
|
|
4523
|
-
const D = z.object({
|
|
4633
|
+
const D = z.object({ projectId: z.string().min(1) });
|
|
4634
|
+
const O = z.object({ flagId: z.string().min(1) });
|
|
4635
|
+
const k = z.object({
|
|
4524
4636
|
flagId: z.string().min(1),
|
|
4525
4637
|
environmentId: z.string().min(1),
|
|
4526
4638
|
enabled: z.boolean().optional(),
|
|
4527
4639
|
rules: z.array(b).optional(),
|
|
4528
4640
|
fallthrough: u.optional()
|
|
4529
4641
|
});
|
|
4530
|
-
const
|
|
4642
|
+
const A = z.object({
|
|
4531
4643
|
flagId: z.string().min(1),
|
|
4532
4644
|
environmentId: z.string().min(1),
|
|
4533
4645
|
enabled: z.boolean()
|
|
4534
4646
|
});
|
|
4535
|
-
const
|
|
4536
|
-
const
|
|
4537
|
-
function
|
|
4647
|
+
const j = z.object({ flagId: z.string().min(1) });
|
|
4648
|
+
const M = z.enum([`active`, `deprecated`]);
|
|
4649
|
+
function N(e) {
|
|
4538
4650
|
let t = Object.getPrototypeOf(e);
|
|
4539
4651
|
return t === Object.prototype || t === null;
|
|
4540
4652
|
}
|
|
4541
|
-
function
|
|
4653
|
+
function P(e, t) {
|
|
4542
4654
|
if (e === null) return !0;
|
|
4543
4655
|
switch (typeof e) {
|
|
4544
4656
|
case `boolean`:
|
|
@@ -4546,13 +4658,13 @@ function M(e, t) {
|
|
|
4546
4658
|
case `number`: return Number.isFinite(e);
|
|
4547
4659
|
case `object`: {
|
|
4548
4660
|
let n = t ?? /* @__PURE__ */ new WeakSet();
|
|
4549
|
-
return !n.has(e) && (n.add(e), Array.isArray(e) ? e.every((e) =>
|
|
4661
|
+
return !n.has(e) && (n.add(e), Array.isArray(e) ? e.every((e) => P(e, n)) : !N(e) || Object.getOwnPropertySymbols(e).length > 0 ? !1 : Object.keys(e).every((t) => P(e[t], n)));
|
|
4550
4662
|
}
|
|
4551
4663
|
default: return !1;
|
|
4552
4664
|
}
|
|
4553
4665
|
}
|
|
4554
|
-
const
|
|
4555
|
-
function
|
|
4666
|
+
const F = z.custom(P, { message: `default must be JSON-serializable` });
|
|
4667
|
+
function I(e, t) {
|
|
4556
4668
|
switch (e.type) {
|
|
4557
4669
|
case `boolean`:
|
|
4558
4670
|
typeof e.default != `boolean` && t.addIssue({
|
|
@@ -4581,43 +4693,43 @@ function P(e, t) {
|
|
|
4581
4693
|
});
|
|
4582
4694
|
break;
|
|
4583
4695
|
}
|
|
4584
|
-
case `json`:
|
|
4696
|
+
case `json`: F.safeParse(e.default).success || t.addIssue({
|
|
4585
4697
|
code: `custom`,
|
|
4586
4698
|
path: [`default`],
|
|
4587
4699
|
message: `json flag default must be JSON-serializable`
|
|
4588
4700
|
});
|
|
4589
4701
|
}
|
|
4590
4702
|
}
|
|
4591
|
-
const
|
|
4703
|
+
const L = z.object({
|
|
4592
4704
|
key: o,
|
|
4593
4705
|
type: t,
|
|
4594
4706
|
default: z.unknown(),
|
|
4595
4707
|
description: z.string().optional(),
|
|
4596
4708
|
tags: z.array(z.string()).default([]),
|
|
4597
|
-
lifecycle:
|
|
4709
|
+
lifecycle: M.default(`active`),
|
|
4598
4710
|
variants: z.array(z.string()).optional(),
|
|
4599
4711
|
disabled: z.boolean().optional()
|
|
4600
4712
|
});
|
|
4601
|
-
const
|
|
4602
|
-
const
|
|
4713
|
+
const R = L.superRefine(I);
|
|
4714
|
+
const z$1 = L.extend({
|
|
4603
4715
|
version: z.number().int().positive(),
|
|
4604
4716
|
environmentVersion: z.number().int().positive().optional(),
|
|
4605
4717
|
managedBy: n
|
|
4606
|
-
}).superRefine(
|
|
4607
|
-
const
|
|
4718
|
+
}).superRefine(I);
|
|
4719
|
+
const B = z.object({
|
|
4608
4720
|
version: z.number().int().positive(),
|
|
4609
4721
|
environmentVersion: z.number().int().positive().optional()
|
|
4610
4722
|
});
|
|
4611
|
-
const
|
|
4723
|
+
const V = z.object({
|
|
4612
4724
|
projectId: z.string().min(1),
|
|
4613
4725
|
environmentId: z.string().min(1)
|
|
4614
4726
|
});
|
|
4615
|
-
const
|
|
4727
|
+
const H = z.object({
|
|
4616
4728
|
projectId: z.string(),
|
|
4617
4729
|
environmentId: z.string(),
|
|
4618
|
-
flags: z.array(
|
|
4730
|
+
flags: z.array(z$1)
|
|
4619
4731
|
});
|
|
4620
|
-
function
|
|
4732
|
+
function U(e, t) {
|
|
4621
4733
|
let n = /* @__PURE__ */ new Set();
|
|
4622
4734
|
for (let [r, i] of e.entries()) n.has(i.key) && t.addIssue({
|
|
4623
4735
|
code: `custom`,
|
|
@@ -4629,12 +4741,12 @@ function V(e, t) {
|
|
|
4629
4741
|
message: `duplicate flag key "${i.key}"`
|
|
4630
4742
|
}), n.add(i.key);
|
|
4631
4743
|
}
|
|
4632
|
-
const
|
|
4744
|
+
const W = z.object({
|
|
4633
4745
|
projectId: z.string().min(1),
|
|
4634
4746
|
environmentId: z.string().min(1),
|
|
4635
|
-
flags: z.array(
|
|
4636
|
-
}).superRefine((e, t) =>
|
|
4637
|
-
const
|
|
4747
|
+
flags: z.array(R).max(500)
|
|
4748
|
+
}).superRefine((e, t) => U(e.flags, t));
|
|
4749
|
+
const G = z.object({
|
|
4638
4750
|
key: z.string(),
|
|
4639
4751
|
op: z.enum([
|
|
4640
4752
|
`add`,
|
|
@@ -4642,32 +4754,32 @@ const U = z.object({
|
|
|
4642
4754
|
`remove`,
|
|
4643
4755
|
`unlinked`
|
|
4644
4756
|
]),
|
|
4645
|
-
before:
|
|
4646
|
-
after:
|
|
4757
|
+
before: z$1.optional(),
|
|
4758
|
+
after: R.optional(),
|
|
4647
4759
|
message: z.string().optional()
|
|
4648
4760
|
});
|
|
4649
|
-
const
|
|
4761
|
+
const K = z.object({
|
|
4650
4762
|
projectId: z.string(),
|
|
4651
4763
|
environmentId: z.string(),
|
|
4652
|
-
changes: z.array(
|
|
4653
|
-
remoteOnly: z.array(
|
|
4764
|
+
changes: z.array(G),
|
|
4765
|
+
remoteOnly: z.array(z$1).default([])
|
|
4654
4766
|
});
|
|
4655
|
-
const
|
|
4767
|
+
const q = z.object({
|
|
4656
4768
|
projectId: z.string().min(1),
|
|
4657
4769
|
environmentId: z.string().min(1),
|
|
4658
|
-
flags: z.array(
|
|
4770
|
+
flags: z.array(R).max(500),
|
|
4659
4771
|
apply: z.boolean().default(!1),
|
|
4660
4772
|
prune: z.boolean().default(!1),
|
|
4661
4773
|
force: z.boolean().default(!1),
|
|
4662
4774
|
adopt: z.boolean().default(!1),
|
|
4663
|
-
expectedVersions: z.record(z.string(),
|
|
4664
|
-
}).superRefine((e, t) =>
|
|
4665
|
-
const
|
|
4775
|
+
expectedVersions: z.record(z.string(), B).optional()
|
|
4776
|
+
}).superRefine((e, t) => U(e.flags, t));
|
|
4777
|
+
const J = z.object({
|
|
4666
4778
|
projectId: z.string(),
|
|
4667
4779
|
environmentId: z.string(),
|
|
4668
4780
|
applied: z.boolean(),
|
|
4669
|
-
changes: z.array(
|
|
4670
|
-
remoteOnly: z.array(
|
|
4781
|
+
changes: z.array(G),
|
|
4782
|
+
remoteOnly: z.array(z$1).default([]),
|
|
4671
4783
|
forced: z.boolean().default(!1),
|
|
4672
4784
|
adopted: z.boolean().default(!1),
|
|
4673
4785
|
approvalRequests: z.array(z.string()).default([])
|
|
@@ -4675,7 +4787,7 @@ const K = z.object({
|
|
|
4675
4787
|
|
|
4676
4788
|
//#endregion
|
|
4677
4789
|
//#region src/lib/local-config.ts
|
|
4678
|
-
const localFlagsArraySchema = z.array(
|
|
4790
|
+
const localFlagsArraySchema = z.array(R).superRefine((flags, ctx) => {
|
|
4679
4791
|
const seen = /* @__PURE__ */ new Set();
|
|
4680
4792
|
for (const [index, flag] of flags.entries()) {
|
|
4681
4793
|
if (seen.has(flag.key)) ctx.addIssue({
|
|
@@ -5265,7 +5377,7 @@ function registerTypesCommands(program) {
|
|
|
5265
5377
|
//#region src/index.ts
|
|
5266
5378
|
/** Detected before parse so usage errors can suppress Commander text under `--json`. */
|
|
5267
5379
|
const jsonRequested = process.argv.includes("--json");
|
|
5268
|
-
const program = new Command().name("shipd").description("shipd CLI — flags as code").option("--json", "Machine-readable JSON output", false).option("--yes", "Skip confirmation prompts", false).option("--ci", "Non-interactive mode (same as --yes / CI=1)", false).option("--api-url <url>",
|
|
5380
|
+
const program = new Command().name("shipd").description("shipd CLI — flags as code").option("--json", "Machine-readable JSON output", false).option("--yes", "Skip confirmation prompts", false).option("--ci", "Non-interactive mode (same as --yes / CI=1)", false).option("--api-url <url>", `API origin (default: ${DEFAULT_API_URL})`).option("--org <slug>", "Organization slug (session: select; API key: must match)").option("--project <slug>", "Project slug").option("--env <slug>", "Environment slug").option("--config <path>", "Project settings JSON (.shipd/config.json shape)").option("--flags-config <path>", "Path to shipd.config.ts").exitOverride().showHelpAfterError(!jsonRequested);
|
|
5269
5381
|
if (jsonRequested) program.configureOutput({
|
|
5270
5382
|
writeErr: () => {},
|
|
5271
5383
|
writeOut: () => {}
|