@magda/connector-sdk 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 +61 -12
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -831,6 +831,17 @@ declare class RecordsApi {
|
|
|
831
831
|
response: Response;
|
|
832
832
|
body: Array<any>;
|
|
833
833
|
}>;
|
|
834
|
+
/**
|
|
835
|
+
* Filter a list of record ids by access
|
|
836
|
+
* Request body is a JSON array of record ids. Returns only readable record ids.
|
|
837
|
+
* @param requestData A JSON array of record ids, e.g. [\"id1\", \"id2\"]
|
|
838
|
+
* @param xMagdaTenantId 0
|
|
839
|
+
* @param xMagdaSession Magda internal session id
|
|
840
|
+
*/
|
|
841
|
+
filterByAccess(requestData: Array<string>, xMagdaTenantId: number, xMagdaSession?: string): Promise<{
|
|
842
|
+
response: Response;
|
|
843
|
+
body: Array<string>;
|
|
844
|
+
}>;
|
|
834
845
|
/**
|
|
835
846
|
* Get a list of all records
|
|
836
847
|
*
|
|
@@ -1048,6 +1059,7 @@ declare class RegistryClient {
|
|
|
1048
1059
|
getRecordInFull(id: string): Promise<Record_2>;
|
|
1049
1060
|
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>;
|
|
1050
1061
|
getRecordsPageTokens(aspect?: Array<string>, limit?: number): Promise<string[] | ServerError>;
|
|
1062
|
+
filterRecordsByAccess(records: string[], jwtToken?: string, tenantId?: number): Promise<string[] | ServerError>;
|
|
1051
1063
|
}
|
|
1052
1064
|
|
|
1053
1065
|
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();
|
|
@@ -40079,9 +40079,9 @@ var require_application = __commonJS({
|
|
|
40079
40079
|
}
|
|
40080
40080
|
});
|
|
40081
40081
|
|
|
40082
|
-
// ../../node_modules/negotiator/lib/charset.js
|
|
40082
|
+
// ../../node_modules/express/node_modules/negotiator/lib/charset.js
|
|
40083
40083
|
var require_charset = __commonJS({
|
|
40084
|
-
"../../node_modules/negotiator/lib/charset.js"(exports, module) {
|
|
40084
|
+
"../../node_modules/express/node_modules/negotiator/lib/charset.js"(exports, module) {
|
|
40085
40085
|
"use strict";
|
|
40086
40086
|
init_cjs_shim();
|
|
40087
40087
|
module.exports = preferredCharsets;
|
|
@@ -40168,9 +40168,9 @@ var require_charset = __commonJS({
|
|
|
40168
40168
|
}
|
|
40169
40169
|
});
|
|
40170
40170
|
|
|
40171
|
-
// ../../node_modules/negotiator/lib/encoding.js
|
|
40171
|
+
// ../../node_modules/express/node_modules/negotiator/lib/encoding.js
|
|
40172
40172
|
var require_encoding2 = __commonJS({
|
|
40173
|
-
"../../node_modules/negotiator/lib/encoding.js"(exports, module) {
|
|
40173
|
+
"../../node_modules/express/node_modules/negotiator/lib/encoding.js"(exports, module) {
|
|
40174
40174
|
"use strict";
|
|
40175
40175
|
init_cjs_shim();
|
|
40176
40176
|
module.exports = preferredEncodings;
|
|
@@ -40268,9 +40268,9 @@ var require_encoding2 = __commonJS({
|
|
|
40268
40268
|
}
|
|
40269
40269
|
});
|
|
40270
40270
|
|
|
40271
|
-
// ../../node_modules/negotiator/lib/language.js
|
|
40271
|
+
// ../../node_modules/express/node_modules/negotiator/lib/language.js
|
|
40272
40272
|
var require_language = __commonJS({
|
|
40273
|
-
"../../node_modules/negotiator/lib/language.js"(exports, module) {
|
|
40273
|
+
"../../node_modules/express/node_modules/negotiator/lib/language.js"(exports, module) {
|
|
40274
40274
|
"use strict";
|
|
40275
40275
|
init_cjs_shim();
|
|
40276
40276
|
module.exports = preferredLanguages;
|
|
@@ -40368,9 +40368,9 @@ var require_language = __commonJS({
|
|
|
40368
40368
|
}
|
|
40369
40369
|
});
|
|
40370
40370
|
|
|
40371
|
-
// ../../node_modules/negotiator/lib/mediaType.js
|
|
40371
|
+
// ../../node_modules/express/node_modules/negotiator/lib/mediaType.js
|
|
40372
40372
|
var require_mediaType = __commonJS({
|
|
40373
|
-
"../../node_modules/negotiator/lib/mediaType.js"(exports, module) {
|
|
40373
|
+
"../../node_modules/express/node_modules/negotiator/lib/mediaType.js"(exports, module) {
|
|
40374
40374
|
"use strict";
|
|
40375
40375
|
init_cjs_shim();
|
|
40376
40376
|
module.exports = preferredMediaTypes;
|
|
@@ -40532,9 +40532,9 @@ var require_mediaType = __commonJS({
|
|
|
40532
40532
|
}
|
|
40533
40533
|
});
|
|
40534
40534
|
|
|
40535
|
-
// ../../node_modules/negotiator/index.js
|
|
40535
|
+
// ../../node_modules/express/node_modules/negotiator/index.js
|
|
40536
40536
|
var require_negotiator = __commonJS({
|
|
40537
|
-
"../../node_modules/negotiator/index.js"(exports, module) {
|
|
40537
|
+
"../../node_modules/express/node_modules/negotiator/index.js"(exports, module) {
|
|
40538
40538
|
"use strict";
|
|
40539
40539
|
init_cjs_shim();
|
|
40540
40540
|
var preferredCharsets = require_charset();
|
|
@@ -57014,6 +57014,49 @@ var RecordsApi = class {
|
|
|
57014
57014
|
}
|
|
57015
57015
|
return fetchWithRequestOptions(requestOptions);
|
|
57016
57016
|
}
|
|
57017
|
+
/**
|
|
57018
|
+
* Filter a list of record ids by access
|
|
57019
|
+
* Request body is a JSON array of record ids. Returns only readable record ids.
|
|
57020
|
+
* @param requestData A JSON array of record ids, e.g. [\"id1\", \"id2\"]
|
|
57021
|
+
* @param xMagdaTenantId 0
|
|
57022
|
+
* @param xMagdaSession Magda internal session id
|
|
57023
|
+
*/
|
|
57024
|
+
filterByAccess(requestData, xMagdaTenantId, xMagdaSession) {
|
|
57025
|
+
const localVarPath = this.basePath + "/records/filterByAccess";
|
|
57026
|
+
let queryParameters = {};
|
|
57027
|
+
let headerParams = Object.assign({}, this.defaultHeaders);
|
|
57028
|
+
let formParams = {};
|
|
57029
|
+
if (requestData === null || requestData === void 0) {
|
|
57030
|
+
throw new Error("Required parameter requestData was null or undefined when calling filterByAccess.");
|
|
57031
|
+
}
|
|
57032
|
+
if (xMagdaTenantId === null || xMagdaTenantId === void 0) {
|
|
57033
|
+
throw new Error("Required parameter xMagdaTenantId was null or undefined when calling filterByAccess.");
|
|
57034
|
+
}
|
|
57035
|
+
if (isNotEmpty(xMagdaTenantId)) {
|
|
57036
|
+
headerParams["X-Magda-Tenant-Id"] = xMagdaTenantId;
|
|
57037
|
+
}
|
|
57038
|
+
if (isNotEmpty(xMagdaSession)) {
|
|
57039
|
+
headerParams["X-Magda-Session"] = xMagdaSession;
|
|
57040
|
+
}
|
|
57041
|
+
let useFormData = false;
|
|
57042
|
+
const requestOptions = {
|
|
57043
|
+
method: "POST",
|
|
57044
|
+
qs: queryParameters,
|
|
57045
|
+
headers: headerParams,
|
|
57046
|
+
uri: localVarPath,
|
|
57047
|
+
json: true,
|
|
57048
|
+
body: requestData
|
|
57049
|
+
};
|
|
57050
|
+
this.authentications.default.applyToRequest(requestOptions);
|
|
57051
|
+
if (Object.keys(formParams).length) {
|
|
57052
|
+
if (useFormData) {
|
|
57053
|
+
requestOptions.formData = formParams;
|
|
57054
|
+
} else {
|
|
57055
|
+
requestOptions.form = formParams;
|
|
57056
|
+
}
|
|
57057
|
+
}
|
|
57058
|
+
return fetchWithRequestOptions(requestOptions);
|
|
57059
|
+
}
|
|
57017
57060
|
/**
|
|
57018
57061
|
* Get a list of all records
|
|
57019
57062
|
*
|
|
@@ -58079,6 +58122,12 @@ var RegistryClient = class {
|
|
|
58079
58122
|
const operation = () => this.recordsApi.getPageTokens(this.tenantId, aspect, limit, this.jwt);
|
|
58080
58123
|
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"));
|
|
58081
58124
|
}
|
|
58125
|
+
async filterRecordsByAccess(records, jwtToken, tenantId) {
|
|
58126
|
+
const resolvedTenantId = tenantId ?? this.tenantId;
|
|
58127
|
+
const resolvedJwt = jwtToken ?? this.jwt;
|
|
58128
|
+
const operation = () => () => this.recordsApi.filterByAccess(records, resolvedTenantId, resolvedJwt);
|
|
58129
|
+
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"));
|
|
58130
|
+
}
|
|
58082
58131
|
};
|
|
58083
58132
|
|
|
58084
58133
|
// ../../magda-typescript-common/dist/session/buildJwt.js
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@magda/connector-sdk",
|
|
3
3
|
"description": "MAGDA Connector SDK",
|
|
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,12 +16,12 @@
|
|
|
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
|
"devDependencies": {
|
|
24
|
-
"@magda/typescript-common": "^6.0.0-
|
|
24
|
+
"@magda/typescript-common": "^6.0.0-pr.3665.5",
|
|
25
25
|
"@microsoft/api-extractor": "~7.39.0",
|
|
26
26
|
"@types/yargs": "^12.0.8",
|
|
27
27
|
"esbuild": "^0.19.10",
|