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.
Files changed (94) hide show
  1. package/README.md +3 -3
  2. package/buddy/README.md +3 -3
  3. package/buddy/package.json +4 -4
  4. package/buddy/src/commands/build.ts +7 -0
  5. package/buddy/src/commands/fresh.ts +3 -3
  6. package/buddy/src/commands/lint.ts +21 -3
  7. package/buddy/src/commands/release.ts +2 -2
  8. package/core/actions/package.json +2 -2
  9. package/core/actions/src/build-core.ts +7 -0
  10. package/core/actions/src/bump.ts +10 -0
  11. package/core/actions/src/fix-lint-issues.ts +4 -0
  12. package/core/actions/src/fresh.ts +4 -1
  13. package/core/actions/src/{generate-package-json.ts → generate-package-jsons.ts} +0 -0
  14. package/core/actions/src/generate.ts +5 -5
  15. package/core/actions/src/helpers/lib-entries.ts +1 -1
  16. package/core/actions/src/helpers/package-json.ts +1 -1
  17. package/core/actions/src/helpers/utils.ts +29 -5
  18. package/core/actions/src/lint-fix.ts +8 -0
  19. package/core/actions/src/lint.ts +6 -30
  20. package/core/actions/src/make.ts +8 -8
  21. package/core/actions/src/release.ts +9 -28
  22. package/core/ai/package.json +1 -1
  23. package/core/alias/package.json +1 -1
  24. package/core/arrays/package.json +1 -1
  25. package/core/auth/package.json +1 -1
  26. package/core/build/node_modules/.bin/vite +2 -2
  27. package/core/build/node_modules/.bin/vite-ssg +2 -2
  28. package/core/build/package.json +3 -3
  29. package/core/cache/package.json +2 -2
  30. package/core/cache/tests/Redis.test.ts +0 -1
  31. package/core/cli/package.json +1 -1
  32. package/core/cli/src/actions/run.ts +22 -9
  33. package/core/cli/src/helpers.ts +5 -5
  34. package/core/cloud/package.json +1 -1
  35. package/core/collections/package.json +1 -1
  36. package/core/config/package.json +1 -1
  37. package/core/dashboard/package.json +1 -1
  38. package/core/database/package.json +2 -2
  39. package/core/datetime/package.json +1 -1
  40. package/core/desktop/package.json +1 -1
  41. package/core/docs/node_modules/.bin/vitepress +2 -2
  42. package/core/docs/package.json +1 -1
  43. package/core/domains/package.json +1 -1
  44. package/core/drivers/package.json +1 -1
  45. package/core/email/package.json +1 -1
  46. package/core/error-handling/package.json +2 -2
  47. package/core/git/package.json +1 -1
  48. package/core/health/package.json +1 -1
  49. package/core/lint/node_modules/.bin/eslint +2 -2
  50. package/core/lint/package.json +3 -3
  51. package/core/logging/package.json +1 -1
  52. package/core/modules/package.json +1 -1
  53. package/core/modules/src/nprogress.ts +3 -1
  54. package/core/notifications/README.md +2 -2
  55. package/core/notifications/package.json +1 -1
  56. package/core/notifications/src/drivers/chat/slack.ts +1 -1
  57. package/core/notifications/src/drivers/email/actions/send.ts +1 -1
  58. package/core/notifications/src/drivers/push/expo.ts +19 -0
  59. package/core/notifications/src/drivers/push/fcm.ts +19 -0
  60. package/core/notifications/src/index.ts +17 -22
  61. package/core/notifications/tests/chat/Slack.test.ts +12 -2
  62. package/core/notifications/tests/email/Mailgun.test.ts +14 -3
  63. package/core/notifications/tests/email/Sendgrid.test.ts +15 -4
  64. package/core/notifications/tests/sms/Twilio.test.ts +13 -2
  65. package/core/objects/package.json +1 -1
  66. package/core/path/package.json +1 -1
  67. package/core/payments/package.json +1 -1
  68. package/core/realtime/package.json +1 -1
  69. package/core/router/package.json +1 -1
  70. package/core/search-engine/package.json +2 -2
  71. package/core/security/package.json +1 -1
  72. package/core/server/node_modules/.bin/vite +2 -2
  73. package/core/server/package.json +2 -2
  74. package/core/storage/package.json +1 -1
  75. package/core/strings/package.json +1 -1
  76. package/core/testing/node_modules/.bin/mkdist +2 -2
  77. package/core/testing/node_modules/.bin/vitest +2 -2
  78. package/core/testing/package.json +5 -5
  79. package/core/types/node_modules/.bin/vitepress +2 -2
  80. package/core/types/package.json +3 -3
  81. package/core/types/src/cli.ts +26 -4
  82. package/core/types/src/notifications.ts +161 -0
  83. package/core/ui/node_modules/.bin/vue-tsc +2 -2
  84. package/core/ui/package.json +2 -2
  85. package/core/utils/package.json +5 -5
  86. package/core/utils/src/helpers.ts +1 -1
  87. package/core/x-ray/package.json +1 -1
  88. package/core/x-ray/src/desktop/app.vue +0 -1
  89. package/core/x-ray/src/ray.config.js +1 -0
  90. package/core/x-ray/src/types.ts +1 -0
  91. package/package.json +4 -4
  92. package/core/actions/test.ts +0 -10
  93. package/core/cloud/dist/actions/README.md +0 -53
  94. 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 { ResultAsync } from '@stacksjs/error-handling'
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
- let spinner: Spinner | undefined
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 (!determineDebugMode(options))
49
- spinner = startAnimation()
51
+ if (!numberOfCommands)
52
+ return err('No commands were specified')
50
53
 
