🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

@fluojs/discord

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fluojs/discord - npm Package Compare versions

Comparing version
1.0.0-beta.2
to
1.0.0-beta.3
+1
-0
dist/service.d.ts

@@ -74,2 +74,3 @@ import type { OnApplicationShutdown, OnModuleInit } from '@fluojs/runtime';

private ensureTransport;
private assertReadyForSend;
private normalizeMessage;

@@ -76,0 +77,0 @@ private resolveNotificationThreadId;

+1
-1

@@ -1,1 +0,1 @@

{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAK3E,OAAO,KAAK,EACV,OAAO,EACP,cAAc,EACd,kCAAkC,EAClC,sBAAsB,EAEtB,sBAAsB,EACtB,kBAAkB,EAClB,iBAAiB,EAIjB,8BAA8B,EAC/B,MAAM,YAAY,CAAC;AAqBpB;;;;;;;GAOG;AACH,qBACa,cAAe,YAAW,OAAO,EAAE,YAAY,EAAE,qBAAqB;IAKrE,OAAO,CAAC,QAAQ,CAAC,OAAO;IAJpC,OAAO,CAAC,cAAc,CAAmF;IACzG,OAAO,CAAC,iBAAiB,CAA+B;IACxD,OAAO,CAAC,gBAAgB,CAAwC;gBAEnC,OAAO,EAAE,8BAA8B;IAE9D,qBAAqB,IAAI,OAAO,CAAC,IAAI,CAAC;IAetC,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAiBnC;;;;OAIG;IACH,4BAA4B;IAW5B;;;;;;;;;;;;;;OAcG;IACG,IAAI,CAAC,OAAO,EAAE,cAAc,EAAE,OAAO,GAAE,kBAAuB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAuBjG;;;;;;;;;;;;OAYG;IACG,QAAQ,CAAC,QAAQ,EAAE,SAA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;;;OAgBG;IACG,gBAAgB,CACpB,YAAY,EAAE,kCAAkC,EAChD,OAAO,GAAE,kBAAuB,GAC/B,OAAO,CAAC,iBAAiB,CAAC;YAiCf,eAAe;IAe7B,OAAO,CAAC,kBAAkB;IAM1B,OAAO,CAAC,gBAAgB;IAkBxB,OAAO,CAAC,2BAA2B;YAkBrB,kBAAkB;CAejC"}

@@ -8,3 +8,3 @@ let _initClass;

import { Inject } from '@fluojs/core';
import { DiscordMessageValidationError } from './errors.js';
import { DiscordMessageValidationError, DiscordTransportError } from './errors.js';
import { createDiscordPlatformStatusSnapshot } from './status.js';

@@ -17,2 +17,5 @@ import { DISCORD_OPTIONS } from './tokens.js';

}
function createStoppedTransportError() {
return new DiscordTransportError('Discord transport is shutting down or already stopped.');
}
function normalizeOptionalString(value) {

@@ -54,5 +57,7 @@ const trimmed = value?.trim();

this.lifecycleState = 'stopped';
} catch {
} catch (error) {
this.lifecycleState = 'failed';
throw new Error('Discord transport failed to close cleanly.');
throw new Error('Discord transport failed to close cleanly.', {
cause: error
});
}

@@ -68,5 +73,7 @@ }

this.lifecycleState = 'ready';
} catch {
} catch (error) {
this.lifecycleState = 'failed';
throw new Error('Discord transport failed to initialize.');
throw new Error('Discord transport failed to initialize.', {
cause: error
});
}

@@ -110,2 +117,3 @@ }

}
this.assertReadyForSend();
const transport = await this.ensureTransport();

@@ -184,2 +192,5 @@ const normalized = this.normalizeMessage(message);

async sendNotification(notification, options = {}) {
if (options.signal?.aborted) {
throw createAbortError();
}
const payload = notification.payload;

@@ -224,2 +235,7 @@ const rendered = await this.renderNotification(notification);

}
assertReadyForSend() {
if (this.lifecycleState === 'stopping' || this.lifecycleState === 'stopped') {
throw createStoppedTransportError();
}
}
normalizeMessage(message) {

@@ -226,0 +242,0 @@ return {

@@ -187,2 +187,5 @@ import { DiscordConfigurationError, DiscordTransportError } from './errors.js';

}
if (error instanceof DiscordTransportError) {
throw error;
}
if (attempt < DEFAULT_RETRY_ATTEMPTS) {

@@ -192,5 +195,2 @@ await waitForRetry(DEFAULT_RETRY_DELAY_MS * 2 ** (attempt - 1), context.signal);

}
if (error instanceof DiscordTransportError) {
throw error;
}
throw new DiscordTransportError(createTransportFailureMessage(attempt));

@@ -197,0 +197,0 @@ }

