@distilled.cloud/discord 1.0.0-rc.16 → 1.0.0-rc.17

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/lib/.lazy.json ADDED
@@ -0,0 +1 @@
1
+ {"serviceDirs":["services"],"twins":["index.js"]}
@@ -0,0 +1,4 @@
1
+ import*as $0 from"./sdk.js";
2
+ import{api$lazyService as L}from"@distilled.cloud/core/_bundle/base";
3
+ const u=import.meta.url,N=[$0];
4
+ export const $L=(s,k,a,l,x)=>L(u,s,k,a===void 0?void 0:x?N.concat(x):N,a,l);
@@ -0,0 +1,2 @@
1
+ import{api$D as e,api$call as t,api$error as n,api$named as ee,api$newError as te,api$op as ne,category$withBadRequestError as r,category$withParseError as i,category$withServerError as re,config$Redacted as a,config$String as o,config$all as ie,config$orElse as ae,config$withDefault as s,retry$capped as c,retry$jittered as l,retry$makeDefault as u,retry$throttlingFactory as d,retry$throttlingOptions as f,retry$transientFactory as p,retry$transientOptions as m,trait$Body as h,trait$FormDataFile as g,trait$Header as _,trait$Http as v,trait$HttpBody as y,trait$KeyDictionary as b,trait$Label as x,trait$Query as S,trait$ResponseCode as C,trait$UnionCases as w,trait$applyErrorMatchers as T,trait$bodySymbol as E,trait$errorMatchersSymbol as D,trait$formDataFileSymbol as O,trait$getErrorMatchers as k,trait$headerSymbol as A,trait$httpBodySymbol as j,trait$httpSymbol as M,trait$keyDictionarySymbol as N,trait$labelSymbol as P,trait$querySymbol as F,trait$responseCodeSymbol as I,trait$unionCasesSymbol as L}from"@distilled.cloud/core/_bundle/base";import{errors$API_ERRORS as R,errors$BadGateway as z,errors$BadRequest as B,errors$ConfigError as V,errors$Conflict as H,errors$DEFAULT_ERRORS as U,errors$Forbidden as W,errors$GatewayTimeout as G,errors$HTTP_STATUS_MAP as K,errors$InternalServerError as q,errors$Locked as J,errors$NotFound as oe,errors$ServiceUnavailable as se,errors$TooManyRequests as ce,errors$Unauthorized as le,errors$UnprocessableEntity as ue,protocol_rest$RawResponse as de,protocol_rest$RawResponseRoot as fe,protocol_rest$SensitiveValue as pe,protocol_rest$makeRestProtocol as me,protocol_rest$rawResponseRootSymbol as he,protocol_rest$rawResponseSymbol as ge,protocol_rest$sensitiveValueSymbol as _e,schema_lite$Array as ve,schema_lite$Boolean as ye,schema_lite$NullOr as be,schema_lite$Number as xe,schema_lite$Record as Se,schema_lite$String as Ce,schema_lite$Struct as we,schema_lite$TaggedError as Te,schema_lite$Unknown as Ee,schema_lite$at as De,schema_lite$optional as Oe,schema_lite$suspend as ke}from"@distilled.cloud/core/_bundle/rest";import*as Y from"effect/Context";import*as X from"effect/Effect";import*as Z from"effect/Layer";import*as Ae from"effect/Redacted";import*as Q from"@distilled.cloud/core/schema-lite-typed";const $=`https://discord.com/api/v10`;var Credentials=class extends (/*@__PURE__*/ Y.Service()(`DiscordCredentials`)){};const je=/*@__PURE__*/ ie({token:/*@__PURE__*/ a(`DISCORD_BOT_TOKEN`).pipe(/*@__PURE__*/ ae(()=>a(`DISCORD_TOKEN`))),tokenType:/*@__PURE__*/ o(`DISCORD_TOKEN_TYPE`).pipe(/*@__PURE__*/ s(`Bot`)),apiBaseUrl:/*@__PURE__*/ o(`DISCORD_API_URL`).pipe(/*@__PURE__*/ s($))});const Me=/*@__PURE__*/ Z.succeed(Credentials,/*@__PURE__*/ je.pipe(/*@__PURE__*/ X.mapError(()=>new V({message:`DISCORD_BOT_TOKEN (or DISCORD_TOKEN) environment variable is required`})),/*@__PURE__*/ X.map(({token:e,tokenType:t,apiBaseUrl:n})=>({token:e,tokenType:t.toLowerCase()===`bearer`?`Bearer`:`Bot`,apiBaseUrl:n})),X.orDie));const credentials=e=>Z.succeed(Credentials,X.succeed({token:e.token,tokenType:e.tokenType??`Bot`,apiBaseUrl:e.apiBaseUrl??`https://discord.com/api/v10`}));var UnknownDiscordError=class extends (/*@__PURE__*/ Q.TaggedError()(`UnknownDiscordError`,{code:/*@__PURE__*/ Q.optional(Q.Number),message:/*@__PURE__*/ Q.optional(Q.String),errors:/*@__PURE__*/ Q.optional(Q.Unknown),body:Q.Unknown}).pipe(re)){};var DiscordParseError=class extends (/*@__PURE__*/ Q.TaggedError()(`DiscordParseError`,{body:Q.Unknown,cause:Q.Unknown}).pipe(i)){};const errorEnvelope=e=>{if(e===null||typeof e!==`object`)return void 0;const t=e;const n=typeof t.message===`string`?t.message:typeof t.error_description===`string`?t.error_description:typeof t.error===`string`?t.error:void 0;return{code:typeof t.code===`number`||typeof t.code===`string`?t.code:void 0,message:n}};const errorDetails=e=>{if(e===null||typeof e!==`object`)return void 0;return e.errors};const numericCode=e=>{if(typeof e===`number`)return Number.isFinite(e)?e:void 0;if(typeof e!==`string`||e.trim()===``)return void 0;const t=Number(e);return Number.isFinite(t)?t:void 0};const Ne=/*@__PURE__*/ me({credentials:/*@__PURE__*/ X.flatMap(Credentials,e=>e),baseUrl:e=>e.apiBaseUrl,headers:e=>({Authorization:`${e.tokenType} ${Ae.value(e.token)}`}),errorEnvelope,unknownError:({code:e,message:t,body:n})=>new UnknownDiscordError({code:numericCode(e),message:t,errors:errorDetails(n),body:n}),parseError:({body:e,cause:t})=>new DiscordParseError({body:e,cause:t})});var Retry=class extends (/*@__PURE__*/ Y.Service()(`DiscordRetry`)){};const policy=e=>X.provide(Z.succeed(Retry,e));const Pe=/*@__PURE__*/ X.provide(/*@__PURE__*/ Z.succeed(Retry,{while:()=>false}));const Fe=u;const Ie=l;const Le=c;const Re=f;const ze=/*@__PURE__*/ policy(d);const Be=m;const Ve=/*@__PURE__*/ policy(p);export{te as _,Se as a,Te as c,Credentials as credentials$Credentials,Me as credentials$CredentialsFromEnv,$ as credentials$DEFAULT_API_BASE_URL,credentials as credentials$credentials,Oe as d,R as errors$API_ERRORS,z as errors$BadGateway,B as errors$BadRequest,V as errors$ConfigError,H as errors$Conflict,U as errors$DEFAULT_ERRORS,DiscordParseError as errors$DiscordParseError,W as errors$Forbidden,G as errors$GatewayTimeout,K as errors$HTTP_STATUS_MAP,q as errors$InternalServerError,J as errors$Locked,oe as errors$NotFound,se as errors$ServiceUnavailable,ce as errors$TooManyRequests,le as errors$Unauthorized,UnknownDiscordError as errors$UnknownDiscordError,ue as errors$UnprocessableEntity,ke as f,ee as g,n as h,xe as i,Ee as l,t as m,ye as n,Ce as o,e as p,Ne as protocol$DiscordProtocol,be as r,Retry as retry$Retry,Le as retry$capped,Ie as retry$jittered,Fe as retry$makeDefault,Pe as retry$none,policy as retry$policy,ze as retry$throttling,Re as retry$throttlingOptions,Ve as retry$transient,Be as retry$transientOptions,we as s,ve as t,h as traits$Body,g as traits$FormDataFile,_ as traits$Header,v as traits$Http,y as traits$HttpBody,b as traits$KeyDictionary,x as traits$Label,S as traits$Query,de as traits$RawResponse,fe as traits$RawResponseRoot,C as traits$ResponseCode,pe as traits$SensitiveValue,w as traits$UnionCases,T as traits$applyErrorMatchers,E as traits$bodySymbol,D as traits$errorMatchersSymbol,O as traits$formDataFileSymbol,k as traits$getErrorMatchers,A as traits$headerSymbol,j as traits$httpBodySymbol,M as traits$httpSymbol,N as traits$keyDictionarySymbol,P as traits$labelSymbol,F as traits$querySymbol,he as traits$rawResponseRootSymbol,ge as traits$rawResponseSymbol,I as traits$responseCodeSymbol,_e as traits$sensitiveValueSymbol,L as traits$unionCasesSymbol,De as u,ne as v,r as y};
2
+ //# sourceMappingURL=sdk.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sdk.js","names":["EffectConfig.Redacted","Category.withServerError","Category.withParseError","Retries.makeDefault","Retries.jittered","Retries.capped","Retries.throttlingOptions","Retries.throttlingFactory","Retries.transientOptions","Retries.transientFactory","D","call","error","named","newError","op","withBadRequestError","withParseError","withServerError","Redacted$2","String$1","all$1","orElse","withDefault","capped$1","jittered$1","makeDefault$1","throttlingFactory","throttlingOptions$1","transientFactory","transientOptions$1","Body","FormDataFile","Header","Http","HttpBody","KeyDictionary","Label","Query","ResponseCode","UnionCases","applyErrorMatchers","bodySymbol","errorMatchersSymbol","formDataFileSymbol","getErrorMatchers","headerSymbol","httpBodySymbol","httpSymbol","keyDictionarySymbol","labelSymbol","querySymbol","responseCodeSymbol","unionCasesSymbol","API_ERRORS","BadGateway","BadRequest","ConfigError","Conflict","DEFAULT_ERRORS","Forbidden","GatewayTimeout","HTTP_STATUS_MAP","InternalServerError","Locked","NotFound","ServiceUnavailable","TooManyRequests","Unauthorized","UnprocessableEntity","RawResponse","RawResponseRoot","SensitiveValue","makeRestProtocol","rawResponseRootSymbol","rawResponseSymbol","sensitiveValueSymbol","Array","Boolean","NullOr","Number$1","Record","String","Struct","TaggedError","Unknown","at","optional","suspend","Context","Effect","Layer","Redacted","Schema","DEFAULT_API_BASE_URL","envConfig","CredentialsFromEnv","tokenType","config","body","b","message","code","n","DiscordProtocol","resolve","creds","optionsOrFactory","none","makeDefault","jittered","capped","throttlingOptions","throttling","transientOptions","transient"],"sources":["../../src/credentials.ts","../../src/errors.ts","../../src/protocol.ts","../../src/retry.ts"],"mappings":"2tEA0BA,MAAa8F,EAAuB,8BAWpC,IAAa,YAAb,eACwB,gBAAQ,QAA4C,CAAC,CACzE,oBACF,EAAA,AAAE,CAAC,EAEL,MAAMC,GAA0B,iBAAiB,CAG/C,MAAqB,gBAAsB,mBAAmB,CAAC,CAAC,KAChD,qBAA0B/F,EAAsB,eAAe,CAAC,CAChF,EACA,UAAyB,gBAAoB,oBAAoB,CAAC,CAAC,KACnD,gBAAyB,KAAK,CAC9C,EACA,WAA0B,gBAAoB,iBAAiB,CAAC,CAAC,KACjD,gBAAyB8F,CAAoB,CAC7D,CACF,CAAC,EAED,MAAaE,GAAmC,gBAAM,QACpD,YACc,iBAAU,KACR,gBAAO,aAEjB,IAAIvC,EAAY,CACd,QAAS,uEACX,CAAC,CACL,EACc,gBAAO,KAAK,CAAE,QAAO,YAAW,iBAAkB,CAC9D,QAGA,UAAYwC,EAAU,YAAY,IAAM,SAAW,SAAW,MAC9D,YACF,EAAE,EACFP,EAAO,KACT,CACF,EAGA,MAAa,YAAe,GAK1BC,EAAM,QACJ,YACAD,EAAO,QAAQ,CACb,MAAOQ,EAAO,MACd,UAAWA,EAAO,WAAa,MAC/B,WAAYA,EAAO,YAAA,6BACrB,CAAC,CACH,ECrDF,IAAa,oBAAb,eACwB,gBAAO,YAAiC,CAAC,CAAC,sBAAuB,CACrF,KAAoB,gBAAO,SAASL,EAAO,MAAM,EACjD,QAAuB,gBAAO,SAASA,EAAO,MAAM,EACpD,OAAsB,gBAAO,SAASA,EAAO,OAAO,EACpD,KAAMA,EAAO,OACf,CAAC,CAAC,CAAC,KAAK5F,EAAwB,EAAA,AAAE,CAAC,EAGrC,IAAa,kBAAb,eACwB,gBAAO,YAA+B,CAAC,CAAC,oBAAqB,CACjF,KAAM4F,EAAO,QACb,MAAOA,EAAO,OAChB,CAAC,CAAC,CAAC,KAAK3F,CAAuB,EAAA,AAAE,CAAC,ECRpC,MAAM,cAAiB,GAAiD,CACtE,GAAIiG,IAAS,MAAQ,OAAOA,IAAS,SAAU,OAAO,IAAA,GACtD,MAAMC,EAAID,EACV,MAAME,EACJ,OAAOD,EAAE,UAAY,SACjBA,EAAE,QACF,OAAOA,EAAE,oBAAsB,SAC7BA,EAAE,kBACF,OAAOA,EAAE,QAAU,SACjBA,EAAE,MACF,IAAA,GAEV,MAAO,CAAE,KADI,OAAOA,EAAE,OAAS,UAAY,OAAOA,EAAE,OAAS,SAAWA,EAAE,KAAO,IAAA,GAClE,SAAQ,CACzB,EAGA,MAAM,aAAgB,GAA2B,CAC/C,GAAID,IAAS,MAAQ,OAAOA,IAAS,SAAU,OAAO,IAAA,GACtD,OAAQA,EAAiC,MAC3C,EAQA,MAAM,YAAe,GAA0D,CAC7E,GAAI,OAAOG,IAAS,SAAU,OAAO,OAAO,SAASA,CAAI,EAAIA,EAAO,IAAA,GACpE,GAAI,OAAOA,IAAS,UAAYA,EAAK,KAAK,IAAM,GAAI,OAAO,IAAA,GAC3D,MAAMC,EAAI,OAAOD,CAAI,EACrB,OAAO,OAAO,SAASC,CAAC,EAAIA,EAAI,IAAA,EAClC,EAEA,MAAaC,GAA2D,iBAAyB,CAI/F,YAA2B,gBAAO,QAAQ,YAAc,GAAYC,CAAO,EAC3E,QAAU,GAAUC,EAAM,WAC1B,QAAU,IAAW,CACnB,cAAe,GAAGA,EAAM,UAAU,GAAGd,GAAS,MAAMc,EAAM,KAAK,GACjE,GACA,cACA,cAAe,CAAE,OAAM,UAAS,UAC9B,IAAI,oBAAoB,CACtB,KAAM,YAAYJ,CAAI,EACtB,UACA,OAAQ,aAAaH,CAAI,EACzB,MACF,CAAC,EACH,YAAa,CAAE,OAAM,WAAY,IAAI,kBAAkB,CAAE,OAAM,OAAM,CAAC,CACxE,CAAC,EClED,IAAa,MAAb,eAAyC,gBAAQ,QAAuB,CAAC,CAAC,cAAc,EAAA,AAAE,CAAC,EAG3F,MAAa,OAOR,GAAwCT,EAAO,QAAQC,EAAM,QAAQ,MAAOgB,CAAgB,CAAC,EAGlG,MAAaC,GAE+C,gBAAO,QACnD,gBAAM,QAAQ,MAAO,CAAE,UAAa,KAAM,CAAC,CAC3D,EAOA,MAAaC,GAAuB1G,EAEpC,MAAa2G,GAAW1G,EACxB,MAAa2G,GAAS1G,EAGtB,MAAa2G,GAA6B1G,EAG1C,MAAa2G,GAE+C,qBAAO1G,CAAyB,EAG5F,MAAa2G,GAA4B1G,EAGzC,MAAa2G,GAE+C,qBAAO1G,CAAwB"}
@@ -1,57 +1 @@
1
-
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
-
13
-
14
-
15
- import * as EffectConfig from "@distilled.cloud/core/config";
16
- import { ConfigError } from "@distilled.cloud/core/errors";
17
- import * as Context from "effect/Context";
18
- import * as Effect from "effect/Effect";
19
- import * as Layer from "effect/Layer";
20
- import * as Redacted from "effect/Redacted";
21
-
22
-
23
-
24
-
25
-
26
- export const DEFAULT_API_BASE_URL = "https://discord.com/api/v10";
27
- export class Credentials extends /*@__PURE__*/ /*@__PURE__*/ Context.Service()("DiscordCredentials") {
28
- }
29
- const envConfig = /*@__PURE__*/ EffectConfig.all({
30
- // DISCORD_BOT_TOKEN is the spelling discord.js and most hosting platforms
31
- // use; DISCORD_TOKEN is the fallback.
32
- token: /*@__PURE__*/ EffectConfig.Redacted("DISCORD_BOT_TOKEN").pipe(
33
- /*@__PURE__*/ EffectConfig.orElse(() => EffectConfig.Redacted("DISCORD_TOKEN"))),
34
- tokenType: /*@__PURE__*/ EffectConfig.String("DISCORD_TOKEN_TYPE").pipe(
35
- /*@__PURE__*/ EffectConfig.withDefault("Bot")),
36
- apiBaseUrl: /*@__PURE__*/ EffectConfig.String("DISCORD_API_URL").pipe(
37
- /*@__PURE__*/ EffectConfig.withDefault(DEFAULT_API_BASE_URL)),
38
- });
39
- export const CredentialsFromEnv = /*@__PURE__*/ Layer.succeed(Credentials,
40
- /*@__PURE__*/ envConfig.pipe(
41
- /*@__PURE__*/ Effect.mapError(() => new ConfigError({
42
- message: "DISCORD_BOT_TOKEN (or DISCORD_TOKEN) environment variable is required",
43
- })),
44
- /*@__PURE__*/ Effect.map(({ token, tokenType, apiBaseUrl }) => ({
45
- token,
46
- // Anything but an explicit `Bearer` means a bot token -- the OAuth2
47
- // flavor is the opt-in.
48
- tokenType: (tokenType.toLowerCase() === "bearer" ? "Bearer" : "Bot"),
49
- apiBaseUrl,
50
- })), Effect.orDie));
51
-
52
- export const credentials = (config) => Layer.succeed(Credentials, Effect.succeed({
53
- token: config.token,
54
- tokenType: config.tokenType ?? "Bot",
55
- apiBaseUrl: config.apiBaseUrl ?? DEFAULT_API_BASE_URL,
56
- }));
57
- //# sourceMappingURL=credentials.js.map
1
+ export { credentials$Credentials as Credentials, credentials$CredentialsFromEnv as CredentialsFromEnv, credentials$DEFAULT_API_BASE_URL as DEFAULT_API_BASE_URL, credentials$credentials as credentials } from "./_bundle/sdk.js";
package/lib/errors.js CHANGED
@@ -1,31 +1 @@
1
-
2
-
3
-
4
-
5
-
6
-
7
- export { BadGateway, BadRequest, Conflict, ConfigError, Forbidden, GatewayTimeout, InternalServerError, Locked, NotFound, ServiceUnavailable, TooManyRequests, Unauthorized, UnprocessableEntity, HTTP_STATUS_MAP, DEFAULT_ERRORS, API_ERRORS, } from "@distilled.cloud/core/errors";
8
- import * as Category from "@distilled.cloud/core/category";
9
- import * as Schema from "@distilled.cloud/core/schema-lite-typed";
10
-
11
-
12
-
13
-
14
-
15
-
16
-
17
-
18
- export class UnknownDiscordError extends /*@__PURE__*/ /*@__PURE__*/ Schema.TaggedError()("UnknownDiscordError", {
19
- code: /*@__PURE__*/ Schema.optional(Schema.Number),
20
- message: /*@__PURE__*/ Schema.optional(Schema.String),
21
- errors: /*@__PURE__*/ Schema.optional(Schema.Unknown),
22
- body: Schema.Unknown,
23
- }).pipe(Category.withServerError) {
24
- }
25
-
26
- export class DiscordParseError extends /*@__PURE__*/ /*@__PURE__*/ Schema.TaggedError()("DiscordParseError", {
27
- body: Schema.Unknown,
28
- cause: Schema.Unknown,
29
- }).pipe(Category.withParseError) {
30
- }
31
- //# sourceMappingURL=errors.js.map
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$DiscordParseError as DiscordParseError, errors$Forbidden as Forbidden, errors$GatewayTimeout as GatewayTimeout, errors$HTTP_STATUS_MAP as HTTP_STATUS_MAP, errors$InternalServerError as InternalServerError, errors$Locked as Locked, errors$NotFound as NotFound, errors$ServiceUnavailable as ServiceUnavailable, errors$TooManyRequests as TooManyRequests, errors$Unauthorized as Unauthorized, errors$UnknownDiscordError as UnknownDiscordError, errors$UnprocessableEntity as UnprocessableEntity } from "./_bundle/sdk.js";
package/lib/index.js CHANGED
@@ -1,14 +1,6 @@
1
-
2
-
3
-
4
-
5
-
6
-
7
-
8
1
  export * from "./credentials.js";
