@workos-inc/node 7.43.1 → 7.45.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/lib/directory-sync/directory-sync.spec.js +4 -0
- package/lib/directory-sync/interfaces/directory-user.interface.d.ts +26 -0
- package/lib/directory-sync/serializers/directory-user.serializer.js +2 -0
- package/lib/directory-sync/utils/get-primary-email.spec.js +1 -0
- package/lib/events/events.spec.js +2 -0
- package/lib/vault/interfaces/index.d.ts +7 -6
- package/lib/vault/interfaces/index.js +7 -6
- package/lib/vault/interfaces/key/create-data-key.interface.d.ts +3 -3
- package/lib/vault/interfaces/key.interface.d.ts +4 -2
- package/lib/vault/interfaces/object/create-object.interface.d.ts +11 -0
- package/lib/vault/interfaces/object/delete-object.interface.d.ts +3 -0
- package/lib/vault/interfaces/object/list-object-versions.interface.d.ts +8 -0
- package/lib/vault/interfaces/{secret/list-secrets.interface.d.ts → object/list-objects.interface.d.ts} +1 -1
- package/lib/vault/interfaces/object/read-object.interface.d.ts +20 -0
- package/lib/vault/interfaces/{secret/update-secret.interface.d.ts → object/update-object.interface.d.ts} +2 -2
- package/lib/vault/interfaces/object/update-object.interface.js +2 -0
- package/lib/vault/interfaces/object.interface.d.ts +30 -0
- package/lib/vault/interfaces/secret.interface.d.ts +8 -26
- package/lib/vault/serializers/vault-object.serializer.d.ts +8 -0
- package/lib/vault/serializers/vault-object.serializer.js +55 -0
- package/lib/vault/vault-live-test.spec.js +89 -89
- package/lib/vault/vault.d.ts +16 -9
- package/lib/vault/vault.js +44 -16
- package/lib/workos.js +1 -1
- package/package.json +1 -1
- package/lib/vault/interfaces/secret/create-secret.interface.d.ts +0 -11
- package/lib/vault/interfaces/secret/delete-secret.interface.d.ts +0 -3
- package/lib/vault/interfaces/secret/list-secret-versions.interface.d.ts +0 -8
- package/lib/vault/interfaces/secret/read-secret.interface.d.ts +0 -19
- package/lib/vault/serializers/vault-secret.serializer.d.ts +0 -8
- package/lib/vault/serializers/vault-secret.serializer.js +0 -55
- /package/lib/vault/interfaces/{secret/delete-secret.interface.js → object/create-object.interface.js} +0 -0
- /package/lib/vault/interfaces/{secret/list-secret-versions.interface.js → object/delete-object.interface.js} +0 -0
- /package/lib/vault/interfaces/{secret/list-secrets.interface.js → object/list-object-versions.interface.js} +0 -0
- /package/lib/vault/interfaces/{secret/read-secret.interface.js → object/list-objects.interface.js} +0 -0
- /package/lib/vault/interfaces/{secret/update-secret.interface.js → object/read-object.interface.js} +0 -0
- /package/lib/vault/interfaces/{secret/create-secret.interface.js → object.interface.js} +0 -0
|
@@ -74,6 +74,7 @@ describe('DirectorySync', () => {
|
|
|
74
74
|
},
|
|
75
75
|
directoryId: 'dir_123',
|
|
76
76
|
organizationId: 'org_123',
|
|
77
|
+
email: 'jonsnow@workos.com',
|
|
77
78
|
emails: [
|
|
78
79
|
{
|
|
79
80
|
primary: true,
|
|
@@ -100,6 +101,7 @@ describe('DirectorySync', () => {
|
|
|
100
101
|
},
|
|
101
102
|
directory_id: 'dir_123',
|
|
102
103
|
organization_id: 'org_123',
|
|
104
|
+
email: 'jonsnow@workos.com',
|
|
103
105
|
emails: [
|
|
104
106
|
{
|
|
105
107
|
primary: true,
|
|
@@ -126,6 +128,7 @@ describe('DirectorySync', () => {
|
|
|
126
128
|
},
|
|
127
129
|
directoryId: 'dir_123',
|
|
128
130
|
organizationId: 'org_123',
|
|
131
|
+
email: 'jonsnow@workos.com',
|
|
129
132
|
emails: [
|
|
130
133
|
{
|
|
131
134
|
primary: true,
|
|
@@ -153,6 +156,7 @@ describe('DirectorySync', () => {
|
|
|
153
156
|
},
|
|
154
157
|
directory_id: 'dir_123',
|
|
155
158
|
organization_id: 'org_123',
|
|
159
|
+
email: 'jonsnow@workos.com',
|
|
156
160
|
emails: [
|
|
157
161
|
{
|
|
158
162
|
primary: true,
|
|
@@ -10,13 +10,26 @@ export interface DirectoryUser<TCustomAttributes extends object = DefaultCustomA
|
|
|
10
10
|
customAttributes: TCustomAttributes;
|
|
11
11
|
idpId: string;
|
|
12
12
|
firstName: string | null;
|
|
13
|
+
email: string | null;
|
|
14
|
+
/** @deprecated Will be removed in a future major version.
|
|
15
|
+
* Enable the `emails` custom attribute in dashboard and pull from customAttributes instead.
|
|
16
|
+
* See https://workos.com/docs/directory-sync/attributes/custom-attributes/auto-mapped-attributes for details.
|
|
17
|
+
*/
|
|
13
18
|
emails: {
|
|
14
19
|
type?: string;
|
|
15
20
|
value?: string;
|
|
16
21
|
primary?: boolean;
|
|
17
22
|
}[];
|
|
23
|
+
/** @deprecated Will be removed in a future major version.
|
|
24
|
+
* Enable the `username` custom attribute in dashboard and pull from customAttributes instead.
|
|
25
|
+
* See https://workos.com/docs/directory-sync/attributes/custom-attributes/auto-mapped-attributes for details.
|
|
26
|
+
*/
|
|
18
27
|
username: string | null;
|
|
19
28
|
lastName: string | null;
|
|
29
|
+
/** @deprecated Will be removed in a future major version.
|
|
30
|
+
* Enable the `job_title` custom attribute in dashboard and pull from customAttributes instead.
|
|
31
|
+
* See https://workos.com/docs/directory-sync/attributes/custom-attributes/auto-mapped-attributes for details.
|
|
32
|
+
*/
|
|
20
33
|
jobTitle: string | null;
|
|
21
34
|
state: 'active' | 'inactive';
|
|
22
35
|
role?: RoleResponse;
|
|
@@ -32,13 +45,26 @@ export interface DirectoryUserResponse<TCustomAttributes extends object = Defaul
|
|
|
32
45
|
custom_attributes: TCustomAttributes;
|
|
33
46
|
idp_id: string;
|
|
34
47
|
first_name: string | null;
|
|
48
|
+
email: string | null;
|
|
49
|
+
/** @deprecated Will be removed in a future major version.
|
|
50
|
+
* Enable the `emails` custom attribute in dashboard and pull from customAttributes instead.
|
|
51
|
+
* See https://workos.com/docs/directory-sync/attributes/custom-attributes/auto-mapped-attributes for details.
|
|
52
|
+
*/
|
|
35
53
|
emails: {
|
|
36
54
|
type?: string;
|
|
37
55
|
value?: string;
|
|
38
56
|
primary?: boolean;
|
|
39
57
|
}[];
|
|
58
|
+
/** @deprecated Will be removed in a future major version.
|
|
59
|
+
* Enable the `username` custom attribute in dashboard and pull from customAttributes instead.
|
|
60
|
+
* See https://workos.com/docs/directory-sync/attributes/custom-attributes/auto-mapped-attributes for details.
|
|
61
|
+
*/
|
|
40
62
|
username: string | null;
|
|
41
63
|
last_name: string | null;
|
|
64
|
+
/** @deprecated Will be removed in a future major version.
|
|
65
|
+
* Enable the `job_title` custom attribute in dashboard and pull from customAttributes instead.
|
|
66
|
+
* See https://workos.com/docs/directory-sync/attributes/custom-attributes/auto-mapped-attributes for details.
|
|
67
|
+
*/
|
|
42
68
|
job_title: string | null;
|
|
43
69
|
state: 'active' | 'inactive';
|
|
44
70
|
role?: RoleResponse;
|
|
@@ -11,6 +11,7 @@ const deserializeDirectoryUser = (directoryUser) => ({
|
|
|
11
11
|
customAttributes: directoryUser.custom_attributes,
|
|
12
12
|
idpId: directoryUser.idp_id,
|
|
13
13
|
firstName: directoryUser.first_name,
|
|
14
|
+
email: directoryUser.email,
|
|
14
15
|
emails: directoryUser.emails,
|
|
15
16
|
username: directoryUser.username,
|
|
16
17
|
lastName: directoryUser.last_name,
|
|
@@ -32,6 +33,7 @@ const deserializeUpdatedEventDirectoryUser = (directoryUser) => ({
|
|
|
32
33
|
customAttributes: directoryUser.custom_attributes,
|
|
33
34
|
idpId: directoryUser.idp_id,
|
|
34
35
|
firstName: directoryUser.first_name,
|
|
36
|
+
email: directoryUser.email,
|
|
35
37
|
emails: directoryUser.emails,
|
|
36
38
|
username: directoryUser.username,
|
|
37
39
|
lastName: directoryUser.last_name,
|
|
@@ -120,6 +120,7 @@ describe('Event', () => {
|
|
|
120
120
|
},
|
|
121
121
|
directoryId: 'dir_123',
|
|
122
122
|
organizationId: 'org_123',
|
|
123
|
+
email: 'jonsnow@workos.com',
|
|
123
124
|
emails: [
|
|
124
125
|
{
|
|
125
126
|
primary: true,
|
|
@@ -154,6 +155,7 @@ describe('Event', () => {
|
|
|
154
155
|
},
|
|
155
156
|
directory_id: 'dir_123',
|
|
156
157
|
organization_id: 'org_123',
|
|
158
|
+
email: 'jonsnow@workos.com',
|
|
157
159
|
emails: [
|
|
158
160
|
{
|
|
159
161
|
primary: true,
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
export * from './key/create-data-key.interface';
|
|
2
2
|
export * from './key/decrypt-data-key.interface';
|
|
3
3
|
export * from './key.interface';
|
|
4
|
-
export * from './
|
|
5
|
-
export * from './
|
|
6
|
-
export * from './
|
|
7
|
-
export * from './
|
|
8
|
-
export * from './
|
|
9
|
-
export * from './
|
|
4
|
+
export * from './object/create-object.interface';
|
|
5
|
+
export * from './object/delete-object.interface';
|
|
6
|
+
export * from './object/list-object-versions.interface';
|
|
7
|
+
export * from './object/list-objects.interface';
|
|
8
|
+
export * from './object/read-object.interface';
|
|
9
|
+
export * from './object/update-object.interface';
|
|
10
|
+
export * from './object.interface';
|
|
10
11
|
export * from './secret.interface';
|
|
@@ -17,10 +17,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./key/create-data-key.interface"), exports);
|
|
18
18
|
__exportStar(require("./key/decrypt-data-key.interface"), exports);
|
|
19
19
|
__exportStar(require("./key.interface"), exports);
|
|
20
|
-
__exportStar(require("./
|
|
21
|
-
__exportStar(require("./
|
|
22
|
-
__exportStar(require("./
|
|
23
|
-
__exportStar(require("./
|
|
24
|
-
__exportStar(require("./
|
|
25
|
-
__exportStar(require("./
|
|
20
|
+
__exportStar(require("./object/create-object.interface"), exports);
|
|
21
|
+
__exportStar(require("./object/delete-object.interface"), exports);
|
|
22
|
+
__exportStar(require("./object/list-object-versions.interface"), exports);
|
|
23
|
+
__exportStar(require("./object/list-objects.interface"), exports);
|
|
24
|
+
__exportStar(require("./object/read-object.interface"), exports);
|
|
25
|
+
__exportStar(require("./object/update-object.interface"), exports);
|
|
26
|
+
__exportStar(require("./object.interface"), exports);
|
|
26
27
|
__exportStar(require("./secret.interface"), exports);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { KeyContext } from '../key.interface';
|
|
2
2
|
export interface CreateDataKeyOptions {
|
|
3
|
-
context:
|
|
3
|
+
context: KeyContext;
|
|
4
4
|
}
|
|
5
5
|
export interface CreateDataKeyResponse {
|
|
6
|
-
context:
|
|
6
|
+
context: KeyContext;
|
|
7
7
|
data_key: string;
|
|
8
8
|
encrypted_keys: string;
|
|
9
9
|
id: string;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { KeyContext } from '../key.interface';
|
|
2
|
+
import { ObjectUpdateBy } from '../object.interface';
|
|
3
|
+
export interface ReadObjectOptions {
|
|
4
|
+
id: string;
|
|
5
|
+
}
|
|
6
|
+
export interface ReadObjectMetadataResponse {
|
|
7
|
+
context: KeyContext;
|
|
8
|
+
environment_id: string;
|
|
9
|
+
id: string;
|
|
10
|
+
key_id: string;
|
|
11
|
+
updated_at: string;
|
|
12
|
+
updated_by: ObjectUpdateBy;
|
|
13
|
+
version_id: string;
|
|
14
|
+
}
|
|
15
|
+
export interface ReadObjectResponse {
|
|
16
|
+
id: string;
|
|
17
|
+
metadata: ReadObjectMetadataResponse;
|
|
18
|
+
name: string;
|
|
19
|
+
value: string;
|
|
20
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export interface
|
|
1
|
+
export interface UpdateObjectEntity {
|
|
2
2
|
value: string;
|
|
3
3
|
version_check?: string;
|
|
4
4
|
}
|
|
5
|
-
export interface
|
|
5
|
+
export interface UpdateObjectOptions {
|
|
6
6
|
id: string;
|
|
7
7
|
value: string;
|
|
8
8
|
versionCheck?: string;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { KeyContext } from './key.interface';
|
|
2
|
+
export interface ObjectDigest {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
updatedAt: Date;
|
|
6
|
+
}
|
|
7
|
+
export interface ObjectUpdateBy {
|
|
8
|
+
id: string;
|
|
9
|
+
name: string;
|
|
10
|
+
}
|
|
11
|
+
export interface ObjectMetadata {
|
|
12
|
+
context: KeyContext;
|
|
13
|
+
environmentId: string;
|
|
14
|
+
id: string;
|
|
15
|
+
keyId: string;
|
|
16
|
+
updatedAt: Date;
|
|
17
|
+
updatedBy: ObjectUpdateBy;
|
|
18
|
+
versionId: string;
|
|
19
|
+
}
|
|
20
|
+
export interface VaultObject {
|
|
21
|
+
id: string;
|
|
22
|
+
metadata: ObjectMetadata;
|
|
23
|
+
name: string;
|
|
24
|
+
value?: string;
|
|
25
|
+
}
|
|
26
|
+
export interface ObjectVersion {
|
|
27
|
+
createdAt: Date;
|
|
28
|
+
currentVersion: boolean;
|
|
29
|
+
id: string;
|
|
30
|
+
}
|
|
@@ -1,32 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { KeyContext } from './key.interface';
|
|
2
|
+
import { ObjectDigest, ObjectUpdateBy, ObjectMetadata, VaultObject, ObjectVersion } from './object.interface';
|
|
3
|
+
export interface SecretContext extends KeyContext {
|
|
3
4
|
}
|
|
4
|
-
export interface SecretDigest {
|
|
5
|
-
id: string;
|
|
6
|
-
name: string;
|
|
7
|
-
updatedAt: Date;
|
|
5
|
+
export interface SecretDigest extends ObjectDigest {
|
|
8
6
|
}
|
|
9
|
-
export interface SecretUpdateBy {
|
|
10
|
-
id: string;
|
|
11
|
-
name: string;
|
|
7
|
+
export interface SecretUpdateBy extends ObjectUpdateBy {
|
|
12
8
|
}
|
|
13
|
-
export interface SecretMetadata {
|
|
14
|
-
context: SecretContext;
|
|
15
|
-
environmentId: string;
|
|
16
|
-
id: string;
|
|
17
|
-
keyId: string;
|
|
18
|
-
updatedAt: Date;
|
|
19
|
-
updatedBy: SecretUpdateBy;
|
|
20
|
-
versionId: string;
|
|
9
|
+
export interface SecretMetadata extends ObjectMetadata {
|
|
21
10
|
}
|
|
22
|
-
export interface VaultSecret {
|
|
23
|
-
id: string;
|
|
24
|
-
metadata: SecretMetadata;
|
|
25
|
-
name: string;
|
|
26
|
-
value?: string;
|
|
11
|
+
export interface VaultSecret extends VaultObject {
|
|
27
12
|
}
|
|
28
|
-
export interface SecretVersion {
|
|
29
|
-
createdAt: Date;
|
|
30
|
-
currentVersion: boolean;
|
|
31
|
-
id: string;
|
|
13
|
+
export interface SecretVersion extends ObjectVersion {
|
|
32
14
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { List, ListResponse } from '../../common/interfaces';
|
|
2
|
+
import { ReadObjectMetadataResponse, ReadObjectResponse, UpdateObjectOptions, UpdateObjectEntity, ObjectMetadata, VaultObject, ObjectVersion, CreateObjectOptions, CreateObjectEntity, ObjectDigestResponse, ObjectDigest, ListObjectVersionsResponse } from '../interfaces';
|
|
3
|
+
export declare const deserializeObjectMetadata: (metadata: ReadObjectMetadataResponse) => ObjectMetadata;
|
|
4
|
+
export declare const deserializeObject: (object: ReadObjectResponse) => VaultObject;
|
|
5
|
+
export declare const deserializeListObjects: (list: ListResponse<ObjectDigestResponse>) => List<ObjectDigest>;
|
|
6
|
+
export declare const desrializeListObjectVersions: (list: ListObjectVersionsResponse) => ObjectVersion[];
|
|
7
|
+
export declare const serializeCreateObjectEntity: (options: CreateObjectOptions) => CreateObjectEntity;
|
|
8
|
+
export declare const serializeUpdateObjectEntity: (options: UpdateObjectOptions) => UpdateObjectEntity;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.serializeUpdateObjectEntity = exports.serializeCreateObjectEntity = exports.desrializeListObjectVersions = exports.deserializeListObjects = exports.deserializeObject = exports.deserializeObjectMetadata = void 0;
|
|
4
|
+
const deserializeObjectMetadata = (metadata) => ({
|
|
5
|
+
context: metadata.context,
|
|
6
|
+
environmentId: metadata.environment_id,
|
|
7
|
+
id: metadata.id,
|
|
8
|
+
keyId: metadata.key_id,
|
|
9
|
+
updatedAt: new Date(Date.parse(metadata.updated_at)),
|
|
10
|
+
updatedBy: metadata.updated_by,
|
|
11
|
+
versionId: metadata.version_id,
|
|
12
|
+
});
|
|
13
|
+
exports.deserializeObjectMetadata = deserializeObjectMetadata;
|
|
14
|
+
const deserializeObject = (object) => ({
|
|
15
|
+
id: object.id,
|
|
16
|
+
name: object.name,
|
|
17
|
+
value: object.value,
|
|
18
|
+
metadata: (0, exports.deserializeObjectMetadata)(object.metadata),
|
|
19
|
+
});
|
|
20
|
+
exports.deserializeObject = deserializeObject;
|
|
21
|
+
const deserializeObjectDigest = (digest) => ({
|
|
22
|
+
id: digest.id,
|
|
23
|
+
name: digest.name,
|
|
24
|
+
updatedAt: new Date(Date.parse(digest.updated_at)),
|
|
25
|
+
});
|
|
26
|
+
const deserializeListObjects = (list) => {
|
|
27
|
+
var _a, _b;
|
|
28
|
+
return ({
|
|
29
|
+
object: 'list',
|
|
30
|
+
data: list.data.map(deserializeObjectDigest),
|
|
31
|
+
listMetadata: {
|
|
32
|
+
after: (_a = list.list_metadata.after) !== null && _a !== void 0 ? _a : undefined,
|
|
33
|
+
before: (_b = list.list_metadata.before) !== null && _b !== void 0 ? _b : undefined,
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
exports.deserializeListObjects = deserializeListObjects;
|
|
38
|
+
const desrializeListObjectVersions = (list) => list.data.map(deserializeObjectVersion);
|
|
39
|
+
exports.desrializeListObjectVersions = desrializeListObjectVersions;
|
|
40
|
+
const deserializeObjectVersion = (version) => ({
|
|
41
|
+
createdAt: new Date(Date.parse(version.created_at)),
|
|
42
|
+
currentVersion: version.current_version,
|
|
43
|
+
id: version.id,
|
|
44
|
+
});
|
|
45
|
+
const serializeCreateObjectEntity = (options) => ({
|
|
46
|
+
name: options.name,
|
|
47
|
+
value: options.value,
|
|
48
|
+
key_context: options.context,
|
|
49
|
+
});
|
|
50
|
+
exports.serializeCreateObjectEntity = serializeCreateObjectEntity;
|
|
51
|
+
const serializeUpdateObjectEntity = (options) => ({
|
|
52
|
+
value: options.value,
|
|
53
|
+
version_check: options.versionCheck,
|
|
54
|
+
});
|
|
55
|
+
exports.serializeUpdateObjectEntity = serializeUpdateObjectEntity;
|
|
@@ -16,7 +16,7 @@ const index_worker_1 = require("../index.worker");
|
|
|
16
16
|
const conflict_exception_1 = require("../common/exceptions/conflict.exception");
|
|
17
17
|
describe.skip('Vault Live Test', () => {
|
|
18
18
|
let workos;
|
|
19
|
-
const
|
|
19
|
+
const objectPrefix = (0, crypto_1.randomUUID)();
|
|
20
20
|
beforeAll(() => {
|
|
21
21
|
(0, jest_fetch_mock_1.disableFetchMocks)();
|
|
22
22
|
workos = new workos_1.WorkOS('API_KEY');
|
|
@@ -28,21 +28,21 @@ describe.skip('Vault Live Test', () => {
|
|
|
28
28
|
let listLimit = 0;
|
|
29
29
|
let before;
|
|
30
30
|
do {
|
|
31
|
-
const
|
|
32
|
-
for (const
|
|
33
|
-
if (
|
|
34
|
-
yield workos.vault.
|
|
31
|
+
const allObjects = yield workos.vault.listObjects({ after: before });
|
|
32
|
+
for (const object of allObjects.data) {
|
|
33
|
+
if (object.name.startsWith(objectPrefix)) {
|
|
34
|
+
yield workos.vault.deleteObject({ id: object.id });
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
|
-
before =
|
|
37
|
+
before = allObjects.listMetadata.before;
|
|
38
38
|
listLimit++;
|
|
39
39
|
} while (listLimit < 100 && before !== undefined);
|
|
40
40
|
}));
|
|
41
|
-
describe('CRUD
|
|
42
|
-
it('Creates
|
|
43
|
-
const
|
|
44
|
-
const
|
|
45
|
-
name:
|
|
41
|
+
describe('CRUD objects', () => {
|
|
42
|
+
it('Creates objects', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
43
|
+
const objectName = `${objectPrefix}-lima`;
|
|
44
|
+
const newObject = yield workos.vault.createObject({
|
|
45
|
+
name: objectName,
|
|
46
46
|
value: 'Huacaya 27.7 micron',
|
|
47
47
|
context: { fiber: 'Alpalca' },
|
|
48
48
|
});
|
|
@@ -60,37 +60,37 @@ describe.skip('Vault Live Test', () => {
|
|
|
60
60
|
},
|
|
61
61
|
versionId: expect.any(String),
|
|
62
62
|
};
|
|
63
|
-
expect(
|
|
64
|
-
const
|
|
65
|
-
expect(
|
|
66
|
-
id:
|
|
67
|
-
name:
|
|
63
|
+
expect(newObject).toStrictEqual(expectedMetadata);
|
|
64
|
+
const objectValue = yield workos.vault.readObject({ id: newObject.id });
|
|
65
|
+
expect(objectValue).toStrictEqual({
|
|
66
|
+
id: newObject.id,
|
|
67
|
+
name: objectName,
|
|
68
68
|
value: 'Huacaya 27.7 micron',
|
|
69
69
|
metadata: expectedMetadata,
|
|
70
70
|
});
|
|
71
71
|
}));
|
|
72
|
-
it('Fails to create
|
|
73
|
-
const
|
|
74
|
-
yield workos.vault.
|
|
75
|
-
name:
|
|
72
|
+
it('Fails to create objects with the same name', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
73
|
+
const objectName = `${objectPrefix}-lima`;
|
|
74
|
+
yield workos.vault.createObject({
|
|
75
|
+
name: objectName,
|
|
76
76
|
value: 'Huacaya 27.7 micron',
|
|
77
77
|
context: { fiber: 'Alpalca' },
|
|
78
78
|
});
|
|
79
|
-
yield expect(workos.vault.
|
|
80
|
-
name:
|
|
79
|
+
yield expect(workos.vault.createObject({
|
|
80
|
+
name: objectName,
|
|
81
81
|
value: 'Huacaya 27.7 micron',
|
|
82
82
|
context: { fiber: 'Alpalca' },
|
|
83
83
|
})).rejects.toThrow(conflict_exception_1.ConflictException);
|
|
84
84
|
}));
|
|
85
|
-
it('Updates
|
|
86
|
-
const
|
|
87
|
-
const
|
|
88
|
-
name:
|
|
85
|
+
it('Updates objects', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
86
|
+
const objectName = `${objectPrefix}-cusco`;
|
|
87
|
+
const newObject = yield workos.vault.createObject({
|
|
88
|
+
name: objectName,
|
|
89
89
|
value: 'Tapada 20-30 micron',
|
|
90
90
|
context: { fiber: 'Alpalca' },
|
|
91
91
|
});
|
|
92
|
-
const
|
|
93
|
-
id:
|
|
92
|
+
const updatedObject = yield workos.vault.updateObject({
|
|
93
|
+
id: newObject.id,
|
|
94
94
|
value: 'Ccara 30-40 micron',
|
|
95
95
|
});
|
|
96
96
|
const expectedMetadata = {
|
|
@@ -107,56 +107,56 @@ describe.skip('Vault Live Test', () => {
|
|
|
107
107
|
},
|
|
108
108
|
versionId: expect.any(String),
|
|
109
109
|
};
|
|
110
|
-
expect(
|
|
111
|
-
id:
|
|
112
|
-
name:
|
|
110
|
+
expect(updatedObject).toStrictEqual({
|
|
111
|
+
id: newObject.id,
|
|
112
|
+
name: objectName,
|
|
113
113
|
value: undefined,
|
|
114
114
|
metadata: expectedMetadata,
|
|
115
115
|
});
|
|
116
|
-
const
|
|
117
|
-
expect(
|
|
118
|
-
id:
|
|
119
|
-
name:
|
|
116
|
+
const objectValue = yield workos.vault.readObject({ id: newObject.id });
|
|
117
|
+
expect(objectValue).toStrictEqual({
|
|
118
|
+
id: newObject.id,
|
|
119
|
+
name: objectName,
|
|
120
120
|
value: 'Ccara 30-40 micron',
|
|
121
121
|
metadata: expectedMetadata,
|
|
122
122
|
});
|
|
123
123
|
}));
|
|
124
|
-
it('Fails to update
|
|
125
|
-
const
|
|
126
|
-
const
|
|
127
|
-
name:
|
|
124
|
+
it('Fails to update objects with wrong version check', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
125
|
+
const objectName = `${objectPrefix}-cusco`;
|
|
126
|
+
const newObject = yield workos.vault.createObject({
|
|
127
|
+
name: objectName,
|
|
128
128
|
value: 'Tapada 20-30 micron',
|
|
129
129
|
context: { fiber: 'Alpalca' },
|
|
130
130
|
});
|
|
131
|
-
yield workos.vault.
|
|
132
|
-
id:
|
|
131
|
+
yield workos.vault.updateObject({
|
|
132
|
+
id: newObject.id,
|
|
133
133
|
value: 'Ccara 30-40 micron',
|
|
134
134
|
});
|
|
135
|
-
yield expect(workos.vault.
|
|
136
|
-
id:
|
|
135
|
+
yield expect(workos.vault.updateObject({
|
|
136
|
+
id: newObject.id,
|
|
137
137
|
value: 'Ccara 30-40 micron',
|
|
138
|
-
versionCheck:
|
|
138
|
+
versionCheck: newObject.versionId,
|
|
139
139
|
})).rejects.toThrow(conflict_exception_1.ConflictException);
|
|
140
140
|
}));
|
|
141
|
-
it('Deletes
|
|
142
|
-
const
|
|
143
|
-
const
|
|
144
|
-
name:
|
|
141
|
+
it('Deletes objects', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
142
|
+
const objectName = `${objectPrefix}-machu`;
|
|
143
|
+
const newObject = yield workos.vault.createObject({
|
|
144
|
+
name: objectName,
|
|
145
145
|
value: 'Tapada 20-30 micron',
|
|
146
146
|
context: { fiber: 'Alpalca' },
|
|
147
147
|
});
|
|
148
|
-
yield workos.vault.
|
|
149
|
-
yield expect(workos.vault.
|
|
148
|
+
yield workos.vault.deleteObject({ id: newObject.id });
|
|
149
|
+
yield expect(workos.vault.readObject({ id: newObject.id })).rejects.toThrow(index_worker_1.NotFoundException);
|
|
150
150
|
}));
|
|
151
|
-
it('Describes
|
|
152
|
-
const
|
|
153
|
-
const
|
|
154
|
-
name:
|
|
151
|
+
it('Describes objects', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
152
|
+
const objectName = `${(0, crypto_1.randomUUID)()}-trujillo`;
|
|
153
|
+
const newObject = yield workos.vault.createObject({
|
|
154
|
+
name: objectName,
|
|
155
155
|
value: 'Qiviut 11-13 micron',
|
|
156
156
|
context: { fiber: 'Musk Ox' },
|
|
157
157
|
});
|
|
158
|
-
const
|
|
159
|
-
id:
|
|
158
|
+
const objectDescription = yield workos.vault.describeObject({
|
|
159
|
+
id: newObject.id,
|
|
160
160
|
});
|
|
161
161
|
const expectedMetadata = {
|
|
162
162
|
id: expect.any(String),
|
|
@@ -172,74 +172,74 @@ describe.skip('Vault Live Test', () => {
|
|
|
172
172
|
},
|
|
173
173
|
versionId: expect.any(String),
|
|
174
174
|
};
|
|
175
|
-
expect(
|
|
176
|
-
id:
|
|
177
|
-
name:
|
|
175
|
+
expect(objectDescription).toStrictEqual({
|
|
176
|
+
id: newObject.id,
|
|
177
|
+
name: objectName,
|
|
178
178
|
metadata: expectedMetadata,
|
|
179
179
|
value: undefined,
|
|
180
180
|
});
|
|
181
181
|
}));
|
|
182
|
-
it('Lists
|
|
183
|
-
const
|
|
184
|
-
const
|
|
185
|
-
const listPrefix = `${
|
|
186
|
-
for (let i = 0; i <
|
|
187
|
-
const
|
|
188
|
-
yield workos.vault.
|
|
189
|
-
name:
|
|
182
|
+
it('Lists objects with pagination', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
183
|
+
const objectNames = [];
|
|
184
|
+
const numObjects = 6;
|
|
185
|
+
const listPrefix = `${objectPrefix}-${(0, crypto_1.randomUUID)()}`;
|
|
186
|
+
for (let i = 0; i < numObjects; i++) {
|
|
187
|
+
const objectName = `${listPrefix}-${i}`;
|
|
188
|
+
yield workos.vault.createObject({
|
|
189
|
+
name: objectName,
|
|
190
190
|
value: 'Qiviut 11-13 micron',
|
|
191
191
|
context: { fiber: 'Musk Ox' },
|
|
192
192
|
});
|
|
193
|
-
|
|
193
|
+
objectNames.push(objectName);
|
|
194
194
|
}
|
|
195
|
-
const
|
|
195
|
+
const allObjectNames = [];
|
|
196
196
|
let before;
|
|
197
197
|
do {
|
|
198
|
-
const list = yield workos.vault.
|
|
198
|
+
const list = yield workos.vault.listObjects({
|
|
199
199
|
limit: 2,
|
|
200
200
|
after: before,
|
|
201
201
|
});
|
|
202
|
-
for (const
|
|
203
|
-
if (
|
|
204
|
-
|
|
202
|
+
for (const object of list.data) {
|
|
203
|
+
if (object.name.startsWith(listPrefix)) {
|
|
204
|
+
allObjectNames.push(object.name);
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
207
|
before = list.listMetadata.before;
|
|
208
208
|
} while (before !== undefined);
|
|
209
|
-
const
|
|
210
|
-
expect(
|
|
211
|
-
expect(
|
|
209
|
+
const missingObjects = objectNames.filter((name) => !allObjectNames.includes(name));
|
|
210
|
+
expect(allObjectNames.length).toEqual(numObjects);
|
|
211
|
+
expect(missingObjects).toStrictEqual([]);
|
|
212
212
|
}));
|
|
213
|
-
it('Lists
|
|
214
|
-
const
|
|
215
|
-
const
|
|
216
|
-
name:
|
|
213
|
+
it('Lists object versions', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
214
|
+
const objectName = `${objectPrefix}-arequipa`;
|
|
215
|
+
const newObject = yield workos.vault.createObject({
|
|
216
|
+
name: objectName,
|
|
217
217
|
value: 'Tapada 20-30 micron',
|
|
218
218
|
context: { fiber: 'Alpalca' },
|
|
219
219
|
});
|
|
220
|
-
const
|
|
221
|
-
id:
|
|
220
|
+
const updatedObject = yield workos.vault.updateObject({
|
|
221
|
+
id: newObject.id,
|
|
222
222
|
value: 'Ccara 30-40 micron',
|
|
223
223
|
});
|
|
224
|
-
const versions = yield workos.vault.
|
|
225
|
-
id:
|
|
224
|
+
const versions = yield workos.vault.listObjectVersions({
|
|
225
|
+
id: newObject.id,
|
|
226
226
|
});
|
|
227
227
|
expect(versions.length).toBe(2);
|
|
228
228
|
const currentVersion = versions.find((v) => v.currentVersion);
|
|
229
|
-
expect(currentVersion === null || currentVersion === void 0 ? void 0 : currentVersion.id).toBe(
|
|
230
|
-
const firstVersion = versions.find((v) => v.id ===
|
|
229
|
+
expect(currentVersion === null || currentVersion === void 0 ? void 0 : currentVersion.id).toBe(updatedObject.metadata.versionId);
|
|
230
|
+
const firstVersion = versions.find((v) => v.id === newObject.versionId);
|
|
231
231
|
expect(firstVersion === null || firstVersion === void 0 ? void 0 : firstVersion.currentVersion).toBe(false);
|
|
232
232
|
}));
|
|
233
233
|
});
|
|
234
234
|
describe('encrypt and decrypt', () => {
|
|
235
235
|
it('encrypts and decrypts data', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
236
|
-
const
|
|
236
|
+
const superObject = 'hot water freezes faster than cold water';
|
|
237
237
|
const keyContext = {
|
|
238
238
|
everything: 'everywhere',
|
|
239
239
|
};
|
|
240
|
-
const encrypted = yield workos.vault.encrypt(
|
|
240
|
+
const encrypted = yield workos.vault.encrypt(superObject, keyContext);
|
|
241
241
|
const decrypted = yield workos.vault.decrypt(encrypted);
|
|
242
|
-
expect(decrypted).toBe(
|
|
242
|
+
expect(decrypted).toBe(superObject);
|
|
243
243
|
}));
|
|
244
244
|
});
|
|
245
245
|
});
|
package/lib/vault/vault.d.ts
CHANGED
|
@@ -1,19 +1,26 @@
|
|
|
1
1
|
import { PaginationOptions } from '../index.worker';
|
|
2
2
|
import { WorkOS } from '../workos';
|
|
3
|
-
import { CreateDataKeyOptions,
|
|
3
|
+
import { CreateDataKeyOptions, CreateObjectOptions, DataKey, DataKeyPair, DecryptDataKeyOptions, DeleteObjectOptions, ReadObjectOptions, KeyContext, ObjectDigest, ObjectMetadata, ObjectVersion, UpdateObjectOptions, VaultObject } from './interfaces';
|
|
4
4
|
import { List } from '../common/interfaces';
|
|
5
5
|
export declare class Vault {
|
|
6
6
|
private readonly workos;
|
|
7
7
|
constructor(workos: WorkOS);
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
createObject(options: CreateObjectOptions): Promise<ObjectMetadata>;
|
|
9
|
+
listObjects(options?: PaginationOptions | undefined): Promise<List<ObjectDigest>>;
|
|
10
|
+
listObjectVersions(options: ReadObjectOptions): Promise<ObjectVersion[]>;
|
|
11
|
+
readObject(options: ReadObjectOptions): Promise<VaultObject>;
|
|
12
|
+
describeObject(options: ReadObjectOptions): Promise<VaultObject>;
|
|
13
|
+
updateObject(options: UpdateObjectOptions): Promise<VaultObject>;
|
|
14
|
+
deleteObject(options: DeleteObjectOptions): Promise<void>;
|
|
15
15
|
createDataKey(options: CreateDataKeyOptions): Promise<DataKeyPair>;
|
|
16
16
|
decryptDataKey(options: DecryptDataKeyOptions): Promise<DataKey>;
|
|
17
|
-
encrypt(data: string, context:
|
|
17
|
+
encrypt(data: string, context: KeyContext): Promise<string>;
|
|
18
18
|
decrypt(encryptedData: string): Promise<string>;
|
|
19
|
+
createSecret: (options: CreateObjectOptions) => Promise<ObjectMetadata>;
|
|
20
|
+
listSecrets: (options?: PaginationOptions | undefined) => Promise<List<ObjectDigest>>;
|
|
21
|
+
listSecretVersions: (options: ReadObjectOptions) => Promise<ObjectVersion[]>;
|
|
22
|
+
readSecret: (options: ReadObjectOptions) => Promise<VaultObject>;
|
|
23
|
+
describeSecret: (options: ReadObjectOptions) => Promise<VaultObject>;
|
|
24
|
+
updateSecret: (options: UpdateObjectOptions) => Promise<VaultObject>;
|
|
25
|
+
deleteSecret: (options: DeleteObjectOptions) => Promise<void>;
|
|
19
26
|
}
|
package/lib/vault/vault.js
CHANGED
|
@@ -13,18 +13,46 @@ exports.Vault = void 0;
|
|
|
13
13
|
const decrypt_1 = require("./cryptography/decrypt");
|
|
14
14
|
const encrypt_1 = require("./cryptography/encrypt");
|
|
15
15
|
const vault_key_serializer_1 = require("./serializers/vault-key.serializer");
|
|
16
|
-
const
|
|
16
|
+
const vault_object_serializer_1 = require("./serializers/vault-object.serializer");
|
|
17
17
|
class Vault {
|
|
18
18
|
constructor(workos) {
|
|
19
19
|
this.workos = workos;
|
|
20
|
+
/*
|
|
21
|
+
* @deprecated Use `createObject` instead.
|
|
22
|
+
*/
|
|
23
|
+
this.createSecret = this.createObject;
|
|
24
|
+
/*
|
|
25
|
+
* @deprecated Use `listObjects` instead.
|
|
26
|
+
*/
|
|
27
|
+
this.listSecrets = this.listObjects;
|
|
28
|
+
/*
|
|
29
|
+
* @deprecated Use `listObjectVersions` instead.
|
|
30
|
+
*/
|
|
31
|
+
this.listSecretVersions = this.listObjectVersions;
|
|
32
|
+
/*
|
|
33
|
+
* @deprecated Use `readObject` instead.
|
|
34
|
+
*/
|
|
35
|
+
this.readSecret = this.readObject;
|
|
36
|
+
/*
|
|
37
|
+
* @deprecated Use `describeObject` instead.
|
|
38
|
+
*/
|
|
39
|
+
this.describeSecret = this.describeObject;
|
|
40
|
+
/*
|
|
41
|
+
* @deprecated Use `updateObject` instead.
|
|
42
|
+
*/
|
|
43
|
+
this.updateSecret = this.updateObject;
|
|
44
|
+
/*
|
|
45
|
+
* @deprecated Use `deleteObject` instead.
|
|
46
|
+
*/
|
|
47
|
+
this.deleteSecret = this.deleteObject;
|
|
20
48
|
}
|
|
21
|
-
|
|
49
|
+
createObject(options) {
|
|
22
50
|
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
-
const { data } = yield this.workos.post(`/vault/v1/kv`, (0,
|
|
24
|
-
return (0,
|
|
51
|
+
const { data } = yield this.workos.post(`/vault/v1/kv`, (0, vault_object_serializer_1.serializeCreateObjectEntity)(options));
|
|
52
|
+
return (0, vault_object_serializer_1.deserializeObjectMetadata)(data);
|
|
25
53
|
});
|
|
26
54
|
}
|
|
27
|
-
|
|
55
|
+
listObjects(options) {
|
|
28
56
|
return __awaiter(this, void 0, void 0, function* () {
|
|
29
57
|
const url = new URL('/vault/v1/kv', this.workos.baseURL);
|
|
30
58
|
if (options === null || options === void 0 ? void 0 : options.after) {
|
|
@@ -34,34 +62,34 @@ class Vault {
|
|
|
34
62
|
url.searchParams.set('limit', options.limit.toString());
|
|
35
63
|
}
|
|
36
64
|
const { data } = yield this.workos.get(url.toString());
|
|
37
|
-
return (0,
|
|
65
|
+
return (0, vault_object_serializer_1.deserializeListObjects)(data);
|
|
38
66
|
});
|
|
39
67
|
}
|
|
40
|
-
|
|
68
|
+
listObjectVersions(options) {
|
|
41
69
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42
70
|
const { data } = yield this.workos.get(`/vault/v1/kv/${encodeURIComponent(options.id)}/versions`);
|
|
43
|
-
return (0,
|
|
71
|
+
return (0, vault_object_serializer_1.desrializeListObjectVersions)(data);
|
|
44
72
|
});
|
|
45
73
|
}
|
|
46
|
-
|
|
74
|
+
readObject(options) {
|
|
47
75
|
return __awaiter(this, void 0, void 0, function* () {
|
|
48
76
|
const { data } = yield this.workos.get(`/vault/v1/kv/${encodeURIComponent(options.id)}`);
|
|
49
|
-
return (0,
|
|
77
|
+
return (0, vault_object_serializer_1.deserializeObject)(data);
|
|
50
78
|
});
|
|
51
79
|
}
|
|
52
|
-
|
|
80
|
+
describeObject(options) {
|
|
53
81
|
return __awaiter(this, void 0, void 0, function* () {
|
|
54
82
|
const { data } = yield this.workos.get(`/vault/v1/kv/${encodeURIComponent(options.id)}/metadata`);
|
|
55
|
-
return (0,
|
|
83
|
+
return (0, vault_object_serializer_1.deserializeObject)(data);
|
|
56
84
|
});
|
|
57
85
|
}
|
|
58
|
-
|
|
86
|
+
updateObject(options) {
|
|
59
87
|
return __awaiter(this, void 0, void 0, function* () {
|
|
60
|
-
const { data } = yield this.workos.put(`/vault/v1/kv/${encodeURIComponent(options.id)}`, (0,
|
|
61
|
-
return (0,
|
|
88
|
+
const { data } = yield this.workos.put(`/vault/v1/kv/${encodeURIComponent(options.id)}`, (0, vault_object_serializer_1.serializeUpdateObjectEntity)(options));
|
|
89
|
+
return (0, vault_object_serializer_1.deserializeObject)(data);
|
|
62
90
|
});
|
|
63
91
|
}
|
|
64
|
-
|
|
92
|
+
deleteObject(options) {
|
|
65
93
|
return __awaiter(this, void 0, void 0, function* () {
|
|
66
94
|
return this.workos.delete(`/vault/v1/kv/${encodeURIComponent(options.id)}`);
|
|
67
95
|
});
|
package/lib/workos.js
CHANGED
|
@@ -31,7 +31,7 @@ const widgets_1 = require("./widgets/widgets");
|
|
|
31
31
|
const actions_1 = require("./actions/actions");
|
|
32
32
|
const vault_1 = require("./vault/vault");
|
|
33
33
|
const conflict_exception_1 = require("./common/exceptions/conflict.exception");
|
|
34
|
-
const VERSION = '7.
|
|
34
|
+
const VERSION = '7.45.0';
|
|
35
35
|
const DEFAULT_HOSTNAME = 'api.workos.com';
|
|
36
36
|
const HEADER_AUTHORIZATION = 'Authorization';
|
|
37
37
|
const HEADER_IDEMPOTENCY_KEY = 'Idempotency-Key';
|
package/package.json
CHANGED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { SecretContext } from '../secret.interface';
|
|
2
|
-
export interface CreateSecretEntity {
|
|
3
|
-
name: string;
|
|
4
|
-
value: string;
|
|
5
|
-
key_context: SecretContext;
|
|
6
|
-
}
|
|
7
|
-
export interface CreateSecretOptions {
|
|
8
|
-
name: string;
|
|
9
|
-
value: string;
|
|
10
|
-
context: SecretContext;
|
|
11
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { SecretContext, SecretUpdateBy } from '../secret.interface';
|
|
2
|
-
export interface ReadSecretOptions {
|
|
3
|
-
id: string;
|
|
4
|
-
}
|
|
5
|
-
export interface ReadSecretMetadataResponse {
|
|
6
|
-
context: SecretContext;
|
|
7
|
-
environment_id: string;
|
|
8
|
-
id: string;
|
|
9
|
-
key_id: string;
|
|
10
|
-
updated_at: string;
|
|
11
|
-
updated_by: SecretUpdateBy;
|
|
12
|
-
version_id: string;
|
|
13
|
-
}
|
|
14
|
-
export interface ReadSecretResponse {
|
|
15
|
-
id: string;
|
|
16
|
-
metadata: ReadSecretMetadataResponse;
|
|
17
|
-
name: string;
|
|
18
|
-
value: string;
|
|
19
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { List, ListResponse } from '../../common/interfaces';
|
|
2
|
-
import { ReadSecretMetadataResponse, ReadSecretResponse, UpdateSecretOptions, UpdateSecretEntity, SecretMetadata, VaultSecret, SecretVersion, CreateSecretOptions, CreateSecretEntity, SecretDigestResponse, SecretDigest, ListSecretVersionsResponse } from '../interfaces';
|
|
3
|
-
export declare const deserializeSecretMetadata: (metadata: ReadSecretMetadataResponse) => SecretMetadata;
|
|
4
|
-
export declare const deserializeSecret: (secret: ReadSecretResponse) => VaultSecret;
|
|
5
|
-
export declare const deserializeListSecrets: (list: ListResponse<SecretDigestResponse>) => List<SecretDigest>;
|
|
6
|
-
export declare const desrializeListSecretVersions: (list: ListSecretVersionsResponse) => SecretVersion[];
|
|
7
|
-
export declare const serializeCreateSecretEntity: (options: CreateSecretOptions) => CreateSecretEntity;
|
|
8
|
-
export declare const serializeUpdateSecretEntity: (options: UpdateSecretOptions) => UpdateSecretEntity;
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.serializeUpdateSecretEntity = exports.serializeCreateSecretEntity = exports.desrializeListSecretVersions = exports.deserializeListSecrets = exports.deserializeSecret = exports.deserializeSecretMetadata = void 0;
|
|
4
|
-
const deserializeSecretMetadata = (metadata) => ({
|
|
5
|
-
context: metadata.context,
|
|
6
|
-
environmentId: metadata.environment_id,
|
|
7
|
-
id: metadata.id,
|
|
8
|
-
keyId: metadata.key_id,
|
|
9
|
-
updatedAt: new Date(Date.parse(metadata.updated_at)),
|
|
10
|
-
updatedBy: metadata.updated_by,
|
|
11
|
-
versionId: metadata.version_id,
|
|
12
|
-
});
|
|
13
|
-
exports.deserializeSecretMetadata = deserializeSecretMetadata;
|
|
14
|
-
const deserializeSecret = (secret) => ({
|
|
15
|
-
id: secret.id,
|
|
16
|
-
name: secret.name,
|
|
17
|
-
value: secret.value,
|
|
18
|
-
metadata: (0, exports.deserializeSecretMetadata)(secret.metadata),
|
|
19
|
-
});
|
|
20
|
-
exports.deserializeSecret = deserializeSecret;
|
|
21
|
-
const deserializeSecretDigest = (digest) => ({
|
|
22
|
-
id: digest.id,
|
|
23
|
-
name: digest.name,
|
|
24
|
-
updatedAt: new Date(Date.parse(digest.updated_at)),
|
|
25
|
-
});
|
|
26
|
-
const deserializeListSecrets = (list) => {
|
|
27
|
-
var _a, _b;
|
|
28
|
-
return ({
|
|
29
|
-
object: 'list',
|
|
30
|
-
data: list.data.map(deserializeSecretDigest),
|
|
31
|
-
listMetadata: {
|
|
32
|
-
after: (_a = list.list_metadata.after) !== null && _a !== void 0 ? _a : undefined,
|
|
33
|
-
before: (_b = list.list_metadata.before) !== null && _b !== void 0 ? _b : undefined,
|
|
34
|
-
},
|
|
35
|
-
});
|
|
36
|
-
};
|
|
37
|
-
exports.deserializeListSecrets = deserializeListSecrets;
|
|
38
|
-
const desrializeListSecretVersions = (list) => list.data.map(deserializeSecretVersion);
|
|
39
|
-
exports.desrializeListSecretVersions = desrializeListSecretVersions;
|
|
40
|
-
const deserializeSecretVersion = (version) => ({
|
|
41
|
-
createdAt: new Date(Date.parse(version.created_at)),
|
|
42
|
-
currentVersion: version.current_version,
|
|
43
|
-
id: version.id,
|
|
44
|
-
});
|
|
45
|
-
const serializeCreateSecretEntity = (options) => ({
|
|
46
|
-
name: options.name,
|
|
47
|
-
value: options.value,
|
|
48
|
-
key_context: options.context,
|
|
49
|
-
});
|
|
50
|
-
exports.serializeCreateSecretEntity = serializeCreateSecretEntity;
|
|
51
|
-
const serializeUpdateSecretEntity = (options) => ({
|
|
52
|
-
value: options.value,
|
|
53
|
-
version_check: options.versionCheck,
|
|
54
|
-
});
|
|
55
|
-
exports.serializeUpdateSecretEntity = serializeUpdateSecretEntity;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/lib/vault/interfaces/{secret/read-secret.interface.js → object/list-objects.interface.js}
RENAMED
|
File without changes
|
/package/lib/vault/interfaces/{secret/update-secret.interface.js → object/read-object.interface.js}
RENAMED
|
File without changes
|
|
File without changes
|