@distilled.cloud/whatsapp 0.0.0-stage → 1.0.0-rc.21
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 +143 -2
- 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 +67 -0
- package/lib/credentials.d.ts.map +1 -0
- package/lib/credentials.js +1 -0
- package/lib/errors.d.ts +48 -0
- package/lib/errors.d.ts.map +1 -0
- package/lib/errors.js +1 -0
- package/lib/index.d.ts +35 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +8 -0
- package/lib/index.lazy.js +8 -0
- package/lib/index.lazy.js.map +1 -0
- package/lib/pagination.d.ts +5 -0
- package/lib/pagination.d.ts.map +1 -0
- package/lib/pagination.js +1 -0
- package/lib/protocol.d.ts +19 -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 +2 -0
- package/lib/services/index.d.ts.map +1 -0
- package/lib/services/index.js +1 -0
- package/lib/services/whatsapp.d.ts +4131 -0
- package/lib/services/whatsapp.d.ts.map +1 -0
- package/lib/services/whatsapp.js +160 -0
- package/lib/services/whatsapp.js.map +1 -0
- package/lib/services.lazy/index.js +3 -0
- package/lib/services.lazy/whatsapp.js +4 -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 +89 -3
- package/src/credentials.ts +123 -0
- package/src/errors.ts +62 -0
- package/src/index.ts +45 -0
- package/src/pagination.ts +73 -0
- package/src/protocol.ts +72 -0
- package/src/retry.ts +72 -0
- package/src/services/index.ts +2 -0
- package/src/services/whatsapp.ts +9925 -0
- package/src/traits.ts +40 -0
package/lib/retry.d.ts
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import * as Retries from "@distilled.cloud/core/retry";
|
|
2
|
+
/**
|
|
3
|
+
* WhatsApp retry surface -- a veneer over `@distilled.cloud/core/retry`.
|
|
4
|
+
*
|
|
5
|
+
* The spec documents 429 Too Many Requests on most operations;
|
|
6
|
+
* `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
|
+
* WhatsApp calls below it and core's `makeDefault` is the fallback when none is
|
|
11
|
+
* provided.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* import * as WhatsApp from "@distilled.cloud/whatsapp";
|
|
16
|
+
*
|
|
17
|
+
* myEffect.pipe(WhatsApp.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, "WhatsAppRetry", Retries.Policy>;
|
|
26
|
+
/** Context tag for configuring retry behavior of WhatsApp API calls. */
|
|
27
|
+
export declare class Retry extends /*@__PURE__*/ Retry_base {
|
|
28
|
+
}
|
|
29
|
+
/** Provides a custom retry policy to every WhatsApp 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","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,OA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C,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","sources":["../../src/services/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * as whatsapp from "./whatsapp.js";
|