@theholocron/holocron-plugin-axiom 5.0.0-alpha.565 → 5.0.0-alpha.566
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 +32 -0
- 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
|
@@ -459,6 +459,33 @@ function tokenProbe(ctx) {
|
|
|
459
459
|
}
|
|
460
460
|
};
|
|
461
461
|
}
|
|
462
|
+
// src/revoke-token.ts
|
|
463
|
+
/**
|
|
464
|
+
* Deletes an Axiom API token through `DELETE /v2/tokens/{id}`. Like minting it needs a personal access token
|
|
465
|
+
* (`HOLOCRON_AXIOM_PERSONAL_TOKEN`) and the organization id (`HOLOCRON_AXIOM_ORG`) and refuses, before any call, when
|
|
466
|
+
* either is missing. The call is made with the personal token, which is never an API token the plugin minted, so no
|
|
467
|
+
* id can be the token in use. A token Axiom does not have (404) is `revoked: false`; any other refusal throws.
|
|
468
|
+
*/
|
|
469
|
+
async function revokeAxiomToken(input, options) {
|
|
470
|
+
const orgId = resolveValue(["AXIOM_ORG"], options.env, { prefix: PREFIX });
|
|
471
|
+
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)");
|
|
472
|
+
const personal = resolvePersonalToken({ env: options.env });
|
|
473
|
+
return await createAxiomClient({
|
|
474
|
+
token: personal,
|
|
475
|
+
orgId,
|
|
476
|
+
baseUrl: options.baseUrl,
|
|
477
|
+
fetch: options.fetch
|
|
478
|
+
}).tokens.delete(input.id).then(() => true, (err) => {
|
|
479
|
+
if (err instanceof ProviderApiError && err.status === 404) return false;
|
|
480
|
+
throw err;
|
|
481
|
+
}) ? {
|
|
482
|
+
revoked: true,
|
|
483
|
+
notes: ["anything that still ingests or queries with this token stops working: replace it where it is used (`holocron sync secrets`)"]
|
|
484
|
+
} : {
|
|
485
|
+
revoked: false,
|
|
486
|
+
notes: [`Axiom has no token \`${input.id}\` (already deleted or expired)`]
|
|
487
|
+
};
|
|
488
|
+
}
|
|
462
489
|
// src/index.ts
|
|
463
490
|
/** Creates the shared context for the given options; no token is resolved until `client()` is first called. */
|
|
464
491
|
function createContext(options) {
|
|
@@ -520,6 +547,11 @@ function createPlugin(options) {
|
|
|
520
547
|
baseUrl: options.baseUrl,
|
|
521
548
|
fetch: options.fetch
|
|
522
549
|
}),
|
|
550
|
+
revokeToken: (input) => revokeAxiomToken(input, {
|
|
551
|
+
env: options.env,
|
|
552
|
+
baseUrl: options.baseUrl,
|
|
553
|
+
fetch: options.fetch
|
|
554
|
+
}),
|
|
523
555
|
capabilities: { logs: () => logs(ctx) }
|
|
524
556
|
};
|
|
525
557
|
}
|
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.566",
|
|
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.566",
|
|
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.566"
|
|
59
59
|
},
|
|
60
60
|
"engines": {
|
|
61
61
|
"node": ">=22"
|