@distilled.cloud/slack 1.0.0-rc.20 → 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.
Files changed (188) hide show
  1. package/README.md +2 -2
  2. package/lib/.lazy.json +1 -1
  3. package/lib/_bundle/sdk.js +1 -1
  4. package/lib/_bundle/sdk.js.map +1 -1
  5. package/lib/credentials.d.ts +6 -2
  6. package/lib/credentials.d.ts.map +1 -1
  7. package/lib/errors.d.ts +10 -0
  8. package/lib/errors.d.ts.map +1 -1
  9. package/lib/errors.js +1 -1
  10. package/lib/index.d.ts +0 -1
  11. package/lib/index.d.ts.map +1 -1
  12. package/lib/index.js +0 -1
  13. package/lib/pagination.d.ts.map +1 -1
  14. package/lib/protocol.d.ts +47 -12
  15. package/lib/protocol.d.ts.map +1 -1
  16. package/lib/retry.d.ts +1 -2
  17. package/lib/retry.d.ts.map +1 -1
  18. package/lib/services/admin.d.ts +264 -83
  19. package/lib/services/admin.d.ts.map +1 -1
  20. package/lib/services/admin.js +154 -149
  21. package/lib/services/admin.js.map +1 -1
  22. package/lib/services/agents.d.ts.map +1 -1
  23. package/lib/services/agents.js +1 -1
  24. package/lib/services/agents.js.map +1 -1
  25. package/lib/services/api.d.ts.map +1 -1
  26. package/lib/services/api.js +1 -1
  27. package/lib/services/api.js.map +1 -1
  28. package/lib/services/apps.d.ts +7 -7
  29. package/lib/services/apps.d.ts.map +1 -1
  30. package/lib/services/apps.js +34 -34
  31. package/lib/services/apps.js.map +1 -1
  32. package/lib/services/assistant.d.ts +4 -1
  33. package/lib/services/assistant.d.ts.map +1 -1
  34. package/lib/services/assistant.js +1 -1
  35. package/lib/services/assistant.js.map +1 -1
  36. package/lib/services/auth.d.ts.map +1 -1
  37. package/lib/services/auth.js +1 -1
  38. package/lib/services/auth.js.map +1 -1
  39. package/lib/services/blocks.d.ts.map +1 -1
  40. package/lib/services/blocks.js +1 -1
  41. package/lib/services/blocks.js.map +1 -1
  42. package/lib/services/bookmarks.d.ts.map +1 -1
  43. package/lib/services/bookmarks.js +1 -1
  44. package/lib/services/bookmarks.js.map +1 -1
  45. package/lib/services/bots.d.ts.map +1 -1
  46. package/lib/services/bots.js +1 -1
  47. package/lib/services/bots.js.map +1 -1
  48. package/lib/services/calls.d.ts.map +1 -1
  49. package/lib/services/calls.js +1 -1
  50. package/lib/services/calls.js.map +1 -1
  51. package/lib/services/canvases.d.ts +1 -1
  52. package/lib/services/canvases.d.ts.map +1 -1
  53. package/lib/services/canvases.js +1 -1
  54. package/lib/services/canvases.js.map +1 -1
  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 +5 -5
  59. package/lib/services/conversations.d.ts.map +1 -1
  60. package/lib/services/conversations.js +39 -39
  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.map +1 -1
  66. package/lib/services/dnd.js +1 -1
  67. package/lib/services/dnd.js.map +1 -1
  68. package/lib/services/emoji.d.ts.map +1 -1
  69. package/lib/services/emoji.js +1 -1
  70. package/lib/services/emoji.js.map +1 -1
  71. package/lib/services/entity.d.ts.map +1 -1
  72. package/lib/services/entity.js +1 -1
  73. package/lib/services/entity.js.map +1 -1
  74. package/lib/services/files.d.ts +1 -1
  75. package/lib/services/files.d.ts.map +1 -1
  76. package/lib/services/files.js +28 -28
  77. package/lib/services/files.js.map +1 -1
  78. package/lib/services/functions.d.ts.map +1 -1
  79. package/lib/services/functions.js +1 -1
  80. package/lib/services/functions.js.map +1 -1
  81. package/lib/services/index.d.ts.map +1 -1
  82. package/lib/services/lists.d.ts.map +1 -1
  83. package/lib/services/lists.js +1 -1
  84. package/lib/services/lists.js.map +1 -1
  85. package/lib/services/migration.d.ts.map +1 -1
  86. package/lib/services/migration.js +1 -1
  87. package/lib/services/migration.js.map +1 -1
  88. package/lib/services/oauth.d.ts +6 -6
  89. package/lib/services/oauth.d.ts.map +1 -1
  90. package/lib/services/oauth.js +1 -1
  91. package/lib/services/oauth.js.map +1 -1
  92. package/lib/services/openid.d.ts +2 -2
  93. package/lib/services/openid.d.ts.map +1 -1
  94. package/lib/services/openid.js +1 -1
  95. package/lib/services/openid.js.map +1 -1
  96. package/lib/services/pins.d.ts.map +1 -1
  97. package/lib/services/pins.js +1 -1
  98. package/lib/services/pins.js.map +1 -1
  99. package/lib/services/reactions.d.ts.map +1 -1
  100. package/lib/services/reactions.js +1 -1
  101. package/lib/services/reactions.js.map +1 -1
  102. package/lib/services/reminders.d.ts.map +1 -1
  103. package/lib/services/reminders.js +1 -1
  104. package/lib/services/reminders.js.map +1 -1
  105. package/lib/services/rtm.d.ts.map +1 -1
  106. package/lib/services/rtm.js +1 -1
  107. package/lib/services/rtm.js.map +1 -1
  108. package/lib/services/search.d.ts.map +1 -1
  109. package/lib/services/search.js +1 -1
  110. package/lib/services/search.js.map +1 -1
  111. package/lib/services/slackbot.d.ts +2 -2
  112. package/lib/services/slackbot.d.ts.map +1 -1
  113. package/lib/services/slackbot.js +1 -1
  114. package/lib/services/slackbot.js.map +1 -1
  115. package/lib/services/stars.d.ts.map +1 -1
  116. package/lib/services/stars.js +1 -1
  117. package/lib/services/stars.js.map +1 -1
  118. package/lib/services/team.d.ts +1 -1
  119. package/lib/services/team.d.ts.map +1 -1
  120. package/lib/services/team.js +1 -1
  121. package/lib/services/team.js.map +1 -1
  122. package/lib/services/tooling.d.ts +1 -1
  123. package/lib/services/tooling.d.ts.map +1 -1
  124. package/lib/services/tooling.js +1 -1
  125. package/lib/services/tooling.js.map +1 -1
  126. package/lib/services/usergroups.d.ts.map +1 -1
  127. package/lib/services/usergroups.js +1 -1
  128. package/lib/services/usergroups.js.map +1 -1
  129. package/lib/services/users.d.ts +73 -1
  130. package/lib/services/users.d.ts.map +1 -1
  131. package/lib/services/users.js +1 -1
  132. package/lib/services/users.js.map +1 -1
  133. package/lib/services/views.d.ts.map +1 -1
  134. package/lib/services/views.js +1 -1
  135. package/lib/services/views.js.map +1 -1
  136. package/lib/services/workflows.d.ts +4 -4
  137. package/lib/services/workflows.d.ts.map +1 -1
  138. package/lib/services/workflows.js +1 -1
  139. package/lib/services/workflows.js.map +1 -1
  140. package/lib/services.lazy/admin.js +2 -2
  141. package/lib/services.lazy/apps.js +1 -1
  142. package/lib/services.lazy/conversations.js +1 -1
  143. package/lib/services.lazy/files.js +1 -1
  144. package/lib/traits.d.ts.map +1 -1
  145. package/package.json +6 -7
  146. package/src/credentials.ts +20 -15
  147. package/src/errors.ts +12 -1
  148. package/src/index.ts +0 -1
  149. package/src/protocol.ts +96 -86
  150. package/src/retry.ts +1 -2
  151. package/src/services/admin.ts +1523 -951
  152. package/src/services/agents.ts +23 -12
  153. package/src/services/api.ts +3 -2
  154. package/src/services/apps.ts +57 -34
  155. package/src/services/assistant.ts +17 -8
  156. package/src/services/auth.ts +7 -4
  157. package/src/services/blocks.ts +3 -2
  158. package/src/services/bookmarks.ts +9 -5
  159. package/src/services/bots.ts +3 -2
  160. package/src/services/calls.ts +13 -7
  161. package/src/services/canvases.ts +16 -9
  162. package/src/services/chat.ts +27 -14
  163. package/src/services/conversations.ts +62 -34
  164. package/src/services/dialog.ts +3 -2
  165. package/src/services/dnd.ts +11 -6
  166. package/src/services/emoji.ts +3 -2
  167. package/src/services/entity.ts +7 -4
  168. package/src/services/files.ts +32 -17
  169. package/src/services/functions.ts +17 -9
  170. package/src/services/lists.ts +25 -13
  171. package/src/services/migration.ts +3 -2
  172. package/src/services/oauth.ts +23 -17
  173. package/src/services/openid.ts +8 -6
  174. package/src/services/pins.ts +7 -4
  175. package/src/services/reactions.ts +9 -5
  176. package/src/services/reminders.ts +11 -6
  177. package/src/services/rtm.ts +5 -3
  178. package/src/services/search.ts +7 -4
  179. package/src/services/slackbot.ts +17 -10
  180. package/src/services/stars.ts +7 -4
  181. package/src/services/team.ts +20 -11
  182. package/src/services/tooling.ts +5 -4
  183. package/src/services/usergroups.ts +15 -8
  184. package/src/services/users.ts +136 -17
  185. package/src/services/views.ts +9 -5
  186. package/src/services/workflows.ts +21 -13
  187. package/lib/index.lazy.js +0 -7
  188. package/lib/index.lazy.js.map +0 -1
