@theholocron/holocron-plugin-axiom 3.58.1 → 3.60.0

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 CHANGED
@@ -47,7 +47,11 @@ declare class AxiomLogs implements Logs {
47
47
  private readonly opts;
48
48
  readonly key: "logs";
49
49
  readonly providerName = "axiom";
50
- constructor(client: AxiomRestClient, opts: AxiomLogsOptions);
50
+ /**
51
+ * `client` is a thunk — the token is resolved on first call, so
52
+ * `describe()` (which needs no auth) works without one.
53
+ */
54
+ constructor(client: () => AxiomRestClient, opts: AxiomLogsOptions);
51
55
  describe(): Promise<{
52
56
  provider: string;
53
57
  envKeys: string[];
@@ -96,7 +100,13 @@ interface PluginContext {
96
100
  options: AxiomPluginOptions & {
97
101
  dataset?: string;
98
102
  };
99
- client: AxiomRestClient;
103
+ /**
104
+ * Lazily builds (and memoizes) the REST client. The token is resolved
105
+ * on first call, not at plugin load — a capability whose method needs
106
+ * no auth (`describe`) works without a token, and the loader never
107
+ * aborts on a plugin whose token happens to be absent.
108
+ */
109
+ client: () => AxiomRestClient;
100
110
  }
101
111
  declare function createContext(options: AxiomPluginOptions): PluginContext;
102
112
  declare function logs(ctx: PluginContext): Logs;
package/dist/index.mjs CHANGED
@@ -13,6 +13,10 @@ var AxiomLogs = class {
13
13
  opts;
14
14
  key = "logs";
15
15
  providerName = "axiom";
16
+ /**
17
+ * `client` is a thunk — the token is resolved on first call, so
18
+ * `describe()` (which needs no auth) works without one.
19
+ */
16
20
  constructor(client, opts) {
17
21
  this.client = client;
18
22
  this.opts = opts;
@@ -26,7 +30,7 @@ var AxiomLogs = class {
26
30
  async whoami() {
27
31
  const dataset = this.opts.dataset;
28
32
  if (!dataset) throw new Error("@theholocron/holocron-plugin-axiom needs a dataset (HOLOCRON_AXIOM_DATASET / AXIOM_DATASET) for whoami");
29
- await this.client.getDataset(dataset);
33
+ await this.client().getDataset(dataset);
30
34
  return {
31
35
  ok: true,
32
36
  dataset
@@ -34,12 +38,12 @@ var AxiomLogs = class {
34
38
  }
35
39
  async ensureDataset(name) {
36
40
  try {
37
- await this.client.getDataset(name);
41
+ await this.client().getDataset(name);
38
42
  return { alreadyExists: true };
39
43
  } catch (err) {
40
44
  if (!(err instanceof ProviderApiError) || err.status !== 404) throw err;
41
45
  }
42
- await this.client.createDataset({
46
+ await this.client().createDataset({
43
47
  name,
44
48
  description: "Managed by holocron"
45
49
  });
@@ -94,16 +98,16 @@ async function verifyToken(token, opts = {}) {
94
98
  //#endregion
95
99
  //#region src/index.ts
96
100
  function createContext(options) {
97
- const token = resolveToken(options);
98
101
  const env = options.env ?? process.env;
99
102
  const dataset = options.dataset ?? env.HOLOCRON_AXIOM_DATASET ?? env.AXIOM_DATASET;
103
+ let client;
100
104
  return {
101
105
  options: {
102
106
  ...options,
103
107
  dataset
104
108
  },
105
- client: createAxiomClient({
106
- token,
109
+ client: () => client ??= createAxiomClient({
110
+ token: resolveToken(options),
107
111
  baseUrl: options.baseUrl,
108
112
  fetch: options.fetch
109
113
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theholocron/holocron-plugin-axiom",
3
- "version": "3.58.1",
3
+ "version": "3.60.0",
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",
@@ -44,10 +44,10 @@
44
44
  "tsx": "4.23.12",
45
45
  "typescript": "^5.9.3",
46
46
  "vitest": "^4.1.11",
47
- "@theholocron/cli": "3.58.1"
47
+ "@theholocron/cli": "3.60.0"
48
48
  },
49
49
  "peerDependencies": {
50
- "@theholocron/cli": "3.58.1"
50
+ "@theholocron/cli": "3.60.0"
51
51
  },
52
52
  "engines": {
53
53
  "node": ">=22"