@theholocron/axiom-client 1.58.0-alpha.4 → 1.58.0-alpha.41

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.
package/dist/index.d.mts CHANGED
@@ -21,6 +21,13 @@ interface AxiomDataset {
21
21
  name: string;
22
22
  /** The dataset description, if it has one. */
23
23
  description?: string;
24
+ /**
25
+ * How many days Axiom keeps data in the dataset (`retentionDays` of `GET /v2/datasets/{id}`). One value for the whole
26
+ * dataset, so every environment in it shares it. Absent when the API does not return it.
27
+ */
28
+ retentionDays?: number;
29
+ /** Whether the retention period applies (`useRetentionPeriod`); `false` means data is not aged out by `retentionDays`. */
30
+ useRetentionPeriod?: boolean;
24
31
  }
25
32
  /** What to create a dataset with. */
26
33
  interface CreateAxiomDatasetInput {
@@ -29,6 +36,15 @@ interface CreateAxiomDatasetInput {
29
36
  /** A description for the new dataset. */
30
37
  description?: string;
31
38
  }
39
+ /** What a query of a dataset is sent with. */
40
+ interface AxiomQueryInput {
41
+ /** The APL query. */
42
+ apl: string;
43
+ /** The start of the time range, an RFC 3339 time. */
44
+ startTime?: string;
45
+ /** The end of the time range, an RFC 3339 time. */
46
+ endTime?: string;
47
+ }
32
48
  /** The user the Axiom token belongs to. */
33
49
  interface AxiomUser {
34
50
  /** The user id. */
@@ -44,6 +60,9 @@ interface AxiomUser {
44
60
  export declare function createAxiomClient(opts: AxiomClientOptions): {
45
61
  datasets: {
46
62
  get: (name: string) => Promise<AxiomDataset>;
63
+ list: () => Promise<AxiomDataset[]>;
64
+ ingest: (name: string, events: readonly Record<string, unknown>[]) => Promise<unknown>;
65
+ query: (input: AxiomQueryInput) => Promise<unknown>;
47
66
  create: (input: CreateAxiomDatasetInput) => Promise<AxiomDataset>;
48
67
  };
49
68
  user: {
@@ -52,4 +71,4 @@ export declare function createAxiomClient(opts: AxiomClientOptions): {
52
71
  };
53
72
  /** The client `createAxiomClient` returns. */
54
73
  export type AxiomClient = ReturnType<typeof createAxiomClient>;
55
- export type { AxiomClientOptions, AxiomDataset, AxiomUser, CreateAxiomDatasetInput };
74
+ export type { AxiomClientOptions, AxiomDataset, AxiomQueryInput, AxiomUser, CreateAxiomDatasetInput };
package/dist/index.mjs CHANGED
@@ -5,6 +5,22 @@ function datasets(rest) {
5
5
  return {
6
6
  /** Get one dataset by name (`GET /v2/datasets/{name}`); the name is URL-encoded. */
7
7
  get: (name) => rest.request(`${PATH}/${encodeURIComponent(name)}`),
8
+ /** List the datasets the token can see (`GET /v2/datasets`). */
9
+ list: () => rest.request(PATH),
10
+ /**
11
+ * Send events to a dataset (`POST /v1/datasets/{name}/ingest`). An empty list ingests nothing, which is how a token's
12
+ * right to ingest is tried without writing an event.
13
+ */
14
+ ingest: (name, events) => rest.request(`/v1/datasets/${encodeURIComponent(name)}/ingest`, {
15
+ method: "POST",
16
+ body: events
17
+ }),
18
+ /** Run an APL query (`POST /v1/datasets/_apl?format=tabular`); the dataset is named in the query. */
19
+ query: (input) => rest.request("/v1/datasets/_apl", {
20
+ method: "POST",
21
+ body: input,
22
+ query: { format: "tabular" }
23
+ }),
8
24
  /** Create a dataset (`POST /v2/datasets`). */
9
25
  create: (input) => rest.request(PATH, {
10
26
  method: "POST",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theholocron/axiom-client",
3
- "version": "1.58.0-alpha.4",
3
+ "version": "1.58.0-alpha.41",
4
4
  "description": "A TypeScript client for the Axiom API",
5
5
  "keywords": [
6
6
  "axiom",
@@ -32,23 +32,23 @@
32
32
  "dist"
33
33
  ],
34
34
  "dependencies": {
35
- "@theholocron/http-client": "^1.58.0-alpha.4",
36
- "@theholocron/observability": "^0.6.1-alpha.1"
35
+ "@theholocron/http-client": "^1.58.0-alpha.41",
36
+ "@theholocron/observability": "^0.7.0-alpha.5"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@types/node": "^26",
40
- "@vitest/coverage-v8": "^5.0.5",
41
- "@vitest/eslint-plugin": "^1.6.27",
42
- "eslint": "^10.8.1",
43
- "eslint-plugin-n": "^18.3.0",
44
- "globals": "^17.11.0",
45
- "tsdown": "^0.23.3",
40
+ "@vitest/coverage-v8": "^5.1.0",
41
+ "@vitest/eslint-plugin": "^1.6.28",
42
+ "eslint": "^10.14.0",
43
+ "eslint-plugin-n": "^18.5.0",
44
+ "globals": "^17.14.0",
45
+ "tsdown": "^0.23.7",
46
46
  "typescript": "^5.9.3",
47
- "vitest": "^5.0.5",
48
- "@theholocron/eslint-config": "^8.9.0-alpha.5",
49
- "@theholocron/tsconfig": "^8.9.0-alpha.5",
50
- "@theholocron/vitest-config": "^8.9.0-alpha.5",
51
- "@theholocron/tsdown-config": "^8.9.0-alpha.5"
47
+ "vitest": "^5.1.0",
48
+ "@theholocron/eslint-config": "^8.9.0-alpha.21",
49
+ "@theholocron/tsdown-config": "^8.9.0-alpha.21",
50
+ "@theholocron/vitest-config": "^8.9.0-alpha.21",
51
+ "@theholocron/tsconfig": "^8.9.0-alpha.21"
52
52
  },
53
53
  "engines": {
54
54
  "node": ">=22.0.0"
@@ -57,10 +57,10 @@
57
57
  "access": "public"
58
58
  },
59
59
  "scripts": {
60
- "delivery.build": "tsdown && node ../scripts/check-bundle-size.mjs",
61
- "sourceQuality.staticAnalysis": "eslint .",
60
+ "build": "tsdown && node ../scripts/check-bundle-size.mjs",
61
+ "lint:code": "eslint .",
62
+ "test:unit": "vitest run --coverage",
62
63
  "test:watch": "vitest",
63
- "verification.typeSafety": "tsc --noEmit",
64
- "verification.unitTests": "vitest run"
64
+ "typecheck": "tsc --noEmit"
65
65
  }
66
66
  }