stacks 0.44.12 → 0.45.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/README.md +3 -3
- package/buddy/README.md +3 -3
- package/buddy/package.json +4 -4
- package/buddy/src/commands/build.ts +7 -0
- package/buddy/src/commands/fresh.ts +3 -3
- package/buddy/src/commands/lint.ts +21 -3
- package/buddy/src/commands/release.ts +2 -2
- package/core/actions/package.json +2 -2
- package/core/actions/src/build-core.ts +7 -0
- package/core/actions/src/bump.ts +10 -0
- package/core/actions/src/fix-lint-issues.ts +4 -0
- package/core/actions/src/fresh.ts +4 -1
- package/core/actions/src/{generate-package-json.ts → generate-package-jsons.ts} +0 -0
- package/core/actions/src/generate.ts +5 -5
- package/core/actions/src/helpers/lib-entries.ts +1 -1
- package/core/actions/src/helpers/package-json.ts +1 -1
- package/core/actions/src/helpers/utils.ts +29 -5
- package/core/actions/src/lint-fix.ts +8 -0
- package/core/actions/src/lint.ts +6 -30
- package/core/actions/src/make.ts +8 -8
- package/core/actions/src/release.ts +9 -28
- package/core/ai/package.json +1 -1
- package/core/alias/package.json +1 -1
- package/core/arrays/package.json +1 -1
- package/core/auth/package.json +1 -1
- package/core/build/node_modules/.bin/vite +2 -2
- package/core/build/node_modules/.bin/vite-ssg +2 -2
- package/core/build/package.json +3 -3
- package/core/cache/package.json +2 -2
- package/core/cache/tests/Redis.test.ts +0 -1
- package/core/cli/package.json +1 -1
- package/core/cli/src/actions/run.ts +22 -9
- package/core/cli/src/helpers.ts +5 -5
- package/core/cloud/package.json +1 -1
- package/core/collections/package.json +1 -1
- package/core/config/package.json +1 -1
- package/core/dashboard/package.json +1 -1
- package/core/database/package.json +2 -2
- package/core/datetime/package.json +1 -1
- package/core/desktop/package.json +1 -1
- package/core/docs/node_modules/.bin/vitepress +2 -2
- package/core/docs/package.json +1 -1
- package/core/domains/package.json +1 -1
- package/core/drivers/package.json +1 -1
- package/core/email/package.json +1 -1
- package/core/error-handling/package.json +2 -2
- package/core/git/package.json +1 -1
- package/core/health/package.json +1 -1
- package/core/lint/node_modules/.bin/eslint +2 -2
- package/core/lint/package.json +3 -3
- package/core/logging/package.json +1 -1
- package/core/modules/package.json +1 -1
- package/core/modules/src/nprogress.ts +3 -1
- package/core/notifications/README.md +2 -2
- package/core/notifications/package.json +1 -1
- package/core/notifications/src/drivers/chat/slack.ts +1 -1
- package/core/notifications/src/drivers/email/actions/send.ts +1 -1
- package/core/notifications/src/drivers/push/expo.ts +19 -0
- package/core/notifications/src/drivers/push/fcm.ts +19 -0
- package/core/notifications/src/index.ts +17 -22
- package/core/notifications/tests/chat/Slack.test.ts +12 -2
- package/core/notifications/tests/email/Mailgun.test.ts +14 -3
- package/core/notifications/tests/email/Sendgrid.test.ts +15 -4
- package/core/notifications/tests/sms/Twilio.test.ts +13 -2
- package/core/objects/package.json +1 -1
- package/core/path/package.json +1 -1
- package/core/payments/package.json +1 -1
- package/core/realtime/package.json +1 -1
- package/core/router/package.json +1 -1
- package/core/search-engine/package.json +2 -2
- package/core/security/package.json +1 -1
- package/core/server/node_modules/.bin/vite +2 -2
- package/core/server/package.json +2 -2
- package/core/storage/package.json +1 -1
- package/core/strings/package.json +1 -1
- package/core/testing/node_modules/.bin/mkdist +2 -2
- package/core/testing/node_modules/.bin/vitest +2 -2
- package/core/testing/package.json +5 -5
- package/core/types/node_modules/.bin/vitepress +2 -2
- package/core/types/package.json +3 -3
- package/core/types/src/cli.ts +26 -4
- package/core/types/src/notifications.ts +161 -0
- package/core/ui/node_modules/.bin/vue-tsc +2 -2
- package/core/ui/package.json +2 -2
- package/core/utils/package.json +5 -5
- package/core/utils/src/helpers.ts +1 -1
- package/core/x-ray/package.json +1 -1
- package/core/x-ray/src/desktop/app.vue +0 -1
- package/core/x-ray/src/ray.config.js +1 -0
- package/core/x-ray/src/types.ts +1 -0
- package/package.json +4 -4
- package/core/actions/test.ts +0 -10
- package/core/cloud/dist/actions/README.md +0 -53
- package/core/notifications/tests/example.test.ts +0 -7
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { CliOptions, CommandResult, Result, SpinnerOptions as Spinner } from '@stacksjs/types'
|
|
2
2
|
import { determineDebugMode } from '@stacksjs/config'
|
|
3
|
-
import {
|
|
3
|
+
import type { Err } from '@stacksjs/error-handling'
|
|
4
|
+
import { ResultAsync, err } from '@stacksjs/error-handling'
|
|
4
5
|
import { projectPath } from '@stacksjs/path'
|
|
5
6
|
import { italic } from '@stacksjs/cli'
|
|
6
7
|
import { spawn } from '../command'
|
|
@@ -17,9 +18,10 @@ import { startAnimation } from '../helpers'
|
|
|
17
18
|
export function exec(command: string, options?: CliOptions) {
|
|
18
19
|
const cwd = options?.cwd || projectPath()
|
|
19
20
|
const stdio = determineDebugMode(options) ? 'inherit' : 'ignore'
|
|
21
|
+
const shell = options?.shell || false
|
|
20
22
|
|
|
21
23
|
return ResultAsync.fromPromise(
|
|
22
|
-
spawn(command, { stdio, cwd }),
|
|
24
|
+
spawn(command, { stdio, cwd, shell }),
|
|
23
25
|
() => new Error(`Failed to run command: ${italic(command)}`),
|
|
24
26
|
)
|
|
25
27
|
}
|
|
@@ -42,21 +44,22 @@ export async function runCommand(command: string, options?: CliOptions) {
|
|
|
42
44
|
* @param options The options to pass to the command.
|
|
43
45
|
* @returns The result of the command.
|
|
44
46
|
*/
|
|
45
|
-
export async function runCommands(commands: string[], options?: CliOptions): Promise<Result<CommandResult<string>, Error>[]> {
|
|
46
|
-
|
|
47
|
+
export async function runCommands(commands: string[], options?: CliOptions): Promise<Result<CommandResult<string>, Error>[] | Result<CommandResult<string>, Error> | Err<CommandResult<string>, string>> {
|
|
48
|
+
const results: Result<CommandResult<string>, Error>[] = []
|
|
49
|
+
const numberOfCommands = commands.length
|
|
47
50
|
|
|
48
|
-
if (!
|
|
49
|
-
|
|
51
|
+
if (!numberOfCommands)
|
|
52
|
+
return err('No commands were specified')
|
|
50
53
|
|
|
51
|
-
const
|
|
54
|
+
const spinner = determineSpinner(options)
|
|
52
55
|
|
|
53
56
|
for (const command of commands) {
|
|
54
57
|
const result = await runCommand(command, options)
|
|
55
58
|
|
|
56
|
-
if (result
|
|
59
|
+
if (result?.isOk())
|
|
57
60
|
results.push(result)
|
|
58
61
|
|
|
59
|
-
if (result
|
|
62
|
+
if (result?.isErr()) {
|
|
60
63
|
if (spinner)
|
|
61
64
|
spinner.fail('Failed to run command.')
|
|
62
65
|
|
|
@@ -68,5 +71,15 @@ export async function runCommands(commands: string[], options?: CliOptions): Pro
|
|
|
68
71
|
if (spinner)
|
|
69
72
|
spinner.stop()
|
|
70
73
|
|
|
74
|
+
if (numberOfCommands === 1)
|
|
75
|
+
return results[0]
|
|
76
|
+
|
|
71
77
|
return results
|
|
72
78
|
}
|
|
79
|
+
|
|
80
|
+
function determineSpinner(options?: CliOptions): Spinner | undefined {
|
|
81
|
+
if (!determineDebugMode(options))
|
|
82
|
+
return startAnimation()
|
|
83
|
+
|
|
84
|
+
return undefined
|
|
85
|
+
}
|
package/core/cli/src/helpers.ts
CHANGED
|
@@ -9,10 +9,8 @@ import { bgCyan, bold, cyan, dim, green, italic, red } from './utilities'
|
|
|
9
9
|
*/
|
|
10
10
|
export function intro(command: string, options?: IntroOptions) {
|
|
11
11
|
console.log()
|
|
12
|
-
|
|
13
12
|
console.log(cyan(bold('Stacks CLI')) + dim(` v${version}`))
|
|
14
13
|
console.log()
|
|
15
|
-
|
|
16
14
|
log.info(`Preparing to run the ${bgCyan(italic(bold(` ${command} `)))} command.`)
|
|
17
15
|
|
|
18
16
|
if (options?.showPerformance === false)
|
|
@@ -47,11 +45,13 @@ export function outro(text: string, options: OutroOptions, error?: Error | strin
|
|
|
47
45
|
}
|
|
48
46
|
|
|
49
47
|
export function startAnimation() {
|
|
50
|
-
const spin = spinner(
|
|
51
|
-
|
|
48
|
+
const spin = spinner({
|
|
49
|
+
text: 'Executing...',
|
|
50
|
+
}).start()
|
|
52
51
|
|
|
53
52
|
setTimeout(() => {
|
|
54
|
-
spin.text = italic(
|
|
53
|
+
spin.text = italic('This may take a little while...')
|
|
54
|
+
spin.spinner = 'clock'
|
|
55
55
|
}, 5000)
|
|
56
56
|
|
|
57
57
|
return spin
|
package/core/cloud/package.json
CHANGED
package/core/config/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/database",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.45.0",
|
|
5
5
|
"packageManager": "pnpm@7.18.2",
|
|
6
6
|
"description": "The Stacks database integration.",
|
|
7
7
|
"author": "Chris Breuer",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"typecheck": "tsc --noEmit"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
|
-
"@prisma/client": "^4.
|
|
51
|
+
"@prisma/client": "^4.8.0",
|
|
52
52
|
"@stacksjs/utils": "workspace:*"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
@@ -11,7 +11,7 @@ else
|
|
|
11
11
|
export NODE_PATH="$NODE_PATH:/home/runner/work/stacks/stacks/node_modules/.pnpm/node_modules"
|
|
12
12
|
fi
|
|
13
13
|
if [ -x "$basedir/node" ]; then
|
|
14
|
-
exec "$basedir/node" "$basedir/../../../../../node_modules/.pnpm/vitepress@1.0.0-alpha.
|
|
14
|
+
exec "$basedir/node" "$basedir/../../../../../node_modules/.pnpm/vitepress@1.0.0-alpha.32_2r467mdhb7mblpaox4bg7fatdi/node_modules/vitepress/bin/vitepress.js" "$@"
|
|
15
15
|
else
|
|
16
|
-
exec node "$basedir/../../../../../node_modules/.pnpm/vitepress@1.0.0-alpha.
|
|
16
|
+
exec node "$basedir/../../../../../node_modules/.pnpm/vitepress@1.0.0-alpha.32_2r467mdhb7mblpaox4bg7fatdi/node_modules/vitepress/bin/vitepress.js" "$@"
|
|
17
17
|
fi
|
package/core/docs/package.json
CHANGED
package/core/email/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/email",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.45.0",
|
|
5
5
|
"packageManager": "pnpm@7.18.2",
|
|
6
6
|
"description": "The Stacks Email integration. Painlessly create & manage your inboxes, templates, and send emails.",
|
|
7
7
|
"author": "Chris Breuer",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/error-handling",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.45.0",
|
|
5
5
|
"packageManager": "pnpm@7.18.2",
|
|
6
6
|
"description": "Type safe error handling.",
|
|
7
7
|
"author": "Chris Breuer",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"typecheck": "tsc --noEmit"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
|
-
"@ow3/eslint-config": "^0.
|
|
47
|
+
"@ow3/eslint-config": "^0.35.0",
|
|
48
48
|
"neverthrow": "^6.0.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
package/core/git/package.json
CHANGED
package/core/health/package.json
CHANGED
|
@@ -11,7 +11,7 @@ else
|
|
|
11
11
|
export NODE_PATH="$NODE_PATH:/home/runner/work/stacks/stacks/node_modules/.pnpm/node_modules"
|
|
12
12
|
fi
|
|
13
13
|
if [ -x "$basedir/node" ]; then
|
|
14
|
-
exec "$basedir/node" "$basedir/../../../../../node_modules/.pnpm/eslint@8.
|
|
14
|
+
exec "$basedir/node" "$basedir/../../../../../node_modules/.pnpm/eslint@8.30.0/node_modules/eslint/bin/eslint.js" "$@"
|
|
15
15
|
else
|
|
16
|
-
exec node "$basedir/../../../../../node_modules/.pnpm/eslint@8.
|
|
16
|
+
exec node "$basedir/../../../../../node_modules/.pnpm/eslint@8.30.0/node_modules/eslint/bin/eslint.js" "$@"
|
|
17
17
|
fi
|
package/core/lint/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/lint",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.45.0",
|
|
5
5
|
"packageManager": "pnpm@7.18.2",
|
|
6
6
|
"description": "The Stacks way to lint.",
|
|
7
7
|
"author": "Chris Breuer",
|
|
@@ -45,9 +45,9 @@
|
|
|
45
45
|
"typecheck": "tsc --noEmit"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
|
-
"@ow3/eslint-config": "^0.
|
|
48
|
+
"@ow3/eslint-config": "^0.35.0",
|
|
49
49
|
"@types/eslint": "^8.4.10",
|
|
50
|
-
"eslint": "^8.
|
|
50
|
+
"eslint": "^8.30.0",
|
|
51
51
|
"lint-staged": "^13.1.0"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
@@ -46,7 +46,7 @@ interface EmailOptions {
|
|
|
46
46
|
html: string
|
|
47
47
|
from?: string
|
|
48
48
|
text?: string
|
|
49
|
-
attachments?:
|
|
49
|
+
attachments?: AttachmentOptions[]
|
|
50
50
|
id?: string
|
|
51
51
|
}
|
|
52
52
|
|
|
@@ -54,7 +54,7 @@ interface SMSOptions {
|
|
|
54
54
|
to: string
|
|
55
55
|
content: string
|
|
56
56
|
from?: string
|
|
57
|
-
attachments?:
|
|
57
|
+
attachments?: AttachmentOptions[]
|
|
58
58
|
id?: string
|
|
59
59
|
}
|
|
60
60
|
```
|
|
@@ -31,6 +31,6 @@ export async function send(options: EmailOptions, provider: any, providerName: s
|
|
|
31
31
|
|
|
32
32
|
return ResultAsync.fromPromise(
|
|
33
33
|
provider.sendMessage(options),
|
|
34
|
-
() => new Error(`Failed to send message using provider: ${italic(
|
|
34
|
+
() => new Error(`Failed to send message using provider: ${italic(providerName)}`),
|
|
35
35
|
)
|
|
36
36
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Novu } from '@novu/node'
|
|
2
|
+
import { notification } from '@stacksjs/config'
|
|
3
|
+
import type { ExpoPushNotificationOptions } from '@stacksjs/types'
|
|
4
|
+
import { ResultAsync } from '@stacksjs/error-handling'
|
|
5
|
+
import { italic } from '@stacksjs/cli'
|
|
6
|
+
|
|
7
|
+
const novu = new Novu(notification.novu.key)
|
|
8
|
+
|
|
9
|
+
function send(options: ExpoPushNotificationOptions) {
|
|
10
|
+
return ResultAsync.fromPromise(
|
|
11
|
+
novu.trigger(options.eventName, {
|
|
12
|
+
to: options.to,
|
|
13
|
+
payload: options.payload,
|
|
14
|
+
}),
|
|
15
|
+
() => new Error(`Failed to send message using provider: ${italic('Expo')}`),
|
|
16
|
+
)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export { send as Send, send }
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Novu } from '@novu/node'
|
|
2
|
+
import { notification } from '@stacksjs/config'
|
|
3
|
+
import type { FCMPushNotificationOptions } from '@stacksjs/types'
|
|
4
|
+
import { ResultAsync } from '@stacksjs/error-handling'
|
|
5
|
+
import { italic } from '@stacksjs/cli'
|
|
6
|
+
|
|
7
|
+
const novu = new Novu(notification.novu.key)
|
|
8
|
+
|
|
9
|
+
function send(options: FCMPushNotificationOptions) {
|
|
10
|
+
return ResultAsync.fromPromise(
|
|
11
|
+
novu.trigger(options.eventName, {
|
|
12
|
+
to: options.to,
|
|
13
|
+
payload: options.payload,
|
|
14
|
+
}),
|
|
15
|
+
() => new Error(`Failed to send message using provider: ${italic('FCM')}`),
|
|
16
|
+
)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export { send as Send, send }
|
|
@@ -1,25 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import * as email from './drivers/email'
|
|
2
|
+
import * as chat from './drivers/chat'
|
|
3
|
+
import * as sms from './drivers/sms'
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
const driverMap = {
|
|
6
|
+
email,
|
|
7
|
+
chat,
|
|
8
|
+
sms,
|
|
9
|
+
}
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
// return email
|
|
11
|
+
const useNotification = (driver = 'email') => {
|
|
12
|
+
return driverMap?.[driver as keyof typeof driverMap]
|
|
13
|
+
}
|
|
15
14
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
// export default {
|
|
24
|
-
// useNotification,
|
|
25
|
-
// }
|
|
15
|
+
export {
|
|
16
|
+
email,
|
|
17
|
+
chat,
|
|
18
|
+
sms,
|
|
19
|
+
useNotification,
|
|
20
|
+
}
|
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
import { describe, expect, it } from 'vitest'
|
|
2
2
|
import { chat } from '@stacksjs/notifications'
|
|
3
3
|
|
|
4
|
-
const notification = chat.slack
|
|
5
|
-
|
|
6
4
|
describe('Slack Test', () => {
|
|
7
5
|
it('should send chat', async () => {
|
|
6
|
+
const notification = chat.slack
|
|
7
|
+
const test = await notification.send({
|
|
8
|
+
content: 'Test Slack Message!',
|
|
9
|
+
webhookUrl: 'https://hooks.slack.com/services/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',
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
expect(test).toBeDefined()
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
it('should send chat using useNotification', async () => {
|
|
16
|
+
const notification = useNotification('chat').slack
|
|
8
17
|
const test = await notification.send({
|
|
9
18
|
content: 'Test Slack Message!',
|
|
10
19
|
webhookUrl: 'https://hooks.slack.com/services/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',
|
|
@@ -14,6 +23,7 @@ describe('Slack Test', () => {
|
|
|
14
23
|
})
|
|
15
24
|
|
|
16
25
|
it('should not send chat if webhook is empty', async () => {
|
|
26
|
+
const notification = chat.slack
|
|
17
27
|
const test = await notification.send({
|
|
18
28
|
content: 'Test Slack Message!',
|
|
19
29
|
webhookUrl: '',
|
|
@@ -1,10 +1,21 @@
|
|
|
1
1
|
import { describe, expect, it } from 'vitest'
|
|
2
2
|
import { email } from '@stacksjs/notifications'
|
|
3
3
|
|
|
4
|
-
const notification = email.mailgun
|
|
5
|
-
|
|
6
4
|
describe('Mailgun Test', () => {
|
|
7
5
|
it('should not send email', async () => {
|
|
6
|
+
const notification = email.mailgun
|
|
7
|
+
const test = await notification.send({
|
|
8
|
+
from: 'repuestobrian2@gmail.com',
|
|
9
|
+
to: 'repuestobrian@gmail',
|
|
10
|
+
subject: 'Test Email',
|
|
11
|
+
html: '<p> Test </p>',
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
expect(test).toBeDefined()
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
it('should send email using useNotification', async () => {
|
|
18
|
+
const notification = useNotification().mailgun
|
|
8
19
|
const test = await notification.send({
|
|
9
20
|
from: 'repuestobrian2@gmail.com',
|
|
10
21
|
to: 'repuestobrian@gmail',
|
|
@@ -16,6 +27,7 @@ describe('Mailgun Test', () => {
|
|
|
16
27
|
})
|
|
17
28
|
|
|
18
29
|
it('should not send email when receiver is empty', async () => {
|
|
30
|
+
const notification = email.mailgun
|
|
19
31
|
const test = await notification.send({
|
|
20
32
|
from: env.email.sendgrid.from,
|
|
21
33
|
to: '',
|
|
@@ -26,4 +38,3 @@ describe('Mailgun Test', () => {
|
|
|
26
38
|
expect(test.error).toThrowError(Error)
|
|
27
39
|
})
|
|
28
40
|
})
|
|
29
|
-
|
|
@@ -1,11 +1,22 @@
|
|
|
1
1
|
import { describe, expect, it } from 'vitest'
|
|
2
|
-
import { email } from '@stacksjs/notifications'
|
|
2
|
+
import { email, useNotification } from '@stacksjs/notifications'
|
|
3
3
|
import { notification as env } from '@stacksjs/config'
|
|
4
4
|
|
|
5
|
-
const notification = email.sendgrid
|
|
6
|
-
|
|
7
5
|
describe('Sendgrid Test', () => {
|
|
8
6
|
it('should send email', async () => {
|
|
7
|
+
const notification = email.sendgrid
|
|
8
|
+
const test = await notification.send({
|
|
9
|
+
from: env.email.sendgrid.from,
|
|
10
|
+
to: 'repuestobrian2@gmail.com',
|
|
11
|
+
subject: 'Test Email',
|
|
12
|
+
html: '<p> Test Email using SG!</p>',
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
expect(test).toBeDefined()
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
it('should send email using useNotification', async () => {
|
|
19
|
+
const notification = useNotification().sendgrid
|
|
9
20
|
const test = await notification.send({
|
|
10
21
|
from: env.email.sendgrid.from,
|
|
11
22
|
to: 'repuestobrian2@gmail.com',
|
|
@@ -17,6 +28,7 @@ describe('Sendgrid Test', () => {
|
|
|
17
28
|
})
|
|
18
29
|
|
|
19
30
|
it('should not send email when receiver is empty', async () => {
|
|
31
|
+
const notification = email.sendgrid
|
|
20
32
|
const test = await notification.send({
|
|
21
33
|
from: env.email.sendgrid.from,
|
|
22
34
|
to: '',
|
|
@@ -27,4 +39,3 @@ describe('Sendgrid Test', () => {
|
|
|
27
39
|
expect(test.error).toThrowError(Error)
|
|
28
40
|
})
|
|
29
41
|
})
|
|
30
|
-
|
|
@@ -2,10 +2,20 @@ import { describe, expect, it } from 'vitest'
|
|
|
2
2
|
import { sms } from '@stacksjs/notifications'
|
|
3
3
|
import { notification } from '@stacksjs/config'
|
|
4
4
|
|
|
5
|
-
const notif = sms.twilio
|
|
6
|
-
|
|
7
5
|
describe('Twilio Test', () => {
|
|
8
6
|
it('should send sms', async () => {
|
|
7
|
+
const notif = sms.twilio
|
|
8
|
+
const test = await notif.send({
|
|
9
|
+
content: 'Test SMS from Stacks',
|
|
10
|
+
to: notification.sms.twilio.to,
|
|
11
|
+
from: notification.sms.twilio.from,
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
expect(test).toBeDefined()
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
it('should send sms using useNotification', async () => {
|
|
18
|
+
const notification = useNotification('sms').twilio
|
|
9
19
|
const test = await notif.send({
|
|
10
20
|
content: 'Test SMS from Stacks',
|
|
11
21
|
to: notification.sms.twilio.to,
|
|
@@ -16,6 +26,7 @@ describe('Twilio Test', () => {
|
|
|
16
26
|
})
|
|
17
27
|
|
|
18
28
|
it('should not send sms if receiver is empty', async () => {
|
|
29
|
+
const notif = sms.twilio
|
|
19
30
|
const test = await notif.send({
|
|
20
31
|
content: 'Test SMS from Stacks',
|
|
21
32
|
to: '',
|
package/core/path/package.json
CHANGED