@distilled.cloud/core 1.0.0-rc.14 → 1.0.0-rc.16

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 (312) hide show
  1. package/lib/api.d.ts +118 -13
  2. package/lib/api.d.ts.map +1 -1
  3. package/lib/api.js +755 -147
  4. package/lib/api.js.map +1 -1
  5. package/lib/category.d.ts.map +1 -1
  6. package/lib/category.js +146 -146
  7. package/lib/category.js.map +1 -1
  8. package/lib/chunks.d.ts +3 -0
  9. package/lib/chunks.d.ts.map +1 -0
  10. package/lib/chunks.js +11 -0
  11. package/lib/chunks.js.map +1 -0
  12. package/lib/codegen/boolean-string-enums.js +36 -36
  13. package/lib/codegen/chunk.d.ts +7 -0
  14. package/lib/codegen/chunk.d.ts.map +1 -0
  15. package/lib/codegen/chunk.js +139 -0
  16. package/lib/codegen/chunk.js.map +1 -0
  17. package/lib/codegen/cli.d.ts.map +1 -1
  18. package/lib/codegen/cli.js +28 -14
  19. package/lib/codegen/cli.js.map +1 -1
  20. package/lib/codegen/datafy.d.ts +14 -0
  21. package/lib/codegen/datafy.d.ts.map +1 -0
  22. package/lib/codegen/datafy.js +853 -0
  23. package/lib/codegen/datafy.js.map +1 -0
  24. package/lib/codegen/dedupe.d.ts +5 -0
  25. package/lib/codegen/dedupe.d.ts.map +1 -0
  26. package/lib/codegen/dedupe.js +153 -0
  27. package/lib/codegen/dedupe.js.map +1 -0
  28. package/lib/codegen/emit.js +56 -56
  29. package/lib/codegen/format.js +18 -18
  30. package/lib/codegen/generated-at.js +29 -29
  31. package/lib/codegen/generator.d.ts.map +1 -1
  32. package/lib/codegen/generator.js +92 -84
  33. package/lib/codegen/generator.js.map +1 -1
  34. package/lib/codegen/graph.js +36 -36
  35. package/lib/codegen/graphql-client.d.ts +2 -0
  36. package/lib/codegen/graphql-client.d.ts.map +1 -1
  37. package/lib/codegen/graphql-client.js +55 -26
  38. package/lib/codegen/graphql-client.js.map +1 -1
  39. package/lib/codegen/graphql.js +113 -113
  40. package/lib/codegen/latin1.d.ts +3 -0
  41. package/lib/codegen/latin1.d.ts.map +1 -0
  42. package/lib/codegen/latin1.js +126 -0
  43. package/lib/codegen/latin1.js.map +1 -0
  44. package/lib/codegen/members.d.ts +7 -0
  45. package/lib/codegen/members.d.ts.map +1 -1
  46. package/lib/codegen/members.js +26 -19
  47. package/lib/codegen/members.js.map +1 -1
  48. package/lib/codegen/model-diff.js +6 -6
  49. package/lib/codegen/naming.js +19 -19
  50. package/lib/codegen/openapi-cli.js +15 -15
  51. package/lib/codegen/openapi.d.ts +17 -0
  52. package/lib/codegen/openapi.d.ts.map +1 -1
  53. package/lib/codegen/openapi.js +323 -169
  54. package/lib/codegen/openapi.js.map +1 -1
  55. package/lib/codegen/operations.js +14 -14
  56. package/lib/codegen/pagination.js +11 -11
  57. package/lib/codegen/patch-audit.js +57 -57
  58. package/lib/codegen/patches.js +79 -79
  59. package/lib/codegen/prelude.js +19 -19
  60. package/lib/codegen/privatize.d.ts +21 -0
  61. package/lib/codegen/privatize.d.ts.map +1 -0
  62. package/lib/codegen/privatize.js +176 -0
  63. package/lib/codegen/privatize.js.map +1 -0
  64. package/lib/codegen/proto.js +25 -25
  65. package/lib/codegen/pure.d.ts +6 -0
  66. package/lib/codegen/pure.d.ts.map +1 -0
  67. package/lib/codegen/pure.js +91 -0
  68. package/lib/codegen/pure.js.map +1 -0
  69. package/lib/codegen/rewrite-operation-ids.js +108 -108
  70. package/lib/codegen/spec-path.js +57 -57
  71. package/lib/codegen/table.d.ts +5 -0
  72. package/lib/codegen/table.d.ts.map +1 -0
  73. package/lib/codegen/table.js +249 -0
  74. package/lib/codegen/table.js.map +1 -0
  75. package/lib/config.d.ts +27 -0
  76. package/lib/config.d.ts.map +1 -0
  77. package/lib/config.js +161 -0
  78. package/lib/config.js.map +1 -0
  79. package/lib/crypto.d.ts +76 -0
  80. package/lib/crypto.d.ts.map +1 -0
  81. package/lib/crypto.js +130 -0
  82. package/lib/crypto.js.map +1 -0
  83. package/lib/debug.d.ts +2 -0
  84. package/lib/debug.d.ts.map +1 -0
  85. package/lib/debug.js +8 -0
  86. package/lib/debug.js.map +1 -0
  87. package/lib/error-category.d.ts +1 -1
  88. package/lib/error-category.d.ts.map +1 -1
  89. package/lib/error-category.js +7 -6
  90. package/lib/error-category.js.map +1 -1
  91. package/lib/errors.d.ts +62 -62
  92. package/lib/errors.d.ts.map +1 -1
  93. package/lib/errors.js +117 -114
  94. package/lib/errors.js.map +1 -1
  95. package/lib/graphql.d.ts +31 -20
  96. package/lib/graphql.d.ts.map +1 -1
  97. package/lib/graphql.js +150 -119
  98. package/lib/graphql.js.map +1 -1
  99. package/lib/graphql.types.js +4 -3
  100. package/lib/graphql.types.js.map +1 -1
  101. package/lib/index.d.ts +3 -2
  102. package/lib/index.d.ts.map +1 -1
  103. package/lib/index.js +15 -14
  104. package/lib/index.js.map +1 -1
  105. package/lib/json-patch.d.ts +2 -2
  106. package/lib/json-patch.js +28 -28
  107. package/lib/pagination.d.ts +9 -25
  108. package/lib/pagination.d.ts.map +1 -1
  109. package/lib/pagination.js +95 -90
  110. package/lib/pagination.js.map +1 -1
  111. package/lib/plain-values.d.ts +10 -0
  112. package/lib/plain-values.d.ts.map +1 -0
  113. package/lib/plain-values.js +40 -0
  114. package/lib/plain-values.js.map +1 -0
  115. package/lib/protocol-http.d.ts +50 -14
  116. package/lib/protocol-http.d.ts.map +1 -1
  117. package/lib/protocol-http.js +351 -178
  118. package/lib/protocol-http.js.map +1 -1
  119. package/lib/protocol-rest.d.ts +38 -25
  120. package/lib/protocol-rest.d.ts.map +1 -1
  121. package/lib/protocol-rest.js +238 -130
  122. package/lib/protocol-rest.js.map +1 -1
  123. package/lib/query.js +16 -16
  124. package/lib/response-validation-strict.d.ts +48 -0
  125. package/lib/response-validation-strict.d.ts.map +1 -0
  126. package/lib/response-validation-strict.js +284 -0
  127. package/lib/response-validation-strict.js.map +1 -0
  128. package/lib/response-validation.d.ts +43 -25
  129. package/lib/response-validation.d.ts.map +1 -1
  130. package/lib/response-validation.js +112 -70
  131. package/lib/response-validation.js.map +1 -1
  132. package/lib/retry-after.d.ts +3 -3
  133. package/lib/retry-after.js +49 -49
  134. package/lib/retry.d.ts +48 -29
  135. package/lib/retry.d.ts.map +1 -1
  136. package/lib/retry.js +142 -154
  137. package/lib/retry.js.map +1 -1
  138. package/lib/schema-lite-impl.d.ts +158 -0
  139. package/lib/schema-lite-impl.d.ts.map +1 -0
  140. package/lib/schema-lite-impl.js +341 -0
  141. package/lib/schema-lite-impl.js.map +1 -0
  142. package/lib/schema-lite-typed.d.ts +41 -0
  143. package/lib/schema-lite-typed.d.ts.map +1 -0
  144. package/lib/schema-lite-typed.js +27 -0
  145. package/lib/schema-lite-typed.js.map +1 -0
  146. package/lib/schema-lite.d.ts +40 -0
  147. package/lib/schema-lite.d.ts.map +1 -0
  148. package/lib/schema-lite.js +31 -0
  149. package/lib/schema-lite.js.map +1 -0
  150. package/lib/schema.d.ts +20 -6
  151. package/lib/schema.d.ts.map +1 -1
  152. package/lib/schema.js +202 -30
  153. package/lib/schema.js.map +1 -1
  154. package/lib/testing.d.ts +3 -2
  155. package/lib/testing.d.ts.map +1 -1
  156. package/lib/testing.js +22 -21
  157. package/lib/testing.js.map +1 -1
  158. package/lib/trait.d.ts +13 -13
  159. package/lib/trait.d.ts.map +1 -1
  160. package/lib/trait.js +80 -80
  161. package/lib/trait.js.map +1 -1
  162. package/lib/xml.d.ts +1 -1
  163. package/lib/xml.d.ts.map +1 -1
  164. package/lib/xml.js +38 -26
  165. package/lib/xml.js.map +1 -1
  166. package/package.json +9 -7
  167. package/src/api.ts +1079 -180
  168. package/src/category.ts +33 -33
  169. package/src/chunks.ts +30 -0
  170. package/src/codegen/chunk.ts +147 -0
  171. package/src/codegen/cli.ts +27 -1
  172. package/src/codegen/datafy.ts +874 -0
  173. package/src/codegen/dedupe.ts +173 -0
  174. package/src/codegen/generator.ts +10 -3
  175. package/src/codegen/graphql-client.ts +49 -15
  176. package/src/codegen/latin1.ts +131 -0
  177. package/src/codegen/members.ts +8 -0
  178. package/src/codegen/openapi.ts +194 -3
  179. package/src/codegen/privatize.ts +200 -0
  180. package/src/codegen/pure.ts +94 -0
  181. package/src/codegen/table.ts +254 -0
  182. package/src/config.ts +216 -0
  183. package/src/crypto.ts +202 -0
  184. package/src/debug.ts +8 -0
  185. package/src/error-category.ts +2 -1
  186. package/src/errors.ts +65 -56
  187. package/src/graphql.ts +109 -62
  188. package/src/graphql.types.ts +9 -7
  189. package/src/index.ts +3 -2
  190. package/src/json-patch.ts +2 -2
  191. package/src/pagination.ts +37 -18
  192. package/src/plain-values.ts +41 -0
  193. package/src/protocol-http.ts +378 -145
  194. package/src/protocol-rest.ts +337 -169
  195. package/src/response-validation-strict.ts +327 -0
  196. package/src/response-validation.ts +101 -50
  197. package/src/retry-after.ts +3 -3
  198. package/src/retry.ts +94 -93
  199. package/src/schema-lite-impl.ts +550 -0
  200. package/src/schema-lite-typed.ts +44 -0
  201. package/src/schema-lite.ts +44 -0
  202. package/src/schema.ts +258 -14
  203. package/src/testing.ts +4 -2
  204. package/src/trait.ts +36 -28
  205. package/src/xml.ts +31 -17
  206. package/lib/codegen/boolean-string-enums.test.d.ts +0 -2
  207. package/lib/codegen/boolean-string-enums.test.d.ts.map +0 -1
  208. package/lib/codegen/boolean-string-enums.test.js +0 -275
  209. package/lib/codegen/boolean-string-enums.test.js.map +0 -1
  210. package/lib/codegen/defer-naming.test.d.ts +0 -2
  211. package/lib/codegen/defer-naming.test.d.ts.map +0 -1
  212. package/lib/codegen/defer-naming.test.js +0 -105
  213. package/lib/codegen/defer-naming.test.js.map +0 -1
  214. package/lib/codegen/generated-at.test.d.ts +0 -2
  215. package/lib/codegen/generated-at.test.d.ts.map +0 -1
  216. package/lib/codegen/generated-at.test.js +0 -81
  217. package/lib/codegen/generated-at.test.js.map +0 -1
  218. package/lib/codegen/generator.test.d.ts +0 -2
  219. package/lib/codegen/generator.test.d.ts.map +0 -1
  220. package/lib/codegen/generator.test.js +0 -121
  221. package/lib/codegen/generator.test.js.map +0 -1
  222. package/lib/codegen/graphql-client.test.d.ts +0 -2
  223. package/lib/codegen/graphql-client.test.d.ts.map +0 -1
  224. package/lib/codegen/graphql-client.test.js +0 -171
  225. package/lib/codegen/graphql-client.test.js.map +0 -1
  226. package/lib/codegen/openapi-binary.test.d.ts +0 -2
  227. package/lib/codegen/openapi-binary.test.d.ts.map +0 -1
  228. package/lib/codegen/openapi-binary.test.js +0 -67
  229. package/lib/codegen/openapi-binary.test.js.map +0 -1
  230. package/lib/codegen/patch-audit.test.d.ts +0 -2
  231. package/lib/codegen/patch-audit.test.d.ts.map +0 -1
  232. package/lib/codegen/patch-audit.test.js +0 -141
  233. package/lib/codegen/patch-audit.test.js.map +0 -1
  234. package/lib/codegen/patches.test.d.ts +0 -2
  235. package/lib/codegen/patches.test.d.ts.map +0 -1
  236. package/lib/codegen/patches.test.js +0 -155
  237. package/lib/codegen/patches.test.js.map +0 -1
  238. package/lib/codegen/protocol-imports.test.d.ts +0 -2
  239. package/lib/codegen/protocol-imports.test.d.ts.map +0 -1
  240. package/lib/codegen/protocol-imports.test.js +0 -36
  241. package/lib/codegen/protocol-imports.test.js.map +0 -1
  242. package/lib/codegen/rewrite-operation-ids.test.d.ts +0 -2
  243. package/lib/codegen/rewrite-operation-ids.test.d.ts.map +0 -1
  244. package/lib/codegen/rewrite-operation-ids.test.js +0 -451
  245. package/lib/codegen/rewrite-operation-ids.test.js.map +0 -1
  246. package/lib/codegen/untagged-unions.test.d.ts +0 -2
  247. package/lib/codegen/untagged-unions.test.d.ts.map +0 -1
  248. package/lib/codegen/untagged-unions.test.js +0 -80
  249. package/lib/codegen/untagged-unions.test.js.map +0 -1
  250. package/lib/fixtures/xml/upstream-validator.json +0 -397
  251. package/lib/graphql.test.d.ts +0 -2
  252. package/lib/graphql.test.d.ts.map +0 -1
  253. package/lib/graphql.test.js +0 -151
  254. package/lib/graphql.test.js.map +0 -1
  255. package/lib/json-patch.test.d.ts +0 -2
  256. package/lib/json-patch.test.d.ts.map +0 -1
  257. package/lib/json-patch.test.js +0 -65
  258. package/lib/json-patch.test.js.map +0 -1
  259. package/lib/pagination.test.d.ts +0 -2
  260. package/lib/pagination.test.d.ts.map +0 -1
  261. package/lib/pagination.test.js +0 -131
  262. package/lib/pagination.test.js.map +0 -1
  263. package/lib/protocol-http.test.d.ts +0 -2
  264. package/lib/protocol-http.test.d.ts.map +0 -1
  265. package/lib/protocol-http.test.js +0 -228
  266. package/lib/protocol-http.test.js.map +0 -1
  267. package/lib/protocol-rest.test.d.ts +0 -2
  268. package/lib/protocol-rest.test.d.ts.map +0 -1
  269. package/lib/protocol-rest.test.js +0 -498
  270. package/lib/protocol-rest.test.js.map +0 -1
  271. package/lib/response-validation.test.d.ts +0 -2
  272. package/lib/response-validation.test.d.ts.map +0 -1
  273. package/lib/response-validation.test.js +0 -72
  274. package/lib/response-validation.test.js.map +0 -1
  275. package/lib/retry-after.test.d.ts +0 -2
  276. package/lib/retry-after.test.d.ts.map +0 -1
  277. package/lib/retry-after.test.js +0 -204
  278. package/lib/retry-after.test.js.map +0 -1
  279. package/lib/retry.test.d.ts +0 -2
  280. package/lib/retry.test.d.ts.map +0 -1
  281. package/lib/retry.test.js +0 -407
  282. package/lib/retry.test.js.map +0 -1
  283. package/lib/sdks.test.d.ts +0 -2
  284. package/lib/sdks.test.d.ts.map +0 -1
  285. package/lib/sdks.test.js +0 -76
  286. package/lib/sdks.test.js.map +0 -1
  287. package/lib/xml.test.d.ts +0 -2
  288. package/lib/xml.test.d.ts.map +0 -1
  289. package/lib/xml.test.js +0 -210
  290. package/lib/xml.test.js.map +0 -1
  291. package/src/codegen/boolean-string-enums.test.ts +0 -299
  292. package/src/codegen/defer-naming.test.ts +0 -113
  293. package/src/codegen/generated-at.test.ts +0 -89
  294. package/src/codegen/generator.test.ts +0 -137
  295. package/src/codegen/graphql-client.test.ts +0 -189
  296. package/src/codegen/openapi-binary.test.ts +0 -91
  297. package/src/codegen/patch-audit.test.ts +0 -160
  298. package/src/codegen/patches.test.ts +0 -188
  299. package/src/codegen/protocol-imports.test.ts +0 -39
  300. package/src/codegen/rewrite-operation-ids.test.ts +0 -472
  301. package/src/codegen/untagged-unions.test.ts +0 -85
  302. package/src/fixtures/xml/upstream-validator.json +0 -397
  303. package/src/graphql.test.ts +0 -198
  304. package/src/json-patch.test.ts +0 -77
  305. package/src/pagination.test.ts +0 -169
  306. package/src/protocol-http.test.ts +0 -276
  307. package/src/protocol-rest.test.ts +0 -703
  308. package/src/response-validation.test.ts +0 -89
  309. package/src/retry-after.test.ts +0 -267
  310. package/src/retry.test.ts +0 -566
  311. package/src/sdks.test.ts +0 -87
  312. package/src/xml.test.ts +0 -251
