@okf/ootils 1.3.5 → 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/browser.d.mts +27 -1
- package/dist/browser.d.ts +27 -1
- package/dist/browser.js +2 -0
- package/dist/browser.mjs +1 -0
- package/dist/node.d.mts +230 -3
- package/dist/node.d.ts +230 -3
- package/dist/node.js +333 -295
- package/dist/node.mjs +327 -303
- package/dist/universal.d.mts +27 -1
- package/dist/universal.d.ts +27 -1
- package/dist/universal.js +2 -0
- package/dist/universal.mjs +1 -0
- package/package.json +2 -1
package/dist/browser.d.mts
CHANGED
|
@@ -124,5 +124,31 @@ declare const extractAllBlocksFromTpl: ({ tpl, buildersWhitelist }: {
|
|
|
124
124
|
tpl: Template;
|
|
125
125
|
buildersWhitelist?: BuilderType[];
|
|
126
126
|
}) => ExtractedBlock[];
|
|
127
|
+
/**
|
|
128
|
+
* Recursively extracts blocks from a hierarchical data structure.
|
|
129
|
+
*
|
|
130
|
+
* This is the core traversal function that handles nested sections and blocks.
|
|
131
|
+
* It preserves two critical pieces of metadata:
|
|
132
|
+
*
|
|
133
|
+
* 1. **sectionStack**: Array of parent sections - Essential for display condition handling.
|
|
134
|
+
* When sections have display conditions, we need to know which blocks belong to
|
|
135
|
+
* hidden sections to exclude them from indexes and processing.
|
|
136
|
+
*
|
|
137
|
+
* 2. **blockPath**: Dot-notation path to the block's location - Required for precise updates.
|
|
138
|
+
* Used when modifying block properties or updating valuePaths in display conditions.
|
|
139
|
+
* See 'modifyValuesAndValuePaths' for detailed usage.
|
|
140
|
+
*
|
|
141
|
+
* @param {Object} params - Extraction parameters
|
|
142
|
+
* @param {Block[]} params.data - Array of blocks/sections to process
|
|
143
|
+
* @param {Function} params.cb - Callback function to handle each extracted block
|
|
144
|
+
* @param {Section[]} params.sectionStack - Current stack of parent sections
|
|
145
|
+
* @param {string} params.blockPathPrefix - Current path prefix for building blockPath
|
|
146
|
+
*/
|
|
147
|
+
declare const _recursExtractBlocks: ({ data, cb, sectionStack, blockPathPrefix }: {
|
|
148
|
+
data: Block[];
|
|
149
|
+
cb: (block: ExtractedBlock) => void;
|
|
150
|
+
sectionStack?: Section[];
|
|
151
|
+
blockPathPrefix?: string;
|
|
152
|
+
}) => void;
|
|
127
153
|
|
|
128
|
-
export { deleteVal, extractAllBlocksFromTpl, genTagId, getVal, setVal, toArray };
|
|
154
|
+
export { deleteVal, extractAllBlocksFromTpl, genTagId, getVal, _recursExtractBlocks as recursivelyExtractBlocks, setVal, toArray };
|
package/dist/browser.d.ts
CHANGED
|
@@ -124,5 +124,31 @@ declare const extractAllBlocksFromTpl: ({ tpl, buildersWhitelist }: {
|
|
|
124
124
|
tpl: Template;
|
|
125
125
|
buildersWhitelist?: BuilderType[];
|
|
126
126
|
}) => ExtractedBlock[];
|
|
127
|
+
/**
|
|
128
|
+
* Recursively extracts blocks from a hierarchical data structure.
|
|
129
|
+
*
|
|
130
|
+
* This is the core traversal function that handles nested sections and blocks.
|
|
131
|
+
* It preserves two critical pieces of metadata:
|
|
132
|
+
*
|
|
133
|
+
* 1. **sectionStack**: Array of parent sections - Essential for display condition handling.
|
|
134
|
+
* When sections have display conditions, we need to know which blocks belong to
|
|
135
|
+
* hidden sections to exclude them from indexes and processing.
|
|
136
|
+
*
|
|
137
|
+
* 2. **blockPath**: Dot-notation path to the block's location - Required for precise updates.
|
|
138
|
+
* Used when modifying block properties or updating valuePaths in display conditions.
|
|
139
|
+
* See 'modifyValuesAndValuePaths' for detailed usage.
|
|
140
|
+
*
|
|
141
|
+
* @param {Object} params - Extraction parameters
|
|
142
|
+
* @param {Block[]} params.data - Array of blocks/sections to process
|
|
143
|
+
* @param {Function} params.cb - Callback function to handle each extracted block
|
|
144
|
+
* @param {Section[]} params.sectionStack - Current stack of parent sections
|
|
145
|
+
* @param {string} params.blockPathPrefix - Current path prefix for building blockPath
|
|
146
|
+
*/
|
|
147
|
+
declare const _recursExtractBlocks: ({ data, cb, sectionStack, blockPathPrefix }: {
|
|
148
|
+
data: Block[];
|
|
149
|
+
cb: (block: ExtractedBlock) => void;
|
|
150
|
+
sectionStack?: Section[];
|
|
151
|
+
blockPathPrefix?: string;
|
|
152
|
+
}) => void;
|
|
127
153
|
|
|
128
|
-
export { deleteVal, extractAllBlocksFromTpl, genTagId, getVal, setVal, toArray };
|
|
154
|
+
export { deleteVal, extractAllBlocksFromTpl, genTagId, getVal, _recursExtractBlocks as recursivelyExtractBlocks, setVal, toArray };
|
package/dist/browser.js
CHANGED
|
@@ -24,6 +24,7 @@ __export(browser_exports, {
|
|
|
24
24
|
extractAllBlocksFromTpl: () => extractAllBlocksFromTpl,
|
|
25
25
|
genTagId: () => genTagId,
|
|
26
26
|
getVal: () => getVal,
|
|
27
|
+
recursivelyExtractBlocks: () => _recursExtractBlocks,
|
|
27
28
|
setVal: () => setVal,
|
|
28
29
|
toArray: () => toArray
|
|
29
30
|
});
|
|
@@ -309,6 +310,7 @@ var _extractBlocksFromSomeBuilders = ({
|
|
|
309
310
|
extractAllBlocksFromTpl,
|
|
310
311
|
genTagId,
|
|
311
312
|
getVal,
|
|
313
|
+
recursivelyExtractBlocks,
|
|
312
314
|
setVal,
|
|
313
315
|
toArray
|
|
314
316
|
});
|
package/dist/browser.mjs
CHANGED
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;
|
|
@@ -127,6 +127,32 @@ declare const extractAllBlocksFromTpl: ({ tpl, buildersWhitelist }: {
|
|
|
127
127
|
tpl: Template$1;
|
|
128
128
|
buildersWhitelist?: BuilderType[];
|
|
129
129
|
}) => ExtractedBlock[];
|
|
130
|
+
/**
|
|
131
|
+
* Recursively extracts blocks from a hierarchical data structure.
|
|
132
|
+
*
|
|
133
|
+
* This is the core traversal function that handles nested sections and blocks.
|
|
134
|
+
* It preserves two critical pieces of metadata:
|
|
135
|
+
*
|
|
136
|
+
* 1. **sectionStack**: Array of parent sections - Essential for display condition handling.
|
|
137
|
+
* When sections have display conditions, we need to know which blocks belong to
|
|
138
|
+
* hidden sections to exclude them from indexes and processing.
|
|
139
|
+
*
|
|
140
|
+
* 2. **blockPath**: Dot-notation path to the block's location - Required for precise updates.
|
|
141
|
+
* Used when modifying block properties or updating valuePaths in display conditions.
|
|
142
|
+
* See 'modifyValuesAndValuePaths' for detailed usage.
|
|
143
|
+
*
|
|
144
|
+
* @param {Object} params - Extraction parameters
|
|
145
|
+
* @param {Block[]} params.data - Array of blocks/sections to process
|
|
146
|
+
* @param {Function} params.cb - Callback function to handle each extracted block
|
|
147
|
+
* @param {Section[]} params.sectionStack - Current stack of parent sections
|
|
148
|
+
* @param {string} params.blockPathPrefix - Current path prefix for building blockPath
|
|
149
|
+
*/
|
|
150
|
+
declare const _recursExtractBlocks: ({ data, cb, sectionStack, blockPathPrefix }: {
|
|
151
|
+
data: Block[];
|
|
152
|
+
cb: (block: ExtractedBlock) => void;
|
|
153
|
+
sectionStack?: Section[];
|
|
154
|
+
blockPathPrefix?: string;
|
|
155
|
+
}) => void;
|
|
130
156
|
|
|
131
157
|
interface DbConnections {
|
|
132
158
|
[clusterName: string]: Connection;
|
|
@@ -216,9 +242,10 @@ interface GetModelShortParams {
|
|
|
216
242
|
connectTo?: string[];
|
|
217
243
|
};
|
|
218
244
|
};
|
|
245
|
+
modelName?: string;
|
|
219
246
|
}
|
|
220
247
|
declare const getModelByTenant: <T extends Document = Document>({ tenant, modelName, schema, env, }: GetModelByTenantParams) => Model<T>;
|
|
221
|
-
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<{
|
|
222
249
|
_id: unknown;
|
|
223
250
|
}> & {
|
|
224
251
|
__v: number;
|
|
@@ -233,6 +260,11 @@ declare const getTplModelByTenant: ({ tenant, env, mongodb, dbConfigs }: GetMode
|
|
|
233
260
|
}> & {
|
|
234
261
|
__v: number;
|
|
235
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>;
|
|
236
268
|
|
|
237
269
|
interface GetTplParams {
|
|
238
270
|
name: string;
|
|
@@ -269,4 +301,199 @@ declare const getAIConfigs: ({ tenant }: GetAIConfigsParams) => Promise<AIconfig
|
|
|
269
301
|
declare const connectToRedis: () => Promise<void>;
|
|
270
302
|
declare const getRedisClient: () => IORedis;
|
|
271
303
|
|
|
272
|
-
|
|
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;
|
|
@@ -127,6 +127,32 @@ declare const extractAllBlocksFromTpl: ({ tpl, buildersWhitelist }: {
|
|
|
127
127
|
tpl: Template$1;
|
|
128
128
|
buildersWhitelist?: BuilderType[];
|
|
129
129
|
}) => ExtractedBlock[];
|
|
130
|
+
/**
|
|
131
|
+
* Recursively extracts blocks from a hierarchical data structure.
|
|
132
|
+
*
|
|
133
|
+
* This is the core traversal function that handles nested sections and blocks.
|
|
134
|
+
* It preserves two critical pieces of metadata:
|
|
135
|
+
*
|
|
136
|
+
* 1. **sectionStack**: Array of parent sections - Essential for display condition handling.
|
|
137
|
+
* When sections have display conditions, we need to know which blocks belong to
|
|
138
|
+
* hidden sections to exclude them from indexes and processing.
|
|
139
|
+
*
|
|
140
|
+
* 2. **blockPath**: Dot-notation path to the block's location - Required for precise updates.
|
|
141
|
+
* Used when modifying block properties or updating valuePaths in display conditions.
|
|
142
|
+
* See 'modifyValuesAndValuePaths' for detailed usage.
|
|
143
|
+
*
|
|
144
|
+
* @param {Object} params - Extraction parameters
|
|
145
|
+
* @param {Block[]} params.data - Array of blocks/sections to process
|
|
146
|
+
* @param {Function} params.cb - Callback function to handle each extracted block
|
|
147
|
+
* @param {Section[]} params.sectionStack - Current stack of parent sections
|
|
148
|
+
* @param {string} params.blockPathPrefix - Current path prefix for building blockPath
|
|
149
|
+
*/
|
|
150
|
+
declare const _recursExtractBlocks: ({ data, cb, sectionStack, blockPathPrefix }: {
|
|
151
|
+
data: Block[];
|
|
152
|
+
cb: (block: ExtractedBlock) => void;
|
|
153
|
+
sectionStack?: Section[];
|
|
154
|
+
blockPathPrefix?: string;
|
|
155
|
+
}) => void;
|
|
130
156
|
|
|
131
157
|
interface DbConnections {
|
|
132
158
|
[clusterName: string]: Connection;
|
|
@@ -216,9 +242,10 @@ interface GetModelShortParams {
|
|
|
216
242
|
connectTo?: string[];
|
|
217
243
|
};
|
|
218
244
|
};
|
|
245
|
+
modelName?: string;
|
|
219
246
|
}
|
|
220
247
|
declare const getModelByTenant: <T extends Document = Document>({ tenant, modelName, schema, env, }: GetModelByTenantParams) => Model<T>;
|
|
221
|
-
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<{
|
|
222
249
|
_id: unknown;
|
|
223
250
|
}> & {
|
|
224
251
|
__v: number;
|
|
@@ -233,6 +260,11 @@ declare const getTplModelByTenant: ({ tenant, env, mongodb, dbConfigs }: GetMode
|
|
|
233
260
|
}> & {
|
|
234
261
|
__v: number;
|
|
235
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>;
|
|
236
268
|
|
|
237
269
|
interface GetTplParams {
|
|
238
270
|
name: string;
|
|
@@ -269,4 +301,199 @@ declare const getAIConfigs: ({ tenant }: GetAIConfigsParams) => Promise<AIconfig
|
|
|
269
301
|
declare const connectToRedis: () => Promise<void>;
|
|
270
302
|
declare const getRedisClient: () => IORedis;
|
|
271
303
|
|
|
272
|
-
|
|
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 };
|