@distilled.cloud/discord 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.
@@ -1,2 +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};
1
+ import{api$D as e,api$call as t,api$error as n,api$named as r,api$newError as ee,api$op as te,category$withBadRequestError as i,category$withParseError as a,category$withServerError as o,config$Redacted as s,config$String as c,config$all as ne,config$orElse as re,config$withDefault as l,retry$capped as ie,retry$jittered as ae,retry$makeDefault as u,retry$throttlingFactory as d,retry$throttlingOptions as f,retry$transientFactory as p,retry$transientOptions as m,schema_lite_typed$Number as h,schema_lite_typed$String as g,schema_lite_typed$TaggedError as _,schema_lite_typed$Unknown as v,schema_lite_typed$optional as y,trait$Body as b,trait$FormDataFile as x,trait$Header as S,trait$Http as C,trait$HttpBody as w,trait$KeyDictionary as T,trait$Label as E,trait$Query as D,trait$ResponseCode as O,trait$UnionCases as k,trait$applyErrorMatchers as A,trait$bodySymbol as j,trait$errorMatchersSymbol as M,trait$formDataFileSymbol as N,trait$getErrorMatchers as P,trait$headerSymbol as F,trait$httpBodySymbol as I,trait$httpSymbol as L,trait$keyDictionarySymbol as R,trait$labelSymbol as z,trait$querySymbol as B,trait$responseCodeSymbol as V,trait$unionCasesSymbol as H}from"@distilled.cloud/core/_bundle/base";import{errors$API_ERRORS as U,errors$BadGateway as W,errors$BadRequest as G,errors$ConfigError as K,errors$Conflict as q,errors$DEFAULT_ERRORS as J,errors$Forbidden as Y,errors$GatewayTimeout as oe,errors$HTTP_STATUS_MAP as se,errors$InternalServerError as ce,errors$Locked as le,errors$NotFound as ue,errors$ServiceUnavailable as de,errors$TooManyRequests as fe,errors$Unauthorized as pe,errors$UnprocessableEntity as me,protocol_rest$RawResponse as he,protocol_rest$RawResponseRoot as ge,protocol_rest$SensitiveValue as _e,protocol_rest$makeRestProtocol as ve,protocol_rest$rawResponseRootSymbol as ye,protocol_rest$rawResponseSymbol as be,protocol_rest$sensitiveValueSymbol as xe,schema_lite$Array as Se,schema_lite$Boolean as Ce,schema_lite$NullOr as we,schema_lite$Number as Te,schema_lite$Record as Ee,schema_lite$String as De,schema_lite$Struct as Oe,schema_lite$TaggedError as ke,schema_lite$Unknown as Ae,schema_lite$at as je,schema_lite$optional as Me,schema_lite$suspend as Ne}from"@distilled.cloud/core/_bundle/rest";import*as X from"effect/Context";import*as Z from"effect/Effect";import*as Q from"effect/Layer";import*as Pe from"effect/Redacted";const $=`https://discord.com/api/v10`;var Credentials=class extends (/*@__PURE__*/ X.Service()(`DiscordCredentials`)){};const Fe=/*@__PURE__*/ ne({token:/*@__PURE__*/ s(`DISCORD_BOT_TOKEN`).pipe(/*@__PURE__*/ re(()=>s(`DISCORD_TOKEN`))),tokenType:/*@__PURE__*/ c(`DISCORD_TOKEN_TYPE`).pipe(/*@__PURE__*/ l(`Bot`)),apiBaseUrl:/*@__PURE__*/ c(`DISCORD_API_URL`).pipe(/*@__PURE__*/ l($))});const Ie=/*@__PURE__*/ Q.succeed(Credentials,/*@__PURE__*/ Fe.pipe(/*@__PURE__*/ Z.mapError(()=>new K({message:`DISCORD_BOT_TOKEN (or DISCORD_TOKEN) environment variable is required`})),/*@__PURE__*/ Z.map(({token:e,tokenType:t,apiBaseUrl:n})=>({token:e,tokenType:t.toLowerCase()===`bearer`?`Bearer`:`Bot`,apiBaseUrl:n}))));const credentials=e=>Q.succeed(Credentials,Z.succeed({token:e.token,tokenType:e.tokenType??`Bot`,apiBaseUrl:e.apiBaseUrl??`https://discord.com/api/v10`}));var UnknownDiscordError=class extends (/*@__PURE__*/ _()(`UnknownDiscordError`,{code:/*@__PURE__*/ y(h),message:/*@__PURE__*/ y(g),errors:/*@__PURE__*/ y(v),body:v}).pipe(o)){};var DiscordParseError=class extends (/*@__PURE__*/ _()(`DiscordParseError`,{body:v,cause:v}).pipe(a)){};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 Le=/*@__PURE__*/ ve({credentials:/*@__PURE__*/ Z.flatMap(Credentials,e=>e),baseUrl:e=>e.apiBaseUrl,headers:e=>({Authorization:`${e.tokenType} ${Pe.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__*/ X.Service()(`DiscordRetry`)){};const policy=e=>Z.provide(Q.succeed(Retry,e));const Re=/*@__PURE__*/ Z.provide(/*@__PURE__*/ Q.succeed(Retry,{while:()=>false}));const ze=u;const Be=ae;const Ve=ie;const He=f;const Ue=/*@__PURE__*/ policy(d);const We=m;const Ge=/*@__PURE__*/ policy(p);export{Se as Ub,Ce as Vb,e as a,we as bc,t as c,Te as cc,Credentials as credentials$Credentials,Ie as credentials$CredentialsFromEnv,$ as credentials$DEFAULT_API_BASE_URL,credentials as credentials$credentials,Ee as dc,n as e,U as errors$API_ERRORS,W as errors$BadGateway,G as errors$BadRequest,K as errors$ConfigError,q as errors$Conflict,J as errors$DEFAULT_ERRORS,DiscordParseError as errors$DiscordParseError,Y as errors$Forbidden,oe as errors$GatewayTimeout,se as errors$HTTP_STATUS_MAP,ce as errors$InternalServerError,le as errors$Locked,ue as errors$NotFound,de as errors$ServiceUnavailable,fe as errors$TooManyRequests,pe as errors$Unauthorized,UnknownDiscordError as errors$UnknownDiscordError,me as errors$UnprocessableEntity,De as fc,Oe as gc,ke as ic,r as k,ee as l,Ae as lc,te as m,je as nc,Le as protocol$DiscordProtocol,Retry as retry$Retry,Ve as retry$capped,Be as retry$jittered,ze as retry$makeDefault,Re as retry$none,policy as retry$policy,Ue as retry$throttling,He as retry$throttlingOptions,Ge as retry$transient,We as retry$transientOptions,Me as sc,Ne as tc,b as traits$Body,x as traits$FormDataFile,S as traits$Header,C as traits$Http,w as traits$HttpBody,T as traits$KeyDictionary,E as traits$Label,D as traits$Query,he as traits$RawResponse,ge as traits$RawResponseRoot,O as traits$ResponseCode,_e as traits$SensitiveValue,k as traits$UnionCases,A as traits$applyErrorMatchers,j as traits$bodySymbol,M as traits$errorMatchersSymbol,N as traits$formDataFileSymbol,P as traits$getErrorMatchers,F as traits$headerSymbol,I as traits$httpBodySymbol,L as traits$httpSymbol,R as traits$keyDictionarySymbol,z as traits$labelSymbol,B as traits$querySymbol,ye as traits$rawResponseRootSymbol,be as traits$rawResponseSymbol,V as traits$responseCodeSymbol,xe as traits$sensitiveValueSymbol,H as traits$unionCasesSymbol,i as ya};
2
2
  //# sourceMappingURL=sdk.js.map
@@ -1 +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,IAAIv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AI,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
+ {"version":3,"file":"sdk.js","names":["EffectConfig.Redacted","Schema.Number","Schema.String","Schema.Unknown","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$3","String$2","all$1","orElse","withDefault","capped$1","jittered$1","makeDefault$1","throttlingFactory","throttlingOptions$1","transientFactory","transientOptions$1","Number$2","String$1","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","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","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":"m0EA0BA,MAAaqG,EAAuB,8BAWpC,IAAa,YAAb,eACwB,gBAAQ,QAAyD,CAAC,CACtF,oBACF,EAAA,AAAE,CAAC,EAEL,MAAMC,GAA0B,iBAAiB,CAG/C,MAAqB,gBAAsB,mBAAmB,CAAC,CAAC,KAChD,qBAA0BtG,EAAsB,eAAe,CAAC,CAChF,EACA,UAAyB,gBAAoB,oBAAoB,CAAC,CAAC,KACnD,gBAAyB,KAAK,CAC9C,EACA,WAA0B,gBAAoB,iBAAiB,CAAC,CAAC,KACjD,gBAAyBqG,CAAoB,CAC7D,CACF,CA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,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,GAAGb,GAAS,MAAMa,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,ECxED,IAAa,MAAb,eAAyC,gBAAQ,QAAuB,CAAC,CAAC,cAAc,EAAA,AAAE,CAAC,EAG3F,MAAa,OAOR,GAAwCR,EAAO,QAAQC,EAAM,QAAQ,MAAOe,CAAgB,CAAC,EAGlG,MAAaC,GAE+C,gBAAO,QACnD,gBAAM,QAAQ,MAAO,CAAE,UAAa,KAAM,CAAC,CAC3D,EAOA,MAAaC,GAAuB9G,EAEpC,MAAa+G,GAAW9G,GACxB,MAAa+G,GAAS9G,GAGtB,MAAa+G,GAA6B9G,EAG1C,MAAa+G,GAE+C,qBAAO9G,CAAyB,EAG5F,MAAa+G,GAA4B9G,EAGzC,MAAa+G,GAE+C,qBAAO9G,CAAwB"}
@@ -1,3 +1,4 @@
1
+ import { ConfigError } from "@distilled.cloud/core/errors";
1
2
  import * as Context from "effect/Context";
2
3
  import * as Effect from "effect/Effect";
3
4
  import * as Layer from "effect/Layer";
@@ -15,7 +16,7 @@ export interface Config {
15
16
  readonly tokenType: TokenType;
16
17
  readonly apiBaseUrl: string;
17
18
  }
18
- declare const Credentials_base: Context.ServiceClass<Credentials, "DiscordCredentials", Effect.Effect<Config, never, never>>;
19
+ declare const Credentials_base: Context.ServiceClass<Credentials, "DiscordCredentials", Effect.Effect<Config, ConfigError, never>>;
19
20
  export declare class Credentials extends /*@__PURE__*/ Credentials_base {
20
21
  }
21
22
  export declare const CredentialsFromEnv: Layer.Layer<Credentials, never, never>;
@@ -1 +1 @@
1
- {"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../src/credentials.ts"],"names":[],"mappings":"AAgBA,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;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,gCAAgC,CAAC;AAElE,yDAAyD;AACzD,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,QAAQ,CAAC;AAEzC,MAAM,WAAW,MAAM;IACrB,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC1C,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;;AAED,qBAAa,WACX,SAAQ,aAAa,CAAC,gBAErB;CAAG;AAgBN,eAAO,MAAM,kBAAkB,wCAkB9B,CAAC;AAEF,gFAAgF;AAChF,eAAO,MAAM,WAAW,WAAY;IAClC,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC1C,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,CAAC;IAC/B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC9B,KAAG,KAAK,CAAC,KAAK,CAAC,WAAW,CAQxB,CAAC"}
1
+ {"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../src/credentials.ts"],"names":[],"mappings":"AAeA,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;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,gCAAgC,CAAC;AAElE,yDAAyD;AACzD,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,QAAQ,CAAC;AAEzC,MAAM,WAAW,MAAM;IACrB,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC1C,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;;AAED,qBAAa,WACX,SAAQ,aAAa,CAAC,gBAErB;CAAG;AAgBN,eAAO,MAAM,kBAAkB,wCAiB9B,CAAC;AAEF,gFAAgF;AAChF,eAAO,MAAM,WAAW,WAAY;IAClC,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC1C,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,CAAC;IAC/B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC9B,KAAG,KAAK,CAAC,KAAK,CAAC,WAAW,CAQxB,CAAC"}
package/lib/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * @distilled.cloud/discord -- Discord HTTP API (v10) SDK for Effect.
3
3
  *
4
- * `./services` is generated by `scripts/generate.ts` from the Smithy model in
5
- * `.generated-specs` (written by `scripts/convert.ts` from the Discord
6
- * OpenAPI spec submodule). Everything else in this folder is hand-written.
4
+ * `./services` is generated by `scripts/generate.ts` from the Smithy model that
5
+ * `scripts/convert.ts` converts from the Discord OpenAPI spec submodule.
6
+ * Everything else in this folder is hand-written.
7
7
  */
8
8
  export * from "./credentials.ts";
9
9
  export * from "./errors.ts";
package/lib/protocol.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import type * as API from "@distilled.cloud/core/api";
2
- import type { ConfigError } from "@distilled.cloud/core/errors";
2
+ import type { ConfigError, InvalidInput } from "@distilled.cloud/core/errors";
3
+ import type { SdkError } from "@distilled.cloud/core/sdk-error";
3
4
  import type * as HttpClient from "effect/http/HttpClient";
4
5
  import type * as HttpClientError from "effect/http/HttpClientError";
5
6
  import type * as Layer from "effect/Layer";
@@ -11,7 +12,7 @@ import { type DefaultErrors } from "./errors.ts";
11
12
  * DiscordOpError, DiscordOpContext>` explicitly so the compiler never infers
12
13
  * these back out of the schema generics.
13
14
  */
14
- export type DiscordOpError = DefaultErrors | ConfigError | HttpClientError.HttpClientError;
15
+ export type DiscordOpError = DefaultErrors | ConfigError | HttpClientError.HttpClientError | InvalidInput | SdkError;
15
16
  /** Context (requirements) shared by every generated Discord operation. */
16
17
  export type DiscordOpContext = Credentials | HttpClient.HttpClient;
17
18
  export declare const DiscordProtocol: Layer.Layer<API.Protocol>;
@@ -1 +1 @@
1
- {"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,GAAG,MAAM,2BAA2B,CAAC;AACtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAiBhE,OAAO,KAAK,KAAK,UAAU,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,KAAK,eAAe,MAAM,6BAA6B,CAAC;AACpE,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAC;AAE3C,OAAO,EAAE,WAAW,EAAe,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAuB,KAAK,aAAa,EAAqB,MAAM,aAAa,C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