@1password/sdk 0.0.0-credential-broker-dev-preview

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.
Files changed (44) hide show
  1. package/README.md +220 -0
  2. package/dist/client.d.ts +23 -0
  3. package/dist/client.js +32 -0
  4. package/dist/client_builder.d.ts +18 -0
  5. package/dist/client_builder.js +64 -0
  6. package/dist/configuration.d.ts +33 -0
  7. package/dist/configuration.js +58 -0
  8. package/dist/core.d.ts +115 -0
  9. package/dist/core.js +154 -0
  10. package/dist/credential_broker.d.ts +28 -0
  11. package/dist/credential_broker.js +31 -0
  12. package/dist/credential_broker_access_requests.d.ts +43 -0
  13. package/dist/credential_broker_access_requests.js +78 -0
  14. package/dist/credential_broker_environment_variables.d.ts +33 -0
  15. package/dist/credential_broker_environment_variables.js +58 -0
  16. package/dist/credential_broker_logins.d.ts +38 -0
  17. package/dist/credential_broker_logins.js +77 -0
  18. package/dist/environments.d.ts +82 -0
  19. package/dist/environments.js +132 -0
  20. package/dist/errors.d.ts +13 -0
  21. package/dist/errors.js +45 -0
  22. package/dist/groups.d.ts +19 -0
  23. package/dist/groups.js +54 -0
  24. package/dist/items.d.ts +89 -0
  25. package/dist/items.js +216 -0
  26. package/dist/items_files.d.ts +40 -0
  27. package/dist/items_files.js +116 -0
  28. package/dist/items_shares.d.ts +32 -0
  29. package/dist/items_shares.js +95 -0
  30. package/dist/sdk.d.ts +24 -0
  31. package/dist/sdk.js +57 -0
  32. package/dist/secrets.d.ts +36 -0
  33. package/dist/secrets.js +107 -0
  34. package/dist/shared_lib_core.d.ts +17 -0
  35. package/dist/shared_lib_core.js +183 -0
  36. package/dist/types.d.ts +972 -0
  37. package/dist/types.js +279 -0
  38. package/dist/vaults.d.ts +83 -0
  39. package/dist/vaults.js +209 -0
  40. package/dist/version.d.ts +2 -0
  41. package/dist/version.js +6 -0
  42. package/dist/web.d.ts +11 -0
  43. package/dist/web.js +55 -0
  44. package/package.json +54 -0
