@distilled.cloud/slack 1.0.0-rc.17 → 1.0.0-rc.19

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.
Files changed (201) hide show
  1. package/lib/_bundle/sdk.js +1 -1
  2. package/lib/_bundle/sdk.js.map +1 -1
  3. package/lib/credentials.d.ts +2 -1
  4. package/lib/credentials.d.ts.map +1 -1
  5. package/lib/index.d.ts +3 -4
  6. package/lib/index.d.ts.map +1 -1
  7. package/lib/index.lazy.js.map +1 -1
  8. package/lib/protocol.d.ts +3 -2
  9. package/lib/protocol.d.ts.map +1 -1
  10. package/lib/services/admin.d.ts +594 -356
  11. package/lib/services/admin.d.ts.map +1 -1
  12. package/lib/services/admin.js +149 -139
  13. package/lib/services/admin.js.map +1 -1
  14. package/lib/services/agents.d.ts +89 -97
  15. package/lib/services/agents.d.ts.map +1 -1
  16. package/lib/services/agents.js +1 -1
  17. package/lib/services/agents.js.map +1 -1
  18. package/lib/services/api.d.ts +2 -2
  19. package/lib/services/api.d.ts.map +1 -1
  20. package/lib/services/api.js +1 -1
  21. package/lib/services/api.js.map +1 -1
  22. package/lib/services/apps.d.ts +74 -74
  23. package/lib/services/apps.d.ts.map +1 -1
  24. package/lib/services/apps.js +34 -33
  25. package/lib/services/apps.js.map +1 -1
  26. package/lib/services/assistant.d.ts +55 -46
  27. package/lib/services/assistant.d.ts.map +1 -1
  28. package/lib/services/assistant.js +1 -1
  29. package/lib/services/assistant.js.map +1 -1
  30. package/lib/services/auth.d.ts +27 -27
  31. package/lib/services/auth.d.ts.map +1 -1
  32. package/lib/services/auth.js +1 -1
  33. package/lib/services/auth.js.map +1 -1
  34. package/lib/services/blocks.d.ts +3 -3
  35. package/lib/services/blocks.d.ts.map +1 -1
  36. package/lib/services/blocks.js +1 -1
  37. package/lib/services/blocks.js.map +1 -1
  38. package/lib/services/bookmarks.d.ts +19 -19
  39. package/lib/services/bookmarks.d.ts.map +1 -1
  40. package/lib/services/bookmarks.js +1 -1
  41. package/lib/services/bookmarks.js.map +1 -1
  42. package/lib/services/bots.d.ts +23 -23
  43. package/lib/services/bots.d.ts.map +1 -1
  44. package/lib/services/bots.js +1 -1
  45. package/lib/services/bots.js.map +1 -1
  46. package/lib/services/calls.d.ts +10 -10
  47. package/lib/services/calls.d.ts.map +1 -1
  48. package/lib/services/calls.js +1 -1
  49. package/lib/services/calls.js.map +1 -1
  50. package/lib/services/canvases.d.ts +18 -18
  51. package/lib/services/canvases.d.ts.map +1 -1
  52. package/lib/services/canvases.js +1 -1
  53. package/lib/services/canvases.js.map +1 -1
  54. package/lib/services/chat.d.ts +103 -103
  55. package/lib/services/chat.d.ts.map +1 -1
  56. package/lib/services/chat.js +1 -1
  57. package/lib/services/chat.js.map +1 -1
  58. package/lib/services/conversations.d.ts +109 -103
  59. package/lib/services/conversations.d.ts.map +1 -1
  60. package/lib/services/conversations.js +39 -38
  61. package/lib/services/conversations.js.map +1 -1
  62. package/lib/services/dialog.d.ts.map +1 -1
  63. package/lib/services/dialog.js +1 -1
  64. package/lib/services/dialog.js.map +1 -1
  65. package/lib/services/dnd.d.ts +14 -14
  66. package/lib/services/dnd.d.ts.map +1 -1
  67. package/lib/services/dnd.js +1 -1
  68. package/lib/services/dnd.js.map +1 -1
  69. package/lib/services/emoji.d.ts +6 -6
  70. package/lib/services/emoji.d.ts.map +1 -1
  71. package/lib/services/emoji.js +1 -1
  72. package/lib/services/emoji.js.map +1 -1
  73. package/lib/services/entity.d.ts +14 -14
  74. package/lib/services/entity.d.ts.map +1 -1
  75. package/lib/services/entity.js +1 -1
  76. package/lib/services/entity.js.map +1 -1
  77. package/lib/services/files.d.ts +106 -106
  78. package/lib/services/files.d.ts.map +1 -1
  79. package/lib/services/files.js +30 -1
  80. package/lib/services/files.js.map +1 -1
  81. package/lib/services/functions.d.ts +37 -37
  82. package/lib/services/functions.d.ts.map +1 -1
  83. package/lib/services/functions.js +1 -1
  84. package/lib/services/functions.js.map +1 -1
  85. package/lib/services/index.d.ts +1 -0
  86. package/lib/services/index.d.ts.map +1 -1
  87. package/lib/services/index.js +1 -0
  88. package/lib/services/lists.d.ts +47 -45
  89. package/lib/services/lists.d.ts.map +1 -1
  90. package/lib/services/lists.js +1 -1
  91. package/lib/services/lists.js.map +1 -1
  92. package/lib/services/migration.d.ts +3 -3
  93. package/lib/services/migration.d.ts.map +1 -1
  94. package/lib/services/migration.js +1 -1
  95. package/lib/services/migration.js.map +1 -1
  96. package/lib/services/oauth.d.ts +102 -102
  97. package/lib/services/oauth.d.ts.map +1 -1
  98. package/lib/services/oauth.js +1 -1
  99. package/lib/services/oauth.js.map +1 -1
  100. package/lib/services/openid.d.ts +40 -40
  101. package/lib/services/openid.d.ts.map +1 -1
  102. package/lib/services/openid.js +1 -1
  103. package/lib/services/openid.js.map +1 -1
  104. package/lib/services/pins.d.ts +9 -9
  105. package/lib/services/pins.d.ts.map +1 -1
  106. package/lib/services/pins.js +1 -1
  107. package/lib/services/pins.js.map +1 -1
  108. package/lib/services/reactions.d.ts +23 -23
  109. package/lib/services/reactions.d.ts.map +1 -1
  110. package/lib/services/reactions.js +1 -1
  111. package/lib/services/reactions.js.map +1 -1
  112. package/lib/services/reminders.d.ts +8 -8
  113. package/lib/services/reminders.d.ts.map +1 -1
  114. package/lib/services/reminders.js +1 -1
  115. package/lib/services/reminders.js.map +1 -1
  116. package/lib/services/rtm.d.ts +11 -11
  117. package/lib/services/rtm.d.ts.map +1 -1
  118. package/lib/services/rtm.js +1 -1
  119. package/lib/services/rtm.js.map +1 -1
  120. package/lib/services/search.d.ts +84 -80
  121. package/lib/services/search.d.ts.map +1 -1
  122. package/lib/services/search.js +1 -1
  123. package/lib/services/search.js.map +1 -1
  124. package/lib/services/slackbot.d.ts +366 -0
  125. package/lib/services/slackbot.d.ts.map +1 -0
  126. package/lib/services/slackbot.js +2 -0
  127. package/lib/services/slackbot.js.map +1 -0
  128. package/lib/services/stars.d.ts +16 -16
  129. package/lib/services/stars.d.ts.map +1 -1
  130. package/lib/services/stars.js +1 -1
  131. package/lib/services/stars.js.map +1 -1
  132. package/lib/services/team.d.ts +39 -37
  133. package/lib/services/team.d.ts.map +1 -1
  134. package/lib/services/team.js +1 -1
  135. package/lib/services/team.js.map +1 -1
  136. package/lib/services/tooling.d.ts.map +1 -1
  137. package/lib/services/tooling.js +1 -1
  138. package/lib/services/tooling.js.map +1 -1
  139. package/lib/services/usergroups.d.ts +30 -30
  140. package/lib/services/usergroups.d.ts.map +1 -1
  141. package/lib/services/usergroups.js +1 -1
  142. package/lib/services/usergroups.js.map +1 -1
  143. package/lib/services/users.d.ts +37 -37
  144. package/lib/services/users.d.ts.map +1 -1
  145. package/lib/services/users.js +1 -1
  146. package/lib/services/users.js.map +1 -1
  147. package/lib/services/views.d.ts +9 -9
  148. package/lib/services/views.d.ts.map +1 -1
  149. package/lib/services/views.js +1 -1
  150. package/lib/services/views.js.map +1 -1
  151. package/lib/services/workflows.d.ts +16 -16
  152. package/lib/services/workflows.d.ts.map +1 -1
  153. package/lib/services/workflows.js +1 -1
  154. package/lib/services/workflows.js.map +1 -1
  155. package/lib/services.lazy/admin.js +2 -2
  156. package/lib/services.lazy/apps.js +1 -1
  157. package/lib/services.lazy/conversations.js +1 -1
  158. package/lib/services.lazy/files.js +3 -1
  159. package/lib/services.lazy/index.js +2 -2
  160. package/lib/services.lazy/slackbot.js +1 -0
  161. package/package.json +8 -7
  162. package/src/credentials.ts +3 -2
  163. package/src/index.ts +3 -4
  164. package/src/protocol.ts +23 -21
  165. package/src/services/admin.ts +1882 -1034
  166. package/src/services/agents.ts +128 -103
  167. package/src/services/api.ts +17 -2
  168. package/src/services/apps.ts +133 -74
  169. package/src/services/assistant.ts +109 -54
  170. package/src/services/auth.ts +46 -27
  171. package/src/services/blocks.ts +18 -3
  172. package/src/services/bookmarks.ts +40 -19
  173. package/src/services/bots.ts +38 -23
  174. package/src/services/calls.ts +35 -10
  175. package/src/services/canvases.ts +77 -46
  176. package/src/services/chat.ts +142 -103
  177. package/src/services/conversations.ts +195 -115
  178. package/src/services/dialog.ts +15 -0
  179. package/src/services/dnd.ts +37 -14
  180. package/src/services/emoji.ts +21 -6
  181. package/src/services/entity.ts +33 -14
  182. package/src/services/files.ts +149 -106
  183. package/src/services/functions.ts +66 -37
  184. package/src/services/index.ts +1 -0
  185. package/src/services/lists.ts +86 -46
  186. package/src/services/migration.ts +18 -3
  187. package/src/services/oauth.ts +127 -102
  188. package/src/services/openid.ts +57 -40
  189. package/src/services/pins.ts +28 -9
  190. package/src/services/reactions.ts +44 -23
  191. package/src/services/reminders.ts +31 -8
  192. package/src/services/rtm.ts +28 -11
  193. package/src/services/search.ts +142 -130
  194. package/src/services/slackbot.ts +766 -0
  195. package/src/services/stars.ts +35 -16
  196. package/src/services/team.ts +73 -37
  197. package/src/services/tooling.ts +15 -0
  198. package/src/services/usergroups.ts +57 -30
  199. package/src/services/users.ts +76 -37
  200. package/src/services/views.ts +30 -9
  201. package/src/services/workflows.ts +45 -16
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@distilled.cloud/slack",
3
- "version": "1.0.0-rc.17",
3
+ "version": "1.0.0-rc.19",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -66,25 +66,26 @@
66
66
  }
