@1password/sdk 0.1.0-beta.2 → 0.1.0-beta.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/dist/client.d.ts +3 -19
- package/dist/client.js +3 -88
- package/dist/client_builder.d.ts +8 -0
- package/dist/client_builder.js +34 -0
- package/dist/configuration.d.ts +6 -5
- package/dist/configuration.js +49 -0
- package/dist/core.d.ts +7 -1
- package/dist/items.d.ts +12 -0
- package/dist/items.js +61 -0
- package/dist/sdk.d.ts +10 -0
- package/dist/sdk.js +37 -0
- package/dist/secrets.d.ts +1 -1
- package/dist/secrets.js +4 -3
- package/dist/types.d.ts +50 -0
- package/dist/types.js +39 -0
- package/package.json +6 -6
package/dist/client.d.ts
CHANGED
|
@@ -1,24 +1,8 @@
|
|
|
1
|
+
import { InnerClient } from "./core.js";
|
|
1
2
|
import { SecretsApi } from "./secrets.js";
|
|
2
|
-
import {
|
|
3
|
-
import { ClientConfiguration, InnerClient } from "./configuration.js";
|
|
4
|
-
export declare const DEFAULT_INTEGRATION_NAME = "Unknown";
|
|
5
|
-
export declare const DEFAULT_INTEGRATION_VERSION = "Unknown";
|
|
6
|
-
/**
|
|
7
|
-
* Creates a default 1Password SDK client.
|
|
8
|
-
* @returns The authenticated 1Password SDK client.
|
|
9
|
-
*/
|
|
10
|
-
export declare const createClient: (config: ClientConfiguration) => Promise<Client>;
|
|
11
|
-
/**
|
|
12
|
-
* Creates a 1Password SDK client with a given core implementation.
|
|
13
|
-
* @returns The authenticated 1Password SDK client.
|
|
14
|
-
*/
|
|
15
|
-
export declare const createClientWithCore: (config: ClientConfiguration, core: Core) => Promise<Client>;
|
|
3
|
+
import { ItemsApi } from "./items.js";
|
|
16
4
|
export declare class Client {
|
|
17
5
|
secrets: SecretsApi;
|
|
6
|
+
items: ItemsApi;
|
|
18
7
|
constructor(innerClient: InnerClient);
|
|
19
8
|
}
|
|
20
|
-
/**
|
|
21
|
-
* Creates a default client configuration.
|
|
22
|
-
* @returns The client configuration to instantiate the client with.
|
|
23
|
-
*/
|
|
24
|
-
export declare const clientAuthConfig: (userConfig: ClientConfiguration) => ClientAuthConfig;
|
package/dist/client.js
CHANGED
|
@@ -1,97 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
-
exports.
|
|
36
|
-
const os = __importStar(require("os"));
|
|
3
|
+
exports.Client = void 0;
|
|
37
4
|
const secrets_js_1 = require("./secrets.js");
|
|
38
|
-
const
|
|
39
|
-
exports.DEFAULT_INTEGRATION_NAME = "Unknown";
|
|
40
|
-
exports.DEFAULT_INTEGRATION_VERSION = "Unknown";
|
|
41
|
-
const LANGUAGE = "JS";
|
|
42
|
-
const VERSION = "0010001"; // v0.1.0
|
|
43
|
-
const finalizationRegistry = new FinalizationRegistry((heldClient) => {
|
|
44
|
-
heldClient.core.releaseClient(heldClient.id);
|
|
45
|
-
});
|
|
46
|
-
/**
|
|
47
|
-
* Creates a default 1Password SDK client.
|
|
48
|
-
* @returns The authenticated 1Password SDK client.
|
|
49
|
-
*/
|
|
50
|
-
const createClient = (config) => __awaiter(void 0, void 0, void 0, function* () { return (0, exports.createClientWithCore)(config, new core_js_1.SharedCore()); });
|
|
51
|
-
exports.createClient = createClient;
|
|
52
|
-
/**
|
|
53
|
-
* Creates a 1Password SDK client with a given core implementation.
|
|
54
|
-
* @returns The authenticated 1Password SDK client.
|
|
55
|
-
*/
|
|
56
|
-
const createClientWithCore = (config, core) => __awaiter(void 0, void 0, void 0, function* () {
|
|
57
|
-
const authConfig = (0, exports.clientAuthConfig)(config);
|
|
58
|
-
const clientId = yield core.initClient(authConfig);
|
|
59
|
-
const inner = {
|
|
60
|
-
id: parseInt(clientId, 10),
|
|
61
|
-
core,
|
|
62
|
-
};
|
|
63
|
-
const client = new Client(inner);
|
|
64
|
-
// Cleans up associated memory from core when client instance goes out of scope.
|
|
65
|
-
finalizationRegistry.register(client, inner);
|
|
66
|
-
return client;
|
|
67
|
-
});
|
|
68
|
-
exports.createClientWithCore = createClientWithCore;
|
|
69
|
-
// Client represents a client instance of the SDK.
|
|
5
|
+
const items_js_1 = require("./items.js");
|
|
70
6
|
class Client {
|
|
71
7
|
constructor(innerClient) {
|
|
72
8
|
this.secrets = new secrets_js_1.SecretsSource(innerClient);
|
|
9
|
+
this.items = new items_js_1.ItemsSource(innerClient);
|
|
73
10
|
}
|
|
74
11
|
}
|
|
75
12
|
exports.Client = Client;
|
|
76
|
-
/**
|
|
77
|
-
* Creates a default client configuration.
|
|
78
|
-
* @returns The client configuration to instantiate the client with.
|
|
79
|
-
*/
|
|
80
|
-
const clientAuthConfig = (userConfig) => {
|
|
81
|
-
// TODO: Add logic for computing the correct sanitized version value for each platform
|
|
82
|
-
const defaultOsVersion = "0.0.0";
|
|
83
|
-
return {
|
|
84
|
-
serviceAccountToken: userConfig.auth,
|
|
85
|
-
programmingLanguage: LANGUAGE,
|
|
86
|
-
sdkVersion: VERSION,
|
|
87
|
-
integrationName: userConfig.integrationName,
|
|
88
|
-
integrationVersion: userConfig.integrationVersion,
|
|
89
|
-
requestLibraryName: "Fetch API",
|
|
90
|
-
requestLibraryVersion: "Fetch API",
|
|
91
|
-
// Only supported on Node.js
|
|
92
|
-
os: os.type().toLowerCase(),
|
|
93
|
-
osVersion: defaultOsVersion,
|
|
94
|
-
architecture: os.arch(),
|
|
95
|
-
};
|
|
96
|
-
};
|
|
97
|
-
exports.clientAuthConfig = clientAuthConfig;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Core } from "./core.js";
|
|
2
|
+
import { ClientConfiguration } from "./configuration.js";
|
|
3
|
+
import { Client } from "./client.js";
|
|
4
|
+
/**
|
|
5
|
+
* Creates a 1Password SDK client with a given core implementation.
|
|
6
|
+
* @returns The authenticated 1Password SDK client.
|
|
7
|
+
*/
|
|
8
|
+
export declare const createClientWithCore: (config: ClientConfiguration, core: Core) => Promise<Client>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.createClientWithCore = void 0;
|
|
13
|
+
const configuration_js_1 = require("./configuration.js");
|
|
14
|
+
const client_js_1 = require("./client.js");
|
|
15
|
+
const finalizationRegistry = new FinalizationRegistry((heldClient) => {
|
|
16
|
+
heldClient.core.releaseClient(heldClient.id);
|
|
17
|
+
});
|
|
18
|
+
/**
|
|
19
|
+
* Creates a 1Password SDK client with a given core implementation.
|
|
20
|
+
* @returns The authenticated 1Password SDK client.
|
|
21
|
+
*/
|
|
22
|
+
const createClientWithCore = (config, core) => __awaiter(void 0, void 0, void 0, function* () {
|
|
23
|
+
const authConfig = (0, configuration_js_1.clientAuthConfig)(config);
|
|
24
|
+
const clientId = yield core.initClient(authConfig);
|
|
25
|
+
const inner = {
|
|
26
|
+
id: parseInt(clientId, 10),
|
|
27
|
+
core,
|
|
28
|
+
};
|
|
29
|
+
const client = new client_js_1.Client(inner);
|
|
30
|
+
// Cleans up associated memory from core when client instance goes out of scope.
|
|
31
|
+
finalizationRegistry.register(client, inner);
|
|
32
|
+
return client;
|
|
33
|
+
});
|
|
34
|
+
exports.createClientWithCore = createClientWithCore;
|
package/dist/configuration.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export interface InnerClient {
|
|
3
|
-
id: number;
|
|
4
|
-
core: Core;
|
|
5
|
-
}
|
|
1
|
+
import { ClientAuthConfig } from "./core.js";
|
|
6
2
|
export interface ClientConfiguration {
|
|
7
3
|
auth: Auth;
|
|
8
4
|
integrationName: string;
|
|
9
5
|
integrationVersion: string;
|
|
10
6
|
}
|
|
11
7
|
type Auth = string;
|
|
8
|
+
/**
|
|
9
|
+
* Creates a default client configuration.
|
|
10
|
+
* @returns The client configuration to instantiate the client with.
|
|
11
|
+
*/
|
|
12
|
+
export declare const clientAuthConfig: (userConfig: ClientConfiguration) => ClientAuthConfig;
|
|
12
13
|
export {};
|
package/dist/configuration.js
CHANGED
|
@@ -1,2 +1,51 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.clientAuthConfig = void 0;
|
|
27
|
+
const os = __importStar(require("os"));
|
|
28
|
+
const LANGUAGE = "JS";
|
|
29
|
+
const VERSION = "0010001"; // v0.1.0
|
|
30
|
+
/**
|
|
31
|
+
* Creates a default client configuration.
|
|
32
|
+
* @returns The client configuration to instantiate the client with.
|
|
33
|
+
*/
|
|
34
|
+
const clientAuthConfig = (userConfig) => {
|
|
35
|
+
// TODO: Add logic for computing the correct sanitized version value for each platform
|
|
36
|
+
const defaultOsVersion = "0.0.0";
|
|
37
|
+
return {
|
|
38
|
+
serviceAccountToken: userConfig.auth,
|
|
39
|
+
programmingLanguage: LANGUAGE,
|
|
40
|
+
sdkVersion: VERSION,
|
|
41
|
+
integrationName: userConfig.integrationName,
|
|
42
|
+
integrationVersion: userConfig.integrationVersion,
|
|
43
|
+
requestLibraryName: "Fetch API",
|
|
44
|
+
requestLibraryVersion: "Fetch API",
|
|
45
|
+
// Only supported on Node.js
|
|
46
|
+
os: os.type().toLowerCase(),
|
|
47
|
+
osVersion: defaultOsVersion,
|
|
48
|
+
architecture: os.arch(),
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
exports.clientAuthConfig = clientAuthConfig;
|
package/dist/core.d.ts
CHANGED
|
@@ -21,11 +21,17 @@ export interface InvokeConfig {
|
|
|
21
21
|
}
|
|
22
22
|
interface Invocation {
|
|
23
23
|
name: string;
|
|
24
|
-
parameters:
|
|
24
|
+
parameters: {
|
|
25
|
+
[key: string]: unknown;
|
|
26
|
+
};
|
|
25
27
|
}
|
|
26
28
|
export declare class SharedCore implements Core {
|
|
27
29
|
initClient(config: ClientAuthConfig): Promise<string>;
|
|
28
30
|
invoke(config: InvokeConfig): Promise<string>;
|
|
29
31
|
releaseClient(clientId: number): void;
|
|
30
32
|
}
|
|
33
|
+
export interface InnerClient {
|
|
34
|
+
id: number;
|
|
35
|
+
core: Core;
|
|
36
|
+
}
|
|
31
37
|
export {};
|
package/dist/items.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { InnerClient } from "./core.js";
|
|
2
|
+
import * as types from "./types.js";
|
|
3
|
+
export interface ItemsApi {
|
|
4
|
+
create(item: types.Item): Promise<types.Item>;
|
|
5
|
+
get(vaultId: string, itemId: string): Promise<types.Item>;
|
|
6
|
+
}
|
|
7
|
+
export declare class ItemsSource implements ItemsApi {
|
|
8
|
+
#private;
|
|
9
|
+
constructor(inner: InnerClient);
|
|
10
|
+
create(item: types.Item): Promise<types.Item>;
|
|
11
|
+
get(vaultId: string, itemId: string): Promise<types.Item>;
|
|
12
|
+
}
|
package/dist/items.js
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
12
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
13
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
14
|
+
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");
|
|
15
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
16
|
+
};
|
|
17
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
18
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
19
|
+
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");
|
|
20
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
21
|
+
};
|
|
22
|
+
var _ItemsSource_inner;
|
|
23
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
+
exports.ItemsSource = void 0;
|
|
25
|
+
class ItemsSource {
|
|
26
|
+
constructor(inner) {
|
|
27
|
+
_ItemsSource_inner.set(this, void 0);
|
|
28
|
+
__classPrivateFieldSet(this, _ItemsSource_inner, inner, "f");
|
|
29
|
+
}
|
|
30
|
+
create(item) {
|
|
31
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
32
|
+
const invocationConfig = {
|
|
33
|
+
clientId: __classPrivateFieldGet(this, _ItemsSource_inner, "f").id,
|
|
34
|
+
invocation: {
|
|
35
|
+
name: "Create",
|
|
36
|
+
parameters: {
|
|
37
|
+
item,
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
return JSON.parse(yield __classPrivateFieldGet(this, _ItemsSource_inner, "f").core.invoke(invocationConfig));
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
get(vaultId, itemId) {
|
|
45
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
46
|
+
const invocationConfig = {
|
|
47
|
+
clientId: __classPrivateFieldGet(this, _ItemsSource_inner, "f").id,
|
|
48
|
+
invocation: {
|
|
49
|
+
name: "Get",
|
|
50
|
+
parameters: {
|
|
51
|
+
vault_id: vaultId,
|
|
52
|
+
item_id: itemId,
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
return JSON.parse(yield __classPrivateFieldGet(this, _ItemsSource_inner, "f").core.invoke(invocationConfig));
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
exports.ItemsSource = ItemsSource;
|
|
61
|
+
_ItemsSource_inner = new WeakMap();
|
package/dist/sdk.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ClientConfiguration } from "./configuration.js";
|
|
2
|
+
import { Client } from "./client.js";
|
|
3
|
+
export declare const DEFAULT_INTEGRATION_NAME = "Unknown";
|
|
4
|
+
export declare const DEFAULT_INTEGRATION_VERSION = "Unknown";
|
|
5
|
+
export * from "./client.js";
|
|
6
|
+
/**
|
|
7
|
+
* Creates a default 1Password SDK client.
|
|
8
|
+
* @returns The authenticated 1Password SDK client.
|
|
9
|
+
*/
|
|
10
|
+
export declare const createClient: (config: ClientConfiguration) => Promise<Client>;
|
package/dist/sdk.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
17
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
18
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
19
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
20
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
21
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
22
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.createClient = exports.DEFAULT_INTEGRATION_VERSION = exports.DEFAULT_INTEGRATION_NAME = void 0;
|
|
27
|
+
const core_js_1 = require("./core.js");
|
|
28
|
+
const client_builder_js_1 = require("./client_builder.js");
|
|
29
|
+
exports.DEFAULT_INTEGRATION_NAME = "Unknown";
|
|
30
|
+
exports.DEFAULT_INTEGRATION_VERSION = "Unknown";
|
|
31
|
+
__exportStar(require("./client.js"), exports);
|
|
32
|
+
/**
|
|
33
|
+
* Creates a default 1Password SDK client.
|
|
34
|
+
* @returns The authenticated 1Password SDK client.
|
|
35
|
+
*/
|
|
36
|
+
const createClient = (config) => __awaiter(void 0, void 0, void 0, function* () { return (0, client_builder_js_1.createClientWithCore)(config, new core_js_1.SharedCore()); });
|
|
37
|
+
exports.createClient = createClient;
|
package/dist/secrets.d.ts
CHANGED
package/dist/secrets.js
CHANGED
|
@@ -22,7 +22,6 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
22
22
|
var _SecretsSource_inner;
|
|
23
23
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
24
|
exports.SecretsSource = void 0;
|
|
25
|
-
// An implementation of the `SecretsAPI` that wraps a `Core`.
|
|
26
25
|
class SecretsSource {
|
|
27
26
|
constructor(inner) {
|
|
28
27
|
_SecretsSource_inner.set(this, void 0);
|
|
@@ -34,10 +33,12 @@ class SecretsSource {
|
|
|
34
33
|
clientId: __classPrivateFieldGet(this, _SecretsSource_inner, "f").id,
|
|
35
34
|
invocation: {
|
|
36
35
|
name: "Resolve",
|
|
37
|
-
parameters:
|
|
36
|
+
parameters: {
|
|
37
|
+
secret_reference: secretReference,
|
|
38
|
+
},
|
|
38
39
|
},
|
|
39
40
|
};
|
|
40
|
-
return __classPrivateFieldGet(this, _SecretsSource_inner, "f").core.invoke(invocationConfig);
|
|
41
|
+
return JSON.parse(yield __classPrivateFieldGet(this, _SecretsSource_inner, "f").core.invoke(invocationConfig));
|
|
41
42
|
});
|
|
42
43
|
}
|
|
43
44
|
}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export declare enum ItemCategory {
|
|
2
|
+
Login = "Login",
|
|
3
|
+
SecureNote = "SecureNote",
|
|
4
|
+
CreditCard = "CreditCard",
|
|
5
|
+
CryptoWallet = "CryptoWallet",
|
|
6
|
+
Identity = "Identity",
|
|
7
|
+
Password = "Password",
|
|
8
|
+
Document = "Document",
|
|
9
|
+
ApiCredentials = "ApiCredentials",
|
|
10
|
+
BankAccount = "BankAccount",
|
|
11
|
+
Database = "Database",
|
|
12
|
+
DriverLicense = "DriverLicense",
|
|
13
|
+
Email = "Email",
|
|
14
|
+
MedicalRecord = "MedicalRecord",
|
|
15
|
+
Membership = "Membership",
|
|
16
|
+
OutdoorLicense = "OutdoorLicense",
|
|
17
|
+
Passport = "Passport",
|
|
18
|
+
Rewards = "Rewards",
|
|
19
|
+
Router = "Router",
|
|
20
|
+
Server = "Server",
|
|
21
|
+
SshKey = "SshKey",
|
|
22
|
+
SocialSecurityNumber = "SocialSecurityNumber",
|
|
23
|
+
SoftwareLicense = "SoftwareLicense",
|
|
24
|
+
Person = "Person",
|
|
25
|
+
Unsupported = "Unsupported"
|
|
26
|
+
}
|
|
27
|
+
export declare enum ItemFieldType {
|
|
28
|
+
Text = "Text",
|
|
29
|
+
Concealed = "Concealed",
|
|
30
|
+
Unsupported = "Unsupported"
|
|
31
|
+
}
|
|
32
|
+
export interface ItemField {
|
|
33
|
+
id: string;
|
|
34
|
+
title: string;
|
|
35
|
+
section_id?: string;
|
|
36
|
+
field_type: ItemFieldType;
|
|
37
|
+
value: string;
|
|
38
|
+
}
|
|
39
|
+
export interface ItemSection {
|
|
40
|
+
id: string;
|
|
41
|
+
title: string;
|
|
42
|
+
}
|
|
43
|
+
export interface Item {
|
|
44
|
+
id: string;
|
|
45
|
+
title: string;
|
|
46
|
+
category: ItemCategory;
|
|
47
|
+
vault_id: string;
|
|
48
|
+
fields: ItemField[];
|
|
49
|
+
sections: ItemSection[];
|
|
50
|
+
}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
Generated by typeshare 1.9.2
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ItemFieldType = exports.ItemCategory = void 0;
|
|
7
|
+
var ItemCategory;
|
|
8
|
+
(function (ItemCategory) {
|
|
9
|
+
ItemCategory["Login"] = "Login";
|
|
10
|
+
ItemCategory["SecureNote"] = "SecureNote";
|
|
11
|
+
ItemCategory["CreditCard"] = "CreditCard";
|
|
12
|
+
ItemCategory["CryptoWallet"] = "CryptoWallet";
|
|
13
|
+
ItemCategory["Identity"] = "Identity";
|
|
14
|
+
ItemCategory["Password"] = "Password";
|
|
15
|
+
ItemCategory["Document"] = "Document";
|
|
16
|
+
ItemCategory["ApiCredentials"] = "ApiCredentials";
|
|
17
|
+
ItemCategory["BankAccount"] = "BankAccount";
|
|
18
|
+
ItemCategory["Database"] = "Database";
|
|
19
|
+
ItemCategory["DriverLicense"] = "DriverLicense";
|
|
20
|
+
ItemCategory["Email"] = "Email";
|
|
21
|
+
ItemCategory["MedicalRecord"] = "MedicalRecord";
|
|
22
|
+
ItemCategory["Membership"] = "Membership";
|
|
23
|
+
ItemCategory["OutdoorLicense"] = "OutdoorLicense";
|
|
24
|
+
ItemCategory["Passport"] = "Passport";
|
|
25
|
+
ItemCategory["Rewards"] = "Rewards";
|
|
26
|
+
ItemCategory["Router"] = "Router";
|
|
27
|
+
ItemCategory["Server"] = "Server";
|
|
28
|
+
ItemCategory["SshKey"] = "SshKey";
|
|
29
|
+
ItemCategory["SocialSecurityNumber"] = "SocialSecurityNumber";
|
|
30
|
+
ItemCategory["SoftwareLicense"] = "SoftwareLicense";
|
|
31
|
+
ItemCategory["Person"] = "Person";
|
|
32
|
+
ItemCategory["Unsupported"] = "Unsupported";
|
|
33
|
+
})(ItemCategory || (exports.ItemCategory = ItemCategory = {}));
|
|
34
|
+
var ItemFieldType;
|
|
35
|
+
(function (ItemFieldType) {
|
|
36
|
+
ItemFieldType["Text"] = "Text";
|
|
37
|
+
ItemFieldType["Concealed"] = "Concealed";
|
|
38
|
+
ItemFieldType["Unsupported"] = "Unsupported";
|
|
39
|
+
})(ItemFieldType || (exports.ItemFieldType = ItemFieldType = {}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@1password/sdk",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.3",
|
|
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",
|
|
@@ -17,14 +17,14 @@
|
|
|
17
17
|
],
|
|
18
18
|
"exports": {
|
|
19
19
|
".": {
|
|
20
|
-
"types": "./dist/
|
|
21
|
-
"default": "./dist/
|
|
20
|
+
"types": "./dist/sdk.d.ts",
|
|
21
|
+
"default": "./dist/sdk.js"
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
|
-
"main": "./dist/
|
|
25
|
-
"types": "./dist/
|
|
24
|
+
"main": "./dist/sdk.js",
|
|
25
|
+
"types": "./dist/sdk.d.ts",
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@1password/sdk-core": "0.1.0-
|
|
27
|
+
"@1password/sdk-core": "0.1.0-beta3"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@1password/eslint-config": "^4.0.0",
|