@theholocron/holocron-plugin-1password 5.0.0-alpha.26 → 5.0.0-alpha.261
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/README.md +1 -1
- package/dist/index.d.mts +17 -33
- package/dist/index.mjs +11 -11
- package/package.json +16 -16
package/README.md
CHANGED
|
@@ -145,7 +145,7 @@ convention):
|
|
|
145
145
|
`ensureProject` / `ensureEnvironment` — 1Password's data model
|
|
146
146
|
doesn't have projects with sub-configs the way Doppler / Infisical
|
|
147
147
|
do. The vault + item hierarchy is created via the 1P UI or `op item
|
|
148
|
-
create`, not via `holocron setup`. The methods are omitted;
|
|
148
|
+
create`, not via `holocron repo setup`. The methods are omitted;
|
|
149
149
|
`runSetup` skips them cleanly (see the [`Vault`
|
|
150
150
|
interface](../cli/src/capabilities/index.ts)).
|
|
151
151
|
|
package/dist/index.d.mts
CHANGED
|
@@ -1,18 +1,15 @@
|
|
|
1
|
+
import { Vault, VerifyTokenFailure, VerifyTokenResult, VerifyTokenResult as VerifyTokenResult$1, VerifyTokenSuccess } from "@theholocron/cli";
|
|
1
2
|
import { spawnSync } from "node:child_process";
|
|
2
|
-
|
|
3
|
-
//#region src/auth.d.ts
|
|
4
|
-
declare class AuthError extends Error {
|
|
3
|
+
export declare class AuthError extends Error {
|
|
5
4
|
name: string;
|
|
6
5
|
}
|
|
7
|
-
interface VerifyInput {
|
|
6
|
+
export interface VerifyInput {
|
|
8
7
|
/** Override the spawn function in tests. */
|
|
9
8
|
spawn?: typeof spawnSync;
|
|
10
9
|
/** Path to the op binary. Defaults to "op". */
|
|
11
10
|
binary?: string;
|
|
12
11
|
}
|
|
13
|
-
declare function verifyOpInstalled(input?: VerifyInput): void;
|
|
14
|
-
//#endregion
|
|
15
|
-
//#region src/shell.d.ts
|
|
12
|
+
export declare function verifyOpInstalled(input?: VerifyInput): void;
|
|
16
13
|
interface OpResult {
|
|
17
14
|
ok: boolean;
|
|
18
15
|
stdout: string;
|
|
@@ -30,7 +27,7 @@ interface RunOptions {
|
|
|
30
27
|
/** Skip `--account` injection for commands that operate above the account level (e.g., `account list`). */
|
|
31
28
|
skipAccount?: boolean;
|
|
32
29
|
}
|
|
33
|
-
declare class OpShell {
|
|
30
|
+
export declare class OpShell {
|
|
34
31
|
private readonly spawnImpl;
|
|
35
32
|
readonly binary: string;
|
|
36
33
|
readonly account?: string;
|
|
@@ -40,13 +37,11 @@ declare class OpShell {
|
|
|
40
37
|
/** Run + throw if non-zero. Mirrors REST clients' `request<T>` ergonomic. */
|
|
41
38
|
runOrThrow(args: string[], context: string, opts?: RunOptions): string;
|
|
42
39
|
}
|
|
43
|
-
//#endregion
|
|
44
|
-
//#region src/capabilities/vault.d.ts
|
|
45
40
|
interface OpVaultOptions {
|
|
46
41
|
/** 1P vault name items live in. Required — list/write default here. */
|
|
47
42
|
vault: string;
|
|
48
43
|
}
|
|
49
|
-
declare class OpVault implements Vault {
|
|
44
|
+
export declare class OpVault implements Vault {
|
|
50
45
|
private readonly shell;
|
|
51
46
|
readonly key: "vault";
|
|
52
47
|
readonly providerName = "1password";
|
|
@@ -58,38 +53,28 @@ declare class OpVault implements Vault {
|
|
|
58
53
|
environments(): Promise<string[]>;
|
|
59
54
|
readEnvironment(environmentId: string): Promise<Record<string, string>>;
|
|
60
55
|
}
|
|
61
|
-
//#endregion
|
|
62
|
-
//#region src/verify-token.d.ts
|
|
63
|
-
interface VerifyTokenSuccess {
|
|
64
|
-
ok: true;
|
|
65
|
-
subject: string;
|
|
66
|
-
}
|
|
67
|
-
interface VerifyTokenFailure {
|
|
68
|
-
ok: false;
|
|
69
|
-
message: string;
|
|
70
|
-
}
|
|
71
|
-
type VerifyTokenResult = VerifyTokenSuccess | VerifyTokenFailure;
|
|
72
56
|
interface VerifyTokenOptions {
|
|
73
57
|
spawn?: typeof spawnSync;
|
|
74
58
|
binary?: string;
|
|
75
59
|
}
|
|
76
|
-
declare function verifyToken(_token: string, opts?: VerifyTokenOptions): Promise<VerifyTokenResult>;
|
|
77
|
-
|
|
78
|
-
//#region src/index.d.ts
|
|
79
|
-
interface OpPluginOptions extends VerifyInput {
|
|
60
|
+
export declare function verifyToken(_token: string, opts?: VerifyTokenOptions): Promise<VerifyTokenResult$1>;
|
|
61
|
+
export interface OpPluginOptions extends VerifyInput {
|
|
80
62
|
/** 1P vault name items live in. Required. */
|
|
81
63
|
vault: string;
|
|
82
64
|
/** Optional 1P account UUID; passed as `--account` on every op call. */
|
|
83
65
|
account?: string;
|
|
84
66
|
}
|
|
85
|
-
interface PluginContext {
|
|
67
|
+
export interface PluginContext {
|
|
86
68
|
options: OpPluginOptions;
|
|
87
69
|
shell: OpShell;
|
|
88
70
|
}
|
|
89
|
-
declare function createContext(options: OpPluginOptions): PluginContext;
|
|
90
|
-
declare function vault(ctx: PluginContext): Vault;
|
|
91
|
-
declare function createPlugin(options: OpPluginOptions): {
|
|
71
|
+
export declare function createContext(options: OpPluginOptions): PluginContext;
|
|
72
|
+
export declare function vault(ctx: PluginContext): Vault;
|
|
73
|
+
export declare function createPlugin(options: OpPluginOptions): {
|
|
92
74
|
name: string;
|
|
75
|
+
probes: {
|
|
76
|
+
connection: import("@theholocron/cli").Probe;
|
|
77
|
+
};
|
|
93
78
|
capabilities: {
|
|
94
79
|
vault: () => Vault;
|
|
95
80
|
};
|
|
@@ -99,6 +84,5 @@ declare function createPlugin(options: OpPluginOptions): {
|
|
|
99
84
|
* store a token in the holocron keyring; the `op` CLI manages its own
|
|
100
85
|
* auth. Directs the operator to the two paths that actually work.
|
|
101
86
|
*/
|
|
102
|
-
declare const AUTH_HINT: string;
|
|
103
|
-
|
|
104
|
-
export { AUTH_HINT, AuthError, OpPluginOptions, OpShell, OpVault, PluginContext, VerifyInput, type VerifyTokenFailure, type VerifyTokenResult, type VerifyTokenSuccess, createContext, createPlugin, vault, verifyOpInstalled, verifyToken };
|
|
87
|
+
export declare const AUTH_HINT: string;
|
|
88
|
+
export type { VerifyTokenFailure, VerifyTokenResult, VerifyTokenSuccess };
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { ProviderApiError, connectionProbe } from "@theholocron/cli";
|
|
1
2
|
import { spawnSync } from "node:child_process";
|
|
2
|
-
|
|
3
|
-
//#region src/auth.ts
|
|
3
|
+
// src/auth.ts
|
|
4
4
|
/**
|
|
5
5
|
* 1Password plugin "auth" is just verifying the `op` binary is on
|
|
6
6
|
* PATH — the CLI handles its own auth (keychain biometric unlock for
|
|
@@ -28,8 +28,7 @@ function verifyOpInstalled(input = {}) {
|
|
|
28
28
|
if (result.error) throw new AuthError(`1Password CLI (\`${binary}\`) not found on PATH. Install via \`brew install 1password-cli\` or see https://developer.1password.com/docs/cli/get-started.`);
|
|
29
29
|
if (result.status !== 0) throw new AuthError(`\`${binary} --version\` failed: ${(result.stderr ?? "").trim() || `exit ${result.status ?? "?"}`}`);
|
|
30
30
|
}
|
|
31
|
-
|
|
32
|
-
//#region src/capabilities/vault.ts
|
|
31
|
+
// src/capabilities/vault.ts
|
|
33
32
|
var OpVault = class {
|
|
34
33
|
shell;
|
|
35
34
|
key = "vault";
|
|
@@ -136,8 +135,7 @@ function parseEnvironmentDump(stdout) {
|
|
|
136
135
|
}
|
|
137
136
|
return out;
|
|
138
137
|
}
|
|
139
|
-
|
|
140
|
-
//#region src/shell.ts
|
|
138
|
+
// src/shell.ts
|
|
141
139
|
/**
|
|
142
140
|
* Thin wrapper around `spawnSync` for `op` CLI shell-outs.
|
|
143
141
|
*
|
|
@@ -198,8 +196,7 @@ var OpShell = class {
|
|
|
198
196
|
return result.stdout;
|
|
199
197
|
}
|
|
200
198
|
};
|
|
201
|
-
|
|
202
|
-
//#region src/verify-token.ts
|
|
199
|
+
// src/verify-token.ts
|
|
203
200
|
/**
|
|
204
201
|
* `verifyToken` — plugin-level export used by `holocron auth check`.
|
|
205
202
|
*
|
|
@@ -245,8 +242,7 @@ async function verifyToken(_token, opts = {}) {
|
|
|
245
242
|
};
|
|
246
243
|
}
|
|
247
244
|
}
|
|
248
|
-
|
|
249
|
-
//#region src/index.ts
|
|
245
|
+
// src/index.ts
|
|
250
246
|
function createContext(options) {
|
|
251
247
|
if (!options.vault) throw new Error("@theholocron/holocron-plugin-1password requires `vault` in options");
|
|
252
248
|
const verifyOpts = {};
|
|
@@ -269,6 +265,11 @@ function createPlugin(options) {
|
|
|
269
265
|
const ctx = createContext(options);
|
|
270
266
|
return {
|
|
271
267
|
name: "@theholocron/holocron-plugin-1password",
|
|
268
|
+
probes: { connection: connectionProbe({
|
|
269
|
+
provider: "1Password",
|
|
270
|
+
token: () => "",
|
|
271
|
+
verify: (token) => verifyToken(token, { spawn: options.spawn })
|
|
272
|
+
}) },
|
|
272
273
|
capabilities: { vault: () => vault(ctx) }
|
|
273
274
|
};
|
|
274
275
|
}
|
|
@@ -278,5 +279,4 @@ function createPlugin(options) {
|
|
|
278
279
|
* auth. Directs the operator to the two paths that actually work.
|
|
279
280
|
*/
|
|
280
281
|
const AUTH_HINT = "1Password uses the `op` CLI for auth — no bearer token to store. On laptop: `op signin` (or the desktop app's biometric flow). In CI: set `OP_SERVICE_ACCOUNT_TOKEN` in the workflow env.";
|
|
281
|
-
//#endregion
|
|
282
282
|
export { AUTH_HINT, AuthError, OpShell, OpVault, createContext, createPlugin, vault, verifyOpInstalled, verifyToken };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theholocron/holocron-plugin-1password",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
3
|
+
"version": "5.0.0-alpha.261",
|
|
4
4
|
"description": "Holocron plugin for 1Password. Implements the vault capability via shell-out to the `op` CLI (https://developer.1password.com/docs/cli).",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"1password",
|
|
@@ -8,12 +8,12 @@
|
|
|
8
8
|
"plugin",
|
|
9
9
|
"vault"
|
|
10
10
|
],
|
|
11
|
-
"homepage": "https://github.com/theholocron/holocron/tree/main/
|
|
11
|
+
"homepage": "https://github.com/theholocron/holocron/tree/main/plugins/holocron-plugin-1password#readme",
|
|
12
12
|
"bugs": "https://github.com/theholocron/holocron/issues",
|
|
13
13
|
"repository": {
|
|
14
14
|
"type": "git",
|
|
15
15
|
"url": "git+https://github.com/theholocron/holocron.git",
|
|
16
|
-
"directory": "
|
|
16
|
+
"directory": "plugins/holocron-plugin-1password"
|
|
17
17
|
},
|
|
18
18
|
"license": "MIT",
|
|
19
19
|
"author": "Newton Koumantzelis",
|
|
@@ -30,24 +30,24 @@
|
|
|
30
30
|
"dist"
|
|
31
31
|
],
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@theholocron/eslint-config": "^8.0.0",
|
|
34
|
-
"@theholocron/tsconfig": "^8.0.0",
|
|
35
|
-
"@theholocron/tsdown-config": "^8.0.0",
|
|
36
|
-
"@theholocron/vitest-config": "^8.0.0",
|
|
37
33
|
"@types/node": "^26",
|
|
38
|
-
"@vitest/coverage-v8": "^
|
|
34
|
+
"@vitest/coverage-v8": "^5.0.5",
|
|
39
35
|
"@vitest/eslint-plugin": "^1.6.27",
|
|
40
36
|
"eslint": "^10.8.1",
|
|
41
37
|
"eslint-plugin-n": "^18.3.0",
|
|
42
38
|
"globals": "^17.11.0",
|
|
43
|
-
"tsdown": "^0.
|
|
44
|
-
"tsx": "4.23.
|
|
39
|
+
"tsdown": "^0.23.3",
|
|
40
|
+
"tsx": "4.23.15",
|
|
45
41
|
"typescript": "^5.9.3",
|
|
46
|
-
"vitest": "^
|
|
47
|
-
"@theholocron/
|
|
42
|
+
"vitest": "^5.0.5",
|
|
43
|
+
"@theholocron/eslint-config": "^8.9.0-alpha.3",
|
|
44
|
+
"@theholocron/vitest-config": "^8.9.0-alpha.3",
|
|
45
|
+
"@theholocron/tsconfig": "^8.9.0-alpha.3",
|
|
46
|
+
"@theholocron/cli": "5.0.0-alpha.261",
|
|
47
|
+
"@theholocron/tsdown-config": "^8.9.0-alpha.3"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@theholocron/cli": "5.0.0-alpha.
|
|
50
|
+
"@theholocron/cli": "5.0.0-alpha.261"
|
|
51
51
|
},
|
|
52
52
|
"engines": {
|
|
53
53
|
"node": ">=22"
|
|
@@ -57,10 +57,10 @@
|
|
|
57
57
|
},
|
|
58
58
|
"scripts": {
|
|
59
59
|
"delivery.build": "tsdown",
|
|
60
|
-
"sourceQuality.staticAnalysis": "
|
|
60
|
+
"sourceQuality.staticAnalysis": "eslint .",
|
|
61
61
|
"test:watch": "vitest",
|
|
62
62
|
"validate": "tsx scripts/validate.mjs",
|
|
63
|
-
"verification.typeSafety": "
|
|
64
|
-
"verification.unitTests": "
|
|
63
|
+
"verification.typeSafety": "tsc --noEmit",
|
|
64
|
+
"verification.unitTests": "vitest run"
|
|
65
65
|
}
|
|
66
66
|
}
|