@theholocron/holocron-plugin-axiom 5.0.0-alpha.27 → 5.0.0-alpha.271
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 +2 -2
- package/dist/index.d.mts +19 -69
- package/dist/index.mjs +25 -39
- package/package.json +21 -17
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,8 @@
|
|
|
1
|
-
import { AuthError, Logs, ResolveTokenInput } from "@theholocron/cli";
|
|
2
|
-
|
|
3
|
-
declare const resolveToken: (
|
|
4
|
-
|
|
5
|
-
|
|
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, PluginToken, 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: import("@theholocron/cli").TokenResolver;
|
|
4
|
+
/** Every token this plugin takes, for `holocron doctor tokens`. */
|
|
5
|
+
export declare const tokens: PluginToken[];
|
|
37
6
|
interface AxiomLogsOptions {
|
|
38
7
|
/**
|
|
39
8
|
* Target dataset, resolved from `HOLOCRON_AXIOM_DATASET` /
|
|
@@ -42,7 +11,7 @@ interface AxiomLogsOptions {
|
|
|
42
11
|
*/
|
|
43
12
|
dataset?: string;
|
|
44
13
|
}
|
|
45
|
-
declare class AxiomLogs implements Logs {
|
|
14
|
+
export declare class AxiomLogs implements Logs {
|
|
46
15
|
private readonly client;
|
|
47
16
|
private readonly opts;
|
|
48
17
|
readonly key: "logs";
|
|
@@ -51,7 +20,7 @@ declare class AxiomLogs implements Logs {
|
|
|
51
20
|
* `client` is a thunk — the token is resolved on first call, so
|
|
52
21
|
* `describe()` (which needs no auth) works without one.
|
|
53
22
|
*/
|
|
54
|
-
constructor(client: () =>
|
|
23
|
+
constructor(client: () => AxiomClient, opts: AxiomLogsOptions);
|
|
55
24
|
describe(): Promise<{
|
|
56
25
|
provider: string;
|
|
57
26
|
envKeys: string[];
|
|
@@ -64,39 +33,18 @@ declare class AxiomLogs implements Logs {
|
|
|
64
33
|
alreadyExists: boolean;
|
|
65
34
|
}>;
|
|
66
35
|
}
|
|
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
36
|
interface VerifyTokenOptions {
|
|
87
37
|
baseUrl?: string;
|
|
88
38
|
fetch?: typeof fetch;
|
|
89
39
|
}
|
|
90
|
-
declare function verifyToken(token: string, opts?: VerifyTokenOptions): Promise<VerifyTokenResult>;
|
|
91
|
-
|
|
92
|
-
//#region src/index.d.ts
|
|
93
|
-
interface AxiomPluginOptions extends ResolveTokenInput, AxiomLogsOptions {
|
|
40
|
+
export declare function verifyToken(token: string, opts?: VerifyTokenOptions): Promise<VerifyTokenResult$1>;
|
|
41
|
+
export interface AxiomPluginOptions extends ResolveTokenInput, AxiomLogsOptions {
|
|
94
42
|
/** Override base URL for tests. */
|
|
95
43
|
baseUrl?: string;
|
|
96
44
|
/** Override `fetch` for tests. */
|
|
97
45
|
fetch?: typeof fetch;
|
|
98
46
|
}
|
|
99
|
-
interface PluginContext {
|
|
47
|
+
export interface PluginContext {
|
|
100
48
|
options: AxiomPluginOptions & {
|
|
101
49
|
dataset?: string;
|
|
102
50
|
};
|
|
@@ -106,12 +54,15 @@ interface PluginContext {
|
|
|
106
54
|
* no auth (`describe`) works without a token, and the loader never
|
|
107
55
|
* aborts on a plugin whose token happens to be absent.
|
|
108
56
|
*/
|
|
109
|
-
client: () =>
|
|
57
|
+
client: () => AxiomClient;
|
|
110
58
|
}
|
|
111
|
-
declare function createContext(options: AxiomPluginOptions): PluginContext;
|
|
112
|
-
declare function logs(ctx: PluginContext): Logs;
|
|
113
|
-
declare function createPlugin(options: AxiomPluginOptions): {
|
|
59
|
+
export declare function createContext(options: AxiomPluginOptions): PluginContext;
|
|
60
|
+
export declare function logs(ctx: PluginContext): Logs;
|
|
61
|
+
export declare function createPlugin(options: AxiomPluginOptions): {
|
|
114
62
|
name: string;
|
|
63
|
+
probes: {
|
|
64
|
+
connection: import("@theholocron/cli").Probe;
|
|
65
|
+
};
|
|
115
66
|
capabilities: {
|
|
116
67
|
logs: () => Logs;
|
|
117
68
|
};
|
|
@@ -120,6 +71,5 @@ declare function createPlugin(options: AxiomPluginOptions): {
|
|
|
120
71
|
* One-line hint shown by `holocron auth set axiom` when no token is
|
|
121
72
|
* supplied or when the supplied token is rejected.
|
|
122
73
|
*/
|
|
123
|
-
declare const AUTH_HINT: string;
|
|
124
|
-
|
|
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 };
|
|
74
|
+
export declare const AUTH_HINT: string;
|
|
75
|
+
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,16 @@
|
|
|
1
|
-
import { AuthError, ProviderApiError,
|
|
2
|
-
|
|
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
|
-
|
|
10
|
-
|
|
11
|
+
/** Every token this plugin takes, for `holocron doctor tokens`. */
|
|
12
|
+
const tokens = [resolveToken.token];
|
|
13
|
+
// src/capabilities/logs.ts
|
|
11
14
|
var AxiomLogs = class {
|
|
12
15
|
client;
|
|
13
16
|
opts;
|
|
@@ -30,7 +33,7 @@ var AxiomLogs = class {
|
|
|
30
33
|
async whoami() {
|
|
31
34
|
const dataset = this.opts.dataset;
|
|
32
35
|
if (!dataset) throw new Error("@theholocron/holocron-plugin-axiom needs a dataset (HOLOCRON_AXIOM_DATASET / AXIOM_DATASET) for whoami");
|
|
33
|
-
await this.client().
|
|
36
|
+
await this.client().datasets.get(dataset);
|
|
34
37
|
return {
|
|
35
38
|
ok: true,
|
|
36
39
|
dataset
|
|
@@ -38,44 +41,19 @@ var AxiomLogs = class {
|
|
|
38
41
|
}
|
|
39
42
|
async ensureDataset(name) {
|
|
40
43
|
try {
|
|
41
|
-
await this.client().
|
|
44
|
+
await this.client().datasets.get(name);
|
|
42
45
|
return { alreadyExists: true };
|
|
43
46
|
} catch (err) {
|
|
44
47
|
if (!(err instanceof ProviderApiError) || err.status !== 404) throw err;
|
|
45
48
|
}
|
|
46
|
-
await this.client().
|
|
49
|
+
await this.client().datasets.create({
|
|
47
50
|
name,
|
|
48
51
|
description: "Managed by holocron"
|
|
49
52
|
});
|
|
50
53
|
return { alreadyExists: false };
|
|
51
54
|
}
|
|
52
55
|
};
|
|
53
|
-
|
|
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
|
-
*/
|
|
56
|
+
// src/verify-token.ts
|
|
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.
|
|
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,12 +69,11 @@ async function verifyToken(token, opts = {}) {
|
|
|
91
69
|
} catch (err) {
|
|
92
70
|
return {
|
|
93
71
|
ok: false,
|
|
94
|
-
message:
|
|
72
|
+
message: errorMessage(err)
|
|
95
73
|
};
|
|
96
74
|
}
|
|
97
75
|
}
|
|
98
|
-
|
|
99
|
-
//#region src/index.ts
|
|
76
|
+
// src/index.ts
|
|
100
77
|
function createContext(options) {
|
|
101
78
|
const env = options.env ?? process.env;
|
|
102
79
|
const dataset = options.dataset ?? env.HOLOCRON_AXIOM_DATASET ?? env.AXIOM_DATASET;
|
|
@@ -120,6 +97,16 @@ function createPlugin(options) {
|
|
|
120
97
|
const ctx = createContext(options);
|
|
121
98
|
return {
|
|
122
99
|
name: "@theholocron/holocron-plugin-axiom",
|
|
100
|
+
probes: { connection: connectionProbe({
|
|
101
|
+
provider: "Axiom",
|
|
102
|
+
url: options.baseUrl ?? "https://api.axiom.co",
|
|
103
|
+
fetch: options.fetch,
|
|
104
|
+
token: () => resolveToken(options),
|
|
105
|
+
verify: (token) => verifyToken(token, {
|
|
106
|
+
baseUrl: options.baseUrl,
|
|
107
|
+
fetch: options.fetch
|
|
108
|
+
})
|
|
109
|
+
}) },
|
|
123
110
|
capabilities: { logs: () => logs(ctx) }
|
|
124
111
|
};
|
|
125
112
|
}
|
|
@@ -128,5 +115,4 @@ function createPlugin(options) {
|
|
|
128
115
|
* supplied or when the supplied token is rejected.
|
|
129
116
|
*/
|
|
130
117
|
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
|
-
|
|
132
|
-
export { AUTH_HINT, AuthError, AxiomLogs, createAxiomClient, createContext, createPlugin, logs, resolveToken, verifyToken };
|
|
118
|
+
export { AUTH_HINT, AuthError, AxiomLogs, createAxiomClient, createContext, createPlugin, logs, resolveToken, tokens, verifyToken };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theholocron/holocron-plugin-axiom",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
3
|
+
"version": "5.0.0-alpha.271",
|
|
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://
|
|
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": "
|
|
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": "^
|
|
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.
|
|
45
|
-
"tsx": "4.23.
|
|
39
|
+
"tsdown": "^0.23.3",
|
|
40
|
+
"tsx": "4.23.15",
|
|
46
41
|
"typescript": "^5.9.3",
|
|
47
|
-
"vitest": "^
|
|
48
|
-
"@theholocron/
|
|
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/misc-utils": "^1.16.1-alpha.1",
|
|
47
|
+
"@theholocron/vitest-config": "^8.9.0-alpha.3",
|
|
48
|
+
"@theholocron/tsconfig": "^8.9.0-alpha.3",
|
|
49
|
+
"@theholocron/tsdown-config": "^8.9.0-alpha.3",
|
|
50
|
+
"@theholocron/cli": "5.0.0-alpha.271"
|
|
49
51
|
},
|
|
50
52
|
"peerDependencies": {
|
|
51
|
-
"@theholocron/
|
|
53
|
+
"@theholocron/axiom-client": "^1.43.1",
|
|
54
|
+
"@theholocron/misc-utils": "^1.16.0",
|
|
55
|
+
"@theholocron/cli": "5.0.0-alpha.271"
|
|
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": "
|
|
65
|
+
"sourceQuality.staticAnalysis": "eslint .",
|
|
62
66
|
"test:watch": "vitest",
|
|
63
67
|
"validate": "tsx scripts/validate.mjs",
|
|
64
|
-
"verification.typeSafety": "
|
|
65
|
-
"verification.unitTests": "
|
|
68
|
+
"verification.typeSafety": "tsc --noEmit",
|
|
69
|
+
"verification.unitTests": "vitest run"
|
|
66
70
|
}
|
|
67
71
|
}
|