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