@shipdit/cli 0.7.2 → 0.8.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 (3) hide show
  1. package/README.md +8 -0
  2. package/dist/index.mjs +519 -473
  3. package/package.json +7 -7
package/dist/index.mjs CHANGED
@@ -3,13 +3,13 @@ import { Command, CommanderError, Option } from "commander";
3
3
  import fs from "node:fs";
4
4
  import os from "node:os";
5
5
  import path from "node:path";
6
- import { z } from "zod";
6
+ import { z as z$1 } from "zod";
7
7
  import { createHash } from "node:crypto";
8
8
  import { createJiti } from "jiti";
9
9
  import { spawn } from "node:child_process";
10
10
  import { isDeepStrictEqual } from "node:util";
11
11
 
12
- //#region src/lib/errors.ts
12
+ // src/lib/errors.ts
13
13
  var CliError = class extends Error {
14
14
  code;
15
15
  exitCode;
@@ -27,8 +27,7 @@ function exitCodeForError(error) {
27
27
  return 1;
28
28
  }
29
29
 
30
- //#endregion
31
- //#region src/lib/config.ts
30
+ // src/lib/config.ts
32
31
  /** Hosted control plane. Used when no flag, env, project, global, or credential URL is set. */
33
32
  const DEFAULT_API_URL = "https://api.useshipd.com";
34
33
  function readJsonFile(filePath) {
@@ -109,8 +108,7 @@ function resolveRuntimeConfig(flags, options) {
109
108
  };
110
109
  }
111
110
 
112
- //#endregion
113
- //#region ../../node_modules/.pnpm/hono@4.13.13/node_modules/hono/dist/client/utils.js
111
+ // ../../node_modules/.pnpm/hono@4.13.18/node_modules/hono/dist/client/utils.js
114
112
  const mergePath = (base, path) => {
115
113
  base = base.replace(/\/+$/, "");
116
114
  base = base + "/";
@@ -160,14 +158,13 @@ function deepMerge(target, source) {
160
158
  return merged;
161
159
  }
162
160
 
163
- //#endregion
164
- //#region ../../node_modules/.pnpm/hono@4.13.13/node_modules/hono/dist/utils/cookie.js
161
+ // ../../node_modules/.pnpm/hono@4.13.18/node_modules/hono/dist/utils/cookie.js
165
162
  const validCookieNameRegEx = /^[\w!#$%&'*.^`|~+-]+$/;
166
163
  const _serialize = (name, value, opt = {}) => {
167
164
  if (!validCookieNameRegEx.test(name)) throw new Error("Invalid cookie name");
168
165
  let cookie = `${name}=${value}`;
169
- if (name.startsWith("__Secure-") && !opt.secure) throw new Error("__Secure- Cookie must have Secure attributes");
170
- if (name.startsWith("__Host-")) {
166
+ if (/^__secure-/i.test(name) && !opt.secure) throw new Error("__Secure- Cookie must have Secure attributes");
167
+ if (/^__host-/i.test(name)) {
171
168
  if (!opt.secure) throw new Error("__Host- Cookie must have Secure attributes");
172
169
  if (opt.path !== "/") throw new Error("__Host- Cookie must have Path attributes with \"/\"");
173
170
  if (opt.domain) throw new Error("__Host- Cookie must not have Domain attributes");
@@ -203,8 +200,7 @@ const serialize = (name, value, opt) => {
203
200
  return _serialize(name, value, opt);
204
201
  };
205
202
 
206
- //#endregion
207
- //#region ../../node_modules/.pnpm/hono@4.13.13/node_modules/hono/dist/client/client.js
203
+ // ../../node_modules/.pnpm/hono@4.13.18/node_modules/hono/dist/client/client.js
208
204
  const createProxy = (callback, path) => {
209
205
  return new Proxy(() => {}, {
210
206
  get(_obj, key) {
@@ -345,8 +341,7 @@ const hc = (baseUrl, options) => createProxy(function proxyCallback(opts) {
345
341
  return req;
346
342
  }, []);
347
343
 
348
- //#endregion
349
- //#region ../api-client/dist/index.mjs
344
+ // ../api-client/dist/index.mjs
350
345
  const t$2 = [
351
346
  `unauthenticated`,
352
347
  `forbidden`,
@@ -483,6 +478,8 @@ function N$1(e) {
483
478
  addEvidence: (e, t) => M$1(a.release.addEvidence.$post, e, t)
484
479
  },
485
480
  me: {
481
+ notifications: (e) => A$1(r.me.notifications.list.$post, e),
482
+ readNotifications: (e) => A$1(r.me.notifications.read.$post, e),
486
483
  get: (e = {}) => A$1(r.me.$post, e),
487
484
  feedback: (e) => A$1(r.me.feedback.$post, e)
488
485
  },
@@ -490,6 +487,7 @@ function N$1(e) {
490
487
  listTransfers: (e = {}) => A$1(i.project.listTransfers.$post, e),
491
488
  requestTransfer: (e) => A$1(i.project.requestTransfer.$post, e),
492
489
  decideTransfer: (e) => A$1(i.project.decideTransfer.$post, e),
490
+ summaries: (e = {}) => A$1(i.project.summaries.$post, e),
493
491
  list: (e = {}) => A$1(i.project.list.$post, e),
494
492
  create: (e) => A$1(i.project.create.$post, e),
495
493
  update: (e) => A$1(i.project.update.$post, e),
@@ -523,6 +521,7 @@ function N$1(e) {
523
521
  publishEnvironments: (e) => A$1(P.flag.publishEnvironments.$post, e),
524
522
  updateEnvironment: (e) => A$1(P.flag.updateEnvironment.$post, e),
525
523
  toggleEnvironment: (e) => A$1(P.flag.toggleEnvironment.$post, e),
524
+ listProjectEnvironmentStates: (e) => A$1(P.flag.listProjectEnvironmentStates.$post, e),
526
525
  listEnvironmentStates: (e) => A$1(P.flag.listEnvironmentStates.$post, e),
527
526
  pull: (e) => A$1(P.flag.pull.$post, e),
528
527
  diff: (e) => A$1(P.flag.diff.$post, e),
@@ -559,6 +558,7 @@ function N$1(e) {
559
558
  archive: (e) => A$1(B.segment.archive.$post, e),
560
559
  listArchived: (e) => A$1(B.segment.listArchived.$post, e),
561
560
  restore: (e) => A$1(B.segment.restore.$post, e),
561
+ listProjectEnvironmentStates: (e) => A$1(B.segment.listProjectEnvironmentStates.$post, e),
562
562
  listEnvironmentStates: (e) => A$1(B.segment.listEnvironmentStates.$post, e),
563
563
  updateEnvironment: (e) => A$1(B.segment.updateEnvironment.$post, e)
564
564
  },
@@ -592,6 +592,7 @@ function N$1(e) {
592
592
  update: (e) => A$1(W.eventWebhook.update.$post, e),
593
593
  delete: (e) => A$1(W.eventWebhook.delete.$post, e),
594
594
  test: (e, t) => M$1(W.eventWebhook.test.$post, e, t),
595
+ export: (e) => A$1(W.eventWebhook.export.$post, e),
595
596
  deliveries: (e) => A$1(W.eventWebhook.deliveries.$post, e),
596
597
  attempts: (e) => A$1(W.eventWebhook.attempts.$post, e),
597
598
  redeliver: (e, t) => M$1(W.eventWebhook.redeliver.$post, e, t),
@@ -613,6 +614,9 @@ function N$1(e) {
613
614
  },
614
615
  usage: { get: (e = {}) => A$1(J.usage.get.$post, e) },
615
616
  approval: {
617
+ listDeletions: () => A$1(I.approval.listDeletions.$post, {}),
618
+ getDeletion: (e) => A$1(I.approval.getDeletion.$post, e),
619
+ decideDeletion: (e) => A$1(I.approval.decideDeletion.$post, e),
616
620
  listPolicies: (e = {}) => A$1(I.approval.listPolicies.$post, e),
617
621
  createPolicy: (e) => A$1(I.approval.createPolicy.$post, e),
618
622
  updatePolicy: (e) => A$1(I.approval.updatePolicy.$post, e),
@@ -645,6 +649,8 @@ function N$1(e) {
645
649
  setRequireTwoFactor: (e) => A$1(X.sso.setRequireTwoFactor.$post, e)
646
650
  },
647
651
  scim: {
652
+ getGroupMappings: (e = {}) => A$1(Z.scim.getGroupMappings.$post, e),
653
+ setGroupTeams: (e) => A$1(Z.scim.setGroupTeams.$post, e),
648
654
  getConnection: (e = {}) => A$1(Z.scim.getConnection.$post, e),
649
655
  createConnection: (e = { creationRequestId: crypto.randomUUID() }) => A$1(Z.scim.createConnection.$post, e),
650
656
  rotateCredential: (e) => A$1(Z.scim.rotateCredential.$post, e),
@@ -678,8 +684,7 @@ function N$1(e) {
678
684
  };
679
685
  }
680
686
 
681
- //#endregion
682
- //#region ../../node_modules/.pnpm/@better-auth+core@1.7.7_@better-auth+utils@0.4.2_@better-fetch+fetch@1.3.2_@opentelemet_0d5083f53bdf976e0320d8b98ec7aa98/node_modules/@better-auth/core/dist/utils/error-codes.mjs
687
+ // ../../node_modules/.pnpm/@better-auth+core@1.7.22_@better-auth+utils@0.5.1_@better-fetch+fetch@1.3.3_@openteleme_210612f248ef93e041cc6a64ad006635/node_modules/@better-auth/core/dist/utils/error-codes.mjs
683
688
  function defineErrorCodes(codes) {
684
689
  return Object.fromEntries(Object.entries(codes).map(([key, value]) => [key, {
685
690
  code: key,
@@ -688,8 +693,7 @@ function defineErrorCodes(codes) {
688
693
  }]));
689
694
  }
690
695
 
691
- //#endregion
692
- //#region ../../node_modules/.pnpm/better-call@1.4.0_zod@4.6.7/node_modules/better-call/dist/error.mjs
696
+ // ../../node_modules/.pnpm/better-call@1.4.5_zod@4.6.7/node_modules/better-call/dist/error.mjs
693
697
  function isErrorStackTraceLimitWritable() {
694
698
  const desc = Object.getOwnPropertyDescriptor(Error, "stackTraceLimit");
695
699
  if (desc === void 0) return Object.isExtensible(Error);
@@ -791,7 +795,7 @@ var InternalAPIError = class extends Error {
791
795
  headers;
792
796
  statusCode;
793
797
  constructor(status = "INTERNAL_SERVER_ERROR", body = void 0, headers = {}, statusCode = typeof status === "number" ? status : statusCodes[status]) {
794
- super(body?.message, body?.cause ? { cause: body.cause } : void 0);
798
+ super(body?.message, body && "cause" in body ? { cause: body.cause } : void 0);
795
799
  this.status = status;
796
800
  this.body = body;
797
801
  this.headers = headers;
@@ -800,13 +804,21 @@ var InternalAPIError = class extends Error {
800
804
  this.status = status;
801
805
  this.headers = headers;
802
806
  this.statusCode = statusCode;
807
+ if (body && "cause" in body) {
808
+ const { cause, ...publicBody } = body;
809
+ this.body = Object.defineProperty(publicBody, "cause", {
810
+ value: cause,
811
+ writable: true,
812
+ configurable: true
813
+ });
814
+ return;
815
+ }
803
816
  this.body = body;
804
817
  }
805
818
  };
806
819
  const APIError = makeErrorForHideStackFrame(InternalAPIError, Error);
807
820
 
808
- //#endregion
809
- //#region ../../node_modules/.pnpm/@better-auth+core@1.7.7_@better-auth+utils@0.4.2_@better-fetch+fetch@1.3.2_@opentelemet_0d5083f53bdf976e0320d8b98ec7aa98/node_modules/@better-auth/core/dist/error/index.mjs
821
+ // ../../node_modules/.pnpm/@better-auth+core@1.7.22_@better-auth+utils@0.5.1_@better-fetch+fetch@1.3.3_@openteleme_210612f248ef93e041cc6a64ad006635/node_modules/@better-auth/core/dist/error/index.mjs
810
822
  var BetterAuthError = class extends Error {
811
823
  constructor(message, options) {
812
824
  super(message, options);
@@ -816,8 +828,7 @@ var BetterAuthError = class extends Error {
816
828
  }
817
829
  };
818
830
 
819
- //#endregion
820
- //#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-rc._8ef4619ff178d531df1451d091680cc1/node_modules/better-auth/dist/plugins/access/access.mjs
831
+ // ../../node_modules/.pnpm/better-auth@1.7.22_@opentelemetry+api@1.10.0_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-r_6aa5cbf5748c3ca553369194e8fda253/node_modules/better-auth/dist/plugins/access/access.mjs
821
832
  function unknownResourceResponse(requestedResource) {
822
833
  return {
823
834
  success: false,
@@ -893,8 +904,24 @@ function createAccessControl(s) {
893
904
  };
894
905
  }
895
906
 
896
- //#endregion
897
- //#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-rc._8ef4619ff178d531df1451d091680cc1/node_modules/better-auth/dist/plugins/two-factor/error-code.mjs
907
+ // ../../node_modules/.pnpm/better-auth@1.7.22_@opentelemetry+api@1.10.0_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-r_6aa5cbf5748c3ca553369194e8fda253/node_modules/better-auth/dist/plugins/organization/roles.mjs
908
+ /**
909
+ * Splits a role value into a list of trimmed, non-empty role names.
910
+ *
911
+ * Roles are stored as a comma separated string (`"admin,owner"`), and may be
912
+ * submitted either as that string or as an array. Any whitespace around a
913
+ * role name is removed so that `"admin, owner"`, `["admin", " owner"]` and
914
+ * `"admin,owner"` all resolve to the same roles.
915
+ *
916
+ * Every role comparison and every write of a role column must go through this
917
+ * helper (or `parseRoles`), so a padded role name can never be stored in a
918
+ * form that one check matches and another does not.
919
+ */
920
+ function parseRoleList(roles) {
921
+ return (Array.isArray(roles) ? roles : [roles]).flatMap((role) => role.split(",")).map((role) => role.trim()).filter(Boolean);
922
+ }
923
+
924
+ // ../../node_modules/.pnpm/better-auth@1.7.22_@opentelemetry+api@1.10.0_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-r_6aa5cbf5748c3ca553369194e8fda253/node_modules/better-auth/dist/plugins/two-factor/error-code.mjs
898
925
  const TWO_FACTOR_ERROR_CODES = defineErrorCodes({
899
926
  OTP_NOT_ENABLED: "OTP not enabled",
900
927
  OTP_NOT_CONFIGURED: "OTP is not available",
@@ -911,16 +938,13 @@ const TWO_FACTOR_ERROR_CODES = defineErrorCodes({
911
938
  INVALID_TWO_FACTOR_COOKIE: "Invalid two factor cookie"
912
939
  });
913
940
 
914
- //#endregion
915
- //#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-rc._8ef4619ff178d531df1451d091680cc1/node_modules/better-auth/dist/package.mjs
916
- var version = "1.7.7";
941
+ // ../../node_modules/.pnpm/better-auth@1.7.22_@opentelemetry+api@1.10.0_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-r_6aa5cbf5748c3ca553369194e8fda253/node_modules/better-auth/dist/package.mjs
942
+ var version = "1.7.22";
917
943
 
918
- //#endregion
919
- //#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-rc._8ef4619ff178d531df1451d091680cc1/node_modules/better-auth/dist/version.mjs
944
+ // ../../node_modules/.pnpm/better-auth@1.7.22_@opentelemetry+api@1.10.0_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-r_6aa5cbf5748c3ca553369194e8fda253/node_modules/better-auth/dist/version.mjs
920
945
  const PACKAGE_VERSION$3 = version;
921
946
 
922
- //#endregion
923
- //#region ../../node_modules/.pnpm/@better-auth+core@1.7.7_@better-auth+utils@0.4.2_@better-fetch+fetch@1.3.2_@opentelemet_0d5083f53bdf976e0320d8b98ec7aa98/node_modules/@better-auth/core/dist/utils/url.mjs
947
+ // ../../node_modules/.pnpm/@better-auth+core@1.7.22_@better-auth+utils@0.5.1_@better-fetch+fetch@1.3.3_@openteleme_210612f248ef93e041cc6a64ad006635/node_modules/@better-auth/core/dist/utils/url.mjs
924
948
  /**
925
949
  * Schemes that execute or embed code when navigated to or accepted as a
926
950
  * redirect target. These are never safe as an OAuth `redirect_uri` or as a
@@ -951,8 +975,7 @@ function isSafeUrlScheme(value) {
951
975
  return !DANGEROUS_URL_SCHEMES.includes(parsed.protocol);
952
976
  }
953
977
 
954
- //#endregion
955
- //#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-rc._8ef4619ff178d531df1451d091680cc1/node_modules/better-auth/dist/plugins/two-factor/client.mjs
978
+ // ../../node_modules/.pnpm/better-auth@1.7.22_@opentelemetry+api@1.10.0_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-r_6aa5cbf5748c3ca553369194e8fda253/node_modules/better-auth/dist/plugins/two-factor/client.mjs
956
979
  const twoFactorClient = (options) => {
957
980
  return {
958
981
  id: "two-factor",
@@ -989,8 +1012,7 @@ const twoFactorClient = (options) => {
989
1012
  };
990
1013
  };
991
1014
 
992
- //#endregion
993
- //#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-rc._8ef4619ff178d531df1451d091680cc1/node_modules/better-auth/dist/plugins/admin/access/statement.mjs
1015
+ // ../../node_modules/.pnpm/better-auth@1.7.22_@opentelemetry+api@1.10.0_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-r_6aa5cbf5748c3ca553369194e8fda253/node_modules/better-auth/dist/plugins/admin/access/statement.mjs
994
1016
  const defaultStatements$1 = {
995
1017
  user: [
996
1018
  "create",
@@ -1002,6 +1024,7 @@ const defaultStatements$1 = {
1002
1024
  "delete",
1003
1025
  "set-password",
1004
1026
  "set-email",
1027
+ "set-phone",
1005
1028
  "get",
1006
1029
  "update"
1007
1030
  ],
@@ -1022,6 +1045,7 @@ const adminAc$1 = defaultAc$1.newRole({
1022
1045
  "delete",
1023
1046
  "set-password",
1024
1047
  "set-email",
1048
+ "set-phone",
1025
1049
  "get",
1026
1050
  "update"
1027
1051
  ],
@@ -1040,8 +1064,7 @@ const defaultRoles$1 = {
1040
1064
  user: userAc
1041
1065
  };
1042
1066
 
1043
- //#endregion
1044
- //#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-rc._8ef4619ff178d531df1451d091680cc1/node_modules/better-auth/dist/plugins/admin/error-codes.mjs
1067
+ // ../../node_modules/.pnpm/better-auth@1.7.22_@opentelemetry+api@1.10.0_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-r_6aa5cbf5748c3ca553369194e8fda253/node_modules/better-auth/dist/plugins/admin/error-codes.mjs
1045
1068
  const ADMIN_ERROR_CODES = defineErrorCodes({
1046
1069
  FAILED_TO_CREATE_USER: "Failed to create user",
1047
1070
  USER_ALREADY_EXISTS: "User already exists.",
@@ -1065,11 +1088,16 @@ const ADMIN_ERROR_CODES = defineErrorCodes({
1065
1088
  YOU_CANNOT_IMPERSONATE_ADMINS: "You cannot impersonate admins",
1066
1089
  INVALID_ROLE_TYPE: "Invalid role type",
1067
1090
  YOU_ARE_NOT_ALLOWED_TO_SET_USERS_EMAIL: "You are not allowed to update users email",
1068
- PASSWORD_CANNOT_BE_UPDATED_VIA_UPDATE_USER: "Password cannot be updated through update-user. Use the set-user-password endpoint instead"
1091
+ YOU_ARE_NOT_ALLOWED_TO_SET_USERS_PHONE_NUMBER: "You are not allowed to update users phone number",
1092
+ PASSWORD_CANNOT_BE_UPDATED_VIA_UPDATE_USER: "Password cannot be updated through update-user. Use the set-user-password endpoint instead",
1093
+ USER_ID_CANNOT_BE_UPDATED: "User id cannot be updated"
1069
1094
  });
1070
1095
 
1071
- //#endregion
1072
- //#region ../../node_modules/.pnpm/@better-auth+core@1.7.7_@better-auth+utils@0.4.2_@better-fetch+fetch@1.3.2_@opentelemet_0d5083f53bdf976e0320d8b98ec7aa98/node_modules/@better-auth/core/dist/env/env-impl.mjs
1096
+ // ../../node_modules/.pnpm/@better-auth+core@1.7.22_@better-auth+utils@0.5.1_@better-fetch+fetch@1.3.3_@openteleme_210612f248ef93e041cc6a64ad006635/node_modules/@better-auth/core/dist/env/runtime.mjs
1097
+ const isDeno = () => "Deno" in globalThis;
1098
+ const isBun = () => "Bun" in globalThis;
1099
+
1100
+ // ../../node_modules/.pnpm/@better-auth+core@1.7.22_@better-auth+utils@0.5.1_@better-fetch+fetch@1.3.3_@openteleme_210612f248ef93e041cc6a64ad006635/node_modules/@better-auth/core/dist/env/env-impl.mjs
1073
1101
  const _envShim = Object.create(null);
1074
1102
  const _getEnv = (useShim) => globalThis.process?.env || globalThis.Deno?.env.toObject() || globalThis.__env__ || (useShim ? _envShim : globalThis);
1075
1103
  const env = new Proxy(_envShim, {
@@ -1101,8 +1129,8 @@ const nodeENV = env.NODE_ENV ?? "";
1101
1129
  */
1102
1130
  function getEnvVar(key, fallback) {
1103
1131
  if (typeof process !== "undefined" && process.env) return process.env[key] ?? fallback;
1104
- if (typeof Deno !== "undefined") return Deno.env.get(key) ?? fallback;
1105
- if (typeof Bun !== "undefined") return Bun.env[key] ?? fallback;
1132
+ if (isDeno()) return Deno.env.get(key) ?? fallback;
1133
+ if (isBun()) return Bun.env[key] ?? fallback;
1106
1134
  return fallback;
1107
1135
  }
1108
1136
  /**
@@ -1132,8 +1160,7 @@ const ENV = Object.freeze({
1132
1160
  }
1133
1161
  });
1134
1162
 
1135
- //#endregion
1136
- //#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-rc._8ef4619ff178d531df1451d091680cc1/node_modules/better-auth/dist/utils/url.mjs
1163
+ // ../../node_modules/.pnpm/better-auth@1.7.22_@opentelemetry+api@1.10.0_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-r_6aa5cbf5748c3ca553369194e8fda253/node_modules/better-auth/dist/utils/url.mjs
1137
1164
  const SLASH_CHAR_CODE = "/".charCodeAt(0);
1138
1165
  function trimTrailingSlashes(value) {
1139
1166
  let end = value.length;
@@ -1211,8 +1238,7 @@ function getOrigin(url) {
1211
1238
  }
1212
1239
  }
1213
1240
 
1214
- //#endregion
1215
- //#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-rc._8ef4619ff178d531df1451d091680cc1/node_modules/better-auth/dist/plugins/admin/has-permission.mjs
1241
+ // ../../node_modules/.pnpm/better-auth@1.7.22_@opentelemetry+api@1.10.0_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-r_6aa5cbf5748c3ca553369194e8fda253/node_modules/better-auth/dist/plugins/admin/has-permission.mjs
1216
1242
  const hasPermission = (input) => {
1217
1243
  if (input.userId && input.options?.adminUserIds?.includes(input.userId)) return true;
1218
1244
  if (!input.permissions) return false;
@@ -1222,8 +1248,7 @@ const hasPermission = (input) => {
1222
1248
  return false;
1223
1249
  };
1224
1250
 
1225
- //#endregion
1226
- //#region ../../node_modules/.pnpm/defu@6.1.7/node_modules/defu/dist/defu.mjs
1251
+ // ../../node_modules/.pnpm/defu@6.1.7/node_modules/defu/dist/defu.mjs
1227
1252
  function isPlainObject$1(value) {
1228
1253
  if (value === null || typeof value !== "object") return false;
1229
1254
  const prototype = Object.getPrototypeOf(value);
@@ -1263,8 +1288,7 @@ const defuArrayFn = createDefu((object, key, currentValue) => {
1263
1288
  }
1264
1289
  });
1265
1290
 
1266
- //#endregion
1267
- //#region ../../node_modules/.pnpm/@better-fetch+fetch@1.3.2/node_modules/@better-fetch/fetch/dist/index.js
1291
+ // ../../node_modules/.pnpm/@better-fetch+fetch@1.3.3/node_modules/@better-fetch/fetch/dist/index.js
1268
1292
  var BetterFetchError = class extends Error {
1269
1293
  constructor(status, statusText, error) {
1270
1294
  super(statusText || status.toString(), { cause: error });
@@ -1367,6 +1391,36 @@ function parseMethodModifier(path) {
1367
1391
  path: separator === -1 ? path : path.slice(separator + 1)
1368
1392
  };
1369
1393
  }
1394
+ /**
1395
+ * Matches the scheme, `//` and host at the start of a URL that names its own
1396
+ * host, such as `https://example.com` in `https://example.com/users`.
1397
+ *
1398
+ * @see https://www.rfc-editor.org/rfc/rfc3986#section-3
1399
+ */
1400
+ const ORIGIN_RE = /^[a-z][a-z\d+.-]*:\/\/[^/?#]+/i;
1401
+ /**
1402
+ * Matches the slashes at the start of a path, such as `///` in `///users`.
1403
+ */
1404
+ const LEADING_SLASHES_RE = /^\/+/;
1405
+ /**
1406
+ * Removes every slash at the end, so `"a//"` becomes `"a"`. A loop rather than
1407
+ * a regex, as a pattern anchored at the end backtracks over a long run of
1408
+ * slashes.
1409
+ */
1410
+ function withoutTrailingSlashes(value) {
1411
+ let end = value.length;
1412
+ while (end > 0 && value[end - 1] === "/") end--;
1413
+ return value.slice(0, end);
1414
+ }
1415
+ /**
1416
+ * Splits at the first occurrence of the separator, so a separator inside the
1417
+ * remainder is kept. `"a?b?c"` splits into `"a"` and `"b?c"`.
1418
+ */
1419
+ function splitOnce(value, separator) {
1420
+ const index = value.indexOf(separator);
1421
+ if (index === -1) return [value, void 0];
1422
+ return [value.slice(0, index), value.slice(index + 1)];
1423
+ }
1370
1424
  const isReservedPathSegment = (value) => value === "." || value === "..";
1371
1425
  const encodeLiteralPathSegment = (segment) => segment.split(":").map((part) => encodeURIComponent(part)).join(":");
1372
1426
  function resolvePathSegment(segment, pathParams) {
@@ -1375,20 +1429,25 @@ function resolvePathSegment(segment, pathParams) {
1375
1429
  if (isReservedPathSegment(pathParam)) throw new TypeError("Path parameters cannot be reserved path segments");
1376
1430
  return encodeURIComponent(pathParam);
1377
1431
  }
1432
+ function getPathParams(path, params) {
1433
+ const pathParams = /* @__PURE__ */ new Map();
1434
+ if (params) if (Array.isArray(params)) {
1435
+ const paramPaths = path.split("/").filter((p) => p.startsWith(":"));
1436
+ for (const [index, key] of paramPaths.entries()) {
1437
+ const value = params[index];
1438
+ pathParams.set(key, String(value));
1439
+ }
1440
+ } else for (const [key, value] of Object.entries(params)) pathParams.set(`:${key}`, String(value));
1441
+ return pathParams;
1442
+ }
1378
1443
  /**
1379
- * Normalize URL
1444
+ * Replaces `:name` segments with their encoded params.
1380
1445
  */
1381
- function getURL$1(url, option) {
1382
- const { baseURL, params, query } = option || {
1383
- query: {},
1384
- params: {},
1385
- baseURL: ""
1386
- };
1387
- let basePath = url.startsWith("http") ? url.split("/").slice(0, 3).join("/") : baseURL || "";
1388
- const { path: requestPath } = parseMethodModifier(url);
1389
- if (requestPath !== url) url = `/${requestPath}`;
1390
- if (!basePath.endsWith("/")) basePath += "/";
1391
- let [path, urlQuery] = url.replace(basePath, "").split("?");
1446
+ function fillPath(path, params) {
1447
+ const pathParams = getPathParams(path, params);
1448
+ return path.split("/").map((segment) => resolvePathSegment(segment, pathParams)).join("/");
1449
+ }
1450
+ function serializeQuery(urlQuery, query) {
1392
1451
  const queryParams = new URLSearchParams(urlQuery);
1393
1452
  for (const [key, value] of Object.entries(query || {})) {
1394
1453
  if (value == null) continue;
@@ -1400,20 +1459,43 @@ function getURL$1(url, option) {
1400
1459
  } else serializedValue = JSON.stringify(value);
1401
1460
  queryParams.set(key, serializedValue);
1402
1461
  }
1403
- const pathParams = /* @__PURE__ */ new Map();
1404
- if (params) if (Array.isArray(params)) {
1405
- const paramPaths = path.split("/").filter((p) => p.startsWith(":"));
1406
- for (const [index, key] of paramPaths.entries()) {
1407
- const value = params[index];
1408
- pathParams.set(key, String(value));
1409
- }
1410
- } else for (const [key, value] of Object.entries(params)) pathParams.set(`:${key}`, String(value));
1411
- path = path.split("/").map((segment) => resolvePathSegment(segment, pathParams)).join("/");
1412
- path = path.replace(/^\/+/, "");
1413
- let queryParamString = queryParams.toString();
1414
- queryParamString = queryParamString.length > 0 ? `?${queryParamString}`.replace(/\+/g, "%20") : "";
1415
- if (!basePath.startsWith("http")) return `${basePath}${path}${queryParamString}`;
1416
- return new URL(`${path}${queryParamString}`, basePath);
1462
+ const queryParamString = queryParams.toString();
1463
+ return queryParamString.length > 0 ? `?${queryParamString}`.replace(/\+/g, "%20") : "";
1464
+ }
1465
+ function withoutBase(input, baseURL) {
1466
+ if (!baseURL) return input;
1467
+ const basePath = `${withoutTrailingSlashes(baseURL)}/`;
1468
+ return input.startsWith(basePath) ? input.slice(basePath.length) : input;
1469
+ }
1470
+ /**
1471
+ * Appends a path and query to a base as strings, with exactly one slash at the
1472
+ * boundary. The path never decides the scheme or host. The base's own query
1473
+ * comes first, and its fragment is dropped as it belongs to the base document.
1474
+ */
1475
+ function joinURL(base, path, urlQuery, query) {
1476
+ const [baseWithoutHash] = splitOnce(base, "#");
1477
+ const [basePath, baseQuery = ""] = splitOnce(baseWithoutHash, "?");
1478
+ const relativePath = path.replace(LEADING_SLASHES_RE, "");
1479
+ const search = serializeQuery(`${baseQuery}&${urlQuery !== null && urlQuery !== void 0 ? urlQuery : ""}`, query);
1480
+ const href = `${withoutTrailingSlashes(basePath)}/${relativePath}${search}`;
1481
+ return ORIGIN_RE.test(href) ? new URL(href) : href;
1482
+ }
1483
+ /**
1484
+ * Normalize URL
1485
+ */
1486
+ function getURL$1(url, option) {
1487
+ var _input$match, _ref;
1488
+ const { baseURL, params, query } = option || {
1489
+ query: {},
1490
+ params: {},
1491
+ baseURL: ""
1492
+ };
1493
+ const { path: requestPath } = parseMethodModifier(url);
1494
+ const input = requestPath === url ? url : `/${requestPath}`;
1495
+ const origin = (_input$match = input.match(ORIGIN_RE)) === null || _input$match === void 0 ? void 0 : _input$match[0];
1496
+ const [path, urlQuery] = splitOnce(origin ? input.slice(origin.length) : withoutBase(input, baseURL), "?");
1497
+ const filledPath = fillPath(path, params);
1498
+ return joinURL((_ref = origin !== null && origin !== void 0 ? origin : baseURL) !== null && _ref !== void 0 ? _ref : "", filledPath, urlQuery, query);
1417
1499
  }
1418
1500
  const getAuthHeader = async (options) => {
1419
1501
  const headers = {};
@@ -1483,6 +1565,15 @@ function getFetch(options) {
1483
1565
  if (typeof window !== "undefined" && isFunction(window.fetch)) return window.fetch;
1484
1566
  throw new Error("No fetch implementation found");
1485
1567
  }
1568
+ function isPayloadMethod(method) {
1569
+ if (!method) return false;
1570
+ return [
1571
+ "POST",
1572
+ "PUT",
1573
+ "PATCH",
1574
+ "DELETE"
1575
+ ].includes(method.toUpperCase());
1576
+ }
1486
1577
  function mergeHeaders(...sources) {
1487
1578
  const merged = {};
1488
1579
  for (const source of sources) {
@@ -1521,7 +1612,7 @@ function getBody(options, headers) {
1521
1612
  if (getMediaType(headers) === "application/x-www-form-urlencoded") return new URLSearchParams(body).toString();
1522
1613
  return JSON.stringify(body);
1523
1614
  }
1524
- function getMethod$1(url, options) {
1615
+ function getMethod(url, options) {
1525
1616
  if (options === null || options === void 0 ? void 0 : options.method) return options.method.toUpperCase();
1526
1617
  const { method } = parseMethodModifier(url);
1527
1618
  if (method) return method.toUpperCase();
@@ -1609,7 +1700,7 @@ const betterFetch = async (url, options) => {
1609
1700
  const _url = getURL$1(__url, opts);
1610
1701
  const headers = await getHeaders(opts);
1611
1702
  const body = getBody(opts, headers);
1612
- const method = getMethod$1(__url, opts);
1703
+ const method = getMethod(__url, opts);
1613
1704
  const context = _objectSpread2(_objectSpread2({}, opts), {}, {
1614
1705
  url: _url,
1615
1706
  headers,
@@ -1813,14 +1904,7 @@ const createFetch = (config) => {
1813
1904
  return $fetch;
1814
1905
  };
1815
1906
 
1816
- //#endregion
1817
- //#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-rc._8ef4619ff178d531df1451d091680cc1/node_modules/better-auth/dist/client/parser.mjs
1818
- const PROTO_POLLUTION_PATTERNS = {
1819
- 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*:/,
1820
- 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*:/,
1821
- protoShort: /"__proto__"\s*:/,
1822
- constructorShort: /"constructor"\s*:/
1823
- };
1907
+ // ../../node_modules/.pnpm/better-auth@1.7.22_@opentelemetry+api@1.10.0_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-r_6aa5cbf5748c3ca553369194e8fda253/node_modules/better-auth/dist/client/parser.mjs
1824
1908
  const JSON_SIGNATURE = /^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;
1825
1909
  const SPECIAL_VALUES = {
1826
1910
  true: true,
@@ -1856,14 +1940,10 @@ function betterJSONParse(value, options = {}) {
1856
1940
  if (strict) throw new SyntaxError("[better-json] Invalid JSON");
1857
1941
  return value;
1858
1942
  }
1859
- if (Object.entries(PROTO_POLLUTION_PATTERNS).some(([key, pattern]) => {
1860
- const matches = pattern.test(trimmed);
1861
- if (matches && warnings) console.warn(`[better-json] Detected potential prototype pollution attempt using ${key} pattern`);
1862
- return matches;
1863
- }) && strict) throw new Error("[better-json] Potential prototype pollution attempt detected");
1864
1943
  try {
1865
1944
  const secureReviver = (key, value) => {
1866
1945
  if (key === "__proto__" || key === "constructor" && value && typeof value === "object" && "prototype" in value) {
1946
+ if (strict) throw new Error("[better-json] Potential prototype pollution attempt detected");
1867
1947
  if (warnings) console.warn(`[better-json] Dropping "${key}" key to prevent prototype pollution`);
1868
1948
  return;
1869
1949
  }
@@ -1883,8 +1963,7 @@ function parseJSON(value, options = { strict: true }) {
1883
1963
  return betterJSONParse(value, options);
1884
1964
  }
1885
1965
 
1886
- //#endregion
1887
- //#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-rc._8ef4619ff178d531df1451d091680cc1/node_modules/better-auth/dist/plugins/organization/access/statement.mjs
1966
+ // ../../node_modules/.pnpm/better-auth@1.7.22_@opentelemetry+api@1.10.0_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-r_6aa5cbf5748c3ca553369194e8fda253/node_modules/better-auth/dist/plugins/organization/access/statement.mjs
1888
1967
  const defaultStatements = {
1889
1968
  organization: ["update", "delete"],
1890
1969
  member: [
@@ -1959,11 +2038,10 @@ const defaultRoles = {
1959
2038
  member: memberAc
1960
2039
  };
1961
2040
 
1962
- //#endregion
1963
- //#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-rc._8ef4619ff178d531df1451d091680cc1/node_modules/better-auth/dist/plugins/organization/permission.mjs
2041
+ // ../../node_modules/.pnpm/better-auth@1.7.22_@opentelemetry+api@1.10.0_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-r_6aa5cbf5748c3ca553369194e8fda253/node_modules/better-auth/dist/plugins/organization/permission.mjs
1964
2042
  const hasPermissionFn = (input, acRoles) => {
1965
2043
  if (!input.permissions) return false;
1966
- const roles = input.role.split(",");
2044
+ const roles = parseRoleList(input.role);
1967
2045
  const creatorRole = input.options.creatorRole || "owner";
1968
2046
  const isCreator = roles.includes(creatorRole);
1969
2047
  const allowCreatorsAllPermissions = input.allowCreatorAllPermissions || false;
@@ -1972,8 +2050,7 @@ const hasPermissionFn = (input, acRoles) => {
1972
2050
  return false;
1973
2051
  };
1974
2052
 
1975
- //#endregion
1976
- //#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-rc._8ef4619ff178d531df1451d091680cc1/node_modules/better-auth/dist/plugins/organization/error-codes.mjs
2053
+ // ../../node_modules/.pnpm/better-auth@1.7.22_@opentelemetry+api@1.10.0_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-r_6aa5cbf5748c3ca553369194e8fda253/node_modules/better-auth/dist/plugins/organization/error-codes.mjs
1977
2054
  const ORGANIZATION_ERROR_CODES = defineErrorCodes({
1978
2055
  YOU_ARE_NOT_ALLOWED_TO_CREATE_A_NEW_ORGANIZATION: "You are not allowed to create a new organization",
1979
2056
  YOU_HAVE_REACHED_THE_MAXIMUM_NUMBER_OF_ORGANIZATIONS: "You have reached the maximum number of organizations",
@@ -2000,6 +2077,7 @@ const ORGANIZATION_ERROR_CODES = defineErrorCodes({
2000
2077
  EMAIL_VERIFICATION_REQUIRED_BEFORE_ACCEPTING_OR_REJECTING_INVITATION: "Email verification required before accepting or rejecting invitation",
2001
2078
  EMAIL_VERIFICATION_REQUIRED_FOR_INVITATION: "Email verification required to view or list invitations for the session email",
2002
2079
  YOU_ARE_NOT_ALLOWED_TO_CANCEL_THIS_INVITATION: "You are not allowed to cancel this invitation",
2080
+ YOU_ARE_NOT_ALLOWED_TO_LIST_INVITATIONS: "You are not allowed to list invitations for this organization",
2003
2081
  INVITER_IS_NO_LONGER_A_MEMBER_OF_THE_ORGANIZATION: "Inviter is no longer a member of the organization",
2004
2082
  YOU_ARE_NOT_ALLOWED_TO_INVITE_USER_WITH_THIS_ROLE: "You are not allowed to invite a user with this role",
2005
2083
  FAILED_TO_RETRIEVE_INVITATION: "Failed to retrieve invitation",
@@ -2036,8 +2114,7 @@ const ORGANIZATION_ERROR_CODES = defineErrorCodes({
2036
2114
  INVALID_TEAM_ID: "Team id contains a reserved character"
2037
2115
  });
2038
2116
 
2039
- //#endregion
2040
- //#region ../auth/dist/rbac.mjs
2117
+ // ../auth/dist/rbac.mjs
2041
2118
  const t$1 = createAccessControl({
2042
2119
  organization: [`update`, `delete`],
2043
2120
  member: [
@@ -2318,8 +2395,7 @@ const n$1 = {
2318
2395
  })
2319
2396
  };
2320
2397
 
2321
- //#endregion
2322
- //#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-rc._8ef4619ff178d531df1451d091680cc1/node_modules/better-auth/dist/client/broadcast-channel.mjs
2398
+ // ../../node_modules/.pnpm/better-auth@1.7.22_@opentelemetry+api@1.10.0_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-r_6aa5cbf5748c3ca553369194e8fda253/node_modules/better-auth/dist/client/broadcast-channel.mjs
2323
2399
  const kBroadcastChannel = Symbol.for("better-auth:broadcast-channel");
2324
2400
  const now$1 = () => Math.floor(Date.now() / 1e3);
2325
2401
  var WindowBroadcastChannel = class {
@@ -2345,15 +2421,16 @@ var WindowBroadcastChannel = class {
2345
2421
  }
2346
2422
  setup() {
2347
2423
  if (typeof window === "undefined" || typeof window.addEventListener === "undefined") return () => {};
2424
+ const target = window;
2348
2425
  const handler = (event) => {
2349
2426
  if (event.key !== this.name) return;
2350
2427
  const message = JSON.parse(event.newValue ?? "{}");
2351
2428
  if (message?.event !== "session" || !message?.data) return;
2352
2429
  this.listeners.forEach((listener) => listener(message));
2353
2430
  };
2354
- window.addEventListener("storage", handler);
2431
+ target.addEventListener("storage", handler);
2355
2432
  return () => {
2356
- window.removeEventListener("storage", handler);
2433
+ target.removeEventListener("storage", handler);
2357
2434
  };
2358
2435
  }
2359
2436
  };
@@ -2362,12 +2439,10 @@ function getGlobalBroadcastChannel(name = "better-auth.message") {
2362
2439
  return globalThis[kBroadcastChannel];
2363
2440
  }
2364
2441
 
2365
- //#endregion
2366
- //#region ../../node_modules/.pnpm/nanostores@1.5.2/node_modules/nanostores/clean-stores/index.js
2442
+ // ../../node_modules/.pnpm/nanostores@1.5.5/node_modules/nanostores/clean-stores/index.js
2367
2443
  const clean = Symbol("clean");
2368
2444
 
2369
- //#endregion
2370
- //#region ../../node_modules/.pnpm/nanostores@1.5.2/node_modules/nanostores/atom/index.js
2445
+ // ../../node_modules/.pnpm/nanostores@1.5.5/node_modules/nanostores/atom/index.js
2371
2446
  let listenerQueue = [];
2372
2447
  let lqIndex = 0;
2373
2448
  let batchSeen = null;
@@ -2375,12 +2450,22 @@ const QUEUE_ITEMS_PER_LISTENER = 4;
2375
2450
  const nanostoresGlobal = globalThis.nanostoresGlobal ||= { epoch: 0 };
2376
2451
  let drainQueue = () => {
2377
2452
  let thrown;
2378
- for (lqIndex = 0; lqIndex < listenerQueue.length; lqIndex += QUEUE_ITEMS_PER_LISTENER) try {
2379
- listenerQueue[lqIndex](listenerQueue[lqIndex + 1].value, listenerQueue[lqIndex + 2], listenerQueue[lqIndex + 3]);
2380
- } catch (e) {
2381
- thrown = e;
2453
+ let i;
2454
+ while (lqIndex < listenerQueue.length) {
2455
+ i = lqIndex;
2456
+ lqIndex += QUEUE_ITEMS_PER_LISTENER;
2457
+ let pendingStores = batchSeen?.get(listenerQueue[i]);
2458
+ if (pendingStores) {
2459
+ if (!pendingStores.has(listenerQueue[i + 1])) continue;
2460
+ pendingStores.clear();
2461
+ }
2462
+ try {
2463
+ listenerQueue[i](listenerQueue[i + 1].value, listenerQueue[i + 2], listenerQueue[i + 3]);
2464
+ } catch (e) {
2465
+ thrown = e;
2466
+ }
2382
2467
  }
2383
- listenerQueue.length = 0;
2468
+ listenerQueue.length = lqIndex = 0;
2384
2469
  if (thrown) throw thrown;
2385
2470
  };
2386
2471
  const atom = /* @__NO_SIDE_EFFECTS__ */ (initialValue) => {
@@ -2396,7 +2481,8 @@ const atom = /* @__NO_SIDE_EFFECTS__ */ (initialValue) => {
2396
2481
  listen(listener) {
2397
2482
  $atom.lc = listeners.push(listener);
2398
2483
  return () => {
2399
- for (let i = lqIndex + QUEUE_ITEMS_PER_LISTENER; i < listenerQueue.length;) if (listenerQueue[i] === listener) listenerQueue.splice(i, QUEUE_ITEMS_PER_LISTENER);
2484
+ batchSeen?.get(listener)?.delete($atom);
2485
+ for (let i = lqIndex; i < listenerQueue.length;) if (listenerQueue[i] === listener && listenerQueue[i + 1] === $atom) listenerQueue.splice(i, QUEUE_ITEMS_PER_LISTENER);
2400
2486
  else i += QUEUE_ITEMS_PER_LISTENER;
2401
2487
  let index = listeners.indexOf(listener);
2402
2488
  if (~index) {
@@ -2409,8 +2495,12 @@ const atom = /* @__NO_SIDE_EFFECTS__ */ (initialValue) => {
2409
2495
  nanostoresGlobal.epoch++;
2410
2496
  let runListenerQueue = !listenerQueue.length && !batchSeen;
2411
2497
  for (let listener of listeners) {
2412
- if (batchSeen?.has(listener)) continue;
2413
- batchSeen?.add(listener);
2498
+ if (batchSeen) {
2499
+ let pendingStores = batchSeen.get(listener);
2500
+ if (!pendingStores) batchSeen.set(listener, pendingStores = /* @__PURE__ */ new Set());
2501
+ if (pendingStores.has($atom)) continue;
2502
+ pendingStores.add($atom);
2503
+ }
2414
2504
  listenerQueue.push(listener, $atom, oldValue, batchSeen ? void 0 : changedKey);
2415
2505
  }
2416
2506
  if (runListenerQueue) drainQueue();
@@ -2438,8 +2528,7 @@ const atom = /* @__NO_SIDE_EFFECTS__ */ (initialValue) => {
2438
2528
  return $atom;
2439
2529
  };
2440
2530
 
2441
- //#endregion
2442
- //#region ../../node_modules/.pnpm/nanostores@1.5.2/node_modules/nanostores/lifecycle/index.js
2531
+ // ../../node_modules/.pnpm/nanostores@1.5.5/node_modules/nanostores/lifecycle/index.js
2443
2532
  const SET = 2;
2444
2533
  const MOUNT = 5;
2445
2534
  const UNMOUNT = 6;
@@ -2457,11 +2546,12 @@ let on = (object, listener, eventKey, mutateStore) => {
2457
2546
  return () => {
2458
2547
  let currentListeners = object.events[eventKey];
2459
2548
  let index = currentListeners.indexOf(listener);
2460
- currentListeners.splice(index, 1);
2461
- if (!currentListeners.length) {
2462
- delete object.events[eventKey];
2463
- object.events[eventKey + REVERT_MUTATION]();
2464
- delete object.events[eventKey + REVERT_MUTATION];
2549
+ if (~index) {
2550
+ currentListeners.splice(index, 1);
2551
+ if (!currentListeners.length) {
2552
+ object.events[eventKey + REVERT_MUTATION]();
2553
+ delete object.events[eventKey + REVERT_MUTATION];
2554
+ }
2465
2555
  }
2466
2556
  };
2467
2557
  };
@@ -2542,8 +2632,7 @@ let onMount = ($store, initialize) => {
2542
2632
  });
2543
2633
  };
2544
2634
 
2545
- //#endregion
2546
- //#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-rc._8ef4619ff178d531df1451d091680cc1/node_modules/better-auth/dist/client/equality.mjs
2635
+ // ../../node_modules/.pnpm/better-auth@1.7.22_@opentelemetry+api@1.10.0_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-r_6aa5cbf5748c3ca553369194e8fda253/node_modules/better-auth/dist/client/equality.mjs
2547
2636
  function isPlainObject(value) {
2548
2637
  if (typeof value !== "object" || value === null) return false;
2549
2638
  const prototype = Object.getPrototypeOf(value);
@@ -2583,8 +2672,7 @@ function withEquality(store, isEqual) {
2583
2672
  });
2584
2673
  }
2585
2674
 
2586
- //#endregion
2587
- //#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-rc._8ef4619ff178d531df1451d091680cc1/node_modules/better-auth/dist/client/focus-manager.mjs
2675
+ // ../../node_modules/.pnpm/better-auth@1.7.22_@opentelemetry+api@1.10.0_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-r_6aa5cbf5748c3ca553369194e8fda253/node_modules/better-auth/dist/client/focus-manager.mjs
2588
2676
  const kFocusManager = Symbol.for("better-auth:focus-manager");
2589
2677
  var WindowFocusManager = class {
2590
2678
  listeners = /* @__PURE__ */ new Set();
@@ -2599,12 +2687,13 @@ var WindowFocusManager = class {
2599
2687
  }
2600
2688
  setup() {
2601
2689
  if (typeof window === "undefined" || typeof document === "undefined" || typeof window.addEventListener === "undefined") return () => {};
2690
+ const target = document;
2602
2691
  const visibilityHandler = () => {
2603
2692
  if (document.visibilityState === "visible") this.setFocused(true);
2604
2693
  };
2605
- document.addEventListener("visibilitychange", visibilityHandler, false);
2694
+ target.addEventListener("visibilitychange", visibilityHandler, false);
2606
2695
  return () => {
2607
- document.removeEventListener("visibilitychange", visibilityHandler, false);
2696
+ target.removeEventListener("visibilitychange", visibilityHandler, false);
2608
2697
  };
2609
2698
  }
2610
2699
  };
@@ -2613,12 +2702,11 @@ function getGlobalFocusManager() {
2613
2702
  return globalThis[kFocusManager];
2614
2703
  }
2615
2704
 
2616
- //#endregion
2617
- //#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-rc._8ef4619ff178d531df1451d091680cc1/node_modules/better-auth/dist/client/online-manager.mjs
2705
+ // ../../node_modules/.pnpm/better-auth@1.7.22_@opentelemetry+api@1.10.0_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-r_6aa5cbf5748c3ca553369194e8fda253/node_modules/better-auth/dist/client/online-manager.mjs
2618
2706
  const kOnlineManager = Symbol.for("better-auth:online-manager");
2619
2707
  var WindowOnlineManager = class {
2620
2708
  listeners = /* @__PURE__ */ new Set();
2621
- isOnline = typeof navigator !== "undefined" ? navigator.onLine : true;
2709
+ isOnline = globalThis.navigator?.onLine ?? true;
2622
2710
  subscribe(listener) {
2623
2711
  this.listeners.add(listener);
2624
2712
  return () => {
@@ -2631,13 +2719,14 @@ var WindowOnlineManager = class {
2631
2719
  }
2632
2720
  setup() {
2633
2721
  if (typeof window === "undefined" || typeof window.addEventListener === "undefined") return () => {};
2722
+ const target = window;
2634
2723
  const onOnline = () => this.setOnline(true);
2635
2724
  const onOffline = () => this.setOnline(false);
2636
- window.addEventListener("online", onOnline, false);
2637
- window.addEventListener("offline", onOffline, false);
2725
+ target.addEventListener("online", onOnline, false);
2726
+ target.addEventListener("offline", onOffline, false);
2638
2727
  return () => {
2639
- window.removeEventListener("online", onOnline, false);
2640
- window.removeEventListener("offline", onOffline, false);
2728
+ target.removeEventListener("online", onOnline, false);
2729
+ target.removeEventListener("offline", onOffline, false);
2641
2730
  };
2642
2731
  }
2643
2732
  };
@@ -2646,8 +2735,7 @@ function getGlobalOnlineManager() {
2646
2735
  return globalThis[kOnlineManager];
2647
2736
  }
2648
2737
 
2649
- //#endregion
2650
- //#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-rc._8ef4619ff178d531df1451d091680cc1/node_modules/better-auth/dist/client/query-atom.mjs
2738
+ // ../../node_modules/.pnpm/better-auth@1.7.22_@opentelemetry+api@1.10.0_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-r_6aa5cbf5748c3ca553369194e8fda253/node_modules/better-auth/dist/client/query-atom.mjs
2651
2739
  const kAuthQuery = Symbol.for("better-auth:auth-query");
2652
2740
  function createAuthQueryAtom(initialValue) {
2653
2741
  const queryAtom = /* @__PURE__ */ atom(initialValue);
@@ -2655,8 +2743,7 @@ function createAuthQueryAtom(initialValue) {
2655
2743
  return queryAtom;
2656
2744
  }
2657
2745
 
2658
- //#endregion
2659
- //#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-rc._8ef4619ff178d531df1451d091680cc1/node_modules/better-auth/dist/client/query.mjs
2746
+ // ../../node_modules/.pnpm/better-auth@1.7.22_@opentelemetry+api@1.10.0_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-r_6aa5cbf5748c3ca553369194e8fda253/node_modules/better-auth/dist/client/query.mjs
2660
2747
  const isServer$1 = () => typeof window === "undefined";
2661
2748
  function isAuthQueryStateEqual(a, b) {
2662
2749
  return isJsonEqual(a.data, b.data) && a.error === b.error && a.isPending === b.isPending && a.isRefetching === b.isRefetching && a.refetch === b.refetch;
@@ -2786,8 +2873,7 @@ const useAuthQuery = (initializedAtom, path, $fetch, options) => {
2786
2873
  return value;
2787
2874
  };
2788
2875
 
2789
- //#endregion
2790
- //#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-rc._8ef4619ff178d531df1451d091680cc1/node_modules/better-auth/dist/client/session-refresh.mjs
2876
+ // ../../node_modules/.pnpm/better-auth@1.7.22_@opentelemetry+api@1.10.0_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-r_6aa5cbf5748c3ca553369194e8fda253/node_modules/better-auth/dist/client/session-refresh.mjs
2791
2877
  const now = () => Math.floor(Date.now() / 1e3);
2792
2878
  /**
2793
2879
  * Rate limit: don't refetch on focus if a session request was made within this many seconds
@@ -2860,11 +2946,12 @@ function createSessionRefreshManager(opts) {
2860
2946
  const init = () => {
2861
2947
  if (state.isInitialized) return;
2862
2948
  state.isInitialized = true;
2949
+ setupSignalSubscription();
2950
+ if (typeof window === "undefined") return;
2863
2951
  setupPolling();
2864
2952
  setupBroadcast();
2865
2953
  setupFocusRefetch();
2866
2954
  setupOnlineRefetch();
2867
- setupSignalSubscription();
2868
2955
  state.cleanupBroadcastSetup = getGlobalBroadcastChannel().setup();
2869
2956
  state.cleanupFocusSetup = getGlobalFocusManager().setup();
2870
2957
  state.cleanupOnlineSetup = getGlobalOnlineManager().setup();
@@ -2914,8 +3001,7 @@ function createSessionRefreshManager(opts) {
2914
3001
  };
2915
3002
  }
2916
3003
 
2917
- //#endregion
2918
- //#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-rc._8ef4619ff178d531df1451d091680cc1/node_modules/better-auth/dist/client/fetch-plugins.mjs
3004
+ // ../../node_modules/.pnpm/better-auth@1.7.22_@opentelemetry+api@1.10.0_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-r_6aa5cbf5748c3ca553369194e8fda253/node_modules/better-auth/dist/client/fetch-plugins.mjs
2919
3005
  const redirectPlugin = {
2920
3006
  id: "redirect",
2921
3007
  name: "Redirect",
@@ -2930,8 +3016,7 @@ const redirectPlugin = {
2930
3016
  } }
2931
3017
  };
2932
3018
 
2933
- //#endregion
2934
- //#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-rc._8ef4619ff178d531df1451d091680cc1/node_modules/better-auth/dist/client/session-atom.mjs
3019
+ // ../../node_modules/.pnpm/better-auth@1.7.22_@opentelemetry+api@1.10.0_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-r_6aa5cbf5748c3ca553369194e8fda253/node_modules/better-auth/dist/client/session-atom.mjs
2935
3020
  const isServer = () => typeof window === "undefined";
2936
3021
  const SESSION_MOUNT_DEDUPE_INTERVAL = STORE_UNMOUNT_DELAY;
2937
3022
  function hydrateSessionAtom(sessionAtom, session) {
@@ -3004,6 +3089,7 @@ function getSessionAtom($fetch, options) {
3004
3089
  if (data?.needsRefresh) try {
3005
3090
  const refreshRes = await $fetch("/get-session", {
3006
3091
  method: "POST",
3092
+ body: {},
3007
3093
  signal
3008
3094
  });
3009
3095
  if (signal.aborted) return "aborted";
@@ -3105,8 +3191,7 @@ function getSessionAtom($fetch, options) {
3105
3191
  };
3106
3192
  }
3107
3193
 
3108
- //#endregion
3109
- //#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-rc._8ef4619ff178d531df1451d091680cc1/node_modules/better-auth/dist/client/config.mjs
3194
+ // ../../node_modules/.pnpm/better-auth@1.7.22_@opentelemetry+api@1.10.0_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-r_6aa5cbf5748c3ca553369194e8fda253/node_modules/better-auth/dist/client/config.mjs
3110
3195
  const resolvePublicAuthUrl = (basePath) => {
3111
3196
  if (typeof process === "undefined") return void 0;
3112
3197
  const path = basePath ?? "/api/auth";
@@ -3211,14 +3296,12 @@ const getClientConfig = (options, loadEnv) => {
3211
3296
  };
3212
3297
  };
3213
3298
 
3214
- //#endregion
3215
- //#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-rc._8ef4619ff178d531df1451d091680cc1/node_modules/better-auth/dist/utils/is-atom.mjs
3299
+ // ../../node_modules/.pnpm/better-auth@1.7.22_@opentelemetry+api@1.10.0_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-r_6aa5cbf5748c3ca553369194e8fda253/node_modules/better-auth/dist/utils/is-atom.mjs
3216
3300
  function isAtom(value) {
3217
3301
  return typeof value === "object" && value !== null && "get" in value && typeof value.get === "function" && "lc" in value && typeof value.lc === "number";
3218
3302
  }
3219
3303
 
3220
- //#endregion
3221
- //#region ../../node_modules/.pnpm/@better-auth+core@1.7.7_@better-auth+utils@0.4.2_@better-fetch+fetch@1.3.2_@opentelemet_0d5083f53bdf976e0320d8b98ec7aa98/node_modules/@better-auth/core/dist/utils/string.mjs
3304
+ // ../../node_modules/.pnpm/@better-auth+core@1.7.22_@better-auth+utils@0.5.1_@better-fetch+fetch@1.3.3_@openteleme_210612f248ef93e041cc6a64ad006635/node_modules/@better-auth/core/dist/utils/string.mjs
3222
3305
  function capitalizeFirstLetter(str) {
3223
3306
  return str.charAt(0).toUpperCase() + str.slice(1);
3224
3307
  }
@@ -3231,16 +3314,7 @@ function toKebabCase(input) {
3231
3314
  return splitWords(input).map((word) => word.toLowerCase()).join("-");
3232
3315
  }
3233
3316
 
3234
- //#endregion
3235
- //#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-rc._8ef4619ff178d531df1451d091680cc1/node_modules/better-auth/dist/client/proxy.mjs
3236
- function getMethod(path, knownPathMethods, args) {
3237
- const method = knownPathMethods[path];
3238
- const { fetchOptions, query: _query, ...body } = args || {};
3239
- if (method) return method;
3240
- if (fetchOptions?.method) return fetchOptions.method;
3241
- if (body && Object.keys(body).length > 0) return "POST";
3242
- return "GET";
3243
- }
3317
+ // ../../node_modules/.pnpm/better-auth@1.7.22_@opentelemetry+api@1.10.0_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-r_6aa5cbf5748c3ca553369194e8fda253/node_modules/better-auth/dist/client/proxy.mjs
3244
3318
  function createDynamicPathProxy(routes, client, knownPathMethods, atoms, atomListeners) {
3245
3319
  function createProxy(path = []) {
3246
3320
  return new Proxy(function() {}, {
@@ -3267,13 +3341,13 @@ function createDynamicPathProxy(routes, client, knownPathMethods, atoms, atomLis
3267
3341
  ...fetchOptions,
3268
3342
  ...argFetchOptions
3269
3343
  };
3270
- const method = getMethod(routePath, knownPathMethods, arg);
3344
+ const method = knownPathMethods[routePath] || options.method || (Object.keys(body).length > 0 ? "POST" : "GET");
3271
3345
  return await client(routePath, {
3272
3346
  ...options,
3273
- body: method === "GET" ? void 0 : {
3347
+ body: isPayloadMethod(method) ? {
3274
3348
  ...body,
3275
3349
  ...options?.body || {}
3276
- },
3350
+ } : void 0,
3277
3351
  query: query || options?.query,
3278
3352
  method,
3279
3353
  async onSuccess(context) {
@@ -3307,23 +3381,22 @@ function createDynamicPathProxy(routes, client, knownPathMethods, atoms, atomLis
3307
3381
  return createProxy();
3308
3382
  }
3309
3383
 
3310
- //#endregion
3311
- //#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-rc._8ef4619ff178d531df1451d091680cc1/node_modules/better-auth/dist/client/vanilla.mjs
3384
+ // ../../node_modules/.pnpm/better-auth@1.7.22_@opentelemetry+api@1.10.0_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-r_6aa5cbf5748c3ca553369194e8fda253/node_modules/better-auth/dist/client/vanilla.mjs
3312
3385
  function createAuthClient(options) {
3313
3386
  const { pluginPathMethods, pluginsActions, pluginsAtoms, hydrateSession, $fetch, atomListeners, $store } = getClientConfig(options);
3314
3387
  const resolvedHooks = {};
3315
3388
  for (const [key, value] of Object.entries(pluginsAtoms)) resolvedHooks[`use${capitalizeFirstLetter(key)}`] = value;
3316
- return createDynamicPathProxy({
3389
+ const routes = {
3317
3390
  ...pluginsActions,
3318
3391
  ...resolvedHooks,
3319
3392
  hydrateSession,
3320
3393
  $fetch,
3321
3394
  $store
3322
- }, $fetch, pluginPathMethods, pluginsAtoms, atomListeners);
3395
+ };
3396
+ return createDynamicPathProxy(routes, $fetch, pluginPathMethods, pluginsAtoms, atomListeners);
3323
3397
  }
3324
3398
 
3325
- //#endregion
3326
- //#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-rc._8ef4619ff178d531df1451d091680cc1/node_modules/better-auth/dist/plugins/additional-fields/client.mjs
3399
+ // ../../node_modules/.pnpm/better-auth@1.7.22_@opentelemetry+api@1.10.0_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-r_6aa5cbf5748c3ca553369194e8fda253/node_modules/better-auth/dist/plugins/additional-fields/client.mjs
3327
3400
  const inferAdditionalFields = (schema) => {
3328
3401
  return {
3329
3402
  id: "additional-fields-client",
@@ -3332,8 +3405,7 @@ const inferAdditionalFields = (schema) => {
3332
3405
  };
3333
3406
  };
3334
3407
 
3335
- //#endregion
3336
- //#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-rc._8ef4619ff178d531df1451d091680cc1/node_modules/better-auth/dist/plugins/admin/client.mjs
3408
+ // ../../node_modules/.pnpm/better-auth@1.7.22_@opentelemetry+api@1.10.0_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-r_6aa5cbf5748c3ca553369194e8fda253/node_modules/better-auth/dist/plugins/admin/client.mjs
3337
3409
  const adminClient = (options) => {
3338
3410
  const roles = {
3339
3411
  admin: adminAc$1,
@@ -3367,8 +3439,7 @@ const adminClient = (options) => {
3367
3439
  };
3368
3440
  };
3369
3441
 
3370
- //#endregion
3371
- //#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-rc._8ef4619ff178d531df1451d091680cc1/node_modules/better-auth/dist/plugins/device-authorization/client.mjs
3442
+ // ../../node_modules/.pnpm/better-auth@1.7.22_@opentelemetry+api@1.10.0_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-r_6aa5cbf5748c3ca553369194e8fda253/node_modules/better-auth/dist/plugins/device-authorization/client.mjs
3372
3443
  const deviceAuthorizationClient = () => {
3373
3444
  return {
3374
3445
  id: "device-authorization",
@@ -3384,13 +3455,13 @@ const deviceAuthorizationClient = () => {
3384
3455
  };
3385
3456
  };
3386
3457
 
3387
- //#endregion
3388
- //#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-rc._8ef4619ff178d531df1451d091680cc1/node_modules/better-auth/dist/plugins/organization/client.mjs
3458
+ // ../../node_modules/.pnpm/better-auth@1.7.22_@opentelemetry+api@1.10.0_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-r_6aa5cbf5748c3ca553369194e8fda253/node_modules/better-auth/dist/plugins/organization/client.mjs
3389
3459
  /**
3390
3460
  * Using the same `hasPermissionFn` function, but without the need for a `ctx` parameter or the `organizationId` parameter.
3391
3461
  */
3392
3462
  const clientSideHasPermission = (input) => {
3393
- return hasPermissionFn(input, input.options.roles || defaultRoles);
3463
+ const acRoles = input.options.roles || defaultRoles;
3464
+ return hasPermissionFn(input, acRoles);
3394
3465
  };
3395
3466
  const organizationClient = (options) => {
3396
3467
  const $listOrg = /* @__PURE__ */ atom(false);
@@ -3428,15 +3499,18 @@ const organizationClient = (options) => {
3428
3499
  }),
3429
3500
  getAtoms: ($fetch) => {
3430
3501
  const listOrganizations = useAuthQuery($listOrg, "/organization/list", $fetch, { method: "GET" });
3502
+ const activeOrganization = useAuthQuery([$activeOrgSignal], "/organization/get-full-organization", $fetch, () => ({ method: "GET" }));
3503
+ const activeMember = useAuthQuery([$activeOrgSignal, $activeMemberSignal], "/organization/get-active-member", $fetch, { method: "GET" });
3504
+ const activeMemberRole = useAuthQuery([$activeOrgSignal, $activeMemberRoleSignal], "/organization/get-active-member-role", $fetch, { method: "GET" });
3431
3505
  return {
3432
3506
  $listOrg,
3433
3507
  $activeOrgSignal,
3434
3508
  $activeMemberSignal,
3435
3509
  $activeMemberRoleSignal,
3436
- activeOrganization: useAuthQuery([$activeOrgSignal], "/organization/get-full-organization", $fetch, () => ({ method: "GET" })),
3510
+ activeOrganization,
3437
3511
  listOrganizations,
3438
- activeMember: useAuthQuery([$activeOrgSignal, $activeMemberSignal], "/organization/get-active-member", $fetch, { method: "GET" }),
3439
- activeMemberRole: useAuthQuery([$activeOrgSignal, $activeMemberRoleSignal], "/organization/get-active-member-role", $fetch, { method: "GET" })
3512
+ activeMember,
3513
+ activeMemberRole
3440
3514
  };
3441
3515
  },
3442
3516
  pathMethods: {
@@ -3479,8 +3553,7 @@ const organizationClient = (options) => {
3479
3553
  };
3480
3554
  };
3481
3555
 
3482
- //#endregion
3483
- //#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_72057e843799b0c86a3fe30aeb49ac2b/node_modules/@better-auth/api-key/dist/version-CUtTQbZf.mjs
3556
+ // ../../node_modules/.pnpm/@better-auth+api-key@1.7.22_@better-auth+core@1.7.22_@better-auth+utils@0.5.1_@better-f_cd35a2f07f9492af3cf3307c4cca88cf/node_modules/@better-auth/api-key/dist/version-Cn4VDZGN.mjs
3484
3557
  const API_KEY_ERROR_CODES = defineErrorCodes({
3485
3558
  INVALID_METADATA_TYPE: "metadata must be an object or undefined",
3486
3559
  REFILL_AMOUNT_AND_INTERVAL_REQUIRED: "refillAmount is required when refillInterval is provided",
@@ -3514,10 +3587,9 @@ const API_KEY_ERROR_CODES = defineErrorCodes({
3514
3587
  NO_DEFAULT_API_KEY_CONFIGURATION_FOUND: "No default api-key configuration found.",
3515
3588
  ORGANIZATION_PLUGIN_REQUIRED: "Organization plugin is required for organization-owned API keys. Please install and configure the organization plugin."
3516
3589
  });
3517
- const PACKAGE_VERSION$2 = "1.7.7";
3590
+ const PACKAGE_VERSION$2 = "1.7.22";
3518
3591
 
3519
- //#endregion
3520
- //#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_72057e843799b0c86a3fe30aeb49ac2b/node_modules/@better-auth/api-key/dist/client.mjs
3592
+ // ../../node_modules/.pnpm/@better-auth+api-key@1.7.22_@better-auth+core@1.7.22_@better-auth+utils@0.5.1_@better-f_cd35a2f07f9492af3cf3307c4cca88cf/node_modules/@better-auth/api-key/dist/client.mjs
3521
3593
  const apiKeyClient = () => {
3522
3594
  return {
3523
3595
  id: "api-key",
@@ -3532,9 +3604,9 @@ const apiKeyClient = () => {
3532
3604
  };
3533
3605
  };
3534
3606
 
3535
- //#endregion
3536
- //#region ../../node_modules/.pnpm/@better-auth+passkey@1.7.7_bb9d362000213fa473d66cafce218d0a/node_modules/@better-auth/passkey/dist/version-Bx477_EO.mjs
3607
+ // ../../node_modules/.pnpm/@better-auth+passkey@1.7.22_@better-auth+core@1.7.22_@better-auth+utils@0.5.1_@better-f_8192076548ca2ef2cc8acd41d1178770/node_modules/@better-auth/passkey/dist/version-DAqaPVlZ.mjs
3537
3608
  const PASSKEY_ERROR_CODES = defineErrorCodes({
3609
+ ORIGIN_NOT_CONFIGURED: "Passkey origin is not configured. Set the `origin` option of the passkey plugin or configure `baseURL`.",
3538
3610
  CHALLENGE_NOT_FOUND: "Challenge not found",
3539
3611
  YOU_ARE_NOT_ALLOWED_TO_REGISTER_THIS_PASSKEY: "You are not allowed to register this passkey",
3540
3612
  FAILED_TO_VERIFY_REGISTRATION: "Failed to verify registration",
@@ -3551,10 +3623,9 @@ const PASSKEY_ERROR_CODES = defineErrorCodes({
3551
3623
  RESOLVE_USER_REQUIRED: "Passkey registration requires either an authenticated session or a resolveUser callback when requireSession is false",
3552
3624
  RESOLVED_USER_INVALID: "Resolved user is invalid"
3553
3625
  });
3554
- const PACKAGE_VERSION$1 = "1.7.7";
3626
+ const PACKAGE_VERSION$1 = "1.7.22";
3555
3627
 
3556
- //#endregion
3557
- //#region ../../node_modules/.pnpm/@simplewebauthn+browser@13.3.0/node_modules/@simplewebauthn/browser/esm/helpers/bufferToBase64URLString.js
3628
+ // ../../node_modules/.pnpm/@simplewebauthn+browser@13.3.0/node_modules/@simplewebauthn/browser/esm/helpers/bufferToBase64URLString.js
3558
3629
  /**
3559
3630
  * Convert the given array buffer into a Base64URL-encoded string. Ideal for converting various
3560
3631
  * credential response ArrayBuffers to string for sending back to the server as JSON.
@@ -3568,8 +3639,7 @@ function bufferToBase64URLString(buffer) {
3568
3639
  return btoa(str).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
3569
3640
  }
3570
3641
 
3571
- //#endregion
3572
- //#region ../../node_modules/.pnpm/@simplewebauthn+browser@13.3.0/node_modules/@simplewebauthn/browser/esm/helpers/base64URLStringToBuffer.js
3642
+ // ../../node_modules/.pnpm/@simplewebauthn+browser@13.3.0/node_modules/@simplewebauthn/browser/esm/helpers/base64URLStringToBuffer.js
3573
3643
  /**
3574
3644
  * Convert from a Base64URL-encoded string to an Array Buffer. Best used when converting a
3575
3645
  * credential ID from a JSON string to an ArrayBuffer, like in allowCredentials or
@@ -3595,8 +3665,7 @@ function base64URLStringToBuffer(base64URLString) {
3595
3665
  return buffer;
3596
3666
  }
3597
3667
 
3598
- //#endregion
3599
- //#region ../../node_modules/.pnpm/@simplewebauthn+browser@13.3.0/node_modules/@simplewebauthn/browser/esm/helpers/browserSupportsWebAuthn.js
3668
+ // ../../node_modules/.pnpm/@simplewebauthn+browser@13.3.0/node_modules/@simplewebauthn/browser/esm/helpers/browserSupportsWebAuthn.js
3600
3669
  /**
3601
3670
  * Determine if the browser is capable of Webauthn
3602
3671
  */
@@ -3609,8 +3678,7 @@ function browserSupportsWebAuthn() {
3609
3678
  */
3610
3679
  const _browserSupportsWebAuthnInternals = { stubThis: (value) => value };
3611
3680
 
3612
- //#endregion
3613
- //#region ../../node_modules/.pnpm/@simplewebauthn+browser@13.3.0/node_modules/@simplewebauthn/browser/esm/helpers/toPublicKeyCredentialDescriptor.js
3681
+ // ../../node_modules/.pnpm/@simplewebauthn+browser@13.3.0/node_modules/@simplewebauthn/browser/esm/helpers/toPublicKeyCredentialDescriptor.js
3614
3682
  function toPublicKeyCredentialDescriptor(descriptor) {
3615
3683
  const { id } = descriptor;
3616
3684
  return {
@@ -3625,8 +3693,7 @@ function toPublicKeyCredentialDescriptor(descriptor) {
3625
3693
  };
3626
3694
  }
3627
3695
 
3628
- //#endregion
3629
- //#region ../../node_modules/.pnpm/@simplewebauthn+browser@13.3.0/node_modules/@simplewebauthn/browser/esm/helpers/isValidDomain.js
3696
+ // ../../node_modules/.pnpm/@simplewebauthn+browser@13.3.0/node_modules/@simplewebauthn/browser/esm/helpers/isValidDomain.js
3630
3697
  /**
3631
3698
  * A simple test to determine if a hostname is a properly-formatted domain name
3632
3699
  *
@@ -3639,8 +3706,7 @@ function isValidDomain(hostname) {
3639
3706
  return hostname === "localhost" || /^((xn--[a-z0-9-]+|[a-z0-9]+(-[a-z0-9]+)*)\.)+([a-z]{2,}|xn--[a-z0-9-]+)$/i.test(hostname);
3640
3707
  }
3641
3708
 
3642
- //#endregion
3643
- //#region ../../node_modules/.pnpm/@simplewebauthn+browser@13.3.0/node_modules/@simplewebauthn/browser/esm/helpers/webAuthnError.js
3709
+ // ../../node_modules/.pnpm/@simplewebauthn+browser@13.3.0/node_modules/@simplewebauthn/browser/esm/helpers/webAuthnError.js
3644
3710
  /**
3645
3711
  * A custom Error used to return a more nuanced error detailing _why_ one of the eight documented
3646
3712
  * errors in the spec was raised after calling `navigator.credentials.create()` or
@@ -3672,8 +3738,7 @@ var WebAuthnError = class extends Error {
3672
3738
  }
3673
3739
  };
3674
3740
 
3675
- //#endregion
3676
- //#region ../../node_modules/.pnpm/@simplewebauthn+browser@13.3.0/node_modules/@simplewebauthn/browser/esm/helpers/identifyRegistrationError.js
3741
+ // ../../node_modules/.pnpm/@simplewebauthn+browser@13.3.0/node_modules/@simplewebauthn/browser/esm/helpers/identifyRegistrationError.js
3677
3742
  /**
3678
3743
  * Attempt to intuit _why_ an error was raised after calling `navigator.credentials.create()`
3679
3744
  */
@@ -3754,8 +3819,7 @@ function identifyRegistrationError({ error, options }) {
3754
3819
  return error;
3755
3820
  }
3756
3821
 
3757
- //#endregion
3758
- //#region ../../node_modules/.pnpm/@simplewebauthn+browser@13.3.0/node_modules/@simplewebauthn/browser/esm/helpers/webAuthnAbortService.js
3822
+ // ../../node_modules/.pnpm/@simplewebauthn+browser@13.3.0/node_modules/@simplewebauthn/browser/esm/helpers/webAuthnAbortService.js
3759
3823
  var BaseWebAuthnAbortService = class {
3760
3824
  constructor() {
3761
3825
  Object.defineProperty(this, "controller", {
@@ -3793,8 +3857,7 @@ var BaseWebAuthnAbortService = class {
3793
3857
  */
3794
3858
  const WebAuthnAbortService = new BaseWebAuthnAbortService();
3795
3859
 
3796
- //#endregion
3797
- //#region ../../node_modules/.pnpm/@simplewebauthn+browser@13.3.0/node_modules/@simplewebauthn/browser/esm/helpers/toAuthenticatorAttachment.js
3860
+ // ../../node_modules/.pnpm/@simplewebauthn+browser@13.3.0/node_modules/@simplewebauthn/browser/esm/helpers/toAuthenticatorAttachment.js
3798
3861
  const attachments = ["cross-platform", "platform"];
3799
3862
  /**
3800
3863
  * If possible coerce a `string` value into a known `AuthenticatorAttachment`
@@ -3805,8 +3868,7 @@ function toAuthenticatorAttachment(attachment) {
3805
3868
  return attachment;
3806
3869
  }
3807
3870
 
3808
- //#endregion
3809
- //#region ../../node_modules/.pnpm/@simplewebauthn+browser@13.3.0/node_modules/@simplewebauthn/browser/esm/methods/startRegistration.js
3871
+ // ../../node_modules/.pnpm/@simplewebauthn+browser@13.3.0/node_modules/@simplewebauthn/browser/esm/methods/startRegistration.js
3810
3872
  /**
3811
3873
  * Begin authenticator "registration" via WebAuthn attestation
3812
3874
  *
@@ -3894,8 +3956,7 @@ function warnOnBrokenImplementation(methodName, cause) {
3894
3956
  console.warn(`The browser extension that intercepted this WebAuthn API call incorrectly implemented ${methodName}. You should report this error to them.\n`, cause);
3895
3957
  }
3896
3958
 
3897
- //#endregion
3898
- //#region ../../node_modules/.pnpm/@simplewebauthn+browser@13.3.0/node_modules/@simplewebauthn/browser/esm/helpers/browserSupportsWebAuthnAutofill.js
3959
+ // ../../node_modules/.pnpm/@simplewebauthn+browser@13.3.0/node_modules/@simplewebauthn/browser/esm/helpers/browserSupportsWebAuthnAutofill.js
3899
3960
  /**
3900
3961
  * Determine if the browser supports conditional UI, so that WebAuthn credentials can
3901
3962
  * be shown to the user in the browser's typical password autofill popup.
@@ -3914,8 +3975,7 @@ function browserSupportsWebAuthnAutofill() {
3914
3975
  }
3915
3976
  const _browserSupportsWebAuthnAutofillInternals = { stubThis: (value) => value };
3916
3977
 
3917
- //#endregion
3918
- //#region ../../node_modules/.pnpm/@simplewebauthn+browser@13.3.0/node_modules/@simplewebauthn/browser/esm/helpers/identifyAuthenticationError.js
3978
+ // ../../node_modules/.pnpm/@simplewebauthn+browser@13.3.0/node_modules/@simplewebauthn/browser/esm/helpers/identifyAuthenticationError.js
3919
3979
  /**
3920
3980
  * Attempt to intuit _why_ an error was raised after calling `navigator.credentials.get()`
3921
3981
  */
@@ -3958,8 +4018,7 @@ function identifyAuthenticationError({ error, options }) {
3958
4018
  return error;
3959
4019
  }
3960
4020
 
3961
- //#endregion
3962
- //#region ../../node_modules/.pnpm/@simplewebauthn+browser@13.3.0/node_modules/@simplewebauthn/browser/esm/methods/startAuthentication.js
4021
+ // ../../node_modules/.pnpm/@simplewebauthn+browser@13.3.0/node_modules/@simplewebauthn/browser/esm/methods/startAuthentication.js
3963
4022
  /**
3964
4023
  * Begin authenticator "login" via WebAuthn assertion
3965
4024
  *
@@ -4022,8 +4081,7 @@ async function startAuthentication(options) {
4022
4081
  };
4023
4082
  }
4024
4083
 
4025
- //#endregion
4026
- //#region ../../node_modules/.pnpm/@better-auth+passkey@1.7.7_bb9d362000213fa473d66cafce218d0a/node_modules/@better-auth/passkey/dist/client.mjs
4084
+ // ../../node_modules/.pnpm/@better-auth+passkey@1.7.22_@better-auth+core@1.7.22_@better-auth+utils@0.5.1_@better-f_8192076548ca2ef2cc8acd41d1178770/node_modules/@better-auth/passkey/dist/client.mjs
4027
4085
  const getPasskeyActions = ($fetch, { $listPasskeys, $store }) => {
4028
4086
  const signInPasskey = async (opts, options) => {
4029
4087
  const response = await $fetch("/passkey/generate-authenticate-options", {
@@ -4224,12 +4282,10 @@ const passkeyClient = () => {
4224
4282
  };
4225
4283
  };
4226
4284
 
4227
- //#endregion
4228
- //#region ../../node_modules/.pnpm/@better-auth+sso@1.7.7_b7f969b8f4178e26300409b5e56227c3/node_modules/@better-auth/sso/dist/version-DFla2W8i.mjs
4229
- const PACKAGE_VERSION = "1.7.7";
4285
+ // ../../node_modules/.pnpm/@better-auth+sso@1.7.22_@better-auth+core@1.7.22_@better-auth+utils@0.5.1_@better-fetch_d9644db8b9b72e6b09ca797e76a3c6f5/node_modules/@better-auth/sso/dist/version-DnGxDgB4.mjs
4286
+ const PACKAGE_VERSION = "1.7.22";
4230
4287
 
4231
- //#endregion
4232
- //#region ../../node_modules/.pnpm/@better-auth+sso@1.7.7_b7f969b8f4178e26300409b5e56227c3/node_modules/@better-auth/sso/dist/client.mjs
4288
+ // ../../node_modules/.pnpm/@better-auth+sso@1.7.22_@better-auth+core@1.7.22_@better-auth+utils@0.5.1_@better-fetch_d9644db8b9b72e6b09ca797e76a3c6f5/node_modules/@better-auth/sso/dist/client.mjs
4233
4289
  const ssoClient = (options) => {
4234
4290
  return {
4235
4291
  id: "sso-client",
@@ -4242,8 +4298,7 @@ const ssoClient = (options) => {
4242
4298
  };
4243
4299
  };
4244
4300
 
4245
- //#endregion
4246
- //#region ../auth/dist/client.mjs
4301
+ // ../auth/dist/client.mjs
4247
4302
  function d$1(n) {
4248
4303
  return [
4249
4304
  apiKeyClient(),
@@ -4279,8 +4334,7 @@ const f$1 = (e) => createAuthClient({
4279
4334
  plugins: d$1(e)
4280
4335
  });
4281
4336
 
4282
- //#endregion
4283
- //#region src/lib/client.ts
4337
+ // src/lib/client.ts
4284
4338
  const AUTH_BASE_PATH = "/api/v1/auth";
4285
4339
  function createCliAuthClient(apiUrl) {
4286
4340
  return f$1({
@@ -4406,8 +4460,7 @@ async function resolveIds(client, runtime) {
4406
4460
  };
4407
4461
  }
4408
4462
 
4409
- //#endregion
4410
- //#region src/lib/output.ts
4463
+ // src/lib/output.ts
4411
4464
  function getRuntime(command, options) {
4412
4465
  const opts = command.optsWithGlobals();
4413
4466
  return resolveRuntimeConfig(opts, options);
@@ -4436,14 +4489,12 @@ async function confirm(runtime, message) {
4436
4489
  return /^y(es)?$/i.test(answer);
4437
4490
  }
4438
4491
 
4439
- //#endregion
4440
- //#region ../auth/dist/device.mjs
4492
+ // ../auth/dist/device.mjs
4441
4493
  function e(e) {
4442
4494
  return e;
4443
4495
  }
4444
4496
 
4445
- //#endregion
4446
- //#region src/commands/auth.ts
4497
+ // src/commands/auth.ts
4447
4498
  const CLIENT_ID = "shipd-cli";
4448
4499
  const MANAGEMENT_KEY_PREFIX = "shipd_mgmt_";
4449
4500
  function registerAuthCommands(program) {
@@ -4531,20 +4582,19 @@ function registerAuthCommands(program) {
4531
4582
  });
4532
4583
  }
4533
4584
 
4534
- //#endregion
4535
- //#region ../contracts/dist/flag.mjs
4536
- const t = z.enum([
4585
+ // ../contracts/dist/flag.mjs
4586
+ const t = z$1.enum([
4537
4587
  `boolean`,
4538
4588
  `variant`,
4539
4589
  `number`,
4540
4590
  `json`
4541
4591
  ]);
4542
- const n = z.enum([
4592
+ const n = z$1.enum([
4543
4593
  `any`,
4544
4594
  `code`,
4545
4595
  `dashboard`
4546
4596
  ]);
4547
- const r = z.enum([
4597
+ const r = z$1.enum([
4548
4598
  `active`,
4549
4599
  `deprecated`,
4550
4600
  `archived`,
@@ -4554,50 +4604,50 @@ const i = /* @__PURE__ */ new Set([`__proto__`]);
4554
4604
  function a(e) {
4555
4605
  return i.has(e);
4556
4606
  }
4557
- const o = z.string().min(1).refine((e) => e.trim().length > 0, { message: `flag key must not be empty or whitespace-only` }).refine((e) => !a(e), { message: `flag key "__proto__" is reserved` });
4558
- const s = z.union([
4559
- z.string(),
4560
- z.number(),
4561
- z.boolean()
4607
+ const o = z$1.string().min(1).refine((e) => e.trim().length > 0, { message: `flag key must not be empty or whitespace-only` }).refine((e) => !a(e), { message: `flag key "__proto__" is reserved` });
4608
+ const s = z$1.union([
4609
+ z$1.string(),
4610
+ z$1.number(),
4611
+ z$1.boolean()
4562
4612
  ]);
4563
- const c = z.discriminatedUnion(`kind`, [
4564
- z.object({
4565
- kind: z.literal(`boolean`),
4566
- value: z.boolean()
4613
+ const c = z$1.discriminatedUnion(`kind`, [
4614
+ z$1.object({
4615
+ kind: z$1.literal(`boolean`),
4616
+ value: z$1.boolean()
4567
4617
  }),
4568
- z.object({
4569
- kind: z.literal(`variant`),
4570
- value: z.string()
4618
+ z$1.object({
4619
+ kind: z$1.literal(`variant`),
4620
+ value: z$1.string()
4571
4621
  }),
4572
- z.object({
4573
- kind: z.literal(`number`),
4574
- value: z.number()
4622
+ z$1.object({
4623
+ kind: z$1.literal(`number`),
4624
+ value: z$1.number()
4575
4625
  }),
4576
- z.object({
4577
- kind: z.literal(`json`),
4578
- value: z.unknown()
4626
+ z$1.object({
4627
+ kind: z$1.literal(`json`),
4628
+ value: z$1.unknown()
4579
4629
  }),
4580
- z.object({ kind: z.literal(`disabled`) })
4630
+ z$1.object({ kind: z$1.literal(`disabled`) })
4581
4631
  ]);
4582
- const l = z.object({
4583
- kind: z.literal(`weighted`),
4584
- variations: z.array(z.object({
4585
- weight: z.number().positive(),
4632
+ const l = z$1.object({
4633
+ kind: z$1.literal(`weighted`),
4634
+ variations: z$1.array(z$1.object({
4635
+ weight: z$1.number().positive(),
4586
4636
  serve: c
4587
4637
  })).min(1),
4588
- seed: z.string().min(1).optional(),
4589
- attribute: z.string().min(1).optional()
4638
+ seed: z$1.string().min(1).optional(),
4639
+ attribute: z$1.string().min(1).optional()
4590
4640
  });
4591
- const u = z.union([c, l]);
4592
- const d = z.object({
4593
- kind: z.literal(`attribute`),
4594
- attribute: z.string().min(1),
4595
- operator: z.enum([`exists`, `not_exists`])
4641
+ const u = z$1.union([c, l]);
4642
+ const d = z$1.object({
4643
+ kind: z$1.literal(`attribute`),
4644
+ attribute: z$1.string().min(1),
4645
+ operator: z$1.enum([`exists`, `not_exists`])
4596
4646
  });
4597
- const f = z.object({
4598
- kind: z.literal(`attribute`),
4599
- attribute: z.string().min(1),
4600
- operator: z.enum([
4647
+ const f = z$1.object({
4648
+ kind: z$1.literal(`attribute`),
4649
+ attribute: z$1.string().min(1),
4650
+ operator: z$1.enum([
4601
4651
  `eq`,
4602
4652
  `neq`,
4603
4653
  `contains`,
@@ -4610,63 +4660,64 @@ const f = z.object({
4610
4660
  ]),
4611
4661
  value: s
4612
4662
  });
4613
- const p = z.object({
4614
- kind: z.literal(`attribute`),
4615
- attribute: z.string().min(1),
4616
- operator: z.enum([`in`, `not_in`]),
4617
- value: z.array(s).min(1)
4663
+ const p = z$1.object({
4664
+ kind: z$1.literal(`attribute`),
4665
+ attribute: z$1.string().min(1),
4666
+ operator: z$1.enum([`in`, `not_in`]),
4667
+ value: z$1.array(s).min(1)
4618
4668
  });
4619
- const m = z.object({
4620
- kind: z.literal(`percentage`),
4621
- rollout: z.number().min(0).max(100),
4622
- seed: z.string().min(1).optional(),
4623
- attribute: z.string().min(1).optional()
4669
+ const m = z$1.object({
4670
+ kind: z$1.literal(`percentage`),
4671
+ rollout: z$1.number().min(0).max(100),
4672
+ seed: z$1.string().min(1).optional(),
4673
+ attribute: z$1.string().min(1).optional()
4624
4674
  });
4625
- const h = z.object({ kind: z.literal(`always`) });
4626
- const g = z.object({
4627
- kind: z.literal(`segment`),
4628
- segmentId: z.string().min(1),
4629
- operator: z.enum([`in`, `not_in`]).optional()
4675
+ const h = z$1.object({ kind: z$1.literal(`always`) });
4676
+ const g = z$1.object({
4677
+ kind: z$1.literal(`segment`),
4678
+ segmentId: z$1.string().min(1),
4679
+ operator: z$1.enum([`in`, `not_in`]).optional()
4630
4680
  });
4631
4681
  function _(t) {
4632
- return z.lazy(() => z.union([
4682
+ return z$1.lazy(() => z$1.union([
4633
4683
  h,
4634
4684
  m,
4635
4685
  g,
4636
4686
  d,
4637
4687
  f,
4638
4688
  p,
4639
- ...t < 8 ? [z.object({
4640
- kind: z.literal(`group`),
4641
- op: z.enum([`and`, `or`]),
4642
- conditions: z.array(_(t + 1)).min(1)
4689
+ ...t < 8 ? [z$1.object({
4690
+ kind: z$1.literal(`group`),
4691
+ op: z$1.enum([`and`, `or`]),
4692
+ conditions: z$1.array(_(t + 1)).min(1)
4643
4693
  })] : []
4644
4694
  ]));
4645
4695
  }
4646
4696
  const v = _(0);
4647
- const y = z.object({
4648
- id: z.string().min(1),
4649
- description: z.string().optional(),
4650
- conditions: z.array(v),
4697
+ const y = z$1.object({
4698
+ id: z$1.string().min(1),
4699
+ description: z$1.string().optional(),
4700
+ conditions: z$1.array(v),
4651
4701
  serve: u
4652
4702
  });
4653
- const b = z.object({
4654
- id: z.string().min(1),
4655
- conditions: z.array(v).min(1)
4703
+ const b = z$1.object({
4704
+ id: z$1.string().min(1),
4705
+ conditions: z$1.array(v).min(1)
4656
4706
  });
4657
- const x = z.object({ projectId: z.string().min(1) });
4658
- const S = z.object({
4659
- projectId: z.string().min(1),
4660
- key: z.string().min(1)
4707
+ const x = z$1.object({ projectId: z$1.string().min(1) });
4708
+ const S = z$1.object({
4709
+ projectId: z$1.string().min(1),
4710
+ key: z$1.string().min(1)
4661
4711
  });
4662
- const C = z.object({
4663
- projectId: z.string().min(1),
4712
+ const C = z$1.object({
4713
+ projectId: z$1.string().min(1),
4664
4714
  key: o,
4665
- name: z.string().min(1),
4666
- description: z.string().optional(),
4715
+ name: z$1.string().min(1),
4716
+ description: z$1.string().optional(),
4667
4717
  type: t,
4668
- variants: z.array(z.string()).optional(),
4669
- tags: z.array(z.string()).optional()
4718
+ variants: z$1.array(z$1.string()).optional(),
4719
+ tags: z$1.array(z$1.string()).optional(),
4720
+ clientAvailable: z$1.boolean().optional()
4670
4721
  }).superRefine((e, t) => {
4671
4722
  e.type === `variant` && (e.variants?.length ?? 0) === 0 && t.addIssue({
4672
4723
  code: `custom`,
@@ -4674,47 +4725,52 @@ const C = z.object({
4674
4725
  message: `variant flag requires a non-empty variants array`
4675
4726
  });
4676
4727
  });
4677
- const w = z.object({
4678
- expectedVersion: z.number().int().positive().optional(),
4679
- flagId: z.string().min(1),
4728
+ const w = z$1.object({
4729
+ expectedVersion: z$1.number().int().positive().optional(),
4730
+ flagId: z$1.string().min(1),
4680
4731
  key: o.optional(),
4681
- name: z.string().min(1).optional(),
4682
- description: z.string().nullable().optional(),
4732
+ name: z$1.string().min(1).optional(),
4733
+ description: z$1.string().nullable().optional(),
4683
4734
  type: t.optional(),
4684
- variants: z.array(z.string()).nullable().optional(),
4685
- tags: z.array(z.string()).optional()
4735
+ variants: z$1.array(z$1.string()).nullable().optional(),
4736
+ tags: z$1.array(z$1.string()).optional(),
4737
+ clientAvailable: z$1.boolean().optional()
4686
4738
  });
4687
- const T = z.object({ flagId: z.string().min(1) });
4688
- const E = z.object({ projectId: z.string().min(1) });
4689
- const D = z.object({ flagId: z.string().min(1) });
4690
- const O = z.object({
4691
- expectedVersion: z.number().int().positive().optional(),
4692
- flagId: z.string().min(1),
4693
- environmentId: z.string().min(1),
4694
- enabled: z.boolean().optional(),
4695
- rules: z.array(y).optional(),
4739
+ const T = z$1.object({ flagId: z$1.string().min(1) });
4740
+ const E = z$1.object({ projectId: z$1.string().min(1) });
4741
+ const D = z$1.object({ flagId: z$1.string().min(1) });
4742
+ const O = z$1.object({
4743
+ expectedVersion: z$1.number().int().positive().optional(),
4744
+ flagId: z$1.string().min(1),
4745
+ environmentId: z$1.string().min(1),
4746
+ enabled: z$1.boolean().optional(),
4747
+ rules: z$1.array(y).optional(),
4696
4748
  fallthrough: u.optional()
4697
4749
  });
4698
- const k = z.object({
4699
- flagId: z.string().min(1),
4700
- environments: z.array(z.object({
4701
- environmentId: z.string().min(1),
4702
- expectedVersion: z.number().int().positive()
4750
+ const k = z$1.object({
4751
+ flagId: z$1.string().min(1),
4752
+ environments: z$1.array(z$1.object({
4753
+ environmentId: z$1.string().min(1),
4754
+ expectedVersion: z$1.number().int().positive()
4703
4755
  })).min(1).refine((e) => new Set(e.map((e) => e.environmentId)).size === e.length, `Duplicate environments`)
4704
4756
  });
4705
- const A = z.object({
4706
- expectedVersion: z.number().int().positive().optional(),
4707
- flagId: z.string().min(1),
4708
- environmentId: z.string().min(1),
4709
- enabled: z.boolean()
4757
+ const A = z$1.object({
4758
+ expectedVersion: z$1.number().int().positive().optional(),
4759
+ flagId: z$1.string().min(1),
4760
+ environmentId: z$1.string().min(1),
4761
+ enabled: z$1.boolean()
4762
+ });
4763
+ const j = z$1.object({
4764
+ projectId: z$1.string().min(1),
4765
+ environmentId: z$1.string().min(1)
4710
4766
  });
4711
- const j = z.object({ flagId: z.string().min(1) });
4712
- const M = z.enum([`active`, `deprecated`]);
4713
- function N(e) {
4767
+ const M = z$1.object({ flagId: z$1.string().min(1) });
4768
+ const N = z$1.enum([`active`, `deprecated`]);
4769
+ function P(e) {
4714
4770
  let t = Object.getPrototypeOf(e);
4715
4771
  return t === Object.prototype || t === null;
4716
4772
  }
4717
- function P(e, t) {
4773
+ function F(e, t) {
4718
4774
  if (e === null) return !0;
4719
4775
  switch (typeof e) {
4720
4776
  case `boolean`:
@@ -4725,7 +4781,7 @@ function P(e, t) {
4725
4781
  if (n.has(e)) return !1;
4726
4782
  n.add(e);
4727
4783
  try {
4728
- return 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));
4784
+ return Array.isArray(e) ? e.every((e) => F(e, n)) : !P(e) || Object.getOwnPropertySymbols(e).length > 0 ? !1 : Object.keys(e).every((t) => F(e[t], n));
4729
4785
  } finally {
4730
4786
  n.delete(e);
4731
4787
  }
@@ -4733,8 +4789,8 @@ function P(e, t) {
4733
4789
  default: return !1;
4734
4790
  }
4735
4791
  }
4736
- const F = z.custom(P, { message: `default must be JSON-serializable` });
4737
- function I(e, t) {
4792
+ const I = z$1.custom(F, { message: `default must be JSON-serializable` });
4793
+ function L(e, t) {
4738
4794
  switch (e.type) {
4739
4795
  case `boolean`:
4740
4796
  typeof e.default != `boolean` && t.addIssue({
@@ -4744,7 +4800,7 @@ function I(e, t) {
4744
4800
  });
4745
4801
  break;
4746
4802
  case `number`:
4747
- (typeof e.default != `number` || !Number.isFinite(e.default)) && t.addIssue({
4803
+ typeof e.default == `number` && Number.isFinite(e.default) || t.addIssue({
4748
4804
  code: `custom`,
4749
4805
  path: [`default`],
4750
4806
  message: `number flag default must be a finite number`
@@ -4756,33 +4812,33 @@ function I(e, t) {
4756
4812
  code: `custom`,
4757
4813
  path: [`variants`],
4758
4814
  message: `variant flag requires a non-empty variants array`
4759
- }), (typeof e.default != `string` || !n.includes(e.default)) && t.addIssue({
4815
+ }), typeof e.default == `string` && n.includes(e.default) || t.addIssue({
4760
4816
  code: `custom`,
4761
4817
  path: [`default`],
4762
4818
  message: `variant default must be one of: ${n.join(`, `) || `(none)`}`
4763
4819
  });
4764
4820
  break;
4765
4821
  }
4766
- case `json`: F.safeParse(e.default).success || t.addIssue({
4822
+ case `json`: I.safeParse(e.default).success || t.addIssue({
4767
4823
  code: `custom`,
4768
4824
  path: [`default`],
4769
4825
  message: `json flag default must be JSON-serializable`
4770
4826
  });
4771
4827
  }
4772
4828
  }
4773
- const L = z.record(o, z.discriminatedUnion(`type`, [
4774
- z.object({
4775
- type: z.literal(`string`),
4776
- values: z.tuple([z.string()], z.string()).optional(),
4777
- required: z.boolean().optional()
4829
+ const R = z$1.record(o, z$1.discriminatedUnion(`type`, [
4830
+ z$1.object({
4831
+ type: z$1.literal(`string`),
4832
+ values: z$1.tuple([z$1.string()], z$1.string()).optional(),
4833
+ required: z$1.boolean().optional()
4778
4834
  }),
4779
- z.object({
4780
- type: z.literal(`number`),
4781
- required: z.boolean().optional()
4835
+ z$1.object({
4836
+ type: z$1.literal(`number`),
4837
+ required: z$1.boolean().optional()
4782
4838
  }),
4783
- z.object({
4784
- type: z.literal(`boolean`),
4785
- required: z.boolean().optional()
4839
+ z$1.object({
4840
+ type: z$1.literal(`boolean`),
4841
+ required: z$1.boolean().optional()
4786
4842
  })
4787
4843
  ])).superRefine((e, t) => {
4788
4844
  for (let n of [
@@ -4797,14 +4853,14 @@ const L = z.record(o, z.discriminatedUnion(`type`, [
4797
4853
  message: `built-in trait "${n}" must be a string`
4798
4854
  });
4799
4855
  });
4800
- const R = z.custom((e) => typeof e == `object` && !!e && !Array.isArray(e), { message: `trait definitions must be an object` }).superRefine((e, t) => {
4856
+ const z = z$1.custom((e) => typeof e == `object` && !!e && !Array.isArray(e), { message: `trait definitions must be an object` }).superRefine((e, t) => {
4801
4857
  Object.hasOwn(e, `__proto__`) && t.addIssue({
4802
4858
  code: `custom`,
4803
4859
  path: [`__proto__`],
4804
4860
  message: `trait key "__proto__" is reserved`
4805
4861
  });
4806
- }).pipe(L);
4807
- function z$1(e, t) {
4862
+ }).pipe(R);
4863
+ function B(e, t) {
4808
4864
  if (!e.traits || !e.targeting) return;
4809
4865
  let n = {
4810
4866
  userId: { type: `string` },
@@ -4856,9 +4912,9 @@ function z$1(e, t) {
4856
4912
  e.conditions.forEach(a), o(e.serve);
4857
4913
  });
4858
4914
  }
4859
- const B = z.object({
4860
- enabled: z.boolean(),
4861
- rules: z.array(y).max(500),
4915
+ const V = z$1.object({
4916
+ enabled: z$1.boolean(),
4917
+ rules: z$1.array(y).max(500),
4862
4918
  fallthrough: u
4863
4919
  }).strict().superRefine((e, t) => {
4864
4920
  let n = /* @__PURE__ */ new Set();
@@ -4874,7 +4930,7 @@ const B = z.object({
4874
4930
  }), n.add(e.id);
4875
4931
  });
4876
4932
  });
4877
- function V(e, t) {
4933
+ function H(e, t) {
4878
4934
  if (!e.targeting) return;
4879
4935
  let n = (n, r) => {
4880
4936
  n.kind === `weighted` && !Number.isFinite(n.variations.reduce((e, t) => e + t.weight, 0)) && t.addIssue({
@@ -4883,7 +4939,7 @@ function V(e, t) {
4883
4939
  message: `total weight must be finite`
4884
4940
  });
4885
4941
  let i = n.kind === `weighted` ? n.variations.map((e) => e.serve) : [n];
4886
- for (let n of i) n.kind !== `disabled` && (n.kind !== e.type || n.kind === `variant` && !e.variants?.includes(n.value) || n.kind === `json` && !P(n.value)) && t.addIssue({
4942
+ for (let n of i) n.kind !== `disabled` && (n.kind !== e.type || n.kind === `variant` && !e.variants?.includes(n.value) || n.kind === `json` && !F(n.value)) && t.addIssue({
4887
4943
  code: `custom`,
4888
4944
  path: r,
4889
4945
  message: `serve must match the flag type and declared variants and contain JSON values`
@@ -4896,44 +4952,45 @@ function V(e, t) {
4896
4952
  `serve`
4897
4953
  ]));
4898
4954
  }
4899
- const H = z.object({
4955
+ const U = z$1.object({
4900
4956
  type: t,
4901
- variants: z.array(z.string()).optional(),
4902
- traits: R.optional(),
4903
- targeting: B.optional()
4904
- }).superRefine(V).superRefine(z$1);
4905
- const U = z.object({
4957
+ variants: z$1.array(z$1.string()).optional(),
4958
+ traits: z.optional(),
4959
+ targeting: V.optional()
4960
+ }).superRefine(H).superRefine(B);
4961
+ const W = z$1.object({
4962
+ clientAvailable: z$1.boolean().optional(),
4906
4963
  key: o,
4907
4964
  type: t,
4908
- default: z.unknown(),
4909
- description: z.string().optional(),
4910
- tags: z.array(z.string()).default([]),
4911
- lifecycle: M.default(`active`),
4912
- variants: z.array(z.string()).optional(),
4913
- disabled: z.boolean().optional(),
4914
- targeting: B.optional(),
4915
- traits: R.optional()
4965
+ default: z$1.unknown(),
4966
+ description: z$1.string().optional(),
4967
+ tags: z$1.array(z$1.string()).default([]),
4968
+ lifecycle: N.default(`active`),
4969
+ variants: z$1.array(z$1.string()).optional(),
4970
+ disabled: z$1.boolean().optional(),
4971
+ targeting: V.optional(),
4972
+ traits: z.optional()
4916
4973
  });
4917
- const W = U.superRefine(I).superRefine(V).superRefine(z$1);
4918
- const G = U.extend({
4919
- version: z.number().int().positive(),
4920
- environmentVersion: z.number().int().positive().optional(),
4974
+ const G = W.superRefine(L).superRefine(H).superRefine(B);
4975
+ const K = W.extend({
4976
+ version: z$1.number().int().positive(),
4977
+ environmentVersion: z$1.number().int().positive().optional(),
4921
4978
  managedBy: n
4922
- }).superRefine(I).superRefine(V).superRefine(z$1);
4923
- const K = z.object({
4924
- version: z.number().int().positive(),
4925
- environmentVersion: z.number().int().positive().optional()
4979
+ }).superRefine(L).superRefine(H).superRefine(B);
4980
+ const q = z$1.object({
4981
+ version: z$1.number().int().positive(),
4982
+ environmentVersion: z$1.number().int().positive().optional()
4926
4983
  });
4927
- const q = z.object({
4928
- projectId: z.string().min(1),
4929
- environmentId: z.string().min(1)
4984
+ const J = z$1.object({
4985
+ projectId: z$1.string().min(1),
4986
+ environmentId: z$1.string().min(1)
4930
4987
  });
4931
- const J = z.object({
4932
- projectId: z.string(),
4933
- environmentId: z.string(),
4934
- flags: z.array(G)
4988
+ const Y = z$1.object({
4989
+ projectId: z$1.string(),
4990
+ environmentId: z$1.string(),
4991
+ flags: z$1.array(K)
4935
4992
  });
4936
- function Y(e, t) {
4993
+ function X(e, t) {
4937
4994
  let n = /* @__PURE__ */ new Set();
4938
4995
  for (let [r, i] of e.entries()) n.has(i.key) && t.addIssue({
4939
4996
  code: `custom`,
@@ -4945,53 +5002,52 @@ function Y(e, t) {
4945
5002
  message: `duplicate flag key "${i.key}"`
4946
5003
  }), n.add(i.key);
4947
5004
  }
4948
- const X = z.object({
4949
- projectId: z.string().min(1),
4950
- environmentId: z.string().min(1),
4951
- flags: z.array(W).max(500)
4952
- }).superRefine((e, t) => Y(e.flags, t));
4953
- const Z = z.object({
4954
- key: z.string(),
4955
- op: z.enum([
5005
+ const Z = z$1.object({
5006
+ projectId: z$1.string().min(1),
5007
+ environmentId: z$1.string().min(1),
5008
+ flags: z$1.array(G).max(500)
5009
+ }).superRefine((e, t) => X(e.flags, t));
5010
+ const Q = z$1.object({
5011
+ key: z$1.string(),
5012
+ op: z$1.enum([
4956
5013
  `add`,
4957
5014
  `update`,
4958
5015
  `remove`,
4959
5016
  `unlinked`
4960
5017
  ]),
4961
- before: G.optional(),
4962
- after: W.optional(),
4963
- message: z.string().optional()
5018
+ before: K.optional(),
5019
+ after: G.optional(),
5020
+ message: z$1.string().optional()
4964
5021
  });
4965
- const Q = z.object({
4966
- projectId: z.string(),
4967
- environmentId: z.string(),
4968
- changes: z.array(Z),
4969
- remoteOnly: z.array(G).default([])
5022
+ const $ = z$1.object({
5023
+ projectId: z$1.string(),
5024
+ environmentId: z$1.string(),
5025
+ changes: z$1.array(Q),
5026
+ remoteOnly: z$1.array(K).default([])
4970
5027
  });
4971
- const $ = z.object({
4972
- projectId: z.string().min(1),
4973
- environmentId: z.string().min(1),
4974
- flags: z.array(W).max(500),
4975
- apply: z.boolean().default(!1),
4976
- prune: z.boolean().default(!1),
4977
- force: z.boolean().default(!1),
4978
- adopt: z.boolean().default(!1),
4979
- expectedVersions: z.record(z.string(), K).optional()
4980
- }).superRefine((e, t) => Y(e.flags, t));
4981
- const ee = z.object({
4982
- projectId: z.string(),
4983
- environmentId: z.string(),
4984
- applied: z.boolean(),
4985
- changes: z.array(Z),
4986
- remoteOnly: z.array(G).default([]),
4987
- forced: z.boolean().default(!1),
4988
- adopted: z.boolean().default(!1),
4989
- approvalRequests: z.array(z.string()).default([]),
4990
- drafts: z.array(z.string()).default([])
5028
+ const ee = z$1.object({
5029
+ projectId: z$1.string().min(1),
5030
+ environmentId: z$1.string().min(1),
5031
+ flags: z$1.array(G).max(500),
5032
+ apply: z$1.boolean().default(!1),
5033
+ prune: z$1.boolean().default(!1),
5034
+ force: z$1.boolean().default(!1),
5035
+ adopt: z$1.boolean().default(!1),
5036
+ expectedVersions: z$1.record(z$1.string(), q).optional()
5037
+ }).superRefine((e, t) => X(e.flags, t));
5038
+ const te = z$1.object({
5039
+ projectId: z$1.string(),
5040
+ environmentId: z$1.string(),
5041
+ applied: z$1.boolean(),
5042
+ changes: z$1.array(Q),
5043
+ remoteOnly: z$1.array(K).default([]),
5044
+ forced: z$1.boolean().default(!1),
5045
+ adopted: z$1.boolean().default(!1),
5046
+ approvalRequests: z$1.array(z$1.string()).default([]),
5047
+ drafts: z$1.array(z$1.string()).default([])
4991
5048
  });
4992
5049
 
4993
- //#endregion
4994
- //#region src/lib/go-string.ts
5050
+ // src/lib/go-string.ts
4995
5051
  /** Go strings cannot represent JavaScript's unpaired UTF-16 surrogates. */
4996
5052
  function goString(value) {
4997
5053
  for (const character of value) {
@@ -5001,8 +5057,7 @@ function goString(value) {
5001
5057
  return JSON.stringify(value);
5002
5058
  }
5003
5059
 
5004
- //#endregion
5005
- //#region src/lib/go-config.ts
5060
+ // src/lib/go-config.ts
5006
5061
  /** Read the package clause after leading whitespace and comments, not comment text. */
5007
5062
  function goPackageClause(source) {
5008
5063
  let offset = 0;
@@ -5194,9 +5249,8 @@ var Config = config.ShipdConfig${entries.length ? `{\n${entries.join("\n")}\n}`
5194
5249
  `;
5195
5250
  }
5196
5251
 
5197
- //#endregion
5198
- //#region src/lib/local-config.ts
5199
- const localFlagsArraySchema = z.array(W).superRefine((flags, ctx) => {
5252
+ // src/lib/local-config.ts
5253
+ const localFlagsArraySchema = z$1.array(G).superRefine((flags, ctx) => {
5200
5254
  const seen = /* @__PURE__ */ new Set();
5201
5255
  for (const [index, flag] of flags.entries()) {
5202
5256
  if (seen.has(flag.key)) ctx.addIssue({
@@ -5233,6 +5287,7 @@ async function loadLocalFlags(configFile) {
5233
5287
  key,
5234
5288
  type: flag.type,
5235
5289
  default: flag.default,
5290
+ clientAvailable: flag.clientAvailable,
5236
5291
  description: flag.description,
5237
5292
  tags: flag.tags ?? [],
5238
5293
  lifecycle: flag.lifecycle ?? (flag.deprecated === true ? "deprecated" : "active"),
@@ -5250,6 +5305,7 @@ async function loadLocalFlags(configFile) {
5250
5305
  key: flag.key,
5251
5306
  type: flag.type,
5252
5307
  default: flag.default,
5308
+ clientAvailable: flag.clientAvailable,
5253
5309
  description: flag.description,
5254
5310
  tags: flag.tags,
5255
5311
  lifecycle: flag.lifecycle,
@@ -5275,6 +5331,7 @@ ${flags.map((flag) => {
5275
5331
  if (flag.type === "variant" && flag.variants) lines.push(` variants: ${JSON.stringify(flag.variants)} as const,`, ` default: ${JSON.stringify(flag.default)},`);
5276
5332
  else if (flag.type === "json") lines.push(` default: ${serializeValue(flag.default)},`);
5277
5333
  else lines.push(` default: ${JSON.stringify(flag.default)},`);
5334
+ if (flag.clientAvailable !== void 0) lines.push(` clientAvailable: ${flag.clientAvailable},`);
5278
5335
  if (flag.traits !== void 0) lines.push(` traits: ${serializeValue(flag.traits)},`);
5279
5336
  if (flag.targeting !== void 0) lines.push(` targeting: ${serializeValue(flag.targeting)},`);
5280
5337
  if (flag.description !== void 0) lines.push(` description: ${JSON.stringify(flag.description)},`);
@@ -5340,8 +5397,7 @@ function generateJSONConfigSource(flags) {
5340
5397
  }, null, 2)}\n`;
5341
5398
  }
5342
5399
 
5343
- //#endregion
5344
- //#region src/lib/plan.ts
5400
+ // src/lib/plan.ts
5345
5401
  const DEFINITION_FIELDS = [
5346
5402
  "type",
5347
5403
  "default",
@@ -5351,7 +5407,8 @@ const DEFINITION_FIELDS = [
5351
5407
  "tags",
5352
5408
  "lifecycle",
5353
5409
  "variants",
5354
- "traits"
5410
+ "traits",
5411
+ "clientAvailable"
5355
5412
  ];
5356
5413
  function formatValue(value) {
5357
5414
  if (value === void 0) return "undefined";
@@ -5360,6 +5417,7 @@ function formatValue(value) {
5360
5417
  function fieldChanges(before, after) {
5361
5418
  const fields = {};
5362
5419
  for (const field of DEFINITION_FIELDS) {
5420
+ if (field === "clientAvailable" && after.clientAvailable === void 0) continue;
5363
5421
  if (field === "traits" && after.traits === void 0) continue;
5364
5422
  if (field === "targeting" && after.targeting === void 0) continue;
5365
5423
  const from = before[field];
@@ -5377,7 +5435,8 @@ const DEFINITION_ONLY_FIELDS = [
5377
5435
  "tags",
5378
5436
  "lifecycle",
5379
5437
  "variants",
5380
- "traits"
5438
+ "traits",
5439
+ "clientAvailable"
5381
5440
  ];
5382
5441
  function planHasDefinitionChanges(plan) {
5383
5442
  if (plan.creates.length > 0 || plan.archives.length > 0) return true;
@@ -5464,13 +5523,12 @@ function formatSyncPlan(plan) {
5464
5523
  }
5465
5524
  if (planHasDefinitionChanges(plan)) {
5466
5525
  lines.push("");
5467
- lines.push("Note: definition changes (type, variants, tags, lifecycle, description) apply to all environments.");
5526
+ lines.push("Note: definition changes (type, variants, tags, lifecycle, description, clientAvailable) apply to all environments.");
5468
5527
  }
5469
5528
  return lines.join("\n").trimEnd();
5470
5529
  }
5471
5530
 
5472
- //#endregion
5473
- //#region src/commands/diff.ts
5531
+ // src/commands/diff.ts
5474
5532
  function registerDiffCommand(program) {
5475
5533
  program.command("diff").description("Show drift between local definitions and the server").option("--exit-code", "Exit 2 on drift, 4 on unlinked (0 when clean)", false).action(async (opts, command) => {
5476
5534
  const runtime = getRuntime(command);
@@ -5499,8 +5557,7 @@ function registerDiffCommand(program) {
5499
5557
  });
5500
5558
  }
5501
5559
 
5502
- //#endregion
5503
- //#region src/commands/environments.ts
5560
+ // src/commands/environments.ts
5504
5561
  function registerEnvironmentsCommands(program) {
5505
5562
  program.command("environments").description("Environment operations").command("list").description("List environments for the current project").action(async (_opts, command) => {
5506
5563
  const runtime = getRuntime(command);
@@ -5522,16 +5579,14 @@ function registerEnvironmentsCommands(program) {
5522
5579
  });
5523
5580
  }
5524
5581
 
5525
- //#endregion
5526
- //#region src/lib/flag-options.ts
5582
+ // src/lib/flag-options.ts
5527
5583
  /** Parse `--variants a,b` / `--variants a --variants b` into a deduped list. */
5528
5584
  function parseVariantsOption(raw) {
5529
5585
  const parts = (Array.isArray(raw) ? raw : raw !== void 0 ? [raw] : []).flatMap((value) => value.split(",")).map((value) => value.trim()).filter((value) => value.length > 0);
5530
5586
  return [...new Set(parts)];
5531
5587
  }
5532
5588
 
5533
- //#endregion
5534
- //#region src/commands/flags.ts
5589
+ // src/commands/flags.ts
5535
5590
  const FLAG_TYPES = [
5536
5591
  "boolean",
5537
5592
  "variant",
@@ -5588,8 +5643,7 @@ function registerFlagsCommands(program) {
5588
5643
  });
5589
5644
  }
5590
5645
 
5591
- //#endregion
5592
- //#region src/commands/projects.ts
5646
+ // src/commands/projects.ts
5593
5647
  function registerProjectsCommands(program) {
5594
5648
  program.command("projects").description("Project operations").command("list").description("List projects in the active organization").action(async (_opts, command) => {
5595
5649
  const runtime = getRuntime(command);
@@ -5606,11 +5660,10 @@ function registerProjectsCommands(program) {
5606
5660
  });
5607
5661
  }
5608
5662
 
5609
- //#endregion
5610
- //#region src/lib/sync-state.ts
5611
- const stateSchema = z.object({
5612
- version: z.literal(1),
5613
- flags: z.record(o, B)
5663
+ // src/lib/sync-state.ts
5664
+ const stateSchema = z$1.object({
5665
+ version: z$1.literal(1),
5666
+ flags: z$1.record(o, V)
5614
5667
  }).strict();
5615
5668
  function stateFile(runtime, projectId, environmentId) {
5616
5669
  const identity = JSON.stringify([
@@ -5670,8 +5723,7 @@ function assertPullPreservesLocalTargeting(state, local, remote) {
5670
5723
  }
5671
5724
  }
5672
5725
 
5673
- //#endregion
5674
- //#region src/lib/go-typegen.ts
5726
+ // src/lib/go-typegen.ts
5675
5727
  const GO_KEYWORDS = new Set("break default func interface select case defer go map struct chan else goto package switch const fallthrough if range type continue for import return var".split(" "));
5676
5728
  function goName(value) {
5677
5729
  let name = (value.normalize("NFC").match(/[\p{L}\p{Nd}]+/gu) ?? []).map((word) => word[0].toUpperCase() + word.slice(1)).join("");
@@ -5759,8 +5811,7 @@ ${declarations}
5759
5811
  `.trimEnd() + "\n";
5760
5812
  }
5761
5813
 
5762
- //#endregion
5763
- //#region src/lib/typegen.ts
5814
+ // src/lib/typegen.ts
5764
5815
  async function runTypegen(runtime, outPath = runtime.typesOut, options = {}) {
5765
5816
  return writeTypegen(prepareTypegen(runtime, await loadLocalFlags(runtime.configFile), outPath, options));
5766
5817
  }
@@ -5783,8 +5834,7 @@ function writeTypegen(prepared) {
5783
5834
  };
5784
5835
  }
5785
5836
 
5786
- //#endregion
5787
- //#region src/commands/pull.ts
5837
+ // src/commands/pull.ts
5788
5838
  function registerPullCommand(program) {
5789
5839
  program.command("pull").description("Regenerate the flag config from the server and run typegen").option("--force", "Overwrite unsynced local targeting", false).action(async (opts, command) => {
5790
5840
  const runtime = getRuntime(command);
@@ -5797,6 +5847,7 @@ function registerPullCommand(program) {
5797
5847
  key: flag.key,
5798
5848
  type: flag.type,
5799
5849
  default: flag.default,
5850
+ clientAvailable: flag.clientAvailable,
5800
5851
  description: flag.description,
5801
5852
  tags: flag.tags,
5802
5853
  lifecycle: flag.lifecycle,
@@ -5823,8 +5874,7 @@ function registerPullCommand(program) {
5823
5874
  });
5824
5875
  }
5825
5876
 
5826
- //#endregion
5827
- //#region src/commands/push.ts
5877
+ // src/commands/push.ts
5828
5878
  function expectedVersionsFromChanges(changes) {
5829
5879
  const expected = {};
5830
5880
  for (const change of changes) if (change.before?.version !== void 0) expected[change.key] = {
@@ -5907,8 +5957,7 @@ function registerPushCommand(program) {
5907
5957
  });
5908
5958
  }
5909
5959
 
5910
- //#endregion
5911
- //#region src/commands/snapshots.ts
5960
+ // src/commands/snapshots.ts
5912
5961
  function registerSnapshotsCommands(program) {
5913
5962
  const snapshots = program.command("snapshots").description("Data-plane snapshot operations");
5914
5963
  snapshots.command("publish").description("Materialize the environment snapshot from Postgres and publish to the data plane").action(async (_opts, command) => {
@@ -5980,8 +6029,7 @@ function registerSnapshotsCommands(program) {
5980
6029
  });
5981
6030
  }
5982
6031
 
5983
- //#endregion
5984
- //#region src/commands/types.ts
6032
+ // src/commands/types.ts
5985
6033
  function registerTypesCommands(program) {
5986
6034
  program.command("types").description("Type generation helpers").command("gen").description("Generate TypeScript types or Go accessors from the local flag config").addOption(new Option("--language <language>", "Output language").choices(["typescript", "go"])).option("--package <name>", "Go package name (default: flags)").option("-o, --out <path>", "Output file path").action(async (opts, command) => {
5987
6035
  const runtime = getRuntime(command);
@@ -5995,8 +6043,7 @@ function registerTypesCommands(program) {
5995
6043
  });
5996
6044
  }
5997
6045
 
5998
- //#endregion
5999
- //#region src/index.ts
6046
+ // src/index.ts
6000
6047
  /** Detected before parse so usage errors can suppress Commander text under `--json`. */
6001
6048
  const jsonRequested = process.argv.includes("--json");
6002
6049
  const program = new Command().name("shipd").description("shipd CLI — flags as code").option("--json", "Machine-readable JSON output", false).option("--yes", "Skip confirmation prompts", false).option("--ci", "Non-interactive mode (same as --yes / CI=1)", false).option("--api-url <url>", `API origin (default: ${DEFAULT_API_URL})`).option("--org <slug>", "Organization slug (session: select; API key: must match)").option("--project <slug>", "Project slug").option("--env <slug>", "Environment slug").option("--config <path>", "Project settings JSON (.shipd/config.json shape)").option("--flags-config <path>", "Path to shipd.config.ts, shipd.config.go, or shipd.config.json").exitOverride().showHelpAfterError(!jsonRequested);
@@ -6051,5 +6098,4 @@ async function main() {
6051
6098
  }
6052
6099
  main();
6053
6100
 
6054
- //#endregion
6055
6101
  export { };