@magda/registry-client 1.2.0-rc.0 → 2.0.0-alpha.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/dist/index.d.ts +56 -2
- package/dist/index.js +253 -43
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import http = require('http');
|
|
3
|
+
import { Response as Response_2 } from 'request';
|
|
3
4
|
import { default as URI_2 } from 'urijs';
|
|
4
5
|
|
|
5
6
|
/**
|
|
@@ -43,8 +44,9 @@ declare class AspectDefinitionsApi {
|
|
|
43
44
|
* Get a list of all aspects
|
|
44
45
|
*
|
|
45
46
|
* @param xMagdaTenantId 0
|
|
47
|
+
* @param xMagdaSession Magda internal session id
|
|
46
48
|
*/
|
|
47
|
-
getAll(xMagdaTenantId: number): Promise<{
|
|
49
|
+
getAll(xMagdaTenantId: number, xMagdaSession?: string): Promise<{
|
|
48
50
|
response: http.IncomingMessage;
|
|
49
51
|
body: Array<AspectDefinition>;
|
|
50
52
|
}>;
|
|
@@ -53,8 +55,9 @@ declare class AspectDefinitionsApi {
|
|
|
53
55
|
*
|
|
54
56
|
* @param xMagdaTenantId 0
|
|
55
57
|
* @param id ID of the aspect to be fetched.
|
|
58
|
+
* @param xMagdaSession Magda internal session id
|
|
56
59
|
*/
|
|
57
|
-
getById(xMagdaTenantId: number, id: string): Promise<{
|
|
60
|
+
getById(xMagdaTenantId: number, id: string, xMagdaSession?: string): Promise<{
|
|
58
61
|
response: http.IncomingMessage;
|
|
59
62
|
body: AspectDefinition;
|
|
60
63
|
}>;
|
|
@@ -90,6 +93,7 @@ declare enum AspectDefinitionsApiApiKeys {
|
|
|
90
93
|
export declare class AuthorizedRegistryClient extends RegistryClient {
|
|
91
94
|
protected jwt: string;
|
|
92
95
|
constructor(options: AuthorizedRegistryOptions);
|
|
96
|
+
getAspectDefinition(aspectId: string): Promise<AspectDefinition>;
|
|
93
97
|
putAspectDefinition(aspectDefinition: AspectDefinition, tenantId?: number): Promise<AspectDefinition | Error>;
|
|
94
98
|
postHook(hook: WebHook): Promise<WebHook | Error>;
|
|
95
99
|
putHook(hook: WebHook): Promise<WebHook | Error>;
|
|
@@ -280,6 +284,33 @@ declare class RecordAspectsApi {
|
|
|
280
284
|
response: http.IncomingMessage;
|
|
281
285
|
body: DeleteResult;
|
|
282
286
|
}>;
|
|
287
|
+
/**
|
|
288
|
+
* Get a list of a record's aspects
|
|
289
|
+
*
|
|
290
|
+
* @param xMagdaTenantId 0
|
|
291
|
+
* @param recordId ID of the record for which to fetch aspects.
|
|
292
|
+
* @param keyword Specify the keyword to search in the all aspects' aspectId & data fields.
|
|
293
|
+
* @param aspectIdOnly When set to true, will respond only an array contains aspect id only.
|
|
294
|
+
* @param start The index of the first record to retrieve.
|
|
295
|
+
* @param limit The maximum number of records to receive.
|
|
296
|
+
* @param xMagdaSession Magda internal session id
|
|
297
|
+
*/
|
|
298
|
+
getAspects(xMagdaTenantId: number, recordId: string, keyword?: string, aspectIdOnly?: boolean, start?: number, limit?: number, xMagdaSession?: string): Promise<{
|
|
299
|
+
response: http.IncomingMessage;
|
|
300
|
+
body: Array<any>;
|
|
301
|
+
}>;
|
|
302
|
+
/**
|
|
303
|
+
* Get the number of aspects that a record has
|
|
304
|
+
*
|
|
305
|
+
* @param xMagdaTenantId 0
|
|
306
|
+
* @param recordId ID of the record for which to fetch an aspect.
|
|
307
|
+
* @param keyword Specify the keyword to search in the all aspects' aspectId & data fields.
|
|
308
|
+
* @param xMagdaSession Magda internal session id
|
|
309
|
+
*/
|
|
310
|
+
getAspectsCount(xMagdaTenantId: number, recordId: string, keyword?: string, xMagdaSession?: string): Promise<{
|
|
311
|
+
response: http.IncomingMessage;
|
|
312
|
+
body: CountResponse;
|
|
313
|
+
}>;
|
|
283
314
|
/**
|
|
284
315
|
* Get a record aspect by ID
|
|
285
316
|
*
|
|
@@ -559,8 +590,16 @@ export declare class RegistryClient {
|
|
|
559
590
|
protected tenantId: number;
|
|
560
591
|
protected jwt: string | undefined;
|
|
561
592
|
constructor({ baseUrl, maxRetries, secondsBetweenRetries, tenantId }: RegistryOptions);
|
|
593
|
+
toServerError(error: {
|
|
594
|
+
body: any;
|
|
595
|
+
response: Response_2;
|
|
596
|
+
}): ServerError | {
|
|
597
|
+
body: any;
|
|
598
|
+
response: Response_2;
|
|
599
|
+
};
|
|
562
600
|
getRecordUrl(id: string): string;
|
|
563
601
|
getAspectDefinitions(): Promise<AspectDefinition[] | Error>;
|
|
602
|
+
getAspectDefinition(aspectId: string, jwtToken?: string): Promise<AspectDefinition>;
|
|
564
603
|
getRecord(id: string, aspect?: Array<string>, optionalAspect?: Array<string>, dereference?: boolean): Promise<Record_2 | Error>;
|
|
565
604
|
getRecords<I extends Record_2>(aspect?: Array<string>, optionalAspect?: Array<string>, pageToken?: string, dereference?: boolean, limit?: number, aspectQueries?: string[], aspectOrQuery?: string[], orderBy?: string, orderByDir?: string, orderNullFirst?: boolean): Promise<RecordsPage<I> | Error>;
|
|
566
605
|
getRecordsPageTokens(aspect?: Array<string>, limit?: number): Promise<string[] | Error>;
|
|
@@ -582,6 +621,16 @@ export declare interface RegistryOptions {
|
|
|
582
621
|
tenantId: number;
|
|
583
622
|
}
|
|
584
623
|
|
|
624
|
+
declare class ServerError extends Error {
|
|
625
|
+
statusCode: number;
|
|
626
|
+
constructor(message?: string, statusCode?: number);
|
|
627
|
+
toData(): {
|
|
628
|
+
isError: boolean;
|
|
629
|
+
errorCode: number;
|
|
630
|
+
errorMessage: string;
|
|
631
|
+
};
|
|
632
|
+
}
|
|
633
|
+
|
|
585
634
|
export declare const TenantConsts: any;
|
|
586
635
|
|
|
587
636
|
export declare class WebHook {
|
|
@@ -598,6 +647,11 @@ export declare class WebHook {
|
|
|
598
647
|
'retryCount': number;
|
|
599
648
|
'isRunning': any;
|
|
600
649
|
'isProcessing': any;
|
|
650
|
+
'ownerId': string;
|
|
651
|
+
'creatorId': string;
|
|
652
|
+
'editorId': string;
|
|
653
|
+
'createTime': Date;
|
|
654
|
+
'editTime': Date;
|
|
601
655
|
}
|
|
602
656
|
|
|
603
657
|
/**
|
package/dist/index.js
CHANGED
|
@@ -11250,8 +11250,8 @@ module.exports = v4;
|
|
|
11250
11250
|
/***/ (function(module, exports, __webpack_require__) {
|
|
11251
11251
|
|
|
11252
11252
|
/*global exports*/
|
|
11253
|
-
var SignStream = __webpack_require__(
|
|
11254
|
-
var VerifyStream = __webpack_require__(
|
|
11253
|
+
var SignStream = __webpack_require__(220);
|
|
11254
|
+
var VerifyStream = __webpack_require__(224);
|
|
11255
11255
|
|
|
11256
11256
|
var ALGORITHMS = [
|
|
11257
11257
|
'HS256', 'HS384', 'HS512',
|
|
@@ -11279,6 +11279,15 @@ exports.createVerify = function createVerify(opts) {
|
|
|
11279
11279
|
|
|
11280
11280
|
"use strict";
|
|
11281
11281
|
|
|
11282
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
11283
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
11284
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
11285
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
11286
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
11287
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
11288
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
11289
|
+
});
|
|
11290
|
+
};
|
|
11282
11291
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
11283
11292
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
11284
11293
|
};
|
|
@@ -11288,6 +11297,7 @@ const urijs_1 = __importDefault(__webpack_require__(213));
|
|
|
11288
11297
|
const retry_1 = __importDefault(__webpack_require__(88));
|
|
11289
11298
|
const formatServiceError_1 = __importDefault(__webpack_require__(89));
|
|
11290
11299
|
const createServiceError_1 = __importDefault(__webpack_require__(90));
|
|
11300
|
+
const ServerError_1 = __importDefault(__webpack_require__(216));
|
|
11291
11301
|
class RegistryClient {
|
|
11292
11302
|
constructor({ baseUrl, maxRetries = 10, secondsBetweenRetries = 10, tenantId }) {
|
|
11293
11303
|
if (tenantId === undefined) {
|
|
@@ -11305,6 +11315,14 @@ class RegistryClient {
|
|
|
11305
11315
|
this.webHooksApi = new api_1.WebHooksApi(registryApiUrl);
|
|
11306
11316
|
this.recordHistoryApi = new api_1.RecordHistoryApi(registryApiUrl);
|
|
11307
11317
|
}
|
|
11318
|
+
toServerError(error) {
|
|
11319
|
+
if (error === null || error === void 0 ? void 0 : error.response) {
|
|
11320
|
+
return new ServerError_1.default(error.body, error.response.statusCode);
|
|
11321
|
+
}
|
|
11322
|
+
else {
|
|
11323
|
+
return error;
|
|
11324
|
+
}
|
|
11325
|
+
}
|
|
11308
11326
|
getRecordUrl(id) {
|
|
11309
11327
|
return this.baseUri.clone().segment("records").segment(id).toString();
|
|
11310
11328
|
}
|
|
@@ -11314,6 +11332,20 @@ class RegistryClient {
|
|
|
11314
11332
|
.then((result) => result.body)
|
|
11315
11333
|
.catch(createServiceError_1.default);
|
|
11316
11334
|
}
|
|
11335
|
+
getAspectDefinition(aspectId, jwtToken) {
|
|
11336
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
11337
|
+
try {
|
|
11338
|
+
const res = yield this.aspectDefinitionsApi.getById(this.tenantId, aspectId, jwtToken);
|
|
11339
|
+
if (typeof res.body === "string") {
|
|
11340
|
+
throw new Error("Invalid non-json response: " + res.body);
|
|
11341
|
+
}
|
|
11342
|
+
return res.body;
|
|
11343
|
+
}
|
|
11344
|
+
catch (e) {
|
|
11345
|
+
throw this.toServerError(e);
|
|
11346
|
+
}
|
|
11347
|
+
});
|
|
11348
|
+
}
|
|
11317
11349
|
getRecord(id, aspect, optionalAspect, dereference) {
|
|
11318
11350
|
const operation = (id) => () => this.recordsApi.getById(encodeURIComponent(id), this.tenantId, aspect, optionalAspect, dereference, this.jwt);
|
|
11319
11351
|
return retry_1.default(operation(id), this.secondsBetweenRetries, this.maxRetries, (e, retriesLeft) => console.log(formatServiceError_1.default("Failed to GET records.", e, retriesLeft)), (e) => {
|
|
@@ -11559,8 +11591,9 @@ class AspectDefinitionsApi {
|
|
|
11559
11591
|
* Get a list of all aspects
|
|
11560
11592
|
*
|
|
11561
11593
|
* @param xMagdaTenantId 0
|
|
11594
|
+
* @param xMagdaSession Magda internal session id
|
|
11562
11595
|
*/
|
|
11563
|
-
getAll(xMagdaTenantId) {
|
|
11596
|
+
getAll(xMagdaTenantId, xMagdaSession) {
|
|
11564
11597
|
const localVarPath = this.basePath + '/aspects';
|
|
11565
11598
|
let queryParameters = {};
|
|
11566
11599
|
let headerParams = Object.assign({}, this.defaultHeaders);
|
|
@@ -11570,6 +11603,7 @@ class AspectDefinitionsApi {
|
|
|
11570
11603
|
throw new Error('Required parameter xMagdaTenantId was null or undefined when calling getAll.');
|
|
11571
11604
|
}
|
|
11572
11605
|
headerParams['X-Magda-Tenant-Id'] = xMagdaTenantId;
|
|
11606
|
+
headerParams['X-Magda-Session'] = xMagdaSession;
|
|
11573
11607
|
let useFormData = false;
|
|
11574
11608
|
let requestOptions = {
|
|
11575
11609
|
method: 'GET',
|
|
@@ -11609,8 +11643,9 @@ class AspectDefinitionsApi {
|
|
|
11609
11643
|
*
|
|
11610
11644
|
* @param xMagdaTenantId 0
|
|
11611
11645
|
* @param id ID of the aspect to be fetched.
|
|
11646
|
+
* @param xMagdaSession Magda internal session id
|
|
11612
11647
|
*/
|
|
11613
|
-
getById(xMagdaTenantId, id) {
|
|
11648
|
+
getById(xMagdaTenantId, id, xMagdaSession) {
|
|
11614
11649
|
const localVarPath = this.basePath + '/aspects/{id}'
|
|
11615
11650
|
.replace('{' + 'id' + '}', String(id));
|
|
11616
11651
|
let queryParameters = {};
|
|
@@ -11625,6 +11660,7 @@ class AspectDefinitionsApi {
|
|
|
11625
11660
|
throw new Error('Required parameter id was null or undefined when calling getById.');
|
|
11626
11661
|
}
|
|
11627
11662
|
headerParams['X-Magda-Tenant-Id'] = xMagdaTenantId;
|
|
11663
|
+
headerParams['X-Magda-Session'] = xMagdaSession;
|
|
11628
11664
|
let useFormData = false;
|
|
11629
11665
|
let requestOptions = {
|
|
11630
11666
|
method: 'GET',
|
|
@@ -11890,6 +11926,140 @@ class RecordAspectsApi {
|
|
|
11890
11926
|
});
|
|
11891
11927
|
});
|
|
11892
11928
|
}
|
|
11929
|
+
/**
|
|
11930
|
+
* Get a list of a record's aspects
|
|
11931
|
+
*
|
|
11932
|
+
* @param xMagdaTenantId 0
|
|
11933
|
+
* @param recordId ID of the record for which to fetch aspects.
|
|
11934
|
+
* @param keyword Specify the keyword to search in the all aspects' aspectId & data fields.
|
|
11935
|
+
* @param aspectIdOnly When set to true, will respond only an array contains aspect id only.
|
|
11936
|
+
* @param start The index of the first record to retrieve.
|
|
11937
|
+
* @param limit The maximum number of records to receive.
|
|
11938
|
+
* @param xMagdaSession Magda internal session id
|
|
11939
|
+
*/
|
|
11940
|
+
getAspects(xMagdaTenantId, recordId, keyword, aspectIdOnly, start, limit, xMagdaSession) {
|
|
11941
|
+
const localVarPath = this.basePath + '/records/{recordId}/aspects'
|
|
11942
|
+
.replace('{' + 'recordId' + '}', String(recordId));
|
|
11943
|
+
let queryParameters = {};
|
|
11944
|
+
let headerParams = Object.assign({}, this.defaultHeaders);
|
|
11945
|
+
let formParams = {};
|
|
11946
|
+
// verify required parameter 'xMagdaTenantId' is not null or undefined
|
|
11947
|
+
if (xMagdaTenantId === null || xMagdaTenantId === undefined) {
|
|
11948
|
+
throw new Error('Required parameter xMagdaTenantId was null or undefined when calling getAspects.');
|
|
11949
|
+
}
|
|
11950
|
+
// verify required parameter 'recordId' is not null or undefined
|
|
11951
|
+
if (recordId === null || recordId === undefined) {
|
|
11952
|
+
throw new Error('Required parameter recordId was null or undefined when calling getAspects.');
|
|
11953
|
+
}
|
|
11954
|
+
if (keyword !== undefined) {
|
|
11955
|
+
queryParameters['keyword'] = keyword;
|
|
11956
|
+
}
|
|
11957
|
+
if (aspectIdOnly !== undefined) {
|
|
11958
|
+
queryParameters['aspectIdOnly'] = aspectIdOnly;
|
|
11959
|
+
}
|
|
11960
|
+
if (start !== undefined) {
|
|
11961
|
+
queryParameters['start'] = start;
|
|
11962
|
+
}
|
|
11963
|
+
if (limit !== undefined) {
|
|
11964
|
+
queryParameters['limit'] = limit;
|
|
11965
|
+
}
|
|
11966
|
+
headerParams['X-Magda-Tenant-Id'] = xMagdaTenantId;
|
|
11967
|
+
headerParams['X-Magda-Session'] = xMagdaSession;
|
|
11968
|
+
let useFormData = false;
|
|
11969
|
+
let requestOptions = {
|
|
11970
|
+
method: 'GET',
|
|
11971
|
+
qs: queryParameters,
|
|
11972
|
+
headers: headerParams,
|
|
11973
|
+
uri: localVarPath,
|
|
11974
|
+
useQuerystring: this._useQuerystring,
|
|
11975
|
+
json: true,
|
|
11976
|
+
};
|
|
11977
|
+
this.authentications.default.applyToRequest(requestOptions);
|
|
11978
|
+
if (Object.keys(formParams).length) {
|
|
11979
|
+
if (useFormData) {
|
|
11980
|
+
requestOptions.formData = formParams;
|
|
11981
|
+
}
|
|
11982
|
+
else {
|
|
11983
|
+
requestOptions.form = formParams;
|
|
11984
|
+
}
|
|
11985
|
+
}
|
|
11986
|
+
return new Promise((resolve, reject) => {
|
|
11987
|
+
request(requestOptions, (error, response, body) => {
|
|
11988
|
+
if (error) {
|
|
11989
|
+
reject(error);
|
|
11990
|
+
}
|
|
11991
|
+
else {
|
|
11992
|
+
if (response.statusCode >= 200 && response.statusCode <= 299) {
|
|
11993
|
+
resolve({ response: response, body: body });
|
|
11994
|
+
}
|
|
11995
|
+
else {
|
|
11996
|
+
reject({ response: response, body: body });
|
|
11997
|
+
}
|
|
11998
|
+
}
|
|
11999
|
+
});
|
|
12000
|
+
});
|
|
12001
|
+
}
|
|
12002
|
+
/**
|
|
12003
|
+
* Get the number of aspects that a record has
|
|
12004
|
+
*
|
|
12005
|
+
* @param xMagdaTenantId 0
|
|
12006
|
+
* @param recordId ID of the record for which to fetch an aspect.
|
|
12007
|
+
* @param keyword Specify the keyword to search in the all aspects' aspectId & data fields.
|
|
12008
|
+
* @param xMagdaSession Magda internal session id
|
|
12009
|
+
*/
|
|
12010
|
+
getAspectsCount(xMagdaTenantId, recordId, keyword, xMagdaSession) {
|
|
12011
|
+
const localVarPath = this.basePath + '/records/{recordId}/aspects/count'
|
|
12012
|
+
.replace('{' + 'recordId' + '}', String(recordId));
|
|
12013
|
+
let queryParameters = {};
|
|
12014
|
+
let headerParams = Object.assign({}, this.defaultHeaders);
|
|
12015
|
+
let formParams = {};
|
|
12016
|
+
// verify required parameter 'xMagdaTenantId' is not null or undefined
|
|
12017
|
+
if (xMagdaTenantId === null || xMagdaTenantId === undefined) {
|
|
12018
|
+
throw new Error('Required parameter xMagdaTenantId was null or undefined when calling getAspectsCount.');
|
|
12019
|
+
}
|
|
12020
|
+
// verify required parameter 'recordId' is not null or undefined
|
|
12021
|
+
if (recordId === null || recordId === undefined) {
|
|
12022
|
+
throw new Error('Required parameter recordId was null or undefined when calling getAspectsCount.');
|
|
12023
|
+
}
|
|
12024
|
+
if (keyword !== undefined) {
|
|
12025
|
+
queryParameters['keyword'] = keyword;
|
|
12026
|
+
}
|
|
12027
|
+
headerParams['X-Magda-Tenant-Id'] = xMagdaTenantId;
|
|
12028
|
+
headerParams['X-Magda-Session'] = xMagdaSession;
|
|
12029
|
+
let useFormData = false;
|
|
12030
|
+
let requestOptions = {
|
|
12031
|
+
method: 'GET',
|
|
12032
|
+
qs: queryParameters,
|
|
12033
|
+
headers: headerParams,
|
|
12034
|
+
uri: localVarPath,
|
|
12035
|
+
useQuerystring: this._useQuerystring,
|
|
12036
|
+
json: true,
|
|
12037
|
+
};
|
|
12038
|
+
this.authentications.default.applyToRequest(requestOptions);
|
|
12039
|
+
if (Object.keys(formParams).length) {
|
|
12040
|
+
if (useFormData) {
|
|
12041
|
+
requestOptions.formData = formParams;
|
|
12042
|
+
}
|
|
12043
|
+
else {
|
|
12044
|
+
requestOptions.form = formParams;
|
|
12045
|
+
}
|
|
12046
|
+
}
|
|
12047
|
+
return new Promise((resolve, reject) => {
|
|
12048
|
+
request(requestOptions, (error, response, body) => {
|
|
12049
|
+
if (error) {
|
|
12050
|
+
reject(error);
|
|
12051
|
+
}
|
|
12052
|
+
else {
|
|
12053
|
+
if (response.statusCode >= 200 && response.statusCode <= 299) {
|
|
12054
|
+
resolve({ response: response, body: body });
|
|
12055
|
+
}
|
|
12056
|
+
else {
|
|
12057
|
+
reject({ response: response, body: body });
|
|
12058
|
+
}
|
|
12059
|
+
}
|
|
12060
|
+
});
|
|
12061
|
+
});
|
|
12062
|
+
}
|
|
11893
12063
|
/**
|
|
11894
12064
|
* Get a record aspect by ID
|
|
11895
12065
|
*
|
|
@@ -18714,10 +18884,10 @@ module.exports = DataStream;
|
|
|
18714
18884
|
/* 93 */
|
|
18715
18885
|
/***/ (function(module, exports, __webpack_require__) {
|
|
18716
18886
|
|
|
18717
|
-
var bufferEqual = __webpack_require__(
|
|
18887
|
+
var bufferEqual = __webpack_require__(221);
|
|
18718
18888
|
var Buffer = __webpack_require__(8).Buffer;
|
|
18719
18889
|
var crypto = __webpack_require__(3);
|
|
18720
|
-
var formatEcdsa = __webpack_require__(
|
|
18890
|
+
var formatEcdsa = __webpack_require__(222);
|
|
18721
18891
|
var util = __webpack_require__(1);
|
|
18722
18892
|
|
|
18723
18893
|
var MSG_INVALID_ALGORITHM = '"%s" is not a valid algorithm.\n Supported algorithms are:\n "HS256", "HS384", "HS512", "RS256", "RS384", "RS512", "PS256", "PS384", "PS512", "ES256", "ES384", "ES512" and "none".'
|
|
@@ -19024,7 +19194,7 @@ module.exports = TokenExpiredError;
|
|
|
19024
19194
|
/* 97 */
|
|
19025
19195
|
/***/ (function(module, exports, __webpack_require__) {
|
|
19026
19196
|
|
|
19027
|
-
var ms = __webpack_require__(
|
|
19197
|
+
var ms = __webpack_require__(226);
|
|
19028
19198
|
|
|
19029
19199
|
module.exports = function (time, iat) {
|
|
19030
19200
|
var timestamp = iat || Math.floor(Date.now() / 1000);
|
|
@@ -19047,7 +19217,7 @@ module.exports = function (time, iat) {
|
|
|
19047
19217
|
/* 98 */
|
|
19048
19218
|
/***/ (function(module, exports, __webpack_require__) {
|
|
19049
19219
|
|
|
19050
|
-
var semver = __webpack_require__(
|
|
19220
|
+
var semver = __webpack_require__(227);
|
|
19051
19221
|
|
|
19052
19222
|
module.exports = semver.satisfies(process.version, '^6.12.0 || >=8.0.0');
|
|
19053
19223
|
|
|
@@ -19062,9 +19232,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
19062
19232
|
exports.TenantConsts = void 0;
|
|
19063
19233
|
var RegistryClient_1 = __webpack_require__(48);
|
|
19064
19234
|
Object.defineProperty(exports, "RegistryClient", { enumerable: true, get: function () { return RegistryClient_1.default; } });
|
|
19065
|
-
var AuthorizedRegistryClient_1 = __webpack_require__(
|
|
19235
|
+
var AuthorizedRegistryClient_1 = __webpack_require__(217);
|
|
19066
19236
|
Object.defineProperty(exports, "AuthorizedRegistryClient", { enumerable: true, get: function () { return AuthorizedRegistryClient_1.default; } });
|
|
19067
|
-
exports.TenantConsts = __webpack_require__(
|
|
19237
|
+
exports.TenantConsts = __webpack_require__(237);
|
|
19068
19238
|
var api_1 = __webpack_require__(49);
|
|
19069
19239
|
Object.defineProperty(exports, "Record", { enumerable: true, get: function () { return api_1.Record; } });
|
|
19070
19240
|
Object.defineProperty(exports, "AspectDefinition", { enumerable: true, get: function () { return api_1.AspectDefinition; } });
|
|
@@ -38940,6 +39110,38 @@ exports.default = runLater;
|
|
|
38940
39110
|
|
|
38941
39111
|
"use strict";
|
|
38942
39112
|
|
|
39113
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39114
|
+
class ServerError extends Error {
|
|
39115
|
+
constructor(message = "Unknown Error", statusCode = 500) {
|
|
39116
|
+
super(message);
|
|
39117
|
+
this.statusCode = statusCode;
|
|
39118
|
+
}
|
|
39119
|
+
toData() {
|
|
39120
|
+
return {
|
|
39121
|
+
isError: true,
|
|
39122
|
+
errorCode: this.statusCode,
|
|
39123
|
+
errorMessage: this.message
|
|
39124
|
+
};
|
|
39125
|
+
}
|
|
39126
|
+
}
|
|
39127
|
+
exports.default = ServerError;
|
|
39128
|
+
//# sourceMappingURL=ServerError.js.map
|
|
39129
|
+
|
|
39130
|
+
/***/ }),
|
|
39131
|
+
/* 217 */
|
|
39132
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
39133
|
+
|
|
39134
|
+
"use strict";
|
|
39135
|
+
|
|
39136
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
39137
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
39138
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
39139
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
39140
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
39141
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
39142
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
39143
|
+
});
|
|
39144
|
+
};
|
|
38943
39145
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
38944
39146
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38945
39147
|
};
|
|
@@ -38948,8 +39150,8 @@ const RegistryClient_1 = __importDefault(__webpack_require__(48));
|
|
|
38948
39150
|
const retry_1 = __importDefault(__webpack_require__(88));
|
|
38949
39151
|
const formatServiceError_1 = __importDefault(__webpack_require__(89));
|
|
38950
39152
|
const createServiceError_1 = __importDefault(__webpack_require__(90));
|
|
38951
|
-
const buildJwt_1 = __importDefault(__webpack_require__(
|
|
38952
|
-
const tsmonad_1 = __webpack_require__(
|
|
39153
|
+
const buildJwt_1 = __importDefault(__webpack_require__(218));
|
|
39154
|
+
const tsmonad_1 = __webpack_require__(236);
|
|
38953
39155
|
class AuthorizedRegistryClient extends RegistryClient_1.default {
|
|
38954
39156
|
constructor(options) {
|
|
38955
39157
|
if (options.tenantId === undefined || options.tenantId === null) {
|
|
@@ -38965,6 +39167,14 @@ class AuthorizedRegistryClient extends RegistryClient_1.default {
|
|
|
38965
39167
|
? options.jwt
|
|
38966
39168
|
: buildJwt_1.default(options.jwtSecret, options.userId);
|
|
38967
39169
|
}
|
|
39170
|
+
getAspectDefinition(aspectId) {
|
|
39171
|
+
const _super = Object.create(null, {
|
|
39172
|
+
getAspectDefinition: { get: () => super.getAspectDefinition }
|
|
39173
|
+
});
|
|
39174
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
39175
|
+
return yield _super.getAspectDefinition.call(this, aspectId, this.jwt);
|
|
39176
|
+
});
|
|
39177
|
+
}
|
|
38968
39178
|
putAspectDefinition(aspectDefinition, tenantId = this.tenantId) {
|
|
38969
39179
|
const operation = () => this.aspectDefinitionsApi.putById(tenantId, encodeURIComponent(aspectDefinition.id), aspectDefinition, this.jwt);
|
|
38970
39180
|
return retry_1.default(operation, this.secondsBetweenRetries, this.maxRetries, (e, retriesLeft) => console.log(formatServiceError_1.default(`Failed to create aspect definition "${aspectDefinition.id}".`, e, retriesLeft)))
|
|
@@ -39056,13 +39266,13 @@ exports.default = AuthorizedRegistryClient;
|
|
|
39056
39266
|
//# sourceMappingURL=AuthorizedRegistryClient.js.map
|
|
39057
39267
|
|
|
39058
39268
|
/***/ }),
|
|
39059
|
-
/*
|
|
39269
|
+
/* 218 */
|
|
39060
39270
|
/***/ (function(module, exports, __webpack_require__) {
|
|
39061
39271
|
|
|
39062
39272
|
"use strict";
|
|
39063
39273
|
|
|
39064
39274
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39065
|
-
const jwt = __webpack_require__(
|
|
39275
|
+
const jwt = __webpack_require__(219);
|
|
39066
39276
|
function buildJwt(jwtSecret, userId, session = {}) {
|
|
39067
39277
|
return jwt.sign({ userId, session }, jwtSecret);
|
|
39068
39278
|
}
|
|
@@ -39070,13 +39280,13 @@ exports.default = buildJwt;
|
|
|
39070
39280
|
//# sourceMappingURL=buildJwt.js.map
|
|
39071
39281
|
|
|
39072
39282
|
/***/ }),
|
|
39073
|
-
/*
|
|
39283
|
+
/* 219 */
|
|
39074
39284
|
/***/ (function(module, exports, __webpack_require__) {
|
|
39075
39285
|
|
|
39076
39286
|
module.exports = {
|
|
39077
39287
|
decode: __webpack_require__(91),
|
|
39078
|
-
verify: __webpack_require__(
|
|
39079
|
-
sign: __webpack_require__(
|
|
39288
|
+
verify: __webpack_require__(225),
|
|
39289
|
+
sign: __webpack_require__(228),
|
|
39080
39290
|
JsonWebTokenError: __webpack_require__(31),
|
|
39081
39291
|
NotBeforeError: __webpack_require__(95),
|
|
39082
39292
|
TokenExpiredError: __webpack_require__(96),
|
|
@@ -39084,7 +39294,7 @@ module.exports = {
|
|
|
39084
39294
|
|
|
39085
39295
|
|
|
39086
39296
|
/***/ }),
|
|
39087
|
-
/*
|
|
39297
|
+
/* 220 */
|
|
39088
39298
|
/***/ (function(module, exports, __webpack_require__) {
|
|
39089
39299
|
|
|
39090
39300
|
/*global module*/
|
|
@@ -39168,7 +39378,7 @@ module.exports = SignStream;
|
|
|
39168
39378
|
|
|
39169
39379
|
|
|
39170
39380
|
/***/ }),
|
|
39171
|
-
/*
|
|
39381
|
+
/* 221 */
|
|
39172
39382
|
/***/ (function(module, exports, __webpack_require__) {
|
|
39173
39383
|
|
|
39174
39384
|
"use strict";
|
|
@@ -39216,7 +39426,7 @@ bufferEq.restore = function() {
|
|
|
39216
39426
|
|
|
39217
39427
|
|
|
39218
39428
|
/***/ }),
|
|
39219
|
-
/*
|
|
39429
|
+
/* 222 */
|
|
39220
39430
|
/***/ (function(module, exports, __webpack_require__) {
|
|
39221
39431
|
|
|
39222
39432
|
"use strict";
|
|
@@ -39224,7 +39434,7 @@ bufferEq.restore = function() {
|
|
|
39224
39434
|
|
|
39225
39435
|
var Buffer = __webpack_require__(8).Buffer;
|
|
39226
39436
|
|
|
39227
|
-
var getParamBytesForAlg = __webpack_require__(
|
|
39437
|
+
var getParamBytesForAlg = __webpack_require__(223);
|
|
39228
39438
|
|
|
39229
39439
|
var MAX_OCTET = 0x80,
|
|
39230
39440
|
CLASS_UNIVERSAL = 0,
|
|
@@ -39410,7 +39620,7 @@ module.exports = {
|
|
|
39410
39620
|
|
|
39411
39621
|
|
|
39412
39622
|
/***/ }),
|
|
39413
|
-
/*
|
|
39623
|
+
/* 223 */
|
|
39414
39624
|
/***/ (function(module, exports, __webpack_require__) {
|
|
39415
39625
|
|
|
39416
39626
|
"use strict";
|
|
@@ -39440,7 +39650,7 @@ module.exports = getParamBytesForAlg;
|
|
|
39440
39650
|
|
|
39441
39651
|
|
|
39442
39652
|
/***/ }),
|
|
39443
|
-
/*
|
|
39653
|
+
/* 224 */
|
|
39444
39654
|
/***/ (function(module, exports, __webpack_require__) {
|
|
39445
39655
|
|
|
39446
39656
|
/*global module*/
|
|
@@ -39566,7 +39776,7 @@ module.exports = VerifyStream;
|
|
|
39566
39776
|
|
|
39567
39777
|
|
|
39568
39778
|
/***/ }),
|
|
39569
|
-
/*
|
|
39779
|
+
/* 225 */
|
|
39570
39780
|
/***/ (function(module, exports, __webpack_require__) {
|
|
39571
39781
|
|
|
39572
39782
|
var JsonWebTokenError = __webpack_require__(31);
|
|
@@ -39797,7 +40007,7 @@ module.exports = function (jwtString, secretOrPublicKey, options, callback) {
|
|
|
39797
40007
|
|
|
39798
40008
|
|
|
39799
40009
|
/***/ }),
|
|
39800
|
-
/*
|
|
40010
|
+
/* 226 */
|
|
39801
40011
|
/***/ (function(module, exports) {
|
|
39802
40012
|
|
|
39803
40013
|
/**
|
|
@@ -39965,7 +40175,7 @@ function plural(ms, msAbs, n, name) {
|
|
|
39965
40175
|
|
|
39966
40176
|
|
|
39967
40177
|
/***/ }),
|
|
39968
|
-
/*
|
|
40178
|
+
/* 227 */
|
|
39969
40179
|
/***/ (function(module, exports) {
|
|
39970
40180
|
|
|
39971
40181
|
exports = module.exports = SemVer
|
|
@@ -41454,19 +41664,19 @@ function coerce (version) {
|
|
|
41454
41664
|
|
|
41455
41665
|
|
|
41456
41666
|
/***/ }),
|
|
41457
|
-
/*
|
|
41667
|
+
/* 228 */
|
|
41458
41668
|
/***/ (function(module, exports, __webpack_require__) {
|
|
41459
41669
|
|
|
41460
41670
|
var timespan = __webpack_require__(97);
|
|
41461
41671
|
var PS_SUPPORTED = __webpack_require__(98);
|
|
41462
41672
|
var jws = __webpack_require__(47);
|
|
41463
|
-
var includes = __webpack_require__(
|
|
41464
|
-
var isBoolean = __webpack_require__(
|
|
41465
|
-
var isInteger = __webpack_require__(
|
|
41466
|
-
var isNumber = __webpack_require__(
|
|
41467
|
-
var isPlainObject = __webpack_require__(
|
|
41468
|
-
var isString = __webpack_require__(
|
|
41469
|
-
var once = __webpack_require__(
|
|
41673
|
+
var includes = __webpack_require__(229);
|
|
41674
|
+
var isBoolean = __webpack_require__(230);
|
|
41675
|
+
var isInteger = __webpack_require__(231);
|
|
41676
|
+
var isNumber = __webpack_require__(232);
|
|
41677
|
+
var isPlainObject = __webpack_require__(233);
|
|
41678
|
+
var isString = __webpack_require__(234);
|
|
41679
|
+
var once = __webpack_require__(235);
|
|
41470
41680
|
|
|
41471
41681
|
var SUPPORTED_ALGS = ['RS256', 'RS384', 'RS512', 'ES256', 'ES384', 'ES512', 'HS256', 'HS384', 'HS512', 'none']
|
|
41472
41682
|
if (PS_SUPPORTED) {
|
|
@@ -41666,7 +41876,7 @@ module.exports = function (payload, secretOrPrivateKey, options, callback) {
|
|
|
41666
41876
|
|
|
41667
41877
|
|
|
41668
41878
|
/***/ }),
|
|
41669
|
-
/*
|
|
41879
|
+
/* 229 */
|
|
41670
41880
|
/***/ (function(module, exports) {
|
|
41671
41881
|
|
|
41672
41882
|
/**
|
|
@@ -42417,7 +42627,7 @@ module.exports = includes;
|
|
|
42417
42627
|
|
|
42418
42628
|
|
|
42419
42629
|
/***/ }),
|
|
42420
|
-
/*
|
|
42630
|
+
/* 230 */
|
|
42421
42631
|
/***/ (function(module, exports) {
|
|
42422
42632
|
|
|
42423
42633
|
/**
|
|
@@ -42493,7 +42703,7 @@ module.exports = isBoolean;
|
|
|
42493
42703
|
|
|
42494
42704
|
|
|
42495
42705
|
/***/ }),
|
|
42496
|
-
/*
|
|
42706
|
+
/* 231 */
|
|
42497
42707
|
/***/ (function(module, exports) {
|
|
42498
42708
|
|
|
42499
42709
|
/**
|
|
@@ -42764,7 +42974,7 @@ module.exports = isInteger;
|
|
|
42764
42974
|
|
|
42765
42975
|
|
|
42766
42976
|
/***/ }),
|
|
42767
|
-
/*
|
|
42977
|
+
/* 232 */
|
|
42768
42978
|
/***/ (function(module, exports) {
|
|
42769
42979
|
|
|
42770
42980
|
/**
|
|
@@ -42849,7 +43059,7 @@ module.exports = isNumber;
|
|
|
42849
43059
|
|
|
42850
43060
|
|
|
42851
43061
|
/***/ }),
|
|
42852
|
-
/*
|
|
43062
|
+
/* 233 */
|
|
42853
43063
|
/***/ (function(module, exports) {
|
|
42854
43064
|
|
|
42855
43065
|
/**
|
|
@@ -42994,7 +43204,7 @@ module.exports = isPlainObject;
|
|
|
42994
43204
|
|
|
42995
43205
|
|
|
42996
43206
|
/***/ }),
|
|
42997
|
-
/*
|
|
43207
|
+
/* 234 */
|
|
42998
43208
|
/***/ (function(module, exports) {
|
|
42999
43209
|
|
|
43000
43210
|
/**
|
|
@@ -43095,7 +43305,7 @@ module.exports = isString;
|
|
|
43095
43305
|
|
|
43096
43306
|
|
|
43097
43307
|
/***/ }),
|
|
43098
|
-
/*
|
|
43308
|
+
/* 235 */
|
|
43099
43309
|
/***/ (function(module, exports) {
|
|
43100
43310
|
|
|
43101
43311
|
/**
|
|
@@ -43395,14 +43605,14 @@ module.exports = once;
|
|
|
43395
43605
|
|
|
43396
43606
|
|
|
43397
43607
|
/***/ }),
|
|
43398
|
-
/*
|
|
43608
|
+
/* 236 */
|
|
43399
43609
|
/***/ (function(module, exports, __webpack_require__) {
|
|
43400
43610
|
|
|
43401
43611
|
!function(t,n){if(true)module.exports=n();else { var i, e; }}(this,function(){return function(t){function n(i){if(e[i])return e[i].exports;var r=e[i]={exports:{},id:i,loaded:!1};return t[i].call(r.exports,r,r.exports,n),r.loaded=!0,r.exports}var e={};return n.m=t,n.c=e,n.p="",n(0)}([function(t,n,e){"use strict";function i(t){for(var e in t)n.hasOwnProperty(e)||(n[e]=t[e])}Object.defineProperty(n,"__esModule",{value:!0}),i(e(2)),i(e(3)),i(e(1)),i(e(4))},function(t,n){"use strict";function e(t,n){var i=0;if(t===n)return!0;if("function"==typeof t.equals)return t.equals(n);if(t.length>0&&t.length===n.length){for(;i<t.length;i+=1)if(!e(t[i],n[i]))return!1;return!0}return!1}Object.defineProperty(n,"__esModule",{value:!0}),n.eq=e},function(t,n,e){"use strict";function i(t){return null!==t&&void 0!==t}function r(t,n){if(i(t)&&i(n))throw new TypeError("Cannot construct an Either with both a left and a right");if(!i(t)&&!i(n))throw new TypeError("Cannot construct an Either with neither a left nor a right");return i(t)&&!i(n)?s.left(t):!i(t)&&i(n)?s.right(n):void 0}Object.defineProperty(n,"__esModule",{value:!0});var o,u=e(1);!function(t){t[t.Left=0]="Left",t[t.Right=1]="Right"}(o=n.EitherType||(n.EitherType={})),n.either=r;var s=function(){function t(t,n,e){this.type=t,this.l=n,this.r=e,this.of=this.unit,this.chain=this.bind,this.lift=this.fmap,this.map=this.fmap}return t.left=function(n){return new t(o.Left,n)},t.right=function(n){return new t(o.Right,null,n)},t.prototype.unit=function(n){return t.right(n)},t.prototype.bind=function(n){return this.type===o.Right?n(this.r):t.left(this.l)},t.prototype.fmap=function(t){var n=this;return this.bind(function(e){return n.unit(t(e))})},t.prototype.caseOf=function(t){return this.type===o.Right?t.right(this.r):t.left(this.l)},t.prototype.equals=function(t){return t.type===this.type&&(this.type===o.Left&&u.eq(t.l,this.l)||this.type===o.Right&&u.eq(t.r,this.r))},t.prototype["do"]=function(t){void 0===t&&(t={});var n={left:function(t){},right:function(t){}},e=Object.assign(n,t);return this.caseOf(e),this},t}();n.Either=s},function(t,n,e){"use strict";function i(t){return u.maybe(t)}Object.defineProperty(n,"__esModule",{value:!0});var r,o=e(1);!function(t){t[t.Nothing=0]="Nothing",t[t.Just=1]="Just"}(r=n.MaybeType||(n.MaybeType={})),n.maybe=i;var u=function(){function t(t,n){this.type=t,this.value=n,this.of=this.unit,this.chain=this.bind,this.lift=this.fmap,this.map=this.fmap}return t.sequence=function(n){if(Object.keys(n).filter(function(t){return n[t].type===r.Nothing}).length)return t.nothing();var e={};for(var i in n)n.hasOwnProperty(i)&&(e[i]=n[i].value);return t.just(e)},t.maybe=function(n){return null===n||void 0===n?new t(r.Nothing):new t(r.Just,n)},t.just=function(n){if(null===n||void 0===n)throw new TypeError("Cannot Maybe.just(null)");return new t(r.Just,n)},t.nothing=function(){return new t(r.Nothing)},t.prototype.unit=function(n){return t.maybe(n)},t.prototype.bind=function(n){return this.type===r.Just?n(this.value):t.nothing()},t.prototype.fmap=function(t){var n=this;return this.bind(function(e){return n.unit(t(e))})},t.prototype.caseOf=function(t){return this.type===r.Just?t.just(this.value):t.nothing()},t.prototype.defaulting=function(n){return t.just(this.valueOr(n))},t.prototype.equals=function(t){return t.type===this.type&&(this.type===r.Nothing||o.eq(t.value,this.value))},t.prototype.valueOr=function(t){return this.valueOrCompute(function(){return t})},t.prototype.valueOrCompute=function(t){return this.type===r.Just?this.value:t()},t.prototype.valueOrThrow=function(t){if(this.type===r.Just)return this.value;throw t||new Error("No value is available.")},t.prototype["do"]=function(t){void 0===t&&(t={});var n={just:function(t){},nothing:function(){}},e=Object.assign(n,t);return this.caseOf(e),this},t}();u.all=function(t){return u.sequence(t)},n.Maybe=u},function(t,n){"use strict";function e(t,n){return i.writer(t,n)}Object.defineProperty(n,"__esModule",{value:!0}),n.writer=e;var i=function(){function t(t,n){this.story=t,this.value=n,this.of=this.unit,this.chain=this.bind,this.lift=this.fmap,this.map=this.fmap}return t.writer=function(n,e){return new t(n,e)},t.tell=function(n){return new t([n],0)},t.prototype.unit=function(n){return new t([],n)},t.prototype.bind=function(n){var e=n(this.value),i=this.story.concat(e.story);return new t(i,e.value)},t.prototype.fmap=function(t){var n=this;return this.bind(function(e){return n.unit(t(e))})},t.prototype.caseOf=function(t){return t.writer(this.story,this.value)},t.prototype.equals=function(t){var n,e=!0;for(n=0;n<this.story.length;n+=1)e=e&&this.story[n]===t.story[n];return e&&this.value===t.value},t}();n.Writer=i}])});
|
|
43402
43612
|
//# sourceMappingURL=tsmonad.js.map
|
|
43403
43613
|
|
|
43404
43614
|
/***/ }),
|
|
43405
|
-
/*
|
|
43615
|
+
/* 237 */
|
|
43406
43616
|
/***/ (function(module, exports, __webpack_require__) {
|
|
43407
43617
|
|
|
43408
43618
|
"use strict";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@magda/registry-client",
|
|
3
3
|
"description": "MAGDA Registry Client",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "2.0.0-alpha.0",
|
|
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": "^
|
|
15
|
+
"@magda/typescript-common": "^2.0.0-alpha.0",
|
|
16
16
|
"@microsoft/api-extractor": "^7.7.8",
|
|
17
17
|
"ts-loader": "^6.2.1",
|
|
18
18
|
"typescript": "^3.7.2",
|