vintasend 0.2.3 → 0.4.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 +227 -12
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/next.config.d.ts +1 -1
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/next.config.js +9 -4
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/api/auth/forgot-password/forgot-password-notification-context.d.ts +6 -6
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/api/auth/forgot-password/forgot-password-notification-context.js +16 -17
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/api/auth/forgot-password/route.d.ts +7 -5
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/api/auth/forgot-password/route.js +105 -79
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/api/auth/login/route.d.ts +4 -5
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/api/auth/login/route.js +96 -66
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/api/auth/reset-password/route.d.ts +7 -5
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/api/auth/reset-password/route.js +95 -71
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/api/auth/signup/email-verification-notification-context.d.ts +6 -6
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/api/auth/signup/email-verification-notification-context.js +18 -18
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/api/auth/signup/route.d.ts +4 -5
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/api/auth/signup/route.js +124 -96
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/api/auth/verify-email/route.d.ts +7 -5
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/api/auth/verify-email/route.js +94 -70
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/auth/login/page.d.ts +1 -1
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/auth/login/page.js +67 -55
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/auth/reset-password/[token]/page.d.ts +1 -1
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/auth/reset-password/[token]/page.js +76 -63
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/auth/signup/page.d.ts +1 -1
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/auth/signup/page.js +87 -63
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/auth/verify-email/[token]/page.d.ts +1 -1
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/auth/verify-email/[token]/page.js +50 -35
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/auth/verify-email-sent/page.d.ts +1 -1
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/auth/verify-email-sent/page.js +12 -12
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/layout.d.ts +7 -5
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/layout.js +15 -16
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/page.d.ts +1 -1
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/app/page.js +65 -21
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/AuthLayout.d.ts +7 -4
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/AuthLayout.js +7 -8
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/accordion.d.ts +18 -6
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/accordion.js +86 -48
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/alert-dialog.d.ts +58 -14
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/alert-dialog.js +135 -53
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/alert.d.ts +21 -7
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/alert.js +85 -49
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/avatar.d.ts +14 -5
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/avatar.js +77 -40
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/button.d.ts +25 -9
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/button.js +80 -58
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/card.d.ts +19 -7
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/card.js +98 -48
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/checkbox.d.ts +6 -3
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/checkbox.js +66 -42
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/collapsible.d.ts +10 -4
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/collapsible.js +48 -35
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/dialog.d.ts +40 -13
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/dialog.js +116 -50
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/dropdown-menu.d.ts +83 -19
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/dropdown-menu.js +170 -68
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/form.d.ts +53 -21
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/form.js +137 -83
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/input.d.ts +8 -2
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/input.js +60 -37
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/label.d.ts +10 -4
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/label.js +61 -40
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/menubar.d.ts +77 -23
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/menubar.js +188 -64
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/select.d.ts +48 -12
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/select.js +148 -66
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/textarea.d.ts +8 -2
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/components/ui/textarea.js +59 -37
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/lib/api-clients/auth.d.ts +10 -10
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/lib/api-clients/auth.js +54 -55
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/lib/api-clients/core.d.ts +14 -11
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/lib/api-clients/core.js +1 -2
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/lib/email.js +0 -1
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/lib/logger.d.ts +3 -3
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/lib/logger.js +9 -10
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/lib/schemas/auth.d.ts +66 -32
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/lib/schemas/auth.js +74 -54
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/lib/services/auth.js +7 -8
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/lib/services/notifications-with-queue.d.ts +14 -4
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/lib/services/notifications-with-queue.js +14 -10
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/lib/services/notifications.d.ts +11 -7
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/lib/services/notifications.js +39 -26
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/lib/services/temporal-queue-service.d.ts +11 -8
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/lib/services/temporal-queue-service.js +14 -15
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/lib/temporal.d.ts +1 -1
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/lib/temporal.js +9 -10
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/lib/utils.d.ts +1 -1
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/lib/utils.js +4 -5
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/workers/notifications/activities.d.ts +6 -5
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/workers/notifications/activities.js +14 -14
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/workers/notifications/config.d.ts +1 -1
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/workers/notifications/config.js +2 -3
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/workers/notifications/constants.d.ts +1 -1
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/workers/notifications/constants.js +1 -2
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/workers/notifications/worker.js +20 -22
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/workers/notifications/workflows.d.ts +3 -2
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/workers/notifications/workflows.js +10 -9
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/tailwind.config.d.ts +74 -74
- package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/tailwind.config.js +80 -81
- package/dist/implementations/vintasend-nodemailer/src/index.js +6 -4
- package/dist/implementations/vintasend-nodemailer/src/nodemailer-notification-adapter.d.ts +36 -14
- package/dist/implementations/vintasend-nodemailer/src/nodemailer-notification-adapter.js +26 -28
- package/dist/implementations/vintasend-prisma/src/index.js +6 -4
- package/dist/implementations/vintasend-prisma/src/prisma-notification-backend.d.ts +232 -138
- package/dist/implementations/vintasend-prisma/src/prisma-notification-backend.js +275 -262
- package/dist/implementations/vintasend-pug/src/index.js +6 -4
- package/dist/implementations/vintasend-pug/src/pug-email-template-renderer.d.ts +18 -7
- package/dist/implementations/vintasend-pug/src/pug-email-template-renderer.js +19 -21
- package/dist/implementations/vintasend-winston/src/index.js +6 -4
- package/dist/implementations/vintasend-winston/src/winston-logger.d.ts +6 -6
- package/dist/implementations/vintasend-winston/src/winston-logger.js +65 -50
- package/dist/index.d.ts +13 -5
- package/dist/index.js +13 -1
- package/dist/services/attachment-manager/base-attachment-manager.d.ts +42 -0
- package/dist/services/attachment-manager/base-attachment-manager.js +115 -0
- package/dist/services/attachment-manager/local-file-attachment-manager.d.ts +58 -0
- package/dist/services/attachment-manager/local-file-attachment-manager.js +192 -0
- package/dist/services/notification-adapters/base-notification-adapter.d.ts +36 -4
- package/dist/services/notification-adapters/base-notification-adapter.js +73 -4
- package/dist/services/notification-backends/base-notification-backend.d.ts +54 -11
- package/dist/services/notification-backends/base-notification-backend.js +12 -0
- package/dist/services/notification-context-generators-map.d.ts +1 -1
- package/dist/services/notification-context-registry.d.ts +14 -9
- package/dist/services/notification-context-registry.js +30 -31
- package/dist/services/notification-queue-service/base-notification-queue-service.d.ts +1 -1
- package/dist/services/notification-service.d.ts +73 -13
- package/dist/services/notification-service.js +125 -8
- package/dist/services/notification-template-renderers/base-email-template-renderer.d.ts +3 -3
- package/dist/services/notification-template-renderers/base-notification-template-renderer.d.ts +2 -2
- package/dist/types/attachment.d.ts +42 -0
- package/dist/types/attachment.js +7 -0
- package/dist/types/notification-type-config.d.ts +2 -2
- package/dist/types/notification.d.ts +21 -0
- package/dist/types/one-off-notification.d.ts +72 -0
- package/dist/types/one-off-notification.js +2 -0
- package/package.json +13 -11
|
@@ -1,65 +1,99 @@
|
|
|
1
|
-
import * as z from
|
|
2
|
-
export declare const loginSchema: z.ZodObject<
|
|
1
|
+
import type * as z from 'zod';
|
|
2
|
+
export declare const loginSchema: z.ZodObject<
|
|
3
|
+
{
|
|
3
4
|
email: z.ZodString;
|
|
4
5
|
password: z.ZodString;
|
|
5
|
-
},
|
|
6
|
+
},
|
|
7
|
+
'strip',
|
|
8
|
+
z.ZodTypeAny,
|
|
9
|
+
{
|
|
6
10
|
email: string;
|
|
7
11
|
password: string;
|
|
8
|
-
},
|
|
12
|
+
},
|
|
13
|
+
{
|
|
9
14
|
email: string;
|
|
10
15
|
password: string;
|
|
11
|
-
}
|
|
12
|
-
|
|
16
|
+
}
|
|
17
|
+
>;
|
|
18
|
+
export declare const signupSchema: z.ZodObject<
|
|
19
|
+
{
|
|
13
20
|
firstName: z.ZodString;
|
|
14
21
|
lastName: z.ZodString;
|
|
15
22
|
email: z.ZodString;
|
|
16
23
|
password: z.ZodString;
|
|
17
|
-
},
|
|
24
|
+
},
|
|
25
|
+
'strip',
|
|
26
|
+
z.ZodTypeAny,
|
|
27
|
+
{
|
|
18
28
|
email: string;
|
|
19
29
|
password: string;
|
|
20
30
|
firstName: string;
|
|
21
31
|
lastName: string;
|
|
22
|
-
},
|
|
32
|
+
},
|
|
33
|
+
{
|
|
23
34
|
email: string;
|
|
24
35
|
password: string;
|
|
25
36
|
firstName: string;
|
|
26
37
|
lastName: string;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
}
|
|
39
|
+
>;
|
|
40
|
+
export declare const passwordResetSchema: z.ZodEffects<
|
|
41
|
+
z.ZodObject<
|
|
42
|
+
{
|
|
43
|
+
token: z.ZodString;
|
|
44
|
+
password: z.ZodString;
|
|
45
|
+
confirmPassword: z.ZodString;
|
|
46
|
+
},
|
|
47
|
+
'strip',
|
|
48
|
+
z.ZodTypeAny,
|
|
49
|
+
{
|
|
50
|
+
password: string;
|
|
51
|
+
token: string;
|
|
52
|
+
confirmPassword: string;
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
password: string;
|
|
56
|
+
token: string;
|
|
57
|
+
confirmPassword: string;
|
|
58
|
+
}
|
|
59
|
+
>,
|
|
60
|
+
{
|
|
41
61
|
password: string;
|
|
42
62
|
token: string;
|
|
43
63
|
confirmPassword: string;
|
|
44
|
-
},
|
|
64
|
+
},
|
|
65
|
+
{
|
|
45
66
|
password: string;
|
|
46
67
|
token: string;
|
|
47
68
|
confirmPassword: string;
|
|
48
|
-
}
|
|
49
|
-
|
|
69
|
+
}
|
|
70
|
+
>;
|
|
71
|
+
export declare const verifyEmailSchema: z.ZodObject<
|
|
72
|
+
{
|
|
50
73
|
token: z.ZodString;
|
|
51
|
-
},
|
|
74
|
+
},
|
|
75
|
+
'strip',
|
|
76
|
+
z.ZodTypeAny,
|
|
77
|
+
{
|
|
52
78
|
token: string;
|
|
53
|
-
},
|
|
79
|
+
},
|
|
80
|
+
{
|
|
54
81
|
token: string;
|
|
55
|
-
}
|
|
56
|
-
|
|
82
|
+
}
|
|
83
|
+
>;
|
|
84
|
+
export declare const forgotPasswordSchema: z.ZodObject<
|
|
85
|
+
{
|
|
57
86
|
email: z.ZodString;
|
|
58
|
-
},
|
|
87
|
+
},
|
|
88
|
+
'strip',
|
|
89
|
+
z.ZodTypeAny,
|
|
90
|
+
{
|
|
59
91
|
email: string;
|
|
60
|
-
},
|
|
92
|
+
},
|
|
93
|
+
{
|
|
61
94
|
email: string;
|
|
62
|
-
}
|
|
95
|
+
}
|
|
96
|
+
>;
|
|
63
97
|
export type LoginValues = z.infer<typeof loginSchema>;
|
|
64
98
|
export type SignupValues = z.infer<typeof signupSchema>;
|
|
65
99
|
export type PasswordResetValues = z.infer<typeof passwordResetSchema>;
|
|
@@ -1,67 +1,87 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
})
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
1
|
+
var __createBinding =
|
|
2
|
+
(this && this.__createBinding) ||
|
|
3
|
+
(Object.create
|
|
4
|
+
? (o, m, k, k2) => {
|
|
5
|
+
if (k2 === undefined) k2 = k;
|
|
6
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
7
|
+
if (!desc || ('get' in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
8
|
+
desc = { enumerable: true, get: () => m[k] };
|
|
9
|
+
}
|
|
10
|
+
Object.defineProperty(o, k2, desc);
|
|
11
|
+
}
|
|
12
|
+
: (o, m, k, k2) => {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
});
|
|
16
|
+
var __setModuleDefault =
|
|
17
|
+
(this && this.__setModuleDefault) ||
|
|
18
|
+
(Object.create
|
|
19
|
+
? (o, v) => {
|
|
20
|
+
Object.defineProperty(o, 'default', { enumerable: true, value: v });
|
|
21
|
+
}
|
|
22
|
+
: (o, v) => {
|
|
23
|
+
o['default'] = v;
|
|
24
|
+
});
|
|
25
|
+
var __importStar =
|
|
26
|
+
(this && this.__importStar) ||
|
|
27
|
+
(() => {
|
|
28
|
+
var ownKeys = (o) => {
|
|
29
|
+
ownKeys =
|
|
30
|
+
Object.getOwnPropertyNames ||
|
|
31
|
+
((o) => {
|
|
32
|
+
var ar = [];
|
|
33
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
34
|
+
return ar;
|
|
35
|
+
});
|
|
36
|
+
return ownKeys(o);
|
|
26
37
|
};
|
|
27
|
-
return
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
38
|
+
return (mod) => {
|
|
39
|
+
if (mod && mod.__esModule) return mod;
|
|
40
|
+
var result = {};
|
|
41
|
+
if (mod != null)
|
|
42
|
+
for (var k = ownKeys(mod), i = 0; i < k.length; i++)
|
|
43
|
+
if (k[i] !== 'default') __createBinding(result, mod, k[i]);
|
|
44
|
+
__setModuleDefault(result, mod);
|
|
45
|
+
return result;
|
|
33
46
|
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports,
|
|
36
|
-
exports.forgotPasswordSchema =
|
|
37
|
-
|
|
47
|
+
})();
|
|
48
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
49
|
+
exports.forgotPasswordSchema =
|
|
50
|
+
exports.verifyEmailSchema =
|
|
51
|
+
exports.passwordResetSchema =
|
|
52
|
+
exports.signupSchema =
|
|
53
|
+
exports.loginSchema =
|
|
54
|
+
void 0;
|
|
55
|
+
const z = __importStar(require('zod'));
|
|
38
56
|
exports.loginSchema = z.object({
|
|
39
|
-
|
|
40
|
-
|
|
57
|
+
email: z.string().email('Please enter a valid email address'),
|
|
58
|
+
password: z.string().min(1, 'Password is required'),
|
|
41
59
|
});
|
|
42
60
|
exports.signupSchema = z.object({
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
61
|
+
firstName: z.string().min(2, 'First name must be at least 2 characters'),
|
|
62
|
+
lastName: z.string().min(2, 'Last name must be at least 2 characters'),
|
|
63
|
+
email: z.string().email('Please enter a valid email address'),
|
|
64
|
+
password: z
|
|
65
|
+
.string()
|
|
66
|
+
.min(8, 'Password must be at least 8 characters')
|
|
67
|
+
.max(100, 'Password is too long'),
|
|
50
68
|
});
|
|
51
|
-
exports.passwordResetSchema = z
|
|
69
|
+
exports.passwordResetSchema = z
|
|
70
|
+
.object({
|
|
52
71
|
token: z.string(),
|
|
53
72
|
password: z
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
confirmPassword: z.string()
|
|
58
|
-
})
|
|
73
|
+
.string()
|
|
74
|
+
.min(8, 'Password must be at least 8 characters')
|
|
75
|
+
.max(100, 'Password is too long'),
|
|
76
|
+
confirmPassword: z.string(),
|
|
77
|
+
})
|
|
78
|
+
.refine((data) => data.password === data.confirmPassword, {
|
|
59
79
|
message: "Passwords don't match",
|
|
60
|
-
path: [
|
|
61
|
-
});
|
|
80
|
+
path: ['confirmPassword'],
|
|
81
|
+
});
|
|
62
82
|
exports.verifyEmailSchema = z.object({
|
|
63
|
-
|
|
83
|
+
token: z.string(),
|
|
64
84
|
});
|
|
65
85
|
exports.forgotPasswordSchema = z.object({
|
|
66
|
-
|
|
86
|
+
email: z.string().email('Please enter a valid email address'),
|
|
67
87
|
});
|
|
@@ -1,21 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
3
2
|
exports.hashPassword = hashPassword;
|
|
4
3
|
exports.verifyPassword = verifyPassword;
|
|
5
4
|
exports.generateToken = generateToken;
|
|
6
5
|
exports.verifyToken = verifyToken;
|
|
7
|
-
const bcryptjs_1 = require(
|
|
8
|
-
const jsonwebtoken_1 = require(
|
|
6
|
+
const bcryptjs_1 = require('bcryptjs');
|
|
7
|
+
const jsonwebtoken_1 = require('jsonwebtoken');
|
|
9
8
|
const JWT_SECRET = process.env.JWT_SECRET || 'your-secret-key';
|
|
10
9
|
async function hashPassword(password) {
|
|
11
|
-
|
|
10
|
+
return (0, bcryptjs_1.hash)(password, 12);
|
|
12
11
|
}
|
|
13
12
|
async function verifyPassword(password, hashedPassword) {
|
|
14
|
-
|
|
13
|
+
return (0, bcryptjs_1.compare)(password, hashedPassword);
|
|
15
14
|
}
|
|
16
15
|
function generateToken(payload, expiresIn = '1d') {
|
|
17
|
-
|
|
16
|
+
return (0, jsonwebtoken_1.sign)(payload, JWT_SECRET, { expiresIn });
|
|
18
17
|
}
|
|
19
18
|
function verifyToken(token) {
|
|
20
|
-
|
|
19
|
+
return (0, jsonwebtoken_1.verify)(token, JWT_SECRET);
|
|
21
20
|
}
|
|
@@ -1,4 +1,14 @@
|
|
|
1
|
-
export declare function getNotificationServiceWithQueue(): Promise<
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
export declare function getNotificationServiceWithQueue(): Promise<
|
|
2
|
+
import('vintasend/src/services/notification-service').NotificationService<
|
|
3
|
+
{
|
|
4
|
+
readonly forgotPassword: import(
|
|
5
|
+
'../../app/api/auth/forgot-password/forgot-password-notification-context',
|
|
6
|
+
).ForgotPasswordContextGenerator;
|
|
7
|
+
readonly emailVerification: import(
|
|
8
|
+
'../../app/api/auth/signup/email-verification-notification-context',
|
|
9
|
+
).EmailVerificationNotificationContextGenerator;
|
|
10
|
+
},
|
|
11
|
+
number,
|
|
12
|
+
number
|
|
13
|
+
>
|
|
14
|
+
>;
|
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
3
2
|
exports.getNotificationServiceWithQueue = getNotificationServiceWithQueue;
|
|
4
|
-
const notifications_1 = require(
|
|
5
|
-
const temporal_queue_service_1 = require(
|
|
6
|
-
const constants_1 = require(
|
|
7
|
-
const temporal_1 = require(
|
|
3
|
+
const notifications_1 = require('./notifications');
|
|
4
|
+
const temporal_queue_service_1 = require('./temporal-queue-service');
|
|
5
|
+
const constants_1 = require('../../workers/notifications/constants');
|
|
6
|
+
const temporal_1 = require('../temporal');
|
|
8
7
|
async function getNotificationServiceWithQueue() {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
const notificationService = (0, notifications_1.getNotificationService)();
|
|
9
|
+
const temporalClient = await (0, temporal_1.getTemporalClient)();
|
|
10
|
+
notificationService.registerQueueService(
|
|
11
|
+
new temporal_queue_service_1.TemporalQueueService(
|
|
12
|
+
temporalClient,
|
|
13
|
+
constants_1.NOTIFICATIONS_QUEUE,
|
|
14
|
+
),
|
|
15
|
+
);
|
|
16
|
+
return notificationService;
|
|
13
17
|
}
|
package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/lib/services/notifications.d.ts
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
|
-
import { NotificationService } from 'vintasend/src/services/notification-service';
|
|
2
|
-
import { ForgotPasswordContextGenerator } from '../../app/api/auth/forgot-password/forgot-password-notification-context';
|
|
3
|
-
import { EmailVerificationNotificationContextGenerator } from '../../app/api/auth/signup/email-verification-notification-context';
|
|
1
|
+
import type { NotificationService } from 'vintasend/src/services/notification-service';
|
|
2
|
+
import type { ForgotPasswordContextGenerator } from '../../app/api/auth/forgot-password/forgot-password-notification-context';
|
|
3
|
+
import type { EmailVerificationNotificationContextGenerator } from '../../app/api/auth/signup/email-verification-notification-context';
|
|
4
4
|
export declare const contextGeneratorsMap: {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
readonly forgotPassword: ForgotPasswordContextGenerator;
|
|
6
|
+
readonly emailVerification: EmailVerificationNotificationContextGenerator;
|
|
7
7
|
};
|
|
8
8
|
export type ContextMap = typeof contextGeneratorsMap;
|
|
9
|
-
export declare function getNotificationService(): NotificationService<
|
|
9
|
+
export declare function getNotificationService(): NotificationService<
|
|
10
|
+
{
|
|
10
11
|
readonly forgotPassword: ForgotPasswordContextGenerator;
|
|
11
12
|
readonly emailVerification: EmailVerificationNotificationContextGenerator;
|
|
12
|
-
},
|
|
13
|
+
},
|
|
14
|
+
number,
|
|
15
|
+
number
|
|
16
|
+
>;
|
package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/lib/services/notifications.js
CHANGED
|
@@ -1,32 +1,45 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
3
2
|
exports.contextGeneratorsMap = void 0;
|
|
4
3
|
exports.getNotificationService = getNotificationService;
|
|
5
|
-
const client_1 = require(
|
|
6
|
-
const notification_service_1 = require(
|
|
7
|
-
const notification_context_registry_1 = require(
|
|
8
|
-
const prisma_notification_backend_1 = require(
|
|
9
|
-
const pug_email_template_renderer_1 = require(
|
|
10
|
-
const vintasend_nodemailer_1 = require(
|
|
11
|
-
const winston_logger_1 = require(
|
|
12
|
-
const forgot_password_notification_context_1 = require(
|
|
13
|
-
const email_verification_notification_context_1 = require(
|
|
14
|
-
const logger_js_1 = require(
|
|
4
|
+
const client_1 = require('@prisma/client');
|
|
5
|
+
const notification_service_1 = require('vintasend/src/services/notification-service');
|
|
6
|
+
const notification_context_registry_1 = require('vintasend/src/services/notification-context-registry');
|
|
7
|
+
const prisma_notification_backend_1 = require('vintasend-prisma/prisma-notification-backend');
|
|
8
|
+
const pug_email_template_renderer_1 = require('vintasend-pug/pug-email-template-renderer');
|
|
9
|
+
const vintasend_nodemailer_1 = require('vintasend-nodemailer');
|
|
10
|
+
const winston_logger_1 = require('vintasend-winston/winston-logger');
|
|
11
|
+
const forgot_password_notification_context_1 = require('../../app/api/auth/forgot-password/forgot-password-notification-context');
|
|
12
|
+
const email_verification_notification_context_1 = require('../../app/api/auth/signup/email-verification-notification-context');
|
|
13
|
+
const logger_js_1 = require('../logger.js');
|
|
15
14
|
exports.contextGeneratorsMap = {
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
forgotPassword: new forgot_password_notification_context_1.ForgotPasswordContextGenerator(),
|
|
16
|
+
emailVerification:
|
|
17
|
+
new email_verification_notification_context_1.EmailVerificationNotificationContextGenerator(),
|
|
18
18
|
};
|
|
19
19
|
function getNotificationService() {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
20
|
+
const prisma = new client_1.PrismaClient();
|
|
21
|
+
const notificationBackend = new prisma_notification_backend_1.PrismaNotificationBackend(prisma);
|
|
22
|
+
return new notification_service_1.NotificationService(
|
|
23
|
+
[
|
|
24
|
+
new vintasend_nodemailer_1.NodemailerNotificationAdapter(
|
|
25
|
+
new pug_email_template_renderer_1.PugEmailTemplateRenderer(),
|
|
26
|
+
notificationBackend,
|
|
27
|
+
true,
|
|
28
|
+
{
|
|
29
|
+
host: process.env.SMTP_HOST,
|
|
30
|
+
port: process.env.SMTP_PORT || 587,
|
|
31
|
+
secure: false, // true for port 465, false for other ports
|
|
32
|
+
auth: {
|
|
33
|
+
user: process.env.SMTP_USER,
|
|
34
|
+
pass: process.env.SMTP_PASSWORD,
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
),
|
|
38
|
+
],
|
|
39
|
+
notificationBackend,
|
|
40
|
+
new winston_logger_1.WinstonLogger(logger_js_1.loggerOptions),
|
|
41
|
+
);
|
|
31
42
|
}
|
|
32
|
-
notification_context_registry_1.NotificationContextRegistry.initialize(
|
|
43
|
+
notification_context_registry_1.NotificationContextRegistry.initialize(
|
|
44
|
+
exports.contextGeneratorsMap,
|
|
45
|
+
);
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import type { Client } from '@temporalio/client';
|
|
2
|
-
import type { BaseNotificationQueueService } from
|
|
2
|
+
import type { BaseNotificationQueueService } from 'vintasend/src/services/notification-queue-service/base-notification-queue-service';
|
|
3
3
|
import type { getNotificationService } from './notifications';
|
|
4
|
-
type NotificationIdType = Parameters<
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
type NotificationIdType = Parameters<
|
|
5
|
+
ReturnType<typeof getNotificationService>['getNotification']
|
|
6
|
+
>[0];
|
|
7
|
+
export declare class TemporalQueueService
|
|
8
|
+
implements BaseNotificationQueueService<NotificationIdType>
|
|
9
|
+
{
|
|
10
|
+
private client;
|
|
11
|
+
private taskQueue;
|
|
12
|
+
constructor(client: Client, taskQueue: string);
|
|
13
|
+
enqueueNotification(notificationId: NotificationIdType): Promise<void>;
|
|
10
14
|
}
|
|
11
|
-
export {};
|
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
3
2
|
exports.TemporalQueueService = void 0;
|
|
4
|
-
const workflows_1 = require(
|
|
3
|
+
const workflows_1 = require('../../workers/notifications/workflows');
|
|
5
4
|
class TemporalQueueService {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
5
|
+
constructor(client, taskQueue) {
|
|
6
|
+
this.client = client;
|
|
7
|
+
this.taskQueue = taskQueue;
|
|
8
|
+
}
|
|
9
|
+
async enqueueNotification(notificationId) {
|
|
10
|
+
await this.client.workflow.start(workflows_1.sendNotificationWorkflow, {
|
|
11
|
+
taskQueue: this.taskQueue,
|
|
12
|
+
workflowId: `sendNotification-${notificationId}`,
|
|
13
|
+
args: [notificationId],
|
|
14
|
+
});
|
|
15
|
+
await this.client.connection.close();
|
|
16
|
+
}
|
|
18
17
|
}
|
|
19
18
|
exports.TemporalQueueService = TemporalQueueService;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Client } from '@temporalio/client';
|
|
1
|
+
import type { Client } from '@temporalio/client';
|
|
2
2
|
export declare function getTemporalClient(): Promise<Client>;
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
3
2
|
exports.getTemporalClient = getTemporalClient;
|
|
4
|
-
const client_1 = require(
|
|
5
|
-
const config_1 = require(
|
|
3
|
+
const client_1 = require('@temporalio/client');
|
|
4
|
+
const config_1 = require('../workers/notifications/config');
|
|
6
5
|
let connection = null;
|
|
7
6
|
async function getTemporalClient() {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
if (!connection) {
|
|
8
|
+
connection = await client_1.Connection.connect(config_1.CONNECTION_CONFIG);
|
|
9
|
+
}
|
|
10
|
+
return new client_1.Client({
|
|
11
|
+
connection,
|
|
12
|
+
});
|
|
14
13
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ClassValue } from 'clsx';
|
|
2
2
|
export declare function cn(...inputs: ClassValue[]): string;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
3
2
|
exports.cn = cn;
|
|
4
|
-
const clsx_1 = require(
|
|
5
|
-
const tailwind_merge_1 = require(
|
|
3
|
+
const clsx_1 = require('clsx');
|
|
4
|
+
const tailwind_merge_1 = require('tailwind-merge');
|
|
6
5
|
function cn(...inputs) {
|
|
7
|
-
|
|
6
|
+
return (0, tailwind_merge_1.twMerge)((0, clsx_1.clsx)(inputs));
|
|
8
7
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { getNotificationService } from '../../lib/services/notifications';
|
|
2
|
-
type NotificationIdType = Parameters<
|
|
1
|
+
import type { getNotificationService } from '../../lib/services/notifications';
|
|
2
|
+
type NotificationIdType = Parameters<
|
|
3
|
+
ReturnType<typeof getNotificationService>['getNotification']
|
|
4
|
+
>[0];
|
|
3
5
|
export declare function sendNotification(notificationId: NotificationIdType): Promise<void>;
|
|
4
6
|
export declare const getAllPendingNotifications: () => Promise<NotificationIdType[]>;
|
|
5
7
|
export declare const emailActivities: {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
+
sendNotification: typeof sendNotification;
|
|
9
|
+
getAllPendingNotifications: () => Promise<NotificationIdType[]>;
|
|
8
10
|
};
|
|
9
11
|
export type EmailActivities = typeof emailActivities;
|
|
10
|
-
export {};
|
package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/workers/notifications/activities.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
3
2
|
exports.emailActivities = exports.getAllPendingNotifications = void 0;
|
|
4
3
|
exports.sendNotification = sendNotification;
|
|
5
|
-
const notifications_1 = require(
|
|
4
|
+
const notifications_1 = require('../../lib/services/notifications');
|
|
6
5
|
async function sendNotification(notificationId) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
const notificationService = (0, notifications_1.getNotificationService)();
|
|
7
|
+
if (!notificationId) {
|
|
8
|
+
throw new Error('Notification ID is required');
|
|
9
|
+
}
|
|
10
|
+
await notificationService.delayedSend(notificationId);
|
|
12
11
|
}
|
|
13
|
-
;
|
|
14
12
|
const getAllPendingNotifications = async () => {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
const notificationServices = (0, notifications_1.getNotificationService)();
|
|
14
|
+
const pendingNotifications = await notificationServices.getPendingNotifications();
|
|
15
|
+
return pendingNotifications
|
|
16
|
+
.map((notification) => notification.id)
|
|
17
|
+
.filter((nid) => nid !== undefined);
|
|
18
18
|
};
|
|
19
19
|
exports.getAllPendingNotifications = getAllPendingNotifications;
|
|
20
20
|
// Export as an object for Temporal activity registration
|
|
21
21
|
exports.emailActivities = {
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
sendNotification,
|
|
23
|
+
getAllPendingNotifications: exports.getAllPendingNotifications,
|
|
24
24
|
};
|
package/dist/examples/nextjs-prisma-nodemailer-pug-temporal/src/workers/notifications/config.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
3
2
|
exports.CONNECTION_CONFIG = exports.TEMPORAL_ADDRESS = void 0;
|
|
4
3
|
exports.TEMPORAL_ADDRESS = process.env.TEMPORAL_ADDRESS || 'localhost:7233';
|
|
5
4
|
exports.CONNECTION_CONFIG = {
|
|
6
|
-
|
|
5
|
+
address: exports.TEMPORAL_ADDRESS,
|
|
7
6
|
};
|