@@ -1,29 +1,29 @@
1
- /**
2
- * Server-provided retry hint parsing.
3
- *
4
- * Standardizes parsing of:
5
- * - `Retry-After` (RFC 7231 §7.1.3): `delay-seconds` (integer) or `HTTP-date`.
6
- * - `RateLimit` (IETF draft-ietf-httpapi-ratelimit-headers): structured
7
- * dictionary `r=<remaining>, t=<seconds-until-reset>`.
8
- *
9
- * Each SDK's `matchError` calls these helpers and attaches the resulting
10
- * `Duration` to retryable errors via the optional `retryAfter` field, where
11
- * the retry policy will honor it with precedence over the default backoff.
12
- *
13
- * Services that use bespoke headers or body fields are expected to do their
14
- * own parsing in the SDK's `matchError`, optionally falling back to these
15
- * helpers for the standard cases.
16
- */
1
+
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+
14
+
15
+
16
+
17
17
  import * as Duration from "effect/Duration";
18
18
  import { RETRYABLE_HTTP_STATUSES } from "./errors.js";
19
- /**
20
- * Parse the standard `Retry-After` HTTP header per RFC 7231 §7.1.3.
21
- *
22
- * Accepts either a non-negative integer number of seconds (the common case)
23
- * or an HTTP-date. HTTP-dates in the past produce a zero duration.
24
- *
25
- * Returns `undefined` when the header is missing or unparseable.
26
- */
19
+
20
+
21
+
22
+
23
+
24
+
25
+
26
+
27
27
  export const parseRetryAfter = (headers) => {
28
28
  const raw = headers?.["retry-after"];
29
29
  if (!raw)
@@ -51,18 +51,18 @@ export const parseRetryAfter = (headers) => {
51
51
  }
52
52
  return undefined;
53
53
  };
