@fluojs/slack 1.0.0 → 1.1.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/README.ko.md +8 -1
- package/README.md +8 -1
- package/dist/service.d.ts.map +1 -1
- package/dist/service.js +5 -2
- package/dist/webhook.d.ts.map +1 -1
- package/dist/webhook.js +3 -0
- package/package.json +5 -5
package/README.ko.md
CHANGED
|
@@ -127,6 +127,7 @@ Behavioral contract 메모:
|
|
|
127
127
|
|
|
128
128
|
- `SlackService.send(...)`는 전달 전에 `defaultChannel`을 해석합니다.
|
|
129
129
|
- `SlackService.sendMany(...)`는 메시지를 순차적으로 보내며, fail-fast 대신 batch result가 필요한 호출자를 위해 `continueOnError`를 지원합니다.
|
|
130
|
+
- `SlackService.send(...)`, `SlackService.sendMany(...)`, `SlackService.sendNotification(...)`은 provider handoff 전에 이미 abort된 signal을 존중하며, 같은 signal을 transport 호출로 전달합니다.
|
|
130
131
|
- 서비스는 모듈 bootstrap 시 transport를 초기화하고, factory가 소유한 리소스만 애플리케이션 shutdown 시 닫습니다.
|
|
131
132
|
- shutdown이 시작된 뒤에는 `SlackService.send(...)`와 `SlackService.sendNotification(...)`이 transport를 재사용하거나 lazy 생성하지 않고 `SlackLifecycleError`로 실패합니다. 진행 중인 factory 소유 transport 생성은 shutdown이 기다린 뒤 닫습니다.
|
|
132
133
|
- `SlackService.createPlatformStatusSnapshot()`은 호출자가 내부 옵션에 접근하지 않아도 lifecycle, readiness, transport 소유권을 보고합니다.
|
|
@@ -199,6 +200,7 @@ await slack.send({
|
|
|
199
200
|
Behavioral contract 메모:
|
|
200
201
|
|
|
201
202
|
- 내장 webhook transport는 `408`, `429`, `5xx` 같은 일시적 실패를 호출자에게 에러를 노출하기 전에 bounded exponential backoff로 재시도합니다.
|
|
203
|
+
- Abort signal은 주입된 `fetch` 경계로 전달되며, retry backoff를 취소할 때 `AbortError`를 `SlackTransportError`로 감싸지 않습니다.
|
|
202
204
|
- 호출자에게 보이는 `SlackTransportError` 메시지는 기본적으로 raw upstream response body를 포함하지 않습니다.
|
|
203
205
|
|
|
204
206
|
### 의도적인 제한 사항
|
|
@@ -217,6 +219,8 @@ Slack 패키지는 의도적으로 다음을 **포함하지 않습니다**:
|
|
|
217
219
|
### 핵심
|
|
218
220
|
|
|
219
221
|
- `SlackModule.forRoot(options)` / `SlackModule.forRootAsync(options)`
|
|
222
|
+
- `SlackModuleOptions`
|
|
223
|
+
- `SlackAsyncModuleOptions`
|
|
220
224
|
- `createSlackProviders(options)`
|
|
221
225
|
- `SlackService`
|
|
222
226
|
- `SlackService.send(message, options)`
|
|
@@ -250,8 +254,11 @@ Slack 패키지는 의도적으로 다음을 **포함하지 않습니다**:
|
|
|
250
254
|
- `SlackTransportReceipt`
|
|
251
255
|
- `SlackFetchLike`
|
|
252
256
|
- `SlackFetchResponse`
|
|
253
|
-
- `
|
|
257
|
+
- `SlackWebhookTransportOptions`
|
|
254
258
|
- `createSlackWebhookTransport(options)`
|
|
259
|
+
- `SlackTemplateRenderer`
|
|
260
|
+
- `SlackTemplateRenderInput`
|
|
261
|
+
- `SlackTemplateRenderResult`
|
|
255
262
|
|
|
256
263
|
### 상태 및 에러
|
|
257
264
|
|
package/README.md
CHANGED
|
@@ -127,6 +127,7 @@ Behavioral contract notes:
|
|
|
127
127
|
|
|
128
128
|
- `SlackService.send(...)` resolves `defaultChannel` before delivery.
|
|
129
129
|
- `SlackService.sendMany(...)` sends messages sequentially and supports `continueOnError` when callers need a batch result instead of fail-fast behavior.
|
|
130
|
+
- `SlackService.send(...)`, `SlackService.sendMany(...)`, and `SlackService.sendNotification(...)` honor already-aborted signals before provider handoff, and the same signal is propagated to transport calls.
|
|
130
131
|
- The service initializes the configured transport during module bootstrap and closes factory-owned resources during application shutdown.
|
|
131
132
|
- Once shutdown starts, `SlackService.send(...)` and `SlackService.sendNotification(...)` fail with `SlackLifecycleError` instead of reusing or lazily creating transports; any in-flight factory-owned transport creation is awaited and closed by shutdown.
|
|
132
133
|
- `SlackService.createPlatformStatusSnapshot()` reports lifecycle, readiness, and transport ownership without requiring callers to reach into internal options.
|
|
@@ -199,6 +200,7 @@ For richer API integrations such as `chat.postMessage`, implement the exported `
|
|
|
199
200
|
Behavioral contract notes:
|
|
200
201
|
|
|
201
202
|
- The built-in webhook transport retries transient `408`, `429`, and `5xx` failures with bounded exponential backoff before surfacing an error.
|
|
203
|
+
- Abort signals are passed to the injected `fetch` boundary and cancel retry backoff without wrapping `AbortError` values as `SlackTransportError`.
|
|
202
204
|
- Caller-visible `SlackTransportError` messages omit raw upstream response bodies by default.
|
|
203
205
|
|
|
204
206
|
### Intentional limitations
|
|
@@ -217,6 +219,8 @@ These limitations are part of the package contract so runtime choice, provider c
|
|
|
217
219
|
### Core
|
|
218
220
|
|
|
219
221
|
- `SlackModule.forRoot(options)` / `SlackModule.forRootAsync(options)`
|
|
222
|
+
- `SlackModuleOptions`
|
|
223
|
+
- `SlackAsyncModuleOptions`
|
|
220
224
|
- `createSlackProviders(options)`
|
|
221
225
|
- `SlackService`
|
|
222
226
|
- `SlackService.send(message, options)`
|
|
@@ -250,8 +254,11 @@ These limitations are part of the package contract so runtime choice, provider c
|
|
|
250
254
|
- `SlackTransportReceipt`
|
|
251
255
|
- `SlackFetchLike`
|
|
252
256
|
- `SlackFetchResponse`
|
|
253
|
-
- `
|
|
257
|
+
- `SlackWebhookTransportOptions`
|
|
254
258
|
- `createSlackWebhookTransport(options)`
|
|
259
|
+
- `SlackTemplateRenderer`
|
|
260
|
+
- `SlackTemplateRenderInput`
|
|
261
|
+
- `SlackTemplateRenderResult`
|
|
255
262
|
|
|
256
263
|
### Status and errors
|
|
257
264
|
|
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,CAA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;IAiBtC,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAiCnC;;;;OAIG;IACH,4BAA4B;IAW5B;;;;;;;;;;;;;;;OAeG;IACG,IAAI,CAAC,OAAO,EAAE,YAAY,EAAE,OAAO,GAAE,gBAAqB,GAAG,OAAO,CAAC,eAAe,CAAC;IAsB3F;;;;;;;;;;;;OAYG;IACG,QAAQ,CAAC,QAAQ,EAAE,SAAS,YAAY,EAAE,EAAE,OAAO,GAAE,oBAAyB,GAAG,OAAO,CAAC,oBAAoB,CAAC;IA6BpH;;;;;;;;;;;;;;;;OAgBG;IACG,gBAAgB,CACpB,YAAY,EAAE,gCAAgC,EAC9C,OAAO,GAAE,gBAAqB,GAC7B,OAAO,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
|
@@ -135,6 +135,7 @@ class SlackService {
|
|
|
135
135
|
const transport = await this.ensureTransport();
|
|
136
136
|
const normalized = this.normalizeMessage(message);
|
|
137
137
|
assertMessageContent(normalized);
|
|
138
|
+
assertNotAborted(options.signal);
|
|
138
139
|
this.assertCanDeliver();
|
|
139
140
|
const result = await transport.send(normalized, options);
|
|
140
141
|
return {
|
|
@@ -207,7 +208,8 @@ class SlackService {
|
|
|
207
208
|
assertNotAborted(options.signal);
|
|
208
209
|
this.assertCanDeliver();
|
|
209
210
|
const payload = notification.payload;
|
|
210
|
-
const rendered = await this.renderNotification(notification);
|
|
211
|
+
const rendered = await this.renderNotification(notification, options.signal);
|
|
212
|
+
assertNotAborted(options.signal);
|
|
211
213
|
return this.send({
|
|
212
214
|
attachments: payload.attachments ?? rendered?.attachments,
|
|
213
215
|
blocks: payload.blocks ?? rendered?.blocks,
|
|
@@ -282,10 +284,11 @@ class SlackService {
|
|
|
282
284
|
}
|
|
283
285
|
return recipients[0] ?? this.options.defaultChannel;
|
|
284
286
|
}
|
|
285
|
-
async renderNotification(notification) {
|
|
287
|
+
async renderNotification(notification, signal) {
|
|
286
288
|
if (!notification.template || !this.options.renderer) {
|
|
287
289
|
return undefined;
|
|
288
290
|
}
|
|
291
|
+
assertNotAborted(signal);
|
|
289
292
|
return this.options.renderer.render({
|
|
290
293
|
locale: notification.locale,
|
|
291
294
|
metadata: notification.metadata,
|
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;
|
|
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,CA6DjG"}
|
package/dist/webhook.js
CHANGED
|
@@ -80,6 +80,9 @@ async function waitForRetry(delayMs, signal) {
|
|
|
80
80
|
if (delayMs <= 0) {
|
|
81
81
|
return;
|
|
82
82
|
}
|
|
83
|
+
if (signal?.aborted) {
|
|
84
|
+
throw signal.reason ?? new DOMException('The operation was aborted.', 'AbortError');
|
|
85
|
+
}
|
|
83
86
|
await new Promise((resolve, reject) => {
|
|
84
87
|
const timer = setTimeout(() => {
|
|
85
88
|
signal?.removeEventListener('abort', onAbort);
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"portable",
|
|
10
10
|
"fetch"
|
|
11
11
|
],
|
|
12
|
-
"version": "1.
|
|
12
|
+
"version": "1.1.1",
|
|
13
13
|
"private": false,
|
|
14
14
|
"license": "MIT",
|
|
15
15
|
"repository": {
|
|
@@ -36,10 +36,10 @@
|
|
|
36
36
|
"dist"
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@fluojs/core": "^1.0.
|
|
40
|
-
"@fluojs/
|
|
41
|
-
"@fluojs/
|
|
42
|
-
"@fluojs/
|
|
39
|
+
"@fluojs/core": "^1.0.3",
|
|
40
|
+
"@fluojs/notifications": "^1.0.1",
|
|
41
|
+
"@fluojs/runtime": "^1.1.1",
|
|
42
|
+
"@fluojs/di": "^1.0.3"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"vitest": "^3.2.4"
|