@magda/connector-sdk 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-web.js +3 -3
- package/dist/index.d.ts +56 -2
- package/dist/index.js +567 -357
- package/package.json +2 -2
package/dist/index-web.js
CHANGED
|
@@ -33242,19 +33242,19 @@ exports.default = createServiceError;
|
|
|
33242
33242
|
/* 201 */
|
|
33243
33243
|
/***/ (function(module) {
|
|
33244
33244
|
|
|
33245
|
-
module.exports = JSON.parse("{\"$schema\":\"http://json-schema.org/hyper-schema#\",\"title\":\"
|
|
33245
|
+
module.exports = JSON.parse("{\"$schema\":\"http://json-schema.org/hyper-schema#\",\"title\":\"Dataset Distributions Aspect\",\"description\":\"Specifies the list of distributions of a dataset.\",\"type\":\"object\",\"properties\":{\"distributions\":{\"title\":\"The distributions of this dataset.\",\"type\":\"array\",\"items\":{\"title\":\"A ID of a distribution of this dataset.\",\"type\":\"string\",\"links\":[{\"href\":\"/api/v0/registry/records/{$}\",\"rel\":\"item\"}]}}}}");
|
|
33246
33246
|
|
|
33247
33247
|
/***/ }),
|
|
33248
33248
|
/* 202 */
|
|
33249
33249
|
/***/ (function(module) {
|
|
33250
33250
|
|
|
33251
|
-
module.exports = JSON.parse("{\"$schema\":\"http://json-schema.org/schema#\",\"title\":\"Aspect for capturing the source of a record\",\"type\":\"object\",\"properties\":{\"id\":{\"title\":\"The id of the source.\",\"type\":\"string\"},\"type\":{\"title\":\"The type of the source.\",\"type\":\"string\"},\"url\":{\"title\":\"The source URL.\",\"type\":\"string\"},\"name\":{\"title\":\"The human-friendly name of this source.\",\"type\":\"string\"},\"originalUrl\":{\"title\":\"The original source URL. Used when the crawling source is not the original source.\",\"type\":\"string\"},\"orignalName\":{\"title\":\"The original human-friendly name of this source. Used when the crawling source is not the original source.\",\"type\":\"string\"},\"extras\":{\"title\":\"Extra Metadata\",\"description\":\"Any extra metadata a connector may have. \\nThis field is auto copied from connector configData.extras.\",\"type\":\"object\"},\"problems\":{\"title\":\"Problems encountered while creating this record from the source.\",\"type\":\"array\",\"items\":{\"title\":\"A problem report.\",\"type\":\"object\",\"properties\":{\"title\":{\"title\":\"A short explanation of the problem.\",\"type\":\"string\"},\"message\":{\"title\":\"A message describing the problem.\",\"type\":\"string\"},\"additionalInfo\":{\"title\":\"Additional information about the problem.\"}}}}}}");
|
|
33251
|
+
module.exports = JSON.parse("{\"$schema\":\"http://json-schema.org/schema#\",\"title\":\"Source Aspect\",\"description\":\"Aspect for capturing the source of a record\",\"type\":\"object\",\"properties\":{\"id\":{\"title\":\"The id of the source.\",\"type\":\"string\"},\"type\":{\"title\":\"The type of the source.\",\"type\":\"string\"},\"url\":{\"title\":\"The source URL.\",\"type\":\"string\"},\"name\":{\"title\":\"The human-friendly name of this source.\",\"type\":\"string\"},\"originalUrl\":{\"title\":\"The original source URL. Used when the crawling source is not the original source.\",\"type\":\"string\"},\"orignalName\":{\"title\":\"The original human-friendly name of this source. Used when the crawling source is not the original source.\",\"type\":\"string\"},\"extras\":{\"title\":\"Extra Metadata\",\"description\":\"Any extra metadata a connector may have. \\nThis field is auto copied from connector configData.extras.\",\"type\":\"object\"},\"problems\":{\"title\":\"Problems encountered while creating this record from the source.\",\"type\":\"array\",\"items\":{\"title\":\"A problem report.\",\"type\":\"object\",\"properties\":{\"title\":{\"title\":\"A short explanation of the problem.\",\"type\":\"string\"},\"message\":{\"title\":\"A message describing the problem.\",\"type\":\"string\"},\"additionalInfo\":{\"title\":\"Additional information about the problem.\"}}}}}}");
|
|
33252
33252
|
|
|
33253
33253
|
/***/ }),
|
|
33254
33254
|
/* 203 */
|
|
33255
33255
|
/***/ (function(module) {
|
|
33256
33256
|
|
|
33257
|
-
module.exports = JSON.parse("{\"$schema\":\"http://json-schema.org/hyper-schema#\",\"title\":\"Dataset
|
|
33257
|
+
module.exports = JSON.parse("{\"$schema\":\"http://json-schema.org/hyper-schema#\",\"title\":\"Dataset Publisher Aspect\",\"description\":\"Links to the publisher of a dataset.\",\"type\":\"object\",\"properties\":{\"publisher\":{\"title\":\"The ID of the record representing the organization that published this dataset.\",\"type\":\"string\",\"links\":[{\"href\":\"/api/v0/registry/records/{$}\",\"rel\":\"item\"}]}}}");
|
|
33258
33258
|
|
|
33259
33259
|
/***/ }),
|
|
33260
33260
|
/* 204 */
|
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
|
export declare interface AspectBuilder {
|
|
@@ -55,8 +56,9 @@ declare class AspectDefinitionsApi {
|
|
|
55
56
|
* Get a list of all aspects
|
|
56
57
|
*
|
|
57
58
|
* @param xMagdaTenantId 0
|
|
59
|
+
* @param xMagdaSession Magda internal session id
|
|
58
60
|
*/
|
|
59
|
-
getAll(xMagdaTenantId: number): Promise<{
|
|
61
|
+
getAll(xMagdaTenantId: number, xMagdaSession?: string): Promise<{
|
|
60
62
|
response: http.IncomingMessage;
|
|
61
63
|
body: Array<AspectDefinition>;
|
|
62
64
|
}>;
|
|
@@ -65,8 +67,9 @@ declare class AspectDefinitionsApi {
|
|
|
65
67
|
*
|
|
66
68
|
* @param xMagdaTenantId 0
|
|
67
69
|
* @param id ID of the aspect to be fetched.
|
|
70
|
+
* @param xMagdaSession Magda internal session id
|
|
68
71
|
*/
|
|
69
|
-
getById(xMagdaTenantId: number, id: string): Promise<{
|
|
72
|
+
getById(xMagdaTenantId: number, id: string, xMagdaSession?: string): Promise<{
|
|
70
73
|
response: http.IncomingMessage;
|
|
71
74
|
body: AspectDefinition;
|
|
72
75
|
}>;
|
|
@@ -116,6 +119,7 @@ declare class AsyncPage<T> {
|
|
|
116
119
|
export declare class AuthorizedRegistryClient extends RegistryClient {
|
|
117
120
|
protected jwt: string;
|
|
118
121
|
constructor(options: AuthorizedRegistryOptions);
|
|
122
|
+
getAspectDefinition(aspectId: string): Promise<AspectDefinition>;
|
|
119
123
|
putAspectDefinition(aspectDefinition: AspectDefinition, tenantId?: number): Promise<AspectDefinition | Error>;
|
|
120
124
|
postHook(hook: WebHook): Promise<WebHook | Error>;
|
|
121
125
|
putHook(hook: WebHook): Promise<WebHook | Error>;
|
|
@@ -644,6 +648,33 @@ declare class RecordAspectsApi {
|
|
|
644
648
|
response: http.IncomingMessage;
|
|
645
649
|
body: DeleteResult;
|
|
646
650
|
}>;
|
|
651
|
+
/**
|
|
652
|
+
* Get a list of a record's aspects
|
|
653
|
+
*
|
|
654
|
+
* @param xMagdaTenantId 0
|
|
655
|
+
* @param recordId ID of the record for which to fetch aspects.
|
|
656
|
+
* @param keyword Specify the keyword to search in the all aspects' aspectId & data fields.
|
|
657
|
+
* @param aspectIdOnly When set to true, will respond only an array contains aspect id only.
|
|
658
|
+
* @param start The index of the first record to retrieve.
|
|
659
|
+
* @param limit The maximum number of records to receive.
|
|
660
|
+
* @param xMagdaSession Magda internal session id
|
|
661
|
+
*/
|
|
662
|
+
getAspects(xMagdaTenantId: number, recordId: string, keyword?: string, aspectIdOnly?: boolean, start?: number, limit?: number, xMagdaSession?: string): Promise<{
|
|
663
|
+
response: http.IncomingMessage;
|
|
664
|
+
body: Array<any>;
|
|
665
|
+
}>;
|
|
666
|
+
/**
|
|
667
|
+
* Get the number of aspects that a record has
|
|
668
|
+
*
|
|
669
|
+
* @param xMagdaTenantId 0
|
|
670
|
+
* @param recordId ID of the record for which to fetch an aspect.
|
|
671
|
+
* @param keyword Specify the keyword to search in the all aspects' aspectId & data fields.
|
|
672
|
+
* @param xMagdaSession Magda internal session id
|
|
673
|
+
*/
|
|
674
|
+
getAspectsCount(xMagdaTenantId: number, recordId: string, keyword?: string, xMagdaSession?: string): Promise<{
|
|
675
|
+
response: http.IncomingMessage;
|
|
676
|
+
body: CountResponse;
|
|
677
|
+
}>;
|
|
647
678
|
/**
|
|
648
679
|
* Get a record aspect by ID
|
|
649
680
|
*
|
|
@@ -932,8 +963,16 @@ declare class RegistryClient {
|
|
|
932
963
|
protected tenantId: number;
|
|
933
964
|
protected jwt: string | undefined;
|
|
934
965
|
constructor({ baseUrl, maxRetries, secondsBetweenRetries, tenantId }: RegistryOptions);
|
|
966
|
+
toServerError(error: {
|
|
967
|
+
body: any;
|
|
968
|
+
response: Response_2;
|
|
969
|
+
}): ServerError | {
|
|
970
|
+
body: any;
|
|
971
|
+
response: Response_2;
|
|
972
|
+
};
|
|
935
973
|
getRecordUrl(id: string): string;
|
|
936
974
|
getAspectDefinitions(): Promise<AspectDefinition[] | Error>;
|
|
975
|
+
getAspectDefinition(aspectId: string, jwtToken?: string): Promise<AspectDefinition>;
|
|
937
976
|
getRecord(id: string, aspect?: Array<string>, optionalAspect?: Array<string>, dereference?: boolean): Promise<Record_2 | Error>;
|
|
938
977
|
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>;
|
|
939
978
|
getRecordsPageTokens(aspect?: Array<string>, limit?: number): Promise<string[] | Error>;
|
|
@@ -959,6 +998,16 @@ declare interface ReportProblem {
|
|
|
959
998
|
(title: string, message?: string, additionalInfo?: any): void;
|
|
960
999
|
}
|
|
961
1000
|
|
|
1001
|
+
declare class ServerError extends Error {
|
|
1002
|
+
statusCode: number;
|
|
1003
|
+
constructor(message?: string, statusCode?: number);
|
|
1004
|
+
toData(): {
|
|
1005
|
+
isError: boolean;
|
|
1006
|
+
errorCode: number;
|
|
1007
|
+
errorMessage: string;
|
|
1008
|
+
};
|
|
1009
|
+
}
|
|
1010
|
+
|
|
962
1011
|
export declare const TenantConsts: any;
|
|
963
1012
|
|
|
964
1013
|
declare class WebHook {
|
|
@@ -975,6 +1024,11 @@ declare class WebHook {
|
|
|
975
1024
|
'retryCount': number;
|
|
976
1025
|
'isRunning': any;
|
|
977
1026
|
'isProcessing': any;
|
|
1027
|
+
'ownerId': string;
|
|
1028
|
+
'creatorId': string;
|
|
1029
|
+
'editorId': string;
|
|
1030
|
+
'createTime': Date;
|
|
1031
|
+
'editTime': Date;
|
|
978
1032
|
}
|
|
979
1033
|
|
|
980
1034
|
/**
|