54
- /**
55
- * Parse the IETF `RateLimit` structured header.
56
- *
57
- * Examples:
58
- * `RateLimit: limit=100, remaining=0, reset=30` (older draft)
59
- * `RateLimit: "default";r=0;t=30` (newer draft)
60
- * `RateLimit: r=0, t=30` (compact form)
61
- *
62
- * Returns the `t` (seconds until reset) value as a Duration, but only when
63
- * `r` (remaining quota) is present and equals `0` — i.e., we're actually
64
- * rate-limited right now. Returns `undefined` otherwise.
65
- */
54
+
55
+
56
+
57
+
58
+
59
+
60
+
61
+
62
+
63
+
64
+
65
+
66
66
  export const parseRatelimit = (headers) => {
67
67
  const raw = headers?.["ratelimit"];
68
68
  if (!raw)
@@ -90,20 +90,20 @@ export const parseRatelimit = (headers) => {
90
90
  return undefined;
91
91
  return Duration.seconds(reset);
92
92
  };
93
- /**
94
- * Convenience: try `Retry-After` first, then `RateLimit`. Returns the first
95
- * successful parse, or `undefined` if neither header yields a usable value.
96
- */
93
+
94
+
95
+
96
+
97
97
  export const parseServerRetryHint = (headers) => parseRetryAfter(headers) ?? parseRatelimit(headers);
98
- /**
99
- * Status-gated variant of {@link parseServerRetryHint}. Returns `undefined`
100
- * unless `status` is one whose error class actually declares a `retryAfter`
101
- * field (see `RETRYABLE_HTTP_STATUSES`). Use this in `matchError` when you
102
- * dispatch off a generic `HTTP_STATUS_MAP` lookup that includes both
103
- * retryable (429/5xx/423) and non-retryable (4xx) classes — it prevents
104
- * stale `retryAfter` properties from being attached to errors like
105
- * `BadRequest` or `NotFound` (which would otherwise leak into JSON output).
106
- */
98
+
99
+
100
+
101
+
102
+
103
+
104
+
105
+
106
+
107
107
  export const parseRetryAfterForStatus = (status, headers) => {
108
108
  if (!RETRYABLE_HTTP_STATUSES.has(status))
109
109
  return undefined;
package/lib/retry.d.ts CHANGED
@@ -1,11 +1,41 @@
1
+ /**
2
+ * Retry Policy System
3
+ *
4
+ * Provides configurable retry policies for API operations.
5
+ * Each SDK creates its own `Retry` Context.Service tag (via
6
+ * `makeRetryService`) and threads it into `makeAPI({ retry: <SDK>.Retry })`
7
+ * so that callers can install a blanket retry policy at the layer level
8
+ * for that SDK without wrapping every call with `Effect.retry`.
9
+ */
1
10
  import * as Context from "effect/Context";
2
11
  import * as Duration from "effect/Duration";
12
+ import * as Effect from "effect/Effect";
3
13
  import * as Layer from "effect/Layer";
4
14
  import * as Ref from "effect/Ref";
5
15
  import * as Schedule from "effect/Schedule";
6
16
  /**
7
17
  * Retry policy options that match the Effect.retry contract.
8
18
  */
19
+ /**
20
+ * Capped exponential backoff, as plain data: the built-in policies use this
21
+ * instead of an Effect `Schedule`, so bundles do not carry the Schedule
22
+ * machinery unless a caller supplies a schedule of their own.
23
+ *
24
+ * Delay before retry `n` (0-based): `min(baseMs * factor^n, capMs)`; a
25
+ * server `retryAfter` hint replaces it when `serverHint` is set (capped by
26
+ * {@link ServerRetryHintCapMs}); otherwise throttling errors wait at least
27
+ * `minThrottleMs`. Then up to `jitterMs` of random jitter is added.
28
+ */
29
+ export interface Backoff {
30
+ readonly baseMs: number;
31
+ readonly factor: number;
32
+ readonly capMs: number;
33
+ /** Stop after this many retries; unlimited when absent. */
34
+ readonly maxRetries?: number;
35
+ readonly jitterMs?: number;
36
+ readonly minThrottleMs?: number;
37
+ readonly serverHint?: boolean;
38
+ }
9
39
  export interface Options {
10
40
  /**
11
41
  * Predicate to determine if an error should trigger a retry.
@@ -15,6 +45,8 @@ export interface Options {
15
45
  * The schedule to use for retrying.
16
46
  */
17
47
  readonly schedule?: Schedule.Schedule<unknown>;
48
+ /** Used when no `schedule` is given. */
49
+ readonly backoff?: Backoff;
18
50
  }
19
51
  /**
20
52
  * A factory function that creates retry policy options with access to the last error ref.
@@ -74,11 +106,22 @@ export declare const serverRetryHintCapLayer: (capMs: number) => Layer.Layer<num
74
106
  * Effective cap when neither {@link ServerRetryHintCapMs} nor
75
107
  * `DISTILLED_SERVER_RETRY_HINT_CAP_MS` is set: {@link DEFAULT_SERVER_RETRY_HINT_CAP_MS}.
76
108
  *
77
- * Reads the `DISTILLED_SERVER_RETRY_HINT_CAP_MS` environment variable via
78
- * Effect's {@link Config} (must be a non-negative finite number; invalid
79
- * values fall back to the default).
109
+ * Reads the `DISTILLED_SERVER_RETRY_HINT_CAP_MS` environment variable (must
110
+ * be a non-negative finite number; invalid values fall back to the default).
111
+ * It reads `process.env` directly: Effect's `Config` would add about 5 KB
112
+ * gzip to every bundle for this one optional knob. Use
113
+ * {@link ServerRetryHintCapMs} to set the cap from code.
80
114
  */
81
115
  export declare const readServerRetryHintCapMsFromEnv: () => number;
116
+ export declare const resolveServerRetryHintCapMs: () => Effect.Effect<number, never, never>;
117
+ /**
118
+ * Extract a server-provided retry hint (in milliseconds) from an error's
119
+ * optional `retryAfter` field, capped by the effective server-hint cap
120
+ * (see {@link ServerRetryHintCapMs} and {@link readServerRetryHintCapMsFromEnv}).
121
+ *
122
+ * Returns `undefined` when the error doesn't carry a hint.
123
+ */
124
+ export declare const serverHintMillis: (error: unknown, capMs: number) => number | undefined;
82
125
  /**
83
126
  * Creates the default retry policy.
84
127
  *
@@ -98,35 +141,11 @@ export declare const readServerRetryHintCapMsFromEnv: () => number;
98
141
  * high request concurrency routinely outlast a short 5-attempt/3s policy
99
142
  * while a genuinely broken credential still fails within seconds.
100
143
  */
144
+ /** The policy used when the context provides none. */
145
+ export declare const defaultOptions: Options;
101
146
  export declare const makeDefault: Factory;
102
- /**
103
- * Factory for the throttling-only retry policy. Honors server hints when
104
- * present so callers using `<SDK>.Retry.throttling` get correct backoff.
105
- */
106
147
  export declare const throttlingFactory: Factory;
107
- /**
108
- * Retry options that retries all throttling errors indefinitely.
109
- *
110
- * Note: prefer {@link throttlingFactory} when you want server-hint honoring.
111
- * This static `Options` form does not have access to `lastError` and so
112
- * cannot read `error.retryAfter`.
113
- */
114
148
  export declare const throttlingOptions: Options;
115
- /**
116
- * Factory for the transient retry policy. Honors server hints when present
117
- * so callers using `<SDK>.Retry.transient` get correct backoff.
118
- */
119
149
  export declare const transientFactory: Factory;
120
- /**
121
- * Retry options that retries all transient errors indefinitely.
122
- *
123
- * This includes:
124
- * 1. Throttling errors
125
- * 2. Server errors
126
- * 3. Network errors
127
- * 4. Locked errors (423)
128
- *
129
- * Note: prefer {@link transientFactory} when you want server-hint honoring.
130
- */
131
150
  export declare const transientOptions: Options;
132
151
  //# sourceMappingURL=retry.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"retry.d.ts","sourceRoot":"","sources":["../src/retry.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAG5C,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAEtC,OAAO,KAAK,GAAG,MAAM,YAAY,CAAC;AAClC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAO5C;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB;;OAEG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC;IAC7C;;OAEG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;CAChD;AAED;;;GAGG;AACH,MAAM,MAAM,OAAO,GAAG,CAAC,SAAS,EAAE,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,OAAO,CAAC;AAE/D;;GAEG;AACH,MAAM,MAAM,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC;AAMvC;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,gBAAgB,SAAU,MAAM,8CAAyC,CAAC;AAMvF;;;GAGG;AACH,eAAO,MAAM,QAAQ,wHAEpB,CAAC;AAEF;;GAEG;A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AAgB,UAAW,OAAO,SAAS,MAAM,KAAG,MAAM,GAAG,SAIzE,CAAC;AA2BF;;;;;;;;;;;;;;;;;;GAkBG;AACH,sDAAsD;AACtD,eAAO,MAAM,cAAc,EAAE,OAW5B,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,OAA8B,CAAC;AAWzD,eAAO,MAAM,iBAAiB,EAAE,OAAwC,CAAC;AAMzE,eAAO,MAAM,iBAAiB,EAAE,OAG/B,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,OAAuC,CAAC;AAGvE,eAAO,MAAM,gBAAgB,EAAE,OAAiE,CAAC"}
package/lib/retry.js CHANGED
@@ -1,13 +1,12 @@
1
- /**
2
- * Retry Policy System
3
- *
4
- * Provides configurable retry policies for API operations.
5
- * Each SDK creates its own `Retry` Context.Service tag (via
6
- * `makeRetryService`) and threads it into `makeAPI({ retry: <SDK>.Retry })`
7
- * so that callers can install a blanket retry policy at the layer level
8
- * for that SDK without wrapping every call with `Effect.retry`.
9
- */
10
- import * as Config from "effect/Config";
1
+
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
11
10
  import * as Context from "effect/Context";
12
11
  import * as Duration from "effect/Duration";
13
12
  import * as Effect from "effect/Effect";
@@ -20,103 +19,116 @@ import { isThrottling, isTransientError } from "./category.js";
20
19
  // ============================================================================
21
20
  // Retry Service Factory
22
21
  // ============================================================================
23
- /**
24
- * Create a typed Retry service class for an SDK.
25
- * Each SDK creates its own Retry service using this factory; the SDK's
26
- * client wraps `makeAPI` with `retry: <SDK>.Retry` so the policy applies
27
- * to every API call below it.
28
- *
29
- * @example
30
- * ```ts
31
- * // packages/<sdk>/src/retry.ts
32
- * export class Retry extends makeRetryService("PlanetScaleRetry") {}
33
- * ```
34
- */
22
+
23
+
24
+
25
+
26
+
27
+
28
+
29
+
30
+
31
+
32
+
33
+
35
34
  export const makeRetryService = (name) => Context.Service()(name);
36
35
  // ============================================================================
37
36
  // Retry Schedule Utilities
38
37
  // ============================================================================
39
- /**
40
- * Custom jittered schedule helper.
41
- * Adds random jitter between 0-50ms to avoid thundering herd.
42
- */
43
- export const jittered = Schedule.addDelay(() => Effect.succeed(Duration.millis(Math.random() * 50)));
44
- /**
45
- * Cap delay at a maximum duration.
46
- */
38
+
39
+
40
+
41
+
42
+ export const jittered = /*@__PURE__*/ Schedule.addDelay(() => Effect.succeed(Duration.millis(Math.random() * 50)));
43
+
44
+
45
+
47
46
  export const capped = (max) => Schedule.modifyDelay(({ duration }) => Effect.succeed(Duration.isGreaterThan(duration, max) ? max : duration));
48
47
  // ============================================================================
49
48
  // Server Hint Helpers
50
49
  // ============================================================================
51
- /**
52
- * Default cap (milliseconds) on how long we'll honor a server-provided
53
- * `Retry-After` / `RateLimit` hint. A misbehaving server can otherwise park
54
- * us forever.
55
- */
50
+
51
+
52
+
53
+
54
+
56
55
  export const DEFAULT_SERVER_RETRY_HINT_CAP_MS = 60_000;
57
56
  const ENV_SERVER_RETRY_HINT_CAP_MS = "DISTILLED_SERVER_RETRY_HINT_CAP_MS";
58
- /**
59
- * Optional override for the server-hint cap, in milliseconds. When provided
60
- * via `Layer.succeed(ServerRetryHintCapMs, n)`, that value wins over the
61
- * environment.
62
- *
63
- * @example
64
- * ```ts
65
- * Effect.retry(op, policy).pipe(
66
- * Effect.provide(serverRetryHintCapLayer(120_000)),
67
- * )
68
- * ```
69
- */
70
- export const ServerRetryHintCapMs = Context.Service("@distilled.cloud/core/ServerRetryHintCapMs");
71
- /**
72
- * Layer that pins the server `retryAfter` cap to a fixed value (milliseconds).
73
- */
57
+
58
+
59
+
60
+
61
+
62
+
63
+
64
+
65
+
66
+
67
+
68
+
69
+ export const ServerRetryHintCapMs = /*@__PURE__*/ Context.Service("@distilled.cloud/core/ServerRetryHintCapMs");
70
+
71
+
72
+
74
73
  export const serverRetryHintCapLayer = (capMs) => Layer.succeed(ServerRetryHintCapMs, capMs);
75
- const serverRetryHintCapMsConfig = Config.String(ENV_SERVER_RETRY_HINT_CAP_MS).pipe(Config.map((raw) => {
76
- if (raw === "")
74
+
75
+
76
+
77
+
78
+
79
+
80
+
81
+
82
+
83
+
84
+ export const readServerRetryHintCapMsFromEnv = () => parseCapMs(globalThis.process?.env?.[ENV_SERVER_RETRY_HINT_CAP_MS]);
85
+ const parseCapMs = (raw) => {
86
+ if (raw === undefined || raw === "")
77
87
  return DEFAULT_SERVER_RETRY_HINT_CAP_MS;
78
88
  const n = Number(raw);
79
- if (!Number.isFinite(n) || n < 0)
80
- return DEFAULT_SERVER_RETRY_HINT_CAP_MS;
81
- return Math.trunc(n);
82
- }), Config.withDefault(DEFAULT_SERVER_RETRY_HINT_CAP_MS));
83
- /**
84
- * Effective cap when neither {@link ServerRetryHintCapMs} nor
85
- * `DISTILLED_SERVER_RETRY_HINT_CAP_MS` is set: {@link DEFAULT_SERVER_RETRY_HINT_CAP_MS}.
86
- *
87
- * Reads the `DISTILLED_SERVER_RETRY_HINT_CAP_MS` environment variable via
88
- * Effect's {@link Config} (must be a non-negative finite number; invalid
89
- * values fall back to the default).
90
- */
91
- export const readServerRetryHintCapMsFromEnv = () => Effect.runSync(serverRetryHintCapMsConfig.pipe(Effect.orElseSucceed(() => DEFAULT_SERVER_RETRY_HINT_CAP_MS)));
92
- const resolveServerRetryHintCapMs = () => Effect.gen(function* () {
89
+ return Number.isFinite(n) && n >= 0 ? Math.trunc(n) : DEFAULT_SERVER_RETRY_HINT_CAP_MS;
90
+ };
91
+
92
+
93
+
94
+
95
+
96
+
97
+ const CONFIG_PROVIDER_KEY = "effect/ConfigProvider";
98
+ export const resolveServerRetryHintCapMs = () => Effect.gen(function* () {
93
99
  const fromLayer = yield* Effect.serviceOption(ServerRetryHintCapMs);
94
100
  if (Option.isSome(fromLayer)) {
95
101
  const n = fromLayer.value;
96
102
  if (Number.isFinite(n) && n >= 0)
97
103
  return Math.trunc(n);
98
104
  }
99
- return yield* serverRetryHintCapMsConfig.pipe(Effect.orElseSucceed(() => DEFAULT_SERVER_RETRY_HINT_CAP_MS));
105
+ const provider = (yield* Effect.context()).mapUnsafe.get(CONFIG_PROVIDER_KEY);
106
+ if (!provider)
107
+ return readServerRetryHintCapMsFromEnv();
108
+ const node = yield* provider
109
+ .load([ENV_SERVER_RETRY_HINT_CAP_MS])
110
+ .pipe(Effect.orElseSucceed(() => undefined));
111
+ return parseCapMs(node?._tag === "Value" ? node.value : undefined);
100
112
  });
101
- /**
102
- * Extract a server-provided retry hint (in milliseconds) from an error's
103
- * optional `retryAfter` field, capped by the effective server-hint cap
104
- * (see {@link ServerRetryHintCapMs} and {@link readServerRetryHintCapMsFromEnv}).
105
- *
106
- * Returns `undefined` when the error doesn't carry a hint.
107
- */
108
- const serverHintMillis = (error, capMs) => {
113
+
114
+
115
+
116
+
117
+
118
+
119
+
120
+ export const serverHintMillis = (error, capMs) => {
109
121
  const hint = error?.retryAfter;
110
122
  if (!Duration.isDuration(hint))
111
123
  return undefined;
112
124
  return Math.min(Duration.toMillis(hint), capMs);
113
125
  };
114
- /**
115
- * Schedule modifier that honors `error.retryAfter` (set by the SDK's
116
- * `matchError` from `Retry-After` / `RateLimit` headers) with precedence
117
- * over the input delay. Falls back to the original delay when no hint is
118
- * present.
119
- */
126
+
127
+
128
+
129
+
130
+
131
+
120
132
  const honorServerHint = (lastError, baseline) => Schedule.modifyDelay(Effect.fnUntraced(function* ({ duration }) {
121
133
  const capMs = yield* resolveServerRetryHintCapMs();
122
134
  const error = yield* Ref.get(lastError);
@@ -129,81 +141,57 @@ const honorServerHint = (lastError, baseline) => Schedule.modifyDelay(Effect.fnU
129
141
  // ============================================================================
130
142
  // Default Retry Policies
131
143
  // ============================================================================
132
- /**
133
- * Creates the default retry policy.
134
- *
135
- * This policy:
136
- * - Retries transient errors (throttling, server, network, locked errors)
137
- * - Honors `error.retryAfter` (server-provided hint) with precedence, capped
138
- * by {@link DEFAULT_SERVER_RETRY_HINT_CAP_MS} by default; override with
139
- * `DISTILLED_SERVER_RETRY_HINT_CAP_MS` or {@link ServerRetryHintCapMs}
140
- * - Otherwise uses exponential backoff starting at 250ms with a factor of 2,
141
- * capped at 5s per delay
142
- * - Ensures at least 500ms delay for throttling errors
143
- * - Limits to 8 retry attempts
144
- * - Applies jitter to avoid thundering herd
145
- *
146
- * The 250ms/5s-cap/8-attempt shape (~20s of total patience) comes from
147
- * alchemy's Cloudflare provider suite, where transient auth blips under
148
- * high request concurrency routinely outlast a short 5-attempt/3s policy
149
- * while a genuinely broken credential still fails within seconds.
150
- */
151
- export const makeDefault = (lastError) => ({
144
+
145
+
146
+
147
+
148
+
149
+
150
+
151
+
152
+
153
+
154
+
155
+
156
+
157
+
158
+
159
+
160
+
161
+
162
+
163
+
164
+ export const defaultOptions = {
152
165
  while: (error) => isTransientError(error),
153
- // The 5s cap applies to the exponential backoff BEFORE the server hint is
154
- // considered, so a server-provided retryAfter longer than 5s is honored in
155
- // full (bounded only by the 60s hint cap inside honorServerHint). Capping
156
- // after the hint would silently clamp e.g. a Retry-After: 30 to 5s.
157
- schedule: Schedule.max([
158
- pipe(Schedule.exponential(250, 2), capped(Duration.seconds(5)), honorServerHint(lastError, (duration, error) => {
159
- if (isThrottling(error) && Duration.toMillis(duration) < 500) {
160
- return Duration.millis(500);
161
- }
162
- return duration;
163
- }), jittered),
164
- Schedule.recurs(8),
165
- ]),
166
- });
167
- /**
168
- * Factory for the throttling-only retry policy. Honors server hints when
169
- * present so callers using `<SDK>.Retry.throttling` get correct backoff.
170
- */
171
- export const throttlingFactory = (lastError) => ({
166
+ backoff: {
167
+ baseMs: 250,
168
+ factor: 2,
169
+ capMs: 5000,
170
+ maxRetries: 8,
171
+ jitterMs: 50,
172
+ minThrottleMs: 500,
173
+ serverHint: true,
174
+ },
175
+ };
176
+ export const makeDefault = () => defaultOptions;
177
+ const slowBackoff = {
178
+ baseMs: 1000,
179
+ factor: 2,
180
+ capMs: 5000,
181
+ jitterMs: 50,
182
+ serverHint: true,
183
+ };
184
+ const slowBackoffNoHint = { baseMs: 1000, factor: 2, capMs: 5000, jitterMs: 50 };
185
+ export const throttlingFactory = () => throttlingFactoryOptions;
186
+ const throttlingFactoryOptions = {
172
187
  while: (error) => isThrottling(error),
173
- schedule: pipe(Schedule.exponential(1000, 2), capped(Duration.seconds(5)), honorServerHint(lastError), jittered),
174
- });
175
- /**
176
- * Retry options that retries all throttling errors indefinitely.
177
- *
178
- * Note: prefer {@link throttlingFactory} when you want server-hint honoring.
179
- * This static `Options` form does not have access to `lastError` and so
180
- * cannot read `error.retryAfter`.
181
- */
188
+ backoff: slowBackoff,
189
+ };
182
190
  export const throttlingOptions = {
183
191
  while: (error) => isThrottling(error),
184
- schedule: pipe(Schedule.exponential(1000, 2), capped(Duration.seconds(5)), jittered),
185
- };
186
- /**
187
- * Factory for the transient retry policy. Honors server hints when present
188
- * so callers using `<SDK>.Retry.transient` get correct backoff.
189
- */
190
- export const transientFactory = (lastError) => ({
191
- while: isTransientError,
192
- schedule: pipe(Schedule.exponential(1000, 2), capped(Duration.seconds(5)), honorServerHint(lastError), jittered),
193
- });
194
- /**
195
- * Retry options that retries all transient errors indefinitely.
196
- *
197
- * This includes:
198
- * 1. Throttling errors
199
- * 2. Server errors
200
- * 3. Network errors
201
- * 4. Locked errors (423)
202
- *
203
- * Note: prefer {@link transientFactory} when you want server-hint honoring.
204
- */
205
- export const transientOptions = {
206
- while: isTransientError,
207
- schedule: pipe(Schedule.exponential(1000, 2), capped(Duration.seconds(5)), jittered),
192
+ backoff: slowBackoffNoHint,
208
193
  };
194
+ export const transientFactory = () => transientFactoryOptions;
195
+ const transientFactoryOptions = { while: isTransientError, backoff: slowBackoff };
196
+ export const transientOptions = { while: isTransientError, backoff: slowBackoffNoHint };
209
197
  //# sourceMappingURL=retry.js.map
package/lib/retry.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"retry.js","sourceRoot":"","sources":["../src/retry.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,O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