@magda/registry-client 2.3.0 → 2.3.2-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/README.md +71 -70
- package/dist/index.d.ts +7 -4
- package/dist/index.js +17 -5
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -8,41 +8,42 @@ This package provides NodeJs client library to connect to a Magda Registry.
|
|
|
8
8
|
|
|
9
9
|
```typescript
|
|
10
10
|
export declare class RegistryClient {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
11
|
+
protected baseUri: uri.URI;
|
|
12
|
+
protected aspectDefinitionsApi: AspectDefinitionsApi;
|
|
13
|
+
protected recordsApi: RecordsApi;
|
|
14
|
+
protected webHooksApi: WebHooksApi;
|
|
15
|
+
protected recordAspectsApi: RecordAspectsApi;
|
|
16
|
+
protected maxRetries: number;
|
|
17
|
+
protected secondsBetweenRetries: number;
|
|
18
|
+
protected tenantId: number;
|
|
19
|
+
protected jwt: string | undefined;
|
|
20
|
+
constructor({
|
|
21
|
+
baseUrl,
|
|
22
|
+
maxRetries,
|
|
23
|
+
secondsBetweenRetries,
|
|
24
|
+
tenantId
|
|
25
|
+
}: RegistryOptions);
|
|
26
|
+
getRecordUrl(id: string): string;
|
|
27
|
+
getAspectDefinitions(): Promise<AspectDefinition[] | Error>;
|
|
28
|
+
getRecord(
|
|
29
|
+
id: string,
|
|
30
|
+
aspect?: Array<string>,
|
|
31
|
+
optionalAspect?: Array<string>,
|
|
32
|
+
dereference?: boolean
|
|
33
|
+
): Promise<Record | Error>;
|
|
34
|
+
getRecords<I extends Record>(
|
|
35
|
+
aspect?: Array<string>,
|
|
36
|
+
optionalAspect?: Array<string>,
|
|
37
|
+
pageToken?: string,
|
|
38
|
+
dereference?: boolean,
|
|
39
|
+
limit?: number,
|
|
40
|
+
aspectQueries?: string[],
|
|
41
|
+
q?: string
|
|
42
|
+
): Promise<RecordsPage<I> | Error>;
|
|
43
|
+
getRecordsPageTokens(
|
|
44
|
+
aspect?: Array<string>,
|
|
45
|
+
limit?: number
|
|
46
|
+
): Promise<string[] | Error>;
|
|
46
47
|
}
|
|
47
48
|
```
|
|
48
49
|
|
|
@@ -50,40 +51,40 @@ export declare class RegistryClient {
|
|
|
50
51
|
|
|
51
52
|
```typescript
|
|
52
53
|
export declare class AuthorizedRegistryClient extends RegistryClient {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
54
|
+
protected options: AuthorizedRegistryOptions;
|
|
55
|
+
protected jwt: string;
|
|
56
|
+
constructor(options: AuthorizedRegistryOptions);
|
|
57
|
+
putAspectDefinition(
|
|
58
|
+
aspectDefinition: AspectDefinition,
|
|
59
|
+
tenantId?: number
|
|
60
|
+
): Promise<AspectDefinition | Error>;
|
|
61
|
+
postHook(hook: WebHook): Promise<WebHook | Error>;
|
|
62
|
+
putHook(hook: WebHook): Promise<WebHook | Error>;
|
|
63
|
+
getHook(hookId: string): Promise<Maybe<WebHook> | Error>;
|
|
64
|
+
getHooks(): Promise<WebHook[] | Error>;
|
|
65
|
+
resumeHook(
|
|
66
|
+
webhookId: string,
|
|
67
|
+
succeeded?: boolean,
|
|
68
|
+
lastEventIdReceived?: string,
|
|
69
|
+
active?: boolean
|
|
70
|
+
): Promise<WebHookAcknowledgementResponse | Error>;
|
|
71
|
+
putRecord(record: Record, tenantId?: number): Promise<Record | Error>;
|
|
72
|
+
putRecordAspect(
|
|
73
|
+
recordId: string,
|
|
74
|
+
aspectId: string,
|
|
75
|
+
aspect: any,
|
|
76
|
+
tenantId?: number
|
|
77
|
+
): Promise<Record | Error>;
|
|
78
|
+
patchRecordAspect(
|
|
79
|
+
recordId: string,
|
|
80
|
+
aspectId: string,
|
|
81
|
+
aspectPatch: Operation[],
|
|
82
|
+
tenantId?: number
|
|
83
|
+
): Promise<Record | Error>;
|
|
84
|
+
deleteBySource(
|
|
85
|
+
sourceTagToPreserve: string,
|
|
86
|
+
sourceId: string,
|
|
87
|
+
tenantId?: number
|
|
88
|
+
): Promise<MultipleDeleteResult | "Processing" | Error>;
|
|
88
89
|
}
|
|
89
90
|
```
|
package/dist/index.d.ts
CHANGED
|
@@ -468,9 +468,10 @@ declare class RecordsApi {
|
|
|
468
468
|
* @param orderByDir Specify the order by direction. Either `asc` or `desc`
|
|
469
469
|
* @param orderNullFirst Specify whether nulls appear before (`true`) or after (`false`) non-null values in the sort ordering.
|
|
470
470
|
* @param reversePageTokenOrder When pagination via pageToken, by default, records with smaller pageToken (i.e. older records) will be returned first. When this parameter is set to `true`, higher pageToken records (newer records) will be returned.
|
|
471
|
+
* @param q full text search query
|
|
471
472
|
* @param xMagdaSession Magda internal session id
|
|
472
473
|
*/
|
|
473
|
-
getAll(xMagdaTenantId: number, aspect?: Array<string>, optionalAspect?: Array<string>, pageToken?: string, start?: number, limit?: number, dereference?: boolean, aspectQuery?: Array<string>, aspectOrQuery?: Array<string>, orderBy?: string, orderByDir?: string, orderNullFirst?: boolean, reversePageTokenOrder?: boolean, xMagdaSession?: string): Promise<{
|
|
474
|
+
getAll(xMagdaTenantId: number, aspect?: Array<string>, optionalAspect?: Array<string>, pageToken?: string, start?: number, limit?: number, dereference?: boolean, aspectQuery?: Array<string>, aspectOrQuery?: Array<string>, orderBy?: string, orderByDir?: string, orderNullFirst?: boolean, reversePageTokenOrder?: boolean, q?: string, xMagdaSession?: string): Promise<{
|
|
474
475
|
response: http.IncomingMessage;
|
|
475
476
|
body: Array<Record_2>;
|
|
476
477
|
}>;
|
|
@@ -482,9 +483,10 @@ declare class RecordsApi {
|
|
|
482
483
|
* @param start The index of the first record to retrieve. When possible, specify pageToken instead as it will result in better performance. If this parameter and pageToken are both specified, this parameter is interpreted as the index after the pageToken of the first record to retrieve.
|
|
483
484
|
* @param limit The maximum number of records to receive. The response will include a token that can be passed as the pageToken parameter to a future request to continue receiving results where this query leaves off.
|
|
484
485
|
* @param reversePageTokenOrder When pagination via pageToken, by default, records with smaller pageToken (i.e. older records) will be returned first. When this parameter is set to `true`, higher pageToken records (newer records) will be returned.
|
|
486
|
+
* @param q full text search query
|
|
485
487
|
* @param xMagdaSession Magda internal session id
|
|
486
488
|
*/
|
|
487
|
-
getAllSummary(xMagdaTenantId: number, pageToken?: string, start?: number, limit?: number, reversePageTokenOrder?: boolean, xMagdaSession?: string): Promise<{
|
|
489
|
+
getAllSummary(xMagdaTenantId: number, pageToken?: string, start?: number, limit?: number, reversePageTokenOrder?: boolean, q?: string, xMagdaSession?: string): Promise<{
|
|
488
490
|
response: http.IncomingMessage;
|
|
489
491
|
body: Array<RecordSummary>;
|
|
490
492
|
}>;
|
|
@@ -531,9 +533,10 @@ declare class RecordsApi {
|
|
|
531
533
|
* @param aspect The aspects for which to retrieve data, specified as multiple occurrences of this query parameter. Only records that have all of these aspects will be included in the response.
|
|
532
534
|
* @param aspectQuery Filter the records returned by a value within the aspect JSON. Expressed as 'aspectId.path.to.field:value', url encoded. NOTE: This is an early stage API and may change greatly in the future
|
|
533
535
|
* @param aspectOrQuery Filter the records returned by a value within the aspect JSON. Expressed as 'aspectId.path.to.field:value', url encoded. Queries passing via this parameter will be grouped with OR logic.
|
|
536
|
+
* @param q full text search query
|
|
534
537
|
* @param xMagdaSession Magda internal session id
|
|
535
538
|
*/
|
|
536
|
-
getCount(xMagdaTenantId: number, aspect?: Array<string>, aspectQuery?: Array<string>, aspectOrQuery?: Array<string>, xMagdaSession?: string): Promise<{
|
|
539
|
+
getCount(xMagdaTenantId: number, aspect?: Array<string>, aspectQuery?: Array<string>, aspectOrQuery?: Array<string>, q?: string, xMagdaSession?: string): Promise<{
|
|
537
540
|
response: http.IncomingMessage;
|
|
538
541
|
body: CountResponse;
|
|
539
542
|
}>;
|
|
@@ -662,7 +665,7 @@ export declare class RegistryClient {
|
|
|
662
665
|
getRecord(id: string, aspect?: Array<string>, optionalAspect?: Array<string>, dereference?: boolean): Promise<Record_2 | ServerError>;
|
|
663
666
|
getRecordAspect(id: string, aspectId: string): Promise<any | ServerError>;
|
|
664
667
|
getRecordInFull(id: string): Promise<Record_2>;
|
|
665
|
-
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, reversePageTokenOrder?: boolean): Promise<RecordsPage<I> | ServerError>;
|
|
668
|
+
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, reversePageTokenOrder?: boolean, q?: string): Promise<RecordsPage<I> | ServerError>;
|
|
666
669
|
getRecordsPageTokens(aspect?: Array<string>, limit?: number): Promise<string[] | ServerError>;
|
|
667
670
|
}
|
|
668
671
|
|
package/dist/index.js
CHANGED
|
@@ -11387,8 +11387,8 @@ class RegistryClient {
|
|
|
11387
11387
|
}
|
|
11388
11388
|
});
|
|
11389
11389
|
}
|
|
11390
|
-
getRecords(aspect, optionalAspect, pageToken, dereference, limit, aspectQueries, aspectOrQuery, orderBy, orderByDir, orderNullFirst, reversePageTokenOrder) {
|
|
11391
|
-
const operation = (pageToken) => () => this.recordsApi.getAll(this.tenantId, aspect, optionalAspect, pageToken, undefined, limit, dereference, aspectQueries, aspectOrQuery, orderBy, orderByDir, orderNullFirst, reversePageTokenOrder, this.jwt);
|
|
11390
|
+
getRecords(aspect, optionalAspect, pageToken, dereference, limit, aspectQueries, aspectOrQuery, orderBy, orderByDir, orderNullFirst, reversePageTokenOrder, q) {
|
|
11391
|
+
const operation = (pageToken) => () => this.recordsApi.getAll(this.tenantId, aspect, optionalAspect, pageToken, undefined, limit, dereference, aspectQueries, aspectOrQuery, orderBy, orderByDir, orderNullFirst, reversePageTokenOrder, q, this.jwt);
|
|
11392
11392
|
return retry_1.default(operation(pageToken), this.secondsBetweenRetries, this.maxRetries, (e, retriesLeft) => console.log(formatServiceError_1.default("Failed to GET records.", e, retriesLeft)))
|
|
11393
11393
|
.then((result) => result.body)
|
|
11394
11394
|
.catch(exports.toServerError("getRecords"));
|
|
@@ -12729,9 +12729,10 @@ class RecordsApi {
|
|
|
12729
12729
|
* @param orderByDir Specify the order by direction. Either `asc` or `desc`
|
|
12730
12730
|
* @param orderNullFirst Specify whether nulls appear before (`true`) or after (`false`) non-null values in the sort ordering.
|
|
12731
12731
|
* @param reversePageTokenOrder When pagination via pageToken, by default, records with smaller pageToken (i.e. older records) will be returned first. When this parameter is set to `true`, higher pageToken records (newer records) will be returned.
|
|
12732
|
+
* @param q full text search query
|
|
12732
12733
|
* @param xMagdaSession Magda internal session id
|
|
12733
12734
|
*/
|
|
12734
|
-
getAll(xMagdaTenantId, aspect, optionalAspect, pageToken, start, limit, dereference, aspectQuery, aspectOrQuery, orderBy, orderByDir, orderNullFirst, reversePageTokenOrder, xMagdaSession) {
|
|
12735
|
+
getAll(xMagdaTenantId, aspect, optionalAspect, pageToken, start, limit, dereference, aspectQuery, aspectOrQuery, orderBy, orderByDir, orderNullFirst, reversePageTokenOrder, q, xMagdaSession) {
|
|
12735
12736
|
const localVarPath = this.basePath + '/records';
|
|
12736
12737
|
let queryParameters = {};
|
|
12737
12738
|
let headerParams = Object.assign({}, this.defaultHeaders);
|
|
@@ -12776,6 +12777,9 @@ class RecordsApi {
|
|
|
12776
12777
|
if (reversePageTokenOrder !== undefined) {
|
|
12777
12778
|
queryParameters['reversePageTokenOrder'] = reversePageTokenOrder;
|
|
12778
12779
|
}
|
|
12780
|
+
if (q !== undefined) {
|
|
12781
|
+
queryParameters['q'] = q;
|
|
12782
|
+
}
|
|
12779
12783
|
headerParams['X-Magda-Tenant-Id'] = xMagdaTenantId;
|
|
12780
12784
|
headerParams['X-Magda-Session'] = xMagdaSession;
|
|
12781
12785
|
let useFormData = false;
|
|
@@ -12820,9 +12824,10 @@ class RecordsApi {
|
|
|
12820
12824
|
* @param start The index of the first record to retrieve. When possible, specify pageToken instead as it will result in better performance. If this parameter and pageToken are both specified, this parameter is interpreted as the index after the pageToken of the first record to retrieve.
|
|
12821
12825
|
* @param limit The maximum number of records to receive. The response will include a token that can be passed as the pageToken parameter to a future request to continue receiving results where this query leaves off.
|
|
12822
12826
|
* @param reversePageTokenOrder When pagination via pageToken, by default, records with smaller pageToken (i.e. older records) will be returned first. When this parameter is set to `true`, higher pageToken records (newer records) will be returned.
|
|
12827
|
+
* @param q full text search query
|
|
12823
12828
|
* @param xMagdaSession Magda internal session id
|
|
12824
12829
|
*/
|
|
12825
|
-
getAllSummary(xMagdaTenantId, pageToken, start, limit, reversePageTokenOrder, xMagdaSession) {
|
|
12830
|
+
getAllSummary(xMagdaTenantId, pageToken, start, limit, reversePageTokenOrder, q, xMagdaSession) {
|
|
12826
12831
|
const localVarPath = this.basePath + '/records/summary';
|
|
12827
12832
|
let queryParameters = {};
|
|
12828
12833
|
let headerParams = Object.assign({}, this.defaultHeaders);
|
|
@@ -12843,6 +12848,9 @@ class RecordsApi {
|
|
|
12843
12848
|
if (reversePageTokenOrder !== undefined) {
|
|
12844
12849
|
queryParameters['reversePageTokenOrder'] = reversePageTokenOrder;
|
|
12845
12850
|
}
|
|
12851
|
+
if (q !== undefined) {
|
|
12852
|
+
queryParameters['q'] = q;
|
|
12853
|
+
}
|
|
12846
12854
|
headerParams['X-Magda-Tenant-Id'] = xMagdaTenantId;
|
|
12847
12855
|
headerParams['X-Magda-Session'] = xMagdaSession;
|
|
12848
12856
|
let useFormData = false;
|
|
@@ -13069,9 +13077,10 @@ class RecordsApi {
|
|
|
13069
13077
|
* @param aspect The aspects for which to retrieve data, specified as multiple occurrences of this query parameter. Only records that have all of these aspects will be included in the response.
|
|
13070
13078
|
* @param aspectQuery Filter the records returned by a value within the aspect JSON. Expressed as 'aspectId.path.to.field:value', url encoded. NOTE: This is an early stage API and may change greatly in the future
|
|
13071
13079
|
* @param aspectOrQuery Filter the records returned by a value within the aspect JSON. Expressed as 'aspectId.path.to.field:value', url encoded. Queries passing via this parameter will be grouped with OR logic.
|
|
13080
|
+
* @param q full text search query
|
|
13072
13081
|
* @param xMagdaSession Magda internal session id
|
|
13073
13082
|
*/
|
|
13074
|
-
getCount(xMagdaTenantId, aspect, aspectQuery, aspectOrQuery, xMagdaSession) {
|
|
13083
|
+
getCount(xMagdaTenantId, aspect, aspectQuery, aspectOrQuery, q, xMagdaSession) {
|
|
13075
13084
|
const localVarPath = this.basePath + '/records/count';
|
|
13076
13085
|
let queryParameters = {};
|
|
13077
13086
|
let headerParams = Object.assign({}, this.defaultHeaders);
|
|
@@ -13089,6 +13098,9 @@ class RecordsApi {
|
|
|
13089
13098
|
if (aspectOrQuery !== undefined) {
|
|
13090
13099
|
queryParameters['aspectOrQuery'] = aspectOrQuery;
|
|
13091
13100
|
}
|
|
13101
|
+
if (q !== undefined) {
|
|
13102
|
+
queryParameters['q'] = q;
|
|
13103
|
+
}
|
|
13092
13104
|
headerParams['X-Magda-Tenant-Id'] = xMagdaTenantId;
|
|
13093
13105
|
headerParams['X-Magda-Session'] = xMagdaSession;
|
|
13094
13106
|
let useFormData = false;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@magda/registry-client",
|
|
3
3
|
"description": "MAGDA Registry Client",
|
|
4
|
-
"version": "2.3.0",
|
|
4
|
+
"version": "2.3.2-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": "^2.3.0",
|
|
15
|
+
"@magda/typescript-common": "^2.3.2-alpha.0",
|
|
16
16
|
"@microsoft/api-extractor": "~7.15.2",
|
|
17
17
|
"ts-loader": "^6.2.1",
|
|
18
18
|
"typescript": "~4.2.4",
|