@distilled.cloud/porkbun 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 +2 -2
- package/lib/credentials.d.ts.map +1 -1
- package/lib/credentials.js +1 -47
- package/lib/errors.d.ts +15 -15
- package/lib/errors.d.ts.map +1 -1
- package/lib/errors.js +1 -26
- package/lib/index.d.ts +1 -1
- package/lib/index.js +0 -19
- package/lib/index.lazy.js +9 -0
- package/lib/{index.js.map → index.lazy.js.map} +1 -1
- package/lib/pagination.d.ts +1 -1
- package/lib/pagination.js +1 -9
- package/lib/protocol.d.ts.map +1 -1
- package/lib/protocol.js +1 -55
- 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/porkbun.d.ts +84 -527
- package/lib/services/porkbun.d.ts.map +1 -1
- package/lib/services/porkbun.js +161 -3022
- package/lib/services/porkbun.js.map +1 -1
- package/lib/services.lazy/index.js +3 -0
- package/lib/services.lazy/porkbun.js +4 -0
- package/lib/traits.d.ts +1 -1
- package/lib/traits.js +1 -11
- package/package.json +9 -7
- package/src/credentials.ts +7 -6
- package/src/errors.ts +12 -16
- package/src/index.ts +2 -2
- package/src/pagination.ts +1 -1
- package/src/protocol.ts +5 -8
- package/src/retry.ts +6 -4
- package/src/services/porkbun.ts +3159 -3474
- package/src/traits.ts +1 -1
- 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/retry.js.map +0 -1
- package/lib/services/index.js.map +0 -1
- package/lib/traits.js.map +0 -1
package/lib/.lazy.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"serviceDirs":["services"],"twins":["index.js"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{errors$API_ERRORS as e,errors$BadGateway as t,errors$BadRequest as n,errors$ConfigError as r,errors$Conflict as i,errors$DEFAULT_ERRORS as a,errors$Forbidden as o,errors$GatewayTimeout as ee,errors$HTTP_STATUS_MAP as te,errors$InternalServerError as ne,errors$Locked as re,errors$NotFound as ie,errors$ServiceUnavailable as s,errors$TooManyRequests as c,errors$Unauthorized as l,errors$UnprocessableEntity as u,protocol_rest$RawResponse as d,protocol_rest$RawResponseRoot as f,protocol_rest$SensitiveValue as p,protocol_rest$makeRestProtocol as m,protocol_rest$rawResponseRootSymbol as h,protocol_rest$rawResponseSymbol as g,protocol_rest$sensitiveValueSymbol as _,schema_lite$Array as v,schema_lite$Boolean as y,schema_lite$NullOr as b,schema_lite$Number as x,schema_lite$Record as S,schema_lite$String as C,schema_lite$Struct as w,schema_lite$TaggedError as T,schema_lite$Unknown as E,schema_lite$at as D,schema_lite$optional as O,schema_lite$suspend as k}from"@distilled.cloud/core/_bundle/rest";import{api$D as A,api$call as j,api$error as M,api$named as N,api$newError as P,api$op as F,category$withAuthError as I,category$withBadRequestError as L,category$withConflictError as R,category$withParseError as z,category$withServerError as B,retry$capped as V,retry$jittered as H,retry$makeDefault as U,retry$throttlingFactory as W,retry$throttlingOptions as G,retry$transientFactory as K,retry$transientOptions as ae,trait$Body as q,trait$FormDataFile as J,trait$Header as oe,trait$Http as se,trait$HttpBody as ce,trait$KeyDictionary as le,trait$Label as ue,trait$Query as de,trait$ResponseCode as fe,trait$UnionCases as pe,trait$applyErrorMatchers as me,trait$bodySymbol as he,trait$errorMatchersSymbol as ge,trait$formDataFileSymbol as _e,trait$getErrorMatchers as ve,trait$headerSymbol as ye,trait$httpBodySymbol as be,trait$httpSymbol as xe,trait$keyDictionarySymbol as Se,trait$labelSymbol as Ce,trait$querySymbol as we,trait$responseCodeSymbol as Te,trait$unionCasesSymbol as Ee}from"@distilled.cloud/core/_bundle/base";import*as Y from"effect/Context";import*as X from"effect/Effect";import*as Z from"effect/Layer";import*as Q from"effect/Redacted";import*as $ from"@distilled.cloud/core/schema-lite-typed";const De=`https://api.porkbun.com/api/json/v3`;var Credentials=class extends (/*@__PURE__*/ Y.Service()(`PorkbunCredentials`)){};const formatHeaders=e=>({"X-API-Key":Q.value(e.apiKey),"X-Secret-API-Key":Q.value(e.secretApiKey)});const fromApiKey=e=>Z.succeed(Credentials,X.succeed({apiKey:e.apiKey,secretApiKey:e.secretApiKey,apiBaseUrl:e.apiBaseUrl??`https://api.porkbun.com/api/json/v3`}));const Oe=/*@__PURE__*/ Z.succeed(Credentials,/*@__PURE__*/ X.gen(function*(){const e=process.env.PORKBUN_API_KEY;const t=process.env.PORKBUN_SECRET_API_KEY;if(!e||!t)return yield*new r({message:`PORKBUN_API_KEY and PORKBUN_SECRET_API_KEY environment variables are required`});return{apiKey:Q.make(e),secretApiKey:Q.make(t),apiBaseUrl:process.env.PORKBUN_API_BASE_URL??`https://api.porkbun.com/api/json/v3`}}).pipe(X.orDie));var UnknownPorkbunError=class extends (/*@__PURE__*/ $.TaggedError()(`UnknownPorkbunError`,{code:/*@__PURE__*/ $.optional($.String),message:/*@__PURE__*/ $.optional($.String),body:$.Unknown}).pipe(B)){};var PorkbunParseError=class extends (/*@__PURE__*/ $.TaggedError()(`PorkbunParseError`,{body:$.Unknown,cause:$.Unknown}).pipe(z)){};const errorEnvelope=e=>{if(e===null||typeof e!==`object`)return void 0;const t=e;const n=t.code;const r=t.message;if(typeof n!==`string`&&typeof r!==`string`)return void 0;return{code:typeof n===`string`?n:void 0,message:typeof r===`string`?r:void 0}};const ke=/*@__PURE__*/ m({credentials:/*@__PURE__*/ X.flatMap(Credentials,e=>e),baseUrl:e=>e.apiBaseUrl,headers:e=>formatHeaders(e),errorEnvelope,unknownError:({code:e,message:t,body:n})=>new UnknownPorkbunError({code:typeof e===`string`?e:e!==void 0?String(e):void 0,message:t,body:n}),parseError:({body:e,cause:t})=>new PorkbunParseError({body:e,cause:t})});var Retry=class extends (/*@__PURE__*/ Y.Service()(`PorkbunRetry`)){};const policy=e=>X.provide(Z.succeed(Retry,e));const Ae=/*@__PURE__*/ X.provide(/*@__PURE__*/ Z.succeed(Retry,{while:()=>false}));const je=/*@__PURE__*/ policy(W);const Me=/*@__PURE__*/ policy(K);export{P as _,S as a,L as b,T as c,Credentials as credentials$Credentials,Oe as credentials$CredentialsFromEnv,De as credentials$DEFAULT_API_BASE_URL,formatHeaders as credentials$formatHeaders,fromApiKey as credentials$fromApiKey,O as d,e as errors$API_ERRORS,t as errors$BadGateway,n as errors$BadRequest,r as errors$ConfigError,i as errors$Conflict,a as errors$DEFAULT_ERRORS,o as errors$Forbidden,ee as errors$GatewayTimeout,te as errors$HTTP_STATUS_MAP,ne as errors$InternalServerError,re as errors$Locked,ie as errors$NotFound,PorkbunParseError as errors$PorkbunParseError,s as errors$ServiceUnavailable,c as errors$TooManyRequests,l as errors$Unauthorized,UnknownPorkbunError as errors$UnknownPorkbunError,u as errors$UnprocessableEntity,k as f,N as g,M as h,x as i,E as l,j as m,y as n,C as o,A as p,ke as protocol$PorkbunProtocol,b as r,Retry as retry$Retry,V as retry$capped,H as retry$jittered,U as retry$makeDefault,Ae as retry$none,policy as retry$policy,je as retry$throttling,W as retry$throttlingFactory,G as retry$throttlingOptions,Me as retry$transient,K as retry$transientFactory,ae as retry$transientOptions,w as s,v as t,q as traits$Body,J as traits$FormDataFile,oe as traits$Header,se as traits$Http,ce as traits$HttpBody,le as traits$KeyDictionary,ue as traits$Label,de as traits$Query,d as traits$RawResponse,f as traits$RawResponseRoot,fe as traits$ResponseCode,p as traits$SensitiveValue,pe as traits$UnionCases,me as traits$applyErrorMatchers,he as traits$bodySymbol,ge as traits$errorMatchersSymbol,_e as traits$formDataFileSymbol,ve as traits$getErrorMatchers,ye as traits$headerSymbol,be as traits$httpBodySymbol,xe as traits$httpSymbol,Se as traits$keyDictionarySymbol,Ce as traits$labelSymbol,we as traits$querySymbol,h as traits$rawResponseRootSymbol,g as traits$rawResponseSymbol,Te as traits$responseCodeSymbol,_ as traits$sensitiveValueSymbol,Ee as traits$unionCasesSymbol,D as u,F as v,R as x,I as y};
|
|
2
|
+
//# sourceMappingURL=sdk.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sdk.js","names":["Category.withServerError","Category.withParseError","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","Record","String$1","Struct","TaggedError","Unknown","at","optional","suspend","D","call","error","named","newError","op","withAuthError","withBadRequestError","withConflictError","withParseError","withServerError","capped","jittered","makeDefault","throttlingFactory","throttlingOptions","transientFactory","transientOptions","Body","FormDataFile","Header","Http","HttpBody","KeyDictionary","Label","Query","ResponseCode","UnionCases","applyErrorMatchers","bodySymbol","errorMatchersSymbol","formDataFileSymbol","getErrorMatchers","headerSymbol","httpBodySymbol","httpSymbol","keyDictionarySymbol","labelSymbol","querySymbol","responseCodeSymbol","unionCasesSymbol","Context","Effect","Layer","Redacted","Schema","DEFAULT_API_BASE_URL","config","CredentialsFromEnv","apiKey","secretApiKey","body","obj","code","message","PorkbunProtocol","resolve","creds","optionsOrFactory","none","throttling","transient"],"sources":["../../src/credentials.ts","../../src/errors.ts","../../src/protocol.ts","../../src/retry.ts"],"mappings":"grEAeA,MAAamF,GAAuB,sCAQpC,IAAa,YAAb,eACwB,gBAAQ,QAA4C,CAAC,CACzE,oBACF,EAAA,AAAE,CAAC,EAGL,MAAa,cAAiB,IAA4C,CACxE,YAAaF,EAAS,MAAMG,EAAO,MAAM,EACzC,mBAAoBH,EAAS,MAAMG,EAAO,YAAY,CACxD,GAGA,MAAa,WAAc,GAKzBJ,EAAM,QACJ,YACAD,EAAO,QAAQ,CACb,OAAQK,EAAO,OACf,aAAcA,EAAO,aACrB,WAAYA,EAAO,YAAA,qCACrB,CAAC,CACH,EAMF,MAAaC,GAA6D,gBAAM,QAC9E,YACc,gBAAO,IAAI,WAAa,CACpC,MAAMC,EAAS,QAAQ,IAAI,gBAC3B,MAAMC,EAAe,QAAQ,IAAI,uBAEjC,GAAI,CAACD,GAAU,CAACC,EACd,OAAO,MAAO,IAAIlF,EAAY,CAC5B,QAAS,+EACX,CAAC,EAGH,MAAO,CACL,OAAQ4E,EAAS,KAAKK,CAAM,EAC5B,aAAcL,EAAS,KAAKM,CAAY,EACxC,WAAY,QAAQ,IAAI,sBAAA,qCAC1B,CACF,CAAC,CAAC,CAAC,KAAKR,EAAO,KAAK,CACtB,ECtCA,IAAa,oBAAb,eACwB,gBAAO,YAAiC,CAAC,CAAC,sBAAuB,CACrF,KAAoB,gBAAO,SAASG,EAAO,MAAM,EACjD,QAAuB,gBAAO,SAASA,EAAO,MAAM,EACpD,KAAMA,EAAO,OACf,CAAC,CAAC,CAAC,KAAKlF,CAAwB,EAAA,AAAE,CAAC,EAGrC,IAAa,kBAAb,eACwB,gBAAO,YAA+B,CAAC,CAAC,oBAAqB,CACjF,KAAMkF,EAAO,QACb,MAAOA,EAAO,OAChB,CAAC,CAAC,CAAC,KAAKjF,CAAuB,EAAA,AAAE,CAAC,ECCpC,MAAM,cAAiB,GAAiD,CACtE,GAAIuF,IAAS,MAAQ,OAAOA,IAAS,SAAU,OAAO,IAAA,GACtD,MAAMC,EAAMD,EACZ,MAAME,EAAOD,EAAI,KACjB,MAAME,EAAUF,EAAI,QACpB,GAAI,OAAOC,IAAS,UAAY,OAAOC,IAAY,SAAU,OAAO,IAAA,GACpE,MAAO,CACL,KAAM,OAAOD,IAAS,SAAWA,EAAO,IAAA,GACxC,QAAS,OAAOC,IAAY,SAAWA,EAAU,IAAA,EACnD,CACF,EAEA,MAAaC,GAA2D,gBAAyB,CAG/F,YAA2B,gBAAO,QAAQ,YAAc,GAAYC,CAAO,EAC3E,QAAU,GAAUC,EAAM,WAC1B,QAAU,GAAU,cAAcA,CAAK,EACvC,cACA,cAAe,CAAE,OAAM,UAAS,UAC9B,IAAI,oBAAoB,CACtB,KAAM,OAAOJ,IAAS,SAAWA,EAAOA,IAAS,IAAA,GAAY,OAAOA,CAAI,EAAI,IAAA,GAC5E,UACA,MACF,CAAC,EACH,YAAa,CAAE,OAAM,WAAY,IAAI,kBAAkB,CAAE,OAAM,OAAM,CAAC,CACxE,CAAC,ECtCD,IAAa,MAAb,eAAyC,gBAAQ,QAAuB,CAAC,CAAC,cAAc,EAAA,AAAE,CAAC,EAG3F,MAAa,OAAU,GACrBX,EAAO,QAAQC,EAAM,QAAQ,MAAOe,CAAgB,CAAC,EAGvD,MAAaC,GAAqB,gBAAO,QACzB,gBAAM,QAAQ,MAAO,CAAE,UAAa,KAAM,CAAC,CAC3D,EAGA,MAAaC,GAA2B,qBAAO9C,CAAiB,EAGhE,MAAa+C,GAA0B,qBAAO7C,CAAgB"}
|
package/lib/credentials.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Porkbun credentials
|
|
2
|
+
* Porkbun credentials -- hand-written.
|
|
3
3
|
*
|
|
4
4
|
* Porkbun authenticates with a public API key and a secret API key, sent as
|
|
5
5
|
* `X-API-Key` / `X-Secret-API-Key` (header auth; the JSON-body form is
|
|
@@ -18,7 +18,7 @@ export interface Config {
|
|
|
18
18
|
readonly apiBaseUrl: string;
|
|
19
19
|
}
|
|
20
20
|
declare const Credentials_base: Context.ServiceClass<Credentials, "PorkbunCredentials", Effect.Effect<Config, never, never>>;
|
|
21
|
-
export declare class Credentials extends Credentials_base {
|
|
21
|
+
export declare class Credentials extends /*@__PURE__*/ Credentials_base {
|
|
22
22
|
}
|
|
23
23
|
/** Auth headers for a resolved credentials config. */
|
|
24
24
|
export declare const formatHeaders: (config: Config) => Record<string, string>;
|
package/lib/credentials.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../src/credentials.ts"],"names":[],"mappings":"AACA;;;;;;;;GAQG;AACH,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,wCAAwC,CAAC;AAE1E,MAAM,WAAW,MAAM;IACrB,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC3C,QAAQ,CAAC,YAAY,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IACjD,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;;AAED,qBAAa,
|
|
1
|
+
{"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../src/credentials.ts"],"names":[],"mappings":"AACA;;;;;;;;GAQG;AACH,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,wCAAwC,CAAC;AAE1E,MAAM,WAAW,MAAM;IACrB,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC3C,QAAQ,CAAC,YAAY,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IACjD,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;;AAED,qBAAa,WACX,SAAQ,aAAa,CAAC,gBAErB;CAAG;AAEN,sDAAsD;AACtD,eAAO,MAAM,aAAa,WAAY,MAAM,KAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAGlE,CAAC;AAEH,8DAA8D;AAC9D,eAAO,MAAM,UAAU,WAAY;IACjC,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC3C,QAAQ,CAAC,YAAY,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IACjD,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC9B,KAAG,KAAK,CAAC,KAAK,CAAC,WAAW,CAQxB,CAAC;AAEJ;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,KAAK,CAAC,WAAW,CAkBvD,CAAC"}
|
package/lib/credentials.js
CHANGED
|
@@ -1,47 +1 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* Porkbun credentials — hand-written.
|
|
4
|
-
*
|
|
5
|
-
* Porkbun authenticates with a public API key and a secret API key, sent as
|
|
6
|
-
* `X-API-Key` / `X-Secret-API-Key` (header auth; the JSON-body form is
|
|
7
|
-
* equivalent). The `Credentials` service holds an *effect* that resolves the
|
|
8
|
-
* current credentials on every request (the protocol layer resolves it per
|
|
9
|
-
* request on the calling fiber).
|
|
10
|
-
*/
|
|
11
|
-
import * as Context from "effect/Context";
|
|
12
|
-
import * as Effect from "effect/Effect";
|
|
13
|
-
import * as Layer from "effect/Layer";
|
|
14
|
-
import * as Redacted from "effect/Redacted";
|
|
15
|
-
export const DEFAULT_API_BASE_URL = "https://api.porkbun.com/api/json/v3";
|
|
16
|
-
export class Credentials extends Context.Service()("PorkbunCredentials") {
|
|
17
|
-
}
|
|
18
|
-
/** Auth headers for a resolved credentials config. */
|
|
19
|
-
export const formatHeaders = (config) => ({
|
|
20
|
-
"X-API-Key": Redacted.value(config.apiKey),
|
|
21
|
-
"X-Secret-API-Key": Redacted.value(config.secretApiKey),
|
|
22
|
-
});
|
|
23
|
-
/** Layer from a redacted API key pair + optional base URL. */
|
|
24
|
-
export const fromApiKey = (config) => Layer.succeed(Credentials, Effect.succeed({
|
|
25
|
-
apiKey: config.apiKey,
|
|
26
|
-
secretApiKey: config.secretApiKey,
|
|
27
|
-
apiBaseUrl: config.apiBaseUrl ?? DEFAULT_API_BASE_URL,
|
|
28
|
-
}));
|
|
29
|
-
/**
|
|
30
|
-
* Reads PORKBUN_API_KEY and PORKBUN_SECRET_API_KEY (required) and
|
|
31
|
-
* PORKBUN_API_BASE_URL (optional).
|
|
32
|
-
*/
|
|
33
|
-
export const CredentialsFromEnv = Layer.succeed(Credentials, Effect.gen(function* () {
|
|
34
|
-
const apiKey = process.env.PORKBUN_API_KEY;
|
|
35
|
-
const secretApiKey = process.env.PORKBUN_SECRET_API_KEY;
|
|
36
|
-
if (!apiKey || !secretApiKey) {
|
|
37
|
-
return yield* new ConfigError({
|
|
38
|
-
message: "PORKBUN_API_KEY and PORKBUN_SECRET_API_KEY environment variables are required",
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
return {
|
|
42
|
-
apiKey: Redacted.make(apiKey),
|
|
43
|
-
secretApiKey: Redacted.make(secretApiKey),
|
|
44
|
-
apiBaseUrl: process.env.PORKBUN_API_BASE_URL ?? DEFAULT_API_BASE_URL,
|
|
45
|
-
};
|
|
46
|
-
}).pipe(Effect.orDie));
|
|
47
|
-
//# 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$formatHeaders as formatHeaders, credentials$fromApiKey as fromApiKey } from "./_bundle/sdk.js";
|
package/lib/errors.d.ts
CHANGED
|
@@ -3,34 +3,34 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Re-exports the common HTTP errors from core and adds the Porkbun fallback
|
|
5
5
|
* errors. Note the generated service module additionally defines its own
|
|
6
|
-
* per-status matcher classes (BadRequest/NotFound
|
|
7
|
-
* operation declares
|
|
6
|
+
* per-status matcher classes (BadRequest/NotFound/...) for the statuses each
|
|
7
|
+
* operation declares -- those share `_tag`s with the core classes here, so
|
|
8
8
|
* `catchTag` works against either.
|
|
9
9
|
*/
|
|
10
10
|
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";
|
|
11
11
|
export type { DefaultErrors } from "@distilled.cloud/core/errors";
|
|
12
|
-
import * as Schema from "
|
|
13
|
-
declare const UnknownPorkbunError_base: Schema.
|
|
14
|
-
readonly code: Schema.optional<Schema.String>;
|
|
15
|
-
readonly message: Schema.optional<Schema.String>;
|
|
16
|
-
readonly body: Schema.Unknown;
|
|
17
|
-
}
|
|
12
|
+
import * as Schema from "@distilled.cloud/core/schema-lite-typed";
|
|
13
|
+
declare const UnknownPorkbunError_base: Schema.TaggedErrorClass<"UnknownPorkbunError", {
|
|
14
|
+
readonly code: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
15
|
+
readonly message: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
16
|
+
readonly body: import("effect/Schema").Unknown;
|
|
17
|
+
}> & (new (...args: any[]) => {
|
|
18
18
|
"@distilled.cloud/error/categories": {
|
|
19
19
|
ServerError: true;
|
|
20
20
|
};
|
|
21
21
|
});
|
|
22
|
-
/** Unknown Porkbun error
|
|
23
|
-
export declare class UnknownPorkbunError extends UnknownPorkbunError_base {
|
|
22
|
+
/** Unknown Porkbun error -- returned when nothing else matches the failure. */
|
|
23
|
+
export declare class UnknownPorkbunError extends /*@__PURE__*/ UnknownPorkbunError_base {
|
|
24
24
|
}
|
|
25
|
-
declare const PorkbunParseError_base: Schema.
|
|
26
|
-
readonly body: Schema.Unknown;
|
|
27
|
-
readonly cause: Schema.Unknown;
|
|
28
|
-
}
|
|
25
|
+
declare const PorkbunParseError_base: Schema.TaggedErrorClass<"PorkbunParseError", {
|
|
26
|
+
readonly body: import("effect/Schema").Unknown;
|
|
27
|
+
readonly cause: import("effect/Schema").Unknown;
|
|
28
|
+
}> & (new (...args: any[]) => {
|
|
29
29
|
"@distilled.cloud/error/categories": {
|
|
30
30
|
ParseError: true;
|
|
31
31
|
};
|
|
32
32
|
});
|
|
33
33
|
/** Schema parse error wrapper. */
|
|
34
|
-
export declare class PorkbunParseError extends PorkbunParseError_base {
|
|
34
|
+
export declare class PorkbunParseError extends /*@__PURE__*/ PorkbunParseError_base {
|
|
35
35
|
}
|
|
36
36
|
//# 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;;;;;;;;GAQG;AACH,OAAO,EACL,UAAU,EACV,UAAU,EACV,QAAQ,EACR,WAAW,EACX,SAAS,EACT,cAAc,EACd,mBAAmB,EACnB,MAAM,EACN,QAAQ,EACR,kBAAkB,EAClB,eAAe,EACf,YAAY,EACZ,mBAAmB,EACnB,eAAe,EACf,cAAc,EACd,UAAU,GACX,MAAM,8BAA8B,CAAC;AACtC,YAAY,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAGlE,OAAO,KAAK,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EACL,UAAU,EACV,UAAU,EACV,QAAQ,EACR,WAAW,EACX,SAAS,EACT,cAAc,EACd,mBAAmB,EACnB,MAAM,EACN,QAAQ,EACR,kBAAkB,EAClB,eAAe,EACf,YAAY,EACZ,mBAAmB,EACnB,eAAe,EACf,cAAc,EACd,UAAU,GACX,MAAM,8BAA8B,CAAC;AACtC,YAAY,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAGlE,OAAO,KAAK,MAAM,MAAM,yCAAyC,CAAC;;;;;;;;;;AAElE,+EAA+E;AAC/E,qBAAa,mBACX,SAAQ,aAAa,CAAC,wBAIW;CAAG;;;;;;;;;AAEtC,kCAAkC;AAClC,qBAAa,iBACX,SAAQ,aAAa,CAAC,sBAGU;CAAG"}
|
package/lib/errors.js
CHANGED
|
@@ -1,26 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Porkbun-specific error types.
|
|
3
|
-
*
|
|
4
|
-
* Re-exports the common HTTP errors from core and adds the Porkbun fallback
|
|
5
|
-
* errors. Note the generated service module additionally defines its own
|
|
6
|
-
* per-status matcher classes (BadRequest/NotFound/…) for the statuses each
|
|
7
|
-
* operation declares — those share `_tag`s with the core classes here, so
|
|
8
|
-
* `catchTag` works against either.
|
|
9
|
-
*/
|
|
10
|
-
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";
|
|
11
|
-
import * as Category from "@distilled.cloud/core/category";
|
|
12
|
-
import * as Schema from "effect/Schema";
|
|
13
|
-
/** Unknown Porkbun error — returned when nothing else matches the failure. */
|
|
14
|
-
export class UnknownPorkbunError extends Schema.TaggedError()("UnknownPorkbunError", {
|
|
15
|
-
code: Schema.optional(Schema.String),
|
|
16
|
-
message: Schema.optional(Schema.String),
|
|
17
|
-
body: Schema.Unknown,
|
|
18
|
-
}).pipe(Category.withServerError) {
|
|
19
|
-
}
|
|
20
|
-
/** Schema parse error wrapper. */
|
|
21
|
-
export class PorkbunParseError extends Schema.TaggedError()("PorkbunParseError", {
|
|
22
|
-
body: Schema.Unknown,
|
|
23
|
-
cause: Schema.Unknown,
|
|
24
|
-
}).pipe(Category.withParseError) {
|
|
25
|
-
}
|
|
26
|
-
//# 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$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$PorkbunParseError as PorkbunParseError, errors$ServiceUnavailable as ServiceUnavailable, errors$TooManyRequests as TooManyRequests, errors$Unauthorized as Unauthorized, errors$UnknownPorkbunError as UnknownPorkbunError, errors$UnprocessableEntity as UnprocessableEntity } from "./_bundle/sdk.js";
|
package/lib/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @distilled.cloud/porkbun
|
|
2
|
+
* @distilled.cloud/porkbun -- Porkbun SDK for Effect.
|
|
3
3
|
*
|
|
4
4
|
* `./services` is generated by `scripts/generate.ts` from the Smithy model
|
|
5
5
|
* in `.generated-specs` (written by `scripts/convert.ts` from the OpenAPI
|
package/lib/index.js
CHANGED
|
@@ -1,17 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @distilled.cloud/porkbun — Porkbun 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 OpenAPI
|
|
6
|
-
* spec). Everything else in this folder is hand-written.
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* ```ts
|
|
10
|
-
* import * as Porkbun from "@distilled.cloud/porkbun";
|
|
11
|
-
*
|
|
12
|
-
* const domains = yield* Porkbun.Services.porkbun.listDomains({});
|
|
13
|
-
* ```
|
|
14
|
-
*/
|
|
15
1
|
export * from "./credentials.js";
|
|
16
2
|
export * from "./errors.js";
|
|
17
3
|
export * as T from "./traits.js";
|
|
@@ -19,10 +5,5 @@ export { PorkbunProtocol } from "./protocol.js";
|
|
|
19
5
|
export { paginateCursor } from "./pagination.js";
|
|
20
6
|
export * as Retry from "./retry.js";
|
|
21
7
|
export * as Services from "./services/index.js";
|
|
22
|
-
// Operations (and their request/response types) are importable straight off
|
|
23
|
-
// the package root. The service-local typed error classes shadow the
|
|
24
|
-
// same-named shared ones from ./errors.ts — the ops actually raise the
|
|
25
|
-
// service-local classes.
|
|
26
8
|
export * from "./services/porkbun.js";
|
|
27
9
|
export { BadRequest, Conflict, Forbidden, NotFound } from "./services/porkbun.js";
|
|
28
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from "./credentials.js";
|
|
2
|
+
export * from "./errors.js";
|
|
3
|
+
export * as T from "./traits.js";
|
|
4
|
+
export { PorkbunProtocol } from "./protocol.js";
|
|
5
|
+
export { paginateCursor } from "./pagination.js";
|
|
6
|
+
export * as Retry from "./retry.js";
|
|
7
|
+
export * as Services from "./services.lazy/index.js";
|
|
8
|
+
export * from "./services.lazy/porkbun.js";
|
|
9
|
+
export { BadRequest, Conflict, Forbidden, NotFound } from "./services.lazy/porkbun.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,OAAO,KAAK,CAAC,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,eAAe,EAA8C,MAAM,eAAe,CAAC;AAC5F,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAC;AAChD,4EAA4E;AAC5E,qEAAqE;AACrE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,OAAO,KAAK,CAAC,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,eAAe,EAA8C,MAAM,eAAe,CAAC;AAC5F,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAC;AAChD,4EAA4E;AAC5E,qEAAqE;AACrE,wEAAwE;AACxE,yBAAyB;AACzB,cAAc,uBAAuB,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC"}
|
package/lib/pagination.d.ts
CHANGED
package/lib/pagination.js
CHANGED
|
@@ -1,9 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Porkbun pagination — hand-written.
|
|
3
|
-
*
|
|
4
|
-
* Porkbun list operations are typically single-page responses; generated
|
|
5
|
-
* operations that the converter stamps as cursor-mode pass core's
|
|
6
|
-
* {@link paginateCursor} strategy to `API.makePaginated`.
|
|
7
|
-
*/
|
|
8
|
-
export { paginateCursor } from "@distilled.cloud/core/pagination";
|
|
9
|
-
//# sourceMappingURL=pagination.js.map
|
|
1
|
+
import{pagination$paginateCursor as e}from"@distilled.cloud/core/_bundle/base";export{e as paginateCursor};
|
package/lib/protocol.d.ts.map
CHANGED
|
@@ -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,UAAU,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAoB5E,OAAO,KAAK,KAAK,UAAU,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,KAAK,eAAe,MAAM,6BAA6B,CAAC;AACpE,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,WAAW,EAA8B,MAAM,kBAAkB,CAAC;AAC3E,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErE;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GACtB,YAAY,CAAC,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,GACzC,mBAAmB,GACnB,WAAW,GACX,eAAe,CAAC,eAAe,GAC/B,iBAAiB,CAAC;AAEtB,0EAA0E;AAC1E,MAAM,MAAM,gBAAgB,GAAG,WAAW,GAAG,UAAU,CAAC,UAAU,CAAC;AAiBnE,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,
|
|
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,UAAU,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAoB5E,OAAO,KAAK,KAAK,UAAU,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,KAAK,eAAe,MAAM,6BAA6B,CAAC;AACpE,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,WAAW,EAA8B,MAAM,kBAAkB,CAAC;AAC3E,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErE;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GACtB,YAAY,CAAC,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,GACzC,mBAAmB,GACnB,WAAW,GACX,eAAe,CAAC,eAAe,GAC/B,iBAAiB,CAAC;AAEtB,0EAA0E;AAC1E,MAAM,MAAM,gBAAgB,GAAG,WAAW,GAAG,UAAU,CAAC,UAAU,CAAC;AAiBnE,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,CAcpD,CAAC"}
|
package/lib/protocol.js
CHANGED
|
@@ -1,55 +1 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* PorkbunProtocol — hand-written.
|
|
4
|
-
*
|
|
5
|
-
* Porkbun speaks JSON REST authenticated with `X-API-Key` /
|
|
6
|
-
* `X-Secret-API-Key` (no success envelope), so the whole protocol is one
|
|
7
|
-
* `makeRestProtocol` call from `core/protocol-rest`:
|
|
8
|
-
*
|
|
9
|
-
* request: credentials → `X-API-Key` + `X-Secret-API-Key` + base URL
|
|
10
|
-
* (default https://api.porkbun.com/api/json/v3), resolved from
|
|
11
|
-
* the calling fiber on every request
|
|
12
|
-
*
|
|
13
|
-
* response: 2xx JSON is the payload (sensitive members delivered as
|
|
14
|
-
* `Redacted`); non-2xx `{ status: "ERROR", code?, message }`
|
|
15
|
-
* bodies map to the operation's typed error classes by status,
|
|
16
|
-
* then the shared HTTP-status classes, then
|
|
17
|
-
* {@link UnknownPorkbunError}.
|
|
18
|
-
*/
|
|
19
|
-
import * as Effect from "effect/Effect";
|
|
20
|
-
import { Credentials, formatHeaders } from "./credentials.js";
|
|
21
|
-
import { UnknownPorkbunError, PorkbunParseError } from "./errors.js";
|
|
22
|
-
/**
|
|
23
|
-
* Porkbun error bodies are `{ status: "ERROR", message, code?, next_action? }`.
|
|
24
|
-
*/
|
|
25
|
-
const errorEnvelope = (body) => {
|
|
26
|
-
if (body === null || typeof body !== "object")
|
|
27
|
-
return undefined;
|
|
28
|
-
const obj = body;
|
|
29
|
-
const code = obj.code;
|
|
30
|
-
const message = obj.message;
|
|
31
|
-
if (typeof code !== "string" && typeof message !== "string")
|
|
32
|
-
return undefined;
|
|
33
|
-
return {
|
|
34
|
-
code: typeof code === "string" ? code : undefined,
|
|
35
|
-
message: typeof message === "string" ? message : undefined,
|
|
36
|
-
};
|
|
37
|
-
};
|
|
38
|
-
export const PorkbunProtocol = makeRestProtocol({
|
|
39
|
-
// The Credentials service holds an effect — resolving it here (per
|
|
40
|
-
// request, on the calling fiber) picks up context-provided credentials.
|
|
41
|
-
credentials: Effect.gen(function* () {
|
|
42
|
-
const resolve = yield* Credentials;
|
|
43
|
-
return yield* resolve;
|
|
44
|
-
}),
|
|
45
|
-
baseUrl: (creds) => creds.apiBaseUrl,
|
|
46
|
-
headers: (creds) => formatHeaders(creds),
|
|
47
|
-
errorEnvelope,
|
|
48
|
-
unknownError: ({ code, message, body }) => new UnknownPorkbunError({
|
|
49
|
-
code: typeof code === "string" ? code : code !== undefined ? String(code) : undefined,
|
|
50
|
-
message,
|
|
51
|
-
body,
|
|
52
|
-
}),
|
|
53
|
-
parseError: ({ body, cause }) => new PorkbunParseError({ body, cause }),
|
|
54
|
-
});
|
|
55
|
-
//# sourceMappingURL=protocol.js.map
|
|
1
|
+
export { protocol$PorkbunProtocol as PorkbunProtocol } from "./_bundle/sdk.js";
|
package/lib/retry.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ import * as Effect from "effect/Effect";
|
|
|
19
19
|
export { type Options, type Factory, type Policy, makeDefault, jittered, capped, throttlingOptions, transientOptions, throttlingFactory, transientFactory, } from "@distilled.cloud/core/retry";
|
|
20
20
|
declare const Retry_base: Context.ServiceClass<Retry, "PorkbunRetry", Policy>;
|
|
21
21
|
/** Context tag for configuring retry behavior of Porkbun API calls. */
|
|
22
|
-
export declare class Retry extends Retry_base {
|
|
22
|
+
export declare class Retry extends /*@__PURE__*/ Retry_base {
|
|
23
23
|
}
|
|
24
24
|
/** Provides a custom retry policy to every Porkbun API call below it. */
|
|
25
25
|
export declare const policy: (optionsOrFactory: Policy) => <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, Exclude<R, Retry>>;
|
package/lib/retry.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"retry.d.ts","sourceRoot":"","sources":["../src/retry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAuC,MAAM,6BAA6B,CAAC;AAC/F;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAGxC,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,OAAO,EACZ,KAAK,MAAM,EACX,WAAW,EACX,QAAQ,EACR,MAAM,EACN,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,6BAA6B,CAAC;;AAErC,uEAAuE;AACvE,qBAAa,KAAM,SAAQ,UAAgD;CAAG;
|
|
1
|
+
{"version":3,"file":"retry.d.ts","sourceRoot":"","sources":["../src/retry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAuC,MAAM,6BAA6B,CAAC;AAC/F;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAGxC,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,OAAO,EACZ,KAAK,MAAM,EACX,WAAW,EACX,QAAQ,EACR,MAAM,EACN,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,6BAA6B,CAAC;;AAErC,uEAAuE;AACvE,qBAAa,KAAM,SAAQ,aAAa,CAAC,UAAgD;CAAG;AAE5F,yEAAyE;AACzE,eAAO,MAAM,MAAM,qBAAsB,MAAM,sFACS,CAAC;AAEzD,sCAAsC;AACtC,eAAO,MAAM,IAAI,mFAEhB,CAAC;AAEF,kFAAkF;AAClF,eAAO,MAAM,UAAU,mFAA0C,CAAC;AAElE,oFAAoF;AACpF,eAAO,MAAM,SAAS,mFAAyC,CAAC"}
|
package/lib/retry.js
CHANGED
|
@@ -1,32 +1 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* Porkbun retry configuration.
|
|
4
|
-
*
|
|
5
|
-
* Defines the per-SDK `Retry` Context.Service tag that generated operations
|
|
6
|
-
* wire into `API.make`. Callers can install a blanket retry policy at the
|
|
7
|
-
* layer level and have every Porkbun API call below it pick it up:
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* ```ts
|
|
11
|
-
* import * as Porkbun from "@distilled.cloud/porkbun";
|
|
12
|
-
*
|
|
13
|
-
* myEffect.pipe(Porkbun.Retry.transient);
|
|
14
|
-
* Effect.provide(myEffect, Layer.succeed(Porkbun.Retry.Retry, customPolicy));
|
|
15
|
-
* ```
|
|
16
|
-
*/
|
|
17
|
-
import * as Context from "effect/Context";
|
|
18
|
-
import * as Effect from "effect/Effect";
|
|
19
|
-
import * as Layer from "effect/Layer";
|
|
20
|
-
export { makeDefault, jittered, capped, throttlingOptions, transientOptions, throttlingFactory, transientFactory, } from "@distilled.cloud/core/retry";
|
|
21
|
-
/** Context tag for configuring retry behavior of Porkbun API calls. */
|
|
22
|
-
export class Retry extends Context.Service()("PorkbunRetry") {
|
|
23
|
-
}
|
|
24
|
-
/** Provides a custom retry policy to every Porkbun API call below it. */
|
|
25
|
-
export const policy = (optionsOrFactory) => Effect.provide(Layer.succeed(Retry, optionsOrFactory));
|
|
26
|
-
/** Disables all automatic retries. */
|
|
27
|
-
export const none = Effect.provide(Layer.succeed(Retry, { while: () => false }));
|
|
28
|
-
/** Apply the throttling retry policy (retries throttling errors indefinitely). */
|
|
29
|
-
export const throttling = policy(throttlingFactory);
|
|
30
|
-
/** Apply the transient retry policy (retries all transient errors indefinitely). */
|
|
31
|
-
export const transient = policy(transientFactory);
|
|
32
|
-
//# 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$throttlingFactory as throttlingFactory, retry$throttlingOptions as throttlingOptions, retry$transient as transient, retry$transientFactory as transientFactory, retry$transientOptions as transientOptions } from "./_bundle/sdk.js";
|
package/lib/services/index.js
CHANGED