package/README.md CHANGED
@@ -14,16 +14,16 @@ npm install @distilled.cloud/slack effect
14
14
  import { Effect, Layer } from "effect";
15
15
  import * as FetchHttpClient from "effect/http/FetchHttpClient";
16
16
  import * as Slack from "@distilled.cloud/slack";
17
+ import * as Admin from "@distilled.cloud/slack/admin";
17
18
 
18
19
  const program = Effect.gen(function* () {
19
- const result = yield* Slack.admin.listAppsActivities({});
20
+ const result = yield* Admin.listAppsActivities({});
20
21
  return result;
21
22
  });
22
23
 
23
24
  const Live = Layer.mergeAll(
24
25
  FetchHttpClient.layer,
25
26
  Slack.CredentialsFromEnv,
26
- Slack.SlackProtocol,
27
27
  );
28
28
 
29
29
  program.pipe(Effect.provide(Live), Effect.runPromise);
package/lib/.lazy.json CHANGED
@@ -1 +1 @@
1
- {"serviceDirs":["services"],"twins":["index.js"]}
1
+ {"serviceDirs":["services"],"twins":[]}
@@ -1,2 +1,2 @@
1
- import{api$D as e,api$Protocol as t,api$call as n,api$named as r,api$op as i,api$opPaginated as a,category$withParseError as o,category$withThrottlingError as s,config$String as c,config$all as l,config$orElse as u,config$withDefault as ee,pagination$paginateCursor as te,retry$capped as ne,retry$jittered as re,retry$makeDefault as ie,retry$throttlingFactory as ae,retry$throttlingOptions as oe,retry$transientFactory as se,retry$transientOptions as ce,schema_lite_typed$Array as d,schema_lite_typed$Number as f,schema_lite_typed$String as p,schema_lite_typed$TaggedError as m,schema_lite_typed$Unknown as h,schema_lite_typed$optional as g,trait$Body as le,trait$FormDataFile as ue,trait$Header as de,trait$Http as fe,trait$HttpBody as pe,trait$KeyDictionary as _,trait$Label as v,trait$Query as y,trait$ResponseCode as b,trait$UnionCases as x,trait$applyErrorMatchers as S,trait$bodySymbol as C,trait$errorMatchersSymbol as w,trait$formDataFileSymbol as T,trait$getErrorMatchers as E,trait$headerSymbol as D,trait$httpBodySymbol as O,trait$httpSymbol as k,trait$keyDictionarySymbol as A,trait$labelSymbol as j,trait$querySymbol as M,trait$responseCodeSymbol as N,trait$unionCasesSymbol as P}from"@distilled.cloud/core/_bundle/base";import{error_category$withCategory as F,errors$API_ERRORS as I,errors$BadGateway as L,errors$BadRequest as R,errors$ConfigError as z,errors$Conflict as B,errors$DEFAULT_ERRORS as me,errors$DurationSchema as he,errors$Forbidden as ge,errors$GatewayTimeout as V,errors$HTTP_STATUS_MAP as H,errors$InternalServerError as U,errors$NotFound as _e,errors$RETRYABLE as ve,errors$ServiceUnavailable as W,errors$TooManyRequests as ye,errors$Unauthorized as G,errors$UnprocessableEntity as be,protocol_http$buildRequest as xe,protocol_http$getAnn as K,protocol_http$getProps as Se,protocol_http$hasPropAnn as Ce,protocol_http$mapKeys as we,protocol_http$matchTypedError as Te,protocol_rest$RawResponse as Ee,protocol_rest$RawResponseRoot as De,protocol_rest$SensitiveValue as Oe,protocol_rest$rawResponseRootSymbol as ke,protocol_rest$rawResponseSymbol as Ae,protocol_rest$sensitiveValueSymbol as je,protocol_rest$unwrapRedactedDeep as Me,protocol_rest$validateSuccess as Ne,retry_after$parseRetryAfterForStatus as q,retry_after$parseServerRetryHint as Pe,schema_lite$Array as Fe,schema_lite$Boolean as Ie,schema_lite$NullOr as Le,schema_lite$Number as Re,schema_lite$Record as ze,schema_lite$String as Be,schema_lite$Struct as Ve,schema_lite$Unknown as He,schema_lite$at as Ue,schema_lite$optional as We,schema_lite$suspend as Ge}from"@distilled.cloud/core/_bundle/rest";import*as J from"effect/Context";import*as Y from"effect/Effect";import*as X from"effect/Layer";import*as Z from"effect/Redacted";const Q=`https://slack.com/api`;var Credentials=class extends (/*@__PURE__*/ J.Service()(`SlackCredentials`)){};const Ke=/*@__PURE__*/ l({token:/*@__PURE__*/ c(`SLACK_BOT_TOKEN`).pipe(/*@__PURE__*/ u(()=>c(`SLACK_TOKEN`))),apiBaseUrl:/*@__PURE__*/ c(`SLACK_API_URL`).pipe(/*@__PURE__*/ ee(Q))});const qe=/*@__PURE__*/ X.succeed(Credentials,/*@__PURE__*/ Ke.pipe(/*@__PURE__*/ Y.mapError(()=>new z({message:`SLACK_BOT_TOKEN (or SLACK_TOKEN) environment variable is required`})),/*@__PURE__*/ Y.map(({token:e,apiBaseUrl:t})=>({token:Z.make(e),apiBaseUrl:t}))));const credentials=e=>X.succeed(Credentials,Y.succeed({token:e.token,apiBaseUrl:e.apiBaseUrl??`https://slack.com/api`}));var SlackError=class extends (/*@__PURE__*/ m()(`SlackError`,{code:p,message:/*@__PURE__*/ g(p),needed:/*@__PURE__*/ g(p),provided:/*@__PURE__*/ g(p),messages:/*@__PURE__*/ g(/*@__PURE__*/ d(p))})){};var SlackRateLimited=class extends (/*@__PURE__*/ m()(`SlackRateLimited`,{code:p,message:/*@__PURE__*/ g(p),retryAfter:/*@__PURE__*/ g(he)}).pipe(/*@__PURE__*/ F(ve),s)){};var SlackHttpError=class extends (/*@__PURE__*/ m()(`SlackHttpError`,{status:f,message:p,body:/*@__PURE__*/ g(p)})){};var SlackParseError=class extends (/*@__PURE__*/ m()(`SlackParseError`,{body:h,cause:h}).pipe(o)){};const slackPaginate=(e,t,n)=>te(e,t,n);const fail=e=>Y.fail(e);const Je=/*@__PURE__*/ new Set([`not_authed`,`invalid_auth`,`account_inactive`,`token_revoked`,`token_expired`]);const $={internal_error:e=>new U({message:e}),fatal_error:e=>new U({message:e}),service_unavailable:e=>new W({message:e}),request_timeout:e=>new V({message:e})};const serializeForWire=(e,t)=>{if(e===null||typeof e!==`object`||Array.isArray(e))return e;const n=K(t,k)?.contentType===`form-urlencoded`;const r=Se(t);if(r.length===0)return e;let i;for(const t of r){const r=String(t.name);const a=e[r];if(a===null||typeof a!==`object`)continue;const o=Ce(t,M);if(Array.isArray(a)&&(o||n)){i??={...e};i[r]=a.every(e=>typeof e!==`object`||e===null)?a.join(`,`):JSON.stringify(a)}else if(n&&!o){i??={...e};i[r]=JSON.stringify(a)}}return i??e};const encode=({input:e,inputAst:t})=>Y.gen(function*(){const n=yield*yield*Credentials;const r=Z.value(n.token);return yield*xe({input:serializeForWire(Me(e),t),inputAst:t,baseUrl:n.apiBaseUrl,headers:r===``?{}:{authorization:`Bearer ${r}`}})});const decode=({response:e,outputAst:t,errors:n})=>Y.gen(function*(){const r=new Uint8Array(yield*e.arrayBuffer.pipe(Y.catch(fail)));const i=new TextDecoder().decode(r);let a;let o=false;if(i.trim().length>0)try{const e=JSON.parse(i);if(e!==null&&typeof e===`object`)a=e}catch{o=true}const s=e.status;const c=e.headers;if(s>=400||a?.ok===false){const e=typeof a?.error===`string`?a.error:void 0;const t=[...(a?.response_metadata)?.messages??[],...Array.isArray(a?.errors)?a.errors:[]].filter(e=>typeof e===`string`);const r=t[0]??e??(a===void 0&&i.trim()?i.trim():`HTTP ${s}`);const o=Te(n,s,[{message:r}],{body:a===void 0?i:a,headers:c});if(o!==void 0)return yield*fail(o);if(s===429||e===`rate_limited`||e===`ratelimited`)return yield*fail(new SlackRateLimited({code:e??`rate_limited`,message:r,retryAfter:Pe(c)}));if(e!==void 0&&Je.has(e))return yield*fail(new G({message:e}));if(e!==void 0&&e in $)return yield*fail($[e](r));if(e!==void 0)return yield*fail(new SlackError({code:e,...r!==e?{message:r}:{},...typeof a?.needed===`string`?{needed:a.needed}:{},...typeof a?.provided===`string`?{provided:a.provided}:{},...t.length>0?{messages:t}:{}}));const l=H[s];if(l)return yield*fail(new l({message:r,retryAfter:q(s,c)}));if(s>=500)return yield*fail(new U({message:r,retryAfter:q(s,c)}));return yield*fail(new SlackHttpError({status:s,message:r,body:i.slice(0,2e3)}))}return yield*Ne(t,a===void 0?{value:r,body:i,nonJson:o}:{value:we(t,a,`decode`),body:a,nonJson:o},e=>new SlackParseError(e)).pipe(Y.catch(fail))});const Ye=/*@__PURE__*/ X.succeed(t,/*@__PURE__*/ t.of({encode:e=>encode(e),decode}));var Retry=class extends (/*@__PURE__*/ J.Service()(`SlackRetry`)){};const policy=e=>Y.provide(X.succeed(Retry,e));const Xe=/*@__PURE__*/ Y.provide(/*@__PURE__*/ X.succeed(Retry,{while:()=>false}));const Ze=ie;const Qe=re;const $e=ne;const et=oe;const tt=/*@__PURE__*/ policy(ae);const nt=ce;const rt=/*@__PURE__*/ policy(se);export{Fe as Nc,Ie as Oc,Le as Vc,Re as Wc,ze as Xc,Be as Zc,Ve as _c,e as a,n as c,Credentials as credentials$Credentials,qe as credentials$CredentialsFromEnv,Q as credentials$DEFAULT_API_BASE_URL,credentials as credentials$credentials,He as ed,I as errors$API_ERRORS,L as errors$BadGateway,R as errors$BadRequest,z as errors$ConfigError,B as errors$Conflict,me as errors$DEFAULT_ERRORS,ge as errors$Forbidden,V as errors$GatewayTimeout,H as errors$HTTP_STATUS_MAP,U as errors$InternalServerError,_e as errors$NotFound,W as errors$ServiceUnavailable,SlackError as errors$SlackError,SlackHttpError as errors$SlackHttpError,SlackParseError as errors$SlackParseError,SlackRateLimited as errors$SlackRateLimited,ye as errors$TooManyRequests,G as errors$Unauthorized,be as errors$UnprocessableEntity,Ue as gd,r as k,We as ld,i as m,Ge as md,a as n,slackPaginate as pagination$slackPaginate,Ye as protocol$SlackProtocol,Retry as retry$Retry,$e as retry$capped,Qe as retry$jittered,Ze as retry$makeDefault,Xe as retry$none,policy as retry$policy,tt as retry$throttling,et as retry$throttlingOptions,rt as retry$transient,nt as retry$transientOptions,le as traits$Body,ue as traits$FormDataFile,de as traits$Header,fe as traits$Http,pe as traits$HttpBody,_ as traits$KeyDictionary,v as traits$Label,y as traits$Query,Ee as traits$RawResponse,De as traits$RawResponseRoot,b as traits$ResponseCode,Oe as traits$SensitiveValue,x as traits$UnionCases,S as traits$applyErrorMatchers,C as traits$bodySymbol,w as traits$errorMatchersSymbol,T as traits$formDataFileSymbol,E as traits$getErrorMatchers,D as traits$headerSymbol,O as traits$httpBodySymbol,k as traits$httpSymbol,A as traits$keyDictionarySymbol,j as traits$labelSymbol,M as traits$querySymbol,ke as traits$rawResponseRootSymbol,Ae as traits$rawResponseSymbol,N as traits$responseCodeSymbol,je as traits$sensitiveValueSymbol,P as traits$unionCasesSymbol};
1
+ import{api$D as e,api$call as t,api$named as n,api$op as r,api$opPaginated as i,category$withParseError as a,category$withThrottlingError as o,config$String as s,config$all as c,config$orElse as l,config$withDefault as ee,pagination$paginateCursor as te,retry$capped as ne,retry$jittered as re,retry$makeDefault as u,retry$throttlingFactory as d,retry$throttlingOptions as f,retry$transientFactory as p,retry$transientOptions as ie,schema_lite_typed$Array as ae,schema_lite_typed$Number as oe,schema_lite_typed$String as m,schema_lite_typed$TaggedError as h,schema_lite_typed$Unknown as g,schema_lite_typed$optional as _,trait$Body as se,trait$FormDataFile as ce,trait$Header as le,trait$Http as ue,trait$HttpBody as de,trait$KeyDictionary as fe,trait$Label as v,trait$Query as y,trait$ResponseCode as b,trait$UnionCases as x,trait$applyErrorMatchers as S,trait$bodySymbol as C,trait$errorMatchersSymbol as w,trait$formDataFileSymbol as T,trait$getErrorMatchers as E,trait$headerSymbol as D,trait$httpBodySymbol as O,trait$httpSymbol as k,trait$keyDictionarySymbol as A,trait$labelSymbol as j,trait$querySymbol as M,trait$responseCodeSymbol as N,trait$unionCasesSymbol as P}from"@distilled.cloud/core/_bundle/base";import{error_category$withCategory as F,errors$API_ERRORS as I,errors$BadGateway as L,errors$BadRequest as R,errors$ConfigError as z,errors$Conflict as B,errors$DEFAULT_ERRORS as V,errors$DurationSchema as pe,errors$Forbidden as me,errors$GatewayTimeout as H,errors$HTTP_STATUS_MAP as he,errors$InternalServerError as U,errors$NotFound as ge,errors$RETRYABLE as _e,errors$ServiceUnavailable as W,errors$TooManyRequests as ve,errors$Unauthorized as G,errors$UnprocessableEntity as ye,protocol_http$buildRequest as be,protocol_http$getAnn as xe,protocol_http$getProps as Se,protocol_http$hasPropAnn as Ce,protocol_http$mapKeys as we,protocol_http$matchTypedError as Te,protocol_rest$RawResponse as Ee,protocol_rest$RawResponseRoot as De,protocol_rest$SensitiveValue as Oe,protocol_rest$declaredStatusClass as ke,protocol_rest$rawResponseRootSymbol as Ae,protocol_rest$rawResponseSymbol as je,protocol_rest$sensitiveValueSymbol as Me,protocol_rest$unwrapRedactedDeep as Ne,protocol_rest$validateSuccess as Pe,retry_after$parseRetryAfterForStatus as K,retry_after$parseServerRetryHint as Fe,schema_lite$Array as Ie,schema_lite$Boolean as Le,schema_lite$NullOr as Re,schema_lite$Number as ze,schema_lite$Record as Be,schema_lite$String as Ve,schema_lite$Struct as He,schema_lite$Unknown as Ue,schema_lite$at as We,schema_lite$optional as Ge,schema_lite$suspend as Ke}from"@distilled.cloud/core/_bundle/rest";import*as q from"effect/Context";import*as J from"effect/Effect";import*as Y from"effect/Layer";import*as X from"effect/Redacted";const Z=`https://slack.com/api`;var Credentials=class extends (/*@__PURE__*/ q.Service()(`SlackCredentials`)){};const qe=/*@__PURE__*/ c({token:/*@__PURE__*/ s(`SLACK_BOT_TOKEN`).pipe(/*@__PURE__*/ l(()=>s(`SLACK_TOKEN`))),apiBaseUrl:/*@__PURE__*/ s(`SLACK_API_URL`).pipe(/*@__PURE__*/ ee(Z))});const Je=/*@__PURE__*/ Y.effect(Credentials,/*@__PURE__*/ J.map(/*@__PURE__*/ qe.pipe(/*@__PURE__*/ J.mapError(()=>new z({message:`SLACK_BOT_TOKEN (or SLACK_TOKEN) environment variable is required`})),/*@__PURE__*/ J.map(({token:e,apiBaseUrl:t})=>({token:X.make(e),apiBaseUrl:t}))),e=>J.succeed(e)));const credentials=e=>Y.succeed(Credentials,J.succeed({token:e.token,apiBaseUrl:e.apiBaseUrl??`https://slack.com/api`}));var SlackError=class extends (/*@__PURE__*/ h()(`SlackError`,{code:m,message:/*@__PURE__*/ _(m),needed:/*@__PURE__*/ _(m),provided:/*@__PURE__*/ _(m),messages:/*@__PURE__*/ _(/*@__PURE__*/ ae(m))})){};var SlackRateLimited=class extends (/*@__PURE__*/ h()(`SlackRateLimited`,{code:m,message:/*@__PURE__*/ _(m),retryAfter:/*@__PURE__*/ _(pe)}).pipe(/*@__PURE__*/ F(_e),o)){};var SlackHttpError=class extends (/*@__PURE__*/ h()(`SlackHttpError`,{status:oe,message:m,body:/*@__PURE__*/ _(m)})){};var SlackParseError=class extends (/*@__PURE__*/ h()(`SlackParseError`,{body:g,cause:g}).pipe(a)){};const Ye=[...I,SlackError,SlackRateLimited];const slackPaginate=(e,t,n)=>te(e,t,n);const declaredError=(e,t,n)=>{const r=t;const i=e.find(e=>e===r);return i===void 0?void 0:new i(n)};const Xe=/*@__PURE__*/ new Set([`not_authed`,`invalid_auth`,`account_inactive`,`token_revoked`,`token_expired`]);const Q={internal_error:(e,t)=>new U({message:t}),fatal_error:(e,t)=>new U({message:t}),service_unavailable:(e,t)=>declaredError(e,W,{message:t}),request_timeout:(e,t)=>declaredError(e,H,{message:t})};const serializeForWire=(e,t)=>{if(e===null||typeof e!==`object`||Array.isArray(e))return e;const n=xe(t,k)?.contentType===`form-urlencoded`;const r=Se(t);if(r.length===0)return e;let i;for(const t of r){const r=String(t.name);const a=e[r];if(a===null||typeof a!==`object`)continue;const o=Ce(t,M);if(Array.isArray(a)&&(o||n)){i??={...e};i[r]=a.every(e=>typeof e!==`object`||e===null)?a.join(`,`):JSON.stringify(a)}else if(n&&!o){i??={...e};i[r]=JSON.stringify(a)}}return i??e};const encode=({input:e,inputAst:t})=>J.gen(function*(){const n=yield*yield*Credentials;const r=X.value(n.token);return yield*be({input:serializeForWire(Ne(e),t),inputAst:t,baseUrl:n.apiBaseUrl,headers:r===``?{}:{authorization:`Bearer ${r}`}})});const decode=({response:e,outputAst:t,errors:n})=>J.gen(function*(){const r=new Uint8Array(yield*e.arrayBuffer);const i=new TextDecoder().decode(r);let a;let o=false;if(i.trim().length>0)try{const e=JSON.parse(i);if(e!==null&&typeof e===`object`)a=e}catch{o=true}const s=e.status;const c=e.headers;if(s>=400||a?.ok===false){const e=typeof a?.error===`string`?a.error:void 0;const t=[...(a?.response_metadata)?.messages??[],...Array.isArray(a?.errors)?a.errors:[]].filter(e=>typeof e===`string`);const r=t[0]??e??(a===void 0&&i.trim()?i.trim():`HTTP ${s}`);const o=Te(n,s,[{message:r}],{body:a===void 0?i:a,headers:c});if(o!==void 0)return yield*J.fail(o);if(s===429||e===`rate_limited`||e===`ratelimited`){const t=declaredError(n,SlackRateLimited,{code:e??`rate_limited`,message:r,retryAfter:Fe(c)});if(t!==void 0)return yield*J.fail(t)}if(e!==void 0&&Xe.has(e)){const t=declaredError(n,G,{message:e});if(t!==void 0)return yield*J.fail(t)}if(e!==void 0&&e in Q){const t=Q[e](n,r);if(t!==void 0)return yield*J.fail(t)}if(e!==void 0){const i=declaredError(n,SlackError,{code:e,...r!==e?{message:r}:{},...typeof a?.needed===`string`?{needed:a.needed}:{},...typeof a?.provided===`string`?{provided:a.provided}:{},...t.length>0?{messages:t}:{}});if(i!==void 0)return yield*J.fail(i)}const l=ke(s,n);if(l)return yield*J.fail(new l({message:r,retryAfter:K(s,c)}));if(s>=500)return yield*J.fail(new U({message:r,retryAfter:K(s,c)}));return yield*J.fail(new SlackHttpError({status:s,message:r,body:i.slice(0,2e3)}))}return yield*Pe(t,a===void 0?{value:r,body:i,nonJson:o}:{value:we(t,a,`decode`),body:a,nonJson:o},e=>new SlackParseError(e))});const Ze={encode,decode};const $=Ze;var Retry=class extends (/*@__PURE__*/ q.Service()(`SlackRetry`)){};const policy=e=>J.provide(Y.succeed(Retry,e));const Qe=/*@__PURE__*/ J.provide(/*@__PURE__*/ Y.succeed(Retry,{while:()=>false}));const $e=u;const et=re;const tt=ne;const nt=f;const rt=/*@__PURE__*/ policy(d);const it=ie;const at=/*@__PURE__*/ policy(p);export{We as Ad,Ge as Fd,Ke as Gd,e as a,t as b,Credentials as credentials$Credentials,Je as credentials$CredentialsFromEnv,Z as credentials$DEFAULT_API_BASE_URL,credentials as credentials$credentials,I as errors$API_ERRORS,L as errors$BadGateway,R as errors$BadRequest,z as errors$ConfigError,B as errors$Conflict,V as errors$DEFAULT_ERRORS,me as errors$Forbidden,H as errors$GatewayTimeout,he as errors$HTTP_STATUS_MAP,U as errors$InternalServerError,ge as errors$NotFound,W as errors$ServiceUnavailable,SlackError as errors$SlackError,SlackHttpError as errors$SlackHttpError,SlackParseError as errors$SlackParseError,SlackRateLimited as errors$SlackRateLimited,Ye as errors$SlackServiceErrors,ve as errors$TooManyRequests,G as errors$Unauthorized,ye as errors$UnprocessableEntity,Ie as fd,Le as gd,n as l,r as n,i as o,Re as od,slackPaginate as pagination$slackPaginate,ze as pd,$ as protocol$SlackProtocol,Be as qd,Retry as retry$Retry,tt as retry$capped,et as retry$jittered,$e as retry$makeDefault,Qe as retry$none,policy as retry$policy,rt as retry$throttling,nt as retry$throttlingOptions,at as retry$transient,it as retry$transientOptions,Ve as sd,He as td,se as traits$Body,ce as traits$FormDataFile,le as traits$Header,ue as traits$Http,de as traits$HttpBody,fe as traits$KeyDictionary,v as traits$Label,y as traits$Query,Ee as traits$RawResponse,De as traits$RawResponseRoot,b as traits$ResponseCode,Oe as traits$SensitiveValue,x as traits$UnionCases,S as traits$applyErrorMatchers,C as traits$bodySymbol,w as traits$errorMatchersSymbol,T as traits$formDataFileSymbol,E as traits$getErrorMatchers,D as traits$headerSymbol,O as traits$httpBodySymbol,k as traits$httpSymbol,A as traits$keyDictionarySymbol,j as traits$labelSymbol,M as traits$querySymbol,Ae as traits$rawResponseRootSymbol,je as traits$rawResponseSymbol,N as traits$responseCodeSymbol,Me as traits$sensitiveValueSymbol,P as traits$unionCasesSymbol,Ue as yd};
2
2
  //# sourceMappingURL=sdk.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"sdk.js","names":["EffectConfig.String","Schema.String","Category.withThrottlingError","Schema.Number","Schema.Unknown","Category.withParseError","Pagination.paginateCursor","API.Protocol","Retries.makeDefault","Retries.jittered","Retries.capped","Retries.throttlingOptions","Retries.throttlingFactory","Retries.transientOptions","Retries.transientFactory","D","Protocol","call","named","op","opPaginated","withParseError","withThrottlingError","String$3","all$1","orElse","withDefault","paginateCursor","capped$1","jittered$1","makeDefault$1","throttlingFactory","throttlingOptions$1","transientFactory","transientOptions$1","Array$2","Number$1","String$2","TaggedError$1","Unknown$1","optional$1","Body","FormDataFile","Header","Http","HttpBody","KeyDictionary","Label","Query","ResponseCode","UnionCases","applyErrorMatchers","bodySymbol","errorMatchersSymbol","formDataFileSymbol","getErrorMatchers","headerSymbol","httpBodySymbol","httpSymbol","keyDictionarySymbol","labelSymbol","querySymbol","responseCodeSymbol","unionCasesSymbol","withCategory","API_ERRORS","BadGateway","BadRequest","ConfigError","Conflict","DEFAULT_ERRORS","DurationSchema","Forbidden","GatewayTimeout","HTTP_STATUS_MAP","InternalServerError","NotFound","RETRYABLE","ServiceUnavailable","TooManyRequests","Unauthorized","UnprocessableEntity","buildRequest","getAnn","getProps","hasPropAnn","mapKeys","matchTypedError","RawResponse","RawResponseRoot","SensitiveValue","rawResponseRootSymbol","rawResponseSymbol","sensitiveValueSymbol","unwrapRedactedDeep","validateSuccess","parseRetryAfterForStatus","parseServerRetryHint","Array$1","Boolean","NullOr","Number","Record","String$1","Struct","Unknown","at","optional","suspend","Context","Effect","Layer","Redacted","DEFAULT_API_BASE_URL","envConfig","CredentialsFromEnv","token","config","operation","input","pagination","AUTH_SLUGS","SERVER_SLUGS","isForm","inputAst","props","out","prop","key","value","isQuery","v","creds","errorClasses","bytes","response","text","json","nonJson","parsed","status","headers","slug","detailMessages","m","message","typed","StatusErrorClass","outputAst","info","SlackProtocol","args","optionsOrFactory","none","makeDefault","jittered","capped","throttlingOptions","throttling","transientOptions","transient"],"sources":["../../src/credentials.ts","../../src/errors.ts","../../src/pagination.ts","../../src/protocol.ts","../../src/retry.ts"],"mappings":"sqFA8BA,MAAaiH,EAAuB,wBAOpC,IAAa,YAAb,eACwB,gBAAQ,QAAyD,CAAC,CACtF,kBACF,EAAA,A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KAAML,EAAK,MAAM,EAAG,GAAI,CAAE,CAAC,CAAC,CACvF,CAcA,OAAO,MAAOzC,GACZqD,EACAX,IAAS,IAAA,GACL,CAAE,MAAOH,EAAO,KAAME,EAAM,SAAQ,EACpC,CAAE,MAAOlD,GAAQ8D,EAAWX,EAAM,QAAQ,EAAG,KAAMA,EAAM,SAAQ,EACpE,GAAS,IAAI,gBAAgBY,CAAI,CACpC,CAAC,CAAC,KAAKvC,EAAO,MAAM,IAAI,CAAC,CAC3B,CAAC,EAEH,MAAawC,GAAyD,gBAAM,QAC1E/I,EACc,gBAAa,GAAG,CAE5B,OAAS,GAAS,OAAOgJ,CAAI,EAC7B,MACF,CAAC,CACH,EC7RA,IAAa,MAAb,eAAyC,gBAAQ,QAAuB,CAAC,CAAC,YAAY,EAAA,AAAE,CAAC,EAGzF,MAAa,OAOR,GAAwCzC,EAAO,QAAQC,EAAM,QAAQ,MAAOyC,CAAgB,CAAC,EAGlG,MAAaC,GAE+C,gBAAO,QACnD,gBAAM,QAAQ,MAAO,CAAE,UAAa,KAAM,CAAC,CAC3D,EAOA,MAAaC,GAAuBlJ,GAEpC,MAAamJ,GAAWlJ,GACxB,MAAamJ,GAASlJ,GAGtB,MAAamJ,GAA6BlJ,GAG1C,MAAamJ,GAE+C,qBAAOlJ,EAAyB,EAG5F,MAAamJ,GAA4BlJ,GAGzC,MAAamJ,GAE+C,qBAAOlJ,EAAwB"}