67
67
  },
68
68
  "dependencies": {
69
- "@distilled.cloud/core": "1.0.0-rc.17"
69
+ "@distilled.cloud/core": "1.0.0-rc.19"
70
70
  },
71
71
  "devDependencies": {
72
- "@effect/platform-node": "^4.0.5",
72
+ "@distilled.cloud/dev": "0.0.0",
73
+ "@effect/platform-node": "^4.1.2",
73
74
  "@types/node": "26.6.5"
74
75
  },
75
76
  "peerDependencies": {
76
- "effect": "^4.0.5"
77
+ "effect": "^4.1.2"
77
78
  },
78
79
  "distilled": {
79
- "generatedAt": "2026-10-09",
80
- "specUpdatedAt": "2026-10-08"
80
+ "generatedAt": "2026-11-10",
81
+ "specUpdatedAt": "2026-11-07"
81
82
  },
82
83
  "scripts": {
83
84
  "build": "tsrs -b",
84
85
  "specs:fetch": "git submodule update --force --init --depth=1 specs/spec-mirror-slack",
85
86
  "specs:update": "git submodule update --remote --force --depth=1 specs/spec-mirror-slack",
86
87
  "convert": "node --conditions=bun scripts/convert.ts",
87
- "generate": "node --conditions=bun scripts/convert.ts && node --conditions=bun scripts/generate.ts",
88
+ "generate": "node --conditions=bun scripts/generate.ts",
88
89
  "typecheck": "tsrs -p tsconfig.json"
89
90
  }
