@theholocron/holocron-plugin-infisical 5.0.0-alpha.277 → 5.0.0-alpha.279
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 +12 -0
- package/dist/index.mjs +8 -0
- package/package.json +9 -9
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { AuthError, EnsureResult, PluginToken, ResolveTokenInput, Vault, VerifyTokenFailure, VerifyTokenResult, VerifyTokenResult as VerifyTokenResult$1, VerifyTokenSuccess } from "@theholocron/cli";
|
|
2
2
|
import { InfisicalClient, InfisicalClient as InfisicalClient$1, InfisicalClientOptions, createInfisicalClient } from "@theholocron/infisical-client";
|
|
3
|
+
/** Resolves the Infisical token from `--token`, `HOLOCRON_INFISICAL_TOKEN`, `INFISICAL_TOKEN` or the keyring entry for `infisical`, and throws `AuthError` when none is set. */
|
|
3
4
|
export declare const resolveToken: import("@theholocron/cli").TokenResolver;
|
|
4
5
|
/** Every token this plugin takes, for `holocron doctor tokens`. */
|
|
5
6
|
export declare const tokens: PluginToken[];
|
|
@@ -9,9 +10,12 @@ interface InfisicalVaultOptions {
|
|
|
9
10
|
/** Default environment slug — e.g., "dev", "stg", "prd". */
|
|
10
11
|
environment: string;
|
|
11
12
|
}
|
|
13
|
+
/** `vault` capability for Infisical, with references shaped `infisical://<workspaceId>/<environment>/<name>`. */
|
|
12
14
|
export declare class InfisicalVault implements Vault {
|
|
13
15
|
private readonly client;
|
|
16
|
+
/** Capability key; always `"vault"`. */
|
|
14
17
|
readonly key: "vault";
|
|
18
|
+
/** Provider name; always `"infisical"`. */
|
|
15
19
|
readonly providerName = "infisical";
|
|
16
20
|
private readonly workspace;
|
|
17
21
|
private readonly environment;
|
|
@@ -36,19 +40,27 @@ interface VerifyTokenOptions {
|
|
|
36
40
|
baseUrl?: string;
|
|
37
41
|
fetch?: typeof fetch;
|
|
38
42
|
}
|
|
43
|
+
/** Checks an Infisical token by listing workspaces; a 403 is reported as a valid but scope-limited token. */
|
|
39
44
|
export declare function verifyToken(token: string, opts?: VerifyTokenOptions): Promise<VerifyTokenResult$1>;
|
|
45
|
+
/** Options for the Infisical plugin: the token lookup inputs plus the default workspace and environment. */
|
|
40
46
|
export interface InfisicalPluginOptions extends ResolveTokenInput, InfisicalVaultOptions {
|
|
41
47
|
/** Override base URL for tests (or self-hosted Infisical). */
|
|
42
48
|
baseUrl?: string;
|
|
43
49
|
/** Override `fetch` for tests. */
|
|
44
50
|
fetch?: typeof fetch;
|
|
45
51
|
}
|
|
52
|
+
/** Shared state for one Infisical plugin instance: its options and a lazily created client. */
|
|
46
53
|
export interface PluginContext {
|
|
54
|
+
/** The options the plugin was created with. */
|
|
47
55
|
options: InfisicalPluginOptions;
|
|
56
|
+
/** Returns the memoized Infisical client; the token is resolved on the first call, not at plugin load. */
|
|
48
57
|
client: () => InfisicalClient;
|
|
49
58
|
}
|
|
59
|
+
/** Builds the plugin context from its options. */
|
|
50
60
|
export declare function createContext(options: InfisicalPluginOptions): PluginContext;
|
|
61
|
+
/** Builds the `vault` capability for the context's default workspace and environment. */
|
|
51
62
|
export declare function vault(ctx: PluginContext): Vault;
|
|
63
|
+
/** Creates the Infisical plugin: its `connection` probe and the `vault` capability. */
|
|
52
64
|
export declare function createPlugin(options: InfisicalPluginOptions): {
|
|
53
65
|
name: string;
|
|
54
66
|
probes: {
|
package/dist/index.mjs
CHANGED
|
@@ -2,6 +2,7 @@ import { AuthError, ProviderApiError, connectionProbe, createResolveToken } from
|
|
|
2
2
|
import { createInfisicalClient } from "@theholocron/infisical-client";
|
|
3
3
|
import { errorMessage } from "@theholocron/misc-utils";
|
|
4
4
|
// src/auth.ts
|
|
5
|
+
/** Resolves the Infisical token from `--token`, `HOLOCRON_INFISICAL_TOKEN`, `INFISICAL_TOKEN` or the keyring entry for `infisical`, and throws `AuthError` when none is set. */
|
|
5
6
|
const resolveToken = createResolveToken({
|
|
6
7
|
envName: "HOLOCRON_INFISICAL_TOKEN",
|
|
7
8
|
vendorEnvName: "INFISICAL_TOKEN",
|
|
@@ -11,9 +12,12 @@ const resolveToken = createResolveToken({
|
|
|
11
12
|
/** Every token this plugin takes, for `holocron doctor tokens`. */
|
|
12
13
|
const tokens = [resolveToken.token];
|
|
13
14
|
// src/capabilities/vault.ts
|
|
15
|
+
/** `vault` capability for Infisical, with references shaped `infisical://<workspaceId>/<environment>/<name>`. */
|
|
14
16
|
var InfisicalVault = class {
|
|
15
17
|
client;
|
|
18
|
+
/** Capability key; always `"vault"`. */
|
|
16
19
|
key = "vault";
|
|
20
|
+
/** Provider name; always `"infisical"`. */
|
|
17
21
|
providerName = "infisical";
|
|
18
22
|
workspace;
|
|
19
23
|
environment;
|
|
@@ -154,6 +158,7 @@ function hasAlreadyExistsBody(details) {
|
|
|
154
158
|
* actually has access to.
|
|
155
159
|
* - 401 or other → token is invalid.
|
|
156
160
|
*/
|
|
161
|
+
/** Checks an Infisical token by listing workspaces; a 403 is reported as a valid but scope-limited token. */
|
|
157
162
|
async function verifyToken(token, opts = {}) {
|
|
158
163
|
const client = createInfisicalClient({
|
|
159
164
|
token,
|
|
@@ -181,6 +186,7 @@ async function verifyToken(token, opts = {}) {
|
|
|
181
186
|
}
|
|
182
187
|
}
|
|
183
188
|
// src/index.ts
|
|
189
|
+
/** Builds the plugin context from its options. */
|
|
184
190
|
function createContext(options) {
|
|
185
191
|
let client;
|
|
186
192
|
return {
|
|
@@ -192,12 +198,14 @@ function createContext(options) {
|
|
|
192
198
|
})
|
|
193
199
|
};
|
|
194
200
|
}
|
|
201
|
+
/** Builds the `vault` capability for the context's default workspace and environment. */
|
|
195
202
|
function vault(ctx) {
|
|
196
203
|
return new InfisicalVault(ctx.client, {
|
|
197
204
|
workspace: ctx.options.workspace,
|
|
198
205
|
environment: ctx.options.environment
|
|
199
206
|
});
|
|
200
207
|
}
|
|
208
|
+
/** Creates the Infisical plugin: its `connection` probe and the `vault` capability. */
|
|
201
209
|
function createPlugin(options) {
|
|
202
210
|
const ctx = createContext(options);
|
|
203
211
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theholocron/holocron-plugin-infisical",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
3
|
+
"version": "5.0.0-alpha.279",
|
|
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",
|
|
@@ -40,19 +40,19 @@
|
|
|
40
40
|
"tsx": "4.23.15",
|
|
41
41
|
"typescript": "^5.9.3",
|
|
42
42
|
"vitest": "^5.0.5",
|
|
43
|
-
"@theholocron/cli": "5.0.0-alpha.
|
|
44
|
-
"@theholocron/eslint-config": "^8.9.0-alpha.
|
|
45
|
-
"@theholocron/http-client": "^1.58.0-alpha.3",
|
|
46
|
-
"@theholocron/misc-utils": "^1.16.1-alpha.2",
|
|
47
|
-
"@theholocron/tsconfig": "^8.9.0-alpha.3",
|
|
48
|
-
"@theholocron/tsdown-config": "^8.9.0-alpha.3",
|
|
43
|
+
"@theholocron/cli": "5.0.0-alpha.279",
|
|
44
|
+
"@theholocron/eslint-config": "^8.9.0-alpha.4",
|
|
49
45
|
"@theholocron/infisical-client": "^1.58.0-alpha.3",
|
|
50
|
-
"@theholocron/
|
|
46
|
+
"@theholocron/tsconfig": "^8.9.0-alpha.4",
|
|
47
|
+
"@theholocron/http-client": "^1.58.0-alpha.3",
|
|
48
|
+
"@theholocron/tsdown-config": "^8.9.0-alpha.4",
|
|
49
|
+
"@theholocron/misc-utils": "^1.16.1-alpha.3",
|
|
50
|
+
"@theholocron/vitest-config": "^8.9.0-alpha.4"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
53
|
"@theholocron/infisical-client": "^1.43.1",
|
|
54
54
|
"@theholocron/misc-utils": "^1.16.0",
|
|
55
|
-
"@theholocron/cli": "5.0.0-alpha.
|
|
55
|
+
"@theholocron/cli": "5.0.0-alpha.279"
|
|
56
56
|
},
|
|
57
57
|
"peerDependenciesMeta": {
|
|
58
58
|
"@theholocron/infisical-client": {}
|