@distilled.cloud/mailchimp 0.0.0 → 1.0.0-rc.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +102 -4
- 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 +59 -0
- package/lib/credentials.d.ts.map +1 -0
- package/lib/credentials.js +1 -0
- package/lib/errors.d.ts +68 -0
- package/lib/errors.d.ts.map +1 -0
- package/lib/errors.js +1 -0
- package/lib/index.d.ts +44 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +10 -0
- package/lib/index.lazy.js +10 -0
- package/lib/index.lazy.js.map +1 -0
- package/lib/pagination.d.ts +11 -0
- package/lib/pagination.d.ts.map +1 -0
- package/lib/pagination.js +1 -0
- package/lib/protocol.d.ts +25 -0
- package/lib/protocol.d.ts.map +1 -0
- package/lib/protocol.js +1 -0
- package/lib/retry.d.ts +53 -0
- package/lib/retry.d.ts.map +1 -0
- package/lib/retry.js +1 -0
- package/lib/services/index.d.ts +3 -0
- package/lib/services/index.d.ts.map +1 -0
- package/lib/services/index.js +2 -0
- package/lib/services/marketing.d.ts +24805 -0
- package/lib/services/marketing.d.ts.map +1 -0
- package/lib/services/marketing.js +409 -0
- package/lib/services/marketing.js.map +1 -0
- package/lib/services/transactional.d.ts +3805 -0
- package/lib/services/transactional.d.ts.map +1 -0
- package/lib/services/transactional.js +143 -0
- package/lib/services/transactional.js.map +1 -0
- package/lib/services.lazy/index.js +3 -0
- package/lib/services.lazy/marketing.js +3 -0
- package/lib/services.lazy/transactional.js +4 -0
- package/lib/subscriber-hash.d.ts +11 -0
- package/lib/subscriber-hash.d.ts.map +1 -0
- package/lib/subscriber-hash.js +2 -0
- package/lib/subscriber-hash.js.map +1 -0
- package/lib/traits.d.ts +7 -0
- package/lib/traits.d.ts.map +1 -0
- package/lib/traits.js +1 -0
- package/package.json +88 -2
- package/src/credentials.ts +156 -0
- package/src/errors.ts +81 -0
- package/src/index.ts +50 -0
- package/src/pagination.ts +69 -0
- package/src/protocol.ts +196 -0
- package/src/retry.ts +72 -0
- package/src/services/index.ts +3 -0
- package/src/services/marketing.ts +43348 -0
- package/src/services/transactional.ts +7512 -0
- package/src/subscriber-hash.ts +87 -0
- package/src/traits.ts +40 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as API from "@distilled.cloud/core/api";
|
|
2
|
+
import type { API_ERRORS, ConfigError, DefaultErrors, InvalidInput } from "@distilled.cloud/core/errors";
|
|
3
|
+
import type { SdkError } from "@distilled.cloud/core/sdk-error";
|
|
4
|
+
import type * as HttpClient from "effect/http/HttpClient";
|
|
5
|
+
import type * as HttpClientError from "effect/http/HttpClientError";
|
|
6
|
+
import * as Layer from "effect/Layer";
|
|
7
|
+
import { Credentials, TransactionalCredentials } from "./credentials.ts";
|
|
8
|
+
import { MailchimpApiError, MailchimpParseError, MailchimpTransactionalError, UnknownMailchimpError } from "./errors.ts";
|
|
9
|
+
export type MailchimpOpError = InstanceType<(typeof API_ERRORS)[number]> | MailchimpApiError | UnknownMailchimpError | MailchimpParseError | ConfigError | HttpClientError.HttpClientError | InvalidInput | SdkError;
|
|
10
|
+
export type MailchimpOpContext = Credentials | HttpClient.HttpClient;
|
|
11
|
+
export declare const MailchimpProtocol: Layer.Layer<API.Protocol>;
|
|
12
|
+
/**
|
|
13
|
+
* Only the always-possible failures. Each operation adds the classes its
|
|
14
|
+
* declared statuses map to (`NotFound`, `PaymentRequired`, ...).
|
|
15
|
+
*/
|
|
16
|
+
export type MailchimpTransactionalOpError = DefaultErrors | MailchimpTransactionalError | UnknownMailchimpError | MailchimpParseError | ConfigError | HttpClientError.HttpClientError | InvalidInput | SdkError;
|
|
17
|
+
export type MailchimpTransactionalOpContext = TransactionalCredentials | HttpClient.HttpClient;
|
|
18
|
+
/**
|
|
19
|
+
* The key rides in the JSON body, not a header. It is added to the input
|
|
20
|
+
* here so the generated request shapes never carry it; the REST encoder
|
|
21
|
+
* sends members the schema does not know as body fields, and unwraps the
|
|
22
|
+
* `Redacted` key on the way out.
|
|
23
|
+
*/
|
|
24
|
+
export declare const MailchimpTransactionalProtocol: Layer.Layer<API.Protocol>;
|
|
25
|
+
//# sourceMappingURL=protocol.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,2BAA2B,CAAC;AACjD,OAAO,KAAK,EACV,UAAU,EACV,WAAW,EACX,aAAa,EACb,YAAY,EACb,MAAM,8BAA8B,CAAC;AAEtC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAyBhE,OAAO,KAAK,KAAK,UAAU,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,KAAK,eAAe,MAAM,6BAA6B,CAAC;AAEpE,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAEtC,OAAO,EACL,WAAW,EACX,wBAAwB,EAGzB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,2BAA2B,EAC3B,qBAAqB,EACtB,MAAM,aAAa,CAAC;AAErB,MAAM,MAAM,gBAAgB,GACxB,YAAY,CAAC,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,GACzC,iBAAiB,GACjB,qBAAqB,GACrB,mBAAmB,GACnB,WAAW,GACX,eAAe,CAAC,eAAe,GAC/B,YAAY,GACZ,QAAQ,CAAC;AAEb,MAAM,MAAM,kBAAkB,GAAG,WAAW,GAAG,UAAU,CAAC,UAAU,CAAC;AAuBrE,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,CA2BtD,CAAC;AAIH;;;GAGG;AACH,MAAM,MAAM,6BAA6B,GACrC,aAAa,GACb,2BAA2B,GAC3B,qBAAqB,GACrB,mBAAmB,GACnB,WAAW,GACX,eAAe,CAAC,eAAe,GAC/B,YAAY,GACZ,QAAQ,CAAC;AAEb,MAAM,MAAM,+BAA+B,GAAG,wBAAwB,GAAG,UAAU,CAAC,UAAU,CAAC;AA4C/F;;;;;GAKG;AACH,eAAO,MAAM,8BAA8B,EAAE,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,CAgB7B,CAAC"}
|
package/lib/protocol.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { protocol$MailchimpProtocol as MailchimpProtocol, protocol$MailchimpTransactionalProtocol as MailchimpTransactionalProtocol } from "./_bundle/sdk.js";
|
package/lib/retry.d.ts
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import * as Retries from "@distilled.cloud/core/retry";
|
|
2
|
+
/**
|
|
3
|
+
* Mailchimp retry surface -- a veneer over `@distilled.cloud/core/retry`.
|
|
4
|
+
*
|
|
5
|
+
* Mailchimp allows 10 simultaneous connections per key and answers 429 past
|
|
6
|
+
* that; `throttling` is the policy that recovers it.
|
|
7
|
+
*
|
|
8
|
+
* The `Retry` service tag is threaded into every generated operation via
|
|
9
|
+
* `API.make({ retry: Retry })`, so a caller-installed policy applies to all
|
|
10
|
+
* Mailchimp calls below it and core's `makeDefault` is the fallback when none is
|
|
11
|
+
* provided.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* import * as Mailchimp from "@distilled.cloud/mailchimp";
|
|
16
|
+
*
|
|
17
|
+
* myEffect.pipe(Mailchimp.Retry.throttling);
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
import * as Context from "effect/Context";
|
|
21
|
+
import * as Effect from "effect/Effect";
|
|
22
|
+
export type Options = Retries.Options;
|
|
23
|
+
export type Factory = Retries.Factory;
|
|
24
|
+
export type Policy = Retries.Policy;
|
|
25
|
+
declare const Retry_base: Context.ServiceClass<Retry, "MailchimpRetry", Retries.Policy>;
|
|
26
|
+
/** Context tag for configuring retry behavior of Mailchimp API calls. */
|
|
27
|
+
export declare class Retry extends /*@__PURE__*/ Retry_base {
|
|
28
|
+
}
|
|
29
|
+
/** Provides a custom retry policy to every Mailchimp API call below it. */
|
|
30
|
+
export declare const policy: {
|
|
31
|
+
(options: Options): <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, Exclude<R, Retry>>;
|
|
32
|
+
(factory: Factory): <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, Exclude<R, Retry>>;
|
|
33
|
+
};
|
|
34
|
+
/** Disables all automatic retries. */
|
|
35
|
+
export declare const none: <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, Exclude<R, Retry>>;
|
|
36
|
+
/**
|
|
37
|
+
* The default retry policy (core's): transient/throttling/retryable errors,
|
|
38
|
+
* capped exponential backoff with jitter, server `retryAfter` hints honored
|
|
39
|
+
* with precedence.
|
|
40
|
+
*/
|
|
41
|
+
export declare const makeDefault: Factory;
|
|
42
|
+
export declare const jittered: <Error, Env>(self: import("effect/Schedule").Schedule<unknown, unknown, Error, Env>) => import("effect/Schedule").Schedule<unknown, unknown, Error, Env>;
|
|
43
|
+
export declare const capped: (max: import("effect/Duration").Duration) => <Error, Env>(self: import("effect/Schedule").Schedule<unknown, unknown, Error, Env>) => import("effect/Schedule").Schedule<unknown, unknown, Error, Env>;
|
|
44
|
+
/** Retry options that retry all throttling errors indefinitely. */
|
|
45
|
+
export declare const throttlingOptions: Options;
|
|
46
|
+
/** Retries all throttling errors indefinitely (honoring server hints). */
|
|
47
|
+
export declare const throttling: <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, Exclude<R, Retry>>;
|
|
48
|
+
/** Retry options that retry all transient errors indefinitely. */
|
|
49
|
+
export declare const transientOptions: Options;
|
|
50
|
+
/** Retries all transient errors indefinitely. */
|
|
51
|
+
export declare const transient: <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, Exclude<R, Retry>>;
|
|
52
|
+
export {};
|
|
53
|
+
//# sourceMappingURL=retry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retry.d.ts","sourceRoot":"","sources":["../src/retry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,6BAA6B,CAAC;AACvD;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAGxC,MAAM,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;AACtC,MAAM,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;AACtC,MAAM,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;;AAEpC,yEAAyE;AACzE,qBAAa,KAAM,SAAQ,aAAa,CAAC,UAAkD;CAAG;AAE9F,2EAA2E;AAC3E,eAAO,MAAM,MAAM,EAAE;IACnB,CACE,OAAO,EAAE,OAAO,GACf,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,KAAK,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;IACvF,CACE,OAAO,EAAE,OAAO,GACf,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,KAAK,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;CACU,CAAC;AAEpG,sCAAsC;AACtC,eAAO,MAAM,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EACzB,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,KAC3B,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,CAAC,EAAE,KAAK,CAAC,CAEzC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAE,OAA6B,CAAC;AAExD,eAAO,MAAM,QAAQ,0JAAmB,CAAC;AACzC,eAAO,MAAM,MAAM,uMAAiB,CAAC;AAErC,mEAAmE;AACnE,eAAO,MAAM,iBAAiB,EAAE,OAAmC,CAAC;AAEpE,0EAA0E;AAC1E,eAAO,MAAM,UAAU,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAC/B,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,KAC3B,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,CAAC,EAAE,KAAK,CAAC,CAAmD,CAAC;AAE9F,kEAAkE;AAClE,eAAO,MAAM,gBAAgB,EAAE,OAAkC,CAAC;AAElE,iDAAiD;AACjD,eAAO,MAAM,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAC9B,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,KAC3B,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,CAAC,EAAE,KAAK,CAAC,CAAkD,CAAC"}
|
package/lib/retry.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { retry$Retry as Retry, retry$capped as capped, retry$jittered as jittered, retry$makeDefault as makeDefault, retry$none as none, retry$policy as policy, retry$throttling as throttling, retry$throttlingOptions as throttlingOptions, retry$transient as transient, retry$transientOptions as transientOptions } from "./_bundle/sdk.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAC;AAC5C,OAAO,KAAK,aAAa,MAAM,oBAAoB,CAAC"}
|