@distilled.cloud/starburst-galaxy 0.0.0 → 1.0.0-rc.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (190) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +110 -4
  3. package/lib/.lazy.json +1 -0
  4. package/lib/_bundle/lazy.js +4 -0
  5. package/lib/_bundle/sdk.js +2 -0
  6. package/lib/_bundle/sdk.js.map +1 -0
  7. package/lib/credentials.d.ts +84 -0
  8. package/lib/credentials.d.ts.map +1 -0
  9. package/lib/credentials.js +1 -0
  10. package/lib/errors.d.ts +83 -0
  11. package/lib/errors.d.ts.map +1 -0
  12. package/lib/errors.js +1 -0
  13. package/lib/index.d.ts +42 -0
  14. package/lib/index.d.ts.map +1 -0
  15. package/lib/index.js +6 -0
  16. package/lib/pagination.d.ts +10 -0
  17. package/lib/pagination.d.ts.map +1 -0
  18. package/lib/pagination.js +1 -0
  19. package/lib/protocol.d.ts +29 -0
  20. package/lib/protocol.d.ts.map +1 -0
  21. package/lib/protocol.js +1 -0
  22. package/lib/retry.d.ts +32 -0
  23. package/lib/retry.d.ts.map +1 -0
  24. package/lib/retry.js +1 -0
  25. package/lib/services/catalog.d.ts +2791 -0
  26. package/lib/services/catalog.d.ts.map +1 -0
  27. package/lib/services/catalog.js +101 -0
  28. package/lib/services/catalog.js.map +1 -0
  29. package/lib/services/cluster.d.ts +248 -0
  30. package/lib/services/cluster.d.ts.map +1 -0
  31. package/lib/services/cluster.js +2 -0
  32. package/lib/services/cluster.js.map +1 -0
  33. package/lib/services/column_mask.d.ts +162 -0
  34. package/lib/services/column_mask.d.ts.map +1 -0
  35. package/lib/services/column_mask.js +2 -0
  36. package/lib/services/column_mask.js.map +1 -0
  37. package/lib/services/cross_account_iam_role.d.ts +133 -0
  38. package/lib/services/cross_account_iam_role.d.ts.map +1 -0
  39. package/lib/services/cross_account_iam_role.js +2 -0
  40. package/lib/services/cross_account_iam_role.js.map +1 -0
  41. package/lib/services/data_domain.d.ts +223 -0
  42. package/lib/services/data_domain.d.ts.map +1 -0
  43. package/lib/services/data_domain.js +2 -0
  44. package/lib/services/data_domain.js.map +1 -0
  45. package/lib/services/data_product.d.ts +290 -0
  46. package/lib/services/data_product.d.ts.map +1 -0
  47. package/lib/services/data_product.js +2 -0
  48. package/lib/services/data_product.js.map +1 -0
  49. package/lib/services/data_product_usage_example.d.ts +158 -0
  50. package/lib/services/data_product_usage_example.d.ts.map +1 -0
  51. package/lib/services/data_product_usage_example.js +2 -0
  52. package/lib/services/data_product_usage_example.js.map +1 -0
  53. package/lib/services/data_quality.d.ts +344 -0
  54. package/lib/services/data_quality.d.ts.map +1 -0
  55. package/lib/services/data_quality.js +2 -0
  56. package/lib/services/data_quality.js.map +1 -0
  57. package/lib/services/data_quality_metrics.d.ts +282 -0
  58. package/lib/services/data_quality_metrics.d.ts.map +1 -0
  59. package/lib/services/data_quality_metrics.js +2 -0
  60. package/lib/services/data_quality_metrics.js.map +1 -0
  61. package/lib/services/data_quality_schedule.d.ts +220 -0
  62. package/lib/services/data_quality_schedule.d.ts.map +1 -0
  63. package/lib/services/data_quality_schedule.js +2 -0
  64. package/lib/services/data_quality_schedule.js.map +1 -0
  65. package/lib/services/discovery.d.ts +439 -0
  66. package/lib/services/discovery.d.ts.map +1 -0
  67. package/lib/services/discovery.js +36 -0
  68. package/lib/services/discovery.js.map +1 -0
  69. package/lib/services/file_ingest_source.d.ts +205 -0
  70. package/lib/services/file_ingest_source.d.ts.map +1 -0
  71. package/lib/services/file_ingest_source.js +2 -0
  72. package/lib/services/file_ingest_source.js.map +1 -0
  73. package/lib/services/group.d.ts +140 -0
  74. package/lib/services/group.d.ts.map +1 -0
  75. package/lib/services/group.js +2 -0
  76. package/lib/services/group.js.map +1 -0
  77. package/lib/services/index.d.ts +26 -0
  78. package/lib/services/index.d.ts.map +1 -0
  79. package/lib/services/index.js +25 -0
  80. package/lib/services/kafka_ingest_source.d.ts +236 -0
  81. package/lib/services/kafka_ingest_source.d.ts.map +1 -0
  82. package/lib/services/kafka_ingest_source.js +2 -0
  83. package/lib/services/kafka_ingest_source.js.map +1 -0
  84. package/lib/services/live_table.d.ts +851 -0
  85. package/lib/services/live_table.d.ts.map +1 -0
  86. package/lib/services/live_table.js +20 -0
  87. package/lib/services/live_table.js.map +1 -0
  88. package/lib/services/policy.d.ts +213 -0
  89. package/lib/services/policy.d.ts.map +1 -0
  90. package/lib/services/policy.js +2 -0
  91. package/lib/services/policy.js.map +1 -0
  92. package/lib/services/privatelink.d.ts +95 -0
  93. package/lib/services/privatelink.d.ts.map +1 -0
  94. package/lib/services/privatelink.js +2 -0
  95. package/lib/services/privatelink.js.map +1 -0
  96. package/lib/services/privilege.d.ts +167 -0
  97. package/lib/services/privilege.d.ts.map +1 -0
  98. package/lib/services/privilege.js +2 -0
  99. package/lib/services/privilege.js.map +1 -0
  100. package/lib/services/role.d.ts +222 -0
  101. package/lib/services/role.d.ts.map +1 -0
  102. package/lib/services/role.js +2 -0
  103. package/lib/services/role.js.map +1 -0
  104. package/lib/services/row_filter.d.ts +155 -0
  105. package/lib/services/row_filter.d.ts.map +1 -0
  106. package/lib/services/row_filter.js +2 -0
  107. package/lib/services/row_filter.js.map +1 -0
  108. package/lib/services/schema_discovery.d.ts +236 -0
  109. package/lib/services/schema_discovery.d.ts.map +1 -0
  110. package/lib/services/schema_discovery.js +2 -0
  111. package/lib/services/schema_discovery.js.map +1 -0
  112. package/lib/services/service_account.d.ts +206 -0
  113. package/lib/services/service_account.d.ts.map +1 -0
  114. package/lib/services/service_account.js +2 -0
  115. package/lib/services/service_account.js.map +1 -0
  116. package/lib/services/sql_jobs.d.ts +264 -0
  117. package/lib/services/sql_jobs.d.ts.map +1 -0
  118. package/lib/services/sql_jobs.js +2 -0
  119. package/lib/services/sql_jobs.js.map +1 -0
  120. package/lib/services/tag.d.ts +287 -0
  121. package/lib/services/tag.d.ts.map +1 -0
  122. package/lib/services/tag.js +2 -0
  123. package/lib/services/tag.js.map +1 -0
  124. package/lib/services/user.d.ts +175 -0
  125. package/lib/services/user.d.ts.map +1 -0
  126. package/lib/services/user.js +2 -0
  127. package/lib/services/user.js.map +1 -0
  128. package/lib/services.lazy/catalog.js +4 -0
  129. package/lib/services.lazy/cluster.js +1 -0
  130. package/lib/services.lazy/column_mask.js +1 -0
  131. package/lib/services.lazy/cross_account_iam_role.js +1 -0
  132. package/lib/services.lazy/data_domain.js +1 -0
  133. package/lib/services.lazy/data_product.js +1 -0
  134. package/lib/services.lazy/data_product_usage_example.js +1 -0
  135. package/lib/services.lazy/data_quality.js +1 -0
  136. package/lib/services.lazy/data_quality_metrics.js +1 -0
  137. package/lib/services.lazy/data_quality_schedule.js +1 -0
  138. package/lib/services.lazy/discovery.js +4 -0
  139. package/lib/services.lazy/file_ingest_source.js +1 -0
  140. package/lib/services.lazy/group.js +1 -0
  141. package/lib/services.lazy/index.js +3 -0
  142. package/lib/services.lazy/kafka_ingest_source.js +1 -0
  143. package/lib/services.lazy/live_table.js +4 -0
  144. package/lib/services.lazy/policy.js +1 -0
  145. package/lib/services.lazy/privatelink.js +1 -0
  146. package/lib/services.lazy/privilege.js +1 -0
  147. package/lib/services.lazy/role.js +1 -0
  148. package/lib/services.lazy/row_filter.js +1 -0
  149. package/lib/services.lazy/schema_discovery.js +1 -0
  150. package/lib/services.lazy/service_account.js +1 -0
  151. package/lib/services.lazy/sql_jobs.js +1 -0
  152. package/lib/services.lazy/tag.js +1 -0
  153. package/lib/services.lazy/user.js +1 -0
  154. package/lib/traits.d.ts +11 -0
  155. package/lib/traits.d.ts.map +1 -0
  156. package/lib/traits.js +1 -0
  157. package/package.json +82 -2
  158. package/src/credentials.ts +205 -0
  159. package/src/errors.ts +102 -0
  160. package/src/index.ts +45 -0
  161. package/src/pagination.ts +9 -0
  162. package/src/protocol.ts +94 -0
  163. package/src/retry.ts +50 -0
  164. package/src/services/catalog.ts +6636 -0
  165. package/src/services/cluster.ts +492 -0
  166. package/src/services/column_mask.ts +388 -0
  167. package/src/services/cross_account_iam_role.ts +328 -0
  168. package/src/services/data_domain.ts +509 -0
  169. package/src/services/data_product.ts +641 -0
  170. package/src/services/data_product_usage_example.ts +380 -0
  171. package/src/services/data_quality.ts +771 -0
  172. package/src/services/data_quality_metrics.ts +580 -0
  173. package/src/services/data_quality_schedule.ts +454 -0
  174. package/src/services/discovery.ts +1257 -0
  175. package/src/services/file_ingest_source.ts +480 -0
  176. package/src/services/group.ts +282 -0
  177. package/src/services/index.ts +26 -0
  178. package/src/services/kafka_ingest_source.ts +545 -0
  179. package/src/services/live_table.ts +1537 -0
  180. package/src/services/policy.ts +526 -0
  181. package/src/services/privatelink.ts +209 -0
  182. package/src/services/privilege.ts +423 -0
  183. package/src/services/role.ts +501 -0
  184. package/src/services/row_filter.ts +365 -0
  185. package/src/services/schema_discovery.ts +516 -0
  186. package/src/services/service_account.ts +525 -0
  187. package/src/services/sql_jobs.ts +621 -0
  188. package/src/services/tag.ts +785 -0
  189. package/src/services/user.ts +375 -0
  190. package/src/traits.ts +44 -0
