@magda/minion-sdk 2.3.2 → 3.0.0-alpha.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 +93 -93
  2. package/dist/index.js +94415 -93352
  3. package/package.json +20 -10
package/dist/index.d.ts CHANGED
@@ -1,24 +1,25 @@
1
1
  /// <reference types="node" />
2
+
2
3
  import express from 'express';
3
- import http = require('http');
4
+ import http from 'node:http';
4
5
  import { default as URI_2 } from 'urijs';
5
6
  import yargs from 'yargs';
6
7
 
7
8
  /**
8
- * A type of aspect in the registry, unique for a tenant.
9
- */
9
+ * A type of aspect in the registry, unique for a tenant.
10
+ */
10
11
  export declare class AspectDefinition {
11
12
  /**
12
- * The identifier for the aspect type.
13
- */
13
+ * The identifier for the aspect type.
14
+ */
14
15
  'id': string;
15
16
  /**
16
- * The name of the aspect.
17
- */
17
+ * The name of the aspect.
18
+ */
18
19
  'name': string;
19
20
  /**
20
- * The JSON Schema of this aspect.
21
- */
21
+ * The JSON Schema of this aspect.
22
+ */
22
23
  'jsonSchema': any;
23
24
  }
24
25
 
@@ -122,13 +123,13 @@ export declare interface AuthorizedRegistryOptions extends RegistryOptions {
122
123
  }
123
124
 
124
125
  /**
125
- * Builds an argv object that will accept command line arguments used by all common argv minions.
126
- *
127
- * @param id
128
- * @param defaultPort
129
- * @param defaultInternalUrl
130
- * @param additions
131
- */
126
+ * Builds an argv object that will accept command line arguments used by all common argv minions.
127
+ *
128
+ * @param id
129
+ * @param defaultPort
130
+ * @param defaultInternalUrl
131
+ * @param additions
132
+ */
132
133
  export declare function commonYargs<T extends MinionArguments = MinionArguments>(defaultPort: number, defaultInternalUrl: string, additions?: (a: yargs.Argv<MinionArguments>) => yargs.Argv<T>): T;
133
134
 
