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
package/dist/services/notification-template-renderers/base-notification-template-renderer.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { JsonObject } from '../../types/json-values';
|
|
2
|
-
import type {
|
|
2
|
+
import type { AnyNotification } from '../../types/notification';
|
|
3
3
|
import type { BaseNotificationTypeConfig } from '../../types/notification-type-config';
|
|
4
4
|
export interface BaseNotificationTemplateRenderer<Config extends BaseNotificationTypeConfig, T = unknown> {
|
|
5
|
-
render(notification:
|
|
5
|
+
render(notification: AnyNotification<Config>, context: JsonObject): Promise<T>;
|
|
6
6
|
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { Readable } from 'node:stream';
|
|
2
|
+
export type FileAttachment = Buffer | ReadableStream | Readable | string;
|
|
3
|
+
export interface NotificationAttachmentUpload {
|
|
4
|
+
file: FileAttachment;
|
|
5
|
+
filename: string;
|
|
6
|
+
contentType?: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface NotificationAttachmentReference {
|
|
10
|
+
fileId: string;
|
|
11
|
+
description?: string;
|
|
12
|
+
}
|
|
13
|
+
export type NotificationAttachment = NotificationAttachmentUpload | NotificationAttachmentReference;
|
|
14
|
+
export declare function isAttachmentReference(attachment: NotificationAttachment): attachment is NotificationAttachmentReference;
|
|
15
|
+
export interface AttachmentFile {
|
|
16
|
+
read(): Promise<Buffer>;
|
|
17
|
+
stream(): Promise<ReadableStream>;
|
|
18
|
+
url(expiresIn?: number): Promise<string>;
|
|
19
|
+
delete(): Promise<void>;
|
|
20
|
+
}
|
|
21
|
+
export interface AttachmentFileRecord {
|
|
22
|
+
id: string;
|
|
23
|
+
filename: string;
|
|
24
|
+
contentType: string;
|
|
25
|
+
size: number;
|
|
26
|
+
checksum: string;
|
|
27
|
+
storageMetadata: Record<string, unknown>;
|
|
28
|
+
createdAt: Date;
|
|
29
|
+
updatedAt: Date;
|
|
30
|
+
}
|
|
31
|
+
export interface StoredAttachment {
|
|
32
|
+
id: string;
|
|
33
|
+
fileId: string;
|
|
34
|
+
filename: string;
|
|
35
|
+
contentType: string;
|
|
36
|
+
size: number;
|
|
37
|
+
checksum: string;
|
|
38
|
+
createdAt: Date;
|
|
39
|
+
file: AttachmentFile;
|
|
40
|
+
description?: string;
|
|
41
|
+
storageMetadata: Record<string, unknown>;
|
|
42
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isAttachmentReference = isAttachmentReference;
|
|
4
|
+
// Type guard to check if attachment is a reference
|
|
5
|
+
function isAttachmentReference(attachment) {
|
|
6
|
+
return 'fileId' in attachment;
|
|
7
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
1
|
+
import type { Identifier } from './identifier';
|
|
2
|
+
import type { ContextGenerator } from './notification-context-generators';
|
|
3
3
|
export type BaseNotificationTypeConfig = {
|
|
4
4
|
ContextMap: Record<string, ContextGenerator>;
|
|
5
5
|
NotificationIdType: Identifier;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
import type { NotificationAttachment, StoredAttachment } from './attachment';
|
|
1
2
|
import type { InputJsonValue, JsonValue } from './json-values';
|
|
2
3
|
import type { NotificationStatus } from './notification-status';
|
|
3
4
|
import type { NotificationType } from './notification-type';
|
|
4
5
|
import type { BaseNotificationTypeConfig } from './notification-type-config';
|
|
6
|
+
import type { DatabaseOneOffNotification, OneOffNotification, OneOffNotificationInput } from './one-off-notification';
|
|
7
|
+
export type { DatabaseOneOffNotification, OneOffNotification, OneOffNotificationInput, OneOffNotificationResendWithContextInput, } from './one-off-notification';
|
|
5
8
|
export type NotificationInput<Config extends BaseNotificationTypeConfig> = {
|
|
6
9
|
userId: Config['UserIdType'];
|
|
7
10
|
notificationType: NotificationType;
|
|
@@ -12,6 +15,7 @@ export type NotificationInput<Config extends BaseNotificationTypeConfig> = {
|
|
|
12
15
|
sendAfter: Date | null;
|
|
13
16
|
subjectTemplate: string | null;
|
|
14
17
|
extraParams: InputJsonValue | null;
|
|
18
|
+
attachments?: NotificationAttachment[];
|
|
15
19
|
};
|
|
16
20
|
export type NotificationResendWithContextInput<Config extends BaseNotificationTypeConfig> = {
|
|
17
21
|
userId: Config['UserIdType'];
|
|
@@ -24,6 +28,7 @@ export type NotificationResendWithContextInput<Config extends BaseNotificationTy
|
|
|
24
28
|
sendAfter: Date | null;
|
|
25
29
|
subjectTemplate: string | null;
|
|
26
30
|
extraParams: InputJsonValue | null;
|
|
31
|
+
attachments?: NotificationAttachment[];
|
|
27
32
|
};
|
|
28
33
|
export type DatabaseNotification<Config extends BaseNotificationTypeConfig> = {
|
|
29
34
|
id: Config['NotificationIdType'];
|
|
@@ -43,5 +48,21 @@ export type DatabaseNotification<Config extends BaseNotificationTypeConfig> = {
|
|
|
43
48
|
readAt: Date | null;
|
|
44
49
|
createdAt?: Date;
|
|
45
50
|
updatedAt?: Date;
|
|
51
|
+
attachments?: StoredAttachment[];
|
|
46
52
|
};
|
|
47
53
|
export type Notification<Config extends BaseNotificationTypeConfig> = NotificationInput<Config> | NotificationResendWithContextInput<Config> | DatabaseNotification<Config>;
|
|
54
|
+
/**
|
|
55
|
+
* Union type representing any notification type (regular or one-off).
|
|
56
|
+
* This is useful for methods that handle both notification types.
|
|
57
|
+
*/
|
|
58
|
+
export type AnyNotification<Config extends BaseNotificationTypeConfig> = Notification<Config> | OneOffNotification<Config>;
|
|
59
|
+
/**
|
|
60
|
+
* Union type for database notifications only (regular or one-off).
|
|
61
|
+
* Useful for send methods and database queries.
|
|
62
|
+
*/
|
|
63
|
+
export type AnyDatabaseNotification<Config extends BaseNotificationTypeConfig> = DatabaseNotification<Config> | DatabaseOneOffNotification<Config>;
|
|
64
|
+
/**
|
|
65
|
+
* Union type for notification inputs only (regular or one-off).
|
|
66
|
+
* Useful for creation methods.
|
|
67
|
+
*/
|
|
68
|
+
export type AnyNotificationInput<Config extends BaseNotificationTypeConfig> = NotificationInput<Config> | OneOffNotificationInput<Config>;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { NotificationAttachment, StoredAttachment } from './attachment';
|
|
2
|
+
import type { InputJsonValue, JsonValue } from './json-values';
|
|
3
|
+
import type { NotificationStatus } from './notification-status';
|
|
4
|
+
import type { NotificationType } from './notification-type';
|
|
5
|
+
import type { BaseNotificationTypeConfig } from './notification-type-config';
|
|
6
|
+
/**
|
|
7
|
+
* Input type for creating a one-off notification.
|
|
8
|
+
* One-off notifications are sent directly to an email/phone without requiring a user account.
|
|
9
|
+
*/
|
|
10
|
+
export type OneOffNotificationInput<Config extends BaseNotificationTypeConfig> = {
|
|
11
|
+
emailOrPhone: string;
|
|
12
|
+
firstName: string;
|
|
13
|
+
lastName: string;
|
|
14
|
+
notificationType: NotificationType;
|
|
15
|
+
title: string | null;
|
|
16
|
+
bodyTemplate: string;
|
|
17
|
+
contextName: string & keyof Config['ContextMap'];
|
|
18
|
+
contextParameters: Parameters<Config['ContextMap'][OneOffNotificationInput<Config>['contextName']]['generate']>[0];
|
|
19
|
+
sendAfter: Date | null;
|
|
20
|
+
subjectTemplate: string | null;
|
|
21
|
+
extraParams: InputJsonValue | null;
|
|
22
|
+
attachments?: NotificationAttachment[];
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Input type for resending a one-off notification with stored context.
|
|
26
|
+
* Similar to OneOffNotificationInput but includes the contextUsed field.
|
|
27
|
+
*/
|
|
28
|
+
export type OneOffNotificationResendWithContextInput<Config extends BaseNotificationTypeConfig> = {
|
|
29
|
+
emailOrPhone: string;
|
|
30
|
+
firstName: string;
|
|
31
|
+
lastName: string;
|
|
32
|
+
notificationType: NotificationType;
|
|
33
|
+
title: string | null;
|
|
34
|
+
bodyTemplate: string;
|
|
35
|
+
contextName: string & keyof Config['ContextMap'];
|
|
36
|
+
contextParameters: Parameters<Config['ContextMap'][OneOffNotificationResendWithContextInput<Config>['contextName']]['generate']>[0];
|
|
37
|
+
contextUsed: ReturnType<Config['ContextMap'][OneOffNotificationResendWithContextInput<Config>['contextName']]['generate']> extends Promise<infer T> ? T : ReturnType<Config['ContextMap'][OneOffNotificationResendWithContextInput<Config>['contextName']]['generate']>;
|
|
38
|
+
sendAfter: Date | null;
|
|
39
|
+
subjectTemplate: string | null;
|
|
40
|
+
extraParams: InputJsonValue | null;
|
|
41
|
+
attachments?: NotificationAttachment[];
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Database representation of a one-off notification.
|
|
45
|
+
* Includes all fields from input plus database-managed fields (id, status, timestamps, etc.)
|
|
46
|
+
*/
|
|
47
|
+
export type DatabaseOneOffNotification<Config extends BaseNotificationTypeConfig> = {
|
|
48
|
+
id: Config['NotificationIdType'];
|
|
49
|
+
emailOrPhone: string;
|
|
50
|
+
firstName: string;
|
|
51
|
+
lastName: string;
|
|
52
|
+
notificationType: NotificationType;
|
|
53
|
+
title: string | null;
|
|
54
|
+
bodyTemplate: string;
|
|
55
|
+
contextName: string & keyof Config['ContextMap'];
|
|
56
|
+
contextParameters: Parameters<Config['ContextMap'][DatabaseOneOffNotification<Config>['contextName']]['generate']>[0];
|
|
57
|
+
sendAfter: Date | null;
|
|
58
|
+
subjectTemplate: string | null;
|
|
59
|
+
status: NotificationStatus;
|
|
60
|
+
contextUsed: null | (ReturnType<Config['ContextMap'][DatabaseOneOffNotification<Config>['contextName']]['generate']> extends Promise<infer T> ? T : ReturnType<Config['ContextMap'][DatabaseOneOffNotification<Config>['contextName']]['generate']>);
|
|
61
|
+
extraParams: JsonValue;
|
|
62
|
+
adapterUsed: string | null;
|
|
63
|
+
sentAt: Date | null;
|
|
64
|
+
readAt: Date | null;
|
|
65
|
+
createdAt?: Date;
|
|
66
|
+
updatedAt?: Date;
|
|
67
|
+
attachments?: StoredAttachment[];
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* Union type representing any one-off notification (input, resend, or database).
|
|
71
|
+
*/
|
|
72
|
+
export type OneOffNotification<Config extends BaseNotificationTypeConfig> = OneOffNotificationInput<Config> | OneOffNotificationResendWithContextInput<Config> | DatabaseOneOffNotification<Config>;
|
package/package.json
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vintasend",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
|
-
"files": [
|
|
6
|
-
"dist"
|
|
7
|
-
],
|
|
5
|
+
"files": ["dist"],
|
|
8
6
|
"author": "Hugo Bessa",
|
|
9
7
|
"license": "MIT",
|
|
10
8
|
"scripts": {
|
|
11
9
|
"lint": "biome check .",
|
|
12
10
|
"format": "biome format .",
|
|
13
|
-
"check": "biome check --
|
|
11
|
+
"check": "biome check --write .",
|
|
14
12
|
"build": "tsc",
|
|
15
13
|
"prepublishOnly": "npm run build",
|
|
16
14
|
"test": "jest",
|
|
@@ -18,11 +16,15 @@
|
|
|
18
16
|
"test:coverage": "jest --coverage"
|
|
19
17
|
},
|
|
20
18
|
"devDependencies": {
|
|
21
|
-
"@biomejs/biome": "
|
|
22
|
-
"@types/jest": "^
|
|
23
|
-
"@types/
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
19
|
+
"@biomejs/biome": "^2.3.11",
|
|
20
|
+
"@types/jest": "^30.0.0",
|
|
21
|
+
"@types/mime-types": "^3.0.1",
|
|
22
|
+
"@types/node": "^25.0.8",
|
|
23
|
+
"jest": "^30.2.0",
|
|
24
|
+
"ts-jest": "^29.4.6",
|
|
25
|
+
"typescript": "^5.9.3"
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"mime-types": "^3.0.2"
|
|
27
29
|
}
|
|
28
30
|
}
|