@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 +204 -3
- package/dist/node.d.ts +204 -3
- package/dist/node.js +331 -295
- package/dist/node.mjs +326 -303
- package/package.json +2 -1
package/dist/node.js
CHANGED
|
@@ -5,9 +5,6 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __commonJS = (cb, mod) => function __require() {
|
|
9
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
|
-
};
|
|
11
8
|
var __export = (target, all) => {
|
|
12
9
|
for (var name in all)
|
|
13
10
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -30,297 +27,18 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
30
27
|
));
|
|
31
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
32
29
|
|
|
33
|
-
// src/models/Annotations.js
|
|
34
|
-
var require_Annotations = __commonJS({
|
|
35
|
-
"src/models/Annotations.js"(exports2, module2) {
|
|
36
|
-
"use strict";
|
|
37
|
-
var mongoose2 = require("mongoose");
|
|
38
|
-
var Schema = mongoose2.Schema;
|
|
39
|
-
var AnnotationSchema = new Schema(
|
|
40
|
-
{
|
|
41
|
-
// Tags section - dynamic structure for various tag categories
|
|
42
|
-
tags: {
|
|
43
|
-
type: Map,
|
|
44
|
-
of: new Schema({
|
|
45
|
-
data: [
|
|
46
|
-
{
|
|
47
|
-
_id: { type: Schema.Types.ObjectId },
|
|
48
|
-
display: String,
|
|
49
|
-
tagId: String
|
|
50
|
-
}
|
|
51
|
-
],
|
|
52
|
-
collectionId: String,
|
|
53
|
-
_id: false
|
|
54
|
-
})
|
|
55
|
-
},
|
|
56
|
-
// Meta information
|
|
57
|
-
meta: {
|
|
58
|
-
contentType: { type: String, required: true },
|
|
59
|
-
kp_contributed_by: {
|
|
60
|
-
type: Schema.Types.ObjectId,
|
|
61
|
-
ref: "user"
|
|
62
|
-
},
|
|
63
|
-
valuePath: String,
|
|
64
|
-
documentId: {
|
|
65
|
-
type: Schema.Types.ObjectId
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
// Main content data - using Schema.Types.Mixed for dynamic structure
|
|
69
|
-
main: {
|
|
70
|
-
type: Schema.Types.Mixed,
|
|
71
|
-
default: {}
|
|
72
|
-
},
|
|
73
|
-
// Annotation specific details
|
|
74
|
-
annotations: {
|
|
75
|
-
tags: {
|
|
76
|
-
type: Map,
|
|
77
|
-
_id: false,
|
|
78
|
-
of: new Schema({
|
|
79
|
-
collectionId: String,
|
|
80
|
-
data: [
|
|
81
|
-
{
|
|
82
|
-
_id: { type: Schema.Types.ObjectId },
|
|
83
|
-
display: String,
|
|
84
|
-
tagId: String
|
|
85
|
-
}
|
|
86
|
-
]
|
|
87
|
-
})
|
|
88
|
-
},
|
|
89
|
-
fragment: {
|
|
90
|
-
isLexical: Boolean,
|
|
91
|
-
editorState: Object,
|
|
92
|
-
allText: String
|
|
93
|
-
},
|
|
94
|
-
annoKey: String,
|
|
95
|
-
author: {
|
|
96
|
-
id: { type: Schema.Types.ObjectId },
|
|
97
|
-
name: String
|
|
98
|
-
}
|
|
99
|
-
},
|
|
100
|
-
embeddings: Array,
|
|
101
|
-
contentEnhancedText: String,
|
|
102
|
-
// // Optional chunk related fields
|
|
103
|
-
// chunk: {
|
|
104
|
-
// embeddings: Schema.Types.Mixed,
|
|
105
|
-
// contentEnhancedText: String
|
|
106
|
-
// },
|
|
107
|
-
clusterId: String,
|
|
108
|
-
kp_date_published: Date,
|
|
109
|
-
createdAt: {
|
|
110
|
-
type: Date,
|
|
111
|
-
default: Date.now
|
|
112
|
-
},
|
|
113
|
-
updatedAt: {
|
|
114
|
-
type: Date,
|
|
115
|
-
default: Date.now
|
|
116
|
-
},
|
|
117
|
-
translations: Object
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
timestamps: true,
|
|
121
|
-
toJSON: { virtuals: true },
|
|
122
|
-
toObject: { virtuals: true },
|
|
123
|
-
strict: false
|
|
124
|
-
// This allows for flexible document structure beyond the defined schema
|
|
125
|
-
}
|
|
126
|
-
);
|
|
127
|
-
AnnotationSchema.index({ "meta.contentType": 1 });
|
|
128
|
-
AnnotationSchema.index({ "meta.documentId": 1 });
|
|
129
|
-
AnnotationSchema.index({ createdAt: -1 });
|
|
130
|
-
AnnotationSchema.index({ "annotations.annoKey": 1 });
|
|
131
|
-
AnnotationSchema.pre("save", function(next) {
|
|
132
|
-
this.updatedAt = /* @__PURE__ */ new Date();
|
|
133
|
-
next();
|
|
134
|
-
});
|
|
135
|
-
AnnotationSchema.methods.getMainField = function(fieldPath) {
|
|
136
|
-
if (!fieldPath) return null;
|
|
137
|
-
const parts = fieldPath.split(".");
|
|
138
|
-
let value = this.main;
|
|
139
|
-
for (const part of parts) {
|
|
140
|
-
if (!value || typeof value !== "object") return null;
|
|
141
|
-
value = value[part];
|
|
142
|
-
}
|
|
143
|
-
return value;
|
|
144
|
-
};
|
|
145
|
-
AnnotationSchema.virtual("displayTitle").get(function() {
|
|
146
|
-
return this.main.title || "Untitled Annotation";
|
|
147
|
-
});
|
|
148
|
-
module2.exports = AnnotationSchema;
|
|
149
|
-
}
|
|
150
|
-
});
|
|
151
|
-
|
|
152
|
-
// src/models/PlatformConfigs.js
|
|
153
|
-
var require_PlatformConfigs = __commonJS({
|
|
154
|
-
"src/models/PlatformConfigs.js"(exports2, module2) {
|
|
155
|
-
"use strict";
|
|
156
|
-
var mongoose2 = require("mongoose");
|
|
157
|
-
var platformConfigTypes = [
|
|
158
|
-
{ id: "roles" },
|
|
159
|
-
{ id: "contentTypes" },
|
|
160
|
-
{ id: "contentCards" },
|
|
161
|
-
{ id: "profileTypes" },
|
|
162
|
-
{ id: "nav" },
|
|
163
|
-
{ id: "deployment" },
|
|
164
|
-
{ id: "userAgreement" },
|
|
165
|
-
{ id: "localeData" },
|
|
166
|
-
{ id: "theme" },
|
|
167
|
-
{ id: "tagTypes" },
|
|
168
|
-
{ id: "AI" }
|
|
169
|
-
];
|
|
170
|
-
var PlatformConfigsSchema2 = new mongoose2.Schema(
|
|
171
|
-
{
|
|
172
|
-
type: {
|
|
173
|
-
type: String,
|
|
174
|
-
enum: platformConfigTypes.map((d) => d.id),
|
|
175
|
-
unique: true
|
|
176
|
-
},
|
|
177
|
-
roles: Array,
|
|
178
|
-
data: Object
|
|
179
|
-
},
|
|
180
|
-
{ collection: "platformConfigs" }
|
|
181
|
-
);
|
|
182
|
-
module2.exports = PlatformConfigsSchema2;
|
|
183
|
-
}
|
|
184
|
-
});
|
|
185
|
-
|
|
186
|
-
// src/models/Tpl.js
|
|
187
|
-
var require_Tpl = __commonJS({
|
|
188
|
-
"src/models/Tpl.js"(exports2, module2) {
|
|
189
|
-
"use strict";
|
|
190
|
-
var mongoose2 = require("mongoose");
|
|
191
|
-
var TplSchema2 = new mongoose2.Schema({
|
|
192
|
-
dateFirstPublished: Date,
|
|
193
|
-
dateCreated: Date,
|
|
194
|
-
dateLastPublished: Date,
|
|
195
|
-
dateLastEdited: Date,
|
|
196
|
-
status: {
|
|
197
|
-
type: String,
|
|
198
|
-
default: "published",
|
|
199
|
-
// only cuz we dont want to go and add this property in all databases
|
|
200
|
-
enum: ["unpublished", "editPublished", "published"]
|
|
201
|
-
},
|
|
202
|
-
version: {
|
|
203
|
-
type: Number,
|
|
204
|
-
default: 0
|
|
205
|
-
},
|
|
206
|
-
versionPublishedBy: {
|
|
207
|
-
type: mongoose2.Schema.Types.ObjectId,
|
|
208
|
-
ref: "user"
|
|
209
|
-
// reference to the 'user' model
|
|
210
|
-
},
|
|
211
|
-
firstPublishedBy: {
|
|
212
|
-
type: mongoose2.Schema.Types.ObjectId,
|
|
213
|
-
ref: "user"
|
|
214
|
-
// reference to the 'user' model
|
|
215
|
-
},
|
|
216
|
-
kp_content_type: {
|
|
217
|
-
type: String,
|
|
218
|
-
required: true,
|
|
219
|
-
unique: true
|
|
220
|
-
},
|
|
221
|
-
category: {
|
|
222
|
-
//to deprecate and turn into 'layout'
|
|
223
|
-
type: String,
|
|
224
|
-
default: "knowledgeResources2"
|
|
225
|
-
},
|
|
226
|
-
kp_settings: [
|
|
227
|
-
{
|
|
228
|
-
type: Object
|
|
229
|
-
}
|
|
230
|
-
],
|
|
231
|
-
kp_templates: {
|
|
232
|
-
type: Object
|
|
233
|
-
},
|
|
234
|
-
tplMeta: Object,
|
|
235
|
-
tplLocales: Object,
|
|
236
|
-
indexed: Object,
|
|
237
|
-
drafts: {
|
|
238
|
-
active: Object
|
|
239
|
-
},
|
|
240
|
-
rollbacks: Object,
|
|
241
|
-
//for 'remembering' hidden configurations
|
|
242
|
-
// OTHER CONFIGS
|
|
243
|
-
listing: Object,
|
|
244
|
-
//listing page configurations. this is new, currently only used in nct
|
|
245
|
-
general: {
|
|
246
|
-
content: {
|
|
247
|
-
title: String,
|
|
248
|
-
singular: String,
|
|
249
|
-
ctaText: String,
|
|
250
|
-
listingDesc: String
|
|
251
|
-
},
|
|
252
|
-
allowQuickTagCreation: { enable: Boolean },
|
|
253
|
-
segment: String,
|
|
254
|
-
settingsUIStyle: String,
|
|
255
|
-
hasUpdateType: Boolean,
|
|
256
|
-
annotation: {
|
|
257
|
-
enable: Boolean
|
|
258
|
-
},
|
|
259
|
-
participantModule: {
|
|
260
|
-
enable: Boolean
|
|
261
|
-
},
|
|
262
|
-
formFieldNumbering: {
|
|
263
|
-
enable: Boolean
|
|
264
|
-
},
|
|
265
|
-
postPblRedirPath: Object,
|
|
266
|
-
templateIndex: Object,
|
|
267
|
-
sharing: {
|
|
268
|
-
enable: Boolean,
|
|
269
|
-
trackShareCount: {
|
|
270
|
-
type: Boolean,
|
|
271
|
-
default: false
|
|
272
|
-
}
|
|
273
|
-
},
|
|
274
|
-
viewsCount: {
|
|
275
|
-
enable: {
|
|
276
|
-
type: Boolean,
|
|
277
|
-
default: false
|
|
278
|
-
}
|
|
279
|
-
},
|
|
280
|
-
comments: {
|
|
281
|
-
enable: Boolean
|
|
282
|
-
},
|
|
283
|
-
reactions: {
|
|
284
|
-
type: Map,
|
|
285
|
-
of: {
|
|
286
|
-
enable: Boolean,
|
|
287
|
-
icon: String
|
|
288
|
-
}
|
|
289
|
-
},
|
|
290
|
-
csvExport: {
|
|
291
|
-
enable: Boolean,
|
|
292
|
-
excludeFields: Array,
|
|
293
|
-
enableUpdateExport: Boolean,
|
|
294
|
-
fieldsToSortAtEnd: Array,
|
|
295
|
-
fetchBatches: {
|
|
296
|
-
enable: Boolean,
|
|
297
|
-
batchSize: Number
|
|
298
|
-
}
|
|
299
|
-
},
|
|
300
|
-
//tci helpers - these exist only to show / not show certain UIs in the tci
|
|
301
|
-
disableKPSettings: Boolean
|
|
302
|
-
}
|
|
303
|
-
//general contenttype configs. mostly the stuff inside platformConfigs > contentTypes
|
|
304
|
-
}, {
|
|
305
|
-
toJSON: { virtuals: true },
|
|
306
|
-
// So `res.json()` and other `JSON.stringify()` functions include virtuals
|
|
307
|
-
toObject: { virtuals: true }
|
|
308
|
-
// So `toObject()` output includes virtuals
|
|
309
|
-
});
|
|
310
|
-
TplSchema2.virtual("layout").get(function() {
|
|
311
|
-
return this.category;
|
|
312
|
-
});
|
|
313
|
-
module2.exports = TplSchema2;
|
|
314
|
-
}
|
|
315
|
-
});
|
|
316
|
-
|
|
317
30
|
// src/node.ts
|
|
318
31
|
var node_exports = {};
|
|
319
32
|
__export(node_exports, {
|
|
33
|
+
AIChatSchema: () => AIChat_default,
|
|
34
|
+
AnnotationSchema: () => Annotations_default,
|
|
35
|
+
PlatformConfigsSchema: () => PlatformConfigs_default,
|
|
36
|
+
TplSchema: () => Tpl_default,
|
|
320
37
|
connectToRedis: () => connectToRedis,
|
|
321
38
|
deleteVal: () => deleteVal,
|
|
322
39
|
extractAllBlocksFromTpl: () => extractAllBlocksFromTpl,
|
|
323
40
|
genTagId: () => genTagId,
|
|
41
|
+
getAIChatModelByTenant: () => getAIChatModelByTenant,
|
|
324
42
|
getAIConfigs: () => getAIConfigs,
|
|
325
43
|
getAnnotationsModelByTenant: () => getAnnotationsModelByTenant,
|
|
326
44
|
getDbByTenant: () => getDbByTenant,
|
|
@@ -709,10 +427,317 @@ var getDbByTenant = ({
|
|
|
709
427
|
throw new Error("getDbByTenant : mongodb object doesnt exist");
|
|
710
428
|
};
|
|
711
429
|
|
|
430
|
+
// src/models/AIChat.ts
|
|
431
|
+
var import_mongoose3 = __toESM(require("mongoose"));
|
|
432
|
+
|
|
433
|
+
// src/models/Annotations.ts
|
|
434
|
+
var import_mongoose2 = require("mongoose");
|
|
435
|
+
var AnnotationSchema = new import_mongoose2.Schema(
|
|
436
|
+
{
|
|
437
|
+
// Tags section - dynamic structure for various tag categories
|
|
438
|
+
tags: {
|
|
439
|
+
type: Map,
|
|
440
|
+
of: new import_mongoose2.Schema({
|
|
441
|
+
data: [
|
|
442
|
+
{
|
|
443
|
+
_id: { type: import_mongoose2.Schema.Types.ObjectId },
|
|
444
|
+
display: String,
|
|
445
|
+
tagId: String
|
|
446
|
+
}
|
|
447
|
+
],
|
|
448
|
+
collectionId: String
|
|
449
|
+
}, {
|
|
450
|
+
_id: false
|
|
451
|
+
})
|
|
452
|
+
},
|
|
453
|
+
// Meta information
|
|
454
|
+
meta: {
|
|
455
|
+
contentType: { type: String, required: true },
|
|
456
|
+
kp_contributed_by: {
|
|
457
|
+
type: import_mongoose2.Schema.Types.ObjectId,
|
|
458
|
+
ref: "user"
|
|
459
|
+
},
|
|
460
|
+
valuePath: String,
|
|
461
|
+
documentId: {
|
|
462
|
+
type: import_mongoose2.Schema.Types.ObjectId
|
|
463
|
+
}
|
|
464
|
+
},
|
|
465
|
+
// Main content data - using Schema.Types.Mixed for dynamic structure
|
|
466
|
+
main: {
|
|
467
|
+
type: import_mongoose2.Schema.Types.Mixed,
|
|
468
|
+
default: {}
|
|
469
|
+
},
|
|
470
|
+
// Annotation specific details
|
|
471
|
+
annotations: {
|
|
472
|
+
tags: {
|
|
473
|
+
type: Map,
|
|
474
|
+
of: new import_mongoose2.Schema({
|
|
475
|
+
collectionId: String,
|
|
476
|
+
data: [
|
|
477
|
+
{
|
|
478
|
+
_id: { type: import_mongoose2.Schema.Types.ObjectId },
|
|
479
|
+
display: String,
|
|
480
|
+
tagId: String
|
|
481
|
+
}
|
|
482
|
+
]
|
|
483
|
+
}, {
|
|
484
|
+
_id: false
|
|
485
|
+
})
|
|
486
|
+
},
|
|
487
|
+
fragment: {
|
|
488
|
+
isLexical: Boolean,
|
|
489
|
+
editorState: Object,
|
|
490
|
+
allText: String
|
|
491
|
+
},
|
|
492
|
+
annoKey: String,
|
|
493
|
+
author: {
|
|
494
|
+
id: { type: import_mongoose2.Schema.Types.ObjectId },
|
|
495
|
+
name: String
|
|
496
|
+
}
|
|
497
|
+
},
|
|
498
|
+
embeddings: Array,
|
|
499
|
+
contentEnhancedText: String,
|
|
500
|
+
// // Optional chunk related fields
|
|
501
|
+
// chunk: {
|
|
502
|
+
// embeddings: Schema.Types.Mixed,
|
|
503
|
+
// contentEnhancedText: String
|
|
504
|
+
// },
|
|
505
|
+
clusterId: String,
|
|
506
|
+
kp_date_published: Date,
|
|
507
|
+
createdAt: {
|
|
508
|
+
type: Date,
|
|
509
|
+
default: Date.now
|
|
510
|
+
},
|
|
511
|
+
updatedAt: {
|
|
512
|
+
type: Date,
|
|
513
|
+
default: Date.now
|
|
514
|
+
},
|
|
515
|
+
topicId: [{ type: import_mongoose2.Schema.Types.ObjectId, ref: "generatedTopics" }],
|
|
516
|
+
translations: Object
|
|
517
|
+
},
|
|
518
|
+
{
|
|
519
|
+
timestamps: true,
|
|
520
|
+
toJSON: { virtuals: true },
|
|
521
|
+
toObject: { virtuals: true },
|
|
522
|
+
strict: false
|
|
523
|
+
// This allows for flexible document structure beyond the defined schema
|
|
524
|
+
}
|
|
525
|
+
);
|
|
526
|
+
AnnotationSchema.index({ "meta.contentType": 1 });
|
|
527
|
+
AnnotationSchema.index({ "meta.documentId": 1 });
|
|
528
|
+
AnnotationSchema.index({ createdAt: -1 });
|
|
529
|
+
AnnotationSchema.index({ "annotations.annoKey": 1 });
|
|
530
|
+
AnnotationSchema.index({ "kp_date_published": -1 });
|
|
531
|
+
AnnotationSchema.pre("save", function(next) {
|
|
532
|
+
this.updatedAt = /* @__PURE__ */ new Date();
|
|
533
|
+
next();
|
|
534
|
+
});
|
|
535
|
+
AnnotationSchema.methods.getMainField = function(fieldPath) {
|
|
536
|
+
if (!fieldPath) return null;
|
|
537
|
+
const parts = fieldPath.split(".");
|
|
538
|
+
let value = this.main;
|
|
539
|
+
for (const part of parts) {
|
|
540
|
+
if (!value || typeof value !== "object") return null;
|
|
541
|
+
value = value[part];
|
|
542
|
+
}
|
|
543
|
+
return value;
|
|
544
|
+
};
|
|
545
|
+
AnnotationSchema.virtual("displayTitle").get(function() {
|
|
546
|
+
return this.main?.title || "Untitled Annotation";
|
|
547
|
+
});
|
|
548
|
+
var Annotations_default = AnnotationSchema;
|
|
549
|
+
|
|
550
|
+
// src/models/AIChat.ts
|
|
551
|
+
var AIChatSchema = new import_mongoose3.default.Schema(
|
|
552
|
+
{
|
|
553
|
+
userId: { type: import_mongoose3.default.Schema.Types.ObjectId, index: { unique: true } },
|
|
554
|
+
createdAt: Date,
|
|
555
|
+
lastAcitivity: Date,
|
|
556
|
+
messages: [
|
|
557
|
+
{
|
|
558
|
+
id: String,
|
|
559
|
+
author: {
|
|
560
|
+
type: String,
|
|
561
|
+
enum: ["system", "user", "assistant"]
|
|
562
|
+
},
|
|
563
|
+
content: {
|
|
564
|
+
type: { type: String },
|
|
565
|
+
value: String
|
|
566
|
+
},
|
|
567
|
+
vectorSearchInfo: {
|
|
568
|
+
chunks: [Annotations_default]
|
|
569
|
+
},
|
|
570
|
+
args: {
|
|
571
|
+
query: String,
|
|
572
|
+
reframedQuery: String,
|
|
573
|
+
summary: Object
|
|
574
|
+
},
|
|
575
|
+
userFeedback: {
|
|
576
|
+
reaction: { type: String, enum: ["positive", "negative"] },
|
|
577
|
+
comments: String
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
]
|
|
581
|
+
},
|
|
582
|
+
{ collection: "aiChat" }
|
|
583
|
+
);
|
|
584
|
+
var AIChat_default = AIChatSchema;
|
|
585
|
+
|
|
586
|
+
// src/models/PlatformConfigs.ts
|
|
587
|
+
var import_mongoose4 = __toESM(require("mongoose"));
|
|
588
|
+
var platformConfigTypes = [
|
|
589
|
+
"roles",
|
|
590
|
+
"nav",
|
|
591
|
+
"deployment",
|
|
592
|
+
"userAgreement",
|
|
593
|
+
"localeData",
|
|
594
|
+
"theme",
|
|
595
|
+
"AI"
|
|
596
|
+
];
|
|
597
|
+
var PlatformConfigsSchema = new import_mongoose4.default.Schema(
|
|
598
|
+
{
|
|
599
|
+
type: {
|
|
600
|
+
type: String,
|
|
601
|
+
enum: platformConfigTypes,
|
|
602
|
+
unique: true
|
|
603
|
+
},
|
|
604
|
+
roles: Array,
|
|
605
|
+
data: Object
|
|
606
|
+
},
|
|
607
|
+
{ collection: "platformConfigs" }
|
|
608
|
+
);
|
|
609
|
+
var PlatformConfigs_default = PlatformConfigsSchema;
|
|
610
|
+
|
|
611
|
+
// src/models/Tpl.ts
|
|
612
|
+
var import_mongoose5 = __toESM(require("mongoose"));
|
|
613
|
+
var TplSchema = new import_mongoose5.default.Schema({
|
|
614
|
+
dateFirstPublished: Date,
|
|
615
|
+
dateCreated: Date,
|
|
616
|
+
dateLastPublished: Date,
|
|
617
|
+
dateLastEdited: Date,
|
|
618
|
+
status: {
|
|
619
|
+
type: String,
|
|
620
|
+
default: "published",
|
|
621
|
+
// only cuz we dont want to go and add this property in all databases
|
|
622
|
+
enum: ["unpublished", "editPublished", "published"]
|
|
623
|
+
},
|
|
624
|
+
version: {
|
|
625
|
+
type: Number,
|
|
626
|
+
default: 0
|
|
627
|
+
},
|
|
628
|
+
versionPublishedBy: {
|
|
629
|
+
type: import_mongoose5.default.Schema.Types.ObjectId,
|
|
630
|
+
ref: "user"
|
|
631
|
+
// reference to the 'user' model
|
|
632
|
+
},
|
|
633
|
+
firstPublishedBy: {
|
|
634
|
+
type: import_mongoose5.default.Schema.Types.ObjectId,
|
|
635
|
+
ref: "user"
|
|
636
|
+
// reference to the 'user' model
|
|
637
|
+
},
|
|
638
|
+
kp_content_type: {
|
|
639
|
+
type: String,
|
|
640
|
+
required: true,
|
|
641
|
+
unique: true
|
|
642
|
+
},
|
|
643
|
+
category: {
|
|
644
|
+
//to deprecate and turn into 'layout'
|
|
645
|
+
type: String,
|
|
646
|
+
default: "knowledgeResources2"
|
|
647
|
+
},
|
|
648
|
+
kp_settings: [
|
|
649
|
+
{
|
|
650
|
+
type: Object
|
|
651
|
+
}
|
|
652
|
+
],
|
|
653
|
+
kp_templates: {
|
|
654
|
+
type: Object
|
|
655
|
+
},
|
|
656
|
+
tplMeta: Object,
|
|
657
|
+
tplLocales: Object,
|
|
658
|
+
indexed: Object,
|
|
659
|
+
drafts: {
|
|
660
|
+
active: Object
|
|
661
|
+
},
|
|
662
|
+
rollbacks: Object,
|
|
663
|
+
//for 'remembering' hidden configurations
|
|
664
|
+
// OTHER CONFIGS
|
|
665
|
+
listing: Object,
|
|
666
|
+
//listing page configurations. this is new, currently only used in nct
|
|
667
|
+
general: {
|
|
668
|
+
content: {
|
|
669
|
+
title: String,
|
|
670
|
+
singular: String,
|
|
671
|
+
ctaText: String,
|
|
672
|
+
listingDesc: String
|
|
673
|
+
},
|
|
674
|
+
allowQuickTagCreation: { enable: Boolean },
|
|
675
|
+
segment: String,
|
|
676
|
+
settingsUIStyle: String,
|
|
677
|
+
hasUpdateType: Boolean,
|
|
678
|
+
annotation: {
|
|
679
|
+
enable: Boolean
|
|
680
|
+
},
|
|
681
|
+
participantModule: {
|
|
682
|
+
enable: Boolean
|
|
683
|
+
},
|
|
684
|
+
formFieldNumbering: {
|
|
685
|
+
enable: Boolean
|
|
686
|
+
},
|
|
687
|
+
postPblRedirPath: Object,
|
|
688
|
+
templateIndex: Object,
|
|
689
|
+
sharing: {
|
|
690
|
+
enable: Boolean,
|
|
691
|
+
trackShareCount: {
|
|
692
|
+
type: Boolean,
|
|
693
|
+
default: false
|
|
694
|
+
}
|
|
695
|
+
},
|
|
696
|
+
viewsCount: {
|
|
697
|
+
enable: {
|
|
698
|
+
type: Boolean,
|
|
699
|
+
default: false
|
|
700
|
+
}
|
|
701
|
+
},
|
|
702
|
+
comments: {
|
|
703
|
+
enable: Boolean
|
|
704
|
+
},
|
|
705
|
+
reactions: {
|
|
706
|
+
type: Map,
|
|
707
|
+
of: {
|
|
708
|
+
enable: Boolean,
|
|
709
|
+
icon: String
|
|
710
|
+
}
|
|
711
|
+
},
|
|
712
|
+
csvExport: {
|
|
713
|
+
enable: Boolean,
|
|
714
|
+
excludeFields: Array,
|
|
715
|
+
enableUpdateExport: Boolean,
|
|
716
|
+
fieldsToSortAtEnd: Array,
|
|
717
|
+
fetchBatches: {
|
|
718
|
+
enable: Boolean,
|
|
719
|
+
batchSize: Number
|
|
720
|
+
}
|
|
721
|
+
},
|
|
722
|
+
onboardingFlow: Object,
|
|
723
|
+
//only on profile tpls
|
|
724
|
+
selfServeSurveyConfig: Object,
|
|
725
|
+
//tci helpers - these exist only to show / not show certain UIs in the tci
|
|
726
|
+
disableKPSettings: Boolean
|
|
727
|
+
}
|
|
728
|
+
//general contenttype configs. mostly the stuff inside platformConfigs > contentTypes
|
|
729
|
+
}, {
|
|
730
|
+
toJSON: { virtuals: true },
|
|
731
|
+
// So `res.json()` and other `JSON.stringify()` functions include virtuals
|
|
732
|
+
toObject: { virtuals: true }
|
|
733
|
+
// So `toObject()` output includes virtuals
|
|
734
|
+
});
|
|
735
|
+
TplSchema.virtual("layout").get(function() {
|
|
736
|
+
return this.category;
|
|
737
|
+
});
|
|
738
|
+
var Tpl_default = TplSchema;
|
|
739
|
+
|
|
712
740
|
// src/db/getModelByTenant.ts
|
|
713
|
-
var AnnotationsSchema = require_Annotations();
|
|
714
|
-
var PlatformConfigsSchema = require_PlatformConfigs();
|
|
715
|
-
var TplSchema = require_Tpl();
|
|
716
741
|
var getModelByTenant = ({
|
|
717
742
|
tenant,
|
|
718
743
|
modelName,
|
|
@@ -731,22 +756,28 @@ var getModelByTenant = ({
|
|
|
731
756
|
}
|
|
732
757
|
return db.model(modelName);
|
|
733
758
|
};
|
|
734
|
-
var getAnnotationsModelByTenant = ({ tenant, env, mongodb, dbConfigs }) => getModelByTenant({
|
|
759
|
+
var getAnnotationsModelByTenant = ({ tenant, env, mongodb, dbConfigs, modelName }) => getModelByTenant({
|
|
735
760
|
tenant,
|
|
736
|
-
modelName: "annotations",
|
|
737
|
-
schema:
|
|
761
|
+
modelName: modelName || "annotations",
|
|
762
|
+
schema: Annotations_default,
|
|
738
763
|
env
|
|
739
764
|
});
|
|
740
765
|
var getPlatformConfigsModelByTenant = ({ tenant, env, mongodb, dbConfigs }) => getModelByTenant({
|
|
741
766
|
tenant,
|
|
742
767
|
modelName: "platformConfigs",
|
|
743
|
-
schema:
|
|
768
|
+
schema: PlatformConfigs_default,
|
|
744
769
|
env
|
|
745
770
|
});
|
|
746
771
|
var getTplModelByTenant = ({ tenant, env, mongodb, dbConfigs }) => getModelByTenant({
|
|
747
772
|
tenant,
|
|
748
773
|
modelName: "tpl",
|
|
749
|
-
schema:
|
|
774
|
+
schema: Tpl_default,
|
|
775
|
+
env
|
|
776
|
+
});
|
|
777
|
+
var getAIChatModelByTenant = ({ tenant, env, mongodb, dbConfigs }) => getModelByTenant({
|
|
778
|
+
tenant,
|
|
779
|
+
modelName: "aiChat",
|
|
780
|
+
schema: AIChat_default,
|
|
750
781
|
env
|
|
751
782
|
});
|
|
752
783
|
|
|
@@ -858,10 +889,15 @@ var getAIConfigs = async ({
|
|
|
858
889
|
};
|
|
859
890
|
// Annotate the CommonJS export names for ESM import in node:
|
|
860
891
|
0 && (module.exports = {
|
|
892
|
+
AIChatSchema,
|
|
893
|
+
AnnotationSchema,
|
|
894
|
+
PlatformConfigsSchema,
|
|
895
|
+
TplSchema,
|
|
861
896
|
connectToRedis,
|
|
862
897
|
deleteVal,
|
|
863
898
|
extractAllBlocksFromTpl,
|
|
864
899
|
genTagId,
|
|
900
|
+
getAIChatModelByTenant,
|
|
865
901
|
getAIConfigs,
|
|
866
902
|
getAnnotationsModelByTenant,
|
|
867
903
|
getDbByTenant,
|