vintasend-prisma 0.3.0 → 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.
@@ -2,62 +2,96 @@ import type { InputJsonValue, JsonValue } from './json-values';
2
2
  import type { NotificationStatus } from './notification-status';
3
3
  import type { NotificationType } from './notification-type';
4
4
  import type { BaseNotificationTypeConfig } from './notification-type-config';
5
- export type { OneOffNotificationInput, OneOffNotificationResendWithContextInput, DatabaseOneOffNotification, OneOffNotification, } from './one-off-notification';
5
+ export type {
6
+ OneOffNotificationInput,
7
+ OneOffNotificationResendWithContextInput,
8
+ DatabaseOneOffNotification,
9
+ OneOffNotification,
10
+ } from './one-off-notification';
6
11
  export type NotificationInput<Config extends BaseNotificationTypeConfig> = {
7
- userId: Config['UserIdType'];
8
- notificationType: NotificationType;
9
- title: string | null;
10
- bodyTemplate: string;
11
- contextName: string & keyof Config['ContextMap'];
12
- contextParameters: Parameters<Config['ContextMap'][NotificationInput<Config>['contextName']]['generate']>[0];
13
- sendAfter: Date | null;
14
- subjectTemplate: string | null;
15
- extraParams: InputJsonValue | null;
12
+ userId: Config['UserIdType'];
13
+ notificationType: NotificationType;
14
+ title: string | null;
15
+ bodyTemplate: string;
16
+ contextName: string & keyof Config['ContextMap'];
17
+ contextParameters: Parameters<
18
+ Config['ContextMap'][NotificationInput<Config>['contextName']]['generate']
19
+ >[0];
20
+ sendAfter: Date | null;
21
+ subjectTemplate: string | null;
22
+ extraParams: InputJsonValue | null;
16
23
  };
17
24
  export type NotificationResendWithContextInput<Config extends BaseNotificationTypeConfig> = {
18
- userId: Config['UserIdType'];
19
- notificationType: NotificationType;
20
- title: string | null;
21
- bodyTemplate: string;
22
- contextName: string & keyof Config['ContextMap'];
23
- contextParameters: Parameters<Config['ContextMap'][NotificationResendWithContextInput<Config>['contextName']]['generate']>[0];
24
- contextUsed: ReturnType<Config['ContextMap'][NotificationResendWithContextInput<Config>['contextName']]['generate']> extends Promise<infer T> ? T : ReturnType<Config['ContextMap'][NotificationResendWithContextInput<Config>['contextName']]['generate']>;
25
- sendAfter: Date | null;
26
- subjectTemplate: string | null;
27
- extraParams: InputJsonValue | null;
25
+ userId: Config['UserIdType'];
26
+ notificationType: NotificationType;
27
+ title: string | null;
28
+ bodyTemplate: string;
29
+ contextName: string & keyof Config['ContextMap'];
30
+ contextParameters: Parameters<
31
+ Config['ContextMap'][NotificationResendWithContextInput<Config>['contextName']]['generate']
32
+ >[0];
33
+ contextUsed: ReturnType<
34
+ Config['ContextMap'][NotificationResendWithContextInput<Config>['contextName']]['generate']
35
+ > extends Promise<infer T>
36
+ ? T
37
+ : ReturnType<
38
+ Config['ContextMap'][NotificationResendWithContextInput<Config>['contextName']]['generate']
39
+ >;
40
+ sendAfter: Date | null;
41
+ subjectTemplate: string | null;
42
+ extraParams: InputJsonValue | null;
28
43
  };
