@theholocron/holocron-plugin-axiom 5.0.0-alpha.565 → 5.0.0-alpha.567
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 +2 -1
- package/dist/index.mjs +34 -1
- package/package.json +5 -5
package/dist/index.d.mts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* exports `verifyToken` + `AUTH_HINT` for `holocron check token`. See README
|
|
6
6
|
* for auth + config docs.
|
|
7
7
|
*/
|
|
8
|
-
import { AuthError, Logs, LogsDataset, MintTokenInput, PluginToken, ResolveTokenInput, VerifyTokenFailure, VerifyTokenResult, VerifyTokenResult as VerifyTokenResult$1, VerifyTokenSuccess } from "@theholocron/cli";
|
|
8
|
+
import { AuthError, Logs, LogsDataset, MintTokenInput, PluginToken, ResolveTokenInput, RevokeTokenInput, VerifyTokenFailure, VerifyTokenResult, VerifyTokenResult as VerifyTokenResult$1, VerifyTokenSuccess } from "@theholocron/cli";
|
|
9
9
|
import { AxiomClient, AxiomClientOptions, AxiomDataset, AxiomUser, CreateAxiomDatasetInput, createAxiomClient } from "@theholocron/axiom-client";
|
|
10
10
|
/** Resolves the Axiom token from `--token`, `HOLOCRON_AXIOM_TOKEN`, `AXIOM_TOKEN` or the keyring, and throws an `AuthError` when none is set. */
|
|
11
11
|
export declare const resolveToken: import("@theholocron/cli").TokenResolver;
|
|
@@ -106,6 +106,7 @@ export declare function createPlugin(options: AxiomPluginOptions): {
|
|
|
106
106
|
};
|
|
107
107
|
whoami: import("@theholocron/cli").ProviderAction;
|
|
108
108
|
mintToken: (input: MintTokenInput) => Promise<import("@theholocron/cli").MintTokenResult>;
|
|
109
|
+
revokeToken: (input: RevokeTokenInput) => Promise<import("@theholocron/cli").RevokeTokenResult>;
|
|
109
110
|
capabilities: {
|
|
110
111
|
logs: () => Logs;
|
|
111
112
|
};
|
package/dist/index.mjs
CHANGED
|
@@ -29,7 +29,8 @@ const EXPECTED = { permissions: {
|
|
|
29
29
|
local: RULES,
|
|
30
30
|
dev: RULES,
|
|
31
31
|
ci: RULES,
|
|
32
|
-
prod: RULES
|
|
32
|
+
prod: RULES,
|
|
33
|
+
agent: RULES
|
|
33
34
|
} };
|
|
34
35
|
/**
|
|
35
36
|
* Where the personal access token that makes API tokens (`HOLOCRON_AXIOM_PERSONAL_TOKEN`) is held: a maintainer's own
|
|
@@ -459,6 +460,33 @@ function tokenProbe(ctx) {
|
|
|
459
460
|
}
|
|
460
461
|
};
|
|
461
462
|
}
|
|
463
|
+
// src/revoke-token.ts
|
|
464
|
+
/**
|
|
465
|
+
* Deletes an Axiom API token through `DELETE /v2/tokens/{id}`. Like minting it needs a personal access token
|
|
466
|
+
* (`HOLOCRON_AXIOM_PERSONAL_TOKEN`) and the organization id (`HOLOCRON_AXIOM_ORG`) and refuses, before any call, when
|
|
467
|
+
* either is missing. The call is made with the personal token, which is never an API token the plugin minted, so no
|
|
468
|
+
* id can be the token in use. A token Axiom does not have (404) is `revoked: false`; any other refusal throws.
|
|
469
|
+
*/
|
|
470
|
+
async function revokeAxiomToken(input, options) {
|
|
471
|
+
const orgId = resolveValue(["AXIOM_ORG"], options.env, { prefix: PREFIX });
|
|
472
|
+
if (!orgId) throw new Error("an Axiom organization id is required to revoke a token: set HOLOCRON_AXIOM_ORG (the `axiom-abcd` of your console URL)");
|
|
473
|
+
const personal = resolvePersonalToken({ env: options.env });
|
|
474
|
+
return await createAxiomClient({
|
|
475
|
+
token: personal,
|
|
476
|
+
orgId,
|
|
477
|
+
baseUrl: options.baseUrl,
|
|
478
|
+
fetch: options.fetch
|
|
479
|
+
}).tokens.delete(input.id).then(() => true, (err) => {
|
|
480
|
+
if (err instanceof ProviderApiError && err.status === 404) return false;
|
|
481
|
+
throw err;
|
|
482
|
+
}) ? {
|
|
483
|
+
revoked: true,
|
|
484
|
+
notes: ["anything that still ingests or queries with this token stops working: replace it where it is used (`holocron sync secrets`)"]
|
|
485
|
+
} : {
|
|
486
|
+
revoked: false,
|
|
487
|
+
notes: [`Axiom has no token \`${input.id}\` (already deleted or expired)`]
|
|
488
|
+
};
|
|
489
|
+
}
|
|
462
490
|
// src/index.ts
|
|
463
491
|
/** Creates the shared context for the given options; no token is resolved until `client()` is first called. */
|
|
464
492
|
function createContext(options) {
|
|
@@ -520,6 +548,11 @@ function createPlugin(options) {
|
|
|
520
548
|
baseUrl: options.baseUrl,
|
|
521
549
|
fetch: options.fetch
|
|
522
550
|
}),
|
|
551
|
+
revokeToken: (input) => revokeAxiomToken(input, {
|
|
552
|
+
env: options.env,
|
|
553
|
+
baseUrl: options.baseUrl,
|
|
554
|
+
fetch: options.fetch
|
|
555
|
+
}),
|
|
523
556
|
capabilities: { logs: () => logs(ctx) }
|
|
524
557
|
};
|
|
525
558
|
}
|
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.567",
|
|
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",
|
|
@@ -43,10 +43,10 @@
|
|
|
43
43
|
"tsx": "4.23.15",
|
|
44
44
|
"typescript": "^6.0.3",
|
|
45
45
|
"vitest": "^5.1.1",
|
|
46
|
-
"@theholocron/
|
|
47
|
-
"@theholocron/
|
|
46
|
+
"@theholocron/axiom-client": "^1.58.0-alpha.65",
|
|
47
|
+
"@theholocron/cli": "5.0.0-alpha.567",
|
|
48
48
|
"@theholocron/eslint-config": "^8.9.0-alpha.24",
|
|
49
|
-
"@theholocron/http-client": "^1.58.0-alpha.
|
|
49
|
+
"@theholocron/http-client": "^1.58.0-alpha.65",
|
|
50
50
|
"@theholocron/misc-utils": "^1.17.0-alpha.8",
|
|
51
51
|
"@theholocron/tsconfig": "^8.9.0-alpha.24",
|
|
52
52
|
"@theholocron/tsdown-config": "^8.9.0-alpha.24",
|
|
@@ -55,7 +55,7 @@
|
|
|
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.567"
|
|
59
59
|
},
|
|
60
60
|
"engines": {
|
|
61
61
|
"node": ">=22"
|