1
+ {"version":3,"file":"sdk.js","names":["EffectConfig.String","Schema.String","Category.withThrottlingError","Schema.Number","Schema.Unknown","Category.withParseError","Pagination.paginateCursor","Retries.makeDefault","Retries.jittered","Retries.capped","Retries.throttlingOptions","Retries.throttlingFactory","Retries.transientOptions","Retries.transientFactory","D","call","named","op","opPaginated","withParseError","withThrottlingError","String$3","all$1","orElse","withDefault","paginateCursor","capped$1","jittered$1","makeDefault$1","throttlingFactory","throttlingOptions$1","transientFactory","transientOptions$1","Array$2","Number$1","String$2","TaggedError$1","Unknown$1","optional$1","Body","FormDataFile","Header","Http","HttpBody","KeyDictionary","Label","Query","ResponseCode","UnionCases","applyErrorMatchers","bodySymbol","errorMatchersSymbol","formDataFileSymbol","getErrorMatchers","headerSymbol","httpBodySymbol","httpSymbol","keyDictionarySymbol","labelSymbol","querySymbol","responseCodeSymbol","unionCasesSymbol","withCategory","API_ERRORS","BadGateway","BadRequest","ConfigError","Conflict","DEFAULT_ERRORS","DurationSchema","Forbidden","GatewayTimeout","HTTP_STATUS_MAP","InternalServerError","NotFound","RETRYABLE","ServiceUnavailable","TooManyRequests","Unauthorized","UnprocessableEntity","buildRequest","getAnn","getProps","hasPropAnn","mapKeys","matchTypedError","RawResponse","RawResponseRoot","SensitiveValue","declaredStatusClass","rawResponseRootSymbol","rawResponseSymbol","sensitiveValueSymbol","unwrapRedactedDeep","validateSuccess","parseRetryAfterForStatus","parseServerRetryHint","Array$1","Boolean","NullOr","Number","Record","String$1","Struct","Unknown","at","optional","suspend","Context","Effect","Layer","Redacted","DEFAULT_API_BASE_URL","envConfig","CredentialsFromEnv","token","config","SlackServiceErrors","operation","input","pagination","known","cls","Declared","errors","declared","props","AUTH_SLUGS","SERVER_SLUGS","isForm","inputAst","out","prop","key","value","isQuery","v","creds","errorClasses","bytes","response","text","json","nonJson","parsed","status","headers","slug","detailMessages","m","message","typed","throttled","unauthorized","server","slackError","StatusErrorClass","outputAst","info","slackProtocolMethods","SlackProtocol","optionsOrFactory","none","makeDefault","jittered","capped","throttlingOptions","throttling","transientOptions","transient"],"sources":["../../src/credentials.ts","../../src/errors.ts","../../src/pagination.ts","../../src/protocol.ts","../../src/retry.ts"],"mappings":"4rFA8BA,MAAagH,EAAuB,wBAOpC,IAAa,YAAb,eACwB,gBAAQ,QAA4C,CAAC,CAAC,kBAAkB,EAAA,AAAE,CAAC,EAEnG,MAAMC,GAA0B,gBAAiB,CAG/C,MAAqB,gBAAoB,iBAAiB,CAAC,CAAC,KAC5C,oBAA0BjH,EAAoB,aAAa,CAAC,CAC5E,EACA,W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E+C,qBAAO5J,CAAwB"}
@@ -12,10 +12,14 @@ export interface Config {
12
12
  readonly token: Redacted.Redacted<string>;
13
13
  readonly apiBaseUrl: string;
14
14
  }
