@robelest/convex-auth 0.0.2-preview.1 → 0.0.2

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 (145) hide show
  1. package/dist/bin.cjs +466 -63
  2. package/dist/client/index.d.ts +211 -30
  3. package/dist/client/index.d.ts.map +1 -1
  4. package/dist/client/index.js +673 -59
  5. package/dist/client/index.js.map +1 -1
  6. package/dist/component/_generated/api.d.ts +56 -1
  7. package/dist/component/_generated/api.d.ts.map +1 -1
  8. package/dist/component/_generated/api.js.map +1 -1
  9. package/dist/component/_generated/component.d.ts +93 -3
  10. package/dist/component/_generated/component.d.ts.map +1 -1
  11. package/dist/component/convex.config.d.ts.map +1 -1
  12. package/dist/component/convex.config.js +2 -0
  13. package/dist/component/convex.config.js.map +1 -1
  14. package/dist/component/index.d.ts +5 -3
  15. package/dist/component/index.d.ts.map +1 -1
  16. package/dist/component/index.js +5 -3
  17. package/dist/component/index.js.map +1 -1
  18. package/dist/component/portalBridge.d.ts +80 -0
  19. package/dist/component/portalBridge.d.ts.map +1 -0
  20. package/dist/component/portalBridge.js +102 -0
  21. package/dist/component/portalBridge.js.map +1 -0
  22. package/dist/component/public.d.ts +193 -9
  23. package/dist/component/public.d.ts.map +1 -1
  24. package/dist/component/public.js +204 -33
  25. package/dist/component/public.js.map +1 -1
  26. package/dist/component/schema.d.ts +89 -9
  27. package/dist/component/schema.d.ts.map +1 -1
  28. package/dist/component/schema.js +68 -7
  29. package/dist/component/schema.js.map +1 -1
  30. package/dist/providers/{Anonymous.d.ts → anonymous.d.ts} +8 -8
  31. package/dist/providers/{Anonymous.d.ts.map → anonymous.d.ts.map} +1 -1
  32. package/dist/providers/{Anonymous.js → anonymous.js} +9 -10
  33. package/dist/providers/anonymous.js.map +1 -0
  34. package/dist/providers/{ConvexCredentials.d.ts → credentials.d.ts} +11 -11
  35. package/dist/providers/credentials.d.ts.map +1 -0
  36. package/dist/providers/{ConvexCredentials.js → credentials.js} +8 -8
  37. package/dist/providers/credentials.js.map +1 -0
  38. package/dist/providers/{Email.d.ts → email.d.ts} +6 -6
  39. package/dist/providers/email.d.ts.map +1 -0
  40. package/dist/providers/{Email.js → email.js} +6 -6
  41. package/dist/providers/email.js.map +1 -0
  42. package/dist/providers/passkey.d.ts +20 -0
  43. package/dist/providers/passkey.d.ts.map +1 -0
  44. package/dist/providers/passkey.js +32 -0
  45. package/dist/providers/passkey.js.map +1 -0
  46. package/dist/providers/{Password.d.ts → password.d.ts} +10 -10
  47. package/dist/providers/{Password.d.ts.map → password.d.ts.map} +1 -1
  48. package/dist/providers/{Password.js → password.js} +19 -20
  49. package/dist/providers/password.js.map +1 -0
  50. package/dist/providers/{Phone.d.ts → phone.d.ts} +3 -3
  51. package/dist/providers/{Phone.d.ts.map → phone.d.ts.map} +1 -1
  52. package/dist/providers/{Phone.js → phone.js} +3 -3
  53. package/dist/providers/{Phone.js.map → phone.js.map} +1 -1
  54. package/dist/providers/totp.d.ts +14 -0
  55. package/dist/providers/totp.d.ts.map +1 -0
  56. package/dist/providers/totp.js +23 -0
  57. package/dist/providers/totp.js.map +1 -0
  58. package/dist/server/convex-auth.d.ts +243 -0
  59. package/dist/server/convex-auth.d.ts.map +1 -0
  60. package/dist/server/convex-auth.js +365 -0
  61. package/dist/server/convex-auth.js.map +1 -0
  62. package/dist/server/implementation/index.d.ts +153 -166
  63. package/dist/server/implementation/index.d.ts.map +1 -1
  64. package/dist/server/implementation/index.js +162 -105
  65. package/dist/server/implementation/index.js.map +1 -1
  66. package/dist/server/implementation/passkey.d.ts +33 -0
  67. package/dist/server/implementation/passkey.d.ts.map +1 -0
  68. package/dist/server/implementation/passkey.js +450 -0
  69. package/dist/server/implementation/passkey.js.map +1 -0
  70. package/dist/server/implementation/redirects.d.ts.map +1 -1
  71. package/dist/server/implementation/redirects.js +4 -9
  72. package/dist/server/implementation/redirects.js.map +1 -1
  73. package/dist/server/implementation/sessions.d.ts +2 -20
  74. package/dist/server/implementation/sessions.d.ts.map +1 -1
  75. package/dist/server/implementation/sessions.js +2 -20
  76. package/dist/server/implementation/sessions.js.map +1 -1
  77. package/dist/server/implementation/signIn.d.ts +13 -0
  78. package/dist/server/implementation/signIn.d.ts.map +1 -1
  79. package/dist/server/implementation/signIn.js +26 -1
  80. package/dist/server/implementation/signIn.js.map +1 -1
  81. package/dist/server/implementation/totp.d.ts +40 -0
  82. package/dist/server/implementation/totp.d.ts.map +1 -0
  83. package/dist/server/implementation/totp.js +211 -0
  84. package/dist/server/implementation/totp.js.map +1 -0
  85. package/dist/server/index.d.ts +18 -0
  86. package/dist/server/index.d.ts.map +1 -1
  87. package/dist/server/index.js +255 -0
  88. package/dist/server/index.js.map +1 -1
  89. package/dist/server/portal-email.d.ts +19 -0
  90. package/dist/server/portal-email.d.ts.map +1 -0
  91. package/dist/server/portal-email.js +89 -0
  92. package/dist/server/portal-email.js.map +1 -0
  93. package/dist/server/portal.d.ts +116 -0
  94. package/dist/server/portal.d.ts.map +1 -0
  95. package/dist/server/portal.js +294 -0
  96. package/dist/server/portal.js.map +1 -0
  97. package/dist/server/provider_utils.d.ts +1 -1
  98. package/dist/server/provider_utils.d.ts.map +1 -1
  99. package/dist/server/provider_utils.js +39 -1
  100. package/dist/server/provider_utils.js.map +1 -1
  101. package/dist/server/types.d.ts +128 -11
  102. package/dist/server/types.d.ts.map +1 -1
  103. package/package.json +7 -7
  104. package/src/cli/index.ts +48 -6
  105. package/src/cli/portal-link.ts +112 -0
  106. package/src/cli/portal-upload.ts +411 -0
  107. package/src/client/index.ts +823 -109
  108. package/src/component/_generated/api.ts +72 -1
  109. package/src/component/_generated/component.ts +180 -4
  110. package/src/component/convex.config.ts +3 -0
  111. package/src/component/index.ts +5 -10
  112. package/src/component/portalBridge.ts +116 -0
  113. package/src/component/public.ts +231 -37
  114. package/src/component/schema.ts +70 -7
  115. package/src/providers/{Anonymous.ts → anonymous.ts} +10 -11
  116. package/src/providers/{ConvexCredentials.ts → credentials.ts} +11 -11
  117. package/src/providers/{Email.ts → email.ts} +5 -5
  118. package/src/providers/passkey.ts +35 -0
  119. package/src/providers/{Password.ts → password.ts} +22 -27
  120. package/src/providers/{Phone.ts → phone.ts} +2 -2
  121. package/src/providers/totp.ts +26 -0
  122. package/src/server/convex-auth.ts +470 -0
  123. package/src/server/implementation/index.ts +228 -239
  124. package/src/server/implementation/passkey.ts +650 -0
  125. package/src/server/implementation/redirects.ts +4 -11
  126. package/src/server/implementation/sessions.ts +2 -20
  127. package/src/server/implementation/signIn.ts +39 -1
  128. package/src/server/implementation/totp.ts +366 -0
  129. package/src/server/index.ts +373 -0
  130. package/src/server/portal-email.ts +95 -0
  131. package/src/server/portal.ts +375 -0
  132. package/src/server/provider_utils.ts +42 -1
  133. package/src/server/types.ts +161 -10
  134. package/dist/providers/Anonymous.js.map +0 -1
  135. package/dist/providers/ConvexCredentials.d.ts.map +0 -1
  136. package/dist/providers/ConvexCredentials.js.map +0 -1
  137. package/dist/providers/Email.d.ts.map +0 -1
  138. package/dist/providers/Email.js.map +0 -1
  139. package/dist/providers/Password.js.map +0 -1
  140. package/providers/Anonymous/package.json +0 -6
  141. package/providers/ConvexCredentials/package.json +0 -6
  142. package/providers/Email/package.json +0 -6
  143. package/providers/Password/package.json +0 -6
  144. package/providers/Phone/package.json +0 -6
  145. package/server/package.json +0 -6
