@distilled.cloud/axiom 1.0.0-rc.1 → 1.0.0-rc.3

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 (49) hide show
  1. package/lib/credentials.d.ts +36 -0
  2. package/lib/credentials.d.ts.map +1 -0
  3. package/lib/credentials.js +59 -0
  4. package/lib/credentials.js.map +1 -0
  5. package/lib/edge-ingest.d.ts +7 -0
  6. package/lib/edge-ingest.d.ts.map +1 -0
  7. package/lib/edge-ingest.js +7 -0
  8. package/lib/edge-ingest.js.map +1 -0
  9. package/lib/edge-query.d.ts +7 -0
  10. package/lib/edge-query.d.ts.map +1 -0
  11. package/lib/edge-query.js +7 -0
  12. package/lib/edge-query.js.map +1 -0
  13. package/lib/errors.d.ts +36 -0
  14. package/lib/errors.d.ts.map +1 -0
  15. package/lib/errors.js +26 -0
  16. package/lib/errors.js.map +1 -0
  17. package/lib/index.d.ts +29 -0
  18. package/lib/index.d.ts.map +1 -0
  19. package/lib/index.js +33 -0
  20. package/lib/index.js.map +1 -0
  21. package/lib/protocol.d.ts +28 -0
  22. package/lib/protocol.d.ts.map +1 -0
  23. package/lib/protocol.js +86 -0
  24. package/lib/protocol.js.map +1 -0
  25. package/lib/retry.d.ts +32 -0
  26. package/lib/retry.d.ts.map +1 -0
  27. package/lib/retry.js +32 -0
  28. package/lib/retry.js.map +1 -0
  29. package/lib/services/edge_ingest.d.ts +52 -0
  30. package/lib/services/edge_ingest.d.ts.map +1 -0
  31. package/lib/services/edge_ingest.js +59 -0
  32. package/lib/services/edge_ingest.js.map +1 -0
  33. package/lib/services/edge_query.d.ts +93 -0
  34. package/lib/services/edge_query.d.ts.map +1 -0
  35. package/lib/services/edge_query.js +81 -0
  36. package/lib/services/edge_query.js.map +1 -0
  37. package/lib/services/index.d.ts +4 -0
  38. package/lib/services/index.d.ts.map +1 -0
  39. package/lib/services/index.js +5 -0
  40. package/lib/services/index.js.map +1 -0
  41. package/lib/services/v2.d.ts +2772 -0
  42. package/lib/services/v2.d.ts.map +1 -0
  43. package/lib/services/v2.js +2494 -0
  44. package/lib/services/v2.js.map +1 -0
  45. package/lib/traits.d.ts +11 -0
  46. package/lib/traits.d.ts.map +1 -0
  47. package/lib/traits.js +11 -0
  48. package/lib/traits.js.map +1 -0
  49. package/package.json +8 -5
