codebase-models 1.0.7 → 2.0.1
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/.github/workflows/npm-publish.yml +33 -0
- package/dist/index.d.ts +4 -3
- package/dist/index.js +7 -5
- package/dist/src/models/Announcement.d.ts +7 -8
- package/dist/src/models/Announcement.js +30 -10
- package/dist/src/models/AppEvent.d.ts +1 -3
- package/dist/src/models/AppEvent.js +1 -1
- package/dist/src/models/Audience.d.ts +2 -3
- package/dist/src/models/Audience.js +6 -1
- package/dist/src/models/{Experiments.d.ts → BqPreCompiledData.d.ts} +12 -32
- package/dist/src/models/{ClientExperiment.js → BqPreCompiledData.js} +26 -46
- package/dist/src/models/CVRReport.d.ts +2 -3
- package/dist/src/models/CVRReport.js +14 -1
- package/dist/src/models/Client.d.ts +2 -4
- package/dist/src/models/Client.js +32 -52
- package/dist/src/models/ClientAdditionalRevenue.d.ts +2 -4
- package/dist/src/models/ClientAdditionalRevenue.js +4 -3
- package/dist/src/models/ClientLearning.d.ts +2 -4
- package/dist/src/models/ClientLearning.js +11 -7
- package/dist/src/models/ClientLinks.d.ts +2 -4
- package/dist/src/models/ClientLinks.js +16 -7
- package/dist/src/models/ClientNextSteps.d.ts +2 -4
- package/dist/src/models/ClientNextSteps.js +4 -3
- package/dist/src/models/ClientNote.d.ts +2 -4
- package/dist/src/models/ClientNote.js +4 -3
- package/dist/src/models/ClientReportsTemp.d.ts +2 -4
- package/dist/src/models/ClientReportsTemp.js +21 -3
- package/dist/src/models/ClientRetention.d.ts +2 -3
- package/dist/src/models/ClientRetention.js +19 -1
- package/dist/src/models/ClientScript.d.ts +2 -4
- package/dist/src/models/ClientScript.js +25 -9
- package/dist/src/models/ClientStrategy.d.ts +2 -4
- package/dist/src/models/ClientStrategy.js +4 -3
- package/dist/src/models/ClientSurvay.d.ts +2 -7
- package/dist/src/models/ClientSurvay.js +6 -1
- package/dist/src/models/Environment.d.ts +3 -3
- package/dist/src/models/Environment.js +27 -3
- package/dist/src/models/Faqs.d.ts +2 -3
- package/dist/src/models/Faqs.js +6 -1
- package/dist/src/models/Feedback.d.ts +2 -4
- package/dist/src/models/Feedback.js +4 -3
- package/dist/src/models/Goal.d.ts +3 -4
- package/dist/src/models/Goal.js +34 -12
- package/dist/src/models/Hypothesis.d.ts +3 -3
- package/dist/src/models/Hypothesis.js +50 -10
- package/dist/src/models/HypothesisSheet.d.ts +2 -4
- package/dist/src/models/HypothesisSheet.js +27 -3
- package/dist/src/models/LandingPages.d.ts +4 -3
- package/dist/src/models/LandingPages.js +30 -1
- package/dist/src/models/NewIdeas.d.ts +2 -4
- package/dist/src/models/NewIdeas.js +4 -3
- package/dist/src/models/Notification.d.ts +2 -3
- package/dist/src/models/Notification.js +30 -2
- package/dist/src/models/{ClientExperiment.d.ts → Organization.d.ts} +18 -31
- package/dist/src/models/{Experiments.js → Organization.js} +36 -54
- package/dist/src/models/Page.d.ts +4 -4
- package/dist/src/models/Page.js +57 -5
- package/dist/src/models/PageElement.d.ts +4 -3
- package/dist/src/models/PageElement.js +60 -8
- package/dist/src/models/PageTestType.d.ts +3 -3
- package/dist/src/models/PageTestType.js +42 -6
- package/dist/src/models/Portfolio.d.ts +2 -3
- package/dist/src/models/Portfolio.js +6 -1
- package/dist/src/models/PrecalculationFilters.d.ts +34 -0
- package/dist/src/models/PrecalculationFilters.js +78 -0
- package/dist/src/models/QueryLog.d.ts +2 -4
- package/dist/src/models/QueryLog.js +4 -3
- package/dist/src/models/ReadNotification.d.ts +2 -3
- package/dist/src/models/ReadNotification.js +30 -2
- package/dist/src/models/Report.d.ts +3 -4
- package/dist/src/models/Report.js +33 -49
- package/dist/src/models/Role.d.ts +4 -3
- package/dist/src/models/Role.js +51 -8
- package/dist/src/models/SavedSegment.d.ts +2 -3
- package/dist/src/models/SavedSegment.js +6 -1
- package/dist/src/models/Segment.d.ts +2 -3
- package/dist/src/models/Segment.js +6 -1
- package/dist/src/models/SegmentCombination.d.ts +2 -3
- package/dist/src/models/SegmentCombination.js +6 -1
- package/dist/src/models/Snippet.d.ts +3 -4
- package/dist/src/models/Snippet.js +29 -4
- package/dist/src/models/StageInCustomerJourney.d.ts +4 -4
- package/dist/src/models/StageInCustomerJourney.js +56 -4
- package/dist/src/models/Tag.d.ts +2 -3
- package/dist/src/models/Tag.js +30 -2
- package/dist/src/models/Temp.d.ts +2 -3
- package/dist/src/models/Temp.js +30 -2
- package/dist/src/models/Test.d.ts +17 -18
- package/dist/src/models/Test.js +83 -186
- package/dist/src/models/TestSequentialValue.d.ts +2 -3
- package/dist/src/models/TestSequentialValue.js +6 -1
- package/dist/src/models/Tier.d.ts +2 -3
- package/dist/src/models/Tier.js +30 -2
- package/dist/src/models/Trigger.d.ts +2 -3
- package/dist/src/models/Trigger.js +30 -2
- package/dist/src/models/User.d.ts +2 -3
- package/dist/src/models/User.js +10 -11
- package/index.ts +6 -4
- package/package.json +1 -1
- package/src/models/Announcement.ts +51 -28
- package/src/models/AppEvent.ts +1 -1
- package/src/models/Audience.ts +7 -1
- package/src/models/BqPreCompiledData.ts +62 -0
- package/src/models/CVRReport.ts +18 -1
- package/src/models/Client.ts +40 -60
- package/src/models/ClientAdditionalRevenue.ts +5 -4
- package/src/models/ClientLearning.ts +12 -8
- package/src/models/ClientLinks.ts +19 -8
- package/src/models/ClientNextSteps.ts +5 -4
- package/src/models/ClientNote.ts +5 -4
- package/src/models/ClientReportsTemp.ts +25 -4
- package/src/models/ClientRetention.ts +28 -2
- package/src/models/ClientScript.ts +27 -10
- package/src/models/ClientStrategy.ts +5 -4
- package/src/models/ClientSurvay.ts +7 -1
- package/src/models/Environment.ts +32 -4
- package/src/models/Faqs.ts +7 -1
- package/src/models/Feedback.ts +5 -4
- package/src/models/Goal.ts +37 -13
- package/src/models/Hypothesis.ts +30 -9
- package/src/models/HypothesisSheet.ts +4 -3
- package/src/models/LandingPages.ts +35 -1
- package/src/models/NewIdeas.ts +5 -4
- package/src/models/Notification.ts +7 -1
- package/src/models/Organization.ts +86 -0
- package/src/models/Page.ts +63 -6
- package/src/models/PageElement.ts +39 -8
- package/src/models/PageTestType.ts +22 -5
- package/src/models/Portfolio.ts +7 -1
- package/src/models/PrecalculationFilters.ts +68 -0
- package/src/models/QueryLog.ts +5 -4
- package/src/models/ReadNotification.ts +7 -1
- package/src/models/Report.ts +55 -67
- package/src/models/Role.ts +32 -7
- package/src/models/SavedSegment.ts +7 -1
- package/src/models/Segment.ts +7 -1
- package/src/models/SegmentCombination.ts +7 -1
- package/src/models/Snippet.ts +33 -5
- package/src/models/StageInCustomerJourney.ts +34 -6
- package/src/models/Tag.ts +7 -1
- package/src/models/Temp.ts +7 -1
- package/src/models/Test.ts +156 -244
- package/src/models/TestSequentialValue.ts +7 -1
- package/src/models/Tier.ts +7 -1
- package/src/models/Trigger.ts +7 -1
- package/src/models/User.ts +12 -11
- package/src/models/ClientExperiment.ts +0 -113
- package/src/models/Experiments.ts +0 -118
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
/// <reference types="mongoose/types/inferschematype" />
|
|
25
25
|
import mongoose, { Document } from "mongoose";
|
|
26
26
|
export interface IClientLinks extends Document {
|
|
27
|
-
|
|
27
|
+
organizationId?: mongoose.Schema.Types.ObjectId;
|
|
28
28
|
title: string;
|
|
29
29
|
description?: string;
|
|
30
30
|
link?: string;
|
|
@@ -33,7 +33,5 @@ export interface IClientLinks extends Document {
|
|
|
33
33
|
viewId?: string;
|
|
34
34
|
createdBy?: mongoose.Schema.Types.ObjectId;
|
|
35
35
|
}
|
|
36
|
-
declare const ClientLinks: mongoose.Model<
|
|
37
|
-
_id: mongoose.Types.ObjectId;
|
|
38
|
-
}, any>;
|
|
36
|
+
declare const ClientLinks: mongoose.Model<any, {}, {}, {}, any, any>;
|
|
39
37
|
export default ClientLinks;
|
|
@@ -25,20 +25,24 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
const mongoose_1 = __importStar(require("mongoose"));
|
|
27
27
|
const ClientLinksSchema = new mongoose_1.Schema({
|
|
28
|
-
|
|
29
|
-
type:
|
|
28
|
+
organizationId: {
|
|
29
|
+
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
30
|
+
ref: "organization",
|
|
30
31
|
default: null,
|
|
31
32
|
},
|
|
32
33
|
title: {
|
|
33
34
|
type: String,
|
|
34
35
|
required: true,
|
|
36
|
+
trim: true,
|
|
35
37
|
},
|
|
36
38
|
description: {
|
|
37
39
|
type: String,
|
|
40
|
+
trim: true,
|
|
38
41
|
},
|
|
39
42
|
link: {
|
|
40
43
|
type: String,
|
|
41
44
|
required: true,
|
|
45
|
+
trim: true,
|
|
42
46
|
},
|
|
43
47
|
client: {
|
|
44
48
|
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
@@ -58,9 +62,14 @@ const ClientLinksSchema = new mongoose_1.Schema({
|
|
|
58
62
|
}, {
|
|
59
63
|
timestamps: true,
|
|
60
64
|
});
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
});
|
|
65
|
-
|
|
65
|
+
// Compound indexes for common query patterns
|
|
66
|
+
ClientLinksSchema.index({ client: 1 });
|
|
67
|
+
ClientLinksSchema.index({ client: 1, private: 1 });
|
|
68
|
+
ClientLinksSchema.index({ client: 1, createdAt: -1 });
|
|
69
|
+
// Sparse indexes for optional fields
|
|
70
|
+
ClientLinksSchema.index({ viewId: 1 }, { sparse: true });
|
|
71
|
+
ClientLinksSchema.index({ organisationId: 1 }, { sparse: true });
|
|
72
|
+
// Case-insensitive indexes
|
|
73
|
+
ClientLinksSchema.index({ title: 1 }, { collation: { locale: 'en', strength: 2 } });
|
|
74
|
+
const ClientLinks = mongoose_1.default.models.clientlink || (0, mongoose_1.model)("clientlink", ClientLinksSchema);
|
|
66
75
|
exports.default = ClientLinks;
|
|
@@ -25,12 +25,10 @@
|
|
|
25
25
|
import mongoose, { Document } from "mongoose";
|
|
26
26
|
export interface IClientNextSteps extends Document {
|
|
27
27
|
name: string;
|
|
28
|
-
|
|
28
|
+
organizationId?: mongoose.Schema.Types.ObjectId;
|
|
29
29
|
client?: mongoose.Schema.Types.ObjectId;
|
|
30
30
|
viewId?: string;
|
|
31
31
|
createdBy?: mongoose.Schema.Types.ObjectId;
|
|
32
32
|
}
|
|
33
|
-
declare const ClientNextStep: mongoose.Model<
|
|
34
|
-
_id: mongoose.Types.ObjectId;
|
|
35
|
-
}, any>;
|
|
33
|
+
declare const ClientNextStep: mongoose.Model<any, {}, {}, {}, any, any>;
|
|
36
34
|
export default ClientNextStep;
|
|
@@ -29,8 +29,9 @@ const ClientNextStepsSchema = new mongoose_1.Schema({
|
|
|
29
29
|
type: String,
|
|
30
30
|
required: true,
|
|
31
31
|
},
|
|
32
|
-
|
|
33
|
-
type:
|
|
32
|
+
organizationId: {
|
|
33
|
+
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
34
|
+
ref: "organization",
|
|
34
35
|
default: null,
|
|
35
36
|
},
|
|
36
37
|
client: {
|
|
@@ -51,5 +52,5 @@ ClientNextStepsSchema.index({
|
|
|
51
52
|
client: 1,
|
|
52
53
|
viewId: 1,
|
|
53
54
|
});
|
|
54
|
-
const ClientNextStep = (0, mongoose_1.model)("clientnextstep", ClientNextStepsSchema);
|
|
55
|
+
const ClientNextStep = mongoose_1.default.models.clientnextstep || (0, mongoose_1.model)("clientnextstep", ClientNextStepsSchema);
|
|
55
56
|
exports.default = ClientNextStep;
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
/// <reference types="mongoose/types/inferschematype" />
|
|
25
25
|
import mongoose, { Document } from "mongoose";
|
|
26
26
|
export interface IClientNote extends Document {
|
|
27
|
-
|
|
27
|
+
organizationId?: mongoose.Schema.Types.ObjectId;
|
|
28
28
|
client?: mongoose.Schema.Types.ObjectId;
|
|
29
29
|
viewId?: string;
|
|
30
30
|
pageType?: mongoose.Schema.Types.ObjectId;
|
|
@@ -34,7 +34,5 @@ export interface IClientNote extends Document {
|
|
|
34
34
|
evidence?: mongoose.Schema.Types.Mixed;
|
|
35
35
|
createdBy?: mongoose.Schema.Types.ObjectId;
|
|
36
36
|
}
|
|
37
|
-
declare const ClientNote: mongoose.Model<
|
|
38
|
-
_id: mongoose.Types.ObjectId;
|
|
39
|
-
}, any>;
|
|
37
|
+
declare const ClientNote: mongoose.Model<any, {}, {}, {}, any, any>;
|
|
40
38
|
export default ClientNote;
|
|
@@ -25,8 +25,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
const mongoose_1 = __importStar(require("mongoose"));
|
|
27
27
|
const ClientNoteSchema = new mongoose_1.Schema({
|
|
28
|
-
|
|
29
|
-
type:
|
|
28
|
+
organizationId: {
|
|
29
|
+
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
30
|
+
ref: "organization",
|
|
30
31
|
default: null,
|
|
31
32
|
},
|
|
32
33
|
client: {
|
|
@@ -64,5 +65,5 @@ ClientNoteSchema.index({
|
|
|
64
65
|
client: 1,
|
|
65
66
|
viewId: 1,
|
|
66
67
|
});
|
|
67
|
-
const ClientNote = (0, mongoose_1.model)("clientnote", ClientNoteSchema);
|
|
68
|
+
const ClientNote = mongoose_1.default.models.clientnote || (0, mongoose_1.model)("clientnote", ClientNoteSchema);
|
|
68
69
|
exports.default = ClientNote;
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
/// <reference types="mongoose/types/inferschematype" />
|
|
25
25
|
import mongoose from "mongoose";
|
|
26
26
|
export interface IClientReportsTemp extends Document {
|
|
27
|
-
|
|
27
|
+
organizationId?: mongoose.Schema.Types.ObjectId;
|
|
28
28
|
client?: mongoose.Schema.Types.ObjectId;
|
|
29
29
|
viewId?: string;
|
|
30
30
|
test?: mongoose.Schema.Types.ObjectId;
|
|
@@ -35,7 +35,5 @@ export interface IClientReportsTemp extends Document {
|
|
|
35
35
|
deactivated?: boolean;
|
|
36
36
|
createdBy?: mongoose.Schema.Types.ObjectId;
|
|
37
37
|
}
|
|
38
|
-
declare const ClientReportsTemp: mongoose.Model<
|
|
39
|
-
_id: mongoose.Types.ObjectId;
|
|
40
|
-
}, any>;
|
|
38
|
+
declare const ClientReportsTemp: mongoose.Model<any, {}, {}, {}, any, any>;
|
|
41
39
|
export default ClientReportsTemp;
|
|
@@ -25,8 +25,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
const mongoose_1 = __importStar(require("mongoose"));
|
|
27
27
|
const ClientReportsTempSchema = new mongoose_1.Schema({
|
|
28
|
-
|
|
29
|
-
type:
|
|
28
|
+
organizationId: {
|
|
29
|
+
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
30
|
+
ref: "organization",
|
|
30
31
|
default: null,
|
|
31
32
|
},
|
|
32
33
|
client: {
|
|
@@ -42,12 +43,15 @@ const ClientReportsTempSchema = new mongoose_1.Schema({
|
|
|
42
43
|
},
|
|
43
44
|
filters: {
|
|
44
45
|
type: String,
|
|
46
|
+
trim: true,
|
|
45
47
|
},
|
|
46
48
|
metricsFilters: {
|
|
47
49
|
type: String,
|
|
50
|
+
trim: true,
|
|
48
51
|
},
|
|
49
52
|
date: {
|
|
50
53
|
type: Date,
|
|
54
|
+
index: true,
|
|
51
55
|
},
|
|
52
56
|
report: {
|
|
53
57
|
type: mongoose_1.default.Schema.Types.Mixed,
|
|
@@ -55,6 +59,7 @@ const ClientReportsTempSchema = new mongoose_1.Schema({
|
|
|
55
59
|
deactivated: {
|
|
56
60
|
type: Boolean,
|
|
57
61
|
default: false,
|
|
62
|
+
index: true,
|
|
58
63
|
},
|
|
59
64
|
createdBy: {
|
|
60
65
|
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
@@ -63,5 +68,18 @@ const ClientReportsTempSchema = new mongoose_1.Schema({
|
|
|
63
68
|
}, {
|
|
64
69
|
timestamps: true,
|
|
65
70
|
});
|
|
66
|
-
|
|
71
|
+
// Compound indexes for common query patterns
|
|
72
|
+
ClientReportsTempSchema.index({ client: 1 });
|
|
73
|
+
ClientReportsTempSchema.index({ client: 1, test: 1 });
|
|
74
|
+
ClientReportsTempSchema.index({ client: 1, deactivated: 1 });
|
|
75
|
+
ClientReportsTempSchema.index({ client: 1, date: -1 });
|
|
76
|
+
ClientReportsTempSchema.index({ createdBy: 1, date: -1 });
|
|
77
|
+
ClientReportsTempSchema.index({ organisationId: 1, client: 1 });
|
|
78
|
+
// Sparse indexes for optional fields
|
|
79
|
+
ClientReportsTempSchema.index({ viewId: 1 }, { sparse: true });
|
|
80
|
+
ClientReportsTempSchema.index({ organisationId: 1 }, { sparse: true });
|
|
81
|
+
ClientReportsTempSchema.index({ test: 1 }, { sparse: true });
|
|
82
|
+
// TTL index for automatic cleanup of old reports
|
|
83
|
+
ClientReportsTempSchema.index({ date: 1 }, { expireAfterSeconds: 86400 }); // 24 hours
|
|
84
|
+
const ClientReportsTemp = mongoose_1.default.models.clientreportstemp || (0, mongoose_1.model)("clientreportstemp", ClientReportsTempSchema);
|
|
67
85
|
exports.default = ClientReportsTemp;
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
/// <reference types="mongoose/types/inferschematype" />
|
|
25
25
|
import mongoose, { Document } from "mongoose";
|
|
26
26
|
export interface IClientRetention extends Document {
|
|
27
|
+
organizationId?: mongoose.Schema.Types.ObjectId;
|
|
27
28
|
client?: mongoose.Schema.Types.ObjectId;
|
|
28
29
|
viewId?: string;
|
|
29
30
|
year: Number;
|
|
@@ -36,7 +37,5 @@ export interface IClientRetention extends Document {
|
|
|
36
37
|
otherPayments: Number;
|
|
37
38
|
};
|
|
38
39
|
}
|
|
39
|
-
declare const ClientRetention: mongoose.Model<
|
|
40
|
-
_id: mongoose.Types.ObjectId;
|
|
41
|
-
}, any>;
|
|
40
|
+
declare const ClientRetention: mongoose.Model<any, {}, {}, {}, any, any>;
|
|
42
41
|
export default ClientRetention;
|
|
@@ -25,10 +25,16 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
const mongoose_1 = __importStar(require("mongoose"));
|
|
27
27
|
const ClientRetentionSchema = new mongoose_1.Schema({
|
|
28
|
+
organizationId: {
|
|
29
|
+
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
30
|
+
ref: "organization",
|
|
31
|
+
default: null,
|
|
32
|
+
},
|
|
28
33
|
client: {
|
|
29
34
|
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
30
35
|
ref: "client",
|
|
31
36
|
required: true,
|
|
37
|
+
index: true,
|
|
32
38
|
},
|
|
33
39
|
viewId: {
|
|
34
40
|
type: String,
|
|
@@ -38,6 +44,7 @@ const ClientRetentionSchema = new mongoose_1.Schema({
|
|
|
38
44
|
type: Number,
|
|
39
45
|
required: true,
|
|
40
46
|
default: new Date().getFullYear(),
|
|
47
|
+
index: true,
|
|
41
48
|
},
|
|
42
49
|
retentions: {
|
|
43
50
|
type: [
|
|
@@ -81,5 +88,16 @@ const ClientRetentionSchema = new mongoose_1.Schema({
|
|
|
81
88
|
}, {
|
|
82
89
|
timestamps: true,
|
|
83
90
|
});
|
|
84
|
-
|
|
91
|
+
// Compound indexes for common query patterns
|
|
92
|
+
ClientRetentionSchema.index({ client: 1, year: 1 });
|
|
93
|
+
ClientRetentionSchema.index({ client: 1, viewId: 1 });
|
|
94
|
+
ClientRetentionSchema.index({ year: 1, "retentions.month": 1 });
|
|
95
|
+
ClientRetentionSchema.index({ client: 1, "retentions.active": 1 });
|
|
96
|
+
// Sparse indexes for optional fields
|
|
97
|
+
ClientRetentionSchema.index({ viewId: 1 }, { sparse: true });
|
|
98
|
+
// Partial index for active retentions
|
|
99
|
+
ClientRetentionSchema.index({ "retentions.active": 1 }, { partialFilterExpression: { "retentions.active": true } });
|
|
100
|
+
// Index for sorting by retainer value
|
|
101
|
+
ClientRetentionSchema.index({ "retentions.retainerValue": -1 });
|
|
102
|
+
const ClientRetention = mongoose_1.default.models.clientretention || (0, mongoose_1.model)("ClientRetention", ClientRetentionSchema);
|
|
85
103
|
exports.default = ClientRetention;
|
|
@@ -28,7 +28,7 @@ export interface IClientScriptSchema extends Document {
|
|
|
28
28
|
viewId: string;
|
|
29
29
|
}
|
|
30
30
|
export interface IClientScript extends Document {
|
|
31
|
-
|
|
31
|
+
organizationId?: mongoose.Schema.Types.ObjectId;
|
|
32
32
|
client?: mongoose.Schema.Types.ObjectId;
|
|
33
33
|
viewId?: string;
|
|
34
34
|
clientScriptURL: string;
|
|
@@ -60,7 +60,5 @@ export interface IClientScript extends Document {
|
|
|
60
60
|
csscode: string;
|
|
61
61
|
is_spa: Boolean;
|
|
62
62
|
}
|
|
63
|
-
declare const ClientScript: mongoose.Model<
|
|
64
|
-
_id: mongoose.Types.ObjectId;
|
|
65
|
-
}, any>;
|
|
63
|
+
declare const ClientScript: mongoose.Model<any, {}, {}, {}, any, any>;
|
|
66
64
|
export default ClientScript;
|
|
@@ -25,23 +25,28 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
const mongoose_1 = __importStar(require("mongoose"));
|
|
27
27
|
const ClientScriptSchema = new mongoose_1.Schema({
|
|
28
|
-
|
|
29
|
-
type:
|
|
28
|
+
organizationId: {
|
|
29
|
+
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
30
|
+
ref: "organization",
|
|
30
31
|
default: null,
|
|
31
32
|
},
|
|
32
33
|
client: {
|
|
33
34
|
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
34
35
|
ref: "client",
|
|
36
|
+
index: true,
|
|
35
37
|
},
|
|
36
38
|
viewId: {
|
|
37
39
|
type: String,
|
|
40
|
+
index: true,
|
|
38
41
|
},
|
|
39
42
|
clientScriptURL: {
|
|
40
43
|
type: String,
|
|
44
|
+
trim: true,
|
|
41
45
|
},
|
|
42
46
|
jquery_include: {
|
|
43
47
|
type: String,
|
|
44
48
|
default: "false",
|
|
49
|
+
trim: true,
|
|
45
50
|
},
|
|
46
51
|
debug: {
|
|
47
52
|
type: Boolean,
|
|
@@ -60,6 +65,7 @@ const ClientScriptSchema = new mongoose_1.Schema({
|
|
|
60
65
|
},
|
|
61
66
|
activation_mode: {
|
|
62
67
|
type: String,
|
|
68
|
+
trim: true,
|
|
63
69
|
},
|
|
64
70
|
use_antiflicker: {
|
|
65
71
|
type: Boolean,
|
|
@@ -71,17 +77,21 @@ const ClientScriptSchema = new mongoose_1.Schema({
|
|
|
71
77
|
},
|
|
72
78
|
rules: {
|
|
73
79
|
type: String,
|
|
74
|
-
default: "return true;"
|
|
80
|
+
default: "return true;",
|
|
81
|
+
trim: true,
|
|
75
82
|
},
|
|
76
83
|
rules_tracking: {
|
|
77
84
|
type: String,
|
|
78
|
-
default: "return true;"
|
|
85
|
+
default: "return true;",
|
|
86
|
+
trim: true,
|
|
79
87
|
},
|
|
80
88
|
tracker_url: {
|
|
81
89
|
type: String,
|
|
90
|
+
trim: true,
|
|
82
91
|
},
|
|
83
92
|
asset_url: {
|
|
84
93
|
type: String,
|
|
94
|
+
trim: true,
|
|
85
95
|
},
|
|
86
96
|
metadata_key_exp_1: {
|
|
87
97
|
type: mongoose_1.default.Schema.Types.Mixed,
|
|
@@ -103,6 +113,7 @@ const ClientScriptSchema = new mongoose_1.Schema({
|
|
|
103
113
|
},
|
|
104
114
|
cookie_domain: {
|
|
105
115
|
type: String,
|
|
116
|
+
trim: true,
|
|
106
117
|
},
|
|
107
118
|
snippet_version: {
|
|
108
119
|
type: Number,
|
|
@@ -110,6 +121,7 @@ const ClientScriptSchema = new mongoose_1.Schema({
|
|
|
110
121
|
storage: {
|
|
111
122
|
type: String,
|
|
112
123
|
default: "default",
|
|
124
|
+
trim: true,
|
|
113
125
|
},
|
|
114
126
|
run_only_on_reinit: {
|
|
115
127
|
type: Boolean,
|
|
@@ -124,9 +136,11 @@ const ClientScriptSchema = new mongoose_1.Schema({
|
|
|
124
136
|
},
|
|
125
137
|
jscode: {
|
|
126
138
|
type: String,
|
|
139
|
+
trim: true,
|
|
127
140
|
},
|
|
128
141
|
csscode: {
|
|
129
142
|
type: String,
|
|
143
|
+
trim: true,
|
|
130
144
|
},
|
|
131
145
|
is_spa: {
|
|
132
146
|
type: Boolean,
|
|
@@ -135,9 +149,11 @@ const ClientScriptSchema = new mongoose_1.Schema({
|
|
|
135
149
|
}, {
|
|
136
150
|
timestamps: true,
|
|
137
151
|
});
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
});
|
|
142
|
-
|
|
152
|
+
// Compound indexes for common query patterns
|
|
153
|
+
ClientScriptSchema.index({ client: 1 });
|
|
154
|
+
// Sparse indexes for optional fields
|
|
155
|
+
ClientScriptSchema.index({ organisationId: 1 }, { sparse: true });
|
|
156
|
+
ClientScriptSchema.index({ tracker_url: 1 }, { sparse: true });
|
|
157
|
+
ClientScriptSchema.index({ asset_url: 1 }, { sparse: true });
|
|
158
|
+
const ClientScript = mongoose_1.default.models.clientscript || (0, mongoose_1.model)("clientscript", ClientScriptSchema);
|
|
143
159
|
exports.default = ClientScript;
|
|
@@ -29,13 +29,11 @@ export interface IClientStrategy extends Document {
|
|
|
29
29
|
startDate?: Date;
|
|
30
30
|
endDate?: Date;
|
|
31
31
|
strategies?: mongoose.Schema.Types.Mixed;
|
|
32
|
-
|
|
32
|
+
organizationId?: mongoose.Schema.Types.ObjectId;
|
|
33
33
|
client?: mongoose.Schema.Types.ObjectId;
|
|
34
34
|
learningsoftime?: mongoose.Schema.Types.Mixed;
|
|
35
35
|
viewId?: string;
|
|
36
36
|
createdBy?: mongoose.Schema.Types.ObjectId;
|
|
37
37
|
}
|
|
38
|
-
declare const ClientStrategy: mongoose.Model<
|
|
39
|
-
_id: mongoose.Types.ObjectId;
|
|
40
|
-
}, any>;
|
|
38
|
+
declare const ClientStrategy: mongoose.Model<any, {}, {}, {}, any, any>;
|
|
41
39
|
export default ClientStrategy;
|
|
@@ -42,8 +42,9 @@ const ClientStrategySchema = new mongoose_1.Schema({
|
|
|
42
42
|
strategies: {
|
|
43
43
|
type: mongoose_1.default.Schema.Types.Mixed,
|
|
44
44
|
},
|
|
45
|
-
|
|
46
|
-
type:
|
|
45
|
+
organizationId: {
|
|
46
|
+
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
47
|
+
ref: "organization",
|
|
47
48
|
default: null,
|
|
48
49
|
},
|
|
49
50
|
client: {
|
|
@@ -69,5 +70,5 @@ ClientStrategySchema.index({
|
|
|
69
70
|
client: 1,
|
|
70
71
|
viewId: 1,
|
|
71
72
|
});
|
|
72
|
-
const ClientStrategy = (0, mongoose_1.model)("clientstrategy", ClientStrategySchema);
|
|
73
|
+
const ClientStrategy = mongoose_1.default.models.clientstrategy || (0, mongoose_1.model)("clientstrategy", ClientStrategySchema);
|
|
73
74
|
exports.default = ClientStrategy;
|
|
@@ -26,16 +26,11 @@ import mongoose, { Document } from "mongoose";
|
|
|
26
26
|
export interface IClientSurvay extends Document {
|
|
27
27
|
responses: IResponce;
|
|
28
28
|
user?: mongoose.Schema.Types.ObjectId;
|
|
29
|
+
organizationId?: mongoose.Schema.Types.ObjectId;
|
|
29
30
|
}
|
|
30
31
|
export interface IResponce extends Document {
|
|
31
32
|
question?: String;
|
|
32
33
|
answer?: String;
|
|
33
34
|
}
|
|
34
|
-
declare const ClientSurvey: mongoose.Model<
|
|
35
|
-
_id: mongoose.Types.ObjectId;
|
|
36
|
-
}, mongoose.Schema<IClientSurvay, mongoose.Model<IClientSurvay, any, any, any, mongoose.Document<unknown, any, IClientSurvay> & IClientSurvay & {
|
|
37
|
-
_id: mongoose.Types.ObjectId;
|
|
38
|
-
}, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, IClientSurvay, mongoose.Document<unknown, {}, mongoose.FlatRecord<IClientSurvay>> & mongoose.FlatRecord<IClientSurvay> & {
|
|
39
|
-
_id: mongoose.Types.ObjectId;
|
|
40
|
-
}>>;
|
|
35
|
+
declare const ClientSurvey: mongoose.Model<any, {}, {}, {}, any, any>;
|
|
41
36
|
export default ClientSurvey;
|
|
@@ -38,8 +38,13 @@ const ClientSurveySchema = new mongoose_1.Schema({
|
|
|
38
38
|
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
39
39
|
ref: "user",
|
|
40
40
|
},
|
|
41
|
+
organizationId: {
|
|
42
|
+
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
43
|
+
ref: "organization",
|
|
44
|
+
default: null,
|
|
45
|
+
},
|
|
41
46
|
}, {
|
|
42
47
|
timestamps: true,
|
|
43
48
|
});
|
|
44
|
-
const ClientSurvey = (0, mongoose_1.model)("clientsurvey", ClientSurveySchema);
|
|
49
|
+
const ClientSurvey = mongoose_1.default.models.clientsurvey || (0, mongoose_1.model)("clientsurvey", ClientSurveySchema);
|
|
45
50
|
exports.default = ClientSurvey;
|
|
@@ -27,8 +27,8 @@ export interface IEnvironment extends Document {
|
|
|
27
27
|
name: string;
|
|
28
28
|
rules_js?: string;
|
|
29
29
|
client?: mongoose.Schema.Types.ObjectId;
|
|
30
|
+
organizationId?: mongoose.Schema.Types.ObjectId;
|
|
31
|
+
isActive?: boolean;
|
|
30
32
|
}
|
|
31
|
-
declare const Environment: mongoose.Model<
|
|
32
|
-
_id: mongoose.Types.ObjectId;
|
|
33
|
-
}, any>;
|
|
33
|
+
declare const Environment: mongoose.Model<any, {}, {}, {}, any, any>;
|
|
34
34
|
export default Environment;
|
|
@@ -28,18 +28,42 @@ const EnvironmentSchema = new mongoose_1.Schema({
|
|
|
28
28
|
name: {
|
|
29
29
|
type: String,
|
|
30
30
|
required: true,
|
|
31
|
-
default: 'Default'
|
|
31
|
+
default: 'Default',
|
|
32
|
+
trim: true,
|
|
33
|
+
index: true,
|
|
32
34
|
},
|
|
33
35
|
client: {
|
|
34
36
|
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
35
37
|
ref: "client",
|
|
38
|
+
required: true,
|
|
39
|
+
index: true,
|
|
40
|
+
},
|
|
41
|
+
organizationId: {
|
|
42
|
+
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
43
|
+
ref: "organization",
|
|
44
|
+
index: true,
|
|
36
45
|
},
|
|
37
46
|
rules_js: {
|
|
38
47
|
type: String,
|
|
39
|
-
default: "return true"
|
|
48
|
+
default: "return true",
|
|
49
|
+
trim: true,
|
|
40
50
|
},
|
|
51
|
+
isActive: {
|
|
52
|
+
type: Boolean,
|
|
53
|
+
default: true,
|
|
54
|
+
index: true,
|
|
55
|
+
}
|
|
41
56
|
}, {
|
|
42
57
|
timestamps: true
|
|
43
58
|
});
|
|
44
|
-
|
|
59
|
+
// Compound indexes for common query patterns
|
|
60
|
+
EnvironmentSchema.index({ client: 1, name: 1 }, { unique: true });
|
|
61
|
+
EnvironmentSchema.index({ client: 1, isActive: 1 });
|
|
62
|
+
EnvironmentSchema.index({ organizationId: 1, client: 1 });
|
|
63
|
+
EnvironmentSchema.index({ organizationId: 1, name: 1 }, {
|
|
64
|
+
sparse: true,
|
|
65
|
+
});
|
|
66
|
+
// Text index for full-text search
|
|
67
|
+
EnvironmentSchema.index({ name: 'text' });
|
|
68
|
+
const Environment = mongoose_1.default.models.environment || (0, mongoose_1.model)("environment", EnvironmentSchema);
|
|
45
69
|
exports.default = Environment;
|
|
@@ -29,8 +29,7 @@ export interface IFaqs extends Document {
|
|
|
29
29
|
keywords?: mongoose.Schema.Types.Array;
|
|
30
30
|
createdAt?: Date;
|
|
31
31
|
updatedAt?: Date;
|
|
32
|
+
organizationId?: mongoose.Schema.Types.ObjectId;
|
|
32
33
|
}
|
|
33
|
-
declare const Faq: mongoose.Model<
|
|
34
|
-
_id: mongoose.Types.ObjectId;
|
|
35
|
-
}, any>;
|
|
34
|
+
declare const Faq: mongoose.Model<any, {}, {}, {}, any, any>;
|
|
36
35
|
export default Faq;
|
package/dist/src/models/Faqs.js
CHANGED
|
@@ -42,6 +42,11 @@ const FaqSchema = new mongoose_1.Schema({
|
|
|
42
42
|
type: Date,
|
|
43
43
|
default: new Date(),
|
|
44
44
|
},
|
|
45
|
+
organizationId: {
|
|
46
|
+
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
47
|
+
ref: "organization",
|
|
48
|
+
default: null,
|
|
49
|
+
},
|
|
45
50
|
});
|
|
46
|
-
const Faq = (0, mongoose_1.model)("faq", FaqSchema);
|
|
51
|
+
const Faq = mongoose_1.default.models.faq || (0, mongoose_1.model)("faq", FaqSchema);
|
|
47
52
|
exports.default = Faq;
|
|
@@ -28,11 +28,9 @@ export interface IFeedback extends Document {
|
|
|
28
28
|
details?: string;
|
|
29
29
|
client?: mongoose.Schema.Types.ObjectId;
|
|
30
30
|
thread?: mongoose.Schema.Types.Mixed;
|
|
31
|
-
|
|
31
|
+
organizationId?: mongoose.Schema.Types.ObjectId;
|
|
32
32
|
createdAt?: Date;
|
|
33
33
|
updatedAt?: Date;
|
|
34
34
|
}
|
|
35
|
-
declare const Feedback: mongoose.Model<
|
|
36
|
-
_id: mongoose.Types.ObjectId;
|
|
37
|
-
}, any>;
|
|
35
|
+
declare const Feedback: mongoose.Model<any, {}, {}, {}, any, any>;
|
|
38
36
|
export default Feedback;
|
|
@@ -41,8 +41,9 @@ const FeedbackSchema = new mongoose_1.Schema({
|
|
|
41
41
|
type: mongoose_1.default.Schema.Types.Mixed,
|
|
42
42
|
default: [],
|
|
43
43
|
},
|
|
44
|
-
|
|
45
|
-
type:
|
|
44
|
+
organizationId: {
|
|
45
|
+
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
46
|
+
ref: "organization",
|
|
46
47
|
default: null,
|
|
47
48
|
},
|
|
48
49
|
createdAt: {
|
|
@@ -54,5 +55,5 @@ const FeedbackSchema = new mongoose_1.Schema({
|
|
|
54
55
|
default: new Date(),
|
|
55
56
|
},
|
|
56
57
|
});
|
|
57
|
-
const Feedback = (0, mongoose_1.model)("feedback", FeedbackSchema);
|
|
58
|
+
const Feedback = mongoose_1.default.models.feedback || (0, mongoose_1.model)("feedback", FeedbackSchema);
|
|
58
59
|
exports.default = Feedback;
|
|
@@ -27,17 +27,16 @@ export interface IGoal extends Document {
|
|
|
27
27
|
name: string;
|
|
28
28
|
details?: string;
|
|
29
29
|
slug?: string;
|
|
30
|
-
|
|
30
|
+
organizationId?: mongoose.Schema.Types.ObjectId;
|
|
31
31
|
client?: mongoose.Schema.Types.ObjectId;
|
|
32
32
|
type: string;
|
|
33
33
|
counting_method: string;
|
|
34
34
|
css_selector: string;
|
|
35
35
|
api_name: string;
|
|
36
36
|
rules_js: string;
|
|
37
|
+
isActive?: boolean;
|
|
37
38
|
createdAt?: Date;
|
|
38
39
|
updatedAt?: Date;
|
|
39
40
|
}
|
|
40
|
-
declare const Goal: mongoose.Model<
|
|
41
|
-
_id: mongoose.Types.ObjectId;
|
|
42
|
-
}, any>;
|
|
41
|
+
declare const Goal: mongoose.Model<any, {}, {}, {}, any, any>;
|
|
43
42
|
export default Goal;
|