@distilled.cloud/stripe 1.0.0-rc.15 → 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 +1 -0
- package/lib/_bundle/lazy.js +4 -0
- package/lib/_bundle/sdk.js +2 -0
- package/lib/_bundle/sdk.js.map +1 -0
- package/lib/credentials.d.ts +1 -1
- package/lib/credentials.d.ts.map +1 -1
- package/lib/credentials.js +1 -31
- package/lib/errors.d.ts +83 -83
- package/lib/errors.d.ts.map +1 -1
- package/lib/errors.js +1 -130
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -14
- package/lib/index.lazy.js +8 -0
- package/lib/pagination.d.ts +3 -3
- package/lib/pagination.js +1 -28
- package/lib/protocol.d.ts +12 -12
- package/lib/protocol.d.ts.map +1 -1
- package/lib/protocol.js +1 -399
- package/lib/retry.d.ts +1 -1
- package/lib/retry.d.ts.map +1 -1
- package/lib/retry.js +1 -32
- package/lib/services/index.js +0 -2
- package/lib/services/stripe.d.ts +507 -14141
- package/lib/services/stripe.d.ts.map +1 -1
- package/lib/services/stripe.js +918 -53147
- package/lib/services/stripe.js.map +1 -1
- package/lib/services.lazy/index.js +3 -0
- package/lib/services.lazy/stripe.js +4 -0
- package/lib/traits.d.ts +2 -2
- package/lib/traits.js +1 -16
- package/lib/webhooks.js +1 -160
- package/lib/webhooks.js.map +1 -1
- package/package.json +9 -7
- package/src/credentials.ts +12 -11
- package/src/errors.ts +89 -88
- package/src/index.ts +1 -1
- package/src/pagination.ts +3 -3
- package/src/protocol.ts +278 -162
- package/src/retry.ts +6 -4
- package/src/services/stripe.ts +37296 -85780
- package/src/traits.ts +2 -2
- package/src/webhooks.ts +2 -2
- package/lib/credentials.js.map +0 -1
- package/lib/errors.js.map +0 -1
- package/lib/pagination.js.map +0 -1
- package/lib/protocol.js.map +0 -1
- package/lib/protocol.test.d.ts +0 -2
- package/lib/protocol.test.d.ts.map +0 -1
- package/lib/protocol.test.js +0 -353
- package/lib/protocol.test.js.map +0 -1
- package/lib/retry.js.map +0 -1
- package/lib/services/index.js.map +0 -1
- package/lib/traits.js.map +0 -1
- package/src/protocol.test.ts +0 -519
- /package/lib/{index.js.map → index.lazy.js.map} +0 -0
package/lib/.lazy.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"serviceDirs":["services"],"twins":["index.js"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{api$D as e,api$Protocol as t,api$call as n,api$error as r,api$named as i,api$newError as a,api$op as o,api$opPaginated as s,api$withValue as c,category$withAuthError as l,category$withBadRequestError as u,category$withConflictError as d,category$withParseError as f,category$withRetryable as p,category$withServerError as m,config$String as h,config$all as g,pagination$paginateCursor as _,pagination$paginateSingle as v,pagination$paginateWithDefaults as ee,response_validation$checkResponse as te,response_validation$withholdActual as ne,retry$capped as re,retry$jittered as y,retry$makeDefault as b,retry$throttlingFactory as x,retry$throttlingOptions as ie,retry$transientFactory as S,retry$transientOptions as ae,trait$Body as oe,trait$FormDataFile as se,trait$Header as ce,trait$Http as le,trait$HttpBody as ue,trait$KeyDictionary as de,trait$Label as fe,trait$Query as pe,trait$ResponseCode as me,trait$UnionCases as he,trait$applyErrorMatchers as ge,trait$bodySymbol as C,trait$formDataFileSymbol as _e,trait$getErrorMatchers as ve,trait$headerSymbol as w,trait$httpBodySymbol as ye,trait$httpSymbol as T,trait$keyDictionarySymbol as E,trait$labelSymbol as D,trait$querySymbol as O,trait$responseCodeSymbol as k,trait$unionCasesSymbol as A}from"@distilled.cloud/core/_bundle/base";import{debug$debugHttp as j,errors$API_ERRORS as M,errors$BadGateway as N,errors$BadRequest as P,errors$ConfigError as F,errors$Conflict as be,errors$DEFAULT_ERRORS as xe,errors$Forbidden as Se,errors$GatewayTimeout as Ce,errors$HTTP_STATUS_MAP as I,errors$InternalServerError as L,errors$Locked as we,errors$NotFound as Te,errors$ServiceUnavailable as Ee,errors$TooManyRequests as De,errors$Unauthorized as Oe,errors$UnprocessableEntity as ke,protocol_http$buildRequest as Ae,protocol_http$getAnn as je,protocol_http$getProps as Me,protocol_http$hasPropAnn as R,protocol_http$makeRequest as Ne,protocol_http$mapKeys as z,protocol_http$mapsVerbatim as B,protocol_http$matchTypedError as Pe,protocol_http$nameOf as V,protocol_rest$RawResponse as Fe,protocol_rest$RawResponseRoot as Ie,protocol_rest$SensitiveValue as Le,protocol_rest$hasSensitive as Re,protocol_rest$hasSensitiveMember as ze,protocol_rest$rawResponseRootSymbol as Be,protocol_rest$rawResponseSymbol as Ve,protocol_rest$sensitiveValueSymbol as He,protocol_rest$unwrapRedactedDeep as H,protocol_rest$wrapSensitive as Ue,retry_after$parseRetryAfterForStatus as U,schema_lite$Array as We,schema_lite$Boolean as Ge,schema_lite$NullOr as Ke,schema_lite$Number as qe,schema_lite$Record as Je,schema_lite$String as Ye,schema_lite$Struct as Xe,schema_lite$TaggedError as Ze,schema_lite$Unknown as Qe,schema_lite$at as $e,schema_lite$optional as et,schema_lite$suspend as tt}from"@distilled.cloud/core/_bundle/rest";import*as W from"effect/Context";import*as G from"effect/Effect";import*as K from"effect/Layer";import*as q from"effect/Redacted";import*as J from"@distilled.cloud/core/schema-lite-typed";import*as Y from"effect/http/HttpBody";import*as nt from"effect/http/HttpClient";import*as rt from"effect/http/HttpClientRequest";const X=`https://api.stripe.com`;var Credentials=class extends (/*@__PURE__*/ W.Service()(`StripeCredentials`)){};const it=/*@__PURE__*/ g({apiKey:/*@__PURE__*/ h(`STRIPE_API_KEY`)});const at=/*@__PURE__*/ K.succeed(Credentials,/*@__PURE__*/ it.pipe(/*@__PURE__*/ G.mapError(()=>new F({message:`STRIPE_API_KEY environment variable is required`})),/*@__PURE__*/ G.map(({apiKey:e})=>({apiKey:q.make(e),apiBaseUrl:X})),G.orDie));const credentials=e=>K.succeed(Credentials,G.succeed({apiKey:e.apiKey,apiBaseUrl:e.apiBaseUrl??`https://api.stripe.com`}));var PaymentError=class extends (/*@__PURE__*/ J.TaggedError()(`PaymentError`,{message:/*@__PURE__*/ J.optional(J.String),code:/*@__PURE__*/ J.optional(J.String),decline_code:/*@__PURE__*/ J.optional(J.String),charge:/*@__PURE__*/ J.optional(J.String),param:/*@__PURE__*/ J.optional(J.String),doc_url:/*@__PURE__*/ J.optional(J.String),request_log_url:/*@__PURE__*/ J.optional(J.String)}).pipe(u)){};var CardError=class extends (/*@__PURE__*/ J.TaggedError()(`CardError`,{message:/*@__PURE__*/ J.optional(J.String),code:/*@__PURE__*/ J.optional(J.String),decline_code:/*@__PURE__*/ J.optional(J.String),charge:/*@__PURE__*/ J.optional(J.String),param:/*@__PURE__*/ J.optional(J.String),doc_url:/*@__PURE__*/ J.optional(J.String),advice_code:/*@__PURE__*/ J.optional(J.String),network_advice_code:/*@__PURE__*/ J.optional(J.String),network_decline_code:/*@__PURE__*/ J.optional(J.String),payment_method_type:/*@__PURE__*/ J.optional(J.String),request_log_url:/*@__PURE__*/ J.optional(J.String)}).pipe(u)){};var IdempotencyError=class extends (/*@__PURE__*/ J.TaggedError()(`IdempotencyError`,{message:/*@__PURE__*/ J.optional(J.String),code:/*@__PURE__*/ J.optional(J.String),doc_url:/*@__PURE__*/ J.optional(J.String),request_log_url:/*@__PURE__*/ J.optional(J.String)}).pipe(d)){};var InvalidRequestError=class extends (/*@__PURE__*/ J.TaggedError()(`InvalidRequestError`,{message:/*@__PURE__*/ J.optional(J.String),code:/*@__PURE__*/ J.optional(J.String),param:/*@__PURE__*/ J.optional(J.String),doc_url:/*@__PURE__*/ J.optional(J.String),request_log_url:/*@__PURE__*/ J.optional(J.String)}).pipe(u)){};var ApiError=class extends (/*@__PURE__*/ J.TaggedError()(`ApiError`,{message:/*@__PURE__*/ J.optional(J.String),code:/*@__PURE__*/ J.optional(J.String),param:/*@__PURE__*/ J.optional(J.String),doc_url:/*@__PURE__*/ J.optional(J.String),request_log_url:/*@__PURE__*/ J.optional(J.String)}).pipe(m,/*@__PURE__*/ p())){};var ExternalDependencyFailed=class extends (/*@__PURE__*/ J.TaggedError()(`ExternalDependencyFailed`,{message:/*@__PURE__*/ J.optional(J.String),code:/*@__PURE__*/ J.optional(J.String),doc_url:/*@__PURE__*/ J.optional(J.String)}).pipe(m,/*@__PURE__*/ p())){};const Z={402:PaymentError,424:ExternalDependencyFailed};var UnknownStripeError=class extends (/*@__PURE__*/ J.TaggedError()(`UnknownStripeError`,{type:/*@__PURE__*/ J.optional(J.String),code:/*@__PURE__*/ J.optional(J.String),message:/*@__PURE__*/ J.optional(J.String),param:/*@__PURE__*/ J.optional(J.String),body:J.Unknown}).pipe(m)){};var StripeParseError=class extends (/*@__PURE__*/ J.TaggedError()(`StripeParseError`,{body:J.Unknown,cause:J.Unknown}).pipe(f)){};var StripeWebhookSignatureError=class extends (/*@__PURE__*/ J.TaggedError()(`StripeWebhookSignatureError`,{message:J.String,cause:/*@__PURE__*/ J.optional(J.Unknown)}).pipe(l)){};var StripeWebhookPayloadParseError=class extends (/*@__PURE__*/ J.TaggedError()(`StripeWebhookPayloadParseError`,{message:J.String,cause:/*@__PURE__*/ J.optional(J.Unknown)}).pipe(f)){};const stripeSearchPaginate=(e,t,n)=>{switch(n.mode){case`page`:return _(e,t,n);case`single`:return v(e,t,n);default:return ee(e,t,n)}};const Http=e=>le(e);var RequestOptions=class extends (/*@__PURE__*/ W.Service()(`StripeRequestOptions`)){};const withRequestOptions=e=>G.provide(K.succeed(RequestOptions,e));const stripeRequestHeaders=e=>{const t={};if(e?.idempotencyKey!==void 0)t[`Idempotency-Key`]=e.idempotencyKey;if(e?.stripeAccount!==void 0)t[`Stripe-Account`]=e.stripeAccount;if(e?.stripeContext!==void 0)t[`Stripe-Context`]=e.stripeContext;if(e?.apiVersion!==void 0)t[`Stripe-Version`]=e.apiVersion;return t};const fail=e=>G.fail(e);const Q=/*@__PURE__*/ new Set([`GET`,`HEAD`]);const appendQueryValue=(e,t,n)=>{if(n===void 0||n===null)return;e.append(t,typeof n===`boolean`?n?`true`:`false`:String(n))};const appendStripeQuery=(e,t,n)=>{if(n===void 0||n===null)return;if(Array.isArray(n)){for(const r of n)appendQueryValue(e,`${t}[]`,r);return}if(typeof n===`object`&&!(n instanceof Date)){for(const[r,i]of Object.entries(n))appendStripeQuery(e,`${t}[${r}]`,i);return}appendQueryValue(e,t,n)};const flattenToFormPairs=(e,t=``)=>{const n=[];for(const[r,i]of Object.entries(e)){if(i===void 0||i===null)continue;const e=t?`${t}[${r}]`:r;if(Array.isArray(i))for(let t=0;t<i.length;t++){const r=i[t];if(r!==null&&r!==void 0&&typeof r===`object`&&!Array.isArray(r))n.push(...flattenToFormPairs(r,`${e}[${t}]`));else if(r!==void 0&&r!==null)n.push([`${e}[${t}]`,String(r)])}else if(typeof i===`object`)n.push(...flattenToFormPairs(i,e));else if(typeof i===`boolean`)n.push([e,i?`true`:`false`]);else n.push([e,String(i)])}return n};const buildFormUrlEncoded=e=>{const t=new URLSearchParams;for(const[n,r]of flattenToFormPairs(e))t.append(n,r);return t.toString()};const $=/*@__PURE__*/ new WeakMap;const requestPlanFor=e=>{let t=$.get(e);if(t!==void 0)return t;const n=je(e,T);if(!n)throw new Error(`operation input is missing the Http() trait`);const r=Me(e).map(e=>{const t=String(e.name);if(R(e,D))return{key:t,bind:`label`,name:V(e,D),type:e.type,verbatim:true};if(R(e,w))return{key:t,bind:`header`,name:V(e,w).toLowerCase(),type:e.type,verbatim:true};if(R(e,O))return{key:t,bind:`query`,name:V(e,O),type:e.type,verbatim:true};return{key:t,bind:`body`,name:V(e,C),type:e.type,verbatim:B(e.type,`encode`)}});t={http:n,members:r,known:new Set(r.map(e=>e.key))};$.set(e,t);return t};const requestFor=(e,t,n,r)=>{const{http:i,members:a,known:o}=requestPlanFor(r);const s={Authorization:`Bearer ${q.value(e.apiKey)}`,...stripeRequestHeaders(t),Accept:`application/json`};if(i.contentType===`multipart`)return Ae({input:H(n),inputAst:r,baseUrl:e.apiBaseUrl,headers:s});const c=H(n)??{};const l=s;const u={};let d=0;let f;let p=i.uri;for(let e=0;e<a.length;e++){const t=a[e];const n=c[t.key];if(n===void 0)continue;switch(t.bind){case`label`:p=p.replace(`{${t.name}}`,encodeURIComponent(String(n)));break;case`header`:l[t.name]=String(n);break;case`query`:appendStripeQuery(f??=new URLSearchParams,t.name,n);break;default:u[t.name]=t.verbatim?n:z(t.type,n,`encode`);d++}}for(const e in c){if(o.has(e)||!Object.hasOwn(c,e))continue;const t=c[e];if(t===void 0)continue;u[e]=t;d++}const m=Q.has(i.method);if(m&&d>0)for(const[e,t]of Object.entries(u))appendStripeQuery(f??=new URLSearchParams,e,t);const h=f===void 0?``:f.toString();const g=h?`${e.apiBaseUrl}${p}?${h}`:`${e.apiBaseUrl}${p}`;if(j())console.error(`[distilled] ${i.method} ${g}`+(d&&!m?` body=${JSON.stringify(u).slice(0,400)}`:``));const _=Ne(i.method,g,l);if(m||d===0)return _;return rt.setBody(_,i.contentType===`form-urlencoded`?Y.text(buildFormUrlEncoded(u),`application/x-www-form-urlencoded`):Y.jsonUnsafe(u))};const withCredentials=(e,t)=>c(W.get(e,Credentials),t);const encode=({input:e,inputAst:t})=>G.withFiber(n=>{const r=n.context;return withCredentials(r,n=>G.succeed(requestFor(n,W.getOrUndefined(r,RequestOptions),e,t)))});const str=e=>typeof e===`string`?e:void 0;const ot=Z;const st=I;const stripeErrorEnvelope=e=>{const t=e!==null&&typeof e===`object`?e.error:void 0;return t!==null&&typeof t===`object`?t:void 0};const stripeErrorMessage=e=>{const t=stripeErrorEnvelope(e)?.message;return typeof t===`string`?t:void 0};const matchStripeError=(e,t,n)=>{const r=stripeErrorEnvelope(t);if(!r||typeof r.type!==`string`)return new UnknownStripeError({body:t});const i={message:str(r.message),code:str(r.code),doc_url:str(r.doc_url),request_log_url:str(r.request_log_url)};switch(r.type){case`card_error`:return new CardError({...i,decline_code:str(r.decline_code),charge:str(r.charge),param:str(r.param),advice_code:str(r.advice_code),network_advice_code:str(r.network_advice_code),network_decline_code:str(r.network_decline_code),payment_method_type:str(r.payment_method_type)});case`idempotency_error`:return new IdempotencyError(i);case`invalid_request_error`:return new InvalidRequestError({...i,param:str(r.param)});case`api_error`:return new ApiError({...i,param:str(r.param)})}const a=ot[e];if(a)return new a({message:i.message,code:i.code,...str(r.decline_code)!==void 0?{decline_code:str(r.decline_code)}:{},...str(r.charge)!==void 0?{charge:str(r.charge)}:{},...str(r.param)!==void 0?{param:str(r.param)}:{},...i.doc_url!==void 0?{doc_url:i.doc_url}:{},...i.request_log_url!==void 0?{request_log_url:i.request_log_url}:{}});const o=st[e];if(o)return new o({message:i.message??``,retryAfter:U(e,n)});if(e>=500)return new L({message:i.message??`HTTP ${e}`,retryAfter:U(e,n)});return new UnknownStripeError({type:str(r.type),code:i.code,message:i.message,param:str(r.param),body:t})};const decodeResponse=(e,t,n,r)=>G.matchEffect(t.text,{onFailure:G.die,onSuccess:i=>{const a=i??``;if(j())console.error(`[distilled] <- ${t.status} ${a.slice(0,400)}`);let o;let s=false;if(a.trim().length>0)try{o=JSON.parse(a)}catch{s=true}const c=t.status;const l=t.headers;if(c>=400){const e=s?a:o;const t=stripeErrorMessage(e)??(s&&a.trim()?a.trim():`HTTP ${c}`);const n=Pe(r,c,[{message:t}],{body:s?a:o,headers:l});if(n!==void 0)return fail(n);return fail(matchStripeError(c,e,l))}const u=ze(n);if(s&&u)return fail(new StripeParseError({body:`[REDACTED]`,cause:`Invalid JSON response`}));const d=s?a:o??{};const f=B(n,`decode`)?d:z(n,d,`decode`);const p=te(e,n,f);if(p!==void 0)return fail(new StripeParseError({body:u?`[REDACTED]`:s?a:o,cause:u?ne(p):p}));return G.succeed(Re(n)?Ue(n,f):f)}});const call=(e,t)=>G.withFiber(n=>{const r=n.context;return withCredentials(r,n=>{const i=requestFor(n,W.getOrUndefined(r,RequestOptions),t,e.inputAst);const a=W.get(r,nt.HttpClient);return G.flatMap(a.execute(i),t=>decodeResponse(r,t,e.outputAst,e.errors))})});const ct=/*@__PURE__*/ K.succeed(t,/*@__PURE__*/ t.of({encode:e=>encode(e),decode:({response:e,outputAst:t,errors:n})=>G.withFiber(r=>decodeResponse(r.context,e,t,n)),call}));var Retry=class extends (/*@__PURE__*/ W.Service()(`StripeRetry`)){};const policy=e=>G.provide(K.succeed(Retry,e));const lt=/*@__PURE__*/ G.provide(/*@__PURE__*/ K.succeed(Retry,{while:()=>false}));const ut=/*@__PURE__*/ policy(x);const dt=/*@__PURE__*/ policy(S);export{a as _,Je as a,u as b,Ze as c,Credentials as credentials$Credentials,at as credentials$CredentialsFromEnv,X as credentials$DEFAULT_API_BASE_URL,credentials as credentials$credentials,et as d,M as errors$API_ERRORS,ApiError as errors$ApiError,N as errors$BadGateway,P as errors$BadRequest,CardError as errors$CardError,F as errors$ConfigError,be as errors$Conflict,xe as errors$DEFAULT_ERRORS,ExternalDependencyFailed as errors$ExternalDependencyFailed,Se as errors$Forbidden,Ce as errors$GatewayTimeout,I as errors$HTTP_STATUS_MAP,IdempotencyError as errors$IdempotencyError,L as errors$InternalServerError,InvalidRequestError as errors$InvalidRequestError,we as errors$Locked,Te as errors$NotFound,PaymentError as errors$PaymentError,Z as errors$STRIPE_HTTP_STATUS_MAP,Ee as errors$ServiceUnavailable,StripeParseError as errors$StripeParseError,StripeWebhookPayloadParseError as errors$StripeWebhookPayloadParseError,StripeWebhookSignatureError as errors$StripeWebhookSignatureError,De as errors$TooManyRequests,Oe as errors$Unauthorized,UnknownStripeError as errors$UnknownStripeError,ke as errors$UnprocessableEntity,tt as f,i as g,r as h,qe as i,Qe as l,n as m,Ge as n,Ye as o,e as p,stripeSearchPaginate as pagination$stripeSearchPaginate,RequestOptions as protocol$RequestOptions,ct as protocol$StripeProtocol,withRequestOptions as protocol$withRequestOptions,Ke as r,Retry as retry$Retry,re as retry$capped,y as retry$jittered,b as retry$makeDefault,lt as retry$none,policy as retry$policy,ut as retry$throttling,x as retry$throttlingFactory,ie as retry$throttlingOptions,dt as retry$transient,S as retry$transientFactory,ae as retry$transientOptions,Xe as s,We as t,oe as traits$Body,se as traits$FormDataFile,ce as traits$Header,Http as traits$Http,ue as traits$HttpBody,de as traits$KeyDictionary,fe as traits$Label,pe as traits$Query,Fe as traits$RawResponse,Ie as traits$RawResponseRoot,me as traits$ResponseCode,Le as traits$SensitiveValue,he as traits$UnionCases,ge as traits$applyErrorMatchers,C as traits$bodySymbol,_e as traits$formDataFileSymbol,ve as traits$getErrorMatchers,w as traits$headerSymbol,ye as traits$httpBodySymbol,T as traits$httpSymbol,E as traits$keyDictionarySymbol,D as traits$labelSymbol,O as traits$querySymbol,Be as traits$rawResponseRootSymbol,Ve as traits$rawResponseSymbol,k as traits$responseCodeSymbol,He as traits$sensitiveValueSymbol,A as traits$unionCasesSymbol,$e as u,o as v,s as y};
|
|
2
|
+
//# sourceMappingURL=sdk.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sdk.js","names":["Category.withBadRequestError","Category.withConflictError","Category.withServerError","Category.withParseError","Category.withAuthError","Pagination.paginateCursor","Pagination.paginateSingle","Pagination.paginateWithDefaults","CoreHttp","HttpBody","API.withValue","API.Protocol","D","Protocol","call$1","error","named","newError","op","opPaginated","withValue","withAuthError","withBadRequestError","withConflictError","withParseError","withRetryable","withServerError","String$2","all$1","paginateCursor","paginateSingle","paginateWithDefaults","checkResponse","withholdActual","capped","jittered","makeDefault","throttlingFactory","throttlingOptions","transientFactory","transientOptions","Body","FormDataFile","Header","Http$1","HttpBody","KeyDictionary","Label","Query","ResponseCode","UnionCases","applyErrorMatchers","bodySymbol","formDataFileSymbol","getErrorMatchers","headerSymbol","httpBodySymbol","httpSymbol","keyDictionarySymbol","labelSymbol","querySymbol","responseCodeSymbol","unionCasesSymbol","debugHttp","API_ERRORS","BadGateway","BadRequest","ConfigError","Conflict","DEFAULT_ERRORS","Forbidden","GatewayTimeout","HTTP_STATUS_MAP","InternalServerError","Locked","NotFound","ServiceUnavailable","TooManyRequests","Unauthorized","UnprocessableEntity","buildRequest","getAnn","getProps","hasPropAnn","makeRequest","mapKeys","mapsVerbatim","matchTypedError","nameOf","RawResponse","RawResponseRoot","SensitiveValue","hasSensitive","hasSensitiveMember","rawResponseRootSymbol","rawResponseSymbol","sensitiveValueSymbol","unwrapRedactedDeep","wrapSensitive","parseRetryAfterForStatus","Array$1","Boolean","NullOr","Number","Record","String$1","Struct","TaggedError","Unknown","at","optional","suspend","Context","Effect","Layer","Redacted","Schema","HttpBody$1","HttpClient","HttpClientRequest","DEFAULT_API_BASE_URL","envConfig","CredentialsFromEnv","apiKey","config","STRIPE_HTTP_STATUS_MAP","pagination","operation","input","trait","options","headers","BODYLESS","value","query","key","item","nestedKey","nestedValue","pairs","obj","fullKey","prefix","i","params","body","requestPlans","plan","inputAst","http","members","prop","m","baseHeaders","creds","inputObj","bodyKeys","uri","known","bodyless","qs","url","request","context","f","fiber","v","stripeStatusMap","coreStatusMap","envelope","errorBody","message","err","common","StripeErrorClass","status","CoreErrorClass","response","text","read","json","nonJson","typed","errorClasses","withholdBody","outputAst","mapped","cause","client","StripeProtocol","args","errors","optionsOrFactory","none","throttling","transient"],"sources":["../../src/credentials.ts","../../src/errors.ts","../../src/pagination.ts","../../src/traits.ts","../../src/protocol.ts","../../src/retry.ts"],"mappings":"8gGAcA,MAAawH,EAAuB,yBAOpC,IAAa,YAAb,eACwB,gBAAQ,QAA4C,CAAC,CACzE,mBACF,EAAA,AAAE,CAAC,EAEL,MAAMC,GAA0B,gBAAiB,CAC/C,OAAsB,gBAAoB,gBAAgB,CAC5D,CAAC,EAED,MAAaC,GAAmC,gBAAM,QACpD,YACc,iBAAU,KACR,gBAAO,aAEjB,IAAIvD,EAAY,CACd,QAAS,iDACX,CAAC,CACL,EACc,gBAAO,KAAK,CAAE,aAAc,CACxC,OAAQgD,EAAS,KAAKQ,CAAM,EAC5B,WAAYH,CACd,EAAE,EACFP,EAAO,KACT,CACF,EAGA,MAAa,YAAe,GAI1BC,EAAM,QACJ,YACAD,EAAO,QAAQ,CACb,OAAQW,EAAO,OACf,WAAYA,EAAO,YA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
|
8
8
|
readonly apiBaseUrl: string;
|
|
9
9
|
}
|
|
10
10
|
declare const Credentials_base: Context.ServiceClass<Credentials, "StripeCredentials", Effect.Effect<Config, never, never>>;
|
|
11
|
-
export declare class Credentials extends Credentials_base {
|
|
11
|
+
export declare class Credentials extends /*@__PURE__*/ Credentials_base {
|
|
12
12
|
}
|
|
13
13
|
export declare const CredentialsFromEnv: Layer.Layer<Credentials, never, never>;
|
|
14
14
|
/** Convenience layer from a redacted API key + optional base URL. */
|
package/lib/credentials.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../src/credentials.ts"],"names":[],"mappings":"AASA,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,eAAO,MAAM,oBAAoB,2BAA2B,CAAC;AAE7D,MAAM,WAAW,MAAM;IACrB,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC3C,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;;AAED,qBAAa,
|
|
1
|
+
{"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../src/credentials.ts"],"names":[],"mappings":"AASA,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,eAAO,MAAM,oBAAoB,2BAA2B,CAAC;AAE7D,MAAM,WAAW,MAAM;IACrB,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC3C,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;;AAED,qBAAa,WACX,SAAQ,aAAa,CAAC,gBAErB;CAAG;AAMN,eAAO,MAAM,kBAAkB,wCAe9B,CAAC;AAEF,qEAAqE;AACrE,eAAO,MAAM,WAAW,WAAY;IAClC,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC3C,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC9B,KAAG,KAAK,CAAC,KAAK,CAAC,WAAW,CAOxB,CAAC"}
|
package/lib/credentials.js
CHANGED
|
@@ -1,31 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Stripe credentials — hand-written.
|
|
3
|
-
*
|
|
4
|
-
* API-compatible port of the distilled v0 stripe credentials module: the
|
|
5
|
-
* `Credentials` service holds an *effect* that resolves the current
|
|
6
|
-
* credentials on every request. `CredentialsFromEnv` reads `STRIPE_API_KEY`.
|
|
7
|
-
*/
|
|
8
|
-
import { ConfigError } from "@distilled.cloud/core/errors";
|
|
9
|
-
import * as EffectConfig from "effect/Config";
|
|
10
|
-
import * as Context from "effect/Context";
|
|
11
|
-
import * as Effect from "effect/Effect";
|
|
12
|
-
import * as Layer from "effect/Layer";
|
|
13
|
-
import * as Redacted from "effect/Redacted";
|
|
14
|
-
export const DEFAULT_API_BASE_URL = "https://api.stripe.com";
|
|
15
|
-
export class Credentials extends Context.Service()("StripeCredentials") {
|
|
16
|
-
}
|
|
17
|
-
const envConfig = EffectConfig.all({
|
|
18
|
-
apiKey: EffectConfig.String("STRIPE_API_KEY"),
|
|
19
|
-
});
|
|
20
|
-
export const CredentialsFromEnv = Layer.succeed(Credentials, envConfig.pipe(Effect.mapError(() => new ConfigError({
|
|
21
|
-
message: "STRIPE_API_KEY environment variable is required",
|
|
22
|
-
})), Effect.map(({ apiKey }) => ({
|
|
23
|
-
apiKey: Redacted.make(apiKey),
|
|
24
|
-
apiBaseUrl: DEFAULT_API_BASE_URL,
|
|
25
|
-
})), Effect.orDie));
|
|
26
|
-
/** Convenience layer from a redacted API key + optional base URL. */
|
|
27
|
-
export const credentials = (config) => Layer.succeed(Credentials, Effect.succeed({
|
|
28
|
-
apiKey: config.apiKey,
|
|
29
|
-
apiBaseUrl: config.apiBaseUrl ?? DEFAULT_API_BASE_URL,
|
|
30
|
-
}));
|
|
31
|
-
//# 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.d.ts
CHANGED
|
@@ -8,90 +8,90 @@
|
|
|
8
8
|
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";
|
|
9
9
|
export type { DefaultErrors } from "@distilled.cloud/core/errors";
|
|
10
10
|
import * as Category from "@distilled.cloud/core/category";
|
|
11
|
-
import * as Schema from "
|
|
12
|
-
declare const PaymentError_base: Schema.
|
|
13
|
-
readonly message: Schema.optional<Schema.String>;
|
|
14
|
-
readonly code: Schema.optional<Schema.String>;
|
|
15
|
-
readonly decline_code: Schema.optional<Schema.String>;
|
|
16
|
-
readonly charge: Schema.optional<Schema.String>;
|
|
17
|
-
readonly param: Schema.optional<Schema.String>;
|
|
18
|
-
readonly doc_url: Schema.optional<Schema.String>;
|
|
19
|
-
readonly request_log_url: Schema.optional<Schema.String>;
|
|
20
|
-
}
|
|
11
|
+
import * as Schema from "@distilled.cloud/core/schema-lite-typed";
|
|
12
|
+
declare const PaymentError_base: Schema.TaggedErrorClass<"PaymentError", {
|
|
13
|
+
readonly message: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
14
|
+
readonly code: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
15
|
+
readonly decline_code: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
16
|
+
readonly charge: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
17
|
+
readonly param: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
18
|
+
readonly doc_url: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
19
|
+
readonly request_log_url: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
20
|
+
}> & (new (...args: any[]) => {
|
|
21
21
|
"@distilled.cloud/error/categories": {
|
|
22
22
|
BadRequestError: true;
|
|
23
23
|
};
|
|
24
24
|
});
|
|
25
25
|
/**
|
|
26
|
-
* Payment error
|
|
26
|
+
* Payment error -- returned when a payment request fails (HTTP 402).
|
|
27
27
|
* The parameters were valid but the request failed (e.g., card declined).
|
|
28
28
|
*/
|
|
29
|
-
export declare class PaymentError extends PaymentError_base {
|
|
29
|
+
export declare class PaymentError extends /*@__PURE__*/ PaymentError_base {
|
|
30
30
|
}
|
|
31
|
-
declare const CardError_base: Schema.
|
|
32
|
-
readonly message: Schema.optional<Schema.String>;
|
|
33
|
-
readonly code: Schema.optional<Schema.String>;
|
|
34
|
-
readonly decline_code: Schema.optional<Schema.String>;
|
|
35
|
-
readonly charge: Schema.optional<Schema.String>;
|
|
36
|
-
readonly param: Schema.optional<Schema.String>;
|
|
37
|
-
readonly doc_url: Schema.optional<Schema.String>;
|
|
38
|
-
readonly advice_code: Schema.optional<Schema.String>;
|
|
39
|
-
readonly network_advice_code: Schema.optional<Schema.String>;
|
|
40
|
-
readonly network_decline_code: Schema.optional<Schema.String>;
|
|
41
|
-
readonly payment_method_type: Schema.optional<Schema.String>;
|
|
42
|
-
readonly request_log_url: Schema.optional<Schema.String>;
|
|
43
|
-
}
|
|
31
|
+
declare const CardError_base: Schema.TaggedErrorClass<"CardError", {
|
|
32
|
+
readonly message: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
33
|
+
readonly code: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
34
|
+
readonly decline_code: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
35
|
+
readonly charge: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
36
|
+
readonly param: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
37
|
+
readonly doc_url: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
38
|
+
readonly advice_code: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
39
|
+
readonly network_advice_code: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
40
|
+
readonly network_decline_code: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
41
|
+
readonly payment_method_type: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
42
|
+
readonly request_log_url: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
43
|
+
}> & (new (...args: any[]) => {
|
|
44
44
|
"@distilled.cloud/error/categories": {
|
|
45
45
|
BadRequestError: true;
|
|
46
46
|
};
|
|
47
47
|
});
|
|
48
48
|
/**
|
|
49
|
-
* Card error
|
|
49
|
+
* Card error -- returned when a card cannot be charged.
|
|
50
50
|
* Stripe error type: "card_error"
|
|
51
51
|
*/
|
|
52
|
-
export declare class CardError extends CardError_base {
|
|
52
|
+
export declare class CardError extends /*@__PURE__*/ CardError_base {
|
|
53
53
|
}
|
|
54
|
-
declare const IdempotencyError_base: Schema.
|
|
55
|
-
readonly message: Schema.optional<Schema.String>;
|
|
56
|
-
readonly code: Schema.optional<Schema.String>;
|
|
57
|
-
readonly doc_url: Schema.optional<Schema.String>;
|
|
58
|
-
readonly request_log_url: Schema.optional<Schema.String>;
|
|
59
|
-
}
|
|
54
|
+
declare const IdempotencyError_base: Schema.TaggedErrorClass<"IdempotencyError", {
|
|
55
|
+
readonly message: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
56
|
+
readonly code: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
57
|
+
readonly doc_url: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
58
|
+
readonly request_log_url: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
59
|
+
}> & (new (...args: any[]) => {
|
|
60
60
|
"@distilled.cloud/error/categories": {
|
|
61
61
|
ConflictError: true;
|
|
62
62
|
};
|
|
63
63
|
});
|
|
64
64
|
/**
|
|
65
|
-
* Idempotency error
|
|
65
|
+
* Idempotency error -- returned when an Idempotency-Key is re-used
|
|
66
66
|
* on a request that does not match the first request's API endpoint and parameters.
|
|
67
67
|
* Stripe error type: "idempotency_error"
|
|
68
68
|
*/
|
|
69
|
-
export declare class IdempotencyError extends IdempotencyError_base {
|
|
69
|
+
export declare class IdempotencyError extends /*@__PURE__*/ IdempotencyError_base {
|
|
70
70
|
}
|
|
71
|
-
declare const InvalidRequestError_base: Schema.
|
|
72
|
-
readonly message: Schema.optional<Schema.String>;
|
|
73
|
-
readonly code: Schema.optional<Schema.String>;
|
|
74
|
-
readonly param: Schema.optional<Schema.String>;
|
|
75
|
-
readonly doc_url: Schema.optional<Schema.String>;
|
|
76
|
-
readonly request_log_url: Schema.optional<Schema.String>;
|
|
77
|
-
}
|
|
71
|
+
declare const InvalidRequestError_base: Schema.TaggedErrorClass<"InvalidRequestError", {
|
|
72
|
+
readonly message: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
73
|
+
readonly code: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
74
|
+
readonly param: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
75
|
+
readonly doc_url: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
76
|
+
readonly request_log_url: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
77
|
+
}> & (new (...args: any[]) => {
|
|
78
78
|
"@distilled.cloud/error/categories": {
|
|
79
79
|
BadRequestError: true;
|
|
80
80
|
};
|
|
81
81
|
});
|
|
82
82
|
/**
|
|
83
|
-
* Invalid request error
|
|
83
|
+
* Invalid request error -- returned when the request has invalid parameters.
|
|
84
84
|
* Stripe error type: "invalid_request_error"
|
|
85
85
|
*/
|
|
86
|
-
export declare class InvalidRequestError extends InvalidRequestError_base {
|
|
86
|
+
export declare class InvalidRequestError extends /*@__PURE__*/ InvalidRequestError_base {
|
|
87
87
|
}
|
|
88
|
-
declare const ApiError_base: Schema.
|
|
89
|
-
readonly message: Schema.optional<Schema.String>;
|
|
90
|
-
readonly code: Schema.optional<Schema.String>;
|
|
91
|
-
readonly param: Schema.optional<Schema.String>;
|
|
92
|
-
readonly doc_url: Schema.optional<Schema.String>;
|
|
93
|
-
readonly request_log_url: Schema.optional<Schema.String>;
|
|
94
|
-
}
|
|
88
|
+
declare const ApiError_base: Schema.TaggedErrorClass<"ApiError", {
|
|
89
|
+
readonly message: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
90
|
+
readonly code: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
91
|
+
readonly param: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
92
|
+
readonly doc_url: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
93
|
+
readonly request_log_url: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
94
|
+
}> & (new (...args: any[]) => {
|
|
95
95
|
"@distilled.cloud/error/categories": {
|
|
96
96
|
ServerError: true;
|
|
97
97
|
};
|
|
@@ -99,16 +99,16 @@ declare const ApiError_base: Schema.Class<ApiError, Schema.TaggedStruct<"ApiErro
|
|
|
99
99
|
"@distilled.cloud/error/retryable": Category.RetryableInfo;
|
|
100
100
|
});
|
|
101
101
|
/**
|
|
102
|
-
* API error
|
|
102
|
+
* API error -- returned when something goes wrong on Stripe's end (HTTP 500+).
|
|
103
103
|
* Stripe error type: "api_error"
|
|
104
104
|
*/
|
|
105
|
-
export declare class ApiError extends ApiError_base {
|
|
105
|
+
export declare class ApiError extends /*@__PURE__*/ ApiError_base {
|
|
106
106
|
}
|
|
107
|
-
declare const ExternalDependencyFailed_base: Schema.
|
|
108
|
-
readonly message: Schema.optional<Schema.String>;
|
|
109
|
-
readonly code: Schema.optional<Schema.String>;
|
|
110
|
-
readonly doc_url: Schema.optional<Schema.String>;
|
|
111
|
-
}
|
|
107
|
+
declare const ExternalDependencyFailed_base: Schema.TaggedErrorClass<"ExternalDependencyFailed", {
|
|
108
|
+
readonly message: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
109
|
+
readonly code: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
110
|
+
readonly doc_url: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
111
|
+
}> & (new (...args: any[]) => {
|
|
112
112
|
"@distilled.cloud/error/categories": {
|
|
113
113
|
ServerError: true;
|
|
114
114
|
};
|
|
@@ -116,9 +116,9 @@ declare const ExternalDependencyFailed_base: Schema.Class<ExternalDependencyFail
|
|
|
116
116
|
"@distilled.cloud/error/retryable": Category.RetryableInfo;
|
|
117
117
|
});
|
|
118
118
|
/**
|
|
119
|
-
* External dependency failed
|
|
119
|
+
* External dependency failed -- returned when an external dependency fails (HTTP 424).
|
|
120
120
|
*/
|
|
121
|
-
export declare class ExternalDependencyFailed extends ExternalDependencyFailed_base {
|
|
121
|
+
export declare class ExternalDependencyFailed extends /*@__PURE__*/ ExternalDependencyFailed_base {
|
|
122
122
|
}
|
|
123
123
|
/**
|
|
124
124
|
* Stripe HTTP status code to error class mapping.
|
|
@@ -128,33 +128,33 @@ export declare const STRIPE_HTTP_STATUS_MAP: {
|
|
|
128
128
|
readonly 402: typeof PaymentError;
|
|
129
129
|
readonly 424: typeof ExternalDependencyFailed;
|
|
130
130
|
};
|
|
131
|
-
declare const UnknownStripeError_base: Schema.
|
|
132
|
-
readonly type: Schema.optional<Schema.String>;
|
|
133
|
-
readonly code: Schema.optional<Schema.String>;
|
|
134
|
-
readonly message: Schema.optional<Schema.String>;
|
|
135
|
-
readonly param: Schema.optional<Schema.String>;
|
|
136
|
-
readonly body: Schema.Unknown;
|
|
137
|
-
}
|
|
131
|
+
declare const UnknownStripeError_base: Schema.TaggedErrorClass<"UnknownStripeError", {
|
|
132
|
+
readonly type: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
133
|
+
readonly code: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
134
|
+
readonly message: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
135
|
+
readonly param: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
136
|
+
readonly body: import("effect/Schema").Unknown;
|
|
137
|
+
}> & (new (...args: any[]) => {
|
|
138
138
|
"@distilled.cloud/error/categories": {
|
|
139
139
|
ServerError: true;
|
|
140
140
|
};
|
|
141
141
|
});
|
|
142
|
-
export declare class UnknownStripeError extends UnknownStripeError_base {
|
|
142
|
+
export declare class UnknownStripeError extends /*@__PURE__*/ UnknownStripeError_base {
|
|
143
143
|
}
|
|
144
|
-
declare const StripeParseError_base: Schema.
|
|
145
|
-
readonly body: Schema.Unknown;
|
|
146
|
-
readonly cause: Schema.Unknown;
|
|
147
|
-
}
|
|
144
|
+
declare const StripeParseError_base: Schema.TaggedErrorClass<"StripeParseError", {
|
|
145
|
+
readonly body: import("effect/Schema").Unknown;
|
|
146
|
+
readonly cause: import("effect/Schema").Unknown;
|
|
147
|
+
}> & (new (...args: any[]) => {
|
|
148
148
|
"@distilled.cloud/error/categories": {
|
|
149
149
|
ParseError: true;
|
|
150
150
|
};
|
|
151
151
|
});
|
|
152
|
-
export declare class StripeParseError extends StripeParseError_base {
|
|
152
|
+
export declare class StripeParseError extends /*@__PURE__*/ StripeParseError_base {
|
|
153
153
|
}
|
|
154
|
-
declare const StripeWebhookSignatureError_base: Schema.
|
|
155
|
-
readonly message: Schema.String;
|
|
156
|
-
readonly cause: Schema.optional<Schema.Unknown>;
|
|
157
|
-
}
|
|
154
|
+
declare const StripeWebhookSignatureError_base: Schema.TaggedErrorClass<"StripeWebhookSignatureError", {
|
|
155
|
+
readonly message: import("effect/Schema").String;
|
|
156
|
+
readonly cause: import("effect/Schema").optional<import("effect/Schema").Unknown>;
|
|
157
|
+
}> & (new (...args: any[]) => {
|
|
158
158
|
"@distilled.cloud/error/categories": {
|
|
159
159
|
AuthError: true;
|
|
160
160
|
};
|
|
@@ -165,12 +165,12 @@ declare const StripeWebhookSignatureError_base: Schema.Class<StripeWebhookSignat
|
|
|
165
165
|
* This is raised by the local webhook helpers when the Stripe-Signature header
|
|
166
166
|
* is missing, malformed, expired, or does not match the raw request payload.
|
|
167
167
|
*/
|
|
168
|
-
export declare class StripeWebhookSignatureError extends StripeWebhookSignatureError_base {
|
|
168
|
+
export declare class StripeWebhookSignatureError extends /*@__PURE__*/ StripeWebhookSignatureError_base {
|
|
169
169
|
}
|
|
170
|
-
declare const StripeWebhookPayloadParseError_base: Schema.
|
|
171
|
-
readonly message: Schema.String;
|
|
172
|
-
readonly cause: Schema.optional<Schema.Unknown>;
|
|
173
|
-
}
|
|
170
|
+
declare const StripeWebhookPayloadParseError_base: Schema.TaggedErrorClass<"StripeWebhookPayloadParseError", {
|
|
171
|
+
readonly message: import("effect/Schema").String;
|
|
172
|
+
readonly cause: import("effect/Schema").optional<import("effect/Schema").Unknown>;
|
|
173
|
+
}> & (new (...args: any[]) => {
|
|
174
174
|
"@distilled.cloud/error/categories": {
|
|
175
175
|
ParseError: true;
|
|
176
176
|
};
|
|
@@ -178,6 +178,6 @@ declare const StripeWebhookPayloadParseError_base: Schema.Class<StripeWebhookPay
|
|
|
178
178
|
/**
|
|
179
179
|
* Stripe webhook payload JSON parsing failed after signature verification.
|
|
180
180
|
*/
|
|
181
|
-
export declare class StripeWebhookPayloadParseError extends StripeWebhookPayloadParseError_base {
|
|
181
|
+
export declare class StripeWebhookPayloadParseError extends /*@__PURE__*/ StripeWebhookPayloadParseError_base {
|
|
182
182
|
}
|
|
183
183
|
//# sourceMappingURL=errors.d.ts.map
|
package/lib/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EACL,UAAU,EACV,UAAU,EACV,QAAQ,EACR,WAAW,EACX,SAAS,EACT,cAAc,EACd,mBAAmB,EACnB,MAAM,EACN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GAAG;aACH,GAAG;CACK,CAAC;;;;;;;;;;;;AAGX,qBAAa,kBACX,SAAQ,aAAa,CAAC,uBAMW;CAAG;;;;;;;;;AAGtC,qBAAa,gBACX,SAAQ,aAAa,CAAC,qBAGU;CAAG;;;;;;;;;AAErC;;;;;GAKG;AACH,qBAAa,2BACX,SAAQ,aAAa,CAAC,gCAMQ;CAAG;;;;;;;;;AAEnC;;GAEG;AACH,qBAAa,8BACX,SAAQ,aAAa,CAAC,mCAMS;CAAG"}
|
package/lib/errors.js
CHANGED
|
@@ -1,130 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Stripe-specific error types.
|
|
3
|
-
*
|
|
4
|
-
* Re-exports common HTTP errors from core and adds Stripe-specific error
|
|
5
|
-
* matching and API error types. Ported from distilled v0's stripe errors
|
|
6
|
-
* module.
|
|
7
|
-
*/
|
|
8
|
-
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";
|
|
9
|
-
import * as Category from "@distilled.cloud/core/category";
|
|
10
|
-
import * as Schema from "effect/Schema";
|
|
11
|
-
/**
|
|
12
|
-
* Payment error — returned when a payment request fails (HTTP 402).
|
|
13
|
-
* The parameters were valid but the request failed (e.g., card declined).
|
|
14
|
-
*/
|
|
15
|
-
export class PaymentError extends Schema.TaggedError()("PaymentError", {
|
|
16
|
-
message: Schema.optional(Schema.String),
|
|
17
|
-
code: Schema.optional(Schema.String),
|
|
18
|
-
decline_code: Schema.optional(Schema.String),
|
|
19
|
-
charge: Schema.optional(Schema.String),
|
|
20
|
-
param: Schema.optional(Schema.String),
|
|
21
|
-
doc_url: Schema.optional(Schema.String),
|
|
22
|
-
request_log_url: Schema.optional(Schema.String),
|
|
23
|
-
}).pipe(Category.withBadRequestError) {
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Card error — returned when a card cannot be charged.
|
|
27
|
-
* Stripe error type: "card_error"
|
|
28
|
-
*/
|
|
29
|
-
export class CardError extends Schema.TaggedError()("CardError", {
|
|
30
|
-
message: Schema.optional(Schema.String),
|
|
31
|
-
code: Schema.optional(Schema.String),
|
|
32
|
-
decline_code: Schema.optional(Schema.String),
|
|
33
|
-
charge: Schema.optional(Schema.String),
|
|
34
|
-
param: Schema.optional(Schema.String),
|
|
35
|
-
doc_url: Schema.optional(Schema.String),
|
|
36
|
-
advice_code: Schema.optional(Schema.String),
|
|
37
|
-
network_advice_code: Schema.optional(Schema.String),
|
|
38
|
-
network_decline_code: Schema.optional(Schema.String),
|
|
39
|
-
payment_method_type: Schema.optional(Schema.String),
|
|
40
|
-
request_log_url: Schema.optional(Schema.String),
|
|
41
|
-
}).pipe(Category.withBadRequestError) {
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Idempotency error — returned when an Idempotency-Key is re-used
|
|
45
|
-
* on a request that does not match the first request's API endpoint and parameters.
|
|
46
|
-
* Stripe error type: "idempotency_error"
|
|
47
|
-
*/
|
|
48
|
-
export class IdempotencyError extends Schema.TaggedError()("IdempotencyError", {
|
|
49
|
-
message: Schema.optional(Schema.String),
|
|
50
|
-
code: Schema.optional(Schema.String),
|
|
51
|
-
doc_url: Schema.optional(Schema.String),
|
|
52
|
-
request_log_url: Schema.optional(Schema.String),
|
|
53
|
-
}).pipe(Category.withConflictError) {
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Invalid request error — returned when the request has invalid parameters.
|
|
57
|
-
* Stripe error type: "invalid_request_error"
|
|
58
|
-
*/
|
|
59
|
-
export class InvalidRequestError extends Schema.TaggedError()("InvalidRequestError", {
|
|
60
|
-
message: Schema.optional(Schema.String),
|
|
61
|
-
code: Schema.optional(Schema.String),
|
|
62
|
-
param: Schema.optional(Schema.String),
|
|
63
|
-
doc_url: Schema.optional(Schema.String),
|
|
64
|
-
request_log_url: Schema.optional(Schema.String),
|
|
65
|
-
}).pipe(Category.withBadRequestError) {
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* API error — returned when something goes wrong on Stripe's end (HTTP 500+).
|
|
69
|
-
* Stripe error type: "api_error"
|
|
70
|
-
*/
|
|
71
|
-
export class ApiError extends Schema.TaggedError()("ApiError", {
|
|
72
|
-
message: Schema.optional(Schema.String),
|
|
73
|
-
code: Schema.optional(Schema.String),
|
|
74
|
-
param: Schema.optional(Schema.String),
|
|
75
|
-
doc_url: Schema.optional(Schema.String),
|
|
76
|
-
request_log_url: Schema.optional(Schema.String),
|
|
77
|
-
}).pipe(Category.withServerError, Category.withRetryable()) {
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* External dependency failed — returned when an external dependency fails (HTTP 424).
|
|
81
|
-
*/
|
|
82
|
-
export class ExternalDependencyFailed extends Schema.TaggedError()("ExternalDependencyFailed", {
|
|
83
|
-
message: Schema.optional(Schema.String),
|
|
84
|
-
code: Schema.optional(Schema.String),
|
|
85
|
-
doc_url: Schema.optional(Schema.String),
|
|
86
|
-
}).pipe(Category.withServerError, Category.withRetryable()) {
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Stripe HTTP status code to error class mapping.
|
|
90
|
-
* Extends core HTTP_STATUS_MAP with Stripe-specific statuses.
|
|
91
|
-
*/
|
|
92
|
-
export const STRIPE_HTTP_STATUS_MAP = {
|
|
93
|
-
402: PaymentError,
|
|
94
|
-
424: ExternalDependencyFailed,
|
|
95
|
-
};
|
|
96
|
-
// Unknown Stripe error — returned when an error type is not recognized
|
|
97
|
-
export class UnknownStripeError extends Schema.TaggedError()("UnknownStripeError", {
|
|
98
|
-
type: Schema.optional(Schema.String),
|
|
99
|
-
code: Schema.optional(Schema.String),
|
|
100
|
-
message: Schema.optional(Schema.String),
|
|
101
|
-
param: Schema.optional(Schema.String),
|
|
102
|
-
body: Schema.Unknown,
|
|
103
|
-
}).pipe(Category.withServerError) {
|
|
104
|
-
}
|
|
105
|
-
// Schema parse error wrapper
|
|
106
|
-
export class StripeParseError extends Schema.TaggedError()("StripeParseError", {
|
|
107
|
-
body: Schema.Unknown,
|
|
108
|
-
cause: Schema.Unknown,
|
|
109
|
-
}).pipe(Category.withParseError) {
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* Stripe webhook signature verification failed.
|
|
113
|
-
*
|
|
114
|
-
* This is raised by the local webhook helpers when the Stripe-Signature header
|
|
115
|
-
* is missing, malformed, expired, or does not match the raw request payload.
|
|
116
|
-
*/
|
|
117
|
-
export class StripeWebhookSignatureError extends Schema.TaggedError()("StripeWebhookSignatureError", {
|
|
118
|
-
message: Schema.String,
|
|
119
|
-
cause: Schema.optional(Schema.Unknown),
|
|
120
|
-
}).pipe(Category.withAuthError) {
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Stripe webhook payload JSON parsing failed after signature verification.
|
|
124
|
-
*/
|
|
125
|
-
export class StripeWebhookPayloadParseError extends Schema.TaggedError()("StripeWebhookPayloadParseError", {
|
|
126
|
-
message: Schema.String,
|
|
127
|
-
cause: Schema.optional(Schema.Unknown),
|
|
128
|
-
}).pipe(Category.withParseError) {
|
|
129
|
-
}
|
|
130
|
-
//# sourceMappingURL=errors.js.map
|
|
1
|
+
export { errors$API_ERRORS as API_ERRORS, errors$ApiError as ApiError, errors$BadGateway as BadGateway, errors$BadRequest as BadRequest, errors$CardError as CardError, errors$ConfigError as ConfigError, errors$Conflict as Conflict, errors$DEFAULT_ERRORS as DEFAULT_ERRORS, errors$ExternalDependencyFailed as ExternalDependencyFailed, errors$Forbidden as Forbidden, errors$GatewayTimeout as GatewayTimeout, errors$HTTP_STATUS_MAP as HTTP_STATUS_MAP, errors$IdempotencyError as IdempotencyError, errors$InternalServerError as InternalServerError, errors$InvalidRequestError as InvalidRequestError, errors$Locked as Locked, errors$NotFound as NotFound, errors$PaymentError as PaymentError, errors$STRIPE_HTTP_STATUS_MAP as STRIPE_HTTP_STATUS_MAP, errors$ServiceUnavailable as ServiceUnavailable, errors$StripeParseError as StripeParseError, errors$StripeWebhookPayloadParseError as StripeWebhookPayloadParseError, errors$StripeWebhookSignatureError as StripeWebhookSignatureError, errors$TooManyRequests as TooManyRequests, errors$Unauthorized as Unauthorized, errors$UnknownStripeError as UnknownStripeError, errors$UnprocessableEntity as UnprocessableEntity } from "./_bundle/sdk.js";
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -1,21 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @distilled.cloud/stripe — Stripe SDK for Effect.
|
|
3
|
-
*
|
|
4
|
-
* `./services` is generated by `scripts/generate.ts` from the Smithy model
|
|
5
|
-
* in `.generated-specs` (written by `scripts/convert.ts` from the Stripe
|
|
6
|
-
* OpenAPI SDK spec). Everything else in this folder is hand-written.
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* ```ts
|
|
10
|
-
* import * as Stripe from "@distilled.cloud/stripe";
|
|
11
|
-
* ```
|
|
12
|
-
*/
|
|
13
1
|
export * from "./credentials.js";
|
|
14
2
|
export * from "./errors.js";
|
|
15
3
|
export * as T from "./traits.js";
|
|
16
|
-
export { StripeProtocol, RequestOptions, withRequestOptions
|
|
4
|
+
export { StripeProtocol, RequestOptions, withRequestOptions } from "./protocol.js";
|
|
17
5
|
export { stripeSearchPaginate } from "./pagination.js";
|
|
18
6
|
export * as Retry from "./retry.js";
|
|
19
7
|
export * as Webhooks from "./webhooks.js";
|
|
20
8
|
export * as Services from "./services/index.js";
|
|
21
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from "./credentials.js";
|
|
2
|
+
export * from "./errors.js";
|
|
3
|
+
export * as T from "./traits.js";
|
|
4
|
+
export { StripeProtocol, RequestOptions, withRequestOptions } from "./protocol.js";
|
|
5
|
+
export { stripeSearchPaginate } from "./pagination.js";
|
|
6
|
+
export * as Retry from "./retry.js";
|
|
7
|
+
export * as Webhooks from "./webhooks.js";
|
|
8
|
+
export * as Services from "./services.lazy/index.js";
|
package/lib/pagination.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Stripe pagination
|
|
2
|
+
* Stripe pagination -- hand-written.
|
|
3
3
|
*
|
|
4
|
-
* Only the GET
|
|
4
|
+
* Only the GET .../search operations paginate (v0 parity): the converter
|
|
5
5
|
* detects them as `mode: "page"` (inputToken `page`, outputToken
|
|
6
6
|
* `next_page`, items `data`), but Stripe's `page` parameter is an OPAQUE
|
|
7
|
-
* CURSOR
|
|
7
|
+
* CURSOR -- `next_page` is the next cursor string, not a page number -- so
|
|
8
8
|
* "page" mode traverses by following the cursor, exactly core's
|
|
9
9
|
* `paginateCursor` semantics.
|
|
10
10
|
*
|