@stacksjs/notifications 0.61.24 → 0.63.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/index.js +13 -10
- package/dist/index.js.map +14 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -15,16 +15,16 @@ import * as push from "@stacksjs/push";
|
|
|
15
15
|
// src/drivers/sms.ts
|
|
16
16
|
import * as sms from "@stacksjs/sms";
|
|
17
17
|
// src/index.ts
|
|
18
|
-
|
|
18
|
+
function useChat(driver = "slack") {
|
|
19
19
|
return chat[driver];
|
|
20
|
-
}
|
|
21
|
-
|
|
20
|
+
}
|
|
21
|
+
function useEmail(driver = "mailtrap") {
|
|
22
22
|
return email[driver];
|
|
23
|
-
}
|
|
24
|
-
|
|
23
|
+
}
|
|
24
|
+
function useSMS(driver = "twilio") {
|
|
25
25
|
return sms[driver];
|
|
26
|
-
}
|
|
27
|
-
|
|
26
|
+
}
|
|
27
|
+
function useNotification(typeParam = "email", driverParam = "mailtrap") {
|
|
28
28
|
if (!config2.default) {
|
|
29
29
|
log.error("No default notification type set in config/notification.ts");
|
|
30
30
|
return process.exit(ExitCode.InvalidArgument);
|
|
@@ -41,10 +41,10 @@ var useNotification = function(typeParam = "email", driverParam = "mailtrap") {
|
|
|
41
41
|
default:
|
|
42
42
|
return err(`Type ${type} not supported`);
|
|
43
43
|
}
|
|
44
|
-
}
|
|
45
|
-
|
|
44
|
+
}
|
|
45
|
+
function notification() {
|
|
46
46
|
return useNotification();
|
|
47
|
-
}
|
|
47
|
+
}
|
|
48
48
|
export {
|
|
49
49
|
useSMS,
|
|
50
50
|
useNotification,
|
|
@@ -52,3 +52,6 @@ export {
|
|
|
52
52
|
useChat,
|
|
53
53
|
notification
|
|
54
54
|
};
|
|
55
|
+
|
|
56
|
+
//# debugId=7667D079221D553A64756E2164756E21
|
|
57
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/index.ts", "../src/drivers/chat.ts", "../src/drivers/email.ts", "../src/drivers/push.ts", "../src/drivers/sms.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import process from 'node:process'\nimport { log } from '@stacksjs/cli'\nimport { notification as config } from '@stacksjs/config'\nimport { err } from '@stacksjs/error-handling'\nimport { ExitCode } from '@stacksjs/types'\nimport { chat, email, sms } from './drivers'\n\nfunction useChat(driver = 'slack') {\n return chat[driver as keyof typeof chat]\n}\n\nfunction useEmail(driver = 'mailtrap') {\n return email[driver as keyof typeof email]\n}\n\nfunction useSMS(driver = 'twilio') {\n return sms[driver as keyof typeof sms]\n}\n\nfunction useNotification(typeParam = 'email', driverParam = 'mailtrap') {\n if (!config.default) {\n log.error('No default notification type set in config/notification.ts')\n return process.exit(ExitCode.InvalidArgument)\n }\n\n const type = typeParam || config.default\n const driver = driverParam || config.default\n\n switch (type) {\n case 'email':\n return useEmail(driver)\n case 'chat':\n return useChat(driver)\n case 'sms':\n return useSMS(driver)\n default:\n return err(`Type ${type} not supported`)\n }\n}\n\nfunction notification() {\n return useNotification()\n}\n\nexport { useEmail, useChat, useSMS, useNotification, notification }\n",
|
|
6
|
+
"export * as chat from '@stacksjs/chat'\n",
|
|
7
|
+
"export * as email from '@stacksjs/email'\n",
|
|
8
|
+
"export * as push from '@stacksjs/push'\n",
|
|
9
|
+
"export * as sms from '@stacksjs/sms'\n"
|
|
10
|
+
],
|
|
11
|
+
"mappings": ";;AAAA;AACA;AACA,wBAAS;AACT;AACA;;;ACJA;;ACAA;;ACAA;;ACAA;;AJOA,SAAS,OAAO,CAAC,SAAS,SAAS;AACjC,SAAO,KAAK;AAAA;AAGd,SAAS,QAAQ,CAAC,SAAS,YAAY;AACrC,SAAO,MAAM;AAAA;AAGf,SAAS,MAAM,CAAC,SAAS,UAAU;AACjC,SAAO,IAAI;AAAA;AAGb,SAAS,eAAe,CAAC,YAAY,SAAS,cAAc,YAAY;AACtE,OAAK,QAAO,SAAS;AACnB,QAAI,MAAM,4DAA4D;AACtE,WAAO,QAAQ,KAAK,SAAS,eAAe;AAAA,EAC9C;AAEA,QAAM,OAAO,aAAa,QAAO;AACjC,QAAM,SAAS,eAAe,QAAO;AAErC,UAAQ;AAAA,SACD;AACH,aAAO,SAAS,MAAM;AAAA,SACnB;AACH,aAAO,QAAQ,MAAM;AAAA,SAClB;AACH,aAAO,OAAO,MAAM;AAAA;AAEpB,aAAO,IAAI,QAAQ,oBAAoB;AAAA;AAAA;AAI7C,SAAS,YAAY,GAAG;AACtB,SAAO,gBAAgB;AAAA;",
|
|
12
|
+
"debugId": "7667D079221D553A64756E2164756E21",
|
|
13
|
+
"names": []
|
|
14
|
+
}
|