@townco/secret 0.1.41 → 0.1.42
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/env-file.d.ts +96 -98
- package/dist/index.d.ts +5 -8
- package/dist/onepassword.d.ts +92 -98
- package/package.json +2 -2
package/dist/env-file.d.ts
CHANGED
|
@@ -1,107 +1,105 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Represents a line in an .env file
|
|
3
3
|
*/
|
|
4
|
-
type EnvLine =
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
value: string;
|
|
16
|
-
raw: string;
|
|
17
|
-
};
|
|
4
|
+
type EnvLine = {
|
|
5
|
+
type: "comment";
|
|
6
|
+
content: string;
|
|
7
|
+
} | {
|
|
8
|
+
type: "blank";
|
|
9
|
+
} | {
|
|
10
|
+
type: "entry";
|
|
11
|
+
key: string;
|
|
12
|
+
value: string;
|
|
13
|
+
raw: string;
|
|
14
|
+
};
|
|
18
15
|
/**
|
|
19
16
|
* A data structure that represents a parsed .env file while preserving
|
|
20
17
|
* all original content including comments, blank lines, and order.
|
|
21
18
|
*/
|
|
22
19
|
export declare class EnvFile {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
20
|
+
private lines;
|
|
21
|
+
constructor(lines?: EnvLine[]);
|
|
22
|
+
/**
|
|
23
|
+
* Parse a .env file string into an EnvFile structure
|
|
24
|
+
*/
|
|
25
|
+
static parse(content: string): EnvFile;
|
|
26
|
+
/**
|
|
27
|
+
* Serialize the EnvFile back to a string
|
|
28
|
+
*/
|
|
29
|
+
toString(): string;
|
|
30
|
+
/**
|
|
31
|
+
* Get all entries as a key-value record
|
|
32
|
+
*/
|
|
33
|
+
toRecord(): Record<string, string>;
|
|
34
|
+
/**
|
|
35
|
+
* Find an entry line by key
|
|
36
|
+
*/
|
|
37
|
+
private findEntry;
|
|
38
|
+
/**
|
|
39
|
+
* Find the index of an entry by key
|
|
40
|
+
*/
|
|
41
|
+
private findEntryIndex;
|
|
42
|
+
/**
|
|
43
|
+
* Create an entry line from key and value
|
|
44
|
+
*/
|
|
45
|
+
private createEntry;
|
|
46
|
+
/**
|
|
47
|
+
* Normalize a value by ensuring it's properly quoted
|
|
48
|
+
*/
|
|
49
|
+
private normalizeValue;
|
|
50
|
+
/**
|
|
51
|
+
* Find the insertion index for a new entry (before the final blank line if present)
|
|
52
|
+
*/
|
|
53
|
+
private findInsertionIndex;
|
|
54
|
+
/**
|
|
55
|
+
* Get the value for a specific key
|
|
56
|
+
*/
|
|
57
|
+
get(key: string): string | undefined;
|
|
58
|
+
/**
|
|
59
|
+
* Set a value for a key. If the key exists, updates it in place.
|
|
60
|
+
* If it doesn't exist, appends it above the final newline (if present).
|
|
61
|
+
* Values are always double quoted.
|
|
62
|
+
*/
|
|
63
|
+
set(key: string, value: string): this;
|
|
64
|
+
/**
|
|
65
|
+
* Delete a key-value entry
|
|
66
|
+
*/
|
|
67
|
+
delete(key: string): this;
|
|
68
|
+
/**
|
|
69
|
+
* Check if a key exists
|
|
70
|
+
*/
|
|
71
|
+
has(key: string): boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Get all keys
|
|
74
|
+
*/
|
|
75
|
+
keys(): string[];
|
|
76
|
+
/**
|
|
77
|
+
* Iterate over all entries
|
|
78
|
+
*/
|
|
79
|
+
entries(): IterableIterator<[string, string]>;
|
|
80
|
+
/**
|
|
81
|
+
* Apply a function to all entries and return a new EnvFile
|
|
82
|
+
*/
|
|
83
|
+
map(fn: (key: string, value: string) => [string, string]): EnvFile;
|
|
84
|
+
/**
|
|
85
|
+
* Filter entries based on a predicate
|
|
86
|
+
*/
|
|
87
|
+
filter(fn: (key: string, value: string) => boolean): EnvFile;
|
|
88
|
+
/**
|
|
89
|
+
* Add a comment line
|
|
90
|
+
*/
|
|
91
|
+
addComment(content: string): this;
|
|
92
|
+
/**
|
|
93
|
+
* Add a blank line
|
|
94
|
+
*/
|
|
95
|
+
addBlank(): this;
|
|
96
|
+
/**
|
|
97
|
+
* Get the raw lines array for custom operations
|
|
98
|
+
*/
|
|
99
|
+
getLines(): readonly EnvLine[];
|
|
100
|
+
/**
|
|
101
|
+
* Create a clone of this EnvFile
|
|
102
|
+
*/
|
|
103
|
+
clone(): EnvFile;
|
|
107
104
|
}
|
|
105
|
+
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
export { EnvFile } from "./env-file";
|
|
2
2
|
export { type OnePassword, OnePassword as OpItem } from "./onepassword";
|
|
3
3
|
export type SecretValidation = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
key: string;
|
|
5
|
+
value: string;
|
|
6
|
+
valid: boolean;
|
|
7
|
+
error?: string;
|
|
8
8
|
};
|
|
9
9
|
export declare const listSecrets: () => Promise<Promise<SecretValidation[]>>;
|
|
10
|
-
export declare const createSecret: (
|
|
11
|
-
name: string,
|
|
12
|
-
value: string,
|
|
13
|
-
) => Promise<Promise<void>>;
|
|
10
|
+
export declare const createSecret: (name: string, value: string) => Promise<Promise<void>>;
|
|
14
11
|
export declare const deleteSecret: (name: string) => Promise<Promise<void>>;
|
|
15
12
|
export declare const genenv: () => Promise<Promise<void>>;
|
package/dist/onepassword.d.ts
CHANGED
|
@@ -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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
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.
|
|
3
|
+
"version": "0.1.42",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"@1password/connect": "^1.4.2"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@townco/tsconfig": "0.1.
|
|
26
|
+
"@townco/tsconfig": "0.1.39",
|
|
27
27
|
"@types/bun": "^1.3.1"
|
|
28
28
|
}
|
|
29
29
|
}
|