@magda/registry-client 1.1.0-arm64.0 → 1.1.0-rc.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.
Files changed (3) hide show
  1. package/dist/index.d.ts +714 -0
  2. package/dist/index.js +43447 -0
  3. package/package.json +2 -2
@@ -0,0 +1,714 @@
1
+ /// <reference types="node" />
2
+ import http = require('http');
3
+ import { default as URI_2 } from 'urijs';
4
+
5
+ /**
6
+ * A type of aspect in the registry, unique for a tenant.
7
+ */
8
+ export declare class AspectDefinition {
9
+ /**
10
+ * The identifier for the aspect type.
11
+ */
12
+ 'id': string;
13
+ /**
14
+ * The name of the aspect.
15
+ */
16
+ 'name': string;
17
+ /**
18
+ * The JSON Schema of this aspect.
19
+ */
20
+ 'jsonSchema': any;
21
+ }
22
+
23
+ declare class AspectDefinitionsApi {
24
+ protected basePath: string;
25
+ protected defaultHeaders: any;
26
+ protected _useQuerystring: boolean;
27
+ protected authentications: any;
28
+ constructor(basePath?: string);
29
+ set useQuerystring(value: boolean);
30
+ setApiKey(key: AspectDefinitionsApiApiKeys, value: string): void;
31
+ /**
32
+ * Create a new aspect
33
+ *
34
+ * @param xMagdaTenantId 0
35
+ * @param aspect The definition of the new aspect.
36
+ * @param xMagdaSession Magda internal session id
37
+ */
38
+ create(xMagdaTenantId: number, aspect: AspectDefinition, xMagdaSession: string): Promise<{
39
+ response: http.IncomingMessage;
40
+ body: AspectDefinition;
41
+ }>;
42
+ /**
43
+ * Get a list of all aspects
44
+ *
45
+ * @param xMagdaTenantId 0
46
+ */
47
+ getAll(xMagdaTenantId: number): Promise<{
48
+ response: http.IncomingMessage;
49
+ body: Array<AspectDefinition>;
50
+ }>;
51
+ /**
52
+ * Get an aspect by ID
53
+ *
54
+ * @param xMagdaTenantId 0
55
+ * @param id ID of the aspect to be fetched.
56
+ */
57
+ getById(xMagdaTenantId: number, id: string): Promise<{
58
+ response: http.IncomingMessage;
59
+ body: AspectDefinition;
60
+ }>;
61
+ /**
62
+ * Modify an aspect by applying a JSON Patch
63
+ * The patch should follow IETF RFC 6902 (https://tools.ietf.org/html/rfc6902).
64
+ * @param xMagdaTenantId 0
65
+ * @param id ID of the aspect to be saved.
66
+ * @param aspectPatch The RFC 6902 patch to apply to the aspect.
67
+ * @param xMagdaSession Magda internal session id
68
+ */
69
+ patchById(xMagdaTenantId: number, id: string, aspectPatch: Array<Operation>, xMagdaSession: string): Promise<{
70
+ response: http.IncomingMessage;
71
+ body: AspectDefinition;
72
+ }>;
73
+ /**
74
+ * Modify an aspect by ID
75
+ * Modifies the aspect with a given ID. If an aspect with the ID does not yet exist, it is created.
76
+ * @param xMagdaTenantId 0
77
+ * @param id ID of the aspect to be saved.
78
+ * @param aspect The aspect to save.
79
+ * @param xMagdaSession Magda internal session id
80
+ */
81
+ putById(xMagdaTenantId: number, id: string, aspect: AspectDefinition, xMagdaSession: string): Promise<{
82
+ response: http.IncomingMessage;
83
+ body: AspectDefinition;
84
+ }>;
85
+ }
86
+
87
+ declare enum AspectDefinitionsApiApiKeys {
88
+ }
89
+
90
+ export declare class AuthorizedRegistryClient extends RegistryClient {
91
+ protected jwt: string;
92
+ constructor(options: AuthorizedRegistryOptions);
93
+ putAspectDefinition(aspectDefinition: AspectDefinition, tenantId?: number): Promise<AspectDefinition | Error>;
94
+ postHook(hook: WebHook): Promise<WebHook | Error>;
95
+ putHook(hook: WebHook): Promise<WebHook | Error>;
96
+ getHook(hookId: string): Promise<Maybe<WebHook> | Error>;
97
+ getHooks(): Promise<WebHook[] | Error>;
98
+ resumeHook(webhookId: string, succeeded?: boolean, lastEventIdReceived?: string, active?: boolean): Promise<WebHookAcknowledgementResponse | Error>;
99
+ putRecord(record: Record_2, tenantId?: number): Promise<Record_2 | Error>;
100
+ putRecordAspect(recordId: string, aspectId: string, aspect: any, tenantId?: number): Promise<Record_2 | Error>;
101
+ patchRecordAspect(recordId: string, aspectId: string, aspectPatch: Operation[], tenantId?: number): Promise<Record_2 | Error>;
102
+ deleteBySource(sourceTagToPreserve: string, sourceId: string, tenantId?: number): Promise<MultipleDeleteResult | "Processing" | Error>;
103
+ getRecordHistory(id: string, pageToken?: string, start?: number, limit?: number): Promise<EventsPage | Error>;
104
+ }
105
+
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;
118
+ }
119
+
120
+ declare class CountResponse {
121
+ 'count': number;
122
+ }
123
+
124
+ declare class DeleteResult {
125
+ 'deleted': boolean;
126
+ }
127
+
128
+ declare interface Eq<T> {
129
+ equals(t: T): boolean;
130
+ }
131
+
132
+ /**
133
+ * A page of events.
134
+ */
135
+ declare class EventsPage {
136
+ /**
137
+ * Whether there are more events available.
138
+ */
139
+ 'hasMore': boolean;
140
+ /**
141
+ * A token to be used to get the next page of events.
142
+ */
143
+ 'nextPageToken': string;
144
+ /**
145
+ * The events in this page.
146
+ */
147
+ 'events': Array<RegistryEvent>;
148
+ }
149
+
150
+ /**
151
+ * The type of a registry modification event.
152
+ */
153
+ export declare type EventType = 'CreateRecord' | 'CreateAspectDefinition' | 'CreateRecordAspect' | 'PatchRecord' | 'PatchAspectDefinition' | 'PatchRecordAspect' | 'DeleteRecord' | 'DeleteAspectDefinition' | 'DeleteRecordAspect';
154
+
155
+ declare interface Functor<T> {
156
+ fmap<U>(f: (t: T) => U): Functor<U>;
157
+ lift<U>(f: (t: T) => U): Functor<U>;
158
+ map<U>(f: (t: T) => U): Functor<U>;
159
+ }
160
+
161
+ declare class JsObject {
162
+ 'fields': {
163
+ [key: string]: JsValue;
164
+ };
165
+ }
166
+
167
+ declare class JsValue {
168
+ }
169
+
170
+ declare class Maybe<T> implements Monad<T>, Functor<T>, Eq<Maybe<T>> {
171
+ private type;
172
+ private value;
173
+ constructor(type: MaybeType, value?: T);
174
+ static sequence<T>(t: {
175
+ [k: string]: Maybe<T>;
176
+ }): Maybe<{
177
+ [k: string]: T;
178
+ }>;
179
+ static all: (t: {
180
+ [k: string]: Maybe<any>;
181
+ }) => Maybe<{
182
+ [k: string]: any;
183
+ }>;
184
+ static maybe<T>(t: T): Maybe<T>;
185
+ static just<T>(t: T): Maybe<T>;
186
+ static nothing<T>(): Maybe<T>;
187
+ unit<U>(u: U): Maybe<U>;
188
+ bind<U>(f: (t: T) => Maybe<U>): Maybe<U>;
189
+ of: <U>(u: U) => Maybe<U>;
190
+ chain: <U>(f: (t: T) => Maybe<U>) => Maybe<U>;
191
+ fmap<U>(f: (t: T) => U): Maybe<U>;
192
+ lift: <U>(f: (t: T) => U) => Maybe<U>;
193
+ map: <U>(f: (t: T) => U) => Maybe<U>;
194
+ caseOf<U>(patterns: MaybePatterns<T, U>): U;
195
+ defaulting(defaultValue: T): Maybe<T>;
196
+ equals(other: Maybe<T>): any;
197
+ valueOr<U extends T>(defaultValue: U): T | U;
198
+ valueOrCompute<U extends T>(defaultValueFunction: () => U): T | U;
199
+ valueOrThrow(error?: Error): T;
200
+ do(patterns?: OptionalMaybePatterns<T, void>): Maybe<T>;
201
+ }
202
+
203
+ declare interface MaybePatterns<T, U> {
204
+ just: (t: T) => U;
205
+ nothing: () => U;
206
+ }
207
+
208
+ declare enum MaybeType {
209
+ Nothing = 0,
210
+ Just = 1,
211
+ }
212
+
213
+ declare interface Monad<T> {
214
+ unit<U>(t: U): Monad<U>;
215
+ bind<U>(f: (t: T) => Monad<U>): Monad<U>;
216
+ of<U>(t: U): Monad<U>;
217
+ chain<U>(f: (t: T) => Monad<U>): Monad<U>;
218
+ }
219
+
220
+ declare class MultipleDeleteResult {
221
+ 'count': number;
222
+ }
223
+
224
+ declare class Operation {
225
+ }
226
+
227
+ declare interface OptionalMaybePatterns<T, U> {
228
+ just?: (t: T) => U;
229
+ nothing?: () => U;
230
+ }
231
+
232
+ /**
233
+ * A record in the registry, usually including data for one or more aspects, unique for a tenant.
234
+ */
235
+ declare class Record_2 {
236
+ /**
237
+ * The identifier of the record
238
+ */
239
+ 'id': string;
240
+ /**
241
+ * The name of the record
242
+ */
243
+ 'name': string;
244
+ /**
245
+ * The aspects included in this record
246
+ */
247
+ 'aspects': any;
248
+ /**
249
+ * The read authorization policy id of a record
250
+ */
251
+ 'authnReadPolicyId': string;
252
+ /**
253
+ * A tag representing the action by the source of this record (e.g. an id for a individual crawl of a data portal).
254
+ */
255
+ 'sourceTag': string;
256
+ /**
257
+ * The identifier of a tenant
258
+ */
259
+ 'tenantId': number;
260
+ }
261
+ export { Record_2 as Record }
262
+
263
+ declare class RecordAspectsApi {
264
+ protected basePath: string;
265
+ protected defaultHeaders: any;
266
+ protected _useQuerystring: boolean;
267
+ protected authentications: any;
268
+ constructor(basePath?: string);
269
+ set useQuerystring(value: boolean);
270
+ setApiKey(key: RecordAspectsApiApiKeys, value: string): void;
271
+ /**
272
+ * Delete a record aspect by ID
273
+ * Deletes a record aspect.
274
+ * @param recordId ID of the record for which to delete an aspect.
275
+ * @param aspectId ID of the aspect to delete.
276
+ * @param xMagdaSession Magda internal session id
277
+ * @param xMagdaTenantId 0
278
+ */
279
+ deleteById(recordId: string, aspectId: string, xMagdaSession: string, xMagdaTenantId: number): Promise<{
280
+ response: http.IncomingMessage;
281
+ body: DeleteResult;
282
+ }>;
283
+ /**
284
+ * Get a record aspect by ID
285
+ *
286
+ * @param xMagdaTenantId 0
287
+ * @param recordId ID of the record for which to fetch an aspect.
288
+ * @param aspectId ID of the aspect to fetch.
289
+ * @param xMagdaSession Magda internal session id
290
+ */
291
+ getById(xMagdaTenantId: number, recordId: string, aspectId: string, xMagdaSession?: string): Promise<{
292
+ response: http.IncomingMessage;
293
+ body: any;
294
+ }>;
295
+ /**
296
+ * Modify a record aspect by applying a JSON Patch
297
+ * The patch should follow IETF RFC 6902 (https://tools.ietf.org/html/rfc6902).
298
+ * @param recordId ID of the record for which to fetch an aspect.
299
+ * @param aspectId ID of the aspect to fetch.
300
+ * @param aspectPatch The RFC 6902 patch to apply to the aspect.
301
+ * @param xMagdaSession Magda internal session id
302
+ * @param xMagdaTenantId 0
303
+ */
304
+ patchById(recordId: string, aspectId: string, aspectPatch: Array<Operation>, xMagdaSession: string, xMagdaTenantId: number): Promise<{
305
+ response: http.IncomingMessage;
306
+ body: any;
307
+ }>;
308
+ /**
309
+ * Modify a record aspect by ID
310
+ * Modifies a record aspect. If the aspect does not yet exist on this record, it is created.
311
+ * @param recordId ID of the record for which to update an aspect.
312
+ * @param aspectId ID of the aspect to update.
313
+ * @param aspect The record aspect to save.
314
+ * @param xMagdaSession Magda internal session id
315
+ * @param xMagdaTenantId 0
316
+ */
317
+ putById(recordId: string, aspectId: string, aspect: any, xMagdaSession: string, xMagdaTenantId: number): Promise<{
318
+ response: http.IncomingMessage;
319
+ body: any;
320
+ }>;
321
+ }
322
+
323
+ declare enum RecordAspectsApiApiKeys {
324
+ }
325
+
326
+ declare class RecordHistoryApi {
327
+ protected basePath: string;
328
+ protected defaultHeaders: any;
329
+ protected _useQuerystring: boolean;
330
+ protected authentications: any;
331
+ constructor(basePath?: string);
332
+ set useQuerystring(value: boolean);
333
+ setApiKey(key: RecordHistoryApiApiKeys, value: string): void;
334
+ /**
335
+ * Get a list of all events affecting this record
336
+ *
337
+ * @param xMagdaTenantId 0
338
+ * @param recordId ID of the record for which to fetch history.
339
+ * @param xMagdaSession Magda internal session id
340
+ * @param pageToken A token that identifies the start of a page of events. This token should not be interpreted as having any meaning, but it can be obtained from a previous page of results.
341
+ * @param start The index of the first event 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.
342
+ * @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.
343
+ * @param aspect The aspects for which to included in event history, specified as multiple occurrences of this query parameter.
344
+ * @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.
345
+ */
346
+ history(xMagdaTenantId: number, recordId: string, xMagdaSession: string, pageToken?: string, start?: number, limit?: number, aspect?: Array<string>, dereference?: boolean): Promise<{
347
+ response: http.IncomingMessage;
348
+ body: EventsPage;
349
+ }>;
350
+ /**
351
+ * Get the version of a record that existed after a given event was applied
352
+ *
353
+ * @param xMagdaTenantId 0
354
+ * @param recordId ID of the record to fetch.
355
+ * @param eventId The ID of the last event to be applied to the record. The event with this ID need not actually apply to the record, in which case that last event prior to this even that does apply will be used.
356
+ */
357
+ version(xMagdaTenantId: number, recordId: string, eventId: string): Promise<{
358
+ response: http.IncomingMessage;
359
+ body: Record_2;
360
+ }>;
361
+ }
362
+
363
+ declare enum RecordHistoryApiApiKeys {
364
+ }
365
+
366
+ declare class RecordsApi {
367
+ protected basePath: string;
368
+ protected defaultHeaders: any;
369
+ protected _useQuerystring: boolean;
370
+ protected authentications: any;
371
+ constructor(basePath?: string);
372
+ set useQuerystring(value: boolean);
373
+ setApiKey(key: RecordsApiApiKeys, value: string): void;
374
+ /**
375
+ * Create a new record
376
+ *
377
+ * @param xMagdaTenantId 0
378
+ * @param record The definition of the new record.
379
+ * @param xMagdaSession Magda internal session id
380
+ */
381
+ create(xMagdaTenantId: number, record: Record_2, xMagdaSession: string): Promise<{
382
+ response: http.IncomingMessage;
383
+ body: Record_2;
384
+ }>;
385
+ /**
386
+ * Delete a record
387
+ *
388
+ * @param xMagdaTenantId 0
389
+ * @param recordId ID of the record to delete.
390
+ * @param xMagdaSession Magda internal session id
391
+ */
392
+ deleteById(xMagdaTenantId: number, recordId: string, xMagdaSession: string): Promise<{
393
+ response: http.IncomingMessage;
394
+ body: DeleteResult;
395
+ }>;
396
+ /**
397
+ * Get a list of all records
398
+ *
399
+ * @param xMagdaTenantId 0
400
+ * @param aspect The aspects for which to retrieve data, specified as multiple occurrences of this query parameter. Only records that have all of these aspects will be included in the response.
401
+ * @param optionalAspect The optional aspects for which to retrieve data, specified as multiple occurrences of this query parameter. These aspects will be included in a record if available, but a record will be included even if it is missing these aspects.
402
+ * @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.
403
+ * @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.
404
+ * @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.
405
+ * @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.
406
+ * @param aspectQuery Filter the records returned by a value within the aspect JSON. Expressed as &#39;aspectId.path.to.field:value&#39;, url encoded. NOTE: This is an early stage API and may change greatly in the future
407
+ * @param aspectOrQuery Filter the records returned by a value within the aspect JSON. Expressed as &#39;aspectId.path.to.field:value&#39;, url encoded. Queries passing via this parameter will be grouped with OR logic. NOTE: This is an early stage API and may change greatly in the future
408
+ * @param orderBy Specify the field to sort the result. Aspect field can be supported in a format like aspectId.path.to.field
409
+ * @param orderByDir Specify the order by direction. Either &#x60;asc&#x60; or &#x60;desc&#x60;
410
+ * @param orderNullFirst Specify whether nulls appear before (&#x60;true&#x60;) or after (&#x60;false&#x60;) non-null values in the sort ordering.
411
+ * @param xMagdaSession Magda internal session id
412
+ */
413
+ 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<{
414
+ response: http.IncomingMessage;
415
+ body: Array<Record_2>;
416
+ }>;
417
+ /**
418
+ * Get a list of all records as summaries
419
+ *
420
+ * @param xMagdaTenantId 0
421
+ * @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.
422
+ * @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.
423
+ * @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.
424
+ * @param xMagdaSession Magda internal session id
425
+ */
426
+ getAllSummary(xMagdaTenantId: number, pageToken?: string, start?: number, limit?: number, xMagdaSession?: string): Promise<{
427
+ response: http.IncomingMessage;
428
+ body: Array<RecordSummary>;
429
+ }>;
430
+ /**
431
+ * Get a record by ID
432
+ * Gets a complete record, including data for all aspects.
433
+ * @param id ID of the record to be fetched.
434
+ * @param xMagdaTenantId 0
435
+ * @param aspect The aspects for which to retrieve data, specified as multiple occurrences of this query parameter. Only records that have all of these aspects will be included in the response.
436
+ * @param optionalAspect The optional aspects for which to retrieve data, specified as multiple occurrences of this query parameter. These aspects will be included in a record if available, but a record will be included even if it is missing these aspects.
437
+ * @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.
438
+ * @param xMagdaSession Magda internal session id
439
+ */
440
+ getById(id: string, xMagdaTenantId: number, aspect?: Array<string>, optionalAspect?: Array<string>, dereference?: boolean, xMagdaSession?: string): Promise<{
441
+ response: http.IncomingMessage;
442
+ body: Record_2;
443
+ }>;
444
+ /**
445
+ * Get a summary record by ID
446
+ * Gets a summary record, including all the aspect ids for which this record has data.
447
+ * @param id ID of the record to be fetched.
448
+ * @param xMagdaTenantId 0
449
+ * @param xMagdaSession Magda internal session id
450
+ */
451
+ getByIdSummary(id: string, xMagdaTenantId: number, xMagdaSession?: string): Promise<{
452
+ response: http.IncomingMessage;
453
+ body: RecordSummary;
454
+ }>;
455
+ /**
456
+ * Get the count of records matching the parameters. If no parameters are specified, the count will be approximate for performance reasons.
457
+ *
458
+ * @param xMagdaTenantId 0
459
+ * @param aspect The aspects for which to retrieve data, specified as multiple occurrences of this query parameter. Only records that have all of these aspects will be included in the response.
460
+ * @param aspectQuery Filter the records returned by a value within the aspect JSON. Expressed as &#39;aspectId.path.to.field:value&#39;, url encoded. NOTE: This is an early stage API and may change greatly in the future
461
+ * @param aspectOrQuery Filter the records returned by a value within the aspect JSON. Expressed as &#39;aspectId.path.to.field:value&#39;, url encoded. Queries passing via this parameter will be grouped with OR logic.
462
+ * @param xMagdaSession Magda internal session id
463
+ */
464
+ getCount(xMagdaTenantId: number, aspect?: Array<string>, aspectQuery?: Array<string>, aspectOrQuery?: Array<string>, xMagdaSession?: string): Promise<{
465
+ response: http.IncomingMessage;
466
+ body: CountResponse;
467
+ }>;
468
+ /**
469
+ * Get a list tokens for paging through the records
470
+ *
471
+ * @param xMagdaTenantId 0
472
+ * @param aspect The aspects for which to retrieve data, specified as multiple occurrences of this query parameter. Only records that have all of these aspects will be included in the response.
473
+ * @param limit The size of each page to get tokens for.
474
+ * @param xMagdaSession Magda internal session id
475
+ */
476
+ getPageTokens(xMagdaTenantId: number, aspect?: Array<string>, limit?: number, xMagdaSession?: string): Promise<{
477
+ response: http.IncomingMessage;
478
+ body: Array<string>;
479
+ }>;
480
+ /**
481
+ * Modify a record by applying a JSON Patch
482
+ * The patch should follow IETF RFC 6902 (https://tools.ietf.org/html/rfc6902).
483
+ * @param xMagdaTenantId 0
484
+ * @param id ID of the aspect to be saved.
485
+ * @param recordPatch The RFC 6902 patch to apply to the aspect.
486
+ * @param xMagdaSession Magda internal session id
487
+ */
488
+ patchById(xMagdaTenantId: number, id: string, recordPatch: Array<Operation>, xMagdaSession: string): Promise<{
489
+ response: http.IncomingMessage;
490
+ body: AspectDefinition;
491
+ }>;
492
+ /**
493
+ * Modify a record by ID
494
+ * Modifies a record. Aspects included in the request are created or updated, but missing aspects are not removed.
495
+ * @param xMagdaTenantId 0
496
+ * @param id ID of the record to be fetched.
497
+ * @param record The record to save.
498
+ * @param xMagdaSession Magda internal session id
499
+ */
500
+ putById(xMagdaTenantId: number, id: string, record: Record_2, xMagdaSession: string): Promise<{
501
+ response: http.IncomingMessage;
502
+ body: Record_2;
503
+ }>;
504
+ /**
505
+ * Trim by source tag
506
+ * Trims records with the provided source that DON&#39;T have the supplied source tag
507
+ * @param xMagdaTenantId 0
508
+ * @param sourceTagToPreserve Source tag of the records to PRESERVE.
509
+ * @param sourceId Source id of the records to delete.
510
+ * @param xMagdaSession Magda internal session id
511
+ */
512
+ trimBySourceTag(xMagdaTenantId: number, sourceTagToPreserve: string, sourceId: string, xMagdaSession: string): Promise<{
513
+ response: http.IncomingMessage;
514
+ body: MultipleDeleteResult;
515
+ }>;
516
+ }
517
+
518
+ declare enum RecordsApiApiKeys {
519
+ }
520
+
521
+ declare interface RecordsPage<I extends Record_2> {
522
+ totalCount: number;
523
+ hasMore: boolean;
524
+ nextPageToken?: string;
525
+ records: I[];
526
+ }
527
+
528
+ /**
529
+ * A summary of a record in the registry. Summaries specify which aspects are available, but do not include data for any aspects.
530
+ */
531
+ declare class RecordSummary {
532
+ /**
533
+ * The identifier of the record
534
+ */
535
+ 'id': string;
536
+ /**
537
+ * The name of the record
538
+ */
539
+ 'name': string;
540
+ /**
541
+ * The list of aspect IDs for which this record has data
542
+ */
543
+ 'aspects': Array<string>;
544
+ /**
545
+ * The identifier of the tenant
546
+ */
547
+ 'tenantId': number;
548
+ }
549
+
550
+ export declare class RegistryClient {
551
+ protected baseUri: URI_2;
552
+ protected aspectDefinitionsApi: AspectDefinitionsApi;
553
+ protected recordsApi: RecordsApi;
554
+ protected webHooksApi: WebHooksApi;
555
+ protected recordAspectsApi: RecordAspectsApi;
556
+ protected recordHistoryApi: RecordHistoryApi;
557
+ protected maxRetries: number;
558
+ protected secondsBetweenRetries: number;
559
+ protected tenantId: number;
560
+ protected jwt: string | undefined;
561
+ constructor({ baseUrl, maxRetries, secondsBetweenRetries, tenantId }: RegistryOptions);
562
+ getRecordUrl(id: string): string;
563
+ getAspectDefinitions(): Promise<AspectDefinition[] | Error>;
564
+ getRecord(id: string, aspect?: Array<string>, optionalAspect?: Array<string>, dereference?: boolean): Promise<Record_2 | Error>;
565
+ 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
+ getRecordsPageTokens(aspect?: Array<string>, limit?: number): Promise<string[] | Error>;
567
+ }
568
+
569
+ export declare class RegistryEvent {
570
+ 'id': any;
571
+ 'eventTime': Date;
572
+ 'eventType': EventType;
573
+ 'userId': string;
574
+ 'data': JsObject;
575
+ 'tenantId': number;
576
+ }
577
+
578
+ export declare interface RegistryOptions {
579
+ baseUrl: string;
580
+ maxRetries?: number;
581
+ secondsBetweenRetries?: number;
582
+ tenantId: number;
583
+ }
584
+
585
+ export declare const TenantConsts: any;
586
+
587
+ export declare class WebHook {
588
+ 'id': string;
589
+ 'name': string;
590
+ 'active': boolean;
591
+ 'lastEvent': any;
592
+ 'url': string;
593
+ 'eventTypes': Array<EventType>;
594
+ 'isWaitingForResponse': any;
595
+ 'config': WebHookConfig;
596
+ 'enabled': boolean;
597
+ 'lastRetryTime': Date;
598
+ 'retryCount': number;
599
+ 'isRunning': any;
600
+ 'isProcessing': any;
601
+ }
602
+
603
+ /**
604
+ * Asynchronously acknowledges receipt of a web hook notification.
605
+ */
606
+ declare class WebHookAcknowledgement {
607
+ /**
608
+ * True if the web hook was received successfully and the listener is ready for further notifications. False if the web hook was not received and the same notification should be repeated.
609
+ */
610
+ 'succeeded': boolean;
611
+ /**
612
+ * The ID of the last event received by the listener. This should be the value of the `lastEventId` property of the web hook payload that is being acknowledged. This value is ignored if `succeeded` is false.
613
+ */
614
+ 'lastEventIdReceived': any;
615
+ /**
616
+ * Should the webhook be active or inactive?
617
+ */
618
+ 'active': any;
619
+ }
620
+
621
+ /**
622
+ * The response to an asynchronous web hook acknowledgement.
623
+ */
624
+ declare class WebHookAcknowledgementResponse {
625
+ /**
626
+ * The ID of the last event successfully received by the listener. Further notifications will start after this event.
627
+ */
628
+ 'lastEventIdReceived': number;
629
+ }
630
+
631
+ declare class WebHookConfig {
632
+ 'aspects': Array<string>;
633
+ 'optionalAspects': Array<string>;
634
+ 'includeEvents': any;
635
+ 'includeRecords': any;
636
+ 'includeAspectDefinitions': any;
637
+ 'dereference': any;
638
+ }
639
+
640
+ declare class WebHooksApi {
641
+ protected basePath: string;
642
+ protected defaultHeaders: any;
643
+ protected _useQuerystring: boolean;
644
+ protected authentications: any;
645
+ constructor(basePath?: string);
646
+ set useQuerystring(value: boolean);
647
+ setApiKey(key: WebHooksApiApiKeys, value: string): void;
648
+ /**
649
+ * Acknowledge a previously-deferred web hook
650
+ * Acknowledges a previously-deferred web hook with a given ID. Acknowledging a previously-POSTed web hook will cause the next, if any, to be sent.
651
+ * @param id ID of the web hook to be acknowledged.
652
+ * @param acknowledgement The details of the acknowledgement.
653
+ * @param xMagdaSession Magda internal session id
654
+ */
655
+ ack(id: string, acknowledgement: WebHookAcknowledgement, xMagdaSession: string): Promise<{
656
+ response: http.IncomingMessage;
657
+ body: WebHookAcknowledgementResponse;
658
+ }>;
659
+ /**
660
+ * Create a new web hook
661
+ *
662
+ * @param hook The definition of the new web hook.
663
+ * @param xMagdaSession Magda internal session id
664
+ */
665
+ create(hook: WebHook, xMagdaSession: string): Promise<{
666
+ response: http.IncomingMessage;
667
+ body: WebHook;
668
+ }>;
669
+ /**
670
+ * Delete a web hook
671
+ *
672
+ * @param hookId ID of the web hook to delete.
673
+ * @param xMagdaSession Magda internal session id
674
+ */
675
+ deleteById(hookId: string, xMagdaSession: string): Promise<{
676
+ response: http.IncomingMessage;
677
+ body: DeleteResult;
678
+ }>;
679
+ /**
680
+ * Get a list of all web hooks
681
+ *
682
+ * @param xMagdaSession Magda internal session id
683
+ */
684
+ getAll(xMagdaSession: string): Promise<{
685
+ response: http.IncomingMessage;
686
+ body: Array<WebHook>;
687
+ }>;
688
+ /**
689
+ * Get a web hook by ID
690
+ *
691
+ * @param id ID of the web hook to be fetched.
692
+ * @param xMagdaSession Magda internal session id
693
+ */
694
+ getById(id: string, xMagdaSession: string): Promise<{
695
+ response: http.IncomingMessage;
696
+ body: WebHook;
697
+ }>;
698
+ /**
699
+ * Modify a web hook by ID
700
+ * Modifies the web hook with a given ID. If a web hook with the ID does not yet exist, it is created.
701
+ * @param id ID of the aspect to be saved.
702
+ * @param hook The web hook to save.
703
+ * @param xMagdaSession Magda internal session id
704
+ */
705
+ putById(id: string, hook: WebHook, xMagdaSession: string): Promise<{
706
+ response: http.IncomingMessage;
707
+ body: WebHook;
708
+ }>;
709
+ }
710
+
711
+ declare enum WebHooksApiApiKeys {
712
+ }
713
+
714
+ export { }