@fluojs/slack 1.1.1 → 1.1.3
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/README.ko.md +1 -0
- package/README.md +1 -0
- package/dist/module.d.ts +4 -1
- package/dist/module.d.ts.map +1 -1
- package/dist/module.js +4 -1
- package/dist/service.d.ts +2 -0
- package/dist/service.d.ts.map +1 -1
- package/dist/service.js +12 -0
- package/dist/webhook.d.ts.map +1 -1
- package/dist/webhook.js +2 -1
- package/package.json +3 -3
package/README.ko.md
CHANGED
|
@@ -199,6 +199,7 @@ await slack.send({
|
|
|
199
199
|
|
|
200
200
|
Behavioral contract 메모:
|
|
201
201
|
|
|
202
|
+
- `fetch`를 명시적으로 전달하는 방식이 portable path이며 모든 지원 런타임에서 권장됩니다. 하위 호환성을 위해 `fetch`를 생략하면 ambient runtime API인 `globalThis.fetch`가 있을 때 이를 폴백으로 사용합니다. `globalThis.fetch`가 없는 런타임에서는 `SlackConfigurationError`로 빠르게 실패합니다.
|
|
202
203
|
- 내장 webhook transport는 `408`, `429`, `5xx` 같은 일시적 실패를 호출자에게 에러를 노출하기 전에 bounded exponential backoff로 재시도합니다.
|
|
203
204
|
- Abort signal은 주입된 `fetch` 경계로 전달되며, retry backoff를 취소할 때 `AbortError`를 `SlackTransportError`로 감싸지 않습니다.
|
|
204
205
|
- 호출자에게 보이는 `SlackTransportError` 메시지는 기본적으로 raw upstream response body를 포함하지 않습니다.
|
package/README.md
CHANGED
|
@@ -199,6 +199,7 @@ For richer API integrations such as `chat.postMessage`, implement the exported `
|
|
|
199
199
|
|
|
200
200
|
Behavioral contract notes:
|
|
201
201
|
|
|
202
|
+
- Passing `fetch` explicitly is the portable path and is recommended for all supported runtimes. For backward compatibility, omitting `fetch` falls back to `globalThis.fetch` when that ambient runtime API exists; runtimes without `globalThis.fetch` fail fast with `SlackConfigurationError`.
|
|
202
203
|
- The built-in webhook transport retries transient `408`, `429`, and `5xx` failures with bounded exponential backoff before surfacing an error.
|
|
203
204
|
- Abort signals are passed to the injected `fetch` boundary and cancel retry backoff without wrapping `AbortError` values as `SlackTransportError`.
|
|
204
205
|
- Caller-visible `SlackTransportError` messages omit raw upstream response bodies by default.
|
package/dist/module.d.ts
CHANGED
|
@@ -19,7 +19,10 @@ export declare class SlackModule {
|
|
|
19
19
|
* @example
|
|
20
20
|
* ```ts
|
|
21
21
|
* SlackModule.forRoot({
|
|
22
|
-
* transport: createSlackWebhookTransport({
|
|
22
|
+
* transport: createSlackWebhookTransport({
|
|
23
|
+
* fetch: runtime.fetch,
|
|
24
|
+
* webhookUrl: 'https://hooks.slack.com/services/...',
|
|
25
|
+
* }),
|
|
23
26
|
* });
|
|
24
27
|
* ```
|
|
25
28
|
*/
|
package/dist/module.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAgB,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAMhE,OAAO,KAAK,EAGV,uBAAuB,EACvB,kBAAkB,EAGnB,MAAM,YAAY,CAAC;AA0DpB;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,kBAAkB,GAAG,QAAQ,EAAE,CAK5E;AAsCD,kFAAkF;AAClF,qBAAa,WAAW;IACtB
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAgB,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAMhE,OAAO,KAAK,EAGV,uBAAuB,EACvB,kBAAkB,EAGnB,MAAM,YAAY,CAAC;AA0DpB;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,kBAAkB,GAAG,QAAQ,EAAE,CAK5E;AAsCD,kFAAkF;AAClF,qBAAa,WAAW;IACtB;;;;;;;;;;;;;;;OAeG;IACH,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,kBAAkB,GAAG,UAAU;IAIvD;;;;;;;;;;;;;;;;;;;OAmBG;IACH,MAAM,CAAC,YAAY,CAAC,OAAO,EAAE,uBAAuB,GAAG,UAAU;CAGlE"}
|
package/dist/module.js
CHANGED
|
@@ -99,7 +99,10 @@ export class SlackModule {
|
|
|
99
99
|
* @example
|
|
100
100
|
* ```ts
|
|
101
101
|
* SlackModule.forRoot({
|
|
102
|
-
* transport: createSlackWebhookTransport({
|
|
102
|
+
* transport: createSlackWebhookTransport({
|
|
103
|
+
* fetch: runtime.fetch,
|
|
104
|
+
* webhookUrl: 'https://hooks.slack.com/services/...',
|
|
105
|
+
* }),
|
|
103
106
|
* });
|
|
104
107
|
* ```
|
|
105
108
|
*/
|
package/dist/service.d.ts
CHANGED
|
@@ -12,9 +12,11 @@ export declare class SlackService implements Slack, OnModuleInit, OnApplicationS
|
|
|
12
12
|
private readonly options;
|
|
13
13
|
private lifecycleState;
|
|
14
14
|
private resolvedTransport;
|
|
15
|
+
private shutdownPromise;
|
|
15
16
|
private transportPromise;
|
|
16
17
|
constructor(options: NormalizedSlackModuleOptions);
|
|
17
18
|
onApplicationShutdown(): Promise<void>;
|
|
19
|
+
private closeOwnedTransport;
|
|
18
20
|
onModuleInit(): Promise<void>;
|
|
19
21
|
/**
|
|
20
22
|
* Creates a platform status snapshot for the active Slack transport wiring.
|
package/dist/service.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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,EAEV,4BAA4B,EAC5B,KAAK,EACL,YAAY,EACZ,gCAAgC,EAChC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AO,CAAC,eAAe,CAAC;YAkCb,eAAe;IAiB7B,OAAO,CAAC,6BAA6B;IAMrC,OAAO,CAAC,gBAAgB;IAIxB,OAAO,CAAC,gBAAgB;IAkBxB,OAAO,CAAC,0BAA0B;YAkBpB,kBAAkB;CAkBjC"}
|
package/dist/service.js
CHANGED
|
@@ -54,12 +54,23 @@ class SlackService {
|
|
|
54
54
|
}
|
|
55
55
|
lifecycleState = 'created';
|
|
56
56
|
resolvedTransport;
|
|
57
|
+
shutdownPromise;
|
|
57
58
|
transportPromise;
|
|
58
59
|
constructor(options) {
|
|
59
60
|
this.options = options;
|
|
60
61
|
}
|
|
61
62
|
async onApplicationShutdown() {
|
|
63
|
+
if (this.lifecycleState === 'stopped') {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
if (this.shutdownPromise) {
|
|
67
|
+
return this.shutdownPromise;
|
|
68
|
+
}
|
|
62
69
|
this.lifecycleState = 'stopping';
|
|
70
|
+
this.shutdownPromise = this.closeOwnedTransport();
|
|
71
|
+
return this.shutdownPromise;
|
|
72
|
+
}
|
|
73
|
+
async closeOwnedTransport() {
|
|
63
74
|
try {
|
|
64
75
|
const transport = this.resolvedTransport ?? (this.transportPromise ? await this.transportPromise : undefined);
|
|
65
76
|
if (transport && this.options.transport.ownsResources && transport.close) {
|
|
@@ -163,6 +174,7 @@ class SlackService {
|
|
|
163
174
|
* ```
|
|
164
175
|
*/
|
|
165
176
|
async sendMany(messages, options = {}) {
|
|
177
|
+
assertNotAborted(options.signal);
|
|
166
178
|
const results = [];
|
|
167
179
|
const failures = [];
|
|
168
180
|
for (const message of messages) {
|
package/dist/webhook.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webhook.d.ts","sourceRoot":"","sources":["../src/webhook.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAIV,cAAc,EAEd,4BAA4B,EAC7B,MAAM,YAAY,CAAC;AA4FpB;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,4BAA4B,GAAG,cAAc,
|
|
1
|
+
{"version":3,"file":"webhook.d.ts","sourceRoot":"","sources":["../src/webhook.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAIV,cAAc,EAEd,4BAA4B,EAC7B,MAAM,YAAY,CAAC;AA4FpB;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,4BAA4B,GAAG,cAAc,CA8DjG"}
|
package/dist/webhook.js
CHANGED
|
@@ -134,14 +134,15 @@ export function createSlackWebhookTransport(options) {
|
|
|
134
134
|
method: 'POST',
|
|
135
135
|
signal: context.signal
|
|
136
136
|
});
|
|
137
|
-
const body = await readResponseBody(response);
|
|
138
137
|
if (!response.ok) {
|
|
139
138
|
if (attempt < DEFAULT_RETRY_ATTEMPTS && isTransientStatus(response.status)) {
|
|
140
139
|
await waitForRetry(DEFAULT_RETRY_DELAY_MS * 2 ** (attempt - 1), context.signal);
|
|
141
140
|
continue;
|
|
142
141
|
}
|
|
142
|
+
await readResponseBody(response);
|
|
143
143
|
throw new SlackTransportError(createStatusFailureMessage(response, attempt));
|
|
144
144
|
}
|
|
145
|
+
const body = await readResponseBody(response);
|
|
145
146
|
return {
|
|
146
147
|
channel: message.channel,
|
|
147
148
|
ok: true,
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"portable",
|
|
10
10
|
"fetch"
|
|
11
11
|
],
|
|
12
|
-
"version": "1.1.
|
|
12
|
+
"version": "1.1.3",
|
|
13
13
|
"private": false,
|
|
14
14
|
"license": "MIT",
|
|
15
15
|
"repository": {
|
|
@@ -37,9 +37,9 @@
|
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@fluojs/core": "^1.0.3",
|
|
40
|
+
"@fluojs/di": "^1.1.0",
|
|
40
41
|
"@fluojs/notifications": "^1.0.1",
|
|
41
|
-
"@fluojs/runtime": "^1.1.
|
|
42
|
-
"@fluojs/di": "^1.0.3"
|
|
42
|
+
"@fluojs/runtime": "^1.1.6"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"vitest": "^3.2.4"
|