29
44
  export type DatabaseNotification<Config extends BaseNotificationTypeConfig> = {
30
- id: Config['NotificationIdType'];
31
- userId: Config['UserIdType'];
32
- notificationType: NotificationType;
33
- title: string | null;
34
- bodyTemplate: string;
35
- contextName: string & keyof Config['ContextMap'];
36
- contextParameters: Parameters<Config['ContextMap'][DatabaseNotification<Config>['contextName']]['generate']>[0];
37
- sendAfter: Date | null;
38
- subjectTemplate: string | null;
39
- status: NotificationStatus;
40
- contextUsed: null | (ReturnType<Config['ContextMap'][DatabaseNotification<Config>['contextName']]['generate']> extends Promise<infer T> ? T : ReturnType<Config['ContextMap'][DatabaseNotification<Config>['contextName']]['generate']>);
41
- extraParams: JsonValue;
42
- adapterUsed: string | null;
43
- sentAt: Date | null;
44
- readAt: Date | null;
45
- createdAt?: Date;
46
- updatedAt?: Date;
45
+ id: Config['NotificationIdType'];
46
+ userId: Config['UserIdType'];
47
+ notificationType: NotificationType;
48
+ title: string | null;
49
+ bodyTemplate: string;
50
+ contextName: string & keyof Config['ContextMap'];
51
+ contextParameters: Parameters<
52
+ Config['ContextMap'][DatabaseNotification<Config>['contextName']]['generate']
53
+ >[0];
54
+ sendAfter: Date | null;
55
+ subjectTemplate: string | null;
56
+ status: NotificationStatus;
57
+ contextUsed:
58
+ | null
59
+ | (ReturnType<
60
+ Config['ContextMap'][DatabaseNotification<Config>['contextName']]['generate']
61
+ > extends Promise<infer T>
62
+ ? T
63
+ : ReturnType<
64
+ Config['ContextMap'][DatabaseNotification<Config>['contextName']]['generate']
65
+ >);
66
+ extraParams: JsonValue;
67
+ adapterUsed: string | null;
68
+ sentAt: Date | null;
69
+ readAt: Date | null;
70
+ createdAt?: Date;
71
+ updatedAt?: Date;
47
72
  };
48
- export type Notification<Config extends BaseNotificationTypeConfig> = NotificationInput<Config> | NotificationResendWithContextInput<Config> | DatabaseNotification<Config>;
73
+ export type Notification<Config extends BaseNotificationTypeConfig> =
74
+ | NotificationInput<Config>
75
+ | NotificationResendWithContextInput<Config>
76
+ | DatabaseNotification<Config>;
49
77
  /**
50
78
  * Union type representing any notification type (regular or one-off).
51
79
  * This is useful for methods that handle both notification types.
52
80
  */
53
- export type AnyNotification<Config extends BaseNotificationTypeConfig> = Notification<Config> | import('./one-off-notification').OneOffNotification<Config>;
81
+ export type AnyNotification<Config extends BaseNotificationTypeConfig> =
82
+ | Notification<Config>
83
+ | import('./one-off-notification').OneOffNotification<Config>;
54
84
  /**
55
85
  * Union type for database notifications only (regular or one-off).
56
86
  * Useful for send methods and database queries.
57
87
  */
58
- export type AnyDatabaseNotification<Config extends BaseNotificationTypeConfig> = DatabaseNotification<Config> | import('./one-off-notification').DatabaseOneOffNotification<Config>;
88
+ export type AnyDatabaseNotification<Config extends BaseNotificationTypeConfig> =
89
+ | DatabaseNotification<Config>
90
+ | import('./one-off-notification').DatabaseOneOffNotification<Config>;
59
91
  /**
60
92
  * Union type for notification inputs only (regular or one-off).
61
93
  * Useful for creation methods.
62
94
  */
63
- export type AnyNotificationInput<Config extends BaseNotificationTypeConfig> = NotificationInput<Config> | import('./one-off-notification').OneOffNotificationInput<Config>;
95
+ export type AnyNotificationInput<Config extends BaseNotificationTypeConfig> =
96
+ | NotificationInput<Config>
97
+ | import('./one-off-notification').OneOffNotificationInput<Config>;
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ Object.defineProperty(exports, '__esModule', { value: true });
@@ -7,62 +7,85 @@ import type { BaseNotificationTypeConfig } from './notification-type-config';
7
7
  * One-off notifications are sent directly to an email/phone without requiring a user account.
8
8
  */
