@distilled.cloud/slack 1.0.0-rc.19 → 1.0.0-rc.21
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.md +2 -2
- package/lib/.lazy.json +1 -1
- package/lib/_bundle/sdk.js +1 -1
- package/lib/_bundle/sdk.js.map +1 -1
- package/lib/credentials.d.ts +6 -2
- package/lib/credentials.d.ts.map +1 -1
- package/lib/errors.d.ts +10 -0
- package/lib/errors.d.ts.map +1 -1
- package/lib/errors.js +1 -1
- package/lib/index.d.ts +0 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +0 -1
- package/lib/pagination.d.ts.map +1 -1
- package/lib/protocol.d.ts +47 -12
- package/lib/protocol.d.ts.map +1 -1
- package/lib/retry.d.ts +1 -2
- package/lib/retry.d.ts.map +1 -1
- package/lib/services/admin.d.ts +264 -83
- package/lib/services/admin.d.ts.map +1 -1
- package/lib/services/admin.js +154 -149
- package/lib/services/admin.js.map +1 -1
- package/lib/services/agents.d.ts.map +1 -1
- package/lib/services/agents.js +1 -1
- package/lib/services/agents.js.map +1 -1
- package/lib/services/api.d.ts.map +1 -1
- package/lib/services/api.js +1 -1
- package/lib/services/api.js.map +1 -1
- package/lib/services/apps.d.ts +7 -7
- package/lib/services/apps.d.ts.map +1 -1
- package/lib/services/apps.js +34 -34
- package/lib/services/apps.js.map +1 -1
- package/lib/services/assistant.d.ts +4 -1
- package/lib/services/assistant.d.ts.map +1 -1
- package/lib/services/assistant.js +1 -1
- package/lib/services/assistant.js.map +1 -1
- package/lib/services/auth.d.ts.map +1 -1
- package/lib/services/auth.js +1 -1
- package/lib/services/auth.js.map +1 -1
- package/lib/services/blocks.d.ts.map +1 -1
- package/lib/services/blocks.js +1 -1
- package/lib/services/blocks.js.map +1 -1
- package/lib/services/bookmarks.d.ts.map +1 -1
- package/lib/services/bookmarks.js +1 -1
- package/lib/services/bookmarks.js.map +1 -1
- package/lib/services/bots.d.ts.map +1 -1
- package/lib/services/bots.js +1 -1
- package/lib/services/bots.js.map +1 -1
- package/lib/services/calls.d.ts.map +1 -1
- package/lib/services/calls.js +1 -1
- package/lib/services/calls.js.map +1 -1
- package/lib/services/canvases.d.ts +1 -1
- package/lib/services/canvases.d.ts.map +1 -1
- package/lib/services/canvases.js +1 -1
- package/lib/services/canvases.js.map +1 -1
- package/lib/services/chat.d.ts.map +1 -1
- package/lib/services/chat.js +1 -1
- package/lib/services/chat.js.map +1 -1
- package/lib/services/conversations.d.ts +5 -5
- package/lib/services/conversations.d.ts.map +1 -1
- package/lib/services/conversations.js +39 -39
- package/lib/services/conversations.js.map +1 -1
- package/lib/services/dialog.d.ts.map +1 -1
- package/lib/services/dialog.js +1 -1
- package/lib/services/dialog.js.map +1 -1
- package/lib/services/dnd.d.ts.map +1 -1
- package/lib/services/dnd.js +1 -1
- package/lib/services/dnd.js.map +1 -1
- package/lib/services/emoji.d.ts.map +1 -1
- package/lib/services/emoji.js +1 -1
- package/lib/services/emoji.js.map +1 -1
- package/lib/services/entity.d.ts.map +1 -1
- package/lib/services/entity.js +1 -1
- package/lib/services/entity.js.map +1 -1
- package/lib/services/files.d.ts +1 -1
- package/lib/services/files.d.ts.map +1 -1
- package/lib/services/files.js +28 -28
- package/lib/services/files.js.map +1 -1
- package/lib/services/functions.d.ts.map +1 -1
- package/lib/services/functions.js +1 -1
- package/lib/services/functions.js.map +1 -1
- package/lib/services/index.d.ts.map +1 -1
- package/lib/services/lists.d.ts.map +1 -1
- package/lib/services/lists.js +1 -1
- package/lib/services/lists.js.map +1 -1
- package/lib/services/migration.d.ts.map +1 -1
- package/lib/services/migration.js +1 -1
- package/lib/services/migration.js.map +1 -1
- package/lib/services/oauth.d.ts +6 -6
- package/lib/services/oauth.d.ts.map +1 -1
- package/lib/services/oauth.js +1 -1
- package/lib/services/oauth.js.map +1 -1
- package/lib/services/openid.d.ts +2 -2
- package/lib/services/openid.d.ts.map +1 -1
- package/lib/services/openid.js +1 -1
- package/lib/services/openid.js.map +1 -1
- package/lib/services/pins.d.ts.map +1 -1
- package/lib/services/pins.js +1 -1
- package/lib/services/pins.js.map +1 -1
- package/lib/services/reactions.d.ts.map +1 -1
- package/lib/services/reactions.js +1 -1
- package/lib/services/reactions.js.map +1 -1
- package/lib/services/reminders.d.ts.map +1 -1
- package/lib/services/reminders.js +1 -1
- package/lib/services/reminders.js.map +1 -1
- package/lib/services/rtm.d.ts.map +1 -1
- package/lib/services/rtm.js +1 -1
- package/lib/services/rtm.js.map +1 -1
- package/lib/services/search.d.ts.map +1 -1
- package/lib/services/search.js +1 -1
- package/lib/services/search.js.map +1 -1
- package/lib/services/slackbot.d.ts +2 -2
- package/lib/services/slackbot.d.ts.map +1 -1
- package/lib/services/slackbot.js +1 -1
- package/lib/services/slackbot.js.map +1 -1
- package/lib/services/stars.d.ts.map +1 -1
- package/lib/services/stars.js +1 -1
- package/lib/services/stars.js.map +1 -1
- package/lib/services/team.d.ts +1 -1
- package/lib/services/team.d.ts.map +1 -1
- package/lib/services/team.js +1 -1
- package/lib/services/team.js.map +1 -1
- package/lib/services/tooling.d.ts +1 -1
- package/lib/services/tooling.d.ts.map +1 -1
- package/lib/services/tooling.js +1 -1
- package/lib/services/tooling.js.map +1 -1
- package/lib/services/usergroups.d.ts.map +1 -1
- package/lib/services/usergroups.js +1 -1
- package/lib/services/usergroups.js.map +1 -1
- package/lib/services/users.d.ts +73 -1
- package/lib/services/users.d.ts.map +1 -1
- package/lib/services/users.js +1 -1
- package/lib/services/users.js.map +1 -1
- package/lib/services/views.d.ts.map +1 -1
- package/lib/services/views.js +1 -1
- package/lib/services/views.js.map +1 -1
- package/lib/services/workflows.d.ts +4 -4
- package/lib/services/workflows.d.ts.map +1 -1
- package/lib/services/workflows.js +1 -1
- package/lib/services/workflows.js.map +1 -1
- package/lib/services.lazy/admin.js +2 -2
- package/lib/services.lazy/apps.js +1 -1
- package/lib/services.lazy/conversations.js +1 -1
- package/lib/services.lazy/files.js +1 -1
- package/lib/traits.d.ts.map +1 -1
- package/package.json +6 -7
- package/src/credentials.ts +20 -15
- package/src/errors.ts +12 -1
- package/src/index.ts +0 -1
- package/src/protocol.ts +96 -86
- package/src/retry.ts +1 -2
- package/src/services/admin.ts +1523 -951
- package/src/services/agents.ts +23 -12
- package/src/services/api.ts +3 -2
- package/src/services/apps.ts +57 -34
- package/src/services/assistant.ts +17 -8
- package/src/services/auth.ts +7 -4
- package/src/services/blocks.ts +3 -2
- package/src/services/bookmarks.ts +9 -5
- package/src/services/bots.ts +3 -2
- package/src/services/calls.ts +13 -7
- package/src/services/canvases.ts +16 -9
- package/src/services/chat.ts +27 -14
- package/src/services/conversations.ts +62 -34
- package/src/services/dialog.ts +3 -2
- package/src/services/dnd.ts +11 -6
- package/src/services/emoji.ts +3 -2
- package/src/services/entity.ts +7 -4
- package/src/services/files.ts +32 -17
- package/src/services/functions.ts +17 -9
- package/src/services/lists.ts +25 -13
- package/src/services/migration.ts +3 -2
- package/src/services/oauth.ts +23 -17
- package/src/services/openid.ts +8 -6
- package/src/services/pins.ts +7 -4
- package/src/services/reactions.ts +9 -5
- package/src/services/reminders.ts +11 -6
- package/src/services/rtm.ts +5 -3
- package/src/services/search.ts +7 -4
- package/src/services/slackbot.ts +17 -10
- package/src/services/stars.ts +7 -4
- package/src/services/team.ts +20 -11
- package/src/services/tooling.ts +5 -4
- package/src/services/usergroups.ts +15 -8
- package/src/services/users.ts +136 -17
- package/src/services/views.ts +9 -5
- package/src/services/workflows.ts +21 -13
- package/lib/index.lazy.js +0 -7
- package/lib/index.lazy.js.map +0 -1
package/src/protocol.ts
CHANGED
|
@@ -1,13 +1,18 @@
|
|
|
1
|
-
import * as API from "@distilled.cloud/core/api";
|
|
2
1
|
import {
|
|
3
|
-
ConfigError,
|
|
4
2
|
GatewayTimeout,
|
|
5
|
-
HTTP_STATUS_MAP,
|
|
6
3
|
InternalServerError,
|
|
7
4
|
ServiceUnavailable,
|
|
8
5
|
Unauthorized,
|
|
9
|
-
type InvalidInput,
|
|
10
6
|
} from "@distilled.cloud/core/errors";
|
|
7
|
+
import type {
|
|
8
|
+
DeclaredError,
|
|
9
|
+
DeclaredErrorClass,
|
|
10
|
+
DecodeArgs,
|
|
11
|
+
EncodeArgs,
|
|
12
|
+
ErrorOf,
|
|
13
|
+
Protocol,
|
|
14
|
+
ProtocolOf,
|
|
15
|
+
} from "@distilled.cloud/core/protocol";
|
|
11
16
|
import {
|
|
12
17
|
buildRequest,
|
|
13
18
|
getAnn,
|
|
@@ -16,9 +21,12 @@ import {
|
|
|
16
21
|
mapKeys,
|
|
17
22
|
matchTypedError,
|
|
18
23
|
} from "@distilled.cloud/core/protocol-http";
|
|
19
|
-
import {
|
|
24
|
+
import {
|
|
25
|
+
declaredStatusClass,
|
|
26
|
+
unwrapRedactedDeep,
|
|
27
|
+
validateSuccess,
|
|
28
|
+
} from "@distilled.cloud/core/protocol-rest";
|
|
20
29
|
import { parseRetryAfterForStatus, parseServerRetryHint } from "@distilled.cloud/core/retry-after";
|
|
21
|
-
import type { SdkError } from "@distilled.cloud/core/sdk-error";
|
|
22
30
|
import { httpSymbol, querySymbol, type HttpTrait } from "@distilled.cloud/core/trait";
|
|
23
31
|
/**
|
|
24
32
|
* SlackProtocol -- hand-written.
|
|
@@ -41,49 +49,53 @@ import { httpSymbol, querySymbol, type HttpTrait } from "@distilled.cloud/core/t
|
|
|
41
49
|
* becomes a typed error: per-op matcher classes first, then the
|
|
42
50
|
* infrastructure slugs (auth -> Unauthorized, throttling ->
|
|
43
51
|
* SlackRateLimited, server hiccups -> retryable 5xx classes),
|
|
44
|
-
* then {@link SlackError} carrying the slug.
|
|
52
|
+
* then {@link SlackError} carrying the slug. Those classes
|
|
53
|
+
* and core's status classes are the service's errors
|
|
54
|
+
* (`SlackServiceErrors`): the protocol builds one only from the
|
|
55
|
+
* classes the operation lists.
|
|
45
56
|
* A successful NON-JSON body is returned as raw bytes -- the one
|
|
46
57
|
* method that answers this way (`admin.analytics.getFile`) sends
|
|
47
58
|
* a gzipped NDJSON file.
|
|
48
59
|
*/
|
|
49
60
|
import * as Effect from "effect/Effect";
|
|
50
61
|
import type * as HttpClient from "effect/http/HttpClient";
|
|
51
|
-
import type * as HttpClientError from "effect/http/HttpClientError";
|
|
52
|
-
import type * as HttpClientRequest from "effect/http/HttpClientRequest";
|
|
53
|
-
import type * as HttpClientResponse from "effect/http/HttpClientResponse";
|
|
54
|
-
import * as Layer from "effect/Layer";
|
|
55
62
|
import * as Redacted from "effect/Redacted";
|
|
56
63
|
import type * as AST from "effect/SchemaAST";
|
|
57
|
-
import { Credentials
|
|
64
|
+
import { Credentials } from "./credentials.ts";
|
|
58
65
|
import {
|
|
59
|
-
type DefaultErrors,
|
|
60
66
|
SlackError,
|
|
61
67
|
SlackHttpError,
|
|
62
68
|
SlackParseError,
|
|
63
69
|
SlackRateLimited,
|
|
70
|
+
type SlackServiceError,
|
|
64
71
|
} from "./errors.ts";
|
|
65
72
|
|
|
66
73
|
/**
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
74
|
+
* What every generated Slack operation fails with besides its own errors:
|
|
75
|
+
* the service's errors, the protocol's, and what resolving the credentials
|
|
76
|
+
* fails with. Generated service files annotate operations with
|
|
77
|
+
* `API.OperationMethod<I, O, SlackOpError, SlackOpContext>` explicitly so
|
|
78
|
+
* the compiler never infers these back out of the schema generics.
|
|
71
79
|
*/
|
|
72
|
-
export type SlackOpError =
|
|
73
|
-
| DefaultErrors
|
|
74
|
-
| ConfigError
|
|
75
|
-
| HttpClientError.HttpClientError
|
|
76
|
-
| InvalidInput
|
|
77
|
-
| SdkError;
|
|
80
|
+
export type SlackOpError = SlackServiceError | ErrorOf<typeof SlackProtocol>;
|
|
78
81
|
|
|
79
82
|
/** Context (requirements) shared by every generated Slack operation. */
|
|
80
83
|
export type SlackOpContext = Credentials | HttpClient.HttpClient;
|
|
81
84
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
85
|
+
/**
|
|
86
|
+
* An instance of `cls`, a class of the service's errors, built from the
|
|
87
|
+
* operation's own list: `undefined` when the operation does not list the
|
|
88
|
+
* class (every generated operation lists `SlackServiceErrors`).
|
|
89
|
+
*/
|
|
90
|
+
const declaredError = <Props>(
|
|
91
|
+
errors: ReadonlyArray<DeclaredErrorClass>,
|
|
92
|
+
cls: new (props: Props) => unknown,
|
|
93
|
+
props: Props,
|
|
94
|
+
): DeclaredError | undefined => {
|
|
95
|
+
const known: unknown = cls;
|
|
96
|
+
const Declared = errors.find((declared) => declared === known);
|
|
97
|
+
return Declared === undefined ? undefined : new Declared(props);
|
|
98
|
+
};
|
|
87
99
|
|
|
88
100
|
/**
|
|
89
101
|
* Envelope slugs that mean "the token is no good" on ANY method -- mapped to
|
|
@@ -100,12 +112,22 @@ const AUTH_SLUGS = /*@__PURE__*/ new Set([
|
|
|
100
112
|
"token_expired",
|
|
101
113
|
]);
|
|
102
114
|
|
|
103
|
-
/**
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
115
|
+
/**
|
|
116
|
+
* Envelope slugs that are Slack-side hiccups -- retryable server errors. An
|
|
117
|
+
* entry answers `undefined` when the operation does not list the class it
|
|
118
|
+
* maps to.
|
|
119
|
+
*/
|
|
120
|
+
const SERVER_SLUGS: Record<
|
|
121
|
+
string,
|
|
122
|
+
(
|
|
123
|
+
errors: ReadonlyArray<DeclaredErrorClass>,
|
|
124
|
+
message: string,
|
|
125
|
+
) => DeclaredError | InternalServerError | undefined
|
|
126
|
+
> = {
|
|
127
|
+
internal_error: (_errors, message) => new InternalServerError({ message }),
|
|
128
|
+
fatal_error: (_errors, message) => new InternalServerError({ message }),
|
|
129
|
+
service_unavailable: (errors, message) => declaredError(errors, ServiceUnavailable, { message }),
|
|
130
|
+
request_timeout: (errors, message) => declaredError(errors, GatewayTimeout, { message }),
|
|
109
131
|
};
|
|
110
132
|
|
|
111
133
|
/**
|
|
@@ -147,16 +169,13 @@ const serializeForWire = (input: unknown, inputAst: AST.AST): unknown => {
|
|
|
147
169
|
return out ?? input;
|
|
148
170
|
};
|
|
149
171
|
|
|
150
|
-
// The protocol
|
|
151
|
-
//
|
|
152
|
-
//
|
|
153
|
-
|
|
154
|
-
// this boundary (Protocol effects are typed with no requirements) and
|
|
155
|
-
// reintroduced for callers by the generated `SlackOpContext` annotations.
|
|
156
|
-
const encode = ({ input, inputAst }: { readonly input: unknown; readonly inputAst: AST.AST }) =>
|
|
172
|
+
// The protocol is one module-level value shared by every operation, so it
|
|
173
|
+
// must not capture credentials -- `encode` resolves Credentials from the
|
|
174
|
+
// calling fiber's context on every request instead.
|
|
175
|
+
const encode = ({ input, inputAst }: EncodeArgs) =>
|
|
157
176
|
Effect.gen(function* () {
|
|
158
177
|
const resolveCredentials = yield* Credentials;
|
|
159
|
-
const creds = yield* resolveCredentials
|
|
178
|
+
const creds = yield* resolveCredentials;
|
|
160
179
|
const token = Redacted.value(creds.token);
|
|
161
180
|
return yield* buildRequest({
|
|
162
181
|
input: serializeForWire(unwrapRedactedDeep(input), inputAst),
|
|
@@ -168,20 +187,12 @@ const encode = ({ input, inputAst }: { readonly input: unknown; readonly inputAs
|
|
|
168
187
|
});
|
|
169
188
|
});
|
|
170
189
|
|
|
171
|
-
const decode = ({
|
|
172
|
-
response,
|
|
173
|
-
outputAst,
|
|
174
|
-
errors: errorClasses,
|
|
175
|
-
}: {
|
|
176
|
-
readonly response: HttpClientResponse.HttpClientResponse;
|
|
177
|
-
readonly outputAst: AST.AST;
|
|
178
|
-
readonly errors: ReadonlyArray<unknown>;
|
|
179
|
-
}) =>
|
|
190
|
+
const decode = ({ response, outputAst, errors: errorClasses }: DecodeArgs) =>
|
|
180
191
|
Effect.gen(function* () {
|
|
181
192
|
// Read as BYTES first: the analytics export answers a successful call
|
|
182
193
|
// with a gzipped file, which a text read would corrupt. Everything else
|
|
183
194
|
// decodes from the same buffer.
|
|
184
|
-
const bytes = new Uint8Array(yield* response.arrayBuffer
|
|
195
|
+
const bytes = new Uint8Array(yield* response.arrayBuffer);
|
|
185
196
|
const text = new TextDecoder().decode(bytes);
|
|
186
197
|
|
|
187
198
|
let json: Record<string, unknown> | undefined;
|
|
@@ -227,59 +238,60 @@ const decode = ({
|
|
|
227
238
|
body: json === undefined ? text : json,
|
|
228
239
|
headers,
|
|
229
240
|
});
|
|
230
|
-
if (typed !== undefined) return yield* fail(typed);
|
|
241
|
+
if (typed !== undefined) return yield* Effect.fail(typed);
|
|
231
242
|
|
|
232
243
|
// 2. Throttling -- the 429 or its envelope spellings.
|
|
233
244
|
if (status === 429 || slug === "rate_limited" || slug === "ratelimited") {
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
);
|
|
245
|
+
const throttled = declaredError(errorClasses, SlackRateLimited, {
|
|
246
|
+
code: slug ?? "rate_limited",
|
|
247
|
+
message,
|
|
248
|
+
retryAfter: parseServerRetryHint(headers),
|
|
249
|
+
});
|
|
250
|
+
if (throttled !== undefined) return yield* Effect.fail(throttled);
|
|
241
251
|
}
|
|
242
252
|
|
|
243
253
|
// 3. Infrastructure slugs: credential problems and Slack-side hiccups.
|
|
244
254
|
if (slug !== undefined && AUTH_SLUGS.has(slug)) {
|
|
245
|
-
|
|
255
|
+
const unauthorized = declaredError(errorClasses, Unauthorized, { message: slug });
|
|
256
|
+
if (unauthorized !== undefined) return yield* Effect.fail(unauthorized);
|
|
246
257
|
}
|
|
247
258
|
if (slug !== undefined && slug in SERVER_SLUGS) {
|
|
248
|
-
|
|
259
|
+
const server = SERVER_SLUGS[slug]!(errorClasses, message);
|
|
260
|
+
if (server !== undefined) return yield* Effect.fail(server);
|
|
249
261
|
}
|
|
250
262
|
|
|
251
263
|
// 4. Any other envelope slug -> SlackError, the slug preserved.
|
|
252
264
|
if (slug !== undefined) {
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
);
|
|
265
|
+
const slackError = declaredError(errorClasses, SlackError, {
|
|
266
|
+
code: slug,
|
|
267
|
+
...(message !== slug ? { message } : {}),
|
|
268
|
+
...(typeof json?.needed === "string" ? { needed: json.needed } : {}),
|
|
269
|
+
...(typeof json?.provided === "string" ? { provided: json.provided } : {}),
|
|
270
|
+
...(detailMessages.length > 0 ? { messages: detailMessages } : {}),
|
|
271
|
+
});
|
|
272
|
+
if (slackError !== undefined) return yield* Effect.fail(slackError);
|
|
262
273
|
}
|
|
263
274
|
|
|
264
|
-
// 5. No envelope at all:
|
|
265
|
-
|
|
275
|
+
// 5. No envelope at all: core's class for the status (which the
|
|
276
|
+
// service declares) / retryable 5xx / raw.
|
|
277
|
+
const StatusErrorClass = declaredStatusClass(status, errorClasses);
|
|
266
278
|
if (StatusErrorClass) {
|
|
267
|
-
return yield* fail(
|
|
279
|
+
return yield* Effect.fail(
|
|
268
280
|
new StatusErrorClass({
|
|
269
281
|
message,
|
|
270
282
|
retryAfter: parseRetryAfterForStatus(status, headers),
|
|
271
|
-
}
|
|
283
|
+
}),
|
|
272
284
|
);
|
|
273
285
|
}
|
|
274
286
|
if (status >= 500) {
|
|
275
|
-
return yield* fail(
|
|
287
|
+
return yield* Effect.fail(
|
|
276
288
|
new InternalServerError({
|
|
277
289
|
message,
|
|
278
290
|
retryAfter: parseRetryAfterForStatus(status, headers),
|
|
279
291
|
}),
|
|
280
292
|
);
|
|
281
293
|
}
|
|
282
|
-
return yield* fail(new SlackHttpError({ status, message, body: text.slice(0, 2000) }));
|
|
294
|
+
return yield* Effect.fail(new SlackHttpError({ status, message, body: text.slice(0, 2000) }));
|
|
283
295
|
}
|
|
284
296
|
|
|
285
297
|
// Successful non-JSON body: raw bytes (the analytics file download --
|
|
@@ -300,14 +312,12 @@ const decode = ({
|
|
|
300
312
|
? { value: bytes, body: text, nonJson }
|
|
301
313
|
: { value: mapKeys(outputAst, json, "decode"), body: json, nonJson },
|
|
302
314
|
(info) => new SlackParseError(info),
|
|
303
|
-
)
|
|
315
|
+
);
|
|
304
316
|
});
|
|
305
317
|
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
}),
|
|
313
|
-
);
|
|
318
|
+
const slackProtocolMethods = {
|
|
319
|
+
encode,
|
|
320
|
+
decode,
|
|
321
|
+
} satisfies Protocol<unknown, unknown>;
|
|
322
|
+
|
|
323
|
+
export const SlackProtocol: ProtocolOf<typeof slackProtocolMethods> = slackProtocolMethods;
|
package/src/retry.ts
CHANGED
|
@@ -6,8 +6,7 @@ import * as Retries from "@distilled.cloud/core/retry";
|
|
|
6
6
|
* `API.make({ retry: Retry })`, so a caller-installed policy applies to all
|
|
7
7
|
* Slack calls below it and core's `makeDefault` is the fallback when none is
|
|
8
8
|
* provided. Slack rate limits per method tier and answers 429s with a
|
|
9
|
-
* `Retry-After` header, which the default policy
|
|
10
|
-
* its own backoff.
|
|
9
|
+
* `Retry-After` header, which the default policy waits at least.
|
|
11
10
|
*
|
|
12
11
|
* @example
|
|
13
12
|
* ```ts
|