@magda/minion-sdk 2.0.0-alpha.5 → 2.0.0-alpha.8

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 CHANGED
@@ -122,13 +122,13 @@ export declare interface AuthorizedRegistryOptions extends RegistryOptions {
122
122
  }
123
123
 
124
124
  /**
125
- * Builds an argv object that will accept command line arguments used by all common argv minions.
126
- *
127
- * @param id
128
- * @param defaultPort
129
- * @param defaultInternalUrl
130
- * @param additions
131
- */
125
+ * Builds an argv object that will accept command line arguments used by all common argv minions.
126
+ *
127
+ * @param id
128
+ * @param defaultPort
129
+ * @param defaultInternalUrl
130
+ * @param additions
131
+ */
132
132
  export declare function commonYargs<T extends MinionArguments = MinionArguments>(defaultPort: number, defaultInternalUrl: string, additions?: (a: yargs.Argv<MinionArguments>) => yargs.Argv<T>): T;
133
133
 
134
134
  declare class CountResponse {
@@ -245,7 +245,8 @@ export declare type MinionArguments = {
245
245
  registryUrl: string;
246
246
  enableMultiTenant: boolean;
247
247
  tenantUrl: string;
248
- retries: string | number;};
248
+ retries: string | number;
249
+ crawlerRecordFetchNumber?: string | number;};
249
250
 
