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

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 (69) hide show
  1. package/lib/_bundle/aws.js +2 -0
  2. package/lib/_bundle/aws.js.map +1 -0
  3. package/lib/_bundle/base.js +5 -0
  4. package/lib/_bundle/base.js.map +1 -0
  5. package/lib/_bundle/graphql.js +3 -0
  6. package/lib/_bundle/graphql.js.map +1 -0
  7. package/lib/_bundle/rest.js +2 -0
  8. package/lib/_bundle/rest.js.map +1 -0
  9. package/lib/_bundle/xml.js +4 -0
  10. package/lib/_bundle/xml.js.map +1 -0
  11. package/lib/api.d.ts.map +1 -1
  12. package/lib/api.js +1 -796
  13. package/lib/category.js +1 -278
  14. package/lib/chunks.js +1 -11
  15. package/lib/config.js +1 -161
  16. package/lib/crypto.js +1 -130
  17. package/lib/debug.js +1 -8
  18. package/lib/error-category.js +1 -47
  19. package/lib/errors.js +1 -198
  20. package/lib/graphql.js +1 -1058
  21. package/lib/graphql.types.js +1 -6
  22. package/lib/index.js +0 -15
  23. package/lib/json-patch.js +1 -226
  24. package/lib/json-patch.js.map +1 -1
  25. package/lib/pagination.js +1 -271
  26. package/lib/plain-values.js +1 -39
  27. package/lib/plain-values.js.map +1 -1
  28. package/lib/protocol-http.js +1 -812
  29. package/lib/protocol-rest.js +1 -375
  30. package/lib/query.js +1 -27
  31. package/lib/response-validation-strict.js +1 -284
  32. package/lib/response-validation.js +1 -118
  33. package/lib/retry-after.js +1 -112
  34. package/lib/retry.js +1 -197
  35. package/lib/schema-lite-impl.js +1 -341
  36. package/lib/schema-lite-typed.js +1 -26
  37. package/lib/schema-lite-typed.js.map +1 -1
  38. package/lib/schema-lite.js +1 -31
  39. package/lib/schema.js +1 -220
  40. package/lib/testing.js +1 -41
  41. package/lib/testing.js.map +1 -1
  42. package/lib/trait.js +1 -131
  43. package/lib/xml.js +1 -323
  44. package/package.json +1 -1
  45. package/src/api.ts +7 -6
  46. package/lib/api.js.map +0 -1
  47. package/lib/category.js.map +0 -1
  48. package/lib/chunks.js.map +0 -1
  49. package/lib/config.js.map +0 -1
  50. package/lib/crypto.js.map +0 -1
  51. package/lib/debug.js.map +0 -1
  52. package/lib/error-category.js.map +0 -1
  53. package/lib/errors.js.map +0 -1
  54. package/lib/graphql.js.map +0 -1
  55. package/lib/graphql.types.js.map +0 -1
  56. package/lib/index.js.map +0 -1
  57. package/lib/pagination.js.map +0 -1
  58. package/lib/protocol-http.js.map +0 -1
  59. package/lib/protocol-rest.js.map +0 -1
  60. package/lib/query.js.map +0 -1
  61. package/lib/response-validation-strict.js.map +0 -1
  62. package/lib/response-validation.js.map +0 -1
  63. package/lib/retry-after.js.map +0 -1
  64. package/lib/retry.js.map +0 -1
  65. package/lib/schema-lite-impl.js.map +0 -1
  66. package/lib/schema-lite.js.map +0 -1
  67. package/lib/schema.js.map +0 -1
  68. package/lib/trait.js.map +0 -1
  69. package/lib/xml.js.map +0 -1
