@infuro/cms-core 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/admin.cjs +3 -3
- package/dist/admin.cjs.map +1 -1
- package/dist/admin.js +3 -3
- package/dist/admin.js.map +1 -1
- package/dist/index.cjs +16 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +16 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -133,8 +133,12 @@ async function createCmsApp(options) {
|
|
|
133
133
|
const context = { dataSource, config, logger };
|
|
134
134
|
const registry = /* @__PURE__ */ new Map();
|
|
135
135
|
for (const plugin of plugins) {
|
|
136
|
-
|
|
137
|
-
|
|
136
|
+
try {
|
|
137
|
+
const instance = await plugin.init(context);
|
|
138
|
+
registry.set(plugin.name, instance !== void 0 ? instance : plugin);
|
|
139
|
+
} catch (err) {
|
|
140
|
+
logger.warn(`Plugin "${plugin.name}" failed to init: ${err instanceof Error ? err.message : err}`);
|
|
141
|
+
}
|
|
138
142
|
}
|
|
139
143
|
return {
|
|
140
144
|
dataSource,
|
|
@@ -373,17 +377,26 @@ function emailPlugin(config) {
|
|
|
373
377
|
async init(context) {
|
|
374
378
|
const from = config.from || context.config.SMTP_FROM || "no-reply@example.com";
|
|
375
379
|
const to = config.to || context.config.SMTP_TO || "info@example.com";
|
|
380
|
+
const type = config.type || context.config.SMTP_TYPE || "SMTP";
|
|
376
381
|
const merged = {
|
|
377
382
|
...config,
|
|
378
383
|
from,
|
|
379
384
|
to,
|
|
380
|
-
type
|
|
385
|
+
type,
|
|
381
386
|
user: config.user ?? context.config.SMTP_USER,
|
|
382
387
|
password: config.password ?? context.config.SMTP_PASSWORD,
|
|
383
388
|
region: config.region ?? context.config.AWS_REGION,
|
|
384
389
|
accessKeyId: config.accessKeyId ?? context.config.AWS_ACCESS_KEY_ID,
|
|
385
390
|
secretAccessKey: config.secretAccessKey ?? context.config.AWS_SECRET_ACCESS_KEY
|
|
386
391
|
};
|
|
392
|
+
if (type === "AWS" && (!merged.region || !merged.accessKeyId || !merged.secretAccessKey)) {
|
|
393
|
+
context.logger.warn("Email plugin skipped: AWS SES configuration incomplete");
|
|
394
|
+
return void 0;
|
|
395
|
+
}
|
|
396
|
+
if ((type === "SMTP" || type === "GMAIL") && (!merged.user || !merged.password)) {
|
|
397
|
+
context.logger.warn("Email plugin skipped: SMTP credentials not configured");
|
|
398
|
+
return void 0;
|
|
399
|
+
}
|
|
387
400
|
return new EmailService(merged);
|
|
388
401
|
}
|
|
389
402
|
};
|