@theholocron/holocron-plugin-doppler 3.59.0 → 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
@@ -16,7 +16,7 @@ declare class DopplerVault implements Vault {
16
16
  readonly providerName = "doppler";
17
17
  private readonly project;
18
18
  private readonly config;
19
- constructor(client: DopplerClient, opts: DopplerVaultOptions);
19
+ constructor(client: () => DopplerClient, opts: DopplerVaultOptions);
20
20
  read(reference: string): Promise<string>;
21
21
  write(reference: string, value: string): Promise<void>;
22
22
  list(): Promise<string[]>;
@@ -61,7 +61,7 @@ interface DopplerPluginOptions extends ResolveTokenInput, DopplerVaultOptions {
61
61
  }
62
62
  interface PluginContext {
63
63
  options: DopplerPluginOptions;
64
- client: DopplerClient;
64
+ client: () => DopplerClient;
65
65
  }
66
66
  declare function createContext(options: DopplerPluginOptions): PluginContext;
67
67
  declare function vault(ctx: PluginContext): Vault;
package/dist/index.mjs CHANGED
@@ -24,29 +24,29 @@ var DopplerVault = class {
24
24
  }
25
25
  async read(reference) {
26
26
  const parsed = parseReference(reference);
27
- const res = await this.client.secrets.get(parsed.project, parsed.config, parsed.name);
27
+ const res = await this.client().secrets.get(parsed.project, parsed.config, parsed.name);
28
28
  return res.value?.computed ?? res.value?.raw ?? "";
29
29
  }
30
30
  async write(reference, value) {
31
31
  const parsed = parseReference(reference);
32
- await this.client.secrets.update(parsed.project, parsed.config, { [parsed.name]: value });
32
+ await this.client().secrets.update(parsed.project, parsed.config, { [parsed.name]: value });
33
33
  }
34
34
  async list() {
35
- const res = await this.client.secrets.list(this.project, this.config);
35
+ const res = await this.client().secrets.list(this.project, this.config);
36
36
  return Object.keys(res.secrets ?? {});
37
37
  }
38
38
  async environments() {
39
- return ((await this.client.environments.list(this.project)).environments ?? []).map((e) => e.slug ?? e.name ?? "").filter(Boolean);
39
+ return ((await this.client().environments.list(this.project)).environments ?? []).map((e) => e.slug ?? e.name ?? "").filter(Boolean);
40
40
  }
41
41
  async readEnvironment(environmentId) {
42
- const res = await this.client.secrets.download(this.project, environmentId);
42
+ const res = await this.client().secrets.download(this.project, environmentId);
43
43
  const out = {};
44
44
  for (const [k, v] of Object.entries(res)) if (typeof v === "string") out[k] = v;
45
45
  return out;
46
46
  }
47
47
  async ensureProject(name) {
48
48
  try {
49
- await this.client.projects.create(name, "Managed by holocron");
49
+ await this.client().projects.create(name, "Managed by holocron");
50
50
  return { alreadyExists: false };
51
51
  } catch (err) {
52
52
  if (isConflict(err)) return { alreadyExists: true };
@@ -55,7 +55,7 @@ var DopplerVault = class {
55
55
  }
56
56
  async ensureEnvironment(project, name) {
57
57
  try {
58
- await this.client.environments.create(project, name, name);
58
+ await this.client().environments.create(project, name, name);
59
59
  return { alreadyExists: false };
60
60
  } catch (err) {
61
61
  if (isConflict(err)) return { alreadyExists: true };
@@ -136,9 +136,10 @@ async function verifyToken(token, opts = {}) {
136
136
  //#endregion
137
137
  //#region src/index.ts
138
138
  function createContext(options) {
139
+ let client;
139
140
  return {
140
141
  options,
141
- client: createDopplerClient({
142
+ client: () => client ??= createDopplerClient({
142
143
  token: resolveToken(options),
143
144
  baseUrl: options.baseUrl,
144
145
  fetch: options.fetch
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theholocron/holocron-plugin-doppler",
3
- "version": "3.59.0",
3
+ "version": "3.60.0",
4
4
  "description": "Holocron plugin for Doppler. Implements the vault capability against Doppler's REST API — projects, configs, secrets, plus verifyToken + AUTH_HINT for `holocron auth`.",
5
5
  "keywords": [
6
6
  "doppler",
@@ -45,11 +45,11 @@
45
45
  "tsx": "4.23.12",
46
46
  "typescript": "^5.9.3",
47
47
  "vitest": "^4.1.11",
48
- "@theholocron/cli": "3.59.0"
48
+ "@theholocron/cli": "3.60.0"
49
49
  },
50
50
  "peerDependencies": {
51
51
  "@theholocron/doppler-client": "^1.14.2",
52
- "@theholocron/cli": "3.59.0"
52
+ "@theholocron/cli": "3.60.0"
53
53
  },
54
54
  "engines": {
55
55
  "node": ">=22"