@stacksjs/notifications 0.57.3 โ 0.58.19
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 +4 -4
- package/dist/index.js +54 -0
- package/package.json +58 -47
- package/LICENSE.md +0 -21
- package/dist/index.d.ts +0 -10
- package/dist/index.mjs +0 -38
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@ Stacks Notifications is a unified driver system for sending messages/notificatio
|
|
|
17
17
|
## ๐ค Usage
|
|
18
18
|
|
|
19
19
|
```bash
|
|
20
|
-
|
|
20
|
+
bun install -d @stacksjs/notifications
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
Set these variables in your env:
|
|
@@ -236,7 +236,7 @@ Learn more in the docs.
|
|
|
236
236
|
## ๐งช Testing
|
|
237
237
|
|
|
238
238
|
```bash
|
|
239
|
-
|
|
239
|
+
bun test
|
|
240
240
|
```
|
|
241
241
|
|
|
242
242
|
## ๐ Changelog
|
|
@@ -255,7 +255,7 @@ For help, discussion about best practices, or any other conversation that would
|
|
|
255
255
|
|
|
256
256
|
For casual chit-chat with others using this package:
|
|
257
257
|
|
|
258
|
-
[Join the Stacks Discord Server](https://discord.
|
|
258
|
+
[Join the Stacks Discord Server](https://discord.gg/stacksjs)
|
|
259
259
|
|
|
260
260
|
## ๐๐ผ Credits
|
|
261
261
|
|
|
@@ -269,4 +269,4 @@ Many thanks to the following core technologies & people who have contributed to
|
|
|
269
269
|
|
|
270
270
|
The MIT License (MIT). Please see [LICENSE](https://github.com/stacksjs/stacks/tree/main/LICENSE.md) for more information.
|
|
271
271
|
|
|
272
|
-
Made with
|
|
272
|
+
Made with ๐
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// src/index.ts
|
|
3
|
+
import process from "process";
|
|
4
|
+
import {err} from "@stacksjs/error-handling";
|
|
5
|
+
import {notification as config2} from "@stacksjs/config";
|
|
6
|
+
import {log} from "@stacksjs/cli";
|
|
7
|
+
import {ExitCode} from "@stacksjs/types";
|
|
8
|
+
|
|
9
|
+
// src/drivers/chat.ts
|
|
10
|
+
import * as chat from "@stacksjs/chat";
|
|
11
|
+
// src/drivers/email.ts
|
|
12
|
+
import * as email from "@stacksjs/email";
|
|
13
|
+
// src/drivers/push.ts
|
|
14
|
+
import * as push from "@stacksjs/push";
|
|
15
|
+
// src/drivers/sms.ts
|
|
16
|
+
import * as sms from "@stacksjs/sms";
|
|
17
|
+
// src/index.ts
|
|
18
|
+
var useChat = function(driver = "slack") {
|
|
19
|
+
return chat[driver];
|
|
20
|
+
};
|
|
21
|
+
var useEmail = function(driver = "mailtrap") {
|
|
22
|
+
return email[driver];
|
|
23
|
+
};
|
|
24
|
+
var useSMS = function(driver = "twilio") {
|
|
25
|
+
return sms[driver];
|
|
26
|
+
};
|
|
27
|
+
var useNotification = function(typeParam = "email", driverParam = "mailtrap") {
|
|
28
|
+
if (!config2.default) {
|
|
29
|
+
log.error("No default notification type set in config/notification.ts");
|
|
30
|
+
return process.exit(ExitCode.InvalidArgument);
|
|
31
|
+
}
|
|
32
|
+
const type = typeParam || config2.default;
|
|
33
|
+
const driver = driverParam || config2.default;
|
|
34
|
+
switch (type) {
|
|
35
|
+
case "email":
|
|
36
|
+
return useEmail(driver);
|
|
37
|
+
case "chat":
|
|
38
|
+
return useChat(driver);
|
|
39
|
+
case "sms":
|
|
40
|
+
return useSMS(driver);
|
|
41
|
+
default:
|
|
42
|
+
return err(`Type ${type} not supported`);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
var notification = function() {
|
|
46
|
+
return useNotification();
|
|
47
|
+
};
|
|
48
|
+
export {
|
|
49
|
+
useSMS,
|
|
50
|
+
useNotification,
|
|
51
|
+
useEmail,
|
|
52
|
+
useChat,
|
|
53
|
+
notification
|
|
54
|
+
};
|
package/package.json
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/notifications",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
5
|
-
"packageManager": "pnpm@8.6.6",
|
|
4
|
+
"version": "0.58.19",
|
|
6
5
|
"description": "The Stacks notifications integration.",
|
|
7
6
|
"author": "Chris Breuer",
|
|
8
7
|
"license": "MIT",
|
|
9
8
|
"funding": "https://github.com/sponsors/chrisbbreuer",
|
|
10
|
-
"homepage": "https://github.com/stacksjs/stacks/tree/main
|
|
9
|
+
"homepage": "https://github.com/stacksjs/stacks/tree/main/storage/framework/core/src/notifications#readme",
|
|
11
10
|
"repository": {
|
|
12
11
|
"type": "git",
|
|
13
12
|
"url": "git+https://github.com/stacksjs/stacks.git",
|
|
14
|
-
"directory": "
|
|
13
|
+
"directory": "./storage/framework/core/src/notifications"
|
|
15
14
|
},
|
|
16
15
|
"bugs": {
|
|
17
16
|
"url": "https://github.com/stacksjs/stacks/issues"
|
|
@@ -32,61 +31,73 @@
|
|
|
32
31
|
],
|
|
33
32
|
"exports": {
|
|
34
33
|
".": {
|
|
35
|
-
"
|
|
36
|
-
"import": "./dist/index.
|
|
34
|
+
"bun": "./src/index.ts",
|
|
35
|
+
"import": "./dist/index.js"
|
|
36
|
+
},
|
|
37
|
+
"./*": {
|
|
38
|
+
"bun": "./src/*",
|
|
39
|
+
"import": "./dist/*"
|
|
37
40
|
}
|
|
38
41
|
},
|
|
39
|
-
"module": "dist/index.
|
|
42
|
+
"module": "dist/index.js",
|
|
40
43
|
"types": "dist/index.d.ts",
|
|
41
44
|
"contributors": [
|
|
42
|
-
"Chris Breuer <chris@
|
|
45
|
+
"Chris Breuer <chris@stacksjs.org>"
|
|
43
46
|
],
|
|
44
47
|
"files": [
|
|
45
|
-
"
|
|
46
|
-
"
|
|
48
|
+
"README.md",
|
|
49
|
+
"dist"
|
|
47
50
|
],
|
|
51
|
+
"scripts": {
|
|
52
|
+
"build": "bun --bun build.ts",
|
|
53
|
+
"typecheck": "bun --bun tsc --noEmit",
|
|
54
|
+
"prepublishOnly": "bun --bun run build"
|
|
55
|
+
},
|
|
48
56
|
"peerDependencies": {
|
|
49
|
-
"@stacksjs/chat": "
|
|
50
|
-
"@stacksjs/cli": "
|
|
51
|
-
"@stacksjs/config": "
|
|
52
|
-
"@stacksjs/email": "
|
|
53
|
-
"@stacksjs/error-handling": "
|
|
54
|
-
"@stacksjs/push": "
|
|
55
|
-
"@stacksjs/sms": "
|
|
56
|
-
"@stacksjs/types": "
|
|
57
|
+
"@stacksjs/chat": "workspace:*",
|
|
58
|
+
"@stacksjs/cli": "workspace:*",
|
|
59
|
+
"@stacksjs/config": "workspace:*",
|
|
60
|
+
"@stacksjs/email": "workspace:*",
|
|
61
|
+
"@stacksjs/error-handling": "workspace:*",
|
|
62
|
+
"@stacksjs/push": "workspace:*",
|
|
63
|
+
"@stacksjs/sms": "workspace:*",
|
|
64
|
+
"@stacksjs/types": "workspace:*"
|
|
57
65
|
},
|
|
58
66
|
"dependencies": {
|
|
59
|
-
"@maizzle/framework": "^4.
|
|
67
|
+
"@maizzle/framework": "^4.6.5",
|
|
68
|
+
"@stacksjs/chat": "workspace:*",
|
|
69
|
+
"@stacksjs/cli": "workspace:*",
|
|
70
|
+
"@stacksjs/config": "workspace:*",
|
|
71
|
+
"@stacksjs/email": "workspace:*",
|
|
72
|
+
"@stacksjs/error-handling": "workspace:*",
|
|
73
|
+
"@stacksjs/push": "workspace:*",
|
|
74
|
+
"@stacksjs/sms": "workspace:*",
|
|
75
|
+
"@stacksjs/types": "workspace:*"
|
|
60
76
|
},
|
|
61
77
|
"optionalDependencies": {
|
|
62
|
-
"@novu/discord": "^0.
|
|
63
|
-
"@novu/emailjs": "^0.
|
|
64
|
-
"@novu/gupshup": "^0.
|
|
65
|
-
"@novu/mailgun": "^0.
|
|
66
|
-
"@novu/mailjet": "^0.
|
|
67
|
-
"@novu/mandrill": "^0.
|
|
68
|
-
"@novu/netcore": "^0.
|
|
69
|
-
"@novu/nexmo": "^0.
|
|
70
|
-
"@novu/node": "^0.
|
|
71
|
-
"@novu/nodemailer": "^0.
|
|
72
|
-
"@novu/plivo": "^0.
|
|
73
|
-
"@novu/postmark": "^0.
|
|
74
|
-
"@novu/sendgrid": "^0.
|
|
75
|
-
"@novu/ses": "^0.
|
|
76
|
-
"@novu/slack": "^0.
|
|
77
|
-
"@novu/sms77": "^0.
|
|
78
|
-
"@novu/sns": "^0.
|
|
79
|
-
"@novu/stateless": "^0.
|
|
80
|
-
"@novu/telnyx": "^0.
|
|
81
|
-
"@novu/termii": "^0.
|
|
82
|
-
"@novu/twilio": "^0.
|
|
78
|
+
"@novu/discord": "^0.22.0",
|
|
79
|
+
"@novu/emailjs": "^0.22.0",
|
|
80
|
+
"@novu/gupshup": "^0.22.0",
|
|
81
|
+
"@novu/mailgun": "^0.22.0",
|
|
82
|
+
"@novu/mailjet": "^0.22.0",
|
|
83
|
+
"@novu/mandrill": "^0.22.0",
|
|
84
|
+
"@novu/netcore": "^0.22.0",
|
|
85
|
+
"@novu/nexmo": "^0.22.0",
|
|
86
|
+
"@novu/node": "^0.22.0",
|
|
87
|
+
"@novu/nodemailer": "^0.22.0",
|
|
88
|
+
"@novu/plivo": "^0.22.0",
|
|
89
|
+
"@novu/postmark": "^0.22.0",
|
|
90
|
+
"@novu/sendgrid": "^0.22.0",
|
|
91
|
+
"@novu/ses": "^0.22.0",
|
|
92
|
+
"@novu/slack": "^0.22.0",
|
|
93
|
+
"@novu/sms77": "^0.22.0",
|
|
94
|
+
"@novu/sns": "^0.22.0",
|
|
95
|
+
"@novu/stateless": "^0.22.0",
|
|
96
|
+
"@novu/telnyx": "^0.22.0",
|
|
97
|
+
"@novu/termii": "^0.22.0",
|
|
98
|
+
"@novu/twilio": "^0.22.0"
|
|
83
99
|
},
|
|
84
100
|
"devDependencies": {
|
|
85
|
-
"@stacksjs/development": "
|
|
86
|
-
},
|
|
87
|
-
"scripts": {
|
|
88
|
-
"build": "unbuild",
|
|
89
|
-
"dev": "unbuild --stub",
|
|
90
|
-
"typecheck": "tsc --noEmit"
|
|
101
|
+
"@stacksjs/development": "workspace:*"
|
|
91
102
|
}
|
|
92
|
-
}
|
|
103
|
+
}
|
package/LICENSE.md
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
# MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2022 Open Web Foundation
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
package/dist/index.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import * as chat from '@stacksjs/chat';
|
|
2
|
-
import * as email from '@stacksjs/email';
|
|
3
|
-
import * as sms from '@stacksjs/sms';
|
|
4
|
-
|
|
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;
|
|
9
|
-
|
|
10
|
-
export { useChat, useEmail, useNotification, useSMS };
|
package/dist/index.mjs
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { err } from '@stacksjs/error-handling';
|
|
2
|
-
import { notification } from '@stacksjs/config';
|
|
3
|
-
import { log } from '@stacksjs/cli';
|
|
4
|
-
import { ExitCode } from '@stacksjs/types';
|
|
5
|
-
import * as chat from '@stacksjs/chat';
|
|
6
|
-
import * as email from '@stacksjs/email';
|
|
7
|
-
import '@stacksjs/push';
|
|
8
|
-
import * as sms from '@stacksjs/sms';
|
|
9
|
-
|
|
10
|
-
function useChat(driver = "slack") {
|
|
11
|
-
return chat[driver];
|
|
12
|
-
}
|
|
13
|
-
function useEmail(driver = "mailtrap") {
|
|
14
|
-
return email[driver];
|
|
15
|
-
}
|
|
16
|
-
function useSMS(driver = "twilio") {
|
|
17
|
-
return sms[driver];
|
|
18
|
-
}
|
|
19
|
-
function useNotification(typeParam = "email", driverParam = "mailtrap") {
|
|
20
|
-
if (!notification.default) {
|
|
21
|
-
log.error("No default notification type set in config/notification.ts");
|
|
22
|
-
return process.exit(ExitCode.InvalidArgument);
|
|
23
|
-
}
|
|
24
|
-
const type = typeParam || notification.default;
|
|
25
|
-
const driver = driverParam || notification.default;
|
|
26
|
-
switch (type) {
|
|
27
|
-
case "email":
|
|
28
|
-
return useEmail(driver);
|
|
29
|
-
case "chat":
|
|
30
|
-
return useChat(driver);
|
|
31
|
-
case "sms":
|
|
32
|
-
return useSMS(driver);
|
|
33
|
-
default:
|
|
34
|
-
return err(`Type ${type} not supported`);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export { useChat, useEmail, useNotification, useSMS };
|