@stacksjs/notifications 0.51.0 → 0.52.1
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 +1 -1
- package/dist/config.cjs +1 -3
- package/dist/config.d.ts +1 -1
- package/dist/config.mjs +1 -3
- package/dist/index.cjs +20 -20
- package/dist/index.d.ts +5 -9
- package/dist/index.mjs +17 -17
- package/package.json +41 -41
package/README.md
CHANGED
|
@@ -243,7 +243,7 @@ pnpm test
|
|
|
243
243
|
|
|
244
244
|
Please see our [releases](https://github.com/stacksjs/stacks/releases) page for more information on what has changed recently.
|
|
245
245
|
|
|
246
|
-
##
|
|
246
|
+
## 🚜 Contributing
|
|
247
247
|
|
|
248
248
|
Please review the [Contributing Guide](https://github.com/stacksjs/contributing) for details.
|
|
249
249
|
|
package/dist/config.cjs
CHANGED
package/dist/config.d.ts
CHANGED
package/dist/config.mjs
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -2,11 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
const errorHandling = require('@stacksjs/error-handling');
|
|
4
4
|
const config = require('@stacksjs/config');
|
|
5
|
+
const cli = require('@stacksjs/cli');
|
|
6
|
+
const types = require('@stacksjs/types');
|
|
5
7
|
const email = require('@stacksjs/email');
|
|
6
8
|
const chat = require('@stacksjs/chat');
|
|
7
9
|
const sms = require('@stacksjs/sms');
|
|
8
10
|
|
|
9
|
-
function
|
|
11
|
+
function _interopNamespaceCompat(e) {
|
|
12
|
+
if (e && typeof e === 'object' && 'default' in e) return e;
|
|
10
13
|
const n = Object.create(null);
|
|
11
14
|
if (e) {
|
|
12
15
|
for (const k in e) {
|
|
@@ -17,22 +20,26 @@ function _interopNamespaceDefault(e) {
|
|
|
17
20
|
return n;
|
|
18
21
|
}
|
|
19
22
|
|
|
20
|
-
const email__namespace = /*#__PURE__*/
|
|
21
|
-
const chat__namespace = /*#__PURE__*/
|
|
22
|
-
const sms__namespace = /*#__PURE__*/
|
|
23
|
+
const email__namespace = /*#__PURE__*/_interopNamespaceCompat(email);
|
|
24
|
+
const chat__namespace = /*#__PURE__*/_interopNamespaceCompat(chat);
|
|
25
|
+
const sms__namespace = /*#__PURE__*/_interopNamespaceCompat(sms);
|
|
23
26
|
|
|
24
|
-
|
|
27
|
+
function useChat(driver = "slack") {
|
|
25
28
|
return chat__namespace[driver];
|
|
26
|
-
}
|
|
27
|
-
|
|
29
|
+
}
|
|
30
|
+
function useEmail(driver = "mailtrap") {
|
|
28
31
|
return email__namespace[driver];
|
|
29
|
-
}
|
|
30
|
-
|
|
32
|
+
}
|
|
33
|
+
function useSMS(driver = "twilio") {
|
|
31
34
|
return sms__namespace[driver];
|
|
32
|
-
}
|
|
33
|
-
function useNotification(typeParam = "email", driverParam = "
|
|
34
|
-
|
|
35
|
-
|
|
35
|
+
}
|
|
36
|
+
function useNotification(typeParam = "email", driverParam = "mailtrap") {
|
|
37
|
+
if (!config.notification.default) {
|
|
38
|
+
cli.log.error("No default notification type set in config/notification.ts");
|
|
39
|
+
return process.exit(types.ExitCode.InvalidArgument);
|
|
40
|
+
}
|
|
41
|
+
const type = typeParam || config.notification.default;
|
|
42
|
+
const driver = driverParam || config.notification.default;
|
|
36
43
|
switch (type) {
|
|
37
44
|
case "email":
|
|
38
45
|
return useEmail(driver);
|
|
@@ -44,14 +51,7 @@ function useNotification(typeParam = "email", driverParam = "sendgrid") {
|
|
|
44
51
|
return errorHandling.err(`Type ${type} not supported`);
|
|
45
52
|
}
|
|
46
53
|
}
|
|
47
|
-
function notification() {
|
|
48
|
-
return useNotification();
|
|
49
|
-
}
|
|
50
54
|
|
|
51
|
-
exports.email = email__namespace;
|
|
52
|
-
exports.chat = chat__namespace;
|
|
53
|
-
exports.sms = sms__namespace;
|
|
54
|
-
exports.notification = notification;
|
|
55
55
|
exports.useChat = useChat;
|
|
56
56
|
exports.useEmail = useEmail;
|
|
57
57
|
exports.useNotification = useNotification;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
import * as email from '@stacksjs/email';
|
|
2
|
-
export { email };
|
|
3
2
|
import * as chat from '@stacksjs/chat';
|
|
4
|
-
export { chat };
|
|
5
3
|
import * as sms from '@stacksjs/sms';
|
|
6
|
-
export { sms };
|
|
7
4
|
|
|
8
|
-
declare
|
|
9
|
-
declare
|
|
10
|
-
declare
|
|
11
|
-
declare function useNotification(typeParam?: string, driverParam?: string):
|
|
12
|
-
declare function notification(): any;
|
|
5
|
+
declare function useChat(driver?: string): typeof chat.slack | typeof chat.discord | typeof chat.teams;
|
|
6
|
+
declare function useEmail(driver?: string): typeof email.sendgrid | typeof email.mailgun | typeof email.mailjet | typeof email.mandrill | typeof email.netcore | typeof email.nodemailer | typeof email.postmark | typeof email.ses | typeof email.emailjs;
|
|
7
|
+
declare function useSMS(driver?: string): typeof sms.twilio | typeof sms.plivo | typeof sms.nexmo | typeof sms.sms77 | typeof sms.sns | typeof sms.gupshup | typeof sms.telnyx | typeof sms.termii;
|
|
8
|
+
declare function useNotification(typeParam?: string, driverParam?: string): typeof chat.slack;
|
|
13
9
|
|
|
14
|
-
export {
|
|
10
|
+
export { useChat, useEmail, useNotification, useSMS };
|
package/dist/index.mjs
CHANGED
|
@@ -1,24 +1,27 @@
|
|
|
1
1
|
import { err } from '@stacksjs/error-handling';
|
|
2
|
-
import { notification
|
|
2
|
+
import { notification } from '@stacksjs/config';
|
|
3
|
+
import { log } from '@stacksjs/cli';
|
|
4
|
+
import { ExitCode } from '@stacksjs/types';
|
|
3
5
|
import * as email from '@stacksjs/email';
|
|
4
|
-
export { email };
|
|
5
6
|
import * as chat from '@stacksjs/chat';
|
|
6
|
-
export { chat };
|
|
7
7
|
import * as sms from '@stacksjs/sms';
|
|
8
|
-
export { sms };
|
|
9
8
|
|
|
10
|
-
|
|
9
|
+
function useChat(driver = "slack") {
|
|
11
10
|
return chat[driver];
|
|
12
|
-
}
|
|
13
|
-
|
|
11
|
+
}
|
|
12
|
+
function useEmail(driver = "mailtrap") {
|
|
14
13
|
return email[driver];
|
|
15
|
-
}
|
|
16
|
-
|
|
14
|
+
}
|
|
15
|
+
function useSMS(driver = "twilio") {
|
|
17
16
|
return sms[driver];
|
|
18
|
-
}
|
|
19
|
-
function useNotification(typeParam = "email", driverParam = "
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
}
|
|
18
|
+
function useNotification(typeParam = "email", driverParam = "mailtrap") {
|
|
19
|
+
if (!notification.default) {
|
|
20
|
+
log.error("No default notification type set in config/notification.ts");
|
|
21
|
+
return process.exit(ExitCode.InvalidArgument);
|
|
22
|
+
}
|
|
23
|
+
const type = typeParam || notification.default;
|
|
24
|
+
const driver = driverParam || notification.default;
|
|
22
25
|
switch (type) {
|
|
23
26
|
case "email":
|
|
24
27
|
return useEmail(driver);
|
|
@@ -30,8 +33,5 @@ function useNotification(typeParam = "email", driverParam = "sendgrid") {
|
|
|
30
33
|
return err(`Type ${type} not supported`);
|
|
31
34
|
}
|
|
32
35
|
}
|
|
33
|
-
function notification() {
|
|
34
|
-
return useNotification();
|
|
35
|
-
}
|
|
36
36
|
|
|
37
|
-
export {
|
|
37
|
+
export { useChat, useEmail, useNotification, useSMS };
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/notifications",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
5
|
-
"packageManager": "pnpm@
|
|
4
|
+
"version": "0.52.1",
|
|
5
|
+
"packageManager": "pnpm@8.5.1",
|
|
6
6
|
"description": "The Stacks notifications integration.",
|
|
7
7
|
"author": "Chris Breuer",
|
|
8
8
|
"license": "MIT",
|
|
@@ -30,7 +30,12 @@
|
|
|
30
30
|
"stacks",
|
|
31
31
|
"maizzle"
|
|
32
32
|
],
|
|
33
|
-
"
|
|
33
|
+
"exports": {
|
|
34
|
+
".": {
|
|
35
|
+
"types": "./dist/index.d.ts",
|
|
36
|
+
"import": "./dist/index.mjs"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
34
39
|
"module": "dist/index.mjs",
|
|
35
40
|
"types": "dist/index.d.ts",
|
|
36
41
|
"contributors": [
|
|
@@ -40,49 +45,44 @@
|
|
|
40
45
|
"dist",
|
|
41
46
|
"README.md"
|
|
42
47
|
],
|
|
43
|
-
"engines": {
|
|
44
|
-
"node": ">=v18.14.0",
|
|
45
|
-
"pnpm": ">=7.26.3"
|
|
46
|
-
},
|
|
47
48
|
"peerDependencies": {
|
|
48
|
-
"@
|
|
49
|
-
"@
|
|
50
|
-
"@
|
|
51
|
-
"@
|
|
52
|
-
"@
|
|
53
|
-
"@
|
|
54
|
-
"@
|
|
55
|
-
"@
|
|
56
|
-
"@novu/node": "^0.11.0",
|
|
57
|
-
"@novu/nodemailer": "^0.11.0",
|
|
58
|
-
"@novu/plivo": "^0.11.0",
|
|
59
|
-
"@novu/postmark": "^0.11.0",
|
|
60
|
-
"@novu/sendgrid": "^0.11.0",
|
|
61
|
-
"@novu/ses": "^0.11.0",
|
|
62
|
-
"@novu/slack": "^0.11.0",
|
|
63
|
-
"@novu/sms77": "^0.11.0",
|
|
64
|
-
"@novu/sns": "^0.11.0",
|
|
65
|
-
"@novu/stateless": "^0.11.0",
|
|
66
|
-
"@novu/telnyx": "^0.11.0",
|
|
67
|
-
"@novu/termii": "^0.11.0",
|
|
68
|
-
"@novu/twilio": "^0.11.0",
|
|
69
|
-
"@stacksjs/chat": "0.51.0",
|
|
70
|
-
"@stacksjs/cli": "0.51.0",
|
|
71
|
-
"@stacksjs/config": "0.51.0",
|
|
72
|
-
"@stacksjs/email": "0.51.0",
|
|
73
|
-
"@stacksjs/error-handling": "0.51.0",
|
|
74
|
-
"@stacksjs/push": "0.51.0",
|
|
75
|
-
"@stacksjs/sms": "0.51.0",
|
|
76
|
-
"@stacksjs/types": "0.51.0"
|
|
49
|
+
"@stacksjs/chat": "0.52.1",
|
|
50
|
+
"@stacksjs/cli": "0.52.1",
|
|
51
|
+
"@stacksjs/config": "0.52.1",
|
|
52
|
+
"@stacksjs/email": "0.52.1",
|
|
53
|
+
"@stacksjs/push": "0.52.1",
|
|
54
|
+
"@stacksjs/error-handling": "0.52.1",
|
|
55
|
+
"@stacksjs/sms": "0.52.1",
|
|
56
|
+
"@stacksjs/types": "0.52.1"
|
|
77
57
|
},
|
|
78
58
|
"dependencies": {
|
|
79
|
-
"@maizzle/framework": "^4.
|
|
59
|
+
"@maizzle/framework": "^4.4.4"
|
|
60
|
+
},
|
|
61
|
+
"optionalDependencies": {
|
|
62
|
+
"@novu/discord": "^0.15.0",
|
|
63
|
+
"@novu/emailjs": "^0.15.0",
|
|
64
|
+
"@novu/gupshup": "^0.15.0",
|
|
65
|
+
"@novu/mailgun": "^0.15.0",
|
|
66
|
+
"@novu/mailjet": "^0.15.0",
|
|
67
|
+
"@novu/mandrill": "^0.15.0",
|
|
68
|
+
"@novu/netcore": "^0.15.0",
|
|
69
|
+
"@novu/nexmo": "^0.15.0",
|
|
70
|
+
"@novu/node": "^0.15.0",
|
|
71
|
+
"@novu/nodemailer": "^0.15.0",
|
|
72
|
+
"@novu/plivo": "^0.15.0",
|
|
73
|
+
"@novu/postmark": "^0.15.0",
|
|
74
|
+
"@novu/sendgrid": "^0.15.0",
|
|
75
|
+
"@novu/ses": "^0.15.0",
|
|
76
|
+
"@novu/slack": "^0.15.0",
|
|
77
|
+
"@novu/sms77": "^0.15.0",
|
|
78
|
+
"@novu/sns": "^0.15.0",
|
|
79
|
+
"@novu/stateless": "^0.15.0",
|
|
80
|
+
"@novu/telnyx": "^0.15.0",
|
|
81
|
+
"@novu/termii": "^0.15.0",
|
|
82
|
+
"@novu/twilio": "^0.15.0"
|
|
80
83
|
},
|
|
81
84
|
"devDependencies": {
|
|
82
|
-
"
|
|
83
|
-
"typescript": "^4.9.5",
|
|
84
|
-
"unbuild": "^1.1.1",
|
|
85
|
-
"@stacksjs/testing": "0.51.0"
|
|
85
|
+
"@stacksjs/development": "0.52.1"
|
|
86
86
|
},
|
|
87
87
|
"scripts": {
|
|
88
88
|
"build": "unbuild",
|