@okf/ootils 1.3.6 → 1.3.7

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 CHANGED
@@ -1,4 +1,4 @@
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
3
 
4
4
  declare const deleteVal: (data: any, valuePath: string) => any;
@@ -242,9 +242,10 @@ interface GetModelShortParams {
242
242
  connectTo?: string[];
243
243
  };
244
244
  };
245
+ modelName?: string;
245
246
  }
246
247
  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<{
248
+ 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
249
  _id: unknown;
249
250
  }> & {
250
251
  __v: number;
@@ -259,6 +260,11 @@ declare const getTplModelByTenant: ({ tenant, env, mongodb, dbConfigs }: GetMode
259
260
  }> & {
260
261
  __v: number;
261
262
  }, any>;
263
+ 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<{
264
+ _id: unknown;
265
+ }> & {
266
+ __v: number;
267
+ }, any>;
262
268
 
263
269
  interface GetTplParams {
264
270
  name: string;
@@ -295,4 +301,199 @@ declare const getAIConfigs: ({ tenant }: GetAIConfigsParams) => Promise<AIconfig
295
301
  declare const connectToRedis: () => Promise<void>;
296
302
  declare const getRedisClient: () => IORedis;
297
303
 
298
- export { connectToRedis, deleteVal, extractAllBlocksFromTpl, genTagId, getAIConfigs, getAnnotationsModelByTenant, getDbByTenant, getModelByTenant, getPlatformConfigsModelByTenant, getRedisClient, getTpl, getTplModelByTenant, getVal, initializeGlobalConfig, multiConnectToMongoDB, _recursExtractBlocks as recursivelyExtractBlocks, setVal, toArray, updateGlobalConfig };
304
+ interface ITagData {
305
+ _id?: Types.ObjectId;
306
+ display: string;
307
+ tagId: string;
308
+ }
309
+ interface ITagCollection {
310
+ data: ITagData[];
311
+ collectionId: string;
312
+ }
313
+ interface IMeta {
314
+ contentType: string;
315
+ kp_contributed_by?: Types.ObjectId;
316
+ valuePath?: string;
317
+ documentId?: Types.ObjectId;
318
+ }
319
+ interface IAuthor {
320
+ id?: Types.ObjectId;
321
+ name?: string;
322
+ }
323
+ interface IFragment {
324
+ isLexical?: boolean;
325
+ editorState?: any;
326
+ allText?: string;
327
+ }
328
+ interface IAnnotations {
329
+ tags?: Map<string, ITagCollection>;
330
+ fragment?: IFragment;
331
+ annoKey?: string;
332
+ author?: IAuthor;
333
+ }
334
+ interface IAnnotation extends Document {
335
+ tags?: Map<string, ITagCollection>;
336
+ meta: IMeta;
337
+ main?: any;
338
+ annotations?: IAnnotations;
339
+ embeddings?: any[];
340
+ contentEnhancedText?: string;
341
+ clusterId?: string;
342
+ kp_date_published?: Date;
343
+ createdAt: Date;
344
+ updatedAt: Date;
345
+ topicId?: Types.ObjectId[];
346
+ translations?: any;
347
+ displayTitle: string;
348
+ getMainField(fieldPath?: string): any;
349
+ }
350
+ declare const AnnotationSchema: mongoose.Schema<IAnnotation, mongoose.Model<IAnnotation, any, any, any, mongoose.Document<unknown, any, IAnnotation, any> & IAnnotation & Required<{
351
+ _id: unknown;
352
+ }> & {
353
+ __v: number;
354
+ }, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, IAnnotation, mongoose.Document<unknown, {}, mongoose.FlatRecord<IAnnotation>, {}> & mongoose.FlatRecord<IAnnotation> & Required<{
355
+ _id: unknown;
356
+ }> & {
357
+ __v: number;
358
+ }>;
359
+
360
+ interface IMessage {
361
+ id: string;
362
+ author: "system" | "user" | "assistant";
363
+ content: {
364
+ type: string;
365
+ value: string;
366
+ };
367
+ vectorSearchInfo: {
368
+ chunks: typeof AnnotationSchema[];
369
+ };
370
+ args: {
371
+ query: string;
372
+ reframedQuery: string;
373
+ summary: object;
374
+ };
375
+ userFeedback: {
376
+ reaction: "positive" | "negative";
377
+ comments: string;
378
+ };
379
+ }
380
+ interface IAIChat extends Document {
381
+ userId: mongoose.Schema.Types.ObjectId;
382
+ createdAt: Date;
383
+ lastAcitivity: Date;
384
+ messages: IMessage[];
385
+ }
386
+ declare const AIChatSchema: mongoose.Schema<IAIChat, mongoose.Model<IAIChat, any, any, any, mongoose.Document<unknown, any, IAIChat, any> & IAIChat & Required<{
387
+ _id: unknown;
388
+ }> & {
389
+ __v: number;
390
+ }, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, IAIChat, mongoose.Document<unknown, {}, mongoose.FlatRecord<IAIChat>, {}> & mongoose.FlatRecord<IAIChat> & Required<{
391
+ _id: unknown;
392
+ }> & {
393
+ __v: number;
394
+ }>;
395
+
396
+ declare const platformConfigTypes: readonly ["roles", "nav", "deployment", "userAgreement", "localeData", "theme", "AI"];
397
+ type PlatformConfigType = typeof platformConfigTypes[number];
398
+ interface IPlatformConfig extends Document {
399
+ type: PlatformConfigType;
400
+ roles?: any[];
401
+ data?: any;
402
+ }
403
+ declare const PlatformConfigsSchema: mongoose.Schema<IPlatformConfig, mongoose.Model<IPlatformConfig, any, any, any, mongoose.Document<unknown, any, IPlatformConfig, any> & IPlatformConfig & Required<{
404
+ _id: unknown;
405
+ }> & {
406
+ __v: number;
407
+ }, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, IPlatformConfig, mongoose.Document<unknown, {}, mongoose.FlatRecord<IPlatformConfig>, {}> & mongoose.FlatRecord<IPlatformConfig> & Required<{
408
+ _id: unknown;
409
+ }> & {
410
+ __v: number;
411
+ }>;
412
+
413
+ interface IGeneral {
414
+ content?: {
415
+ title?: string;
416
+ singular?: string;
417
+ ctaText?: string;
418
+ listingDesc?: string;
419
+ };
420
+ allowQuickTagCreation?: {
421
+ enable?: boolean;
422
+ };
423
+ segment?: string;
424
+ settingsUIStyle?: string;
425
+ hasUpdateType?: boolean;
426
+ annotation?: {
427
+ enable?: boolean;
428
+ };
429
+ participantModule?: {
430
+ enable?: boolean;
431
+ };
432
+ formFieldNumbering?: {
433
+ enable?: boolean;
434
+ };
435
+ postPblRedirPath?: object;
436
+ templateIndex?: object;
437
+ sharing?: {
438
+ enable?: boolean;
439
+ trackShareCount?: boolean;
440
+ };
441
+ viewsCount?: {
442
+ enable?: boolean;
443
+ };
444
+ comments?: {
445
+ enable?: boolean;
446
+ };
447
+ reactions?: Map<string, {
448
+ enable?: boolean;
449
+ icon?: string;
450
+ }>;
451
+ csvExport?: {
452
+ enable?: boolean;
453
+ excludeFields?: any[];
454
+ enableUpdateExport?: boolean;
455
+ fieldsToSortAtEnd?: any[];
456
+ fetchBatches?: {
457
+ enable?: boolean;
458
+ batchSize?: number;
459
+ };
460
+ };
461
+ onboardingFlow?: object;
462
+ selfServeSurveyConfig?: object;
463
+ disableKPSettings?: boolean;
464
+ }
465
+ interface ITplDocument extends Document {
466
+ dateFirstPublished?: Date;
467
+ dateCreated?: Date;
468
+ dateLastPublished?: Date;
469
+ dateLastEdited?: Date;
470
+ status: 'unpublished' | 'editPublished' | 'published';
471
+ version: number;
472
+ versionPublishedBy?: mongoose.Schema.Types.ObjectId;
473
+ firstPublishedBy?: mongoose.Schema.Types.ObjectId;
474
+ kp_content_type: string;
475
+ category: string;
476
+ kp_settings: object[];
477
+ kp_templates?: object;
478
+ tplMeta?: object;
479
+ tplLocales?: object;
480
+ indexed?: object;
481
+ drafts?: {
482
+ active?: object;
483
+ };
484
+ rollbacks?: object;
485
+ listing?: object;
486
+ general?: IGeneral;
487
+ layout: string;
488
+ }
489
+ declare const TplSchema: mongoose.Schema<ITplDocument, mongoose.Model<ITplDocument, any, any, any, mongoose.Document<unknown, any, ITplDocument, any> & ITplDocument & Required<{
490
+ _id: unknown;
491
+ }> & {
492
+ __v: number;
493
+ }, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, ITplDocument, mongoose.Document<unknown, {}, mongoose.FlatRecord<ITplDocument>, {}> & mongoose.FlatRecord<ITplDocument> & Required<{
494
+ _id: unknown;
495
+ }> & {
496
+ __v: number;
497
+ }>;
498
+
499
+ export { AIChatSchema, AnnotationSchema, PlatformConfigsSchema, TplSchema, 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,4 +1,4 @@
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
3
 
4
4
  declare const deleteVal: (data: any, valuePath: string) => any;
@@ -242,9 +242,10 @@ interface GetModelShortParams {
242
242
  connectTo?: string[];
243
243
  };
244
244
  };
245
+ modelName?: string;
245
246
  }
246
247
  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<{
248
+ 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
249
  _id: unknown;
249
250
  }> & {
250
251
  __v: number;
@@ -259,6 +260,11 @@ declare const getTplModelByTenant: ({ tenant, env, mongodb, dbConfigs }: GetMode
259
260
  }> & {
260
261
  __v: number;
261
262
  }, any>;
263
+ 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<{
264
+ _id: unknown;
265
+ }> & {
266
+ __v: number;
267
+ }, any>;
262
268
 
263
269
  interface GetTplParams {
264
270
  name: string;
@@ -295,4 +301,199 @@ declare const getAIConfigs: ({ tenant }: GetAIConfigsParams) => Promise<AIconfig
295
301
  declare const connectToRedis: () => Promise<void>;
296
302
  declare const getRedisClient: () => IORedis;
297
303
 
298
- export { connectToRedis, deleteVal, extractAllBlocksFromTpl, genTagId, getAIConfigs, getAnnotationsModelByTenant, getDbByTenant, getModelByTenant, getPlatformConfigsModelByTenant, getRedisClient, getTpl, getTplModelByTenant, getVal, initializeGlobalConfig, multiConnectToMongoDB, _recursExtractBlocks as recursivelyExtractBlocks, setVal, toArray, updateGlobalConfig };
304
+ interface ITagData {
305
+ _id?: Types.ObjectId;
306
+ display: string;
307
+ tagId: string;
308
+ }
309
+ interface ITagCollection {
310
+ data: ITagData[];
311
+ collectionId: string;
312
+ }
313
+ interface IMeta {
314
+ contentType: string;
315
+ kp_contributed_by?: Types.ObjectId;
316
+ valuePath?: string;
317
+ documentId?: Types.ObjectId;
318
+ }
319
+ interface IAuthor {
320
+ id?: Types.ObjectId;
321
+ name?: string;
322
+ }
323
+ interface IFragment {
324
+ isLexical?: boolean;
325
+ editorState?: any;
326
+ allText?: string;
327
+ }
328
+ interface IAnnotations {
329
+ tags?: Map<string, ITagCollection>;
330
+ fragment?: IFragment;
331
+ annoKey?: string;
332
+ author?: IAuthor;
333
+ }
334
+ interface IAnnotation extends Document {
335
+ tags?: Map<string, ITagCollection>;
336
+ meta: IMeta;
337
+ main?: any;
338
+ annotations?: IAnnotations;
339
+ embeddings?: any[];
340
+ contentEnhancedText?: string;
341
+ clusterId?: string;
342
+ kp_date_published?: Date;
343
+ createdAt: Date;
344
+ updatedAt: Date;
345
+ topicId?: Types.ObjectId[];
346
+ translations?: any;
347
+ displayTitle: string;
348
+ getMainField(fieldPath?: string): any;
349
+ }
350
+ declare const AnnotationSchema: mongoose.Schema<IAnnotation, mongoose.Model<IAnnotation, any, any, any, mongoose.Document<unknown, any, IAnnotation, any> & IAnnotation & Required<{
351
+ _id: unknown;
352
+ }> & {
353
+ __v: number;
354
+ }, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, IAnnotation, mongoose.Document<unknown, {}, mongoose.FlatRecord<IAnnotation>, {}> & mongoose.FlatRecord<IAnnotation> & Required<{
355
+ _id: unknown;
356
+ }> & {
357
+ __v: number;
358
+ }>;
359
+
360
+ interface IMessage {
361
+ id: string;
362
+ author: "system" | "user" | "assistant";
363
+ content: {
364
+ type: string;
365
+ value: string;
366
+ };
367
+ vectorSearchInfo: {
368
+ chunks: typeof AnnotationSchema[];
369
+ };
370
+ args: {
371
+ query: string;
372
+ reframedQuery: string;
373
+ summary: object;
374
+ };
375
+ userFeedback: {
376
+ reaction: "positive" | "negative";
377
+ comments: string;
378
+ };
379
+ }
380
+ interface IAIChat extends Document {
381
+ userId: mongoose.Schema.Types.ObjectId;
382
+ createdAt: Date;
383
+ lastAcitivity: Date;
384
+ messages: IMessage[];
385
+ }
386
+ declare const AIChatSchema: mongoose.Schema<IAIChat, mongoose.Model<IAIChat, any, any, any, mongoose.Document<unknown, any, IAIChat, any> & IAIChat & Required<{
387
+ _id: unknown;
388
+ }> & {
389
+ __v: number;
390
+ }, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, IAIChat, mongoose.Document<unknown, {}, mongoose.FlatRecord<IAIChat>, {}> & mongoose.FlatRecord<IAIChat> & Required<{
391
+ _id: unknown;
392
+ }> & {
393
+ __v: number;
394
+ }>;
395
+
396
+ declare const platformConfigTypes: readonly ["roles", "nav", "deployment", "userAgreement", "localeData", "theme", "AI"];
397
+ type PlatformConfigType = typeof platformConfigTypes[number];
398
+ interface IPlatformConfig extends Document {
399
+ type: PlatformConfigType;
400
+ roles?: any[];
401
+ data?: any;
402
+ }
403
+ declare const PlatformConfigsSchema: mongoose.Schema<IPlatformConfig, mongoose.Model<IPlatformConfig, any, any, any, mongoose.Document<unknown, any, IPlatformConfig, any> & IPlatformConfig & Required<{
404
+ _id: unknown;
405
+ }> & {
406
+ __v: number;
407
+ }, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, IPlatformConfig, mongoose.Document<unknown, {}, mongoose.FlatRecord<IPlatformConfig>, {}> & mongoose.FlatRecord<IPlatformConfig> & Required<{
408
+ _id: unknown;
409
+ }> & {
410
+ __v: number;
411
+ }>;
412
+
413
+ interface IGeneral {
414
+ content?: {
415
+ title?: string;
416
+ singular?: string;
417
+ ctaText?: string;
418
+ listingDesc?: string;
419
+ };
420
+ allowQuickTagCreation?: {
421
+ enable?: boolean;
422
+ };
423
+ segment?: string;
424
+ settingsUIStyle?: string;
425
+ hasUpdateType?: boolean;
426
+ annotation?: {
427
+ enable?: boolean;
428
+ };
429
+ participantModule?: {
430
+ enable?: boolean;
431
+ };
432
+ formFieldNumbering?: {
433
+ enable?: boolean;
434
+ };
435
+ postPblRedirPath?: object;
436
+ templateIndex?: object;
437
+ sharing?: {
438
+ enable?: boolean;
439
+ trackShareCount?: boolean;
440
+ };
441
+ viewsCount?: {
442
+ enable?: boolean;
443
+ };
444
+ comments?: {
445
+ enable?: boolean;
446
+ };
447
+ reactions?: Map<string, {
448
+ enable?: boolean;
449
+ icon?: string;
450
+ }>;
451
+ csvExport?: {
452
+ enable?: boolean;
453
+ excludeFields?: any[];
454
+ enableUpdateExport?: boolean;
455
+ fieldsToSortAtEnd?: any[];
456
+ fetchBatches?: {
457
+ enable?: boolean;
458
+ batchSize?: number;
459
+ };
460
+ };
461
+ onboardingFlow?: object;
462
+ selfServeSurveyConfig?: object;
463
+ disableKPSettings?: boolean;
464
+ }
465
+ interface ITplDocument extends Document {
466
+ dateFirstPublished?: Date;
467
+ dateCreated?: Date;
468
+ dateLastPublished?: Date;
469
+ dateLastEdited?: Date;
470
+ status: 'unpublished' | 'editPublished' | 'published';
471
+ version: number;
472
+ versionPublishedBy?: mongoose.Schema.Types.ObjectId;
473
+ firstPublishedBy?: mongoose.Schema.Types.ObjectId;
474
+ kp_content_type: string;
475
+ category: string;
476
+ kp_settings: object[];
477
+ kp_templates?: object;
478
+ tplMeta?: object;
479
+ tplLocales?: object;
480
+ indexed?: object;
481
+ drafts?: {
482
+ active?: object;
483
+ };
484
+ rollbacks?: object;
485
+ listing?: object;
486
+ general?: IGeneral;
487
+ layout: string;
488
+ }
489
+ declare const TplSchema: mongoose.Schema<ITplDocument, mongoose.Model<ITplDocument, any, any, any, mongoose.Document<unknown, any, ITplDocument, any> & ITplDocument & Required<{
490
+ _id: unknown;
491
+ }> & {
492
+ __v: number;
493
+ }, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, ITplDocument, mongoose.Document<unknown, {}, mongoose.FlatRecord<ITplDocument>, {}> & mongoose.FlatRecord<ITplDocument> & Required<{
494
+ _id: unknown;
495
+ }> & {
496
+ __v: number;
497
+ }>;
498
+
499
+ export { AIChatSchema, AnnotationSchema, PlatformConfigsSchema, TplSchema, connectToRedis, deleteVal, extractAllBlocksFromTpl, genTagId, getAIChatModelByTenant, getAIConfigs, getAnnotationsModelByTenant, getDbByTenant, getModelByTenant, getPlatformConfigsModelByTenant, getRedisClient, getTpl, getTplModelByTenant, getVal, initializeGlobalConfig, multiConnectToMongoDB, _recursExtractBlocks as recursivelyExtractBlocks, setVal, toArray, updateGlobalConfig };