@townco/secret 0.1.77 → 0.1.79

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.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as fs from "node:fs/promises";
2
2
  import * as path from "node:path";
3
- import { findRoot } from "@townco/core";
3
+ import { findRoot } from "@townco/core/path";
4
4
  import { EnvFile } from "@townco/env";
5
5
  import { OnePassword } from "./onepassword";
6
6
  export { EnvFile } from "@townco/env";
@@ -2,107 +2,101 @@ import type { FullItem } from "@1password/connect";
2
2
  /**
3
3
  * Represents a change to be made to a 1Password item
4
4
  */
5
- type OnePasswordChange =
6
- | {
7
- type: "add";
8
- key: string;
9
- value: string;
10
- }
11
- | {
12
- type: "update";
13
- key: string;
14
- value: string;
15
- }
16
- | {
17
- type: "delete";
18
- key: string;
19
- };
5
+ type OnePasswordChange = {
6
+ type: "add";
7
+ key: string;
8
+ value: string;
9
+ } | {
10
+ type: "update";
11
+ key: string;
12
+ value: string;
13
+ } | {
14
+ type: "delete";
15
+ key: string;
16
+ };
20
17
  /**
21
18
  * A data structure that represents a 1Password item and provides
22
19
  * methods to detect changes and generate appropriate `op` CLI commands.
23
20
  */
24
21
  export declare class OnePassword {
25
- private vault;
26
- private item;
27
- private fields;
28
- private originalFields;
29
- constructor(vault: string, item: string, fields?: Map<string, string>);
30
- /**
31
- * Create an OpItem from a 1Password FullItem JSON response
32
- */
33
- static fromFullItem(
34
- vault: string,
35
- itemName: string,
36
- fullItem: FullItem,
37
- ): OnePassword;
38
- /**
39
- * Fetch an OpItem from 1Password using the CLI
40
- */
41
- static fetch(vault: string, item: string): Promise<OnePassword>;
42
- /**
43
- * Sign in to 1Password CLI
44
- */
45
- static signin(): Promise<void>;
46
- /**
47
- * Get a field value
48
- */
49
- get(key: string): string | undefined;
50
- /**
51
- * Set a field value (marks as changed)
52
- */
53
- set(key: string, value: string): this;
54
- /**
55
- * Delete a field (marks as deleted)
56
- */
57
- delete(key: string): this;
58
- /**
59
- * Check if a field exists
60
- */
61
- has(key: string): boolean;
62
- /**
63
- * Get all field keys
64
- */
65
- keys(): string[];
66
- /**
67
- * Get all fields as a record
68
- */
69
- toRecord(): Record<string, string>;
70
- /**
71
- * Get all field entries
72
- */
73
- entries(): IterableIterator<[string, string]>;
74
- /**
75
- * Build an op:// reference for a field
76
- */
77
- getReference(key: string): string;
78
- /**
79
- * Detect changes between original and current state
80
- */
81
- detectChanges(): OnePasswordChange[];
82
- /**
83
- * Generate op CLI arguments for a single change
84
- */
85
- private buildEditArgs;
86
- /**
87
- * Apply all changes to 1Password using the op CLI
88
- * Returns the number of changes applied
89
- */
90
- sync(): Promise<number>;
91
- /**
92
- * Inject secrets from a template file to an output file
93
- * This resolves op:// references to actual values
94
- */
95
- static inject(inputPath: string, outputPath: string): Promise<void>;
96
- /**
97
- * Create a clone of this OpItem
98
- */
99
- clone(): OnePassword;
100
- /**
101
- * Reset to original state (discard changes)
102
- */
103
- reset(): this;
104
- /**
105
- * Check if there are unsaved changes
106
- */
107
- hasChanges(): boolean;
22
+ private vault;
23
+ private item;
24
+ private fields;
25
+ private originalFields;
26
+ constructor(vault: string, item: string, fields?: Map<string, string>);
27
+ /**
28
+ * Create an OpItem from a 1Password FullItem JSON response
29
+ */
30
+ static fromFullItem(vault: string, itemName: string, fullItem: FullItem): OnePassword;
31
+ /**
32
+ * Fetch an OpItem from 1Password using the CLI
33
+ */
34
+ static fetch(vault: string, item: string): Promise<OnePassword>;
35
+ /**
36
+ * Sign in to 1Password CLI
37
+ */
38
+ static signin(): Promise<void>;
39
+ /**
40
+ * Get a field value
41
+ */
42
+ get(key: string): string | undefined;
43
+ /**
44
+ * Set a field value (marks as changed)
45
+ */
46
+ set(key: string, value: string): this;
47
+ /**
48
+ * Delete a field (marks as deleted)
49
+ */
50
+ delete(key: string): this;
51
+ /**
52
+ * Check if a field exists
53
+ */
54
+ has(key: string): boolean;
55
+ /**
56
+ * Get all field keys
57
+ */
58
+ keys(): string[];
59
+ /**
60
+ * Get all fields as a record
61
+ */
62
+ toRecord(): Record<string, string>;
63
+ /**
64
+ * Get all field entries
65
+ */
66
+ entries(): IterableIterator<[string, string]>;
67
+ /**
68
+ * Build an op:// reference for a field
69
+ */
70
+ getReference(key: string): string;
71
+ /**
72
+ * Detect changes between original and current state
73
+ */
74
+ detectChanges(): OnePasswordChange[];
75
+ /**
76
+ * Generate op CLI arguments for a single change
77
+ */
78
+ private buildEditArgs;
79
+ /**
80
+ * Apply all changes to 1Password using the op CLI
81
+ * Returns the number of changes applied
82
+ */
83
+ sync(): Promise<number>;
84
+ /**
85
+ * Inject secrets from a template file to an output file
86
+ * This resolves op:// references to actual values
87
+ */
88
+ static inject(inputPath: string, outputPath: string): Promise<void>;
89
+ /**
90
+ * Create a clone of this OpItem
91
+ */
92
+ clone(): OnePassword;
93
+ /**
94
+ * Reset to original state (discard changes)
95
+ */
96
+ reset(): this;
97
+ /**
98
+ * Check if there are unsaved changes
99
+ */
100
+ hasChanges(): boolean;
108
101
  }
102
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@townco/secret",
3
- "version": "0.1.77",
3
+ "version": "0.1.79",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -16,16 +16,16 @@
16
16
  }
17
17
  },
18
18
  "scripts": {
19
- "build": "tsc",
20
- "check": "tsc --noEmit"
19
+ "build": "tsgo",
20
+ "check": "tsgo --noEmit"
21
21
  },
22
22
  "dependencies": {
23
23
  "@1password/connect": "^1.4.2",
24
- "@townco/env": "0.1.27"
24
+ "@townco/env": "0.1.29"
25
25
  },
26
26
  "devDependencies": {
27
- "@townco/core": "0.0.55",
28
- "@townco/tsconfig": "0.1.74",
27
+ "@townco/core": "0.0.57",
28
+ "@townco/tsconfig": "0.1.76",
29
29
  "@types/bun": "^1.3.1"
30
30
  }
31
31
  }