@magda/semantic-indexer-sdk 6.0.0-alpha.3 → 6.0.0-alpha.6

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 +837 -41
  2. package/dist/index.js +63049 -53664
  3. package/package.json +3 -2
package/dist/index.d.ts CHANGED
@@ -1,4 +1,8 @@
1
+ import { DeleteByQuery_Request } from '@opensearch-project/opensearch/api/_core/deleteByQuery.js';
2
+ import { DeleteByQuery_Response } from '@opensearch-project/opensearch/api/_core/deleteByQuery.js';
1
3
  import { ResponseBody } from '@opensearch-project/opensearch/api/_types/_core.search.js';
4
+ import { TransportRequestOptions } from '@opensearch-project/opensearch/lib/Transport.js';
5
+ import { default as URI_2 } from 'urijs';
2
6
  import urijs from 'urijs';
3
7
 
4
8
  declare interface ApiClientBaseConfig {
@@ -10,6 +14,121 @@ declare interface ApiKeyBasedConfigOptions extends ApiClientBaseConfig {
10
14
  apiKey?: string;
11
15
  }
12
16
 
17
+ /**
18
+ * A type of aspect in the registry, unique for a tenant.
19
+ */
20
+ declare class AspectDefinition {
21
+ /**
22
+ * The identifier for the aspect type.
23
+ */
24
+ 'id': string;
25
+ /**
26
+ * The name of the aspect.
27
+ */
28
+ 'name': string;
29
+ /**
30
+ * The JSON Schema of this aspect.
31
+ */
32
+ 'jsonSchema': any;
33
+ }
34
+
35
+ declare class AspectDefinitionsApi {
36
+ protected basePath: string;
37
+ protected defaultHeaders: any;
38
+ protected authentications: any;
39
+ constructor(basePath?: string);
40
+ setApiKey(key: AspectDefinitionsApiApiKeys, value: string): void;
41
+ /**
42
+ * Create a new aspect
43
+ *
44
+ * @param xMagdaTenantId 0
45
+ * @param aspect The definition of the new aspect.
46
+ * @param xMagdaSession Magda internal session id
47
+ */
48
+ create(xMagdaTenantId: number, aspect: AspectDefinition, xMagdaSession: string): Promise<{
49
+ response: Response;
50
+ body: AspectDefinition;
51
+ }>;
52
+ /**
53
+ * Get a list of all aspects
54
+ *
55
+ * @param xMagdaTenantId 0
56
+ * @param xMagdaSession Magda internal session id
57
+ */
58
+ getAll(xMagdaTenantId: number, xMagdaSession?: string): Promise<{
59
+ response: Response;
60
+ body: Array<AspectDefinition>;
61
+ }>;
62
+ /**
63
+ * Get an aspect by ID
64
+ *
65
+ * @param xMagdaTenantId 0
66
+ * @param id ID of the aspect to be fetched.
67
+ * @param xMagdaSession Magda internal session id
68
+ */
69
+ getById(xMagdaTenantId: number, id: string, xMagdaSession?: string): Promise<{
70
+ response: Response;
71
+ body: AspectDefinition;
72
+ }>;
73
+ /**
74
+ * Modify an aspect by applying a JSON Patch
75
+ * The patch should follow IETF RFC 6902 (https://tools.ietf.org/html/rfc6902).
76
+ * @param xMagdaTenantId 0
77
+ * @param id ID of the aspect to be saved.
78
+ * @param aspectPatch The RFC 6902 patch to apply to the aspect.
79
+ * @param xMagdaSession Magda internal session id
80
+ */
81
+ patchById(xMagdaTenantId: number, id: string, aspectPatch: Array<Operation>, xMagdaSession: string): Promise<{
82
+ response: Response;
83
+ body: AspectDefinition;
84
+ }>;
85
+ /**
86
+ * Modify an aspect by ID
87
+ * Modifies the aspect with a given ID. If an aspect with the ID does not yet exist, it is created.
88
+ * @param xMagdaTenantId 0
89
+ * @param id ID of the aspect to be saved.
90
+ * @param aspect The aspect to save.
91
+ * @param xMagdaSession Magda internal session id
92
+ */
93
+ putById(xMagdaTenantId: number, id: string, aspect: AspectDefinition, xMagdaSession: string): Promise<{
94
+ response: Response;
95
+ body: AspectDefinition;
96
+ }>;
97
+ }
98
+
99
+ declare enum AspectDefinitionsApiApiKeys {
100
+ }
101
+
102
+ export declare class AuthorizedRegistryClient extends RegistryClient {
103
+ protected jwt: string;
104
+ constructor(options: AuthorizedRegistryOptions);
105
+ getAspectDefinition(aspectId: string): Promise<AspectDefinition>;
106
+ putAspectDefinition(aspectDefinition: AspectDefinition, tenantId?: number): Promise<AspectDefinition | ServerError>;
107
+ postHook(hook: WebHook): Promise<WebHook | ServerError>;
108
+ putHook(hook: WebHook): Promise<WebHook | ServerError>;
109
+ getHook(hookId: string): Promise<Maybe<WebHook> | ServerError>;
110
+ getHooks(): Promise<WebHook[] | ServerError>;
111
+ resumeHook(webhookId: string, succeeded?: boolean, lastEventIdReceived?: string, active?: boolean): Promise<WebHookAcknowledgementResponse | ServerError>;
112
+ creatRecord(record: Record_2, tenantId?: number): Promise<Record_2 | ServerError>;
113
+ putRecord(record: Record_2, tenantId?: number): Promise<Record_2 | ServerError>;
114
+ patchRecord(recordId: string, recordPatch: Operation[], tenantId?: number): Promise<Record_2 | ServerError>;
115
+ patchRecords(recordIds: string[], recordPatch: Operation[], tenantId?: number): Promise<string[] | ServerError>;
116
+ putRecordAspect(recordId: string, aspectId: string, aspect: any, merge?: boolean, tenantId?: number): Promise<any | ServerError>;
117
+ putRecordsAspect(recordIds: string[], aspectId: string, aspectData: any, merge?: boolean, tenantId?: number): Promise<string[] | ServerError>;
118
+ deleteRecordsAspectArrayItems(recordIds: string[], aspectId: string, jsonPath: string, items: (string | number)[], tenantId?: number): Promise<string[] | ServerError>;
119
+ deleteRecordAspect(recordId: string, aspectId: string, tenantId?: number): Promise<DeleteResult | ServerError>;
120
+ patchRecordAspect(recordId: string, aspectId: string, aspectPatch: Operation[], tenantId?: number): Promise<Record_2 | ServerError>;
121
+ deleteBySource(sourceTagToPreserve: string, sourceId: string, tenantId?: number): Promise<MultipleDeleteResult | "Processing" | ServerError>;
122
+ deleteRecord(id: string, tenantId?: number): Promise<DeleteResult | ServerError>;
123
+ getRecordHistory(id: string, pageToken?: string, start?: number, limit?: number): Promise<EventsPage | ServerError>;
124
+ }
125
+
126
+ declare interface AuthorizedRegistryOptions extends RegistryOptions {
127
+ jwt?: string;
128
+ userId?: string;
129
+ jwtSecret?: string;
130
+ }
131
+
13
132
  declare abstract class BaseApiClient {
14
133
  readonly authMode: "jwtToken" | "apiKey" | "noAuth";
15
134
  protected baseApiUrl: string;
@@ -61,6 +180,10 @@ export declare type ChunkStrategyType = (text: string) => Promise<ChunkResult[]>
61
180
 
62
181
  export declare function commonYargs(defaultPort: number, defaultInternalUrl: string): SemanticIndexerArguments;
63
182
 
183
+ declare class CountResponse {
184
+ 'count': number;
185
+ }
186
+
64
187
  export declare type CreateEmbeddingText = (params: CreateEmbeddingTextParams) => Promise<EmbeddingText>;
65
188
 
66
189
  export declare type CreateEmbeddingTextParams = {
@@ -68,8 +191,19 @@ export declare type CreateEmbeddingTextParams = {
68
191
  format: string | null;
69
192
  filePath: string | null;
70
193
  url: string | null;
194
+ readonlyRegistry: AuthorizedRegistryClient;
71
195
  };
72
196
 
197
+ declare class DeleteRecordsAspectArrayItemsRequest {
198
+ 'recordIds': Array<string>;
199
+ 'jsonPath': string;
200
+ 'items': Array<JsValue>;
201
+ }
202
+
203
+ declare class DeleteResult {
204
+ 'deleted': boolean;
205
+ }
206
+
73
207
  declare class EmbeddingApiClient extends BaseApiClient {
74
208
  private taskSize;
75
209
  constructor(options: EmbeddingApiClientConfig);
@@ -81,10 +215,6 @@ declare class EmbeddingApiClient extends BaseApiClient {
81
215
  declare interface EmbeddingApiClientConfig extends BaseApiClientConfig {
82
216
  }
83
217
 
84
- declare interface EmbeddingApiConfig {
85
- baseUrl: string;
86
- }
87
-
88
218
  export declare type EmbeddingText = {
89
219
  text: string;
90
220
  subObjects?: Array<{
@@ -94,21 +224,126 @@ export declare type EmbeddingText = {
94
224
  }>;
95
225
  };
96
226
 
97
- export declare function indexEmbeddingText(options: SemanticIndexerOptions, EmbeddingText: EmbeddingText, chunker: Chunker, embeddingApiClient: EmbeddingApiClient, opensearchApiClient: OpensearchApiClient, recordId: string, fileFormat?: string): Promise<void>;
227
+ declare interface Eq<T> {
228
+ equals(t: T): boolean;
229
+ }
230
+
231
+ /**
232
+ * A page of events.
233
+ */
234
+ declare class EventsPage {
235
+ /**
236
+ * Whether there are more events available.
237
+ */
238
+ 'hasMore': boolean;
239
+ /**
240
+ * A token to be used to get the next page of events.
241
+ */
242
+ 'nextPageToken': string;
243
+ /**
244
+ * The events in this page.
245
+ */
246
+ 'events': Array<RegistryEvent>;
247
+ }
248
+
249
+ /**
250
+ * The type of a registry modification event.
251
+ */
252
+ declare type EventType = 'CreateRecord' | 'CreateAspectDefinition' | 'CreateRecordAspect' | 'PatchRecord' | 'PatchAspectDefinition' | 'PatchRecordAspect' | 'DeleteRecord' | 'DeleteAspectDefinition' | 'DeleteRecordAspect';
253
+
254
+ declare interface Functor<T> {
255
+ fmap<U>(f: (t: T) => U): Functor<U>;
256
+ lift<U>(f: (t: T) => U): Functor<U>;
257
+ map<U>(f: (t: T) => U): Functor<U>;
258
+ }
259
+
260
+ export declare function indexEmbeddingText({ options, chunker, embeddingApiClient, opensearchApiClient, embeddingText, metadata
261
+
262
+
263
+
264
+
265
+
266
+
267
+ }: {options: SemanticIndexerOptions;chunker: Chunker;embeddingApiClient: EmbeddingApiClient;opensearchApiClient: OpensearchApiClient;embeddingText: EmbeddingText;metadata: Metadata;}): Promise<void>;
98
268
 
99
269
  export declare type ItemType = "registryRecord" | "storageObject";
100
270
 
271
+ declare class JsObject {
272
+ 'fields': {
273
+ [key: string]: JsValue;
274
+ };
275
+ }
276
+
277
+ declare class JsonPatch {
278
+ 'ops': Array<Operation>;
279
+ }
280
+
281
+ declare class JsValue {
282
+ }
283
+
101
284
  declare interface JWTBasedConfigOptions extends ApiClientBaseConfig {
102
285
  jwtSecret?: string;
103
286
  userId?: string;
104
287
  }
105
288
 
289
+ declare class Maybe<T> implements Monad<T>, Functor<T>, Eq<Maybe<T>> {
290
+ private type;
291
+ private value?;
292
+ constructor(type: MaybeType, value?: T);
293
+ static sequence<T>(t: {
294
+ [k: string]: Maybe<T>;
295
+ }): Maybe<{
296
+ [k: string]: T;
297
+ }>;
298
+ static all: (t: {
299
+ [k: string]: Maybe<any>;
300
+ }) => Maybe<{
301
+ [k: string]: any;
302
+ }>;
303
+ static maybe<T>(t?: T | null): Maybe<T>;
304
+ static just<T>(t: T): Maybe<T>;
305
+ static nothing<T>(): Maybe<T>;
306
+ static isJust<T>(t: Maybe<T>): boolean;
307
+ static isNothing<T>(t: Maybe<T>): boolean;
308
+ unit<U>(u: U): Maybe<U>;
309
+ bind<U>(f: (t: T) => Maybe<U>): Maybe<U>;
310
+ of: <U>(u: U) => Maybe<U>;
311
+ chain: <U>(f: (t: T) => Maybe<U>) => Maybe<U>;
312
+ fmap<U>(f: (t: T) => U): Maybe<U>;
313
+ lift: <U>(f: (t: T) => U) => Maybe<U>;
314
+ map: <U>(f: (t: T) => U) => Maybe<U>;
315
+ caseOf<U>(patterns: MaybePatterns<T, U>): U;
316
+ defaulting(defaultValue: T): Maybe<T>;
317
+ equals(other: Maybe<T>): any;
318
+ valueOr<U extends T>(defaultValue: U): T | U;
319
+ valueOrCompute<U extends T>(defaultValueFunction: () => U): T | U;
320
+ valueOrThrow(error?: Error): T;
321
+ do(patterns?: Partial<MaybePatterns<T, void>>): Maybe<T>;
322
+ }
323
+
324
+ declare interface MaybePatterns<T, U> {
325
+ just: (t: T) => U;
326
+ nothing: () => U;
327
+ }
328
+
329
+ declare enum MaybeType {
330
+ Nothing = 0,
331
+ Just = 1
332
+ }
333
+
334
+ declare interface Metadata {
335
+ recordId: string;
336
+ parentRecordId?: string;
337
+ aspectId?: string;
338
+ fileFormat?: string;
339
+ subObjectId?: string;
340
+ subObjectType?: string;
341
+ }
342
+
106
343
  declare interface MinioConfig {
107
344
  endPoint: string;
108
345
  port: number;
109
346
  useSSL: boolean;
110
- accessKey: string;
111
- secretKey: string;
112
347
  region: string;
113
348
  defaultDatasetBucket: string;
114
349
  }
@@ -125,10 +360,21 @@ declare type MinionArguments = {
125
360
  crawlerRecordFetchNumber?: string | number;
126
361
  };
127
362
 
363
+ declare interface Monad<T> {
364
+ unit<U>(t: U): Monad<U>;
365
+ bind<U>(f: (t: T) => Monad<U>): Monad<U>;
366
+ of<U>(t: U): Monad<U>;
367
+ chain<U>(f: (t: T) => Monad<U>): Monad<U>;
368
+ }
369
+
370
+ declare class MultipleDeleteResult {
371
+ 'count': number;
372
+ }
373
+
128
374
  declare class OpensearchApiClient {
129
375
  private client;
130
- constructor(config: OpensearchConfig_2);
131
- static getOpensearchApiClient(openSearchConfig: OpensearchConfig_2): Promise<OpensearchApiClient>;
376
+ constructor(config: OpensearchConfig);
377
+ static getOpensearchApiClient(openSearchConfig: OpensearchConfig): Promise<OpensearchApiClient>;
132
378
  createIndex(indexDefinition: {
133
379
  indexName: string;
134
380
  settings?: any;
@@ -140,36 +386,24 @@ declare class OpensearchApiClient {
140
386
  bulkIndexDocument(indexName: string, documents: any[]): Promise<void>;
141
387
  searchDocuments(indexName: string, query: string): Promise<ResponseBody>;
142
388
  deleteDocument(indexName: string, documentId: string): Promise<void>;
389
+ deleteByQuery(params: DeleteByQuery_Request, options?: TransportRequestOptions): Promise<DeleteByQuery_Response>;
143
390
  }
144
391
 
145
392
  declare interface OpensearchConfig {
146
- serverUrl: string;
147
- indices: {
148
- semanticIndex: {
149
- indexName: string;
150
- indexVersion: number;
151
- numberOfShards: number;
152
- numberOfReplicas: number;
153
- knnVectorFieldConfig: {
154
- mode: string;
155
- dimension: number;
156
- spaceType: string;
157
- efConstruction: number;
158
- efSearch: number;
159
- m: number;
160
- encoder?: {
161
- name: string;
162
- type: string;
163
- clip: boolean;
164
- };
165
- compressionLevel?: string;
166
- };
167
- };
168
- };
393
+ url?: string;
169
394
  }
170
395
 
171
- declare interface OpensearchConfig_2 {
172
- url?: string;
396
+ declare class Operation {
397
+ }
398
+
399
+ declare class PatchRecordsRequest {
400
+ 'recordIds': Array<string>;
401
+ 'jsonPath': JsonPatch;
402
+ }
403
+
404
+ declare class PutRecordsAspectRequest {
405
+ 'recordIds': Array<string>;
406
+ 'data': JsObject;
173
407
  }
174
408
 
175
409
  /**
@@ -199,22 +433,443 @@ declare class Record_2 {
199
433
  }
200
434
  export { Record_2 as Record }
201
435
 
436
+ declare class RecordAspectsApi {
437
+ protected basePath: string;
438
+ protected defaultHeaders: any;
439
+ protected authentications: any;
440
+ constructor(basePath?: string);
441
+ setApiKey(key: RecordAspectsApiApiKeys, value: string): void;
442
+ /**
443
+ * Delete a record aspect by ID
444
+ * Deletes a record aspect.
445
+ * @param recordId ID of the record for which to delete an aspect.
446
+ * @param aspectId ID of the aspect to delete.
447
+ * @param xMagdaSession Magda internal session id
448
+ * @param xMagdaTenantId 0
449
+ */
450
+ deleteById(recordId: string, aspectId: string, xMagdaSession: string, xMagdaTenantId: number): Promise<{
451
+ response: Response;
452
+ body: DeleteResult;
453
+ }>;
454
+ /**
455
+ * Get a list of a record&#39;s aspects
456
+ *
457
+ * @param xMagdaTenantId 0
458
+ * @param recordId ID of the record for which to fetch aspects.
459
+ * @param keyword Specify the keyword to search in the all aspects&#39; aspectId &amp; data fields.
460
+ * @param aspectIdOnly When set to true, will respond only an array contains aspect id only.
461
+ * @param start The index of the first record to retrieve.
462
+ * @param limit The maximum number of records to receive.
463
+ * @param xMagdaSession Magda internal session id
464
+ */
465
+ getAspects(xMagdaTenantId: number, recordId: string, keyword?: string, aspectIdOnly?: boolean, start?: number, limit?: number, xMagdaSession?: string): Promise<{
466
+ response: Response;
467
+ body: Array<any>;
468
+ }>;
469
+ /**
470
+ * Get the number of aspects that a record has
471
+ *
472
+ * @param xMagdaTenantId 0
473
+ * @param recordId ID of the record for which to fetch an aspect.
474
+ * @param keyword Specify the keyword to search in the all aspects&#39; aspectId &amp; data fields.
475
+ * @param xMagdaSession Magda internal session id
476
+ */
477
+ getAspectsCount(xMagdaTenantId: number, recordId: string, keyword?: string, xMagdaSession?: string): Promise<{
478
+ response: Response;
479
+ body: CountResponse;
480
+ }>;
481
+ /**
482
+ * Get a record aspect by ID
483
+ *
484
+ * @param xMagdaTenantId 0
485
+ * @param recordId ID of the record for which to fetch an aspect.
486
+ * @param aspectId ID of the aspect to fetch.
487
+ * @param xMagdaSession Magda internal session id
488
+ */
489
+ getById(xMagdaTenantId: number, recordId: string, aspectId: string, xMagdaSession?: string): Promise<{
490
+ response: Response;
491
+ body: any;
492
+ }>;
493
+ /**
494
+ * Modify a record aspect by applying a JSON Patch
495
+ * The patch should follow IETF RFC 6902 (https://tools.ietf.org/html/rfc6902).
496
+ * @param recordId ID of the record for which to fetch an aspect.
497
+ * @param aspectId ID of the aspect to fetch.
498
+ * @param aspectPatch The RFC 6902 patch to apply to the aspect.
499
+ * @param xMagdaSession Magda internal session id
500
+ * @param xMagdaTenantId 0
501
+ */
502
+ patchById(recordId: string, aspectId: string, aspectPatch: Array<Operation>, xMagdaSession: string, xMagdaTenantId: number): Promise<{
503
+ response: Response;
504
+ body: any;
505
+ }>;
506
+ /**
507
+ * Modify a record aspect by ID
508
+ * Modifies a record aspect. If the aspect does not yet exist on this record, it is created.
509
+ * @param recordId ID of the record for which to update an aspect.
510
+ * @param aspectId ID of the aspect to update.
511
+ * @param aspect The record aspect to save.
512
+ * @param xMagdaSession Magda internal session id
513
+ * @param xMagdaTenantId 0
514
+ * @param merge Whether merge the supplied aspect data to existing aspect data or replace it
515
+ */
516
+ putById(recordId: string, aspectId: string, aspect: any, xMagdaSession: string, xMagdaTenantId: number, merge?: boolean): Promise<{
517
+ response: Response;
518
+ body: any;
519
+ }>;
520
+ }
521
+
522
+ declare enum RecordAspectsApiApiKeys {
523
+ }
524
+
525
+ declare class RecordHistoryApi {
526
+ protected basePath: string;
527
+ protected defaultHeaders: any;
528
+ protected authentications: any;
529
+ constructor(basePath?: string);
530
+ setApiKey(key: RecordHistoryApiApiKeys, value: string): void;
531
+ /**
532
+ * Get a list of all events affecting this record
533
+ *
534
+ * @param xMagdaTenantId 0
535
+ * @param recordId ID of the record for which to fetch history.
536
+ * @param xMagdaSession Magda internal session id
537
+ * @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.
538
+ * @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.
539
+ * @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.
540
+ * @param aspect The aspects for which to included in event history, specified as multiple occurrences of this query parameter.
541
+ * @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.
542
+ * @param reversePageTokenOrder When pagination via pageToken, by default, records with smaller pageToken (i.e. older records) will be returned first. When this parameter is set to &#x60;true&#x60;, higher pageToken records (newer records) will be returned.
543
+ */
544
+ history(xMagdaTenantId: number, recordId: string, xMagdaSession: string, pageToken?: string, start?: number, limit?: number, aspect?: Array<string>, dereference?: boolean, reversePageTokenOrder?: boolean): Promise<{
545
+ response: Response;
546
+ body: EventsPage;
547
+ }>;
548
+ /**
549
+ * Get the version of a record that existed after a given event was applied
550
+ *
551
+ * @param xMagdaTenantId 0
552
+ * @param recordId ID of the record to fetch.
553
+ * @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.
554
+ */
555
+ version(xMagdaTenantId: number, recordId: string, eventId: string): Promise<{
556
+ response: Response;
557
+ body: Record_2;
558
+ }>;
559
+ }
560
+
561
+ declare enum RecordHistoryApiApiKeys {
562
+ }
563
+
564
+ declare class RecordsApi {
565
+ protected basePath: string;
566
+ protected defaultHeaders: any;
567
+ protected authentications: any;
568
+ constructor(basePath?: string);
569
+ setApiKey(key: RecordsApiApiKeys, value: string): void;
570
+ /**
571
+ * Create a new record
572
+ *
573
+ * @param xMagdaTenantId 0
574
+ * @param record The definition of the new record.
575
+ * @param xMagdaSession Magda internal session id
576
+ */
577
+ create(xMagdaTenantId: number, record: Record_2, xMagdaSession: string): Promise<{
578
+ response: Response;
579
+ body: Record_2;
580
+ }>;
581
+ /**
582
+ * Delete a record
583
+ *
584
+ * @param xMagdaTenantId 0
585
+ * @param recordId ID of the record to delete.
586
+ * @param xMagdaSession Magda internal session id
587
+ */
588
+ deleteById(xMagdaTenantId: number, recordId: string, xMagdaSession: string): Promise<{
589
+ response: Response;
590
+ body: DeleteResult;
591
+ }>;
592
+ /**
593
+ * Remove items from records&#39; aspect data
594
+ * Remove items from records&#39; aspect data
595
+ * @param xMagdaTenantId 0
596
+ * @param aspectId ID of the aspect to update.
597
+ * @param requestData An json object has key &#39;recordIds&#39;, &#39;jsonPath&#39;, &#39;items&#39;
598
+ * @param xMagdaSession Magda internal session id
599
+ */
600
+ deleteRecordsAspectArrayItems(xMagdaTenantId: number, aspectId: string, requestData: DeleteRecordsAspectArrayItemsRequest, xMagdaSession: string): Promise<{
601
+ response: Response;
602
+ body: Array<any>;
603
+ }>;
604
+ /**
605
+ * Get a list of all records
606
+ *
607
+ * @param xMagdaTenantId 0
608
+ * @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.
609
+ * @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.
610
+ * @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.
611
+ * @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.
612
+ * @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.
613
+ * @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.
614
+ * @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
615
+ * @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
616
+ * @param orderBy Specify the field to sort the result. Aspect field can be supported in a format like aspectId.path.to.field
617
+ * @param orderByDir Specify the order by direction. Either &#x60;asc&#x60; or &#x60;desc&#x60;
618
+ * @param orderNullFirst Specify whether nulls appear before (&#x60;true&#x60;) or after (&#x60;false&#x60;) non-null values in the sort ordering.
619
+ * @param reversePageTokenOrder When pagination via pageToken, by default, records with smaller pageToken (i.e. older records) will be returned first. When this parameter is set to &#x60;true&#x60;, higher pageToken records (newer records) will be returned.
620
+ * @param q full text search query
621
+ * @param xMagdaSession Magda internal session id
622
+ */
623
+ 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, reversePageTokenOrder?: boolean, q?: string, xMagdaSession?: string): Promise<{
624
+ response: Response;
625
+ body: Array<Record_2>;
626
+ }>;
627
+ /**
628
+ * Get a list of all records as summaries
629
+ *
630
+ * @param xMagdaTenantId 0
631
+ * @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.
632
+ * @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.
633
+ * @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.
634
+ * @param reversePageTokenOrder When pagination via pageToken, by default, records with smaller pageToken (i.e. older records) will be returned first. When this parameter is set to &#x60;true&#x60;, higher pageToken records (newer records) will be returned.
635
+ * @param q full text search query
636
+ * @param xMagdaSession Magda internal session id
637
+ */
638
+ getAllSummary(xMagdaTenantId: number, pageToken?: string, start?: number, limit?: number, reversePageTokenOrder?: boolean, q?: string, xMagdaSession?: string): Promise<{
639
+ response: Response;
640
+ body: Array<RecordSummary>;
641
+ }>;
642
+ /**
643
+ * Get a record by ID
644
+ * Gets a complete record, including data for all aspects.
645
+ * @param id ID of the record to be fetched.
646
+ * @param xMagdaTenantId 0
647
+ * @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.
648
+ * @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.
649
+ * @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.
650
+ * @param xMagdaSession Magda internal session id
651
+ */
652
+ getById(id: string, xMagdaTenantId: number, aspect?: Array<string>, optionalAspect?: Array<string>, dereference?: boolean, xMagdaSession?: string): Promise<{
653
+ response: Response;
654
+ body: Record_2;
655
+ }>;
656
+ /**
657
+ * Get a record in full by ID
658
+ * Get a record with all attached aspects data by the record ID.
659
+ * @param id ID of the record to be fetched.
660
+ * @param xMagdaTenantId 0
661
+ * @param xMagdaSession Magda internal session id
662
+ */
663
+ getByIdInFull(id: string, xMagdaTenantId: number, xMagdaSession?: string): Promise<{
664
+ response: Response;
665
+ body: Record_2;
666
+ }>;
667
+ /**
668
+ * Get a summary record by ID
669
+ * Gets a summary record, including all the aspect ids for which this record has data.
670
+ * @param id ID of the record to be fetched.
671
+ * @param xMagdaTenantId 0
672
+ * @param xMagdaSession Magda internal session id
673
+ */
674
+ getByIdSummary(id: string, xMagdaTenantId: number, xMagdaSession?: string): Promise<{
675
+ response: Response;
676
+ body: RecordSummary;
677
+ }>;
678
+ /**
679
+ * Get the count of records matching the parameters. If no parameters are specified, the count will be approximate for performance reasons.
680
+ *
681
+ * @param xMagdaTenantId 0
682
+ * @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.
683
+ * @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
684
+ * @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.
685
+ * @param q full text search query
686
+ * @param xMagdaSession Magda internal session id
687
+ */
688
+ getCount(xMagdaTenantId: number, aspect?: Array<string>, aspectQuery?: Array<string>, aspectOrQuery?: Array<string>, q?: string, xMagdaSession?: string): Promise<{
689
+ response: Response;
690
+ body: CountResponse;
691
+ }>;
692
+ /**
693
+ * Get a list tokens for paging through the records
694
+ *
695
+ * @param xMagdaTenantId 0
696
+ * @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.
697
+ * @param limit The size of each page to get tokens for.
698
+ * @param xMagdaSession Magda internal session id
699
+ */
700
+ getPageTokens(xMagdaTenantId: number, aspect?: Array<string>, limit?: number, xMagdaSession?: string): Promise<{
701
+ response: Response;
702
+ body: Array<string>;
703
+ }>;
704
+ /**
705
+ * Modify a record by applying a JSON Patch
706
+ * The patch should follow IETF RFC 6902 (https://tools.ietf.org/html/rfc6902).
707
+ * @param xMagdaTenantId 0
708
+ * @param id ID of the record to be pacthed.
709
+ * @param recordPatch The RFC 6902 patch to apply to the aspect.
710
+ * @param xMagdaSession Magda internal session id
711
+ */
712
+ patchById(xMagdaTenantId: number, id: string, recordPatch: Array<Operation>, xMagdaSession: string): Promise<{
713
+ response: Response;
714
+ body: Record_2;
715
+ }>;
716
+ /**
717
+ * Modify a list of records by applying the same JSON Patch
718
+ * The patch should follow IETF RFC 6902 (https://tools.ietf.org/html/rfc6902).
719
+ * @param xMagdaTenantId 0
720
+ * @param requestData An json object has key &#39;recordIds&#39; &amp; &#39;jsonPath&#39;
721
+ * @param xMagdaSession Magda internal session id
722
+ */
723
+ patchRecords(xMagdaTenantId: number, requestData: PatchRecordsRequest, xMagdaSession: string): Promise<{
724
+ response: Response;
725
+ body: Array<any>;
726
+ }>;
727
+ /**
728
+ * Modify a record by ID
729
+ * Modifies a record. Aspects included in the request are created or updated, but missing aspects are not removed.
730
+ * @param xMagdaTenantId 0
731
+ * @param id ID of the record to be fetched.
732
+ * @param record The record to save.
733
+ * @param xMagdaSession Magda internal session id
734
+ * @param merge Whether merge the supplied aspect data to existing aspect data or replace it
735
+ */
736
+ putById(xMagdaTenantId: number, id: string, record: Record_2, xMagdaSession: string, merge?: boolean): Promise<{
737
+ response: Response;
738
+ body: Record_2;
739
+ }>;
740
+ /**
741
+ * Modify a list of records&#39;s aspect with same new data
742
+ * Modify a list of records&#39;s aspect with same new data
743
+ * @param xMagdaTenantId 0
744
+ * @param aspectId ID of the aspect to update.
745
+ * @param requestData An json object has key &#39;recordIds&#39; &amp; &#39;data&#39;
746
+ * @param xMagdaSession Magda internal session id
747
+ * @param merge Whether merge the supplied aspect data to existing aspect data or replace it
748
+ */
749
+ putRecordsAspect(xMagdaTenantId: number, aspectId: string, requestData: PutRecordsAspectRequest, xMagdaSession: string, merge?: boolean): Promise<{
750
+ response: Response;
751
+ body: Array<any>;
752
+ }>;
753
+ /**
754
+ * Trim by source tag
755
+ * Trims records with the provided source that DON&#39;T have the supplied source tag
756
+ * @param xMagdaTenantId 0
757
+ * @param sourceTagToPreserve Source tag of the records to PRESERVE.
758
+ * @param sourceId Source id of the records to delete.
759
+ * @param xMagdaSession Magda internal session id
760
+ */
761
+ trimBySourceTag(xMagdaTenantId: number, sourceTagToPreserve: string, sourceId: string, xMagdaSession: string): Promise<{
762
+ response: Response;
763
+ body: MultipleDeleteResult;
764
+ }>;
765
+ }
766
+
767
+ declare enum RecordsApiApiKeys {
768
+ }
769
+
770
+ declare interface RecordsPage<I extends Record_2> {
771
+ totalCount: number;
772
+ hasMore: boolean;
773
+ nextPageToken?: string;
774
+ records: I[];
775
+ }
776
+
777
+ /**
778
+ * A summary of a record in the registry. Summaries specify which aspects are available, but do not include data for any aspects.
779
+ */
780
+ declare class RecordSummary {
781
+ /**
782
+ * The identifier of the record
783
+ */
784
+ 'id': string;
785
+ /**
786
+ * The name of the record
787
+ */
788
+ 'name': string;
789
+ /**
790
+ * The list of aspect IDs for which this record has data
791
+ */
792
+ 'aspects': Array<string>;
793
+ /**
794
+ * The identifier of the tenant
795
+ */
796
+ 'tenantId': number;
797
+ }
798
+
799
+ declare class RegistryClient {
800
+ protected baseUri: URI_2;
801
+ protected aspectDefinitionsApi: AspectDefinitionsApi;
802
+ protected recordsApi: RecordsApi;
803
+ protected webHooksApi: WebHooksApi;
804
+ protected recordAspectsApi: RecordAspectsApi;
805
+ protected recordHistoryApi: RecordHistoryApi;
806
+ protected maxRetries: number;
807
+ protected secondsBetweenRetries: number;
808
+ protected tenantId: number;
809
+ protected jwt: string | undefined;
810
+ constructor({ baseUrl, maxRetries, secondsBetweenRetries, tenantId }: RegistryOptions);
811
+ getRecordUrl(id: string): string;
812
+ getAspectDefinitions(): Promise<AspectDefinition[] | ServerError>;
813
+ getAspectDefinition(aspectId: string, jwtToken?: string): Promise<AspectDefinition>;
814
+ getRecord(id: string, aspect?: Array<string>, optionalAspect?: Array<string>, dereference?: boolean): Promise<Record_2 | ServerError>;
815
+ getRecordAspect(id: string, aspectId: string): Promise<any | ServerError>;
816
+ getRecordInFull(id: string): Promise<Record_2>;
817
+ 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, reversePageTokenOrder?: boolean, q?: string): Promise<RecordsPage<I> | ServerError>;
818
+ getRecordsPageTokens(aspect?: Array<string>, limit?: number): Promise<string[] | ServerError>;
819
+ }
820
+
821
+ declare class RegistryEvent {
822
+ 'id': any;
823
+ 'eventTime': Date;
824
+ 'eventType': EventType;
825
+ 'userId': string;
826
+ 'data': JsObject;
827
+ 'tenantId': number;
828
+ }
829
+
830
+ declare interface RegistryOptions {
831
+ baseUrl: string;
832
+ maxRetries?: number;
833
+ secondsBetweenRetries?: number;
834
+ tenantId: number;
835
+ }
836
+
202
837
  declare function semanticIndexer(userConfig: SemanticIndexerOptions): Promise<void>;
203
838
  export default semanticIndexer;
204
839
 
205
840
  declare interface SemanticIndexerArguments extends MinionArguments {
841
+ opensearchApiURL: string;
842
+ embeddingApiURL: string;
206
843
  semanticIndexerConfig: SemanticIndexerConfig;
207
844
  minioConfig: MinioConfig;
845
+ minioAccessKey: string;
846
+ minioSecretKey: string;
847
+ registryReadonlyURL: string;
208
848
  }
209
849
 
210
850
  declare interface SemanticIndexerConfig {
211
- semanticIndexer: {
212
- chunkSizeLimit: number;
213
- overlap: number;
214
- bulkEmbeddingsSize: number;
215
- bulkIndexSize: number;
216
- opensearch: OpensearchConfig;
217
- embeddingApi: EmbeddingApiConfig;
851
+ numberOfShards: number;
852
+ numberOfReplicas: number;
853
+ indexName: string;
854
+ indexVersion: number;
855
+ chunkSizeLimit: number;
856
+ overlap: number;
857
+ bulkEmbeddingsSize: number;
858
+ bulkIndexSize: number;
859
+ fullIndexName?: string;
860
+ knnVectorFieldConfig: {
861
+ mode: string;
862
+ dimension: number;
863
+ spaceType: string;
864
+ efConstruction: number;
865
+ efSearch: number;
866
+ m: number;
867
+ encoder?: {
868
+ name: string;
869
+ type: string;
870
+ clip: boolean;
871
+ };
872
+ compressionLevel?: string;
218
873
  };
219
874
  }
220
875
 
@@ -230,6 +885,147 @@ export declare interface SemanticIndexerOptions {
230
885
  chunkSizeLimit?: number;
231
886
  overlap?: number;
232
887
  autoDownloadFile?: boolean;
888
+ timeout?: string;
889
+ }
890
+
891
+ declare class ServerError extends Error {
892
+ statusCode: number;
893
+ constructor(message?: string, statusCode?: number);
894
+ toData(): {
895
+ isError: boolean;
896
+ errorCode: number;
897
+ errorMessage: string;
898
+ };
899
+ }
900
+
901
+ declare class WebHook {
902
+ 'id': string;
903
+ 'name': string;
904
+ 'active': boolean;
905
+ 'lastEvent': any;
906
+ 'url': string;
907
+ 'eventTypes': Array<EventType>;
908
+ 'isWaitingForResponse': any;
909
+ 'config': WebHookConfig;
910
+ 'enabled': boolean;
911
+ 'lastRetryTime': Date;
912
+ 'retryCount': number;
913
+ 'isRunning': any;
914
+ 'isProcessing': any;
915
+ 'ownerId': string;
916
+ 'creatorId': string;
917
+ 'editorId': string;
918
+ 'createTime': Date;
919
+ 'editTime': Date;
920
+ }
921
+
922
+ /**
923
+ * Asynchronously acknowledges receipt of a web hook notification.
924
+ */
925
+ declare class WebHookAcknowledgement {
926
+ /**
927
+ * 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.
928
+ */
929
+ 'succeeded': boolean;
930
+ /**
931
+ * 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.
932
+ */
933
+ 'lastEventIdReceived': any;
934
+ /**
935
+ * Should the webhook be active or inactive?
936
+ */
937
+ 'active': any;
938
+ }
939
+
940
+ /**
941
+ * The response to an asynchronous web hook acknowledgement.
942
+ */
943
+ declare class WebHookAcknowledgementResponse {
944
+ /**
945
+ * The ID of the last event successfully received by the listener. Further notifications will start after this event.
946
+ */
947
+ 'lastEventIdReceived': number;
948
+ }
949
+
950
+ declare class WebHookConfig {
951
+ 'aspects': Array<string>;
952
+ 'optionalAspects': Array<string>;
953
+ 'includeEvents': any;
954
+ 'includeRecords': any;
955
+ 'includeAspectDefinitions': any;
956
+ 'dereference': any;
957
+ }
958
+
959
+ declare class WebHooksApi {
960
+ protected basePath: string;
961
+ protected defaultHeaders: any;
962
+ protected authentications: any;
963
+ constructor(basePath?: string);
964
+ setApiKey(key: WebHooksApiApiKeys, value: string): void;
965
+ /**
966
+ * Acknowledge a previously-deferred web hook
967
+ * 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.
968
+ * @param id ID of the web hook to be acknowledged.
969
+ * @param acknowledgement The details of the acknowledgement.
970
+ * @param xMagdaSession Magda internal session id
971
+ */
972
+ ack(id: string, acknowledgement: WebHookAcknowledgement, xMagdaSession: string): Promise<{
973
+ response: Response;
974
+ body: WebHookAcknowledgementResponse;
975
+ }>;
976
+ /**
977
+ * Create a new web hook
978
+ *
979
+ * @param hook The definition of the new web hook.
980
+ * @param xMagdaSession Magda internal session id
981
+ */
982
+ create(hook: WebHook, xMagdaSession: string): Promise<{
983
+ response: Response;
984
+ body: WebHook;
985
+ }>;
986
+ /**
987
+ * Delete a web hook
988
+ *
989
+ * @param hookId ID of the web hook to delete.
990
+ * @param xMagdaSession Magda internal session id
991
+ */
992
+ deleteById(hookId: string, xMagdaSession: string): Promise<{
993
+ response: Response;
994
+ body: DeleteResult;
995
+ }>;
996
+ /**
997
+ * Get a list of all web hooks
998
+ *
999
+ * @param xMagdaSession Magda internal session id
1000
+ */
1001
+ getAll(xMagdaSession: string): Promise<{
1002
+ response: Response;
1003
+ body: Array<WebHook>;
1004
+ }>;
1005
+ /**
1006
+ * Get a web hook by ID
1007
+ *
1008
+ * @param id ID of the web hook to be fetched.
1009
+ * @param xMagdaSession Magda internal session id
1010
+ */
1011
+ getById(id: string, xMagdaSession: string): Promise<{
1012
+ response: Response;
1013
+ body: WebHook;
1014
+ }>;
1015
+ /**
1016
+ * Modify a web hook by ID
1017
+ * Modifies the web hook with a given ID. If a web hook with the ID does not yet exist, it is created.
1018
+ * @param id ID of the aspect to be saved.
1019
+ * @param hook The web hook to save.
1020
+ * @param xMagdaSession Magda internal session id
1021
+ */
1022
+ putById(id: string, hook: WebHook, xMagdaSession: string): Promise<{
1023
+ response: Response;
1024
+ body: WebHook;
1025
+ }>;
1026
+ }
1027
+
1028
+ declare enum WebHooksApiApiKeys {
233
1029
  }
234
1030
 
235
1031
  export { }