package/dist/bin.cjs CHANGED
@@ -6,6 +6,9 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
7
  var __getProtoOf = Object.getPrototypeOf;
8
8
  var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __esm = (fn, res) => function __init() {
10
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
11
+ };
9
12
  var __commonJS = (cb, mod) => function __require() {
10
13
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
11
14
  };
@@ -3769,8 +3772,8 @@ var require_main = __commonJS({
3769
3772
  const shortPaths = [];
3770
3773
  for (const filePath of optionPaths) {
3771
3774
  try {
3772
- const relative = path3.relative(process.cwd(), filePath);
3773
- shortPaths.push(relative);
3775
+ const relative2 = path3.relative(process.cwd(), filePath);
3776
+ shortPaths.push(relative2);
3774
3777
  } catch (e) {
3775
3778
  if (debug) {
3776
3779
  _debug(`Failed to load ${filePath} ${e.message}`);
@@ -9623,7 +9626,7 @@ var require_lib2 = __commonJS({
9623
9626
  return matches;
9624
9627
  };
9625
9628
  exports2.analyse = analyse;
9626
- var detectFile = (filepath, opts = {}) => new Promise((resolve, reject) => {
9629
+ var detectFile = (filepath, opts = {}) => new Promise((resolve2, reject) => {
9627
9630
  let fd;
9628
9631
  const fs = (0, node_1.default)();
9629
9632
  const handler = (err, buffer) => {
@@ -9633,7 +9636,7 @@ var require_lib2 = __commonJS({
9633
9636
  if (err) {
9634
9637
  reject(err);
9635
9638
  } else if (buffer) {
9636
- resolve((0, exports2.detect)(buffer));
9639
+ resolve2((0, exports2.detect)(buffer));
9637
9640
  } else {
9638
9641
  reject(new Error("No error and no buffer received"));
9639
9642
  }
@@ -14176,7 +14179,7 @@ var require_Observable = __commonJS({
14176
14179
  Observable2.prototype.forEach = function(next, promiseCtor) {
14177
14180
  var _this = this;
14178
14181
  promiseCtor = getPromiseCtor(promiseCtor);
14179
- return new promiseCtor(function(resolve, reject) {
14182
+ return new promiseCtor(function(resolve2, reject) {
14180
14183
  var subscriber = new Subscriber_1.SafeSubscriber({
14181
14184
  next: function(value) {
14182
14185
  try {
@@ -14187,7 +14190,7 @@ var require_Observable = __commonJS({
14187
14190
  }
14188
14191
  },
14189
14192
  error: reject,
14190
- complete: resolve
14193
+ complete: resolve2
14191
14194
  });
14192
14195
  _this.subscribe(subscriber);
14193
14196
  });
@@ -14209,14 +14212,14 @@ var require_Observable = __commonJS({
14209
14212
  Observable2.prototype.toPromise = function(promiseCtor) {
14210
14213
  var _this = this;
14211
14214
  promiseCtor = getPromiseCtor(promiseCtor);
14212
- return new promiseCtor(function(resolve, reject) {
14215
+ return new promiseCtor(function(resolve2, reject) {
14213
14216
  var value;
14214
14217
  _this.subscribe(function(x) {
14215
14218
  return value = x;
14216
14219
  }, function(err) {
14217
14220
  return reject(err);
14218
14221
  }, function() {
14219
- return resolve(value);
14222
+ return resolve2(value);
14220
14223
  });
14221
14224
  });
14222
14225
  };
@@ -16312,11 +16315,11 @@ var require_innerFrom = __commonJS({
16312
16315
  "use strict";
16313
16316
  var __awaiter = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) {
16314
16317
  function adopt(value) {
16315
- return value instanceof P ? value : new P(function(resolve) {
16316
- resolve(value);
16318
+ return value instanceof P ? value : new P(function(resolve2) {
16319
+ resolve2(value);
16317
16320
  });
16318
16321
  }
16319
- return new (P || (P = Promise))(function(resolve, reject) {
16322
+ return new (P || (P = Promise))(function(resolve2, reject) {
16320
16323
  function fulfilled(value) {
16321
16324
  try {
16322
16325
  step(generator.next(value));
@@ -16332,7 +16335,7 @@ var require_innerFrom = __commonJS({
16332
16335
  }
16333
16336
  }
16334
16337
  function step(result) {
16335
- result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
16338
+ result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected);
16336
16339
  }
16337
16340
  step((generator = generator.apply(thisArg, _arguments || [])).next());
16338
16341
  });
@@ -16414,14 +16417,14 @@ var require_innerFrom = __commonJS({
16414
16417
  }, i);
16415
16418
  function verb(n) {
16416
16419
  i[n] = o[n] && function(v) {
16417
- return new Promise(function(resolve, reject) {
16418
- v = o[n](v), settle(resolve, reject, v.done, v.value);
16420
+ return new Promise(function(resolve2, reject) {
16421
+ v = o[n](v), settle(resolve2, reject, v.done, v.value);
16419
16422
  });
16420
16423
  };
16421
16424
  }
16422
- function settle(resolve, reject, d, v) {
16425
+ function settle(resolve2, reject, d, v) {
16423
16426
  Promise.resolve(v).then(function(v2) {
16424
- resolve({ value: v2, done: d });
16427
+ resolve2({ value: v2, done: d });
16425
16428
  }, reject);
16426
16429
  }
16427
16430
  };
@@ -17040,7 +17043,7 @@ var require_lastValueFrom = __commonJS({
17040
17043
  var EmptyError_1 = require_EmptyError();
17041
17044
  function lastValueFrom2(source, config) {
17042
17045
  var hasConfig = typeof config === "object";
17043
- return new Promise(function(resolve, reject) {
17046
+ return new Promise(function(resolve2, reject) {
17044
17047
  var _hasValue = false;
17045
17048
  var _value;
17046
17049
  source.subscribe({
@@ -17051,9 +17054,9 @@ var require_lastValueFrom = __commonJS({
17051
17054
  error: reject,
17052
17055
  complete: function() {
17053
17056
  if (_hasValue) {
17054
- resolve(_value);
17057
+ resolve2(_value);
17055
17058
  } else if (hasConfig) {
17056
- resolve(config.defaultValue);
17059
+ resolve2(config.defaultValue);
17057
17060
  } else {
17058
17061
  reject(new EmptyError_1.EmptyError());
17059
17062
  }
@@ -17075,16 +17078,16 @@ var require_firstValueFrom = __commonJS({
17075
17078
  var Subscriber_1 = require_Subscriber();
17076
17079
  function firstValueFrom(source, config) {
17077
17080
  var hasConfig = typeof config === "object";
17078
- return new Promise(function(resolve, reject) {
17081
+ return new Promise(function(resolve2, reject) {
17079
17082
  var subscriber = new Subscriber_1.SafeSubscriber({
17080
17083
  next: function(value) {
17081
- resolve(value);
17084
+ resolve2(value);
17082
17085
  subscriber.unsubscribe();
17083
17086
  },
17084
17087
  error: reject,
17085
17088
  complete: function() {
17086
17089
  if (hasConfig) {
17087
- resolve(config.defaultValue);
17090
+ resolve2(config.defaultValue);
17088
17091
  } else {
17089
17092
  reject(new EmptyError_1.EmptyError());
17090
17093
  }
@@ -22876,14 +22879,14 @@ var require_run_async = __commonJS({
22876
22879
  return function() {
22877
22880
  var args = arguments;
22878
22881
  var originalThis = this;
22879
- var promise = new Promise(function(resolve, reject) {
22882
+ var promise = new Promise(function(resolve2, reject) {
22880
22883
  var resolved = false;
22881
22884
  const wrappedResolve = function(value) {
22882
22885
  if (resolved) {
22883
22886
  console.warn("Run-async promise already resolved.");
22884
22887
  }
22885
22888
  resolved = true;
22886
- resolve(value);
22889
+ resolve2(value);
22887
22890
  };
22888
22891
  var rejected = false;
22889
22892
  const wrappedReject = function(value) {
@@ -22969,6 +22972,383 @@ var require_run_async = __commonJS({
22969
22972
  }
22970
22973
  });
22971
22974
 
22975
+ // src/cli/portal-upload.ts
22976
+ var portal_upload_exports = {};
22977
+ __export(portal_upload_exports, {
22978
+ parsePortalUploadArgs: () => parsePortalUploadArgs,
22979
+ portalUploadMain: () => portalUploadMain
22980
+ });
22981
+ function getMimeType(path3) {
22982
+ return MIME_TYPES[(0, import_path.extname)(path3).toLowerCase()] || "application/octet-stream";
22983
+ }
22984
+ function parsePortalUploadArgs(args) {
22985
+ const result = {
22986
+ dist: "./dist",
22987
+ component: "auth",
22988
+ prod: false,
22989
+ build: false,
22990
+ concurrency: 5,
22991
+ help: false
22992
+ };
22993
+ for (let i = 0; i < args.length; i++) {
22994
+ const arg = args[i];
22995
+ if (arg === "--help" || arg === "-h") {
22996
+ result.help = true;
22997
+ } else if (arg === "--dist" || arg === "-d") {
22998
+ result.dist = args[++i] || result.dist;
22999
+ } else if (arg === "--component" || arg === "-c") {
23000
+ result.component = args[++i] || result.component;
23001
+ } else if (arg === "--prod") {
23002
+ result.prod = true;
23003
+ } else if (arg === "--no-prod" || arg === "--dev") {
23004
+ result.prod = false;
23005
+ } else if (arg === "--build" || arg === "-b") {
23006
+ result.build = true;
23007
+ } else if (arg === "--concurrency" || arg === "-j") {
23008
+ const val = parseInt(args[++i], 10);
23009
+ if (val > 0) result.concurrency = val;
23010
+ }
23011
+ }
23012
+ return result;
23013
+ }
23014
+ function showHelp() {
23015
+ console.log(`
23016
+ Usage: npx @robelest/convex-auth portal upload [options]
23017
+
23018
+ Upload portal static files to Convex storage.
23019
+
23020
+ Options:
23021
+ -d, --dist <path> Path to dist directory (default: ./dist)
23022
+ -c, --component <name> Convex module with portal functions (default: auth)
23023
+ --prod Deploy to production deployment
23024
+ -b, --build Run 'npm run build' before uploading
23025
+ -j, --concurrency <n> Number of parallel uploads (default: 5)
23026
+ -h, --help Show this help message
23027
+
23028
+ Examples:
23029
+ npx @robelest/convex-auth portal upload
23030
+ npx @robelest/convex-auth portal upload --dist packages/portal/build --prod
23031
+ npx @robelest/convex-auth portal upload --build --prod
23032
+ `);
23033
+ }
23034
+ function convexRunAsync(functionPath, args = {}) {
23035
+ return new Promise((resolve2, reject) => {
23036
+ const cmdArgs = [
23037
+ "convex",
23038
+ "run",
23039
+ functionPath,
23040
+ JSON.stringify(args),
23041
+ "--typecheck=disable",
23042
+ "--codegen=disable"
23043
+ ];
23044
+ if (useProd) cmdArgs.push("--prod");
23045
+ (0, import_child_process2.execFile)("npx", cmdArgs, { encoding: "utf-8" }, (error, stdout, stderr) => {
23046
+ if (error) {
23047
+ console.error("Convex run failed:", stderr || stdout);
23048
+ reject(error);
23049
+ return;
23050
+ }
23051
+ resolve2(stdout.trim());
23052
+ });
23053
+ });
23054
+ }
23055
+ function runHosting(componentName, action, extraArgs = {}) {
23056
+ return convexRunAsync(`${componentName}:portalInternal`, {
23057
+ action,
23058
+ ...extraArgs
23059
+ });
23060
+ }
23061
+ async function uploadSingleFile(file, componentName, deploymentId) {
23062
+ const content = (0, import_fs2.readFileSync)(file.localPath);
23063
+ const uploadUrlOutput = await runHosting(componentName, "generateUploadUrl");
23064
+ const uploadUrl = JSON.parse(uploadUrlOutput);
23065
+ const response = await fetch(uploadUrl, {
23066
+ method: "POST",
23067
+ headers: { "Content-Type": file.contentType },
23068
+ body: content
23069
+ });
23070
+ const { storageId } = await response.json();
23071
+ await runHosting(componentName, "recordAsset", {
23072
+ path: file.path,
23073
+ storageId,
23074
+ contentType: file.contentType,
23075
+ deploymentId
23076
+ });
23077
+ return { path: file.path };
23078
+ }
23079
+ async function uploadWithConcurrency(files, componentName, deploymentId, concurrency) {
23080
+ const total = files.length;
23081
+ let completed = 0;
23082
+ let failed = false;
23083
+ const pending = /* @__PURE__ */ new Set();
23084
+ const iterator = files[Symbol.iterator]();
23085
+ function enqueue() {
23086
+ if (failed) return;
23087
+ const next = iterator.next();
23088
+ if (next.done) return;
23089
+ const file = next.value;
23090
+ const task = uploadSingleFile(file, componentName, deploymentId).then(
23091
+ ({ path: path3 }) => {
23092
+ completed++;
23093
+ console.log(` [${completed}/${total}] ${path3}`);
23094
+ pending.delete(task);
23095
+ }
23096
+ );
23097
+ task.catch(() => {
23098
+ failed = true;
23099
+ });
23100
+ pending.add(task);
23101
+ return task;
23102
+ }
23103
+ for (let i = 0; i < concurrency && i < total; i++) {
23104
+ void enqueue();
23105
+ }
23106
+ while (pending.size > 0) {
23107
+ await Promise.race(pending);
23108
+ if (failed) {
23109
+ await Promise.allSettled(pending);
23110
+ throw new Error("Upload failed");
23111
+ }
23112
+ void enqueue();
23113
+ }
23114
+ }
23115
+ function collectFiles(dir, baseDir) {
23116
+ const files = [];
23117
+ for (const entry of (0, import_fs2.readdirSync)(dir, { withFileTypes: true })) {
23118
+ const fullPath = (0, import_path.join)(dir, entry.name);
23119
+ if (entry.isDirectory()) {
23120
+ files.push(...collectFiles(fullPath, baseDir));
23121
+ } else if (entry.isFile()) {
23122
+ files.push({
23123
+ path: "/" + (0, import_path.relative)(baseDir, fullPath).replace(/\\/g, "/"),
23124
+ localPath: fullPath,
23125
+ contentType: getMimeType(fullPath)
23126
+ });
23127
+ }
23128
+ }
23129
+ return files;
23130
+ }
23131
+ function getConvexSiteUrl(prod) {
23132
+ try {
23133
+ const envFlag = prod ? "--prod" : "";
23134
+ const result = (0, import_child_process2.execSync)(`npx convex env get CONVEX_CLOUD_URL ${envFlag}`, {
23135
+ stdio: "pipe",
23136
+ encoding: "utf-8"
23137
+ });
23138
+ const cloudUrl = result.trim();
23139
+ if (cloudUrl && cloudUrl.includes(".convex.cloud")) {
23140
+ return cloudUrl.replace(".convex.cloud", ".convex.site");
23141
+ }
23142
+ } catch {
23143
+ }
23144
+ return null;
23145
+ }
23146
+ async function portalUploadMain(rawArgs) {
23147
+ const args = parsePortalUploadArgs(rawArgs);
23148
+ if (args.help) {
23149
+ showHelp();
23150
+ process.exit(0);
23151
+ }
23152
+ useProd = args.prod;
23153
+ if (args.build) {
23154
+ let convexUrl = null;
23155
+ if (useProd) {
23156
+ try {
23157
+ const result = (0, import_child_process2.execSync)("npx convex dashboard --prod --no-open", {
23158
+ stdio: "pipe",
23159
+ encoding: "utf-8"
23160
+ });
23161
+ const match = result.match(/dashboard\.convex\.dev\/d\/([a-z0-9-]+)/i);
23162
+ if (match) {
23163
+ convexUrl = `https://${match[1]}.convex.cloud`;
23164
+ }
23165
+ } catch {
23166
+ console.error("Could not get production Convex URL.");
23167
+ console.error(
23168
+ "Make sure you have deployed to production: npx convex deploy"
23169
+ );
23170
+ process.exit(1);
23171
+ }
23172
+ } else {
23173
+ if ((0, import_fs2.existsSync)(".env.local")) {
23174
+ const envContent = (0, import_fs2.readFileSync)(".env.local", "utf-8");
23175
+ const match = envContent.match(/(?:VITE_)?CONVEX_URL=(.+)/);
23176
+ if (match) {
23177
+ convexUrl = match[1].trim();
23178
+ }
23179
+ }
23180
+ }
23181
+ if (!convexUrl) {
23182
+ console.error("Could not determine Convex URL for build.");
23183
+ process.exit(1);
23184
+ }
23185
+ const envLabel2 = useProd ? "production" : "development";
23186
+ console.log(`Building for ${envLabel2}...`);
23187
+ console.log(` VITE_CONVEX_URL=${convexUrl}`);
23188
+ console.log("");
23189
+ const buildResult = (0, import_child_process2.spawnSync)("npm", ["run", "build"], {
23190
+ stdio: "inherit",
23191
+ env: { ...process.env, VITE_CONVEX_URL: convexUrl }
23192
+ });
23193
+ if (buildResult.status !== 0) {
23194
+ console.error("Build failed.");
23195
+ process.exit(1);
23196
+ }
23197
+ console.log("");
23198
+ }
23199
+ const distDir = (0, import_path.resolve)(args.dist);
23200
+ const componentName = args.component;
23201
+ if (!(0, import_fs2.existsSync)(distDir)) {
23202
+ console.error(`Error: dist directory not found: ${distDir}`);
23203
+ console.error(
23204
+ "Run your build command first (e.g., 'bun run build:portal' or add --build flag)"
23205
+ );
23206
+ process.exit(1);
23207
+ }
23208
+ const deploymentId = (0, import_crypto.randomUUID)();
23209
+ const files = collectFiles(distDir, distDir);
23210
+ const envLabel = useProd ? "production" : "development";
23211
+ console.log(`Deploying portal to ${envLabel} environment`);
23212
+ console.log(
23213
+ `Uploading ${files.length} files with deployment ID: ${deploymentId}`
23214
+ );
23215
+ console.log(`Component: ${componentName}`);
23216
+ console.log("");
23217
+ try {
23218
+ await uploadWithConcurrency(
23219
+ files,
23220
+ componentName,
23221
+ deploymentId,
23222
+ args.concurrency
23223
+ );
23224
+ } catch {
23225
+ console.error("Upload failed.");
23226
+ process.exit(1);
23227
+ }
23228
+ console.log("");
23229
+ const gcOutput = await runHosting(componentName, "gcOldAssets", {
23230
+ currentDeploymentId: deploymentId
23231
+ });
23232
+ const gcResult = JSON.parse(gcOutput);
23233
+ const deletedCount = typeof gcResult === "number" ? gcResult : gcResult.deleted;
23234
+ if (deletedCount > 0) {
23235
+ console.log(
23236
+ `Cleaned up ${deletedCount} old storage file(s) from previous deployments`
23237
+ );
23238
+ }
23239
+ console.log("");
23240
+ console.log("Upload complete!");
23241
+ const deployedSiteUrl = getConvexSiteUrl(useProd);
23242
+ if (deployedSiteUrl) {
23243
+ console.log("");
23244
+ console.log(`Portal available at: ${deployedSiteUrl}/auth`);
23245
+ }
23246
+ }
23247
+ var import_fs2, import_path, import_crypto, import_child_process2, MIME_TYPES, useProd;
23248
+ var init_portal_upload = __esm({
23249
+ "src/cli/portal-upload.ts"() {
23250
+ "use strict";
23251
+ import_fs2 = require("fs");
23252
+ import_path = require("path");
23253
+ import_crypto = require("crypto");
23254
+ import_child_process2 = require("child_process");
23255
+ MIME_TYPES = {
23256
+ ".html": "text/html; charset=utf-8",
23257
+ ".js": "application/javascript; charset=utf-8",
23258
+ ".mjs": "application/javascript; charset=utf-8",
23259
+ ".css": "text/css; charset=utf-8",
23260
+ ".json": "application/json; charset=utf-8",
23261
+ ".png": "image/png",
23262
+ ".jpg": "image/jpeg",
23263
+ ".jpeg": "image/jpeg",
23264
+ ".gif": "image/gif",
23265
+ ".svg": "image/svg+xml",
23266
+ ".ico": "image/x-icon",
23267
+ ".webp": "image/webp",
23268
+ ".woff": "font/woff",
23269
+ ".woff2": "font/woff2",
23270
+ ".ttf": "font/ttf",
23271
+ ".txt": "text/plain; charset=utf-8",
23272
+ ".map": "application/json",
23273
+ ".webmanifest": "application/manifest+json",
23274
+ ".xml": "application/xml"
23275
+ };
23276
+ useProd = true;
23277
+ }
23278
+ });
23279
+
23280
+ // src/cli/portal-link.ts
23281
+ var portal_link_exports = {};
23282
+ __export(portal_link_exports, {
23283
+ portalLinkMain: () => portalLinkMain
23284
+ });
23285
+ function convexRunAsync2(functionPath, args = {}) {
23286
+ return new Promise((resolve2, reject) => {
23287
+ const cmdArgs = [
23288
+ "convex",
23289
+ "run",
23290
+ functionPath,
23291
+ JSON.stringify(args),
23292
+ "--typecheck=disable",
23293
+ "--codegen=disable"
23294
+ ];
23295
+ if (useProd2) cmdArgs.push("--prod");
23296
+ (0, import_child_process3.execFile)("npx", cmdArgs, { encoding: "utf-8" }, (error, stdout, stderr) => {
23297
+ if (error) {
23298
+ console.error("Convex run failed:", stderr || stdout);
23299
+ reject(error);
23300
+ return;
23301
+ }
23302
+ resolve2(stdout.trim());
23303
+ });
23304
+ });
23305
+ }
23306
+ function generateToken() {
23307
+ return (0, import_crypto2.randomBytes)(32).toString("base64url");
23308
+ }
23309
+ function hashToken(token) {
23310
+ return (0, import_crypto2.createHash)("sha256").update(token).digest("hex");
23311
+ }
23312
+ async function portalLinkMain(opts) {
23313
+ useProd2 = opts.prod;
23314
+ const component = opts.component;
23315
+ const token = generateToken();
23316
+ const tokenHash = hashToken(token);
23317
+ console.log("Creating portal admin invite...");
23318
+ let portalUrl;
23319
+ try {
23320
+ const raw = await convexRunAsync2(`${component}:portalInternal`, {
23321
+ action: "createPortalInvite",
23322
+ tokenHash
23323
+ });
23324
+ const result = JSON.parse(raw);
23325
+ portalUrl = result.portalUrl;
23326
+ } catch {
23327
+ console.error(
23328
+ "\nFailed to create invite. Make sure your Convex deployment is running",
23329
+ "and the portal module is configured in your convex/ directory."
23330
+ );
23331
+ process.exit(1);
23332
+ }
23333
+ const inviteUrl = `${portalUrl}?invite=${token}`;
23334
+ console.log("\nPortal admin invite created!\n");
23335
+ console.log(` ${inviteUrl}
23336
+ `);
23337
+ console.log("This invite is single-use. Share it securely.");
23338
+ if (useProd2) {
23339
+ console.log("(Using production deployment)");
23340
+ }
23341
+ }
23342
+ var import_crypto2, import_child_process3, useProd2;
23343
+ var init_portal_link = __esm({
23344
+ "src/cli/portal-link.ts"() {
23345
+ "use strict";
23346
+ import_crypto2 = require("crypto");
23347
+ import_child_process3 = require("child_process");
23348
+ useProd2 = false;
23349
+ }
23350
+ });
23351
+
22972
23352
  // src/cli/index.ts
22973
23353
  var index_exports = {};
22974
23354
  __export(index_exports, {
@@ -23491,9 +23871,9 @@ var chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 });
23491
23871
  var source_default = chalk;
23492
23872
 
23493
23873
  // src/cli/index.ts
23494
- var import_child_process2 = require("child_process");
23874
+ var import_child_process4 = require("child_process");
23495
23875
  var import_dotenv = __toESM(require_main(), 1);
23496
- var import_fs2 = require("fs");
23876
+ var import_fs3 = require("fs");
23497
23877
 
23498
23878
  // ../../node_modules/.bun/@inquirer+core@11.1.1+8edf6063c4b37a0a/node_modules/@inquirer/core/dist/lib/key.js
23499
23879
  var isUpKey = (key, keybindings = []) => (
@@ -24961,13 +25341,13 @@ var PromisePolyfill = class extends Promise {
24961
25341
  // Available starting from Node 22
24962
25342
  // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/withResolvers
24963
25343
  static withResolver() {
24964
- let resolve;
25344
+ let resolve2;
24965
25345
  let reject;
24966
25346
  const promise = new Promise((res, rej) => {
24967
- resolve = res;
25347
+ resolve2 = res;
24968
25348
  reject = rej;
24969
25349
  });
24970
- return { promise, resolve, reject };
25350
+ return { promise, resolve: resolve2, reject };
24971
25351
  }
24972
25352
  };
24973
25353
 
@@ -25001,7 +25381,7 @@ function createPrompt(view) {
25001
25381
  output
25002
25382
  });
25003
25383
  const screen = new ScreenManager(rl);
25004
- const { promise, resolve, reject } = PromisePolyfill.withResolver();
25384
+ const { promise, resolve: resolve2, reject } = PromisePolyfill.withResolver();
25005
25385
  const cancel = () => reject(new CancelPromptError());
25006
25386
  if (signal) {
25007
25387
  const abort = () => reject(new AbortPromptError({ cause: signal.reason }));
@@ -25028,7 +25408,7 @@ function createPrompt(view) {
25028
25408
  cycle(() => {
25029
25409
  try {
25030
25410
  const nextView = view(config, (value) => {
25031
- setImmediate(() => resolve(value));
25411
+ setImmediate(() => resolve2(value));
25032
25412
  });
25033
25413
  if (nextView === void 0) {
25034
25414
  const callerFilename = callSites[1]?.getFileName();
@@ -26467,7 +26847,7 @@ var PromptsRunner = class {
26467
26847
  throw new Error(`Prompt for type ${question.type} not found`);
26468
26848
  }
26469
26849
  let cleanupSignal;
26470
- const promptFn = isPromptConstructor(prompt2) ? (q, opt) => new Promise((resolve, reject) => {
26850
+ const promptFn = isPromptConstructor(prompt2) ? (q, opt) => new Promise((resolve2, reject) => {
26471
26851
  const { signal: signal2 } = opt;
26472
26852
  if (signal2.aborted) {
26473
26853
  reject(new AbortPromptError({ cause: signal2.reason }));
@@ -26504,7 +26884,7 @@ var PromptsRunner = class {
26504
26884
  signal2.removeEventListener("abort", abort);
26505
26885
  cleanupSignal = void 0;
26506
26886
  };
26507
- activePrompt.run().then(resolve, reject).finally(cleanup);
26887
+ activePrompt.run().then(resolve2, reject).finally(cleanup);
26508
26888
  }) : prompt2;
26509
26889
  let cleanupModuleSignal;
26510
26890
  const { signal: moduleSignal } = this.opt;
@@ -26595,7 +26975,7 @@ var inquirer = {
26595
26975
  var dist_default12 = inquirer;
26596
26976
 
26597
26977
  // src/cli/index.ts
26598
- var import_path = __toESM(require("path"), 1);
26978
+ var import_path2 = __toESM(require("path"), 1);
26599
26979
 
26600
26980
  // ../../node_modules/.bun/valibot@1.2.0+1fb4c65d43e298b9/node_modules/valibot/dist/index.mjs
26601
26981
  var store$4;
@@ -27138,9 +27518,28 @@ async function generateKeys() {
27138
27518
  }
27139
27519
 
27140
27520
  // src/cli/index.ts
27141
- new Command().name("@robelest/convex-auth").description(
27521
+ var program2 = new Command().name("@robelest/convex-auth").description(
27142
27522
  "Add code and set environment variables for @robelest/convex-auth.\n\nFull docs: https://deepwiki.com/robelest/convex-auth"
27143
- ).option(
27523
+ );
27524
+ var portalCmd = program2.command("portal").description("Manage the auth admin portal");
27525
+ portalCmd.command("upload").description("Upload portal static files to Convex storage").allowUnknownOption(true).allowExcessArguments(true).action(async () => {
27526
+ const idx = process.argv.indexOf("upload");
27527
+ const uploadArgs = idx >= 0 ? process.argv.slice(idx + 1) : [];
27528
+ const { portalUploadMain: portalUploadMain2 } = await Promise.resolve().then(() => (init_portal_upload(), portal_upload_exports));
27529
+ await portalUploadMain2(uploadArgs);
27530
+ });
27531
+ portalCmd.command("link").description("Generate an admin invite link for the portal").option("--prod", "Use production deployment").option(
27532
+ "--component <name>",
27533
+ "Convex module with portal functions",
27534
+ "auth"
27535
+ ).action(async (opts) => {
27536
+ const { portalLinkMain: portalLinkMain2 } = await Promise.resolve().then(() => (init_portal_link(), portal_link_exports));
27537
+ await portalLinkMain2({
27538
+ prod: opts.prod ?? false,
27539
+ component: opts.component
27540
+ });
27541
+ });
27542
+ program2.option(
27144
27543
  "--site-url <url>",
27145
27544
  "Your frontend app URL (e.g. 'http://localhost:5173' for dev, 'https://myapp.com' for prod)"
27146
27545
  ).option(
@@ -27178,7 +27577,8 @@ new Command().name("@robelest/convex-auth").description(
27178
27577
  } else {
27179
27578
  printFinalSuccessMessage(config);
27180
27579
  }
27181
- }).parse(process.argv);
27580
+ });
27581
+ program2.parse(process.argv);
27182
27582
  async function configureSiteUrl(config, forcedValue) {
27183
27583
  logStep(config, "Configure SITE_URL");
27184
27584
  if (config.isExpo) {
@@ -27241,13 +27641,13 @@ async function configureKeys(config) {
27241
27641
  await setEnvVar(config, "JWKS", JWKS, { hideValue: true });
27242
27642
  }
27243
27643
  async function backendEnvVar(config, name) {
27244
- return (0, import_child_process2.execSync)(`npx convex env get ${deploymentOptions(config)} ${name}`, {
27644
+ return (0, import_child_process4.execSync)(`npx convex env get ${deploymentOptions(config)} ${name}`, {
27245
27645
  stdio: "pipe"
27246
27646
  }).toString().slice(0, -1);
27247
27647
  }
27248
27648
  async function setEnvVar(config, name, value, options) {
27249
27649
  const valueEscaped = value.replace(/"/g, '\\"');
27250
- (0, import_child_process2.execSync)(
27650
+ (0, import_child_process4.execSync)(
27251
27651
  `npx convex env set ${deploymentOptions(config)} -- ${name} "${valueEscaped}"`,
27252
27652
  {
27253
27653
  stdio: options?.hideValue ? "ignore" : "inherit"
@@ -27320,11 +27720,11 @@ var validTsConfig = `{
27320
27720
  async function modifyTsConfig(config) {
27321
27721
  logStep(config, "Modify tsconfig file");
27322
27722
  const projectLevelTsConfigPath = "tsconfig.json";
27323
- const tsConfigPath = import_path.default.join(config.convexFolderPath, "tsconfig.json");
27324
- if (!(0, import_fs2.existsSync)(tsConfigPath)) {
27325
- if ((0, import_fs2.existsSync)(projectLevelTsConfigPath)) {
27723
+ const tsConfigPath = import_path2.default.join(config.convexFolderPath, "tsconfig.json");
27724
+ if (!(0, import_fs3.existsSync)(tsConfigPath)) {
27725
+ if ((0, import_fs3.existsSync)(projectLevelTsConfigPath)) {
27326
27726
  if (config.isExpo) {
27327
- (0, import_fs2.writeFileSync)(tsConfigPath, validTsConfig);
27727
+ (0, import_fs3.writeFileSync)(tsConfigPath, validTsConfig);
27328
27728
  logSuccess(`Added ${source_default.bold(tsConfigPath)}`);
27329
27729
  return;
27330
27730
  }
@@ -27332,7 +27732,7 @@ async function modifyTsConfig(config) {
27332
27732
  logInfo(`No ${source_default.bold(tsConfigPath)} found. Skipping.`);
27333
27733
  return;
27334
27734
  }
27335
- const existingTsConfig = (0, import_fs2.readFileSync)(tsConfigPath, "utf8");
27735
+ const existingTsConfig = (0, import_fs3.readFileSync)(tsConfigPath, "utf8");
27336
27736
  const moduleResolutionPattern = /"moduleResolution"\s*:\s*"(\w+)"/;
27337
27737
  const [, existingModuleResolution] = existingTsConfig.match(moduleResolutionPattern) ?? [];
27338
27738
  const skipLibCheckPattern = /"skipLibCheck"\s*:\s*(\w+)/;
@@ -27368,7 +27768,7 @@ ${source}
27368
27768
  skipLibCheckPattern,
27369
27769
  '"skipLibCheck": true'
27370
27770
  );
27371
- (0, import_fs2.writeFileSync)(tsConfigPath, changedTsConfig);
27771
+ (0, import_fs3.writeFileSync)(tsConfigPath, changedTsConfig);
27372
27772
  logSuccess(`Modified ${source_default.bold(tsConfigPath)}`);
27373
27773
  }
27374
27774
  function addCompilerOption(tsconfig, existingValue, pattern, optionAndValue) {
@@ -27390,10 +27790,10 @@ app.use(auth);
27390
27790
  export default app;
27391
27791
  `;
27392
27792
  const source = templateToSource(sourceTemplate);
27393
- const convexConfigPath = import_path.default.join(config.convexFolderPath, "convex.config");
27793
+ const convexConfigPath = import_path2.default.join(config.convexFolderPath, "convex.config");
27394
27794
  const existingConfigPath = await existingNonEmptySourcePath(convexConfigPath);
27395
27795
  if (existingConfigPath !== null) {
27396
- const existingConfig = (0, import_fs2.readFileSync)(existingConfigPath, "utf8");
27796
+ const existingConfig = (0, import_fs3.readFileSync)(existingConfigPath, "utf8");
27397
27797
  if (doesAlreadyMatchTemplate(existingConfig, sourceTemplate)) {
27398
27798
  logSuccess(`The ${source_default.bold(existingConfigPath)} is already set up.`);
27399
27799
  } else {
@@ -27407,25 +27807,28 @@ ${source}
27407
27807
  }
27408
27808
  } else {
27409
27809
  const newConfigPath = config.usesTypeScript ? `${convexConfigPath}.ts` : `${convexConfigPath}.js`;
27410
- (0, import_fs2.writeFileSync)(newConfigPath, source);
27810
+ (0, import_fs3.writeFileSync)(newConfigPath, source);
27411
27811
  logSuccess(`Created ${source_default.bold(newConfigPath)}`);
27412
27812
  }
27413
27813
  }
27414
27814
  async function initializeAuth(config) {
27415
27815
  logStep(config, "Initialize auth file");
27416
- const sourceTemplate = `import { Auth } from "@robelest/convex-auth/component";
27816
+ const sourceTemplate = `import { Auth, Portal } from "@robelest/convex-auth/component";
27417
27817
  import { components } from "./_generated/api";
27418
27818
 
27419
- export const { auth, signIn, signOut, store } = Auth({$$
27420
- component: components.auth,$$
27819
+ const auth = new Auth(components.auth, {$$
27421
27820
  providers: [$$],$$
27422
27821
  });
27822
+
27823
+ export { auth };
27824
+ export const { signIn, signOut, store } = auth;
27825
+ export const { portalQuery, portalMutation, portalInternal } = Portal(auth);
27423
27826
  `;
27424
27827
  const source = templateToSource(sourceTemplate);
27425
- const authPath = import_path.default.join(config.convexFolderPath, "auth");
27828
+ const authPath = import_path2.default.join(config.convexFolderPath, "auth");
27426
27829
  const existingAuthPath = await existingNonEmptySourcePath(authPath);
27427
27830
  if (existingAuthPath !== null) {
27428
- const existingAuth = (0, import_fs2.readFileSync)(existingAuthPath, "utf8");
27831
+ const existingAuth = (0, import_fs3.readFileSync)(existingAuthPath, "utf8");
27429
27832
  if (doesAlreadyMatchTemplate(existingAuth, sourceTemplate)) {
27430
27833
  logSuccess(`The ${source_default.bold(existingAuthPath)} is already set up.`);
27431
27834
  } else {
@@ -27439,7 +27842,7 @@ ${source}
27439
27842
  }
27440
27843
  } else {
27441
27844
  const newAuthPath = config.usesTypeScript ? `${authPath}.ts` : `${authPath}.js`;
27442
- (0, import_fs2.writeFileSync)(newAuthPath, source);
27845
+ (0, import_fs3.writeFileSync)(newAuthPath, source);
27443
27846
  logSuccess(`Created ${source_default.bold(newAuthPath)}`);
27444
27847
  }
27445
27848
  }
@@ -27455,10 +27858,10 @@ auth.addHttpRoutes(http);
27455
27858
  export default http;
27456
27859
  `;
27457
27860
  const source = templateToSource(sourceTemplate);
27458
- const httpPath = import_path.default.join(config.convexFolderPath, "http");
27861
+ const httpPath = import_path2.default.join(config.convexFolderPath, "http");
27459
27862
  const existingHttpPath = await existingNonEmptySourcePath(httpPath);
27460
27863
  if (existingHttpPath !== null) {
27461
- const existingHttp = (0, import_fs2.readFileSync)(existingHttpPath, "utf8");
27864
+ const existingHttp = (0, import_fs3.readFileSync)(existingHttpPath, "utf8");
27462
27865
  if (doesAlreadyMatchTemplate(existingHttp, sourceTemplate)) {
27463
27866
  logSuccess(`The ${source_default.bold(existingHttpPath)} is already set up.`);
27464
27867
  } else {
@@ -27472,7 +27875,7 @@ ${source}
27472
27875
  }
27473
27876
  } else {
27474
27877
  const newHttpPath = config.usesTypeScript ? `${httpPath}.ts` : `${httpPath}.js`;
27475
- (0, import_fs2.writeFileSync)(newHttpPath, source);
27878
+ (0, import_fs3.writeFileSync)(newHttpPath, source);
27476
27879
  logSuccess(`Created ${source_default.bold(newHttpPath)}`);
27477
27880
  }
27478
27881
  }
@@ -27532,7 +27935,7 @@ async function existingNonEmptySourcePath(path3) {
27532
27935
  return await existsAndNotEmpty(`${path3}.ts`) ? `${path3}.ts` : await existsAndNotEmpty(`${path3}.js`) ? `${path3}.js` : null;
27533
27936
  }
27534
27937
  async function existsAndNotEmpty(path3) {
27535
- return (0, import_fs2.existsSync)(path3) && (0, import_fs2.readFileSync)(path3, "utf8").trim() !== "";
27938
+ return (0, import_fs3.existsSync)(path3) && (0, import_fs3.readFileSync)(path3, "utf8").trim() !== "";
27536
27939
  }
27537
27940
  function logStep(config, message2) {
27538
27941
  if (config.step > 1) {
@@ -27544,9 +27947,9 @@ async function checkSourceControl(options) {
27544
27947
  if (options.allowDirtyGitState) {
27545
27948
  return;
27546
27949
  }
27547
- const isGit = (0, import_fs2.existsSync)(".git");
27950
+ const isGit = (0, import_fs3.existsSync)(".git");
27548
27951
  if (isGit) {
27549
- const gitStatus = (0, import_child_process2.execSync)("git status --porcelain").toString();
27952
+ const gitStatus = (0, import_child_process4.execSync)("git status --porcelain").toString();
27550
27953
  const changedFiles = gitStatus.split("\n").filter(
27551
27954
  (line) => !/\bpackage(-lock)?.json/.test(line) && line.length > 0
27552
27955
  );
@@ -27568,7 +27971,7 @@ async function checkSourceControl(options) {
27568
27971
  }
27569
27972
  function readPackageJson() {
27570
27973
  try {
27571
- const data = (0, import_fs2.readFileSync)("package.json", "utf8");
27974
+ const data = (0, import_fs3.readFileSync)("package.json", "utf8");
27572
27975
  return JSON.parse(data);
27573
27976
  } catch (error) {
27574
27977
  logErrorAndExit(
@@ -27578,11 +27981,11 @@ function readPackageJson() {
27578
27981
  }
27579
27982
  }
27580
27983
  function readConvexJson() {
27581
- if (!(0, import_fs2.existsSync)("convex.json")) {
27984
+ if (!(0, import_fs3.existsSync)("convex.json")) {
27582
27985
  return {};
27583
27986
  }
27584
27987
  try {
27585
- const data = (0, import_fs2.readFileSync)("convex.json", "utf8");
27988
+ const data = (0, import_fs3.readFileSync)("convex.json", "utf8");
27586
27989
  return JSON.parse(data);
27587
27990
  } catch (error) {
27588
27991
  logErrorAndExit(