@magda/registry-client 6.0.0-alpha.9 → 6.0.0-pr.3665.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/dist/index.d.ts +12 -0
- package/dist/index.js +51 -2
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -439,6 +439,17 @@ declare class RecordsApi {
|
|
|
439
439
|
response: Response;
|
|
440
440
|
body: Array<any>;
|
|
441
441
|
}>;
|
|
442
|
+
/**
|
|
443
|
+
* Filter a list of record ids by access
|
|
444
|
+
* Request body is a JSON array of record ids. Returns only readable record ids.
|
|
445
|
+
* @param requestData A JSON array of record ids, e.g. [\"id1\", \"id2\"]
|
|
446
|
+
* @param xMagdaTenantId 0
|
|
447
|
+
* @param xMagdaSession Magda internal session id
|
|
448
|
+
*/
|
|
449
|
+
filterByAccess(requestData: Array<string>, xMagdaTenantId: number, xMagdaSession?: string): Promise<{
|
|
450
|
+
response: Response;
|
|
451
|
+
body: Array<string>;
|
|
452
|
+
}>;
|
|
442
453
|
/**
|
|
443
454
|
* Get a list of all records
|
|
444
455
|
*
|
|
@@ -654,6 +665,7 @@ export declare class RegistryClient {
|
|
|
654
665
|
getRecordInFull(id: string): Promise<Record_2>;
|
|
655
666
|
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>;
|
|
656
667
|
getRecordsPageTokens(aspect?: Array<string>, limit?: number): Promise<string[] | ServerError>;
|
|
668
|
+
filterRecordsByAccess(records: string[], jwtToken?: string, tenantId?: number): Promise<string[] | ServerError>;
|
|
657
669
|
}
|
|
658
670
|
|
|
659
671
|
export declare class RegistryEvent {
|
package/dist/index.js
CHANGED
|
@@ -11222,9 +11222,9 @@ var require_yallist = __commonJS({
|
|
|
11222
11222
|
}
|
|
11223
11223
|
});
|
|
11224
11224
|
|
|
11225
|
-
// ../../node_modules/lru-cache/index.js
|
|
11225
|
+
// ../../magda-typescript-common/node_modules/lru-cache/index.js
|
|
11226
11226
|
var require_lru_cache = __commonJS({
|
|
11227
|
-
"../../node_modules/lru-cache/index.js"(exports, module) {
|
|
11227
|
+
"../../magda-typescript-common/node_modules/lru-cache/index.js"(exports, module) {
|
|
11228
11228
|
"use strict";
|
|
11229
11229
|
init_cjs_shim();
|
|
11230
11230
|
var Yallist = require_yallist();
|
|
@@ -14581,6 +14581,49 @@ var RecordsApi = class {
|
|
|
14581
14581
|
}
|
|
14582
14582
|
return fetchWithRequestOptions(requestOptions);
|
|
14583
14583
|
}
|
|
14584
|
+
/**
|
|
14585
|
+
* Filter a list of record ids by access
|
|
14586
|
+
* Request body is a JSON array of record ids. Returns only readable record ids.
|
|
14587
|
+
* @param requestData A JSON array of record ids, e.g. [\"id1\", \"id2\"]
|
|
14588
|
+
* @param xMagdaTenantId 0
|
|
14589
|
+
* @param xMagdaSession Magda internal session id
|
|
14590
|
+
*/
|
|
14591
|
+
filterByAccess(requestData, xMagdaTenantId, xMagdaSession) {
|
|
14592
|
+
const localVarPath = this.basePath + "/records/filterByAccess";
|
|
14593
|
+
let queryParameters = {};
|
|
14594
|
+
let headerParams = Object.assign({}, this.defaultHeaders);
|
|
14595
|
+
let formParams = {};
|
|
14596
|
+
if (requestData === null || requestData === void 0) {
|
|
14597
|
+
throw new Error("Required parameter requestData was null or undefined when calling filterByAccess.");
|
|
14598
|
+
}
|
|
14599
|
+
if (xMagdaTenantId === null || xMagdaTenantId === void 0) {
|
|
14600
|
+
throw new Error("Required parameter xMagdaTenantId was null or undefined when calling filterByAccess.");
|
|
14601
|
+
}
|
|
14602
|
+
if (isNotEmpty(xMagdaTenantId)) {
|
|
14603
|
+
headerParams["X-Magda-Tenant-Id"] = xMagdaTenantId;
|
|
14604
|
+
}
|
|
14605
|
+
if (isNotEmpty(xMagdaSession)) {
|
|
14606
|
+
headerParams["X-Magda-Session"] = xMagdaSession;
|
|
14607
|
+
}
|
|
14608
|
+
let useFormData = false;
|
|
14609
|
+
const requestOptions = {
|
|
14610
|
+
method: "POST",
|
|
14611
|
+
qs: queryParameters,
|
|
14612
|
+
headers: headerParams,
|
|
14613
|
+
uri: localVarPath,
|
|
14614
|
+
json: true,
|
|
14615
|
+
body: requestData
|
|
14616
|
+
};
|
|
14617
|
+
this.authentications.default.applyToRequest(requestOptions);
|
|
14618
|
+
if (Object.keys(formParams).length) {
|
|
14619
|
+
if (useFormData) {
|
|
14620
|
+
requestOptions.formData = formParams;
|
|
14621
|
+
} else {
|
|
14622
|
+
requestOptions.form = formParams;
|
|
14623
|
+
}
|
|
14624
|
+
}
|
|
14625
|
+
return fetchWithRequestOptions(requestOptions);
|
|
14626
|
+
}
|
|
14584
14627
|
/**
|
|
14585
14628
|
* Get a list of all records
|
|
14586
14629
|
*
|
|
@@ -15646,6 +15689,12 @@ var RegistryClient = class {
|
|
|
15646
15689
|
const operation = () => this.recordsApi.getPageTokens(this.tenantId, aspect, limit, this.jwt);
|
|
15647
15690
|
return retry(operation, this.secondsBetweenRetries, this.maxRetries, (e, retriesLeft) => console.log(formatServiceError("Failed to GET records page tokens.", e, retriesLeft))).then((result) => result.body).catch(toServerError("getRecordsPageTokens"));
|
|
15648
15691
|
}
|
|
15692
|
+
async filterRecordsByAccess(records, jwtToken, tenantId) {
|
|
15693
|
+
const resolvedTenantId = tenantId ?? this.tenantId;
|
|
15694
|
+
const resolvedJwt = jwtToken ?? this.jwt;
|
|
15695
|
+
const operation = () => () => this.recordsApi.filterByAccess(records, resolvedTenantId, resolvedJwt);
|
|
15696
|
+
return retry(operation(), this.secondsBetweenRetries, this.maxRetries, (e, retriesLeft) => console.log(formatServiceError("Failed to filter records by access.", e, retriesLeft))).then((result) => result.body).catch(toServerError("filterRecordsByAccess"));
|
|
15697
|
+
}
|
|
15649
15698
|
};
|
|
15650
15699
|
|
|
15651
15700
|
// ../../magda-typescript-common/dist/registry/AuthorizedRegistryClient.js
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@magda/registry-client",
|
|
3
3
|
"description": "MAGDA Registry Client",
|
|
4
|
-
"version": "6.0.0-
|
|
4
|
+
"version": "6.0.0-pr.3665.5",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": "./dist/index.js",
|
|
8
8
|
"./package.json": "./package.json"
|
|
9
9
|
},
|
|
10
10
|
"engines": {
|
|
11
|
-
"node": ">=
|
|
11
|
+
"node": ">=22.0.0"
|
|
12
12
|
},
|
|
13
13
|
"scripts": {
|
|
14
14
|
"prebuild": "rimraf dist tsconfig.tsbuildinfo",
|
|
@@ -16,14 +16,14 @@
|
|
|
16
16
|
"build-main": "node esbuild.js",
|
|
17
17
|
"build-types": "tsc --emitDeclarationOnly",
|
|
18
18
|
"build-types-bundle": "api-extractor run --local",
|
|
19
|
-
"release": "
|
|
19
|
+
"release": "node \"$(git rev-parse --show-toplevel)/ci-scripts/npm-publish-release.js\""
|
|
20
20
|
},
|
|
21
21
|
"author": "",
|
|
22
22
|
"license": "Apache-2.0",
|
|
23
23
|
"main": "dist/index.js",
|
|
24
24
|
"types": "dist/index.d.ts",
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@magda/typescript-common": "^6.0.0-
|
|
26
|
+
"@magda/typescript-common": "^6.0.0-pr.3665.5",
|
|
27
27
|
"@microsoft/api-extractor": "~7.39.0",
|
|
28
28
|
"esbuild": "^0.19.10",
|
|
29
29
|
"ts-loader": "^9.5.1",
|