codebase-models 1.0.7 → 2.0.0
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 +6 -5
- package/dist/src/models/Announcement.js +29 -9
- package/dist/src/models/Audience.d.ts +1 -0
- package/dist/src/models/Audience.js +5 -0
- package/dist/src/models/{Experiments.d.ts → BqPreCompiledData.d.ts} +12 -30
- package/dist/src/models/{ClientExperiment.js → BqPreCompiledData.js} +26 -46
- package/dist/src/models/CVRReport.d.ts +1 -0
- package/dist/src/models/CVRReport.js +13 -0
- package/dist/src/models/Client.d.ts +1 -1
- package/dist/src/models/Client.js +31 -51
- package/dist/src/models/ClientAdditionalRevenue.d.ts +1 -1
- package/dist/src/models/ClientAdditionalRevenue.js +3 -2
- package/dist/src/models/ClientLearning.d.ts +1 -1
- package/dist/src/models/ClientLearning.js +10 -6
- package/dist/src/models/ClientLinks.d.ts +1 -1
- package/dist/src/models/ClientLinks.js +15 -6
- package/dist/src/models/ClientNextSteps.d.ts +1 -1
- package/dist/src/models/ClientNextSteps.js +3 -2
- package/dist/src/models/ClientNote.d.ts +1 -1
- package/dist/src/models/ClientNote.js +3 -2
- package/dist/src/models/ClientReportsTemp.d.ts +1 -1
- package/dist/src/models/ClientReportsTemp.js +20 -2
- package/dist/src/models/ClientRetention.d.ts +1 -0
- package/dist/src/models/ClientRetention.js +18 -0
- package/dist/src/models/ClientScript.d.ts +1 -1
- package/dist/src/models/ClientScript.js +24 -8
- package/dist/src/models/ClientStrategy.d.ts +1 -1
- package/dist/src/models/ClientStrategy.js +3 -2
- package/dist/src/models/ClientSurvay.d.ts +1 -0
- package/dist/src/models/ClientSurvay.js +5 -0
- package/dist/src/models/Environment.d.ts +2 -0
- package/dist/src/models/Environment.js +26 -2
- package/dist/src/models/Faqs.d.ts +1 -0
- package/dist/src/models/Faqs.js +5 -0
- package/dist/src/models/Feedback.d.ts +1 -1
- package/dist/src/models/Feedback.js +3 -2
- package/dist/src/models/Goal.d.ts +2 -1
- package/dist/src/models/Goal.js +33 -11
- package/dist/src/models/Hypothesis.d.ts +2 -0
- package/dist/src/models/Hypothesis.js +49 -9
- package/dist/src/models/HypothesisSheet.d.ts +1 -1
- package/dist/src/models/HypothesisSheet.js +26 -2
- package/dist/src/models/LandingPages.d.ts +3 -0
- package/dist/src/models/LandingPages.js +29 -0
- package/dist/src/models/NewIdeas.d.ts +1 -1
- package/dist/src/models/NewIdeas.js +3 -2
- package/dist/src/models/Notification.d.ts +1 -0
- package/dist/src/models/Notification.js +29 -1
- package/dist/src/models/{ClientExperiment.d.ts → Organization.d.ts} +18 -29
- package/dist/src/models/{Experiments.js → Organization.js} +36 -54
- package/dist/src/models/Page.d.ts +3 -1
- package/dist/src/models/Page.js +56 -4
- package/dist/src/models/PageElement.d.ts +3 -0
- package/dist/src/models/PageElement.js +59 -7
- package/dist/src/models/PageTestType.d.ts +2 -0
- package/dist/src/models/PageTestType.js +41 -5
- package/dist/src/models/Portfolio.d.ts +1 -0
- package/dist/src/models/Portfolio.js +5 -0
- package/dist/src/models/PrecalculationFilters.d.ts +36 -0
- package/dist/src/models/PrecalculationFilters.js +77 -0
- package/dist/src/models/QueryLog.d.ts +1 -1
- package/dist/src/models/QueryLog.js +3 -2
- package/dist/src/models/ReadNotification.d.ts +1 -0
- package/dist/src/models/ReadNotification.js +29 -1
- package/dist/src/models/Report.d.ts +2 -1
- package/dist/src/models/Report.js +32 -48
- package/dist/src/models/Role.d.ts +3 -0
- package/dist/src/models/Role.js +50 -7
- package/dist/src/models/SavedSegment.d.ts +1 -0
- package/dist/src/models/SavedSegment.js +5 -0
- package/dist/src/models/Segment.d.ts +1 -0
- package/dist/src/models/Segment.js +5 -0
- package/dist/src/models/SegmentCombination.d.ts +1 -0
- package/dist/src/models/SegmentCombination.js +5 -0
- package/dist/src/models/Snippet.d.ts +2 -1
- package/dist/src/models/Snippet.js +28 -3
- package/dist/src/models/StageInCustomerJourney.d.ts +3 -1
- package/dist/src/models/StageInCustomerJourney.js +56 -4
- package/dist/src/models/Tag.d.ts +1 -0
- package/dist/src/models/Tag.js +29 -1
- package/dist/src/models/Temp.d.ts +1 -0
- package/dist/src/models/Temp.js +29 -1
- package/dist/src/models/Test.d.ts +16 -15
- package/dist/src/models/Test.js +82 -185
- package/dist/src/models/TestSequentialValue.d.ts +1 -0
- package/dist/src/models/TestSequentialValue.js +5 -0
- package/dist/src/models/Tier.d.ts +1 -0
- package/dist/src/models/Tier.js +29 -1
- package/dist/src/models/Trigger.d.ts +1 -0
- package/dist/src/models/Trigger.js +29 -1
- package/dist/src/models/User.d.ts +1 -0
- package/dist/src/models/User.js +9 -10
- package/index.ts +6 -4
- package/package.json +1 -1
- package/src/models/Announcement.ts +50 -27
- package/src/models/Audience.ts +6 -0
- package/src/models/BqPreCompiledData.ts +62 -0
- package/src/models/CVRReport.ts +17 -0
- package/src/models/Client.ts +39 -59
- package/src/models/ClientAdditionalRevenue.ts +4 -3
- package/src/models/ClientLearning.ts +11 -7
- package/src/models/ClientLinks.ts +18 -7
- package/src/models/ClientNextSteps.ts +4 -3
- package/src/models/ClientNote.ts +4 -3
- package/src/models/ClientReportsTemp.ts +24 -3
- package/src/models/ClientRetention.ts +27 -1
- package/src/models/ClientScript.ts +26 -9
- package/src/models/ClientStrategy.ts +4 -3
- package/src/models/ClientSurvay.ts +6 -0
- package/src/models/Environment.ts +31 -3
- package/src/models/Faqs.ts +6 -0
- package/src/models/Feedback.ts +4 -3
- package/src/models/Goal.ts +36 -12
- package/src/models/Hypothesis.ts +29 -8
- package/src/models/HypothesisSheet.ts +3 -2
- package/src/models/LandingPages.ts +34 -0
- package/src/models/NewIdeas.ts +4 -3
- package/src/models/Notification.ts +6 -0
- package/src/models/Organization.ts +86 -0
- package/src/models/Page.ts +62 -5
- package/src/models/PageElement.ts +38 -7
- package/src/models/PageTestType.ts +21 -4
- package/src/models/Portfolio.ts +6 -0
- package/src/models/PrecalculationFilters.ts +67 -0
- package/src/models/QueryLog.ts +4 -3
- package/src/models/ReadNotification.ts +6 -0
- package/src/models/Report.ts +54 -66
- package/src/models/Role.ts +31 -6
- package/src/models/SavedSegment.ts +6 -0
- package/src/models/Segment.ts +6 -0
- package/src/models/SegmentCombination.ts +6 -0
- package/src/models/Snippet.ts +32 -4
- package/src/models/StageInCustomerJourney.ts +33 -5
- package/src/models/Tag.ts +6 -0
- package/src/models/Temp.ts +6 -0
- package/src/models/Test.ts +155 -243
- package/src/models/TestSequentialValue.ts +6 -0
- package/src/models/Tier.ts +6 -0
- package/src/models/Trigger.ts +6 -0
- package/src/models/User.ts +11 -10
- package/src/models/ClientExperiment.ts +0 -113
- package/src/models/Experiments.ts +0 -118
package/src/models/Snippet.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import mongoose, { Document, Schema, model } from "mongoose";
|
|
2
2
|
|
|
3
3
|
export interface ISnippet extends Document {
|
|
4
|
-
organisationId?: string;
|
|
5
4
|
name?: string;
|
|
6
5
|
pageelement?: mongoose.Schema.Types.ObjectId[];
|
|
7
6
|
client?: mongoose.Schema.Types.ObjectId;
|
|
@@ -13,66 +12,95 @@ export interface ISnippet extends Document {
|
|
|
13
12
|
jscode?: string;
|
|
14
13
|
test?: mongoose.Schema.Types.ObjectId;
|
|
15
14
|
status?: string;
|
|
15
|
+
isActive?: boolean;
|
|
16
|
+
organizationId?: mongoose.Schema.Types.ObjectId;
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
const SnippetSchema = new Schema<ISnippet>(
|
|
19
20
|
{
|
|
20
|
-
|
|
21
|
-
type:
|
|
21
|
+
organizationId: {
|
|
22
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
23
|
+
ref: "organization",
|
|
22
24
|
default: null,
|
|
25
|
+
index: true,
|
|
23
26
|
},
|
|
24
27
|
name: {
|
|
25
28
|
type: String,
|
|
26
29
|
required: true,
|
|
27
30
|
unique: true,
|
|
31
|
+
trim: true,
|
|
32
|
+
index: true,
|
|
28
33
|
},
|
|
29
34
|
pageelement: {
|
|
30
35
|
type: [mongoose.Schema.Types.ObjectId],
|
|
31
36
|
ref: "pageelement",
|
|
32
37
|
default: [],
|
|
38
|
+
index: true,
|
|
33
39
|
},
|
|
34
40
|
client: {
|
|
35
41
|
type: mongoose.Schema.Types.ObjectId,
|
|
36
42
|
ref: "client",
|
|
43
|
+
required: true,
|
|
44
|
+
index: true,
|
|
37
45
|
},
|
|
38
46
|
details: {
|
|
39
47
|
type: String,
|
|
40
48
|
default: "",
|
|
49
|
+
trim: true,
|
|
41
50
|
},
|
|
42
51
|
figmaUrl: {
|
|
43
52
|
type: String,
|
|
53
|
+
trim: true,
|
|
44
54
|
},
|
|
45
55
|
tags: {
|
|
46
56
|
type: [mongoose.Schema.Types.ObjectId],
|
|
47
57
|
ref: "tag",
|
|
48
58
|
default: [],
|
|
59
|
+
index: true,
|
|
49
60
|
},
|
|
50
61
|
htmlcode: {
|
|
51
62
|
type: String,
|
|
52
63
|
default: "",
|
|
64
|
+
trim: true,
|
|
53
65
|
},
|
|
54
66
|
csscode: {
|
|
55
67
|
type: String,
|
|
68
|
+
trim: true,
|
|
56
69
|
},
|
|
57
70
|
jscode: {
|
|
58
71
|
type: String,
|
|
59
72
|
default: "",
|
|
73
|
+
trim: true,
|
|
60
74
|
},
|
|
61
75
|
test: {
|
|
62
76
|
type: mongoose.Schema.Types.ObjectId,
|
|
63
77
|
ref: "test",
|
|
78
|
+
index: true,
|
|
64
79
|
},
|
|
65
80
|
status: {
|
|
66
81
|
type: String,
|
|
67
82
|
default: "live",
|
|
68
|
-
enum: ["live", "draft"],
|
|
83
|
+
enum: ["live", "draft","running","paused","preview","ended"],
|
|
84
|
+
index: true,
|
|
69
85
|
},
|
|
86
|
+
isActive: {
|
|
87
|
+
type: Boolean,
|
|
88
|
+
default: true,
|
|
89
|
+
index: true,
|
|
90
|
+
}
|
|
70
91
|
},
|
|
71
92
|
{
|
|
72
93
|
timestamps: true,
|
|
73
94
|
}
|
|
74
95
|
);
|
|
75
96
|
|
|
97
|
+
// Compound indexes for common query patterns
|
|
98
|
+
SnippetSchema.index({ client: 1, name: 1 }, { unique: true });
|
|
99
|
+
SnippetSchema.index({ organisationId: 1, client: 1 });
|
|
100
|
+
SnippetSchema.index({ client: 1, tags: 1 });
|
|
101
|
+
SnippetSchema.index({ client: 1, pageelement: 1 });
|
|
102
|
+
|
|
103
|
+
|
|
76
104
|
const Snippet = model<ISnippet>("snippet", SnippetSchema);
|
|
77
105
|
|
|
78
106
|
export default Snippet;
|
|
@@ -1,35 +1,63 @@
|
|
|
1
|
-
import mongoose, { Document, Schema, model } from "mongoose";
|
|
1
|
+
import mongoose, { Document, Mongoose, Schema, model } from "mongoose";
|
|
2
|
+
import slug from "mongoose-slug-updater"
|
|
3
|
+
mongoose.plugin(slug)
|
|
2
4
|
|
|
3
5
|
export interface IStageInCustomerJourney extends Document {
|
|
4
6
|
name?: string;
|
|
5
7
|
stages?: string;
|
|
6
8
|
slug?: string;
|
|
7
|
-
organizationId?:
|
|
9
|
+
organizationId?: mongoose.Schema.Types.ObjectId;
|
|
10
|
+
client?: mongoose.Schema.Types.ObjectId;
|
|
11
|
+
isActive?: boolean;
|
|
8
12
|
}
|
|
9
13
|
|
|
10
|
-
const
|
|
14
|
+
const StageInCustomerJourneySchema = new Schema<IStageInCustomerJourney>(
|
|
11
15
|
{
|
|
12
16
|
name: {
|
|
13
17
|
type: String,
|
|
18
|
+
required: true,
|
|
19
|
+
trim: true,
|
|
20
|
+
index: true,
|
|
14
21
|
},
|
|
15
22
|
stages: {
|
|
16
23
|
type: String,
|
|
24
|
+
required: true,
|
|
25
|
+
trim: true,
|
|
17
26
|
},
|
|
18
27
|
slug: {
|
|
19
28
|
type: String,
|
|
29
|
+
slug: ["name"],
|
|
30
|
+
slugPaddingSize: 4,
|
|
31
|
+
unique: true,
|
|
32
|
+
trim: true,
|
|
20
33
|
},
|
|
21
34
|
organizationId: {
|
|
22
|
-
type:
|
|
35
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
36
|
+
default: null,
|
|
37
|
+
ref: "organization",
|
|
38
|
+
index: true,
|
|
39
|
+
},
|
|
40
|
+
client: {
|
|
41
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
42
|
+
ref: "client",
|
|
43
|
+
index: true,
|
|
23
44
|
},
|
|
45
|
+
isActive: {
|
|
46
|
+
type: Boolean,
|
|
47
|
+
default: true,
|
|
48
|
+
index: true,
|
|
49
|
+
}
|
|
24
50
|
},
|
|
25
51
|
{
|
|
26
52
|
timestamps: true,
|
|
27
53
|
}
|
|
28
54
|
);
|
|
29
55
|
|
|
56
|
+
// Compound indexes for common query patterns
|
|
57
|
+
// StageInCustomerJourneySchema.index({ client: 1, slug: 1 });
|
|
30
58
|
const StageInCustomerJourney = model<IStageInCustomerJourney>(
|
|
31
59
|
"stageincustomerjourney",
|
|
32
|
-
|
|
60
|
+
StageInCustomerJourneySchema
|
|
33
61
|
);
|
|
34
62
|
|
|
35
63
|
export default StageInCustomerJourney;
|
package/src/models/Tag.ts
CHANGED
|
@@ -4,9 +4,15 @@ export interface ITag extends Document {
|
|
|
4
4
|
name: string;
|
|
5
5
|
createdAt?: Date;
|
|
6
6
|
updatedAt?: Date;
|
|
7
|
+
organizationId?: mongoose.Schema.Types.ObjectId;
|
|
7
8
|
}
|
|
8
9
|
|
|
9
10
|
const TagSchema = new Schema<ITag>({
|
|
11
|
+
organizationId: {
|
|
12
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
13
|
+
ref: "organization",
|
|
14
|
+
default: null,
|
|
15
|
+
},
|
|
10
16
|
name: {
|
|
11
17
|
type: String,
|
|
12
18
|
unique: true,
|
package/src/models/Temp.ts
CHANGED
|
@@ -5,9 +5,15 @@ export interface ITemp extends Document {
|
|
|
5
5
|
userId: string;
|
|
6
6
|
enabled?: boolean;
|
|
7
7
|
createdAt?: Date;
|
|
8
|
+
organizationId?: mongoose.Schema.Types.ObjectId;
|
|
8
9
|
}
|
|
9
10
|
|
|
10
11
|
const TempSchema = new Schema<ITemp>({
|
|
12
|
+
organizationId: {
|
|
13
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
14
|
+
ref: "organization",
|
|
15
|
+
default: null,
|
|
16
|
+
},
|
|
11
17
|
secret: {
|
|
12
18
|
type: String,
|
|
13
19
|
},
|
package/src/models/Test.ts
CHANGED
|
@@ -3,8 +3,8 @@ import mongoose, { Document, Schema, model } from "mongoose";
|
|
|
3
3
|
export interface IVariations extends Document {
|
|
4
4
|
name: string;
|
|
5
5
|
css_code: string;
|
|
6
|
-
baseline:
|
|
7
|
-
traffic_allocation:
|
|
6
|
+
baseline: boolean;
|
|
7
|
+
traffic_allocation: number;
|
|
8
8
|
metadata_1: mongoose.Schema.Types.Mixed;
|
|
9
9
|
metadata_2: mongoose.Schema.Types.Mixed;
|
|
10
10
|
metadata_3: mongoose.Schema.Types.Mixed;
|
|
@@ -13,51 +13,61 @@ export interface IVariations extends Document {
|
|
|
13
13
|
csscode: string;
|
|
14
14
|
changesets: string;
|
|
15
15
|
}
|
|
16
|
+
|
|
16
17
|
export interface ITest extends Document {
|
|
17
|
-
|
|
18
|
+
// Core test properties
|
|
19
|
+
organizationId?: mongoose.Schema.Types.ObjectId;
|
|
18
20
|
status: string;
|
|
19
21
|
name: string;
|
|
20
|
-
traffic_allocation:
|
|
22
|
+
traffic_allocation: number;
|
|
21
23
|
audiences_match_type: string;
|
|
24
|
+
|
|
25
|
+
// Metadata fields
|
|
22
26
|
metadata_1: mongoose.Schema.Types.Mixed;
|
|
23
27
|
metadata_2: mongoose.Schema.Types.Mixed;
|
|
24
28
|
metadata_3: mongoose.Schema.Types.Mixed;
|
|
25
29
|
integrations_run_mode: mongoose.Schema.Types.Mixed;
|
|
30
|
+
|
|
31
|
+
// Code fields
|
|
26
32
|
jscode: string;
|
|
27
33
|
reset_js: string;
|
|
28
34
|
csscode: string;
|
|
35
|
+
htmlcode: string;
|
|
36
|
+
|
|
37
|
+
// References
|
|
29
38
|
audiences?: mongoose.Schema.Types.ObjectId[];
|
|
30
39
|
variations: IVariations[];
|
|
31
|
-
environments?: mongoose.Schema.Types.
|
|
40
|
+
environments?: mongoose.Schema.Types.ObjectId[];
|
|
32
41
|
pages?: mongoose.Schema.Types.ObjectId[];
|
|
33
|
-
// OLD SCHEMA VARIABLES
|
|
34
42
|
pageelement?: mongoose.Schema.Types.ObjectId[];
|
|
35
43
|
client?: mongoose.Schema.Types.ObjectId;
|
|
44
|
+
goal?: mongoose.Schema.Types.ObjectId[];
|
|
45
|
+
pagetesttype?: mongoose.Schema.Types.ObjectId[];
|
|
46
|
+
tags?: mongoose.Schema.Types.ObjectId[];
|
|
47
|
+
hypothesis?: mongoose.Schema.Types.ObjectId;
|
|
48
|
+
trigger?: mongoose.Schema.Types.ObjectId[];
|
|
49
|
+
stageincustomerjourney?: mongoose.Schema.Types.ObjectId;
|
|
50
|
+
|
|
51
|
+
// Test configuration
|
|
36
52
|
property?: mongoose.Schema.Types.Mixed;
|
|
37
53
|
platform: string;
|
|
38
54
|
viewId: string;
|
|
39
|
-
goal?: mongoose.Schema.Types.ObjectId[];
|
|
40
|
-
pagetesttype?: mongoose.Schema.Types.ObjectId[];
|
|
41
55
|
controlimage: string;
|
|
42
56
|
variationimage: string;
|
|
43
|
-
|
|
44
|
-
hypothesis?: mongoose.Schema.Types.ObjectId;
|
|
45
|
-
urltargeting?: [];
|
|
57
|
+
urltargeting: any[];
|
|
46
58
|
pageaudience: string;
|
|
47
59
|
targetaudience: string;
|
|
48
60
|
page: string;
|
|
49
61
|
pageNotContains: string;
|
|
50
62
|
eventparameter: string;
|
|
51
|
-
htmlcode: string;
|
|
52
63
|
testid: string;
|
|
53
64
|
testtool: string;
|
|
65
|
+
personalization: boolean;
|
|
54
66
|
kameleoontestdetails: mongoose.Schema.Types.Mixed;
|
|
55
67
|
vwotestdetails: mongoose.Schema.Types.Mixed;
|
|
56
|
-
|
|
57
|
-
triggerevents?: [];
|
|
58
|
-
stageincustomerjourney?: mongoose.Schema.Types.ObjectId;
|
|
68
|
+
triggerevents: any[];
|
|
59
69
|
selectedevent: string;
|
|
60
|
-
revenue
|
|
70
|
+
revenue: any[];
|
|
61
71
|
significance: string;
|
|
62
72
|
recommendedsamplesize: number;
|
|
63
73
|
livedate: Date;
|
|
@@ -66,246 +76,148 @@ export interface ITest extends Document {
|
|
|
66
76
|
}
|
|
67
77
|
|
|
68
78
|
const VariationsSchema = new Schema<IVariations>({
|
|
69
|
-
name: {
|
|
70
|
-
|
|
71
|
-
},
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
},
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
},
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
},
|
|
81
|
-
metadata_1: {
|
|
82
|
-
type: mongoose.Schema.Types.Mixed,
|
|
83
|
-
},
|
|
84
|
-
metadata_2: {
|
|
85
|
-
type: mongoose.Schema.Types.Mixed,
|
|
86
|
-
},
|
|
87
|
-
metadata_3: {
|
|
88
|
-
type: mongoose.Schema.Types.Mixed,
|
|
89
|
-
},
|
|
90
|
-
jscode: {
|
|
91
|
-
type: String,
|
|
92
|
-
},
|
|
93
|
-
reset_js: {
|
|
94
|
-
type: String,
|
|
95
|
-
},
|
|
96
|
-
csscode: {
|
|
97
|
-
type: String,
|
|
98
|
-
},
|
|
99
|
-
changesets: {
|
|
100
|
-
type: String,
|
|
101
|
-
default: "[]",
|
|
102
|
-
},
|
|
79
|
+
name: { type: String, required: true },
|
|
80
|
+
css_code: { type: String, default: "" },
|
|
81
|
+
baseline: { type: Boolean, default: false },
|
|
82
|
+
traffic_allocation: { type: Number, default: 0 },
|
|
83
|
+
metadata_1: { type: mongoose.Schema.Types.Mixed, default: null },
|
|
84
|
+
metadata_2: { type: mongoose.Schema.Types.Mixed, default: null },
|
|
85
|
+
metadata_3: { type: mongoose.Schema.Types.Mixed, default: null },
|
|
86
|
+
jscode: { type: String, default: "" },
|
|
87
|
+
reset_js: { type: String, default: "" },
|
|
88
|
+
csscode: { type: String, default: "" },
|
|
89
|
+
changesets: { type: String, default: "[]" }
|
|
103
90
|
});
|
|
104
91
|
|
|
105
92
|
const TestSchema = new Schema<ITest>(
|
|
106
93
|
{
|
|
107
|
-
|
|
108
|
-
type:
|
|
109
|
-
|
|
94
|
+
organizationId: {
|
|
95
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
96
|
+
ref: "organization",
|
|
97
|
+
default: null
|
|
110
98
|
},
|
|
111
|
-
status: {
|
|
112
|
-
type: String,
|
|
99
|
+
status: {
|
|
100
|
+
type: String,
|
|
113
101
|
default: "draft",
|
|
114
|
-
enum: ["live", "draft", "ended", "paused", "preview"
|
|
115
|
-
},
|
|
116
|
-
name: {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
},
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
},
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
},
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
default: "",
|
|
143
|
-
},
|
|
144
|
-
reset_js: {
|
|
145
|
-
type: String,
|
|
146
|
-
},
|
|
147
|
-
csscode: {
|
|
148
|
-
type: String,
|
|
149
|
-
},
|
|
150
|
-
audiences: {
|
|
151
|
-
type: [mongoose.Schema.Types.ObjectId],
|
|
152
|
-
ref: "audience",
|
|
153
|
-
default: [],
|
|
154
|
-
},
|
|
155
|
-
pages: {
|
|
156
|
-
type: [mongoose.Schema.Types.ObjectId],
|
|
157
|
-
ref: "page",
|
|
158
|
-
default: [],
|
|
102
|
+
enum: ["live", "draft", "ended", "paused", "preview", "running"]
|
|
103
|
+
},
|
|
104
|
+
name: { type: String, required: true },
|
|
105
|
+
traffic_allocation: { type: Number, default: 100 },
|
|
106
|
+
audiences_match_type: { type: String, default: "all" },
|
|
107
|
+
|
|
108
|
+
// Metadata fields
|
|
109
|
+
metadata_1: { type: mongoose.Schema.Types.Mixed, default: null },
|
|
110
|
+
metadata_2: { type: mongoose.Schema.Types.Mixed, default: null },
|
|
111
|
+
metadata_3: { type: mongoose.Schema.Types.Mixed, default: null },
|
|
112
|
+
integrations_run_mode: { type: mongoose.Schema.Types.Mixed, default: null },
|
|
113
|
+
|
|
114
|
+
// Code fields
|
|
115
|
+
jscode: { type: String, default: "" },
|
|
116
|
+
reset_js: { type: String, default: "" },
|
|
117
|
+
csscode: { type: String, default: "" },
|
|
118
|
+
htmlcode: { type: String, default: "" },
|
|
119
|
+
|
|
120
|
+
// References with proper refs and defaults
|
|
121
|
+
audiences: {
|
|
122
|
+
type: [mongoose.Schema.Types.ObjectId],
|
|
123
|
+
ref: "audience",
|
|
124
|
+
default: []
|
|
125
|
+
},
|
|
126
|
+
pages: {
|
|
127
|
+
type: [mongoose.Schema.Types.ObjectId],
|
|
128
|
+
ref: "page",
|
|
129
|
+
default: []
|
|
159
130
|
},
|
|
160
131
|
variations: [VariationsSchema],
|
|
161
|
-
environments: {
|
|
162
|
-
type: [mongoose.Schema.Types.ObjectId],
|
|
163
|
-
ref: "environment",
|
|
164
|
-
default: []
|
|
165
|
-
},
|
|
166
|
-
pageelement: {
|
|
167
|
-
type: [mongoose.Schema.Types.ObjectId],
|
|
168
|
-
ref: "pageelement",
|
|
169
|
-
default: []
|
|
170
|
-
},
|
|
171
|
-
client: {
|
|
172
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
173
|
-
ref: "client"
|
|
174
|
-
},
|
|
175
|
-
|
|
176
|
-
type: mongoose.Schema.Types.
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
},
|
|
185
|
-
|
|
186
|
-
type: [mongoose.Schema.Types.ObjectId],
|
|
187
|
-
ref: "
|
|
188
|
-
default: []
|
|
189
|
-
},
|
|
190
|
-
|
|
191
|
-
type:
|
|
192
|
-
ref: "
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
default:
|
|
198
|
-
},
|
|
199
|
-
|
|
200
|
-
type:
|
|
201
|
-
|
|
202
|
-
},
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
},
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
},
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
},
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
},
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
},
|
|
228
|
-
|
|
229
|
-
type: String,
|
|
230
|
-
default: null,
|
|
231
|
-
},
|
|
232
|
-
pageNotContains: {
|
|
233
|
-
type: String,
|
|
234
|
-
default: null,
|
|
235
|
-
},
|
|
236
|
-
eventparameter: {
|
|
237
|
-
type: String,
|
|
238
|
-
default: null,
|
|
239
|
-
},
|
|
240
|
-
htmlcode: {
|
|
241
|
-
type: String,
|
|
242
|
-
default: "",
|
|
243
|
-
},
|
|
244
|
-
testid: {
|
|
245
|
-
type: String,
|
|
246
|
-
default: null,
|
|
247
|
-
},
|
|
248
|
-
testtool: {
|
|
249
|
-
type: String,
|
|
250
|
-
default: "",
|
|
251
|
-
},
|
|
252
|
-
kameleoontestdetails: {
|
|
253
|
-
type: mongoose.Schema.Types.Mixed,
|
|
254
|
-
default: null,
|
|
255
|
-
},
|
|
256
|
-
vwotestdetails: {
|
|
257
|
-
type: mongoose.Schema.Types.Mixed,
|
|
258
|
-
default: null,
|
|
259
|
-
},
|
|
260
|
-
trigger: {
|
|
261
|
-
type: [mongoose.Schema.Types.ObjectId],
|
|
262
|
-
ref: "trigger",
|
|
263
|
-
default: [],
|
|
264
|
-
},
|
|
265
|
-
triggerevents: {
|
|
266
|
-
type: [],
|
|
267
|
-
default: [],
|
|
268
|
-
},
|
|
269
|
-
stageincustomerjourney: {
|
|
270
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
271
|
-
ref: "stageincustomerjourney",
|
|
272
|
-
default: null,
|
|
273
|
-
},
|
|
274
|
-
selectedevent: {
|
|
275
|
-
type: String,
|
|
276
|
-
default: null,
|
|
277
|
-
},
|
|
278
|
-
revenue: {
|
|
279
|
-
type: [],
|
|
280
|
-
default: [],
|
|
281
|
-
},
|
|
282
|
-
significance: {
|
|
283
|
-
type: String,
|
|
284
|
-
default: "",
|
|
285
|
-
},
|
|
286
|
-
recommendedsamplesize: {
|
|
287
|
-
type: Number,
|
|
288
|
-
default: null,
|
|
289
|
-
},
|
|
290
|
-
livedate: {
|
|
291
|
-
type: Date,
|
|
292
|
-
default: null,
|
|
293
|
-
},
|
|
294
|
-
defaultControl: {
|
|
295
|
-
type: String,
|
|
296
|
-
default: null,
|
|
297
|
-
},
|
|
298
|
-
enddate: {
|
|
299
|
-
type: Date,
|
|
300
|
-
default: null,
|
|
301
|
-
},
|
|
132
|
+
environments: {
|
|
133
|
+
type: [mongoose.Schema.Types.ObjectId],
|
|
134
|
+
ref: "environment",
|
|
135
|
+
default: []
|
|
136
|
+
},
|
|
137
|
+
pageelement: {
|
|
138
|
+
type: [mongoose.Schema.Types.ObjectId],
|
|
139
|
+
ref: "pageelement",
|
|
140
|
+
default: []
|
|
141
|
+
},
|
|
142
|
+
client: {
|
|
143
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
144
|
+
ref: "client"
|
|
145
|
+
},
|
|
146
|
+
goal: {
|
|
147
|
+
type: [mongoose.Schema.Types.ObjectId],
|
|
148
|
+
ref: "goal",
|
|
149
|
+
default: []
|
|
150
|
+
},
|
|
151
|
+
pagetesttype: {
|
|
152
|
+
type: [mongoose.Schema.Types.ObjectId],
|
|
153
|
+
ref: "pagetesttype",
|
|
154
|
+
default: []
|
|
155
|
+
},
|
|
156
|
+
tags: {
|
|
157
|
+
type: [mongoose.Schema.Types.ObjectId],
|
|
158
|
+
ref: "tag",
|
|
159
|
+
default: []
|
|
160
|
+
},
|
|
161
|
+
hypothesis: {
|
|
162
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
163
|
+
ref: "hypos"
|
|
164
|
+
},
|
|
165
|
+
trigger: {
|
|
166
|
+
type: [mongoose.Schema.Types.ObjectId],
|
|
167
|
+
ref: "trigger",
|
|
168
|
+
default: []
|
|
169
|
+
},
|
|
170
|
+
stageincustomerjourney: {
|
|
171
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
172
|
+
ref: "stageincustomerjourney"
|
|
173
|
+
},
|
|
174
|
+
|
|
175
|
+
// Test configuration
|
|
176
|
+
property: { type: mongoose.Schema.Types.Mixed, default: null },
|
|
177
|
+
platform: { type: String, default: "BQ" },
|
|
178
|
+
viewId: { type: String, default: "" },
|
|
179
|
+
controlimage: { type: String, default: null },
|
|
180
|
+
variationimage: { type: String, default: null },
|
|
181
|
+
urltargeting: { type: [], default: [] },
|
|
182
|
+
pageaudience: { type: String, default: null },
|
|
183
|
+
targetaudience: { type: String, default: null },
|
|
184
|
+
page: { type: String, default: null },
|
|
185
|
+
pageNotContains: { type: String, default: null },
|
|
186
|
+
eventparameter: { type: String, default: null },
|
|
187
|
+
testid: { type: String, default: null },
|
|
188
|
+
testtool: { type: String, default: "" },
|
|
189
|
+
personalization: { type: Boolean, default: false },
|
|
190
|
+
kameleoontestdetails: { type: mongoose.Schema.Types.Mixed, default: null },
|
|
191
|
+
vwotestdetails: { type: mongoose.Schema.Types.Mixed, default: null },
|
|
192
|
+
triggerevents: { type: [], default: [] },
|
|
193
|
+
selectedevent: { type: String, default: null },
|
|
194
|
+
revenue: { type: [], default: [] },
|
|
195
|
+
significance: { type: String, default: "" },
|
|
196
|
+
recommendedsamplesize: { type: Number, default: null },
|
|
197
|
+
livedate: { type: Date, default: null },
|
|
198
|
+
defaultControl: { type: String, default: null },
|
|
199
|
+
enddate: { type: Date, default: null }
|
|
302
200
|
},
|
|
303
201
|
{
|
|
304
|
-
timestamps: true
|
|
202
|
+
timestamps: true
|
|
305
203
|
}
|
|
306
204
|
);
|
|
307
|
-
|
|
205
|
+
// Add compound indexes for better query performance
|
|
308
206
|
TestSchema.index({ client: 1, status: 1 });
|
|
207
|
+
TestSchema.index({ client: 1, status: 1, livedate: 1 });
|
|
208
|
+
TestSchema.index({ client: 1, status: 1, enddate: 1 });
|
|
209
|
+
TestSchema.index({ client: 1, testtool: 1, status: 1 });
|
|
210
|
+
TestSchema.index({ name: 1 }, { collation: { locale: 'en', strength: 2 } }); // Case-insensitive search
|
|
211
|
+
TestSchema.index({ "variations._id": 1 });
|
|
212
|
+
TestSchema.index({ status: 1, livedate: 1 });
|
|
213
|
+
TestSchema.index({ status: 1, enddate: 1 });
|
|
214
|
+
|
|
215
|
+
// Add partial indexes for better performance
|
|
216
|
+
TestSchema.index({ status: 1 }, { partialFilterExpression: { status: { $in: ['live', 'running', 'draft', 'paused', 'preview', 'ended'] } } });
|
|
217
|
+
TestSchema.index({ client: 1, status: 1 }, { partialFilterExpression: { status: { $in: ['live', 'running', 'draft', 'paused', 'preview', 'ended'] } } });
|
|
218
|
+
|
|
219
|
+
// Add TTL index for automatic cleanup of ended tests after 1 year
|
|
220
|
+
TestSchema.index({ enddate: 1 }, { expireAfterSeconds: 31536000 });
|
|
309
221
|
|
|
310
222
|
const Test = model<ITest>("test", TestSchema);
|
|
311
223
|
|
|
@@ -8,10 +8,16 @@ export interface ITestSequentialValue extends Document {
|
|
|
8
8
|
nMax: number;
|
|
9
9
|
createdAt?: Date;
|
|
10
10
|
updatedAt?: Date;
|
|
11
|
+
organizationId?: mongoose.Schema.Types.ObjectId;
|
|
11
12
|
}
|
|
12
13
|
|
|
13
14
|
const TestSequentialValueSchema = new Schema<ITestSequentialValue>(
|
|
14
15
|
{
|
|
16
|
+
organizationId: {
|
|
17
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
18
|
+
ref: "organization",
|
|
19
|
+
default: null,
|
|
20
|
+
},
|
|
15
21
|
test: {
|
|
16
22
|
type: mongoose.Schema.Types.ObjectId,
|
|
17
23
|
ref: "test",
|