@magda/minion-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.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  /// <reference types="node" />
2
2
  import express from 'express';
3
3
  import http = require('http');
4
+ import { Response as Response_2 } from 'request';
4
5
  import { default as URI_2 } from 'urijs';
5
6
  import yargs from 'yargs';
6
7
 
@@ -45,8 +46,9 @@ declare class AspectDefinitionsApi {
45
46
  * Get a list of all aspects
46
47
  *
47
48
  * @param xMagdaTenantId 0
49
+ * @param xMagdaSession Magda internal session id
48
50
  */
49
- getAll(xMagdaTenantId: number): Promise<{
51
+ getAll(xMagdaTenantId: number, xMagdaSession?: string): Promise<{
50
52
  response: http.IncomingMessage;
51
53
  body: Array<AspectDefinition>;
52
54
  }>;
@@ -55,8 +57,9 @@ declare class AspectDefinitionsApi {
55
57
  *
56
58
  * @param xMagdaTenantId 0
57
59
  * @param id ID of the aspect to be fetched.
60
+ * @param xMagdaSession Magda internal session id
58
61
  */
59
- getById(xMagdaTenantId: number, id: string): Promise<{
62
+ getById(xMagdaTenantId: number, id: string, xMagdaSession?: string): Promise<{
60
63
  response: http.IncomingMessage;
61
64
  body: AspectDefinition;
62
65
  }>;
@@ -92,6 +95,7 @@ declare enum AspectDefinitionsApiApiKeys {
92
95
  export declare class AuthorizedRegistryClient extends RegistryClient {
93
96
  protected jwt: string;
94
97
  constructor(options: AuthorizedRegistryOptions);
98
+ getAspectDefinition(aspectId: string): Promise<AspectDefinition>;
95
99
  putAspectDefinition(aspectDefinition: AspectDefinition, tenantId?: number): Promise<AspectDefinition | Error>;
96
100
  postHook(hook: WebHook): Promise<WebHook | Error>;
97
101
  putHook(hook: WebHook): Promise<WebHook | Error>;
@@ -320,6 +324,33 @@ declare class RecordAspectsApi {
320
324
  response: http.IncomingMessage;
321
325
  body: DeleteResult;
322
326
  }>;
327
+ /**
328
+ * Get a list of a record&#39;s aspects
329
+ *
330
+ * @param xMagdaTenantId 0
331
+ * @param recordId ID of the record for which to fetch aspects.
332
+ * @param keyword Specify the keyword to search in the all aspects&#39; aspectId &amp; data fields.
333
+ * @param aspectIdOnly When set to true, will respond only an array contains aspect id only.
334
+ * @param start The index of the first record to retrieve.
335
+ * @param limit The maximum number of records to receive.
336
+ * @param xMagdaSession Magda internal session id
337
+ */
338
+ getAspects(xMagdaTenantId: number, recordId: string, keyword?: string, aspectIdOnly?: boolean, start?: number, limit?: number, xMagdaSession?: string): Promise<{
339
+ response: http.IncomingMessage;
340
+ body: Array<any>;
341
+ }>;
342
+ /**
343
+ * Get the number of aspects that a record has
344
+ *
345
+ * @param xMagdaTenantId 0
346
+ * @param recordId ID of the record for which to fetch an aspect.
347
+ * @param keyword Specify the keyword to search in the all aspects&#39; aspectId &amp; data fields.
348
+ * @param xMagdaSession Magda internal session id
349
+ */
350
+ getAspectsCount(xMagdaTenantId: number, recordId: string, keyword?: string, xMagdaSession?: string): Promise<{
351
+ response: http.IncomingMessage;
352
+ body: CountResponse;
353
+ }>;
323
354
  /**
324
355
  * Get a record aspect by ID
325
356
  *
@@ -599,8 +630,16 @@ declare class RegistryClient {
599
630
  protected tenantId: number;
600
631
  protected jwt: string | undefined;
601
632
  constructor({ baseUrl, maxRetries, secondsBetweenRetries, tenantId }: RegistryOptions);
633
+ toServerError(error: {
634
+ body: any;
635
+ response: Response_2;
636
+ }): ServerError | {
637
+ body: any;
638
+ response: Response_2;
639
+ };
602
640
  getRecordUrl(id: string): string;
603
641
  getAspectDefinitions(): Promise<AspectDefinition[] | Error>;
642
+ getAspectDefinition(aspectId: string, jwtToken?: string): Promise<AspectDefinition>;
604
643
  getRecord(id: string, aspect?: Array<string>, optionalAspect?: Array<string>, dereference?: boolean): Promise<Record_2 | Error>;
605
644
  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>;
606
645
  getRecordsPageTokens(aspect?: Array<string>, limit?: number): Promise<string[] | Error>;
@@ -622,6 +661,16 @@ declare interface RegistryOptions {
622
661
  tenantId: number;
623
662
  }
624
663
 
664
+ declare class ServerError extends Error {
665
+ statusCode: number;
666
+ constructor(message?: string, statusCode?: number);
667
+ toData(): {
668
+ isError: boolean;
669
+ errorCode: number;
670
+ errorMessage: string;
671
+ };
672
+ }
673
+
625
674
  declare class WebHook {
626
675
  'id': string;
627
676
  'name': string;
@@ -636,6 +685,11 @@ declare class WebHook {
636
685
  'retryCount': number;
637
686
  'isRunning': any;
638
687
  'isProcessing': any;
688
+ 'ownerId': string;
689
+ 'creatorId': string;
690
+ 'editorId': string;
691
+ 'createTime': Date;
692
+ 'editTime': Date;
639
693
  }
640
694
 
641
695
  /**