@facteurjs/core 2.0.0-beta.0 → 2.0.0-beta.1
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/channels/aws-sns/channel.d.mts +3 -1
- package/dist/channels/discord/channel.d.mts +3 -1
- package/dist/channels/expo/channel.d.mts +3 -1
- package/dist/channels/expo/message.d.mts +0 -1
- package/dist/channels/fcm/channel.d.mts +3 -1
- package/dist/channels/slack/channel.d.mts +3 -1
- package/dist/channels/socketio/channel.d.mts +3 -1
- package/dist/channels/transmit/channel.d.mts +3 -1
- package/dist/channels/twilio/channel.d.mts +3 -1
- package/dist/channels/webhook/exceptions.d.mts +0 -1
- package/dist/channels/webhook/provider.d.mts +1 -0
- package/dist/channels/webpush/channel.d.mts +3 -1
- package/dist/database/channel.d.mts +3 -1
- package/dist/database/types.d.mts +1 -0
- package/dist/errors/http_error.d.mts +0 -1
- package/dist/errors/index.d.mts +0 -1
- package/dist/errors/index.mjs +2 -2
- package/dist/events/events.d.mts +1 -0
- package/dist/facteur.d.mts +1 -0
- package/dist/fake.d.mts +1 -0
- package/dist/index.d.mts +0 -1
- package/dist/notifications/batching_sender.mjs +3 -3
- package/dist/notifications/channel_resolver.mjs +2 -2
- package/dist/notifications/notification_discoverer.d.mts +1 -0
- package/dist/notifications/notification_discoverer.mjs +2 -2
- package/dist/notifications/notification_sender.mjs +7 -7
- package/dist/options.d.mts +1 -0
- package/dist/types/builder.d.mts +0 -1
- package/dist/types/events.d.mts +0 -1
- package/dist/types/extend.d.mts +0 -1
- package/dist/types/notifications.d.mts +1 -1
- package/dist/types/options.d.mts +2 -2
- package/package.json +7 -7
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Channel, ChannelSendParams, kTargetSymbol } from "../../types/channel.mjs";
|
|
2
|
+
import "../../types.mjs";
|
|
2
3
|
import { AwsSnsMessage } from "./message.mjs";
|
|
3
4
|
import { AwsSnsConfig, AwsSnsTargets } from "./types.mjs";
|
|
5
|
+
import { Awaitable } from "@julr/utils/types";
|
|
4
6
|
|
|
5
7
|
//#region src/channels/aws-sns/channel.d.ts
|
|
6
8
|
declare function awsSnsChannel(config: AwsSnsConfig): AwsSnsChannel;
|
|
@@ -14,7 +16,7 @@ declare class AwsSnsChannel implements Channel<AwsSnsConfig, AwsSnsMessage, any,
|
|
|
14
16
|
}
|
|
15
17
|
declare module '@facteurjs/core/types' {
|
|
16
18
|
interface Notification {
|
|
17
|
-
asAwsSnsMessage(): AwsSnsMessage
|
|
19
|
+
asAwsSnsMessage(): Awaitable<AwsSnsMessage>;
|
|
18
20
|
}
|
|
19
21
|
}
|
|
20
22
|
//#endregion
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { Channel } from "../../types/channel.mjs";
|
|
2
|
+
import "../../types.mjs";
|
|
2
3
|
import { WebhookOptions, WebhookTargets } from "../webhook/types.mjs";
|
|
3
4
|
import { DiscordResponse } from "./types.mjs";
|
|
4
5
|
import { DiscordMessage } from "./message.mjs";
|
|
5
6
|
import { WebhookChannel } from "../webhook/provider.mjs";
|
|
7
|
+
import { Awaitable } from "@julr/utils/types";
|
|
6
8
|
|
|
7
9
|
//#region src/channels/discord/channel.d.ts
|
|
8
10
|
declare function discordWebhookChannel<Options extends WebhookOptions<any>>(options: Options): DiscordProvider<Options>;
|
|
@@ -11,7 +13,7 @@ declare class DiscordProvider<T extends WebhookOptions<any>> extends WebhookChan
|
|
|
11
13
|
}
|
|
12
14
|
declare module '@facteurjs/core/types' {
|
|
13
15
|
interface Notification {
|
|
14
|
-
asDiscordMessage(): DiscordMessage
|
|
16
|
+
asDiscordMessage(): Awaitable<DiscordMessage>;
|
|
15
17
|
}
|
|
16
18
|
}
|
|
17
19
|
//#endregion
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { BatchConfig, BatchSendResult, Channel, ChannelSendParams, kTargetSymbol } from "../../types/channel.mjs";
|
|
2
|
+
import "../../types.mjs";
|
|
2
3
|
import { ExpoMessage } from "./message.mjs";
|
|
3
4
|
import { ExpoConfig, ExpoTargets } from "./types.mjs";
|
|
5
|
+
import { Awaitable } from "@julr/utils/types";
|
|
4
6
|
|
|
5
7
|
//#region src/channels/expo/channel.d.ts
|
|
6
8
|
declare function expoChannel(config?: ExpoConfig): ExpoChannel;
|
|
@@ -18,7 +20,7 @@ declare class ExpoChannel implements Channel<ExpoConfig, ExpoMessage, any, ExpoT
|
|
|
18
20
|
}
|
|
19
21
|
declare module '@facteurjs/core/types' {
|
|
20
22
|
interface Notification {
|
|
21
|
-
asExpoMessage(): ExpoMessage
|
|
23
|
+
asExpoMessage(): Awaitable<ExpoMessage>;
|
|
22
24
|
}
|
|
23
25
|
}
|
|
24
26
|
//#endregion
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { BatchConfig, BatchSendResult, Channel, ChannelSendParams, kTargetSymbol } from "../../types/channel.mjs";
|
|
2
|
+
import "../../types.mjs";
|
|
2
3
|
import { FcmMessage } from "./message.mjs";
|
|
3
4
|
import { FcmConfig, FcmTargets } from "./types.mjs";
|
|
5
|
+
import { Awaitable } from "@julr/utils/types";
|
|
4
6
|
|
|
5
7
|
//#region src/channels/fcm/channel.d.ts
|
|
6
8
|
declare function fcmChannel(config: FcmConfig): FcmChannel;
|
|
@@ -15,7 +17,7 @@ declare class FcmChannel implements Channel<FcmConfig, FcmMessage, any, FcmTarge
|
|
|
15
17
|
}
|
|
16
18
|
declare module '@facteurjs/core/types' {
|
|
17
19
|
interface Notification {
|
|
18
|
-
asFcmMessage(): FcmMessage
|
|
20
|
+
asFcmMessage(): Awaitable<FcmMessage>;
|
|
19
21
|
}
|
|
20
22
|
}
|
|
21
23
|
//#endregion
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { Channel } from "../../types/channel.mjs";
|
|
2
|
+
import "../../types.mjs";
|
|
2
3
|
import { WebhookChannel } from "../webhook/provider.mjs";
|
|
3
4
|
import { SlackMessage } from "./message.mjs";
|
|
4
5
|
import { SlackOptions, SlackTargets } from "./types.mjs";
|
|
6
|
+
import { Awaitable } from "@julr/utils/types";
|
|
5
7
|
|
|
6
8
|
//#region src/channels/slack/channel.d.ts
|
|
7
9
|
declare function slackWebhookChannel<Options extends SlackOptions<any>>(options: Options): SlackWebhookChannel<Options>;
|
|
@@ -11,7 +13,7 @@ declare class SlackWebhookChannel<T extends SlackOptions<any>> extends WebhookCh
|
|
|
11
13
|
}
|
|
12
14
|
declare module '@facteurjs/core/types' {
|
|
13
15
|
interface Notification {
|
|
14
|
-
asSlackMessage(): SlackMessage
|
|
16
|
+
asSlackMessage(): Awaitable<SlackMessage>;
|
|
15
17
|
}
|
|
16
18
|
}
|
|
17
19
|
//#endregion
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Channel, ChannelSendParams, kTargetSymbol } from "../../types/channel.mjs";
|
|
2
|
+
import "../../types.mjs";
|
|
2
3
|
import { SocketIoMessage } from "./message.mjs";
|
|
3
4
|
import { SocketIOConfig, SocketIOTargets } from "./types.mjs";
|
|
5
|
+
import { Awaitable } from "@julr/utils/types";
|
|
4
6
|
import { Server } from "socket.io";
|
|
5
7
|
|
|
6
8
|
//#region src/channels/socketio/channel.d.ts
|
|
@@ -16,7 +18,7 @@ declare class SocketIOChannel implements Channel<SocketIOConfig, SocketIoMessage
|
|
|
16
18
|
}
|
|
17
19
|
declare module '@facteurjs/core/types' {
|
|
18
20
|
interface Notification {
|
|
19
|
-
asSocketIoMessage(): SocketIoMessage
|
|
21
|
+
asSocketIoMessage(): Awaitable<SocketIoMessage>;
|
|
20
22
|
}
|
|
21
23
|
}
|
|
22
24
|
//#endregion
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Channel, ChannelSendParams, kTargetSymbol } from "../../types/channel.mjs";
|
|
2
|
+
import "../../types.mjs";
|
|
2
3
|
import { TransmitMessage } from "./message.mjs";
|
|
3
4
|
import { TransmitConfig, TransmitTargets } from "./types.mjs";
|
|
5
|
+
import { Awaitable } from "@julr/utils/types";
|
|
4
6
|
|
|
5
7
|
//#region src/channels/transmit/channel.d.ts
|
|
6
8
|
declare function transmitChannel(config: TransmitConfig): TransmitChannel;
|
|
@@ -14,7 +16,7 @@ declare class TransmitChannel implements Channel<TransmitConfig, TransmitMessage
|
|
|
14
16
|
}
|
|
15
17
|
declare module '@facteurjs/core/types' {
|
|
16
18
|
interface Notification {
|
|
17
|
-
asTransmitMessage(): TransmitMessage
|
|
19
|
+
asTransmitMessage(): Awaitable<TransmitMessage>;
|
|
18
20
|
}
|
|
19
21
|
}
|
|
20
22
|
//#endregion
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Channel, ChannelSendParams, kTargetSymbol } from "../../types/channel.mjs";
|
|
2
|
+
import "../../types.mjs";
|
|
2
3
|
import { TwilioMessage } from "./message.mjs";
|
|
3
4
|
import { TwilioConfig, TwilioTargets } from "./types.mjs";
|
|
5
|
+
import { Awaitable } from "@julr/utils/types";
|
|
4
6
|
|
|
5
7
|
//#region src/channels/twilio/channel.d.ts
|
|
6
8
|
declare function twilioChannel(config: TwilioConfig): TwilioChannel;
|
|
@@ -14,7 +16,7 @@ declare class TwilioChannel implements Channel<TwilioConfig, TwilioMessage, any,
|
|
|
14
16
|
}
|
|
15
17
|
declare module '@facteurjs/core/types' {
|
|
16
18
|
interface Notification {
|
|
17
|
-
asTwilioMessage(): TwilioMessage
|
|
19
|
+
asTwilioMessage(): Awaitable<TwilioMessage>;
|
|
18
20
|
}
|
|
19
21
|
}
|
|
20
22
|
//#endregion
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { Channel, ChannelSendParams, kTargetSymbol } from "../../types/channel.mjs";
|
|
2
|
+
import "../../types.mjs";
|
|
2
3
|
import { WebpushMessage } from "./message.mjs";
|
|
3
4
|
import { WebpushConfig, WebpushTargets } from "./types.mjs";
|
|
4
5
|
import webpush from "web-push";
|
|
6
|
+
import { Awaitable } from "@julr/utils/types";
|
|
5
7
|
|
|
6
8
|
//#region src/channels/webpush/channel.d.ts
|
|
7
9
|
declare function webpushChannel(config: WebpushConfig): WebpushChannel;
|
|
@@ -19,7 +21,7 @@ declare class WebpushChannel implements Channel<WebpushConfig, WebpushMessage, a
|
|
|
19
21
|
}
|
|
20
22
|
declare module '@facteurjs/core/types' {
|
|
21
23
|
interface Notification {
|
|
22
|
-
asWebpushMessage(): WebpushMessage
|
|
24
|
+
asWebpushMessage(): Awaitable<WebpushMessage>;
|
|
23
25
|
}
|
|
24
26
|
}
|
|
25
27
|
//#endregion
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Channel, ChannelSendParams, kTargetSymbol } from "../types/channel.mjs";
|
|
2
|
+
import "../types.mjs";
|
|
2
3
|
import { DatabaseConfig, Identifier } from "./types.mjs";
|
|
3
4
|
import { DatabaseMessage } from "./message.mjs";
|
|
5
|
+
import { Awaitable } from "@julr/utils/types";
|
|
4
6
|
|
|
5
7
|
//#region src/database/channel.d.ts
|
|
6
8
|
declare function databaseChannel(options: DatabaseConfig): DatabaseChannel;
|
|
@@ -17,7 +19,7 @@ declare class DatabaseChannel implements Channel<DatabaseConfig, DatabaseMessage
|
|
|
17
19
|
}
|
|
18
20
|
declare module '@facteurjs/core/types' {
|
|
19
21
|
interface Notification {
|
|
20
|
-
asDatabaseMessage(): DatabaseMessage
|
|
22
|
+
asDatabaseMessage(): Awaitable<DatabaseMessage>;
|
|
21
23
|
}
|
|
22
24
|
}
|
|
23
25
|
//#endregion
|
package/dist/errors/index.d.mts
CHANGED
|
@@ -2,7 +2,6 @@ import { E_DUPLICATE_NOTIFICATION } from "./duplicate_notification_exception.mjs
|
|
|
2
2
|
import * as _poppinss_exception0 from "@poppinss/exception";
|
|
3
3
|
|
|
4
4
|
//#region src/errors/index.d.ts
|
|
5
|
-
|
|
6
5
|
/**
|
|
7
6
|
* Thrown when the notification targets for a channel cannot be determined
|
|
8
7
|
* before sending the notification.
|
package/dist/errors/index.mjs
CHANGED
|
@@ -22,8 +22,8 @@ const E_MISSING_MESSAGE_METHOD = createError(`Notification is missing "as%sMessa
|
|
|
22
22
|
var E_SEND_NOTIFICATION_FAILED = class extends AggregateError {
|
|
23
23
|
code = "E_SEND_NOTIFICATION_FAILED";
|
|
24
24
|
status = 500;
|
|
25
|
-
constructor(errors
|
|
26
|
-
super(errors
|
|
25
|
+
constructor(errors) {
|
|
26
|
+
super(errors, "Failed to send notification due to errors in one or more channels.");
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
29
|
const errors = {
|
package/dist/events/events.d.mts
CHANGED
package/dist/facteur.d.mts
CHANGED
|
@@ -4,6 +4,7 @@ import { FacteurFake } from "./fake.mjs";
|
|
|
4
4
|
import { FacteurDatabase } from "./database/database.mjs";
|
|
5
5
|
import { FacteurConfiguration } from "./types/options.mjs";
|
|
6
6
|
import { Notification, NotificationClass } from "./types/notifications.mjs";
|
|
7
|
+
import "./types.mjs";
|
|
7
8
|
import { DatabaseAdapter } from "./database/types.mjs";
|
|
8
9
|
|
|
9
10
|
//#region src/facteur.d.ts
|
package/dist/fake.d.mts
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -56,7 +56,7 @@ var BatchingSender = class {
|
|
|
56
56
|
continueOnError: options.continueOnError,
|
|
57
57
|
...options.timeout && { timeout: options.timeout }
|
|
58
58
|
});
|
|
59
|
-
const messagesByChannel = this.#groupByChannel(preparedRecipients);
|
|
59
|
+
const messagesByChannel = await this.#groupByChannel(preparedRecipients);
|
|
60
60
|
return this.#sendBatches({
|
|
61
61
|
messagesByChannel,
|
|
62
62
|
builderOptions: options.builderOptions,
|
|
@@ -98,11 +98,11 @@ var BatchingSender = class {
|
|
|
98
98
|
/**
|
|
99
99
|
* Groups prepared messages by channel name for batch sending
|
|
100
100
|
*/
|
|
101
|
-
#groupByChannel(preparedRecipients) {
|
|
101
|
+
async #groupByChannel(preparedRecipients) {
|
|
102
102
|
const messagesByChannel = /* @__PURE__ */ new Map();
|
|
103
103
|
for (const prepared of preparedRecipients) for (const [channelName, channelConfig] of Object.entries(prepared.resolvedChannels)) {
|
|
104
104
|
if (!channelConfig.shouldSend || !channelConfig.target) continue;
|
|
105
|
-
const message = this.#sender.prepareMessage({
|
|
105
|
+
const message = await this.#sender.prepareMessage({
|
|
106
106
|
notification: prepared.notification,
|
|
107
107
|
channelName,
|
|
108
108
|
sendOptions: prepared.options,
|
|
@@ -74,8 +74,8 @@ var ChannelResolver = class {
|
|
|
74
74
|
const currentTenant = preferences?.tenants?.[tenantId || -1];
|
|
75
75
|
const tenantPreferences = currentTenant?.global;
|
|
76
76
|
const globalPreferences = preferences?.global.global;
|
|
77
|
-
const notificationTenantPreference = currentTenant?.notifications?.find(({ notification
|
|
78
|
-
const notificationGlobalPreference = preferences?.global.notifications.find(({ notification
|
|
77
|
+
const notificationTenantPreference = currentTenant?.notifications?.find(({ notification }) => notification.identifier === notificationIdentifier);
|
|
78
|
+
const notificationGlobalPreference = preferences?.global.notifications.find(({ notification }) => notification.identifier === notificationIdentifier);
|
|
79
79
|
return mapEntries(fromDeliverBy, (channelName, { shouldSend, target }) => {
|
|
80
80
|
if (shouldSend === false) return [channelName, {
|
|
81
81
|
shouldSend: false,
|
|
@@ -57,9 +57,9 @@ var NotificationDiscoverer = class {
|
|
|
57
57
|
*/
|
|
58
58
|
#validateUniqueNotificationNames(notifications) {
|
|
59
59
|
const notificationsByName = Object.groupBy(notifications, (i) => i.notification.name);
|
|
60
|
-
const duplicates = Object.entries(notificationsByName).filter(([_, notifications
|
|
60
|
+
const duplicates = Object.entries(notificationsByName).filter(([_, notifications]) => (notifications?.length || 0) > 1).map(([notificationName, notifications]) => ({
|
|
61
61
|
notificationName,
|
|
62
|
-
notifications
|
|
62
|
+
notifications
|
|
63
63
|
}));
|
|
64
64
|
if (duplicates.length > 0) throw new errors.E_DUPLICATE_NOTIFICATION(this.#config.searchDirectory, duplicates);
|
|
65
65
|
}
|
|
@@ -20,12 +20,12 @@ var NotificationSender = class {
|
|
|
20
20
|
/**
|
|
21
21
|
* Build the message content by calling the notification's `as<ChannelName>Message` method
|
|
22
22
|
*/
|
|
23
|
-
#buildMessageContent(options) {
|
|
23
|
+
async #buildMessageContent(options) {
|
|
24
24
|
const { notification, channelName, sendOptions } = options;
|
|
25
25
|
const capitalizedChannelName = capitalizeFirstLetter(channelName);
|
|
26
26
|
const messageBuilder = notification[`as${capitalizedChannelName}Message`];
|
|
27
27
|
if (typeof messageBuilder !== "function") throw new errors.E_MISSING_MESSAGE_METHOD([capitalizedChannelName]);
|
|
28
|
-
const content = messageBuilder.call(notification, {
|
|
28
|
+
const content = await messageBuilder.call(notification, {
|
|
29
29
|
to: sendOptions.to,
|
|
30
30
|
params: sendOptions.params,
|
|
31
31
|
tenantId: sendOptions.tenantId
|
|
@@ -75,10 +75,10 @@ var NotificationSender = class {
|
|
|
75
75
|
/**
|
|
76
76
|
* Emit notification failed event
|
|
77
77
|
*/
|
|
78
|
-
#emitNotificationFailed(notification, errors
|
|
78
|
+
#emitNotificationFailed(notification, errors) {
|
|
79
79
|
const event = facteurEvents.notificationFailed({
|
|
80
80
|
notification,
|
|
81
|
-
errors
|
|
81
|
+
errors
|
|
82
82
|
});
|
|
83
83
|
this.emitter.emit(event.name, event.data);
|
|
84
84
|
}
|
|
@@ -144,7 +144,7 @@ var NotificationSender = class {
|
|
|
144
144
|
async #sendMessage(options) {
|
|
145
145
|
const { notification, channelName, options: sendOptions, channelConfig } = options;
|
|
146
146
|
const channel = this.#getChannel(channelName);
|
|
147
|
-
const messageResult = this.#buildMessageContent({
|
|
147
|
+
const messageResult = await this.#buildMessageContent({
|
|
148
148
|
notification,
|
|
149
149
|
channelName,
|
|
150
150
|
sendOptions
|
|
@@ -304,10 +304,10 @@ var NotificationSender = class {
|
|
|
304
304
|
* Prepare a message for a specific channel without sending it.
|
|
305
305
|
* Returns null if the message should not be sent.
|
|
306
306
|
*/
|
|
307
|
-
prepareMessage(options) {
|
|
307
|
+
async prepareMessage(options) {
|
|
308
308
|
const { notification, channelName, sendOptions, channelConfig } = options;
|
|
309
309
|
this.#getChannel(channelName);
|
|
310
|
-
const messageResult = this.#buildMessageContent({
|
|
310
|
+
const messageResult = await this.#buildMessageContent({
|
|
311
311
|
notification,
|
|
312
312
|
channelName,
|
|
313
313
|
sendOptions
|
package/dist/options.d.mts
CHANGED
|
@@ -3,6 +3,7 @@ import { QueueAdapter } from "./types/queue.mjs";
|
|
|
3
3
|
import { ResolvedDefaultPreferences } from "./types/preferences.mjs";
|
|
4
4
|
import { Emitter } from "./types/events.mjs";
|
|
5
5
|
import { FacteurConfiguration, NotificationResolver, RetryConfig } from "./types/options.mjs";
|
|
6
|
+
import "./types.mjs";
|
|
6
7
|
import { DatabaseAdapter } from "./database/types.mjs";
|
|
7
8
|
import { Logger } from "@julr/utils/logger";
|
|
8
9
|
|
package/dist/types/builder.d.mts
CHANGED
package/dist/types/events.d.mts
CHANGED
package/dist/types/extend.d.mts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ChannelName, NotificationChannels } from "./extend.mjs";
|
|
2
2
|
import { ExtractChannelTargets, MessageCtx, NotificationOptions } from "./options.mjs";
|
|
3
|
+
import "../types.mjs";
|
|
3
4
|
import { Identifier } from "../database/types.mjs";
|
|
4
5
|
import { Awaitable } from "@julr/utils/types";
|
|
5
6
|
|
|
6
7
|
//#region src/types/notifications.d.ts
|
|
7
|
-
|
|
8
8
|
/**
|
|
9
9
|
* Constructor type for notification classes
|
|
10
10
|
*/
|
package/dist/types/options.d.mts
CHANGED
|
@@ -4,13 +4,13 @@ import { DefaultPreferences } from "./preferences.mjs";
|
|
|
4
4
|
import { ChannelName, NotificationChannels } from "./extend.mjs";
|
|
5
5
|
import { Emitter } from "./events.mjs";
|
|
6
6
|
import { Notifiable, Notification, NotificationClass } from "./notifications.mjs";
|
|
7
|
+
import "../types.mjs";
|
|
7
8
|
import { DatabaseAdapter, Identifier } from "../database/types.mjs";
|
|
8
9
|
import { Logger } from "@julr/utils/logger";
|
|
9
10
|
import { Awaitable } from "@julr/utils/types";
|
|
10
11
|
import { Duration } from "@julr/tenace/types";
|
|
11
12
|
|
|
12
13
|
//#region src/types/options.d.ts
|
|
13
|
-
|
|
14
14
|
/**
|
|
15
15
|
* Type for values that can be a single item or an array of items
|
|
16
16
|
*/
|
|
@@ -162,7 +162,7 @@ type SendOptions<TNotificationClass extends NotificationClass<any, any>> = IsAno
|
|
|
162
162
|
};
|
|
163
163
|
type ChannelSpecificConfig<N extends Notifiable> = { [K in ChannelName]?: boolean | ProviderTarget<N, K> };
|
|
164
164
|
type ExtractChannelTargets<T> = T extends Channel<any, any, any, infer U> ? U : never;
|
|
165
|
-
type ProviderTarget<_N extends Notifiable, K
|
|
165
|
+
type ProviderTarget<_N extends Notifiable, K extends ChannelName> = ExtractChannelTargets<NotificationChannels[K]>;
|
|
166
166
|
/**
|
|
167
167
|
* Retry options for channel sends
|
|
168
168
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@facteurjs/core",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.1",
|
|
4
4
|
"description": "Framework-agnostic notification system for Node.js with support for multiple channels (email, SMS, push, webhooks, etc.)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"discord",
|
|
@@ -65,18 +65,18 @@
|
|
|
65
65
|
"@julr/tenace": "1.0.0-next.0",
|
|
66
66
|
"@julr/utils": "1.9.0",
|
|
67
67
|
"@poppinss/exception": "^1.2.3",
|
|
68
|
-
"ky": "^1.14.
|
|
68
|
+
"ky": "^1.14.3"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
|
-
"@aws-sdk/client-sns": "^3.
|
|
72
|
-
"@boringnode/transmit": "^0.
|
|
71
|
+
"@aws-sdk/client-sns": "^3.987.0",
|
|
72
|
+
"@boringnode/transmit": "^0.4.0",
|
|
73
73
|
"@types/web-push": "^3.6.4",
|
|
74
74
|
"expo-server-sdk": "^4.0.0",
|
|
75
|
-
"firebase-admin": "^13.6.
|
|
75
|
+
"firebase-admin": "^13.6.1",
|
|
76
76
|
"knex": "^3.1.0",
|
|
77
|
-
"kysely": "^0.28.
|
|
77
|
+
"kysely": "^0.28.11",
|
|
78
78
|
"socket.io": "^4.8.3",
|
|
79
|
-
"twilio": "^5.
|
|
79
|
+
"twilio": "^5.12.1",
|
|
80
80
|
"web-push": "^3.6.7"
|
|
81
81
|
},
|
|
82
82
|
"peerDependencies": {
|