9
9
  export type OneOffNotificationInput<Config extends BaseNotificationTypeConfig> = {
10
- emailOrPhone: string;
11
- firstName: string;
12
- lastName: string;
13
- notificationType: NotificationType;
14
- title: string | null;
15
- bodyTemplate: string;
16
- contextName: string & keyof Config['ContextMap'];
17
- contextParameters: Parameters<Config['ContextMap'][OneOffNotificationInput<Config>['contextName']]['generate']>[0];
18
- sendAfter: Date | null;
19
- subjectTemplate: string | null;
20
- extraParams: InputJsonValue | null;
10
+ emailOrPhone: string;
11
+ firstName: string;
12
+ lastName: string;
13
+ notificationType: NotificationType;
14
+ title: string | null;
15
+ bodyTemplate: string;
16
+ contextName: string & keyof Config['ContextMap'];
17
+ contextParameters: Parameters<
18
+ Config['ContextMap'][OneOffNotificationInput<Config>['contextName']]['generate']
19
+ >[0];
20
+ sendAfter: Date | null;
21
+ subjectTemplate: string | null;
22
+ extraParams: InputJsonValue | null;
21
23
  };
22
24
  /**
23
25
  * Input type for resending a one-off notification with stored context.
24
26
  * Similar to OneOffNotificationInput but includes the contextUsed field.
25
27
  */
26
28
  export type OneOffNotificationResendWithContextInput<Config extends BaseNotificationTypeConfig> = {
27
- emailOrPhone: string;
28
- firstName: string;
29
- lastName: string;
30
- notificationType: NotificationType;
31
- title: string | null;
32
- bodyTemplate: string;
33
- contextName: string & keyof Config['ContextMap'];
34
- contextParameters: Parameters<Config['ContextMap'][OneOffNotificationResendWithContextInput<Config>['contextName']]['generate']>[0];
35
- contextUsed: ReturnType<Config['ContextMap'][OneOffNotificationResendWithContextInput<Config>['contextName']]['generate']> extends Promise<infer T> ? T : ReturnType<Config['ContextMap'][OneOffNotificationResendWithContextInput<Config>['contextName']]['generate']>;
36
- sendAfter: Date | null;
37
- subjectTemplate: string | null;
38
- extraParams: InputJsonValue | null;
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<
37
+ Config['ContextMap'][OneOffNotificationResendWithContextInput<Config>['contextName']]['generate']
38
+ >[0];
39
+ contextUsed: ReturnType<
40
+ Config['ContextMap'][OneOffNotificationResendWithContextInput<Config>['contextName']]['generate']
41
+ > extends Promise<infer T>
42
+ ? T
43
+ : ReturnType<
44
+ Config['ContextMap'][OneOffNotificationResendWithContextInput<Config>['contextName']]['generate']
45
+ >;
46
+ sendAfter: Date | null;
47
+ subjectTemplate: string | null;
48
+ extraParams: InputJsonValue | null;
39
49
  };
40
50
  /**
41
51
  * Database representation of a one-off notification.
42
52
  * Includes all fields from input plus database-managed fields (id, status, timestamps, etc.)
43
53
  */