@@ -0,0 +1,36 @@
1
+ import * as Context from "effect/Context";
2
+ import * as Effect from "effect/Effect";
3
+ import * as Layer from "effect/Layer";
4
+ import * as Redacted from "effect/Redacted";
5
+ /** Default base URL for Axiom Cloud. Self-hosted users can override via AXIOM_URL. */
6
+ export declare const DEFAULT_API_BASE_URL = "https://api.axiom.co";
7
+ export interface Config {
8
+ readonly apiKey: Redacted.Redacted<string>;
9
+ readonly apiBaseUrl: string;
10
+ /**
11
+ * Optional organization ID. Required when authenticating with a Personal
12
+ * Access Token (PAT); optional for API tokens scoped to a single org.
13
+ * Sent on every request as the `X-Axiom-Org-ID` header when set.
14
+ */
15
+ readonly orgId?: string;
16
+ }
17
+ declare const Credentials_base: Context.ServiceClass<Credentials, "AxiomCredentials", Effect.Effect<Config, never, never>>;
18
+ export declare class Credentials extends Credentials_base {
19
+ }
20
+ /** Layer from a plain API token + optional base URL / org ID. */
21
+ export declare const fromApiKey: (config: {
22
+ readonly apiKey: string | Redacted.Redacted<string>;
23
+ readonly apiBaseUrl?: string;
24
+ readonly orgId?: string;
25
+ }) => Layer.Layer<Credentials>;
26
+ /**
27
+ * Build {@link Credentials} from environment variables.
28
+ *
29
+ * - `AXIOM_TOKEN` or `AXIOM_API_KEY` (required) — Axiom API token or PAT.
30
+ * - `AXIOM_URL` (optional) — override the API base URL (for self-hosted or
31
+ * regional edge deployments). Defaults to `https://api.axiom.co`.
32
+ * - `AXIOM_ORG_ID` (optional) — organization ID, required for PATs.
33
+ */
34
+ export declare const CredentialsFromEnv: Layer.Layer<Credentials>;
35
+ export {};
36
+ //# sourceMappingURL=credentials.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../src/credentials.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAEtC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAG5C,sFAAsF;AACtF,eAAO,MAAM,oBAAoB,yBAAyB,CAAC;AAE3D,MAAM,WAAW,MAAM;IACrB,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC3C,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B;;;;OAIG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;;AAED,qBAAa,WAAY,SAAQ,gBAGV;CAAG;AAE1B,iEAAiE;AACjE,eAAO,MAAM,UAAU,WAAY;IACjC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IACpD,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB,KAAG,KAAK,CAAC,KAAK,CAAC,WAAW,CAUxB,CAAC;AAWJ;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,KAAK,CAAC,WAAW,CA6BvD,CAAC"}
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Axiom credentials — hand-written.
3
+ *
4
+ * API-compatible port of the distilled v0 axiom credentials module: the
5
+ * `Credentials` service holds an *effect* that resolves the current
6
+ * credentials on every request (the protocol layer resolves it per request
7
+ * on the calling fiber).
8
+ */
9
+ import * as EffectConfig from "effect/Config";
10
+ import * as Context from "effect/Context";
11
+ import * as Effect from "effect/Effect";
12
+ import * as Layer from "effect/Layer";
13
+ import * as Option from "effect/Option";
14
+ import * as Redacted from "effect/Redacted";
15
+ import { ConfigError } from "@distilled.cloud/core/errors";
16
+ /** Default base URL for Axiom Cloud. Self-hosted users can override via AXIOM_URL. */
17
+ export const DEFAULT_API_BASE_URL = "https://api.axiom.co";
18
+ export class Credentials extends Context.Service()("AxiomCredentials") {
19
+ }
20
+ /** Layer from a plain API token + optional base URL / org ID. */
21
+ export const fromApiKey = (config) => Layer.succeed(Credentials, Effect.succeed({
22
+ apiKey: Redacted.isRedacted(config.apiKey)
23
+ ? config.apiKey
24
+ : Redacted.make(config.apiKey),
25
+ apiBaseUrl: config.apiBaseUrl ?? DEFAULT_API_BASE_URL,
26
+ orgId: config.orgId,
27
+ }));
28
+ const envConfig = EffectConfig.all({
29
+ apiToken: EffectConfig.option(EffectConfig.string("AXIOM_TOKEN")),
30
+ apiKey: EffectConfig.option(EffectConfig.string("AXIOM_API_KEY")),
31
+ apiBaseUrl: EffectConfig.string("AXIOM_URL").pipe(EffectConfig.withDefault(DEFAULT_API_BASE_URL)),
32
+ orgId: EffectConfig.option(EffectConfig.string("AXIOM_ORG_ID")),
33
+ });
34
+ /**
35
+ * Build {@link Credentials} from environment variables.
36
+ *
37
+ * - `AXIOM_TOKEN` or `AXIOM_API_KEY` (required) — Axiom API token or PAT.
38
+ * - `AXIOM_URL` (optional) — override the API base URL (for self-hosted or
39
+ * regional edge deployments). Defaults to `https://api.axiom.co`.
40
+ * - `AXIOM_ORG_ID` (optional) — organization ID, required for PATs.
41
+ */
42
+ export const CredentialsFromEnv = Layer.succeed(Credentials, Effect.gen(function* () {
43
+ const config = yield* envConfig.pipe(Effect.mapError(() => new ConfigError({
44
+ message: "AXIOM_TOKEN (or AXIOM_API_KEY) environment variable is required",
45
+ })));
46
+ const apiKey = Option.getOrUndefined(config.apiToken) ??
47
+ Option.getOrUndefined(config.apiKey);
48
+ if (!apiKey) {
49
+ return yield* new ConfigError({
50
+ message: "AXIOM_TOKEN (or AXIOM_API_KEY) environment variable is required",
51
+ });
52
+ }
53
+ return {
54
+ apiKey: Redacted.make(apiKey),
55
+ apiBaseUrl: config.apiBaseUrl,
56
+ orgId: Option.getOrUndefined(config.orgId),
57
+ };
58
+ }).pipe(Effect.orDie));
59
+ //# sourceMappingURL=credentials.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"credentials.js","sourceRoot":"","sources":["../src/credentials.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,YAAY,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAE3D,sFAAsF;AACtF,MAAM,CAAC,MAAM,oBAAoB,GAAG,sBAAsB,CAAC;AAa3D,MAAM,OAAO,WAAY,SAAQ,OAAO,CAAC,OAAO,EAG7C,CAAC,kBAAkB,CAAC;CAAG;AAE1B,iEAAiE;AACjE,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,MAI1B,EAA4B,EAAE,CAC7B,KAAK,CAAC,OAAO,CACX,WAAW,EACX,MAAM,CAAC,OAAO,CAAC;IACb,MAAM,EAAE,QAAQ,CAAC,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC;QACxC,CAAC,CAAC,MAAM,CAAC,MAAM;QACf,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;IAChC,UAAU,EAAE,MAAM,CAAC,UAAU,IAAI,oBAAoB;IACrD,KAAK,EAAE,MAAM,CAAC,KAAK;CACpB,CAAC,CACH,CAAC;AAEJ,MAAM,SAAS,GAAG,YAAY,CAAC,GAAG,CAAC;IACjC,QAAQ,EAAE,YAAY,CAAC,MAA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cloud/axiom/edge-ingest` — the v1 edge ingest API
3
+ * (`ingestToDataset`), served from the same canonical host
4
+ * (https://api.axiom.co) under the `/v1` prefix.
5
+ */
6
+ export * from "./services/edge_ingest.ts";
7
+ //# sourceMappingURL=edge-ingest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"edge-ingest.d.ts","sourceRoot":"","sources":["../src/edge-ingest.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,cAAc,2BAA2B,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * `@distilled.cloud/axiom/edge-ingest` — the v1 edge ingest API
3
+ * (`ingestToDataset`), served from the same canonical host
4
+ * (https://api.axiom.co) under the `/v1` prefix.
5
+ */
6
+ export * from "./services/edge_ingest.js";
7
+ //# sourceMappingURL=edge-ingest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"edge-ingest.js","sourceRoot":"","sources":["../src/edge-ingest.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,cAAc,2BAA2B,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * `@distilled.cloud/axiom/edge-query` — the v1 edge query API (`queryApl`),
3
+ * served from the same canonical host (https://api.axiom.co) under the `/v1`
4
+ * prefix.
5
+ */
6
+ export * from "./services/edge_query.ts";
7
+ //# sourceMappingURL=edge-query.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"edge-query.d.ts","sourceRoot":"","sources":["../src/edge-query.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,cAAc,0BAA0B,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * `@distilled.cloud/axiom/edge-query` — the v1 edge query API (`queryApl`),
3
+ * served from the same canonical host (https://api.axiom.co) under the `/v1`
4
+ * prefix.
5
+ */
6
+ export * from "./services/edge_query.js";
7
+ //# sourceMappingURL=edge-query.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"edge-query.js","sourceRoot":"","sources":["../src/edge-query.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,cAAc,0BAA0B,CAAC"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Axiom-specific error types.
3
+ *
4
+ * Re-exports the common HTTP errors from core and adds the Axiom 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 { BadGateway, BadRequest, Conflict, ConfigError, Forbidden, GatewayTimeout, InternalServerError, Locked, NotFound, ServiceUnavailable, TooManyRequests, Unauthorized, UnprocessableEntity, HTTP_STATUS_MAP, DEFAULT_ERRORS, API_ERRORS, } from "@distilled.cloud/core/errors";
11
+ export type { DefaultErrors } from "@distilled.cloud/core/errors";
12
+ import * as Schema from "effect/Schema";
13
+ declare const UnknownAxiomError_base: Schema.Class<UnknownAxiomError, Schema.TaggedStruct<"UnknownAxiomError", {
14
+ readonly code: Schema.optional<Schema.String>;
15
+ readonly message: Schema.optional<Schema.String>;
16
+ readonly body: Schema.Unknown;
17
+ }>, import("effect/Cause").YieldableError> & (new (...args: any[]) => {
18
+ "@distilled.cloud/error/categories": {
19
+ ServerError: true;
20
+ };
21
+ });
22
+ /** Unknown Axiom error — returned when nothing else matches the failure. */
23
+ export declare class UnknownAxiomError extends UnknownAxiomError_base {
24
+ }
25
+ declare const AxiomParseError_base: Schema.Class<AxiomParseError, Schema.TaggedStruct<"AxiomParseError", {
26
+ readonly body: Schema.Unknown;
27
+ readonly cause: Schema.Unknown;
28
+ }>, import("effect/Cause").YieldableError> & (new (...args: any[]) => {
29
+ "@distilled.cloud/error/categories": {
30
+ ParseError: true;
31
+ };
32
+ });
33
+ /** Schema parse error wrapper (kept for v0 surface parity). */
34
+ export declare class AxiomParseError extends AxiomParseError_base {
35
+ }
36
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EACL,UAAU,EACV,UAAU,EACV,QAAQ,EACR,WAAW,EACX,SAAS,EACT,cAAc,EACd,mBAAmB,EACnB,MAAM,EACN,QAAQ,EACR,kBAAkB,EAClB,eAAe,EACf,YAAY,EACZ,mBAAmB,EACnB,eAAe,EACf,cAAc,EACd,UAAU,GACX,MAAM,8BAA8B,CAAC;AACtC,YAAY,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAElE,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;;;;;;;;;;AAGxC,4EAA4E;AAC5E,qBAAa,iBAAkB,SAAQ,sBAOP;CAAG;;;;;;;;;AAEnC,+DAA+D;AAC/D,qBAAa,eAAgB,SAAQ,oBAMN;CAAG"}
package/lib/errors.js ADDED
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Axiom-specific error types.
3
+ *
4
+ * Re-exports the common HTTP errors from core and adds the Axiom 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 { BadGateway, BadRequest, Conflict, ConfigError, Forbidden, GatewayTimeout, InternalServerError, Locked, NotFound, ServiceUnavailable, TooManyRequests, Unauthorized, UnprocessableEntity, HTTP_STATUS_MAP, DEFAULT_ERRORS, API_ERRORS, } from "@distilled.cloud/core/errors";
11
+ import * as Schema from "effect/Schema";
12
+ import * as Category from "@distilled.cloud/core/category";
13
+ /** Unknown Axiom error — returned when nothing else matches the failure. */
14
+ export class UnknownAxiomError extends Schema.TaggedErrorClass()("UnknownAxiomError", {
15
+ code: Schema.optional(Schema.String),
16
+ message: Schema.optional(Schema.String),
17
+ body: Schema.Unknown,
18
+ }).pipe(Category.withServerError) {
19
+ }
20
+ /** Schema parse error wrapper (kept for v0 surface parity). */
21
+ export class AxiomParseError extends Schema.TaggedErrorClass()("AxiomParseError", {
22
+ body: Schema.Unknown,
23
+ cause: Schema.Unknown,
24
+ }).pipe(Category.withParseError) {
25
+ }
26
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EACL,UAAU,EACV,UAAU,EACV,QAAQ,EACR,WAAW,EACX,SAAS,EACT,cAAc,EACd,mBAAmB,EACnB,MAAM,EACN,QAAQ,EACR,kBAAkB,EAClB,eAAe,EACf,YAAY,EACZ,mBAAmB,EACnB,eAAe,EACf,cAAc,EACd,UAAU,GACX,MAAM,8BAA8B,CAAC;AAGtC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,QAAQ,MAAM,gCAAgC,CAAC;AAE3D,4EAA4E;AAC5E,MAAM,OAAO,iBAAkB,SAAQ,MAAM,CAAC,gBAAgB,EAAqB,CACjF,mBAAmB,EACnB;IACE,IAAI,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;IACpC,OAAO,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;IACvC,IAAI,EAAE,MAAM,CAAC,OAAO;CACrB,CACF,CAAC,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC;CAAG;AAEnC,+DAA+D;AAC/D,MAAM,OAAO,eAAgB,SAAQ,MAAM,CAAC,gBAAgB,EAAmB,CAC7E,iBAAiB,EACjB;IACE,IAAI,EAAE,MAAM,CAAC,OAAO;IACpB,KAAK,EAAE,MAAM,CAAC,OAAO;CACtB,CACF,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC;CAAG"}
package/lib/index.d.ts ADDED
@@ -0,0 +1,29 @@
1
+ /**
2
+ * @distilled.cloud/axiom — Axiom 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 three
6
+ * OpenAPI specs in specs/docs/restapi/versions). Everything else in this
7
+ * folder is hand-written.
8
+ *
9
+ * The v2 control-plane API lives under `Services.v2`; the v1 edge APIs are
10
+ * also available under their own subpath imports:
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * import * as Axiom from "@distilled.cloud/axiom";
15
+ * import * as EdgeIngest from "@distilled.cloud/axiom/edge-ingest";
16
+ * import * as EdgeQuery from "@distilled.cloud/axiom/edge-query";
17
+ *
18
+ * const datasets = yield* Axiom.Services.v2.getDatasets({});
19
+ * ```
20
+ */
21
+ export * from "./credentials.ts";
22
+ export * from "./errors.ts";
23
+ export * as T from "./traits.ts";
24
+ export { AxiomProtocol, stripNulls, type AxiomOpError, type AxiomOpContext, } from "./protocol.ts";
25
+ export * as Retry from "./retry.ts";
26
+ export * as Services from "./services/index.ts";
27
+ export * from "./services/v2.ts";
28
+ export { BadRequest, Conflict, Forbidden, NotFound, UnprocessableEntity, } from "./services/v2.ts";
29
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,OAAO,KAAK,CAAC,MAAM,aAAa,CAAC;AACjC,OAAO,EACL,aAAa,EACb,UAAU,EACV,KAAK,YAAY,EACjB,KAAK,cAAc,GACpB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAC;AAKhD,cAAc,kBAAkB,CAAC;AACjC,OAAO,EACL,UAAU,EACV,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,mBAAmB,GACpB,MAAM,kBAAkB,CAAC"}
package/lib/index.js ADDED
@@ -0,0 +1,33 @@
1
+ /**
2
+ * @distilled.cloud/axiom — Axiom 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 three
6
+ * OpenAPI specs in specs/docs/restapi/versions). Everything else in this
7
+ * folder is hand-written.
8
+ *
9
+ * The v2 control-plane API lives under `Services.v2`; the v1 edge APIs are
10
+ * also available under their own subpath imports:
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * import * as Axiom from "@distilled.cloud/axiom";
15
+ * import * as EdgeIngest from "@distilled.cloud/axiom/edge-ingest";
16
+ * import * as EdgeQuery from "@distilled.cloud/axiom/edge-query";
17
+ *
18
+ * const datasets = yield* Axiom.Services.v2.getDatasets({});
19
+ * ```
20
+ */
21
+ export * from "./credentials.js";
22
+ export * from "./errors.js";
23
+ export * as T from "./traits.js";
24
+ export { AxiomProtocol, stripNulls, } from "./protocol.js";
25
+ export * as Retry from "./retry.js";
26
+ export * as Services from "./services/index.js";
27
+ // v0-parity surface: the v2 control-plane operations live on the package
28
+ // root (edge-ingest / edge-query stay behind their subpath exports).
29
+ // The service-local typed error classes shadow the same-named shared ones
30
+ // from ./errors.ts — the ops actually raise the service-local classes.
31
+ export * from "./services/v2.js";
32
+ export { BadRequest, Conflict, Forbidden, NotFound, UnprocessableEntity, } from "./services/v2.js";
33
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,OAAO,KAAK,CAAC,MAAM,aAAa,CAAC;AACjC,OAAO,EACL,aAAa,EACb,UAAU,GAGX,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAC;AAChD,yEAAyE;AACzE,qEAAqE;AACrE,0EAA0E;AAC1E,uEAAuE;AACvE,cAAc,kBAAkB,CAAC;AACjC,OAAO,EACL,UAAU,EACV,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,mBAAmB,GACpB,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,28 @@
1
+ import type * as Layer from "effect/Layer";
2
+ import type * as HttpClient from "effect/unstable/http/HttpClient";
3
+ import type * as HttpClientError from "effect/unstable/http/HttpClientError";
4
+ import type * as API from "@distilled.cloud/core/api";
5
+ import type { API_ERRORS, ConfigError } from "@distilled.cloud/core/errors";
6
+ import { Credentials } from "./credentials.ts";
7
+ import { UnknownAxiomError } from "./errors.ts";
8
+ /**
9
+ * Error channel shared by every generated Axiom operation. Generated service
10
+ * files annotate operations with `API.OperationMethod<I, O, AxiomOpError,
11
+ * AxiomOpContext>` explicitly so the compiler never infers these back out of
12
+ * the schema generics.
13
+ */
14
+ export type AxiomOpError = InstanceType<(typeof API_ERRORS)[number]> | UnknownAxiomError | ConfigError | HttpClientError.HttpClientError;
15
+ /** Context (requirements) shared by every generated Axiom operation. */
16
+ export type AxiomOpContext = Credentials | HttpClient.HttpClient;
17
+ /**
18
+ * Axiom's backend (Go) serializes nil slices and omitted optional fields as
19
+ * JSON `null`. The generated output schemas model these as optional members
20
+ * (value or absent), so `null` trips decoding. Recursively drop explicit
21
+ * `null` properties before decoding so optional fields are treated as
22
+ * absent. Keys that are genuinely nullable in the API are patched to
23
+ * nullable in the spec — this hook exists for the far more common "Go nil
24
+ * slice" case.
25
+ */
26
+ export declare const stripNulls: (value: unknown) => unknown;
27
+ export declare const AxiomProtocol: Layer.Layer<API.Protocol>;
28
+ //# sourceMappingURL=protocol.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAC;AAE3C,OAAO,KAAK,KAAK,UAAU,MAAM,iCAAiC,CAAC;AACnE,OAAO,KAAK,KAAK,eAAe,MAAM,sCAAsC,CAAC;AAC7E,OAAO,KAAK,KAAK,GAAG,MAAM,2BAA2B,CAAC;AAKtD,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC5E,OAAO,EAAE,WAAW,EAAe,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GACpB,YAAY,CAAC,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,GACzC,iBAAiB,GACjB,WAAW,GACX,eAAe,CAAC,eAAe,CAAC;AAEpC,wEAAwE;AACxE,MAAM,MAAM,cAAc,GAAG,WAAW,GAAG,UAAU,CAAC,UAAU,CAAC;AAEjE;;;;;;;;GAQG;AACH,eAAO,MAAM,UAAU,UAAW,OAAO,KAAG,OAW3C,CAAC;AAkBF,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,CAqBhD,CAAC"}
@@ -0,0 +1,86 @@
1
+ /**
2
+ * AxiomProtocol — hand-written.
3
+ *
4
+ * Axiom speaks plain bearer-authenticated JSON REST (no response envelope),
5
+ * so the whole protocol is one `makeRestProtocol` call from
6
+ * `core/protocol-rest`:
7
+ *
8
+ * request: credentials → `Authorization: Bearer <apiKey>` (+ optional
9
+ * `X-Axiom-Org-ID` for Personal Access Tokens) + base URL
10
+ * (default https://api.axiom.co), resolved from the calling
11
+ * fiber on every request
12
+ *
13
+ * response: 2xx JSON is the payload, with explicit JSON `null` properties
14
+ * recursively dropped first ({@link stripNulls} — Axiom's Go
15
+ * backend serializes nil slices/omitted optionals as `null`);
16
+ * non-2xx bodies map to the operation's typed error classes by
17
+ * status, then the shared HTTP-status classes, then
18
+ * {@link UnknownAxiomError}. Axiom returns two error envelope
19
+ * shapes — `{ code, message }` (control-plane / edge-ingest) and
20
+ * `{ error, message }` (edge-query) — unified by a lenient
21
+ * extractor; the HTTP status stays the authoritative signal.
22
+ */
23
+ import * as Effect from "effect/Effect";
24
+ import * as Redacted from "effect/Redacted";
25
+ import { makeRestProtocol, } from "@distilled.cloud/core/protocol-rest";
26
+ import { Credentials } from "./credentials.js";
27
+ import { UnknownAxiomError } from "./errors.js";
28
+ /**
29
+ * Axiom's backend (Go) serializes nil slices and omitted optional fields as
30
+ * JSON `null`. The generated output schemas model these as optional members
31
+ * (value or absent), so `null` trips decoding. Recursively drop explicit
32
+ * `null` properties before decoding so optional fields are treated as
33
+ * absent. Keys that are genuinely nullable in the API are patched to
34
+ * nullable in the spec — this hook exists for the far more common "Go nil
35
+ * slice" case.
36
+ */
37
+ export const stripNulls = (value) => {
38
+ if (Array.isArray(value))
39
+ return value.map(stripNulls);
40
+ if (value && typeof value === "object") {
41
+ const out = {};
42
+ for (const [k, v] of Object.entries(value)) {
43
+ if (v === null)
44
+ continue;
45
+ out[k] = stripNulls(v);
46
+ }
47
+ return out;
48
+ }
49
+ return value;
50
+ };
51
+ /**
52
+ * Unify Axiom's two error envelope shapes (`{ code, message }` and
53
+ * `{ error, message }`, some endpoints plain `{ message }`) into one
54
+ * `{ code?, message? }` pair — v0 semantics: `message ?? error`,
55
+ * `code ?? error`.
56
+ */
57
+ const errorEnvelope = (body) => {
58
+ if (body === null || typeof body !== "object")
59
+ return undefined;
60
+ const b = body;
61
+ const error = typeof b.error === "string" ? b.error : undefined;
62
+ const code = typeof b.code === "string" || typeof b.code === "number" ? b.code : error;
63
+ const message = typeof b.message === "string" ? b.message : error;
64
+ return { code, message };
65
+ };
66
+ export const AxiomProtocol = makeRestProtocol({
67
+ // The Credentials service holds an effect — resolving it here (per
68
+ // request, on the calling fiber) picks up context-provided credentials.
69
+ credentials: Effect.gen(function* () {
70
+ const resolve = yield* Credentials;
71
+ return yield* resolve;
72
+ }),
73
+ baseUrl: (creds) => creds.apiBaseUrl,
74
+ headers: (creds) => ({
75
+ Authorization: `Bearer ${Redacted.value(creds.apiKey)}`,
76
+ ...(creds.orgId ? { "X-Axiom-Org-ID": creds.orgId } : {}),
77
+ }),
78
+ errorEnvelope,
79
+ transformResponse: stripNulls,
80
+ unknownError: ({ code, message, body }) => new UnknownAxiomError({
81
+ code: typeof code === "number" ? String(code) : code,
82
+ message,
83
+ body,
84
+ }),
85
+ });
86
+ //# sourceMappingURL=protocol.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protocol.js","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAI5C,OAAO,EACL,gBAAgB,GAEjB,MAAM,qCAAqC,CAAC;AAE7C,OAAO,EAAE,WAAW,EAAe,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAiBhD;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,KAAc,EAAW,EAAE;IACpD,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IACvD,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QACvC,MAAM,GAAG,GAA4B,EAAE,CAAC;QACxC,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAgC,CAAC,EAAE,CAAC;YACtE,IAAI,CAAC,KAAK,IAAI;gBAAE,SAAS;YACzB,GAAG,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;QACzB,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,aAAa,GAAG,CAAC,IAAa,EAAiC,EAAE;IACr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E,UAAU;IAC7B,YAAY,EAAE,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,CACxC,IAAI,iBAAiB,CAAC;QACpB,IAAI,EAAE,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI;QACpD,OAAO;QACP,IAAI;KACL,CAAC;CACL,CAAC,CAAC"}
package/lib/retry.d.ts ADDED
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Axiom 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 Axiom API call below it pick it up:
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * import * as Axiom from "@distilled.cloud/axiom";
11
+ *
12
+ * myEffect.pipe(Axiom.Retry.transient);
13
+ * Effect.provide(myEffect, Layer.succeed(Axiom.Retry.Retry, customPolicy));
14
+ * ```
15
+ */
16
+ import * as Context from "effect/Context";
17
+ import * as Effect from "effect/Effect";
18
+ import { type Policy } from "@distilled.cloud/core/retry";
19
+ export { type Options, type Factory, type Policy, makeDefault, jittered, capped, throttlingOptions, transientOptions, throttlingFactory, transientFactory, } from "@distilled.cloud/core/retry";
20
+ declare const Retry_base: Context.ServiceClass<Retry, "AxiomRetry", Policy>;
21
+ /** Context tag for configuring retry behavior of Axiom API calls. */
22
+ export declare class Retry extends Retry_base {
23
+ }
24
+ /** Provides a custom retry policy to every Axiom API call below it. */
25
+ export declare const policy: (optionsOrFactory: Policy) => <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, Exclude<R, Retry>>;
26
+ /** Disables all automatic retries. */
27
+ export declare const none: <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, Exclude<R, Retry>>;
28
+ /** Apply the throttling retry policy (retries throttling errors indefinitely). */
29
+ export declare const throttling: <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, Exclude<R, Retry>>;
30
+ /** Apply the transient retry policy (retries all transient errors indefinitely). */
31
+ export declare const transient: <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, Exclude<R, Retry>>;
32
+ //# sourceMappingURL=retry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"retry.d.ts","sourceRoot":"","sources":["../src/retry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,EACL,KAAK,MAAM,EAGZ,MAAM,6BAA6B,CAAC;AAErC,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,OAAO,EACZ,KAAK,MAAM,EACX,WAAW,EACX,QAAQ,EACR,MAAM,EACN,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,6BAA6B,CAAC;;AAErC,qEAAqE;AACrE,qBAAa,KAAM,SAAQ,UAA8C;CAAG;AAE5E,uEAAuE;AACvE,eAAO,MAAM,MAAM,qBAAsB,MAAM,sFACS,CAAC;AAEzD,sCAAsC;AACtC,eAAO,MAAM,IAAI,mFAEhB,CAAC;AAEF,kFAAkF;AAClF,eAAO,MAAM,UAAU,mFAA4B,CAAC;AAEpD,oFAAoF;AACpF,eAAO,MAAM,SAAS,mFAA2B,CAAC"}
package/lib/retry.js ADDED
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Axiom 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 Axiom API call below it pick it up:
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * import * as Axiom from "@distilled.cloud/axiom";
11
+ *
12
+ * myEffect.pipe(Axiom.Retry.transient);
13
+ * Effect.provide(myEffect, Layer.succeed(Axiom.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 { throttlingFactory, transientFactory, } from "@distilled.cloud/core/retry";
20
+ export { makeDefault, jittered, capped, throttlingOptions, transientOptions, throttlingFactory, transientFactory, } from "@distilled.cloud/core/retry";
21
+ /** Context tag for configuring retry behavior of Axiom API calls. */
22
+ export class Retry extends Context.Service()("AxiomRetry") {
23
+ }
24
+ /** Provides a custom retry policy to every Axiom API call below it. */
25
+ export const policy = (optionsOrFactory) => Effect.provide(Layer.succeed(Retry, optionsOrFactory));
26
+ /** Disables all automatic retries. */
27
+ export const none = Effect.provide(Layer.succeed(Retry, { while: () => false }));
28
+ /** Apply the throttling retry policy (retries throttling errors indefinitely). */
29
+ export const throttling = policy(throttlingFactory);
30
+ /** Apply the transient retry policy (retries all transient errors indefinitely). */
31
+ export const transient = policy(transientFactory);
32
+ //# sourceMappingURL=retry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"retry.js","sourceRoot":"","sources":["../src/retry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,EAEL,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAIL,WAAW,EACX,QAAQ,EACR,MAAM,EACN,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,6BAA6B,CAAC;AAErC,qEAAqE;AACrE,MAAM,OAAO,KAAM,SAAQ,OAAO,CAAC,OAAO,EAAiB,CAAC,YAAY,CAAC;CAAG;AAE5E,uEAAuE;AACvE,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,gBAAwB,EAAE,EAAE,CACjD,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,gBAAgB,CAAC,CAAC,CAAC;AAEzD,sCAAsC;AACtC,MAAM,CAAC,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,CAChC,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,KAAK,EAAE,CAAC,CAC7C,CAAC;AAEF,kFAAkF;AAClF,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAAC,iBAAiB,CAAC,CAAC;AAEpD,oFAAoF;AACpF,MAAM,CAAC,MAAM,SAAS,GAAG,MAAM,CAAC,gBAAgB,CAAC,CAAC"}
@@ -0,0 +1,52 @@
1
+ import * as S from "@distilled.cloud/core/schema";
2
+ import * as API from "@distilled.cloud/core/api";
3
+ import { type AxiomOpError, type AxiomOpContext } from "../protocol.ts";
4
+ export type { AxiomOpError, AxiomOpContext };
5
+ declare const BadRequest_base: S.Class<BadRequest, S.TaggedStruct<"BadRequest", {
6
+ readonly code: any;
7
+ readonly message: any;
8
+ }>, import("effect/Cause").YieldableError>;
9
+ export declare class BadRequest extends /*@__PURE__*/ BadRequest_base {
10
+ }
11
+ declare const NotFound_base: S.Class<NotFound, S.TaggedStruct<"NotFound", {
12
+ readonly code: any;
13
+ readonly message: any;
14
+ }>, import("effect/Cause").YieldableError>;
15
+ export declare class NotFound extends /*@__PURE__*/ NotFound_base {
16
+ }
17
+ declare const UnprocessableEntity_base: S.Class<UnprocessableEntity, S.TaggedStruct<"UnprocessableEntity", {
18
+ readonly code: any;
19
+ readonly message: any;
20
+ }>, import("effect/Cause").YieldableError>;
21
+ export declare class UnprocessableEntity extends /*@__PURE__*/ UnprocessableEntity_base {
22
+ }
23
+ export interface IngestToDatasetRequest {
24
+ dataset_id: string;
25
+ /** The name of the field to use as the timestamp. If not specified, the timestamp will be the time the event was received by Axiom. */
26
+ timestamp_field?: string;
27
+ /** The date-time format of the timestamp field. The reference time is `Mon Jan 2 15:04:05 -0700 MST 2006`, as specified in https://pkg.go.dev/time/?tab=doc#Parse */
28
+ timestamp_format?: string;
29
+ /** The delimiter to use when parsing CSV data. If not specified, the default delimiter is `,`. */
30
+ csv_delimiter?: string;
31
+ body: string;
32
+ }
33
+ export declare const IngestToDatasetRequest: S.Schema<IngestToDatasetRequest>;
34
+ export interface IngestFailure {
35
+ error: string;
36
+ timestamp: string;
37
+ }
38
+ export declare const IngestFailure: S.Schema<IngestFailure>;
39
+ export type IngestStatusFailuresList = Array<IngestFailure>;
40
+ export declare const IngestStatusFailuresList: S.Schema<IngestStatusFailuresList>;
41
+ export interface IngestStatus {
42
+ blocksCreated: number;
43
+ failed: number;
44
+ failures?: IngestStatusFailuresList;
45
+ ingested: number;
46
+ processedBytes: number;
47
+ walLength: number;
48
+ }
49
+ export declare const IngestStatus: S.Schema<IngestStatus>;
50
+ export type IngestToDatasetError = BadRequest | NotFound | UnprocessableEntity | AxiomOpError;
51
+ export declare const ingestToDataset: API.OperationMethod<IngestToDatasetRequest, IngestStatus, IngestToDatasetError, AxiomOpContext>;
52
+ //# sourceMappingURL=edge_ingest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"edge_ingest.d.ts","sourceRoot":"","sources":["../../src/services/edge_ingest.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,8BAA8B,CAAC;AAClD,OAAO,KAAK,GAAG,MAAM,2BAA2B,CAAC;AAEjD,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,cAAc,EACpB,MAAM,gBAAgB,CAAC;AAIxB,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,CAAC;;;;;AAE7C,qBAAa,UACX,SAAQ,aAAa,CAAC,eAMrB;CAAG;;;;;AAEN,qBAAa,QACX,SAAQ,aAAa,CAAC,aAMrB;CAAG;;;;;AAEN,qBAAa,mBACX,SAAQ,aAAa,CAAC,wBASrB;CAAG;AAEN,MAAM,WAAW,sBAAsB;IACrC,UAAU,EAAE,MAAM,CAAC;IACnB,uIAAuI;IACvI,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,qKAAqK;IACrK,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,kGAAkG;IAClG,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;CACd;AACD,eAAO,MAAM,sBAAsB,EAgBtB,CAAC,CAAC,MAAM,CAAC,sBAAsB,CAAC,CAAC;AAE9C,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;CACnB;AACD,eAAO,MAAM,aAAa,EAK4B,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;AAE9E,MAAM,MAAM,wBAAwB,GAAG,KAAK,CAAC,aAAa,CAAC,CAAC;AAC5D,eAAO,MAAM,wBAAwB,EAEzB,CAAC,CAAC,MAAM,CAAC,wBAAwB,CAAC,CAAC;AAE/C,MAAM,WAAW,YAAY;IAC3B,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,wBAAwB,CAAC;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;CACnB;AACD,eAAO,MAAM,YAAY,EAS4B,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;AAE5E,MAAM,MAAM,oBAAoB,GAC5B,UAAU,GACV,QAAQ,GACR,mBAAmB,GACnB,YAAY,CAAC;AACjB,eAAO,MAAM,eAAe,EAAE,GAAG,CAAC,eAAe,CAC/C,sBAAsB,EACtB,YAAY,EACZ,oBAAoB,EACpB,cAAc,CAOb,CAAC"}
@@ -0,0 +1,59 @@
1
+ // AUTO-GENERATED by scripts/generate.ts from .generated-specs (specs/docs restapi/versions). Do not edit.
2
+ import * as S from "@distilled.cloud/core/schema";
3
+ import * as API from "@distilled.cloud/core/api";
4
+ import * as T from "../traits.js";
5
+ import { AxiomProtocol, } from "../protocol.js";
6
+ import { UnknownAxiomError } from "../errors.js";
7
+ import * as Retry from "../retry.js";
8
+ export class BadRequest extends /*@__PURE__*/ /*@__PURE__*/ T.applyErrorMatchers(
9
+ /*@__PURE__*/ S.TaggedErrorClass()("BadRequest", {
10
+ code: S.Number,
11
+ message: S.String,
12
+ }), [{ status: 400 }]) {
13
+ }
14
+ export class NotFound extends /*@__PURE__*/ /*@__PURE__*/ T.applyErrorMatchers(
15
+ /*@__PURE__*/ S.TaggedErrorClass()("NotFound", {
16
+ code: S.Number,
17
+ message: S.String,
18
+ }), [{ status: 404 }]) {
19
+ }
20
+ export class UnprocessableEntity extends /*@__PURE__*/ /*@__PURE__*/ T.applyErrorMatchers(
21
+ /*@__PURE__*/ S.TaggedErrorClass()("UnprocessableEntity", {
22
+ code: S.Number,
23
+ message: S.String,
24
+ }), [{ status: 422 }]) {
25
+ }
26
+ export const IngestToDatasetRequest = /*@__PURE__*/ S.suspend(() => S.Struct({
27
+ dataset_id: S.String.pipe(T.Label()),
28
+ timestamp_field: S.optional(S.String.pipe(T.Query("timestamp-field"))),
29
+ timestamp_format: S.optional(S.String.pipe(T.Query("timestamp-format"))),
30
+ csv_delimiter: S.optional(S.String.pipe(T.Query("csv-delimiter"))),
31
+ body: S.String.pipe(T.HttpBody()),
32
+ }).pipe(T.Http({
33
+ method: "POST",
34
+ uri: "/v1/datasets/{dataset_id}/ingest",
35
+ code: 200,
36
+ }))).annotate({
37
+ identifier: "IngestToDatasetRequest",
38
+ });
39
+ export const IngestFailure = /*@__PURE__*/ S.suspend(() => S.Struct({
40
+ error: S.String,
41
+ timestamp: S.String,
42
+ })).annotate({ identifier: "IngestFailure" });
43
+ export const IngestStatusFailuresList = /*@__PURE__*/ S.Array(IngestFailure);
44
+ export const IngestStatus = /*@__PURE__*/ S.suspend(() => S.Struct({
45
+ blocksCreated: S.Number,
46
+ failed: S.Number,
47
+ failures: S.optional(IngestStatusFailuresList),
48
+ ingested: S.Number,
49
+ processedBytes: S.Number,
50
+ walLength: S.Number,
51
+ })).annotate({ identifier: "IngestStatus" });
52
+ export const ingestToDataset = /*@__PURE__*/ API.make(() => ({
53
+ input: IngestToDatasetRequest,
54
+ output: IngestStatus,
55
+ errors: [BadRequest, NotFound, UnprocessableEntity, UnknownAxiomError],
56
+ protocol: AxiomProtocol,
57
+ retry: Retry.Retry,
58
+ }));
59
+ //# sourceMappingURL=edge_ingest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"edge_ingest.js","sourceRoot":"","sources":["../../src/services/edge_ingest.ts"],"names":[],"mappings":"AAAA,0GAA0G;AAC1G,OAAO,KAAK,CAAC,MAAM,8BAA8B,CAAC;AAClD,OAAO,KAAK,GAAG,MAAM,2BAA2B,CAAC;AACjD,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAClC,OAAO,EACL,aAAa,GAGd,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,KAAK,KAAK,MAAM,aAAa,CAAC;AAIrC,MAAM,OAAO,UACX,SAAQ,aAAa,CAAb,aAAa,CAAC,CAAC,CAAC,kBAAkB;AACxC,aAAa,CAAC,CAAC,CAAC,gBAAgB,EAAc,CAAC,YAAY,EAAE;IAC3D,IAAI,EAAE,CAAC,CAAC,MAAM;IACd,OAAO,EAAE,CAAC,CAAC,MAAM;CAClB,CAAC,EACF,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAClB;CAAG;AAEN,MAAM,OAAO,QACX,SAAQ,aAAa,CAAb,aAAa,CAAC,CAAC,CAAC,kBAAkB;AACxC,aAAa,CAAC,CAAC,CAAC,gBAAgB,EAAY,CAAC,UAAU,EAAE;IACvD,IAAI,EAAE,CAAC,CAAC,MAAM;IACd,OAAO,EAAE,CAAC,CAAC,MAAM;CAClB,CAAC,EACF,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAClB;CAAG;AAEN,MAA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