90
91
  }
@@ -36,7 +36,9 @@ export interface Config {
36
36
  }
37
37
 
38
38
  export class Credentials
39
- extends /*@__PURE__*/ Context.Service<Credentials, Effect.Effect<Config>>()("SlackCredentials") {}
39
+ extends /*@__PURE__*/ Context.Service<Credentials, Effect.Effect<Config, ConfigError>>()(
40
+ "SlackCredentials",
41
+ ) {}
40
42
 
41
43
  const envConfig = /*@__PURE__*/ EffectConfig.all({
42
44
  // SLACK_BOT_TOKEN is the spelling Bolt and most hosting platforms use;
@@ -62,7 +64,6 @@ export const CredentialsFromEnv = /*@__PURE__*/ Layer.succeed(
62
64
  token: Redacted.make(token),
63
65
  apiBaseUrl,
64
66
  })),
65
- Effect.orDie,
66
67
  ),
67
68
  );
68
69
 
package/src/index.ts CHANGED
@@ -2,10 +2,9 @@
2
2
  * @distilled.cloud/slack -- Slack Web API SDK for Effect.
3
3
  *
4
4
  * `./services` is generated by `scripts/generate.ts` from the Smithy models
5
- * in `.generated-specs` (written by `scripts/convert.ts` from the JSON twins
6
- * of the docs.slack.dev method reference, which the spec mirror
7
- * `specs/spec-mirror-slack` snapshots). Everything else in this folder is
8
- * hand-written.
5
+ * that `scripts/convert.ts` converts from the JSON twins of the docs.slack.dev
6
+ * method reference, which the spec mirror `specs/spec-mirror-slack` snapshots.
7
+ * Everything else in this folder is hand-written.
9
8
  */
