@theholocron/holocron-plugin-axiom 5.0.0-alpha.27 → 5.0.0-alpha.270

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/README.md CHANGED
@@ -9,7 +9,7 @@ plus exports `verifyToken` + `AUTH_HINT` for use by `holocron auth`.
9
9
  > This plugin does **not** ship log lines. `@theholocron/observability/logger`'s
10
10
  > Axiom transport reads `HOLOCRON_AXIOM_TOKEN` / `HOLOCRON_AXIOM_DATASET`
11
11
  > directly at startup. The `logs` capability exists only for the
12
- > management surface — `holocron setup` provisions the aggregation
12
+ > management surface — `holocron repo setup` provisions the aggregation
13
13
  > datasets and `holocron doctor` checks connectivity.
14
14
 
15
15
  ## Install
@@ -49,7 +49,7 @@ token as `HOLOCRON_AXIOM_TOKEN` (or `AXIOM_TOKEN`) in the workflow env.
49
49
  }
50
50
  ```
51
51
 
52
- No options are required. `holocron setup` provisions the `holocron-ci`
52
+ No options are required. `holocron repo setup` provisions the `holocron-ci`
53
53
  and `holocron-local` datasets; `holocron doctor` checks the dataset
54
54
  named by `HOLOCRON_AXIOM_DATASET` / `AXIOM_DATASET`. An explicit
55
55
  `logs: ["axiom", { "dataset": "holocron-ci" }]` overrides the env var
package/dist/index.d.mts CHANGED
@@ -1,39 +1,6 @@
1
- import { AuthError, Logs, ResolveTokenInput } from "@theholocron/cli";
2
- //#region src/auth.d.ts
3
- declare const resolveToken: (input?: ResolveTokenInput) => string;
4
- //#endregion
5
- //#region src/rest.d.ts
6
- /** Axiom dataset — the subset of fields Holocron reads. */
7
- interface AxiomDataset {
8
- id: string;
9
- name: string;
10
- description?: string;
11
- }
12
- /** Axiom user — the subset returned by `GET /v2/user`. */
13
- interface AxiomUser {
14
- id: string;
15
- name?: string;
16
- email?: string;
17
- emails?: string[];
18
- }
19
- interface AxiomClientOptions {
20
- token: string;
21
- /** Override the API base URL (default `https://api.axiom.co`). */
22
- baseUrl?: string;
23
- /** Override `fetch` for tests. */
24
- fetch?: typeof fetch;
25
- }
26
- interface AxiomRestClient {
27
- getDataset(name: string): Promise<AxiomDataset>;
28
- createDataset(input: {
29
- name: string;
30
- description?: string;
31
- }): Promise<AxiomDataset>;
32
- getCurrentUser(): Promise<AxiomUser>;
33
- }
34
- declare function createAxiomClient(opts: AxiomClientOptions): AxiomRestClient;
35
- //#endregion
36
- //#region src/capabilities/logs.d.ts
1
+ import { AuthError, Logs, ResolveTokenInput, VerifyTokenFailure, VerifyTokenResult, VerifyTokenResult as VerifyTokenResult$1, VerifyTokenSuccess } from "@theholocron/cli";
2
+ import { AxiomClient, AxiomClientOptions, AxiomDataset, AxiomUser, CreateAxiomDatasetInput, createAxiomClient } from "@theholocron/axiom-client";
3
+ export declare const resolveToken: (input?: ResolveTokenInput) => string;
37
4
  interface AxiomLogsOptions {
38
5
  /**
39
6
  * Target dataset, resolved from `HOLOCRON_AXIOM_DATASET` /
@@ -42,7 +9,7 @@ interface AxiomLogsOptions {
42
9
  */
43
10
  dataset?: string;
44
11
  }
