@magda/auth-api-client 2.0.0-alpha.1 → 2.0.0-alpha.2
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/index.d.ts +67 -30
- package/dist/index.js +152 -64
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -14,15 +14,6 @@ declare class ApiClient {
|
|
|
14
14
|
* @memberof ApiClient
|
|
15
15
|
*/
|
|
16
16
|
getUser(userId: string): Promise<Maybe<RequiredKeys<User, "id">>>;
|
|
17
|
-
/**
|
|
18
|
-
* Get the data of a user.
|
|
19
|
-
* (Deprecated) This is the public facing API and will return less fields.
|
|
20
|
-
*
|
|
21
|
-
* @param {string} userId
|
|
22
|
-
* @returns {Promise<Maybe<User>>}
|
|
23
|
-
* @memberof ApiClient
|
|
24
|
-
*/
|
|
25
|
-
getUserPublic(userId: string): Promise<Maybe<RequiredKeys<User, "id">>>;
|
|
26
17
|
/**
|
|
27
18
|
* Lookup user by source (identity provider) & sourceId (identity ID)
|
|
28
19
|
*
|
|
@@ -35,11 +26,11 @@ declare class ApiClient {
|
|
|
35
26
|
/**
|
|
36
27
|
* create a user
|
|
37
28
|
*
|
|
38
|
-
* @param {
|
|
39
|
-
* @returns {Promise<
|
|
29
|
+
* @param {CreateUserData} user
|
|
30
|
+
* @returns {Promise<UserRecord>}
|
|
40
31
|
* @memberof ApiClient
|
|
41
32
|
*/
|
|
42
|
-
createUser(user:
|
|
33
|
+
createUser(user: CreateUserData): Promise<UserRecord>;
|
|
43
34
|
/**
|
|
44
35
|
* Add Roles to a user.
|
|
45
36
|
* Returns a list of current role ids of the user.
|
|
@@ -135,10 +126,21 @@ declare class ApiClient {
|
|
|
135
126
|
* @memberof ApiClient
|
|
136
127
|
*/
|
|
137
128
|
getAllOrgUnitChildren(nodeId: string): Promise<OrgUnit[]>;
|
|
129
|
+
createOrgNode(parentNodeId: string, node: Partial<Omit<OrgUnitRecord, "id" | "createBy" | "createTime" | "editBy" | "editTime" | "left" | "right">>): Promise<OrgUnit>;
|
|
130
|
+
createRole(name: string, desc?: string): Promise<Role>;
|
|
131
|
+
createRolePermission(roleId: string, permissionData: CreateRolePermissionInputData): Promise<PermissionRecord>;
|
|
132
|
+
getOperationByUri(opUri: string): Promise<OperationRecord>;
|
|
133
|
+
getResourceByUri(resUri: string): Promise<ResourceRecord>;
|
|
138
134
|
private handleGetResult;
|
|
139
135
|
}
|
|
140
136
|
export default ApiClient;
|
|
141
137
|
|
|
138
|
+
declare interface CreateRolePermissionInputData extends Omit<PermissionRecord, "id" | "owner_id" | "create_by" | "create_time" | "edit_by" | "edit_time"> {
|
|
139
|
+
operationIds: string[];
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
declare type CreateUserData = Partial<Omit<UserRecord, "email" | "displayName" | "id">> & Pick<UserRecord, "displayName" | "email">;
|
|
143
|
+
|
|
142
144
|
declare interface Eq<T> {
|
|
143
145
|
equals(t: T): boolean;
|
|
144
146
|
}
|
|
@@ -206,22 +208,33 @@ export declare interface Operation {
|
|
|
206
208
|
description?: string;
|
|
207
209
|
}
|
|
208
210
|
|
|
211
|
+
declare type OperationRecord = {
|
|
212
|
+
id: string;
|
|
213
|
+
uri: string;
|
|
214
|
+
name: string;
|
|
215
|
+
description: string;
|
|
216
|
+
resource_id: string;
|
|
217
|
+
};
|
|
218
|
+
|
|
209
219
|
declare interface OptionalMaybePatterns<T, U> {
|
|
210
220
|
just?: (t: T) => U;
|
|
211
221
|
nothing?: () => U;
|
|
212
222
|
}
|
|
213
223
|
|
|
214
|
-
export declare
|
|
215
|
-
id?: string;
|
|
216
|
-
name?: string;
|
|
217
|
-
description?: string;
|
|
224
|
+
export declare type OrgUnit = Partial<OrgUnitRecord> & {
|
|
218
225
|
relationship?: OrgUnitRelationshipType;
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
declare interface OrgUnitRecord {
|
|
229
|
+
id: string;
|
|
230
|
+
name: string;
|
|
231
|
+
description: string;
|
|
232
|
+
left: number;
|
|
233
|
+
right: number;
|
|
234
|
+
createBy: string;
|
|
235
|
+
createTime: Date;
|
|
236
|
+
editBy: string;
|
|
237
|
+
editTime: Date;
|
|
225
238
|
}
|
|
226
239
|
|
|
227
240
|
export declare type OrgUnitRelationshipType = "ancestor" | "descendant" | "equal" | "unrelated";
|
|
@@ -242,20 +255,37 @@ export declare interface Permission {
|
|
|
242
255
|
editTime?: Date;
|
|
243
256
|
}
|
|
244
257
|
|
|
245
|
-
|
|
246
|
-
id
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
258
|
+
declare interface PermissionRecord {
|
|
259
|
+
id: string;
|
|
260
|
+
name: string;
|
|
261
|
+
description: string;
|
|
262
|
+
resource_id: string;
|
|
263
|
+
user_ownership_constraint: boolean;
|
|
264
|
+
org_unit_ownership_constraint: boolean;
|
|
265
|
+
pre_authorised_constraint: boolean;
|
|
266
|
+
owner_id: string;
|
|
267
|
+
create_time: string;
|
|
268
|
+
create_by: string;
|
|
269
|
+
edit_time: string;
|
|
270
|
+
edit_by: string;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
export declare type PublicUser = Partial<Pick<UserRecord, "id" | "photoURL" | "orgUnitId">> & Omit<UserRecord, "id" | "photoURL" | "orgUnitId" | "email" | "source" | "sourceId"> & {
|
|
250
274
|
roles?: Role[];
|
|
251
275
|
permissions?: Permission[];
|
|
252
276
|
managingOrgUnitIds?: string[];
|
|
253
|
-
orgUnitId?: string;
|
|
254
277
|
orgUnit?: OrgUnit;
|
|
255
|
-
}
|
|
278
|
+
};
|
|
256
279
|
|
|
257
280
|
declare type RequiredKeys<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>;
|
|
258
281
|
|
|
282
|
+
declare type ResourceRecord = {
|
|
283
|
+
id: string;
|
|
284
|
+
uri: string;
|
|
285
|
+
name: string;
|
|
286
|
+
description: string;
|
|
287
|
+
};
|
|
288
|
+
|
|
259
289
|
export declare interface Role {
|
|
260
290
|
id: string;
|
|
261
291
|
name: string;
|
|
@@ -267,7 +297,14 @@ export declare interface Role {
|
|
|
267
297
|
editTime?: Date;
|
|
268
298
|
}
|
|
269
299
|
|
|
270
|
-
export declare
|
|
300
|
+
export declare type User = PublicUser & Pick<UserRecord, "email" | "source" | "sourceId">;
|
|
301
|
+
|
|
302
|
+
declare interface UserRecord {
|
|
303
|
+
id: string;
|
|
304
|
+
displayName: string;
|
|
305
|
+
photoURL: string;
|
|
306
|
+
isAdmin: boolean;
|
|
307
|
+
orgUnitId: string;
|
|
271
308
|
email: string;
|
|
272
309
|
source: string;
|
|
273
310
|
sourceId: string;
|
package/dist/index.js
CHANGED
|
@@ -1806,7 +1806,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
|
|
|
1806
1806
|
* URI.js - Mutating URLs
|
|
1807
1807
|
* IPv6 Support
|
|
1808
1808
|
*
|
|
1809
|
-
* Version: 1.19.
|
|
1809
|
+
* Version: 1.19.11
|
|
1810
1810
|
*
|
|
1811
1811
|
* Author: Rodney Rehm
|
|
1812
1812
|
* Web: http://medialize.github.io/URI.js/
|
|
@@ -1998,7 +1998,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
|
|
|
1998
1998
|
* URI.js - Mutating URLs
|
|
1999
1999
|
* Second Level Domain (SLD) Support
|
|
2000
2000
|
*
|
|
2001
|
-
* Version: 1.19.
|
|
2001
|
+
* Version: 1.19.11
|
|
2002
2002
|
*
|
|
2003
2003
|
* Author: Rodney Rehm
|
|
2004
2004
|
* Web: http://medialize.github.io/URI.js/
|
|
@@ -2281,9 +2281,10 @@ const isomorphic_fetch_1 = __importDefault(__webpack_require__(30));
|
|
|
2281
2281
|
const tsmonad_1 = __webpack_require__(15);
|
|
2282
2282
|
const lodash_1 = __importDefault(__webpack_require__(59));
|
|
2283
2283
|
const buildJwt_1 = __importDefault(__webpack_require__(60));
|
|
2284
|
-
const
|
|
2285
|
-
const
|
|
2286
|
-
const
|
|
2284
|
+
const addTrailingSlash_1 = __importDefault(__webpack_require__(79));
|
|
2285
|
+
const urijs_1 = __importDefault(__webpack_require__(80));
|
|
2286
|
+
const ServerError_1 = __importDefault(__webpack_require__(81));
|
|
2287
|
+
const isUuid_1 = __importDefault(__webpack_require__(82));
|
|
2287
2288
|
class ApiClient {
|
|
2288
2289
|
constructor(
|
|
2289
2290
|
// e.g. http://authorization-api/v0
|
|
@@ -2295,14 +2296,29 @@ class ApiClient {
|
|
|
2295
2296
|
if (jwtSecret && userId) {
|
|
2296
2297
|
this.jwt = buildJwt_1.default(jwtSecret, userId);
|
|
2297
2298
|
}
|
|
2298
|
-
this.
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2299
|
+
if (this.jwt) {
|
|
2300
|
+
this.requestInitOption = {
|
|
2301
|
+
headers: {
|
|
2302
|
+
"X-Magda-Session": this.jwt
|
|
2303
|
+
}
|
|
2304
|
+
};
|
|
2305
|
+
}
|
|
2303
2306
|
}
|
|
2304
2307
|
getMergeRequestInitOption(extraOptions = null) {
|
|
2305
|
-
|
|
2308
|
+
let defaultContentTypeCfg = {};
|
|
2309
|
+
if ((extraOptions === null || extraOptions === void 0 ? void 0 : extraOptions.body) &&
|
|
2310
|
+
(!(extraOptions === null || extraOptions === void 0 ? void 0 : extraOptions.headers) ||
|
|
2311
|
+
(typeof extraOptions.headers === "object" &&
|
|
2312
|
+
Object.keys(extraOptions.headers)
|
|
2313
|
+
.map((key) => key.toLowerCase())
|
|
2314
|
+
.indexOf("content-type") == -1))) {
|
|
2315
|
+
defaultContentTypeCfg = {
|
|
2316
|
+
headers: {
|
|
2317
|
+
"Content-Type": "application/json"
|
|
2318
|
+
}
|
|
2319
|
+
};
|
|
2320
|
+
}
|
|
2321
|
+
return lodash_1.default.merge({}, this.requestInitOption, extraOptions, defaultContentTypeCfg);
|
|
2306
2322
|
}
|
|
2307
2323
|
processJsonResponse(res) {
|
|
2308
2324
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -2310,8 +2326,8 @@ class ApiClient {
|
|
|
2310
2326
|
return (yield res.json());
|
|
2311
2327
|
}
|
|
2312
2328
|
else {
|
|
2313
|
-
const responseText =
|
|
2314
|
-
throw new
|
|
2329
|
+
const responseText = yield res.text();
|
|
2330
|
+
throw new ServerError_1.default(`Error: ${res.statusText}. ${responseText.replace(/<(.|\n)*?>/g, "")}`, res.status);
|
|
2315
2331
|
}
|
|
2316
2332
|
});
|
|
2317
2333
|
}
|
|
@@ -2323,19 +2339,6 @@ class ApiClient {
|
|
|
2323
2339
|
* @memberof ApiClient
|
|
2324
2340
|
*/
|
|
2325
2341
|
getUser(userId) {
|
|
2326
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2327
|
-
return yield this.handleGetResult(isomorphic_fetch_1.default(`${this.baseUrl}private/users/${userId}`, this.getMergeRequestInitOption()));
|
|
2328
|
-
});
|
|
2329
|
-
}
|
|
2330
|
-
/**
|
|
2331
|
-
* Get the data of a user.
|
|
2332
|
-
* (Deprecated) This is the public facing API and will return less fields.
|
|
2333
|
-
*
|
|
2334
|
-
* @param {string} userId
|
|
2335
|
-
* @returns {Promise<Maybe<User>>}
|
|
2336
|
-
* @memberof ApiClient
|
|
2337
|
-
*/
|
|
2338
|
-
getUserPublic(userId) {
|
|
2339
2342
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2340
2343
|
return yield this.handleGetResult(isomorphic_fetch_1.default(`${this.baseUrl}public/users/${userId}`, this.getMergeRequestInitOption()));
|
|
2341
2344
|
});
|
|
@@ -2356,14 +2359,14 @@ class ApiClient {
|
|
|
2356
2359
|
/**
|
|
2357
2360
|
* create a user
|
|
2358
2361
|
*
|
|
2359
|
-
* @param {
|
|
2360
|
-
* @returns {Promise<
|
|
2362
|
+
* @param {CreateUserData} user
|
|
2363
|
+
* @returns {Promise<UserRecord>}
|
|
2361
2364
|
* @memberof ApiClient
|
|
2362
2365
|
*/
|
|
2363
2366
|
createUser(user) {
|
|
2364
2367
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2365
2368
|
try {
|
|
2366
|
-
const res = yield isomorphic_fetch_1.default(`${this.baseUrl}
|
|
2369
|
+
const res = yield isomorphic_fetch_1.default(`${this.baseUrl}public/users`, this.getMergeRequestInitOption({
|
|
2367
2370
|
method: "POST",
|
|
2368
2371
|
headers: {
|
|
2369
2372
|
"Content-Type": "application/json"
|
|
@@ -2371,10 +2374,10 @@ class ApiClient {
|
|
|
2371
2374
|
body: JSON.stringify(user)
|
|
2372
2375
|
}));
|
|
2373
2376
|
if (res.status >= 400) {
|
|
2374
|
-
throw new Error(`Encountered error ${res.status} when
|
|
2377
|
+
throw new Error(`Encountered error ${res.status}: ${yield res.text()} when creating new user to ${this.baseUrl}public/users`);
|
|
2375
2378
|
}
|
|
2376
2379
|
const resData = yield res.json();
|
|
2377
|
-
return
|
|
2380
|
+
return resData;
|
|
2378
2381
|
}
|
|
2379
2382
|
catch (e) {
|
|
2380
2383
|
console.error(e);
|
|
@@ -2393,7 +2396,7 @@ class ApiClient {
|
|
|
2393
2396
|
*/
|
|
2394
2397
|
addUserRoles(userId, roleIds) {
|
|
2395
2398
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2396
|
-
const res = yield isomorphic_fetch_1.default(`${this.baseUrl}public/
|
|
2399
|
+
const res = yield isomorphic_fetch_1.default(`${this.baseUrl}public/users/${userId}/roles`, this.getMergeRequestInitOption({
|
|
2397
2400
|
method: "POST",
|
|
2398
2401
|
headers: {
|
|
2399
2402
|
"Content-Type": "application/json"
|
|
@@ -2432,7 +2435,7 @@ class ApiClient {
|
|
|
2432
2435
|
*/
|
|
2433
2436
|
getUserRoles(userId) {
|
|
2434
2437
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2435
|
-
const res = yield isomorphic_fetch_1.default(`${this.baseUrl}public/
|
|
2438
|
+
const res = yield isomorphic_fetch_1.default(`${this.baseUrl}public/users/${userId}/roles`, this.getMergeRequestInitOption());
|
|
2436
2439
|
return yield this.processJsonResponse(res);
|
|
2437
2440
|
});
|
|
2438
2441
|
}
|
|
@@ -2445,7 +2448,7 @@ class ApiClient {
|
|
|
2445
2448
|
*/
|
|
2446
2449
|
getUserPermissions(userId) {
|
|
2447
2450
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2448
|
-
const res = yield isomorphic_fetch_1.default(`${this.baseUrl}public/
|
|
2451
|
+
const res = yield isomorphic_fetch_1.default(`${this.baseUrl}public/users/${userId}/permissions`, this.getMergeRequestInitOption());
|
|
2449
2452
|
return yield this.processJsonResponse(res);
|
|
2450
2453
|
});
|
|
2451
2454
|
}
|
|
@@ -2458,7 +2461,7 @@ class ApiClient {
|
|
|
2458
2461
|
*/
|
|
2459
2462
|
getRolePermissions(roleId) {
|
|
2460
2463
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2461
|
-
const res = yield isomorphic_fetch_1.default(`${this.baseUrl}public/
|
|
2464
|
+
const res = yield isomorphic_fetch_1.default(`${this.baseUrl}public/roles/${roleId}/permissions`, this.getMergeRequestInitOption());
|
|
2462
2465
|
return yield this.processJsonResponse(res);
|
|
2463
2466
|
});
|
|
2464
2467
|
}
|
|
@@ -2568,6 +2571,60 @@ class ApiClient {
|
|
|
2568
2571
|
return yield this.processJsonResponse(res);
|
|
2569
2572
|
});
|
|
2570
2573
|
}
|
|
2574
|
+
createOrgNode(parentNodeId, node) {
|
|
2575
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2576
|
+
const uri = urijs_1.default(`${this.baseUrl}public/orgunits`)
|
|
2577
|
+
.segmentCoded(parentNodeId)
|
|
2578
|
+
.segmentCoded("insert");
|
|
2579
|
+
const res = yield isomorphic_fetch_1.default(uri.toString(), this.getMergeRequestInitOption({
|
|
2580
|
+
method: "post",
|
|
2581
|
+
body: JSON.stringify(node)
|
|
2582
|
+
}));
|
|
2583
|
+
return yield this.processJsonResponse(res);
|
|
2584
|
+
});
|
|
2585
|
+
}
|
|
2586
|
+
createRole(name, desc) {
|
|
2587
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2588
|
+
const uri = urijs_1.default(`${this.baseUrl}public/roles`);
|
|
2589
|
+
const res = yield isomorphic_fetch_1.default(uri.toString(), this.getMergeRequestInitOption({
|
|
2590
|
+
method: "post",
|
|
2591
|
+
body: JSON.stringify({
|
|
2592
|
+
name,
|
|
2593
|
+
description: desc ? desc : ""
|
|
2594
|
+
})
|
|
2595
|
+
}));
|
|
2596
|
+
return yield this.processJsonResponse(res);
|
|
2597
|
+
});
|
|
2598
|
+
}
|
|
2599
|
+
createRolePermission(roleId, permissionData) {
|
|
2600
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2601
|
+
if (!isUuid_1.default(roleId)) {
|
|
2602
|
+
throw new ServerError_1.default(`roleId: ${roleId} is not a valid UUID.`);
|
|
2603
|
+
}
|
|
2604
|
+
const uri = urijs_1.default(`${this.baseUrl}public/roles`)
|
|
2605
|
+
.segmentCoded(roleId)
|
|
2606
|
+
.segmentCoded("permissions");
|
|
2607
|
+
const res = yield isomorphic_fetch_1.default(uri.toString(), this.getMergeRequestInitOption({
|
|
2608
|
+
method: "post",
|
|
2609
|
+
body: JSON.stringify(permissionData)
|
|
2610
|
+
}));
|
|
2611
|
+
return yield this.processJsonResponse(res);
|
|
2612
|
+
});
|
|
2613
|
+
}
|
|
2614
|
+
getOperationByUri(opUri) {
|
|
2615
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2616
|
+
const uri = urijs_1.default(`${this.baseUrl}public/operations/byUri/${opUri}`);
|
|
2617
|
+
const res = yield isomorphic_fetch_1.default(uri.toString(), this.getMergeRequestInitOption());
|
|
2618
|
+
return yield this.processJsonResponse(res);
|
|
2619
|
+
});
|
|
2620
|
+
}
|
|
2621
|
+
getResourceByUri(resUri) {
|
|
2622
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2623
|
+
const uri = urijs_1.default(`${this.baseUrl}public/resources/byUri/${resUri}`);
|
|
2624
|
+
const res = yield isomorphic_fetch_1.default(uri.toString(), this.getMergeRequestInitOption());
|
|
2625
|
+
return yield this.processJsonResponse(res);
|
|
2626
|
+
});
|
|
2627
|
+
}
|
|
2571
2628
|
handleGetResult(promise) {
|
|
2572
2629
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2573
2630
|
return promise
|
|
@@ -27562,29 +27619,6 @@ module.exports = once;
|
|
|
27562
27619
|
|
|
27563
27620
|
"use strict";
|
|
27564
27621
|
|
|
27565
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27566
|
-
class GenericError extends Error {
|
|
27567
|
-
constructor(message = "Unknown Error", statusCode = 500) {
|
|
27568
|
-
super(message);
|
|
27569
|
-
this.statusCode = statusCode;
|
|
27570
|
-
}
|
|
27571
|
-
toData() {
|
|
27572
|
-
return {
|
|
27573
|
-
isError: true,
|
|
27574
|
-
errorCode: this.statusCode,
|
|
27575
|
-
errorMessage: this.message
|
|
27576
|
-
};
|
|
27577
|
-
}
|
|
27578
|
-
}
|
|
27579
|
-
exports.default = GenericError;
|
|
27580
|
-
//# sourceMappingURL=GenericError.js.map
|
|
27581
|
-
|
|
27582
|
-
/***/ }),
|
|
27583
|
-
/* 80 */
|
|
27584
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
27585
|
-
|
|
27586
|
-
"use strict";
|
|
27587
|
-
|
|
27588
27622
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27589
27623
|
function addTrailingSlash(url) {
|
|
27590
27624
|
if (!url) {
|
|
@@ -27601,13 +27635,13 @@ exports.default = addTrailingSlash;
|
|
|
27601
27635
|
//# sourceMappingURL=addTrailingSlash.js.map
|
|
27602
27636
|
|
|
27603
27637
|
/***/ }),
|
|
27604
|
-
/*
|
|
27638
|
+
/* 80 */
|
|
27605
27639
|
/***/ (function(module, exports, __webpack_require__) {
|
|
27606
27640
|
|
|
27607
27641
|
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
|
|
27608
27642
|
* URI.js - Mutating URLs
|
|
27609
27643
|
*
|
|
27610
|
-
* Version: 1.19.
|
|
27644
|
+
* Version: 1.19.11
|
|
27611
27645
|
*
|
|
27612
27646
|
* Author: Rodney Rehm
|
|
27613
27647
|
* Web: http://medialize.github.io/URI.js/
|
|
@@ -27687,7 +27721,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
27687
27721
|
return /^[0-9]+$/.test(value);
|
|
27688
27722
|
}
|
|
27689
27723
|
|
|
27690
|
-
URI.version = '1.19.
|
|
27724
|
+
URI.version = '1.19.11';
|
|
27691
27725
|
|
|
27692
27726
|
var p = URI.prototype;
|
|
27693
27727
|
var hasOwn = Object.prototype.hasOwnProperty;
|
|
@@ -27845,6 +27879,9 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
27845
27879
|
// balanced parens inclusion (), [], {}, <>
|
|
27846
27880
|
parens: /(\([^\)]*\)|\[[^\]]*\]|\{[^}]*\}|<[^>]*>)/g,
|
|
27847
27881
|
};
|
|
27882
|
+
URI.leading_whitespace_expression = /^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/
|
|
27883
|
+
// https://infra.spec.whatwg.org/#ascii-tab-or-newline
|
|
27884
|
+
URI.ascii_tab_whitespace = /[\u0009\u000A\u000D]+/g
|
|
27848
27885
|
// http://www.iana.org/assignments/uri-schemes.html
|
|
27849
27886
|
// http://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers#Well-known_ports
|
|
27850
27887
|
URI.defaultPorts = {
|
|
@@ -28100,6 +28137,11 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
28100
28137
|
preventInvalidHostname: URI.preventInvalidHostname
|
|
28101
28138
|
};
|
|
28102
28139
|
}
|
|
28140
|
+
|
|
28141
|
+
string = string.replace(URI.leading_whitespace_expression, '')
|
|
28142
|
+
// https://infra.spec.whatwg.org/#ascii-tab-or-newline
|
|
28143
|
+
string = string.replace(URI.ascii_tab_whitespace, '')
|
|
28144
|
+
|
|
28103
28145
|
// [protocol"://"[username[":"password]"@"]hostname[":"port]"/"?][path]["?"querystring]["#"fragment]
|
|
28104
28146
|
|
|
28105
28147
|
// extract fragment
|
|
@@ -28118,6 +28160,11 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
28118
28160
|
string = string.substring(0, pos);
|
|
28119
28161
|
}
|
|
28120
28162
|
|
|
28163
|
+
// slashes and backslashes have lost all meaning for the web protocols (https, http, wss, ws)
|
|
28164
|
+
string = string.replace(/^(https?|ftp|wss?)?:+[/\\]*/i, '$1://');
|
|
28165
|
+
// slashes and backslashes have lost all meaning for scheme relative URLs
|
|
28166
|
+
string = string.replace(/^[/\\]{2,}/i, '//');
|
|
28167
|
+
|
|
28121
28168
|
// extract protocol
|
|
28122
28169
|
if (string.substring(0, 2) === '//') {
|
|
28123
28170
|
// relative-scheme
|
|
@@ -28132,7 +28179,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
28132
28179
|
if (parts.protocol && !parts.protocol.match(URI.protocol_expression)) {
|
|
28133
28180
|
// : may be within the path
|
|
28134
28181
|
parts.protocol = undefined;
|
|
28135
|
-
} else if (string.substring(pos + 1, pos + 3) === '//') {
|
|
28182
|
+
} else if (string.substring(pos + 1, pos + 3).replace(/\\/g, '/') === '//') {
|
|
28136
28183
|
string = string.substring(pos + 3);
|
|
28137
28184
|
|
|
28138
28185
|
// extract "user:pass@host:port"
|
|
@@ -28264,7 +28311,10 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
28264
28311
|
// no "=" is null according to http://dvcs.w3.org/hg/url/raw-file/tip/Overview.html#collect-url-parameters
|
|
28265
28312
|
value = v.length ? URI.decodeQuery(v.join('='), escapeQuerySpace) : null;
|
|
28266
28313
|
|
|
28267
|
-
if (
|
|
28314
|
+
if (name === '__proto__') {
|
|
28315
|
+
// ignore attempt at exploiting JavaScript internals
|
|
28316
|
+
continue;
|
|
28317
|
+
} else if (hasOwn.call(items, name)) {
|
|
28268
28318
|
if (typeof items[name] === 'string' || items[name] === null) {
|
|
28269
28319
|
items[name] = [items[name]];
|
|
28270
28320
|
}
|
|
@@ -28357,7 +28407,10 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
28357
28407
|
var t = '';
|
|
28358
28408
|
var unique, key, i, length;
|
|
28359
28409
|
for (key in data) {
|
|
28360
|
-
if (
|
|
28410
|
+
if (key === '__proto__') {
|
|
28411
|
+
// ignore attempt at exploiting JavaScript internals
|
|
28412
|
+
continue;
|
|
28413
|
+
} else if (hasOwn.call(data, key)) {
|
|
28361
28414
|
if (isArray(data[key])) {
|
|
28362
28415
|
unique = {};
|
|
28363
28416
|
for (i = 0, length = data[key].length; i < length; i++) {
|
|
@@ -29951,6 +30004,41 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
29951
30004
|
}));
|
|
29952
30005
|
|
|
29953
30006
|
|
|
30007
|
+
/***/ }),
|
|
30008
|
+
/* 81 */
|
|
30009
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
30010
|
+
|
|
30011
|
+
"use strict";
|
|
30012
|
+
|
|
30013
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30014
|
+
class ServerError extends Error {
|
|
30015
|
+
constructor(message = "Unknown Error", statusCode = 500) {
|
|
30016
|
+
super(message);
|
|
30017
|
+
this.statusCode = statusCode;
|
|
30018
|
+
}
|
|
30019
|
+
toData() {
|
|
30020
|
+
return {
|
|
30021
|
+
isError: true,
|
|
30022
|
+
errorCode: this.statusCode,
|
|
30023
|
+
errorMessage: this.message
|
|
30024
|
+
};
|
|
30025
|
+
}
|
|
30026
|
+
}
|
|
30027
|
+
exports.default = ServerError;
|
|
30028
|
+
//# sourceMappingURL=ServerError.js.map
|
|
30029
|
+
|
|
30030
|
+
/***/ }),
|
|
30031
|
+
/* 82 */
|
|
30032
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
30033
|
+
|
|
30034
|
+
"use strict";
|
|
30035
|
+
|
|
30036
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30037
|
+
const uuidRegEx = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
30038
|
+
const isUuid = (id) => typeof id === "string" && uuidRegEx.test(id);
|
|
30039
|
+
exports.default = isUuid;
|
|
30040
|
+
//# sourceMappingURL=isUuid.js.map
|
|
30041
|
+
|
|
29954
30042
|
/***/ })
|
|
29955
30043
|
/******/ ]);
|
|
29956
30044
|
});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@magda/auth-api-client",
|
|
3
3
|
"description": "MAGDA Auth API Client",
|
|
4
|
-
"version": "2.0.0-alpha.
|
|
4
|
+
"version": "2.0.0-alpha.2",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"prebuild": "rimraf dist tsconfig.tsbuildinfo",
|
|
7
7
|
"build": "webpack && api-extractor run -l",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"main": "dist/index.js",
|
|
13
13
|
"types": "dist/index.d.ts",
|
|
14
14
|
"devDependencies": {
|
|
15
|
-
"@magda/typescript-common": "^2.0.0-alpha.
|
|
15
|
+
"@magda/typescript-common": "^2.0.0-alpha.2",
|
|
16
16
|
"@microsoft/api-extractor": "^7.7.8",
|
|
17
17
|
"ts-loader": "^6.2.1",
|
|
18
18
|
"typescript": "^3.7.2",
|