@alinsafawi/aegis-auth 0.2.1 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +173 -212
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -2126,20 +2126,20 @@ var require_range = __commonJS({
2126
2126
  };
2127
2127
  var replaceTilde = (comp, options) => {
2128
2128
  const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
2129
- return comp.replace(r, (_, M, m, p10, pr) => {
2130
- debug("tilde", comp, _, M, m, p10, pr);
2129
+ return comp.replace(r, (_, M, m, p9, pr) => {
2130
+ debug("tilde", comp, _, M, m, p9, pr);
2131
2131
  let ret;
2132
2132
  if (isX(M)) {
2133
2133
  ret = "";
2134
2134
  } else if (isX(m)) {
2135
2135
  ret = `>=${M}.0.0 <${+M + 1}.0.0-0`;
2136
- } else if (isX(p10)) {
2136
+ } else if (isX(p9)) {
2137
2137
  ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`;
2138
2138
  } else if (pr) {
2139
2139
  debug("replaceTilde pr", pr);
2140
- ret = `>=${M}.${m}.${p10}-${pr} <${M}.${+m + 1}.0-0`;
2140
+ ret = `>=${M}.${m}.${p9}-${pr} <${M}.${+m + 1}.0-0`;
2141
2141
  } else {
2142
- ret = `>=${M}.${m}.${p10} <${M}.${+m + 1}.0-0`;
2142
+ ret = `>=${M}.${m}.${p9} <${M}.${+m + 1}.0-0`;
2143
2143
  }
2144
2144
  debug("tilde return", ret);
2145
2145
  return ret;
@@ -2152,14 +2152,14 @@ var require_range = __commonJS({
2152
2152
  debug("caret", comp, options);
2153
2153
  const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
2154
2154
  const z3 = options.includePrerelease ? "-0" : "";
2155
- return comp.replace(r, (_, M, m, p10, pr) => {
2156
- debug("caret", comp, _, M, m, p10, pr);
2155
+ return comp.replace(r, (_, M, m, p9, pr) => {
2156
+ debug("caret", comp, _, M, m, p9, pr);
2157
2157
  let ret;
2158
2158
  if (isX(M)) {
2159
2159
  ret = "";
2160
2160
  } else if (isX(m)) {
2161
2161
  ret = `>=${M}.0.0${z3} <${+M + 1}.0.0-0`;
2162
- } else if (isX(p10)) {
2162
+ } else if (isX(p9)) {
2163
2163
  if (M === "0") {
2164
2164
  ret = `>=${M}.${m}.0${z3} <${M}.${+m + 1}.0-0`;
2165
2165
  } else {
@@ -2169,23 +2169,23 @@ var require_range = __commonJS({
2169
2169
  debug("replaceCaret pr", pr);
2170
2170
  if (M === "0") {
2171
2171
  if (m === "0") {
2172
- ret = `>=${M}.${m}.${p10}-${pr} <${M}.${m}.${+p10 + 1}-0`;
2172
+ ret = `>=${M}.${m}.${p9}-${pr} <${M}.${m}.${+p9 + 1}-0`;
2173
2173
  } else {
2174
- ret = `>=${M}.${m}.${p10}-${pr} <${M}.${+m + 1}.0-0`;
2174
+ ret = `>=${M}.${m}.${p9}-${pr} <${M}.${+m + 1}.0-0`;
2175
2175
  }
2176
2176
  } else {
2177
- ret = `>=${M}.${m}.${p10}-${pr} <${+M + 1}.0.0-0`;
2177
+ ret = `>=${M}.${m}.${p9}-${pr} <${+M + 1}.0.0-0`;
2178
2178
  }
2179
2179
  } else {
2180
2180
  debug("no pr");
2181
2181
  if (M === "0") {
2182
2182
  if (m === "0") {
2183
- ret = `>=${M}.${m}.${p10}${z3} <${M}.${m}.${+p10 + 1}-0`;
2183
+ ret = `>=${M}.${m}.${p9}${z3} <${M}.${m}.${+p9 + 1}-0`;
2184
2184
  } else {
2185
- ret = `>=${M}.${m}.${p10}${z3} <${M}.${+m + 1}.0-0`;
2185
+ ret = `>=${M}.${m}.${p9}${z3} <${M}.${+m + 1}.0-0`;
2186
2186
  }
2187
2187
  } else {
2188
- ret = `>=${M}.${m}.${p10} <${+M + 1}.0.0-0`;
2188
+ ret = `>=${M}.${m}.${p9} <${+M + 1}.0.0-0`;
2189
2189
  }
2190
2190
  }
2191
2191
  debug("caret return", ret);
@@ -2199,11 +2199,11 @@ var require_range = __commonJS({
2199
2199
  var replaceXRange = (comp, options) => {
2200
2200
  comp = comp.trim();
2201
2201
  const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
2202
- return comp.replace(r, (ret, gtlt, M, m, p10, pr) => {
2203
- debug("xRange", comp, ret, gtlt, M, m, p10, pr);
2202
+ return comp.replace(r, (ret, gtlt, M, m, p9, pr) => {
2203
+ debug("xRange", comp, ret, gtlt, M, m, p9, pr);
2204
2204
  const xM = isX(M);
2205
2205
  const xm = xM || isX(m);
2206
- const xp = xm || isX(p10);
2206
+ const xp = xm || isX(p9);
2207
2207
  const anyX = xp;
2208
2208
  if (gtlt === "=" && anyX) {
2209
2209
  gtlt = "";
@@ -2219,16 +2219,16 @@ var require_range = __commonJS({
2219
2219
  if (xm) {
2220
2220
  m = 0;
2221
2221
  }
2222
- p10 = 0;
2222
+ p9 = 0;
2223
2223
  if (gtlt === ">") {
2224
2224
  gtlt = ">=";
2225
2225
  if (xm) {
2226
2226
  M = +M + 1;
2227
2227
  m = 0;
2228
- p10 = 0;
2228
+ p9 = 0;
2229
2229
  } else {
2230
2230
  m = +m + 1;
2231
- p10 = 0;
2231
+ p9 = 0;
2232
2232
  }
2233
2233
  } else if (gtlt === "<=") {
2234
2234
  gtlt = "<";
@@ -2241,7 +2241,7 @@ var require_range = __commonJS({
2241
2241
  if (gtlt === "<") {
2242
2242
  pr = "-0";
2243
2243
  }
2244
- ret = `${gtlt + M}.${m}.${p10}${pr}`;
2244
+ ret = `${gtlt + M}.${m}.${p9}${pr}`;
2245
2245
  } else if (xm) {
2246
2246
  ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`;
2247
2247
  } else if (xp) {
@@ -6919,14 +6919,14 @@ var require_mask_pattern = __commonJS({
6919
6919
  const numPatterns = Object.keys(exports2.Patterns).length;
6920
6920
  let bestPattern = 0;
6921
6921
  let lowerPenalty = Infinity;
6922
- for (let p10 = 0; p10 < numPatterns; p10++) {
6923
- setupFormatFunc(p10);
6924
- exports2.applyMask(p10, data);
6922
+ for (let p9 = 0; p9 < numPatterns; p9++) {
6923
+ setupFormatFunc(p9);
6924
+ exports2.applyMask(p9, data);
6925
6925
  const penalty = exports2.getPenaltyN1(data) + exports2.getPenaltyN2(data) + exports2.getPenaltyN3(data) + exports2.getPenaltyN4(data);
6926
- exports2.applyMask(p10, data);
6926
+ exports2.applyMask(p9, data);
6927
6927
  if (penalty < lowerPenalty) {
6928
6928
  lowerPenalty = penalty;
6929
- bestPattern = p10;
6929
+ bestPattern = p9;
6930
6930
  }
6931
6931
  }
6932
6932
  return bestPattern;
@@ -10909,7 +10909,7 @@ var require_browser = __commonJS({
10909
10909
  var QRCode2 = require_qrcode();
10910
10910
  var CanvasRenderer = require_canvas();
10911
10911
  var SvgRenderer = require_svg_tag();
10912
- function renderCanvas(renderFunc, canvas, text8, opts, cb) {
10912
+ function renderCanvas(renderFunc, canvas, text7, opts, cb) {
10913
10913
  const args2 = [].slice.call(arguments, 1);
10914
10914
  const argsNum = args2.length;
10915
10915
  const isLastArgCb = typeof args2[argsNum - 1] === "function";
@@ -10921,8 +10921,8 @@ var require_browser = __commonJS({
10921
10921
  throw new Error("Too few arguments provided");
10922
10922
  }
10923
10923
  if (argsNum === 2) {
10924
- cb = text8;
10925
- text8 = canvas;
10924
+ cb = text7;
10925
+ text7 = canvas;
10926
10926
  canvas = opts = void 0;
10927
10927
  } else if (argsNum === 3) {
10928
10928
  if (canvas.getContext && typeof cb === "undefined") {
@@ -10930,8 +10930,8 @@ var require_browser = __commonJS({
10930
10930
  opts = void 0;
10931
10931
  } else {
10932
10932
  cb = opts;
10933
- opts = text8;
10934
- text8 = canvas;
10933
+ opts = text7;
10934
+ text7 = canvas;
10935
10935
  canvas = void 0;
10936
10936
  }
10937
10937
  }
@@ -10940,16 +10940,16 @@ var require_browser = __commonJS({
10940
10940
  throw new Error("Too few arguments provided");
10941
10941
  }
10942
10942
  if (argsNum === 1) {
10943
- text8 = canvas;
10943
+ text7 = canvas;
10944
10944
  canvas = opts = void 0;
10945
10945
  } else if (argsNum === 2 && !canvas.getContext) {
10946
- opts = text8;
10947
- text8 = canvas;
10946
+ opts = text7;
10947
+ text7 = canvas;
10948
10948
  canvas = void 0;
10949
10949
  }
10950
10950
  return new Promise(function(resolve, reject) {
10951
10951
  try {
10952
- const data = QRCode2.create(text8, opts);
10952
+ const data = QRCode2.create(text7, opts);
10953
10953
  resolve(renderFunc(data, canvas, opts));
10954
10954
  } catch (e) {
10955
10955
  reject(e);
@@ -10957,7 +10957,7 @@ var require_browser = __commonJS({
10957
10957
  });
10958
10958
  }
10959
10959
  try {
10960
- const data = QRCode2.create(text8, opts);
10960
+ const data = QRCode2.create(text7, opts);
10961
10961
  cb(null, renderFunc(data, canvas, opts));
10962
10962
  } catch (e) {
10963
10963
  cb(e);
@@ -10982,8 +10982,8 @@ var require_server = __commonJS({
10982
10982
  var Utf8Renderer = require_utf8();
10983
10983
  var TerminalRenderer = require_terminal2();
10984
10984
  var SvgRenderer = require_svg();
10985
- function checkParams(text8, opts, cb) {
10986
- if (typeof text8 === "undefined") {
10985
+ function checkParams(text7, opts, cb) {
10986
+ if (typeof text7 === "undefined") {
10987
10987
  throw new Error("String required as first argument");
10988
10988
  }
10989
10989
  if (typeof cb === "undefined") {
@@ -11030,11 +11030,11 @@ var require_server = __commonJS({
11030
11030
  return Utf8Renderer;
11031
11031
  }
11032
11032
  }
11033
- function render(renderFunc, text8, params) {
11033
+ function render(renderFunc, text7, params) {
11034
11034
  if (!params.cb) {
11035
11035
  return new Promise(function(resolve, reject) {
11036
11036
  try {
11037
- const data = QRCode2.create(text8, params.opts);
11037
+ const data = QRCode2.create(text7, params.opts);
11038
11038
  return renderFunc(data, params.opts, function(err, data2) {
11039
11039
  return err ? reject(err) : resolve(data2);
11040
11040
  });
@@ -11044,7 +11044,7 @@ var require_server = __commonJS({
11044
11044
  });
11045
11045
  }
11046
11046
  try {
11047
- const data = QRCode2.create(text8, params.opts);
11047
+ const data = QRCode2.create(text7, params.opts);
11048
11048
  return renderFunc(data, params.opts, params.cb);
11049
11049
  } catch (e) {
11050
11050
  params.cb(e);
@@ -11052,43 +11052,43 @@ var require_server = __commonJS({
11052
11052
  }
11053
11053
  exports2.create = QRCode2.create;
11054
11054
  exports2.toCanvas = require_browser().toCanvas;
11055
- exports2.toString = function toString(text8, opts, cb) {
11056
- const params = checkParams(text8, opts, cb);
11055
+ exports2.toString = function toString(text7, opts, cb) {
11056
+ const params = checkParams(text7, opts, cb);
11057
11057
  const type = params.opts ? params.opts.type : void 0;
11058
11058
  const renderer = getStringRendererFromType(type);
11059
- return render(renderer.render, text8, params);
11059
+ return render(renderer.render, text7, params);
11060
11060
  };
11061
- exports2.toDataURL = function toDataURL(text8, opts, cb) {
11062
- const params = checkParams(text8, opts, cb);
11061
+ exports2.toDataURL = function toDataURL(text7, opts, cb) {
11062
+ const params = checkParams(text7, opts, cb);
11063
11063
  const renderer = getRendererFromType(params.opts.type);
11064
- return render(renderer.renderToDataURL, text8, params);
11064
+ return render(renderer.renderToDataURL, text7, params);
11065
11065
  };
11066
- exports2.toBuffer = function toBuffer(text8, opts, cb) {
11067
- const params = checkParams(text8, opts, cb);
11066
+ exports2.toBuffer = function toBuffer(text7, opts, cb) {
11067
+ const params = checkParams(text7, opts, cb);
11068
11068
  const renderer = getRendererFromType(params.opts.type);
11069
- return render(renderer.renderToBuffer, text8, params);
11069
+ return render(renderer.renderToBuffer, text7, params);
11070
11070
  };
11071
- exports2.toFile = function toFile(path6, text8, opts, cb) {
11072
- if (typeof path6 !== "string" || !(typeof text8 === "string" || typeof text8 === "object")) {
11071
+ exports2.toFile = function toFile(path6, text7, opts, cb) {
11072
+ if (typeof path6 !== "string" || !(typeof text7 === "string" || typeof text7 === "object")) {
11073
11073
  throw new Error("Invalid argument");
11074
11074
  }
11075
11075
  if (arguments.length < 3 && !canPromise()) {
11076
11076
  throw new Error("Too few arguments provided");
11077
11077
  }
11078
- const params = checkParams(text8, opts, cb);
11078
+ const params = checkParams(text7, opts, cb);
11079
11079
  const type = params.opts.type || getTypeFromFilename(path6);
11080
11080
  const renderer = getRendererFromType(type);
11081
11081
  const renderToFile = renderer.renderToFile.bind(null, path6);
11082
- return render(renderToFile, text8, params);
11082
+ return render(renderToFile, text7, params);
11083
11083
  };
11084
- exports2.toFileStream = function toFileStream(stream, text8, opts) {
11084
+ exports2.toFileStream = function toFileStream(stream, text7, opts) {
11085
11085
  if (arguments.length < 2) {
11086
11086
  throw new Error("Too few arguments provided");
11087
11087
  }
11088
- const params = checkParams(text8, opts, stream.emit.bind(stream, "error"));
11088
+ const params = checkParams(text7, opts, stream.emit.bind(stream, "error"));
11089
11089
  const renderer = getRendererFromType("png");
11090
11090
  const renderToFileStream = renderer.renderToFileStream.bind(null, stream);
11091
- render(renderToFileStream, text8, params);
11091
+ render(renderToFileStream, text7, params);
11092
11092
  };
11093
11093
  }
11094
11094
  });
@@ -16697,16 +16697,16 @@ var require_mail_composer = __commonJS({
16697
16697
  * @returns {Array} An array of alternative elements. Includes the `text` and `html` values as well
16698
16698
  */
16699
16699
  getAlternatives() {
16700
- let alternatives = [], text8, html, watchHtml, amp, icalEvent, eventObject;
16700
+ let alternatives = [], text7, html, watchHtml, amp, icalEvent, eventObject;
16701
16701
  if (this.mail.text) {
16702
16702
  if (typeof this.mail.text === "object" && (this.mail.text.content || this.mail.text.path || this.mail.text.href || this.mail.text.raw)) {
16703
- text8 = this.mail.text;
16703
+ text7 = this.mail.text;
16704
16704
  } else {
16705
- text8 = {
16705
+ text7 = {
16706
16706
  content: this.mail.text
16707
16707
  };
16708
16708
  }
16709
- text8.contentType = "text/plain; charset=utf-8";
16709
+ text7.contentType = "text/plain; charset=utf-8";
16710
16710
  }
16711
16711
  if (this.mail.watchHtml) {
16712
16712
  if (typeof this.mail.watchHtml === "object" && (this.mail.watchHtml.content || this.mail.watchHtml.path || this.mail.watchHtml.href || this.mail.watchHtml.raw)) {
@@ -16759,7 +16759,7 @@ var require_mail_composer = __commonJS({
16759
16759
  }
16760
16760
  html.contentType = "text/html; charset=utf-8";
16761
16761
  }
16762
- [].concat(text8 || []).concat(watchHtml || []).concat(amp || []).concat(html || []).concat(eventObject || []).concat(this.mail.alternatives || []).forEach((alternative) => {
16762
+ [].concat(text7 || []).concat(watchHtml || []).concat(amp || []).concat(html || []).concat(eventObject || []).concat(this.mail.alternatives || []).forEach((alternative) => {
16763
16763
  let data;
16764
16764
  if (/^data:/i.test(alternative.path || alternative.href)) {
16765
16765
  alternative = this._processDataUrl(alternative);
@@ -22296,8 +22296,8 @@ var require_nodemailer = __commonJS({
22296
22296
  });
22297
22297
 
22298
22298
  // src/commands/init.ts
22299
- var p7 = __toESM(require("@clack/prompts"));
22300
- var import_chalk8 = __toESM(require("chalk"));
22299
+ var p6 = __toESM(require("@clack/prompts"));
22300
+ var import_chalk7 = __toESM(require("chalk"));
22301
22301
  var import_fs_extra = __toESM(require("fs-extra"));
22302
22302
  var import_path = __toESM(require("path"));
22303
22303
  var import_execa = require("execa");
@@ -22367,10 +22367,10 @@ function printNextSteps(steps) {
22367
22367
  console.log(import_chalk.default.dim(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"));
22368
22368
  console.log();
22369
22369
  for (const step of steps) {
22370
- console.log(` ${import_chalk.default.cyanBright.bold(`${step.n}`)} ${import_chalk.default.bold(step.title)}`);
22370
+ console.log(`\x1B[0m ${import_chalk.default.cyanBright.bold(`${step.n}`)} ${step.title}`);
22371
22371
  console.log();
22372
22372
  for (const line of step.lines) {
22373
- console.log(` ${line}`);
22373
+ console.log(`\x1B[0m ${line}`);
22374
22374
  }
22375
22375
  console.log();
22376
22376
  }
@@ -22933,41 +22933,6 @@ async function promptInfrastructure() {
22933
22933
  };
22934
22934
  }
22935
22935
 
22936
- // src/prompts/style.ts
22937
- var p6 = __toESM(require("@clack/prompts"));
22938
- var import_chalk7 = __toESM(require("chalk"));
22939
- async function promptStyle() {
22940
- console.log(
22941
- `
22942
- ${import_chalk7.default.dim("Used on buttons, links, and focus rings in all scaffolded pages.")}
22943
- ${import_chalk7.default.dim("This becomes a CSS variable \u2014 change it any time in globals.css.")}
22944
- `
22945
- );
22946
- const primaryColor = await p6.text({
22947
- message: "Primary color",
22948
- initialValue: "oklch(0.6 0.2 240)",
22949
- validate: (v) => !v ? "Required" : void 0
22950
- });
22951
- if (p6.isCancel(primaryColor)) process.exit(0);
22952
- console.log(
22953
- `
22954
- ${import_chalk7.default.dim("Accepts any CSS color:")}
22955
- ${import_chalk7.default.dim(" #3b82f6 (hex)")}
22956
- ${import_chalk7.default.dim(" hsl(220 90% 56%) (HSL)")}
22957
- ${import_chalk7.default.dim(" oklch(0.6 0.2 240) (recommended \u2014 perceptually uniform)")}
22958
- `
22959
- );
22960
- const logoUrl = await p6.text({
22961
- message: "Logo path (optional \u2014 leave blank to skip)",
22962
- placeholder: "/logo.svg"
22963
- });
22964
- if (p6.isCancel(logoUrl)) process.exit(0);
22965
- return {
22966
- primaryColor,
22967
- logoUrl: logoUrl || void 0
22968
- };
22969
- }
22970
-
22971
22936
  // ../core/dist/index.js
22972
22937
  var import_zod = require("zod");
22973
22938
  var import_jsonwebtoken = __toESM(require_jsonwebtoken(), 1);
@@ -23342,8 +23307,8 @@ function serializePermissions(role) {
23342
23307
  if (mode === "none") return `'none'`;
23343
23308
  if (mode === "dynamic") return `'dynamic'`;
23344
23309
  const perms = typeof role.permissions === "object" ? role.permissions : {};
23345
- const lines = Object.entries(perms).map(([key, p10]) => {
23346
- const def = p10;
23310
+ const lines = Object.entries(perms).map(([key, p9]) => {
23311
+ const def = p9;
23347
23312
  return [
23348
23313
  ` ${key}: {`,
23349
23314
  ` label: '${def.label}',`,
@@ -23784,6 +23749,8 @@ function generatePackageJson(name, packageManager) {
23784
23749
  }
23785
23750
 
23786
23751
  // src/commands/init.ts
23752
+ var DEFAULT_COLOR = "oklch(0.6 0.2 240)";
23753
+ var DEFAULT_STYLE = { primaryColor: DEFAULT_COLOR, logoUrl: void 0 };
23787
23754
  function detectPackageManager() {
23788
23755
  if (process.env.npm_config_user_agent?.includes("pnpm")) return "pnpm";
23789
23756
  if (process.env.npm_config_user_agent?.includes("yarn")) return "yarn";
@@ -23793,10 +23760,10 @@ function detectPackageManager() {
23793
23760
  function isExistingNextProject(dir) {
23794
23761
  return import_fs_extra.default.existsSync(import_path.default.join(dir, "next.config.ts")) || import_fs_extra.default.existsSync(import_path.default.join(dir, "next.config.js")) || import_fs_extra.default.existsSync(import_path.default.join(dir, "next.config.mjs"));
23795
23762
  }
23796
- var STEPS = ["PROJECT", "APP", "ROLES", "FEATURES", "INFRA", "STYLE"];
23763
+ var STEPS = ["PROJECT", "APP", "ROLES", "FEATURES", "INFRA"];
23797
23764
  async function runInit() {
23798
23765
  printBanner();
23799
- const mode = await p7.select({
23766
+ const mode = await p6.select({
23800
23767
  message: "What would you like to do?",
23801
23768
  options: [
23802
23769
  {
@@ -23811,8 +23778,8 @@ async function runInit() {
23811
23778
  }
23812
23779
  ]
23813
23780
  });
23814
- if (p7.isCancel(mode)) {
23815
- p7.cancel("Cancelled.");
23781
+ if (p6.isCancel(mode)) {
23782
+ p6.cancel("Cancelled.");
23816
23783
  process.exit(0);
23817
23784
  }
23818
23785
  let targetDir = process.cwd();
@@ -23829,12 +23796,12 @@ async function runInit() {
23829
23796
  database = project.database;
23830
23797
  targetDir = import_path.default.join(process.cwd(), project.name);
23831
23798
  if (import_fs_extra.default.existsSync(targetDir)) {
23832
- const overwrite = await p7.confirm({
23799
+ const overwrite = await p6.confirm({
23833
23800
  message: `Folder '${project.name}' already exists. Continue anyway?`,
23834
23801
  initialValue: false
23835
23802
  });
23836
- if (p7.isCancel(overwrite) || !overwrite) {
23837
- p7.cancel("Cancelled.");
23803
+ if (p6.isCancel(overwrite) || !overwrite) {
23804
+ p6.cancel("Cancelled.");
23838
23805
  process.exit(0);
23839
23806
  }
23840
23807
  }
@@ -23850,17 +23817,17 @@ async function runInit() {
23850
23817
  printStatusList(checks);
23851
23818
  language = import_fs_extra.default.existsSync(import_path.default.join(targetDir, "tsconfig.json")) ? "typescript" : "javascript";
23852
23819
  if (checks.find((c4) => c4.label === "Next.js")?.status === "error") {
23853
- p7.cancel(`No Next.js project found in ${targetDir}. Run from inside your project folder.`);
23820
+ p6.cancel(`No Next.js project found in ${targetDir}. Run from inside your project folder.`);
23854
23821
  process.exit(1);
23855
23822
  }
23856
23823
  console.log(`
23857
- ${import_chalk8.default.dim("This wizard will:")}
23824
+ ${import_chalk7.default.dim("This wizard will:")}
23858
23825
  `);
23859
- console.log(` ${import_chalk8.default.dim("\xB7")} Generate Prisma models for your roles`);
23860
- console.log(` ${import_chalk8.default.dim("\xB7")} Create API route handlers ${import_chalk8.default.dim("src/app/api/auth/**")}`);
23861
- console.log(` ${import_chalk8.default.dim("\xB7")} Scaffold auth pages ${import_chalk8.default.dim("(login, 2FA, reset password, etc.)")}`);
23862
- console.log(` ${import_chalk8.default.dim("\xB7")} Create auth.config.ts`);
23863
- console.log(` ${import_chalk8.default.dim("\xB7")} Update .env.example
23826
+ console.log(` ${import_chalk7.default.dim("\xB7")} Generate Prisma models for your roles`);
23827
+ console.log(` ${import_chalk7.default.dim("\xB7")} Create API route handlers ${import_chalk7.default.dim("src/app/api/auth/**")}`);
23828
+ console.log(` ${import_chalk7.default.dim("\xB7")} Scaffold auth pages ${import_chalk7.default.dim("(login, 2FA, reset password, etc.)")}`);
23829
+ console.log(` ${import_chalk7.default.dim("\xB7")} Create auth.config.ts`);
23830
+ console.log(` ${import_chalk7.default.dim("\xB7")} Update .env.example
23864
23831
  `);
23865
23832
  }
23866
23833
  printSection(mode === "new" ? `STEP 2 of ${STEPS.length} \u25B8 PROJECT \u2713 \u25B8 APP` : `STEP 1 of ${STEPS.length - 1} \u25B8 APP`);
@@ -23871,31 +23838,29 @@ async function runInit() {
23871
23838
  let features = await promptFeatures(Object.keys(roles));
23872
23839
  printSection(mode === "new" ? `STEP 5 of ${STEPS.length} \u25B8 ... FEATURES \u2713 \u25B8 INFRA` : `STEP 4 \u25B8 FEATURES \u2713 \u25B8 INFRA`);
23873
23840
  let infra = await promptInfrastructure();
23874
- printSection(mode === "new" ? `STEP 6 of ${STEPS.length} \u25B8 ... INFRA \u2713 \u25B8 STYLE` : `STEP 5 \u25B8 INFRA \u2713 \u25B8 STYLE`);
23875
- let style = await promptStyle();
23876
23841
  let isDry = false;
23877
23842
  while (true) {
23878
23843
  printSection("REVIEW \xB7 Everything that's about to happen");
23879
- console.log(` ${import_chalk8.default.bold("Configuration")}
23844
+ console.log(` ${import_chalk7.default.bold("Configuration")}
23880
23845
  `);
23881
- console.log(` App ${import_chalk8.default.cyan(app.appName)}`);
23882
- console.log(` Cookie prefix ${import_chalk8.default.cyan(app.cookiePrefix)}`);
23883
- console.log(` Session ${import_chalk8.default.cyan(app.sessionDuration / 3600 + " hours")}`);
23846
+ console.log(` App ${import_chalk7.default.cyan(app.appName)}`);
23847
+ console.log(` Cookie prefix ${import_chalk7.default.cyan(app.cookiePrefix)}`);
23848
+ console.log(` Session ${import_chalk7.default.cyan(app.sessionDuration / 3600 + " hours")}`);
23884
23849
  if (mode === "new") {
23885
- console.log(` Language ${import_chalk8.default.cyan(language)}`);
23886
- console.log(` Package manager ${import_chalk8.default.cyan(packageManager)}`);
23887
- console.log(` Database ${import_chalk8.default.cyan(database)}`);
23850
+ console.log(` Language ${import_chalk7.default.cyan(language)}`);
23851
+ console.log(` Package manager ${import_chalk7.default.cyan(packageManager)}`);
23852
+ console.log(` Database ${import_chalk7.default.cyan(database)}`);
23888
23853
  }
23889
23854
  console.log();
23890
- console.log(` ${import_chalk8.default.bold("Roles")}`);
23855
+ console.log(` ${import_chalk7.default.bold("Roles")}`);
23891
23856
  for (const [id, role] of Object.entries(roles)) {
23892
- console.log(` ${import_chalk8.default.dim("\xB7")} ${import_chalk8.default.magentaBright(id)} ${import_chalk8.default.dim("\u2192")} ${role.prismaModel} ${import_chalk8.default.dim("(")}${role.loginField}${import_chalk8.default.dim(")")}`);
23857
+ console.log(` ${import_chalk7.default.dim("\xB7")} ${import_chalk7.default.magentaBright(id)} ${import_chalk7.default.dim("\u2192")} ${role.prismaModel} ${import_chalk7.default.dim("(")}${role.loginField}${import_chalk7.default.dim(")")}`);
23893
23858
  }
23894
23859
  console.log();
23895
23860
  const onFeatures = Object.entries(features).filter(([k, v]) => v === true && ["twoFactor", "emailVerification", "passwordReset", "accountLockout", "apiKeys", "auditLog", "sessionTracking"].includes(k)).map(([k]) => k);
23896
- console.log(` ${import_chalk8.default.bold("Features")} ${onFeatures.map((f) => import_chalk8.default.cyan(f)).join(import_chalk8.default.dim(" \xB7 "))}`);
23861
+ console.log(` ${import_chalk7.default.bold("Features")} ${onFeatures.map((f) => import_chalk7.default.cyan(f)).join(import_chalk7.default.dim(" \xB7 "))}`);
23897
23862
  console.log();
23898
- const action = await p7.select({
23863
+ const action = await p6.select({
23899
23864
  message: "Proceed?",
23900
23865
  options: [
23901
23866
  { value: "go", label: mode === "new" ? "Create project" : "Create files" },
@@ -23904,41 +23869,39 @@ async function runInit() {
23904
23869
  { value: "no", label: "Cancel" }
23905
23870
  ]
23906
23871
  });
23907
- if (p7.isCancel(action) || action === "no") {
23908
- p7.cancel("Cancelled.");
23872
+ if (p6.isCancel(action) || action === "no") {
23873
+ p6.cancel("Cancelled.");
23909
23874
  process.exit(0);
23910
23875
  }
23911
23876
  if (action === "edit") {
23912
- const section = await p7.select({
23877
+ const section = await p6.select({
23913
23878
  message: "Which section would you like to change?",
23914
23879
  options: [
23915
23880
  { value: "app", label: "App identity (name, cookie prefix, session duration)" },
23916
23881
  { value: "roles", label: "Roles" },
23917
23882
  { value: "features", label: "Features" },
23918
- { value: "infra", label: "Infrastructure (SMTP, rate limiting)" },
23919
- { value: "style", label: "Style (primary colour, logo)" }
23883
+ { value: "infra", label: "Infrastructure (SMTP, rate limiting)" }
23920
23884
  ]
23921
23885
  });
23922
- if (p7.isCancel(section)) {
23923
- p7.cancel("Cancelled.");
23886
+ if (p6.isCancel(section)) {
23887
+ p6.cancel("Cancelled.");
23924
23888
  process.exit(0);
23925
23889
  }
23926
23890
  if (section === "app") app = await promptApp(projectName);
23927
23891
  if (section === "roles") roles = await promptRoles();
23928
23892
  if (section === "features") features = await promptFeatures(Object.keys(roles));
23929
23893
  if (section === "infra") infra = await promptInfrastructure();
23930
- if (section === "style") style = await promptStyle();
23931
23894
  continue;
23932
23895
  }
23933
23896
  isDry = action === "dry";
23934
23897
  break;
23935
23898
  }
23936
23899
  printSection(mode === "new" ? `BUILDING ${projectName}` : "INSTALLING");
23937
- const spin = p7.spinner();
23900
+ const spin = p6.spinner();
23938
23901
  async function writeFile(relPath, content) {
23939
23902
  const full = import_path.default.join(targetDir, relPath);
23940
23903
  if (isDry) {
23941
- console.log(` ${import_chalk8.default.dim("+")} ${import_chalk8.default.yellow(relPath)}`);
23904
+ console.log(` ${import_chalk7.default.dim("+")} ${import_chalk7.default.yellow(relPath)}`);
23942
23905
  return;
23943
23906
  }
23944
23907
  await import_fs_extra.default.ensureDir(import_path.default.dirname(full));
@@ -23947,7 +23910,7 @@ async function runInit() {
23947
23910
  async function step(label, fn) {
23948
23911
  spin.start(label);
23949
23912
  await fn();
23950
- spin.stop(`${import_chalk8.default.green("\u2713")} ${label}`);
23913
+ spin.stop(`${import_chalk7.default.green("\u2713")} ${label}`);
23951
23914
  }
23952
23915
  if (mode === "new") {
23953
23916
  await step("Scaffolding Next.js project", async () => {
@@ -23963,9 +23926,9 @@ dist
23963
23926
  *.tsbuildinfo
23964
23927
  `);
23965
23928
  await writeFile(".env.local", "");
23966
- await writeFile("src/app/layout.tsx", generateRootLayout(app.appName, style.primaryColor, language));
23967
- await writeFile("src/app/globals.css", generateGlobalsCss(style.primaryColor));
23968
- await writeFile("src/app/page.tsx", generateRootPage(roles[Object.keys(roles)[0]] ? "/login" : "/login"));
23929
+ await writeFile("src/app/layout.tsx", generateRootLayout(app.appName, DEFAULT_COLOR, language));
23930
+ await writeFile("src/app/globals.css", generateGlobalsCss(DEFAULT_COLOR));
23931
+ await writeFile("src/app/page.tsx", generateRootPage("/login"));
23969
23932
  });
23970
23933
  }
23971
23934
  await step("Generating Prisma schema", async () => {
@@ -23986,7 +23949,7 @@ dist
23986
23949
  await writeFile("prisma/schema.prisma", schema);
23987
23950
  });
23988
23951
  await step("Creating auth.config.ts", async () => {
23989
- const config = generateAuthConfig({ appName: app.appName, cookiePrefix: app.cookiePrefix, sessionDuration: app.sessionDuration, roles, features, infra, style, language });
23952
+ const config = generateAuthConfig({ appName: app.appName, cookiePrefix: app.cookiePrefix, sessionDuration: app.sessionDuration, roles, features, infra, style: DEFAULT_STYLE, language });
23990
23953
  await writeFile(`auth.config.${language === "typescript" ? "ts" : "js"}`, config);
23991
23954
  });
23992
23955
  await step("Creating middleware", async () => {
@@ -23997,7 +23960,7 @@ dist
23997
23960
  });
23998
23961
  await step("Scaffolding auth pages", async () => {
23999
23962
  const e = language === "typescript" ? "tsx" : "jsx";
24000
- await writeFile(`src/app/(auth)/login/page.${e}`, generateLoginPage(app.appName, style.primaryColor, language));
23963
+ await writeFile(`src/app/(auth)/login/page.${e}`, generateLoginPage(app.appName, DEFAULT_COLOR, language));
24001
23964
  });
24002
23965
  await step("Creating .env and .env.example", async () => {
24003
23966
  await writeFile(".env", generateEnvFile(app.cookiePrefix, infra, features));
@@ -24013,55 +23976,53 @@ dist
24013
23976
  printNextSteps([
24014
23977
  ...isNew ? [{
24015
23978
  n: 0,
24016
- title: `Enter your project ${import_chalk8.default.dim("(run every command below from inside here)")}`,
24017
- lines: [`${import_chalk8.default.green(`cd ${projectName}`)}`]
23979
+ title: `Enter your project ${import_chalk7.default.dim("(run every command below from inside here)")}`,
23980
+ lines: [`${import_chalk7.default.green(`cd ${projectName}`)}`]
24018
23981
  }] : [],
24019
23982
  {
24020
23983
  n: 1,
24021
- title: `Fill in ${import_chalk8.default.yellow(".env")} ${import_chalk8.default.dim("(created for you \u2014 open it and add your values)")}`,
23984
+ title: `Fill in ${import_chalk7.default.yellow(".env")} ${import_chalk7.default.dim("(created for you \u2014 open it and add your values)")}`,
24022
23985
  lines: [
24023
- `${import_chalk8.default.cyan("DATABASE_URL=")} ${import_chalk8.default.dim("\u2190 your Postgres connection string (Neon, Supabase, local)")}`,
24024
- `${import_chalk8.default.cyan("AEGIS_JWT_SECRET=")} ${import_chalk8.default.dim(process.platform === "win32" ? "\u2190 [Convert]::ToBase64String((1..32|%{[byte](Get-Random -Max 256)}))" : "\u2190 openssl rand -base64 32")}`,
24025
- ...features.emailVerification || features.passwordReset ? [`${import_chalk8.default.cyan("AEGIS_SMTP_HOST=")} ${import_chalk8.default.dim("\u2190 and SMTP_PORT, SMTP_USER, SMTP_PASS, SMTP_FROM")}`] : [],
24026
- ...infra.rateLimitProvider === "upstash" ? [`${import_chalk8.default.cyan("UPSTASH_REDIS_REST_URL=")} ${import_chalk8.default.dim("\u2190 and UPSTASH_REDIS_REST_TOKEN")}`] : []
23986
+ `${import_chalk7.default.cyan("DATABASE_URL=")} ${import_chalk7.default.dim("\u2190 your Postgres connection string (Neon, Supabase, local)")}`,
23987
+ `${import_chalk7.default.cyan("AEGIS_JWT_SECRET=")} ${import_chalk7.default.dim(process.platform === "win32" ? "\u2190 [Convert]::ToBase64String((1..32|%{[byte](Get-Random -Max 256)}))" : "\u2190 openssl rand -base64 32")}`,
23988
+ ...features.emailVerification || features.passwordReset ? [`${import_chalk7.default.cyan("AEGIS_SMTP_HOST=")} ${import_chalk7.default.dim("\u2190 and SMTP_PORT, SMTP_USER, SMTP_PASS, SMTP_FROM")}`] : [],
23989
+ ...infra.rateLimitProvider === "upstash" ? [`${import_chalk7.default.cyan("UPSTASH_REDIS_REST_URL=")} ${import_chalk7.default.dim("\u2190 and UPSTASH_REDIS_REST_TOKEN")}`] : []
24027
23990
  ]
24028
23991
  },
24029
23992
  {
24030
23993
  n: 2,
24031
23994
  title: "Apply the database schema",
24032
23995
  lines: [
24033
- ...isNew ? [`${import_chalk8.default.green(`cd ${projectName}`)} ${import_chalk8.default.dim("\u2190 if not already inside")}`] : [],
24034
- `${import_chalk8.default.green("npx prisma migrate dev --name init")}`
23996
+ ...isNew ? [`${import_chalk7.default.green(`cd ${projectName}`)} ${import_chalk7.default.dim("\u2190 if not already inside")}`] : [],
23997
+ `${import_chalk7.default.green("npx prisma migrate dev --name init")}`
24035
23998
  ]
24036
23999
  },
24037
24000
  {
24038
24001
  n: 3,
24039
24002
  title: "Create your first user",
24040
- lines: [`${import_chalk8.default.green("npx aegis-auth seed")}`]
24003
+ lines: [`${import_chalk7.default.green("npx aegis-auth seed")}`]
24041
24004
  },
24042
24005
  {
24043
24006
  n: 4,
24044
24007
  title: mode === "new" ? "Start building" : "Start your dev server",
24045
24008
  lines: [
24046
- `${import_chalk8.default.green(packageManager === "npm" ? "npm run dev" : `${packageManager} dev`)} ${import_chalk8.default.dim("\u2192 http://localhost:3000")}`
24009
+ `${import_chalk7.default.green(packageManager === "npm" ? "npm run dev" : `${packageManager} dev`)} ${import_chalk7.default.dim("\u2192 http://localhost:3000")}`
24047
24010
  ]
24048
24011
  }
24049
24012
  ]);
24050
24013
  console.log();
24051
- console.log(
24052
- ` ${import_chalk8.default.dim("Commands available any time:")}
24053
- `
24054
- );
24055
- console.log(` ${import_chalk8.default.green("aegis-auth add-role")} ${import_chalk8.default.dim("add a new role")}`);
24056
- console.log(` ${import_chalk8.default.green("aegis-auth generate")} ${import_chalk8.default.dim("regenerate TypeScript types")}`);
24057
- console.log(` ${import_chalk8.default.green("aegis-auth validate")} ${import_chalk8.default.dim("check config without hitting DB")}`);
24058
- console.log(` ${import_chalk8.default.green("aegis-auth doctor")} ${import_chalk8.default.dim("check env, DB, SMTP, Redis")}`);
24059
- console.log(` ${import_chalk8.default.green("aegis-auth upgrade")} ${import_chalk8.default.dim("update to a new version")}`);
24014
+ console.log(` ${import_chalk7.default.dim("Commands available any time:")}
24015
+ `);
24016
+ console.log(` ${import_chalk7.default.green("aegis-auth add-role")} ${import_chalk7.default.dim("add a new role")}`);
24017
+ console.log(` ${import_chalk7.default.green("aegis-auth generate")} ${import_chalk7.default.dim("regenerate TypeScript types")}`);
24018
+ console.log(` ${import_chalk7.default.green("aegis-auth validate")} ${import_chalk7.default.dim("check config without hitting DB")}`);
24019
+ console.log(` ${import_chalk7.default.green("aegis-auth doctor")} ${import_chalk7.default.dim("check env, DB, SMTP, Redis")}`);
24020
+ console.log(` ${import_chalk7.default.green("aegis-auth upgrade")} ${import_chalk7.default.dim("update to a new version")}`);
24060
24021
  console.log();
24061
24022
  }
24062
24023
 
24063
24024
  // src/commands/doctor.ts
24064
- var import_chalk9 = __toESM(require("chalk"));
24025
+ var import_chalk8 = __toESM(require("chalk"));
24065
24026
  var import_fs_extra2 = __toESM(require("fs-extra"));
24066
24027
  var import_path2 = __toESM(require("path"));
24067
24028
  async function runDoctor() {
@@ -24089,7 +24050,7 @@ async function runDoctor() {
24089
24050
  "AEGIS_JWT_SECRET_PREVIOUS"
24090
24051
  ];
24091
24052
  console.log(`
24092
- ${import_chalk9.default.dim("\u2500 Environment \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500")}
24053
+ ${import_chalk8.default.dim("\u2500 Environment \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500")}
24093
24054
  `);
24094
24055
  for (const key of requiredEnv) {
24095
24056
  const val = process.env[key];
@@ -24112,20 +24073,20 @@ async function runDoctor() {
24112
24073
  const warns = results.filter((r) => r.status === "warn");
24113
24074
  console.log();
24114
24075
  if (errors.length === 0 && warns.length === 0) {
24115
- console.log(` ${import_chalk9.default.green("\u2713")} ${import_chalk9.default.green("Everything looks good.")}`);
24076
+ console.log(` ${import_chalk8.default.green("\u2713")} ${import_chalk8.default.green("Everything looks good.")}`);
24116
24077
  } else {
24117
24078
  console.log(
24118
- ` ${import_chalk9.default.red(errors.length)} error${errors.length !== 1 ? "s" : ""}` + (warns.length ? ` ${import_chalk9.default.yellow(warns.length)} warning${warns.length !== 1 ? "s" : ""}` : "") + ` found.`
24079
+ ` ${import_chalk8.default.red(errors.length)} error${errors.length !== 1 ? "s" : ""}` + (warns.length ? ` ${import_chalk8.default.yellow(warns.length)} warning${warns.length !== 1 ? "s" : ""}` : "") + ` found.`
24119
24080
  );
24120
24081
  console.log();
24121
- console.log(` Fix the above, then re-run: ${import_chalk9.default.green("npx aegis-auth doctor")}`);
24082
+ console.log(` Fix the above, then re-run: ${import_chalk8.default.green("npx aegis-auth doctor")}`);
24122
24083
  }
24123
24084
  console.log();
24124
24085
  }
24125
24086
 
24126
24087
  // src/commands/add-role.ts
24127
- var p8 = __toESM(require("@clack/prompts"));
24128
- var import_chalk10 = __toESM(require("chalk"));
24088
+ var p7 = __toESM(require("@clack/prompts"));
24089
+ var import_chalk9 = __toESM(require("chalk"));
24129
24090
  var import_fs_extra3 = __toESM(require("fs-extra"));
24130
24091
  var import_path3 = __toESM(require("path"));
24131
24092
  async function runAddRole() {
@@ -24134,25 +24095,25 @@ async function runAddRole() {
24134
24095
  const cwd = process.cwd();
24135
24096
  const configPath = import_fs_extra3.default.existsSync(import_path3.default.join(cwd, "auth.config.ts")) ? import_path3.default.join(cwd, "auth.config.ts") : import_fs_extra3.default.existsSync(import_path3.default.join(cwd, "auth.config.js")) ? import_path3.default.join(cwd, "auth.config.js") : null;
24136
24097
  if (!configPath) {
24137
- p8.cancel("No auth.config.ts found. Run: npx aegis-auth init first.");
24098
+ p7.cancel("No auth.config.ts found. Run: npx aegis-auth init first.");
24138
24099
  process.exit(1);
24139
24100
  }
24140
24101
  console.log(
24141
24102
  `
24142
- ${import_chalk10.default.dim("Adding a new role to your existing setup.")}
24143
- ${import_chalk10.default.dim("You will need to run npx prisma migrate dev after.")}
24103
+ ${import_chalk9.default.dim("Adding a new role to your existing setup.")}
24104
+ ${import_chalk9.default.dim("You will need to run npx prisma migrate dev after.")}
24144
24105
  `
24145
24106
  );
24146
24107
  const { id, config } = await promptRole(1, 1);
24147
24108
  console.log();
24148
- console.log(` ${import_chalk10.default.green("\u2713")} Role ${import_chalk10.default.magentaBright(id)} defined.`);
24109
+ console.log(` ${import_chalk9.default.green("\u2713")} Role ${import_chalk9.default.magentaBright(id)} defined.`);
24149
24110
  console.log();
24150
- console.log(` ${import_chalk10.default.dim("Next steps:")}`);
24111
+ console.log(` ${import_chalk9.default.dim("Next steps:")}`);
24151
24112
  console.log();
24152
24113
  console.log(` 1 Add to auth.config.ts \u2192 roles:`);
24153
24114
  console.log();
24154
24115
  console.log(
24155
- import_chalk10.default.dim(
24116
+ import_chalk9.default.dim(
24156
24117
  ` ${id}: {
24157
24118
  label: '${config.label}',
24158
24119
  prismaModel: '${config.prismaModel}',
@@ -24164,15 +24125,15 @@ async function runAddRole() {
24164
24125
  );
24165
24126
  console.log();
24166
24127
  console.log(` 2 Apply the schema:`);
24167
- console.log(` ${import_chalk10.default.green("npx prisma migrate dev --name add-role-" + id)}`);
24128
+ console.log(` ${import_chalk9.default.green("npx prisma migrate dev --name add-role-" + id)}`);
24168
24129
  console.log();
24169
24130
  console.log(` 3 Regenerate types:`);
24170
- console.log(` ${import_chalk10.default.green("npx aegis-auth generate")}`);
24131
+ console.log(` ${import_chalk9.default.green("npx aegis-auth generate")}`);
24171
24132
  console.log();
24172
24133
  }
24173
24134
 
24174
24135
  // src/commands/generate.ts
24175
- var import_chalk11 = __toESM(require("chalk"));
24136
+ var import_chalk10 = __toESM(require("chalk"));
24176
24137
  var import_fs_extra4 = __toESM(require("fs-extra"));
24177
24138
  var import_path4 = __toESM(require("path"));
24178
24139
  async function runGenerate() {
@@ -24180,7 +24141,7 @@ async function runGenerate() {
24180
24141
  const cwd = process.cwd();
24181
24142
  const outPath = import_path4.default.join(cwd, "src", "lib", "auth-types.generated.ts");
24182
24143
  console.log(`
24183
- ${import_chalk11.default.dim("Regenerating TypeScript types from auth.config.ts...")}
24144
+ ${import_chalk10.default.dim("Regenerating TypeScript types from auth.config.ts...")}
24184
24145
  `);
24185
24146
  const content = `// auto-generated by aegis-auth \u2014 do not edit
24186
24147
  // run: npx aegis-auth generate to update
@@ -24194,13 +24155,13 @@ export type { AegisSession }
24194
24155
  `;
24195
24156
  await import_fs_extra4.default.ensureDir(import_path4.default.dirname(outPath));
24196
24157
  await import_fs_extra4.default.writeFile(outPath, content, "utf8");
24197
- console.log(` ${import_chalk11.default.green("\u2713")} ${import_chalk11.default.yellow("src/lib/auth-types.generated.ts")} updated`);
24158
+ console.log(` ${import_chalk10.default.green("\u2713")} ${import_chalk10.default.yellow("src/lib/auth-types.generated.ts")} updated`);
24198
24159
  console.log();
24199
24160
  }
24200
24161
 
24201
24162
  // src/commands/seed.ts
24202
- var p9 = __toESM(require("@clack/prompts"));
24203
- var import_chalk12 = __toESM(require("chalk"));
24163
+ var p8 = __toESM(require("@clack/prompts"));
24164
+ var import_chalk11 = __toESM(require("chalk"));
24204
24165
  var import_fs_extra5 = __toESM(require("fs-extra"));
24205
24166
  var import_path5 = __toESM(require("path"));
24206
24167
  async function runSeed() {
@@ -24209,45 +24170,45 @@ async function runSeed() {
24209
24170
  const cwd = process.cwd();
24210
24171
  const hasConfig = import_fs_extra5.default.existsSync(import_path5.default.join(cwd, "auth.config.ts")) || import_fs_extra5.default.existsSync(import_path5.default.join(cwd, "auth.config.js"));
24211
24172
  if (!hasConfig) {
24212
- p9.cancel("No auth.config.ts found. Run: npx aegis-auth init first.");
24173
+ p8.cancel("No auth.config.ts found. Run: npx aegis-auth init first.");
24213
24174
  process.exit(1);
24214
24175
  }
24215
24176
  const hasPrisma = import_fs_extra5.default.existsSync(import_path5.default.join(cwd, "node_modules", ".prisma", "client"));
24216
24177
  if (!hasPrisma) {
24217
- p9.cancel("Prisma client not generated. Run: npx prisma generate first.");
24178
+ p8.cancel("Prisma client not generated. Run: npx prisma generate first.");
24218
24179
  process.exit(1);
24219
24180
  }
24220
24181
  console.log(`
24221
- ${import_chalk12.default.dim("Creates the first user account in your database.")}
24182
+ ${import_chalk11.default.dim("Creates the first user account in your database.")}
24222
24183
  `);
24223
- const role = await p9.text({
24184
+ const role = await p8.text({
24224
24185
  message: "Role ID",
24225
24186
  placeholder: "admin",
24226
24187
  validate: (v) => !v ? "Required" : void 0
24227
24188
  });
24228
- if (p9.isCancel(role)) process.exit(0);
24229
- const loginField = await p9.select({
24189
+ if (p8.isCancel(role)) process.exit(0);
24190
+ const loginField = await p8.select({
24230
24191
  message: "Login field for this role",
24231
24192
  options: [
24232
24193
  { value: "email", label: "email" },
24233
24194
  { value: "username", label: "username" }
24234
24195
  ]
24235
24196
  });
24236
- if (p9.isCancel(loginField)) process.exit(0);
24237
- const identifier = await p9.text({
24197
+ if (p8.isCancel(loginField)) process.exit(0);
24198
+ const identifier = await p8.text({
24238
24199
  message: loginField === "email" ? "Email address" : "Username",
24239
24200
  validate: (v) => {
24240
24201
  if (!v) return "Required";
24241
24202
  if (loginField === "email" && !v.includes("@")) return "Enter a valid email address";
24242
24203
  }
24243
24204
  });
24244
- if (p9.isCancel(identifier)) process.exit(0);
24245
- const password3 = await p9.password({
24205
+ if (p8.isCancel(identifier)) process.exit(0);
24206
+ const password3 = await p8.password({
24246
24207
  message: "Password",
24247
24208
  validate: (v) => v.length < 8 ? "At least 8 characters" : void 0
24248
24209
  });
24249
- if (p9.isCancel(password3)) process.exit(0);
24250
- const spin = p9.spinner();
24210
+ if (p8.isCancel(password3)) process.exit(0);
24211
+ const spin = p8.spinner();
24251
24212
  spin.start("Creating user\u2026");
24252
24213
  try {
24253
24214
  const envPath = import_path5.default.join(cwd, ".env");
@@ -24275,18 +24236,18 @@ async function runSeed() {
24275
24236
  }
24276
24237
  });
24277
24238
  await prisma.$disconnect();
24278
- spin.stop(`${import_chalk12.default.green("\u2713")} User created`);
24239
+ spin.stop(`${import_chalk11.default.green("\u2713")} User created`);
24279
24240
  console.log();
24280
- console.log(` ${import_chalk12.default.bold("Role")} ${import_chalk12.default.magentaBright(role)}`);
24281
- console.log(` ${import_chalk12.default.bold(loginField)} ${import_chalk12.default.cyan(identifier)}`);
24241
+ console.log(` ${import_chalk11.default.bold("Role")} ${import_chalk11.default.magentaBright(role)}`);
24242
+ console.log(` ${import_chalk11.default.bold(loginField)} ${import_chalk11.default.cyan(identifier)}`);
24282
24243
  console.log();
24283
24244
  } catch (err) {
24284
- spin.stop(`${import_chalk12.default.red("\u2717")} Failed`);
24245
+ spin.stop(`${import_chalk11.default.red("\u2717")} Failed`);
24285
24246
  console.log();
24286
24247
  if (err?.code === "P2002") {
24287
- console.log(` ${import_chalk12.default.red("A user with that ${loginField} already exists.")}`);
24248
+ console.log(` ${import_chalk11.default.red("A user with that ${loginField} already exists.")}`);
24288
24249
  } else {
24289
- console.log(` ${import_chalk12.default.red(err?.message ?? String(err))}`);
24250
+ console.log(` ${import_chalk11.default.red(err?.message ?? String(err))}`);
24290
24251
  }
24291
24252
  console.log();
24292
24253
  process.exit(1);
@@ -24294,7 +24255,7 @@ async function runSeed() {
24294
24255
  }
24295
24256
 
24296
24257
  // src/index.ts
24297
- var import_chalk13 = __toESM(require("chalk"));
24258
+ var import_chalk12 = __toESM(require("chalk"));
24298
24259
  var [, , command, ...args] = process.argv;
24299
24260
  var COMMANDS = {
24300
24261
  init: runInit,
@@ -24315,23 +24276,23 @@ var DESCRIPTIONS = {
24315
24276
  async function main() {
24316
24277
  if (!command || command === "--help" || command === "-h") {
24317
24278
  printBanner();
24318
- console.log(` ${import_chalk13.default.bold("Usage")} ${import_chalk13.default.cyan("npx aegis-auth")} ${import_chalk13.default.yellow("<command>")}`);
24279
+ console.log(` ${import_chalk12.default.bold("Usage")} ${import_chalk12.default.cyan("npx aegis-auth")} ${import_chalk12.default.yellow("<command>")}`);
24319
24280
  console.log();
24320
- console.log(` ${import_chalk13.default.bold("Commands")}`);
24281
+ console.log(` ${import_chalk12.default.bold("Commands")}`);
24321
24282
  console.log();
24322
24283
  for (const [cmd, desc] of Object.entries(DESCRIPTIONS)) {
24323
- console.log(` ${import_chalk13.default.green(cmd.padEnd(14))} ${import_chalk13.default.dim(desc)}`);
24284
+ console.log(` ${import_chalk12.default.green(cmd.padEnd(14))} ${import_chalk12.default.dim(desc)}`);
24324
24285
  }
24325
24286
  console.log();
24326
- console.log(` ${import_chalk13.default.dim("Run")} ${import_chalk13.default.cyan("npx aegis-auth <command> --help")} ${import_chalk13.default.dim("for more info.")}`);
24287
+ console.log(` ${import_chalk12.default.dim("Run")} ${import_chalk12.default.cyan("npx aegis-auth <command> --help")} ${import_chalk12.default.dim("for more info.")}`);
24327
24288
  console.log();
24328
24289
  return;
24329
24290
  }
24330
24291
  const handler = COMMANDS[command];
24331
24292
  if (!handler) {
24332
24293
  console.error(`
24333
- ${import_chalk13.default.red("Unknown command:")} ${import_chalk13.default.yellow(command)}`);
24334
- console.error(` Run ${import_chalk13.default.cyan("npx aegis-auth --help")} for available commands.
24294
+ ${import_chalk12.default.red("Unknown command:")} ${import_chalk12.default.yellow(command)}`);
24295
+ console.error(` Run ${import_chalk12.default.cyan("npx aegis-auth --help")} for available commands.
24335
24296
  `);
24336
24297
  process.exit(1);
24337
24298
  }
@@ -24339,7 +24300,7 @@ async function main() {
24339
24300
  }
24340
24301
  main().catch((err) => {
24341
24302
  console.error(`
24342
- ${import_chalk13.default.red("Unexpected error:")} ${err.message}
24303
+ ${import_chalk12.default.red("Unexpected error:")} ${err.message}
24343
24304
  `);
24344
24305
  process.exit(1);
24345
24306
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alinsafawi/aegis-auth",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "description": "The shield your Next.js app deserves — full-stack auth in minutes",
5
5
  "bin": {
6
6
  "aegis-auth": "dist/index.js"