15
- declare const Credentials_base: Context.ServiceClass<Credentials, "SlackCredentials", Effect.Effect<Config, ConfigError, never>>;
15
+ declare const Credentials_base: Context.ServiceClass<Credentials, "SlackCredentials", Effect.Effect<Config, never, never>>;
16
16
  export declare class Credentials extends /*@__PURE__*/ Credentials_base {
17
17
  }
18
- export declare const CredentialsFromEnv: Layer.Layer<Credentials, never, never>;
18
+ /**
19
+ * Its configuration is read and checked once, when the layer is built: a
20
+ * problem there fails the layer with `ConfigError`.
21
+ */
22
+ export declare const CredentialsFromEnv: Layer.Layer<Credentials, ConfigError, never>;
19
23
  /**
20
24
  * Convenience layer from a redacted token + optional base URL. Pass an empty
21
25
  * token (`""`) for the credential-less OAuth exchange methods.
@@ -1 +1 @@
1
- {"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../src/credentials.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAE5C;;;GAGG;AACH,eAAO,MAAM,oBAAoB,0BAA0B,CAAC;AAE5D,MAAM,WAAW,MAAM;IACrB,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC1C,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;;AAED,qBAAa,WACX,SAAQ,aAAa,CAAC,gBAErB;CAAG;AAaN,eAAO,MAAM,kBAAkB,wCAc9B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,WAAW,WAAY;IAClC,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC1C,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC9B,KAAG,KAAK,CAAC,KAAK,CAAC,WAAW,CAOxB,CAAC"}
1
+ {"version":3,"file":"credentials.d.ts","sources":["../src/credentials.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAE5C;;;GAGG;AACH,eAAO,MAAM,oBAAoB,0BAA0B,CAAC;AAE5D,MAAM,WAAW,MAAM;IACrB,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC1C,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;;AAED,qBAAa,WACX,SAAQ,aAAa,CAAC,gBAAyE;CAAG;AAapG;;;GAGG;AACH,eAAO,MAAM,kBAAkB,8CAiB9B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,WAAW,WAAY;IAClC,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC1C,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC9B,KAAG,KAAK,CAAC,KAAK,CAAC,WAAW,CAOxB,CAAC"}
package/lib/errors.d.ts CHANGED
@@ -80,4 +80,14 @@ export type ClientErrors = SlackError | SlackRateLimited | SlackHttpError | Slac
80
80
  * plus the client-level envelope/decode errors.
81
81
  */
