@kyro-cms/core 0.12.49 → 0.12.51
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/api-handler-graphql.cjs +1 -1
- package/dist/api-handler-graphql.js +1 -1
- package/dist/api-handler-trpc.cjs +1 -1
- package/dist/api-handler-trpc.js +1 -1
- package/dist/api-handler.cjs +1 -1
- package/dist/api-handler.d.cts +2 -1
- package/dist/api-handler.d.ts +2 -1
- package/dist/api-handler.js +1 -1
- package/dist/{bootstrap-4FK3LPPH.js → bootstrap-5DPLIKCR.js} +1 -1
- package/dist/bootstrap-ND37CWFL.cjs +1 -0
- package/dist/{chunk-LGYBTBWE.js → chunk-6OIEZHOE.js} +2 -2
- package/dist/{chunk-HKNQVI76.cjs → chunk-754DLK7M.cjs} +1 -1
- package/dist/{chunk-26Q7JXM4.cjs → chunk-EEBI65GB.cjs} +2 -2
- package/dist/{chunk-JR6IOJO7.js → chunk-EVCRNJBG.js} +9 -9
- package/dist/{chunk-7N7U2ERH.js → chunk-G3B5RM2F.js} +2 -2
- package/dist/{chunk-EFGOYI57.js → chunk-HJXUDJC4.js} +15 -15
- package/dist/{chunk-YUER4JU3.cjs → chunk-KBQTMHP3.cjs} +153 -34
- package/dist/{chunk-63BSQ3FK.cjs → chunk-LHYVQSFE.cjs} +1 -1
- package/dist/{chunk-PENOCINR.js → chunk-Q63LWE6P.js} +154 -35
- package/dist/{chunk-CFZVJTXW.cjs → chunk-RYTA4NYP.cjs} +14 -14
- package/dist/chunk-VF6IW6WG.js +2 -0
- package/dist/{chunk-WC7H45ZG.cjs → chunk-XYICMRHL.cjs} +8 -8
- package/dist/cli/index.cjs +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/index.cjs +5 -5
- package/dist/index.d.cts +102 -1
- package/dist/index.d.ts +102 -1
- package/dist/index.js +6 -6
- package/dist/rest/index.cjs +1 -1
- package/dist/rest/index.js +1 -1
- package/dist/templates/index.cjs +1 -1
- package/dist/templates/index.js +1 -1
- package/package.json +2 -2
- package/dist/bootstrap-F4SDJLPK.cjs +0 -1
- package/dist/chunk-24L3UEJJ.js +0 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';var chunkHPYH7GTS_cjs=require('./chunk-HPYH7GTS.cjs'),chunkBUNLC3II_cjs=require('./chunk-BUNLC3II.cjs');chunkBUNLC3II_cjs.h();function
|
|
1
|
+
'use strict';var chunkHPYH7GTS_cjs=require('./chunk-HPYH7GTS.cjs'),chunkBUNLC3II_cjs=require('./chunk-BUNLC3II.cjs');chunkBUNLC3II_cjs.h();function l(o){let{title:e,previewText:t=e,badgeText:r="Security Notification",badgeType:s="info",bodyHtml:i,ctaText:a,ctaUrl:c,secondaryCtaText:g,secondaryCtaUrl:p}=o,u="#eff6ff",m="#bfdbfe",f="#1d4ed8";return s==="success"?(u="#ecfdf5",m="#a7f3d0",f="#047857"):s==="warning"?(u="#fffbeb",m="#fde68a",f="#b45309"):s==="error"&&(u="#fef2f2",m="#fecaca",f="#b91c1c"),`<!DOCTYPE html>
|
|
2
2
|
<html lang="en">
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8">
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
</a>
|
|
55
55
|
</td>
|
|
56
56
|
<td align="right" valign="middle">
|
|
57
|
-
<span class="badge-status" style="display: inline-block; padding: 4px 10px; background-color: ${
|
|
57
|
+
<span class="badge-status" style="display: inline-block; padding: 4px 10px; background-color: ${u}; border: 1px solid ${m}; border-radius: 9999px; font-size: 11px; font-weight: 500; color: ${f};">
|
|
58
58
|
${r}
|
|
59
59
|
</span>
|
|
60
60
|
</td>
|
|
@@ -70,18 +70,18 @@
|
|
|
70
70
|
${e}
|
|
71
71
|
</h1>
|
|
72
72
|
|
|
73
|
-
${
|
|
73
|
+
${i}
|
|
74
74
|
|
|
75
|
-
${a&&
|
|
75
|
+
${a&&c?`
|
|
76
76
|
<!-- Action Buttons -->
|
|
77
77
|
<table role="presentation" width="100%" border="0" cellspacing="0" cellpadding="0" style="margin-top: 24px;">
|
|
78
78
|
<tr>
|
|
79
79
|
<td align="left">
|
|
80
|
-
<a href="${
|
|
80
|
+
<a href="${c}" target="_blank" class="email-btn-primary" style="display: inline-block; padding: 11px 20px; background-color: #09090b; color: #ffffff; font-size: 13px; font-weight: 500; text-decoration: none; border-radius: 6px;">
|
|
81
81
|
${a} \u2192
|
|
82
82
|
</a>
|
|
83
|
-
${
|
|
84
|
-
${
|
|
83
|
+
${g&&p?`<a href="${p}" target="_blank" class="email-btn-secondary" style="display: inline-block; padding: 11px 16px; margin-left: 8px; background-color: #ffffff; border: 1px solid #e4e4e7; color: #09090b; font-size: 13px; font-weight: 500; text-decoration: none; border-radius: 6px;">
|
|
84
|
+
${g}
|
|
85
85
|
</a>`:""}
|
|
86
86
|
</td>
|
|
87
87
|
</tr>
|
|
@@ -104,7 +104,7 @@
|
|
|
104
104
|
</tr>
|
|
105
105
|
</table>
|
|
106
106
|
</body>
|
|
107
|
-
</html>`}chunkBUNLC3II_cjs.h();function b(
|
|
107
|
+
</html>`}chunkBUNLC3II_cjs.h();function b(o,e="User"){let t="Confirm your email address \u2014 Kyro CMS",r=`
|
|
108
108
|
<p class="email-text" style="margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: #52525b;">
|
|
109
109
|
Hello <strong class="email-strong" style="color: #09090b;">${e}</strong>,
|
|
110
110
|
</p>
|
|
@@ -117,7 +117,7 @@
|
|
|
117
117
|
<tr>
|
|
118
118
|
<td style="font-size: 12px; color: #71717a; line-height: 1.5; word-break: break-all;">
|
|
119
119
|
<strong>Direct link:</strong><br />
|
|
120
|
-
<a href="${
|
|
120
|
+
<a href="${o}" style="color: #09090b; text-decoration: underline;" class="email-value">${o}</a>
|
|
121
121
|
</td>
|
|
122
122
|
</tr>
|
|
123
123
|
</table>
|
|
@@ -125,14 +125,14 @@
|
|
|
125
125
|
<p class="email-text" style="margin: 0 0 8px; font-size: 12px; color: #71717a;">
|
|
126
126
|
This verification link will expire in 24 hours. If you did not create an account, you can safely ignore this email.
|
|
127
127
|
</p>
|
|
128
|
-
`,s=
|
|
128
|
+
`,s=l({title:"Confirm Your Email Address",previewText:"Please confirm your email address to activate your Kyro CMS account.",badgeText:"Action Required",badgeType:"warning",bodyHtml:r,ctaText:"Confirm Email Address",ctaUrl:o,secondaryCtaText:"Documentation",secondaryCtaUrl:"https://kyro-cms.com/docs"}),i=`Welcome, ${e}!
|
|
129
129
|
|
|
130
130
|
Please verify your email address by visiting:
|
|
131
|
-
${
|
|
131
|
+
${o}
|
|
132
132
|
|
|
133
133
|
This link expires in 24 hours.
|
|
134
134
|
|
|
135
|
-
Kyro CMS \u2014 https://kyro-cms.com`;return {subject:t,html:s,text:
|
|
135
|
+
Kyro CMS \u2014 https://kyro-cms.com`;return {subject:t,html:s,text:i}}chunkBUNLC3II_cjs.h();function x(o,e="User"){let t="Reset your password \u2014 Kyro CMS",r=`
|
|
136
136
|
<p class="email-text" style="margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: #52525b;">
|
|
137
137
|
Hello <strong class="email-strong" style="color: #09090b;">${e}</strong>,
|
|
138
138
|
</p>
|
|
@@ -145,7 +145,7 @@ Kyro CMS \u2014 https://kyro-cms.com`;return {subject:t,html:s,text:o}}chunkBUNL
|
|
|
145
145
|
<tr>
|
|
146
146
|
<td style="font-size: 12px; color: #71717a; line-height: 1.5; word-break: break-all;">
|
|
147
147
|
<strong>Reset URL:</strong><br />
|
|
148
|
-
<a href="${
|
|
148
|
+
<a href="${o}" style="color: #09090b; text-decoration: underline;" class="email-value">${o}</a>
|
|
149
149
|
</td>
|
|
150
150
|
</tr>
|
|
151
151
|
</table>
|
|
@@ -153,16 +153,16 @@ Kyro CMS \u2014 https://kyro-cms.com`;return {subject:t,html:s,text:o}}chunkBUNL
|
|
|
153
153
|
<p class="email-text" style="margin: 0 0 8px; font-size: 12px; color: #71717a;">
|
|
154
154
|
For security reasons, this link will expire in 1 hour. If you did not request a password reset, no further action is required.
|
|
155
155
|
</p>
|
|
156
|
-
`,s=
|
|
156
|
+
`,s=l({title:"Reset Your Password",previewText:"Use this secure link to reset your Kyro CMS password.",badgeText:"Security Action",badgeType:"warning",bodyHtml:r,ctaText:"Reset Password",ctaUrl:o}),i=`Hello ${e},
|
|
157
157
|
|
|
158
158
|
Reset your password using the following link:
|
|
159
|
-
${
|
|
159
|
+
${o}
|
|
160
160
|
|
|
161
161
|
This link will expire in 1 hour.
|
|
162
162
|
|
|
163
|
-
Kyro CMS \u2014 https://kyro-cms.com`;return {subject:t,html:s,text:
|
|
163
|
+
Kyro CMS \u2014 https://kyro-cms.com`;return {subject:t,html:s,text:i}}chunkBUNLC3II_cjs.h();function _(o="User",e="https://kyro-cms.com"){let t="Welcome to Kyro CMS!",r=`
|
|
164
164
|
<p class="email-text" style="margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: #52525b;">
|
|
165
|
-
Welcome <strong class="email-strong" style="color: #09090b;">${
|
|
165
|
+
Welcome <strong class="email-strong" style="color: #09090b;">${o}</strong>,
|
|
166
166
|
</p>
|
|
167
167
|
<p class="email-text" style="margin: 0 0 20px; font-size: 14px; line-height: 1.6; color: #52525b;">
|
|
168
168
|
Your Kyro CMS account is now set up and ready to go. You can access your admin dashboard, build content collections, and manage schema endpoints.
|
|
@@ -181,13 +181,13 @@ Kyro CMS \u2014 https://kyro-cms.com`;return {subject:t,html:s,text:o}}chunkBUNL
|
|
|
181
181
|
</td>
|
|
182
182
|
</tr>
|
|
183
183
|
</table>
|
|
184
|
-
`,s=
|
|
184
|
+
`,s=l({title:"Welcome to Kyro CMS",previewText:"Your account is verified and ready. Start building content applications.",badgeText:"Account Ready",badgeType:"success",bodyHtml:r,ctaText:"Open Dashboard",ctaUrl:e,secondaryCtaText:"Documentation",secondaryCtaUrl:"https://kyro-cms.com/docs"}),i=`Welcome to Kyro CMS, ${o}!
|
|
185
185
|
|
|
186
186
|
Your account is active. Log in at ${e} to start building.
|
|
187
187
|
|
|
188
|
-
Documentation: https://kyro-cms.com/docs`;return {subject:t,html:s,text:
|
|
188
|
+
Documentation: https://kyro-cms.com/docs`;return {subject:t,html:s,text:i}}chunkBUNLC3II_cjs.h();function S(o="User"){let e="Security Alert: Password Changed \u2014 Kyro CMS",t=new Date().toUTCString(),r=`
|
|
189
189
|
<p class="email-text" style="margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: #52525b;">
|
|
190
|
-
Hello <strong class="email-strong" style="color: #09090b;">${
|
|
190
|
+
Hello <strong class="email-strong" style="color: #09090b;">${o}</strong>,
|
|
191
191
|
</p>
|
|
192
192
|
<p class="email-text" style="margin: 0 0 20px; font-size: 14px; line-height: 1.6; color: #52525b;">
|
|
193
193
|
This email confirms that the password for your Kyro CMS account was successfully updated on <strong>${t}</strong>.
|
|
@@ -202,11 +202,11 @@ Documentation: https://kyro-cms.com/docs`;return {subject:t,html:s,text:o}}chunk
|
|
|
202
202
|
</td>
|
|
203
203
|
</tr>
|
|
204
204
|
</table>
|
|
205
|
-
`,s=
|
|
205
|
+
`,s=l({title:"Password Updated",previewText:"Your Kyro CMS account password was updated.",badgeText:"Security Alert",badgeType:"warning",bodyHtml:r,ctaText:"Account Security",ctaUrl:"https://kyro-cms.com"}),i=`Security Alert: Your Kyro CMS password was updated at ${t}.
|
|
206
206
|
|
|
207
207
|
If you did not make this change, please reset your password immediately.
|
|
208
208
|
|
|
209
|
-
Kyro CMS \u2014 https://kyro-cms.com`;return {subject:e,html:s,text:
|
|
209
|
+
Kyro CMS \u2014 https://kyro-cms.com`;return {subject:e,html:s,text:i}}chunkBUNLC3II_cjs.h();function T(o,e,t="User"){let r="Your one-time login link \u2014 Kyro CMS",s=`
|
|
210
210
|
<p class="email-text" style="margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: #52525b;">
|
|
211
211
|
Hello <strong class="email-strong" style="color: #09090b;">${t}</strong>,
|
|
212
212
|
</p>
|
|
@@ -232,21 +232,21 @@ Kyro CMS \u2014 https://kyro-cms.com`;return {subject:e,html:s,text:o}}chunkBUNL
|
|
|
232
232
|
<p class="email-text" style="margin: 0 0 8px; font-size: 12px; color: #71717a;">
|
|
233
233
|
This single-use link will expire in 10 minutes. Never share authentication links with anyone.
|
|
234
234
|
</p>
|
|
235
|
-
`,
|
|
235
|
+
`,i=l({title:"Sign in to Kyro CMS",previewText:"Your secure magic login link for Kyro CMS.",badgeText:"Instant Login",badgeType:"info",bodyHtml:s,ctaText:"Sign In Now",ctaUrl:o}),a=`Hello ${t},
|
|
236
236
|
|
|
237
237
|
Sign in to Kyro CMS using the link below:
|
|
238
|
-
${
|
|
238
|
+
${o}${e?`
|
|
239
239
|
|
|
240
240
|
Or enter code: ${e}`:""}
|
|
241
241
|
|
|
242
242
|
This link expires in 10 minutes.
|
|
243
243
|
|
|
244
|
-
Kyro CMS \u2014 https://kyro-cms.com`;return {subject:r,html:
|
|
244
|
+
Kyro CMS \u2014 https://kyro-cms.com`;return {subject:r,html:i,text:a}}chunkBUNLC3II_cjs.h();function w(o,e,t="User"){let r="Security Alert: Account Temporarily Locked \u2014 Kyro CMS",s=`
|
|
245
245
|
<p class="email-text" style="margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: #52525b;">
|
|
246
246
|
Hello <strong class="email-strong" style="color: #09090b;">${t}</strong>,
|
|
247
247
|
</p>
|
|
248
248
|
<p class="email-text" style="margin: 0 0 20px; font-size: 14px; line-height: 1.6; color: #52525b;">
|
|
249
|
-
Your Kyro CMS account was temporarily locked after <strong>${
|
|
249
|
+
Your Kyro CMS account was temporarily locked after <strong>${o} failed login attempts</strong>.
|
|
250
250
|
</p>
|
|
251
251
|
|
|
252
252
|
<!-- Lockout Notice Card -->
|
|
@@ -258,9 +258,9 @@ Kyro CMS \u2014 https://kyro-cms.com`;return {subject:r,html:o,text:a}}chunkBUNL
|
|
|
258
258
|
</td>
|
|
259
259
|
</tr>
|
|
260
260
|
</table>
|
|
261
|
-
`,
|
|
261
|
+
`,i=l({title:"Account Temporarily Locked",previewText:"Your Kyro CMS account was locked due to multiple failed login attempts.",badgeText:"Security Lockout",badgeType:"warning",bodyHtml:s,ctaText:"Unlock Instructions",ctaUrl:"https://kyro-cms.com/docs"}),a=`Security Alert: Account temporarily locked for ${t} after ${o} failed login attempts. Unlocks in ${e} minutes.
|
|
262
262
|
|
|
263
|
-
Kyro CMS \u2014 https://kyro-cms.com`;return {subject:r,html:
|
|
263
|
+
Kyro CMS \u2014 https://kyro-cms.com`;return {subject:r,html:i,text:a}}chunkBUNLC3II_cjs.h();function C(o,e="Editor",t="An Administrator"){let r="You're invited to join Kyro CMS",s=`
|
|
264
264
|
<p class="email-text" style="margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: #52525b;">
|
|
265
265
|
Hello,
|
|
266
266
|
</p>
|
|
@@ -277,24 +277,143 @@ Kyro CMS \u2014 https://kyro-cms.com`;return {subject:r,html:o,text:a}}chunkBUNL
|
|
|
277
277
|
</td>
|
|
278
278
|
</tr>
|
|
279
279
|
</table>
|
|
280
|
-
`,
|
|
280
|
+
`,i=l({title:"Workspace Invitation",previewText:`You have been invited to join Kyro CMS as an ${e}.`,badgeText:"Team Invite",badgeType:"info",bodyHtml:s,ctaText:"Accept Invitation",ctaUrl:o,secondaryCtaText:"Documentation",secondaryCtaUrl:"https://kyro-cms.com/docs"}),a=`You're invited to join Kyro CMS as an ${e} by ${t}.
|
|
281
281
|
|
|
282
282
|
Accept your invitation here:
|
|
283
|
-
${
|
|
283
|
+
${o}
|
|
284
284
|
|
|
285
|
-
Kyro CMS \u2014 https://kyro-cms.com`;return {subject:r,html:
|
|
285
|
+
Kyro CMS \u2014 https://kyro-cms.com`;return {subject:r,html:i,text:a}}chunkBUNLC3II_cjs.h();function k(o,e,t="User"){let r="Security Alert: New Sign-in to Kyro CMS",s=`
|
|
286
|
+
<p class="email-text" style="margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: #52525b;">
|
|
287
|
+
Hello <strong class="email-strong" style="color: #09090b;">${t}</strong>,
|
|
288
|
+
</p>
|
|
289
|
+
<p class="email-text" style="margin: 0 0 20px; font-size: 14px; line-height: 1.6; color: #52525b;">
|
|
290
|
+
A new sign-in to your Kyro CMS account was detected.
|
|
291
|
+
</p>
|
|
292
|
+
|
|
293
|
+
<!-- Sign-in Details -->
|
|
294
|
+
<table role="presentation" width="100%" border="0" cellspacing="0" cellpadding="0" class="email-table" style="background-color: #fafafa; border: 1px solid #e4e4e7; border-radius: 8px; margin-bottom: 20px; padding: 14px; border-collapse: separate;">
|
|
295
|
+
<tr>
|
|
296
|
+
<td style="font-size: 13px; color: #09090b; line-height: 1.6;" class="email-value">
|
|
297
|
+
<strong>Time:</strong> ${e}<br />
|
|
298
|
+
<strong>Location/IP:</strong> ${o}
|
|
299
|
+
</td>
|
|
300
|
+
</tr>
|
|
301
|
+
</table>
|
|
302
|
+
|
|
303
|
+
<!-- Security Warning Card -->
|
|
304
|
+
<table role="presentation" width="100%" border="0" cellspacing="0" cellpadding="0" class="email-table" style="background-color: #fef2f2; border: 1px solid #fecaca; border-radius: 8px; margin-bottom: 20px; padding: 14px; border-collapse: separate;">
|
|
305
|
+
<tr>
|
|
306
|
+
<td style="font-size: 13px; color: #991b1b; line-height: 1.5;">
|
|
307
|
+
\u26A0\uFE0F <strong>Don't recognize this activity?</strong><br />
|
|
308
|
+
If you did not sign in recently, your account may be compromised. Please reset your password immediately and contact an administrator.
|
|
309
|
+
</td>
|
|
310
|
+
</tr>
|
|
311
|
+
</table>
|
|
312
|
+
`,i=l({title:"New Sign-in Detected",previewText:"A new sign-in was detected on your Kyro CMS account.",badgeText:"Security Alert",badgeType:"warning",bodyHtml:s,ctaText:"Review Account Security",ctaUrl:"https://kyro-cms.com"}),a=`Security Alert: New Sign-in to Kyro CMS
|
|
313
|
+
|
|
314
|
+
Hello ${t},
|
|
315
|
+
|
|
316
|
+
A new sign-in to your account was detected at ${e} from ${o}.
|
|
317
|
+
|
|
318
|
+
If you did not sign in recently, please reset your password immediately.
|
|
319
|
+
|
|
320
|
+
Kyro CMS \u2014 https://kyro-cms.com`;return {subject:r,html:i,text:a}}chunkBUNLC3II_cjs.h();function v(o,e="Customer",t,r){let s=`Order Confirmation #${o}`,i=`
|
|
321
|
+
<p class="email-text" style="margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: #52525b;">
|
|
322
|
+
Hi <strong class="email-strong" style="color: #09090b;">${e}</strong>,
|
|
323
|
+
</p>
|
|
324
|
+
<p class="email-text" style="margin: 0 0 20px; font-size: 14px; line-height: 1.6; color: #52525b;">
|
|
325
|
+
Thank you for your order! We've received your order <strong>#${o}</strong> and are getting it ready for shipment.
|
|
326
|
+
</p>
|
|
327
|
+
|
|
328
|
+
<table role="presentation" width="100%" border="0" cellspacing="0" cellpadding="0" class="email-table" style="background-color: #fafafa; border: 1px solid #e4e4e7; border-radius: 8px; margin-bottom: 24px; padding: 16px; border-collapse: separate;">
|
|
329
|
+
<tr>
|
|
330
|
+
<td style="font-size: 13px; color: #09090b; line-height: 1.6;" class="email-value">
|
|
331
|
+
\u{1F6D2} <strong>Order Summary:</strong><br/>
|
|
332
|
+
Order Total: <strong>${t}</strong>
|
|
333
|
+
</td>
|
|
334
|
+
</tr>
|
|
335
|
+
</table>
|
|
336
|
+
`,a=l({title:"Order Confirmed",previewText:`Your order #${o} has been confirmed.`,badgeText:"Confirmed",badgeType:"success",bodyHtml:i,ctaText:"View Order",ctaUrl:r||"https://kyro-cms.com"}),c=`Hi ${e},
|
|
337
|
+
|
|
338
|
+
Thank you for your order #${o}!
|
|
339
|
+
|
|
340
|
+
Order Total: ${t}
|
|
341
|
+
|
|
342
|
+
View your order here: ${r||"https://kyro-cms.com"}`;return {subject:s,html:a,text:c}}chunkBUNLC3II_cjs.h();function E(o,e="Customer",t,r){let s=`Your Order #${o} is on the way!`,i=`
|
|
343
|
+
<p class="email-text" style="margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: #52525b;">
|
|
344
|
+
Great news, <strong class="email-strong" style="color: #09090b;">${e}</strong>!
|
|
345
|
+
</p>
|
|
346
|
+
<p class="email-text" style="margin: 0 0 20px; font-size: 14px; line-height: 1.6; color: #52525b;">
|
|
347
|
+
Your order <strong>#${o}</strong> has been shipped and is on its way to you.
|
|
348
|
+
</p>
|
|
349
|
+
|
|
350
|
+
<table role="presentation" width="100%" border="0" cellspacing="0" cellpadding="0" class="email-table" style="background-color: #fafafa; border: 1px solid #e4e4e7; border-radius: 8px; margin-bottom: 24px; padding: 16px; border-collapse: separate;">
|
|
351
|
+
<tr>
|
|
352
|
+
<td style="font-size: 13px; color: #09090b; line-height: 1.6;" class="email-value">
|
|
353
|
+
\u{1F4E6} <strong>Tracking Number:</strong> ${t}
|
|
354
|
+
</td>
|
|
355
|
+
</tr>
|
|
356
|
+
</table>
|
|
357
|
+
`,a=l({title:"Order Shipped",previewText:`Your order #${o} has shipped. Track your package now.`,badgeText:"Shipped",badgeType:"info",bodyHtml:i,ctaText:"Track Package",ctaUrl:r}),c=`Hi ${e},
|
|
358
|
+
|
|
359
|
+
Your order #${o} has been shipped!
|
|
360
|
+
|
|
361
|
+
Tracking Number: ${t}
|
|
362
|
+
Track it here: ${r}`;return {subject:s,html:a,text:c}}chunkBUNLC3II_cjs.h();function A(o,e="Customer",t){let r=`Your Order #${o} has been delivered`,s=`
|
|
363
|
+
<p class="email-text" style="margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: #52525b;">
|
|
364
|
+
Hi <strong class="email-strong" style="color: #09090b;">${e}</strong>,
|
|
365
|
+
</p>
|
|
366
|
+
<p class="email-text" style="margin: 0 0 20px; font-size: 14px; line-height: 1.6; color: #52525b;">
|
|
367
|
+
Good news! Your order <strong>#${o}</strong> has been successfully delivered. We hope you love it!
|
|
368
|
+
</p>
|
|
369
|
+
<p class="email-text" style="margin: 0 0 20px; font-size: 14px; line-height: 1.6; color: #52525b;">
|
|
370
|
+
We'd love to hear your thoughts. If you have a minute, please leave a review for your items.
|
|
371
|
+
</p>
|
|
372
|
+
`,i=l({title:"Order Delivered",previewText:`Your order #${o} has arrived!`,badgeText:"Delivered",badgeType:"success",bodyHtml:s,ctaText:"Leave a Review",ctaUrl:t}),a=`Hi ${e},
|
|
373
|
+
|
|
374
|
+
Your order #${o} has been delivered!
|
|
375
|
+
|
|
376
|
+
Leave a review here: ${t}`;return {subject:r,html:i,text:a}}chunkBUNLC3II_cjs.h();function P(o,e="Customer",t){let r=`Refund Processed for Order #${o}`,s=`
|
|
377
|
+
<p class="email-text" style="margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: #52525b;">
|
|
378
|
+
Hi <strong class="email-strong" style="color: #09090b;">${e}</strong>,
|
|
379
|
+
</p>
|
|
380
|
+
<p class="email-text" style="margin: 0 0 20px; font-size: 14px; line-height: 1.6; color: #52525b;">
|
|
381
|
+
We have processed a refund for your order <strong>#${o}</strong>. It may take 3-5 business days for the funds to appear on your original payment method.
|
|
382
|
+
</p>
|
|
383
|
+
|
|
384
|
+
<table role="presentation" width="100%" border="0" cellspacing="0" cellpadding="0" class="email-table" style="background-color: #fafafa; border: 1px solid #e4e4e7; border-radius: 8px; margin-bottom: 24px; padding: 16px; border-collapse: separate;">
|
|
385
|
+
<tr>
|
|
386
|
+
<td style="font-size: 13px; color: #09090b; line-height: 1.6;" class="email-value">
|
|
387
|
+
\u{1F4B8} <strong>Refund Amount:</strong> ${t}
|
|
388
|
+
</td>
|
|
389
|
+
</tr>
|
|
390
|
+
</table>
|
|
391
|
+
`,i=l({title:"Refund Processed",previewText:`We have processed a refund of ${t} for order #${o}.`,badgeText:"Refunded",badgeType:"info",bodyHtml:s,ctaText:"View Store",ctaUrl:"https://kyro-cms.com"}),a=`Hi ${e},
|
|
392
|
+
|
|
393
|
+
We have processed a refund of ${t} for order #${o}.
|
|
394
|
+
|
|
395
|
+
View store: https://kyro-cms.com`;return {subject:r,html:i,text:a}}chunkBUNLC3II_cjs.h();function R(o="Customer",e){let t="You left something behind...",r=`
|
|
396
|
+
<p class="email-text" style="margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: #52525b;">
|
|
397
|
+
Hi <strong class="email-strong" style="color: #09090b;">${o}</strong>,
|
|
398
|
+
</p>
|
|
399
|
+
<p class="email-text" style="margin: 0 0 20px; font-size: 14px; line-height: 1.6; color: #52525b;">
|
|
400
|
+
We noticed you left some great items in your shopping cart. They are still waiting for you, but they might sell out soon!
|
|
401
|
+
</p>
|
|
402
|
+
`,s=l({title:"Complete Your Purchase",previewText:"Your shopping cart is waiting for you. Complete your purchase now.",badgeText:"Cart Reminder",badgeType:"warning",bodyHtml:r,ctaText:"Return to Checkout",ctaUrl:e}),i=`Hi ${o},
|
|
403
|
+
|
|
404
|
+
You left some items in your cart! Complete your purchase here: ${e}`;return {subject:t,html:s,text:i}}chunkBUNLC3II_cjs.h();function I(){return {verifyEmail:(o,e)=>b(o,e),resetPassword:(o,e)=>x(o,e),welcome:(o,e)=>_(o,e),passwordChanged:o=>S(o),magicLink:(o,e,t)=>T(o,e,t),accountLocked:(o,e,t)=>w(o,e,t),newLogin:(o,e,t)=>k(o,e,t),userInvite:(o,e,t)=>C(o,e,t),orderConfirmation:(o,e,t,r)=>v(o,e,t||"0.00",r),orderShipped:(o,e,t,r)=>E(o,e,t||"",r||""),orderDelivered:(o,e,t)=>A(o,e,t||""),orderRefunded:(o,e,t)=>P(o,e,t||"0.00"),abandonedCart:(o,e)=>R(o,e||"")}}chunkBUNLC3II_cjs.h();var K=false,y=class o{db;cache={};loaded=false;static SENSITIVE_KEYS=["storage.s3.secret_access_key","storage.r2.secret_access_key","storage.gcs.private_key","storage.backblaze.application_key","storage.wasabi.secret_access_key","storage.ftp.password","storage.bunny.api_key","storage.cloudinary.api_secret","storage.imgix.sign_key","email.smtp.pass","auth.jwt_secret","auth.github_secret","auth.google_secret","auth.app_secret","database.url","redis.url","auth.admin_password"];constructor(e){this.db=e;}async load(){if(!this.loaded){await this.ensureSettingsTable();try{if(typeof this.db?.select=="function"){let e=await this.db.select().from(chunkHPYH7GTS_cjs.a);this.cache=e.reduce((t,r)=>(t[r.key]=r.value,t),{});}await this.loadFromGlobals();}catch{console.warn("ConfigService: Could not load settings from database, using environment fallbacks.");}this.loaded=true;}}async ensureSettingsTable(){if(!K)try{if(typeof this.db?.execute=="function"){let{sql:e}=await import('./drizzle-orm-47ELDEM6.cjs');await this.db.execute(e`
|
|
286
405
|
CREATE TABLE IF NOT EXISTS "settings" (
|
|
287
406
|
"key" VARCHAR(255) PRIMARY KEY,
|
|
288
407
|
"value" TEXT NOT NULL,
|
|
289
408
|
"description" TEXT,
|
|
290
409
|
"updated_at" TIMESTAMP DEFAULT NOW()
|
|
291
410
|
)
|
|
292
|
-
`),
|
|
411
|
+
`),K=!0;}else typeof this.db?.exec=="function"&&(this.db.exec(`
|
|
293
412
|
CREATE TABLE IF NOT EXISTS settings (
|
|
294
413
|
key TEXT PRIMARY KEY,
|
|
295
414
|
value TEXT NOT NULL,
|
|
296
415
|
description TEXT,
|
|
297
416
|
updated_at TEXT
|
|
298
417
|
)
|
|
299
|
-
`),k=!0);}catch{}}async loadFromGlobals(){try{let e=null;if(typeof this.db?.findOne=="function")try{let s=await this.db.findOne({collection:"_globals_storage-settings",where:{},draft:!0});s&&(e=s);}catch{}if(!e&&typeof this.db?.execute=="function"){let{sql:s}=await import('./drizzle-orm-47ELDEM6.cjs'),o=['"_globals_storage-settings"','"_globals_storage_settings"','"global_storage_settings"'];for(let a of o)try{let n=await this.db.execute(s`SELECT * FROM ${s.raw(a)} LIMIT 1`);if(e=Array.isArray(n)?n[0]:n?.rows?n.rows[0]:null,e)break}catch{}}else if(!e&&typeof this.db?.prepare=="function"){let s=['"_globals_storage-settings"','"_globals_storage_settings"','"global_storage_settings"'];for(let o of s)try{if(e=this.db.prepare(`SELECT * FROM ${o} LIMIT 1`).get(),e)break}catch{}}if(!e)return;let t=s=>{if(!s)return null;if(typeof s=="string")try{return JSON.parse(s)}catch{return null}return s},r=e.provider||"local";if(this.cache["storage.type"]=r,r==="local"){let s=t(e.local);this.cache["storage.local.dir"]=s?.uploadDir||"./public/uploads",this.cache["storage.local.url"]=s?.baseUrl||"/uploads";}if(r==="aws"){let s=t(e.aws);this.cache["storage.s3.bucket"]=s?.bucket||"",this.cache["storage.s3.region"]=s?.region||"us-east-1",this.cache["storage.s3.access_key_id"]=s?.accessKeyId||"",this.cache["storage.s3.secret_access_key"]=s?.secretAccessKey||"",this.cache["storage.s3.endpoint"]=s?.endpoint||"",this.cache["storage.s3.cdn_url"]=s?.cdnUrl||"",this.cache["storage.s3.prefix"]=s?.prefix||"";}if(r==="r2"){let s=t(e.r2);this.cache["storage.r2.account_id"]=s?.accountId||"",this.cache["storage.r2.access_key_id"]=s?.accessKeyId||"",this.cache["storage.r2.secret_access_key"]=s?.secretAccessKey||"",this.cache["storage.r2.bucket"]=s?.bucket||"",this.cache["storage.r2.cdn_url"]=s?.cdnUrl||"",this.cache["storage.r2.prefix"]=s?.prefix||"";}if(r==="cloudinary"){let s=t(e.cloudinary);this.cache["storage.cloudinary.cloud_name"]=s?.cloudName||"",this.cache["storage.cloudinary.api_key"]=s?.apiKey||"",this.cache["storage.cloudinary.api_secret"]=s?.apiSecret||"",this.cache["storage.cloudinary.folder"]=s?.folder||"";}if(r==="ftp"){let s=t(e.ftp);this.cache["storage.ftp.host"]=s?.host||"",this.cache["storage.ftp.port"]=String(s?.port||"21"),this.cache["storage.ftp.user"]=s?.user||"",this.cache["storage.ftp.password"]=s?.password||"",this.cache["storage.ftp.secure"]=s?.secure?"true":"false",this.cache["storage.ftp.base_url"]=s?.baseUrl||"",this.cache["storage.ftp.prefix"]=s?.prefix||"";}}catch(e){console.warn("ConfigService: Could not load storage settings from globals table:",e);}try{let e=null;if(typeof this.db?.findOne=="function")try{let t=await this.db.findOne({collection:"_globals_email-settings",where:{},draft:!0});t&&(e=t);}catch{}if(!e&&typeof this.db?.execute=="function"){let{sql:t}=await import('./drizzle-orm-47ELDEM6.cjs'),r=['"_globals_email-settings"','"_globals_email_settings"','"global_email_settings"'];for(let s of r)try{let o=await this.db.execute(t`SELECT * FROM ${t.raw(s)} LIMIT 1`);if(e=Array.isArray(o)?o[0]:o?.rows?o.rows[0]:null,e)break}catch{}}else if(!e&&typeof this.db?.prepare=="function"){let t=['"_globals_email-settings"','"_globals_email_settings"','"global_email_settings"'];for(let r of t)try{if(e=this.db.prepare(`SELECT * FROM ${r} LIMIT 1`).get(),e)break}catch{}}if(e){let t=r=>{if(!r)return null;if(typeof r=="string")try{return JSON.parse(r)}catch{return null}return r};if(this.cache["email.provider"]=e.provider||"smtp",this.cache["email.smtp.from"]=e.fromEmail||"",this.cache["email.smtp.from_name"]=e.fromName||"",this.cache["email.smtp.reply_to"]=e.replyTo||"",e.provider==="smtp"){let r=t(e.smtp);this.cache["email.smtp.host"]=r?.host||"",this.cache["email.smtp.port"]=String(r?.port||"587"),this.cache["email.smtp.user"]=r?.username||"",this.cache["email.smtp.pass"]=r?.password||"",this.cache["email.smtp.secure"]=r?.secure?"true":"false";}else if(e.provider==="resend"){let r=t(e.resend);this.cache["email.smtp.pass"]=r?.apiKey||"";}else if(e.provider==="sendgrid"){let r=t(e.sendgrid);this.cache["email.smtp.pass"]=r?.apiKey||"";}else if(e.provider==="mailgun"){let r=t(e.mailgun);this.cache["email.smtp.pass"]=r?.apiKey||"";}else if(e.provider==="ses"){let r=t(e.ses);this.cache["email.smtp.user"]=r?.accessKeyId||"",this.cache["email.smtp.pass"]=r?.secretAccessKey||"";}}}catch(e){console.warn("ConfigService: Could not load email settings from globals table:",e);}}get(e,t,r){return this.cache[e]?this.cache[e]:t&&process.env[t]?process.env[t]:r}getStorageConfig(){let e="local";return typeof globalThis.STORAGE_BUCKET<"u"&&(e="cloudflare_r2"),{type:this.get("storage.type","STORAGE_TYPE",e),s3:{bucket:this.get("storage.s3.bucket","STORAGE_BUCKET"),region:this.get("storage.s3.region","STORAGE_REGION","us-east-1"),accessKeyId:this.get("storage.s3.access_key_id","STORAGE_ACCESS_KEY_ID"),secretAccessKey:this.get("storage.s3.secret_access_key","STORAGE_SECRET_ACCESS_KEY"),endpoint:this.get("storage.s3.endpoint","STORAGE_ENDPOINT"),cdnUrl:this.get("storage.s3.cdn_url","STORAGE_CDN_URL"),prefix:this.get("storage.s3.prefix","STORAGE_PREFIX")},r2:{accountId:this.get("storage.r2.account_id","R2_ACCOUNT_ID"),accessKeyId:this.get("storage.r2.access_key_id","R2_ACCESS_KEY_ID"),secretAccessKey:this.get("storage.r2.secret_access_key","R2_SECRET_ACCESS_KEY"),bucket:this.get("storage.r2.bucket","R2_BUCKET"),cdnUrl:this.get("storage.r2.cdn_url","R2_CDN_URL"),prefix:this.get("storage.r2.prefix","R2_PREFIX")},gcs:{bucket:this.get("storage.gcs.bucket","GCS_BUCKET"),projectId:this.get("storage.gcs.project_id","GCS_PROJECT_ID"),clientEmail:this.get("storage.gcs.client_email","GCS_CLIENT_EMAIL"),privateKey:this.get("storage.gcs.private_key","GCS_PRIVATE_KEY"),cdnUrl:this.get("storage.gcs.cdn_url","GCS_CDN_URL"),prefix:this.get("storage.gcs.prefix","GCS_PREFIX")},digitalocean:{bucket:this.get("storage.digitalocean.bucket","DO_BUCKET"),region:this.get("storage.digitalocean.region","DO_REGION","nyc3"),accessKeyId:this.get("storage.digitalocean.access_key_id","DO_ACCESS_KEY_ID"),secretAccessKey:this.get("storage.digitalocean.secret_access_key","DO_SECRET_ACCESS_KEY"),cdnUrl:this.get("storage.digitalocean.cdn_url","DO_CDN_URL"),prefix:this.get("storage.digitalocean.prefix","DO_PREFIX")},backblaze:{bucket:this.get("storage.backblaze.bucket","BB_BUCKET"),accountId:this.get("storage.backblaze.account_id","BB_ACCOUNT_ID"),applicationKeyId:this.get("storage.backblaze.application_key_id","BB_APPLICATION_KEY_ID"),applicationKey:this.get("storage.backblaze.application_key","BB_APPLICATION_KEY"),cdnUrl:this.get("storage.backblaze.cdn_url","BB_CDN_URL"),prefix:this.get("storage.backblaze.prefix","BB_PREFIX")},wasabi:{bucket:this.get("storage.wasabi.bucket","WASABI_BUCKET"),region:this.get("storage.wasabi.region","WASABI_REGION","us-east-1"),accessKeyId:this.get("storage.wasabi.access_key_id","WASABI_ACCESS_KEY_ID"),secretAccessKey:this.get("storage.wasabi.secret_access_key","WASABI_SECRET_ACCESS_KEY"),cdnUrl:this.get("storage.wasabi.cdn_url","WASABI_CDN_URL"),prefix:this.get("storage.wasabi.prefix","WASABI_PREFIX")},bunny:{storageZone:this.get("storage.bunny.storage_zone","BUNNY_STORAGE_ZONE"),apiKey:this.get("storage.bunny.api_key","BUNNY_API_KEY"),cdnUrl:this.get("storage.bunny.cdn_url","BUNNY_CDN_URL"),prefix:this.get("storage.bunny.prefix","BUNNY_PREFIX")},ftp:{host:this.get("storage.ftp.host","FTP_HOST"),port:parseInt(this.get("storage.ftp.port","FTP_PORT","21"),10),user:this.get("storage.ftp.user","FTP_USER"),password:this.get("storage.ftp.password","FTP_PASSWORD"),secure:this.get("storage.ftp.secure","FTP_SECURE")==="true",baseUrl:this.get("storage.ftp.base_url","FTP_BASE_URL"),prefix:this.get("storage.ftp.prefix","FTP_PREFIX")},cloudinary:{cloudName:this.get("storage.cloudinary.cloud_name","CLOUDINARY_CLOUD_NAME"),apiKey:this.get("storage.cloudinary.api_key","CLOUDINARY_API_KEY"),apiSecret:this.get("storage.cloudinary.api_secret","CLOUDINARY_API_SECRET"),folder:this.get("storage.cloudinary.folder","CLOUDINARY_FOLDER")},imgix:{domain:this.get("storage.imgix.domain","IMGIX_DOMAIN"),signKey:this.get("storage.imgix.sign_key","IMGIX_SIGN_KEY")},local:{uploadDir:this.get("storage.local.dir","STORAGE_LOCAL_DIR","./public/uploads"),baseUrl:this.get("storage.local.url","STORAGE_LOCAL_URL","/uploads")}}}getEmailConfig(){return {provider:this.get("email.provider","EMAIL_PROVIDER","smtp"),host:this.get("email.smtp.host","SMTP_HOST"),port:parseInt(this.get("email.smtp.port","SMTP_PORT","587"),10),secure:this.get("email.smtp.secure","SMTP_SECURE")==="true",user:this.get("email.smtp.user","SMTP_USER"),pass:this.get("email.smtp.pass","SMTP_PASS"),from:this.get("email.smtp.from","SMTP_FROM","noreply@example.com"),fromName:this.get("email.smtp.from_name","SMTP_FROM_NAME","Kyro CMS"),replyTo:this.get("email.smtp.reply_to","SMTP_REPLY_TO")}}maskSensitive(e,t){return t&&(i.SENSITIVE_KEYS.includes(e)?"********":t)}async set(e,t,r){await this.db.insert(chunkHPYH7GTS_cjs.a).values({key:e,value:t,description:r,updatedAt:new Date}).onConflictDoUpdate({target:[chunkHPYH7GTS_cjs.a.key],set:{value:t,description:r,updatedAt:new Date}}),this.cache[e]=t;}};chunkBUNLC3II_cjs.h();var v=class i{transporter;config;templates;transporterInitialized=false;constructor(e,t){this.config=e,this.templates={...E(),...t};}async ensureTransporter(){if(this.transporterInitialized)return this.transporter;let{default:e}=await import('./nodemailer-IDML4L6W.cjs');return this.config.provider==="smtp"&&this.config.smtp?this.transporter=e.createTransport({host:this.config.smtp.host,port:this.config.smtp.port,secure:this.config.smtp.secure,auth:this.config.smtp.auth}):this.config.provider==="ses"&&this.config.ses&&(this.transporter=e.createTransport({host:`email-smtp.${this.config.ses.region}.amazonaws.com`,port:587,secure:false,auth:{user:this.config.ses.accessKeyId,pass:this.config.ses.secretAccessKey}})),this.transporterInitialized=true,this.transporter}async send(e){let{provider:t,from:r,fromName:s,replyTo:o}=this.config,a=`"${s||"Kyro CMS"}" <${r}>`,n=e.replyTo||o;try{let l;switch(t){case "smtp":case "ses":{let p=await this.ensureTransporter();if(!p)throw new Error(`${t} transporter not initialized`);l=await p.sendMail({from:a,to:Array.isArray(e.to)?e.to.join(", "):e.to,subject:e.subject,html:e.html,text:e.text,replyTo:n});}break;case "resend":l=await this.sendViaResend(a,e,n);break;case "sendgrid":l=await this.sendViaSendGrid(a,e,n);break;case "mailgun":l=await this.sendViaMailgun(a,e,n);break;default:throw new Error(`Unsupported email provider: ${t}`)}return l}catch(l){throw console.error("[EmailTransport] FAILED to send email:",l.message),l.response&&console.error("[EmailTransport] Provider Error Detail:",JSON.stringify(l.response,null,2)),l}}async sendViaResend(e,t,r){let s=this.config.resend?.apiKey;if(!s)throw new Error("Resend API Key missing");let o={from:e,to:t.to,subject:t.subject,html:t.html,text:t.text,reply_to:r},a=await fetch("https://api.resend.com/emails",{method:"POST",headers:{Authorization:`Bearer ${s}`,"Content-Type":"application/json"},body:JSON.stringify(o)});if(!a.ok){let n=await a.json();throw new Error(`Resend Error: ${JSON.stringify(n)}`)}return a.json()}async sendViaSendGrid(e,t,r){let s=this.config.sendgrid?.apiKey;if(!s)throw new Error("SendGrid API Key missing");let o={personalizations:[{to:Array.isArray(t.to)?t.to.map(n=>({email:n})):[{email:t.to}]}],from:{email:e.match(/<(.+)>/)?.[1]||e,name:e.match(/"(.+)"/)?.[1]},subject:t.subject,content:[{type:"text/plain",value:t.text||""},{type:"text/html",value:t.html}],reply_to:r?{email:r}:void 0},a=await fetch("https://api.sendgrid.com/v3/mail/send",{method:"POST",headers:{Authorization:`Bearer ${s}`,"Content-Type":"application/json"},body:JSON.stringify(o)});if(!a.ok){let n=await a.json();throw new Error(`SendGrid Error: ${JSON.stringify(n)}`)}return {success:true}}async sendViaMailgun(e,t,r){let{apiKey:s,domain:o,region:a}=this.config.mailgun||{};if(!s||!o)throw new Error("Mailgun config missing");let n=a==="eu"?"api.eu.mailgun.net":"api.mailgun.net",l=btoa(`api:${s}`),p=new URLSearchParams;p.append("from",e);let f=Array.isArray(t.to)?t.to.join(", "):t.to;p.append("to",f),p.append("subject",t.subject),p.append("html",t.html),t.text&&p.append("text",t.text),r&&p.append("h:Reply-To",r);let m=await fetch(`https://${n}/v3/${o}/messages`,{method:"POST",headers:{Authorization:`Basic ${l}`,"Content-Type":"application/x-www-form-urlencoded"},body:p});if(!m.ok){let u=await m.json();throw new Error(`Mailgun Error: ${JSON.stringify(u)}`)}return m.json()}getTemplates(){return this.templates}async verifyConnection(){if(this.config.provider==="smtp"||this.config.provider==="ses")try{let e=await this.ensureTransporter();if(e)return await e.verify(),!0}catch{return false}return !!(this.config.resend?.apiKey||this.config.sendgrid?.apiKey||this.config.mailgun?.apiKey)}static async fromConfig(e){let t=new y(e);await t.load();let r=t.getEmailConfig();if(!r.provider)return this.fromEnv();let s={provider:r.provider||"smtp",from:r.from||"noreply@example.com",fromName:r.fromName,replyTo:r.replyTo,smtp:r.provider==="smtp"?{host:r.host||"",port:r.port||587,secure:r.secure||false,auth:{user:r.user||"",pass:r.pass||""}}:void 0,resend:r.provider==="resend"?{apiKey:r.pass||""}:void 0,sendgrid:r.provider==="sendgrid"?{apiKey:r.pass||""}:void 0,mailgun:r.provider==="mailgun"?{apiKey:r.pass||"",domain:r.host||"",region:r.secure?"eu":"us"}:void 0,ses:r.provider==="ses"?{accessKeyId:r.user||"",secretAccessKey:r.pass||"",region:r.host||"us-east-1"}:void 0};return new i(s)}static fromEnv(){let e=process.env.EMAIL_PROVIDER||"smtp",t=process.env.SMTP_FROM||process.env.DEFAULT_FROM||"noreply@example.com",r=process.env.SMTP_FROM_NAME||"Kyro CMS",s=process.env.SMTP_REPLY_TO;if(e==="smtp"){let o=process.env.SMTP_HOST,a=process.env.SMTP_USER,n=process.env.SMTP_PASS;return !o||!a||!n?null:new i({provider:"smtp",from:t,fromName:r,replyTo:s,smtp:{host:o,port:parseInt(process.env.SMTP_PORT||"587",10),secure:process.env.SMTP_SECURE==="true",auth:{user:a,pass:n}}})}if(e==="resend"){let o=process.env.RESEND_API_KEY||process.env.SMTP_PASS;return o?new i({provider:"resend",from:t,fromName:r,replyTo:s,resend:{apiKey:o}}):null}if(e==="sendgrid"){let o=process.env.SENDGRID_API_KEY||process.env.SMTP_PASS;return o?new i({provider:"sendgrid",from:t,fromName:r,replyTo:s,sendgrid:{apiKey:o}}):null}if(e==="mailgun"){let o=process.env.MAILGUN_API_KEY||process.env.SMTP_PASS,a=process.env.MAILGUN_DOMAIN||process.env.SMTP_HOST;return !o||!a?null:new i({provider:"mailgun",from:t,fromName:r,replyTo:s,mailgun:{apiKey:o,domain:a,region:process.env.MAILGUN_REGION||(process.env.SMTP_SECURE==="true"?"eu":"us")}})}if(e==="ses"){let o=process.env.AWS_ACCESS_KEY_ID||process.env.SMTP_USER,a=process.env.AWS_SECRET_ACCESS_KEY||process.env.SMTP_PASS,n=process.env.AWS_REGION||process.env.SMTP_HOST||"us-east-1";return !o||!a?null:new i({provider:"ses",from:t,fromName:r,replyTo:s,ses:{accessKeyId:o,secretAccessKey:a,region:n}})}return null}};chunkBUNLC3II_cjs.h();var P={minLength:12,requireUppercase:true,requireLowercase:true,requireNumbers:true,requireSpecialChars:true,preventReuse:5,maxLength:128},A=class{config;constructor(e={}){this.config={...P,...e};}validate(e){let t=[];return this.config.maxLength&&e.length>this.config.maxLength&&t.push(`Password must not exceed ${this.config.maxLength} characters`),e.length<this.config.minLength&&t.push(`Password must be at least ${this.config.minLength} characters`),this.config.requireUppercase&&!/[A-Z]/.test(e)&&t.push("Password must contain at least one uppercase letter"),this.config.requireLowercase&&!/[a-z]/.test(e)&&t.push("Password must contain at least one lowercase letter"),this.config.requireNumbers&&!/[0-9]/.test(e)&&t.push("Password must contain at least one number"),this.config.requireSpecialChars&&!/[!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/.test(e)&&t.push("Password must contain at least one special character"),["password","123456","12345678","qwerty","abc123","monkey","1234567","letmein","trustno1","dragon","baseball","iloveyou","master","sunshine","ashley","football","password1","shadow","123123","654321"].includes(e.toLowerCase())&&t.push("This password is too common. Please choose a more secure password"),(/^[a-zA-Z]+$/.test(e)||/^[0-9]+$/.test(e))&&t.push("Password must contain a mix of letters, numbers, and/or special characters"),/(.)\1{2,}/.test(e)&&t.push("Password must not contain more than 2 consecutive identical characters"),/^(012|123|234|345|456|567|678|789|890|098|987|876|765|654|543|432|321|210)+$/i.test(e)&&t.push("Password must not contain sequential numbers or letters"),{valid:t.length===0,errors:t}}async checkReuse(e,t,r){return {valid:true,errors:[]}}async isInHistory(e,t,r){for(let s of t)if(await r(e,s))return true;return false}generatePassword(e=16){let t="ABCDEFGHIJKLMNOPQRSTUVWXYZ",r="abcdefghijklmnopqrstuvwxyz",s="0123456789",o="!@#$%^&*()_+-=[]{}|;:,.<>?",a="";a+=t[Math.floor(Math.random()*t.length)],a+=r[Math.floor(Math.random()*r.length)],a+=s[Math.floor(Math.random()*s.length)],a+=o[Math.floor(Math.random()*o.length)];let n=t+r+s+o;for(let l=a.length;l<e;l++)a+=n[Math.floor(Math.random()*n.length)];return a.split("").sort(()=>Math.random()-.5).join("")}getStrength(e){let t=0,r=[];e.length>=8&&(t+=1),e.length>=12&&(t+=1),e.length>=16&&(t+=1),/[a-z]/.test(e)&&(t+=1),/[A-Z]/.test(e)&&(t+=1),/[0-9]/.test(e)&&(t+=1),/[!@#$%^&*()_+\-=\[\]{}|;:,.<>?]/.test(e)&&(t+=1),e.length>8&&(t+=1),e.length>12&&(t+=1);let s=new Set(e).size;s>6&&(t+=1),s>10&&(t+=1);let o;return t<=3?(o="Weak",r.push("Add more characters"),r.push("Include uppercase and lowercase letters")):t<=5?(o="Fair",r.push("Add special characters"),r.push("Consider making it longer")):t<=7?(o="Good",r.push("Consider making it longer for extra security")):o="Strong",{score:t,label:o,feedback:r}}setConfig(e){this.config={...this.config,...e};}getConfig(){return {...this.config}}};
|
|
300
|
-
exports.a=
|
|
418
|
+
`),K=!0);}catch{}}async loadFromGlobals(){try{let e=null;if(typeof this.db?.findOne=="function")try{let s=await this.db.findOne({collection:"_globals_storage-settings",where:{},draft:!0});s&&(e=s);}catch{}if(!e&&typeof this.db?.execute=="function"){let{sql:s}=await import('./drizzle-orm-47ELDEM6.cjs'),i=['"_globals_storage-settings"','"_globals_storage_settings"','"global_storage_settings"'];for(let a of i)try{let c=await this.db.execute(s`SELECT * FROM ${s.raw(a)} LIMIT 1`);if(e=Array.isArray(c)?c[0]:c?.rows?c.rows[0]:null,e)break}catch{}}else if(!e&&typeof this.db?.prepare=="function"){let s=['"_globals_storage-settings"','"_globals_storage_settings"','"global_storage_settings"'];for(let i of s)try{if(e=this.db.prepare(`SELECT * FROM ${i} LIMIT 1`).get(),e)break}catch{}}if(!e)return;let t=s=>{if(!s)return null;if(typeof s=="string")try{return JSON.parse(s)}catch{return null}return s},r=e.provider||"local";if(this.cache["storage.type"]=r,r==="local"){let s=t(e.local);this.cache["storage.local.dir"]=s?.uploadDir||"./public/uploads",this.cache["storage.local.url"]=s?.baseUrl||"/uploads";}if(r==="aws"){let s=t(e.aws);this.cache["storage.s3.bucket"]=s?.bucket||"",this.cache["storage.s3.region"]=s?.region||"us-east-1",this.cache["storage.s3.access_key_id"]=s?.accessKeyId||"",this.cache["storage.s3.secret_access_key"]=s?.secretAccessKey||"",this.cache["storage.s3.endpoint"]=s?.endpoint||"",this.cache["storage.s3.cdn_url"]=s?.cdnUrl||"",this.cache["storage.s3.prefix"]=s?.prefix||"";}if(r==="r2"){let s=t(e.r2);this.cache["storage.r2.account_id"]=s?.accountId||"",this.cache["storage.r2.access_key_id"]=s?.accessKeyId||"",this.cache["storage.r2.secret_access_key"]=s?.secretAccessKey||"",this.cache["storage.r2.bucket"]=s?.bucket||"",this.cache["storage.r2.cdn_url"]=s?.cdnUrl||"",this.cache["storage.r2.prefix"]=s?.prefix||"";}if(r==="cloudinary"){let s=t(e.cloudinary);this.cache["storage.cloudinary.cloud_name"]=s?.cloudName||"",this.cache["storage.cloudinary.api_key"]=s?.apiKey||"",this.cache["storage.cloudinary.api_secret"]=s?.apiSecret||"",this.cache["storage.cloudinary.folder"]=s?.folder||"";}if(r==="ftp"){let s=t(e.ftp);this.cache["storage.ftp.host"]=s?.host||"",this.cache["storage.ftp.port"]=String(s?.port||"21"),this.cache["storage.ftp.user"]=s?.user||"",this.cache["storage.ftp.password"]=s?.password||"",this.cache["storage.ftp.secure"]=s?.secure?"true":"false",this.cache["storage.ftp.base_url"]=s?.baseUrl||"",this.cache["storage.ftp.prefix"]=s?.prefix||"";}}catch(e){console.warn("ConfigService: Could not load storage settings from globals table:",e);}try{let e=null;if(typeof this.db?.findOne=="function")try{let t=await this.db.findOne({collection:"_globals_email-settings",where:{},draft:!0});t&&(e=t);}catch{}if(!e&&typeof this.db?.execute=="function"){let{sql:t}=await import('./drizzle-orm-47ELDEM6.cjs'),r=['"_globals_email-settings"','"_globals_email_settings"','"global_email_settings"'];for(let s of r)try{let i=await this.db.execute(t`SELECT * FROM ${t.raw(s)} LIMIT 1`);if(e=Array.isArray(i)?i[0]:i?.rows?i.rows[0]:null,e)break}catch{}}else if(!e&&typeof this.db?.prepare=="function"){let t=['"_globals_email-settings"','"_globals_email_settings"','"global_email_settings"'];for(let r of t)try{if(e=this.db.prepare(`SELECT * FROM ${r} LIMIT 1`).get(),e)break}catch{}}if(e){let t=r=>{if(!r)return null;if(typeof r=="string")try{return JSON.parse(r)}catch{return null}return r};if(this.cache["email.provider"]=e.provider||"smtp",this.cache["email.smtp.from"]=e.fromEmail||"",this.cache["email.smtp.from_name"]=e.fromName||"",this.cache["email.smtp.reply_to"]=e.replyTo||"",e.provider==="smtp"){let r=t(e.smtp);this.cache["email.smtp.host"]=r?.host||"",this.cache["email.smtp.port"]=String(r?.port||"587"),this.cache["email.smtp.user"]=r?.username||"",this.cache["email.smtp.pass"]=r?.password||"",this.cache["email.smtp.secure"]=r?.secure?"true":"false";}else if(e.provider==="resend"){let r=t(e.resend);this.cache["email.smtp.pass"]=r?.apiKey||"";}else if(e.provider==="sendgrid"){let r=t(e.sendgrid);this.cache["email.smtp.pass"]=r?.apiKey||"";}else if(e.provider==="mailgun"){let r=t(e.mailgun);this.cache["email.smtp.pass"]=r?.apiKey||"";}else if(e.provider==="ses"){let r=t(e.ses);this.cache["email.smtp.user"]=r?.accessKeyId||"",this.cache["email.smtp.pass"]=r?.secretAccessKey||"";}}}catch(e){console.warn("ConfigService: Could not load email settings from globals table:",e);}}get(e,t,r){return this.cache[e]?this.cache[e]:t&&process.env[t]?process.env[t]:r}getStorageConfig(){let e="local";return typeof globalThis.STORAGE_BUCKET<"u"&&(e="cloudflare_r2"),{type:this.get("storage.type","STORAGE_TYPE",e),s3:{bucket:this.get("storage.s3.bucket","STORAGE_BUCKET"),region:this.get("storage.s3.region","STORAGE_REGION","us-east-1"),accessKeyId:this.get("storage.s3.access_key_id","STORAGE_ACCESS_KEY_ID"),secretAccessKey:this.get("storage.s3.secret_access_key","STORAGE_SECRET_ACCESS_KEY"),endpoint:this.get("storage.s3.endpoint","STORAGE_ENDPOINT"),cdnUrl:this.get("storage.s3.cdn_url","STORAGE_CDN_URL"),prefix:this.get("storage.s3.prefix","STORAGE_PREFIX")},r2:{accountId:this.get("storage.r2.account_id","R2_ACCOUNT_ID"),accessKeyId:this.get("storage.r2.access_key_id","R2_ACCESS_KEY_ID"),secretAccessKey:this.get("storage.r2.secret_access_key","R2_SECRET_ACCESS_KEY"),bucket:this.get("storage.r2.bucket","R2_BUCKET"),cdnUrl:this.get("storage.r2.cdn_url","R2_CDN_URL"),prefix:this.get("storage.r2.prefix","R2_PREFIX")},gcs:{bucket:this.get("storage.gcs.bucket","GCS_BUCKET"),projectId:this.get("storage.gcs.project_id","GCS_PROJECT_ID"),clientEmail:this.get("storage.gcs.client_email","GCS_CLIENT_EMAIL"),privateKey:this.get("storage.gcs.private_key","GCS_PRIVATE_KEY"),cdnUrl:this.get("storage.gcs.cdn_url","GCS_CDN_URL"),prefix:this.get("storage.gcs.prefix","GCS_PREFIX")},digitalocean:{bucket:this.get("storage.digitalocean.bucket","DO_BUCKET"),region:this.get("storage.digitalocean.region","DO_REGION","nyc3"),accessKeyId:this.get("storage.digitalocean.access_key_id","DO_ACCESS_KEY_ID"),secretAccessKey:this.get("storage.digitalocean.secret_access_key","DO_SECRET_ACCESS_KEY"),cdnUrl:this.get("storage.digitalocean.cdn_url","DO_CDN_URL"),prefix:this.get("storage.digitalocean.prefix","DO_PREFIX")},backblaze:{bucket:this.get("storage.backblaze.bucket","BB_BUCKET"),accountId:this.get("storage.backblaze.account_id","BB_ACCOUNT_ID"),applicationKeyId:this.get("storage.backblaze.application_key_id","BB_APPLICATION_KEY_ID"),applicationKey:this.get("storage.backblaze.application_key","BB_APPLICATION_KEY"),cdnUrl:this.get("storage.backblaze.cdn_url","BB_CDN_URL"),prefix:this.get("storage.backblaze.prefix","BB_PREFIX")},wasabi:{bucket:this.get("storage.wasabi.bucket","WASABI_BUCKET"),region:this.get("storage.wasabi.region","WASABI_REGION","us-east-1"),accessKeyId:this.get("storage.wasabi.access_key_id","WASABI_ACCESS_KEY_ID"),secretAccessKey:this.get("storage.wasabi.secret_access_key","WASABI_SECRET_ACCESS_KEY"),cdnUrl:this.get("storage.wasabi.cdn_url","WASABI_CDN_URL"),prefix:this.get("storage.wasabi.prefix","WASABI_PREFIX")},bunny:{storageZone:this.get("storage.bunny.storage_zone","BUNNY_STORAGE_ZONE"),apiKey:this.get("storage.bunny.api_key","BUNNY_API_KEY"),cdnUrl:this.get("storage.bunny.cdn_url","BUNNY_CDN_URL"),prefix:this.get("storage.bunny.prefix","BUNNY_PREFIX")},ftp:{host:this.get("storage.ftp.host","FTP_HOST"),port:parseInt(this.get("storage.ftp.port","FTP_PORT","21"),10),user:this.get("storage.ftp.user","FTP_USER"),password:this.get("storage.ftp.password","FTP_PASSWORD"),secure:this.get("storage.ftp.secure","FTP_SECURE")==="true",baseUrl:this.get("storage.ftp.base_url","FTP_BASE_URL"),prefix:this.get("storage.ftp.prefix","FTP_PREFIX")},cloudinary:{cloudName:this.get("storage.cloudinary.cloud_name","CLOUDINARY_CLOUD_NAME"),apiKey:this.get("storage.cloudinary.api_key","CLOUDINARY_API_KEY"),apiSecret:this.get("storage.cloudinary.api_secret","CLOUDINARY_API_SECRET"),folder:this.get("storage.cloudinary.folder","CLOUDINARY_FOLDER")},imgix:{domain:this.get("storage.imgix.domain","IMGIX_DOMAIN"),signKey:this.get("storage.imgix.sign_key","IMGIX_SIGN_KEY")},local:{uploadDir:this.get("storage.local.dir","STORAGE_LOCAL_DIR","./public/uploads"),baseUrl:this.get("storage.local.url","STORAGE_LOCAL_URL","/uploads")}}}getEmailConfig(){return {provider:this.get("email.provider","EMAIL_PROVIDER","smtp"),host:this.get("email.smtp.host","SMTP_HOST"),port:parseInt(this.get("email.smtp.port","SMTP_PORT","587"),10),secure:this.get("email.smtp.secure","SMTP_SECURE")==="true",user:this.get("email.smtp.user","SMTP_USER"),pass:this.get("email.smtp.pass","SMTP_PASS"),from:this.get("email.smtp.from","SMTP_FROM","noreply@example.com"),fromName:this.get("email.smtp.from_name","SMTP_FROM_NAME","Kyro CMS"),replyTo:this.get("email.smtp.reply_to","SMTP_REPLY_TO")}}maskSensitive(e,t){return t&&(o.SENSITIVE_KEYS.includes(e)?"********":t)}async set(e,t,r){await this.db.insert(chunkHPYH7GTS_cjs.a).values({key:e,value:t,description:r,updatedAt:new Date}).onConflictDoUpdate({target:[chunkHPYH7GTS_cjs.a.key],set:{value:t,description:r,updatedAt:new Date}}),this.cache[e]=t;}};chunkBUNLC3II_cjs.h();var O=class o{transporter;config;templates;transporterInitialized=false;constructor(e,t){this.config=e,this.templates={...I(),...t};}async ensureTransporter(){if(this.transporterInitialized)return this.transporter;let{default:e}=await import('./nodemailer-IDML4L6W.cjs');return this.config.provider==="smtp"&&this.config.smtp?this.transporter=e.createTransport({host:this.config.smtp.host,port:this.config.smtp.port,secure:this.config.smtp.secure,auth:this.config.smtp.auth}):this.config.provider==="ses"&&this.config.ses&&(this.transporter=e.createTransport({host:`email-smtp.${this.config.ses.region}.amazonaws.com`,port:587,secure:false,auth:{user:this.config.ses.accessKeyId,pass:this.config.ses.secretAccessKey}})),this.transporterInitialized=true,this.transporter}async send(e){let{provider:t,from:r,fromName:s,replyTo:i}=this.config,a=`"${s||"Kyro CMS"}" <${r}>`,c=e.replyTo||i;try{let g;switch(t){case "smtp":case "ses":{let p=await this.ensureTransporter();if(!p)throw new Error(`${t} transporter not initialized`);g=await p.sendMail({from:a,to:Array.isArray(e.to)?e.to.join(", "):e.to,subject:e.subject,html:e.html,text:e.text,replyTo:c});}break;case "resend":g=await this.sendViaResend(a,e,c);break;case "sendgrid":g=await this.sendViaSendGrid(a,e,c);break;case "mailgun":g=await this.sendViaMailgun(a,e,c);break;default:throw new Error(`Unsupported email provider: ${t}`)}return g}catch(g){throw console.error("[EmailTransport] FAILED to send email:",g.message),g.response&&console.error("[EmailTransport] Provider Error Detail:",JSON.stringify(g.response,null,2)),g}}async sendViaResend(e,t,r){let s=this.config.resend?.apiKey;if(!s)throw new Error("Resend API Key missing");let i={from:e,to:t.to,subject:t.subject,html:t.html,text:t.text,reply_to:r},a=await fetch("https://api.resend.com/emails",{method:"POST",headers:{Authorization:`Bearer ${s}`,"Content-Type":"application/json"},body:JSON.stringify(i)});if(!a.ok){let c=await a.json();throw new Error(`Resend Error: ${JSON.stringify(c)}`)}return a.json()}async sendViaSendGrid(e,t,r){let s=this.config.sendgrid?.apiKey;if(!s)throw new Error("SendGrid API Key missing");let i={personalizations:[{to:Array.isArray(t.to)?t.to.map(c=>({email:c})):[{email:t.to}]}],from:{email:e.match(/<(.+)>/)?.[1]||e,name:e.match(/"(.+)"/)?.[1]},subject:t.subject,content:[{type:"text/plain",value:t.text||""},{type:"text/html",value:t.html}],reply_to:r?{email:r}:void 0},a=await fetch("https://api.sendgrid.com/v3/mail/send",{method:"POST",headers:{Authorization:`Bearer ${s}`,"Content-Type":"application/json"},body:JSON.stringify(i)});if(!a.ok){let c=await a.json();throw new Error(`SendGrid Error: ${JSON.stringify(c)}`)}return {success:true}}async sendViaMailgun(e,t,r){let{apiKey:s,domain:i,region:a}=this.config.mailgun||{};if(!s||!i)throw new Error("Mailgun config missing");let c=a==="eu"?"api.eu.mailgun.net":"api.mailgun.net",g=btoa(`api:${s}`),p=new URLSearchParams;p.append("from",e);let u=Array.isArray(t.to)?t.to.join(", "):t.to;p.append("to",u),p.append("subject",t.subject),p.append("html",t.html),t.text&&p.append("text",t.text),r&&p.append("h:Reply-To",r);let m=await fetch(`https://${c}/v3/${i}/messages`,{method:"POST",headers:{Authorization:`Basic ${g}`,"Content-Type":"application/x-www-form-urlencoded"},body:p});if(!m.ok){let f=await m.json();throw new Error(`Mailgun Error: ${JSON.stringify(f)}`)}return m.json()}getTemplates(){return this.templates}async verifyConnection(){if(this.config.provider==="smtp"||this.config.provider==="ses")try{let e=await this.ensureTransporter();if(e)return await e.verify(),!0}catch{return false}return !!(this.config.resend?.apiKey||this.config.sendgrid?.apiKey||this.config.mailgun?.apiKey)}static async fromConfig(e){let t=new y(e);await t.load();let r=t.getEmailConfig();if(!r.provider)return this.fromEnv();let s={provider:r.provider||"smtp",from:r.from||"noreply@example.com",fromName:r.fromName,replyTo:r.replyTo,smtp:r.provider==="smtp"?{host:r.host||"",port:r.port||587,secure:r.secure||false,auth:{user:r.user||"",pass:r.pass||""}}:void 0,resend:r.provider==="resend"?{apiKey:r.pass||""}:void 0,sendgrid:r.provider==="sendgrid"?{apiKey:r.pass||""}:void 0,mailgun:r.provider==="mailgun"?{apiKey:r.pass||"",domain:r.host||"",region:r.secure?"eu":"us"}:void 0,ses:r.provider==="ses"?{accessKeyId:r.user||"",secretAccessKey:r.pass||"",region:r.host||"us-east-1"}:void 0};return new o(s)}static fromEnv(){let e=process.env.EMAIL_PROVIDER||"smtp",t=process.env.SMTP_FROM||process.env.DEFAULT_FROM||"noreply@example.com",r=process.env.SMTP_FROM_NAME||"Kyro CMS",s=process.env.SMTP_REPLY_TO;if(e==="smtp"){let i=process.env.SMTP_HOST,a=process.env.SMTP_USER,c=process.env.SMTP_PASS;return !i||!a||!c?null:new o({provider:"smtp",from:t,fromName:r,replyTo:s,smtp:{host:i,port:parseInt(process.env.SMTP_PORT||"587",10),secure:process.env.SMTP_SECURE==="true",auth:{user:a,pass:c}}})}if(e==="resend"){let i=process.env.RESEND_API_KEY||process.env.SMTP_PASS;return i?new o({provider:"resend",from:t,fromName:r,replyTo:s,resend:{apiKey:i}}):null}if(e==="sendgrid"){let i=process.env.SENDGRID_API_KEY||process.env.SMTP_PASS;return i?new o({provider:"sendgrid",from:t,fromName:r,replyTo:s,sendgrid:{apiKey:i}}):null}if(e==="mailgun"){let i=process.env.MAILGUN_API_KEY||process.env.SMTP_PASS,a=process.env.MAILGUN_DOMAIN||process.env.SMTP_HOST;return !i||!a?null:new o({provider:"mailgun",from:t,fromName:r,replyTo:s,mailgun:{apiKey:i,domain:a,region:process.env.MAILGUN_REGION||(process.env.SMTP_SECURE==="true"?"eu":"us")}})}if(e==="ses"){let i=process.env.AWS_ACCESS_KEY_ID||process.env.SMTP_USER,a=process.env.AWS_SECRET_ACCESS_KEY||process.env.SMTP_PASS,c=process.env.AWS_REGION||process.env.SMTP_HOST||"us-east-1";return !i||!a?null:new o({provider:"ses",from:t,fromName:r,replyTo:s,ses:{accessKeyId:i,secretAccessKey:a,region:c}})}return null}};chunkBUNLC3II_cjs.h();var M={minLength:12,requireUppercase:true,requireLowercase:true,requireNumbers:true,requireSpecialChars:true,preventReuse:5,maxLength:128},$=class{config;constructor(e={}){this.config={...M,...e};}validate(e){let t=[];return this.config.maxLength&&e.length>this.config.maxLength&&t.push(`Password must not exceed ${this.config.maxLength} characters`),e.length<this.config.minLength&&t.push(`Password must be at least ${this.config.minLength} characters`),this.config.requireUppercase&&!/[A-Z]/.test(e)&&t.push("Password must contain at least one uppercase letter"),this.config.requireLowercase&&!/[a-z]/.test(e)&&t.push("Password must contain at least one lowercase letter"),this.config.requireNumbers&&!/[0-9]/.test(e)&&t.push("Password must contain at least one number"),this.config.requireSpecialChars&&!/[!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/.test(e)&&t.push("Password must contain at least one special character"),["password","123456","12345678","qwerty","abc123","monkey","1234567","letmein","trustno1","dragon","baseball","iloveyou","master","sunshine","ashley","football","password1","shadow","123123","654321"].includes(e.toLowerCase())&&t.push("This password is too common. Please choose a more secure password"),(/^[a-zA-Z]+$/.test(e)||/^[0-9]+$/.test(e))&&t.push("Password must contain a mix of letters, numbers, and/or special characters"),/(.)\1{2,}/.test(e)&&t.push("Password must not contain more than 2 consecutive identical characters"),/^(012|123|234|345|456|567|678|789|890|098|987|876|765|654|543|432|321|210)+$/i.test(e)&&t.push("Password must not contain sequential numbers or letters"),{valid:t.length===0,errors:t}}async checkReuse(e,t,r){return {valid:true,errors:[]}}async isInHistory(e,t,r){for(let s of t)if(await r(e,s))return true;return false}generatePassword(e=16){let t="ABCDEFGHIJKLMNOPQRSTUVWXYZ",r="abcdefghijklmnopqrstuvwxyz",s="0123456789",i="!@#$%^&*()_+-=[]{}|;:,.<>?",a="";a+=t[Math.floor(Math.random()*t.length)],a+=r[Math.floor(Math.random()*r.length)],a+=s[Math.floor(Math.random()*s.length)],a+=i[Math.floor(Math.random()*i.length)];let c=t+r+s+i;for(let g=a.length;g<e;g++)a+=c[Math.floor(Math.random()*c.length)];return a.split("").sort(()=>Math.random()-.5).join("")}getStrength(e){let t=0,r=[];e.length>=8&&(t+=1),e.length>=12&&(t+=1),e.length>=16&&(t+=1),/[a-z]/.test(e)&&(t+=1),/[A-Z]/.test(e)&&(t+=1),/[0-9]/.test(e)&&(t+=1),/[!@#$%^&*()_+\-=\[\]{}|;:,.<>?]/.test(e)&&(t+=1),e.length>8&&(t+=1),e.length>12&&(t+=1);let s=new Set(e).size;s>6&&(t+=1),s>10&&(t+=1);let i;return t<=3?(i="Weak",r.push("Add more characters"),r.push("Include uppercase and lowercase letters")):t<=5?(i="Fair",r.push("Add special characters"),r.push("Consider making it longer")):t<=7?(i="Good",r.push("Consider making it longer for extra security")):i="Strong",{score:t,label:i,feedback:r}}setConfig(e){this.config={...this.config,...e};}getConfig(){return {...this.config}}};
|
|
419
|
+
exports.a=l;exports.b=b;exports.c=x;exports.d=_;exports.e=S;exports.f=T;exports.g=w;exports.h=C;exports.i=k;exports.j=v;exports.k=E;exports.l=A;exports.m=P;exports.n=R;exports.o=I;exports.p=y;exports.q=O;exports.r=$;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunkXYICMRHL_cjs=require('./chunk-XYICMRHL.cjs'),chunk754DLK7M_cjs=require('./chunk-754DLK7M.cjs'),chunkRYTA4NYP_cjs=require('./chunk-RYTA4NYP.cjs'),chunkBHR7OAU4_cjs=require('./chunk-BHR7OAU4.cjs'),chunk6KUL2BSA_cjs=require('./chunk-6KUL2BSA.cjs'),chunkXBQ6HV3T_cjs=require('./chunk-XBQ6HV3T.cjs'),chunkWJBQ2NBD_cjs=require('./chunk-WJBQ2NBD.cjs'),chunkBUNLC3II_cjs=require('./chunk-BUNLC3II.cjs'),w=require('kyro:config');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var w__default=/*#__PURE__*/_interopDefault(w);chunkBUNLC3II_cjs.h();exports.a=null;var l=null;async function b(){if(!exports.a){if(globalThis.__KYRO_INSTANCE__)try{await globalThis.__KYRO_INSTANCE__.shutdown();}catch{}try{let e=w__default.default.default||w__default.default,t=e.adapter,o=t&&!t.dialect&&typeof t.connect=="function";if(globalThis.DB&&(!t||o)){let s=globalThis.DB;e.adapter=new chunk6KUL2BSA_cjs.c({type:"sqlite",client:s}),chunkXYICMRHL_cjs.D.info("Hot-swapped to D1 DrizzleAdapter");}exports.a=chunkXYICMRHL_cjs.A(e),await exports.a.init();let a=e.adapter,p=a&&a.dialect&&(a.dialect==="postgres"||a.dialect==="sqlite"),c=a&&a.dialect==="mongodb",n;if(p)a.dialect==="postgres"?n=new chunkXBQ6HV3T_cjs.a({db:a.client}):a.dialect==="sqlite"&&(n=new chunkRYTA4NYP_cjs.fb({db:a.rawClient||a.client}));else if(o&&!globalThis.DB){let s=process.env.KYRO_AUTH_DB_PATH||"./data/auth.db";n=new chunkBHR7OAU4_cjs.a({path:s});}else c&&(n=new chunkWJBQ2NBD_cjs.a({adapter:a}));if(n?.connect)try{await n.connect();}catch(s){chunkXYICMRHL_cjs.D.warn("Auth connect warning:",s);}try{await exports.a.loadSettings();}catch(s){chunkXYICMRHL_cjs.D.warn("loadSettings warning:",s);}try{await chunk754DLK7M_cjs.e(n);}catch(s){chunkXYICMRHL_cjs.D.warn("autoBootstrap warning:",s);}globalThis.__KYRO_INSTANCE__=exports.a;}catch(e){throw exports.a=null,l=null,chunkXYICMRHL_cjs.D.error("Init failed, will retry:",e),e}}}async function E(e){let t=globalThis.DB?globalThis:null;try{let{env:o}=await import('cloudflare:workers');o&&(t=o);}catch{}if(e)try{t=e.locals?.cfContext?.env||e?.env||t;}catch{}if(!t)try{t=process.env;}catch{}t?.DB&&(globalThis.DB=t.DB),t?.STORAGE_BUCKET&&(globalThis.STORAGE_BUCKET=t.STORAGE_BUCKET),l||(l=b()),await l;}var _={graphqlEnabled:false,trpcEnabled:false,wsEnabled:false,requireAuth:false};function T(e){return exports.a?exports.a.settings?.access?.apiAccess?.[e]??_[e]??true:_[e]??true}var R=async e=>{if(!exports.a)try{await Promise.race([E(e),new Promise((t,o)=>setTimeout(()=>o(new Error("Initialization timeout")),3e4))]);}catch(t){return console.error("[Kyro API] Warm error:",t?.stack||t?.message||t),new Response(JSON.stringify({error:"Service Unavailable",message:"Kyro CMS is still starting up. Please try again in a moment."}),{status:503,headers:{"Content-Type":"application/json","Retry-After":"5"}})}try{let o=new URL(e.request.url).pathname,a=__KYRO_API_PATH__;if(o===`${a}/graphql`&&typeof exports.a.getGraphQL=="function"){if(!T("graphqlEnabled"))return new Response(JSON.stringify({error:"GraphQL is disabled"}),{status:503,headers:{"Content-Type":"application/json"}});let n=await exports.a.getGraphQL().fetch(e.request,e.locals);return new Response(n.body,n)}if(o.startsWith(`${a}/trpc/`)&&typeof exports.a.getTRPC=="function"){if(!T("trpcEnabled"))return new Response(JSON.stringify({error:"tRPC is disabled"}),{status:503,headers:{"Content-Type":"application/json"}});let n=await exports.a.getTRPC().fetch(e.request,e.locals);return new Response(n.body,n)}return await(await exports.a.getREST()).fetch(e.request,e.locals)}catch(t){return console.error("[Kyro API Execution Error]:",t?.stack||t?.message||t),new Response(JSON.stringify({error:"Internal Server Error",message:t?.message||String(t),stack:t?.stack}),{status:500,headers:{"Content-Type":"application/json"}})}},L=R;exports.b=E;exports.c=R;exports.d=L;
|