@develit-services/notification 0.0.14 → 0.0.15

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 (45) hide show
  1. package/dist/database/schema.cjs +9 -0
  2. package/dist/database/schema.d.cts +2 -0
  3. package/dist/database/schema.d.mts +2 -0
  4. package/dist/database/schema.d.ts +2 -0
  5. package/dist/database/schema.mjs +3 -0
  6. package/dist/export/worker.cjs +3 -17
  7. package/dist/export/worker.d.cts +2 -201
  8. package/dist/export/worker.d.mts +2 -201
  9. package/dist/export/worker.d.ts +2 -201
  10. package/dist/export/worker.mjs +3 -17
  11. package/dist/shared/notification.4b3eUEIG.cjs +22 -0
  12. package/dist/shared/notification.BJyMXKGH.d.cts +203 -0
  13. package/dist/shared/notification.BJyMXKGH.d.mts +203 -0
  14. package/dist/shared/notification.BJyMXKGH.d.ts +203 -0
  15. package/dist/shared/notification.C0X8Orrh.mjs +19 -0
  16. package/package.json +5 -5
  17. package/@types/consts/audit-log.consts.ts +0 -7
  18. package/@types/consts/index.ts +0 -1
  19. package/@types/database/audit-log.types.ts +0 -7
  20. package/@types/database/index.ts +0 -1
  21. package/@types/email/IEmail.connector.ts +0 -21
  22. package/@types/email/IEmail.types.ts +0 -25
  23. package/@types/email/ecomail/ecomail.connector.ts +0 -139
  24. package/@types/email/ecomail/ecomail.types.ts +0 -27
  25. package/@types/email/ecomail/index.ts +0 -2
  26. package/@types/email/index.ts +0 -3
  27. package/@types/index.ts +0 -9
  28. package/@types/io/index.ts +0 -3
  29. package/@types/io/sendEmail.ts +0 -18
  30. package/@types/io/sendSlack.ts +0 -19
  31. package/@types/io/sendSms.ts +0 -20
  32. package/@types/pushNotification/IPushNotification.ts +0 -1
  33. package/@types/pushNotification/index.ts +0 -1
  34. package/@types/queue.ts +0 -19
  35. package/@types/service.ts +0 -30
  36. package/@types/slack/ISlack.types.ts +0 -3
  37. package/@types/slack/index.ts +0 -1
  38. package/@types/slack/slack.connector.ts +0 -27
  39. package/@types/sms/ISms.connector.ts +0 -22
  40. package/@types/sms/ISms.types.ts +0 -4
  41. package/@types/sms/index.ts +0 -3
  42. package/@types/sms/twilio/index.ts +0 -1
  43. package/@types/sms/twilio/twilio.connector.ts +0 -35
  44. package/src/database/schema/audit-log.schema.ts +0 -13
  45. package/src/database/schema/index.ts +0 -1
@@ -1,22 +0,0 @@
1
- import type { InternalError } from '@develit-io/backend-sdk'
2
- import type { ISms } from '../'
3
-
4
- export abstract class ISmsConnector {
5
- static providerName: string
6
-
7
- public ACCOUNT_ID: string
8
- public AUTH_TOKEN: string
9
- public SERVICE_ID: string
10
-
11
- protected constructor({
12
- ACCOUNT_ID,
13
- AUTH_TOKEN,
14
- SERVICE_ID,
15
- }: { ACCOUNT_ID: string; AUTH_TOKEN: string; SERVICE_ID: string }) {
16
- this.ACCOUNT_ID = ACCOUNT_ID
17
- this.AUTH_TOKEN = AUTH_TOKEN
18
- this.SERVICE_ID = SERVICE_ID
19
- }
20
-
21
- abstract sendSms(sms: ISms): Promise<InternalError | void>
22
- }
@@ -1,4 +0,0 @@
1
- export interface ISms {
2
- message: string
3
- to: string
4
- }
@@ -1,3 +0,0 @@
1
- export * from './ISms.types'
2
- export * from './ISms.connector'
3
- export * from './twilio'
@@ -1 +0,0 @@
1
- export * from './twilio.connector'
@@ -1,35 +0,0 @@
1
- import {
2
- type InternalError,
3
- createInternalError,
4
- } from '@develit-io/backend-sdk'
5
- import { type ISms, ISmsConnector } from '../'
6
- import twilio from 'twilio'
7
-
8
- export class TwilioConnector extends ISmsConnector {
9
- static providerName = 'twilio'
10
-
11
- readonly twilioClient: twilio.Twilio
12
-
13
- constructor({
14
- ACCOUNT_ID,
15
- AUTH_TOKEN,
16
- SERVICE_ID,
17
- }: { ACCOUNT_ID: string; AUTH_TOKEN: string; SERVICE_ID: string }) {
18
- super({ ACCOUNT_ID, AUTH_TOKEN, SERVICE_ID })
19
- this.twilioClient = twilio(ACCOUNT_ID, AUTH_TOKEN)
20
- }
21
-
22
- async sendSms(sms: ISms): Promise<InternalError | void> {
23
- const message = await this.twilioClient.messages.create({
24
- body: sms.message,
25
- messagingServiceSid: this.SERVICE_ID,
26
- to: sms.to,
27
- })
28
-
29
- if (message.errorMessage)
30
- return createInternalError(null, {
31
- message: message.errorMessage,
32
- status: message.errorCode,
33
- })
34
- }
35
- }
@@ -1,13 +0,0 @@
1
- import { base } from '@develit-io/backend-sdk'
2
- import type { AuditLogEventType } from '../../../@types'
3
- import { sqliteTable, text } from 'drizzle-orm/sqlite-core'
4
-
5
- export const auditLog = sqliteTable('audit_log', {
6
- ...base,
7
- event: text('event').$type<AuditLogEventType>().notNull(),
8
- ip: text('ip'),
9
- userAgent: text('user_agent'),
10
- description: text('description'),
11
- initiatorService: text('initiator_service').notNull(),
12
- initiatorUserId: text('initiator_user_id'),
13
- })
@@ -1 +0,0 @@
1
- export * from './audit-log.schema'