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