@distilled.cloud/mux 0.0.0 → 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.
Files changed (64) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +122 -4
  3. package/lib/.lazy.json +1 -0
  4. package/lib/_bundle/lazy.js +4 -0
  5. package/lib/_bundle/sdk.js +2 -0
  6. package/lib/_bundle/sdk.js.map +1 -0
  7. package/lib/credentials.d.ts +66 -0
  8. package/lib/credentials.d.ts.map +1 -0
  9. package/lib/credentials.js +1 -0
  10. package/lib/errors.d.ts +45 -0
  11. package/lib/errors.d.ts.map +1 -0
  12. package/lib/errors.js +1 -0
  13. package/lib/index.d.ts +44 -0
  14. package/lib/index.d.ts.map +1 -0
  15. package/lib/index.js +6 -0
  16. package/lib/pagination.d.ts +11 -0
  17. package/lib/pagination.d.ts.map +1 -0
  18. package/lib/pagination.js +1 -0
  19. package/lib/protocol.d.ts +19 -0
  20. package/lib/protocol.d.ts.map +1 -0
  21. package/lib/protocol.js +1 -0
  22. package/lib/retry.d.ts +54 -0
  23. package/lib/retry.d.ts.map +1 -0
  24. package/lib/retry.js +1 -0
  25. package/lib/services/data.d.ts +1347 -0
  26. package/lib/services/data.d.ts.map +1 -0
  27. package/lib/services/data.js +58 -0
  28. package/lib/services/data.js.map +1 -0
  29. package/lib/services/index.d.ts +5 -0
  30. package/lib/services/index.d.ts.map +1 -0
  31. package/lib/services/index.js +4 -0
  32. package/lib/services/robots.d.ts +2206 -0
  33. package/lib/services/robots.d.ts.map +1 -0
  34. package/lib/services/robots.js +75 -0
  35. package/lib/services/robots.js.map +1 -0
  36. package/lib/services/system.d.ts +263 -0
  37. package/lib/services/system.d.ts.map +1 -0
  38. package/lib/services/system.js +2 -0
  39. package/lib/services/system.js.map +1 -0
  40. package/lib/services/video.d.ts +1564 -0
  41. package/lib/services/video.d.ts.map +1 -0
  42. package/lib/services/video.js +100 -0
  43. package/lib/services/video.js.map +1 -0
  44. package/lib/services.lazy/data.js +3 -0
  45. package/lib/services.lazy/index.js +3 -0
  46. package/lib/services.lazy/robots.js +4 -0
  47. package/lib/services.lazy/system.js +1 -0
  48. package/lib/services.lazy/video.js +4 -0
  49. package/lib/traits.d.ts +7 -0
  50. package/lib/traits.d.ts.map +1 -0
  51. package/lib/traits.js +1 -0
  52. package/package.json +82 -2
  53. package/src/credentials.ts +142 -0
  54. package/src/errors.ts +59 -0
  55. package/src/index.ts +43 -0
  56. package/src/pagination.ts +63 -0
  57. package/src/protocol.ts +62 -0
  58. package/src/retry.ts +73 -0
  59. package/src/services/data.ts +3993 -0
  60. package/src/services/index.ts +5 -0
  61. package/src/services/robots.ts +4712 -0
  62. package/src/services/system.ts +752 -0
  63. package/src/services/video.ts +4291 -0
  64. package/src/traits.ts +40 -0
package/lib/retry.d.ts ADDED
@@ -0,0 +1,54 @@
1
+ import * as Retries from "@distilled.cloud/core/retry";
2
+ /**
3
+ * Mux retry surface -- a veneer over `@distilled.cloud/core/retry`.
4
+ *
5
+ * Mux rate-limits per environment and answers 429 past the limit (the
6
+ * System API documents it as `RateLimitedResponse`); `throttling` is the
7
+ * policy that recovers it.
8
+ *
9
+ * The `Retry` service tag is threaded into every generated operation via
10
+ * `API.make({ retry: Retry })`, so a caller-installed policy applies to all
11
+ * Mux calls below it and core's `makeDefault` is the fallback when none is
12
+ * provided.
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * import * as Mux from "@distilled.cloud/mux";
17
+ *
18
+ * myEffect.pipe(Mux.Retry.throttling);
19
+ * ```
20
+ */
21
+ import * as Context from "effect/Context";
22
+ import * as Effect from "effect/Effect";
23
+ export type Options = Retries.Options;
24
+ export type Factory = Retries.Factory;
25
+ export type Policy = Retries.Policy;
26
+ declare const Retry_base: Context.ServiceClass<Retry, "MuxRetry", Retries.Policy>;
27
+ /** Context tag for configuring retry behavior of Mux API calls. */
28
+ export declare class Retry extends /*@__PURE__*/ Retry_base {
29
+ }
30
+ /** Provides a custom retry policy to every Mux API call below it. */
31
+ export declare const policy: {
32
+ (options: Options): <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, Exclude<R, Retry>>;
33
+ (factory: Factory): <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, Exclude<R, Retry>>;
34
+ };
35
+ /** Disables all automatic retries. */
36
+ export declare const none: <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, Exclude<R, Retry>>;
37
+ /**
38
+ * The default retry policy (core's): transient/throttling/retryable errors,
39
+ * capped exponential backoff with jitter, server `retryAfter` hints honored
40
+ * with precedence.
41
+ */
42
+ export declare const makeDefault: Factory;
43
+ export declare const jittered: <Error, Env>(self: import("effect/Schedule").Schedule<unknown, unknown, Error, Env>) => import("effect/Schedule").Schedule<unknown, unknown, Error, Env>;
44
+ 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>;
45
+ /** Retry options that retry all throttling errors indefinitely. */
46
+ export declare const throttlingOptions: Options;
47
+ /** Retries all throttling errors indefinitely (honoring server hints). */
48
+ export declare const throttling: <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, Exclude<R, Retry>>;
49
+ /** Retry options that retry all transient errors indefinitely. */
50
+ export declare const transientOptions: Options;
51
+ /** Retries all transient errors indefinitely. */
52
+ export declare const transient: <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, Exclude<R, Retry>>;
53
+ export {};
54
+ //# 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;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAA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AM,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";