@okf/ootils 1.3.6 → 1.3.8
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.
- package/dist/node.d.mts +297 -3
- package/dist/node.d.ts +297 -3
- package/dist/node.js +627 -270
- package/dist/node.mjs +648 -270
- package/package.json +3 -1
package/dist/node.d.mts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import { Connection, Document, Schema, Model } from 'mongoose';
|
|
1
|
+
import mongoose, { Connection, Document, Schema, Model, Types } from 'mongoose';
|
|
2
2
|
import IORedis from 'ioredis';
|
|
3
|
+
import * as bullmq from 'bullmq';
|
|
4
|
+
import { Queue } from 'bullmq/dist/esm/classes/queue';
|
|
5
|
+
import { Worker } from 'bullmq/dist/esm/classes/worker';
|
|
3
6
|
|
|
4
7
|
declare const deleteVal: (data: any, valuePath: string) => any;
|
|
5
8
|
|
|
@@ -242,9 +245,10 @@ interface GetModelShortParams {
|
|
|
242
245
|
connectTo?: string[];
|
|
243
246
|
};
|
|
244
247
|
};
|
|
248
|
+
modelName?: string;
|
|
245
249
|
}
|
|
246
250
|
declare const getModelByTenant: <T extends Document = Document>({ tenant, modelName, schema, env, }: GetModelByTenantParams) => Model<T>;
|
|
247
|
-
declare const getAnnotationsModelByTenant: ({ tenant, env, mongodb, dbConfigs }: GetModelShortParams) => Model<Document<unknown, any, any, Record<string, any>>, {}, {}, {}, Document<unknown, {}, Document<unknown, any, any, Record<string, any>>, {}> & Document<unknown, any, any, Record<string, any>> & Required<{
|
|
251
|
+
declare const getAnnotationsModelByTenant: ({ tenant, env, mongodb, dbConfigs, modelName }: GetModelShortParams) => Model<Document<unknown, any, any, Record<string, any>>, {}, {}, {}, Document<unknown, {}, Document<unknown, any, any, Record<string, any>>, {}> & Document<unknown, any, any, Record<string, any>> & Required<{
|
|
248
252
|
_id: unknown;
|
|
249
253
|
}> & {
|
|
250
254
|
__v: number;
|
|
@@ -259,6 +263,11 @@ declare const getTplModelByTenant: ({ tenant, env, mongodb, dbConfigs }: GetMode
|
|
|
259
263
|
}> & {
|
|
260
264
|
__v: number;
|
|
261
265
|
}, any>;
|
|
266
|
+
declare const getAIChatModelByTenant: ({ tenant, env, mongodb, dbConfigs }: GetModelShortParams) => Model<Document<unknown, any, any, Record<string, any>>, {}, {}, {}, Document<unknown, {}, Document<unknown, any, any, Record<string, any>>, {}> & Document<unknown, any, any, Record<string, any>> & Required<{
|
|
267
|
+
_id: unknown;
|
|
268
|
+
}> & {
|
|
269
|
+
__v: number;
|
|
270
|
+
}, any>;
|
|
262
271
|
|
|
263
272
|
interface GetTplParams {
|
|
264
273
|
name: string;
|
|
@@ -295,4 +304,289 @@ declare const getAIConfigs: ({ tenant }: GetAIConfigsParams) => Promise<AIconfig
|
|
|
295
304
|
declare const connectToRedis: () => Promise<void>;
|
|
296
305
|
declare const getRedisClient: () => IORedis;
|
|
297
306
|
|
|
298
|
-
|
|
307
|
+
interface ITagData {
|
|
308
|
+
_id?: Types.ObjectId;
|
|
309
|
+
display: string;
|
|
310
|
+
tagId: string;
|
|
311
|
+
}
|
|
312
|
+
interface ITagCollection {
|
|
313
|
+
data: ITagData[];
|
|
314
|
+
collectionId: string;
|
|
315
|
+
}
|
|
316
|
+
interface IMeta {
|
|
317
|
+
contentType: string;
|
|
318
|
+
kp_contributed_by?: Types.ObjectId;
|
|
319
|
+
valuePath?: string;
|
|
320
|
+
documentId?: Types.ObjectId;
|
|
321
|
+
}
|
|
322
|
+
interface IAuthor {
|
|
323
|
+
id?: Types.ObjectId;
|
|
324
|
+
name?: string;
|
|
325
|
+
}
|
|
326
|
+
interface IFragment {
|
|
327
|
+
isLexical?: boolean;
|
|
328
|
+
editorState?: any;
|
|
329
|
+
allText?: string;
|
|
330
|
+
}
|
|
331
|
+
interface IAnnotations {
|
|
332
|
+
tags?: Map<string, ITagCollection>;
|
|
333
|
+
fragment?: IFragment;
|
|
334
|
+
annoKey?: string;
|
|
335
|
+
author?: IAuthor;
|
|
336
|
+
}
|
|
337
|
+
interface IAnnotation extends Document {
|
|
338
|
+
tags?: Map<string, ITagCollection>;
|
|
339
|
+
meta: IMeta;
|
|
340
|
+
main?: any;
|
|
341
|
+
annotations?: IAnnotations;
|
|
342
|
+
embeddings?: any[];
|
|
343
|
+
contentEnhancedText?: string;
|
|
344
|
+
clusterId?: string;
|
|
345
|
+
kp_date_published?: Date;
|
|
346
|
+
createdAt: Date;
|
|
347
|
+
updatedAt: Date;
|
|
348
|
+
topicId?: Types.ObjectId[];
|
|
349
|
+
translations?: any;
|
|
350
|
+
displayTitle: string;
|
|
351
|
+
getMainField(fieldPath?: string): any;
|
|
352
|
+
}
|
|
353
|
+
declare const AnnotationSchema: mongoose.Schema<IAnnotation, mongoose.Model<IAnnotation, any, any, any, mongoose.Document<unknown, any, IAnnotation, any> & IAnnotation & Required<{
|
|
354
|
+
_id: unknown;
|
|
355
|
+
}> & {
|
|
356
|
+
__v: number;
|
|
357
|
+
}, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, IAnnotation, mongoose.Document<unknown, {}, mongoose.FlatRecord<IAnnotation>, {}> & mongoose.FlatRecord<IAnnotation> & Required<{
|
|
358
|
+
_id: unknown;
|
|
359
|
+
}> & {
|
|
360
|
+
__v: number;
|
|
361
|
+
}>;
|
|
362
|
+
|
|
363
|
+
interface IMessage {
|
|
364
|
+
id: string;
|
|
365
|
+
author: "system" | "user" | "assistant";
|
|
366
|
+
content: {
|
|
367
|
+
type: string;
|
|
368
|
+
value: string;
|
|
369
|
+
};
|
|
370
|
+
vectorSearchInfo: {
|
|
371
|
+
chunks: typeof AnnotationSchema[];
|
|
372
|
+
};
|
|
373
|
+
args: {
|
|
374
|
+
query: string;
|
|
375
|
+
reframedQuery: string;
|
|
376
|
+
summary: object;
|
|
377
|
+
};
|
|
378
|
+
userFeedback: {
|
|
379
|
+
reaction: "positive" | "negative";
|
|
380
|
+
comments: string;
|
|
381
|
+
};
|
|
382
|
+
}
|
|
383
|
+
interface IAIChat extends Document {
|
|
384
|
+
userId: mongoose.Schema.Types.ObjectId;
|
|
385
|
+
createdAt: Date;
|
|
386
|
+
lastAcitivity: Date;
|
|
387
|
+
messages: IMessage[];
|
|
388
|
+
}
|
|
389
|
+
declare const AIChatSchema: mongoose.Schema<IAIChat, mongoose.Model<IAIChat, any, any, any, mongoose.Document<unknown, any, IAIChat, any> & IAIChat & Required<{
|
|
390
|
+
_id: unknown;
|
|
391
|
+
}> & {
|
|
392
|
+
__v: number;
|
|
393
|
+
}, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, IAIChat, mongoose.Document<unknown, {}, mongoose.FlatRecord<IAIChat>, {}> & mongoose.FlatRecord<IAIChat> & Required<{
|
|
394
|
+
_id: unknown;
|
|
395
|
+
}> & {
|
|
396
|
+
__v: number;
|
|
397
|
+
}>;
|
|
398
|
+
|
|
399
|
+
declare const platformConfigTypes: readonly ["roles", "nav", "deployment", "userAgreement", "localeData", "theme", "AI"];
|
|
400
|
+
type PlatformConfigType = typeof platformConfigTypes[number];
|
|
401
|
+
interface IPlatformConfig extends Document {
|
|
402
|
+
type: PlatformConfigType;
|
|
403
|
+
roles?: any[];
|
|
404
|
+
data?: any;
|
|
405
|
+
}
|
|
406
|
+
declare const PlatformConfigsSchema: mongoose.Schema<IPlatformConfig, mongoose.Model<IPlatformConfig, any, any, any, mongoose.Document<unknown, any, IPlatformConfig, any> & IPlatformConfig & Required<{
|
|
407
|
+
_id: unknown;
|
|
408
|
+
}> & {
|
|
409
|
+
__v: number;
|
|
410
|
+
}, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, IPlatformConfig, mongoose.Document<unknown, {}, mongoose.FlatRecord<IPlatformConfig>, {}> & mongoose.FlatRecord<IPlatformConfig> & Required<{
|
|
411
|
+
_id: unknown;
|
|
412
|
+
}> & {
|
|
413
|
+
__v: number;
|
|
414
|
+
}>;
|
|
415
|
+
|
|
416
|
+
interface IGeneral {
|
|
417
|
+
content?: {
|
|
418
|
+
title?: string;
|
|
419
|
+
singular?: string;
|
|
420
|
+
ctaText?: string;
|
|
421
|
+
listingDesc?: string;
|
|
422
|
+
};
|
|
423
|
+
allowQuickTagCreation?: {
|
|
424
|
+
enable?: boolean;
|
|
425
|
+
};
|
|
426
|
+
segment?: string;
|
|
427
|
+
settingsUIStyle?: string;
|
|
428
|
+
hasUpdateType?: boolean;
|
|
429
|
+
annotation?: {
|
|
430
|
+
enable?: boolean;
|
|
431
|
+
};
|
|
432
|
+
participantModule?: {
|
|
433
|
+
enable?: boolean;
|
|
434
|
+
};
|
|
435
|
+
formFieldNumbering?: {
|
|
436
|
+
enable?: boolean;
|
|
437
|
+
};
|
|
438
|
+
postPblRedirPath?: object;
|
|
439
|
+
templateIndex?: object;
|
|
440
|
+
sharing?: {
|
|
441
|
+
enable?: boolean;
|
|
442
|
+
trackShareCount?: boolean;
|
|
443
|
+
};
|
|
444
|
+
viewsCount?: {
|
|
445
|
+
enable?: boolean;
|
|
446
|
+
};
|
|
447
|
+
comments?: {
|
|
448
|
+
enable?: boolean;
|
|
449
|
+
};
|
|
450
|
+
reactions?: Map<string, {
|
|
451
|
+
enable?: boolean;
|
|
452
|
+
icon?: string;
|
|
453
|
+
}>;
|
|
454
|
+
csvExport?: {
|
|
455
|
+
enable?: boolean;
|
|
456
|
+
excludeFields?: any[];
|
|
457
|
+
enableUpdateExport?: boolean;
|
|
458
|
+
fieldsToSortAtEnd?: any[];
|
|
459
|
+
fetchBatches?: {
|
|
460
|
+
enable?: boolean;
|
|
461
|
+
batchSize?: number;
|
|
462
|
+
};
|
|
463
|
+
};
|
|
464
|
+
onboardingFlow?: object;
|
|
465
|
+
selfServeSurveyConfig?: object;
|
|
466
|
+
disableKPSettings?: boolean;
|
|
467
|
+
}
|
|
468
|
+
interface ITplDocument extends Document {
|
|
469
|
+
dateFirstPublished?: Date;
|
|
470
|
+
dateCreated?: Date;
|
|
471
|
+
dateLastPublished?: Date;
|
|
472
|
+
dateLastEdited?: Date;
|
|
473
|
+
status: 'unpublished' | 'editPublished' | 'published';
|
|
474
|
+
version: number;
|
|
475
|
+
versionPublishedBy?: mongoose.Schema.Types.ObjectId;
|
|
476
|
+
firstPublishedBy?: mongoose.Schema.Types.ObjectId;
|
|
477
|
+
kp_content_type: string;
|
|
478
|
+
category: string;
|
|
479
|
+
kp_settings: object[];
|
|
480
|
+
kp_templates?: object;
|
|
481
|
+
tplMeta?: object;
|
|
482
|
+
tplLocales?: object;
|
|
483
|
+
indexed?: object;
|
|
484
|
+
drafts?: {
|
|
485
|
+
active?: object;
|
|
486
|
+
};
|
|
487
|
+
rollbacks?: object;
|
|
488
|
+
listing?: object;
|
|
489
|
+
general?: IGeneral;
|
|
490
|
+
layout: string;
|
|
491
|
+
}
|
|
492
|
+
declare const TplSchema: mongoose.Schema<ITplDocument, mongoose.Model<ITplDocument, any, any, any, mongoose.Document<unknown, any, ITplDocument, any> & ITplDocument & Required<{
|
|
493
|
+
_id: unknown;
|
|
494
|
+
}> & {
|
|
495
|
+
__v: number;
|
|
496
|
+
}, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, ITplDocument, mongoose.Document<unknown, {}, mongoose.FlatRecord<ITplDocument>, {}> & mongoose.FlatRecord<ITplDocument> & Required<{
|
|
497
|
+
_id: unknown;
|
|
498
|
+
}> & {
|
|
499
|
+
__v: number;
|
|
500
|
+
}>;
|
|
501
|
+
|
|
502
|
+
declare class WorkerManager {
|
|
503
|
+
constructor(workers?: any[]);
|
|
504
|
+
workers: any[];
|
|
505
|
+
activeWorkers: any[];
|
|
506
|
+
startAllWorkers(): any[];
|
|
507
|
+
shutdown(): Promise<void>;
|
|
508
|
+
getStatus(): {
|
|
509
|
+
name: any;
|
|
510
|
+
queueId: any;
|
|
511
|
+
isActive: boolean;
|
|
512
|
+
}[];
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
declare class BaseProducer {
|
|
516
|
+
constructor(config: any);
|
|
517
|
+
config: any;
|
|
518
|
+
queue: Queue<any, any, string, any, any, string>;
|
|
519
|
+
execute(params: any): Promise<void>;
|
|
520
|
+
addBulkJobs(jobs: any): Promise<bullmq.Job<any, any, string>[]>;
|
|
521
|
+
addJob(name: any, data: any, opts?: {}): Promise<bullmq.Job<any, any, string>>;
|
|
522
|
+
getStatus(): Promise<{
|
|
523
|
+
waiting: number;
|
|
524
|
+
active: number;
|
|
525
|
+
completed: number;
|
|
526
|
+
failed: number;
|
|
527
|
+
total: number;
|
|
528
|
+
}>;
|
|
529
|
+
getJobDetails(limit?: number): Promise<{
|
|
530
|
+
waiting: {
|
|
531
|
+
id: any;
|
|
532
|
+
batchIndex: any;
|
|
533
|
+
totalBatches: any;
|
|
534
|
+
rawRecordsCount: any;
|
|
535
|
+
}[];
|
|
536
|
+
active: {
|
|
537
|
+
id: any;
|
|
538
|
+
batchIndex: any;
|
|
539
|
+
totalBatches: any;
|
|
540
|
+
progress: any;
|
|
541
|
+
rawRecordsCount: any;
|
|
542
|
+
}[];
|
|
543
|
+
completed: {
|
|
544
|
+
id: any;
|
|
545
|
+
batchIndex: any;
|
|
546
|
+
totalProcessed: any;
|
|
547
|
+
summary: any;
|
|
548
|
+
}[];
|
|
549
|
+
failed: {
|
|
550
|
+
id: any;
|
|
551
|
+
batchIndex: any;
|
|
552
|
+
error: any;
|
|
553
|
+
attempts: any;
|
|
554
|
+
}[];
|
|
555
|
+
}>;
|
|
556
|
+
stop(): Promise<void>;
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
declare class BaseWorker {
|
|
560
|
+
constructor(config: any);
|
|
561
|
+
config: any;
|
|
562
|
+
worker: Worker<any, void, string> | null;
|
|
563
|
+
execute(job: any): Promise<void>;
|
|
564
|
+
start(): Worker<any, void, string>;
|
|
565
|
+
setupEventHandlers(): void;
|
|
566
|
+
onCompleted(job: any, returnValue: any): void;
|
|
567
|
+
onFailed(job: any, err: any): void;
|
|
568
|
+
onProgress(job: any, progress: any): void;
|
|
569
|
+
onError(error: any): void;
|
|
570
|
+
stop(): Promise<void>;
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
/**
|
|
574
|
+
* Creates BullMQ configuration with explicit dependencies
|
|
575
|
+
* @param {Object} params Configuration parameters
|
|
576
|
+
* @param {string} params.env Environment (staging, production, etc.)
|
|
577
|
+
* @param {Object} params.redisCredentials Redis connection details
|
|
578
|
+
* @param {string} params.redisCredentials.REDIS_HOST Redis host
|
|
579
|
+
* @param {number} params.redisCredentials.REDIS_PORT Redis port
|
|
580
|
+
* @param {string} params.redisCredentials.REDIS_PASSWORD Redis password
|
|
581
|
+
* @returns {Object} Complete BullMQ configuration
|
|
582
|
+
*/
|
|
583
|
+
declare function GET_GLOBAL_BULLMQ_CONFIG({ env, redisCredentials }: {
|
|
584
|
+
env: string;
|
|
585
|
+
redisCredentials: {
|
|
586
|
+
REDIS_HOST: string;
|
|
587
|
+
REDIS_PORT: number;
|
|
588
|
+
REDIS_PASSWORD: string;
|
|
589
|
+
};
|
|
590
|
+
}): Object;
|
|
591
|
+
|
|
592
|
+
export { AIChatSchema, AnnotationSchema, BaseProducer, BaseWorker, GET_GLOBAL_BULLMQ_CONFIG, PlatformConfigsSchema, TplSchema, WorkerManager, connectToRedis, deleteVal, extractAllBlocksFromTpl, genTagId, getAIChatModelByTenant, getAIConfigs, getAnnotationsModelByTenant, getDbByTenant, getModelByTenant, getPlatformConfigsModelByTenant, getRedisClient, getTpl, getTplModelByTenant, getVal, initializeGlobalConfig, multiConnectToMongoDB, _recursExtractBlocks as recursivelyExtractBlocks, setVal, toArray, updateGlobalConfig };
|
package/dist/node.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import { Connection, Document, Schema, Model } from 'mongoose';
|
|
1
|
+
import mongoose, { Connection, Document, Schema, Model, Types } from 'mongoose';
|
|
2
2
|
import IORedis from 'ioredis';
|
|
3
|
+
import * as bullmq from 'bullmq';
|
|
4
|
+
import { Queue } from 'bullmq/dist/esm/classes/queue';
|
|
5
|
+
import { Worker } from 'bullmq/dist/esm/classes/worker';
|
|
3
6
|
|
|
4
7
|
declare const deleteVal: (data: any, valuePath: string) => any;
|
|
5
8
|
|
|
@@ -242,9 +245,10 @@ interface GetModelShortParams {
|
|
|
242
245
|
connectTo?: string[];
|
|
243
246
|
};
|
|
244
247
|
};
|
|
248
|
+
modelName?: string;
|
|
245
249
|
}
|
|
246
250
|
declare const getModelByTenant: <T extends Document = Document>({ tenant, modelName, schema, env, }: GetModelByTenantParams) => Model<T>;
|
|
247
|
-
declare const getAnnotationsModelByTenant: ({ tenant, env, mongodb, dbConfigs }: GetModelShortParams) => Model<Document<unknown, any, any, Record<string, any>>, {}, {}, {}, Document<unknown, {}, Document<unknown, any, any, Record<string, any>>, {}> & Document<unknown, any, any, Record<string, any>> & Required<{
|
|
251
|
+
declare const getAnnotationsModelByTenant: ({ tenant, env, mongodb, dbConfigs, modelName }: GetModelShortParams) => Model<Document<unknown, any, any, Record<string, any>>, {}, {}, {}, Document<unknown, {}, Document<unknown, any, any, Record<string, any>>, {}> & Document<unknown, any, any, Record<string, any>> & Required<{
|
|
248
252
|
_id: unknown;
|
|
249
253
|
}> & {
|
|
250
254
|
__v: number;
|
|
@@ -259,6 +263,11 @@ declare const getTplModelByTenant: ({ tenant, env, mongodb, dbConfigs }: GetMode
|
|
|
259
263
|
}> & {
|
|
260
264
|
__v: number;
|
|
261
265
|
}, any>;
|
|
266
|
+
declare const getAIChatModelByTenant: ({ tenant, env, mongodb, dbConfigs }: GetModelShortParams) => Model<Document<unknown, any, any, Record<string, any>>, {}, {}, {}, Document<unknown, {}, Document<unknown, any, any, Record<string, any>>, {}> & Document<unknown, any, any, Record<string, any>> & Required<{
|
|
267
|
+
_id: unknown;
|
|
268
|
+
}> & {
|
|
269
|
+
__v: number;
|
|
270
|
+
}, any>;
|
|
262
271
|
|
|
263
272
|
interface GetTplParams {
|
|
264
273
|
name: string;
|
|
@@ -295,4 +304,289 @@ declare const getAIConfigs: ({ tenant }: GetAIConfigsParams) => Promise<AIconfig
|
|
|
295
304
|
declare const connectToRedis: () => Promise<void>;
|
|
296
305
|
declare const getRedisClient: () => IORedis;
|
|
297
306
|
|
|
298
|
-
|
|
307
|
+
interface ITagData {
|
|
308
|
+
_id?: Types.ObjectId;
|
|
309
|
+
display: string;
|
|
310
|
+
tagId: string;
|
|
311
|
+
}
|
|
312
|
+
interface ITagCollection {
|
|
313
|
+
data: ITagData[];
|
|
314
|
+
collectionId: string;
|
|
315
|
+
}
|
|
316
|
+
interface IMeta {
|
|
317
|
+
contentType: string;
|
|
318
|
+
kp_contributed_by?: Types.ObjectId;
|
|
319
|
+
valuePath?: string;
|
|
320
|
+
documentId?: Types.ObjectId;
|
|
321
|
+
}
|
|
322
|
+
interface IAuthor {
|
|
323
|
+
id?: Types.ObjectId;
|
|
324
|
+
name?: string;
|
|
325
|
+
}
|
|
326
|
+
interface IFragment {
|
|
327
|
+
isLexical?: boolean;
|
|
328
|
+
editorState?: any;
|
|
329
|
+
allText?: string;
|
|
330
|
+
}
|
|
331
|
+
interface IAnnotations {
|
|
332
|
+
tags?: Map<string, ITagCollection>;
|
|
333
|
+
fragment?: IFragment;
|
|
334
|
+
annoKey?: string;
|
|
335
|
+
author?: IAuthor;
|
|
336
|
+
}
|
|
337
|
+
interface IAnnotation extends Document {
|
|
338
|
+
tags?: Map<string, ITagCollection>;
|
|
339
|
+
meta: IMeta;
|
|
340
|
+
main?: any;
|
|
341
|
+
annotations?: IAnnotations;
|
|
342
|
+
embeddings?: any[];
|
|
343
|
+
contentEnhancedText?: string;
|
|
344
|
+
clusterId?: string;
|
|
345
|
+
kp_date_published?: Date;
|
|
346
|
+
createdAt: Date;
|
|
347
|
+
updatedAt: Date;
|
|
348
|
+
topicId?: Types.ObjectId[];
|
|
349
|
+
translations?: any;
|
|
350
|
+
displayTitle: string;
|
|
351
|
+
getMainField(fieldPath?: string): any;
|
|
352
|
+
}
|
|
353
|
+
declare const AnnotationSchema: mongoose.Schema<IAnnotation, mongoose.Model<IAnnotation, any, any, any, mongoose.Document<unknown, any, IAnnotation, any> & IAnnotation & Required<{
|
|
354
|
+
_id: unknown;
|
|
355
|
+
}> & {
|
|
356
|
+
__v: number;
|
|
357
|
+
}, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, IAnnotation, mongoose.Document<unknown, {}, mongoose.FlatRecord<IAnnotation>, {}> & mongoose.FlatRecord<IAnnotation> & Required<{
|
|
358
|
+
_id: unknown;
|
|
359
|
+
}> & {
|
|
360
|
+
__v: number;
|
|
361
|
+
}>;
|
|
362
|
+
|
|
363
|
+
interface IMessage {
|
|
364
|
+
id: string;
|
|
365
|
+
author: "system" | "user" | "assistant";
|
|
366
|
+
content: {
|
|
367
|
+
type: string;
|
|
368
|
+
value: string;
|
|
369
|
+
};
|
|
370
|
+
vectorSearchInfo: {
|
|
371
|
+
chunks: typeof AnnotationSchema[];
|
|
372
|
+
};
|
|
373
|
+
args: {
|
|
374
|
+
query: string;
|
|
375
|
+
reframedQuery: string;
|
|
376
|
+
summary: object;
|
|
377
|
+
};
|
|
378
|
+
userFeedback: {
|
|
379
|
+
reaction: "positive" | "negative";
|
|
380
|
+
comments: string;
|
|
381
|
+
};
|
|
382
|
+
}
|
|
383
|
+
interface IAIChat extends Document {
|
|
384
|
+
userId: mongoose.Schema.Types.ObjectId;
|
|
385
|
+
createdAt: Date;
|
|
386
|
+
lastAcitivity: Date;
|
|
387
|
+
messages: IMessage[];
|
|
388
|
+
}
|
|
389
|
+
declare const AIChatSchema: mongoose.Schema<IAIChat, mongoose.Model<IAIChat, any, any, any, mongoose.Document<unknown, any, IAIChat, any> & IAIChat & Required<{
|
|
390
|
+
_id: unknown;
|
|
391
|
+
}> & {
|
|
392
|
+
__v: number;
|
|
393
|
+
}, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, IAIChat, mongoose.Document<unknown, {}, mongoose.FlatRecord<IAIChat>, {}> & mongoose.FlatRecord<IAIChat> & Required<{
|
|
394
|
+
_id: unknown;
|
|
395
|
+
}> & {
|
|
396
|
+
__v: number;
|
|
397
|
+
}>;
|
|
398
|
+
|
|
399
|
+
declare const platformConfigTypes: readonly ["roles", "nav", "deployment", "userAgreement", "localeData", "theme", "AI"];
|
|
400
|
+
type PlatformConfigType = typeof platformConfigTypes[number];
|
|
401
|
+
interface IPlatformConfig extends Document {
|
|
402
|
+
type: PlatformConfigType;
|
|
403
|
+
roles?: any[];
|
|
404
|
+
data?: any;
|
|
405
|
+
}
|
|
406
|
+
declare const PlatformConfigsSchema: mongoose.Schema<IPlatformConfig, mongoose.Model<IPlatformConfig, any, any, any, mongoose.Document<unknown, any, IPlatformConfig, any> & IPlatformConfig & Required<{
|
|
407
|
+
_id: unknown;
|
|
408
|
+
}> & {
|
|
409
|
+
__v: number;
|
|
410
|
+
}, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, IPlatformConfig, mongoose.Document<unknown, {}, mongoose.FlatRecord<IPlatformConfig>, {}> & mongoose.FlatRecord<IPlatformConfig> & Required<{
|
|
411
|
+
_id: unknown;
|
|
412
|
+
}> & {
|
|
413
|
+
__v: number;
|
|
414
|
+
}>;
|
|
415
|
+
|
|
416
|
+
interface IGeneral {
|
|
417
|
+
content?: {
|
|
418
|
+
title?: string;
|
|
419
|
+
singular?: string;
|
|
420
|
+
ctaText?: string;
|
|
421
|
+
listingDesc?: string;
|
|
422
|
+
};
|
|
423
|
+
allowQuickTagCreation?: {
|
|
424
|
+
enable?: boolean;
|
|
425
|
+
};
|
|
426
|
+
segment?: string;
|
|
427
|
+
settingsUIStyle?: string;
|
|
428
|
+
hasUpdateType?: boolean;
|
|
429
|
+
annotation?: {
|
|
430
|
+
enable?: boolean;
|
|
431
|
+
};
|
|
432
|
+
participantModule?: {
|
|
433
|
+
enable?: boolean;
|
|
434
|
+
};
|
|
435
|
+
formFieldNumbering?: {
|
|
436
|
+
enable?: boolean;
|
|
437
|
+
};
|
|
438
|
+
postPblRedirPath?: object;
|
|
439
|
+
templateIndex?: object;
|
|
440
|
+
sharing?: {
|
|
441
|
+
enable?: boolean;
|
|
442
|
+
trackShareCount?: boolean;
|
|
443
|
+
};
|
|
444
|
+
viewsCount?: {
|
|
445
|
+
enable?: boolean;
|
|
446
|
+
};
|
|
447
|
+
comments?: {
|
|
448
|
+
enable?: boolean;
|
|
449
|
+
};
|
|
450
|
+
reactions?: Map<string, {
|
|
451
|
+
enable?: boolean;
|
|
452
|
+
icon?: string;
|
|
453
|
+
}>;
|
|
454
|
+
csvExport?: {
|
|
455
|
+
enable?: boolean;
|
|
456
|
+
excludeFields?: any[];
|
|
457
|
+
enableUpdateExport?: boolean;
|
|
458
|
+
fieldsToSortAtEnd?: any[];
|
|
459
|
+
fetchBatches?: {
|
|
460
|
+
enable?: boolean;
|
|
461
|
+
batchSize?: number;
|
|
462
|
+
};
|
|
463
|
+
};
|
|
464
|
+
onboardingFlow?: object;
|
|
465
|
+
selfServeSurveyConfig?: object;
|
|
466
|
+
disableKPSettings?: boolean;
|
|
467
|
+
}
|
|
468
|
+
interface ITplDocument extends Document {
|
|
469
|
+
dateFirstPublished?: Date;
|
|
470
|
+
dateCreated?: Date;
|
|
471
|
+
dateLastPublished?: Date;
|
|
472
|
+
dateLastEdited?: Date;
|
|
473
|
+
status: 'unpublished' | 'editPublished' | 'published';
|
|
474
|
+
version: number;
|
|
475
|
+
versionPublishedBy?: mongoose.Schema.Types.ObjectId;
|
|
476
|
+
firstPublishedBy?: mongoose.Schema.Types.ObjectId;
|
|
477
|
+
kp_content_type: string;
|
|
478
|
+
category: string;
|
|
479
|
+
kp_settings: object[];
|
|
480
|
+
kp_templates?: object;
|
|
481
|
+
tplMeta?: object;
|
|
482
|
+
tplLocales?: object;
|
|
483
|
+
indexed?: object;
|
|
484
|
+
drafts?: {
|
|
485
|
+
active?: object;
|
|
486
|
+
};
|
|
487
|
+
rollbacks?: object;
|
|
488
|
+
listing?: object;
|
|
489
|
+
general?: IGeneral;
|
|
490
|
+
layout: string;
|
|
491
|
+
}
|
|
492
|
+
declare const TplSchema: mongoose.Schema<ITplDocument, mongoose.Model<ITplDocument, any, any, any, mongoose.Document<unknown, any, ITplDocument, any> & ITplDocument & Required<{
|
|
493
|
+
_id: unknown;
|
|
494
|
+
}> & {
|
|
495
|
+
__v: number;
|
|
496
|
+
}, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, ITplDocument, mongoose.Document<unknown, {}, mongoose.FlatRecord<ITplDocument>, {}> & mongoose.FlatRecord<ITplDocument> & Required<{
|
|
497
|
+
_id: unknown;
|
|
498
|
+
}> & {
|
|
499
|
+
__v: number;
|
|
500
|
+
}>;
|
|
501
|
+
|
|
502
|
+
declare class WorkerManager {
|
|
503
|
+
constructor(workers?: any[]);
|
|
504
|
+
workers: any[];
|
|
505
|
+
activeWorkers: any[];
|
|
506
|
+
startAllWorkers(): any[];
|
|
507
|
+
shutdown(): Promise<void>;
|
|
508
|
+
getStatus(): {
|
|
509
|
+
name: any;
|
|
510
|
+
queueId: any;
|
|
511
|
+
isActive: boolean;
|
|
512
|
+
}[];
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
declare class BaseProducer {
|
|
516
|
+
constructor(config: any);
|
|
517
|
+
config: any;
|
|
518
|
+
queue: Queue<any, any, string, any, any, string>;
|
|
519
|
+
execute(params: any): Promise<void>;
|
|
520
|
+
addBulkJobs(jobs: any): Promise<bullmq.Job<any, any, string>[]>;
|
|
521
|
+
addJob(name: any, data: any, opts?: {}): Promise<bullmq.Job<any, any, string>>;
|
|
522
|
+
getStatus(): Promise<{
|
|
523
|
+
waiting: number;
|
|
524
|
+
active: number;
|
|
525
|
+
completed: number;
|
|
526
|
+
failed: number;
|
|
527
|
+
total: number;
|
|
528
|
+
}>;
|
|
529
|
+
getJobDetails(limit?: number): Promise<{
|
|
530
|
+
waiting: {
|
|
531
|
+
id: any;
|
|
532
|
+
batchIndex: any;
|
|
533
|
+
totalBatches: any;
|
|
534
|
+
rawRecordsCount: any;
|
|
535
|
+
}[];
|
|
536
|
+
active: {
|
|
537
|
+
id: any;
|
|
538
|
+
batchIndex: any;
|
|
539
|
+
totalBatches: any;
|
|
540
|
+
progress: any;
|
|
541
|
+
rawRecordsCount: any;
|
|
542
|
+
}[];
|
|
543
|
+
completed: {
|
|
544
|
+
id: any;
|
|
545
|
+
batchIndex: any;
|
|
546
|
+
totalProcessed: any;
|
|
547
|
+
summary: any;
|
|
548
|
+
}[];
|
|
549
|
+
failed: {
|
|
550
|
+
id: any;
|
|
551
|
+
batchIndex: any;
|
|
552
|
+
error: any;
|
|
553
|
+
attempts: any;
|
|
554
|
+
}[];
|
|
555
|
+
}>;
|
|
556
|
+
stop(): Promise<void>;
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
declare class BaseWorker {
|
|
560
|
+
constructor(config: any);
|
|
561
|
+
config: any;
|
|
562
|
+
worker: Worker<any, void, string> | null;
|
|
563
|
+
execute(job: any): Promise<void>;
|
|
564
|
+
start(): Worker<any, void, string>;
|
|
565
|
+
setupEventHandlers(): void;
|
|
566
|
+
onCompleted(job: any, returnValue: any): void;
|
|
567
|
+
onFailed(job: any, err: any): void;
|
|
568
|
+
onProgress(job: any, progress: any): void;
|
|
569
|
+
onError(error: any): void;
|
|
570
|
+
stop(): Promise<void>;
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
/**
|
|
574
|
+
* Creates BullMQ configuration with explicit dependencies
|
|
575
|
+
* @param {Object} params Configuration parameters
|
|
576
|
+
* @param {string} params.env Environment (staging, production, etc.)
|
|
577
|
+
* @param {Object} params.redisCredentials Redis connection details
|
|
578
|
+
* @param {string} params.redisCredentials.REDIS_HOST Redis host
|
|
579
|
+
* @param {number} params.redisCredentials.REDIS_PORT Redis port
|
|
580
|
+
* @param {string} params.redisCredentials.REDIS_PASSWORD Redis password
|
|
581
|
+
* @returns {Object} Complete BullMQ configuration
|
|
582
|
+
*/
|
|
583
|
+
declare function GET_GLOBAL_BULLMQ_CONFIG({ env, redisCredentials }: {
|
|
584
|
+
env: string;
|
|
585
|
+
redisCredentials: {
|
|
586
|
+
REDIS_HOST: string;
|
|
587
|
+
REDIS_PORT: number;
|
|
588
|
+
REDIS_PASSWORD: string;
|
|
589
|
+
};
|
|
590
|
+
}): Object;
|
|
591
|
+
|
|
592
|
+
export { AIChatSchema, AnnotationSchema, BaseProducer, BaseWorker, GET_GLOBAL_BULLMQ_CONFIG, PlatformConfigsSchema, TplSchema, WorkerManager, connectToRedis, deleteVal, extractAllBlocksFromTpl, genTagId, getAIChatModelByTenant, getAIConfigs, getAnnotationsModelByTenant, getDbByTenant, getModelByTenant, getPlatformConfigsModelByTenant, getRedisClient, getTpl, getTplModelByTenant, getVal, initializeGlobalConfig, multiConnectToMongoDB, _recursExtractBlocks as recursivelyExtractBlocks, setVal, toArray, updateGlobalConfig };
|