45
- declare class AxiomLogs implements Logs {
12
+ export declare class AxiomLogs implements Logs {
46
13
  private readonly client;
47
14
  private readonly opts;
48
15
  readonly key: "logs";
@@ -51,7 +18,7 @@ declare class AxiomLogs implements Logs {
51
18
  * `client` is a thunk — the token is resolved on first call, so
52
19
  * `describe()` (which needs no auth) works without one.
53
20
  */
54
- constructor(client: () => AxiomRestClient, opts: AxiomLogsOptions);
21
+ constructor(client: () => AxiomClient, opts: AxiomLogsOptions);
55
22
  describe(): Promise<{
56
23
  provider: string;
57
24
  envKeys: string[];
@@ -64,39 +31,18 @@ declare class AxiomLogs implements Logs {
64
31
  alreadyExists: boolean;
65
32
  }>;
66
33
  }
67
- //#endregion
68
- //#region src/verify-token.d.ts
69
- /**
70
- * `verifyToken` — plugin-level export used by `holocron auth set axiom`
71
- * + `holocron auth check`. Hits `GET /v2/user` and translates the
72
- * response into the normalized `VerifyTokenResult` shape.
73
- *
74
- * Kept as a standalone function (not a capability method) so the auth
75
- * command can call it without initializing the full plugin.
76
- */
77
- interface VerifyTokenSuccess {
78
- ok: true;
79
- subject: string;
80
- }
81
- interface VerifyTokenFailure {
82
- ok: false;
83
- message: string;
84
- }
85
- type VerifyTokenResult = VerifyTokenSuccess | VerifyTokenFailure;
86
34
  interface VerifyTokenOptions {
87
35
  baseUrl?: string;
88
36
  fetch?: typeof fetch;
89
37
  }
90
- declare function verifyToken(token: string, opts?: VerifyTokenOptions): Promise<VerifyTokenResult>;
91
- //#endregion
92
- //#region src/index.d.ts
93
- interface AxiomPluginOptions extends ResolveTokenInput, AxiomLogsOptions {
38
+ export declare function verifyToken(token: string, opts?: VerifyTokenOptions): Promise<VerifyTokenResult$1>;
39
+ export interface AxiomPluginOptions extends ResolveTokenInput, AxiomLogsOptions {
94
40
  /** Override base URL for tests. */
95
41
  baseUrl?: string;
96
42
  /** Override `fetch` for tests. */
97
43
  fetch?: typeof fetch;
98
44
  }
99
- interface PluginContext {
45
+ export interface PluginContext {
100
46
  options: AxiomPluginOptions & {
101
47
  dataset?: string;
102
48
  };
@@ -106,12 +52,15 @@ interface PluginContext {
106
52
  * no auth (`describe`) works without a token, and the loader never
107
53
  * aborts on a plugin whose token happens to be absent.
108
54
  */
109
- client: () => AxiomRestClient;
55
+ client: () => AxiomClient;
110
56
  }
111
- declare function createContext(options: AxiomPluginOptions): PluginContext;
112
- declare function logs(ctx: PluginContext): Logs;
113
- declare function createPlugin(options: AxiomPluginOptions): {
57
+ export declare function createContext(options: AxiomPluginOptions): PluginContext;
58
+ export declare function logs(ctx: PluginContext): Logs;
59
+ export declare function createPlugin(options: AxiomPluginOptions): {
114
60
  name: string;
61
+ probes: {
62
+ connection: import("@theholocron/cli").Probe;
63
+ };
115
64
  capabilities: {
116
65
  logs: () => Logs;
117
66
  };
@@ -120,6 +69,5 @@ declare function createPlugin(options: AxiomPluginOptions): {
120
69
  * One-line hint shown by `holocron auth set axiom` when no token is
121
70
  * supplied or when the supplied token is rejected.
122
71
  */
123
- declare const AUTH_HINT: string;
124
- //#endregion
125
- export { AUTH_HINT, AuthError, type AxiomClientOptions, type AxiomDataset, AxiomLogs, type AxiomLogsOptions, AxiomPluginOptions, type AxiomRestClient, type AxiomUser, PluginContext, type ResolveTokenInput, type VerifyTokenFailure, type VerifyTokenResult, type VerifyTokenSuccess, createAxiomClient, createContext, createPlugin, logs, resolveToken, verifyToken };
72
+ export declare const AUTH_HINT: string;
73
+ export { AuthError, type AxiomClient, type AxiomClientOptions, type AxiomDataset, type AxiomLogsOptions, type AxiomUser, type CreateAxiomDatasetInput, type ResolveTokenInput, type VerifyTokenFailure, type VerifyTokenResult, type VerifyTokenSuccess, createAxiomClient };
package/dist/index.mjs CHANGED
@@ -1,13 +1,14 @@
1
- import { AuthError, ProviderApiError, createResolveToken, createRestClient } from "@theholocron/cli";
2
- //#region src/auth.ts
1
+ import { AuthError, ProviderApiError, connectionProbe, createResolveToken } from "@theholocron/cli";
2
+ import { createAxiomClient } from "@theholocron/axiom-client";
3
+ import { errorMessage } from "@theholocron/misc-utils";
4
+ // src/auth.ts
3
5
  const resolveToken = createResolveToken({
4
6
  envName: "HOLOCRON_AXIOM_TOKEN",
5
7
  vendorEnvName: "AXIOM_TOKEN",
6
8
  keyringService: "axiom",
7
9
  errorMessage: "no Axiom token found. Pass --token <TOKEN>, set HOLOCRON_AXIOM_TOKEN / AXIOM_TOKEN, or run: holocron auth set axiom <TOKEN>"
8
10
  });
9
- //#endregion
10
- //#region src/capabilities/logs.ts
11
+ // src/capabilities/logs.ts
11
12
  var AxiomLogs = class {
12
13
  client;
13
14
  opts;
@@ -30,7 +31,7 @@ var AxiomLogs = class {
30
31
  async whoami() {
31
32
  const dataset = this.opts.dataset;
32
33
  if (!dataset) throw new Error("@theholocron/holocron-plugin-axiom needs a dataset (HOLOCRON_AXIOM_DATASET / AXIOM_DATASET) for whoami");
33
- await this.client().getDataset(dataset);
34
+ await this.client().datasets.get(dataset);
34
35
  return {
35
36
  ok: true,
36
37
  dataset
@@ -38,44 +39,19 @@ var AxiomLogs = class {
38
39
  }
39
40
  async ensureDataset(name) {
40
41
  try {
41
- await this.client().getDataset(name);
42
+ await this.client().datasets.get(name);
42
43
  return { alreadyExists: true };
43
44
  } catch (err) {
44
45
  if (!(err instanceof ProviderApiError) || err.status !== 404) throw err;
45
46
  }
46
- await this.client().createDataset({
47
+ await this.client().datasets.create({
47
48
  name,
48
49
  description: "Managed by holocron"
49
50
  });
50
51
  return { alreadyExists: false };
51
52
  }
52
53
  };
53
- function createAxiomClient(opts) {
54
- const rest = createRestClient({
55
- baseUrl: opts.baseUrl ?? "https://api.axiom.co",
56
- token: opts.token,
57
- vendor: "Axiom",
58
- fetch: opts.fetch
59
- });
60
- return {
61
- getDataset: (name) => rest.request(`/v2/datasets/${encodeURIComponent(name)}`),
62
- createDataset: (input) => rest.request("/v2/datasets", {
63
- method: "POST",
64
- body: input
65
- }),
66
- getCurrentUser: () => rest.request("/v2/user")
67
- };
68
- }
69
- //#endregion
70
- //#region src/verify-token.ts
71
- /**
72
- * `verifyToken` — plugin-level export used by `holocron auth set axiom`
73
- * + `holocron auth check`. Hits `GET /v2/user` and translates the
74
- * response into the normalized `VerifyTokenResult` shape.
75
- *
76
- * Kept as a standalone function (not a capability method) so the auth
77
- * command can call it without initializing the full plugin.
78
- */
54
+ // src/verify-token.ts
79
55
  async function verifyToken(token, opts = {}) {
80
56
  const client = createAxiomClient({
81
57
  token,
@@ -83,7 +59,7 @@ async function verifyToken(token, opts = {}) {
83
59
  fetch: opts.fetch
84
60
  });
85
61
  try {
86
- const me = await client.getCurrentUser();
62
+ const me = await client.user.me();
87
63
  return {
88
64
  ok: true,
89
65
  subject: `user @ ${me.email ?? me.emails?.[0] ?? me.name ?? me.id ?? "unknown"}`
@@ -91,12 +67,11 @@ async function verifyToken(token, opts = {}) {
91
67
  } catch (err) {
92
68
  return {
93
69
  ok: false,
94
- message: err instanceof Error ? err.message : String(err)
70
+ message: errorMessage(err)
95
71
  };
96
72
  }
97
73
  }
98
- //#endregion
99
- //#region src/index.ts
74
+ // src/index.ts
100
75
  function createContext(options) {
101
76
  const env = options.env ?? process.env;
102
77
  const dataset = options.dataset ?? env.HOLOCRON_AXIOM_DATASET ?? env.AXIOM_DATASET;
@@ -120,6 +95,16 @@ function createPlugin(options) {
120
95
  const ctx = createContext(options);
121
96
  return {
122
97
  name: "@theholocron/holocron-plugin-axiom",
98
+ probes: { connection: connectionProbe({
99
+ provider: "Axiom",
100
+ url: options.baseUrl ?? "https://api.axiom.co",
101
+ fetch: options.fetch,
102
+ token: () => resolveToken(options),
103
+ verify: (token) => verifyToken(token, {
104
+ baseUrl: options.baseUrl,
105
+ fetch: options.fetch
106
+ })
107
+ }) },
123
108
  capabilities: { logs: () => logs(ctx) }
124
109
  };
125
110
  }
@@ -128,5 +113,4 @@ function createPlugin(options) {
128
113
  * supplied or when the supplied token is rejected.
129
114
  */
130
115
  const AUTH_HINT = "generate an Axiom API token at https://app.axiom.co/settings/api-tokens with dataset read + create permissions, then run: holocron auth set axiom <TOKEN>";
131
- //#endregion
132
116
  export { AUTH_HINT, AuthError, AxiomLogs, createAxiomClient, createContext, createPlugin, logs, resolveToken, verifyToken };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theholocron/holocron-plugin-axiom",
3
- "version": "5.0.0-alpha.27",
3
+ "version": "5.0.0-alpha.270",
4
4
  "description": "Holocron plugin for Axiom. Implements the logs capability against Axiom's REST API — dataset provisioning and connectivity checks, plus verifyToken + AUTH_HINT for `holocron auth`.",
5
5
  "keywords": [
6
6
  "axiom",
@@ -8,12 +8,12 @@
8
8
  "logs",
9
9
  "plugin"
10
10
  ],
11
- "homepage": "https://github.com/theholocron/holocron/tree/main/packages/holocron-plugin-axiom#readme",
11
+ "homepage": "https://docs.theholocron.dev/holocron/plugins/axiom/",
12
12
  "bugs": "https://github.com/theholocron/holocron/issues",
13
13
  "repository": {
14
14
  "type": "git",
15
15
  "url": "git+https://github.com/theholocron/holocron.git",
16
- "directory": "packages/holocron-plugin-axiom"
16
+ "directory": "plugins/holocron-plugin-axiom"
17
17
  },
18
18
  "license": "MIT",
19
19
  "author": "Newton Koumantzelis",
@@ -30,25 +30,29 @@
30
30
  "dist"
31
31
  ],
32
32
  "devDependencies": {
33
- "@theholocron/eslint-config": "^8.0.0",
34
- "@theholocron/http-client": "^1.23.0",
35
- "@theholocron/tsconfig": "^8.0.0",
36
- "@theholocron/tsdown-config": "^8.0.0",
37
- "@theholocron/vitest-config": "^8.0.0",
38
33
  "@types/node": "^26",
39
- "@vitest/coverage-v8": "^4.1.11",
34
+ "@vitest/coverage-v8": "^5.0.5",
40
35
  "@vitest/eslint-plugin": "^1.6.27",
41
36
  "eslint": "^10.8.1",
42
37
  "eslint-plugin-n": "^18.3.0",
43
38
  "globals": "^17.11.0",
44
- "tsdown": "^0.22.14",
45
- "tsx": "4.23.12",
39
+ "tsdown": "^0.23.3",
40
+ "tsx": "4.23.15",
46
41
  "typescript": "^5.9.3",
47
- "vitest": "^4.1.11",
48
- "@theholocron/cli": "5.0.0-alpha.27"
42
+ "vitest": "^5.0.5",
43
+ "@theholocron/axiom-client": "^1.58.0-alpha.2",
44
+ "@theholocron/eslint-config": "^8.9.0-alpha.3",
45
+ "@theholocron/http-client": "^1.58.0-alpha.2",
46
+ "@theholocron/cli": "5.0.0-alpha.270",
47
+ "@theholocron/misc-utils": "^1.16.1-alpha.1",
48
+ "@theholocron/vitest-config": "^8.9.0-alpha.3",
49
+ "@theholocron/tsdown-config": "^8.9.0-alpha.3",
50
+ "@theholocron/tsconfig": "^8.9.0-alpha.3"
49
51
  },
50
52
  "peerDependencies": {
51
- "@theholocron/cli": "5.0.0-alpha.27"
53
+ "@theholocron/axiom-client": "^1.43.1",
54
+ "@theholocron/misc-utils": "^1.16.0",
55
+ "@theholocron/cli": "5.0.0-alpha.270"
52
56
  },
53
57
  "engines": {
54
58
  "node": ">=22"
@@ -58,10 +62,10 @@
58
62
  },
59
63
  "scripts": {
60
64
  "delivery.build": "tsdown",
61
- "sourceQuality.staticAnalysis": "holocron run sourceQuality.staticAnalysis --",
65
+ "sourceQuality.staticAnalysis": "eslint .",
62
66
  "test:watch": "vitest",
63
67
  "validate": "tsx scripts/validate.mjs",
64
- "verification.typeSafety": "holocron run verification.typeSafety --",
65
- "verification.unitTests": "holocron run verification.unitTests --"
68
+ "verification.typeSafety": "tsc --noEmit",
69
+ "verification.unitTests": "vitest run"
66
70
  }
67
71
  }