@theholocron/holocron-plugin-infisical 3.59.0 → 3.61.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
@@ -23,7 +23,7 @@ declare class InfisicalVault implements Vault {
23
23
  * calls in the same run.
24
24
  */
25
25
  private readonly workspaceIdCache;
26
- constructor(client: InfisicalClient$1, opts: InfisicalVaultOptions);
26
+ constructor(client: () => InfisicalClient$1, opts: InfisicalVaultOptions);
27
27
  read(reference: string): Promise<string>;
28
28
  write(reference: string, value: string): Promise<void>;
29
29
  list(): Promise<string[]>;
@@ -75,7 +75,7 @@ interface InfisicalPluginOptions extends ResolveTokenInput, InfisicalVaultOption
75
75
  }
76
76
  interface PluginContext {
77
77
  options: InfisicalPluginOptions;
78
- client: InfisicalClient;
78
+ client: () => InfisicalClient;
79
79
  }
80
80
  declare function createContext(options: InfisicalPluginOptions): PluginContext;
81
81
  declare function vault(ctx: PluginContext): Vault;
package/dist/index.mjs CHANGED
@@ -31,7 +31,7 @@ var InfisicalVault = class {
31
31
  }
32
32
  async read(reference) {
33
33
  const parsed = parseReference(reference);
34
- const { secret } = await this.client.secrets.get(parsed.name, {
34
+ const { secret } = await this.client().secrets.get(parsed.name, {
35
35
  workspaceId: parsed.workspace,
36
36
  environment: parsed.environment,
37
37
  secretPath: "/"
@@ -47,17 +47,17 @@ var InfisicalVault = class {
47
47
  secretValue: value
48
48
  };
49
49
  try {
50
- await this.client.secrets.create(parsed.name, {
50
+ await this.client().secrets.create(parsed.name, {
51
51
  ...scope,
52
52
  type: "shared"
53
53
  });
54
54
  } catch (err) {
55
55
  if (!isConflict(err)) throw err;
56
- await this.client.secrets.update(parsed.name, scope);
56
+ await this.client().secrets.update(parsed.name, scope);
57
57
  }
58
58
  }
59
59
  async list() {
60
- const { secrets } = await this.client.secrets.list({
60
+ const { secrets } = await this.client().secrets.list({
61
61
  workspaceId: this.workspace,
62
62
  environment: this.environment,
63
63
  secretPath: "/"
@@ -65,11 +65,11 @@ var InfisicalVault = class {
65
65
  return (secrets ?? []).map((s) => s.secretKey ?? "").filter(Boolean);
66
66
  }
67
67
  async environments() {
68
- const { workspace } = await this.client.workspaces.get(this.workspace);
68
+ const { workspace } = await this.client().workspaces.get(this.workspace);
69
69
  return (workspace?.environments ?? []).map((e) => e.slug ?? e.name ?? "").filter(Boolean);
70
70
  }
71
71
  async readEnvironment(environmentId) {
72
- const { secrets } = await this.client.secrets.list({
72
+ const { secrets } = await this.client().secrets.list({
73
73
  workspaceId: this.workspace,
74
74
  environment: environmentId,
75
75
  secretPath: "/"
@@ -80,7 +80,7 @@ var InfisicalVault = class {
80
80
  }
81
81
  async ensureProject(name) {
82
82
  try {
83
- await this.client.workspaces.create(name, name);
83
+ await this.client().workspaces.create(name, name);
84
84
  return { alreadyExists: false };
85
85
  } catch (err) {
86
86
  if (isConflict(err)) return { alreadyExists: true };
@@ -90,7 +90,7 @@ var InfisicalVault = class {
90
90
  async ensureEnvironment(project, name) {
91
91
  const workspaceId = await this.resolveWorkspaceId(project);
92
92
  try {
93
- await this.client.workspaces.createEnvironment(workspaceId, name, name);
93
+ await this.client().workspaces.createEnvironment(workspaceId, name, name);
94
94
  return { alreadyExists: false };
95
95
  } catch (err) {
96
96
  if (isConflict(err)) return { alreadyExists: true };
@@ -101,7 +101,7 @@ var InfisicalVault = class {
101
101
  const cached = this.workspaceIdCache.get(nameOrId);
102
102
  if (cached) return cached;
103
103
  try {
104
- const { workspaces } = await this.client.workspaces.list();
104
+ const { workspaces } = await this.client().workspaces.list();
105
105
  const match = (workspaces ?? []).find((w) => w.name === nameOrId || w.slug === nameOrId);
106
106
  const resolvedId = match?._id ?? match?.id;
107
107
  if (resolvedId) {
@@ -182,9 +182,10 @@ async function verifyToken(token, opts = {}) {
182
182
  //#endregion
183
183
  //#region src/index.ts
184
184
  function createContext(options) {
185
+ let client;
185
186
  return {
186
187
  options,
187
- client: createInfisicalClient({
188
+ client: () => client ??= createInfisicalClient({
188
189
  token: resolveToken(options),
189
190
  baseUrl: options.baseUrl,
190
191
  fetch: options.fetch
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theholocron/holocron-plugin-infisical",
3
- "version": "3.59.0",
3
+ "version": "3.61.0",
4
4
  "description": "Holocron plugin for Infisical. Implements the vault capability against Infisical's REST API, plus exports verifyToken + AUTH_HINT for `holocron auth`.",
5
5
  "keywords": [
6
6
  "holocron",
@@ -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.61.0"
49
49
  },
50
50
  "peerDependencies": {
51
51
  "@theholocron/infisical-client": "^1.14.2",
52
- "@theholocron/cli": "3.59.0"
52
+ "@theholocron/cli": "3.61.0"
53
53
  },
54
54
  "peerDependenciesMeta": {
55
55
  "@theholocron/infisical-client": {}