@fluojs/slack 1.1.2 → 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/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.
@@ -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,oBAAoB,EAEpB,oBAAoB,EACpB,gBAAgB,EAChB,eAAe,EAGhB,MAAM,YAAY,CAAC;AA2CpB;;;;;;;GAOG;AACH,qBACa,YAAa,YAAW,KAAK,EAAE,YAAY,EAAE,qBAAqB;IAKjE,OAAO,CAAC,QAAQ,CAAC,OAAO;IAJpC,OAAO,CAAC,cAAc,CAAyC;IAC/D,OAAO,CAAC,iBAAiB,CAA6B;IACtD,OAAO,CAAC,gBAAgB,CAAsC;gBAEjC,OAAO,EAAE,4BAA4B;IAE5D,qBAAqB,IAAI,OAAO,CAAC,IAAI,CAAC;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;;;;;;;;;;;;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;;;;;;;;;;;OAYG;IACG,QAAQ,CAAC,QAAQ,EAAE,SAAS,YAAY,EAAE,EAAE,OAAO,GAAE,oBAAyB,GAAG,OAAO,CAAC,oBAAoB,CAAC;IA+BpH;;;;;;;;;;;;;;;;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
@@ -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) {
@@ -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,CA6DjG"}
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.2",
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.0.3",
40
+ "@fluojs/di": "^1.1.0",
41
41
  "@fluojs/notifications": "^1.0.1",
42
- "@fluojs/runtime": "^1.1.2"
42
+ "@fluojs/runtime": "^1.1.6"
43
43
  },
44
44
  "devDependencies": {
45
45
  "vitest": "^3.2.4"