@distilled.cloud/resend 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 -34
- 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 +8 -0
- package/lib/{index.js.map → index.lazy.js.map} +1 -1
- package/lib/pagination.js +1 -48
- package/lib/protocol.d.ts.map +1 -1
- package/lib/protocol.js +1 -53
- 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/resend.d.ts +6 -336
- package/lib/services/resend.d.ts.map +1 -1
- package/lib/services/resend.js +103 -2147
- package/lib/services/resend.js.map +1 -1
- package/lib/services.lazy/index.js +3 -0
- package/lib/services.lazy/resend.js +3 -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 +14 -15
- package/src/index.ts +2 -2
- package/src/pagination.ts +2 -2
- package/src/protocol.ts +5 -8
- package/src/retry.ts +6 -4
- package/src/services/resend.ts +2087 -2429
- 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 s,errors$HTTP_STATUS_MAP as c,errors$InternalServerError as l,errors$Locked as u,errors$NotFound as ee,errors$ServiceUnavailable as d,errors$TooManyRequests as f,errors$Unauthorized as p,errors$UnprocessableEntity as te,protocol_rest$RawResponse as ne,protocol_rest$RawResponseRoot as re,protocol_rest$SensitiveValue as ie,protocol_rest$makeRestProtocol as ae,protocol_rest$rawResponseRootSymbol as oe,protocol_rest$rawResponseSymbol as m,protocol_rest$sensitiveValueSymbol as h,schema_lite$Array as g,schema_lite$Boolean as _,schema_lite$NullOr as v,schema_lite$Number as y,schema_lite$Record as b,schema_lite$String as x,schema_lite$Struct as S,schema_lite$Unknown as C,schema_lite$at as w,schema_lite$optional as T,schema_lite$suspend as E}from"@distilled.cloud/core/_bundle/rest";import{api$D as D,api$call as O,api$named as k,api$op as A,api$opPaginated as j,category$withParseError as M,category$withServerError as N,pagination$getItems as P,pagination$getPath as F,retry$capped as I,retry$jittered as L,retry$makeDefault as R,retry$throttlingFactory as z,retry$throttlingOptions as B,retry$transientFactory as V,retry$transientOptions as H,trait$Body as U,trait$FormDataFile as W,trait$Header as G,trait$Http as K,trait$HttpBody as q,trait$KeyDictionary as se,trait$Label as ce,trait$Query as le,trait$ResponseCode as ue,trait$UnionCases as de,trait$applyErrorMatchers as fe,trait$bodySymbol as pe,trait$errorMatchersSymbol as me,trait$formDataFileSymbol as he,trait$getErrorMatchers as ge,trait$headerSymbol as _e,trait$httpBodySymbol as ve,trait$httpSymbol as ye,trait$keyDictionarySymbol as be,trait$labelSymbol as xe,trait$querySymbol as Se,trait$responseCodeSymbol as Ce,trait$unionCasesSymbol as we}from"@distilled.cloud/core/_bundle/base";import*as J from"effect/Context";import*as Y from"effect/Effect";import*as X from"effect/Layer";import*as Z from"effect/Redacted";import*as Q from"@distilled.cloud/core/schema-lite-typed";import*as $ from"effect/Stream";const Te=`https://api.resend.com`;var Credentials=class extends (/*@__PURE__*/ J.Service()(`ResendCredentials`)){};const fromApiKey=e=>X.succeed(Credentials,Y.succeed({apiKey:e.apiKey,apiBaseUrl:e.apiBaseUrl??`https://api.resend.com`}));const Ee=/*@__PURE__*/ X.succeed(Credentials,/*@__PURE__*/ Y.gen(function*(){const e=process.env.RESEND_API_KEY;if(!e)return yield*new r({message:`RESEND_API_KEY environment variable is required`});return{apiKey:Z.make(e),apiBaseUrl:process.env.RESEND_API_BASE_URL??`https://api.resend.com`}}).pipe(Y.orDie));var UnknownResendError=class extends (/*@__PURE__*/ Q.TaggedError()(`UnknownResendError`,{code:/*@__PURE__*/ Q.optional(Q.String),message:/*@__PURE__*/ Q.optional(Q.String),body:Q.Unknown}).pipe(N)){};var ResendParseError=class extends (/*@__PURE__*/ Q.TaggedError()(`ResendParseError`,{body:Q.Unknown,cause:Q.Unknown}).pipe(M)){};const paginateResend=(e,t,n)=>{const r=n.inputToken;if(!r)return $.die(/* @__PURE__ */ new Error(`Resend cursor pagination requires inputToken`));const i=n.hasNextPage??`has_more`;const a=n.items??`data`;const o=typeof t[r]===`string`?t[r]:void 0;return $.unfold({cursor:o,done:false},n=>Y.gen(function*(){if(n.done)return void 0;const o=yield*e({...t,...n.cursor?{[r]:n.cursor}:{}});const s=P(o,a).at(-1);const c=typeof s?.id===`string`?s.id:void 0;const l=F(o,i)===true;const u=n.cursor!==void 0&&c===n.cursor;return[o,{cursor:c,done:!l||c===void 0||u}]}))};const De=/*@__PURE__*/ ae({credentials:/*@__PURE__*/ Y.flatMap(Credentials,e=>e),baseUrl:e=>e.apiBaseUrl,headers:e=>({Authorization:`Bearer ${Z.value(e.apiKey)}`}),errorEnvelope:e=>{if(e===null||typeof e!==`object`)return void 0;const t=e;const n=typeof t.name===`string`?t.name:typeof t.code===`string`?t.code:void 0;const r=typeof t.message===`string`?t.message:void 0;if(n===void 0&&r===void 0)return void 0;return{code:n,message:r}},unknownError:({code:e,message:t,body:n})=>new UnknownResendError({code:typeof e===`string`?e:e!==void 0?String(e):void 0,message:t,body:n}),parseError:({body:e,cause:t})=>new ResendParseError({body:e,cause:t})});var Retry=class extends (/*@__PURE__*/ J.Service()(`ResendRetry`)){};const policy=e=>Y.provide(X.succeed(Retry,e));const Oe=/*@__PURE__*/ Y.provide(/*@__PURE__*/ X.succeed(Retry,{while:()=>false}));const ke=/*@__PURE__*/ policy(z);const Ae=/*@__PURE__*/ policy(V);export{b as a,C as c,Credentials as credentials$Credentials,Ee as credentials$CredentialsFromEnv,Te as credentials$DEFAULT_API_BASE_URL,fromApiKey as credentials$fromApiKey,E 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,s as errors$GatewayTimeout,c as errors$HTTP_STATUS_MAP,l as errors$InternalServerError,u as errors$Locked,ee as errors$NotFound,ResendParseError as errors$ResendParseError,d as errors$ServiceUnavailable,f as errors$TooManyRequests,p as errors$Unauthorized,UnknownResendError as errors$UnknownResendError,te as errors$UnprocessableEntity,D as f,j as g,A as h,y as i,w as l,k as m,_ as n,x as o,O as p,paginateResend as pagination$paginateResend,De as protocol$ResendProtocol,v as r,Retry as retry$Retry,I as retry$capped,L as retry$jittered,R as retry$makeDefault,Oe as retry$none,policy as retry$policy,ke as retry$throttling,z as retry$throttlingFactory,B as retry$throttlingOptions,Ae as retry$transient,V as retry$transientFactory,H as retry$transientOptions,S as s,g as t,U as traits$Body,W as traits$FormDataFile,G as traits$Header,K as traits$Http,q as traits$HttpBody,se as traits$KeyDictionary,ce as traits$Label,le as traits$Query,ne as traits$RawResponse,re as traits$RawResponseRoot,ue as traits$ResponseCode,ie as traits$SensitiveValue,de as traits$UnionCases,fe as traits$applyErrorMatchers,pe as traits$bodySymbol,me as traits$errorMatchersSymbol,he as traits$formDataFileSymbol,ge as traits$getErrorMatchers,_e as traits$headerSymbol,ve as traits$httpBodySymbol,ye as traits$httpSymbol,be as traits$keyDictionarySymbol,xe as traits$labelSymbol,Se as traits$querySymbol,oe as traits$rawResponseRootSymbol,m as traits$rawResponseSymbol,Ce as traits$responseCodeSymbol,h as traits$sensitiveValueSymbol,we as traits$unionCasesSymbol,T as u};
|
|
2
|
+
//# sourceMappingURL=sdk.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sdk.js","names":["Category.withServerError","Category.withParseError","Pagination.getItems","Pagination.getPath","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","Unknown","at","optional","suspend","call","named","op","opPaginated","withParseError","withServerError","getItems","getPath","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","Stream","DEFAULT_API_BASE_URL","config","CredentialsFromEnv","apiKey","inputToken","pagination","hasNextPath","itemsPath","startCursor","input","state","response","operation","last","nextCursor","hasNext","stuckCursor","ResendProtocol","resolve","creds","body","rec","code","message","optionsOrFactory","none","throttling","transient"],"sources":["../../src/credentials.ts","../../src/errors.ts","../../src/pagination.ts","../../src/protocol.ts","../../src/retry.ts"],"mappings":"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"}
|
package/lib/credentials.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Resend credentials
|
|
2
|
+
* Resend credentials -- hand-written.
|
|
3
3
|
*
|
|
4
4
|
* The `Credentials` service holds an *effect* that resolves the current
|
|
5
5
|
* credentials on every request (the protocol layer resolves it per request
|
|
@@ -15,7 +15,7 @@ export interface Config {
|
|
|
15
15
|
readonly apiBaseUrl: string;
|
|
16
16
|
}
|
|
17
17
|
declare const Credentials_base: Context.ServiceClass<Credentials, "ResendCredentials", Effect.Effect<Config, never, never>>;
|
|
18
|
-
export declare class Credentials extends Credentials_base {
|
|
18
|
+
export declare class Credentials extends /*@__PURE__*/ Credentials_base {
|
|
19
19
|
}
|
|
20
20
|
/** Layer from a redacted API key + optional base URL. */
|
|
21
21
|
export declare const fromApiKey: (config: {
|
package/lib/credentials.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../src/credentials.ts"],"names":[],"mappings":"AACA;;;;;;GAMG;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,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":"AACA;;;;;;GAMG;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,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;AAEN,yDAAyD;AACzD,eAAO,MAAM,UAAU,WAAY;IACjC,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;AAEJ,0EAA0E;AAC1E,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,KAAK,CAAC,WAAW,CAgBvD,CAAC"}
|
package/lib/credentials.js
CHANGED
|
@@ -1,34 +1 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* Resend credentials — hand-written.
|
|
4
|
-
*
|
|
5
|
-
* The `Credentials` service holds an *effect* that resolves the current
|
|
6
|
-
* credentials on every request (the protocol layer resolves it per request
|
|
7
|
-
* on the calling fiber).
|
|
8
|
-
*/
|
|
9
|
-
import * as Context from "effect/Context";
|
|
10
|
-
import * as Effect from "effect/Effect";
|
|
11
|
-
import * as Layer from "effect/Layer";
|
|
12
|
-
import * as Redacted from "effect/Redacted";
|
|
13
|
-
export const DEFAULT_API_BASE_URL = "https://api.resend.com";
|
|
14
|
-
export class Credentials extends Context.Service()("ResendCredentials") {
|
|
15
|
-
}
|
|
16
|
-
/** Layer from a redacted API key + optional base URL. */
|
|
17
|
-
export const fromApiKey = (config) => Layer.succeed(Credentials, Effect.succeed({
|
|
18
|
-
apiKey: config.apiKey,
|
|
19
|
-
apiBaseUrl: config.apiBaseUrl ?? DEFAULT_API_BASE_URL,
|
|
20
|
-
}));
|
|
21
|
-
/** Reads RESEND_API_KEY (required) and RESEND_API_BASE_URL (optional). */
|
|
22
|
-
export const CredentialsFromEnv = Layer.succeed(Credentials, Effect.gen(function* () {
|
|
23
|
-
const apiKey = process.env.RESEND_API_KEY;
|
|
24
|
-
if (!apiKey) {
|
|
25
|
-
return yield* new ConfigError({
|
|
26
|
-
message: "RESEND_API_KEY environment variable is required",
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
return {
|
|
30
|
-
apiKey: Redacted.make(apiKey),
|
|
31
|
-
apiBaseUrl: process.env.RESEND_API_BASE_URL ?? DEFAULT_API_BASE_URL,
|
|
32
|
-
};
|
|
33
|
-
}).pipe(Effect.orDie));
|
|
34
|
-
//# 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$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 Resend 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 UnknownResendError_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 UnknownResendError_base: Schema.TaggedErrorClass<"UnknownResendError", {
|
|
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 Resend error
|
|
23
|
-
export declare class UnknownResendError extends UnknownResendError_base {
|
|
22
|
+
/** Unknown Resend error -- returned when nothing else matches the failure. */
|
|
23
|
+
export declare class UnknownResendError extends /*@__PURE__*/ UnknownResendError_base {
|
|
24
24
|
}
|
|
25
|
-
declare const ResendParseError_base: Schema.
|
|
26
|
-
readonly body: Schema.Unknown;
|
|
27
|
-
readonly cause: Schema.Unknown;
|
|
28
|
-
}
|
|
25
|
+
declare const ResendParseError_base: Schema.TaggedErrorClass<"ResendParseError", {
|
|
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 ResendParseError extends ResendParseError_base {
|
|
34
|
+
export declare class ResendParseError extends /*@__PURE__*/ ResendParseError_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,8EAA8E;AAC9E,qBAAa,kBACX,SAAQ,aAAa,CAAC,uBAIW;CAAG;;;;;;;;;AAEtC,kCAAkC;AAClC,qBAAa,gBACX,SAAQ,aAAa,CAAC,qBAGU;CAAG"}
|
package/lib/errors.js
CHANGED
|
@@ -1,26 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Resend-specific error types.
|
|
3
|
-
*
|
|
4
|
-
* Re-exports the common HTTP errors from core and adds the Resend 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 Resend error — returned when nothing else matches the failure. */
|
|
14
|
-
export class UnknownResendError extends Schema.TaggedError()("UnknownResendError", {
|
|
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 ResendParseError extends Schema.TaggedError()("ResendParseError", {
|
|
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$ResendParseError as ResendParseError, errors$ServiceUnavailable as ServiceUnavailable, errors$TooManyRequests as TooManyRequests, errors$Unauthorized as Unauthorized, errors$UnknownResendError as UnknownResendError, errors$UnprocessableEntity as UnprocessableEntity } from "./_bundle/sdk.js";
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -1,17 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @distilled.cloud/resend — Resend 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 Resend from "@distilled.cloud/resend";
|
|
11
|
-
*
|
|
12
|
-
* const emails = yield* Resend.Services.resend.getEmails({});
|
|
13
|
-
* ```
|
|
14
|
-
*/
|
|
15
1
|
export * from "./credentials.js";
|
|
16
2
|
export * from "./errors.js";
|
|
17
3
|
export * as T from "./traits.js";
|
|
@@ -19,9 +5,4 @@ export { ResendProtocol } from "./protocol.js";
|
|
|
19
5
|
export { paginateResend } 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 OpenAPI document does not declare per-status error
|
|
24
|
-
// bodies, so typed error classes are not generated — failures ride
|
|
25
|
-
// ResendOpError / the shared HTTP-status map.
|
|
26
8
|
export * from "./services/resend.js";
|
|
27
|
-
//# 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 { ResendProtocol } from "./protocol.js";
|
|
5
|
+
export { paginateResend } from "./pagination.js";
|
|
6
|
+
export * as Retry from "./retry.js";
|
|
7
|
+
export * as Services from "./services.lazy/index.js";
|
|
8
|
+
export * from "./services.lazy/resend.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,cAAc,EAA4C,MAAM,eAAe,CAAC;AACzF,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAC;AAChD,4EAA4E;AAC5E,2EAA2E;AAC3E,
|
|
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,cAAc,EAA4C,MAAM,eAAe,CAAC;AACzF,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAC;AAChD,4EAA4E;AAC5E,2EAA2E;AAC3E,oEAAoE;AACpE,8CAA8C;AAC9C,cAAc,sBAAsB,CAAC"}
|
package/lib/pagination.js
CHANGED
|
@@ -1,48 +1 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* Resend pagination — hand-written.
|
|
4
|
-
*
|
|
5
|
-
* Resend's paginated list operations are cursor-mode (`after`/`limit` in,
|
|
6
|
-
* `has_more` + last `data[].id` out). There is no next-cursor field on the
|
|
7
|
-
* response — the docs say to pass the last item's `id` as `after` — so
|
|
8
|
-
* generated operations pass {@link paginateResend} rather than core's
|
|
9
|
-
* paginateCursor.
|
|
10
|
-
*/
|
|
11
|
-
import * as Effect from "effect/Effect";
|
|
12
|
-
import * as Stream from "effect/Stream";
|
|
13
|
-
/**
|
|
14
|
-
* Walk forward with `after` set to the last item's `id` while `has_more` is
|
|
15
|
-
* true. An empty page or a repeated cursor terminates even if `has_more`
|
|
16
|
-
* claims otherwise.
|
|
17
|
-
*/
|
|
18
|
-
export const paginateResend = (operation, input, pagination) => {
|
|
19
|
-
const inputToken = pagination.inputToken;
|
|
20
|
-
if (!inputToken) {
|
|
21
|
-
return Stream.die(new Error("Resend cursor pagination requires inputToken"));
|
|
22
|
-
}
|
|
23
|
-
const hasNextPath = pagination.hasNextPage ?? "has_more";
|
|
24
|
-
const itemsPath = pagination.items ?? "data";
|
|
25
|
-
const startCursor = typeof input[inputToken] === "string" ? input[inputToken] : undefined;
|
|
26
|
-
return Stream.unfold({ cursor: startCursor, done: false }, (state) => Effect.gen(function* () {
|
|
27
|
-
if (state.done)
|
|
28
|
-
return undefined;
|
|
29
|
-
const requestPayload = {
|
|
30
|
-
...input,
|
|
31
|
-
...(state.cursor ? { [inputToken]: state.cursor } : {}),
|
|
32
|
-
};
|
|
33
|
-
const response = yield* operation(requestPayload);
|
|
34
|
-
const items = Pagination.getItems(response, itemsPath);
|
|
35
|
-
const last = items.at(-1);
|
|
36
|
-
const nextCursor = typeof last?.id === "string" ? last.id : undefined;
|
|
37
|
-
const hasNext = Pagination.getPath(response, hasNextPath) === true;
|
|
38
|
-
const stuckCursor = state.cursor !== undefined && nextCursor === state.cursor;
|
|
39
|
-
return [
|
|
40
|
-
response,
|
|
41
|
-
{
|
|
42
|
-
cursor: nextCursor,
|
|
43
|
-
done: !hasNext || nextCursor === undefined || stuckCursor,
|
|
44
|
-
},
|
|
45
|
-
];
|
|
46
|
-
}));
|
|
47
|
-
};
|
|
48
|
-
//# sourceMappingURL=pagination.js.map
|
|
1
|
+
export { pagination$paginateResend as paginateResend } from "./_bundle/sdk.js";
|
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;AAmB5E,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,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEnE;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GACrB,YAAY,CAAC,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,GACzC,kBAAkB,GAClB,WAAW,GACX,eAAe,CAAC,eAAe,GAC/B,gBAAgB,CAAC;AAErB,yEAAyE;AACzE,MAAM,MAAM,eAAe,GAAG,WAAW,GAAG,UAAU,CAAC,UAAU,CAAC;AAElE,eAAO,MAAM,cAAc,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;AAmB5E,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,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEnE;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GACrB,YAAY,CAAC,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,GACzC,kBAAkB,GAClB,WAAW,GACX,eAAe,CAAC,eAAe,GAC/B,gBAAgB,CAAC;AAErB,yEAAyE;AACzE,MAAM,MAAM,eAAe,GAAG,WAAW,GAAG,UAAU,CAAC,UAAU,CAAC;AAElE,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,CA2BnD,CAAC"}
|
package/lib/protocol.js
CHANGED
|
@@ -1,53 +1 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* ResendProtocol — hand-written.
|
|
4
|
-
*
|
|
5
|
-
* Resend speaks plain bearer-authenticated JSON REST (no response envelope),
|
|
6
|
-
* so the whole protocol is one `makeRestProtocol` call from
|
|
7
|
-
* `core/protocol-rest`:
|
|
8
|
-
*
|
|
9
|
-
* request: credentials → `Authorization: Bearer <apiKey>` + base URL
|
|
10
|
-
* (default https://api.resend.com), resolved from the
|
|
11
|
-
* calling fiber on every request
|
|
12
|
-
*
|
|
13
|
-
* response: 2xx JSON is the payload (sensitive members delivered as
|
|
14
|
-
* `Redacted`); non-2xx `{ name?, message, statusCode? }` bodies
|
|
15
|
-
* map to the operation's typed error classes by status, then the
|
|
16
|
-
* shared HTTP-status classes, then {@link UnknownResendError}.
|
|
17
|
-
*/
|
|
18
|
-
import * as Effect from "effect/Effect";
|
|
19
|
-
import * as Redacted from "effect/Redacted";
|
|
20
|
-
import { Credentials } from "./credentials.js";
|
|
21
|
-
import { UnknownResendError, ResendParseError } from "./errors.js";
|
|
22
|
-
export const ResendProtocol = makeRestProtocol({
|
|
23
|
-
// The Credentials service holds an effect — resolving it here (per
|
|
24
|
-
// request, on the calling fiber) picks up context-provided credentials.
|
|
25
|
-
credentials: Effect.gen(function* () {
|
|
26
|
-
const resolve = yield* Credentials;
|
|
27
|
-
return yield* resolve;
|
|
28
|
-
}),
|
|
29
|
-
baseUrl: (creds) => creds.apiBaseUrl,
|
|
30
|
-
headers: (creds) => ({
|
|
31
|
-
Authorization: `Bearer ${Redacted.value(creds.apiKey)}`,
|
|
32
|
-
}),
|
|
33
|
-
// Resend's error body is `{ name?: string, message: string, statusCode?: number }`.
|
|
34
|
-
// The factory's default lenient envelope covers `{ code, message }`; `name`
|
|
35
|
-
// is the machine-readable code Resend actually sends.
|
|
36
|
-
errorEnvelope: (body) => {
|
|
37
|
-
if (body === null || typeof body !== "object")
|
|
38
|
-
return undefined;
|
|
39
|
-
const rec = body;
|
|
40
|
-
const code = typeof rec.name === "string" ? rec.name : typeof rec.code === "string" ? rec.code : undefined;
|
|
41
|
-
const message = typeof rec.message === "string" ? rec.message : undefined;
|
|
42
|
-
if (code === undefined && message === undefined)
|
|
43
|
-
return undefined;
|
|
44
|
-
return { code, message };
|
|
45
|
-
},
|
|
46
|
-
unknownError: ({ code, message, body }) => new UnknownResendError({
|
|
47
|
-
code: typeof code === "string" ? code : code !== undefined ? String(code) : undefined,
|
|
48
|
-
message,
|
|
49
|
-
body,
|
|
50
|
-
}),
|
|
51
|
-
parseError: ({ body, cause }) => new ResendParseError({ body, cause }),
|
|
52
|
-
});
|
|
53
|
-
//# sourceMappingURL=protocol.js.map
|
|
1
|
+
export { protocol$ResendProtocol as ResendProtocol } 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, "ResendRetry", Policy>;
|
|
21
21
|
/** Context tag for configuring retry behavior of Resend 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 Resend 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,sEAAsE;AACtE,qBAAa,KAAM,SAAQ,UAA+C;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,sEAAsE;AACtE,qBAAa,KAAM,SAAQ,aAAa,CAAC,UAA+C;CAAG;AAE3F,wEAAwE;AACxE,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
|
-
* Resend 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 Resend API call below it pick it up:
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* ```ts
|
|
11
|
-
* import * as Resend from "@distilled.cloud/resend";
|
|
12
|
-
*
|
|
13
|
-
* myEffect.pipe(Resend.Retry.transient);
|
|
14
|
-
* Effect.provide(myEffect, Layer.succeed(Resend.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 Resend API calls. */
|
|
22
|
-
export class Retry extends Context.Service()("ResendRetry") {
|
|
23
|
-
}
|
|
24
|
-
/** Provides a custom retry policy to every Resend 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