@qui-cli/env-1password 1.2.1 → 1.2.3
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/CHANGELOG.md +14 -0
- package/README.md +1 -1
- package/dist/1Password.js +18 -11
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [1.2.3](https://github.com/battis/qui-cli/compare/env-1password/1.2.2...env-1password/1.2.3) (2025-12-24)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* handle inconsistencies of 1password-sdk sectionIds more gracefully ([bfa2be1](https://github.com/battis/qui-cli/commit/bfa2be1750da265676b31f7162f24e7d75a31502))
|
|
11
|
+
|
|
12
|
+
## [1.2.2](https://github.com/battis/qui-cli/compare/env-1password/1.2.1...env-1password/1.2.2) (2025-12-24)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* handle 1Password secret reference not in sections ([bd57bb6](https://github.com/battis/qui-cli/commit/bd57bb67f5027135425dfdd61fef5b3c1c2301c7))
|
|
18
|
+
|
|
5
19
|
## [1.2.1](https://github.com/battis/qui-cli/compare/env-1password/1.2.0...env-1password/1.2.1) (2025-12-23)
|
|
6
20
|
|
|
7
21
|
|
package/README.md
CHANGED
|
@@ -38,7 +38,7 @@ This package integrates with [@1password/sdk](https://www.npmjs.com/package/@1pa
|
|
|
38
38
|
3. Update environment variables to be [secret references](https://developer.1password.com/docs/cli/secret-references)
|
|
39
39
|
4. Run!
|
|
40
40
|
|
|
41
|
-
See [dev-1password
|
|
41
|
+
See [dev-env-1password](https://github.com/battis/qui-cli/tree/main/examples/dev-env-1password#readme) for an example using the 1Password implementation of this package.
|
|
42
42
|
|
|
43
43
|
## Configuration
|
|
44
44
|
|
package/dist/1Password.js
CHANGED
|
@@ -67,7 +67,7 @@ export function options() {
|
|
|
67
67
|
default: config.opAccount
|
|
68
68
|
},
|
|
69
69
|
opItem: {
|
|
70
|
-
description: `Name or ID of the 1Password API Credential item storing the 1Password service account token; will use
|
|
70
|
+
description: `Name or ID of the 1Password API Credential item storing the 1Password service account token; will use environment variable ${Colors.varName('OP_ITEM')} if present`,
|
|
71
71
|
hint: '1Password unique identifier',
|
|
72
72
|
default: config.opItem
|
|
73
73
|
},
|
|
@@ -100,6 +100,8 @@ function isSecretReference(value) {
|
|
|
100
100
|
function secretReferences(parsed) {
|
|
101
101
|
return Object.fromEntries(Object.entries(parsed).filter((entry) => isSecretReference(entry[1])));
|
|
102
102
|
}
|
|
103
|
+
// FIXME parse is not loading 1Password secrets into process.env
|
|
104
|
+
// Issue URL: https://github.com/battis/qui-cli/issues/81
|
|
103
105
|
export async function parse(file) {
|
|
104
106
|
const parsed = await Env.parse(file);
|
|
105
107
|
if (client) {
|
|
@@ -120,9 +122,14 @@ export async function exists({ key, file }) {
|
|
|
120
122
|
return Env.exists({ key, file });
|
|
121
123
|
}
|
|
122
124
|
function secretFrom(secretReference) {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
+
// eslint-disable-next-line prefer-const
|
|
126
|
+
let [vault, item, section, field] = secretReference
|
|
127
|
+
.replace(/^op:\/\//, '')
|
|
125
128
|
.split('/');
|
|
129
|
+
if (field === undefined) {
|
|
130
|
+
field = section;
|
|
131
|
+
section = '';
|
|
132
|
+
}
|
|
126
133
|
return { vault, item, section, field };
|
|
127
134
|
}
|
|
128
135
|
async function itemFrom(secret) {
|
|
@@ -152,14 +159,14 @@ export async function set({ key, value, file, ...rest }) {
|
|
|
152
159
|
const updated = {
|
|
153
160
|
...item,
|
|
154
161
|
fields: item.fields.map((field) => {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
field.sectionId
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
162
|
+
const section = item.sections.find((s) => s.id === field.sectionId);
|
|
163
|
+
if (secret.field === field.title || secret.field === field.id) {
|
|
164
|
+
if ((!secret.section &&
|
|
165
|
+
(field.sectionId === '' || field.sectionId === 'add more')) ||
|
|
166
|
+
secret.section === section?.title ||
|
|
167
|
+
secret.section === section?.id) {
|
|
168
|
+
return { ...field, value };
|
|
169
|
+
}
|
|
163
170
|
}
|
|
164
171
|
return field;
|
|
165
172
|
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qui-cli/env-1password",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.3",
|
|
4
4
|
"description": "@qui-cli Plugin: Standardized environment configuration",
|
|
5
5
|
"homepage": "https://github.com/battis/qui-cli/tree/main/packages/env-1password#readme",
|
|
6
6
|
"repository": {
|
|
@@ -28,9 +28,9 @@
|
|
|
28
28
|
"del-cli": "^6.0.0",
|
|
29
29
|
"npm-run-all": "^4.1.5",
|
|
30
30
|
"typescript": "^5.9.3",
|
|
31
|
-
"@qui-cli/colors": "3.1.1",
|
|
32
|
-
"@qui-cli/log": "4.0.1",
|
|
33
31
|
"@qui-cli/env": "5.0.2",
|
|
32
|
+
"@qui-cli/log": "4.0.1",
|
|
33
|
+
"@qui-cli/colors": "3.1.1",
|
|
34
34
|
"@qui-cli/plugin": "4.0.0",
|
|
35
35
|
"@qui-cli/root": "3.0.4",
|
|
36
36
|
"@qui-cli/shell": "3.0.3"
|