@magda/registry-client 2.0.0-alpha.0 → 2.0.0-alpha.3

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 +19 -35
  2. package/dist/index.js +474 -395
  3. package/package.json +3 -3
package/dist/index.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  /// <reference types="node" />
2
2
  import http = require('http');
3
- import { Response as Response_2 } from 'request';
4
3
  import { default as URI_2 } from 'urijs';
5
4
 
6
5
  /**
@@ -101,24 +100,18 @@ export declare class AuthorizedRegistryClient extends RegistryClient {
101
100
  getHooks(): Promise<WebHook[] | Error>;
102
101
  resumeHook(webhookId: string, succeeded?: boolean, lastEventIdReceived?: string, active?: boolean): Promise<WebHookAcknowledgementResponse | Error>;
103
102
  putRecord(record: Record_2, tenantId?: number): Promise<Record_2 | Error>;
103
+ patchRecord(recordId: string, recordPatch: Operation[], tenantId?: number): Promise<Record_2 | Error>;
104
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>;
105
106
  patchRecordAspect(recordId: string, aspectId: string, aspectPatch: Operation[], tenantId?: number): Promise<Record_2 | Error>;
106
107
  deleteBySource(sourceTagToPreserve: string, sourceId: string, tenantId?: number): Promise<MultipleDeleteResult | "Processing" | Error>;
107
108
  getRecordHistory(id: string, pageToken?: string, start?: number, limit?: number): Promise<EventsPage | Error>;
108
109
  }
109
110
 
110
- declare interface AuthorizedRegistryJwtOptions extends RegistryOptions {
111
- jwt: string;
112
- userId?: never;
113
- jwtSecret?: never;
114
- }
115
-
116
- export declare type AuthorizedRegistryOptions = AuthorizedRegistryUserIdAndJwtSecretOptions | AuthorizedRegistryJwtOptions;
117
-
118
- declare interface AuthorizedRegistryUserIdAndJwtSecretOptions extends RegistryOptions {
119
- userId: string;
120
- jwtSecret: string;
121
- jwt?: never;
111
+ export declare interface AuthorizedRegistryOptions extends RegistryOptions {
112
+ jwt?: string;
113
+ userId?: string;
114
+ jwtSecret?: string;
122
115
  }
123
116
 
124
117
  declare class CountResponse {
@@ -250,10 +243,6 @@ declare class Record_2 {
250
243
  */
251
244
  'aspects': any;
252
245
  /**
253
- * The read authorization policy id of a record
254
- */
255
- 'authnReadPolicyId': string;
256
- /**
257
246
  * A tag representing the action by the source of this record (e.g. an id for a individual crawl of a data portal).
258
247
  */
259
248
  'sourceTag': string;
@@ -472,6 +461,17 @@ declare class RecordsApi {
472
461
  response: http.IncomingMessage;
473
462
  body: Record_2;
474
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
+ }>;
475
475
  /**
476
476
  * Get a summary record by ID
477
477
  * Gets a summary record, including all the aspect ids for which this record has data.
@@ -518,7 +518,7 @@ declare class RecordsApi {
518
518
  */
519
519
  patchById(xMagdaTenantId: number, id: string, recordPatch: Array<Operation>, xMagdaSession: string): Promise<{
520
520
  response: http.IncomingMessage;
521
- body: AspectDefinition;
521
+ body: Record_2;
522
522
  }>;
523
523
  /**
524
524
  * Modify a record by ID
@@ -590,17 +590,11 @@ export declare class RegistryClient {
590
590
  protected tenantId: number;
591
591
  protected jwt: string | undefined;
592
592
  constructor({ baseUrl, maxRetries, secondsBetweenRetries, tenantId }: RegistryOptions);
593
- toServerError(error: {
594
- body: any;
595
- response: Response_2;
596
- }): ServerError | {
597
- body: any;
598
- response: Response_2;
599
- };
600
593
  getRecordUrl(id: string): string;
601
594
  getAspectDefinitions(): Promise<AspectDefinition[] | Error>;
602
595
  getAspectDefinition(aspectId: string, jwtToken?: string): Promise<AspectDefinition>;
603
596
  getRecord(id: string, aspect?: Array<string>, optionalAspect?: Array<string>, dereference?: boolean): Promise<Record_2 | Error>;
597
+ getRecordInFull(id: string): Promise<Record_2>;
604
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>;
605
599
  getRecordsPageTokens(aspect?: Array<string>, limit?: number): Promise<string[] | Error>;
606
600
  }
@@ -621,16 +615,6 @@ export declare interface RegistryOptions {
621
615
  tenantId: number;
622
616
  }
623
617
 
624
- declare class ServerError extends Error {
625
- statusCode: number;
626
- constructor(message?: string, statusCode?: number);
627
- toData(): {
628
- isError: boolean;
629
- errorCode: number;
630
- errorMessage: string;
631
- };
632
- }
633
-
634
618
  export declare const TenantConsts: any;
635
619
 
636
620
  export declare class WebHook {