@shipdit/cli 0.3.2 → 0.4.0

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