@distilled.cloud/core 0.30.3 → 1.0.0-rc.10

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 (216) hide show
  1. package/LICENSE +201 -0
  2. package/lib/api.d.ts +165 -0
  3. package/lib/api.d.ts.map +1 -0
  4. package/lib/api.js +190 -0
  5. package/lib/api.js.map +1 -0
  6. package/lib/category.d.ts +4 -4
  7. package/lib/category.js +4 -4
  8. package/lib/codegen/boolean-string-enums.d.ts +36 -0
  9. package/lib/codegen/boolean-string-enums.d.ts.map +1 -0
  10. package/lib/codegen/boolean-string-enums.js +94 -0
  11. package/lib/codegen/boolean-string-enums.js.map +1 -0
  12. package/lib/codegen/boolean-string-enums.test.d.ts +2 -0
  13. package/lib/codegen/boolean-string-enums.test.d.ts.map +1 -0
  14. package/lib/codegen/boolean-string-enums.test.js +147 -0
  15. package/lib/codegen/boolean-string-enums.test.js.map +1 -0
  16. package/lib/codegen/cli.d.ts +79 -0
  17. package/lib/codegen/cli.d.ts.map +1 -0
  18. package/lib/codegen/cli.js +149 -0
  19. package/lib/codegen/cli.js.map +1 -0
  20. package/lib/codegen/emit.d.ts +125 -0
  21. package/lib/codegen/emit.d.ts.map +1 -0
  22. package/lib/codegen/emit.js +101 -0
  23. package/lib/codegen/emit.js.map +1 -0
  24. package/lib/codegen/format.d.ts +23 -0
  25. package/lib/codegen/format.d.ts.map +1 -0
  26. package/lib/codegen/format.js +28 -0
  27. package/lib/codegen/format.js.map +1 -0
  28. package/lib/codegen/generator.d.ts +334 -0
  29. package/lib/codegen/generator.d.ts.map +1 -0
  30. package/lib/codegen/generator.js +813 -0
  31. package/lib/codegen/generator.js.map +1 -0
  32. package/lib/codegen/graph.d.ts +36 -0
  33. package/lib/codegen/graph.d.ts.map +1 -0
  34. package/lib/codegen/graph.js +136 -0
  35. package/lib/codegen/graph.js.map +1 -0
  36. package/lib/codegen/graphql-client.d.ts +62 -0
  37. package/lib/codegen/graphql-client.d.ts.map +1 -0
  38. package/lib/codegen/graphql-client.js +294 -0
  39. package/lib/codegen/graphql-client.js.map +1 -0
  40. package/lib/codegen/graphql-client.test.d.ts +2 -0
  41. package/lib/codegen/graphql-client.test.d.ts.map +1 -0
  42. package/lib/codegen/graphql-client.test.js +311 -0
  43. package/lib/codegen/graphql-client.test.js.map +1 -0
  44. package/lib/codegen/graphql.d.ts +207 -0
  45. package/lib/codegen/graphql.d.ts.map +1 -0
  46. package/lib/codegen/graphql.js +799 -0
  47. package/lib/codegen/graphql.js.map +1 -0
  48. package/lib/codegen/members.d.ts +25 -0
  49. package/lib/codegen/members.d.ts.map +1 -0
  50. package/lib/codegen/members.js +55 -0
  51. package/lib/codegen/members.js.map +1 -0
  52. package/lib/codegen/naming.d.ts +29 -0
  53. package/lib/codegen/naming.d.ts.map +1 -0
  54. package/lib/codegen/naming.js +74 -0
  55. package/lib/codegen/naming.js.map +1 -0
  56. package/lib/codegen/openapi-cli.d.ts +52 -0
  57. package/lib/codegen/openapi-cli.d.ts.map +1 -0
  58. package/lib/codegen/openapi-cli.js +109 -0
  59. package/lib/codegen/openapi-cli.js.map +1 -0
  60. package/lib/codegen/openapi.d.ts +178 -0
  61. package/lib/codegen/openapi.d.ts.map +1 -0
  62. package/lib/codegen/openapi.js +1377 -0
  63. package/lib/codegen/openapi.js.map +1 -0
  64. package/lib/codegen/operations.d.ts +24 -0
  65. package/lib/codegen/operations.d.ts.map +1 -0
  66. package/lib/codegen/operations.js +56 -0
  67. package/lib/codegen/operations.js.map +1 -0
  68. package/lib/codegen/pagination.d.ts +39 -0
  69. package/lib/codegen/pagination.d.ts.map +1 -0
  70. package/lib/codegen/pagination.js +33 -0
  71. package/lib/codegen/pagination.js.map +1 -0
  72. package/lib/codegen/patches.d.ts +65 -0
  73. package/lib/codegen/patches.d.ts.map +1 -0
  74. package/lib/codegen/patches.js +236 -0
  75. package/lib/codegen/patches.js.map +1 -0
  76. package/lib/codegen/patches.test.d.ts +2 -0
  77. package/lib/codegen/patches.test.d.ts.map +1 -0
  78. package/lib/codegen/patches.test.js +105 -0
  79. package/lib/codegen/patches.test.js.map +1 -0
  80. package/lib/codegen/prelude.d.ts +15 -0
  81. package/lib/codegen/prelude.d.ts.map +1 -0
  82. package/lib/codegen/prelude.js +60 -0
  83. package/lib/codegen/prelude.js.map +1 -0
  84. package/lib/codegen/proto.d.ts +121 -0
  85. package/lib/codegen/proto.d.ts.map +1 -0
  86. package/lib/codegen/proto.js +962 -0
  87. package/lib/codegen/proto.js.map +1 -0
  88. package/lib/codegen/rewrite-operation-ids.d.ts +131 -0
  89. package/lib/codegen/rewrite-operation-ids.d.ts.map +1 -0
  90. package/lib/codegen/rewrite-operation-ids.js +1079 -0
  91. package/lib/codegen/rewrite-operation-ids.js.map +1 -0
  92. package/lib/codegen/rewrite-operation-ids.test.d.ts +2 -0
  93. package/lib/codegen/rewrite-operation-ids.test.d.ts.map +1 -0
  94. package/lib/codegen/rewrite-operation-ids.test.js +533 -0
  95. package/lib/codegen/rewrite-operation-ids.test.js.map +1 -0
  96. package/lib/codegen/spec-path.d.ts +16 -0
  97. package/lib/codegen/spec-path.d.ts.map +1 -0
  98. package/lib/codegen/spec-path.js +101 -0
  99. package/lib/codegen/spec-path.js.map +1 -0
  100. package/lib/error-category.d.ts +28 -0
  101. package/lib/error-category.d.ts.map +1 -0
  102. package/lib/error-category.js +46 -0
  103. package/lib/error-category.js.map +1 -0
  104. package/lib/errors.d.ts +1 -0
  105. package/lib/errors.d.ts.map +1 -1
  106. package/lib/errors.js +18 -13
  107. package/lib/errors.js.map +1 -1
  108. package/lib/graphql.d.ts +284 -0
  109. package/lib/graphql.d.ts.map +1 -0
  110. package/lib/graphql.fixture.d.ts +249 -0
  111. package/lib/graphql.fixture.d.ts.map +1 -0
  112. package/lib/graphql.fixture.js +240 -0
  113. package/lib/graphql.fixture.js.map +1 -0
  114. package/lib/graphql.js +718 -0
  115. package/lib/graphql.js.map +1 -0
  116. package/lib/graphql.test.d.ts +2 -0
  117. package/lib/graphql.test.d.ts.map +1 -0
  118. package/lib/graphql.test.js +780 -0
  119. package/lib/graphql.test.js.map +1 -0
  120. package/lib/graphql.types.d.ts +2 -0
  121. package/lib/graphql.types.d.ts.map +1 -0
  122. package/lib/graphql.types.js +45 -0
  123. package/lib/graphql.types.js.map +1 -0
  124. package/lib/json-patch.d.ts +30 -30
  125. package/lib/json-patch.d.ts.map +1 -1
  126. package/lib/json-patch.js +73 -107
  127. package/lib/json-patch.js.map +1 -1
  128. package/lib/pagination.d.ts +77 -51
  129. package/lib/pagination.d.ts.map +1 -1
  130. package/lib/pagination.js +162 -94
  131. package/lib/pagination.js.map +1 -1
  132. package/lib/protocol-http.d.ts +74 -0
  133. package/lib/protocol-http.d.ts.map +1 -0
  134. package/lib/protocol-http.js +590 -0
  135. package/lib/protocol-http.js.map +1 -0
  136. package/lib/protocol-http.test.d.ts +2 -0
  137. package/lib/protocol-http.test.d.ts.map +1 -0
  138. package/lib/protocol-http.test.js +88 -0
  139. package/lib/protocol-http.test.js.map +1 -0
  140. package/lib/protocol-rest.d.ts +134 -0
  141. package/lib/protocol-rest.d.ts.map +1 -0
  142. package/lib/protocol-rest.js +256 -0
  143. package/lib/protocol-rest.js.map +1 -0
  144. package/lib/retry.d.ts +8 -2
  145. package/lib/retry.d.ts.map +1 -1
  146. package/lib/retry.js +22 -16
  147. package/lib/retry.js.map +1 -1
  148. package/lib/schema.d.ts +8 -9
  149. package/lib/schema.d.ts.map +1 -1
  150. package/lib/schema.js +8 -9
  151. package/lib/schema.js.map +1 -1
  152. package/lib/trait.d.ts +174 -0
  153. package/lib/trait.d.ts.map +1 -0
  154. package/lib/trait.js +123 -0
  155. package/lib/trait.js.map +1 -0
  156. package/package.json +24 -78
  157. package/src/api.ts +460 -0
  158. package/src/category.ts +4 -4
  159. package/src/codegen/boolean-string-enums.test.ts +168 -0
  160. package/src/codegen/boolean-string-enums.ts +106 -0
  161. package/src/codegen/cli.ts +285 -0
  162. package/src/codegen/emit.ts +203 -0
  163. package/src/codegen/format.ts +47 -0
  164. package/src/codegen/generator.ts +1283 -0
  165. package/src/codegen/graph.ts +151 -0
  166. package/src/codegen/graphql-client.test.ts +386 -0
  167. package/src/codegen/graphql-client.ts +419 -0
  168. package/src/codegen/graphql.ts +1217 -0
  169. package/src/codegen/members.ts +71 -0
  170. package/src/codegen/naming.ts +86 -0
  171. package/src/codegen/openapi-cli.ts +182 -0
  172. package/src/codegen/openapi.ts +1689 -0
  173. package/src/codegen/operations.ts +76 -0
  174. package/src/codegen/pagination.ts +71 -0
  175. package/src/codegen/patches.test.ts +130 -0
  176. package/src/codegen/patches.ts +291 -0
  177. package/src/codegen/prelude.ts +70 -0
  178. package/src/codegen/proto.ts +1128 -0
  179. package/src/codegen/rewrite-operation-ids.test.ts +563 -0
  180. package/src/codegen/rewrite-operation-ids.ts +1206 -0
  181. package/src/codegen/spec-path.ts +115 -0
  182. package/src/error-category.ts +84 -0
  183. package/src/errors.ts +22 -25
  184. package/src/graphql.fixture.ts +371 -0
  185. package/src/graphql.test.ts +974 -0
  186. package/src/graphql.ts +1321 -0
  187. package/src/graphql.types.ts +185 -0
  188. package/src/json-patch.ts +95 -122
  189. package/src/pagination.ts +217 -146
  190. package/src/protocol-http.test.ts +107 -0
  191. package/src/protocol-http.ts +735 -0
  192. package/src/protocol-rest.ts +391 -0
  193. package/src/retry.ts +21 -22
  194. package/src/schema.ts +9 -10
  195. package/src/trait.ts +274 -0
  196. package/README.md +0 -30
  197. package/lib/client.d.ts +0 -167
  198. package/lib/client.d.ts.map +0 -1
  199. package/lib/client.js +0 -659
  200. package/lib/client.js.map +0 -1
  201. package/lib/schemas.d.ts +0 -60
  202. package/lib/schemas.d.ts.map +0 -1
  203. package/lib/schemas.js +0 -79
  204. package/lib/schemas.js.map +0 -1
  205. package/lib/sensitive.d.ts +0 -71
  206. package/lib/sensitive.d.ts.map +0 -1
  207. package/lib/sensitive.js +0 -96
  208. package/lib/sensitive.js.map +0 -1
  209. package/lib/traits.d.ts +0 -421
  210. package/lib/traits.d.ts.map +0 -1
  211. package/lib/traits.js +0 -737
  212. package/lib/traits.js.map +0 -1
  213. package/src/client.ts +0 -1177
  214. package/src/schemas.ts +0 -128
  215. package/src/sensitive.ts +0 -119
  216. package/src/traits.ts +0 -996
