@1password/sdk 0.1.6 → 0.1.7
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/configuration.d.ts +1 -1
- package/dist/core.js +19 -3
- package/dist/errors.d.ts +5 -0
- package/dist/errors.js +27 -0
- package/dist/items.d.ts +9 -9
- package/dist/items_shares.d.ts +7 -7
- package/dist/sdk.d.ts +1 -0
- package/dist/sdk.js +1 -0
- package/dist/secrets.d.ts +2 -2
- package/dist/vaults.d.ts +3 -3
- package/dist/version.d.ts +2 -2
- package/dist/version.js +3 -3
- package/package.json +2 -2
package/dist/configuration.d.ts
CHANGED
package/dist/core.js
CHANGED
|
@@ -11,24 +11,40 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.SharedCore = void 0;
|
|
13
13
|
const sdk_core_1 = require("@1password/sdk-core");
|
|
14
|
+
const errors_1 = require("./errors");
|
|
14
15
|
/**
|
|
15
16
|
* An implementation of the `Core` interface that shares resources across all clients.
|
|
16
17
|
*/
|
|
17
18
|
class SharedCore {
|
|
18
19
|
invoke_sync(config) {
|
|
19
20
|
const serializedConfig = JSON.stringify(config);
|
|
20
|
-
|
|
21
|
+
try {
|
|
22
|
+
return (0, sdk_core_1.invoke_sync)(serializedConfig);
|
|
23
|
+
}
|
|
24
|
+
catch (e) {
|
|
25
|
+
(0, errors_1.throwError)(e);
|
|
26
|
+
}
|
|
21
27
|
}
|
|
22
28
|
initClient(config) {
|
|
23
29
|
return __awaiter(this, void 0, void 0, function* () {
|
|
24
30
|
const serializedConfig = JSON.stringify(config);
|
|
25
|
-
|
|
31
|
+
try {
|
|
32
|
+
return yield (0, sdk_core_1.init_client)(serializedConfig);
|
|
33
|
+
}
|
|
34
|
+
catch (e) {
|
|
35
|
+
(0, errors_1.throwError)(e);
|
|
36
|
+
}
|
|
26
37
|
});
|
|
27
38
|
}
|
|
28
39
|
invoke(config) {
|
|
29
40
|
return __awaiter(this, void 0, void 0, function* () {
|
|
30
41
|
const serializedConfig = JSON.stringify(config);
|
|
31
|
-
|
|
42
|
+
try {
|
|
43
|
+
return yield (0, sdk_core_1.invoke)(serializedConfig);
|
|
44
|
+
}
|
|
45
|
+
catch (e) {
|
|
46
|
+
(0, errors_1.throwError)(e);
|
|
47
|
+
}
|
|
32
48
|
});
|
|
33
49
|
}
|
|
34
50
|
releaseClient(clientId) {
|
package/dist/errors.d.ts
ADDED
package/dist/errors.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Code generated by op-codegen - DO NOT EDIT MANUALLY
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.throwError = exports.RateLimitExceededError = void 0;
|
|
5
|
+
class RateLimitExceededError extends Error {
|
|
6
|
+
constructor(message) {
|
|
7
|
+
super();
|
|
8
|
+
this.message = message;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.RateLimitExceededError = RateLimitExceededError;
|
|
12
|
+
const throwError = (errString) => {
|
|
13
|
+
let err;
|
|
14
|
+
try {
|
|
15
|
+
err = JSON.parse(errString);
|
|
16
|
+
}
|
|
17
|
+
catch (e) {
|
|
18
|
+
throw new Error(errString);
|
|
19
|
+
}
|
|
20
|
+
switch (err.name) {
|
|
21
|
+
case "RateLimitExceeded":
|
|
22
|
+
throw new RateLimitExceededError(err.message);
|
|
23
|
+
default:
|
|
24
|
+
throw new Error(err.message);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
exports.throwError = throwError;
|
package/dist/items.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { InnerClient } from "./core.js";
|
|
2
|
-
import * as types from "./types.js";
|
|
3
2
|
import { SdkIterable } from "./iterator.js";
|
|
3
|
+
import { Item, ItemCreateParams, ItemOverview } from "./types.js";
|
|
4
4
|
import { ItemsSharesApi } from "./items_shares.js";
|
|
5
5
|
/**
|
|
6
6
|
* The Items API holds all operations the SDK client can perform on 1Password items.
|
|
@@ -10,15 +10,15 @@ export interface ItemsApi {
|
|
|
10
10
|
/**
|
|
11
11
|
* Create a new item.
|
|
12
12
|
*/
|
|
13
|
-
create(params:
|
|
13
|
+
create(params: ItemCreateParams): Promise<Item>;
|
|
14
14
|
/**
|
|
15
15
|
* Get an item by vault and item ID
|
|
16
16
|
*/
|
|
17
|
-
get(vaultId: string, itemId: string): Promise<
|
|
17
|
+
get(vaultId: string, itemId: string): Promise<Item>;
|
|
18
18
|
/**
|
|
19
19
|
* Update an existing item.
|
|
20
20
|
*/
|
|
21
|
-
put(item:
|
|
21
|
+
put(item: Item): Promise<Item>;
|
|
22
22
|
/**
|
|
23
23
|
* Delete an item.
|
|
24
24
|
*/
|
|
@@ -30,7 +30,7 @@ export interface ItemsApi {
|
|
|
30
30
|
/**
|
|
31
31
|
* List all items
|
|
32
32
|
*/
|
|
33
|
-
listAll(vaultId: string): Promise<SdkIterable<
|
|
33
|
+
listAll(vaultId: string): Promise<SdkIterable<ItemOverview>>;
|
|
34
34
|
}
|
|
35
35
|
export declare class Items implements ItemsApi {
|
|
36
36
|
#private;
|
|
@@ -39,15 +39,15 @@ export declare class Items implements ItemsApi {
|
|
|
39
39
|
/**
|
|
40
40
|
* Create a new item.
|
|
41
41
|
*/
|
|
42
|
-
create(params:
|
|
42
|
+
create(params: ItemCreateParams): Promise<Item>;
|
|
43
43
|
/**
|
|
44
44
|
* Get an item by vault and item ID
|
|
45
45
|
*/
|
|
46
|
-
get(vaultId: string, itemId: string): Promise<
|
|
46
|
+
get(vaultId: string, itemId: string): Promise<Item>;
|
|
47
47
|
/**
|
|
48
48
|
* Update an existing item.
|
|
49
49
|
*/
|
|
50
|
-
put(item:
|
|
50
|
+
put(item: Item): Promise<Item>;
|
|
51
51
|
/**
|
|
52
52
|
* Delete an item.
|
|
53
53
|
*/
|
|
@@ -59,5 +59,5 @@ export declare class Items implements ItemsApi {
|
|
|
59
59
|
/**
|
|
60
60
|
* List all items
|
|
61
61
|
*/
|
|
62
|
-
listAll(vaultId: string): Promise<SdkIterable<
|
|
62
|
+
listAll(vaultId: string): Promise<SdkIterable<ItemOverview>>;
|
|
63
63
|
}
|
package/dist/items_shares.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { InnerClient } from "./core.js";
|
|
2
|
-
import
|
|
2
|
+
import { Item, ItemShareAccountPolicy, ItemShareParams, ValidRecipient } from "./types.js";
|
|
3
3
|
export interface ItemsSharesApi {
|
|
4
4
|
/**
|
|
5
5
|
* Get the item sharing policy of your account.
|
|
6
6
|
*/
|
|
7
|
-
getAccountPolicy(vaultId: string, itemId: string): Promise<
|
|
7
|
+
getAccountPolicy(vaultId: string, itemId: string): Promise<ItemShareAccountPolicy>;
|
|
8
8
|
/**
|
|
9
9
|
* Validate the recipients of an item sharing link.
|
|
10
10
|
*/
|
|
11
|
-
validateRecipients(policy:
|
|
11
|
+
validateRecipients(policy: ItemShareAccountPolicy, recipients: string[]): Promise<ValidRecipient[]>;
|
|
12
12
|
/**
|
|
13
13
|
* Create a new item sharing link.
|
|
14
14
|
*/
|
|
15
|
-
create(item:
|
|
15
|
+
create(item: Item, policy: ItemShareAccountPolicy, params: ItemShareParams): Promise<string>;
|
|
16
16
|
}
|
|
17
17
|
export declare class ItemsShares implements ItemsSharesApi {
|
|
18
18
|
#private;
|
|
@@ -20,13 +20,13 @@ export declare class ItemsShares implements ItemsSharesApi {
|
|
|
20
20
|
/**
|
|
21
21
|
* Get the item sharing policy of your account.
|
|
22
22
|
*/
|
|
23
|
-
getAccountPolicy(vaultId: string, itemId: string): Promise<
|
|
23
|
+
getAccountPolicy(vaultId: string, itemId: string): Promise<ItemShareAccountPolicy>;
|
|
24
24
|
/**
|
|
25
25
|
* Validate the recipients of an item sharing link.
|
|
26
26
|
*/
|
|
27
|
-
validateRecipients(policy:
|
|
27
|
+
validateRecipients(policy: ItemShareAccountPolicy, recipients: string[]): Promise<ValidRecipient[]>;
|
|
28
28
|
/**
|
|
29
29
|
* Create a new item sharing link.
|
|
30
30
|
*/
|
|
31
|
-
create(item:
|
|
31
|
+
create(item: Item, policy: ItemShareAccountPolicy, params: ItemShareParams): Promise<string>;
|
|
32
32
|
}
|
package/dist/sdk.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export declare const DEFAULT_INTEGRATION_NAME = "Unknown";
|
|
|
4
4
|
export declare const DEFAULT_INTEGRATION_VERSION = "Unknown";
|
|
5
5
|
export { Secrets } from "./secrets.js";
|
|
6
6
|
export * from "./client.js";
|
|
7
|
+
export * from "./errors.js";
|
|
7
8
|
export * from "./types.js";
|
|
8
9
|
/**
|
|
9
10
|
* Creates a default 1Password SDK client.
|
package/dist/sdk.js
CHANGED
|
@@ -32,6 +32,7 @@ exports.DEFAULT_INTEGRATION_VERSION = "Unknown";
|
|
|
32
32
|
var secrets_js_1 = require("./secrets.js");
|
|
33
33
|
Object.defineProperty(exports, "Secrets", { enumerable: true, get: function () { return secrets_js_1.Secrets; } });
|
|
34
34
|
__exportStar(require("./client.js"), exports);
|
|
35
|
+
__exportStar(require("./errors.js"), exports);
|
|
35
36
|
__exportStar(require("./types.js"), exports);
|
|
36
37
|
/**
|
|
37
38
|
* Creates a default 1Password SDK client.
|
package/dist/secrets.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { InnerClient } from "./core.js";
|
|
2
|
-
import
|
|
2
|
+
import { GeneratePasswordResponse, PasswordRecipe } from "./types.js";
|
|
3
3
|
/**
|
|
4
4
|
* The Secrets API includes all operations the SDK client can perform on secrets.
|
|
5
5
|
* Use secret reference URIs to securely load secrets from 1Password: op://<vault-name>/<item-name>[/<section-name>]/<field-name>
|
|
@@ -21,5 +21,5 @@ export declare class Secrets implements SecretsApi {
|
|
|
21
21
|
* Validate the secret reference to ensure there are no syntax errors.
|
|
22
22
|
*/
|
|
23
23
|
static validateSecretReference(secretReference: string): void;
|
|
24
|
-
static generatePassword(recipe:
|
|
24
|
+
static generatePassword(recipe: PasswordRecipe): GeneratePasswordResponse;
|
|
25
25
|
}
|
package/dist/vaults.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { InnerClient } from "./core.js";
|
|
2
|
-
import * as types from "./types.js";
|
|
3
2
|
import { SdkIterable } from "./iterator.js";
|
|
3
|
+
import { VaultOverview } from "./types.js";
|
|
4
4
|
/**
|
|
5
5
|
* The Vaults API holds all the operations the SDK client can perform on 1Password vaults.
|
|
6
6
|
*/
|
|
@@ -8,7 +8,7 @@ export interface VaultsApi {
|
|
|
8
8
|
/**
|
|
9
9
|
* List all vaults
|
|
10
10
|
*/
|
|
11
|
-
listAll(): Promise<SdkIterable<
|
|
11
|
+
listAll(): Promise<SdkIterable<VaultOverview>>;
|
|
12
12
|
}
|
|
13
13
|
export declare class Vaults implements VaultsApi {
|
|
14
14
|
#private;
|
|
@@ -16,5 +16,5 @@ export declare class Vaults implements VaultsApi {
|
|
|
16
16
|
/**
|
|
17
17
|
* List all vaults
|
|
18
18
|
*/
|
|
19
|
-
listAll(): Promise<SdkIterable<
|
|
19
|
+
listAll(): Promise<SdkIterable<VaultOverview>>;
|
|
20
20
|
}
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.1.
|
|
2
|
-
export declare const SDK_BUILD_NUMBER = "
|
|
1
|
+
export declare const SDK_VERSION = "0.1.7";
|
|
2
|
+
export declare const SDK_BUILD_NUMBER = "0010701";
|
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.1.
|
|
5
|
-
exports.SDK_BUILD_NUMBER = "
|
|
6
|
-
const SDK_CORE_VERSION = "0.1.
|
|
4
|
+
exports.SDK_VERSION = "0.1.7";
|
|
5
|
+
exports.SDK_BUILD_NUMBER = "0010701";
|
|
6
|
+
const SDK_CORE_VERSION = "0.1.7";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@1password/sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
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.1.
|
|
29
|
+
"@1password/sdk-core": "0.1.7"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@1password/eslint-config": "^4.0.0",
|