@@ -0,0 +1,132 @@
1
+ "use strict";
2
+ // Code generated by op-codegen - DO NOT EDIT MANUALLY
3
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
4
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
5
+ return new (P || (P = Promise))(function (resolve, reject) {
6
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
7
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
8
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
9
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
10
+ });
11
+ };
12
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
13
+ if (kind === "m") throw new TypeError("Private method is not writable");
14
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
15
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
16
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
17
+ };
18
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
19
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
20
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
21
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
22
+ };
23
+ var _Environments_inner;
24
+ Object.defineProperty(exports, "__esModule", { value: true });
25
+ exports.Environments = void 0;
26
+ const types_js_1 = require("./types.js");
27
+ class Environments {
28
+ constructor(inner) {
29
+ _Environments_inner.set(this, void 0);
30
+ __classPrivateFieldSet(this, _Environments_inner, inner, "f");
31
+ }
32
+ /**
33
+ * Get environment variables belonging to an Environment.
34
+ */
35
+ getVariables(environmentId) {
36
+ return __awaiter(this, void 0, void 0, function* () {
37
+ const invocationConfig = {
38
+ invocation: {
39
+ clientId: __classPrivateFieldGet(this, _Environments_inner, "f").id,
40
+ parameters: {
41
+ name: "EnvironmentsGetVariables",
42
+ parameters: {
43
+ environment_id: environmentId,
44
+ },
45
+ },
46
+ },
47
+ };
48
+ return JSON.parse(yield __classPrivateFieldGet(this, _Environments_inner, "f").invoke(invocationConfig), types_js_1.ReviverFunc);
49
+ });
50
+ }
51
+ /**
52
+ * Get a single secret from an Environment.
53
+ *
54
+ * `environment_name_id` accepts either the Environment's name or its
55
+ * ID; a name that matches more than one Environment is an error.
56
+ *
57
+ * `secret_name` is the name of the secret to get, matched
58
+ * case-insensitively; a name that matches more than one secret in the
59
+ * Environment is an error.
60
+ *
61
+ * `reveal` controls whether a concealed secret's value is returned;
62
+ * when `reveal` is `false`, a concealed value is withheld.
63
+ */
64
+ getSecret(environmentNameId, secretName, reveal) {
65
+ return __awaiter(this, void 0, void 0, function* () {
66
+ const invocationConfig = {
67
+ invocation: {
68
+ clientId: __classPrivateFieldGet(this, _Environments_inner, "f").id,
69
+ parameters: {
70
+ name: "EnvironmentsGetSecret",
71
+ parameters: {
72
+ environment_name_id: environmentNameId,
73
+ secret_name: secretName,
74
+ reveal,
75
+ },
76
+ },
77
+ },
78
+ };
79
+ return JSON.parse(yield __classPrivateFieldGet(this, _Environments_inner, "f").invoke(invocationConfig), types_js_1.ReviverFunc);
80
+ });
81
+ }
82
+ /**
83
+ * List all secrets in an Environment.
84
+ *
85
+ * `environment_name_id` accepts either the Environment's name or its
86
+ * ID; a name that matches more than one Environment is an error.
87
+ *
88
+ * `reveal` controls whether concealed secrets' values are returned;
89
+ * when `reveal` is `false`, concealed values are withheld.
90
+ */
91
+ listSecrets(environmentNameId, reveal) {
92
+ return __awaiter(this, void 0, void 0, function* () {
93
+ const invocationConfig = {
94
+ invocation: {
95
+ clientId: __classPrivateFieldGet(this, _Environments_inner, "f").id,
96
+ parameters: {
97
+ name: "EnvironmentsListSecrets",
98
+ parameters: {
99
+ environment_name_id: environmentNameId,
100
+ reveal,
101
+ },
102
+ },
103
+ },
104
+ };
105
+ return JSON.parse(yield __classPrivateFieldGet(this, _Environments_inner, "f").invoke(invocationConfig), types_js_1.ReviverFunc);
106
+ });
107
+ }
108
+ /**
109
+ * Create a new Environment.
110
+ *
111
+ * `environment_name` accepts a name for the new Environment. The name is
112
+ * trimmed. A name that is empty after trimming is an error.
113
+ */
114
+ create(environmentName) {
115
+ return __awaiter(this, void 0, void 0, function* () {
116
+ const invocationConfig = {
117
+ invocation: {
118
+ clientId: __classPrivateFieldGet(this, _Environments_inner, "f").id,
119
+ parameters: {
120
+ name: "EnvironmentsCreate",
121
+ parameters: {
122
+ environment_name: environmentName,
123
+ },
124
+ },
125
+ },
126
+ };
127
+ return JSON.parse(yield __classPrivateFieldGet(this, _Environments_inner, "f").invoke(invocationConfig), types_js_1.ReviverFunc);
128
+ });
129
+ }
130
+ }
131
+ exports.Environments = Environments;
132
+ _Environments_inner = new WeakMap();
@@ -0,0 +1,13 @@
1
+ export declare class DesktopSessionExpiredError extends Error {
2
+ message: string;
3
+ constructor(message: string);
4
+ }
5
+ export declare class RateLimitExceededError extends Error {
6
+ message: string;
7
+ constructor(message: string);
8
+ }
9
+ export declare class AuthExpiredError extends Error {
10
+ message: string;
11
+ constructor(message: string);
12
+ }
13
+ export declare const throwError: (errString: string) => never;
package/dist/errors.js ADDED
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ // Code generated by op-codegen - DO NOT EDIT MANUALLY
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.throwError = exports.AuthExpiredError = 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;
12
+ class RateLimitExceededError extends Error {
13
+ constructor(message) {
14
+ super();
15
+ this.message = message;
16
+ }
17
+ }
18
+ exports.RateLimitExceededError = RateLimitExceededError;
19
+ class AuthExpiredError extends Error {
20
+ constructor(message) {
21
+ super();
22
+ this.message = message;
23
+ }
24
+ }
25
+ exports.AuthExpiredError = AuthExpiredError;
26
+ const throwError = (errString) => {
27
+ let err;
28
+ try {
29
+ err = JSON.parse(errString);
30
+ }
31
+ catch (e) {
32
+ throw new Error(errString);
33
+ }
34
+ switch (err.name) {
35
+ case "DesktopSessionExpired":
36
+ throw new DesktopSessionExpiredError(err.message);
37
+ case "RateLimitExceeded":
38
+ throw new RateLimitExceededError(err.message);
39
+ case "AuthExpired":
40
+ throw new AuthExpiredError(err.message);
41
+ default:
42
+ throw new Error(err.message);
43
+ }
44
+ };
45
+ exports.throwError = throwError;
@@ -0,0 +1,19 @@
1
+ import { InnerClient } from "./core.js";
2
+ import { Group, GroupGetParams } from "./types.js";
3
+ /**
4
+ * The Groups API holds all the operations the SDK client can perform on 1Password groups.
5
+ */
6
+ export interface GroupsApi {
7
+ /**
8
+ * Get a group by its ID and parameters.
9
+ */
10
+ get(groupId: string, groupParams: GroupGetParams): Promise<Group>;
11
+ }
12
+ export declare class Groups implements GroupsApi {
13
+ #private;
14
+ constructor(inner: InnerClient);
15
+ /**
16
+ * Get a group by its ID and parameters.
17
+ */
18
+ get(groupId: string, groupParams: GroupGetParams): Promise<Group>;
19
+ }
package/dist/groups.js ADDED
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ // Code generated by op-codegen - DO NOT EDIT MANUALLY
3
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
4
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
5
+ return new (P || (P = Promise))(function (resolve, reject) {
6
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
7
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
8
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
9
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
10
+ });
11
+ };
12
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
13
+ if (kind === "m") throw new TypeError("Private method is not writable");
14
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
15
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
16
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
17
+ };
18
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
19
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
20
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
21
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
22
+ };
23
+ var _Groups_inner;
24
+ Object.defineProperty(exports, "__esModule", { value: true });
25
+ exports.Groups = void 0;
26
+ const types_js_1 = require("./types.js");
27
+ class Groups {
28
+ constructor(inner) {
29
+ _Groups_inner.set(this, void 0);
30
+ __classPrivateFieldSet(this, _Groups_inner, inner, "f");
31
+ }
32
+ /**
33
+ * Get a group by its ID and parameters.
34
+ */
35
+ get(groupId, groupParams) {
36
+ return __awaiter(this, void 0, void 0, function* () {
37
+ const invocationConfig = {
38
+ invocation: {
39
+ clientId: __classPrivateFieldGet(this, _Groups_inner, "f").id,
40
+ parameters: {
41
+ name: "GroupsGet",
42
+ parameters: {
43
+ group_id: groupId,
44
+ group_params: groupParams,
45
+ },
46
+ },
47
+ },
48
+ };
49
+ return JSON.parse(yield __classPrivateFieldGet(this, _Groups_inner, "f").invoke(invocationConfig), types_js_1.ReviverFunc);
50
+ });
51
+ }
52
+ }
53
+ exports.Groups = Groups;
54
+ _Groups_inner = new WeakMap();
@@ -0,0 +1,89 @@
1
+ import { InnerClient } from "./core.js";
2
+ import { Item, ItemCreateParams, ItemListFilter, ItemOverview, ItemsDeleteAllResponse, ItemsGetAllResponse, ItemsUpdateAllResponse } from "./types.js";
3
+ import { ItemsSharesApi } from "./items_shares.js";
4
+ import { ItemsFilesApi } from "./items_files.js";
5
+ /**
6
+ * The Items API holds all operations the SDK client can perform on 1Password items.
7
+ */
8
+ export interface ItemsApi {
9
+ shares: ItemsSharesApi;
10
+ files: ItemsFilesApi;
11
+ /**
12
+ * Create a new item.
13
+ */
14
+ create(params: ItemCreateParams): Promise<Item>;
15
+ /**
16
+ * Create items in batch, within a single vault.
17
+ */
18
+ createAll(vaultId: string, params: ItemCreateParams[]): Promise<ItemsUpdateAllResponse>;
19
+ /**
20
+ * Get an item by vault and item ID.
21
+ */
22
+ get(vaultId: string, itemId: string): Promise<Item>;
23
+ /**
24
+ * Get items by vault and their item IDs.
25
+ */
26
+ getAll(vaultId: string, itemIds: string[]): Promise<ItemsGetAllResponse>;
27
+ /**
28
+ * Update an existing item.
29
+ */
30
+ put(item: Item): Promise<Item>;
31
+ /**
32
+ * Delete an item.
33
+ */
34
+ delete(vaultId: string, itemId: string): Promise<void>;
35
+ /**
36
+ * Delete items in batch, within a single vault.
37
+ */
38
+ deleteAll(vaultId: string, itemIds: string[]): Promise<ItemsDeleteAllResponse>;
39
+ /**
40
+ * Archive an item.
41
+ */
42
+ archive(vaultId: string, itemId: string): Promise<void>;
43
+ /**
44
+ * List items based on filters.
45
+ */
46
+ list(vaultId: string, ...filters: ItemListFilter[]): Promise<ItemOverview[]>;
47
+ }
48
+ export declare class Items implements ItemsApi {
49
+ #private;
50
+ shares: ItemsSharesApi;
51
+ files: ItemsFilesApi;
52
+ constructor(inner: InnerClient);
53
+ /**
54
+ * Create a new item.
55
+ */
56
+ create(params: ItemCreateParams): Promise<Item>;
57
+ /**
58
+ * Create items in batch, within a single vault.
59
+ */
60
+ createAll(vaultId: string, params: ItemCreateParams[]): Promise<ItemsUpdateAllResponse>;
61
+ /**
62
+ * Get an item by vault and item ID.
63
+ */
64
+ get(vaultId: string, itemId: string): Promise<Item>;
65
+ /**
66
+ * Get items by vault and their item IDs.
67
+ */
68
+ getAll(vaultId: string, itemIds: string[]): Promise<ItemsGetAllResponse>;
69
+ /**
70
+ * Update an existing item.
71
+ */
72
+ put(item: Item): Promise<Item>;
73
+ /**
74
+ * Delete an item.
75
+ */
76
+ delete(vaultId: string, itemId: string): Promise<void>;
77
+ /**
78
+ * Delete items in batch, within a single vault.
79
+ */
80
+ deleteAll(vaultId: string, itemIds: string[]): Promise<ItemsDeleteAllResponse>;
81
+ /**
82
+ * Archive an item.
83
+ */
84
+ archive(vaultId: string, itemId: string): Promise<void>;
85
+ /**
86
+ * List items based on filters.
87
+ */
88
+ list(vaultId: string, ...filters: ItemListFilter[]): Promise<ItemOverview[]>;
89
+ }
package/dist/items.js ADDED
@@ -0,0 +1,216 @@
1
+ "use strict";
2
+ // Code generated by op-codegen - DO NOT EDIT MANUALLY
3
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
4
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
5
+ return new (P || (P = Promise))(function (resolve, reject) {
6
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
7
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
8
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
9
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
10
+ });
11
+ };
12
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
13
+ if (kind === "m") throw new TypeError("Private method is not writable");
14
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
15
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
16
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
17
+ };
18
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
19
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
20
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
21
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
22
+ };
23
+ var _Items_inner;
24
+ Object.defineProperty(exports, "__esModule", { value: true });
25
+ exports.Items = void 0;
26
+ const types_js_1 = require("./types.js");
27
+ const items_shares_js_1 = require("./items_shares.js");
28
+ const items_files_js_1 = require("./items_files.js");
29
+ class Items {
30
+ constructor(inner) {
31
+ _Items_inner.set(this, void 0);
32
+ __classPrivateFieldSet(this, _Items_inner, inner, "f");
33
+ this.shares = new items_shares_js_1.ItemsShares(inner);
34
+ this.files = new items_files_js_1.ItemsFiles(inner);
35
+ }
36
+ /**
37
+ * Create a new item.
38
+ */
39
+ create(params) {
40
+ return __awaiter(this, void 0, void 0, function* () {
41
+ const invocationConfig = {
42
+ invocation: {
43
+ clientId: __classPrivateFieldGet(this, _Items_inner, "f").id,
44
+ parameters: {
45
+ name: "ItemsCreate",
46
+ parameters: {
47
+ params,
48
+ },
49
+ },
50
+ },
51
+ };
52
+ return JSON.parse(yield __classPrivateFieldGet(this, _Items_inner, "f").invoke(invocationConfig), types_js_1.ReviverFunc);
53
+ });
54
+ }
55
+ /**
56
+ * Create items in batch, within a single vault.
57
+ */
58
+ createAll(vaultId, params) {
59
+ return __awaiter(this, void 0, void 0, function* () {
60
+ const invocationConfig = {
61
+ invocation: {
62
+ clientId: __classPrivateFieldGet(this, _Items_inner, "f").id,
63
+ parameters: {
64
+ name: "ItemsCreateAll",
65
+ parameters: {
66
+ vault_id: vaultId,
67
+ params,
68
+ },
69
+ },
70
+ },
71
+ };
72
+ return JSON.parse(yield __classPrivateFieldGet(this, _Items_inner, "f").invoke(invocationConfig), types_js_1.ReviverFunc);
73
+ });
74
+ }
75
+ /**
76
+ * Get an item by vault and item ID.
77
+ */
78
+ get(vaultId, itemId) {
79
+ return __awaiter(this, void 0, void 0, function* () {
80
+ const invocationConfig = {
81
+ invocation: {
82
+ clientId: __classPrivateFieldGet(this, _Items_inner, "f").id,
83
+ parameters: {
84
+ name: "ItemsGet",
85
+ parameters: {
86
+ vault_id: vaultId,
87
+ item_id: itemId,
88
+ },
89
+ },
90
+ },
91
+ };
92
+ return JSON.parse(yield __classPrivateFieldGet(this, _Items_inner, "f").invoke(invocationConfig), types_js_1.ReviverFunc);
93
+ });
94
+ }
95
+ /**
96
+ * Get items by vault and their item IDs.
97
+ */
98
+ getAll(vaultId, itemIds) {
99
+ return __awaiter(this, void 0, void 0, function* () {
100
+ const invocationConfig = {
101
+ invocation: {
102
+ clientId: __classPrivateFieldGet(this, _Items_inner, "f").id,
103
+ parameters: {
104
+ name: "ItemsGetAll",
105
+ parameters: {
106
+ vault_id: vaultId,
107
+ item_ids: itemIds,
108
+ },
109
+ },
110
+ },
111
+ };
112
+ return JSON.parse(yield __classPrivateFieldGet(this, _Items_inner, "f").invoke(invocationConfig), types_js_1.ReviverFunc);
113
+ });
114
+ }
115
+ /**
116
+ * Update an existing item.
117
+ */
118
+ put(item) {
119
+ return __awaiter(this, void 0, void 0, function* () {
120
+ const invocationConfig = {
121
+ invocation: {
122
+ clientId: __classPrivateFieldGet(this, _Items_inner, "f").id,
123
+ parameters: {
124
+ name: "ItemsPut",
125
+ parameters: {
126
+ item,
127
+ },
128
+ },
129
+ },
130
+ };
131
+ return JSON.parse(yield __classPrivateFieldGet(this, _Items_inner, "f").invoke(invocationConfig), types_js_1.ReviverFunc);
132
+ });
133
+ }
134
+ /**
135
+ * Delete an item.
136
+ */
137
+ delete(vaultId, itemId) {
138
+ return __awaiter(this, void 0, void 0, function* () {
139
+ const invocationConfig = {
140
+ invocation: {
141
+ clientId: __classPrivateFieldGet(this, _Items_inner, "f").id,
142
+ parameters: {
143
+ name: "ItemsDelete",
144
+ parameters: {
145
+ vault_id: vaultId,
146
+ item_id: itemId,
147
+ },
148
+ },
149
+ },
150
+ };
151
+ yield __classPrivateFieldGet(this, _Items_inner, "f").invoke(invocationConfig);
152
+ });
153
+ }
154
+ /**
155
+ * Delete items in batch, within a single vault.
156
+ */
157
+ deleteAll(vaultId, itemIds) {
158
+ return __awaiter(this, void 0, void 0, function* () {
159
+ const invocationConfig = {
160
+ invocation: {
161
+ clientId: __classPrivateFieldGet(this, _Items_inner, "f").id,
162
+ parameters: {
163
+ name: "ItemsDeleteAll",
164
+ parameters: {
165
+ vault_id: vaultId,
166
+ item_ids: itemIds,
167
+ },
168
+ },
169
+ },
170
+ };
171
+ return JSON.parse(yield __classPrivateFieldGet(this, _Items_inner, "f").invoke(invocationConfig), types_js_1.ReviverFunc);
172
+ });
173
+ }
174
+ /**
175
+ * Archive an item.
176
+ */
177
+ archive(vaultId, itemId) {
178
+ return __awaiter(this, void 0, void 0, function* () {
179
+ const invocationConfig = {
180
+ invocation: {
181
+ clientId: __classPrivateFieldGet(this, _Items_inner, "f").id,
182
+ parameters: {
183
+ name: "ItemsArchive",
184
+ parameters: {
185
+ vault_id: vaultId,
186
+ item_id: itemId,
187
+ },
188
+ },
189
+ },
190
+ };
191
+ yield __classPrivateFieldGet(this, _Items_inner, "f").invoke(invocationConfig);
192
+ });
193
+ }
194
+ /**
195
+ * List items based on filters.
196
+ */
197
+ list(vaultId, ...filters) {
198
+ return __awaiter(this, void 0, void 0, function* () {
199
+ const invocationConfig = {
200
+ invocation: {
201
+ clientId: __classPrivateFieldGet(this, _Items_inner, "f").id,
202
+ parameters: {
203
+ name: "ItemsList",
204
+ parameters: {
205
+ vault_id: vaultId,
206
+ filters,
207
+ },
208
+ },
209
+ },
210
+ };
211
+ return JSON.parse(yield __classPrivateFieldGet(this, _Items_inner, "f").invoke(invocationConfig), types_js_1.ReviverFunc);
212
+ });
213
+ }
214
+ }
215
+ exports.Items = Items;
216
+ _Items_inner = new WeakMap();
@@ -0,0 +1,40 @@
1
+ import { InnerClient } from "./core.js";
2
+ import { DocumentCreateParams, FileAttributes, FileCreateParams, Item } from "./types.js";
3
+ export interface ItemsFilesApi {
4
+ /**
5
+ * Attach files to Items.
6
+ */
7
+ attach(item: Item, fileParams: FileCreateParams): Promise<Item>;
8
+ /**
9
+ * Read file content from the Item.
10
+ */
11
+ read(vaultId: string, itemId: string, attr: FileAttributes): Promise<Uint8Array>;
12
+ /**
13
+ * Delete a field file from Item using the section and field IDs.
14
+ */
15
+ delete(item: Item, sectionId: string, fieldId: string): Promise<Item>;
16
+ /**
17
+ * Replace the document file within a document item.
18
+ */
19
+ replaceDocument(item: Item, docParams: DocumentCreateParams): Promise<Item>;
20
+ }
21
+ export declare class ItemsFiles implements ItemsFilesApi {
22
+ #private;
23
+ constructor(inner: InnerClient);
24
+ /**
25
+ * Attach files to Items.
26
+ */
27
+ attach(item: Item, fileParams: FileCreateParams): Promise<Item>;
28
+ /**
29
+ * Read file content from the Item.
30
+ */
31
+ read(vaultId: string, itemId: string, attr: FileAttributes): Promise<Uint8Array>;
32
+ /**
33
+ * Delete a field file from Item using the section and field IDs.
34
+ */
35
+ delete(item: Item, sectionId: string, fieldId: string): Promise<Item>;
36
+ /**
37
+ * Replace the document file within a document item.
38
+ */
39
+ replaceDocument(item: Item, docParams: DocumentCreateParams): Promise<Item>;
40
+ }