package/lib/retry.js CHANGED
@@ -8,7 +8,6 @@
8
8
  * for that SDK without wrapping every call with `Effect.retry`.
9
9
  */
10
10
  import * as Config from "effect/Config";
11
- import * as ConfigProvider from "effect/ConfigProvider";
12
11
  import * as Context from "effect/Context";
13
12
  import * as Duration from "effect/Duration";
14
13
  import * as Effect from "effect/Effect";
@@ -45,7 +44,7 @@ export const jittered = Schedule.addDelay(() => Effect.succeed(Duration.millis(M
45
44
  /**
46
45
  * Cap delay at a maximum duration.
47
46
  */
48
- export const capped = (max) => Schedule.modifyDelay(({ duration }) => Effect.succeed(Duration.isGreaterThan(duration, max) ? Duration.millis(5000) : duration));
47
+ export const capped = (max) => Schedule.modifyDelay(({ duration }) => Effect.succeed(Duration.isGreaterThan(duration, max) ? max : duration));
49
48
  // ============================================================================
50
49
  // Server Hint Helpers
51
50
  // ============================================================================
@@ -73,7 +72,7 @@ export const ServerRetryHintCapMs = Context.Service("@distilled.cloud/core/Serve
73
72
  * Layer that pins the server `retryAfter` cap to a fixed value (milliseconds).
74
73
  */
75
74
  export const serverRetryHintCapLayer = (capMs) => Layer.succeed(ServerRetryHintCapMs, capMs);
76
- const serverRetryHintCapMsConfig = Config.string(ENV_SERVER_RETRY_HINT_CAP_MS).pipe(Config.map((raw) => {
75
+ const serverRetryHintCapMsConfig = Config.String(ENV_SERVER_RETRY_HINT_CAP_MS).pipe(Config.map((raw) => {
77
76
  if (raw === "")
78
77
  return DEFAULT_SERVER_RETRY_HINT_CAP_MS;
79
78
  const n = Number(raw);
@@ -89,10 +88,7 @@ const serverRetryHintCapMsConfig = Config.string(ENV_SERVER_RETRY_HINT_CAP_MS).p
89
88
  * Effect's {@link Config} (must be a non-negative finite number; invalid
90
89
  * values fall back to the default).
91
90
  */
92
- export const readServerRetryHintCapMsFromEnv = () => Effect.runSync(serverRetryHintCapMsConfig.pipe(Effect.orElseSucceed(() => DEFAULT_SERVER_RETRY_HINT_CAP_MS),
93
- // The default ConfigProvider caches env reads; use a fresh provider so
94
- // each call observes the current process.env value.
95
- Effect.provideService(ConfigProvider.ConfigProvider, ConfigProvider.fromEnv())));
91
+ export const readServerRetryHintCapMsFromEnv = () => Effect.runSync(serverRetryHintCapMsConfig.pipe(Effect.orElseSucceed(() => DEFAULT_SERVER_RETRY_HINT_CAP_MS)));
96
92
  const resolveServerRetryHintCapMs = () => Effect.gen(function* () {
97
93
  const fromLayer = yield* Effect.serviceOption(ServerRetryHintCapMs);
98
94
  if (Option.isSome(fromLayer)) {
@@ -100,7 +96,7 @@ const resolveServerRetryHintCapMs = () => Effect.gen(function* () {
100
96
  if (Number.isFinite(n) && n >= 0)
101
97
  return Math.trunc(n);
102
98
  }
103
- return yield* serverRetryHintCapMsConfig.pipe(Effect.orElseSucceed(() => DEFAULT_SERVER_RETRY_HINT_CAP_MS), Effect.provideService(ConfigProvider.ConfigProvider, ConfigProvider.fromEnv()));
99
+ return yield* serverRetryHintCapMsConfig.pipe(Effect.orElseSucceed(() => DEFAULT_SERVER_RETRY_HINT_CAP_MS));
104
100
  });
105
101
  /**
106
102
  * Extract a server-provided retry hint (in milliseconds) from an error's
@@ -142,22 +138,32 @@ const honorServerHint = (lastError, baseline) => Schedule.modifyDelay(Effect.fnU
142
138
  * - Honors `error.retryAfter` (server-provided hint) with precedence, capped
143
139
  * by {@link DEFAULT_SERVER_RETRY_HINT_CAP_MS} by default; override with
144
140
  * `DISTILLED_SERVER_RETRY_HINT_CAP_MS` or {@link ServerRetryHintCapMs}
145
- * - Otherwise uses exponential backoff starting at 100ms with a factor of 2
141
+ * - Otherwise uses exponential backoff starting at 250ms with a factor of 2,
142
+ * capped at 5s per delay
146
143
  * - Ensures at least 500ms delay for throttling errors
147
- * - Limits to 5 retry attempts
144
+ * - Limits to 8 retry attempts
148
145
  * - Applies jitter to avoid thundering herd
146
+ *
147
+ * The 250ms/5s-cap/8-attempt shape (~20s of total patience) comes from
148
+ * alchemy's Cloudflare provider suite, where transient auth blips under
149
+ * high request concurrency routinely outlast a short 5-attempt/3s policy
150
+ * while a genuinely broken credential still fails within seconds.
149
151
  */
150
152
  export const makeDefault = (lastError) => ({
151
153
  while: (error) => isTransientError(error),
154
+ // The 5s cap applies to the exponential backoff BEFORE the server hint is
155
+ // considered, so a server-provided retryAfter longer than 5s is honored in
156
+ // full (bounded only by the 60s hint cap inside honorServerHint). Capping
157
+ // after the hint would silently clamp e.g. a Retry-After: 30 to 5s.
152
158
  schedule: Schedule.max([
153
- pipe(Schedule.exponential(100, 2), honorServerHint(lastError, (duration, error) => {
159
+ pipe(Schedule.exponential(250, 2), capped(Duration.seconds(5)), honorServerHint(lastError, (duration, error) => {
154
160
  if (isThrottling(error) && Duration.toMillis(duration) < 500) {
155
161
  return Duration.millis(500);
156
162
  }
157
163
  return duration;
158
- })),
159
- Schedule.recurs(5),
160
- ]).pipe(jittered),
164
+ }), jittered),
165
+ Schedule.recurs(8),
166
+ ]),
161
167
  });
162
168
  /**
163
169
  * Factory for the throttling-only retry policy. Honors server hints when
@@ -165,7 +171,7 @@ export const makeDefault = (lastError) => ({
165
171
  */
166
172
  export const throttlingFactory = (lastError) => ({
167
173
  while: (error) => isThrottling(error),
168
- schedule: pipe(Schedule.exponential(1000, 2), honorServerHint(lastError), capped(Duration.seconds(5)), jittered),
174
+ schedule: pipe(Schedule.exponential(1000, 2), capped(Duration.seconds(5)), honorServerHint(lastError), jittered),
169
175
  });
170
176
  /**
171
177
  * Retry options that retries all throttling errors indefinitely.
@@ -184,7 +190,7 @@ export const throttlingOptions = {
184
190
  */
185
191
  export const transientFactory = (lastError) => ({
186
192
  while: isTransientError,
187
- schedule: pipe(Schedule.exponential(1000, 2), honorServerHint(lastError), capped(Duration.seconds(5)), jittered),
193
+ schedule: pipe(Schedule.exponential(1000, 2), capped(Duration.seconds(5)), honorServerHint(lastError), jittered),
188
194
  });
189
195
  /**
190
196
  * Retry options that retries all transient errors indefinitely.
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,cAAc,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,GAAG,MAAM,YAAY,CAAC;AAClC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AA+B/D,+EAA+E;AAC/E,wBAAwB;AACxB,+EAA+E;AAE/E;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,IAAY,EAAE,EAAE,CAC/C,OAAO,CAAC,OAAO,EAAe,CAAC,IAAI,CAAC,CAAC;AAEvC,+EAA+E;AAC/E,2BAA2B;AAC3B,+EAA+E;AAE/E;;;GAGG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,QAAQ,CAAC,QAAQ,CAAC,GAAG,EAAE,CAC7C,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,CACpD,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,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
package/lib/schema.d.ts CHANGED
@@ -2,16 +2,15 @@
2
2
  * `any`-collapsing re-export of `effect/Schema` for generated service files.
3
3
  *
4
4
  * This is the single, shared definition consumed by every code-generated
5
- * provider package (AWS, Azure, Cloudflare, GCP, Kubernetes, …) via
6
- * `@distilled.cloud/core/schema`. Do not copy it into individual packages.
5
+ * provider package via `@distilled.cloud/core/schema`. Do not copy it into
6
+ * individual packages.
7
7
  *
8
8
  * Every real TYPE (`Schema`, `Codec`, `Top`, …) is re-exported untouched, so
9
- * the `Schema.Schema<Foo>` / `Schema.Codec<Foo>` annotations on generated
10
- * consts (and the public `.d.ts`) stay precise. The schema *construction
11
- * surface* (`Struct`, `optional`, `suspend`, …) and the leaf scalar schemas are
12
- * retyped to `any`, so the compiler instantiates none of the heavy Schema
13
- * generics while building a service file — the explicit annotations carry the
14
- * real types.
9
+ * the `Schema.Schema<Foo>` annotations on generated consts (and the public
10
+ * `.d.ts`) stay precise. The schema *construction surface* (`Struct`,
11
+ * `optional`, `suspend`, …) and the leaf scalar schemas are retyped to `any`,
12
+ * so the compiler instantiates none of the heavy Schema generics while
13
+ * building a service file — the explicit annotations carry the real types.
15
14
  *
16
15
  * Overriding a *value* export never affects the same-named *type* export (they
17
16
  * live in separate namespaces and continue to flow through `export *`), so
@@ -21,7 +20,7 @@
21
20
  * runtime value from `effect/Schema`.
22
21
  */
23
22
  export * from "effect/Schema";
24
- type AnyFn = (...args: any[]) => any;
23
+ export type AnyFn = (...args: any[]) => any;
25
24
  export declare const optional: AnyFn;
26
25
  export declare const Struct: AnyFn;
27
26
  export declare const suspend: AnyFn;
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,cAAc,eAAe,CAAC;AAI9B,KAAK,KAAK,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC;AAGrC,eAAO,MAA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AAyB,CAAC;AAC/C,eAAO,MAAM,KAAK,EAAE,KAAwB,CAAC;AAC7C,eAAO,MAAM,OAAO,EAAE,KAA0B,CAAC;AACjD,eAAO,MAAM,QAAQ,EAAE,KAA2B,CAAC;AACnD,eAAO,MAAM,MAAM,EAAE,KAAyB,CAAC;AAC/C,eAAO,MAAM,KAAK,EAAE,KAAwB,CAAC;AAC7C,eAAO,MAAM,UAAU,EAAE,KAA6B,CAAC;AAGvD,eAAO,MAAM,MAAM,EAAE,GAAc,CAAC;AACpC,eAAO,MAAM,MAAM,EAAE,GAAc,CAAC;AACpC,eAAO,MAAM,OAAO,EAAE,GAAe,CAAC;AACtC,eAAO,MAAM,IAAI,EAAE,GAAY,CAAC;AAChC,eAAO,MAAM,OAAO,EAAE,GAAe,CAAC;AACtC,eAAO,MAAM,IAAI,EAAE,GAAY,CAAC;AAChC,eAAO,MAAM,IAAI,EAAE,GAAY,CAAC;AAChC,eAAO,MAAM,GAAG,EAAE,GAAW,CAAC"}
package/lib/schema.js CHANGED
@@ -2,16 +2,15 @@
2
2
  * `any`-collapsing re-export of `effect/Schema` for generated service files.
3
3
  *
4
4
  * This is the single, shared definition consumed by every code-generated
5
- * provider package (AWS, Azure, Cloudflare, GCP, Kubernetes, …) via
6
- * `@distilled.cloud/core/schema`. Do not copy it into individual packages.
5
+ * provider package via `@distilled.cloud/core/schema`. Do not copy it into
6
+ * individual packages.
7
7
  *
8
8
  * Every real TYPE (`Schema`, `Codec`, `Top`, …) is re-exported untouched, so
9
- * the `Schema.Schema<Foo>` / `Schema.Codec<Foo>` annotations on generated
10
- * consts (and the public `.d.ts`) stay precise. The schema *construction
11
- * surface* (`Struct`, `optional`, `suspend`, …) and the leaf scalar schemas are
12
- * retyped to `any`, so the compiler instantiates none of the heavy Schema
13
- * generics while building a service file — the explicit annotations carry the
14
- * real types.
9
+ * the `Schema.Schema<Foo>` annotations on generated consts (and the public
10
+ * `.d.ts`) stay precise. The schema *construction surface* (`Struct`,
11
+ * `optional`, `suspend`, …) and the leaf scalar schemas are retyped to `any`,
12
+ * so the compiler instantiates none of the heavy Schema generics while
13
+ * building a service file — the explicit annotations carry the real types.
15
14
  *
16
15
  * Overriding a *value* export never affects the same-named *type* export (they
17
16
  * live in separate namespaces and continue to flow through `export *`), so
@@ -43,7 +42,7 @@ export const Unknown = S.Unknown;
43
42
  export const Null = S.Null;
44
43
  export const Void = S.Void;
45
44
  export const Any = S.Any;
46
- // NOTE: `Schema` / `Codec` (types) and `TaggedErrorClass` are intentionally NOT
45
+ // NOTE: `Schema` / `Codec` (types) and `TaggedError` are intentionally NOT
47
46
  // overridden — they flow through `export *` with real types so cast targets and
48
47
  // typed error classes stay precise.
49
48
  //# sourceMappingURL=schema.js.map
package/lib/schema.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"schema.js","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,cAAc,eAAe,CAAC;AAE9B,OAAO,KAAK,CAAC,MAAM,eAAe,CAAC;AAInC,+EAA+E;AAC/E,MAAM,CAAC,MAAM,QAAQ,GAAU,CAAC,CAAC,QAAiB,CAAC;AACnD,MAAM,CAAC,MAAM,MAAM,GAAU,CAAC,CAAC,MAAe,CAAC;AAC/C,MAAM,CAAC,MAAM,OAAO,GAAU,CAAC,CAAC,OAAgB,CAAC;AACjD,MAAM,CAAC,MAAM,KAAK,GAAU,CAAC,CAAC,KAAc,CAAC;AAC7C,MAAM,CAAC,MAAM,MAAM,GAAU,CAAC,CAAC,MAAe,CAAC;AAC/C,MAAM,CAAC,MAAM,KAAK,GAAU,CAAC,CAAC,KAAc,CAAC;AAC7C,MAAM,CAAC,MAAM,OAAO,GAAU,CAAC,CAAC,OAAgB,CAAC;AACjD,MAAM,CAAC,MAAM,QAAQ,GAAU,CAAC,CAAC,QAAiB,CAAC;AACnD,MAAM,CAAC,MAAM,MAAM,GAAU,CAAC,CAAC,MAAe,CAAC;AAC/C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M,CAAC,MAAM,OAAO,GAAU,CAAC,CAAC,OAAgB,CAAC;AACjD,MAAM,CAAC,MAAM,QAAQ,GAAU,CAAC,CAAC,QAAiB,CAAC;AACnD,MAAM,CAAC,MAAM,MAAM,GAAU,CAAC,CAAC,MAAe,CAAC;AAC/C,MAAM,CAAC,MAAM,KAAK,GAAU,CAAC,CAAC,KAAc,CAAC;AAC7C,MAAM,CAAC,MAAM,UAAU,GAAU,CAAC,CAAC,UAAmB,CAAC;AAEvD,oEAAoE;AACpE,MAAM,CAAC,MAAM,MAAM,GAAQ,CAAC,CAAC,MAAM,CAAC;AACpC,MAAM,CAAC,MAAM,MAAM,GAAQ,CAAC,CAAC,MAAM,CAAC;AACpC,MAAM,CAAC,MAAM,OAAO,GAAQ,CAAC,CAAC,OAAO,CAAC;AACtC,MAAM,CAAC,MAAM,IAAI,GAAQ,CAAC,CAAC,IAAI,CAAC;AAChC,MAAM,CAAC,MAAM,OAAO,GAAQ,CAAC,CAAC,OAAO,CAAC;AACtC,MAAM,CAAC,MAAM,IAAI,GAAQ,CAAC,CAAC,IAAI,CAAC;AAChC,MAAM,CAAC,MAAM,IAAI,GAAQ,CAAC,CAAC,IAAI,CAAC;AAChC,MAAM,CAAC,MAAM,GAAG,GAAQ,CAAC,CAAC,GAAG,CAAC;AAE9B,2EAA2E;AAC3E,gFAAgF;AAChF,oCAAoC"}
package/lib/trait.d.ts ADDED
@@ -0,0 +1,174 @@
1
+ export declare const annotationMetaSymbol: unique symbol;
2
+ export type Annotatable = {
3
+ annotate(annotations: any): Annotatable;
4
+ };
5
+ export interface Annotation {
6
+ <A extends Annotatable>(schema: A): A;
7
+ readonly [annotationMetaSymbol]: Array<{
8
+ symbol: symbol | string;
9
+ value: unknown;
10
+ }>;
11
+ readonly [key: symbol]: unknown;
12
+ readonly [key: string]: unknown;
13
+ }
14
+ /**
15
+ * Build a pipeable schema annotation carrying `value` under `sym`. Exported
16
+ * so SDK packages can define their own protocol traits (e.g. cloudflare's
17
+ * envelope traits, aws's smithy traits) with the same mechanics as the
18
+ * generic ones here. Keys may be symbols or plain strings — effect Schema
19
+ * annotation dictionaries accept both.
20
+ */
21
+ export declare function makeAnnotation<T>(sym: symbol | string, value: T): Annotation;
22
+ /**
23
+ * Combine several annotations into one — needed where only a single
24
+ * annotations object can be supplied (e.g. the second argument of
25
+ * `S.Class`).
26
+ */
27
+ export declare function all(...annotations: Annotation[]): Annotation;
28
+ export interface HttpTrait {
29
+ readonly method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTIONS";
30
+ /** URI template relative to the service base URL, e.g. `/accounts/{account_id}/foo`. */
31
+ readonly uri: string;
32
+ /** Default success status code (a `ResponseCode()` member can still read the actual code). */
33
+ readonly code?: number;
34
+ /**
35
+ * Request body encoding. Default is JSON; `"multipart"` sends
36
+ * multipart/form-data — body members become form parts (objects
37
+ * JSON-encoded) and members marked `FormDataFile()` append their files.
38
+ * `"form-urlencoded"` sends application/x-www-form-urlencoded with
39
+ * Stripe-style bracket notation for nested objects and arrays (see
40
+ * `buildRequest`).
41
+ */
42
+ readonly contentType?: "multipart" | "form-urlencoded";
43
+ /**
44
+ * Explicit `Content-Type` for a whole-body (`HttpBody()`) member carrying a
45
+ * preserialized payload, when the API requires a specific media type rather
46
+ * than JSON (e.g. `application/x-ndjson` for Vectorize insert/upsert). The
47
+ * member value is sent verbatim (string/bytes) under this media type.
48
+ */
49
+ readonly bodyMediaType?: string;
50
+ /**
51
+ * Explicit `Accept` for the operation, when the API serves more than one
52
+ * response media type. Atlas pins an API version this way (e.g.
53
+ * `application/vnd.atlas.2024-05-30+json` — `application/json` alone is a
54
+ * 406). Protocols that don't read it fall back to their own default.
55
+ */
56
+ readonly accept?: string;
57
+ }
58
+ export declare const httpSymbol: unique symbol;
59
+ /**
60
+ * Operation-level HTTP binding: the request method + URI template. Stamped on
61
+ * the input schema so the protocol can build the request line. URI `{labels}`
62
+ * are filled from members marked with `Label()`.
63
+ */
64
+ export declare const Http: (trait: HttpTrait) => Annotation;
65
+ export declare const labelSymbol: unique symbol;
66
+ /** Bind a member to a `{name}` placeholder in the operation's URI template. */
67
+ export declare const Label: (name?: string) => Annotation;
68
+ export declare const responseCodeSymbol: unique symbol;
69
+ export declare const ResponseCode: () => Annotation;
70
+ export declare const headerSymbol: unique symbol;
71
+ export declare const Header: (name?: string) => Annotation;
72
+ export declare const bodySymbol: unique symbol;
73
+ export declare const Body: (name?: string) => Annotation;
74
+ export declare const querySymbol: unique symbol;
75
+ export declare const Query: (name?: string) => Annotation;
76
+ export declare const deepQuerySymbol: unique symbol;
77
+ /**
78
+ * Binds a struct-valued input member to a family of DOTTED query parameters:
79
+ * `{ account: { id, name } }` with `DeepQuery("account")` serializes as
80
+ * `?account.id=…&account.name=…` (null/undefined entries skipped). This is
81
+ * how several list endpoints model their filters on the wire (e.g.
82
+ * Cloudflare zones list `account.id` / `account.name`) while the TS surface
83
+ * keeps the nested-object shape (v0 parity).
84
+ */
85
+ export declare const DeepQuery: (name?: string) => Annotation;
86
+ export declare const httpBodySymbol: unique symbol;
87
+ /**
88
+ * Marks the input member whose value IS the entire request body (raw arrays/
89
+ * scalars — e.g. endpoints that POST a bare JSON array). Mirrors
90
+ * `smithy.api#httpPayload`.
91
+ */
92
+ export declare const HttpBody: () => Annotation;
93
+ export declare const stringEncodedSymbol: unique symbol;
94
+ /**
95
+ * Marks a member the API only accepts as the STRING spelling of its value —
96
+ * `true` travels as `"true"`, `3` as `"3"` — while the TS surface keeps the
97
+ * natural type (e.g. Cloudflare's multipart `validation_enabled`, which the
98
+ * docs model as the enum `"true" | "false"`). The protocol stringifies body
99
+ * members on encode, element-wise for lists; `null` is left alone. Query and
100
+ * header bindings already serialize their values as strings, so the trait is
101
+ * documentation there.
102
+ */
103
+ export declare const StringEncoded: () => Annotation;
104
+ export declare const formDataFileSymbol: unique symbol;
105
+ /**
106
+ * Marks an input member holding `File`/`Blob` parts for a multipart upload
107
+ * (`Http({ contentType: "multipart" })`). Each file is appended to the form
108
+ * under its own filename.
109
+ */
110
+ export declare const FormDataFile: () => Annotation;
111
+ export declare const keyDictionarySymbol: unique symbol;
112
+ /**
113
+ * Deep TS-name→wire-name key dictionary for members whose full structure is
114
+ * not modeled (opaque `Document` content). The protocol renames any matching
115
+ * key at any depth on encode (and the reverse on decode); keys not in the
116
+ * dictionary pass through verbatim.
117
+ *
118
+ * A value may be an array of wire names when the API itself is inconsistent
119
+ * (e.g. queues consumer responses name the worker script `script_name` on
120
+ * create/update but `script` on get/list): the first entry is the canonical
121
+ * wire name used on encode; decode maps every listed spelling back to the
122
+ * TS name.
123
+ */
124
+ export type KeyDictionaryEntries = Record<string, string | ReadonlyArray<string>>;
125
+ export declare const KeyDictionary: (dict: KeyDictionaryEntries) => Annotation;
126
+ export declare const unionCasesSymbol: unique symbol;
127
+ /**
128
+ * The literal member every case of a union fixes to its own value — what the
129
+ * docs call the resource `type` or the action `id`. `values[i]` is the value
130
+ * case `i` carries.
131
+ */
132
+ export interface UnionDiscriminator {
133
+ readonly key: string;
134
+ readonly values: ReadonlyArray<string>;
135
+ }
136
+ /**
137
+ * Marks an opaque schema standing in for a discriminated union of object
138
+ * cases, carrying each case's TS-facing key set. For APIs that return every
139
+ * case's keys with `null` for the inactive ones, the protocol uses these key
140
+ * sets to pick the active case and drop the others, so consumers' `"key" in
141
+ * value` discrimination works.
142
+ *
143
+ * Key sets alone cannot tell apart cases that share them — the 41 resource
144
+ * kinds of `resource_tagging`, the 34 page-rule actions — so when the union
145
+ * has a discriminator the protocol reads the case off it and only falls back
146
+ * to key-set scoring for a value whose tag is missing or unknown.
147
+ */
148
+ export declare const UnionCases: (cases: ReadonlyArray<ReadonlyArray<string>>, discriminator?: UnionDiscriminator) => Annotation;
149
+ export declare const errorMatchersSymbol: unique symbol;
150
+ /**
151
+ * One wire-matching rule for a typed error class. A matcher matches a wire
152
+ * failure when every present field matches: `code` equals the wire error's
153
+ * code, `status` equals the HTTP status, and `message` either equals the
154
+ * error message (string form) or satisfies `includes` (substring) /
155
+ * `matches` (regex). A matcher with no fields matches nothing.
156
+ */
157
+ export interface ErrorMatcher {
158
+ readonly code?: number;
159
+ readonly status?: number;
160
+ readonly message?: string | {
161
+ readonly includes?: string;
162
+ readonly matches?: string;
163
+ };
164
+ }
165
+ /**
166
+ * Stamp wire-matching rules onto a generated error class. Protocols consult
167
+ * these to decide which of an operation's declared error classes a failed
168
+ * response should surface as (most specific matcher wins; ties break by
169
+ * declaration order — see `matchTypedError` in `core/protocol-http`).
170
+ */
171
+ export declare const applyErrorMatchers: <C>(cls: C, matchers: ReadonlyArray<ErrorMatcher>) => C;
172
+ /** Read the matchers stamped on an error class, if any. */
173
+ export declare const getErrorMatchers: (cls: unknown) => ReadonlyArray<ErrorMatcher> | undefined;
174
+ //# sourceMappingURL=trait.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trait.d.ts","sourceRoot":"","sources":["../src/trait.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB,eAEhC,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,CAAC,WAAW,EAAE,GAAG,GAAG,WAAW,CAAC;CACzC,CAAC;AAEF,MAAM,WAAW,UAAU;IACzB,CAAC,CAAC,SAAS,WAAW,EAAE,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC;IACtC,QAAQ,CAAC,CAAC,oBAAoB,CAAC,EAAE,KAAK,CAAC;QACrC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;QACxB,KAAK,EAAE,OAAO,CAAC;KAChB,CAAC,CAAC;IACH,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IAChC,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACjC;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,UAAU,CAM5E;AAED;;;;GAIG;A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F,CAAC;AAEF,2DAA2D;AAC3D,eAAO,MAAM,gBAAgB,QACtB,OAAO,KACX,aAAa,CAAC,YAAY,CAAC,GAAG,SACI,CAAC"}
package/lib/trait.js ADDED
@@ -0,0 +1,123 @@
1
+ export const annotationMetaSymbol = Symbol.for("@distilled.cloud/core/annotation-meta");
2
+ /**
3
+ * Build a pipeable schema annotation carrying `value` under `sym`. Exported
4
+ * so SDK packages can define their own protocol traits (e.g. cloudflare's
5
+ * envelope traits, aws's smithy traits) with the same mechanics as the
6
+ * generic ones here. Keys may be symbols or plain strings — effect Schema
7
+ * annotation dictionaries accept both.
8
+ */
9
+ export function makeAnnotation(sym, value) {
10
+ const fn = (schema) => schema.annotate({ [sym]: value });
11
+ fn[annotationMetaSymbol] = [{ symbol: sym, value }];
12
+ fn[sym] = value;
13
+ return fn;
14
+ }
15
+ /**
16
+ * Combine several annotations into one — needed where only a single
17
+ * annotations object can be supplied (e.g. the second argument of
18
+ * `S.Class`).
19
+ */
20
+ export function all(...annotations) {
21
+ const entries = [];
22
+ const raw = {};
23
+ for (const a of annotations) {
24
+ for (const entry of a[annotationMetaSymbol]) {
25
+ entries.push(entry);
26
+ raw[entry.symbol] = entry.value;
27
+ }
28
+ }
29
+ const fn = (schema) => schema.annotate(raw);
30
+ fn[annotationMetaSymbol] = entries;
31
+ for (const { symbol: sym, value } of entries) {
32
+ fn[sym] = value;
33
+ }
34
+ return fn;
35
+ }
36
+ export const httpSymbol = Symbol.for("@distilled.cloud/core/http");
37
+ /**
38
+ * Operation-level HTTP binding: the request method + URI template. Stamped on
39
+ * the input schema so the protocol can build the request line. URI `{labels}`
40
+ * are filled from members marked with `Label()`.
41
+ */
42
+ export const Http = (trait) => makeAnnotation(httpSymbol, trait);
43
+ export const labelSymbol = Symbol.for("@distilled.cloud/core/http/label");
44
+ /** Bind a member to a `{name}` placeholder in the operation's URI template. */
45
+ export const Label = (name) => makeAnnotation(labelSymbol, name ?? true);
46
+ export const responseCodeSymbol = Symbol.for("@distilled.cloud/core/http/response-code");
47
+ export const ResponseCode = () => makeAnnotation(responseCodeSymbol, true);
48
+ export const headerSymbol = Symbol.for("@distilled.cloud/core/http/header");
49
+ export const Header = (name) => makeAnnotation(headerSymbol, name ?? true);
50
+ export const bodySymbol = Symbol.for("@distilled.cloud/core/http/body");
51
+ export const Body = (name) => makeAnnotation(bodySymbol, name ?? true);
52
+ export const querySymbol = Symbol.for("@distilled.cloud/core/http/query");
53
+ export const Query = (name) => makeAnnotation(querySymbol, name ?? true);
54
+ export const deepQuerySymbol = Symbol.for("@distilled.cloud/core/http/deep-query");
55
+ /**
56
+ * Binds a struct-valued input member to a family of DOTTED query parameters:
57
+ * `{ account: { id, name } }` with `DeepQuery("account")` serializes as
58
+ * `?account.id=…&account.name=…` (null/undefined entries skipped). This is
59
+ * how several list endpoints model their filters on the wire (e.g.
60
+ * Cloudflare zones list `account.id` / `account.name`) while the TS surface
61
+ * keeps the nested-object shape (v0 parity).
62
+ */
63
+ export const DeepQuery = (name) => makeAnnotation(deepQuerySymbol, name ?? true);
64
+ export const httpBodySymbol = Symbol.for("@distilled.cloud/core/http-body");
65
+ /**
66
+ * Marks the input member whose value IS the entire request body (raw arrays/
67
+ * scalars — e.g. endpoints that POST a bare JSON array). Mirrors
68
+ * `smithy.api#httpPayload`.
69
+ */
70
+ export const HttpBody = () => makeAnnotation(httpBodySymbol, true);
71
+ export const stringEncodedSymbol = Symbol.for("@distilled.cloud/core/http/string-encoded");
72
+ /**
73
+ * Marks a member the API only accepts as the STRING spelling of its value —
74
+ * `true` travels as `"true"`, `3` as `"3"` — while the TS surface keeps the
75
+ * natural type (e.g. Cloudflare's multipart `validation_enabled`, which the
76
+ * docs model as the enum `"true" | "false"`). The protocol stringifies body
77
+ * members on encode, element-wise for lists; `null` is left alone. Query and
78
+ * header bindings already serialize their values as strings, so the trait is
79
+ * documentation there.
80
+ */
81
+ export const StringEncoded = () => makeAnnotation(stringEncodedSymbol, true);
82
+ export const formDataFileSymbol = Symbol.for("@distilled.cloud/core/form-data-file");
83
+ /**
84
+ * Marks an input member holding `File`/`Blob` parts for a multipart upload
85
+ * (`Http({ contentType: "multipart" })`). Each file is appended to the form
86
+ * under its own filename.
87
+ */
88
+ export const FormDataFile = () => makeAnnotation(formDataFileSymbol, true);
89
+ //#endregion
90
+ //#region Generic JSON traits
91
+ export const keyDictionarySymbol = Symbol.for("@distilled.cloud/core/key-dictionary");
92
+ export const KeyDictionary = (dict) => makeAnnotation(keyDictionarySymbol, dict);
93
+ export const unionCasesSymbol = Symbol.for("@distilled.cloud/core/union-cases");
94
+ /**
95
+ * Marks an opaque schema standing in for a discriminated union of object
96
+ * cases, carrying each case's TS-facing key set. For APIs that return every
97
+ * case's keys with `null` for the inactive ones, the protocol uses these key
98
+ * sets to pick the active case and drop the others, so consumers' `"key" in
99
+ * value` discrimination works.
100
+ *
101
+ * Key sets alone cannot tell apart cases that share them — the 41 resource
102
+ * kinds of `resource_tagging`, the 34 page-rule actions — so when the union
103
+ * has a discriminator the protocol reads the case off it and only falls back
104
+ * to key-set scoring for a value whose tag is missing or unknown.
105
+ */
106
+ export const UnionCases = (cases, discriminator) => makeAnnotation(unionCasesSymbol, discriminator ? { cases, discriminator } : { cases });
107
+ //#endregion
108
+ //#region Error matcher traits
109
+ export const errorMatchersSymbol = Symbol.for("@distilled.cloud/core/error-matchers");
110
+ /**
111
+ * Stamp wire-matching rules onto a generated error class. Protocols consult
112
+ * these to decide which of an operation's declared error classes a failed
113
+ * response should surface as (most specific matcher wins; ties break by
114
+ * declaration order — see `matchTypedError` in `core/protocol-http`).
115
+ */
116
+ export const applyErrorMatchers = (cls, matchers) => {
117
+ cls[errorMatchersSymbol] = matchers;
118
+ return cls;
119
+ };
120
+ /** Read the matchers stamped on an error class, if any. */
121
+ export const getErrorMatchers = (cls) => cls?.[errorMatchersSymbol];
122
+ //#endregion
123
+ //# sourceMappingURL=trait.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trait.js","sourceRoot":"","sources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AAgB,EAChB,aAAa,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,aAAa,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CACrD,CAAC;AACJ,YAAY;AAEZ,8BAA8B;AAE9B,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC,GAAG,CAC3C,sCAAsC,CACvC,CAAC;AAiBF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAChC,GAAM,EACN,QAAqC,EAClC,EAAE;IACJ,GAAW,CAAC,mBAAmB,CAAC,GAAG,QAAQ,CAAC;IAC7C,OAAO,GAAG,CAAC;AACb,CAAC,CAAC;AAEF,2DAA2D;AAC3D,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAC9B,GAAY,EAC6B,EAAE,CAC1C,GAAW,EAAE,CAAC,mBAAmB,CAAC,CAAC;AACtC,YAAY"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@distilled.cloud/core",
3
- "version": "0.30.3",
3
+ "version": "1.0.0-rc.10",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/alchemy-run/distilled",
@@ -14,86 +14,32 @@
14
14
  "src"
15
15
  ],
16
16
  "exports": {
17
- "./category": {
18
- "types": "./lib/category.d.ts",
19
- "bun": "./src/category.ts",
20
- "default": "./lib/category.js"
21
- },
22
- "./client": {
23
- "types": "./lib/client.d.ts",
24
- "bun": "./src/client.ts",
25
- "default": "./lib/client.js"
26
- },
27
- "./errors": {
28
- "types": "./lib/errors.d.ts",
29
- "bun": "./src/errors.ts",
30
- "default": "./lib/errors.js"
31
- },
32
- "./json-patch": {
33
- "types": "./lib/json-patch.d.ts",
34
- "bun": "./src/json-patch.ts",
35
- "default": "./lib/json-patch.js"
36
- },
37
- "./pagination": {
38
- "types": "./lib/pagination.d.ts",
39
- "bun": "./src/pagination.ts",
40
- "default": "./lib/pagination.js"
41
- },
42
- "./retry": {
43
- "types": "./lib/retry.d.ts",
44
- "bun": "./src/retry.ts",
45
- "default": "./lib/retry.js"
46
- },
47
- "./retry-after": {
48
- "types": "./lib/retry-after.d.ts",
49
- "bun": "./src/retry-after.ts",
50
- "default": "./lib/retry-after.js"
51
- },
52
- "./schema": {
53
- "types": "./lib/schema.d.ts",
54
- "bun": "./src/schema.ts",
55
- "default": "./lib/schema.js"
56
- },
57
- "./schemas": {
58
- "types": "./lib/schemas.d.ts",
59
- "bun": "./src/schemas.ts",
60
- "default": "./lib/schemas.js"
61
- },
62
- "./sensitive": {
63
- "types": "./lib/sensitive.d.ts",
64
- "bun": "./src/sensitive.ts",
65
- "default": "./lib/sensitive.js"
66
- },
67
- "./traits": {
68
- "types": "./lib/traits.d.ts",
69
- "bun": "./src/traits.ts",
70
- "default": "./lib/traits.js"
71
- },
72
- "./openapi/generate": {
73
- "bun": "./scripts/generate-openapi.ts",
74
- "default": "./scripts/generate-openapi.ts"
75
- },
76
- "./graphql/generate": {
77
- "bun": "./scripts/generate-graphql.ts",
78
- "default": "./scripts/generate-graphql.ts"
17
+ ".": {
18
+ "types": "./lib/index.d.ts",
19
+ "bun": "./src/index.ts",
20
+ "worker": "./src/index.ts",
21
+ "import": "./lib/index.js"
22
+ },
23
+ "./*": {
24
+ "types": "./lib/*.d.ts",
25
+ "bun": "./src/*.ts",
26
+ "worker": "./src/*.ts",
27
+ "import": "./lib/*.js"
79
28
  }
80
29
  },
81
- "scripts": {
82
- "typecheck": "tsc",
83
- "build": "tsc -b",
84
- "fmt": "oxfmt --write src",
85
- "lint": "oxlint --fix src",
86
- "check": "tsc && oxlint src && oxfmt --check src",
87
- "test": "bunx vitest run test --exclude specs --passWithNoTests",
88
- "publish:npm": "bun run build && bun publish --access public"
89
- },
90
30
  "devDependencies": {
91
- "@types/bun": "^1.3.0",
92
- "@types/node": "^25.3.5",
93
- "dotenv": "^16.5.0",
94
- "vitest": "^3.2.3"
31
+ "@effect/platform-bun": ">=4.0.0-rc.115 || >=4.0.0",
32
+ "@types/bun": "1.3.14",
33
+ "@types/node": "26.2.0",
34
+ "effect": ">=4.0.0-rc.115 || >=4.0.0"
95
35
  },
96
36
  "peerDependencies": {
97
- "effect": ">=4.0.0-beta.100 || >=4.0.0"
37
+ "effect": ">=4.0.0-rc.115 || >=4.0.0"
38
+ },
39
+ "dependencies": {
40
+ "graphql": "16.11.0"
41
+ },
42
+ "scripts": {
43
+ "build": "tsc -b"
98
44
  }
99
- }
45
+ }