9
2
  export * from "./errors.js";
10
3
  export * as T from "./traits.js";
11
4
  export { DiscordProtocol } from "./protocol.js";
12
5
  export * as Retry from "./retry.js";
13
6
  export * as Services from "./services/index.js";
14
- //# sourceMappingURL=index.js.map
@@ -0,0 +1,6 @@
1
+ export * from "./credentials.js";
2
+ export * from "./errors.js";
3
+ export * as T from "./traits.js";
4
+ export { DiscordProtocol } from "./protocol.js";
5
+ export * as Retry from "./retry.js";
6
+ export * as Services from "./services.lazy/index.js";
package/lib/protocol.js CHANGED
@@ -1,77 +1 @@
1
- import { makeRestProtocol } from "@distilled.cloud/core/protocol-rest";
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
-
13
-
14
-
15
-
16
- import * as Effect from "effect/Effect";
17
- import * as Redacted from "effect/Redacted";
18
- import { Credentials } from "./credentials.js";
19
- import { UnknownDiscordError, DiscordParseError } from "./errors.js";
20
-
21
-
22
-
23
-
24
-
25
- const errorEnvelope = (body) => {
26
- if (body === null || typeof body !== "object")
27
- return undefined;
28
- const b = body;
29
- const message = typeof b.message === "string"
30
- ? b.message
31
- : typeof b.error_description === "string"
32
- ? b.error_description
33
- : typeof b.error === "string"
34
- ? b.error
35
- : undefined;
36
- const code = typeof b.code === "number" || typeof b.code === "string" ? b.code : undefined;
37
- return { code, message };
38
- };
39
-
40
- const errorDetails = (body) => {
41
- if (body === null || typeof body !== "object")
42
- return undefined;
43
- return body.errors;
44
- };
45
-
46
-
47
-
48
-
49
-
50
-
51
- const numericCode = (code) => {
52
- if (typeof code === "number")
53
- return Number.isFinite(code) ? code : undefined;
54
- if (typeof code !== "string" || code.trim() === "")
55
- return undefined;
56
- const n = Number(code);
57
- return Number.isFinite(n) ? n : undefined;
58
- };
59
- export const DiscordProtocol = /*@__PURE__*/ makeRestProtocol({
60
- // Resolved on the CALLING fiber per request (the layer is memoized per
61
- // process); the Credentials service holds an effect so rotating tokens
62
- // Just Work.
63
- credentials: /*@__PURE__*/ Effect.flatMap(Credentials, (resolve) => resolve),
64
- baseUrl: (creds) => creds.apiBaseUrl,
65
- headers: (creds) => ({
66
- Authorization: `${creds.tokenType} ${Redacted.value(creds.token)}`,
67
- }),
68
- errorEnvelope,
69
- unknownError: ({ code, message, body }) => new UnknownDiscordError({
70
- code: numericCode(code),
71
- message,
72
- errors: errorDetails(body),
73
- body,
74
- }),
75
- parseError: ({ body, cause }) => new DiscordParseError({ body, cause }),
76
- });
77
- //# sourceMappingURL=protocol.js.map
1
+ export { protocol$DiscordProtocol as DiscordProtocol } from "./_bundle/sdk.js";
package/lib/retry.js CHANGED
@@ -1,46 +1 @@
1
- import * as Retries from "@distilled.cloud/core/retry";
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
-
13
-
14
-
15
-
16
-
17
-
18
-
19
- import * as Context from "effect/Context";
20
- import * as Effect from "effect/Effect";
21
- import * as Layer from "effect/Layer";
22
-
23
- export class Retry extends /*@__PURE__*/ /*@__PURE__*/ Context.Service()("DiscordRetry") {
24
- }
25
-
26
- export const policy = (optionsOrFactory) => Effect.provide(Layer.succeed(Retry, optionsOrFactory));
27
-
28
- export const none = /*@__PURE__*/ Effect.provide(
29
- /*@__PURE__*/ Layer.succeed(Retry, { while: () => false }));
30
-
31
-
32
-
33
-
34
-
35
- export const makeDefault = Retries.makeDefault;
36
- export const jittered = Retries.jittered;
37
- export const capped = Retries.capped;
38
-
39
- export const throttlingOptions = Retries.throttlingOptions;
40
-
41
- export const throttling = /*@__PURE__*/ policy(Retries.throttlingFactory);
42
-
43
- export const transientOptions = Retries.transientOptions;
44
-
45
- export const transient = /*@__PURE__*/ policy(Retries.transientFactory);
46
- //# sourceMappingURL=retry.js.map
1
+ export { retry$Retry as Retry, retry$capped as capped, retry$jittered as jittered, retry$makeDefault as makeDefault, retry$none as none, retry$policy as policy, retry$throttling as throttling, retry$throttlingOptions as throttlingOptions, retry$transient as transient, retry$transientOptions as transientOptions } from "./_bundle/sdk.js";