@theholocron/holocron-plugin-axiom 5.0.0-alpha.385 → 5.0.0-alpha.387
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 +7 -5
- package/dist/index.d.mts +6 -1
- package/dist/index.mjs +30 -0
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -60,11 +60,13 @@ synced from 1Password. Leave the token unset locally to skip Axiom entirely.
|
|
|
60
60
|
|
|
61
61
|
## What's implemented
|
|
62
62
|
|
|
63
|
-
| Method | Behavior
|
|
64
|
-
| --------------- |
|
|
65
|
-
| `describe` | Returns `{ provider: "axiom", envKeys: ["HOLOCRON_AXIOM_TOKEN", "HOLOCRON_AXIOM_DATASET"] }`.
|
|
66
|
-
| `whoami` | `GET /v2/datasets/{dataset}` — verifies the token and the configured dataset's reachability.
|
|
67
|
-
| `ensureDataset` | `GET /v2/datasets/{name}`; on 404, `POST /v2/datasets`. Returns `{ alreadyExists }`. Idempotent.
|
|
63
|
+
| Method | Behavior |
|
|
64
|
+
| --------------- | ------------------------------------------------------------------------------------------------------------------------- |
|
|
65
|
+
| `describe` | Returns `{ provider: "axiom", envKeys: ["HOLOCRON_AXIOM_TOKEN", "HOLOCRON_AXIOM_DATASET"] }`. |
|
|
66
|
+
| `whoami` | `GET /v2/datasets/{dataset}` — verifies the token and the configured dataset's reachability. |
|
|
67
|
+
| `ensureDataset` | `GET /v2/datasets/{name}`; on 404, `POST /v2/datasets`. Returns `{ alreadyExists }`. Idempotent. |
|
|
68
|
+
| `readDataset` | `GET /v2/datasets/{name}`; a 404 is `{ exists: false }` and nothing is created. Returns `retentionDays` when Axiom does. |
|
|
69
|
+
| `checkToken` | `GET` of a dataset that cannot exist: a 404 means the token is accepted, a 401 means it is refused, anything else throws. |
|
|
68
70
|
|
|
69
71
|
Plugin-level exports (not capability methods, per the auth-bootstrap convention):
|
|
70
72
|
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AuthError, Logs, PluginToken, ResolveTokenInput, VerifyTokenFailure, VerifyTokenResult, VerifyTokenResult as VerifyTokenResult$1, VerifyTokenSuccess } from "@theholocron/cli";
|
|
1
|
+
import { AuthError, Logs, LogsDataset, 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
3
|
/** Resolves the Axiom token from `--token`, `HOLOCRON_AXIOM_TOKEN`, `AXIOM_TOKEN` or the keyring, and throws an `AuthError` when none is set. */
|
|
4
4
|
export declare const resolveToken: import("@theholocron/cli").TokenResolver;
|
|
@@ -34,6 +34,11 @@ export declare class AxiomLogs implements Logs {
|
|
|
34
34
|
ok: boolean;
|
|
35
35
|
dataset: string;
|
|
36
36
|
}>;
|
|
37
|
+
readDataset(name: string): Promise<LogsDataset>;
|
|
38
|
+
checkToken(): Promise<{
|
|
39
|
+
ok: boolean;
|
|
40
|
+
reason?: string;
|
|
41
|
+
}>;
|
|
37
42
|
ensureDataset(name: string): Promise<{
|
|
38
43
|
alreadyExists: boolean;
|
|
39
44
|
}>;
|
package/dist/index.mjs
CHANGED
|
@@ -13,6 +13,8 @@ const resolveToken = createResolveToken({
|
|
|
13
13
|
/** Every token this plugin takes, for `holocron doctor tokens`. */
|
|
14
14
|
const tokens = [resolveToken.token];
|
|
15
15
|
// src/capabilities/logs.ts
|
|
16
|
+
/** A dataset that does not exist: asking for it tells a token Axiom accepts (404) from one it refuses (401). */
|
|
17
|
+
const PROBE_DATASET$1 = "holocron-token-check";
|
|
16
18
|
/** The `logs` capability for Axiom: checks a dataset is reachable and creates datasets that are missing. */
|
|
17
19
|
var AxiomLogs = class {
|
|
18
20
|
client;
|
|
@@ -44,6 +46,34 @@ var AxiomLogs = class {
|
|
|
44
46
|
dataset
|
|
45
47
|
};
|
|
46
48
|
}
|
|
49
|
+
async readDataset(name) {
|
|
50
|
+
try {
|
|
51
|
+
const found = await this.client().datasets.get(name);
|
|
52
|
+
const days = found.useRetentionPeriod === false ? void 0 : found.retentionDays;
|
|
53
|
+
return {
|
|
54
|
+
exists: true,
|
|
55
|
+
...days === void 0 ? {} : { retentionDays: days }
|
|
56
|
+
};
|
|
57
|
+
} catch (err) {
|
|
58
|
+
if (err instanceof ProviderApiError && err.status === 404) return { exists: false };
|
|
59
|
+
throw err;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
async checkToken() {
|
|
63
|
+
try {
|
|
64
|
+
await this.client().datasets.get(PROBE_DATASET$1);
|
|
65
|
+
return { ok: true };
|
|
66
|
+
} catch (err) {
|
|
67
|
+
if (err instanceof ProviderApiError) {
|
|
68
|
+
if (err.status === 404) return { ok: true };
|
|
69
|
+
if (err.status === 401) return {
|
|
70
|
+
ok: false,
|
|
71
|
+
reason: "Axiom refused the token (401)"
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
throw err;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
47
77
|
async ensureDataset(name) {
|
|
48
78
|
try {
|
|
49
79
|
await this.client().datasets.get(name);
|
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.387",
|
|
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",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"dist"
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@theholocron/env-utils": "^1.17.0-alpha.
|
|
33
|
+
"@theholocron/env-utils": "^1.17.0-alpha.3"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@types/node": "^26",
|
|
@@ -43,19 +43,19 @@
|
|
|
43
43
|
"tsx": "4.23.15",
|
|
44
44
|
"typescript": "^5.9.3",
|
|
45
45
|
"vitest": "^5.1.0",
|
|
46
|
-
"@theholocron/axiom-client": "^1.58.0-alpha.
|
|
47
|
-
"@theholocron/cli": "5.0.0-alpha.
|
|
48
|
-
"@theholocron/
|
|
49
|
-
"@theholocron/
|
|
50
|
-
"@theholocron/
|
|
46
|
+
"@theholocron/axiom-client": "^1.58.0-alpha.24",
|
|
47
|
+
"@theholocron/cli": "5.0.0-alpha.387",
|
|
48
|
+
"@theholocron/http-client": "^1.58.0-alpha.24",
|
|
49
|
+
"@theholocron/eslint-config": "^8.9.0-alpha.13",
|
|
50
|
+
"@theholocron/misc-utils": "^1.17.0-alpha.3",
|
|
51
51
|
"@theholocron/tsdown-config": "^8.9.0-alpha.13",
|
|
52
52
|
"@theholocron/vitest-config": "^8.9.0-alpha.13",
|
|
53
|
-
"@theholocron/
|
|
53
|
+
"@theholocron/tsconfig": "^8.9.0-alpha.13"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
56
|
"@theholocron/axiom-client": "^1.43.1",
|
|
57
57
|
"@theholocron/misc-utils": "^1.16.0",
|
|
58
|
-
"@theholocron/cli": "5.0.0-alpha.
|
|
58
|
+
"@theholocron/cli": "5.0.0-alpha.387"
|
|
59
59
|
},
|
|
60
60
|
"engines": {
|
|
61
61
|
"node": ">=22"
|