@1password/sdk 0.4.0-beta.1 → 0.4.0
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/client_builder.js +2 -4
- package/dist/configuration.d.ts +2 -2
- package/dist/configuration.js +1 -1
- package/dist/core.d.ts +5 -2
- package/dist/core.js +31 -19
- package/dist/errors.d.ts +4 -0
- package/dist/errors.js +10 -1
- package/dist/groups.d.ts +6 -0
- package/dist/groups.js +4 -1
- package/dist/items.d.ts +4 -4
- package/dist/items.js +10 -10
- package/dist/items_files.d.ts +8 -8
- package/dist/items_files.js +8 -8
- package/dist/items_shares.js +3 -3
- package/dist/sdk.d.ts +1 -1
- package/dist/sdk.js +2 -2
- package/dist/secrets.d.ts +4 -1
- package/dist/secrets.js +5 -2
- package/dist/shared_lib_core.js +42 -30
- package/dist/types.d.ts +44 -2
- package/dist/types.js +16 -2
- package/dist/vaults.d.ts +66 -6
- package/dist/vaults.js +130 -7
- package/dist/version.d.ts +2 -2
- package/dist/version.js +3 -3
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
|
|
19
19
|
To use the 1Password JavaScript SDK in your project:
|
|
20
20
|
|
|
21
|
-
1. [Create a service account](https://my.1password.com/developer-tools/infrastructure-secrets/serviceaccount
|
|
21
|
+
1. [Create a service account](https://my.1password.com/developer-tools/infrastructure-secrets/serviceaccount/?source=github-sdk) and give it the appropriate permissions in the vaults where the items you want to use with the SDK are saved.
|
|
22
22
|
2. Provision your service account token. We recommend provisioning your token from the environment. For example, to export your token to the `OP_SERVICE_ACCOUNT_TOKEN` environment variable:
|
|
23
23
|
|
|
24
24
|
**macOS or Linux**
|
package/dist/client_builder.js
CHANGED
|
@@ -10,6 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.createClientWithCore = void 0;
|
|
13
|
+
const core_js_1 = require("./core.js");
|
|
13
14
|
const configuration_js_1 = require("./configuration.js");
|
|
14
15
|
const client_js_1 = require("./client.js");
|
|
15
16
|
const shared_lib_core_js_1 = require("./shared_lib_core.js");
|
|
@@ -26,10 +27,7 @@ const createClientWithCore = (config, core) => __awaiter(void 0, void 0, void 0,
|
|
|
26
27
|
core.setInner(new shared_lib_core_js_1.SharedLibCore(authConfig.accountName));
|
|
27
28
|
}
|
|
28
29
|
const clientId = yield core.initClient(authConfig);
|
|
29
|
-
const inner =
|
|
30
|
-
id: parseInt(clientId, 10),
|
|
31
|
-
core,
|
|
32
|
-
};
|
|
30
|
+
const inner = new core_js_1.InnerClient(parseInt(clientId, 10), core, authConfig);
|
|
33
31
|
const client = new client_js_1.Client(inner);
|
|
34
32
|
// Cleans up associated memory from core when client instance goes out of scope.
|
|
35
33
|
finalizationRegistry.register(client, inner);
|
package/dist/configuration.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ClientAuthConfig } from "./core.js";
|
|
2
2
|
export declare const LANGUAGE = "JS";
|
|
3
|
-
export declare const VERSION = "
|
|
3
|
+
export declare const VERSION = "0040003";
|
|
4
4
|
export interface ClientConfiguration {
|
|
5
5
|
auth: Auth;
|
|
6
6
|
integrationName: string;
|
|
@@ -8,7 +8,7 @@ export interface ClientConfiguration {
|
|
|
8
8
|
}
|
|
9
9
|
type Auth = string | DesktopAuth;
|
|
10
10
|
/**
|
|
11
|
-
* Setting that specifies
|
|
11
|
+
* Setting that specifies a client should use the desktop app to authenticate. Set accountName to your 1Password account name as shown at the top left sidebar of the app, or your account UUID.
|
|
12
12
|
*/
|
|
13
13
|
export declare class DesktopAuth {
|
|
14
14
|
accountName: string;
|
package/dist/configuration.js
CHANGED
|
@@ -9,7 +9,7 @@ const version_js_1 = require("./version.js");
|
|
|
9
9
|
exports.LANGUAGE = "JS";
|
|
10
10
|
exports.VERSION = version_js_1.SDK_BUILD_NUMBER;
|
|
11
11
|
/**
|
|
12
|
-
* Setting that specifies
|
|
12
|
+
* Setting that specifies a client should use the desktop app to authenticate. Set accountName to your 1Password account name as shown at the top left sidebar of the app, or your account UUID.
|
|
13
13
|
*/
|
|
14
14
|
class DesktopAuth {
|
|
15
15
|
constructor(accountName) {
|
package/dist/core.d.ts
CHANGED
|
@@ -82,8 +82,11 @@ export declare class SharedCore {
|
|
|
82
82
|
/**
|
|
83
83
|
* Represents the client instance on which a call is made.
|
|
84
84
|
*/
|
|
85
|
-
export
|
|
85
|
+
export declare class InnerClient {
|
|
86
86
|
id: number;
|
|
87
|
-
core: SharedCore;
|
|
87
|
+
readonly core: SharedCore;
|
|
88
|
+
config: ClientAuthConfig;
|
|
89
|
+
constructor(id: number, core: SharedCore, config: ClientAuthConfig);
|
|
90
|
+
invoke(config: InvokeConfig): Promise<string>;
|
|
88
91
|
}
|
|
89
92
|
export {};
|
package/dist/core.js
CHANGED
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.SharedCore = exports.WasmCore = void 0;
|
|
12
|
+
exports.InnerClient = exports.SharedCore = exports.WasmCore = void 0;
|
|
13
13
|
const sdk_core_1 = require("@1password/sdk-core");
|
|
14
14
|
const types_1 = require("./types");
|
|
15
15
|
const errors_1 = require("./errors");
|
|
@@ -61,12 +61,7 @@ class SharedCore {
|
|
|
61
61
|
initClient(config) {
|
|
62
62
|
return __awaiter(this, void 0, void 0, function* () {
|
|
63
63
|
const serializedConfig = JSON.stringify(config);
|
|
64
|
-
|
|
65
|
-
return yield this.inner.initClient(serializedConfig);
|
|
66
|
-
}
|
|
67
|
-
catch (e) {
|
|
68
|
-
(0, errors_1.throwError)(e);
|
|
69
|
-
}
|
|
64
|
+
return this.inner.initClient(serializedConfig);
|
|
70
65
|
});
|
|
71
66
|
}
|
|
72
67
|
invoke(config) {
|
|
@@ -77,12 +72,7 @@ class SharedCore {
|
|
|
77
72
|
if (new TextEncoder().encode(serializedConfig).length > messageLimit) {
|
|
78
73
|
(0, errors_1.throwError)(`message size exceeds the limit of ${messageLimit} bytes, please contact 1Password at support@1password.com or https://developer.1password.com/joinslack if you need help."`);
|
|
79
74
|
}
|
|
80
|
-
|
|
81
|
-
return yield this.inner.invoke(serializedConfig);
|
|
82
|
-
}
|
|
83
|
-
catch (e) {
|
|
84
|
-
(0, errors_1.throwError)(e);
|
|
85
|
-
}
|
|
75
|
+
return this.inner.invoke(serializedConfig);
|
|
86
76
|
});
|
|
87
77
|
}
|
|
88
78
|
invoke_sync(config) {
|
|
@@ -92,12 +82,7 @@ class SharedCore {
|
|
|
92
82
|
if (new TextEncoder().encode(serializedConfig).length > messageLimit) {
|
|
93
83
|
(0, errors_1.throwError)(`message size exceeds the limit of ${messageLimit} bytes, please contact 1Password at support@1password.com or https://developer.1password.com/joinslack if you need help.`);
|
|
94
84
|
}
|
|
95
|
-
|
|
96
|
-
return (0, sdk_core_1.invoke_sync)(serializedConfig);
|
|
97
|
-
}
|
|
98
|
-
catch (e) {
|
|
99
|
-
(0, errors_1.throwError)(e);
|
|
100
|
-
}
|
|
85
|
+
return (0, sdk_core_1.invoke_sync)(serializedConfig);
|
|
101
86
|
}
|
|
102
87
|
releaseClient(clientId) {
|
|
103
88
|
const serializedId = JSON.stringify(clientId);
|
|
@@ -105,3 +90,30 @@ class SharedCore {
|
|
|
105
90
|
}
|
|
106
91
|
}
|
|
107
92
|
exports.SharedCore = SharedCore;
|
|
93
|
+
/**
|
|
94
|
+
* Represents the client instance on which a call is made.
|
|
95
|
+
*/
|
|
96
|
+
class InnerClient {
|
|
97
|
+
constructor(id, core, config) {
|
|
98
|
+
this.id = id;
|
|
99
|
+
this.core = core;
|
|
100
|
+
this.config = config;
|
|
101
|
+
}
|
|
102
|
+
invoke(config) {
|
|
103
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
104
|
+
try {
|
|
105
|
+
return yield this.core.invoke(config);
|
|
106
|
+
}
|
|
107
|
+
catch (err) {
|
|
108
|
+
if (err instanceof errors_1.DesktopSessionExpiredError) {
|
|
109
|
+
const newId = yield this.core.initClient(this.config);
|
|
110
|
+
this.id = parseInt(newId, 10);
|
|
111
|
+
config.invocation.clientId = this.id;
|
|
112
|
+
return yield this.core.invoke(config);
|
|
113
|
+
}
|
|
114
|
+
throw err;
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
exports.InnerClient = InnerClient;
|
package/dist/errors.d.ts
CHANGED
package/dist/errors.js
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// Code generated by op-codegen - DO NOT EDIT MANUALLY
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.throwError = exports.RateLimitExceededError = void 0;
|
|
4
|
+
exports.throwError = exports.RateLimitExceededError = exports.DesktopSessionExpiredError = void 0;
|
|
5
|
+
class DesktopSessionExpiredError extends Error {
|
|
6
|
+
constructor(message) {
|
|
7
|
+
super();
|
|
8
|
+
this.message = message;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.DesktopSessionExpiredError = DesktopSessionExpiredError;
|
|
5
12
|
class RateLimitExceededError extends Error {
|
|
6
13
|
constructor(message) {
|
|
7
14
|
super();
|
|
@@ -18,6 +25,8 @@ const throwError = (errString) => {
|
|
|
18
25
|
throw new Error(errString);
|
|
19
26
|
}
|
|
20
27
|
switch (err.name) {
|
|
28
|
+
case "DesktopSessionExpired":
|
|
29
|
+
throw new DesktopSessionExpiredError(err.message);
|
|
21
30
|
case "RateLimitExceeded":
|
|
22
31
|
throw new RateLimitExceededError(err.message);
|
|
23
32
|
default:
|
package/dist/groups.d.ts
CHANGED
|
@@ -4,10 +4,16 @@ import { Group, GroupGetParams } from "./types.js";
|
|
|
4
4
|
* The Groups API holds all the operations the SDK client can perform on 1Password groups.
|
|
5
5
|
*/
|
|
6
6
|
export interface GroupsApi {
|
|
7
|
+
/**
|
|
8
|
+
* Get a group by its ID and parameters.
|
|
9
|
+
*/
|
|
7
10
|
get(groupId: string, groupParams: GroupGetParams): Promise<Group>;
|
|
8
11
|
}
|
|
9
12
|
export declare class Groups implements GroupsApi {
|
|
10
13
|
#private;
|
|
11
14
|
constructor(inner: InnerClient);
|
|
15
|
+
/**
|
|
16
|
+
* Get a group by its ID and parameters.
|
|
17
|
+
*/
|
|
12
18
|
get(groupId: string, groupParams: GroupGetParams): Promise<Group>;
|
|
13
19
|
}
|
package/dist/groups.js
CHANGED
|
@@ -29,6 +29,9 @@ class Groups {
|
|
|
29
29
|
_Groups_inner.set(this, void 0);
|
|
30
30
|
__classPrivateFieldSet(this, _Groups_inner, inner, "f");
|
|
31
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Get a group by its ID and parameters.
|
|
34
|
+
*/
|
|
32
35
|
get(groupId, groupParams) {
|
|
33
36
|
return __awaiter(this, void 0, void 0, function* () {
|
|
34
37
|
const invocationConfig = {
|
|
@@ -43,7 +46,7 @@ class Groups {
|
|
|
43
46
|
},
|
|
44
47
|
},
|
|
45
48
|
};
|
|
46
|
-
return JSON.parse(yield __classPrivateFieldGet(this, _Groups_inner, "f").
|
|
49
|
+
return JSON.parse(yield __classPrivateFieldGet(this, _Groups_inner, "f").invoke(invocationConfig), types_js_1.ReviverFunc);
|
|
47
50
|
});
|
|
48
51
|
}
|
|
49
52
|
}
|
package/dist/items.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ export interface ItemsApi {
|
|
|
17
17
|
*/
|
|
18
18
|
createAll(vaultId: string, params: ItemCreateParams[]): Promise<ItemsUpdateAllResponse>;
|
|
19
19
|
/**
|
|
20
|
-
* Get an item by vault and item ID
|
|
20
|
+
* Get an item by vault and item ID.
|
|
21
21
|
*/
|
|
22
22
|
get(vaultId: string, itemId: string): Promise<Item>;
|
|
23
23
|
/**
|
|
@@ -31,7 +31,7 @@ export interface ItemsApi {
|
|
|
31
31
|
/**
|
|
32
32
|
* Delete an item.
|
|
33
33
|
*/
|
|
34
|
-
delete(vaultId: string, itemId: string):
|
|
34
|
+
delete(vaultId: string, itemId: string): Promise<void>;
|
|
35
35
|
/**
|
|
36
36
|
* Delete items in batch, within a single vault.
|
|
37
37
|
*/
|
|
@@ -39,7 +39,7 @@ export interface ItemsApi {
|
|
|
39
39
|
/**
|
|
40
40
|
* Archive an item.
|
|
41
41
|
*/
|
|
42
|
-
archive(vaultId: string, itemId: string):
|
|
42
|
+
archive(vaultId: string, itemId: string): Promise<void>;
|
|
43
43
|
/**
|
|
44
44
|
* List items based on filters.
|
|
45
45
|
*/
|
|
@@ -59,7 +59,7 @@ export declare class Items implements ItemsApi {
|
|
|
59
59
|
*/
|
|
60
60
|
createAll(vaultId: string, params: ItemCreateParams[]): Promise<ItemsUpdateAllResponse>;
|
|
61
61
|
/**
|
|
62
|
-
* Get an item by vault and item ID
|
|
62
|
+
* Get an item by vault and item ID.
|
|
63
63
|
*/
|
|
64
64
|
get(vaultId: string, itemId: string): Promise<Item>;
|
|
65
65
|
/**
|
package/dist/items.js
CHANGED
|
@@ -49,7 +49,7 @@ class Items {
|
|
|
49
49
|
},
|
|
50
50
|
},
|
|
51
51
|
};
|
|
52
|
-
return JSON.parse(yield __classPrivateFieldGet(this, _Items_inner, "f").
|
|
52
|
+
return JSON.parse(yield __classPrivateFieldGet(this, _Items_inner, "f").invoke(invocationConfig), types_js_1.ReviverFunc);
|
|
53
53
|
});
|
|
54
54
|
}
|
|
55
55
|
/**
|
|
@@ -69,11 +69,11 @@ class Items {
|
|
|
69
69
|
},
|
|
70
70
|
},
|
|
71
71
|
};
|
|
72
|
-
return JSON.parse(yield __classPrivateFieldGet(this, _Items_inner, "f").
|
|
72
|
+
return JSON.parse(yield __classPrivateFieldGet(this, _Items_inner, "f").invoke(invocationConfig), types_js_1.ReviverFunc);
|
|
73
73
|
});
|
|
74
74
|
}
|
|
75
75
|
/**
|
|
76
|
-
* Get an item by vault and item ID
|
|
76
|
+
* Get an item by vault and item ID.
|
|
77
77
|
*/
|
|
78
78
|
get(vaultId, itemId) {
|
|
79
79
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -89,7 +89,7 @@ class Items {
|
|
|
89
89
|
},
|
|
90
90
|
},
|
|
91
91
|
};
|
|
92
|
-
return JSON.parse(yield __classPrivateFieldGet(this, _Items_inner, "f").
|
|
92
|
+
return JSON.parse(yield __classPrivateFieldGet(this, _Items_inner, "f").invoke(invocationConfig), types_js_1.ReviverFunc);
|
|
93
93
|
});
|
|
94
94
|
}
|
|
95
95
|
/**
|
|
@@ -109,7 +109,7 @@ class Items {
|
|
|
109
109
|
},
|
|
110
110
|
},
|
|
111
111
|
};
|
|
112
|
-
return JSON.parse(yield __classPrivateFieldGet(this, _Items_inner, "f").
|
|
112
|
+
return JSON.parse(yield __classPrivateFieldGet(this, _Items_inner, "f").invoke(invocationConfig), types_js_1.ReviverFunc);
|
|
113
113
|
});
|
|
114
114
|
}
|
|
115
115
|
/**
|
|
@@ -128,7 +128,7 @@ class Items {
|
|
|
128
128
|
},
|
|
129
129
|
},
|
|
130
130
|
};
|
|
131
|
-
return JSON.parse(yield __classPrivateFieldGet(this, _Items_inner, "f").
|
|
131
|
+
return JSON.parse(yield __classPrivateFieldGet(this, _Items_inner, "f").invoke(invocationConfig), types_js_1.ReviverFunc);
|
|
132
132
|
});
|
|
133
133
|
}
|
|
134
134
|
/**
|
|
@@ -148,7 +148,7 @@ class Items {
|
|
|
148
148
|
},
|
|
149
149
|
},
|
|
150
150
|
};
|
|
151
|
-
yield __classPrivateFieldGet(this, _Items_inner, "f").
|
|
151
|
+
yield __classPrivateFieldGet(this, _Items_inner, "f").invoke(invocationConfig);
|
|
152
152
|
});
|
|
153
153
|
}
|
|
154
154
|
/**
|
|
@@ -168,7 +168,7 @@ class Items {
|
|
|
168
168
|
},
|
|
169
169
|
},
|
|
170
170
|
};
|
|
171
|
-
return JSON.parse(yield __classPrivateFieldGet(this, _Items_inner, "f").
|
|
171
|
+
return JSON.parse(yield __classPrivateFieldGet(this, _Items_inner, "f").invoke(invocationConfig), types_js_1.ReviverFunc);
|
|
172
172
|
});
|
|
173
173
|
}
|
|
174
174
|
/**
|
|
@@ -188,7 +188,7 @@ class Items {
|
|
|
188
188
|
},
|
|
189
189
|
},
|
|
190
190
|
};
|
|
191
|
-
yield __classPrivateFieldGet(this, _Items_inner, "f").
|
|
191
|
+
yield __classPrivateFieldGet(this, _Items_inner, "f").invoke(invocationConfig);
|
|
192
192
|
});
|
|
193
193
|
}
|
|
194
194
|
/**
|
|
@@ -208,7 +208,7 @@ class Items {
|
|
|
208
208
|
},
|
|
209
209
|
},
|
|
210
210
|
};
|
|
211
|
-
return JSON.parse(yield __classPrivateFieldGet(this, _Items_inner, "f").
|
|
211
|
+
return JSON.parse(yield __classPrivateFieldGet(this, _Items_inner, "f").invoke(invocationConfig), types_js_1.ReviverFunc);
|
|
212
212
|
});
|
|
213
213
|
}
|
|
214
214
|
}
|
package/dist/items_files.d.ts
CHANGED
|
@@ -2,19 +2,19 @@ import { InnerClient } from "./core.js";
|
|
|
2
2
|
import { DocumentCreateParams, FileAttributes, FileCreateParams, Item } from "./types.js";
|
|
3
3
|
export interface ItemsFilesApi {
|
|
4
4
|
/**
|
|
5
|
-
* Attach files to Items
|
|
5
|
+
* Attach files to Items.
|
|
6
6
|
*/
|
|
7
7
|
attach(item: Item, fileParams: FileCreateParams): Promise<Item>;
|
|
8
8
|
/**
|
|
9
|
-
* Read file content from the Item
|
|
9
|
+
* Read file content from the Item.
|
|
10
10
|
*/
|
|
11
11
|
read(vaultId: string, itemId: string, attr: FileAttributes): Promise<Uint8Array>;
|
|
12
12
|
/**
|
|
13
|
-
* Delete a field file from Item using the section and field IDs
|
|
13
|
+
* Delete a field file from Item using the section and field IDs.
|
|
14
14
|
*/
|
|
15
15
|
delete(item: Item, sectionId: string, fieldId: string): Promise<Item>;
|
|
16
16
|
/**
|
|
17
|
-
* Replace the document file within a document item
|
|
17
|
+
* Replace the document file within a document item.
|
|
18
18
|
*/
|
|
19
19
|
replaceDocument(item: Item, docParams: DocumentCreateParams): Promise<Item>;
|
|
20
20
|
}
|
|
@@ -22,19 +22,19 @@ export declare class ItemsFiles implements ItemsFilesApi {
|
|
|
22
22
|
#private;
|
|
23
23
|
constructor(inner: InnerClient);
|
|
24
24
|
/**
|
|
25
|
-
* Attach files to Items
|
|
25
|
+
* Attach files to Items.
|
|
26
26
|
*/
|
|
27
27
|
attach(item: Item, fileParams: FileCreateParams): Promise<Item>;
|
|
28
28
|
/**
|
|
29
|
-
* Read file content from the Item
|
|
29
|
+
* Read file content from the Item.
|
|
30
30
|
*/
|
|
31
31
|
read(vaultId: string, itemId: string, attr: FileAttributes): Promise<Uint8Array>;
|
|
32
32
|
/**
|
|
33
|
-
* Delete a field file from Item using the section and field IDs
|
|
33
|
+
* Delete a field file from Item using the section and field IDs.
|
|
34
34
|
*/
|
|
35
35
|
delete(item: Item, sectionId: string, fieldId: string): Promise<Item>;
|
|
36
36
|
/**
|
|
37
|
-
* Replace the document file within a document item
|
|
37
|
+
* Replace the document file within a document item.
|
|
38
38
|
*/
|
|
39
39
|
replaceDocument(item: Item, docParams: DocumentCreateParams): Promise<Item>;
|
|
40
40
|
}
|
package/dist/items_files.js
CHANGED
|
@@ -30,7 +30,7 @@ class ItemsFiles {
|
|
|
30
30
|
__classPrivateFieldSet(this, _ItemsFiles_inner, inner, "f");
|
|
31
31
|
}
|
|
32
32
|
/**
|
|
33
|
-
* Attach files to Items
|
|
33
|
+
* Attach files to Items.
|
|
34
34
|
*/
|
|
35
35
|
attach(item, fileParams) {
|
|
36
36
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -46,11 +46,11 @@ class ItemsFiles {
|
|
|
46
46
|
},
|
|
47
47
|
},
|
|
48
48
|
};
|
|
49
|
-
return JSON.parse(yield __classPrivateFieldGet(this, _ItemsFiles_inner, "f").
|
|
49
|
+
return JSON.parse(yield __classPrivateFieldGet(this, _ItemsFiles_inner, "f").invoke(invocationConfig), types_js_1.ReviverFunc);
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
52
|
/**
|
|
53
|
-
* Read file content from the Item
|
|
53
|
+
* Read file content from the Item.
|
|
54
54
|
*/
|
|
55
55
|
read(vaultId, itemId, attr) {
|
|
56
56
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -67,11 +67,11 @@ class ItemsFiles {
|
|
|
67
67
|
},
|
|
68
68
|
},
|
|
69
69
|
};
|
|
70
|
-
return JSON.parse(yield __classPrivateFieldGet(this, _ItemsFiles_inner, "f").
|
|
70
|
+
return JSON.parse(yield __classPrivateFieldGet(this, _ItemsFiles_inner, "f").invoke(invocationConfig), types_js_1.ReviverFunc);
|
|
71
71
|
});
|
|
72
72
|
}
|
|
73
73
|
/**
|
|
74
|
-
* Delete a field file from Item using the section and field IDs
|
|
74
|
+
* Delete a field file from Item using the section and field IDs.
|
|
75
75
|
*/
|
|
76
76
|
delete(item, sectionId, fieldId) {
|
|
77
77
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -88,11 +88,11 @@ class ItemsFiles {
|
|
|
88
88
|
},
|
|
89
89
|
},
|
|
90
90
|
};
|
|
91
|
-
return JSON.parse(yield __classPrivateFieldGet(this, _ItemsFiles_inner, "f").
|
|
91
|
+
return JSON.parse(yield __classPrivateFieldGet(this, _ItemsFiles_inner, "f").invoke(invocationConfig), types_js_1.ReviverFunc);
|
|
92
92
|
});
|
|
93
93
|
}
|
|
94
94
|
/**
|
|
95
|
-
* Replace the document file within a document item
|
|
95
|
+
* Replace the document file within a document item.
|
|
96
96
|
*/
|
|
97
97
|
replaceDocument(item, docParams) {
|
|
98
98
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -108,7 +108,7 @@ class ItemsFiles {
|
|
|
108
108
|
},
|
|
109
109
|
},
|
|
110
110
|
};
|
|
111
|
-
return JSON.parse(yield __classPrivateFieldGet(this, _ItemsFiles_inner, "f").
|
|
111
|
+
return JSON.parse(yield __classPrivateFieldGet(this, _ItemsFiles_inner, "f").invoke(invocationConfig), types_js_1.ReviverFunc);
|
|
112
112
|
});
|
|
113
113
|
}
|
|
114
114
|
}
|
package/dist/items_shares.js
CHANGED
|
@@ -46,7 +46,7 @@ class ItemsShares {
|
|
|
46
46
|
},
|
|
47
47
|
},
|
|
48
48
|
};
|
|
49
|
-
return JSON.parse(yield __classPrivateFieldGet(this, _ItemsShares_inner, "f").
|
|
49
|
+
return JSON.parse(yield __classPrivateFieldGet(this, _ItemsShares_inner, "f").invoke(invocationConfig), types_js_1.ReviverFunc);
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
52
|
/**
|
|
@@ -66,7 +66,7 @@ class ItemsShares {
|
|
|
66
66
|
},
|
|
67
67
|
},
|
|
68
68
|
};
|
|
69
|
-
return JSON.parse(yield __classPrivateFieldGet(this, _ItemsShares_inner, "f").
|
|
69
|
+
return JSON.parse(yield __classPrivateFieldGet(this, _ItemsShares_inner, "f").invoke(invocationConfig), types_js_1.ReviverFunc);
|
|
70
70
|
});
|
|
71
71
|
}
|
|
72
72
|
/**
|
|
@@ -87,7 +87,7 @@ class ItemsShares {
|
|
|
87
87
|
},
|
|
88
88
|
},
|
|
89
89
|
};
|
|
90
|
-
return JSON.parse(yield __classPrivateFieldGet(this, _ItemsShares_inner, "f").
|
|
90
|
+
return JSON.parse(yield __classPrivateFieldGet(this, _ItemsShares_inner, "f").invoke(invocationConfig), types_js_1.ReviverFunc);
|
|
91
91
|
});
|
|
92
92
|
}
|
|
93
93
|
}
|
package/dist/sdk.d.ts
CHANGED
|
@@ -3,10 +3,10 @@ import { Client } from "./client.js";
|
|
|
3
3
|
export declare const DEFAULT_INTEGRATION_NAME = "Unknown";
|
|
4
4
|
export declare const DEFAULT_INTEGRATION_VERSION = "Unknown";
|
|
5
5
|
export { Secrets } from "./secrets.js";
|
|
6
|
+
export { DesktopAuth } from "./configuration.js";
|
|
6
7
|
export * from "./client.js";
|
|
7
8
|
export * from "./errors.js";
|
|
8
9
|
export * from "./types.js";
|
|
9
|
-
export { DesktopAuth } from "./configuration.js";
|
|
10
10
|
/**
|
|
11
11
|
* Creates a default 1Password SDK client.
|
|
12
12
|
* @returns The authenticated 1Password SDK client.
|
package/dist/sdk.js
CHANGED
|
@@ -32,11 +32,11 @@ exports.DEFAULT_INTEGRATION_VERSION = "Unknown";
|
|
|
32
32
|
// auto-generated static exports
|
|
33
33
|
var secrets_js_1 = require("./secrets.js");
|
|
34
34
|
Object.defineProperty(exports, "Secrets", { enumerable: true, get: function () { return secrets_js_1.Secrets; } });
|
|
35
|
+
var configuration_js_1 = require("./configuration.js");
|
|
36
|
+
Object.defineProperty(exports, "DesktopAuth", { enumerable: true, get: function () { return configuration_js_1.DesktopAuth; } });
|
|
35
37
|
__exportStar(require("./client.js"), exports);
|
|
36
38
|
__exportStar(require("./errors.js"), exports);
|
|
37
39
|
__exportStar(require("./types.js"), exports);
|
|
38
|
-
var configuration_js_1 = require("./configuration.js");
|
|
39
|
-
Object.defineProperty(exports, "DesktopAuth", { enumerable: true, get: function () { return configuration_js_1.DesktopAuth; } });
|
|
40
40
|
/**
|
|
41
41
|
* Creates a default 1Password SDK client.
|
|
42
42
|
* @returns The authenticated 1Password SDK client.
|
package/dist/secrets.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { InnerClient } from "./core.js";
|
|
|
2
2
|
import { GeneratePasswordResponse, PasswordRecipe, ResolveAllResponse } from "./types.js";
|
|
3
3
|
/**
|
|
4
4
|
* The Secrets API includes all operations the SDK client can perform on secrets.
|
|
5
|
-
* Use secret reference URIs to securely load secrets from 1Password: op://<vault-name>/<item-name>[/<section-name>]/<field-name
|
|
5
|
+
* Use secret reference URIs to securely load secrets from 1Password: `op://<vault-name>/<item-name>[/<section-name>]/<field-name>`
|
|
6
6
|
*/
|
|
7
7
|
export interface SecretsApi {
|
|
8
8
|
/**
|
|
@@ -29,5 +29,8 @@ export declare class Secrets implements SecretsApi {
|
|
|
29
29
|
* Validate the secret reference to ensure there are no syntax errors.
|
|
30
30
|
*/
|
|
31
31
|
static validateSecretReference(secretReference: string): void;
|
|
32
|
+
/**
|
|
33
|
+
* Generate a password using the provided recipe.
|
|
34
|
+
*/
|
|
32
35
|
static generatePassword(recipe: PasswordRecipe): GeneratePasswordResponse;
|
|
33
36
|
}
|
package/dist/secrets.js
CHANGED
|
@@ -46,7 +46,7 @@ class Secrets {
|
|
|
46
46
|
},
|
|
47
47
|
},
|
|
48
48
|
};
|
|
49
|
-
return JSON.parse(yield __classPrivateFieldGet(this, _Secrets_inner, "f").
|
|
49
|
+
return JSON.parse(yield __classPrivateFieldGet(this, _Secrets_inner, "f").invoke(invocationConfig), types_js_1.ReviverFunc);
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
52
|
/**
|
|
@@ -65,7 +65,7 @@ class Secrets {
|
|
|
65
65
|
},
|
|
66
66
|
},
|
|
67
67
|
};
|
|
68
|
-
return JSON.parse(yield __classPrivateFieldGet(this, _Secrets_inner, "f").
|
|
68
|
+
return JSON.parse(yield __classPrivateFieldGet(this, _Secrets_inner, "f").invoke(invocationConfig), types_js_1.ReviverFunc);
|
|
69
69
|
});
|
|
70
70
|
}
|
|
71
71
|
/**
|
|
@@ -85,6 +85,9 @@ class Secrets {
|
|
|
85
85
|
};
|
|
86
86
|
sharedCore.invoke_sync(invocationConfig);
|
|
87
87
|
}
|
|
88
|
+
/**
|
|
89
|
+
* Generate a password using the provided recipe.
|
|
90
|
+
*/
|
|
88
91
|
static generatePassword(recipe) {
|
|
89
92
|
const sharedCore = new core_js_1.SharedCore();
|
|
90
93
|
const invocationConfig = {
|
package/dist/shared_lib_core.js
CHANGED
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
36
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
37
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -36,6 +46,7 @@ exports.SharedLibCore = void 0;
|
|
|
36
46
|
const fs = __importStar(require("fs"));
|
|
37
47
|
const os = __importStar(require("os"));
|
|
38
48
|
const path = __importStar(require("path"));
|
|
49
|
+
const errors_1 = require("./errors");
|
|
39
50
|
/**
|
|
40
51
|
* Find the 1Password shared lib path by asking an the wasm core synchronously.
|
|
41
52
|
*/
|
|
@@ -58,6 +69,14 @@ const find1PasswordLibPath = () => {
|
|
|
58
69
|
"/snap/bin/1password/libop_sdk_ipc_client.so",
|
|
59
70
|
];
|
|
60
71
|
break;
|
|
72
|
+
case "win32": // Windows
|
|
73
|
+
searchPaths = [
|
|
74
|
+
path.join(os.homedir(), "/AppData/Local/1Password/op_sdk_ipc_client.dll"),
|
|
75
|
+
"C:/Program Files/1Password/app/8/op_sdk_ipc_client.dll",
|
|
76
|
+
"C:/Program Files (x86)/1Password/app/8/op_sdk_ipc_client.dll",
|
|
77
|
+
path.join(os.homedir(), "/AppData/Local/1Password/app/8/op_sdk_ipc_client.dll"),
|
|
78
|
+
];
|
|
79
|
+
break;
|
|
61
80
|
default:
|
|
62
81
|
throw new Error(`Unsupported platform: ${platform}`);
|
|
63
82
|
}
|
|
@@ -118,30 +137,23 @@ class SharedLibCore {
|
|
|
118
137
|
payload: inputEncoded,
|
|
119
138
|
};
|
|
120
139
|
const inputBuf = Buffer.from(JSON.stringify(req), "utf8");
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
return decodedPayload;
|
|
132
|
-
}
|
|
133
|
-
else {
|
|
134
|
-
// On failure, convert the error payload to a readable string and throw
|
|
135
|
-
const errorMessage = Array.isArray(response.payload)
|
|
136
|
-
? String.fromCharCode(...response.payload)
|
|
137
|
-
: JSON.stringify(response.payload);
|
|
138
|
-
throw new Error(`Native library returned an error: ${errorMessage}`);
|
|
139
|
-
}
|
|
140
|
+
const nativeResponse = yield this.lib.sendMessage(inputBuf);
|
|
141
|
+
if (!(nativeResponse instanceof Uint8Array)) {
|
|
142
|
+
throw new Error(`Native function returned an unexpected type. Expected Uint8Array, got ${typeof nativeResponse}`);
|
|
143
|
+
}
|
|
144
|
+
const respString = new TextDecoder().decode(nativeResponse);
|
|
145
|
+
const response = JSON.parse(respString);
|
|
146
|
+
if (response.success) {
|
|
147
|
+
const decodedPayload = Buffer.from(response.payload).toString("utf8");
|
|
148
|
+
// On success, the payload is the actual result string
|
|
149
|
+
return decodedPayload;
|
|
140
150
|
}
|
|
141
|
-
|
|
142
|
-
//
|
|
143
|
-
|
|
144
|
-
|
|
151
|
+
else {
|
|
152
|
+
// On failure, convert the error payload to a readable string and throw
|
|
153
|
+
const errorMessage = Array.isArray(response.payload)
|
|
154
|
+
? String.fromCharCode(...response.payload)
|
|
155
|
+
: JSON.stringify(response.payload);
|
|
156
|
+
(0, errors_1.throwError)(errorMessage);
|
|
145
157
|
}
|
|
146
158
|
});
|
|
147
159
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -114,9 +114,28 @@ export interface Group {
|
|
|
114
114
|
state: GroupState;
|
|
115
115
|
vaultAccess?: VaultAccess[];
|
|
116
116
|
}
|
|
117
|
+
/**
|
|
118
|
+
* Represents a group's access to a 1Password vault.
|
|
119
|
+
* This is used for granting permissions
|
|
120
|
+
*/
|
|
121
|
+
export interface GroupAccess {
|
|
122
|
+
/** The group's ID */
|
|
123
|
+
groupId: string;
|
|
124
|
+
/** The group's set of permissions for the vault */
|
|
125
|
+
permissions: number;
|
|
126
|
+
}
|
|
117
127
|
export interface GroupGetParams {
|
|
118
128
|
vaultPermissions?: boolean;
|
|
119
129
|
}
|
|
130
|
+
/** Represents a group's access to a 1Password vault. */
|
|
131
|
+
export interface GroupVaultAccess {
|
|
132
|
+
/** The vault's ID */
|
|
133
|
+
vaultId: string;
|
|
134
|
+
/** The group's ID */
|
|
135
|
+
groupId: string;
|
|
136
|
+
/** The group's set of permissions for the vault */
|
|
137
|
+
permissions: number;
|
|
138
|
+
}
|
|
120
139
|
export declare enum ItemCategory {
|
|
121
140
|
Login = "Login",
|
|
122
141
|
SecureNote = "SecureNote",
|
|
@@ -203,7 +222,7 @@ export interface ItemSection {
|
|
|
203
222
|
* Controls the auto-fill behavior of a website.
|
|
204
223
|
*
|
|
205
224
|
*
|
|
206
|
-
* For more information, visit https://support.1password.com/autofill-behavior
|
|
225
|
+
* For more information, visit <https://support.1password.com/autofill-behavior/>
|
|
207
226
|
*/
|
|
208
227
|
export declare enum AutofillBehavior {
|
|
209
228
|
/** Auto-fill any page that’s part of the website, including subdomains */
|
|
@@ -221,7 +240,7 @@ export interface Website {
|
|
|
221
240
|
/**
|
|
222
241
|
* The auto-fill behavior of the website
|
|
223
242
|
*
|
|
224
|
-
* For more information, visit https://support.1password.com/autofill-behavior
|
|
243
|
+
* For more information, visit <https://support.1password.com/autofill-behavior/>
|
|
225
244
|
*/
|
|
226
245
|
autofillBehavior: AutofillBehavior;
|
|
227
246
|
}
|
|
@@ -591,6 +610,11 @@ export interface Vault {
|
|
|
591
610
|
/** The access information associated with the vault. */
|
|
592
611
|
access?: VaultAccess[];
|
|
593
612
|
}
|
|
613
|
+
export interface VaultCreateParams {
|
|
614
|
+
title: string;
|
|
615
|
+
description?: string;
|
|
616
|
+
allowAdminsAccess?: boolean;
|
|
617
|
+
}
|
|
594
618
|
/** Represents the possible query parameters used for retrieving extra information about a vault. */
|
|
595
619
|
export interface VaultGetParams {
|
|
596
620
|
/** The vault's accessor params. */
|
|
@@ -620,6 +644,10 @@ export interface VaultOverview {
|
|
|
620
644
|
/** The time the vault was updated at */
|
|
621
645
|
updatedAt: Date;
|
|
622
646
|
}
|
|
647
|
+
export interface VaultUpdateParams {
|
|
648
|
+
title?: string;
|
|
649
|
+
description?: string;
|
|
650
|
+
}
|
|
623
651
|
export type ItemListFilter = {
|
|
624
652
|
type: "ByState";
|
|
625
653
|
content: {
|
|
@@ -703,6 +731,20 @@ export declare enum WordListType {
|
|
|
703
731
|
/** Three (random) letter "words" */
|
|
704
732
|
ThreeLetters = "threeLetters"
|
|
705
733
|
}
|
|
734
|
+
export declare const ARCHIVE_ITEMS: number;
|
|
735
|
+
export declare const CREATE_ITEMS: number;
|
|
736
|
+
export declare const DELETE_ITEMS: number;
|
|
737
|
+
export declare const EXPORT_ITEMS: number;
|
|
738
|
+
export declare const IMPORT_ITEMS: number;
|
|
739
|
+
export declare const MANAGE_VAULT: number;
|
|
740
|
+
export declare const NO_ACCESS: number;
|
|
741
|
+
export declare const PRINT_ITEMS: number;
|
|
742
|
+
export declare const READ_ITEMS: number;
|
|
743
|
+
export declare const RECOVER_VAULT: number;
|
|
744
|
+
export declare const REVEAL_ITEM_PASSWORD: number;
|
|
745
|
+
export declare const SEND_ITEMS: number;
|
|
746
|
+
export declare const UPDATE_ITEMS: number;
|
|
747
|
+
export declare const UPDATE_ITEM_HISTORY: number;
|
|
706
748
|
/**
|
|
707
749
|
* Custom JSON reviver and replacer functions for dynamic data transformation
|
|
708
750
|
* ReviverFunc is used during JSON parsing to detect and transform specific data structures
|
package/dist/types.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Generated by typeshare 1.13.2
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.ReplacerFunc = exports.ReviverFunc = exports.WordListType = exports.SeparatorType = exports.VaultType = exports.AllowedRecipientType = exports.AllowedType = exports.ItemShareDuration = exports.ItemState = exports.AutofillBehavior = exports.ItemFieldType = exports.ItemCategory = exports.VaultAccessorType = exports.GroupState = exports.GroupType = void 0;
|
|
6
|
+
exports.ReplacerFunc = exports.ReviverFunc = exports.UPDATE_ITEM_HISTORY = exports.UPDATE_ITEMS = exports.SEND_ITEMS = exports.REVEAL_ITEM_PASSWORD = exports.RECOVER_VAULT = exports.READ_ITEMS = exports.PRINT_ITEMS = exports.NO_ACCESS = exports.MANAGE_VAULT = exports.IMPORT_ITEMS = exports.EXPORT_ITEMS = exports.DELETE_ITEMS = exports.CREATE_ITEMS = exports.ARCHIVE_ITEMS = exports.WordListType = exports.SeparatorType = exports.VaultType = exports.AllowedRecipientType = exports.AllowedType = exports.ItemShareDuration = exports.ItemState = exports.AutofillBehavior = exports.ItemFieldType = exports.ItemCategory = exports.VaultAccessorType = exports.GroupState = exports.GroupType = void 0;
|
|
7
7
|
var GroupType;
|
|
8
8
|
(function (GroupType) {
|
|
9
9
|
/**
|
|
@@ -107,7 +107,7 @@ var ItemFieldType;
|
|
|
107
107
|
* Controls the auto-fill behavior of a website.
|
|
108
108
|
*
|
|
109
109
|
*
|
|
110
|
-
* For more information, visit https://support.1password.com/autofill-behavior
|
|
110
|
+
* For more information, visit <https://support.1password.com/autofill-behavior/>
|
|
111
111
|
*/
|
|
112
112
|
var AutofillBehavior;
|
|
113
113
|
(function (AutofillBehavior) {
|
|
@@ -214,6 +214,20 @@ var WordListType;
|
|
|
214
214
|
/** Three (random) letter "words" */
|
|
215
215
|
WordListType["ThreeLetters"] = "threeLetters";
|
|
216
216
|
})(WordListType || (exports.WordListType = WordListType = {}));
|
|
217
|
+
exports.ARCHIVE_ITEMS = 256;
|
|
218
|
+
exports.CREATE_ITEMS = 128;
|
|
219
|
+
exports.DELETE_ITEMS = 512;
|
|
220
|
+
exports.EXPORT_ITEMS = 4194304;
|
|
221
|
+
exports.IMPORT_ITEMS = 2097152;
|
|
222
|
+
exports.MANAGE_VAULT = 2;
|
|
223
|
+
exports.NO_ACCESS = 0;
|
|
224
|
+
exports.PRINT_ITEMS = 8388608;
|
|
225
|
+
exports.READ_ITEMS = 32;
|
|
226
|
+
exports.RECOVER_VAULT = 1;
|
|
227
|
+
exports.REVEAL_ITEM_PASSWORD = 16;
|
|
228
|
+
exports.SEND_ITEMS = 1048576;
|
|
229
|
+
exports.UPDATE_ITEMS = 64;
|
|
230
|
+
exports.UPDATE_ITEM_HISTORY = 1024;
|
|
217
231
|
/**
|
|
218
232
|
* Custom JSON reviver and replacer functions for dynamic data transformation
|
|
219
233
|
* ReviverFunc is used during JSON parsing to detect and transform specific data structures
|
package/dist/vaults.d.ts
CHANGED
|
@@ -1,23 +1,83 @@
|
|
|
1
1
|
import { InnerClient } from "./core.js";
|
|
2
|
-
import { Vault, VaultGetParams, VaultListParams, VaultOverview } from "./types.js";
|
|
2
|
+
import { GroupAccess, GroupVaultAccess, Vault, VaultCreateParams, VaultGetParams, VaultListParams, VaultOverview, VaultUpdateParams } from "./types.js";
|
|
3
3
|
/**
|
|
4
4
|
* The Vaults API holds all the operations the SDK client can perform on 1Password vaults.
|
|
5
5
|
*/
|
|
6
6
|
export interface VaultsApi {
|
|
7
|
+
/**
|
|
8
|
+
* Create a new user vault.
|
|
9
|
+
*/
|
|
10
|
+
create(params: VaultCreateParams): Promise<Vault>;
|
|
7
11
|
/**
|
|
8
12
|
* List information about vaults that's configurable based on some input parameters.
|
|
9
13
|
*/
|
|
10
14
|
list(params?: VaultListParams): Promise<VaultOverview[]>;
|
|
11
|
-
|
|
12
|
-
|
|
15
|
+
/**
|
|
16
|
+
* Get an overview of a vault by its ID.
|
|
17
|
+
*/
|
|
18
|
+
getOverview(vaultId: string): Promise<VaultOverview>;
|
|
19
|
+
/**
|
|
20
|
+
* Get detailed vault information by vault ID and parameters.
|
|
21
|
+
*/
|
|
22
|
+
get(vaultId: string, vaultParams: VaultGetParams): Promise<Vault>;
|
|
23
|
+
/**
|
|
24
|
+
* Update a vault
|
|
25
|
+
*/
|
|
26
|
+
update(vaultId: string, params: VaultUpdateParams): Promise<Vault>;
|
|
27
|
+
/**
|
|
28
|
+
* Delete a vault by its ID.
|
|
29
|
+
*/
|
|
30
|
+
delete(vaultId: string): Promise<void>;
|
|
31
|
+
/**
|
|
32
|
+
* Grant group permissions to a vault.
|
|
33
|
+
*/
|
|
34
|
+
grantGroupPermissions(vaultId: string, groupPermissionsList: GroupAccess[]): Promise<void>;
|
|
35
|
+
/**
|
|
36
|
+
* Update group permissions for vaults.
|
|
37
|
+
*/
|
|
38
|
+
updateGroupPermissions(groupPermissionsList: GroupVaultAccess[]): Promise<void>;
|
|
39
|
+
/**
|
|
40
|
+
* Revoke group permissions from a vault.
|
|
41
|
+
*/
|
|
42
|
+
revokeGroupPermissions(vaultId: string, groupId: string): Promise<void>;
|
|
13
43
|
}
|
|
14
44
|
export declare class Vaults implements VaultsApi {
|
|
15
45
|
#private;
|
|
16
46
|
constructor(inner: InnerClient);
|
|
47
|
+
/**
|
|
48
|
+
* Create a new user vault.
|
|
49
|
+
*/
|
|
50
|
+
create(params: VaultCreateParams): Promise<Vault>;
|
|
17
51
|
/**
|
|
18
52
|
* List information about vaults that's configurable based on some input parameters.
|
|
19
53
|
*/
|
|
20
|
-
list(params
|
|
21
|
-
|
|
22
|
-
|
|
54
|
+
list(params?: VaultListParams): Promise<VaultOverview[]>;
|
|
55
|
+
/**
|
|
56
|
+
* Get an overview of a vault by its ID.
|
|
57
|
+
*/
|
|
58
|
+
getOverview(vaultId: string): Promise<VaultOverview>;
|
|
59
|
+
/**
|
|
60
|
+
* Get detailed vault information by vault ID and parameters.
|
|
61
|
+
*/
|
|
62
|
+
get(vaultId: string, vaultParams: VaultGetParams): Promise<Vault>;
|
|
63
|
+
/**
|
|
64
|
+
* Update a vault
|
|
65
|
+
*/
|
|
66
|
+
update(vaultId: string, params: VaultUpdateParams): Promise<Vault>;
|
|
67
|
+
/**
|
|
68
|
+
* Delete a vault by its ID.
|
|
69
|
+
*/
|
|
70
|
+
delete(vaultId: string): Promise<void>;
|
|
71
|
+
/**
|
|
72
|
+
* Grant group permissions to a vault.
|
|
73
|
+
*/
|
|
74
|
+
grantGroupPermissions(vaultId: string, groupPermissionsList: GroupAccess[]): Promise<void>;
|
|
75
|
+
/**
|
|
76
|
+
* Update group permissions for vaults.
|
|
77
|
+
*/
|
|
78
|
+
updateGroupPermissions(groupPermissionsList: GroupVaultAccess[]): Promise<void>;
|
|
79
|
+
/**
|
|
80
|
+
* Revoke group permissions from a vault.
|
|
81
|
+
*/
|
|
82
|
+
revokeGroupPermissions(vaultId: string, groupId: string): Promise<void>;
|
|
23
83
|
}
|
package/dist/vaults.js
CHANGED
|
@@ -29,6 +29,25 @@ class Vaults {
|
|
|
29
29
|
_Vaults_inner.set(this, void 0);
|
|
30
30
|
__classPrivateFieldSet(this, _Vaults_inner, inner, "f");
|
|
31
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Create a new user vault.
|
|
34
|
+
*/
|
|
35
|
+
create(params) {
|
|
36
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
37
|
+
const invocationConfig = {
|
|
38
|
+
invocation: {
|
|
39
|
+
clientId: __classPrivateFieldGet(this, _Vaults_inner, "f").id,
|
|
40
|
+
parameters: {
|
|
41
|
+
name: "VaultsCreate",
|
|
42
|
+
parameters: {
|
|
43
|
+
params,
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
return JSON.parse(yield __classPrivateFieldGet(this, _Vaults_inner, "f").invoke(invocationConfig), types_js_1.ReviverFunc);
|
|
49
|
+
});
|
|
50
|
+
}
|
|
32
51
|
/**
|
|
33
52
|
* List information about vaults that's configurable based on some input parameters.
|
|
34
53
|
*/
|
|
@@ -45,10 +64,13 @@ class Vaults {
|
|
|
45
64
|
},
|
|
46
65
|
},
|
|
47
66
|
};
|
|
48
|
-
return JSON.parse(yield __classPrivateFieldGet(this, _Vaults_inner, "f").
|
|
67
|
+
return JSON.parse(yield __classPrivateFieldGet(this, _Vaults_inner, "f").invoke(invocationConfig), types_js_1.ReviverFunc);
|
|
49
68
|
});
|
|
50
69
|
}
|
|
51
|
-
|
|
70
|
+
/**
|
|
71
|
+
* Get an overview of a vault by its ID.
|
|
72
|
+
*/
|
|
73
|
+
getOverview(vaultId) {
|
|
52
74
|
return __awaiter(this, void 0, void 0, function* () {
|
|
53
75
|
const invocationConfig = {
|
|
54
76
|
invocation: {
|
|
@@ -56,15 +78,18 @@ class Vaults {
|
|
|
56
78
|
parameters: {
|
|
57
79
|
name: "VaultsGetOverview",
|
|
58
80
|
parameters: {
|
|
59
|
-
|
|
81
|
+
vault_id: vaultId,
|
|
60
82
|
},
|
|
61
83
|
},
|
|
62
84
|
},
|
|
63
85
|
};
|
|
64
|
-
return JSON.parse(yield __classPrivateFieldGet(this, _Vaults_inner, "f").
|
|
86
|
+
return JSON.parse(yield __classPrivateFieldGet(this, _Vaults_inner, "f").invoke(invocationConfig), types_js_1.ReviverFunc);
|
|
65
87
|
});
|
|
66
88
|
}
|
|
67
|
-
|
|
89
|
+
/**
|
|
90
|
+
* Get detailed vault information by vault ID and parameters.
|
|
91
|
+
*/
|
|
92
|
+
get(vaultId, vaultParams) {
|
|
68
93
|
return __awaiter(this, void 0, void 0, function* () {
|
|
69
94
|
const invocationConfig = {
|
|
70
95
|
invocation: {
|
|
@@ -72,13 +97,111 @@ class Vaults {
|
|
|
72
97
|
parameters: {
|
|
73
98
|
name: "VaultsGet",
|
|
74
99
|
parameters: {
|
|
75
|
-
|
|
100
|
+
vault_id: vaultId,
|
|
76
101
|
vault_params: vaultParams,
|
|
77
102
|
},
|
|
78
103
|
},
|
|
79
104
|
},
|
|
80
105
|
};
|
|
81
|
-
return JSON.parse(yield __classPrivateFieldGet(this, _Vaults_inner, "f").
|
|
106
|
+
return JSON.parse(yield __classPrivateFieldGet(this, _Vaults_inner, "f").invoke(invocationConfig), types_js_1.ReviverFunc);
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Update a vault
|
|
111
|
+
*/
|
|
112
|
+
update(vaultId, params) {
|
|
113
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
114
|
+
const invocationConfig = {
|
|
115
|
+
invocation: {
|
|
116
|
+
clientId: __classPrivateFieldGet(this, _Vaults_inner, "f").id,
|
|
117
|
+
parameters: {
|
|
118
|
+
name: "VaultsUpdate",
|
|
119
|
+
parameters: {
|
|
120
|
+
vault_id: vaultId,
|
|
121
|
+
params,
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
};
|
|
126
|
+
return JSON.parse(yield __classPrivateFieldGet(this, _Vaults_inner, "f").invoke(invocationConfig), types_js_1.ReviverFunc);
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Delete a vault by its ID.
|
|
131
|
+
*/
|
|
132
|
+
delete(vaultId) {
|
|
133
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
134
|
+
const invocationConfig = {
|
|
135
|
+
invocation: {
|
|
136
|
+
clientId: __classPrivateFieldGet(this, _Vaults_inner, "f").id,
|
|
137
|
+
parameters: {
|
|
138
|
+
name: "VaultsDelete",
|
|
139
|
+
parameters: {
|
|
140
|
+
vault_id: vaultId,
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
};
|
|
145
|
+
yield __classPrivateFieldGet(this, _Vaults_inner, "f").invoke(invocationConfig);
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Grant group permissions to a vault.
|
|
150
|
+
*/
|
|
151
|
+
grantGroupPermissions(vaultId, groupPermissionsList) {
|
|
152
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
153
|
+
const invocationConfig = {
|
|
154
|
+
invocation: {
|
|
155
|
+
clientId: __classPrivateFieldGet(this, _Vaults_inner, "f").id,
|
|
156
|
+
parameters: {
|
|
157
|
+
name: "VaultsGrantGroupPermissions",
|
|
158
|
+
parameters: {
|
|
159
|
+
vault_id: vaultId,
|
|
160
|
+
group_permissions_list: groupPermissionsList,
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
};
|
|
165
|
+
yield __classPrivateFieldGet(this, _Vaults_inner, "f").invoke(invocationConfig);
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Update group permissions for vaults.
|
|
170
|
+
*/
|
|
171
|
+
updateGroupPermissions(groupPermissionsList) {
|
|
172
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
173
|
+
const invocationConfig = {
|
|
174
|
+
invocation: {
|
|
175
|
+
clientId: __classPrivateFieldGet(this, _Vaults_inner, "f").id,
|
|
176
|
+
parameters: {
|
|
177
|
+
name: "VaultsUpdateGroupPermissions",
|
|
178
|
+
parameters: {
|
|
179
|
+
group_permissions_list: groupPermissionsList,
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
};
|
|
184
|
+
yield __classPrivateFieldGet(this, _Vaults_inner, "f").invoke(invocationConfig);
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Revoke group permissions from a vault.
|
|
189
|
+
*/
|
|
190
|
+
revokeGroupPermissions(vaultId, groupId) {
|
|
191
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
192
|
+
const invocationConfig = {
|
|
193
|
+
invocation: {
|
|
194
|
+
clientId: __classPrivateFieldGet(this, _Vaults_inner, "f").id,
|
|
195
|
+
parameters: {
|
|
196
|
+
name: "VaultsRevokeGroupPermissions",
|
|
197
|
+
parameters: {
|
|
198
|
+
vault_id: vaultId,
|
|
199
|
+
group_id: groupId,
|
|
200
|
+
},
|
|
201
|
+
},
|
|
202
|
+
},
|
|
203
|
+
};
|
|
204
|
+
yield __classPrivateFieldGet(this, _Vaults_inner, "f").invoke(invocationConfig);
|
|
82
205
|
});
|
|
83
206
|
}
|
|
84
207
|
}
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.4.0
|
|
2
|
-
export declare const SDK_BUILD_NUMBER = "
|
|
1
|
+
export declare const SDK_VERSION = "0.4.0";
|
|
2
|
+
export declare const SDK_BUILD_NUMBER = "0040003";
|
package/dist/version.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SDK_BUILD_NUMBER = exports.SDK_VERSION = void 0;
|
|
4
|
-
exports.SDK_VERSION = "0.4.0
|
|
5
|
-
exports.SDK_BUILD_NUMBER = "
|
|
6
|
-
const SDK_CORE_VERSION = "0.4.0
|
|
4
|
+
exports.SDK_VERSION = "0.4.0";
|
|
5
|
+
exports.SDK_BUILD_NUMBER = "0040003";
|
|
6
|
+
const SDK_CORE_VERSION = "0.4.0";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@1password/sdk",
|
|
3
|
-
"version": "0.4.0
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "The 1Password JavaScript SDK offers programmatic read access to your secrets in 1Password in an interface native to JavaScript. The SDK currently supports `Node.JS`",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "tsc",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"main": "./dist/sdk.js",
|
|
27
27
|
"types": "./dist/sdk.d.ts",
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@1password/sdk-core": "0.4.0
|
|
29
|
+
"@1password/sdk-core": "0.4.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@1password/eslint-config": "^4.0.0",
|