@distilled.cloud/core 1.0.0-rc.2 → 1.0.0-rc.20

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 (291) hide show
  1. package/LICENSE +201 -0
  2. package/lib/_bundle/aws.js +2 -0
  3. package/lib/_bundle/aws.js.map +1 -0
  4. package/lib/_bundle/base.js +5 -0
  5. package/lib/_bundle/base.js.map +1 -0
  6. package/lib/_bundle/graphql.js +3 -0
  7. package/lib/_bundle/graphql.js.map +1 -0
  8. package/lib/_bundle/grpc.js +2 -0
  9. package/lib/_bundle/grpc.js.map +1 -0
  10. package/lib/_bundle/rest.js +2 -0
  11. package/lib/_bundle/rest.js.map +1 -0
  12. package/lib/_bundle/xml.js +4 -0
  13. package/lib/_bundle/xml.js.map +1 -0
  14. package/lib/annotations.d.ts +17 -0
  15. package/lib/annotations.d.ts.map +1 -0
  16. package/lib/annotations.js +2 -0
  17. package/lib/annotations.js.map +1 -0
  18. package/lib/api.d.ts +174 -18
  19. package/lib/api.d.ts.map +1 -1
  20. package/lib/api.js +1 -178
  21. package/lib/category.d.ts +4 -4
  22. package/lib/category.d.ts.map +1 -1
  23. package/lib/category.js +1 -280
  24. package/lib/chunks.d.ts +3 -0
  25. package/lib/chunks.d.ts.map +1 -0
  26. package/lib/chunks.js +1 -0
  27. package/lib/config.d.ts +68 -0
  28. package/lib/config.d.ts.map +1 -0
  29. package/lib/config.js +1 -0
  30. package/lib/crypto.d.ts +76 -0
  31. package/lib/crypto.d.ts.map +1 -0
  32. package/lib/crypto.js +1 -0
  33. package/lib/error-category.d.ts +1 -1
  34. package/lib/error-category.d.ts.map +1 -1
  35. package/lib/error-category.js +1 -46
  36. package/lib/errors.d.ts +64 -72
  37. package/lib/errors.d.ts.map +1 -1
  38. package/lib/errors.js +1 -186
  39. package/lib/graphql.d.ts +403 -0
  40. package/lib/graphql.d.ts.map +1 -0
  41. package/lib/graphql.js +1 -0
  42. package/lib/graphql.types.d.ts +12 -0
  43. package/lib/graphql.types.d.ts.map +1 -0
  44. package/lib/graphql.types.js +1 -0
  45. package/lib/grpc-transport-cloudflare-http2.d.ts +7 -0
  46. package/lib/grpc-transport-cloudflare-http2.d.ts.map +1 -0
  47. package/lib/grpc-transport-cloudflare-http2.js +6 -0
  48. package/lib/grpc-transport-cloudflare-http2.js.map +1 -0
  49. package/lib/grpc-transport-cloudflare-sockets.d.ts +7 -0
  50. package/lib/grpc-transport-cloudflare-sockets.d.ts.map +1 -0
  51. package/lib/grpc-transport-cloudflare-sockets.js +5 -0
  52. package/lib/grpc-transport-cloudflare-sockets.js.map +1 -0
  53. package/lib/grpc-transport-node-http2.d.ts +19 -0
  54. package/lib/grpc-transport-node-http2.d.ts.map +1 -0
  55. package/lib/grpc-transport-node-http2.js +2 -0
  56. package/lib/grpc-transport-node-http2.js.map +1 -0
  57. package/lib/grpc-transport.d.ts +76 -0
  58. package/lib/grpc-transport.d.ts.map +1 -0
  59. package/lib/grpc-transport.js +1 -0
  60. package/lib/hpack.d.ts +34 -0
  61. package/lib/hpack.d.ts.map +1 -0
  62. package/lib/hpack.js +2 -0
  63. package/lib/hpack.js.map +1 -0
  64. package/lib/index.d.ts +32 -0
  65. package/lib/index.d.ts.map +1 -0
  66. package/lib/index.js +17 -0
  67. package/lib/pagination.d.ts +101 -24
  68. package/lib/pagination.d.ts.map +1 -1
  69. package/lib/pagination.js +1 -182
  70. package/lib/plain-values.d.ts +10 -0
  71. package/lib/plain-values.d.ts.map +1 -0
  72. package/lib/plain-values.js +2 -0
  73. package/lib/plain-values.js.map +1 -0
  74. package/lib/protobuf.d.ts +92 -0
  75. package/lib/protobuf.d.ts.map +1 -0
  76. package/lib/protobuf.js +1 -0
  77. package/lib/protocol-grpc.d.ts +86 -0
  78. package/lib/protocol-grpc.d.ts.map +1 -0
  79. package/lib/protocol-grpc.js +1 -0
  80. package/lib/protocol-http.d.ts +102 -23
  81. package/lib/protocol-http.d.ts.map +1 -1
  82. package/lib/protocol-http.js +1 -554
  83. package/lib/protocol-rest.d.ts +120 -50
  84. package/lib/protocol-rest.d.ts.map +1 -1
  85. package/lib/protocol-rest.js +1 -242
  86. package/lib/query.d.ts +29 -0
  87. package/lib/query.d.ts.map +1 -0
  88. package/lib/query.js +1 -0
  89. package/lib/response-validation-strict.d.ts +48 -0
  90. package/lib/response-validation-strict.d.ts.map +1 -0
  91. package/lib/response-validation-strict.js +1 -0
  92. package/lib/response-validation.d.ts +86 -0
  93. package/lib/response-validation.d.ts.map +1 -0
  94. package/lib/response-validation.js +1 -0
  95. package/lib/retry-after.d.ts +3 -3
  96. package/lib/retry-after.d.ts.map +1 -1
  97. package/lib/retry-after.js +1 -112
  98. package/lib/retry.d.ts +48 -29
  99. package/lib/retry.d.ts.map +1 -1
  100. package/lib/retry.js +1 -210
  101. package/lib/schema-lite-impl.d.ts +158 -0
  102. package/lib/schema-lite-impl.d.ts.map +1 -0
  103. package/lib/schema-lite-impl.js +1 -0
  104. package/lib/schema-lite-typed.d.ts +41 -0
  105. package/lib/schema-lite-typed.d.ts.map +1 -0
  106. package/lib/schema-lite-typed.js +1 -0
  107. package/lib/schema-lite.d.ts +40 -0
  108. package/lib/schema-lite.d.ts.map +1 -0
  109. package/lib/schema-lite.js +1 -0
  110. package/lib/schema.d.ts +21 -7
  111. package/lib/schema.d.ts.map +1 -1
  112. package/lib/schema.js +1 -48
  113. package/lib/sdk-error.d.ts +27 -0
  114. package/lib/sdk-error.d.ts.map +1 -0
  115. package/lib/sdk-error.js +1 -0
  116. package/lib/sensitive.d.ts +28 -0
  117. package/lib/sensitive.d.ts.map +1 -0
  118. package/lib/sensitive.js +2 -0
  119. package/lib/sensitive.js.map +1 -0
  120. package/lib/telemetry-debug.d.ts +6 -0
  121. package/lib/telemetry-debug.d.ts.map +1 -0
  122. package/lib/telemetry-debug.js +2 -0
  123. package/lib/telemetry-debug.js.map +1 -0
  124. package/lib/telemetry-hooks.d.ts +32 -0
  125. package/lib/telemetry-hooks.d.ts.map +1 -0
  126. package/lib/telemetry-hooks.js +2 -0
  127. package/lib/telemetry-hooks.js.map +1 -0
  128. package/lib/telemetry-host-rules.d.ts +23 -0
  129. package/lib/telemetry-host-rules.d.ts.map +1 -0
  130. package/lib/telemetry-host-rules.js +2 -0
  131. package/lib/telemetry-host-rules.js.map +1 -0
  132. package/lib/telemetry-lambda-context.d.ts +17 -0
  133. package/lib/telemetry-lambda-context.d.ts.map +1 -0
  134. package/lib/telemetry-lambda-context.js +2 -0
  135. package/lib/telemetry-lambda-context.js.map +1 -0
  136. package/lib/telemetry-message-context.d.ts +52 -0
  137. package/lib/telemetry-message-context.d.ts.map +1 -0
  138. package/lib/telemetry-message-context.js +2 -0
  139. package/lib/telemetry-message-context.js.map +1 -0
  140. package/lib/telemetry-metrics.d.ts +6 -0
  141. package/lib/telemetry-metrics.d.ts.map +1 -0
  142. package/lib/telemetry-metrics.js +2 -0
  143. package/lib/telemetry-metrics.js.map +1 -0
  144. package/lib/telemetry-name-template.d.ts +13 -0
  145. package/lib/telemetry-name-template.d.ts.map +1 -0
  146. package/lib/telemetry-name-template.js +2 -0
  147. package/lib/telemetry-name-template.js.map +1 -0
  148. package/lib/telemetry-stream.d.ts +11 -0
  149. package/lib/telemetry-stream.d.ts.map +1 -0
  150. package/lib/telemetry-stream.js +2 -0
  151. package/lib/telemetry-stream.js.map +1 -0
  152. package/lib/telemetry-xray.d.ts +28 -0
  153. package/lib/telemetry-xray.d.ts.map +1 -0
  154. package/lib/telemetry-xray.js +2 -0
  155. package/lib/telemetry-xray.js.map +1 -0
  156. package/lib/telemetry.d.ts +288 -0
  157. package/lib/telemetry.d.ts.map +1 -0
  158. package/lib/telemetry.js +3 -0
  159. package/lib/telemetry.js.map +1 -0
  160. package/lib/trait.d.ts +71 -20
  161. package/lib/trait.d.ts.map +1 -1
  162. package/lib/trait.js +1 -107
  163. package/lib/unknown-error.d.ts +18 -0
  164. package/lib/unknown-error.d.ts.map +1 -0
  165. package/lib/unknown-error.js +1 -0
  166. package/lib/xml.d.ts +44 -0
  167. package/lib/xml.d.ts.map +1 -0
  168. package/lib/xml.js +1 -0
  169. package/package.json +13 -13
  170. package/src/annotations.ts +53 -0
  171. package/src/api.ts +1370 -200
  172. package/src/category.ts +76 -106
  173. package/src/chunks.ts +30 -0
  174. package/src/config.ts +245 -0
  175. package/src/crypto.ts +202 -0
  176. package/src/error-category.ts +16 -29
  177. package/src/errors.ts +75 -75
  178. package/src/graphql.ts +1778 -0
  179. package/src/graphql.types.ts +105 -0
  180. package/src/grpc-transport-cloudflare-http2.ts +494 -0
  181. package/src/grpc-transport-cloudflare-sockets.ts +299 -0
  182. package/src/grpc-transport-node-http2.ts +234 -0
  183. package/src/grpc-transport.ts +118 -0
  184. package/src/hpack.ts +331 -0
  185. package/src/index.ts +31 -0
  186. package/src/pagination.ts +368 -94
  187. package/src/plain-values.ts +41 -0
  188. package/src/protobuf.ts +1332 -0
  189. package/src/protocol-grpc.ts +641 -0
  190. package/src/protocol-http.ts +622 -322
  191. package/src/protocol-rest.ts +440 -227
  192. package/src/query.ts +39 -0
  193. package/src/response-validation-strict.ts +327 -0
  194. package/src/response-validation.ts +161 -0
  195. package/src/retry-after.ts +7 -13
  196. package/src/retry.ts +96 -110
  197. package/src/schema-lite-impl.ts +550 -0
  198. package/src/schema-lite-typed.ts +44 -0
  199. package/src/schema-lite.ts +44 -0
  200. package/src/schema.ts +259 -15
  201. package/src/sdk-error.ts +33 -0
  202. package/src/sensitive.ts +154 -0
  203. package/src/telemetry-debug.ts +179 -0
  204. package/src/telemetry-hooks.ts +33 -0
  205. package/src/telemetry-host-rules.ts +39 -0
  206. package/src/telemetry-lambda-context.ts +46 -0
  207. package/src/telemetry-message-context.ts +170 -0
  208. package/src/telemetry-metrics.ts +69 -0
  209. package/src/telemetry-name-template.ts +26 -0
  210. package/src/telemetry-stream.ts +100 -0
  211. package/src/telemetry-xray.ts +66 -0
  212. package/src/telemetry.ts +832 -0
  213. package/src/trait.ts +106 -67
  214. package/src/unknown-error.ts +38 -0
  215. package/src/xml.ts +346 -0
  216. package/lib/api.js.map +0 -1
  217. package/lib/category.js.map +0 -1
  218. package/lib/codegen/cli.d.ts +0 -29
  219. package/lib/codegen/cli.d.ts.map +0 -1
  220. package/lib/codegen/cli.js +0 -165
  221. package/lib/codegen/cli.js.map +0 -1
  222. package/lib/codegen/emit.d.ts +0 -129
  223. package/lib/codegen/emit.d.ts.map +0 -1
  224. package/lib/codegen/emit.js +0 -105
  225. package/lib/codegen/emit.js.map +0 -1
  226. package/lib/codegen/format.d.ts +0 -23
  227. package/lib/codegen/format.d.ts.map +0 -1
  228. package/lib/codegen/format.js +0 -28
  229. package/lib/codegen/format.js.map +0 -1
  230. package/lib/codegen/generator.d.ts +0 -334
  231. package/lib/codegen/generator.d.ts.map +0 -1
  232. package/lib/codegen/generator.js +0 -691
  233. package/lib/codegen/generator.js.map +0 -1
  234. package/lib/codegen/graph.d.ts +0 -36
  235. package/lib/codegen/graph.d.ts.map +0 -1
  236. package/lib/codegen/graph.js +0 -136
  237. package/lib/codegen/graph.js.map +0 -1
  238. package/lib/codegen/members.d.ts +0 -25
  239. package/lib/codegen/members.d.ts.map +0 -1
  240. package/lib/codegen/members.js +0 -55
  241. package/lib/codegen/members.js.map +0 -1
  242. package/lib/codegen/naming.d.ts +0 -29
  243. package/lib/codegen/naming.d.ts.map +0 -1
  244. package/lib/codegen/naming.js +0 -74
  245. package/lib/codegen/naming.js.map +0 -1
  246. package/lib/codegen/openapi-cli.d.ts +0 -38
  247. package/lib/codegen/openapi-cli.d.ts.map +0 -1
  248. package/lib/codegen/openapi-cli.js +0 -107
  249. package/lib/codegen/openapi-cli.js.map +0 -1
  250. package/lib/codegen/openapi.d.ts +0 -115
  251. package/lib/codegen/openapi.d.ts.map +0 -1
  252. package/lib/codegen/openapi.js +0 -1220
  253. package/lib/codegen/openapi.js.map +0 -1
  254. package/lib/codegen/operations.d.ts +0 -24
  255. package/lib/codegen/operations.d.ts.map +0 -1
  256. package/lib/codegen/operations.js +0 -56
  257. package/lib/codegen/operations.js.map +0 -1
  258. package/lib/codegen/pagination.d.ts +0 -39
  259. package/lib/codegen/pagination.d.ts.map +0 -1
  260. package/lib/codegen/pagination.js +0 -33
  261. package/lib/codegen/pagination.js.map +0 -1
  262. package/lib/codegen/prelude.d.ts +0 -15
  263. package/lib/codegen/prelude.d.ts.map +0 -1
  264. package/lib/codegen/prelude.js +0 -60
  265. package/lib/codegen/prelude.js.map +0 -1
  266. package/lib/error-category.js.map +0 -1
  267. package/lib/errors.js.map +0 -1
  268. package/lib/json-patch.d.ts +0 -44
  269. package/lib/json-patch.d.ts.map +0 -1
  270. package/lib/json-patch.js +0 -174
  271. package/lib/json-patch.js.map +0 -1
  272. package/lib/pagination.js.map +0 -1
  273. package/lib/protocol-http.js.map +0 -1
  274. package/lib/protocol-rest.js.map +0 -1
  275. package/lib/retry-after.js.map +0 -1
  276. package/lib/retry.js.map +0 -1
  277. package/lib/schema.js.map +0 -1
  278. package/lib/trait.js.map +0 -1
  279. package/src/codegen/cli.ts +0 -268
  280. package/src/codegen/emit.ts +0 -207
  281. package/src/codegen/format.ts +0 -47
  282. package/src/codegen/generator.ts +0 -1153
  283. package/src/codegen/graph.ts +0 -151
  284. package/src/codegen/members.ts +0 -71
  285. package/src/codegen/naming.ts +0 -86
  286. package/src/codegen/openapi-cli.ts +0 -166
  287. package/src/codegen/openapi.ts +0 -1450
  288. package/src/codegen/operations.ts +0 -76
  289. package/src/codegen/pagination.ts +0 -71
  290. package/src/codegen/prelude.ts +0 -70
  291. package/src/json-patch.ts +0 -222
