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.
- package/dist/implementations/vintasend-prisma/src/index.js +6 -4
- package/dist/implementations/vintasend-prisma/src/prisma-notification-backend.d.ts +296 -168
- package/dist/implementations/vintasend-prisma/src/prisma-notification-backend.js +389 -382
- package/dist/prisma-notification-backend.d.ts +209 -20
- package/dist/prisma-notification-backend.js +292 -16
- package/dist/services/notification-backends/base-notification-backend.d.ts +85 -26
- package/dist/services/notification-backends/base-notification-backend.js +1 -2
- package/dist/types/identifier.js +1 -2
- package/dist/types/json-values.d.ts +13 -9
- package/dist/types/json-values.js +1 -2
- package/dist/types/notification-context-generators.d.ts +4 -2
- package/dist/types/notification-context-generators.js +1 -2
- package/dist/types/notification-status.js +1 -2
- package/dist/types/notification-type-config.d.ts +5 -5
- package/dist/types/notification-type-config.js +1 -2
- package/dist/types/notification-type.js +1 -2
- package/dist/types/notification.d.ts +75 -41
- package/dist/types/notification.js +1 -2
- package/dist/types/one-off-notification.d.ts +66 -43
- package/dist/types/one-off-notification.js +1 -2
- package/dist/types/uuid.js +1 -2
- package/package.json +27 -29
|
@@ -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 {
|
|
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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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> =
|
|
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> =
|
|
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> =
|
|
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> =
|
|
95
|
+
export type AnyNotificationInput<Config extends BaseNotificationTypeConfig> =
|
|
96
|
+
| NotificationInput<Config>
|
|
97
|
+
| import('./one-off-notification').OneOffNotificationInput<Config>;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
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> =
|
|
88
|
+
export type OneOffNotification<Config extends BaseNotificationTypeConfig> =
|
|
89
|
+
| OneOffNotificationInput<Config>
|
|
90
|
+
| OneOffNotificationResendWithContextInput<Config>
|
|
91
|
+
| DatabaseOneOffNotification<Config>;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
package/dist/types/uuid.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
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.
|
|
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
|
-
|
|
15
|
-
|
|
16
|
-
"
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
|
|
27
|
-
|
|
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
|
+
}
|