@theholocron/holocron-plugin-axiom 5.0.0-alpha.278 → 5.0.0-alpha.279
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 +12 -0
- package/dist/index.mjs +8 -0
- package/package.json +7 -7
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { AuthError, Logs, PluginToken, ResolveTokenInput, VerifyTokenFailure, VerifyTokenResult, VerifyTokenResult as VerifyTokenResult$1, VerifyTokenSuccess } from "@theholocron/cli";
|
|
2
2
|
import { AxiomClient, AxiomClientOptions, AxiomDataset, AxiomUser, CreateAxiomDatasetInput, createAxiomClient } from "@theholocron/axiom-client";
|
|
3
|
+
/** Resolves the Axiom token from `--token`, `HOLOCRON_AXIOM_TOKEN`, `AXIOM_TOKEN` or the keyring, and throws an `AuthError` when none is set. */
|
|
3
4
|
export declare const resolveToken: import("@theholocron/cli").TokenResolver;
|
|
4
5
|
/** Every token this plugin takes, for `holocron doctor tokens`. */
|
|
5
6
|
export declare const tokens: PluginToken[];
|
|
7
|
+
/** Options for the Axiom `logs` capability. */
|
|
6
8
|
interface AxiomLogsOptions {
|
|
7
9
|
/**
|
|
8
10
|
* Target dataset, resolved from `HOLOCRON_AXIOM_DATASET` /
|
|
@@ -11,10 +13,13 @@ interface AxiomLogsOptions {
|
|
|
11
13
|
*/
|
|
12
14
|
dataset?: string;
|
|
13
15
|
}
|
|
16
|
+
/** The `logs` capability for Axiom: checks a dataset is reachable and creates datasets that are missing. */
|
|
14
17
|
export declare class AxiomLogs implements Logs {
|
|
15
18
|
private readonly client;
|
|
16
19
|
private readonly opts;
|
|
20
|
+
/** The capability key, always `logs`. */
|
|
17
21
|
readonly key: "logs";
|
|
22
|
+
/** The provider name, `axiom`. */
|
|
18
23
|
readonly providerName = "axiom";
|
|
19
24
|
/**
|
|
20
25
|
* `client` is a thunk — the token is resolved on first call, so
|
|
@@ -37,14 +42,18 @@ interface VerifyTokenOptions {
|
|
|
37
42
|
baseUrl?: string;
|
|
38
43
|
fetch?: typeof fetch;
|
|
39
44
|
}
|
|
45
|
+
/** Checks an Axiom token by fetching the current user; the success subject is `user @` followed by the email, name or id, the failure carries the error message. */
|
|
40
46
|
export declare function verifyToken(token: string, opts?: VerifyTokenOptions): Promise<VerifyTokenResult$1>;
|
|
47
|
+
/** Options for the Axiom plugin: token resolution, the target dataset and test overrides. */
|
|
41
48
|
export interface AxiomPluginOptions extends ResolveTokenInput, AxiomLogsOptions {
|
|
42
49
|
/** Override base URL for tests. */
|
|
43
50
|
baseUrl?: string;
|
|
44
51
|
/** Override `fetch` for tests. */
|
|
45
52
|
fetch?: typeof fetch;
|
|
46
53
|
}
|
|
54
|
+
/** What the plugin's capabilities share: the resolved options and a lazily built client. */
|
|
47
55
|
export interface PluginContext {
|
|
56
|
+
/** The options, with `dataset` resolved from config, `HOLOCRON_AXIOM_DATASET` or `AXIOM_DATASET` (in that order). */
|
|
48
57
|
options: AxiomPluginOptions & {
|
|
49
58
|
dataset?: string;
|
|
50
59
|
};
|
|
@@ -56,8 +65,11 @@ export interface PluginContext {
|
|
|
56
65
|
*/
|
|
57
66
|
client: () => AxiomClient;
|
|
58
67
|
}
|
|
68
|
+
/** Creates the shared context for the given options; no token is resolved until `client()` is first called. */
|
|
59
69
|
export declare function createContext(options: AxiomPluginOptions): PluginContext;
|
|
70
|
+
/** Builds the `logs` capability from a plugin context. */
|
|
60
71
|
export declare function logs(ctx: PluginContext): Logs;
|
|
72
|
+
/** Creates the Axiom plugin: a `connection` probe and the `logs` capability. */
|
|
61
73
|
export declare function createPlugin(options: AxiomPluginOptions): {
|
|
62
74
|
name: string;
|
|
63
75
|
probes: {
|
package/dist/index.mjs
CHANGED
|
@@ -2,6 +2,7 @@ import { AuthError, ProviderApiError, connectionProbe, createResolveToken } from
|
|
|
2
2
|
import { createAxiomClient } from "@theholocron/axiom-client";
|
|
3
3
|
import { errorMessage } from "@theholocron/misc-utils";
|
|
4
4
|
// src/auth.ts
|
|
5
|
+
/** Resolves the Axiom token from `--token`, `HOLOCRON_AXIOM_TOKEN`, `AXIOM_TOKEN` or the keyring, and throws an `AuthError` when none is set. */
|
|
5
6
|
const resolveToken = createResolveToken({
|
|
6
7
|
envName: "HOLOCRON_AXIOM_TOKEN",
|
|
7
8
|
vendorEnvName: "AXIOM_TOKEN",
|
|
@@ -11,10 +12,13 @@ const resolveToken = createResolveToken({
|
|
|
11
12
|
/** Every token this plugin takes, for `holocron doctor tokens`. */
|
|
12
13
|
const tokens = [resolveToken.token];
|
|
13
14
|
// src/capabilities/logs.ts
|
|
15
|
+
/** The `logs` capability for Axiom: checks a dataset is reachable and creates datasets that are missing. */
|
|
14
16
|
var AxiomLogs = class {
|
|
15
17
|
client;
|
|
16
18
|
opts;
|
|
19
|
+
/** The capability key, always `logs`. */
|
|
17
20
|
key = "logs";
|
|
21
|
+
/** The provider name, `axiom`. */
|
|
18
22
|
providerName = "axiom";
|
|
19
23
|
/**
|
|
20
24
|
* `client` is a thunk — the token is resolved on first call, so
|
|
@@ -54,6 +58,7 @@ var AxiomLogs = class {
|
|
|
54
58
|
}
|
|
55
59
|
};
|
|
56
60
|
// src/verify-token.ts
|
|
61
|
+
/** Checks an Axiom token by fetching the current user; the success subject is `user @` followed by the email, name or id, the failure carries the error message. */
|
|
57
62
|
async function verifyToken(token, opts = {}) {
|
|
58
63
|
const client = createAxiomClient({
|
|
59
64
|
token,
|
|
@@ -74,6 +79,7 @@ async function verifyToken(token, opts = {}) {
|
|
|
74
79
|
}
|
|
75
80
|
}
|
|
76
81
|
// src/index.ts
|
|
82
|
+
/** Creates the shared context for the given options; no token is resolved until `client()` is first called. */
|
|
77
83
|
function createContext(options) {
|
|
78
84
|
const env = options.env ?? process.env;
|
|
79
85
|
const dataset = options.dataset ?? env.HOLOCRON_AXIOM_DATASET ?? env.AXIOM_DATASET;
|
|
@@ -90,9 +96,11 @@ function createContext(options) {
|
|
|
90
96
|
})
|
|
91
97
|
};
|
|
92
98
|
}
|
|
99
|
+
/** Builds the `logs` capability from a plugin context. */
|
|
93
100
|
function logs(ctx) {
|
|
94
101
|
return new AxiomLogs(ctx.client, { dataset: ctx.options.dataset });
|
|
95
102
|
}
|
|
103
|
+
/** Creates the Axiom plugin: a `connection` probe and the `logs` capability. */
|
|
96
104
|
function createPlugin(options) {
|
|
97
105
|
const ctx = createContext(options);
|
|
98
106
|
return {
|
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.279",
|
|
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",
|
|
@@ -40,19 +40,19 @@
|
|
|
40
40
|
"tsx": "4.23.15",
|
|
41
41
|
"typescript": "^5.9.3",
|
|
42
42
|
"vitest": "^5.0.5",
|
|
43
|
-
"@theholocron/cli": "5.0.0-alpha.
|
|
44
|
-
"@theholocron/
|
|
43
|
+
"@theholocron/cli": "5.0.0-alpha.279",
|
|
44
|
+
"@theholocron/misc-utils": "^1.16.1-alpha.3",
|
|
45
45
|
"@theholocron/tsconfig": "^8.9.0-alpha.4",
|
|
46
|
-
"@theholocron/
|
|
46
|
+
"@theholocron/eslint-config": "^8.9.0-alpha.4",
|
|
47
|
+
"@theholocron/axiom-client": "^1.58.0-alpha.3",
|
|
47
48
|
"@theholocron/vitest-config": "^8.9.0-alpha.4",
|
|
48
49
|
"@theholocron/tsdown-config": "^8.9.0-alpha.4",
|
|
49
|
-
"@theholocron/
|
|
50
|
-
"@theholocron/misc-utils": "^1.16.1-alpha.3"
|
|
50
|
+
"@theholocron/http-client": "^1.58.0-alpha.3"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
53
|
"@theholocron/axiom-client": "^1.43.1",
|
|
54
54
|
"@theholocron/misc-utils": "^1.16.0",
|
|
55
|
-
"@theholocron/cli": "5.0.0-alpha.
|
|
55
|
+
"@theholocron/cli": "5.0.0-alpha.279"
|
|
56
56
|
},
|
|
57
57
|
"engines": {
|
|
58
58
|
"node": ">=22"
|