@magda/minion-sdk 6.0.0-alpha.9 → 6.0.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 +12 -0
- package/dist/index.js +61 -12
- package/package.json +5 -5
package/dist/index.d.ts
CHANGED
|
@@ -486,6 +486,17 @@ declare class RecordsApi {
|
|
|
486
486
|
response: Response;
|
|
487
487
|
body: Array<any>;
|
|
488
488
|
}>;
|
|
489
|
+
/**
|
|
490
|
+
* Filter a list of record ids by access
|
|
491
|
+
* Request body is a JSON array of record ids. Returns only readable record ids.
|
|
492
|
+
* @param requestData A JSON array of record ids, e.g. [\"id1\", \"id2\"]
|
|
493
|
+
* @param xMagdaTenantId 0
|
|
494
|
+
* @param xMagdaSession Magda internal session id
|
|
495
|
+
*/
|
|
496
|
+
filterByAccess(requestData: Array<string>, xMagdaTenantId: number, xMagdaSession?: string): Promise<{
|
|
497
|
+
response: Response;
|
|
498
|
+
body: Array<string>;
|
|
499
|
+
}>;
|
|
489
500
|
/**
|
|
490
501
|
* Get a list of all records
|
|
491
502
|
*
|
|
@@ -701,6 +712,7 @@ declare class RegistryClient {
|
|
|
701
712
|
getRecordInFull(id: string): Promise<Record_2>;
|
|
702
713
|
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>;
|
|
703
714
|
getRecordsPageTokens(aspect?: Array<string>, limit?: number): Promise<string[] | ServerError>;
|
|
715
|
+
filterRecordsByAccess(records: string[], jwtToken?: string, tenantId?: number): Promise<string[] | ServerError>;
|
|
704
716
|
}
|
|
705
717
|
|
|
706
718
|
declare class RegistryEvent {
|
package/dist/index.js
CHANGED
|
@@ -22657,9 +22657,9 @@ var require_application = __commonJS({
|
|
|
22657
22657
|
}
|
|
22658
22658
|
});
|
|
22659
22659
|
|
|
22660
|
-
// ../../node_modules/negotiator/lib/charset.js
|
|
22660
|
+
// ../../node_modules/express/node_modules/negotiator/lib/charset.js
|
|
22661
22661
|
var require_charset = __commonJS({
|
|
22662
|
-
"../../node_modules/negotiator/lib/charset.js"(exports, module) {
|
|
22662
|
+
"../../node_modules/express/node_modules/negotiator/lib/charset.js"(exports, module) {
|
|
22663
22663
|
"use strict";
|
|
22664
22664
|
init_cjs_shim();
|
|
22665
22665
|
module.exports = preferredCharsets;
|
|
@@ -22746,9 +22746,9 @@ var require_charset = __commonJS({
|
|
|
22746
22746
|
}
|
|
22747
22747
|
});
|
|
22748
22748
|
|
|
22749
|
-
// ../../node_modules/negotiator/lib/encoding.js
|
|
22749
|
+
// ../../node_modules/express/node_modules/negotiator/lib/encoding.js
|
|
22750
22750
|
var require_encoding = __commonJS({
|
|
22751
|
-
"../../node_modules/negotiator/lib/encoding.js"(exports, module) {
|
|
22751
|
+
"../../node_modules/express/node_modules/negotiator/lib/encoding.js"(exports, module) {
|
|
22752
22752
|
"use strict";
|
|
22753
22753
|
init_cjs_shim();
|
|
22754
22754
|
module.exports = preferredEncodings;
|
|
@@ -22846,9 +22846,9 @@ var require_encoding = __commonJS({
|
|
|
22846
22846
|
}
|
|
22847
22847
|
});
|
|
22848
22848
|
|
|
22849
|
-
// ../../node_modules/negotiator/lib/language.js
|
|
22849
|
+
// ../../node_modules/express/node_modules/negotiator/lib/language.js
|
|
22850
22850
|
var require_language = __commonJS({
|
|
22851
|
-
"../../node_modules/negotiator/lib/language.js"(exports, module) {
|
|
22851
|
+
"../../node_modules/express/node_modules/negotiator/lib/language.js"(exports, module) {
|
|
22852
22852
|
"use strict";
|
|
22853
22853
|
init_cjs_shim();
|
|
22854
22854
|
module.exports = preferredLanguages;
|
|
@@ -22946,9 +22946,9 @@ var require_language = __commonJS({
|
|
|
22946
22946
|
}
|
|
22947
22947
|
});
|
|
22948
22948
|
|
|
22949
|
-
// ../../node_modules/negotiator/lib/mediaType.js
|
|
22949
|
+
// ../../node_modules/express/node_modules/negotiator/lib/mediaType.js
|
|
22950
22950
|
var require_mediaType = __commonJS({
|
|
22951
|
-
"../../node_modules/negotiator/lib/mediaType.js"(exports, module) {
|
|
22951
|
+
"../../node_modules/express/node_modules/negotiator/lib/mediaType.js"(exports, module) {
|
|
22952
22952
|
"use strict";
|
|
22953
22953
|
init_cjs_shim();
|
|
22954
22954
|
module.exports = preferredMediaTypes;
|
|
@@ -23110,9 +23110,9 @@ var require_mediaType = __commonJS({
|
|
|
23110
23110
|
}
|
|
23111
23111
|
});
|
|
23112
23112
|
|
|
23113
|
-
// ../../node_modules/negotiator/index.js
|
|
23113
|
+
// ../../node_modules/express/node_modules/negotiator/index.js
|
|
23114
23114
|
var require_negotiator = __commonJS({
|
|
23115
|
-
"../../node_modules/negotiator/index.js"(exports, module) {
|
|
23115
|
+
"../../node_modules/express/node_modules/negotiator/index.js"(exports, module) {
|
|
23116
23116
|
"use strict";
|
|
23117
23117
|
init_cjs_shim();
|
|
23118
23118
|
var preferredCharsets = require_charset();
|
|
@@ -40707,9 +40707,9 @@ var require_yallist = __commonJS({
|
|
|
40707
40707
|
}
|
|
40708
40708
|
});
|
|
40709
40709
|
|
|
40710
|
-
// ../../node_modules/lru-cache/index.js
|
|
40710
|
+
// ../../magda-typescript-common/node_modules/lru-cache/index.js
|
|
40711
40711
|
var require_lru_cache = __commonJS({
|
|
40712
|
-
"../../node_modules/lru-cache/index.js"(exports, module) {
|
|
40712
|
+
"../../magda-typescript-common/node_modules/lru-cache/index.js"(exports, module) {
|
|
40713
40713
|
"use strict";
|
|
40714
40714
|
init_cjs_shim();
|
|
40715
40715
|
var Yallist = require_yallist();
|
|
@@ -58597,6 +58597,49 @@ var RecordsApi = class {
|
|
|
58597
58597
|
}
|
|
58598
58598
|
return fetchWithRequestOptions(requestOptions);
|
|
58599
58599
|
}
|
|
58600
|
+
/**
|
|
58601
|
+
* Filter a list of record ids by access
|
|
58602
|
+
* Request body is a JSON array of record ids. Returns only readable record ids.
|
|
58603
|
+
* @param requestData A JSON array of record ids, e.g. [\"id1\", \"id2\"]
|
|
58604
|
+
* @param xMagdaTenantId 0
|
|
58605
|
+
* @param xMagdaSession Magda internal session id
|
|
58606
|
+
*/
|
|
58607
|
+
filterByAccess(requestData, xMagdaTenantId, xMagdaSession) {
|
|
58608
|
+
const localVarPath = this.basePath + "/records/filterByAccess";
|
|
58609
|
+
let queryParameters = {};
|
|
58610
|
+
let headerParams = Object.assign({}, this.defaultHeaders);
|
|
58611
|
+
let formParams = {};
|
|
58612
|
+
if (requestData === null || requestData === void 0) {
|
|
58613
|
+
throw new Error("Required parameter requestData was null or undefined when calling filterByAccess.");
|
|
58614
|
+
}
|
|
58615
|
+
if (xMagdaTenantId === null || xMagdaTenantId === void 0) {
|
|
58616
|
+
throw new Error("Required parameter xMagdaTenantId was null or undefined when calling filterByAccess.");
|
|
58617
|
+
}
|
|
58618
|
+
if (isNotEmpty(xMagdaTenantId)) {
|
|
58619
|
+
headerParams["X-Magda-Tenant-Id"] = xMagdaTenantId;
|
|
58620
|
+
}
|
|
58621
|
+
if (isNotEmpty(xMagdaSession)) {
|
|
58622
|
+
headerParams["X-Magda-Session"] = xMagdaSession;
|
|
58623
|
+
}
|
|
58624
|
+
let useFormData = false;
|
|
58625
|
+
const requestOptions = {
|
|
58626
|
+
method: "POST",
|
|
58627
|
+
qs: queryParameters,
|
|
58628
|
+
headers: headerParams,
|
|
58629
|
+
uri: localVarPath,
|
|
58630
|
+
json: true,
|
|
58631
|
+
body: requestData
|
|
58632
|
+
};
|
|
58633
|
+
this.authentications.default.applyToRequest(requestOptions);
|
|
58634
|
+
if (Object.keys(formParams).length) {
|
|
58635
|
+
if (useFormData) {
|
|
58636
|
+
requestOptions.formData = formParams;
|
|
58637
|
+
} else {
|
|
58638
|
+
requestOptions.form = formParams;
|
|
58639
|
+
}
|
|
58640
|
+
}
|
|
58641
|
+
return fetchWithRequestOptions(requestOptions);
|
|
58642
|
+
}
|
|
58600
58643
|
/**
|
|
58601
58644
|
* Get a list of all records
|
|
58602
58645
|
*
|
|
@@ -59662,6 +59705,12 @@ var RegistryClient = class {
|
|
|
59662
59705
|
const operation = () => this.recordsApi.getPageTokens(this.tenantId, aspect, limit, this.jwt);
|
|
59663
59706
|
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"));
|
|
59664
59707
|
}
|
|
59708
|
+
async filterRecordsByAccess(records, jwtToken, tenantId) {
|
|
59709
|
+
const resolvedTenantId = tenantId ?? this.tenantId;
|
|
59710
|
+
const resolvedJwt = jwtToken ?? this.jwt;
|
|
59711
|
+
const operation = () => () => this.recordsApi.filterByAccess(records, resolvedTenantId, resolvedJwt);
|
|
59712
|
+
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"));
|
|
59713
|
+
}
|
|
59665
59714
|
};
|
|
59666
59715
|
|
|
59667
59716
|
// ../../magda-typescript-common/dist/session/buildJwt.js
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@magda/minion-sdk",
|
|
3
3
|
"description": "MAGDA Minion SDK",
|
|
4
|
-
"version": "6.0.0
|
|
4
|
+
"version": "6.0.0",
|
|
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,15 +16,15 @@
|
|
|
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/minion-framework": "^6.0.0
|
|
27
|
-
"@magda/typescript-common": "^6.0.0
|
|
26
|
+
"@magda/minion-framework": "^6.0.0",
|
|
27
|
+
"@magda/typescript-common": "^6.0.0",
|
|
28
28
|
"@microsoft/api-extractor": "~7.39.0",
|
|
29
29
|
"esbuild": "^0.19.10",
|
|
30
30
|
"ts-loader": "^9.5.1",
|