51
- const results: Result<CommandResult<string>, Error>[] = []
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.isOk())
59
+ if (result?.isOk())
57
60
  results.push(result)
58
61
 
59
- if (result.isErr()) {
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
+ }
@@ -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('Running...').start()
51
- const pleaseWait = 'This may take a little while...'
48
+ const spin = spinner({
49
+ text: 'Executing...',
50
+ }).start()
52
51
 
53
52
  setTimeout(() => {
54
- spin.text = italic(pleaseWait)
53
+ spin.text = italic('This may take a little while...')
54
+ spin.spinner = 'clock'
55
55
  }, 5000)
56
56
 
57
57
  return spin
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/cloud",
3
3
  "type": "module",
4
- "version": "0.44.12",
4
+ "version": "0.45.0",
5
5
  "packageManager": "pnpm@7.18.2",
6
6
  "description": "The Stacks cloud/serverless integration & implementation.",
7
7
  "author": "Chris Breuer",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/collections",
3
3
  "type": "module",
4
- "version": "0.44.12",
4
+ "version": "0.45.0",
5
5
  "packageManager": "pnpm@7.18.2",
6
6
  "description": "The Stacks collections.",
7
7
  "author": "Chris Breuer",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/config",
3
3
  "type": "module",
4
- "version": "0.44.12",
4
+ "version": "0.45.0",
5
5
  "packageManager": "pnpm@7.18.2",
6
6
  "description": "The Stacks configuration.",
7
7
  "author": "Chris Breuer",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/dashboard",
3
3
  "type": "module",
4
- "version": "0.44.12",
4
+ "version": "0.45.0",
5
5
  "packageManager": "pnpm@7.18.2",
6
6
  "description": "The Stacks Dashboard.",
7
7
  "author": "Chris Breuer",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/database",
3
3
  "type": "module",
4
- "version": "0.44.12",
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.7.1",
51
+ "@prisma/client": "^4.8.0",
52
52
  "@stacksjs/utils": "workspace:*"
53
53
  },
54
54
  "devDependencies": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/datetime",
3
3
  "type": "module",
4
- "version": "0.44.12",
4
+ "version": "0.45.0",
5
5
  "packageManager": "pnpm@7.18.2",
6
6
  "description": "The Stacks datetime helpers.",
7
7
  "author": "Chris Breuer",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/desktop",
3
3
  "type": "module",
4
- "version": "0.44.12",
4
+ "version": "0.45.0",
5
5
  "packageManager": "pnpm@7.18.2",
6
6
  "description": "The Stacks Desktop engine.",
7
7
  "author": "Chris Breuer",
@@ -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.32_tbpndr44ulefs3hehwpi2mkf2y/node_modules/vitepress/bin/vitepress.js" "$@"
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.32_tbpndr44ulefs3hehwpi2mkf2y/node_modules/vitepress/bin/vitepress.js" "$@"
16
+ exec node "$basedir/../../../../../node_modules/.pnpm/vitepress@1.0.0-alpha.32_2r467mdhb7mblpaox4bg7fatdi/node_modules/vitepress/bin/vitepress.js" "$@"
17
17
  fi
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/docs",
3
3
  "type": "module",
4
- "version": "0.44.12",
4
+ "version": "0.45.0",
5
5
  "packageManager": "pnpm@7.18.2",
6
6
  "description": "The Stacks way to document.",
7
7
  "author": "Chris Breuer",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/domains",
3
3
  "type": "module",
4
- "version": "0.44.12",
4
+ "version": "0.45.0",
5
5
  "packageManager": "pnpm@7.18.2",
6
6
  "description": "Easily manage your domains.",
7
7
  "author": "Chris Breuer",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/drivers",
3
3
  "type": "module",
4
- "version": "0.44.12",
4
+ "version": "0.45.0",
5
5
  "packageManager": "pnpm@7.18.2",
6
6
  "description": "Easily create a driver-based system.",
7
7
  "author": "Chris Breuer",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/email",
3
3
  "type": "module",
4
- "version": "0.44.12",
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.44.12",
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.33.11",
47
+ "@ow3/eslint-config": "^0.35.0",
48
48
  "neverthrow": "^6.0.0"
49
49
  },
50
50
  "devDependencies": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/git",
3
3
  "type": "module",
4
- "version": "0.44.12",
4
+ "version": "0.45.0",
5
5
  "packageManager": "pnpm@7.18.2",
6
6
  "description": "The Stacks git utilities & conventions.",
7
7
  "author": "Chris Breuer",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/health",
3
3
  "type": "module",