134
135
  declare class CountResponse {
@@ -150,26 +151,26 @@ declare interface Eq<T> {
150
151
  }
151
152
 
152
153
  /**
153
- * A page of events.
154
- */
154
+ * A page of events.
155
+ */
155
156
  declare class EventsPage {
156
157
  /**
157
- * Whether there are more events available.
158
- */
158
+ * Whether there are more events available.
159
+ */
159
160
  'hasMore': boolean;
160
161
  /**
161
- * A token to be used to get the next page of events.
162
- */
162
+ * A token to be used to get the next page of events.
163
+ */
163
164
  'nextPageToken': string;
164
165
  /**
165
- * The events in this page.
166
- */
166
+ * The events in this page.
167
+ */
167
168
  'events': Array<RegistryEvent>;
168
169
  }
169
170
 
170
171
  /**
171
- * The type of a registry modification event.
172
- */
172
+ * The type of a registry modification event.
173
+ */
173
174
  declare type EventType = 'CreateRecord' | 'CreateAspectDefinition' | 'CreateRecordAspect' | 'PatchRecord' | 'PatchAspectDefinition' | 'PatchRecordAspect' | 'DeleteRecord' | 'DeleteAspectDefinition' | 'DeleteRecordAspect';
174
175
 
175
176
  declare interface Functor<T> {
@@ -193,7 +194,7 @@ declare class JsValue {
193
194
 
194
195
  declare class Maybe<T> implements Monad<T>, Functor<T>, Eq<Maybe<T>> {
195
196
  private type;
196
- private value;
197
+ private value?;
197
198
  constructor(type: MaybeType, value?: T);
198
199
  static sequence<T>(t: {
199
200
  [k: string]: Maybe<T>;
@@ -205,9 +206,11 @@ declare class Maybe<T> implements Monad<T>, Functor<T>, Eq<Maybe<T>> {
205
206
  }) => Maybe<{
206
207
  [k: string]: any;
207
208
  }>;
208
- static maybe<T>(t: T): Maybe<T>;
209
+ static maybe<T>(t?: T | null): Maybe<T>;
209
210
  static just<T>(t: T): Maybe<T>;
210
211
  static nothing<T>(): Maybe<T>;
212
+ static isJust<T>(t: Maybe<T>): boolean;
213
+ static isNothing<T>(t: Maybe<T>): boolean;
211
214
  unit<U>(u: U): Maybe<U>;
212
215
  bind<U>(f: (t: T) => Maybe<U>): Maybe<U>;
213
216
  of: <U>(u: U) => Maybe<U>;
@@ -221,7 +224,7 @@ declare class Maybe<T> implements Monad<T>, Functor<T>, Eq<Maybe<T>> {
221
224
  valueOr<U extends T>(defaultValue: U): T | U;
222
225
  valueOrCompute<U extends T>(defaultValueFunction: () => U): T | U;
223
226
  valueOrThrow(error?: Error): T;
224
- do(patterns?: OptionalMaybePatterns<T, void>): Maybe<T>;
227
+ do(patterns?: Partial<MaybePatterns<T, void>>): Maybe<T>;
225
228
  }
226
229
 
227
230
  declare interface MaybePatterns<T, U> {
@@ -231,39 +234,41 @@ declare interface MaybePatterns<T, U> {
231
234
 
232
235
  declare enum MaybeType {
233
236
  Nothing = 0,
234
- Just = 1,
237
+ Just = 1
235
238
  }
236
239
 
237
240
  declare function minion(options: MinionOptions): Promise<void>;
238
241
  export default minion;
239
242
 
240
243
  export declare type MinionArguments = {
241
- listenPort: string | number;
242
- internalUrl: string;
243
- jwtSecret: string;
244
- userId: string;
245
- registryUrl: string;
246
- enableMultiTenant: boolean;
247
- tenantUrl: string;
248
- retries: string | number;
249
- crawlerRecordFetchNumber?: string | number;};
244
+ listenPort: string | number;
245
+ internalUrl: string;
246
+ jwtSecret: string;
247
+ userId: string;
248
+ registryUrl: string;
249
+ enableMultiTenant: boolean;
250
+ tenantUrl: string;
251
+ retries: string | number;
252
+ crawlerRecordFetchNumber?: string | number;
253
+ };
250
254
 
251
255
  export declare interface MinionOptions {
252
- argv: MinionArguments;
253
- id: string;
254
- aspects: string[];
255
- optionalAspects: string[];
256
- writeAspectDefs: AspectDefinition[];
257
- async?: boolean;
258
- onRecordFound: onRecordFoundType;
259
- express?: () => express.Express;
260
- maxRetries?: number;
261
- concurrency?: number;
262
- crawlerRecordFetchNumber?: number;
263
- includeEvents?: boolean;
264
- includeRecords?: boolean;
265
- includeAspectDefinitions?: boolean;
266
- dereference?: boolean;}
256
+ argv: MinionArguments;
257
+ id: string;
258
+ aspects: string[];
259
+ optionalAspects: string[];
260
+ writeAspectDefs: AspectDefinition[];
261
+ async?: boolean;
262
+ onRecordFound: onRecordFoundType;
263
+ express?: () => express.Express;
264
+ maxRetries?: number;
265
+ concurrency?: number;
266
+ crawlerRecordFetchNumber?: number;
267
+ includeEvents?: boolean;
268
+ includeRecords?: boolean;
269
+ includeAspectDefinitions?: boolean;
270
+ dereference?: boolean;
271
+ }
267
272
 
268
273
  declare interface Monad<T> {
269
274
  unit<U>(t: U): Monad<U>;
@@ -281,11 +286,6 @@ export declare type onRecordFoundType = (record: Record_2, registry: AuthorizedR
281
286
  declare class Operation {
282
287
  }
283
288
 
284
- declare interface OptionalMaybePatterns<T, U> {
285
- just?: (t: T) => U;
286
- nothing?: () => U;
287
- }
288
-
289
289
  declare class PatchRecordsRequest {
290
290
  'recordIds': Array<string>;
291
291
  'jsonPath': JsonPatch;
@@ -297,28 +297,28 @@ declare class PutRecordsAspectRequest {
297
297
  }
298
298
 
299
299
  /**
300
- * A record in the registry, usually including data for one or more aspects, unique for a tenant.
301
- */
300
+ * A record in the registry, usually including data for one or more aspects, unique for a tenant.
301
+ */
302
302
  declare class Record_2 {
303
303
  /**
304
- * The identifier of the record
305
- */
304
+ * The identifier of the record
305
+ */
306
306
  'id': string;
307
307
  /**
308
- * The name of the record
309
- */
308
+ * The name of the record
309
+ */
310
310
  'name': string;
311
311
  /**
312
- * The aspects included in this record
313
- */
312
+ * The aspects included in this record
313
+ */
314
314
  'aspects': any;
315
315
  /**
316
- * A tag representing the action by the source of this record (e.g. an id for a individual crawl of a data portal).
317
- */
316
+ * A tag representing the action by the source of this record (e.g. an id for a individual crawl of a data portal).
317
+ */
318
318
  'sourceTag': string;
319
319
  /**
320
- * The identifier of a tenant
321
- */
320
+ * The identifier of a tenant
321
+ */
322
322
  'tenantId': number;
323
323
  }
324
324
  export { Record_2 as Record }
@@ -671,24 +671,24 @@ declare interface RecordsPage<I extends Record_2> {
671
671
  }
672
672
 
673
673
  /**
674
- * A summary of a record in the registry. Summaries specify which aspects are available, but do not include data for any aspects.
675
- */
674
+ * A summary of a record in the registry. Summaries specify which aspects are available, but do not include data for any aspects.
675
+ */
676
676
  declare class RecordSummary {
677
677
  /**
678
- * The identifier of the record
679
- */
678
+ * The identifier of the record
679
+ */
680
680
  'id': string;
681
681
  /**
682
- * The name of the record
683
- */
682
+ * The name of the record
683
+ */
684
684
  'name': string;
685
685
  /**
686
- * The list of aspect IDs for which this record has data
687
- */
686
+ * The list of aspect IDs for which this record has data
687
+ */
688
688
  'aspects': Array<string>;
689
689
  /**
690
- * The identifier of the tenant
691
- */
690
+ * The identifier of the tenant
691
+ */
692
692
  'tenantId': number;
693
693
  }
694
694
 
@@ -762,30 +762,30 @@ declare class WebHook {
762
762
  }
763
763
 
764
764
  /**
765
- * Asynchronously acknowledges receipt of a web hook notification.
766
- */
765
+ * Asynchronously acknowledges receipt of a web hook notification.
766
+ */
767
767
  declare class WebHookAcknowledgement {
768
768
  /**
769
- * 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.
770
- */
769
+ * 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.
770
+ */
771
771
  'succeeded': boolean;
772
772
  /**
773
- * 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.
774
- */
773
+ * 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.
774
+ */
775
775
  'lastEventIdReceived': any;
776
776
  /**
777
- * Should the webhook be active or inactive?
778
- */
777
+ * Should the webhook be active or inactive?
778
+ */
779
779
  'active': any;
780
780
  }
781
781
 
782
782
  /**
783
- * The response to an asynchronous web hook acknowledgement.
784
- */
783
+ * The response to an asynchronous web hook acknowledgement.
784
+ */
785
785
  declare class WebHookAcknowledgementResponse {
786
786
  /**
787
- * The ID of the last event successfully received by the listener. Further notifications will start after this event.
788
- */
787
+ * The ID of the last event successfully received by the listener. Further notifications will start after this event.
788
+ */
789
789
  'lastEventIdReceived': number;
790
790
  }
791
791