@magda/connector-sdk 1.2.1 → 2.0.0-alpha.1

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 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\":\"The distributions of a dataset\",\"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\"}]}}}}");
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 publisher\",\"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\"}]}}}");
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&#39;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&#39; aspectId &amp; 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&#39; aspectId &amp; 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
  *
@@ -812,6 +843,17 @@ declare class RecordsApi {
812
843
  response: http.IncomingMessage;
813
844
  body: Record_2;
814
845
  }>;
846
+ /**
847
+ * Get a record in full by ID
848
+ * Get a record with all attached aspects data by the record ID.
849
+ * @param id ID of the record to be fetched.
850
+ * @param xMagdaTenantId 0
851
+ * @param xMagdaSession Magda internal session id
852
+ */
853
+ getByIdInFull(id: string, xMagdaTenantId: number, xMagdaSession?: string): Promise<{
854
+ response: http.IncomingMessage;
855
+ body: Record_2;
856
+ }>;
815
857
  /**
816
858
  * Get a summary record by ID
817
859
  * Gets a summary record, including all the aspect ids for which this record has data.
@@ -932,9 +974,18 @@ declare class RegistryClient {
932
974
  protected tenantId: number;
933
975
  protected jwt: string | undefined;
934
976
  constructor({ baseUrl, maxRetries, secondsBetweenRetries, tenantId }: RegistryOptions);
977
+ toServerError(error: {
978
+ body: any;
979
+ response: Response_2;
980
+ }): ServerError | {
981
+ body: any;
982
+ response: Response_2;
983
+ };
935
984
  getRecordUrl(id: string): string;
936
985
  getAspectDefinitions(): Promise<AspectDefinition[] | Error>;
986
+ getAspectDefinition(aspectId: string, jwtToken?: string): Promise<AspectDefinition>;
937
987
  getRecord(id: string, aspect?: Array<string>, optionalAspect?: Array<string>, dereference?: boolean): Promise<Record_2 | Error>;
988
+ getRecordInFull(id: string): Promise<Record_2>;
938
989
  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
990
  getRecordsPageTokens(aspect?: Array<string>, limit?: number): Promise<string[] | Error>;
940
991
  }
@@ -959,6 +1010,16 @@ declare interface ReportProblem {
959
1010
  (title: string, message?: string, additionalInfo?: any): void;
960
1011
  }
961
1012
 
1013
+ declare class ServerError extends Error {
1014
+ statusCode: number;
1015
+ constructor(message?: string, statusCode?: number);
1016
+ toData(): {
1017
+ isError: boolean;
1018
+ errorCode: number;
1019
+ errorMessage: string;
1020
+ };
1021
+ }
1022
+
962
1023
  export declare const TenantConsts: any;
963
1024
 
964
1025
  declare class WebHook {
@@ -975,6 +1036,11 @@ declare class WebHook {
975
1036
  'retryCount': number;
976
1037
  'isRunning': any;
977
1038
  'isProcessing': any;
1039
+ 'ownerId': string;
1040
+ 'creatorId': string;
1041
+ 'editorId': string;
1042
+ 'createTime': Date;
1043
+ 'editTime': Date;
978
1044
  }
979
1045
 
980
1046
  /**