250
251
  export declare interface MinionOptions {
251
252
  argv: MinionArguments;
@@ -428,8 +429,9 @@ declare class RecordHistoryApi {
428
429
  * @param limit The maximum number of events to receive. The response will include a token that can be passed as the pageToken parameter to a future request to continue receiving results where this query leaves off.
429
430
  * @param aspect The aspects for which to included in event history, specified as multiple occurrences of this query parameter.
430
431
  * @param dereference true to automatically dereference links to other records; false to leave them as links. Dereferencing a link means including the record itself where the link would be. Dereferencing only happens one level deep, regardless of the value of this parameter.
432
+ * @param reversePageTokenOrder When pagination via pageToken, by default, records with smaller pageToken (i.e. older records) will be returned first. When this parameter is set to &#x60;true&#x60;, higher pageToken records (newer records) will be returned.
431
433
  */
432
- history(xMagdaTenantId: number, recordId: string, xMagdaSession: string, pageToken?: string, start?: number, limit?: number, aspect?: Array<string>, dereference?: boolean): Promise<{
434
+ history(xMagdaTenantId: number, recordId: string, xMagdaSession: string, pageToken?: string, start?: number, limit?: number, aspect?: Array<string>, dereference?: boolean, reversePageTokenOrder?: boolean): Promise<{
433
435
  response: http.IncomingMessage;
434
436
  body: EventsPage;
435
437
  }>;
@@ -506,9 +508,10 @@ declare class RecordsApi {
506
508
  * @param orderBy Specify the field to sort the result. Aspect field can be supported in a format like aspectId.path.to.field
507
509
  * @param orderByDir Specify the order by direction. Either &#x60;asc&#x60; or &#x60;desc&#x60;
508
510
  * @param orderNullFirst Specify whether nulls appear before (&#x60;true&#x60;) or after (&#x60;false&#x60;) non-null values in the sort ordering.
511
+ * @param reversePageTokenOrder When pagination via pageToken, by default, records with smaller pageToken (i.e. older records) will be returned first. When this parameter is set to &#x60;true&#x60;, higher pageToken records (newer records) will be returned.
509
512
  * @param xMagdaSession Magda internal session id
510
513
  */
511
- getAll(xMagdaTenantId: number, aspect?: Array<string>, optionalAspect?: Array<string>, pageToken?: string, start?: number, limit?: number, dereference?: boolean, aspectQuery?: Array<string>, aspectOrQuery?: Array<string>, orderBy?: string, orderByDir?: string, orderNullFirst?: boolean, xMagdaSession?: string): Promise<{
514
+ getAll(xMagdaTenantId: number, aspect?: Array<string>, optionalAspect?: Array<string>, pageToken?: string, start?: number, limit?: number, dereference?: boolean, aspectQuery?: Array<string>, aspectOrQuery?: Array<string>, orderBy?: string, orderByDir?: string, orderNullFirst?: boolean, reversePageTokenOrder?: boolean, xMagdaSession?: string): Promise<{
512
515
  response: http.IncomingMessage;
513
516
  body: Array<Record_2>;
514
517
  }>;
@@ -519,9 +522,10 @@ declare class RecordsApi {
519
522
  * @param pageToken A token that identifies the start of a page of results. This token should not be interpreted as having any meaning, but it can be obtained from a previous page of results.
520
523
  * @param start The index of the first record to retrieve. When possible, specify pageToken instead as it will result in better performance. If this parameter and pageToken are both specified, this parameter is interpreted as the index after the pageToken of the first record to retrieve.
521
524
  * @param limit The maximum number of records to receive. The response will include a token that can be passed as the pageToken parameter to a future request to continue receiving results where this query leaves off.
525
+ * @param reversePageTokenOrder When pagination via pageToken, by default, records with smaller pageToken (i.e. older records) will be returned first. When this parameter is set to &#x60;true&#x60;, higher pageToken records (newer records) will be returned.
522
526
  * @param xMagdaSession Magda internal session id
523
527
  */
524
- getAllSummary(xMagdaTenantId: number, pageToken?: string, start?: number, limit?: number, xMagdaSession?: string): Promise<{
528
+ getAllSummary(xMagdaTenantId: number, pageToken?: string, start?: number, limit?: number, reversePageTokenOrder?: boolean, xMagdaSession?: string): Promise<{
525
529
  response: http.IncomingMessage;
526
530
  body: Array<RecordSummary>;
527
531
  }>;
@@ -698,7 +702,7 @@ declare class RegistryClient {
698
702
  getRecord(id: string, aspect?: Array<string>, optionalAspect?: Array<string>, dereference?: boolean): Promise<Record_2 | ServerError>;
699
703
  getRecordAspect(id: string, aspectId: string): Promise<any | ServerError>;
700
704
  getRecordInFull(id: string): Promise<Record_2>;
701
- 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> | ServerError>;
705
+ 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): Promise<RecordsPage<I> | ServerError>;
702
706
  getRecordsPageTokens(aspect?: Array<string>, limit?: number): Promise<string[] | ServerError>;
703
707
  }
704
708
 
package/dist/index.js CHANGED
@@ -38187,8 +38187,9 @@ class RecordHistoryApi {
38187
38187
  * @param limit The maximum number of events to receive. The response will include a token that can be passed as the pageToken parameter to a future request to continue receiving results where this query leaves off.
38188
38188
  * @param aspect The aspects for which to included in event history, specified as multiple occurrences of this query parameter.
38189
38189
  * @param dereference true to automatically dereference links to other records; false to leave them as links. Dereferencing a link means including the record itself where the link would be. Dereferencing only happens one level deep, regardless of the value of this parameter.
38190
+ * @param reversePageTokenOrder When pagination via pageToken, by default, records with smaller pageToken (i.e. older records) will be returned first. When this parameter is set to &#x60;true&#x60;, higher pageToken records (newer records) will be returned.
38190
38191
  */
38191
- history(xMagdaTenantId, recordId, xMagdaSession, pageToken, start, limit, aspect, dereference) {
38192
+ history(xMagdaTenantId, recordId, xMagdaSession, pageToken, start, limit, aspect, dereference, reversePageTokenOrder) {
38192
38193
  const localVarPath = this.basePath + '/records/{recordId}/history'
38193
38194
  .replace('{' + 'recordId' + '}', String(recordId));
38194
38195
  let queryParameters = {};
@@ -38221,6 +38222,9 @@ class RecordHistoryApi {
38221
38222
  if (dereference !== undefined) {
38222
38223
  queryParameters['dereference'] = dereference;
38223
38224
  }
38225
+ if (reversePageTokenOrder !== undefined) {
38226
+ queryParameters['reversePageTokenOrder'] = reversePageTokenOrder;
38227
+ }
38224
38228
  headerParams['X-Magda-Tenant-Id'] = xMagdaTenantId;
38225
38229
  headerParams['X-Magda-Session'] = xMagdaSession;
38226
38230
  let useFormData = false;
@@ -38552,9 +38556,10 @@ class RecordsApi {
38552
38556
  * @param orderBy Specify the field to sort the result. Aspect field can be supported in a format like aspectId.path.to.field
38553
38557
  * @param orderByDir Specify the order by direction. Either &#x60;asc&#x60; or &#x60;desc&#x60;
38554
38558
  * @param orderNullFirst Specify whether nulls appear before (&#x60;true&#x60;) or after (&#x60;false&#x60;) non-null values in the sort ordering.
38559
+ * @param reversePageTokenOrder When pagination via pageToken, by default, records with smaller pageToken (i.e. older records) will be returned first. When this parameter is set to &#x60;true&#x60;, higher pageToken records (newer records) will be returned.
38555
38560
  * @param xMagdaSession Magda internal session id
38556
38561
  */
38557
- getAll(xMagdaTenantId, aspect, optionalAspect, pageToken, start, limit, dereference, aspectQuery, aspectOrQuery, orderBy, orderByDir, orderNullFirst, xMagdaSession) {
38562
+ getAll(xMagdaTenantId, aspect, optionalAspect, pageToken, start, limit, dereference, aspectQuery, aspectOrQuery, orderBy, orderByDir, orderNullFirst, reversePageTokenOrder, xMagdaSession) {
38558
38563
  const localVarPath = this.basePath + '/records';
38559
38564
  let queryParameters = {};
38560
38565
  let headerParams = Object.assign({}, this.defaultHeaders);
@@ -38596,6 +38601,9 @@ class RecordsApi {
38596
38601
  if (orderNullFirst !== undefined) {
38597
38602
  queryParameters['orderNullFirst'] = orderNullFirst;
38598
38603
  }
38604
+ if (reversePageTokenOrder !== undefined) {
38605
+ queryParameters['reversePageTokenOrder'] = reversePageTokenOrder;
38606
+ }
38599
38607
  headerParams['X-Magda-Tenant-Id'] = xMagdaTenantId;
38600
38608
  headerParams['X-Magda-Session'] = xMagdaSession;
38601
38609
  let useFormData = false;
@@ -38639,9 +38647,10 @@ class RecordsApi {
38639
38647
  * @param pageToken A token that identifies the start of a page of results. This token should not be interpreted as having any meaning, but it can be obtained from a previous page of results.
38640
38648
  * @param start The index of the first record to retrieve. When possible, specify pageToken instead as it will result in better performance. If this parameter and pageToken are both specified, this parameter is interpreted as the index after the pageToken of the first record to retrieve.
38641
38649
  * @param limit The maximum number of records to receive. The response will include a token that can be passed as the pageToken parameter to a future request to continue receiving results where this query leaves off.
38650
+ * @param reversePageTokenOrder When pagination via pageToken, by default, records with smaller pageToken (i.e. older records) will be returned first. When this parameter is set to &#x60;true&#x60;, higher pageToken records (newer records) will be returned.
38642
38651
  * @param xMagdaSession Magda internal session id
38643
38652
  */
38644
- getAllSummary(xMagdaTenantId, pageToken, start, limit, xMagdaSession) {
38653
+ getAllSummary(xMagdaTenantId, pageToken, start, limit, reversePageTokenOrder, xMagdaSession) {
38645
38654
  const localVarPath = this.basePath + '/records/summary';
38646
38655
  let queryParameters = {};
38647
38656
  let headerParams = Object.assign({}, this.defaultHeaders);
@@ -38659,6 +38668,9 @@ class RecordsApi {
38659
38668
  if (limit !== undefined) {
38660
38669
  queryParameters['limit'] = limit;
38661
38670
  }
38671
+ if (reversePageTokenOrder !== undefined) {
38672
+ queryParameters['reversePageTokenOrder'] = reversePageTokenOrder;
38673
+ }
38662
38674
  headerParams['X-Magda-Tenant-Id'] = xMagdaTenantId;
38663
38675
  headerParams['X-Magda-Session'] = xMagdaSession;
38664
38676
  let useFormData = false;
@@ -61202,8 +61214,8 @@ class RegistryClient {
61202
61214
  }
61203
61215
  });
61204
61216
  }
61205
- getRecords(aspect, optionalAspect, pageToken, dereference, limit, aspectQueries, aspectOrQuery, orderBy, orderByDir, orderNullFirst) {
61206
- const operation = (pageToken) => () => this.recordsApi.getAll(this.tenantId, aspect, optionalAspect, pageToken, undefined, limit, dereference, aspectQueries, aspectOrQuery, orderBy, orderByDir, orderNullFirst, this.jwt);
61217
+ getRecords(aspect, optionalAspect, pageToken, dereference, limit, aspectQueries, aspectOrQuery, orderBy, orderByDir, orderNullFirst, reversePageTokenOrder) {
61218
+ const operation = (pageToken) => () => this.recordsApi.getAll(this.tenantId, aspect, optionalAspect, pageToken, undefined, limit, dereference, aspectQueries, aspectOrQuery, orderBy, orderByDir, orderNullFirst, reversePageTokenOrder, this.jwt);
61207
61219
  return retry_1.default(operation(pageToken), this.secondsBetweenRetries, this.maxRetries, (e, retriesLeft) => console.log(formatServiceError_1.default("Failed to GET records.", e, retriesLeft)))
61208
61220
  .then((result) => result.body)
61209
61221
  .catch(exports.toServerError("getRecords"));
@@ -84289,14 +84301,14 @@ class Crawler {
84289
84301
  return this.isCrawling;
84290
84302
  }
84291
84303
  crawlExistingRecords() {
84292
- var _a;
84304
+ var _a, _b, _c, _d;
84293
84305
  return __awaiter(this, void 0, void 0, function* () {
84294
84306
  try {
84295
84307
  this.resetCrawler();
84296
84308
  this.isCrawling = true;
84297
84309
  console.info("Crawling existing records in registry");
84298
84310
  const crawlerRecordFetchNumber = ((_a = this.options) === null || _a === void 0 ? void 0 : _a.crawlerRecordFetchNumber) ? this.options.crawlerRecordFetchNumber :
84299
- DEFAULT_CRAWLER_RECORD_FETCH_NUMBER;
84311
+ ((_c = (_b = this.options) === null || _b === void 0 ? void 0 : _b.argv) === null || _c === void 0 ? void 0 : _c.crawlerRecordFetchNumber) ? (_d = this.options) === null || _d === void 0 ? void 0 : _d.argv.crawlerRecordFetchNumber : DEFAULT_CRAWLER_RECORD_FETCH_NUMBER;
84300
84312
  const registryPage = AsyncPage_1.default.create(previous => {
84301
84313
  if (previous && previous.hasMore === false) {
84302
84314
  console.info("No more records left");
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@magda/minion-sdk",
3
3
  "description": "MAGDA Minion SDK",
4
- "version": "2.0.0-alpha.5",
4
+ "version": "2.0.0-alpha.8",
5
5
  "scripts": {
6
6
  "prebuild": "rimraf dist tsconfig.tsbuildinfo",
7
7
  "build": "webpack && api-extractor run -l",
@@ -12,8 +12,8 @@
12
12
  "main": "dist/index.js",
13
13
  "types": "dist/index.d.ts",
14
14
  "devDependencies": {
15
- "@magda/minion-framework": "^2.0.0-alpha.5",
16
- "@magda/typescript-common": "^2.0.0-alpha.5",
15
+ "@magda/minion-framework": "^2.0.0-alpha.8",
16
+ "@magda/typescript-common": "^2.0.0-alpha.8",
17
17
  "@microsoft/api-extractor": "^7.7.8",
18
18
  "ts-loader": "^6.2.1",
19
19
  "typescript": "^3.7.2",