@@ -12,3 +12,3 @@ {

],
"version": "1.0.0-beta.2",
"version": "1.0.0-beta.3",
"private": false,

@@ -40,6 +40,6 @@ "license": "MIT",

"dependencies": {
"@fluojs/core": "^1.0.0-beta.4",
"@fluojs/di": "^1.0.0-beta.6",
"@fluojs/notifications": "^1.0.0-beta.3",
"@fluojs/runtime": "^1.0.0-beta.11"
"@fluojs/core": "^1.0.0-beta.5",
"@fluojs/di": "^1.0.0-beta.7",
"@fluojs/notifications": "^1.0.0-beta.4",
"@fluojs/runtime": "^1.0.0-beta.12"
},

@@ -46,0 +46,0 @@ "devDependencies": {

@@ -64,4 +64,5 @@ # @fluojs/discord

@Inject(DiscordService)
export class DeployNotifier {
constructor(@Inject(DiscordService) private readonly discord: DiscordService) {}
constructor(private readonly discord: DiscordService) {}

@@ -99,2 +100,3 @@ async announce(version: string) {

- 서비스는 모듈 bootstrap 시 transport를 초기화하고, factory가 소유한 리소스만 애플리케이션 shutdown 시 닫습니다.
- 서비스가 shutdown 중이거나 이미 stopped 상태라면 cached transport를 재사용하지 않고 send를 거부합니다.
- 빈 `defaultThreadId`와 `notifications.channel` 값은 trim 후 무시됩니다. notifications channel은 기본적으로 `discord`입니다.

@@ -168,3 +170,3 @@ - 이 패키지는 절대로 `process.env`를 직접 읽지 않습니다. 모든 설정은 명시적인 옵션 또는 DI를 통해 들어와야 합니다.

- 내장 webhook transport는 `408`, `429`, `5xx` 같은 일시적 응답뿐 아니라 transport-level exception도 bounded exponential backoff로 재시도한 뒤 호출자에게 에러를 노출합니다.
- 내장 webhook transport는 `408`, `429`, `5xx` 같은 일시적 응답뿐 아니라 transport-level exception도 bounded exponential backoff로 재시도한 뒤 호출자에게 에러를 노출합니다. 영구적인 upstream 응답은 재시도하지 않습니다.
- 잘못되었거나 절대 URL이 아닌 `webhookUrl` 값은 전달 실패로 재시도하지 않고 즉시 `DiscordConfigurationError`로 거부됩니다.

@@ -171,0 +173,0 @@ - 호출자에게 보이는 `DiscordTransportError` 메시지는 기본적으로 raw upstream response body를 포함하지 않습니다.

@@ -64,4 +64,5 @@ # @fluojs/discord

@Inject(DiscordService)
export class DeployNotifier {
constructor(@Inject(DiscordService) private readonly discord: DiscordService) {}
constructor(private readonly discord: DiscordService) {}

@@ -99,2 +100,3 @@ async announce(version: string) {

- The service initializes the configured transport during module bootstrap and closes factory-owned resources during application shutdown.
- Sends attempted while the service is shutting down or already stopped are rejected before reusing the cached transport.
- Blank `defaultThreadId` and `notifications.channel` values are trimmed and ignored; the notifications channel defaults to `discord`.

@@ -168,3 +170,3 @@ - The package never reads `process.env` directly. All configuration must enter through explicit options or DI.

- The built-in webhook transport retries transient `408`, `429`, and `5xx` responses, and also retries transport-level exceptions, using bounded exponential backoff before surfacing an error.
- The built-in webhook transport retries transient `408`, `429`, and `5xx` responses, and also retries transport-level exceptions, using bounded exponential backoff before surfacing an error. Permanent upstream responses are not retried.
- Malformed or non-absolute `webhookUrl` values are rejected immediately as `DiscordConfigurationError` instead of being retried as delivery failures.

@@ -171,0 +173,0 @@ - Caller-visible `DiscordTransportError` messages omit raw upstream response bodies by default.