@magda/registry-client 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.
Files changed (3) hide show
  1. package/dist/index.d.ts +57 -19
  2. package/dist/index.js +607 -337
  3. package/package.json +2 -2
package/dist/index.d.ts CHANGED
@@ -43,8 +43,9 @@ declare class AspectDefinitionsApi {
43
43
  * Get a list of all aspects
44
44
  *
45
45
  * @param xMagdaTenantId 0
46
+ * @param xMagdaSession Magda internal session id
46
47
  */
47
- getAll(xMagdaTenantId: number): Promise<{
48
+ getAll(xMagdaTenantId: number, xMagdaSession?: string): Promise<{
48
49
  response: http.IncomingMessage;
49
50
  body: Array<AspectDefinition>;
50
51
  }>;
@@ -53,8 +54,9 @@ declare class AspectDefinitionsApi {
53
54
  *
54
55
  * @param xMagdaTenantId 0
55
56
  * @param id ID of the aspect to be fetched.
57
+ * @param xMagdaSession Magda internal session id
56
58
  */
57
- getById(xMagdaTenantId: number, id: string): Promise<{
59
+ getById(xMagdaTenantId: number, id: string, xMagdaSession?: string): Promise<{
58
60
  response: http.IncomingMessage;
59
61
  body: AspectDefinition;
60
62
  }>;
@@ -90,6 +92,7 @@ declare enum AspectDefinitionsApiApiKeys {
90
92
  export declare class AuthorizedRegistryClient extends RegistryClient {
91
93
  protected jwt: string;
92
94
  constructor(options: AuthorizedRegistryOptions);
95
+ getAspectDefinition(aspectId: string): Promise<AspectDefinition>;
93
96
  putAspectDefinition(aspectDefinition: AspectDefinition, tenantId?: number): Promise<AspectDefinition | Error>;
94
97
  postHook(hook: WebHook): Promise<WebHook | Error>;
95
98
  putHook(hook: WebHook): Promise<WebHook | Error>;
@@ -97,24 +100,18 @@ export declare class AuthorizedRegistryClient extends RegistryClient {
97
100
  getHooks(): Promise<WebHook[] | Error>;
98
101
  resumeHook(webhookId: string, succeeded?: boolean, lastEventIdReceived?: string, active?: boolean): Promise<WebHookAcknowledgementResponse | Error>;
99
102
  putRecord(record: Record_2, tenantId?: number): Promise<Record_2 | Error>;
103
+ patchRecord(recordId: string, recordPatch: Operation[], tenantId?: number): Promise<Record_2 | Error>;
100
104
  putRecordAspect(recordId: string, aspectId: string, aspect: any, tenantId?: number): Promise<Record_2 | Error>;
105
+ deleteRecordAspect(recordId: string, aspectId: string, tenantId?: number): Promise<DeleteResult | Error>;
101
106
  patchRecordAspect(recordId: string, aspectId: string, aspectPatch: Operation[], tenantId?: number): Promise<Record_2 | Error>;
102
107
  deleteBySource(sourceTagToPreserve: string, sourceId: string, tenantId?: number): Promise<MultipleDeleteResult | "Processing" | Error>;
103
108
  getRecordHistory(id: string, pageToken?: string, start?: number, limit?: number): Promise<EventsPage | Error>;
104
109
  }
105
110
 
106
- declare interface AuthorizedRegistryJwtOptions extends RegistryOptions {
107
- jwt: string;
108
- userId?: never;
109
- jwtSecret?: never;
110
- }
111
-
112
- export declare type AuthorizedRegistryOptions = AuthorizedRegistryUserIdAndJwtSecretOptions | AuthorizedRegistryJwtOptions;
113
-
114
- declare interface AuthorizedRegistryUserIdAndJwtSecretOptions extends RegistryOptions {
115
- userId: string;
116
- jwtSecret: string;
117
- jwt?: never;
111
+ export declare interface AuthorizedRegistryOptions extends RegistryOptions {
112
+ jwt?: string;
113
+ userId?: string;
114
+ jwtSecret?: string;
118
115
  }
119
116
 
120
117
  declare class CountResponse {
@@ -246,10 +243,6 @@ declare class Record_2 {
246
243
  */
247
244
  'aspects': any;
248
245
  /**
249
- * The read authorization policy id of a record
250
- */
251
- 'authnReadPolicyId': string;
252
- /**
253
246
  * A tag representing the action by the source of this record (e.g. an id for a individual crawl of a data portal).
254
247
  */
255
248
  'sourceTag': string;
@@ -280,6 +273,33 @@ declare class RecordAspectsApi {
280
273
  response: http.IncomingMessage;
281
274
  body: DeleteResult;
282
275
  }>;
276
+ /**
277
+ * Get a list of a record&#39;s aspects
278
+ *
279
+ * @param xMagdaTenantId 0
280
+ * @param recordId ID of the record for which to fetch aspects.
281
+ * @param keyword Specify the keyword to search in the all aspects&#39; aspectId &amp; data fields.
282
+ * @param aspectIdOnly When set to true, will respond only an array contains aspect id only.
283
+ * @param start The index of the first record to retrieve.
284
+ * @param limit The maximum number of records to receive.
285
+ * @param xMagdaSession Magda internal session id
286
+ */
287
+ getAspects(xMagdaTenantId: number, recordId: string, keyword?: string, aspectIdOnly?: boolean, start?: number, limit?: number, xMagdaSession?: string): Promise<{
288
+ response: http.IncomingMessage;
289
+ body: Array<any>;
290
+ }>;
291
+ /**
292
+ * Get the number of aspects that a record has
293
+ *
294
+ * @param xMagdaTenantId 0
295
+ * @param recordId ID of the record for which to fetch an aspect.
296
+ * @param keyword Specify the keyword to search in the all aspects&#39; aspectId &amp; data fields.
297
+ * @param xMagdaSession Magda internal session id
298
+ */
299
+ getAspectsCount(xMagdaTenantId: number, recordId: string, keyword?: string, xMagdaSession?: string): Promise<{
300
+ response: http.IncomingMessage;
301
+ body: CountResponse;
302
+ }>;
283
303
  /**
284
304
  * Get a record aspect by ID
285
305
  *
@@ -441,6 +461,17 @@ declare class RecordsApi {
441
461
  response: http.IncomingMessage;
442
462
  body: Record_2;
443
463
  }>;
464
+ /**
465
+ * Get a record in full by ID
466
+ * Get a record with all attached aspects data by the record ID.
467
+ * @param id ID of the record to be fetched.
468
+ * @param xMagdaTenantId 0
469
+ * @param xMagdaSession Magda internal session id
470
+ */
471
+ getByIdInFull(id: string, xMagdaTenantId: number, xMagdaSession?: string): Promise<{
472
+ response: http.IncomingMessage;
473
+ body: Record_2;
474
+ }>;
444
475
  /**
445
476
  * Get a summary record by ID
446
477
  * Gets a summary record, including all the aspect ids for which this record has data.
@@ -487,7 +518,7 @@ declare class RecordsApi {
487
518
  */
488
519
  patchById(xMagdaTenantId: number, id: string, recordPatch: Array<Operation>, xMagdaSession: string): Promise<{
489
520
  response: http.IncomingMessage;
490
- body: AspectDefinition;
521
+ body: Record_2;
491
522
  }>;
492
523
  /**
493
524
  * Modify a record by ID
@@ -561,7 +592,9 @@ export declare class RegistryClient {
561
592
  constructor({ baseUrl, maxRetries, secondsBetweenRetries, tenantId }: RegistryOptions);
562
593
  getRecordUrl(id: string): string;
563
594
  getAspectDefinitions(): Promise<AspectDefinition[] | Error>;
595
+ getAspectDefinition(aspectId: string, jwtToken?: string): Promise<AspectDefinition>;
564
596
  getRecord(id: string, aspect?: Array<string>, optionalAspect?: Array<string>, dereference?: boolean): Promise<Record_2 | Error>;
597
+ getRecordInFull(id: string): Promise<Record_2>;
565
598
  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>;
566
599
  getRecordsPageTokens(aspect?: Array<string>, limit?: number): Promise<string[] | Error>;
567
600
  }
@@ -598,6 +631,11 @@ export declare class WebHook {
598
631
  'retryCount': number;
599
632
  'isRunning': any;
600
633
  'isProcessing': any;
634
+ 'ownerId': string;
635
+ 'creatorId': string;
636
+ 'editorId': string;
637
+ 'createTime': Date;
638
+ 'editTime': Date;
601
639
  }
602
640
 
603
641
  /**