@magda/connector-sdk 1.3.0-rc.0 → 2.0.0-alpha.2

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.
@@ -164,10 +164,6 @@ declare class Record_2 {
164
164
  */
165
165
  'aspects': any;
166
166
  /**
167
- * The read authorization policy id of a record
168
- */
169
- 'authnReadPolicyId': string;
170
- /**
171
167
  * A tag representing the action by the source of this record (e.g. an id for a individual crawl of a data portal).
172
168
  */
173
169
  'sourceTag': string;
package/dist/index-web.js CHANGED
@@ -33086,8 +33086,7 @@ class JsonTransformer {
33086
33086
  name: name,
33087
33087
  aspects: generatedAspects,
33088
33088
  sourceTag: undefined,
33089
- tenantId: this.tenantId,
33090
- authnReadPolicyId: undefined
33089
+ tenantId: this.tenantId
33091
33090
  };
33092
33091
  }
33093
33092
  }
@@ -33242,19 +33241,19 @@ exports.default = createServiceError;
33242
33241
  /* 201 */
33243
33242
  /***/ (function(module) {
33244
33243
 
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\"}]}}}}");
33244
+ 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
33245
 
33247
33246
  /***/ }),
33248
33247
  /* 202 */
33249
33248
  /***/ (function(module) {
33250
33249
 
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.\"}}}}}}");
33250
+ 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
33251
 
33253
33252
  /***/ }),
33254
33253
  /* 203 */
33255
33254
  /***/ (function(module) {
33256
33255
 
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\"}]}}}");
33256
+ 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
33257
 
33259
33258
  /***/ }),
33260
33259
  /* 204 */
