@momentumcms/auth 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## 0.5.0 (2026-02-23)
2
+
3
+ This was a version bump only for auth to align it with other projects, there were no code changes.
4
+
5
+ ## 0.4.1 (2026-02-22)
6
+
7
+ This was a version bump only for auth to align it with other projects, there were no code changes.
8
+
1
9
  ## 0.4.0 (2026-02-22)
2
10
 
3
11
  ### 🚀 Features
package/index.cjs CHANGED
@@ -59,7 +59,6 @@ var AUTH_ROLES = [
59
59
 
60
60
  // libs/auth/src/lib/auth.ts
61
61
  var import_better_auth = require("better-auth");
62
- var import_plugins = require("better-auth/plugins");
63
62
 
64
63
  // libs/auth/src/lib/email.ts
65
64
  var nodemailer = __toESM(require("nodemailer"));
@@ -540,14 +539,7 @@ function convertFieldsToAdditionalFields(fields) {
540
539
  }
541
540
  function createMomentumAuth(config) {
542
541
  const dbConfig = isLegacyConfig(config) ? { type: "sqlite", database: config.database } : config.db;
543
- const {
544
- baseURL,
545
- secret,
546
- trustedOrigins,
547
- email: emailConfig,
548
- socialProviders,
549
- twoFactorAuth
550
- } = config;
542
+ const { baseURL, secret, trustedOrigins, email: emailConfig, socialProviders } = config;
551
543
  const extraPlugins = !isLegacyConfig(config) ? config.plugins ?? [] : [];
552
544
  const extraUserFields = !isLegacyConfig(config) ? config.userFields ?? [] : [];
553
545
  const databaseOption = dbConfig.type === "sqlite" ? dbConfig.database : dbConfig.pool;
@@ -614,9 +606,6 @@ function createMomentumAuth(config) {
614
606
  }
615
607
  const socialProvidersConfig = buildSocialProviders(socialProviders, baseURL);
616
608
  const plugins = [];
617
- if (twoFactorAuth) {
618
- plugins.push((0, import_plugins.twoFactor)());
619
- }
620
609
  for (const p of extraPlugins) {
621
610
  if (p !== void 0) {
622
611
  plugins.push(p);
@@ -1068,7 +1057,7 @@ function momentumAuth(config) {
1068
1057
  }
1069
1058
 
1070
1059
  // libs/auth/src/lib/plugins/two-factor.ts
1071
- var import_plugins2 = require("better-auth/plugins");
1060
+ var import_plugins = require("better-auth/plugins");
1072
1061
  var AuthTwoFactorCollection = defineCollection({
1073
1062
  slug: "auth-two-factor",
1074
1063
  dbName: "twoFactor",
@@ -1095,24 +1084,25 @@ var AuthTwoFactorCollection = defineCollection({
1095
1084
  function authTwoFactor() {
1096
1085
  return {
1097
1086
  name: "two-factor",
1098
- betterAuthPlugin: (0, import_plugins2.twoFactor)(),
1087
+ betterAuthPlugin: (0, import_plugins.twoFactor)(),
1099
1088
  collections: [AuthTwoFactorCollection],
1100
1089
  userFields: [checkbox("twoFactorEnabled")]
1101
1090
  };
1102
1091
  }
1103
1092
 
1104
1093
  // libs/auth/src/lib/plugins/admin.ts
1094
+ var import_plugins2 = require("better-auth/plugins");
1105
1095
  function authAdmin() {
1106
1096
  return {
1107
1097
  name: "admin",
1108
- // Stub: Better Auth admin plugin will be added here
1109
- betterAuthPlugin: void 0,
1098
+ betterAuthPlugin: (0, import_plugins2.admin)(),
1110
1099
  userFields: [checkbox("banned"), text("banReason"), date("banExpires")],
1111
1100
  sessionFields: [text("impersonatedBy")]
1112
1101
  };
1113
1102
  }
1114
1103
 
1115
1104
  // libs/auth/src/lib/plugins/organization.ts
1105
+ var import_plugins3 = require("better-auth/plugins");
1116
1106
  var AuthOrganizationCollection = defineCollection({
1117
1107
  slug: "auth-organization",
1118
1108
  dbName: "organization",
@@ -1214,8 +1204,7 @@ var AuthInvitationCollection = defineCollection({
1214
1204
  function authOrganization() {
1215
1205
  return {
1216
1206
  name: "organization",
1217
- // Stub: Better Auth organization plugin will be added here
1218
- betterAuthPlugin: void 0,
1207
+ betterAuthPlugin: (0, import_plugins3.organization)(),
1219
1208
  collections: [AuthOrganizationCollection, AuthMemberCollection, AuthInvitationCollection]
1220
1209
  };
1221
1210
  }
package/index.js CHANGED
@@ -8,7 +8,6 @@ var AUTH_ROLES = [
8
8
 
9
9
  // libs/auth/src/lib/auth.ts
10
10
  import { betterAuth } from "better-auth";
11
- import { twoFactor } from "better-auth/plugins";
12
11
 
13
12
  // libs/auth/src/lib/email.ts
14
13
  import * as nodemailer from "nodemailer";
@@ -489,14 +488,7 @@ function convertFieldsToAdditionalFields(fields) {
489
488
  }
490
489
  function createMomentumAuth(config) {
491
490
  const dbConfig = isLegacyConfig(config) ? { type: "sqlite", database: config.database } : config.db;
492
- const {
493
- baseURL,
494
- secret,
495
- trustedOrigins,
496
- email: emailConfig,
497
- socialProviders,
498
- twoFactorAuth
499
- } = config;
491
+ const { baseURL, secret, trustedOrigins, email: emailConfig, socialProviders } = config;
500
492
  const extraPlugins = !isLegacyConfig(config) ? config.plugins ?? [] : [];
501
493
  const extraUserFields = !isLegacyConfig(config) ? config.userFields ?? [] : [];
502
494
  const databaseOption = dbConfig.type === "sqlite" ? dbConfig.database : dbConfig.pool;
@@ -563,9 +555,6 @@ function createMomentumAuth(config) {
563
555
  }
564
556
  const socialProvidersConfig = buildSocialProviders(socialProviders, baseURL);
565
557
  const plugins = [];
566
- if (twoFactorAuth) {
567
- plugins.push(twoFactor());
568
- }
569
558
  for (const p of extraPlugins) {
570
559
  if (p !== void 0) {
571
560
  plugins.push(p);
@@ -1017,7 +1006,7 @@ function momentumAuth(config) {
1017
1006
  }
1018
1007
 
1019
1008
  // libs/auth/src/lib/plugins/two-factor.ts
1020
- import { twoFactor as twoFactor2 } from "better-auth/plugins";
1009
+ import { twoFactor } from "better-auth/plugins";
1021
1010
  var AuthTwoFactorCollection = defineCollection({
1022
1011
  slug: "auth-two-factor",
1023
1012
  dbName: "twoFactor",
@@ -1044,24 +1033,25 @@ var AuthTwoFactorCollection = defineCollection({
1044
1033
  function authTwoFactor() {
1045
1034
  return {
1046
1035
  name: "two-factor",
1047
- betterAuthPlugin: twoFactor2(),
1036
+ betterAuthPlugin: twoFactor(),
1048
1037
  collections: [AuthTwoFactorCollection],
1049
1038
  userFields: [checkbox("twoFactorEnabled")]
1050
1039
  };
1051
1040
  }
1052
1041
 
1053
1042
  // libs/auth/src/lib/plugins/admin.ts
1043
+ import { admin } from "better-auth/plugins";
1054
1044
  function authAdmin() {
1055
1045
  return {
1056
1046
  name: "admin",
1057
- // Stub: Better Auth admin plugin will be added here
1058
- betterAuthPlugin: void 0,
1047
+ betterAuthPlugin: admin(),
1059
1048
  userFields: [checkbox("banned"), text("banReason"), date("banExpires")],
1060
1049
  sessionFields: [text("impersonatedBy")]
1061
1050
  };
1062
1051
  }
1063
1052
 
1064
1053
  // libs/auth/src/lib/plugins/organization.ts
1054
+ import { organization } from "better-auth/plugins";
1065
1055
  var AuthOrganizationCollection = defineCollection({
1066
1056
  slug: "auth-organization",
1067
1057
  dbName: "organization",
@@ -1163,8 +1153,7 @@ var AuthInvitationCollection = defineCollection({
1163
1153
  function authOrganization() {
1164
1154
  return {
1165
1155
  name: "organization",
1166
- // Stub: Better Auth organization plugin will be added here
1167
- betterAuthPlugin: void 0,
1156
+ betterAuthPlugin: organization(),
1168
1157
  collections: [AuthOrganizationCollection, AuthMemberCollection, AuthInvitationCollection]
1169
1158
  };
1170
1159
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momentumcms/auth",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "Better Auth integration for Momentum CMS",
5
5
  "license": "MIT",
6
6
  "author": "Momentum CMS Contributors",
package/src/lib/auth.d.ts CHANGED
@@ -43,8 +43,6 @@ export interface MomentumAuthConfig {
43
43
  email?: MomentumEmailOptions;
44
44
  /** OAuth social login providers */
45
45
  socialProviders?: OAuthProvidersConfig;
46
- /** Enable two-factor authentication (TOTP). Default: false */
47
- twoFactorAuth?: boolean;
48
46
  /** Additional Better Auth plugins (from sub-plugins). */
49
47
  plugins?: unknown[];
50
48
  /** Extra user fields to register with Better Auth's user.additionalFields. */
@@ -66,8 +64,6 @@ export interface MomentumAuthConfigLegacy {
66
64
  email?: MomentumEmailOptions;
67
65
  /** OAuth social login providers */
68
66
  socialProviders?: OAuthProvidersConfig;
69
- /** Enable two-factor authentication (TOTP). Default: false */
70
- twoFactorAuth?: boolean;
71
67
  }
72
68
  /**
73
69
  * Get the list of enabled OAuth provider names from config/env vars.
@@ -1,19 +1,16 @@
1
1
  /**
2
- * Admin Sub-Plugin (Stub)
2
+ * Admin Sub-Plugin
3
3
  *
4
4
  * Wraps Better Auth's admin plugin for user management capabilities:
5
5
  * - Ban/unban users
6
6
  * - Impersonate users
7
7
  * - Admin-level session fields
8
- *
9
- * This is a stub — the Better Auth admin plugin import will be added
10
- * when the full admin integration is implemented.
11
8
  */
12
9
  import type { MomentumAuthSubPlugin } from './sub-plugin.types';
13
10
  /**
14
11
  * Creates the admin sub-plugin.
15
12
  *
16
- * Adds ban/impersonation fields to the user and session collections.
17
- * The actual Better Auth admin plugin will be wired in a future iteration.
13
+ * Adds ban/impersonation fields to the user and session collections
14
+ * and registers the Better Auth admin plugin for ban/unban/impersonation endpoints.
18
15
  */
19
16
  export declare function authAdmin(): MomentumAuthSubPlugin;
@@ -1,19 +1,16 @@
1
1
  /**
2
- * Organization Sub-Plugin (Stub)
2
+ * Organization Sub-Plugin
3
3
  *
4
4
  * Wraps Better Auth's organization plugin for multi-tenant capabilities:
5
5
  * - Organizations
6
6
  * - Members with roles
7
7
  * - Invitations
8
- *
9
- * This is a stub — the Better Auth organization plugin import will be added
10
- * when the full organization integration is implemented.
11
8
  */
12
9
  import type { MomentumAuthSubPlugin } from './sub-plugin.types';
13
10
  /**
14
11
  * Creates the organization sub-plugin.
15
12
  *
16
- * Adds organization, member, and invitation collections.
17
- * The actual Better Auth organization plugin will be wired in a future iteration.
13
+ * Adds organization, member, and invitation collections
14
+ * and registers the Better Auth organization plugin for multi-tenant endpoints.
18
15
  */
19
16
  export declare function authOrganization(): MomentumAuthSubPlugin;