82
82
  export type DefaultErrors = CoreDefaultErrors | ClientErrors;
83
+ /**
84
+ * The errors declared on the Slack service: any operation can return them,
85
+ * and every generated operation lists them as its `serviceErrors`. The
86
+ * envelope's errors ({@link SlackError} for a slug, {@link SlackRateLimited}
87
+ * for throttling), and each of core's status classes: for the
88
+ * infrastructure slugs (`Unauthorized`, `ServiceUnavailable`,
89
+ * `GatewayTimeout`) and for the status of a failure without an envelope.
90
+ */
91
+ export declare const SlackServiceErrors: readonly [typeof import("@distilled.cloud/core/errors").Unauthorized, typeof import("@distilled.cloud/core/errors").Forbidden, typeof import("@distilled.cloud/core/errors").NotFound, typeof import("@distilled.cloud/core/errors").BadRequest, typeof import("@distilled.cloud/core/errors").Conflict, typeof import("@distilled.cloud/core/errors").UnprocessableEntity, typeof import("@distilled.cloud/core/errors").TooManyRequests, typeof import("@distilled.cloud/core/errors").Locked, typeof import("@distilled.cloud/core/errors").InternalServerError, typeof import("@distilled.cloud/core/errors").BadGateway, typeof import("@distilled.cloud/core/errors").ServiceUnavailable, typeof import("@distilled.cloud/core/errors").GatewayTimeout, typeof SlackError, typeof SlackRateLimited];
92
+ export type SlackServiceError = InstanceType<(typeof SlackServiceErrors)[number]>;
83
93
  //# sourceMappingURL=errors.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EACL,UAAU,EACV,UAAU,EACV,QAAQ,EACR,WAAW,EACX,SAAS,EACT,cAAc,EACd,mBAAmB,EACnB,QAAQ,EACR,kBAAkB,EAClB,eAAe,EACf,YAAY,EACZ,mBAAmB,EACnB,eAAe,EACf,cAAc,EACd,UAAU,GACX,MAAM,8BAA8B,CAAC;AAGtC,OAAO,KAAK,EAAE,aAAa,IAAI,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAEvF,OAAO,KAAK,MAAM,MAAM,yCAAyC,CAAC;;;;;;;;AAElE;;;;;;;GAOG;AACH,qBAAa,UACX,SAAQ,aAAa,CAAC,eAMpB;CAAG;;;;;;;;;;;;;;AAEP;;;GAGG;AACH,qBAAa,gBACX,SAAQ,aAAa,CAA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AACH,eAAO,MAAM,kBAAkB,2wBAAyD,CAAC;AACzF,MAAM,MAAM,iBAAiB,GAAG,YAAY,CAAC,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC"}
