@contentgrowth/content-emailing 0.7.7 → 0.7.8
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/backend/index.cjs +32 -2
- package/dist/backend/index.cjs.map +1 -1
- package/dist/backend/index.js +32 -2
- package/dist/backend/index.js.map +1 -1
- package/dist/backend/routes/index.cjs +4 -4
- package/dist/backend/routes/index.cjs.map +1 -1
- package/dist/backend/routes/index.d.cts +12 -12
- package/dist/backend/routes/index.d.ts +12 -12
- package/dist/backend/routes/index.js +4 -4
- package/dist/backend/routes/index.js.map +1 -1
- package/dist/index.cjs +32 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +32 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/backend/index.js
CHANGED
|
@@ -1423,7 +1423,7 @@ function createSettingsRoutes(config = {}) {
|
|
|
1423
1423
|
|
|
1424
1424
|
// src/backend/routes/templates.js
|
|
1425
1425
|
import { Hono as Hono2 } from "hono";
|
|
1426
|
-
function
|
|
1426
|
+
function createTemplateRoutes(config = {}) {
|
|
1427
1427
|
const app = new Hono2();
|
|
1428
1428
|
app.get("/", async (c) => {
|
|
1429
1429
|
const emailService = new EmailService(c.env, config);
|
|
@@ -1680,6 +1680,36 @@ function createTrackingRoutes(env, config = {}) {
|
|
|
1680
1680
|
|
|
1681
1681
|
// src/backend/routes/logs.js
|
|
1682
1682
|
import { Hono as Hono4 } from "hono";
|
|
1683
|
+
function createLogRoutes(config = {}) {
|
|
1684
|
+
const app = new Hono4();
|
|
1685
|
+
app.get("/", async (c) => {
|
|
1686
|
+
const limit = Math.min(parseInt(c.req.query("limit") || "50"), 100);
|
|
1687
|
+
const offset = parseInt(c.req.query("offset") || "0");
|
|
1688
|
+
const env = c.env;
|
|
1689
|
+
try {
|
|
1690
|
+
const table = `${config.emailTablePrefix || "system_email_"}logs`;
|
|
1691
|
+
const { results } = await env.DB.prepare(`
|
|
1692
|
+
SELECT * FROM ${table}
|
|
1693
|
+
ORDER BY created_at DESC
|
|
1694
|
+
LIMIT ? OFFSET ?
|
|
1695
|
+
`).bind(limit, offset).all();
|
|
1696
|
+
const countResult = await env.DB.prepare(`SELECT COUNT(*) as exact_count FROM ${table}`).first();
|
|
1697
|
+
return c.json({
|
|
1698
|
+
logs: results.map((row) => ({
|
|
1699
|
+
...row,
|
|
1700
|
+
metadata: row.metadata ? JSON.parse(row.metadata) : null
|
|
1701
|
+
})),
|
|
1702
|
+
total: countResult.exact_count,
|
|
1703
|
+
limit,
|
|
1704
|
+
offset
|
|
1705
|
+
});
|
|
1706
|
+
} catch (error) {
|
|
1707
|
+
console.error("Failed to fetch logs:", error);
|
|
1708
|
+
return c.json({ error: "Failed to fetch logs" }, 500);
|
|
1709
|
+
}
|
|
1710
|
+
});
|
|
1711
|
+
return app;
|
|
1712
|
+
}
|
|
1683
1713
|
|
|
1684
1714
|
// src/backend/routes/index.js
|
|
1685
1715
|
function createEmailRoutes(config = {}, cacheProvider = null) {
|
|
@@ -1760,7 +1790,7 @@ export {
|
|
|
1760
1790
|
createDOCacheProvider,
|
|
1761
1791
|
createEmailLoggerCallback,
|
|
1762
1792
|
createEmailRoutes,
|
|
1763
|
-
|
|
1793
|
+
createTemplateRoutes,
|
|
1764
1794
|
createTrackingRoutes,
|
|
1765
1795
|
encodeTrackingLinks,
|
|
1766
1796
|
extractVariables,
|