@theholocron/holocron-plugin-axiom 5.0.0-alpha.13 → 5.0.0-alpha.132

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,38 +1,8 @@
1
- import { AuthError, Logs, ResolveTokenInput } from "@theholocron/cli";
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";
2
3
  //#region src/auth.d.ts
3
4
  declare const resolveToken: (input?: ResolveTokenInput) => string;
4
5
  //#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
6
  //#region src/capabilities/logs.d.ts
37
7
  interface AxiomLogsOptions {
38
8
  /**
@@ -51,7 +21,7 @@ declare class AxiomLogs implements Logs {
51
21
  * `client` is a thunk — the token is resolved on first call, so
52
22
  * `describe()` (which needs no auth) works without one.
53
23
  */
54
- constructor(client: () => AxiomRestClient, opts: AxiomLogsOptions);
24
+ constructor(client: () => AxiomClient, opts: AxiomLogsOptions);
55
25
  describe(): Promise<{
56
26
  provider: string;
57
27
  envKeys: string[];
@@ -66,28 +36,11 @@ declare class AxiomLogs implements Logs {
66
36
  }
67
37
  //#endregion
68
38
  //#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
39
  interface VerifyTokenOptions {
87
40
  baseUrl?: string;
88
41
  fetch?: typeof fetch;
89
42
  }
90
- declare function verifyToken(token: string, opts?: VerifyTokenOptions): Promise<VerifyTokenResult>;
43
+ declare function verifyToken(token: string, opts?: VerifyTokenOptions): Promise<VerifyTokenResult$1>;
91
44
  //#endregion
92
45
  //#region src/index.d.ts
93
46
  interface AxiomPluginOptions extends ResolveTokenInput, AxiomLogsOptions {
@@ -106,7 +59,7 @@ interface PluginContext {
106
59
  * no auth (`describe`) works without a token, and the loader never
107
60
  * aborts on a plugin whose token happens to be absent.
108
61
  */
109
- client: () => AxiomRestClient;
62
+ client: () => AxiomClient;
110
63
  }
111
64
  declare function createContext(options: AxiomPluginOptions): PluginContext;
112
65
  declare function logs(ctx: PluginContext): Logs;
@@ -122,4 +75,4 @@ declare function createPlugin(options: AxiomPluginOptions): {
122
75
  */
123
76
  declare const AUTH_HINT: string;
124
77
  //#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 };
78
+ export { AUTH_HINT, AuthError, type AxiomClient, type AxiomClientOptions, type AxiomDataset, AxiomLogs, type AxiomLogsOptions, AxiomPluginOptions, type AxiomUser, type CreateAxiomDatasetInput, PluginContext, type ResolveTokenInput, type VerifyTokenFailure, type VerifyTokenResult, type VerifyTokenSuccess, createAxiomClient, createContext, createPlugin, logs, resolveToken, verifyToken };
package/dist/index.mjs CHANGED
@@ -1,4 +1,6 @@
1
- import { AuthError, ProviderApiError, createResolveToken, createRestClient } from "@theholocron/cli";
1
+ import { AuthError, ProviderApiError, createResolveToken } from "@theholocron/cli";
2
+ import { createAxiomClient } from "@theholocron/axiom-client";
3
+ import { errorMessage } from "@theholocron/misc-utils";
2
4
  //#region src/auth.ts
3
5
  const resolveToken = createResolveToken({
4
6
  envName: "HOLOCRON_AXIOM_TOKEN",
@@ -30,7 +32,7 @@ var AxiomLogs = class {
30
32
  async whoami() {
31
33
  const dataset = this.opts.dataset;
32
34
  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);
35
+ await this.client().datasets.get(dataset);
34
36
  return {
35
37
  ok: true,
36
38
  dataset
@@ -38,44 +40,20 @@ var AxiomLogs = class {
38
40
  }
39
41
  async ensureDataset(name) {
40
42
  try {
41
- await this.client().getDataset(name);
43
+ await this.client().datasets.get(name);
42
44
  return { alreadyExists: true };
43
45
  } catch (err) {
44
46
  if (!(err instanceof ProviderApiError) || err.status !== 404) throw err;
45
47
  }
46
- await this.client().createDataset({
48
+ await this.client().datasets.create({
47
49
  name,
48
50
  description: "Managed by holocron"
49
51
  });
50
52
  return { alreadyExists: false };
51
53
  }
52
54
  };
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
55
  //#endregion
70
56
  //#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
- */
79
57
  async function verifyToken(token, opts = {}) {
80
58
  const client = createAxiomClient({
81
59
  token,
@@ -83,7 +61,7 @@ async function verifyToken(token, opts = {}) {
83
61
  fetch: opts.fetch
84
62
  });
85
63
  try {
86
- const me = await client.getCurrentUser();
64
+ const me = await client.user.me();
87
65
  return {
88
66
  ok: true,
89
67
  subject: `user @ ${me.email ?? me.emails?.[0] ?? me.name ?? me.id ?? "unknown"}`
@@ -91,7 +69,7 @@ async function verifyToken(token, opts = {}) {
91
69
  } catch (err) {
92
70
  return {
93
71
  ok: false,
94
- message: err instanceof Error ? err.message : String(err)
72
+ message: errorMessage(err)
95
73
  };
96
74
  }
97
75
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theholocron/holocron-plugin-axiom",
3
- "version": "5.0.0-alpha.13",
3
+ "version": "5.0.0-alpha.132",
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://github.com/theholocron/holocron/tree/main/plugins/holocron-plugin-axiom#readme",
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,10 +30,13 @@
30
30
  "dist"
31
31
  ],
32
32
  "devDependencies": {
33
- "@theholocron/eslint-config": "^8.0.0",
34
- "@theholocron/tsconfig": "^8.0.0",
35
- "@theholocron/tsdown-config": "^8.0.0",
36
- "@theholocron/vitest-config": "^8.0.0",
33
+ "@theholocron/axiom-client": "^1.40.0",
34
+ "@theholocron/eslint-config": "^8.7.1",
35
+ "@theholocron/http-client": "^1.40.0",
36
+ "@theholocron/misc-utils": "^1.9.2",
37
+ "@theholocron/tsconfig": "^8.7.1",
38
+ "@theholocron/tsdown-config": "^8.7.1",
39
+ "@theholocron/vitest-config": "^8.7.0",
37
40
  "@types/node": "^26",
38
41
  "@vitest/coverage-v8": "^4.1.11",
39
42
  "@vitest/eslint-plugin": "^1.6.27",
@@ -44,10 +47,12 @@
44
47
  "tsx": "4.23.12",
45
48
  "typescript": "^5.9.3",
46
49
  "vitest": "^4.1.11",
47
- "@theholocron/cli": "5.0.0-alpha.13"
50
+ "@theholocron/cli": "5.0.0-alpha.134"
48
51
  },
49
52
  "peerDependencies": {
50
- "@theholocron/cli": "5.0.0-alpha.13"
53
+ "@theholocron/axiom-client": "^1.40.0",
54
+ "@theholocron/misc-utils": "^1.9.2",
55
+ "@theholocron/cli": "5.0.0-alpha.134"
51
56
  },
52
57
  "engines": {
53
58
  "node": ">=22"