package/lib/errors.js CHANGED
@@ -1 +1 @@
1
- export { errors$API_ERRORS as API_ERRORS, errors$BadGateway as BadGateway, errors$BadRequest as BadRequest, errors$ConfigError as ConfigError, errors$Conflict as Conflict, errors$DEFAULT_ERRORS as DEFAULT_ERRORS, errors$Forbidden as Forbidden, errors$GatewayTimeout as GatewayTimeout, errors$HTTP_STATUS_MAP as HTTP_STATUS_MAP, errors$InternalServerError as InternalServerError, errors$NotFound as NotFound, errors$ServiceUnavailable as ServiceUnavailable, errors$SlackError as SlackError, errors$SlackHttpError as SlackHttpError, errors$SlackParseError as SlackParseError, errors$SlackRateLimited as SlackRateLimited, errors$TooManyRequests as TooManyRequests, errors$Unauthorized as Unauthorized, errors$UnprocessableEntity as UnprocessableEntity } from "./_bundle/sdk.js";
1
+ export { errors$API_ERRORS as API_ERRORS, errors$BadGateway as BadGateway, errors$BadRequest as BadRequest, errors$ConfigError as ConfigError, errors$Conflict as Conflict, errors$DEFAULT_ERRORS as DEFAULT_ERRORS, errors$Forbidden as Forbidden, errors$GatewayTimeout as GatewayTimeout, errors$HTTP_STATUS_MAP as HTTP_STATUS_MAP, errors$InternalServerError as InternalServerError, errors$NotFound as NotFound, errors$ServiceUnavailable as ServiceUnavailable, errors$SlackError as SlackError, errors$SlackHttpError as SlackHttpError, errors$SlackParseError as SlackParseError, errors$SlackRateLimited as SlackRateLimited, errors$SlackServiceErrors as SlackServiceErrors, errors$TooManyRequests as TooManyRequests, errors$Unauthorized as Unauthorized, errors$UnprocessableEntity as UnprocessableEntity } from "./_bundle/sdk.js";
package/lib/index.d.ts CHANGED
@@ -12,5 +12,4 @@ export * as T from "./traits.ts";
12
12
  export { SlackProtocol, type SlackOpError, type SlackOpContext } from "./protocol.ts";