package/lib/errors.d.ts CHANGED
@@ -6,21 +6,21 @@
6
6
  * that are used across all SDKs.
7
7
  */
8
8
  import * as Duration from "effect/Duration";
9
- import * as Schema from "effect/Schema";
10
9
  import * as Category from "./category.ts";
10
+ import * as Schema from "./schema-lite-typed.ts";
11
11
  /**
12
12
  * Opaque schema for an Effect `Duration.Duration` value.
13
13
  *
14
14
  * Used on retryable errors to carry a server-provided wait hint (e.g. parsed
15
15
  * from `Retry-After` or the IETF `Ratelimit` header). Core does not encode/decode
16
- * this field over the wire — it is constructed at runtime by `matchError` from
16
+ * this field over the wire -- it is constructed at runtime by `matchError` from
17
17
  * whatever the service actually returns (delay-seconds, HTTP-date, epoch, etc.)
18
18
  * and consumed at runtime by the retry policy.
19
19
  */
20
- export declare const DurationSchema: Schema.declare<Duration.Duration, Duration.Duration>;
21
- declare const Unauthorized_base: Schema.Class<Unauthorized, Schema.TaggedStruct<"Unauthorized", {
22
- readonly message: Schema.String;
23
- }>, import("effect/Cause").YieldableError> & (new (...args: any[]) => {
20
+ export declare const DurationSchema: import("effect/Schema").declare<Duration.Duration, Duration.Duration>;
21
+ declare const Unauthorized_base: Schema.TaggedErrorClass<"Unauthorized", {
22
+ readonly message: import("effect/Schema").String;
23
+ }> & (new (...args: any[]) => {
24
24
  "@distilled.cloud/error/categories": {
25
25
  AuthError: true;
26
26
  };
@@ -28,11 +28,11 @@ declare const Unauthorized_base: Schema.Class<Unauthorized, Schema.TaggedStruct<
28
28
  /**
29
29
  * Unauthorized - Authentication failure (401).
30
30
  */
31
- export declare class Unauthorized extends Unauthorized_base {
31
+ export declare class Unauthorized extends /*@__PURE__*/ Unauthorized_base {
32
32
  }
33
- declare const Forbidden_base: Schema.Class<Forbidden, Schema.TaggedStruct<"Forbidden", {
34
- readonly message: Schema.String;
35
- }>, import("effect/Cause").YieldableError> & (new (...args: any[]) => {
33
+ declare const Forbidden_base: Schema.TaggedErrorClass<"Forbidden", {
34
+ readonly message: import("effect/Schema").String;
35
+ }> & (new (...args: any[]) => {
36
36
  "@distilled.cloud/error/categories": {
37
37
  AuthError: true;
38
38
  };
@@ -40,11 +40,11 @@ declare const Forbidden_base: Schema.Class<Forbidden, Schema.TaggedStruct<"Forbi
40
40
  /**
41
41
  * Forbidden - Access denied (403).
42
42
  */
43
- export declare class Forbidden extends Forbidden_base {
43
+ export declare class Forbidden extends /*@__PURE__*/ Forbidden_base {
44
44
  }
45
- declare const NotFound_base: Schema.Class<NotFound, Schema.TaggedStruct<"NotFound", {
46
- readonly message: Schema.String;
47
- }>, import("effect/Cause").YieldableError> & (new (...args: any[]) => {
45
+ declare const NotFound_base: Schema.TaggedErrorClass<"NotFound", {
46
+ readonly message: import("effect/Schema").String;
47
+ }> & (new (...args: any[]) => {
48
48
  "@distilled.cloud/error/categories": {
49
49
  NotFoundError: true;
50
50
  };
@@ -52,11 +52,11 @@ declare const NotFound_base: Schema.Class<NotFound, Schema.TaggedStruct<"NotFoun
52
52
  /**
53
53
  * NotFound - Resource not found (404).
54
54
  */
55
- export declare class NotFound extends NotFound_base {
55
+ export declare class NotFound extends /*@__PURE__*/ NotFound_base {
56
56
  }
57
- declare const BadRequest_base: Schema.Class<BadRequest, Schema.TaggedStruct<"BadRequest", {
58
- readonly message: Schema.String;
59
- }>, import("effect/Cause").YieldableError> & (new (...args: any[]) => {
57
+ declare const BadRequest_base: Schema.TaggedErrorClass<"BadRequest", {
58
+ readonly message: import("effect/Schema").String;
59
+ }> & (new (...args: any[]) => {
60
60
  "@distilled.cloud/error/categories": {
61
61
  BadRequestError: true;
62
62
  };
@@ -64,11 +64,11 @@ declare const BadRequest_base: Schema.Class<BadRequest, Schema.TaggedStruct<"Bad
64
64
  /**
65
65
  * BadRequest - Invalid request (400).
66
66
  */
67
- export declare class BadRequest extends BadRequest_base {
67
+ export declare class BadRequest extends /*@__PURE__*/ BadRequest_base {
68
68
  }
69
- declare const Conflict_base: Schema.Class<Conflict, Schema.TaggedStruct<"Conflict", {
70
- readonly message: Schema.String;
71
- }>, import("effect/Cause").YieldableError> & (new (...args: any[]) => {
69
+ declare const Conflict_base: Schema.TaggedErrorClass<"Conflict", {
70
+ readonly message: import("effect/Schema").String;
71
+ }> & (new (...args: any[]) => {
72
72
  "@distilled.cloud/error/categories": {
73
73
  ConflictError: true;
74
74
  };
@@ -76,11 +76,11 @@ declare const Conflict_base: Schema.Class<Conflict, Schema.TaggedStruct<"Conflic
76
76
  /**
77
77
  * Conflict - Resource conflict (409).
78
78
  */
79
- export declare class Conflict extends Conflict_base {
79
+ export declare class Conflict extends /*@__PURE__*/ Conflict_base {
80
80
  }
81
- declare const UnprocessableEntity_base: Schema.Class<UnprocessableEntity, Schema.TaggedStruct<"UnprocessableEntity", {
82
- readonly message: Schema.String;
83
- }>, import("effect/Cause").YieldableError> & (new (...args: any[]) => {
81
+ declare const UnprocessableEntity_base: Schema.TaggedErrorClass<"UnprocessableEntity", {
82
+ readonly message: import("effect/Schema").String;
83
+ }> & (new (...args: any[]) => {
84
84
  "@distilled.cloud/error/categories": {
85
85
  BadRequestError: true;
86
86
  };
@@ -88,12 +88,12 @@ declare const UnprocessableEntity_base: Schema.Class<UnprocessableEntity, Schema
88
88
  /**
89
89
  * UnprocessableEntity - Validation error (422).
90
90
  */
91
- export declare class UnprocessableEntity extends UnprocessableEntity_base {
91
+ export declare class UnprocessableEntity extends /*@__PURE__*/ UnprocessableEntity_base {
92
92
  }
93
- declare const TooManyRequests_base: Schema.Class<TooManyRequests, Schema.TaggedStruct<"TooManyRequests", {
94
- readonly message: Schema.String;
95
- readonly retryAfter: Schema.optional<Schema.declare<Duration.Duration, Duration.Duration>>;
96
- }>, import("effect/Cause").YieldableError> & (new (...args: any[]) => {
93
+ declare const TooManyRequests_base: Schema.TaggedErrorClass<"TooManyRequests", {
94
+ readonly message: import("effect/Schema").String;
95
+ readonly retryAfter: import("effect/Schema").optional<import("effect/Schema").declare<Duration.Duration, Duration.Duration>>;
96
+ }> & (new (...args: any[]) => {
97
97
  "@distilled.cloud/error/categories": {
98
98
  ThrottlingError: true;
99
99
  };
@@ -103,12 +103,12 @@ declare const TooManyRequests_base: Schema.Class<TooManyRequests, Schema.TaggedS
103
103
  /**
104
104
  * TooManyRequests - Rate limited (429).
105
105
  */
106
- export declare class TooManyRequests extends TooManyRequests_base {
106
+ export declare class TooManyRequests extends /*@__PURE__*/ TooManyRequests_base {
107
107
  }
108
- declare const Locked_base: Schema.Class<Locked, Schema.TaggedStruct<"Locked", {
109
- readonly message: Schema.String;
110
- readonly retryAfter: Schema.optional<Schema.declare<Duration.Duration, Duration.Duration>>;
111
- }>, import("effect/Cause").YieldableError> & (new (...args: any[]) => {
108
+ declare const Locked_base: Schema.TaggedErrorClass<"Locked", {
109
+ readonly message: import("effect/Schema").String;
110
+ readonly retryAfter: import("effect/Schema").optional<import("effect/Schema").declare<Duration.Duration, Duration.Duration>>;
111
+ }> & (new (...args: any[]) => {
112
112
  "@distilled.cloud/error/categories": {
113
113
  LockedError: true;
114
114
  };
@@ -118,13 +118,13 @@ declare const Locked_base: Schema.Class<Locked, Schema.TaggedStruct<"Locked", {
118
118
  /**
119
119
  * Locked - Resource locked (423).
120
120
  */
121
- export declare class Locked extends Locked_base {
121
+ export declare class Locked extends /*@__PURE__*/ Locked_base {
122
122
  }
123
- declare const InternalServerError_base: Schema.Class<InternalServerError, Schema.TaggedStruct<"InternalServerError", {
124
- readonly message: Schema.String;
125
- readonly code: Schema.optional<Schema.Number>;
126
- readonly retryAfter: Schema.optional<Schema.declare<Duration.Duration, Duration.Duration>>;
127
- }>, import("effect/Cause").YieldableError> & (new (...args: any[]) => {
123
+ declare const InternalServerError_base: Schema.TaggedErrorClass<"InternalServerError", {
124
+ readonly message: import("effect/Schema").String;
125
+ readonly code: import("effect/Schema").optional<import("effect/Schema").Number>;
126
+ readonly retryAfter: import("effect/Schema").optional<import("effect/Schema").declare<Duration.Duration, Duration.Duration>>;
127
+ }> & (new (...args: any[]) => {
128
128
  "@distilled.cloud/error/categories": {
129
129
  ServerError: true;
130
130
  };
@@ -139,12 +139,12 @@ declare const InternalServerError_base: Schema.Class<InternalServerError, Schema
139
139
  * 200 envelope carrying `{ code: 10002, message: "An unknown error has
140
140
  * occurred" }` for transient backend failures on some endpoints).
141
141
  */
142
- export declare class InternalServerError extends InternalServerError_base {
142
+ export declare class InternalServerError extends /*@__PURE__*/ InternalServerError_base {
143
143
  }
144
- declare const BadGateway_base: Schema.Class<BadGateway, Schema.TaggedStruct<"BadGateway", {
145
- readonly message: Schema.String;
146
- readonly retryAfter: Schema.optional<Schema.declare<Duration.Duration, Duration.Duration>>;
147
- }>, import("effect/Cause").YieldableError> & (new (...args: any[]) => {
144
+ declare const BadGateway_base: Schema.TaggedErrorClass<"BadGateway", {
145
+ readonly message: import("effect/Schema").String;
146
+ readonly retryAfter: import("effect/Schema").optional<import("effect/Schema").declare<Duration.Duration, Duration.Duration>>;
147
+ }> & (new (...args: any[]) => {
148
148
  "@distilled.cloud/error/categories": {
149
149
  ServerError: true;
150
150
  };
@@ -154,12 +154,12 @@ declare const BadGateway_base: Schema.Class<BadGateway, Schema.TaggedStruct<"Bad
154
154
  /**
155
155
  * BadGateway - Bad gateway (502).
156
156
  */
157
- export declare class BadGateway extends BadGateway_base {
157
+ export declare class BadGateway extends /*@__PURE__*/ BadGateway_base {
158
158
  }
159
- declare const ServiceUnavailable_base: Schema.Class<ServiceUnavailable, Schema.TaggedStruct<"ServiceUnavailable", {
160
- readonly message: Schema.String;
161
- readonly retryAfter: Schema.optional<Schema.declare<Duration.Duration, Duration.Duration>>;
162
- }>, import("effect/Cause").YieldableError> & (new (...args: any[]) => {
159
+ declare const ServiceUnavailable_base: Schema.TaggedErrorClass<"ServiceUnavailable", {
160
+ readonly message: import("effect/Schema").String;
161
+ readonly retryAfter: import("effect/Schema").optional<import("effect/Schema").declare<Duration.Duration, Duration.Duration>>;
162
+ }> & (new (...args: any[]) => {
163
163
  "@distilled.cloud/error/categories": {
164
164
  ServerError: true;
165
165
  };
@@ -169,12 +169,12 @@ declare const ServiceUnavailable_base: Schema.Class<ServiceUnavailable, Schema.T
169
169
  /**
170
170
  * ServiceUnavailable - Service unavailable (503).
171
171
  */
172
- export declare class ServiceUnavailable extends ServiceUnavailable_base {
172
+ export declare class ServiceUnavailable extends /*@__PURE__*/ ServiceUnavailable_base {
173
173
  }
174
- declare const GatewayTimeout_base: Schema.Class<GatewayTimeout, Schema.TaggedStruct<"GatewayTimeout", {
175
- readonly message: Schema.String;
176
- readonly retryAfter: Schema.optional<Schema.declare<Duration.Duration, Duration.Duration>>;
177
- }>, import("effect/Cause").YieldableError> & (new (...args: any[]) => {
174
+ declare const GatewayTimeout_base: Schema.TaggedErrorClass<"GatewayTimeout", {
175
+ readonly message: import("effect/Schema").String;
176
+ readonly retryAfter: import("effect/Schema").optional<import("effect/Schema").declare<Duration.Duration, Duration.Duration>>;
177
+ }> & (new (...args: any[]) => {
178
178
  "@distilled.cloud/error/categories": {
179
179
  ServerError: true;
180
180
  };
@@ -182,22 +182,14 @@ declare const GatewayTimeout_base: Schema.Class<GatewayTimeout, Schema.TaggedStr
182
182
  "@distilled.cloud/error/retryable": Category.RetryableInfo;
183
183
  });
184
184
  /**
185
- * GatewayTimeout - Gateway timeout (504).
185
+ * GatewayTimeout - HTTP request or gateway timeout (408, 504).
186
186
  */
187
- export declare class GatewayTimeout extends GatewayTimeout_base {
188
- }
189
- declare const ConfigError_base: Schema.Class<ConfigError, Schema.TaggedStruct<"ConfigError", {
190
- readonly message: Schema.String;
191
- }>, import("effect/Cause").YieldableError> & (new (...args: any[]) => {
192
- "@distilled.cloud/error/categories": {
193
- ConfigurationError: true;
194
- };
195
- });
196
- /**
197
- * Configuration error - missing or invalid configuration.
198
- */
199
- export declare class ConfigError extends ConfigError_base {
187
+ export declare class GatewayTimeout extends /*@__PURE__*/ GatewayTimeout_base {
200
188
  }
189
+ export { ConfigError } from "./config.ts";
190
+ export { InvalidInput } from "./protocol-http.ts";
191
+ export { SdkError } from "./sdk-error.ts";
192
+ export { UnknownErrorFields, type UnknownErrorProps } from "./unknown-error.ts";
201
193
  /**
202
194
  * Mapping from HTTP status codes to common error classes.
203
195
  */
@@ -206,6 +198,7 @@ export declare const HTTP_STATUS_MAP: {
206
198
  readonly 401: typeof Unauthorized;
207
199
  readonly 403: typeof Forbidden;
208
200
  readonly 404: typeof NotFound;
201
+ readonly 408: typeof GatewayTimeout;
209
202
  readonly 409: typeof Conflict;
210
203
  readonly 422: typeof UnprocessableEntity;
211
204
  readonly 423: typeof Locked;
@@ -242,5 +235,4 @@ export declare const API_ERRORS: readonly [typeof Unauthorized, typeof Forbidden
242
235
  export declare const DEFAULT_ERRORS: readonly [typeof Unauthorized, typeof TooManyRequests, typeof InternalServerError, typeof BadGateway, typeof ServiceUnavailable, typeof GatewayTimeout];
243
236
  export type DefaultErrors = InstanceType<(typeof DEFAULT_ERRORS)[number]>;
244
237
  export declare const RETRYABLE: "@distilled/errors/retryable";
245
- export {};
246
238
  //# sourceMappingURL=errors.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAM1C;;;;;;;;GAQG;AACH,eAAO,MAAM,cAAc,sDAE1B,CAAC;;;;;;;;AAMF;;GAEG;AACH,qBAAa,YAAa,SAAQ,iBAGJ;CAAG;;;;;;;;AAEjC;;GAEG;AACH,qBAAa,SAAU,SAAQ,cAGD;CAAG;;;;;;;;AAEjC;;GAEG;AACH,qBAAa,QAAS,SAAQ,aAEK;CAAG;;;;;;;;AAEtC;;GAEG;AACH,qBAAa,UAAW,SAAQ,eAGI;CAAG;;;;;;;;AAEvC;;GAEG;AACH,qBAAa,QAAS,SAAQ,aAEK;CAAG;;;;;;;;AAEtC;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,wBAGL;CAAG;;;;;;;;;;;AAEvC;;GAEG;AACH,qBAAa,eAAgB,SAAQ,oBASpC;CAAG;;;;;;;;;;;AAEJ;;GAEG;AACH,qBAAa,MAAO,SAAQ,WAG+B;CAAG;;;;;;;;;;;;AAE9D;;;;;;;GAOG;AACH,qBAAa,mBAAoB,SAAQ,wBAOiB;CAAG;;;;;;;;;;;A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AAM,uBAAuB,aAA6D,CAAC;AAElG;;GAEG;AACH,eAAO,MAAM,UAAU,2QAab,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,cAAc,yJAOjB,CAAC;AAEX,MAAM,MAAM,aAAa,GAAG,YAAY,CAAC,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AAE1E,eAAO,MAAM,SAAS,EAAG,6BAAsC,CAAC"}
package/lib/errors.js CHANGED
@@ -1,186 +1 @@
1
- /**
2
- * Common error types shared across SDKs.
3
- *
4
- * Each SDK defines its own provider-specific errors (e.g., Unauthorized, NotFound)
5
- * using the category system. This module provides base error types and utilities
6
- * that are used across all SDKs.
7
- */
8
- import * as Duration from "effect/Duration";
9
- import * as Schema from "effect/Schema";
10
- import * as Category from "./category.js";
11
- // ============================================================================
12
- // Shared Schema Helpers
13
- // ============================================================================
14
- /**
15
- * Opaque schema for an Effect `Duration.Duration` value.
16
- *
17
- * Used on retryable errors to carry a server-provided wait hint (e.g. parsed
18
- * from `Retry-After` or the IETF `Ratelimit` header). Core does not encode/decode
19
- * this field over the wire — it is constructed at runtime by `matchError` from
20
- * whatever the service actually returns (delay-seconds, HTTP-date, epoch, etc.)
21
- * and consumed at runtime by the retry policy.
22
- */
23
- export const DurationSchema = Schema.declare(Duration.isDuration);
24
- // ============================================================================
25
- // Common HTTP Status Error Classes
26
- // ============================================================================
27
- /**
28
- * Unauthorized - Authentication failure (401).
29
- */
30
- export class Unauthorized extends Schema.TaggedErrorClass()("Unauthorized", { message: Schema.String }).pipe(Category.withAuthError) {
31
- }
32
- /**
33
- * Forbidden - Access denied (403).
34
- */
35
- export class Forbidden extends Schema.TaggedErrorClass()("Forbidden", { message: Schema.String }).pipe(Category.withAuthError) {
36
- }
37
- /**
38
- * NotFound - Resource not found (404).
39
- */
40
- export class NotFound extends Schema.TaggedErrorClass()("NotFound", {
41
- message: Schema.String,
42
- }).pipe(Category.withNotFoundError) {
43
- }
44
- /**
45
- * BadRequest - Invalid request (400).
46
- */
47
- export class BadRequest extends Schema.TaggedErrorClass()("BadRequest", { message: Schema.String }).pipe(Category.withBadRequestError) {
48
- }
49
- /**
50
- * Conflict - Resource conflict (409).
51
- */
52
- export class Conflict extends Schema.TaggedErrorClass()("Conflict", {
53
- message: Schema.String,
54
- }).pipe(Category.withConflictError) {
55
- }
56
- /**
57
- * UnprocessableEntity - Validation error (422).
58
- */
59
- export class UnprocessableEntity extends Schema.TaggedErrorClass()("UnprocessableEntity", { message: Schema.String }).pipe(Category.withBadRequestError) {
60
- }
61
- /**
62
- * TooManyRequests - Rate limited (429).
63
- */
64
- export class TooManyRequests extends Schema.TaggedErrorClass()("TooManyRequests", {
65
- message: Schema.String,
66
- retryAfter: Schema.optional(DurationSchema),
67
- }).pipe(Category.withThrottlingError, Category.withRetryable({ throttling: true })) {
68
- }
69
- /**
70
- * Locked - Resource locked (423).
71
- */
72
- export class Locked extends Schema.TaggedErrorClass()("Locked", {
73
- message: Schema.String,
74
- retryAfter: Schema.optional(DurationSchema),
75
- }).pipe(Category.withLockedError, Category.withRetryable()) {
76
- }
77
- /**
78
- * InternalServerError - Server error.
79
- *
80
- * Mapped from HTTP 500 by default. Per-service patches may also pin it to a
81
- * specific in-band error code/message combination (e.g. Cloudflare returns a
82
- * 200 envelope carrying `{ code: 10002, message: "An unknown error has
83
- * occurred" }` for transient backend failures on some endpoints).
84
- */
85
- export class InternalServerError extends Schema.TaggedErrorClass()("InternalServerError", {
86
- message: Schema.String,
87
- code: Schema.optional(Schema.Number),
88
- retryAfter: Schema.optional(DurationSchema),
89
- }).pipe(Category.withServerError, Category.withRetryable()) {
90
- }
91
- /**
92
- * BadGateway - Bad gateway (502).
93
- */
94
- export class BadGateway extends Schema.TaggedErrorClass()("BadGateway", {
95
- message: Schema.String,
96
- retryAfter: Schema.optional(DurationSchema),
97
- }).pipe(Category.withServerError, Category.withRetryable()) {
98
- }
99
- /**
100
- * ServiceUnavailable - Service unavailable (503).
101
- */
102
- export class ServiceUnavailable extends Schema.TaggedErrorClass()("ServiceUnavailable", {
103
- message: Schema.String,
104
- retryAfter: Schema.optional(DurationSchema),
105
- }).pipe(Category.withServerError, Category.withRetryable()) {
106
- }
107
- /**
108
- * GatewayTimeout - Gateway timeout (504).
109
- */
110
- export class GatewayTimeout extends Schema.TaggedErrorClass()("GatewayTimeout", {
111
- message: Schema.String,
112
- retryAfter: Schema.optional(DurationSchema),
113
- }).pipe(Category.withServerError, Category.withRetryable()) {
114
- }
115
- /**
116
- * Configuration error - missing or invalid configuration.
117
- */
118
- export class ConfigError extends Schema.TaggedErrorClass()("ConfigError", { message: Schema.String }).pipe(Category.withConfigurationError) {
119
- }
120
- // ============================================================================
121
- // Error Maps
122
- // ============================================================================
123
- /**
124
- * Mapping from HTTP status codes to common error classes.
125
- */
126
- export const HTTP_STATUS_MAP = {
127
- 400: BadRequest,
128
- 401: Unauthorized,
129
- 403: Forbidden,
130
- 404: NotFound,
131
- 409: Conflict,
132
- 422: UnprocessableEntity,
133
- 423: Locked,
134
- 429: TooManyRequests,
135
- 500: InternalServerError,
136
- 502: BadGateway,
137
- 503: ServiceUnavailable,
138
- 504: GatewayTimeout,
139
- };
140
- /**
141
- * HTTP status codes that are considered "default" errors (always present).
142
- * These are excluded from per-operation error types since they're handled globally.
143
- */
144
- export const DEFAULT_ERROR_STATUSES = new Set([401, 429, 500, 502, 503, 504]);
145
- /**
146
- * HTTP status codes whose corresponding error class in {@link HTTP_STATUS_MAP}
147
- * declares a `retryAfter` field. The retry policy honors `error.retryAfter`
148
- * with precedence over the default backoff for these.
149
- *
150
- * `matchError` implementations should only pass `retryAfter` into the
151
- * constructor when the status is in this set; passing it on non-retryable
152
- * classes (BadRequest/Unauthorized/etc.) would silently retain it as a
153
- * stale field on the instance and pollute serialized output.
154
- */
155
- export const RETRYABLE_HTTP_STATUSES = new Set([423, 429, 500, 502, 503, 504]);
156
- /**
157
- * All common API error classes.
158
- */
159
- export const API_ERRORS = [
160
- Unauthorized,
161
- Forbidden,
162
- NotFound,
163
- BadRequest,
164
- Conflict,
165
- UnprocessableEntity,
166
- TooManyRequests,
167
- Locked,
168
- InternalServerError,
169
- BadGateway,
170
- ServiceUnavailable,
171
- GatewayTimeout,
172
- ];
173
- /**
174
- * Default errors that apply to ALL operations.
175
- * These are infrastructure-level errors that can occur regardless of the operation.
176
- */
177
- export const DEFAULT_ERRORS = [
178
- Unauthorized,
179
- TooManyRequests,
180
- InternalServerError,
181
- BadGateway,
182
- ServiceUnavailable,
183
- GatewayTimeout,
184
- ];
185
- export const RETRYABLE = "@distilled/errors/retryable";
186
- //# 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$DEFAULT_ERROR_STATUSES as DEFAULT_ERROR_STATUSES, errors$DurationSchema as DurationSchema, errors$Forbidden as Forbidden, errors$GatewayTimeout as GatewayTimeout, errors$HTTP_STATUS_MAP as HTTP_STATUS_MAP, errors$InternalServerError as InternalServerError, errors$InvalidInput as InvalidInput, errors$Locked as Locked, errors$NotFound as NotFound, errors$RETRYABLE as RETRYABLE, errors$RETRYABLE_HTTP_STATUSES as RETRYABLE_HTTP_STATUSES, errors$SdkError as SdkError, errors$ServiceUnavailable as ServiceUnavailable, errors$TooManyRequests as TooManyRequests, errors$Unauthorized as Unauthorized, errors$UnknownErrorFields as UnknownErrorFields, errors$UnprocessableEntity as UnprocessableEntity } from "./_bundle/rest.js";