@magda/minion-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.d.ts +68 -2
- package/dist/index.js +2363 -4558
- package/package.json +3 -3
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'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' aspectId & 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' aspectId & 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
|
*
|
|
@@ -481,6 +512,17 @@ declare class RecordsApi {
|
|
|
481
512
|
response: http.IncomingMessage;
|
|
482
513
|
body: Record_2;
|
|
483
514
|
}>;
|
|
515
|
+
/**
|
|
516
|
+
* Get a record in full by ID
|
|
517
|
+
* Get a record with all attached aspects data by the record ID.
|
|
518
|
+
* @param id ID of the record to be fetched.
|
|
519
|
+
* @param xMagdaTenantId 0
|
|
520
|
+
* @param xMagdaSession Magda internal session id
|
|
521
|
+
*/
|
|
522
|
+
getByIdInFull(id: string, xMagdaTenantId: number, xMagdaSession?: string): Promise<{
|
|
523
|
+
response: http.IncomingMessage;
|
|
524
|
+
body: Record_2;
|
|
525
|
+
}>;
|
|
484
526
|
/**
|
|
485
527
|
* Get a summary record by ID
|
|
486
528
|
* Gets a summary record, including all the aspect ids for which this record has data.
|
|
@@ -599,9 +641,18 @@ declare class RegistryClient {
|
|
|
599
641
|
protected tenantId: number;
|
|
600
642
|
protected jwt: string | undefined;
|
|
601
643
|
constructor({ baseUrl, maxRetries, secondsBetweenRetries, tenantId }: RegistryOptions);
|
|
644
|
+
toServerError(error: {
|
|
645
|
+
body: any;
|
|
646
|
+
response: Response_2;
|
|
647
|
+
}): ServerError | {
|
|
648
|
+
body: any;
|
|
649
|
+
response: Response_2;
|
|
650
|
+
};
|
|
602
651
|
getRecordUrl(id: string): string;
|
|
603
652
|
getAspectDefinitions(): Promise<AspectDefinition[] | Error>;
|
|
653
|
+
getAspectDefinition(aspectId: string, jwtToken?: string): Promise<AspectDefinition>;
|
|
604
654
|
getRecord(id: string, aspect?: Array<string>, optionalAspect?: Array<string>, dereference?: boolean): Promise<Record_2 | Error>;
|
|
655
|
+
getRecordInFull(id: string): Promise<Record_2>;
|
|
605
656
|
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
657
|
getRecordsPageTokens(aspect?: Array<string>, limit?: number): Promise<string[] | Error>;
|
|
607
658
|
}
|
|
@@ -622,6 +673,16 @@ declare interface RegistryOptions {
|
|
|
622
673
|
tenantId: number;
|
|
623
674
|
}
|
|
624
675
|
|
|
676
|
+
declare class ServerError extends Error {
|
|
677
|
+
statusCode: number;
|
|
678
|
+
constructor(message?: string, statusCode?: number);
|
|
679
|
+
toData(): {
|
|
680
|
+
isError: boolean;
|
|
681
|
+
errorCode: number;
|
|
682
|
+
errorMessage: string;
|
|
683
|
+
};
|
|
684
|
+
}
|
|
685
|
+
|
|
625
686
|
declare class WebHook {
|
|
626
687
|
'id': string;
|
|
627
688
|
'name': string;
|
|
@@ -636,6 +697,11 @@ declare class WebHook {
|
|
|
636
697
|
'retryCount': number;
|
|
637
698
|
'isRunning': any;
|
|
638
699
|
'isProcessing': any;
|
|
700
|
+
'ownerId': string;
|
|
701
|
+
'creatorId': string;
|
|
702
|
+
'editorId': string;
|
|
703
|
+
'createTime': Date;
|
|
704
|
+
'editTime': Date;
|
|
639
705
|
}
|
|
640
706
|
|
|
641
707
|
/**
|