@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.
- package/dist/database/schema.cjs +9 -0
- package/dist/database/schema.d.cts +2 -0
- package/dist/database/schema.d.mts +2 -0
- package/dist/database/schema.d.ts +2 -0
- package/dist/database/schema.mjs +3 -0
- package/dist/export/worker.cjs +3 -17
- package/dist/export/worker.d.cts +2 -201
- package/dist/export/worker.d.mts +2 -201
- package/dist/export/worker.d.ts +2 -201
- package/dist/export/worker.mjs +3 -17
- package/dist/shared/notification.4b3eUEIG.cjs +22 -0
- package/dist/shared/notification.BJyMXKGH.d.cts +203 -0
- package/dist/shared/notification.BJyMXKGH.d.mts +203 -0
- package/dist/shared/notification.BJyMXKGH.d.ts +203 -0
- package/dist/shared/notification.C0X8Orrh.mjs +19 -0
- package/package.json +5 -5
- package/@types/consts/audit-log.consts.ts +0 -7
- package/@types/consts/index.ts +0 -1
- package/@types/database/audit-log.types.ts +0 -7
- package/@types/database/index.ts +0 -1
- package/@types/email/IEmail.connector.ts +0 -21
- package/@types/email/IEmail.types.ts +0 -25
- package/@types/email/ecomail/ecomail.connector.ts +0 -139
- package/@types/email/ecomail/ecomail.types.ts +0 -27
- package/@types/email/ecomail/index.ts +0 -2
- package/@types/email/index.ts +0 -3
- package/@types/index.ts +0 -9
- package/@types/io/index.ts +0 -3
- package/@types/io/sendEmail.ts +0 -18
- package/@types/io/sendSlack.ts +0 -19
- package/@types/io/sendSms.ts +0 -20
- package/@types/pushNotification/IPushNotification.ts +0 -1
- package/@types/pushNotification/index.ts +0 -1
- package/@types/queue.ts +0 -19
- package/@types/service.ts +0 -30
- package/@types/slack/ISlack.types.ts +0 -3
- package/@types/slack/index.ts +0 -1
- package/@types/slack/slack.connector.ts +0 -27
- package/@types/sms/ISms.connector.ts +0 -22
- package/@types/sms/ISms.types.ts +0 -4
- package/@types/sms/index.ts +0 -3
- package/@types/sms/twilio/index.ts +0 -1
- package/@types/sms/twilio/twilio.connector.ts +0 -35
- package/src/database/schema/audit-log.schema.ts +0 -13
- 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
|
-
}
|
package/@types/sms/ISms.types.ts
DELETED
package/@types/sms/index.ts
DELETED
|
@@ -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'
|