13
13
  export * as Retry from "./retry.ts";
14
14
  export * as Pagination from "./pagination.ts";
15
- export * from "./services/index.ts";
16
15
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,OAAO,KAAK,CAAC,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,KAAK,YAAY,EAAE,KAAK,cAAc,EAAE,MAAM,eAAe,CAAC;AACtF,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAC;AAC9C,cAAc,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,OAAO,KAAK,CAAC,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,KAAK,YAAY,EAAE,KAAK,cAAc,EAAE,MAAM,eAAe,CAAC;AACtF,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAC"}
package/lib/index.js CHANGED
@@ -4,4 +4,3 @@ export * as T from "./traits.js";
4
4
  export { SlackProtocol } from "./protocol.js";
5
5
  export * as Retry from "./retry.js";
6
6
  export * as Pagination from "./pagination.js";
7
- export * from "./services/index.js";
@@ -1 +1 @@
1
- {"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["../src/pagination.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,OAAO,KAAK,UAAU,MAAM,kCAAkC,CAAC;AAE/D;;;GAGG;AACH,eAAO,MAAM,aAAa,EAAE,UAAU,CAAC,kBACkB,CAAC"}
1
+ {"version":3,"file":"pagination.d.ts","sources":["../src/pagination.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,OAAO,KAAK,UAAU,MAAM,kCAAkC,CAAC;AAE/D;;;GAGG;AACH,eAAO,MAAM,aAAa,EAAE,UAAU,CAAC,kBACkB,CAAC"}
package/lib/protocol.d.ts CHANGED
@@ -1,19 +1,54 @@
1
- import * as API from "@distilled.cloud/core/api";
2
- import { ConfigError, type InvalidInput } from "@distilled.cloud/core/errors";
3
- import type { SdkError } from "@distilled.cloud/core/sdk-error";
1
+ import { InternalServerError } from "@distilled.cloud/core/errors";
2
+ import type { DeclaredError, DecodeArgs, EncodeArgs, ErrorOf, ProtocolOf } from "@distilled.cloud/core/protocol";
3
+ /**
4
+ * SlackProtocol -- hand-written.
5
+ *
6
+ * Speaks the Slack Web API convention. The generic request/response machinery
7
+ * (trait-driven request building, recursive wire-name mapping, typed-error
8
+ * matcher evaluation) lives in `@distilled.cloud/core/protocol-http`; this
9
+ * module supplies what is Slack's own:
10
+ *
11
+ * request: credentials -> `Authorization: Bearer <token>` (omitted for an
12
+ * empty token -- the OAuth exchange methods authenticate with
13
+ * `client_id`/`client_secret` args instead), and array-valued
14
+ * query args joined with commas (`channel_ids=C1,C2` -- Slack
15
+ * reads comma-separated lists, not repeated params)
16
+ *
17
+ * response: `{ "ok": true, ...payload }` -- the payload shares the envelope's
18
+ * level, so a successful body maps onto the output schema
19
+ * directly (`ok` is a modeled member).
20
+ * `{ "ok": false, "error": "<slug>" }` -- usually WITH HTTP 200 --
21
+ * becomes a typed error: per-op matcher classes first, then the
22
+ * infrastructure slugs (auth -> Unauthorized, throttling ->
23
+ * SlackRateLimited, server hiccups -> retryable 5xx classes),
24
+ * then {@link SlackError} carrying the slug. Those classes
25
+ * and core's status classes are the service's errors
26
+ * (`SlackServiceErrors`): the protocol builds one only from the
27
+ * classes the operation lists.
28
+ * A successful NON-JSON body is returned as raw bytes -- the one
29
+ * method that answers this way (`admin.analytics.getFile`) sends
30
+ * a gzipped NDJSON file.
31
+ */
32
+ import * as Effect from "effect/Effect";
4
33
  import type * as HttpClient from "effect/http/HttpClient";
5
- import type * as HttpClientError from "effect/http/HttpClientError";
6
- import * as Layer from "effect/Layer";
7
34
  import { Credentials } from "./credentials.ts";
8
- import { type DefaultErrors } from "./errors.ts";
35
+ import { SlackHttpError, SlackParseError, type SlackServiceError } from "./errors.ts";
9
36
  /**
10
- * Error channel shared by every generated Slack operation. Generated service
11
- * files annotate operations with `API.OperationMethod<I, O, SlackOpError,
12
- * SlackOpContext>` explicitly so the compiler never infers these back out of
13
- * the schema generics.
37
+ * What every generated Slack operation fails with besides its own errors:
38
+ * the service's errors, the protocol's, and what resolving the credentials
39
+ * fails with. Generated service files annotate operations with
40
+ * `API.OperationMethod<I, O, SlackOpError, SlackOpContext>` explicitly so
41
+ * the compiler never infers these back out of the schema generics.
14
42
  */
15
- export type SlackOpError = DefaultErrors | ConfigError | HttpClientError.HttpClientError | InvalidInput | SdkError;
43
+ export type SlackOpError = SlackServiceError | ErrorOf<typeof SlackProtocol>;
16
44
  /** Context (requirements) shared by every generated Slack operation. */
17
45
  export type SlackOpContext = Credentials | HttpClient.HttpClient;
18
- export declare const SlackProtocol: Layer.Layer<API.Protocol>;
46
+ declare const encode: ({ input, inputAst }: EncodeArgs) => Effect.Effect<import("effect/http/HttpClientRequest").HttpClientRequest, import("@distilled.cloud/core/protocol-http").InvalidInput | import("@distilled.cloud/core/sdk-error").SdkError, Credentials>;
47
+ declare const decode: ({ response, outputAst, errors: errorClasses }: DecodeArgs) => Effect.Effect<unknown, DeclaredError | import("effect/http/HttpClientError").HttpClientError | InternalServerError | SlackHttpError | SlackParseError, never>;
48
+ declare const slackProtocolMethods: {
49
+ encode: typeof encode;
50
+ decode: typeof decode;
51
+ };
52
+ export declare const SlackProtocol: ProtocolOf<typeof slackProtocolMethods>;
53
+ export {};
19
54
  //# sourceMappingURL=protocol.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"protocol.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AAM,aAAa,CAAC;AAErB;;;;;;GAMG;AACH,MAAM,MAAM,YAAY,GAAG,iBAAiB,GAAG,OAAO,CAAC,OAAO,aAAa,CAAC,CAAC;AAE7E,wEAAwE;AACxE,MAAM,MAAM,cAAc,GAAG,WAAW,GAAG,UAAU,CAAC,UAAU,CAAC;AA4FjE,QAAA,MAAM,MAAM,wBAAyB,UAAU,2MAa3C,CAAC;AAEL,QAAA,MAAM,MAAM,kDAAmD,UAAU,kKA8HrE,CAAC;AAEL,QAAA,MAAM,oBAAoB;;;CAGY,CAAC;AAEvC,eAAO,MAAM,aAAa,EAAE,UAAU,CAAC,OAAO,oBAAoB,CAAwB,CAAC"}
package/lib/retry.d.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 honors with precedence over
10
- * its own backoff.
9
+ * `Retry-After` header, which the default policy waits at least.
11
10
  *
12
11
  * @example
13
12
  * ```ts
@@ -1 +1 @@
1
- {"version":3,"file":"retry.d.ts","sourceRoot":"","sources":["../src/retry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,6BAA6B,CAAC;AACvD;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAGxC,MAAM,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;AACtC,MAAM,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;AACtC,MAAM,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;;AAEpC,qEAAqE;AACrE,qBAAa,KAAM,SAAQ,aAAa,CAAC,UAA8C;CAAG;AAE1F,uEAAuE;AACvE,eAAO,MAAM,MAAM,EAAE;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