package/src/errors.ts ADDED
@@ -0,0 +1,102 @@
1
+ /**
2
+ * Starburst Galaxy error types.
3
+ *
4
+ * Re-exports the common HTTP errors from core and adds the one status Galaxy
5
+ * documents that core's shared map has no entry for (412), plus the
6
+ * unknown-error and parse-error wrappers.
7
+ *
8
+ * Galaxy failures carry `{ message, ... }` bodies. Operations that declare a
9
+ * status get the generated per-status class for it, which keeps `message`
10
+ * and the whole `body` (where `BadRequest`'s `fields` and
11
+ * `FailedPrecondition`'s `detail` are read). Every other failure is
12
+ * dispatched on its status by `StarburstGalaxyProtocol` to the classes
13
+ * here, which carry `message`. Both share their `_tag`s, so `catchTag`
14
+ * works against either.
15
+ */
16
+ export {
17
+ BadGateway,
18
+ BadRequest,
19
+ Conflict,
20
+ ConfigError,
21
+ Forbidden,
22
+ GatewayTimeout,
23
+ InternalServerError,
24
+ Locked,
25
+ NotFound,
26
+ ServiceUnavailable,
27
+ TooManyRequests,
28
+ Unauthorized,
29
+ UnprocessableEntity,
30
+ HTTP_STATUS_MAP,
31
+ DEFAULT_ERRORS,
32
+ API_ERRORS,
33
+ } from "@distilled.cloud/core/errors";
34
+ export type { DefaultErrors } from "@distilled.cloud/core/errors";
35
+
36
+ import * as Category from "@distilled.cloud/core/category";
37
+ import { API_ERRORS, UnknownErrorFields } from "@distilled.cloud/core/errors";
38
+ import * as Schema from "@distilled.cloud/core/schema-lite-typed";
39
+ import { applyErrorMatchers } from "@distilled.cloud/core/trait";
40
+
41
+ /**
42
+ * HTTP 412 -- `FailedPrecondition`: the request cannot run in the
43
+ * resource's current state (for example deleting a data domain that still
44
+ * holds data products, or creating a cluster the account cannot host yet).
45
+ * Retrying unchanged keeps failing until that state changes, so it is not
46
+ * retryable. Like the generated per-operation `PreconditionFailed` (core
47
+ * derives categories from the status, and 412 has none), it carries no
48
+ * category, so handling by `_tag` or by category does not depend on
49
+ * whether an operation declares 412.
50
+ */
51
+ export class PreconditionFailed
52
+ extends /*@__PURE__*/ applyErrorMatchers(
53
+ /*@__PURE__*/ Schema.TaggedError<PreconditionFailed>()("PreconditionFailed", {
54
+ message: Schema.String,
55
+ }),
56
+ [{ status: 412 }],
57
+ ) {}
58
+
59
+ /**
60
+ * Unknown Starburst Galaxy error -- returned when a failed response's HTTP
61
+ * status has no mapped error class. Carries that `status`, Galaxy's
62
+ * `message` and the whole `body`.
63
+ */
64
+ export class UnknownStarburstGalaxyError
65
+ extends /*@__PURE__*/ Schema.TaggedError<UnknownStarburstGalaxyError>()(
66
+ "UnknownStarburstGalaxyError",
67
+ UnknownErrorFields,
68
+ ) {}
69
+
70
+ /** A 2xx body that does not match the output schema (strict response validation). */
71
+ export class StarburstGalaxyParseError
72
+ extends /*@__PURE__*/ Schema.TaggedError<StarburstGalaxyParseError>()(
73
+ "StarburstGalaxyParseError",
74
+ {
75
+ body: Schema.Unknown,
76
+ cause: Schema.Unknown,
77
+ },
78
+ ).pipe(Category.withParseError) {}
79
+
80
+ /**
81
+ * The OAuth token request the credentials make failed: Galaxy could not
82
+ * be reached, refused the client credentials, answered with something that
83
+ * is not a token, or did not answer in time.
84
+ * `status` is the token endpoint's HTTP status, when it answered. It is a
85
+ * failure of a request at run time, so it is not a `ConfigError`.
86
+ */
87
+ export class TokenRequestFailed
88
+ extends /*@__PURE__*/ Schema.TaggedError<TokenRequestFailed>()("TokenRequestFailed", {
89
+ message: Schema.String,
90
+ status: /*@__PURE__*/ Schema.optional(Schema.Number),
91
+ }).pipe(Category.withAuthError) {}
92
+
93
+ /**
94
+ * The errors declared on the Galaxy service: any operation can return them,
95
+ * and every generated operation lists them as its `serviceErrors`. Each of
96
+ * core's status classes, and {@link PreconditionFailed} for 412, matched by
97
+ * its status like an operation's own errors.
98
+ */
99
+ export const StarburstGalaxyServiceErrors = [...API_ERRORS, PreconditionFailed] as const;
100
+ export type StarburstGalaxyServiceError = InstanceType<
101
+ (typeof StarburstGalaxyServiceErrors)[number]
102
+ >;
package/src/index.ts ADDED
@@ -0,0 +1,45 @@
1
+ /**
2
+ * @distilled.cloud/starburst-galaxy -- Starburst Galaxy SDK for Effect.
3
+ *
4
+ * `./services` is generated by `scripts/generate.ts` from the Smithy models
5
+ * that `scripts/convert.ts` converts from Galaxy's public OpenAPI documents,
6
+ * mirrored at `specs/spec-mirror-starburst-galaxy/specs/`. Everything else in
7
+ * this folder is hand-written.
8
+ *
9
+ * One module per Galaxy API service: `cluster`, `catalog`, `role`,
10
+ * `privilege`, `serviceAccount`, `dataProduct`, `tag`, ....
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * import { Effect, Layer } from "effect";
15
+ * import * as FetchHttpClient from "effect/http/FetchHttpClient";
16
+ * import * as StarburstGalaxy from "@distilled.cloud/starburst-galaxy";
17
+ * import * as Cluster from "@distilled.cloud/starburst-galaxy/cluster";
18
+ *
19
+ * const program = Effect.gen(function* () {
20
+ * const { result } = yield* Cluster.listClusters({});
21
+ * const [first] = result;
22
+ * if (first === undefined) return undefined;
23
+ *
24
+ * const cluster = yield* Cluster.getCluster({ clusterId: first.clusterId });
25
+ * yield* Effect.log(`${cluster.name}: ${cluster.clusterState} at ${cluster.trinoUri}`);
26
+ * return cluster;
27
+ * });
28
+ *
29
+ * const Live = Layer.mergeAll(
30
+ * StarburstGalaxy.CredentialsFromEnv,
31
+ * ).pipe(Layer.provideMerge(FetchHttpClient.layer));
32
+ *
33
+ * program.pipe(Effect.provide(Live), Effect.runPromise);
34
+ * ```
35
+ */
36
+ export * from "./credentials.ts";
37
+ export * from "./errors.ts";
38
+ export * as T from "./traits.ts";
39
+ export {
40
+ StarburstGalaxyProtocol,
41
+ type StarburstGalaxyOpError,
42
+ type StarburstGalaxyOpContext,
43
+ } from "./protocol.ts";
44
+ export { paginateToken } from "./pagination.ts";
45
+ export * as Retry from "./retry.ts";
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Starburst Galaxy pagination -- hand-written.
3
+ *
4
+ * List operations page by token: `pageToken` in, `nextPageToken` out (`""`
5
+ * on the last page), items under `result`. `scripts/convert.ts` stamps
6
+ * `smithy.api#paginated` on them; generated operations pass core's
7
+ * {@link paginateToken} strategy to `API.makePaginated`.
8
+ */
9
+ export { paginateToken } from "@distilled.cloud/core/pagination";
@@ -0,0 +1,94 @@
1
+ import { TooManyRequests } from "@distilled.cloud/core/errors";
2
+ import type { ErrorOf } from "@distilled.cloud/core/protocol";
3
+ import {
4
+ restProtocol,
5
+ type RestErrorInfo,
6
+ unknownErrorProps,
7
+ } from "@distilled.cloud/core/protocol-rest";
8
+ import { parseRetryAfter } from "@distilled.cloud/core/retry-after";
9
+ /**
10
+ * StarburstGalaxyProtocol -- hand-written.
11
+ *
12
+ * Galaxy speaks bearer-authenticated JSON REST with no success envelope, so
13
+ * the whole protocol is one `restProtocol` call from
14
+ * `core/protocol-rest`:
15
+ *
16
+ * request: credentials -> `Authorization: Bearer <access token>` + the
17
+ * account's base URL (`https://<account-domain>`), resolved
18
+ * from the calling fiber on every request (picking up the
19
+ * token refresh in credentials.ts)
20
+ *
21
+ * response: 2xx JSON is the payload (sensitive members delivered as
22
+ * `Redacted`); a 429 is read by {@link rateLimited}; other
23
+ * non-2xx `{ message, ... }` bodies map to the operation's typed
24
+ * error classes by status, then the shared HTTP-status classes
25
+ * plus 412 -> {@link PreconditionFailed}, then
26
+ * {@link UnknownStarburstGalaxyError}.
27
+ */
28
+ import * as Duration from "effect/Duration";
29
+ import * as Effect from "effect/Effect";
30
+ import type * as HttpClient from "effect/http/HttpClient";
31
+ import * as Redacted from "effect/Redacted";
32
+ import { Credentials } from "./credentials.ts";
33
+ import {
34
+ StarburstGalaxyParseError,
35
+ UnknownStarburstGalaxyError,
36
+ type StarburstGalaxyServiceError,
37
+ } from "./errors.ts";
38
+
39
+ /**
40
+ * What every generated Galaxy operation fails with besides its own errors: the
41
+ * service's errors, the protocol's, and what resolving the credentials fails
42
+ * with. Generated service files annotate operations with
43
+ * `API.OperationMethod<I, O, StarburstGalaxyOpError,
44
+ * StarburstGalaxyOpContext>` explicitly so the compiler never infers these
45
+ * back out of the schema generics.
46
+ */
47
+ export type StarburstGalaxyOpError =
48
+ | StarburstGalaxyServiceError
49
+ | ErrorOf<typeof StarburstGalaxyProtocol>;
50
+
51
+ /** Context (requirements) shared by every generated Galaxy operation. */
52
+ export type StarburstGalaxyOpContext = Credentials | HttpClient.HttpClient;
53
+
54
+ /** The wait Galaxy's rate limiter states in its plain-text 429 body. */
55
+ const TRY_AGAIN_IN = /try again in (\d+) seconds?/i;
56
+
57
+ /**
58
+ * Galaxy's rate limiter answers `429 Too Many Requests` with
59
+ * `Retry-After: 0` and the real wait in its text body ("Rate limit
60
+ * exceeded. Please try again in 10 seconds."). Core honors a zero hint as
61
+ * "retry now", which fails again at once, so the body's wait wins; a
62
+ * positive `Retry-After` is used when the body names none, and otherwise the
63
+ * retry policy's own backoff applies. Core has no hook for a body-stated
64
+ * wait, so this is Galaxy's `classifyError`.
65
+ */
66
+ export const rateLimited = (info: RestErrorInfo): TooManyRequests | undefined => {
67
+ if (info.status !== 429) return undefined;
68
+ const stated = TRY_AGAIN_IN.exec(info.message)?.[1];
69
+ const wait =
70
+ stated === undefined ? parseRetryAfter(info.headers) : Duration.seconds(Number(stated));
71
+ return new TooManyRequests({
72
+ message: info.message,
73
+ retryAfter: wait !== undefined && Duration.toMillis(wait) > 0 ? wait : undefined,
74
+ });
75
+ };
76
+
77
+ export const StarburstGalaxyProtocol = /*@__PURE__*/ restProtocol({
78
+ // The Credentials service holds an effect -- resolving it here (per
79
+ // request, on the calling fiber) picks up a refreshed access token.
80
+ credentials: /*@__PURE__*/ Effect.flatten(Credentials),
81
+ baseUrl: (creds) => creds.apiBaseUrl,
82
+ headers: (creds) => ({
83
+ Authorization: `Bearer ${Redacted.value(creds.accessToken)}`,
84
+ }),
85
+ // A status becomes the class the service declares for it
86
+ // (`StarburstGalaxyServiceErrors`: core's classes plus 412,
87
+ // `FailedPrecondition`, which Galaxy documents on cluster creation, schema
88
+ // discovery, data domain deletion and data quality operations).
89
+ classifyError: rateLimited,
90
+ // Galaxy's error body is `{ message, ... }` -- the factory's default
91
+ // lenient `{ code?, message? }` envelope reads it.
92
+ unknownError: (info) => new UnknownStarburstGalaxyError(unknownErrorProps(info)),
93
+ parseError: ({ body, cause }) => new StarburstGalaxyParseError({ body, cause }),
94
+ });
package/src/retry.ts ADDED
@@ -0,0 +1,50 @@
1
+ import { type Policy, throttlingFactory, transientFactory } from "@distilled.cloud/core/retry";
2
+ /**
3
+ * Starburst Galaxy retry configuration.
4
+ *
5
+ * Defines the per-SDK `Retry` Context.Service tag that generated operations
6
+ * wire into `API.make`. Callers can install a blanket retry policy at the
7
+ * layer level and have every Starburst Galaxy API call below it pick it up:
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * import * as StarburstGalaxy from "@distilled.cloud/starburst-galaxy";
12
+ *
13
+ * myEffect.pipe(StarburstGalaxy.Retry.transient);
14
+ * Effect.provide(myEffect, Layer.succeed(StarburstGalaxy.Retry.Retry, customPolicy));
15
+ * ```
16
+ */
17
+ import * as Context from "effect/Context";
18
+ import * as Effect from "effect/Effect";
19
+ import * as Layer from "effect/Layer";
20
+
21
+ export {
22
+ type Options,
23
+ type Factory,
24
+ type Policy,
25
+ makeDefault,
26
+ jittered,
27
+ capped,
28
+ throttlingOptions,
29
+ transientOptions,
30
+ throttlingFactory,
31
+ transientFactory,
32
+ } from "@distilled.cloud/core/retry";
33
+
34
+ /** Context tag for configuring retry behavior of Starburst Galaxy API calls. */
35
+ export class Retry extends /*@__PURE__*/ Context.Service<Retry, Policy>()("StarburstGalaxyRetry") {}
36
+
37
+ /** Provides a custom retry policy to every Starburst Galaxy API call below it. */
38
+ export const policy = (optionsOrFactory: Policy) =>
39
+ Effect.provide(Layer.succeed(Retry, optionsOrFactory));
40
+
41
+ /** Disables all automatic retries. */
42
+ export const none = /*@__PURE__*/ Effect.provide(
43
+ /*@__PURE__*/ Layer.succeed(Retry, { while: () => false }),
44
+ );
45
+
46
+ /** Apply the throttling retry policy (retries throttling errors indefinitely). */
47
+ export const throttling = /*@__PURE__*/ policy(throttlingFactory);
48
+
49
+ /** Apply the transient retry policy (retries all transient errors indefinitely). */
50
+ export const transient = /*@__PURE__*/ policy(transientFactory);