10
9
  export * from "./credentials.ts";
11
10
  export * from "./errors.ts";
package/src/protocol.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import * as API from "@distilled.cloud/core/api";
2
- import { debugHttp } from "@distilled.cloud/core/debug";
3
2
  import {
4
3
  ConfigError,
5
4
  GatewayTimeout,
@@ -7,6 +6,7 @@ import {
7
6
  InternalServerError,
8
7
  ServiceUnavailable,
9
8
  Unauthorized,
9
+ type InvalidInput,
10
10
  } from "@distilled.cloud/core/errors";
11
11
  import {
12
12
  buildRequest,
@@ -16,9 +16,9 @@ import {
16
16
  mapKeys,
17
17
  matchTypedError,
18
18
  } from "@distilled.cloud/core/protocol-http";
19
- import { unwrapRedactedDeep, wrapSensitive } from "@distilled.cloud/core/protocol-rest";
20
- import { validateResponse } from "@distilled.cloud/core/response-validation";
19
+ import { unwrapRedactedDeep, validateSuccess } from "@distilled.cloud/core/protocol-rest";
21
20
  import { parseRetryAfterForStatus, parseServerRetryHint } from "@distilled.cloud/core/retry-after";
21
+ import type { SdkError } from "@distilled.cloud/core/sdk-error";
22
22
  import { httpSymbol, querySymbol, type HttpTrait } from "@distilled.cloud/core/trait";
23
23
  /**
24
24
  * SlackProtocol -- hand-written.
@@ -69,7 +69,12 @@ import {
69
69
  * SlackOpContext>` explicitly so the compiler never infers these back out of
70
70
  * the schema generics.
71
71
  */
72
- export type SlackOpError = DefaultErrors | ConfigError | HttpClientError.HttpClientError;
72
+ export type SlackOpError =
73
+ | DefaultErrors
74
+ | ConfigError
75
+ | HttpClientError.HttpClientError
76
+ | InvalidInput
77
+ | SdkError;
73
78
 
74
79
  /** Context (requirements) shared by every generated Slack operation. */
75
80
  export type SlackOpContext = Credentials | HttpClient.HttpClient;
@@ -153,7 +158,7 @@ const encode = ({ input, inputAst }: { readonly input: unknown; readonly inputAs
153
158
  const resolveCredentials = yield* Credentials;
154
159
  const creds = yield* resolveCredentials as Effect.Effect<Config>;
155
160
  const token = Redacted.value(creds.token);
156
- return buildRequest({
161
+ return yield* buildRequest({
157
162
  input: serializeForWire(unwrapRedactedDeep(input), inputAst),
158
163
  inputAst,
159
164
  baseUrl: creds.apiBaseUrl,
@@ -176,13 +181,11 @@ const decode = ({
176
181
  // Read as BYTES first: the analytics export answers a successful call
177
182
  // with a gzipped file, which a text read would corrupt. Everything else
178
183
  // decodes from the same buffer.
179
- const bytes = new Uint8Array(yield* response.arrayBuffer.pipe(Effect.orDie));
184
+ const bytes = new Uint8Array(yield* response.arrayBuffer.pipe(Effect.catch(fail)));
180
185
  const text = new TextDecoder().decode(bytes);
181
- if (debugHttp()) {
182
- console.error(`[distilled] <- ${response.status} ${text.slice(0, 400)}`);
183
- }
184
186
 
185
187
  let json: Record<string, unknown> | undefined;
188
+ let nonJson = false;
186
189
  if (text.trim().length > 0) {
187
190
  try {
188
191
  const parsed = JSON.parse(text);
@@ -191,6 +194,7 @@ const decode = ({
191
194
  }
192
195
  } catch {
193
196
  // non-JSON -- a binary success payload or an HTML error page
197
+ nonJson = true;
194
198
  }
195
199
  }
196
200
  const status = response.status;
@@ -281,24 +285,22 @@ const decode = ({
281
285
  // Successful non-JSON body: raw bytes (the analytics file download --
282
286
  // modeled as a Document output, so the bytes pass through verbatim).
283
287
  // Strict mode fails them for every other (struct) output.
284
- if (json === undefined) {
285
- return yield* validateResponse(
286
- outputAst,
287
- bytes,
288
- (cause) => new SlackParseError({ body: text, cause }),
289
- ).pipe(Effect.catch(fail));
290
- }
291
-
288
+ //
292
289
  // 2xx envelope: the body IS the payload (`ok` rides along as a modeled
293
290
  // member). Wire->TS key mapping is schema-driven; sensitive members
294
291
  // (OAuth access/refresh tokens) wrap in Redacted. Strict mode checks the
295
292
  // mapped payload against the output schema first.
296
- const mapped = yield* validateResponse(
293
+ //
294
+ // Either way, parse errors withhold a body that can hold a secret, and a
295
+ // body that is not JSON at all fails for such an output in every mode
296
+ // (core `validateSuccess`).
297
+ return yield* validateSuccess(
297
298
  outputAst,
298
- mapKeys(outputAst, json, "decode"),
299
- (cause) => new SlackParseError({ body: json, cause }),
299
+ json === undefined
300
+ ? { value: bytes, body: text, nonJson }
301
+ : { value: mapKeys(outputAst, json, "decode"), body: json, nonJson },
302
+ (info) => new SlackParseError(info),
300
303
  ).pipe(Effect.catch(fail));
301
- return wrapSensitive(outputAst, mapped);
302
304
  });
303
305
 
304
306
  export const SlackProtocol: Layer.Layer<API.Protocol> = /*@__PURE__*/ Layer.succeed(