create-nexwire 4.2.4 → 4.3.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/README.md +20 -8
- package/express/.env +1 -1
- package/express/.vscode/extensions.json +6 -0
- package/express/.vscode/settings.json +37 -26
- package/express/biome.json +99 -66
- package/express/package.json +31 -29
- package/express/src/config/database.ts +48 -29
- package/express/src/config/index.ts +83 -83
- package/express/src/config/openapi.ts +6 -24
- package/express/src/config/queue.ts +30 -30
- package/express/src/config/validate.ts +50 -40
- package/express/src/database/migrations/sqlite/0000_init.sql +47 -47
- package/express/src/database/migrations/sqlite/meta/0000_snapshot.json +1 -1
- package/express/src/database/migrations/sqlite/meta/_journal.json +1 -1
- package/express/src/database/schema.ts +2 -2
- package/express/src/framework/cache/cache.ts +40 -8
- package/express/src/framework/circuit-breaker/cb.ts +88 -60
- package/express/src/framework/database/connection.ts +52 -27
- package/express/src/framework/events/dispatcher.ts +61 -49
- package/express/src/framework/facade.ts +46 -3
- package/express/src/framework/http/app.ts +28 -22
- package/express/src/framework/http/logger.ts +27 -16
- package/express/src/framework/http/openapi.ts +9 -11
- package/express/src/framework/modules/routes.ts +26 -21
- package/express/src/framework/notification/channels/broadcast.ts +15 -0
- package/express/src/framework/notification/channels/mail.ts +40 -0
- package/express/src/framework/notification/contracts.ts +29 -0
- package/express/src/framework/notification/index.ts +19 -94
- package/express/src/framework/notification/registry.ts +15 -0
- package/express/src/framework/providers/adapter.ts +27 -17
- package/express/src/framework/queue/queue.ts +43 -44
- package/express/src/framework/realtime/broadcast.ts +29 -5
- package/express/src/framework/realtime/socket.ts +149 -119
- package/express/src/framework/redis/client.ts +148 -151
- package/express/src/framework/runtime/server-adapter.ts +39 -34
- package/express/src/framework/scheduler/lock.ts +128 -116
- package/express/src/framework/server.ts +33 -49
- package/express/src/framework/session/session.ts +69 -14
- package/express/src/framework/storage/storage.ts +744 -785
- package/express/src/framework/support/mail.ts +15 -7
- package/express/src/providers/notification.ts +4 -0
- package/express/src/resources/src/components/Checkbox.vue +32 -29
- package/express/src/resources/src/components/Input.vue +243 -223
- package/express/src/resources/src/components/InputGroup.vue +147 -145
- package/express/src/resources/src/components/InputPasswordToggle.vue +229 -213
- package/express/src/resources/src/components/Modal.vue +71 -55
- package/express/src/resources/src/components/Refresh.vue +19 -0
- package/express/src/resources/src/helpers/assets.ts +51 -0
- package/express/src/resources/src/layouts/Layout/Header.vue +124 -105
- package/express/src/resources/src/main.ts +3 -1
- package/express/src/resources/src/plugins/gum.ts +1 -1
- package/express/src/resources/src/plugins/pulse.ts +157 -147
- package/express/src/resources/src/stores/auth.ts +184 -164
- package/express/src/resources/vite.config.ts +54 -36
- package/express/src/storage/database/nexwire.sqlite +0 -0
- package/express/src/storage/logs/app.log +0 -0
- package/express/src/storage/logs/fatal.log +0 -0
- package/express/src/types/global.d.ts +32 -26
- package/hono/.env +1 -1
- package/hono/.vscode/extensions.json +6 -0
- package/hono/.vscode/settings.json +37 -26
- package/hono/biome.json +25 -2
- package/hono/package.json +25 -23
- package/hono/src/config/database.ts +48 -29
- package/hono/src/config/index.ts +83 -83
- package/hono/src/config/openapi.ts +6 -24
- package/hono/src/config/queue.ts +30 -30
- package/hono/src/config/validate.ts +50 -40
- package/hono/src/database/migrations/sqlite/0000_init.sql +47 -47
- package/hono/src/database/migrations/sqlite/meta/0000_snapshot.json +1 -1
- package/hono/src/database/migrations/sqlite/meta/_journal.json +1 -1
- package/hono/src/database/schema.ts +2 -2
- package/hono/src/framework/cache/cache.ts +40 -8
- package/hono/src/framework/circuit-breaker/cb.ts +88 -60
- package/hono/src/framework/database/connection.ts +52 -27
- package/hono/src/framework/events/dispatcher.ts +61 -49
- package/hono/src/framework/facade.ts +38 -1
- package/hono/src/framework/http/openapi.ts +7 -9
- package/hono/src/framework/notification/channels/broadcast.ts +15 -0
- package/hono/src/framework/notification/channels/mail.ts +40 -0
- package/hono/src/framework/notification/contracts.ts +29 -0
- package/hono/src/framework/notification/index.ts +19 -94
- package/hono/src/framework/notification/registry.ts +15 -0
- package/hono/src/framework/providers/adapter.ts +27 -17
- package/hono/src/framework/queue/queue.ts +43 -44
- package/hono/src/framework/realtime/broadcast.ts +29 -5
- package/hono/src/framework/realtime/socket.ts +217 -196
- package/hono/src/framework/redis/client.ts +148 -151
- package/hono/src/framework/scheduler/lock.ts +128 -116
- package/hono/src/framework/server.ts +27 -29
- package/hono/src/framework/session/session.ts +62 -14
- package/hono/src/framework/storage/storage.ts +744 -785
- package/hono/src/framework/support/mail.ts +56 -48
- package/hono/src/providers/notification.ts +4 -0
- package/hono/src/resources/src/components/Checkbox.vue +32 -29
- package/hono/src/resources/src/components/Input.vue +243 -234
- package/hono/src/resources/src/components/InputGroup.vue +147 -149
- package/hono/src/resources/src/components/InputPasswordToggle.vue +229 -222
- package/hono/src/resources/src/components/Modal.vue +71 -55
- package/hono/src/resources/src/components/Refresh.vue +19 -0
- package/hono/src/resources/src/helpers/assets.ts +51 -0
- package/hono/src/resources/src/layouts/Layout/Header.vue +124 -105
- package/hono/src/resources/src/main.ts +3 -1
- package/hono/src/resources/src/plugins/gum.ts +1 -1
- package/hono/src/resources/src/plugins/pulse.ts +157 -147
- package/hono/src/resources/src/stores/auth.ts +184 -164
- package/hono/src/resources/vite.config.ts +54 -36
- package/hono/src/storage/database/nexwire.sqlite +0 -0
- package/hono/src/storage/logs/app.log +0 -0
- package/hono/src/storage/logs/fatal.log +0 -0
- package/hono/src/types/global.d.ts +32 -26
- package/package.json +2 -2
- package/src/index.js +139 -14
|
@@ -1,48 +1,56 @@
|
|
|
1
|
-
import nodemailer from "nodemailer";
|
|
2
|
-
import { mailConfig } from "@/config/index.js";
|
|
3
|
-
import {
|
|
4
|
-
import { logger } from "@/framework/support/logger.js";
|
|
5
|
-
|
|
6
|
-
type MailPayload = {
|
|
7
|
-
to: string;
|
|
8
|
-
subject: string;
|
|
9
|
-
html?: string;
|
|
10
|
-
text?: string;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
const transport = nodemailer.createTransport({
|
|
14
|
-
host: mailConfig.host,
|
|
15
|
-
port: mailConfig.port,
|
|
16
|
-
secure: mailConfig.encryption === "ssl",
|
|
17
|
-
auth: mailConfig.username ? { user: mailConfig.username, pass: mailConfig.password } : undefined
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
const mailBreaker =
|
|
21
|
-
|
|
22
|
-
export const mail = {
|
|
23
|
-
/**
|
|
24
|
-
* Why: Sends transactional email through configured SMTP transport.
|
|
25
|
-
* When: Features need notifications/password reset/signup email.
|
|
26
|
-
* Where: Jobs and event handlers.
|
|
27
|
-
* How: Uses nodemailer transport and respects the fail-silent setting.
|
|
28
|
-
*/
|
|
29
|
-
async sendMail(payload: MailPayload) {
|
|
30
|
-
try {
|
|
31
|
-
return await mailBreaker.exec(() =>
|
|
32
|
-
transport.sendMail({
|
|
33
|
-
from: mailConfig.fromAddress,
|
|
34
|
-
...payload
|
|
35
|
-
})
|
|
36
|
-
);
|
|
37
|
-
} catch (error) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
1
|
+
import nodemailer from "nodemailer";
|
|
2
|
+
import { mailConfig } from "@/config/index.js";
|
|
3
|
+
import { createCircuitBreaker, isCircuitBreakerError } from "@/framework/circuit-breaker/cb.js";
|
|
4
|
+
import { logger } from "@/framework/support/logger.js";
|
|
5
|
+
|
|
6
|
+
type MailPayload = {
|
|
7
|
+
to: string;
|
|
8
|
+
subject: string;
|
|
9
|
+
html?: string;
|
|
10
|
+
text?: string;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const transport = nodemailer.createTransport({
|
|
14
|
+
host: mailConfig.host,
|
|
15
|
+
port: mailConfig.port,
|
|
16
|
+
secure: mailConfig.encryption === "ssl",
|
|
17
|
+
auth: mailConfig.username ? { user: mailConfig.username, pass: mailConfig.password } : undefined
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const mailBreaker = createCircuitBreaker({ name: "SMTP Mail" });
|
|
21
|
+
|
|
22
|
+
export const mail = {
|
|
23
|
+
/**
|
|
24
|
+
* Why: Sends transactional email through configured SMTP transport.
|
|
25
|
+
* When: Features need notifications/password reset/signup email.
|
|
26
|
+
* Where: Jobs and event handlers.
|
|
27
|
+
* How: Uses nodemailer transport and respects the fail-silent setting.
|
|
28
|
+
*/
|
|
29
|
+
async sendMail(payload: MailPayload) {
|
|
30
|
+
try {
|
|
31
|
+
return await mailBreaker.exec(() =>
|
|
32
|
+
transport.sendMail({
|
|
33
|
+
from: mailConfig.fromAddress,
|
|
34
|
+
...payload
|
|
35
|
+
})
|
|
36
|
+
);
|
|
37
|
+
} catch (error) {
|
|
38
|
+
// Distinguish between a Circuit Breaker rejection and an actual SMTP failure
|
|
39
|
+
if (isCircuitBreakerError(error)) {
|
|
40
|
+
logger.warn("Mail send skipped: Circuit breaker is open", {
|
|
41
|
+
to: payload.to,
|
|
42
|
+
subject: payload.subject
|
|
43
|
+
});
|
|
44
|
+
} else {
|
|
45
|
+
logger.error("Mail send failed", {
|
|
46
|
+
to: payload.to,
|
|
47
|
+
subject: payload.subject,
|
|
48
|
+
error: error instanceof Error ? error.message : error
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (!mailConfig.failSilent) throw error;
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
};
|
|
@@ -1,29 +1,32 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="form-check mb-0" :class="props.topclass">
|
|
3
|
-
<input
|
|
4
|
-
:id="String(props.id)"
|
|
5
|
-
v-model="model"
|
|
6
|
-
class="form-check-input shadow-none
|
|
7
|
-
type="checkbox"
|
|
8
|
-
v-bind="$attrs"
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<div class="form-check mb-0" :class="props.topclass">
|
|
3
|
+
<input
|
|
4
|
+
:id="String(props.id)"
|
|
5
|
+
v-model="model"
|
|
6
|
+
class="form-check-input shadow-none"
|
|
7
|
+
type="checkbox"
|
|
8
|
+
v-bind="$attrs"
|
|
9
|
+
/>
|
|
10
|
+
<label v-if="props.label" class="form-check-label" :for="String(props.id)">{{
|
|
11
|
+
props.label
|
|
12
|
+
}}</label>
|
|
13
|
+
</div>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<script setup lang="ts">
|
|
17
|
+
defineOptions({ name: "Checkbox", inheritAttrs: false });
|
|
18
|
+
|
|
19
|
+
interface CheckboxProps {
|
|
20
|
+
id?: string | number;
|
|
21
|
+
label?: string;
|
|
22
|
+
topclass?: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const props = defineProps<CheckboxProps>();
|
|
26
|
+
|
|
27
|
+
type CheckboxModel = boolean | Array<string | number>;
|
|
28
|
+
|
|
29
|
+
const model = defineModel<CheckboxModel>({ default: false });
|
|
30
|
+
</script>
|
|
31
|
+
|
|
32
|
+
<style lang="scss" scoped></style>
|