@wopr-network/platform-core 1.67.1 → 1.68.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/dist/auth/better-auth.js +7 -0
- package/dist/email/client.js +16 -0
- package/package.json +4 -3
- package/src/auth/better-auth.ts +8 -0
- package/src/email/client.ts +18 -0
package/dist/auth/better-auth.js
CHANGED
|
@@ -194,6 +194,13 @@ function authOptions(cfg) {
|
|
|
194
194
|
}
|
|
195
195
|
if (user.emailVerified)
|
|
196
196
|
return;
|
|
197
|
+
if (process.env.SKIP_EMAIL_VERIFICATION === "true") {
|
|
198
|
+
// raw SQL: better-auth manages the "user" table schema; Drizzle schema is not available in this auth hook context
|
|
199
|
+
await pool.query('UPDATE "user" SET "emailVerified" = true WHERE id = $1', [user.id]);
|
|
200
|
+
user.emailVerified = true;
|
|
201
|
+
logger.info("Email verification skipped (SKIP_EMAIL_VERIFICATION=true)", { userId: user.id });
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
197
204
|
try {
|
|
198
205
|
await initVerificationSchema(pool);
|
|
199
206
|
const { token } = await generateVerificationToken(pool, user.id);
|
package/dist/email/client.js
CHANGED
|
@@ -89,6 +89,17 @@ class ResendTransport {
|
|
|
89
89
|
return result;
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
|
+
/** No-op transport that logs but does not send. Used when EMAIL_DISABLED=true. */
|
|
93
|
+
class NoopTransport {
|
|
94
|
+
async send(opts) {
|
|
95
|
+
logger.info("Email suppressed (EMAIL_DISABLED)", {
|
|
96
|
+
to: opts.to,
|
|
97
|
+
template: opts.templateName,
|
|
98
|
+
userId: opts.userId,
|
|
99
|
+
});
|
|
100
|
+
return { id: "noop", success: true };
|
|
101
|
+
}
|
|
102
|
+
}
|
|
92
103
|
/**
|
|
93
104
|
* Create a lazily-initialized singleton EmailClient from environment variables.
|
|
94
105
|
*
|
|
@@ -126,6 +137,11 @@ let _client = null;
|
|
|
126
137
|
*/
|
|
127
138
|
export function getEmailClient(overrides) {
|
|
128
139
|
if (!_client) {
|
|
140
|
+
if (process.env.EMAIL_DISABLED === "true") {
|
|
141
|
+
_client = new EmailClient(new NoopTransport());
|
|
142
|
+
logger.info("Email client disabled (EMAIL_DISABLED=true)");
|
|
143
|
+
return _client;
|
|
144
|
+
}
|
|
129
145
|
const from = overrides?.from || process.env.EMAIL_FROM || process.env.RESEND_FROM || "noreply@wopr.bot";
|
|
130
146
|
const replyTo = overrides?.replyTo || process.env.EMAIL_REPLY_TO || process.env.RESEND_REPLY_TO || "support@wopr.bot";
|
|
131
147
|
const sesRegion = process.env.AWS_SES_REGION;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wopr-network/platform-core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.68.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -83,6 +83,7 @@
|
|
|
83
83
|
"format": "biome format src/ --write"
|
|
84
84
|
},
|
|
85
85
|
"peerDependencies": {
|
|
86
|
+
"@aws-sdk/client-ses": ">=3",
|
|
86
87
|
"@trpc/server": ">=11",
|
|
87
88
|
"better-auth": ">=1.5",
|
|
88
89
|
"dockerode": ">=4",
|
|
@@ -95,6 +96,7 @@
|
|
|
95
96
|
"zod": ">=3"
|
|
96
97
|
},
|
|
97
98
|
"devDependencies": {
|
|
99
|
+
"@aws-sdk/client-ses": "^3.1014.0",
|
|
98
100
|
"@biomejs/biome": "^2.4.6",
|
|
99
101
|
"@electric-sql/pglite": "^0.3.16",
|
|
100
102
|
"@sentry/node": "^10.43.0",
|
|
@@ -129,14 +131,13 @@
|
|
|
129
131
|
},
|
|
130
132
|
"packageManager": "pnpm@10.31.0",
|
|
131
133
|
"dependencies": {
|
|
132
|
-
"@aws-sdk/client-ses": "^3.1014.0",
|
|
133
134
|
"@hono/node-server": "^1.19.11",
|
|
134
135
|
"@noble/curves": "^2.0.1",
|
|
135
136
|
"@noble/hashes": "^2.0.1",
|
|
136
137
|
"@scure/base": "^2.0.0",
|
|
137
138
|
"@scure/bip32": "^2.0.1",
|
|
138
139
|
"@scure/bip39": "^2.0.1",
|
|
139
|
-
"@wopr-network/crypto-plugins": "^1.0
|
|
140
|
+
"@wopr-network/crypto-plugins": "^1.1.0",
|
|
140
141
|
"handlebars": "^4.7.8",
|
|
141
142
|
"js-yaml": "^4.1.1",
|
|
142
143
|
"postmark": "^4.0.7",
|
package/src/auth/better-auth.ts
CHANGED
|
@@ -265,6 +265,14 @@ function authOptions(cfg: BetterAuthConfig): BetterAuthOptions {
|
|
|
265
265
|
|
|
266
266
|
if (user.emailVerified) return;
|
|
267
267
|
|
|
268
|
+
if (process.env.SKIP_EMAIL_VERIFICATION === "true") {
|
|
269
|
+
// raw SQL: better-auth manages the "user" table schema; Drizzle schema is not available in this auth hook context
|
|
270
|
+
await pool.query('UPDATE "user" SET "emailVerified" = true WHERE id = $1', [user.id]);
|
|
271
|
+
user.emailVerified = true;
|
|
272
|
+
logger.info("Email verification skipped (SKIP_EMAIL_VERIFICATION=true)", { userId: user.id });
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
|
|
268
276
|
try {
|
|
269
277
|
await initVerificationSchema(pool);
|
|
270
278
|
const { token } = await generateVerificationToken(pool, user.id);
|
package/src/email/client.ts
CHANGED
|
@@ -129,6 +129,18 @@ class ResendTransport implements EmailTransport {
|
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
+
/** No-op transport that logs but does not send. Used when EMAIL_DISABLED=true. */
|
|
133
|
+
class NoopTransport implements EmailTransport {
|
|
134
|
+
async send(opts: SendTemplateEmailOpts): Promise<EmailSendResult> {
|
|
135
|
+
logger.info("Email suppressed (EMAIL_DISABLED)", {
|
|
136
|
+
to: opts.to,
|
|
137
|
+
template: opts.templateName,
|
|
138
|
+
userId: opts.userId,
|
|
139
|
+
});
|
|
140
|
+
return { id: "noop", success: true };
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
132
144
|
/**
|
|
133
145
|
* Create a lazily-initialized singleton EmailClient from environment variables.
|
|
134
146
|
*
|
|
@@ -174,6 +186,12 @@ export interface EmailClientOverrides {
|
|
|
174
186
|
*/
|
|
175
187
|
export function getEmailClient(overrides?: EmailClientOverrides): EmailClient {
|
|
176
188
|
if (!_client) {
|
|
189
|
+
if (process.env.EMAIL_DISABLED === "true") {
|
|
190
|
+
_client = new EmailClient(new NoopTransport());
|
|
191
|
+
logger.info("Email client disabled (EMAIL_DISABLED=true)");
|
|
192
|
+
return _client;
|
|
193
|
+
}
|
|
194
|
+
|
|
177
195
|
const from = overrides?.from || process.env.EMAIL_FROM || process.env.RESEND_FROM || "noreply@wopr.bot";
|
|
178
196
|
const replyTo =
|
|
179
197
|
overrides?.replyTo || process.env.EMAIL_REPLY_TO || process.env.RESEND_REPLY_TO || "support@wopr.bot";
|