44
54
  export type DatabaseOneOffNotification<Config extends BaseNotificationTypeConfig> = {
45
- id: Config['NotificationIdType'];
46
- emailOrPhone: string;
47
- firstName: string;
48
- lastName: string;
49
- notificationType: NotificationType;
50
- title: string | null;
51
- bodyTemplate: string;
52
- contextName: string & keyof Config['ContextMap'];
53
- contextParameters: Parameters<Config['ContextMap'][DatabaseOneOffNotification<Config>['contextName']]['generate']>[0];
54
- sendAfter: Date | null;
55
- subjectTemplate: string | null;
56
- status: NotificationStatus;
57
- contextUsed: null | (ReturnType<Config['ContextMap'][DatabaseOneOffNotification<Config>['contextName']]['generate']> extends Promise<infer T> ? T : ReturnType<Config['ContextMap'][DatabaseOneOffNotification<Config>['contextName']]['generate']>);
58
- extraParams: JsonValue;
59
- adapterUsed: string | null;
60
- sentAt: Date | null;
61
- readAt: Date | null;
62
- createdAt?: Date;
63
- updatedAt?: Date;
55
+ id: Config['NotificationIdType'];
56
+ emailOrPhone: string;
57
+ firstName: string;
58
+ lastName: string;
59
+ notificationType: NotificationType;
60
+ title: string | null;
61
+ bodyTemplate: string;
62
+ contextName: string & keyof Config['ContextMap'];
63
+ contextParameters: Parameters<
64
+ Config['ContextMap'][DatabaseOneOffNotification<Config>['contextName']]['generate']
65
+ >[0];
66
+ sendAfter: Date | null;
67
+ subjectTemplate: string | null;
68
+ status: NotificationStatus;
69
+ contextUsed:
70
+ | null
71
+ | (ReturnType<
72
+ Config['ContextMap'][DatabaseOneOffNotification<Config>['contextName']]['generate']
73
+ > extends Promise<infer T>
74
+ ? T
75
+ : ReturnType<
76
+ Config['ContextMap'][DatabaseOneOffNotification<Config>['contextName']]['generate']
77
+ >);
78
+ extraParams: JsonValue;
79
+ adapterUsed: string | null;
80
+ sentAt: Date | null;
81
+ readAt: Date | null;
82
+ createdAt?: Date;
83
+ updatedAt?: Date;
64
84
  };
65
85
  /**
66
86
  * Union type representing any one-off notification (input, resend, or database).
67
87
  */
68
- export type OneOffNotification<Config extends BaseNotificationTypeConfig> = OneOffNotificationInput<Config> | OneOffNotificationResendWithContextInput<Config> | DatabaseOneOffNotification<Config>;
88
+ export type OneOffNotification<Config extends BaseNotificationTypeConfig> =
89
+ | OneOffNotificationInput<Config>
90
+ | OneOffNotificationResendWithContextInput<Config>
91
+ | DatabaseOneOffNotification<Config>;
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ Object.defineProperty(exports, '__esModule', { value: true });
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ Object.defineProperty(exports, '__esModule', { value: true });
package/package.json CHANGED
@@ -1,29 +1,27 @@
1
- {
2
- "name": "vintasend-prisma",
3
- "version": "0.3.0",
4
- "description": "VintaSend Backend implementation for Prisma",
5
- "main": "dist/index.js",
6
- "scripts": {
7
- "build": "tsc",
8
- "prepublishOnly": "npm run build",
9
- "test": "jest",
10
- "test:watch": "jest --watch",
11
- "test:coverage": "jest --coverage"
12
- },
13
- "files": [
14
- "dist"
15
- ],
16
- "author": "Hugo Bessa",
17
- "license": "MIT",
18
- "dependencies": {
19
- "@prisma/client": "^6.3.1",
20
- "prisma": "^6.3.1",
21
- "vintasend": "^0.3.0"
22
- },
23
- "devDependencies": {
24
- "@types/jest": "^29.5.14",
25
- "jest": "^29.7.0",
26
- "ts-jest": "^29.2.6",
27
- "typescript": "^5.8.2"
28
- }
29
- }
1
+ {
2
+ "name": "vintasend-prisma",
3
+ "version": "0.4.0",
4
+ "description": "VintaSend Backend implementation for Prisma",
5
+ "main": "dist/index.js",
6
+ "scripts": {
7
+ "build": "tsc",
8
+ "prepublishOnly": "npm run build",
9
+ "test": "jest",
10
+ "test:watch": "jest --watch",
11
+ "test:coverage": "jest --coverage"
12
+ },
13
+ "files": ["dist"],
14
+ "author": "Hugo Bessa",
15
+ "license": "MIT",
16
+ "dependencies": {
17
+ "@prisma/client": "^6.3.1",
18
+ "prisma": "^6.3.1",
19
+ "vintasend": "^0.4.0"
20
+ },
21
+ "devDependencies": {
22
+ "@types/jest": "^29.5.14",
23
+ "jest": "^29.7.0",
24
+ "ts-jest": "^29.2.6",
25
+ "typescript": "^5.8.2"
26
+ }
27
+ }