package/lib/errors.js CHANGED
@@ -1,198 +1 @@
1
-
2
-
3
-
4
-
5
-
6
-
7
-
8
- import * as Duration from "effect/Duration";
9
- import * as Category from "./category.js";
10
- import * as Schema from "./schema-lite-typed.js";
11
- // ============================================================================
12
- // Shared Schema Helpers
13
- // ============================================================================
14
-
15
-
16
-
17
-
18
-
19
-
20
-
21
-
22
-
23
- export const DurationSchema = /*@__PURE__*/ Schema.declare(Duration.isDuration);
24
- // ============================================================================
25
- // Common HTTP Status Error Classes
26
- // ============================================================================
27
-
28
-
29
-
30
- export class Unauthorized extends /*@__PURE__*/ /*@__PURE__*/ Schema.TaggedError()("Unauthorized", {
31
- message: Schema.String,
32
- }).pipe(Category.withAuthError) {
33
- }
34
-
35
-
36
-
37
- export class Forbidden extends /*@__PURE__*/ /*@__PURE__*/ Schema.TaggedError()("Forbidden", {
38
- message: Schema.String,
39
- }).pipe(Category.withAuthError) {
40
- }
41
-
42
-
43
-
44
- export class NotFound extends /*@__PURE__*/ /*@__PURE__*/ Schema.TaggedError()("NotFound", {
45
- message: Schema.String,
46
- }).pipe(Category.withNotFoundError) {
47
- }
48
-
49
-
50
-
51
- export class BadRequest extends /*@__PURE__*/ /*@__PURE__*/ Schema.TaggedError()("BadRequest", {
52
- message: Schema.String,
53
- }).pipe(Category.withBadRequestError) {
54
- }
55
-
56
-
57
-
58
- export class Conflict extends /*@__PURE__*/ /*@__PURE__*/ Schema.TaggedError()("Conflict", {
59
- message: Schema.String,
60
- }).pipe(Category.withConflictError) {
61
- }
62
-
63
-
64
-
65
- export class UnprocessableEntity extends /*@__PURE__*/ /*@__PURE__*/ Schema.TaggedError()("UnprocessableEntity", {
66
- message: Schema.String,
67
- }).pipe(Category.withBadRequestError) {
68
- }
69
-
70
-
71
-
72
- export class TooManyRequests extends /*@__PURE__*/ /*@__PURE__*/ Schema.TaggedError()("TooManyRequests", {
73
- message: Schema.String,
74
- retryAfter: /*@__PURE__*/ Schema.optional(DurationSchema),
75
- }).pipe(Category.withThrottlingError,
76
- /*@__PURE__*/ Category.withRetryable({ throttling: true })) {
77
- }
78
-
79
-
80
-
81
- export class Locked extends /*@__PURE__*/ /*@__PURE__*/ Schema.TaggedError()("Locked", {
82
- message: Schema.String,
83
- retryAfter: /*@__PURE__*/ Schema.optional(DurationSchema),
84
- }).pipe(Category.withLockedError, /*@__PURE__*/ Category.withRetryable()) {
85
- }
86
-
87
-
88
-
89
-
90
-
91
-
92
-
93
-
94
- export class InternalServerError extends /*@__PURE__*/ /*@__PURE__*/ Schema.TaggedError()("InternalServerError", {
95
- message: Schema.String,
96
- code: /*@__PURE__*/ Schema.optional(Schema.Number),
97
- retryAfter: /*@__PURE__*/ Schema.optional(DurationSchema),
98
- }).pipe(Category.withServerError, /*@__PURE__*/ Category.withRetryable()) {
99
- }
100
-
101
-
102
-
103
- export class BadGateway extends /*@__PURE__*/ /*@__PURE__*/ Schema.TaggedError()("BadGateway", {
104
- message: Schema.String,
105
- retryAfter: /*@__PURE__*/ Schema.optional(DurationSchema),
106
- }).pipe(Category.withServerError, /*@__PURE__*/ Category.withRetryable()) {
107
- }
108
-
109
-
110
-
111
- export class ServiceUnavailable extends /*@__PURE__*/ /*@__PURE__*/ Schema.TaggedError()("ServiceUnavailable", {
112
- message: Schema.String,
113
- retryAfter: /*@__PURE__*/ Schema.optional(DurationSchema),
114
- }).pipe(Category.withServerError, /*@__PURE__*/ Category.withRetryable()) {
115
- }
116
-
117
-
118
-
119
- export class GatewayTimeout extends /*@__PURE__*/ /*@__PURE__*/ Schema.TaggedError()("GatewayTimeout", {
120
- message: Schema.String,
121
- retryAfter: /*@__PURE__*/ Schema.optional(DurationSchema),
122
- }).pipe(Category.withServerError, /*@__PURE__*/ Category.withRetryable()) {
123
- }
124
-
125
-
126
-
127
- export class ConfigError extends /*@__PURE__*/ /*@__PURE__*/ Schema.TaggedError()("ConfigError", {
128
- message: Schema.String,
129
- }).pipe(Category.withConfigurationError) {
130
- }
131
- // ============================================================================
132
- // Error Maps
133
- // ============================================================================
134
-
135
-
136
-
137
- export const HTTP_STATUS_MAP = {
138
- 400: BadRequest,
139
- 401: Unauthorized,
140
- 403: Forbidden,
141
- 404: NotFound,
142
- 408: GatewayTimeout,
143
- 409: Conflict,
144
- 422: UnprocessableEntity,
145
- 423: Locked,
146
- 429: TooManyRequests,
147
- 500: InternalServerError,
148
- 502: BadGateway,
149
- 503: ServiceUnavailable,
150
- 504: GatewayTimeout,
151
- };
152
-
153
-
154
-
155
-
156
- export const DEFAULT_ERROR_STATUSES = /*@__PURE__*/ new Set([401, 429, 500, 502, 503, 504]);
157
-
158
-
159
-
160
-
161
-
162
-
163
-
164
-
165
-
166
-
167
- export const RETRYABLE_HTTP_STATUSES = /*@__PURE__*/ new Set([408, 423, 429, 500, 502, 503, 504]);
168
-
169
-
170
-
171
- export const API_ERRORS = [
172
- Unauthorized,
173
- Forbidden,
174
- NotFound,
175
- BadRequest,
176
- Conflict,
177
- UnprocessableEntity,
178
- TooManyRequests,
179
- Locked,
180
- InternalServerError,
181
- BadGateway,
182
- ServiceUnavailable,
183
- GatewayTimeout,
184
- ];
185
-
186
-
187
-
188
-
189
- export const DEFAULT_ERRORS = [
190
- Unauthorized,
191
- TooManyRequests,
192
- InternalServerError,
193
- BadGateway,
194
- ServiceUnavailable,
195
- GatewayTimeout,
196
- ];
197
- export const RETRYABLE = "@distilled/errors/retryable";
198
- //# 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$Locked as Locked, errors$NotFound as NotFound, errors$RETRYABLE as RETRYABLE, errors$RETRYABLE_HTTP_STATUSES as RETRYABLE_HTTP_STATUSES, errors$ServiceUnavailable as ServiceUnavailable, errors$TooManyRequests as TooManyRequests, errors$Unauthorized as Unauthorized, errors$UnprocessableEntity as UnprocessableEntity } from "./_bundle/rest.js";