4
- "version": "0.44.12",
4
+ "version": "0.45.0",
5
5
  "packageManager": "pnpm@7.18.2",
6
6
  "description": "The Stacks Health services.",
7
7
  "author": "Chris Breuer",
@@ -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.29.0/node_modules/eslint/bin/eslint.js" "$@"
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.29.0/node_modules/eslint/bin/eslint.js" "$@"
16
+ exec node "$basedir/../../../../../node_modules/.pnpm/eslint@8.30.0/node_modules/eslint/bin/eslint.js" "$@"
17
17
  fi
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/lint",
3
3
  "type": "module",
4
- "version": "0.44.12",
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.33.11",
48
+ "@ow3/eslint-config": "^0.35.0",
49
49
  "@types/eslint": "^8.4.10",
50
- "eslint": "^8.29.0",
50
+ "eslint": "^8.30.0",
51
51
  "lint-staged": "^13.1.0"
52
52
  },
53
53
  "devDependencies": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/logging",
3
3
  "type": "module",
4
- "version": "0.44.12",
4
+ "version": "0.45.0",
5
5
  "packageManager": "pnpm@7.18.2",
6
6
  "description": "The Stacks logging system.",
7
7
  "author": "Chris Breuer",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/modules",
3
3
  "type": "module",
4
- "version": "0.44.12",
4
+ "version": "0.45.0",
5
5
  "packageManager": "pnpm@7.18.2",
6
6
  "description": "The Stacks framework modules.",
7
7
  "author": "Chris Breuer",
@@ -7,6 +7,8 @@ export const install: UserModule = ({ isClient, router }) => {
7
7
  if (to.path !== from.path)
8
8
  NProgress.start()
9
9
  })
10
- router.afterEach(() => { NProgress.done() })
10
+ router.afterEach(() => {
11
+ NProgress.done()
12
+ })
11
13
  }
12
14
  }
@@ -46,7 +46,7 @@ interface EmailOptions {
46
46
  html: string
47
47
  from?: string
48
48
  text?: string
49
- attachments?: IAttachmentOptions[]
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?: IAttachmentOptions[]
57
+ attachments?: AttachmentOptions[]
58
58
  id?: string
59
59
  }
60
60
  ```
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/notifications",
3
3
  "type": "module",
4
- "version": "0.44.12",
4
+ "version": "0.45.0",
5
5
  "packageManager": "pnpm@7.18.2",
6
6
  "description": "The Stacks notifications integration.",
7
7
  "author": "Chris Breuer",
@@ -8,7 +8,7 @@ const env = notification.chat.slack
8
8
 
9
9
  const provider = new SlackProvider({
10
10
  applicationId: env.appId,
11
- clientId: env.clientID,
11
+ clientId: env.clientId,
12
12
  secretKey: env.secret,
13
13
  })
14
14
 
@@ -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('Sendgrid')}`),
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
- export * as email from './drivers/email'
2
- export * as chat from './drivers/chat'
3
- export * as sms from './drivers/sms'
1
+ import * as email from './drivers/email'
2
+ import * as chat from './drivers/chat'
3
+ import * as sms from './drivers/sms'
4
4
 
5
- // const driverMap = {
6
- // email,
7
- // chat,
8
- // sms,
9
- // }
5
+ const driverMap = {
6
+ email,
7
+ chat,
8
+ sms,
9
+ }
10
10
 
11
- // export function useNotification(driver = 'email') {
12
- // // return driverMap?.[driver as keyof typeof driverMap]
13
- // if (driver === 'email')
14
- // return email
11
+ const useNotification = (driver = 'email') => {
12
+ return driverMap?.[driver as keyof typeof driverMap]
13
+ }
15
14
 
16
- // if (driver === 'chat')
17
- // return chat
18
-
19
- // if (driver === 'sms')
20
- // return sms
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: '',
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/objects",
3
3
  "type": "module",
4
- "version": "0.44.12",
4
+ "version": "0.45.0",
5
5
  "packageManager": "pnpm@7.18.2",
6
6
  "description": "The Stacks objects.",
7
7
  "author": "Chris Breuer",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/path",
3
3
  "type": "module",
4
- "version": "0.44.12",
4
+ "version": "0.45.0",
5
5
  "packageManager": "pnpm@7.18.2",
6
6
  "description": "The Stacks path.",
7
7
  "author": "Chris Breuer",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/payments",
3
3
  "type": "module",
4
- "version": "0.44.12",
4
+ "version": "0.45.0",
5
5
  "packageManager": "pnpm@7.18.2",
6
6
  "description": "The Stacks payments package. Currently supporting Stripe.",
7
7
  "author": "Chris Breuer",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/realtime",
3
3
  "type": "module",
4
- "version": "0.44.12",
4
+ "version": "0.45.0",
5
5
  "packageManager": "pnpm@7.18.2",
6
6
  "description": "The Stacks realtime integration.",
7
7
  "author": "Chris Breuer",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/router",
3
3
  "type": "module",
4
- "version": "0.44.12",
4
+ "version": "0.45.0",
5
5
  "packageManager": "pnpm@7.18.2",
6
6
  "description": "The Stacks framework router.",
7
7
  "author": "Chris Breuer",