@dfns/sdk 0.2.4 → 0.2.5
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/codegen/Permissions/DelegatedPermissionsClient.d.ts +27 -0
- package/codegen/Permissions/DelegatedPermissionsClient.js +284 -0
- package/codegen/Permissions/PermissionsClient.d.ts +18 -0
- package/codegen/Permissions/PermissionsClient.js +156 -0
- package/codegen/Permissions/index.d.ts +3 -0
- package/codegen/Permissions/index.js +19 -0
- package/codegen/Permissions/types.d.ts +62 -0
- package/codegen/Permissions/types.js +2 -0
- package/dfnsApiClient.d.ts +6 -1
- package/dfnsApiClient.js +7 -0
- package/dfnsDelegatedApiClient.d.ts +6 -1
- package/dfnsDelegatedApiClient.js +7 -0
- package/package.json +1 -1
- package/types/permissions.d.ts +1 -0
- package/types/permissions.js +17 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { SignUserActionChallengeRequest, UserActionChallengeResponse } from '../../baseAuthApi';
|
|
2
|
+
import { DfnsDelegatedApiClientOptions } from '../../dfnsDelegatedApiClient';
|
|
3
|
+
import * as T from './types';
|
|
4
|
+
export declare class DelegatedPermissionsClient {
|
|
5
|
+
private apiOptions;
|
|
6
|
+
constructor(apiOptions: DfnsDelegatedApiClientOptions);
|
|
7
|
+
createPermissionInit(request: T.CreatePermissionRequest): Promise<UserActionChallengeResponse>;
|
|
8
|
+
createPermissionComplete(request: T.CreatePermissionRequest, signedChallenge: SignUserActionChallengeRequest): Promise<T.CreatePermissionResponse>;
|
|
9
|
+
updatePermissionInit(request: T.UpdatePermissionRequest): Promise<UserActionChallengeResponse>;
|
|
10
|
+
updatePermissionComplete(request: T.UpdatePermissionRequest, signedChallenge: SignUserActionChallengeRequest): Promise<T.UpdatePermissionResponse>;
|
|
11
|
+
archivePermissionInit(request: T.ArchivePermissionRequest): Promise<UserActionChallengeResponse>;
|
|
12
|
+
archivePermissionComplete(request: T.ArchivePermissionRequest, signedChallenge: SignUserActionChallengeRequest): Promise<T.ArchivePermissionResponse>;
|
|
13
|
+
getPermissionById(request: T.GetPermissionByIdRequest): Promise<T.GetPermissionByIdResponse>;
|
|
14
|
+
listPermissions(): Promise<T.ListPermissionsResponse>;
|
|
15
|
+
createPermissionPredicateInit(request: T.CreatePermissionPredicateRequest): Promise<UserActionChallengeResponse>;
|
|
16
|
+
createPermissionPredicateComplete(request: T.CreatePermissionPredicateRequest, signedChallenge: SignUserActionChallengeRequest): Promise<T.CreatePermissionPredicateResponse>;
|
|
17
|
+
updatePermissionPredicateInit(request: T.UpdatePermissionPredicateRequest): Promise<UserActionChallengeResponse>;
|
|
18
|
+
updatePermissionPredicateComplete(request: T.UpdatePermissionPredicateRequest, signedChallenge: SignUserActionChallengeRequest): Promise<T.UpdatePermissionPredicateResponse>;
|
|
19
|
+
archivePermissionPredicateInit(request: T.ArchivePermissionPredicateRequest): Promise<UserActionChallengeResponse>;
|
|
20
|
+
archivePermissionPredicateComplete(request: T.ArchivePermissionPredicateRequest, signedChallenge: SignUserActionChallengeRequest): Promise<T.ArchivePermissionPredicateResponse>;
|
|
21
|
+
listPermissionPredicates(request: T.ListPermissionPredicatesRequest): Promise<T.ListPermissionPredicatesResponse>;
|
|
22
|
+
createPermissionAssignmentInit(request: T.CreatePermissionAssignmentRequest): Promise<UserActionChallengeResponse>;
|
|
23
|
+
createPermissionAssignmentComplete(request: T.CreatePermissionAssignmentRequest, signedChallenge: SignUserActionChallengeRequest): Promise<T.CreatePermissionAssignmentResponse>;
|
|
24
|
+
revokePermissionAssignmentInit(request: T.RevokePermissionAssignmentRequest): Promise<UserActionChallengeResponse>;
|
|
25
|
+
revokePermissionAssignmentComplete(request: T.RevokePermissionAssignmentRequest, signedChallenge: SignUserActionChallengeRequest): Promise<T.RevokePermissionAssignmentResponse>;
|
|
26
|
+
listPermissionAssignments(request: T.ListPermissionAssignmentsRequest): Promise<T.ListPermissionAssignmentsResponse>;
|
|
27
|
+
}
|
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DelegatedPermissionsClient = void 0;
|
|
4
|
+
const baseAuthApi_1 = require("../../baseAuthApi");
|
|
5
|
+
const fetch_1 = require("../../utils/fetch");
|
|
6
|
+
const url_1 = require("../../utils/url");
|
|
7
|
+
class DelegatedPermissionsClient {
|
|
8
|
+
constructor(apiOptions) {
|
|
9
|
+
this.apiOptions = apiOptions;
|
|
10
|
+
}
|
|
11
|
+
async createPermissionInit(request) {
|
|
12
|
+
const path = (0, url_1.buildPathAndQuery)('/permissions', {
|
|
13
|
+
path: {},
|
|
14
|
+
query: {},
|
|
15
|
+
});
|
|
16
|
+
const challenge = await baseAuthApi_1.BaseAuthApi.createUserActionChallenge({
|
|
17
|
+
userActionHttpMethod: 'POST',
|
|
18
|
+
userActionHttpPath: path,
|
|
19
|
+
userActionPayload: JSON.stringify(request.body),
|
|
20
|
+
userActionServerKind: 'Api',
|
|
21
|
+
}, this.apiOptions);
|
|
22
|
+
return challenge;
|
|
23
|
+
}
|
|
24
|
+
async createPermissionComplete(request, signedChallenge) {
|
|
25
|
+
const path = (0, url_1.buildPathAndQuery)('/permissions', {
|
|
26
|
+
path: {},
|
|
27
|
+
query: {},
|
|
28
|
+
});
|
|
29
|
+
const { userAction } = await baseAuthApi_1.BaseAuthApi.signUserActionChallenge(signedChallenge, this.apiOptions);
|
|
30
|
+
const response = await (0, fetch_1.simpleFetch)(path, {
|
|
31
|
+
method: 'POST',
|
|
32
|
+
body: request.body,
|
|
33
|
+
headers: { 'x-dfns-useraction': userAction },
|
|
34
|
+
apiOptions: this.apiOptions,
|
|
35
|
+
});
|
|
36
|
+
return response.json();
|
|
37
|
+
}
|
|
38
|
+
async updatePermissionInit(request) {
|
|
39
|
+
const path = (0, url_1.buildPathAndQuery)('/permissions/:permissionId', {
|
|
40
|
+
path: { permissionId: request.permissionId },
|
|
41
|
+
query: {},
|
|
42
|
+
});
|
|
43
|
+
const challenge = await baseAuthApi_1.BaseAuthApi.createUserActionChallenge({
|
|
44
|
+
userActionHttpMethod: 'PUT',
|
|
45
|
+
userActionHttpPath: path,
|
|
46
|
+
userActionPayload: JSON.stringify(request.body),
|
|
47
|
+
userActionServerKind: 'Api',
|
|
48
|
+
}, this.apiOptions);
|
|
49
|
+
return challenge;
|
|
50
|
+
}
|
|
51
|
+
async updatePermissionComplete(request, signedChallenge) {
|
|
52
|
+
const path = (0, url_1.buildPathAndQuery)('/permissions/:permissionId', {
|
|
53
|
+
path: { permissionId: request.permissionId },
|
|
54
|
+
query: {},
|
|
55
|
+
});
|
|
56
|
+
const { userAction } = await baseAuthApi_1.BaseAuthApi.signUserActionChallenge(signedChallenge, this.apiOptions);
|
|
57
|
+
const response = await (0, fetch_1.simpleFetch)(path, {
|
|
58
|
+
method: 'PUT',
|
|
59
|
+
body: request.body,
|
|
60
|
+
headers: { 'x-dfns-useraction': userAction },
|
|
61
|
+
apiOptions: this.apiOptions,
|
|
62
|
+
});
|
|
63
|
+
return response.json();
|
|
64
|
+
}
|
|
65
|
+
async archivePermissionInit(request) {
|
|
66
|
+
const path = (0, url_1.buildPathAndQuery)('/permissions/:permissionId/archive', {
|
|
67
|
+
path: { permissionId: request.permissionId },
|
|
68
|
+
query: {},
|
|
69
|
+
});
|
|
70
|
+
const challenge = await baseAuthApi_1.BaseAuthApi.createUserActionChallenge({
|
|
71
|
+
userActionHttpMethod: 'PUT',
|
|
72
|
+
userActionHttpPath: path,
|
|
73
|
+
userActionPayload: JSON.stringify(request.body),
|
|
74
|
+
userActionServerKind: 'Api',
|
|
75
|
+
}, this.apiOptions);
|
|
76
|
+
return challenge;
|
|
77
|
+
}
|
|
78
|
+
async archivePermissionComplete(request, signedChallenge) {
|
|
79
|
+
const path = (0, url_1.buildPathAndQuery)('/permissions/:permissionId/archive', {
|
|
80
|
+
path: { permissionId: request.permissionId },
|
|
81
|
+
query: {},
|
|
82
|
+
});
|
|
83
|
+
const { userAction } = await baseAuthApi_1.BaseAuthApi.signUserActionChallenge(signedChallenge, this.apiOptions);
|
|
84
|
+
const response = await (0, fetch_1.simpleFetch)(path, {
|
|
85
|
+
method: 'PUT',
|
|
86
|
+
body: request.body,
|
|
87
|
+
headers: { 'x-dfns-useraction': userAction },
|
|
88
|
+
apiOptions: this.apiOptions,
|
|
89
|
+
});
|
|
90
|
+
return response.json();
|
|
91
|
+
}
|
|
92
|
+
async getPermissionById(request) {
|
|
93
|
+
const path = (0, url_1.buildPathAndQuery)('/permissions/:permissionId', {
|
|
94
|
+
path: { permissionId: request.permissionId },
|
|
95
|
+
query: {},
|
|
96
|
+
});
|
|
97
|
+
const response = await (0, fetch_1.simpleFetch)(path, {
|
|
98
|
+
method: 'GET',
|
|
99
|
+
apiOptions: this.apiOptions,
|
|
100
|
+
});
|
|
101
|
+
return response.json();
|
|
102
|
+
}
|
|
103
|
+
async listPermissions() {
|
|
104
|
+
const path = (0, url_1.buildPathAndQuery)('/permissions', {
|
|
105
|
+
path: {},
|
|
106
|
+
query: {},
|
|
107
|
+
});
|
|
108
|
+
const response = await (0, fetch_1.simpleFetch)(path, {
|
|
109
|
+
method: 'GET',
|
|
110
|
+
apiOptions: this.apiOptions,
|
|
111
|
+
});
|
|
112
|
+
return response.json();
|
|
113
|
+
}
|
|
114
|
+
async createPermissionPredicateInit(request) {
|
|
115
|
+
const path = (0, url_1.buildPathAndQuery)('/dev-permissions/:permissionId/predicates', {
|
|
116
|
+
path: { permissionId: request.permissionId },
|
|
117
|
+
query: {},
|
|
118
|
+
});
|
|
119
|
+
const challenge = await baseAuthApi_1.BaseAuthApi.createUserActionChallenge({
|
|
120
|
+
userActionHttpMethod: 'POST',
|
|
121
|
+
userActionHttpPath: path,
|
|
122
|
+
userActionPayload: JSON.stringify(request.body),
|
|
123
|
+
userActionServerKind: 'Api',
|
|
124
|
+
}, this.apiOptions);
|
|
125
|
+
return challenge;
|
|
126
|
+
}
|
|
127
|
+
async createPermissionPredicateComplete(request, signedChallenge) {
|
|
128
|
+
const path = (0, url_1.buildPathAndQuery)('/dev-permissions/:permissionId/predicates', {
|
|
129
|
+
path: { permissionId: request.permissionId },
|
|
130
|
+
query: {},
|
|
131
|
+
});
|
|
132
|
+
const { userAction } = await baseAuthApi_1.BaseAuthApi.signUserActionChallenge(signedChallenge, this.apiOptions);
|
|
133
|
+
const response = await (0, fetch_1.simpleFetch)(path, {
|
|
134
|
+
method: 'POST',
|
|
135
|
+
body: request.body,
|
|
136
|
+
headers: { 'x-dfns-useraction': userAction },
|
|
137
|
+
apiOptions: this.apiOptions,
|
|
138
|
+
});
|
|
139
|
+
return response.json();
|
|
140
|
+
}
|
|
141
|
+
async updatePermissionPredicateInit(request) {
|
|
142
|
+
const path = (0, url_1.buildPathAndQuery)('/dev-permissions/:permissionId/predicates/:predicateId', {
|
|
143
|
+
path: {
|
|
144
|
+
permissionId: request.permissionId,
|
|
145
|
+
predicateId: request.predicateId,
|
|
146
|
+
},
|
|
147
|
+
query: {},
|
|
148
|
+
});
|
|
149
|
+
const challenge = await baseAuthApi_1.BaseAuthApi.createUserActionChallenge({
|
|
150
|
+
userActionHttpMethod: 'PUT',
|
|
151
|
+
userActionHttpPath: path,
|
|
152
|
+
userActionPayload: JSON.stringify(request.body),
|
|
153
|
+
userActionServerKind: 'Api',
|
|
154
|
+
}, this.apiOptions);
|
|
155
|
+
return challenge;
|
|
156
|
+
}
|
|
157
|
+
async updatePermissionPredicateComplete(request, signedChallenge) {
|
|
158
|
+
const path = (0, url_1.buildPathAndQuery)('/dev-permissions/:permissionId/predicates/:predicateId', {
|
|
159
|
+
path: {
|
|
160
|
+
permissionId: request.permissionId,
|
|
161
|
+
predicateId: request.predicateId,
|
|
162
|
+
},
|
|
163
|
+
query: {},
|
|
164
|
+
});
|
|
165
|
+
const { userAction } = await baseAuthApi_1.BaseAuthApi.signUserActionChallenge(signedChallenge, this.apiOptions);
|
|
166
|
+
const response = await (0, fetch_1.simpleFetch)(path, {
|
|
167
|
+
method: 'PUT',
|
|
168
|
+
body: request.body,
|
|
169
|
+
headers: { 'x-dfns-useraction': userAction },
|
|
170
|
+
apiOptions: this.apiOptions,
|
|
171
|
+
});
|
|
172
|
+
return response.json();
|
|
173
|
+
}
|
|
174
|
+
async archivePermissionPredicateInit(request) {
|
|
175
|
+
const path = (0, url_1.buildPathAndQuery)('/dev-permissions/:permissionId/predicates/:predicateId/archive', {
|
|
176
|
+
path: {
|
|
177
|
+
permissionId: request.permissionId,
|
|
178
|
+
predicateId: request.predicateId,
|
|
179
|
+
},
|
|
180
|
+
query: {},
|
|
181
|
+
});
|
|
182
|
+
const challenge = await baseAuthApi_1.BaseAuthApi.createUserActionChallenge({
|
|
183
|
+
userActionHttpMethod: 'PUT',
|
|
184
|
+
userActionHttpPath: path,
|
|
185
|
+
userActionPayload: JSON.stringify(request.body),
|
|
186
|
+
userActionServerKind: 'Api',
|
|
187
|
+
}, this.apiOptions);
|
|
188
|
+
return challenge;
|
|
189
|
+
}
|
|
190
|
+
async archivePermissionPredicateComplete(request, signedChallenge) {
|
|
191
|
+
const path = (0, url_1.buildPathAndQuery)('/dev-permissions/:permissionId/predicates/:predicateId/archive', {
|
|
192
|
+
path: {
|
|
193
|
+
permissionId: request.permissionId,
|
|
194
|
+
predicateId: request.predicateId,
|
|
195
|
+
},
|
|
196
|
+
query: {},
|
|
197
|
+
});
|
|
198
|
+
const { userAction } = await baseAuthApi_1.BaseAuthApi.signUserActionChallenge(signedChallenge, this.apiOptions);
|
|
199
|
+
const response = await (0, fetch_1.simpleFetch)(path, {
|
|
200
|
+
method: 'PUT',
|
|
201
|
+
body: request.body,
|
|
202
|
+
headers: { 'x-dfns-useraction': userAction },
|
|
203
|
+
apiOptions: this.apiOptions,
|
|
204
|
+
});
|
|
205
|
+
return response.json();
|
|
206
|
+
}
|
|
207
|
+
async listPermissionPredicates(request) {
|
|
208
|
+
const path = (0, url_1.buildPathAndQuery)('/dev-permissions/:permissionId/predicates', {
|
|
209
|
+
path: { permissionId: request.permissionId },
|
|
210
|
+
query: {},
|
|
211
|
+
});
|
|
212
|
+
const response = await (0, fetch_1.simpleFetch)(path, {
|
|
213
|
+
method: 'GET',
|
|
214
|
+
apiOptions: this.apiOptions,
|
|
215
|
+
});
|
|
216
|
+
return response.json();
|
|
217
|
+
}
|
|
218
|
+
async createPermissionAssignmentInit(request) {
|
|
219
|
+
const path = (0, url_1.buildPathAndQuery)('/permissions/assignments', {
|
|
220
|
+
path: {},
|
|
221
|
+
query: {},
|
|
222
|
+
});
|
|
223
|
+
const challenge = await baseAuthApi_1.BaseAuthApi.createUserActionChallenge({
|
|
224
|
+
userActionHttpMethod: 'POST',
|
|
225
|
+
userActionHttpPath: path,
|
|
226
|
+
userActionPayload: JSON.stringify(request.body),
|
|
227
|
+
userActionServerKind: 'Api',
|
|
228
|
+
}, this.apiOptions);
|
|
229
|
+
return challenge;
|
|
230
|
+
}
|
|
231
|
+
async createPermissionAssignmentComplete(request, signedChallenge) {
|
|
232
|
+
const path = (0, url_1.buildPathAndQuery)('/permissions/assignments', {
|
|
233
|
+
path: {},
|
|
234
|
+
query: {},
|
|
235
|
+
});
|
|
236
|
+
const { userAction } = await baseAuthApi_1.BaseAuthApi.signUserActionChallenge(signedChallenge, this.apiOptions);
|
|
237
|
+
const response = await (0, fetch_1.simpleFetch)(path, {
|
|
238
|
+
method: 'POST',
|
|
239
|
+
body: request.body,
|
|
240
|
+
headers: { 'x-dfns-useraction': userAction },
|
|
241
|
+
apiOptions: this.apiOptions,
|
|
242
|
+
});
|
|
243
|
+
return response.json();
|
|
244
|
+
}
|
|
245
|
+
async revokePermissionAssignmentInit(request) {
|
|
246
|
+
const path = (0, url_1.buildPathAndQuery)('/permissions/assignments/:assignmentId', {
|
|
247
|
+
path: { assignmentId: request.assignmentId },
|
|
248
|
+
query: {},
|
|
249
|
+
});
|
|
250
|
+
const challenge = await baseAuthApi_1.BaseAuthApi.createUserActionChallenge({
|
|
251
|
+
userActionHttpMethod: 'DELETE',
|
|
252
|
+
userActionHttpPath: path,
|
|
253
|
+
userActionPayload: JSON.stringify({}),
|
|
254
|
+
userActionServerKind: 'Api',
|
|
255
|
+
}, this.apiOptions);
|
|
256
|
+
return challenge;
|
|
257
|
+
}
|
|
258
|
+
async revokePermissionAssignmentComplete(request, signedChallenge) {
|
|
259
|
+
const path = (0, url_1.buildPathAndQuery)('/permissions/assignments/:assignmentId', {
|
|
260
|
+
path: { assignmentId: request.assignmentId },
|
|
261
|
+
query: {},
|
|
262
|
+
});
|
|
263
|
+
const { userAction } = await baseAuthApi_1.BaseAuthApi.signUserActionChallenge(signedChallenge, this.apiOptions);
|
|
264
|
+
const response = await (0, fetch_1.simpleFetch)(path, {
|
|
265
|
+
method: 'DELETE',
|
|
266
|
+
body: {},
|
|
267
|
+
headers: { 'x-dfns-useraction': userAction },
|
|
268
|
+
apiOptions: this.apiOptions,
|
|
269
|
+
});
|
|
270
|
+
return response.json();
|
|
271
|
+
}
|
|
272
|
+
async listPermissionAssignments(request) {
|
|
273
|
+
const path = (0, url_1.buildPathAndQuery)('/permissions/assignments', {
|
|
274
|
+
path: {},
|
|
275
|
+
query: request.query ?? {},
|
|
276
|
+
});
|
|
277
|
+
const response = await (0, fetch_1.simpleFetch)(path, {
|
|
278
|
+
method: 'GET',
|
|
279
|
+
apiOptions: this.apiOptions,
|
|
280
|
+
});
|
|
281
|
+
return response.json();
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
exports.DelegatedPermissionsClient = DelegatedPermissionsClient;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { DfnsApiClientOptions } from '../../dfnsApiClient';
|
|
2
|
+
import * as T from './types';
|
|
3
|
+
export declare class PermissionsClient {
|
|
4
|
+
private apiOptions;
|
|
5
|
+
constructor(apiOptions: DfnsApiClientOptions);
|
|
6
|
+
createPermission(request: T.CreatePermissionRequest): Promise<T.CreatePermissionResponse>;
|
|
7
|
+
updatePermission(request: T.UpdatePermissionRequest): Promise<T.UpdatePermissionResponse>;
|
|
8
|
+
archivePermission(request: T.ArchivePermissionRequest): Promise<T.ArchivePermissionResponse>;
|
|
9
|
+
getPermissionById(request: T.GetPermissionByIdRequest): Promise<T.GetPermissionByIdResponse>;
|
|
10
|
+
listPermissions(): Promise<T.ListPermissionsResponse>;
|
|
11
|
+
createPermissionPredicate(request: T.CreatePermissionPredicateRequest): Promise<T.CreatePermissionPredicateResponse>;
|
|
12
|
+
updatePermissionPredicate(request: T.UpdatePermissionPredicateRequest): Promise<T.UpdatePermissionPredicateResponse>;
|
|
13
|
+
archivePermissionPredicate(request: T.ArchivePermissionPredicateRequest): Promise<T.ArchivePermissionPredicateResponse>;
|
|
14
|
+
listPermissionPredicates(request: T.ListPermissionPredicatesRequest): Promise<T.ListPermissionPredicatesResponse>;
|
|
15
|
+
createPermissionAssignment(request: T.CreatePermissionAssignmentRequest): Promise<T.CreatePermissionAssignmentResponse>;
|
|
16
|
+
revokePermissionAssignment(request: T.RevokePermissionAssignmentRequest): Promise<T.RevokePermissionAssignmentResponse>;
|
|
17
|
+
listPermissionAssignments(request: T.ListPermissionAssignmentsRequest): Promise<T.ListPermissionAssignmentsResponse>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PermissionsClient = void 0;
|
|
4
|
+
const fetch_1 = require("../../utils/fetch");
|
|
5
|
+
const url_1 = require("../../utils/url");
|
|
6
|
+
class PermissionsClient {
|
|
7
|
+
constructor(apiOptions) {
|
|
8
|
+
this.apiOptions = apiOptions;
|
|
9
|
+
}
|
|
10
|
+
async createPermission(request) {
|
|
11
|
+
const path = (0, url_1.buildPathAndQuery)('/permissions', {
|
|
12
|
+
path: {},
|
|
13
|
+
query: {},
|
|
14
|
+
});
|
|
15
|
+
const response = await (0, fetch_1.userActionFetch)(path, {
|
|
16
|
+
method: 'POST',
|
|
17
|
+
body: request.body,
|
|
18
|
+
apiOptions: this.apiOptions,
|
|
19
|
+
});
|
|
20
|
+
return response.json();
|
|
21
|
+
}
|
|
22
|
+
async updatePermission(request) {
|
|
23
|
+
const path = (0, url_1.buildPathAndQuery)('/permissions/:permissionId', {
|
|
24
|
+
path: { permissionId: request.permissionId },
|
|
25
|
+
query: {},
|
|
26
|
+
});
|
|
27
|
+
const response = await (0, fetch_1.userActionFetch)(path, {
|
|
28
|
+
method: 'PUT',
|
|
29
|
+
body: request.body,
|
|
30
|
+
apiOptions: this.apiOptions,
|
|
31
|
+
});
|
|
32
|
+
return response.json();
|
|
33
|
+
}
|
|
34
|
+
async archivePermission(request) {
|
|
35
|
+
const path = (0, url_1.buildPathAndQuery)('/permissions/:permissionId/archive', {
|
|
36
|
+
path: { permissionId: request.permissionId },
|
|
37
|
+
query: {},
|
|
38
|
+
});
|
|
39
|
+
const response = await (0, fetch_1.userActionFetch)(path, {
|
|
40
|
+
method: 'PUT',
|
|
41
|
+
body: request.body,
|
|
42
|
+
apiOptions: this.apiOptions,
|
|
43
|
+
});
|
|
44
|
+
return response.json();
|
|
45
|
+
}
|
|
46
|
+
async getPermissionById(request) {
|
|
47
|
+
const path = (0, url_1.buildPathAndQuery)('/permissions/:permissionId', {
|
|
48
|
+
path: { permissionId: request.permissionId },
|
|
49
|
+
query: {},
|
|
50
|
+
});
|
|
51
|
+
const response = await (0, fetch_1.simpleFetch)(path, {
|
|
52
|
+
method: 'GET',
|
|
53
|
+
apiOptions: this.apiOptions,
|
|
54
|
+
});
|
|
55
|
+
return response.json();
|
|
56
|
+
}
|
|
57
|
+
async listPermissions() {
|
|
58
|
+
const path = (0, url_1.buildPathAndQuery)('/permissions', {
|
|
59
|
+
path: {},
|
|
60
|
+
query: {},
|
|
61
|
+
});
|
|
62
|
+
const response = await (0, fetch_1.simpleFetch)(path, {
|
|
63
|
+
method: 'GET',
|
|
64
|
+
apiOptions: this.apiOptions,
|
|
65
|
+
});
|
|
66
|
+
return response.json();
|
|
67
|
+
}
|
|
68
|
+
async createPermissionPredicate(request) {
|
|
69
|
+
const path = (0, url_1.buildPathAndQuery)('/dev-permissions/:permissionId/predicates', {
|
|
70
|
+
path: { permissionId: request.permissionId },
|
|
71
|
+
query: {},
|
|
72
|
+
});
|
|
73
|
+
const response = await (0, fetch_1.userActionFetch)(path, {
|
|
74
|
+
method: 'POST',
|
|
75
|
+
body: request.body,
|
|
76
|
+
apiOptions: this.apiOptions,
|
|
77
|
+
});
|
|
78
|
+
return response.json();
|
|
79
|
+
}
|
|
80
|
+
async updatePermissionPredicate(request) {
|
|
81
|
+
const path = (0, url_1.buildPathAndQuery)('/dev-permissions/:permissionId/predicates/:predicateId', {
|
|
82
|
+
path: {
|
|
83
|
+
permissionId: request.permissionId,
|
|
84
|
+
predicateId: request.predicateId,
|
|
85
|
+
},
|
|
86
|
+
query: {},
|
|
87
|
+
});
|
|
88
|
+
const response = await (0, fetch_1.userActionFetch)(path, {
|
|
89
|
+
method: 'PUT',
|
|
90
|
+
body: request.body,
|
|
91
|
+
apiOptions: this.apiOptions,
|
|
92
|
+
});
|
|
93
|
+
return response.json();
|
|
94
|
+
}
|
|
95
|
+
async archivePermissionPredicate(request) {
|
|
96
|
+
const path = (0, url_1.buildPathAndQuery)('/dev-permissions/:permissionId/predicates/:predicateId/archive', {
|
|
97
|
+
path: {
|
|
98
|
+
permissionId: request.permissionId,
|
|
99
|
+
predicateId: request.predicateId,
|
|
100
|
+
},
|
|
101
|
+
query: {},
|
|
102
|
+
});
|
|
103
|
+
const response = await (0, fetch_1.userActionFetch)(path, {
|
|
104
|
+
method: 'PUT',
|
|
105
|
+
body: request.body,
|
|
106
|
+
apiOptions: this.apiOptions,
|
|
107
|
+
});
|
|
108
|
+
return response.json();
|
|
109
|
+
}
|
|
110
|
+
async listPermissionPredicates(request) {
|
|
111
|
+
const path = (0, url_1.buildPathAndQuery)('/dev-permissions/:permissionId/predicates', {
|
|
112
|
+
path: { permissionId: request.permissionId },
|
|
113
|
+
query: {},
|
|
114
|
+
});
|
|
115
|
+
const response = await (0, fetch_1.simpleFetch)(path, {
|
|
116
|
+
method: 'GET',
|
|
117
|
+
apiOptions: this.apiOptions,
|
|
118
|
+
});
|
|
119
|
+
return response.json();
|
|
120
|
+
}
|
|
121
|
+
async createPermissionAssignment(request) {
|
|
122
|
+
const path = (0, url_1.buildPathAndQuery)('/permissions/assignments', {
|
|
123
|
+
path: {},
|
|
124
|
+
query: {},
|
|
125
|
+
});
|
|
126
|
+
const response = await (0, fetch_1.userActionFetch)(path, {
|
|
127
|
+
method: 'POST',
|
|
128
|
+
body: request.body,
|
|
129
|
+
apiOptions: this.apiOptions,
|
|
130
|
+
});
|
|
131
|
+
return response.json();
|
|
132
|
+
}
|
|
133
|
+
async revokePermissionAssignment(request) {
|
|
134
|
+
const path = (0, url_1.buildPathAndQuery)('/permissions/assignments/:assignmentId', {
|
|
135
|
+
path: { assignmentId: request.assignmentId },
|
|
136
|
+
query: {},
|
|
137
|
+
});
|
|
138
|
+
const response = await (0, fetch_1.userActionFetch)(path, {
|
|
139
|
+
method: 'DELETE',
|
|
140
|
+
apiOptions: this.apiOptions,
|
|
141
|
+
});
|
|
142
|
+
return response.json();
|
|
143
|
+
}
|
|
144
|
+
async listPermissionAssignments(request) {
|
|
145
|
+
const path = (0, url_1.buildPathAndQuery)('/permissions/assignments', {
|
|
146
|
+
path: {},
|
|
147
|
+
query: request.query ?? {},
|
|
148
|
+
});
|
|
149
|
+
const response = await (0, fetch_1.simpleFetch)(path, {
|
|
150
|
+
method: 'GET',
|
|
151
|
+
apiOptions: this.apiOptions,
|
|
152
|
+
});
|
|
153
|
+
return response.json();
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
exports.PermissionsClient = PermissionsClient;
|
|
@@ -0,0 +1,19 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./DelegatedPermissionsClient"), exports);
|
|
18
|
+
__exportStar(require("./PermissionsClient"), exports);
|
|
19
|
+
__exportStar(require("./types"), exports);
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import * as Permissions from '../datamodel/Permissions';
|
|
2
|
+
export type CreatePermissionRequest = {
|
|
3
|
+
body: Permissions.CreatePermissionInput;
|
|
4
|
+
};
|
|
5
|
+
export type CreatePermissionResponse = Permissions.Permission;
|
|
6
|
+
export type UpdatePermissionRequest = {
|
|
7
|
+
permissionId: string;
|
|
8
|
+
body: Permissions.UpdatePermissionInput;
|
|
9
|
+
};
|
|
10
|
+
export type UpdatePermissionResponse = Permissions.Permission;
|
|
11
|
+
export type ArchivePermissionRequest = {
|
|
12
|
+
permissionId: string;
|
|
13
|
+
body: Permissions.ArchivePermissionInput;
|
|
14
|
+
};
|
|
15
|
+
export type ArchivePermissionResponse = Permissions.Permission;
|
|
16
|
+
export type GetPermissionByIdRequest = {
|
|
17
|
+
permissionId: string;
|
|
18
|
+
};
|
|
19
|
+
export type GetPermissionByIdResponse = Permissions.Permission;
|
|
20
|
+
export type ListPermissionsResponse = {
|
|
21
|
+
items: Permissions.Permission[];
|
|
22
|
+
};
|
|
23
|
+
export type CreatePermissionPredicateRequest = {
|
|
24
|
+
permissionId: string;
|
|
25
|
+
body: Permissions.CreatePermissionPredicateInput;
|
|
26
|
+
};
|
|
27
|
+
export type CreatePermissionPredicateResponse = Permissions.PermissionPredicate;
|
|
28
|
+
export type UpdatePermissionPredicateRequest = {
|
|
29
|
+
permissionId: string;
|
|
30
|
+
predicateId: string;
|
|
31
|
+
body: Permissions.UpdatePermissionPredicateInput;
|
|
32
|
+
};
|
|
33
|
+
export type UpdatePermissionPredicateResponse = Permissions.PermissionPredicate;
|
|
34
|
+
export type ArchivePermissionPredicateRequest = {
|
|
35
|
+
permissionId: string;
|
|
36
|
+
predicateId: string;
|
|
37
|
+
body: Permissions.ArchivePermissionPredicateInput;
|
|
38
|
+
};
|
|
39
|
+
export type ArchivePermissionPredicateResponse = Permissions.PermissionPredicate;
|
|
40
|
+
export type ListPermissionPredicatesRequest = {
|
|
41
|
+
permissionId: string;
|
|
42
|
+
};
|
|
43
|
+
export type ListPermissionPredicatesResponse = {
|
|
44
|
+
items: Permissions.PermissionPredicate[];
|
|
45
|
+
};
|
|
46
|
+
export type CreatePermissionAssignmentRequest = {
|
|
47
|
+
body: Permissions.CreatePermissionAssignmentInput;
|
|
48
|
+
};
|
|
49
|
+
export type CreatePermissionAssignmentResponse = Permissions.PermissionAssignment;
|
|
50
|
+
export type RevokePermissionAssignmentRequest = {
|
|
51
|
+
assignmentId: string;
|
|
52
|
+
};
|
|
53
|
+
export type RevokePermissionAssignmentResponse = Permissions.DeletionAcknowledgement;
|
|
54
|
+
export type ListPermissionAssignmentsRequest = {
|
|
55
|
+
query?: {
|
|
56
|
+
permissionId?: string;
|
|
57
|
+
identityId?: string;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
export type ListPermissionAssignmentsResponse = {
|
|
61
|
+
items: Permissions.PermissionAssignment[];
|
|
62
|
+
};
|
package/dfnsApiClient.d.ts
CHANGED
|
@@ -3,10 +3,11 @@ import { AssetsClient } from './codegen/Assets';
|
|
|
3
3
|
import { AuthClient } from './codegen/Auth';
|
|
4
4
|
import { BlockchainsClient } from './codegen/Blockchains';
|
|
5
5
|
import { CallbacksClient } from './codegen/Callbacks';
|
|
6
|
+
import { PermissionsClient } from './codegen/Permissions';
|
|
6
7
|
import { PolicyExecutionClient } from './codegen/PolicyExecution';
|
|
7
8
|
import { PolicyManagementClient } from './codegen/PolicyManagement';
|
|
8
9
|
import { PublicKeysClient } from './codegen/PublicKeys';
|
|
9
|
-
import { PermissionsClient } from './generated/permissions';
|
|
10
|
+
import { PermissionsClient as PermissionsV2Client } from './generated/permissions';
|
|
10
11
|
import { PoliciesClient } from './generated/policies';
|
|
11
12
|
import { SignersClient } from './generated/signers';
|
|
12
13
|
import { WalletsClient } from './generated/wallets';
|
|
@@ -22,7 +23,11 @@ export declare class DfnsApiClient {
|
|
|
22
23
|
get auth(): AuthClient;
|
|
23
24
|
get blockchains(): BlockchainsClient;
|
|
24
25
|
get callbacks(): CallbacksClient;
|
|
26
|
+
/**
|
|
27
|
+
* @deprecated use permissions v2 instead
|
|
28
|
+
*/
|
|
25
29
|
get permissions(): PermissionsClient;
|
|
30
|
+
get permissionsV2(): PermissionsV2Client;
|
|
26
31
|
get policies(): PoliciesClient;
|
|
27
32
|
/**
|
|
28
33
|
* @deprecated use the new policy engine instead
|
package/dfnsApiClient.js
CHANGED
|
@@ -5,6 +5,7 @@ const Assets_1 = require("./codegen/Assets");
|
|
|
5
5
|
const Auth_1 = require("./codegen/Auth");
|
|
6
6
|
const Blockchains_1 = require("./codegen/Blockchains");
|
|
7
7
|
const Callbacks_1 = require("./codegen/Callbacks");
|
|
8
|
+
const Permissions_1 = require("./codegen/Permissions");
|
|
8
9
|
const PolicyExecution_1 = require("./codegen/PolicyExecution");
|
|
9
10
|
const PolicyManagement_1 = require("./codegen/PolicyManagement");
|
|
10
11
|
const PublicKeys_1 = require("./codegen/PublicKeys");
|
|
@@ -29,7 +30,13 @@ class DfnsApiClient {
|
|
|
29
30
|
get callbacks() {
|
|
30
31
|
return new Callbacks_1.CallbacksClient(this.apiOptions);
|
|
31
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* @deprecated use permissions v2 instead
|
|
35
|
+
*/
|
|
32
36
|
get permissions() {
|
|
37
|
+
return new Permissions_1.PermissionsClient(this.apiOptions);
|
|
38
|
+
}
|
|
39
|
+
get permissionsV2() {
|
|
33
40
|
return new permissions_1.PermissionsClient(this.apiOptions);
|
|
34
41
|
}
|
|
35
42
|
get policies() {
|
|
@@ -3,10 +3,11 @@ import { DelegatedAssetsClient } from './codegen/Assets';
|
|
|
3
3
|
import { DelegatedAuthClient } from './codegen/Auth';
|
|
4
4
|
import { DelegatedBlockchainsClient } from './codegen/Blockchains';
|
|
5
5
|
import { DelegatedCallbacksClient } from './codegen/Callbacks';
|
|
6
|
+
import { DelegatedPermissionsClient } from './codegen/Permissions';
|
|
6
7
|
import { DelegatedPolicyExecutionClient } from './codegen/PolicyExecution';
|
|
7
8
|
import { DelegatedPolicyManagementClient } from './codegen/PolicyManagement';
|
|
8
9
|
import { DelegatedPublicKeysClient } from './codegen/PublicKeys';
|
|
9
|
-
import { DelegatedPermissionsClient } from './generated/permissions';
|
|
10
|
+
import { DelegatedPermissionsClient as DelegatedPermissionsV2Client } from './generated/permissions';
|
|
10
11
|
import { DelegatedPoliciesClient } from './generated/policies';
|
|
11
12
|
import { DelegatedSignersClient } from './generated/signers';
|
|
12
13
|
import { DelegatedWalletsClient } from './generated/wallets';
|
|
@@ -21,7 +22,11 @@ export declare class DfnsDelegatedApiClient {
|
|
|
21
22
|
get auth(): DelegatedAuthClient;
|
|
22
23
|
get blockchains(): DelegatedBlockchainsClient;
|
|
23
24
|
get callbacks(): DelegatedCallbacksClient;
|
|
25
|
+
/**
|
|
26
|
+
* @deprecated use permissions v2 instead
|
|
27
|
+
*/
|
|
24
28
|
get permissions(): DelegatedPermissionsClient;
|
|
29
|
+
get permissionsV2(): DelegatedPermissionsV2Client;
|
|
25
30
|
get policies(): DelegatedPoliciesClient;
|
|
26
31
|
/**
|
|
27
32
|
* @deprecated use the new policy engine instead
|
|
@@ -5,6 +5,7 @@ const Assets_1 = require("./codegen/Assets");
|
|
|
5
5
|
const Auth_1 = require("./codegen/Auth");
|
|
6
6
|
const Blockchains_1 = require("./codegen/Blockchains");
|
|
7
7
|
const Callbacks_1 = require("./codegen/Callbacks");
|
|
8
|
+
const Permissions_1 = require("./codegen/Permissions");
|
|
8
9
|
const PolicyExecution_1 = require("./codegen/PolicyExecution");
|
|
9
10
|
const PolicyManagement_1 = require("./codegen/PolicyManagement");
|
|
10
11
|
const PublicKeys_1 = require("./codegen/PublicKeys");
|
|
@@ -29,7 +30,13 @@ class DfnsDelegatedApiClient {
|
|
|
29
30
|
get callbacks() {
|
|
30
31
|
return new Callbacks_1.DelegatedCallbacksClient(this.apiOptions);
|
|
31
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* @deprecated use permissions v2 instead
|
|
35
|
+
*/
|
|
32
36
|
get permissions() {
|
|
37
|
+
return new Permissions_1.DelegatedPermissionsClient(this.apiOptions);
|
|
38
|
+
}
|
|
39
|
+
get permissionsV2() {
|
|
33
40
|
return new permissions_1.DelegatedPermissionsClient(this.apiOptions);
|
|
34
41
|
}
|
|
35
42
|
get policies() {
|
package/package.json
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../generated/permissions/types';
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("../generated/permissions/types"), exports);
|