package/dist/index.d.ts CHANGED
@@ -55,8 +55,9 @@ declare class AspectDefinitionsApi {
55
55
  * Get a list of all aspects
56
56
  *
57
57
  * @param xMagdaTenantId 0
58
+ * @param xMagdaSession Magda internal session id
58
59
  */
59
- getAll(xMagdaTenantId: number): Promise<{
60
+ getAll(xMagdaTenantId: number, xMagdaSession?: string): Promise<{
60
61
  response: http.IncomingMessage;
61
62
  body: Array<AspectDefinition>;
62
63
  }>;
@@ -65,8 +66,9 @@ declare class AspectDefinitionsApi {
65
66
  *
66
67
  * @param xMagdaTenantId 0
67
68
  * @param id ID of the aspect to be fetched.
69
+ * @param xMagdaSession Magda internal session id
68
70
  */
69
- getById(xMagdaTenantId: number, id: string): Promise<{
71
+ getById(xMagdaTenantId: number, id: string, xMagdaSession?: string): Promise<{
70
72
  response: http.IncomingMessage;
71
73
  body: AspectDefinition;
72
74
  }>;
@@ -116,6 +118,7 @@ declare class AsyncPage<T> {
116
118
  export declare class AuthorizedRegistryClient extends RegistryClient {
117
119
  protected jwt: string;
118
120
  constructor(options: AuthorizedRegistryOptions);
121
+ getAspectDefinition(aspectId: string): Promise<AspectDefinition>;
119
122
  putAspectDefinition(aspectDefinition: AspectDefinition, tenantId?: number): Promise<AspectDefinition | Error>;
120
123
  postHook(hook: WebHook): Promise<WebHook | Error>;
121
124
  putHook(hook: WebHook): Promise<WebHook | Error>;
@@ -123,24 +126,18 @@ export declare class AuthorizedRegistryClient extends RegistryClient {
123
126
  getHooks(): Promise<WebHook[] | Error>;
124
127
  resumeHook(webhookId: string, succeeded?: boolean, lastEventIdReceived?: string, active?: boolean): Promise<WebHookAcknowledgementResponse | Error>;
125
128
  putRecord(record: Record_2, tenantId?: number): Promise<Record_2 | Error>;
129
+ patchRecord(recordId: string, recordPatch: Operation[], tenantId?: number): Promise<Record_2 | Error>;
126
130
  putRecordAspect(recordId: string, aspectId: string, aspect: any, tenantId?: number): Promise<Record_2 | Error>;
131
+ deleteRecordAspect(recordId: string, aspectId: string, tenantId?: number): Promise<DeleteResult | Error>;
127
132
  patchRecordAspect(recordId: string, aspectId: string, aspectPatch: Operation[], tenantId?: number): Promise<Record_2 | Error>;
128
133
  deleteBySource(sourceTagToPreserve: string, sourceId: string, tenantId?: number): Promise<MultipleDeleteResult | "Processing" | Error>;
129
134
  getRecordHistory(id: string, pageToken?: string, start?: number, limit?: number): Promise<EventsPage | Error>;
130
135
  }
131
136
 
132
- declare interface AuthorizedRegistryJwtOptions extends RegistryOptions {
133
- jwt: string;
134
- userId?: never;
135
- jwtSecret?: never;
136
- }
137
-
138
- export declare type AuthorizedRegistryOptions = AuthorizedRegistryUserIdAndJwtSecretOptions | AuthorizedRegistryJwtOptions;
139
-
140
- declare interface AuthorizedRegistryUserIdAndJwtSecretOptions extends RegistryOptions {
141
- userId: string;
142
- jwtSecret: string;
143
- jwt?: never;
137
+ export declare interface AuthorizedRegistryOptions extends RegistryOptions {
138
+ jwt?: string;
139
+ userId?: string;
140
+ jwtSecret?: string;
144
141
  }
145
142
 
146
143
  export declare abstract class BuilderFunctionParameters {
@@ -610,10 +607,6 @@ declare class Record_2 {
610
607
  */
611
608
  'aspects': any;
612
609
  /**
613
- * The read authorization policy id of a record
614
- */
615
- 'authnReadPolicyId': string;
616
- /**
617
610
  * A tag representing the action by the source of this record (e.g. an id for a individual crawl of a data portal).
618
611
  */
619
612
  'sourceTag': string;
@@ -644,6 +637,33 @@ declare class RecordAspectsApi {
644
637
  response: http.IncomingMessage;
645
638
  body: DeleteResult;
646
639
  }>;
640
+ /**
641
+ * Get a list of a record&#39;s aspects
642
+ *
643
+ * @param xMagdaTenantId 0
644
+ * @param recordId ID of the record for which to fetch aspects.
645
+ * @param keyword Specify the keyword to search in the all aspects&#39; aspectId &amp; data fields.
646
+ * @param aspectIdOnly When set to true, will respond only an array contains aspect id only.
647
+ * @param start The index of the first record to retrieve.
648
+ * @param limit The maximum number of records to receive.
649
+ * @param xMagdaSession Magda internal session id
650
+ */
651
+ getAspects(xMagdaTenantId: number, recordId: string, keyword?: string, aspectIdOnly?: boolean, start?: number, limit?: number, xMagdaSession?: string): Promise<{
652
+ response: http.IncomingMessage;
653
+ body: Array<any>;
654
+ }>;
655
+ /**
656
+ * Get the number of aspects that a record has
657
+ *
658
+ * @param xMagdaTenantId 0
659
+ * @param recordId ID of the record for which to fetch an aspect.
660
+ * @param keyword Specify the keyword to search in the all aspects&#39; aspectId &amp; data fields.
661
+ * @param xMagdaSession Magda internal session id
662
+ */
663
+ getAspectsCount(xMagdaTenantId: number, recordId: string, keyword?: string, xMagdaSession?: string): Promise<{
664
+ response: http.IncomingMessage;
665
+ body: CountResponse;
666
+ }>;
647
667
  /**
648
668
  * Get a record aspect by ID
649
669
  *
@@ -812,6 +832,17 @@ declare class RecordsApi {
812
832
  response: http.IncomingMessage;
813
833
  body: Record_2;
814
834
  }>;
835
+ /**
836
+ * Get a record in full by ID
837
+ * Get a record with all attached aspects data by the record ID.
838
+ * @param id ID of the record to be fetched.
839
+ * @param xMagdaTenantId 0
840
+ * @param xMagdaSession Magda internal session id
841
+ */
842
+ getByIdInFull(id: string, xMagdaTenantId: number, xMagdaSession?: string): Promise<{
843
+ response: http.IncomingMessage;
844
+ body: Record_2;
845
+ }>;
815
846
  /**
816
847
  * Get a summary record by ID
817
848
  * Gets a summary record, including all the aspect ids for which this record has data.
@@ -858,7 +889,7 @@ declare class RecordsApi {
858
889
  */
859
890
  patchById(xMagdaTenantId: number, id: string, recordPatch: Array<Operation>, xMagdaSession: string): Promise<{
860
891
  response: http.IncomingMessage;
861
- body: AspectDefinition;
892
+ body: Record_2;
862
893
  }>;
863
894
  /**
864
895
  * Modify a record by ID
@@ -934,7 +965,9 @@ declare class RegistryClient {
934
965
  constructor({ baseUrl, maxRetries, secondsBetweenRetries, tenantId }: RegistryOptions);
935
966
  getRecordUrl(id: string): string;
936
967
  getAspectDefinitions(): Promise<AspectDefinition[] | Error>;
968
+ getAspectDefinition(aspectId: string, jwtToken?: string): Promise<AspectDefinition>;
937
969
  getRecord(id: string, aspect?: Array<string>, optionalAspect?: Array<string>, dereference?: boolean): Promise<Record_2 | Error>;
970
+ getRecordInFull(id: string): Promise<Record_2>;
938
971
  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
972
  getRecordsPageTokens(aspect?: Array<string>, limit?: number): Promise<string[] | Error>;
940
973
  }
@@ -975,6 +1008,11 @@ declare class WebHook {
975
1008
  'retryCount': number;
976
1009
  'isRunning': any;
977
1010
  'isProcessing': any;
1011
+ 'ownerId': string;
1012
+ 'creatorId': string;
1013
+ 'editorId': string;
1014
+ 'createTime': Date;
1015
+ 'editTime': Date;
978
1016
  }
979
1017
 
980
1018
  /**