@distilled.cloud/datadog 0.0.0 → 1.0.0-rc.9

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 (52) hide show
  1. package/LICENSE +201 -0
  2. package/lib/credentials.d.ts +42 -0
  3. package/lib/credentials.d.ts.map +1 -0
  4. package/lib/credentials.js +57 -0
  5. package/lib/credentials.js.map +1 -0
  6. package/lib/errors.d.ts +36 -0
  7. package/lib/errors.d.ts.map +1 -0
  8. package/lib/errors.js +26 -0
  9. package/lib/errors.js.map +1 -0
  10. package/lib/index.d.ts +22 -0
  11. package/lib/index.d.ts.map +1 -0
  12. package/lib/index.js +22 -0
  13. package/lib/index.js.map +1 -0
  14. package/lib/pagination.d.ts +11 -0
  15. package/lib/pagination.d.ts.map +1 -0
  16. package/lib/pagination.js +11 -0
  17. package/lib/pagination.js.map +1 -0
  18. package/lib/protocol.d.ts +18 -0
  19. package/lib/protocol.d.ts.map +1 -0
  20. package/lib/protocol.js +87 -0
  21. package/lib/protocol.js.map +1 -0
  22. package/lib/retry.d.ts +32 -0
  23. package/lib/retry.d.ts.map +1 -0
  24. package/lib/retry.js +32 -0
  25. package/lib/retry.js.map +1 -0
  26. package/lib/services/index.d.ts +3 -0
  27. package/lib/services/index.d.ts.map +1 -0
  28. package/lib/services/index.js +4 -0
  29. package/lib/services/index.js.map +1 -0
  30. package/lib/services/v1.d.ts +12737 -0
  31. package/lib/services/v1.d.ts.map +1 -0
  32. package/lib/services/v1.js +9659 -0
  33. package/lib/services/v1.js.map +1 -0
  34. package/lib/services/v2.d.ts +75167 -0
  35. package/lib/services/v2.d.ts.map +1 -0
  36. package/lib/services/v2.js +69959 -0
  37. package/lib/services/v2.js.map +1 -0
  38. package/lib/traits.d.ts +11 -0
  39. package/lib/traits.d.ts.map +1 -0
  40. package/lib/traits.js +11 -0
  41. package/lib/traits.js.map +1 -0
  42. package/package.json +77 -6
  43. package/src/credentials.ts +88 -0
  44. package/src/errors.ts +50 -0
  45. package/src/index.ts +25 -0
  46. package/src/pagination.ts +10 -0
  47. package/src/protocol.ts +116 -0
  48. package/src/retry.ts +54 -0
  49. package/src/services/index.ts +3 -0
  50. package/src/services/v1.ts +27861 -0
  51. package/src/services/v2.ts +181842 -0
  52. package/src/traits.ts +44 -0
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Datadog SDK trait surface — hand-written.
3
+ *
4
+ * Re-exports the generic protocol traits from core (so generated operations
5
+ * import everything from one place). Datadog has no envelope of its own; the
6
+ * REST-protocol traits (SensitiveValue / RawResponse) come from
7
+ * `core/protocol-rest`.
8
+ */
9
+ export { Body, Header, Query, Label, Http, ResponseCode, HttpBody, FormDataFile, KeyDictionary, UnionCases, applyErrorMatchers, getErrorMatchers, type HttpTrait, type ErrorMatcher, bodySymbol, headerSymbol, querySymbol, labelSymbol, httpSymbol, responseCodeSymbol, httpBodySymbol, formDataFileSymbol, keyDictionarySymbol, unionCasesSymbol, errorMatchersSymbol, } from "@distilled.cloud/core/trait";
10
+ export { SensitiveValue, RawResponse, RawResponseRoot, sensitiveValueSymbol, rawResponseSymbol, rawResponseRootSymbol, } from "@distilled.cloud/core/protocol-rest";
11
+ //# sourceMappingURL=traits.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"traits.d.ts","sourceRoot":"","sources":["../src/traits.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EACL,IAAI,EACJ,MAAM,EACN,KAAK,EACL,KAAK,EACL,IAAI,EACJ,YAAY,EACZ,QAAQ,EACR,YAAY,EACZ,aAAa,EACb,UAAU,EACV,kBAAkB,EAClB,gBAAgB,EAChB,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,UAAU,EACV,YAAY,EACZ,WAAW,EACX,WAAW,EACX,UAAU,EACV,kBAAkB,EAClB,cAAc,EACd,kBAAkB,EAClB,mBAAmB,EACnB,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,6BAA6B,CAAC;AAErC,OAAO,EACL,cAAc,EACd,WAAW,EACX,eAAe,EACf,oBAAoB,EACpB,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,qCAAqC,CAAC"}
package/lib/traits.js ADDED
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Datadog SDK trait surface — hand-written.
3
+ *
4
+ * Re-exports the generic protocol traits from core (so generated operations
5
+ * import everything from one place). Datadog has no envelope of its own; the
6
+ * REST-protocol traits (SensitiveValue / RawResponse) come from
7
+ * `core/protocol-rest`.
8
+ */
9
+ export { Body, Header, Query, Label, Http, ResponseCode, HttpBody, FormDataFile, KeyDictionary, UnionCases, applyErrorMatchers, getErrorMatchers, bodySymbol, headerSymbol, querySymbol, labelSymbol, httpSymbol, responseCodeSymbol, httpBodySymbol, formDataFileSymbol, keyDictionarySymbol, unionCasesSymbol, errorMatchersSymbol, } from "@distilled.cloud/core/trait";
10
+ export { SensitiveValue, RawResponse, RawResponseRoot, sensitiveValueSymbol, rawResponseSymbol, rawResponseRootSymbol, } from "@distilled.cloud/core/protocol-rest";
11
+ //# sourceMappingURL=traits.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"traits.js","sourceRoot":"","sources":["../src/traits.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EACL,IAAI,EACJ,MAAM,EACN,KAAK,EACL,KAAK,EACL,IAAI,EACJ,YAAY,EACZ,QAAQ,EACR,YAAY,EACZ,aAAa,EACb,UAAU,EACV,kBAAkB,EAClB,gBAAgB,EAGhB,UAAU,EACV,YAAY,EACZ,WAAW,EACX,WAAW,EACX,UAAU,EACV,kBAAkB,EAClB,cAAc,EACd,kBAAkB,EAClB,mBAAmB,EACnB,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,6BAA6B,CAAC;AAErC,OAAO,EACL,cAAc,EACd,WAAW,EACX,eAAe,EACf,oBAAoB,EACpB,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,qCAAqC,CAAC"}
package/package.json CHANGED
@@ -1,14 +1,85 @@
1
1
  {
2
2
  "name": "@distilled.cloud/datadog",
3
- "version": "0.0.0",
4
- "description": "Placeholder package for an upcoming distilled SDK.",
5
- "license": "Apache-2.0",
3
+ "version": "1.0.0-rc.9",
6
4
  "repository": {
7
5
  "type": "git",
8
6
  "url": "https://github.com/alchemy-run/distilled",
9
7
  "directory": "packages/datadog"
10
8
  },
11
- "publishConfig": {
12
- "access": "public"
9
+ "license": "Apache-2.0",
10
+ "type": "module",
11
+ "sideEffects": false,
12
+ "files": [
13
+ "lib",
14
+ "src"
15
+ ],
16
+ "exports": {
17
+ ".": {
18
+ "types": "./lib/index.d.ts",
19
+ "bun": "./src/index.ts",
20
+ "worker": "./src/index.ts",
21
+ "default": "./lib/index.js"
22
+ },
23
+ "./Credentials": {
24
+ "types": "./lib/credentials.d.ts",
25
+ "bun": "./src/credentials.ts",
26
+ "worker": "./src/credentials.ts",
27
+ "default": "./lib/credentials.js"
28
+ },
29
+ "./Errors": {
30
+ "types": "./lib/errors.d.ts",
31
+ "bun": "./src/errors.ts",
32
+ "worker": "./src/errors.ts",
33
+ "default": "./lib/errors.js"
34
+ },
35
+ "./Traits": {
36
+ "types": "./lib/traits.d.ts",
37
+ "bun": "./src/traits.ts",
38
+ "worker": "./src/traits.ts",
39
+ "default": "./lib/traits.js"
40
+ },
41
+ "./Pagination": {
42
+ "types": "./lib/pagination.d.ts",
43
+ "bun": "./src/pagination.ts",
44
+ "worker": "./src/pagination.ts",
45
+ "default": "./lib/pagination.js"
46
+ },
47
+ "./Protocol": {
48
+ "types": "./lib/protocol.d.ts",
49
+ "bun": "./src/protocol.ts",
50
+ "worker": "./src/protocol.ts",
51
+ "default": "./lib/protocol.js"
52
+ },
53
+ "./Retry": {
54
+ "types": "./lib/retry.d.ts",
55
+ "bun": "./src/retry.ts",
56
+ "worker": "./src/retry.ts",
57
+ "default": "./lib/retry.js"
58
+ },
59
+ "./*": {
60
+ "types": "./lib/services/*.d.ts",
61
+ "bun": "./src/services/*.ts",
62
+ "worker": "./src/services/*.ts",
63
+ "default": "./lib/services/*.js"
64
+ }
65
+ },
66
+ "dependencies": {
67
+ "@distilled.cloud/core": "1.0.0-rc.9"
68
+ },
69
+ "devDependencies": {
70
+ "@types/bun": "latest",
71
+ "@types/node": "latest",
72
+ "@effect/platform-bun": ">=4.0.0-rc.112 || >=4.0.0"
73
+ },
74
+ "peerDependencies": {
75
+ "effect": ">=4.0.0-rc.112 || >=4.0.0"
76
+ },
77
+ "scripts": {
78
+ "build": "tsc -b",
79
+ "convert": "bun scripts/convert.ts",
80
+ "generate": "bun scripts/convert.ts && bun scripts/generate.ts",
81
+ "typecheck": "tsc -p tsconfig.json",
82
+ "specs:fetch": "git submodule update --force --init --depth=1 specs/spec-mirror-datadog",
83
+ "specs:update": "git submodule update --remote --force --depth=1 specs/spec-mirror-datadog"
13
84
  }
14
- }
85
+ }
@@ -0,0 +1,88 @@
1
+ /**
2
+ * Datadog credentials — hand-written.
3
+ *
4
+ * API-compatible port of the distilled v0 Neon credentials module, adapted
5
+ * for Datadog's dual-header auth (`DD-API-KEY` + optional
6
+ * `DD-APPLICATION-KEY`) and regional sites. The `Credentials` service holds
7
+ * an *effect* that resolves the current credentials on every request (the
8
+ * protocol layer resolves it per request on the calling fiber).
9
+ */
10
+ import * as Context from "effect/Context";
11
+ import * as Effect from "effect/Effect";
12
+ import * as Layer from "effect/Layer";
13
+ import * as Redacted from "effect/Redacted";
14
+ import { ConfigError } from "@distilled.cloud/core/errors";
15
+
16
+ /** Default Datadog site (US1). */
17
+ export const DEFAULT_SITE = "datadoghq.com";
18
+
19
+ /** US1 REST API root — `https://api.${DEFAULT_SITE}`. */
20
+ export const DEFAULT_API_BASE_URL = "https://api.datadoghq.com";
21
+
22
+ /** Map a Datadog site (`datadoghq.eu`, `us3.datadoghq.com`, …) to its API origin. */
23
+ export const apiBaseUrlForSite = (site: string): string =>
24
+ `https://api.${site}`;
25
+
26
+ export interface Config {
27
+ readonly apiKey: Redacted.Redacted<string>;
28
+ readonly applicationKey?: Redacted.Redacted<string>;
29
+ readonly site: string;
30
+ readonly apiBaseUrl: string;
31
+ }
32
+
33
+ export class Credentials extends Context.Service<
34
+ Credentials,
35
+ Effect.Effect<Config>
36
+ >()("DatadogCredentials") {}
37
+
38
+ /** Layer from a plain API key + optional application key / site / base URL. */
39
+ export const fromApiKey = (config: {
40
+ readonly apiKey: string;
41
+ readonly applicationKey?: string;
42
+ readonly site?: string;
43
+ readonly apiBaseUrl?: string;
44
+ }): Layer.Layer<Credentials> => {
45
+ const site = config.site ?? DEFAULT_SITE;
46
+ return Layer.succeed(
47
+ Credentials,
48
+ Effect.succeed({
49
+ apiKey: Redacted.make(config.apiKey),
50
+ applicationKey:
51
+ config.applicationKey !== undefined
52
+ ? Redacted.make(config.applicationKey)
53
+ : undefined,
54
+ site,
55
+ apiBaseUrl: config.apiBaseUrl ?? apiBaseUrlForSite(site),
56
+ }),
57
+ );
58
+ };
59
+
60
+ /**
61
+ * Reads DD_API_KEY (required), DD_APP_KEY (optional), DD_SITE (optional)
62
+ * and DD_API_BASE_URL (optional override of `https://api.${site}`).
63
+ */
64
+ export const CredentialsFromEnv: Layer.Layer<Credentials> = Layer.succeed(
65
+ Credentials,
66
+ Effect.gen(function* () {
67
+ const apiKey = process.env.DD_API_KEY;
68
+
69
+ if (!apiKey) {
70
+ return yield* new ConfigError({
71
+ message: "DD_API_KEY environment variable is required",
72
+ });
73
+ }
74
+
75
+ const site = process.env.DD_SITE ?? DEFAULT_SITE;
76
+ const applicationKey = process.env.DD_APP_KEY;
77
+
78
+ return {
79
+ apiKey: Redacted.make(apiKey),
80
+ applicationKey:
81
+ applicationKey !== undefined
82
+ ? Redacted.make(applicationKey)
83
+ : undefined,
84
+ site,
85
+ apiBaseUrl: process.env.DD_API_BASE_URL ?? apiBaseUrlForSite(site),
86
+ };
87
+ }).pipe(Effect.orDie),
88
+ );
package/src/errors.ts ADDED
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Datadog-specific error types.
3
+ *
4
+ * Re-exports the common HTTP errors from core and adds the Datadog fallback
5
+ * errors. Note the generated service modules additionally define their own
6
+ * per-status matcher classes (BadRequest/NotFound/…) for the statuses each
7
+ * operation declares — those share `_tag`s with the core classes here, so
8
+ * `catchTag` works against either.
9
+ */
10
+ export {
11
+ BadGateway,
12
+ BadRequest,
13
+ Conflict,
14
+ ConfigError,
15
+ Forbidden,
16
+ GatewayTimeout,
17
+ InternalServerError,
18
+ Locked,
19
+ NotFound,
20
+ ServiceUnavailable,
21
+ TooManyRequests,
22
+ Unauthorized,
23
+ UnprocessableEntity,
24
+ HTTP_STATUS_MAP,
25
+ DEFAULT_ERRORS,
26
+ API_ERRORS,
27
+ } from "@distilled.cloud/core/errors";
28
+ export type { DefaultErrors } from "@distilled.cloud/core/errors";
29
+
30
+ import * as Schema from "effect/Schema";
31
+ import * as Category from "@distilled.cloud/core/category";
32
+
33
+ /** Unknown Datadog error — returned when nothing else matches the failure. */
34
+ export class UnknownDatadogError extends Schema.TaggedError<UnknownDatadogError>()(
35
+ "UnknownDatadogError",
36
+ {
37
+ code: Schema.optional(Schema.String),
38
+ message: Schema.optional(Schema.String),
39
+ body: Schema.Unknown,
40
+ },
41
+ ).pipe(Category.withServerError) {}
42
+
43
+ /** Schema parse error wrapper. */
44
+ export class DatadogParseError extends Schema.TaggedError<DatadogParseError>()(
45
+ "DatadogParseError",
46
+ {
47
+ body: Schema.Unknown,
48
+ cause: Schema.Unknown,
49
+ },
50
+ ).pipe(Category.withParseError) {}
package/src/index.ts ADDED
@@ -0,0 +1,25 @@
1
+ /**
2
+ * @distilled.cloud/datadog — Datadog REST API SDK for Effect.
3
+ *
4
+ * `./services` is generated by `scripts/generate.ts` from the Smithy models
5
+ * in `.generated-specs` (written by `scripts/convert.ts` from the OpenAPI
6
+ * specs). Everything else in this folder is hand-written.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * import * as Datadog from "@distilled.cloud/datadog";
11
+ *
12
+ * const dashboards = yield* Datadog.Services.v1.listDashboards({});
13
+ * ```
14
+ */
15
+ export * from "./credentials.ts";
16
+ export * from "./errors.ts";
17
+ export * as T from "./traits.ts";
18
+ export {
19
+ DatadogProtocol,
20
+ type DatadogOpError,
21
+ type DatadogOpContext,
22
+ } from "./protocol.ts";
23
+ export { paginateCursor } from "./pagination.ts";
24
+ export * as Retry from "./retry.ts";
25
+ export * as Services from "./services/index.ts";
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Datadog pagination — hand-written.
3
+ *
4
+ * Generated operations that the converter stamps as cursor-paginated pass
5
+ * core's {@link paginateCursor} strategy to `API.makePaginated`. Many
6
+ * Datadog list endpoints use `page[number]` / `page[size]` or `page[cursor]`
7
+ * query parameters without an in-body next-page token; those stay plain
8
+ * inputs.
9
+ */
10
+ export { paginateCursor } from "@distilled.cloud/core/pagination";
@@ -0,0 +1,116 @@
1
+ /**
2
+ * DatadogProtocol — hand-written.
3
+ *
4
+ * Datadog speaks plain JSON REST (no response envelope), so the whole
5
+ * protocol is one `makeRestProtocol` call from `core/protocol-rest`:
6
+ *
7
+ * request: credentials → `DD-API-KEY` + optional `DD-APPLICATION-KEY` +
8
+ * base URL (default https://api.datadoghq.com), resolved from
9
+ * the calling fiber on every request
10
+ *
11
+ * response: 2xx JSON is the payload (sensitive members delivered as
12
+ * `Redacted`); non-2xx `{ errors: string[] | object[] }` bodies
13
+ * map to the operation's typed error classes by status, then the
14
+ * shared HTTP-status classes, then {@link UnknownDatadogError}.
15
+ */
16
+ import * as Effect from "effect/Effect";
17
+ import type * as Layer from "effect/Layer";
18
+ import * as Redacted from "effect/Redacted";
19
+ import type * as HttpClient from "effect/unstable/http/HttpClient";
20
+ import type * as HttpClientError from "effect/unstable/http/HttpClientError";
21
+ import type * as API from "@distilled.cloud/core/api";
22
+ import {
23
+ makeRestProtocol,
24
+ type RestErrorEnvelope,
25
+ } from "@distilled.cloud/core/protocol-rest";
26
+ import type { API_ERRORS, ConfigError } from "@distilled.cloud/core/errors";
27
+ import { Credentials, type Config } from "./credentials.ts";
28
+ import { UnknownDatadogError } from "./errors.ts";
29
+
30
+ /**
31
+ * Error channel shared by every generated Datadog operation. Generated
32
+ * service files annotate operations with `API.OperationMethod<I, O,
33
+ * DatadogOpError, DatadogOpContext>` explicitly so the compiler never infers
34
+ * these back out of the schema generics.
35
+ */
36
+ export type DatadogOpError =
37
+ | InstanceType<(typeof API_ERRORS)[number]>
38
+ | UnknownDatadogError
39
+ | ConfigError
40
+ | HttpClientError.HttpClientError;
41
+
42
+ /** Context (requirements) shared by every generated Datadog operation. */
43
+ export type DatadogOpContext = Credentials | HttpClient.HttpClient;
44
+
45
+ /**
46
+ * Datadog error bodies are typically `{ errors: string[] }` or JSON:API
47
+ * `{ errors: [{ title?, detail?, status? }] }`. Surface the first entry as
48
+ * `message` so status matchers and logs have something to key on.
49
+ */
50
+ const errorEnvelope = (body: unknown): RestErrorEnvelope | undefined => {
51
+ if (body === null || typeof body !== "object") return undefined;
52
+ const b = body as Record<string, unknown>;
53
+ const first = Array.isArray(b.errors) ? b.errors[0] : undefined;
54
+ if (typeof first === "string") {
55
+ return { message: first };
56
+ }
57
+ if (first !== null && typeof first === "object") {
58
+ const e = first as Record<string, unknown>;
59
+ const message =
60
+ typeof e.detail === "string"
61
+ ? e.detail
62
+ : typeof e.title === "string"
63
+ ? e.title
64
+ : typeof b.message === "string"
65
+ ? b.message
66
+ : undefined;
67
+ const code =
68
+ typeof e.code === "string"
69
+ ? e.code
70
+ : typeof e.status === "string"
71
+ ? e.status
72
+ : undefined;
73
+ return { code, message };
74
+ }
75
+ const message = typeof b.message === "string" ? b.message : undefined;
76
+ const code =
77
+ typeof b.code === "string" || typeof b.code === "number"
78
+ ? b.code
79
+ : undefined;
80
+ return message !== undefined || code !== undefined
81
+ ? { code, message }
82
+ : undefined;
83
+ };
84
+
85
+ export const DatadogProtocol: Layer.Layer<API.Protocol> =
86
+ makeRestProtocol<Config>({
87
+ // The Credentials service holds an effect — resolving it here (per
88
+ // request, on the calling fiber) picks up context-provided credentials.
89
+ credentials: Effect.gen(function* () {
90
+ const resolve = yield* Credentials;
91
+ return yield* resolve;
92
+ }),
93
+ baseUrl: (creds) => creds.apiBaseUrl,
94
+ headers: (creds) => {
95
+ const headers: Record<string, string> = {
96
+ "DD-API-KEY": Redacted.value(creds.apiKey),
97
+ Accept: "application/json",
98
+ };
99
+ if (creds.applicationKey !== undefined) {
100
+ headers["DD-APPLICATION-KEY"] = Redacted.value(creds.applicationKey);
101
+ }
102
+ return headers;
103
+ },
104
+ errorEnvelope,
105
+ unknownError: ({ code, message, body }) =>
106
+ new UnknownDatadogError({
107
+ code:
108
+ typeof code === "string"
109
+ ? code
110
+ : code !== undefined
111
+ ? String(code)
112
+ : undefined,
113
+ message,
114
+ body,
115
+ }),
116
+ });
package/src/retry.ts ADDED
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Datadog retry configuration.
3
+ *
4
+ * Defines the per-SDK `Retry` Context.Service tag that generated operations
5
+ * wire into `API.make`. Callers can install a blanket retry policy at the
6
+ * layer level and have every Datadog API call below it pick it up:
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * import * as Datadog from "@distilled.cloud/datadog";
11
+ *
12
+ * myEffect.pipe(Datadog.Retry.transient);
13
+ * Effect.provide(myEffect, Layer.succeed(Datadog.Retry.Retry, customPolicy));
14
+ * ```
15
+ */
16
+ import * as Context from "effect/Context";
17
+ import * as Effect from "effect/Effect";
18
+ import * as Layer from "effect/Layer";
19
+ import {
20
+ type Policy,
21
+ throttlingFactory,
22
+ transientFactory,
23
+ } from "@distilled.cloud/core/retry";
24
+
25
+ export {
26
+ type Options,
27
+ type Factory,
28
+ type Policy,
29
+ makeDefault,
30
+ jittered,
31
+ capped,
32
+ throttlingOptions,
33
+ transientOptions,
34
+ throttlingFactory,
35
+ transientFactory,
36
+ } from "@distilled.cloud/core/retry";
37
+
38
+ /** Context tag for configuring retry behavior of Datadog API calls. */
39
+ export class Retry extends Context.Service<Retry, Policy>()("DatadogRetry") {}
40
+
41
+ /** Provides a custom retry policy to every Datadog API call below it. */
42
+ export const policy = (optionsOrFactory: Policy) =>
43
+ Effect.provide(Layer.succeed(Retry, optionsOrFactory));
44
+
45
+ /** Disables all automatic retries. */
46
+ export const none = Effect.provide(
47
+ Layer.succeed(Retry, { while: () => false }),
48
+ );
49
+
50
+ /** Apply the throttling retry policy (retries throttling errors indefinitely). */
51
+ export const throttling = policy(throttlingFactory);
52
+
53
+ /** Apply the transient retry policy (retries all transient errors indefinitely). */
54
+ export const transient = policy(transientFactory);
@@ -0,0 +1,3 @@
1
+ // AUTO-GENERATED by scripts/generate.ts. Do not edit.
2
+ export * as v1 from "./v1.ts";
3
+ export * as v2 from "./v2.ts";