codebase-models 1.0.0 → 1.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/dist/index.d.ts +8 -1
- package/dist/index.js +60 -6
- package/dist/src/models/AppEvent.d.ts +56 -0
- package/dist/src/models/AppEvent.js +66 -0
- package/dist/src/models/Audience.d.ts +34 -0
- package/dist/src/models/Audience.js +43 -0
- package/dist/src/models/ClientExperiment.d.ts +58 -0
- package/dist/src/models/ClientExperiment.js +92 -0
- package/dist/src/models/ClientScript.d.ts +66 -0
- package/dist/src/models/ClientScript.js +143 -0
- package/dist/src/models/ClientSurvay.js +1 -1
- package/dist/src/models/Environment.d.ts +34 -0
- package/dist/src/models/Environment.js +45 -0
- package/dist/src/models/Experiments.d.ts +58 -0
- package/dist/src/models/Experiments.js +108 -0
- package/dist/src/models/Goal.d.ts +6 -0
- package/dist/src/models/Goal.js +46 -1
- package/dist/src/models/Notification.js +5 -5
- package/dist/src/models/Page.d.ts +45 -0
- package/dist/src/models/Page.js +76 -0
- package/dist/src/models/SegmentCombination.js +1 -1
- package/dist/src/models/Test.d.ts +28 -4
- package/dist/src/models/Test.js +92 -15
- package/index.ts +14 -0
- package/package.json +1 -1
- package/src/models/AppEvent.ts +81 -0
- package/src/models/Audience.ts +27 -0
- package/src/models/ClientExperiment.ts +113 -0
- package/src/models/ClientScript.ts +164 -0
- package/src/models/Environment.ts +29 -0
- package/src/models/Experiments.ts +118 -0
- package/src/models/Goal.ts +25 -0
- package/src/models/Page.ts +69 -0
- package/src/models/Test.ts +122 -19
package/dist/src/models/Test.js
CHANGED
|
@@ -24,15 +24,102 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
const mongoose_1 = __importStar(require("mongoose"));
|
|
27
|
-
const
|
|
27
|
+
const VariationsSchema = new mongoose_1.Schema({
|
|
28
28
|
name: {
|
|
29
29
|
type: String,
|
|
30
|
-
required: true,
|
|
31
30
|
},
|
|
31
|
+
css_code: {
|
|
32
|
+
type: String,
|
|
33
|
+
},
|
|
34
|
+
baseline: {
|
|
35
|
+
type: Boolean,
|
|
36
|
+
},
|
|
37
|
+
traffic_allocation: {
|
|
38
|
+
type: Number,
|
|
39
|
+
},
|
|
40
|
+
metadata_1: {
|
|
41
|
+
type: mongoose_1.default.Schema.Types.Mixed,
|
|
42
|
+
},
|
|
43
|
+
metadata_2: {
|
|
44
|
+
type: mongoose_1.default.Schema.Types.Mixed,
|
|
45
|
+
},
|
|
46
|
+
metadata_3: {
|
|
47
|
+
type: mongoose_1.default.Schema.Types.Mixed,
|
|
48
|
+
},
|
|
49
|
+
jscode: {
|
|
50
|
+
type: String,
|
|
51
|
+
},
|
|
52
|
+
reset_js: {
|
|
53
|
+
type: String,
|
|
54
|
+
},
|
|
55
|
+
csscode: {
|
|
56
|
+
type: String,
|
|
57
|
+
},
|
|
58
|
+
changesets: {
|
|
59
|
+
type: String,
|
|
60
|
+
default: "[]",
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
const TestSchema = new mongoose_1.Schema({
|
|
32
64
|
organisationId: {
|
|
33
65
|
type: String,
|
|
34
66
|
default: null,
|
|
35
67
|
},
|
|
68
|
+
status: {
|
|
69
|
+
type: String,
|
|
70
|
+
default: "draft",
|
|
71
|
+
enum: ["live", "draft", "ended", "paused", "preview"], // running is live
|
|
72
|
+
},
|
|
73
|
+
name: {
|
|
74
|
+
type: String,
|
|
75
|
+
required: true,
|
|
76
|
+
},
|
|
77
|
+
traffic_allocation: {
|
|
78
|
+
type: Number,
|
|
79
|
+
default: 100,
|
|
80
|
+
},
|
|
81
|
+
audiences_match_type: {
|
|
82
|
+
type: String,
|
|
83
|
+
default: "all",
|
|
84
|
+
},
|
|
85
|
+
metadata_1: {
|
|
86
|
+
type: mongoose_1.default.Schema.Types.Mixed,
|
|
87
|
+
},
|
|
88
|
+
metadata_2: {
|
|
89
|
+
type: mongoose_1.default.Schema.Types.Mixed,
|
|
90
|
+
},
|
|
91
|
+
metadata_3: {
|
|
92
|
+
type: mongoose_1.default.Schema.Types.Mixed,
|
|
93
|
+
},
|
|
94
|
+
integrations_run_mode: {
|
|
95
|
+
type: mongoose_1.default.Schema.Types.Mixed,
|
|
96
|
+
},
|
|
97
|
+
jscode: {
|
|
98
|
+
type: String,
|
|
99
|
+
default: "",
|
|
100
|
+
},
|
|
101
|
+
reset_js: {
|
|
102
|
+
type: String,
|
|
103
|
+
},
|
|
104
|
+
csscode: {
|
|
105
|
+
type: String,
|
|
106
|
+
},
|
|
107
|
+
audiences: {
|
|
108
|
+
type: [mongoose_1.default.Schema.Types.ObjectId],
|
|
109
|
+
ref: "audience",
|
|
110
|
+
default: [],
|
|
111
|
+
},
|
|
112
|
+
pages: {
|
|
113
|
+
type: [mongoose_1.default.Schema.Types.ObjectId],
|
|
114
|
+
ref: "page",
|
|
115
|
+
default: [],
|
|
116
|
+
},
|
|
117
|
+
variations: [VariationsSchema],
|
|
118
|
+
environments: {
|
|
119
|
+
type: [mongoose_1.default.Schema.Types.ObjectId],
|
|
120
|
+
ref: "environment",
|
|
121
|
+
default: [],
|
|
122
|
+
},
|
|
36
123
|
pageelement: {
|
|
37
124
|
type: [mongoose_1.default.Schema.Types.ObjectId],
|
|
38
125
|
ref: "pageelement",
|
|
@@ -47,7 +134,7 @@ const TestSchema = new mongoose_1.Schema({
|
|
|
47
134
|
},
|
|
48
135
|
platform: {
|
|
49
136
|
type: String,
|
|
50
|
-
default: "
|
|
137
|
+
default: "BQ",
|
|
51
138
|
},
|
|
52
139
|
viewId: {
|
|
53
140
|
type: String,
|
|
@@ -81,10 +168,12 @@ const TestSchema = new mongoose_1.Schema({
|
|
|
81
168
|
default: null,
|
|
82
169
|
},
|
|
83
170
|
// Action , Posibility, Hypothesis
|
|
171
|
+
// Check if we need anymore
|
|
84
172
|
urltargeting: {
|
|
85
173
|
type: [],
|
|
86
174
|
default: [],
|
|
87
175
|
},
|
|
176
|
+
// Check if we need anymore
|
|
88
177
|
pageaudience: {
|
|
89
178
|
type: String,
|
|
90
179
|
default: null,
|
|
@@ -109,13 +198,6 @@ const TestSchema = new mongoose_1.Schema({
|
|
|
109
198
|
type: String,
|
|
110
199
|
default: "",
|
|
111
200
|
},
|
|
112
|
-
csscode: {
|
|
113
|
-
type: String,
|
|
114
|
-
},
|
|
115
|
-
jscode: {
|
|
116
|
-
type: String,
|
|
117
|
-
default: "",
|
|
118
|
-
},
|
|
119
201
|
testid: {
|
|
120
202
|
type: String,
|
|
121
203
|
default: null,
|
|
@@ -162,11 +244,6 @@ const TestSchema = new mongoose_1.Schema({
|
|
|
162
244
|
type: Number,
|
|
163
245
|
default: null,
|
|
164
246
|
},
|
|
165
|
-
status: {
|
|
166
|
-
type: String,
|
|
167
|
-
default: "draft",
|
|
168
|
-
enum: ["live", "draft", "ended"],
|
|
169
|
-
},
|
|
170
247
|
livedate: {
|
|
171
248
|
type: Date,
|
|
172
249
|
default: null,
|
package/index.ts
CHANGED
|
@@ -7,6 +7,7 @@ import Report from "./src/models/Report";
|
|
|
7
7
|
import Test from "./src/models/Test";
|
|
8
8
|
import TestSequentialValue from "./src/models/TestSequentialValue";
|
|
9
9
|
import User from "./src/models/User";
|
|
10
|
+
import AppEvent from "./src/models/AppEvent";
|
|
10
11
|
import Announcement from "./src/models/Announcement";
|
|
11
12
|
import ClientAdditionalRevenue from "./src/models/ClientAdditionalRevenue";
|
|
12
13
|
import ClientLearning from "./src/models/ClientLearning";
|
|
@@ -17,6 +18,7 @@ import ClientRetention from "./src/models/ClientRetention";
|
|
|
17
18
|
import ClientStrategy from "./src/models/ClientStrategy";
|
|
18
19
|
import ClientSurvey from "./src/models/ClientSurvay";
|
|
19
20
|
import CVRReport from "./src/models/CVRReport";
|
|
21
|
+
import Experiments from "./src/models/Experiments";
|
|
20
22
|
import Faq from "./src/models/Faqs";
|
|
21
23
|
import Feedback from "./src/models/Feedback";
|
|
22
24
|
import Goal from "./src/models/Goal";
|
|
@@ -25,6 +27,7 @@ import HypothesisSheet from "./src/models/HypothesisSheet";
|
|
|
25
27
|
import LandingPages from "./src/models/LandingPages";
|
|
26
28
|
import NewIdeas from "./src/models/NewIdeas";
|
|
27
29
|
import Notification from "./src/models/Notification";
|
|
30
|
+
import Page from "./src/models/Page";
|
|
28
31
|
import PageElement from "./src/models/PageElement";
|
|
29
32
|
import PageTestType from "./src/models/PageTestType";
|
|
30
33
|
import Portfolio from "./src/models/Portfolio";
|
|
@@ -39,6 +42,10 @@ import Tag from "./src/models/Tag";
|
|
|
39
42
|
import Temp from "./src/models/Temp";
|
|
40
43
|
import Tier from "./src/models/Tier";
|
|
41
44
|
import Trigger from "./src/models/Trigger";
|
|
45
|
+
import ClientScript from "./src/models/ClientScript";
|
|
46
|
+
import ClientExperiment from "./src/models/ClientExperiment";
|
|
47
|
+
import Audience from "./src/models/Audience";
|
|
48
|
+
import Environment from './src/models/Environment'
|
|
42
49
|
|
|
43
50
|
async function seedRoles() {
|
|
44
51
|
const checkRoles = await Role.countDocuments();
|
|
@@ -89,6 +96,7 @@ export {
|
|
|
89
96
|
Test,
|
|
90
97
|
TestSequentialValue,
|
|
91
98
|
User,
|
|
99
|
+
AppEvent,
|
|
92
100
|
Announcement,
|
|
93
101
|
ClientAdditionalRevenue,
|
|
94
102
|
ClientLearning,
|
|
@@ -99,6 +107,7 @@ export {
|
|
|
99
107
|
ClientStrategy,
|
|
100
108
|
ClientSurvey,
|
|
101
109
|
CVRReport,
|
|
110
|
+
Experiments,
|
|
102
111
|
Faq,
|
|
103
112
|
Feedback,
|
|
104
113
|
Goal,
|
|
@@ -107,6 +116,7 @@ export {
|
|
|
107
116
|
LandingPages,
|
|
108
117
|
NewIdeas,
|
|
109
118
|
Notification,
|
|
119
|
+
Page,
|
|
110
120
|
PageElement,
|
|
111
121
|
PageTestType,
|
|
112
122
|
Portfolio,
|
|
@@ -121,4 +131,8 @@ export {
|
|
|
121
131
|
Temp,
|
|
122
132
|
Tier,
|
|
123
133
|
Trigger,
|
|
134
|
+
ClientScript,
|
|
135
|
+
ClientExperiment,
|
|
136
|
+
Audience,
|
|
137
|
+
Environment
|
|
124
138
|
};
|
package/package.json
CHANGED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import mongoose, { Document, Schema, model } from "mongoose";
|
|
2
|
+
|
|
3
|
+
export interface IPerformanceMetrics extends Document {
|
|
4
|
+
pageLoadTime?: string;
|
|
5
|
+
serverResponseTime?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface IEngagementMetrics extends Document {
|
|
8
|
+
bounceRate?: string;
|
|
9
|
+
sessionDuration?: string;
|
|
10
|
+
returnVisits?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface IBrowser extends Document {
|
|
13
|
+
browserName: string;
|
|
14
|
+
browserVersion?: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface IOs extends Document {
|
|
18
|
+
osName: string;
|
|
19
|
+
osVersion?: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface IAppEvent extends Document {
|
|
23
|
+
clientId?: mongoose.Schema.Types.ObjectId;
|
|
24
|
+
variant?: string;
|
|
25
|
+
viewId?: boolean;
|
|
26
|
+
browser?: IBrowser;
|
|
27
|
+
os?: IOs;
|
|
28
|
+
eventName?: string;
|
|
29
|
+
performanceMetrics?: IPerformanceMetrics;
|
|
30
|
+
engagementMetrics?: IEngagementMetrics;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const PerformanceMetricsSchema: Schema = new Schema<IBrowser>({
|
|
34
|
+
browserName: mongoose.Schema.Types.String,
|
|
35
|
+
browserVersion: mongoose.Schema.Types.String,
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
const EngagementMetricsSchema: Schema = new Schema<IBrowser>({
|
|
39
|
+
browserName: mongoose.Schema.Types.String,
|
|
40
|
+
browserVersion: mongoose.Schema.Types.String,
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
const browserSchema: Schema = new Schema<IBrowser>({
|
|
44
|
+
browserName: mongoose.Schema.Types.String,
|
|
45
|
+
browserVersion: mongoose.Schema.Types.String,
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
const osSchema: Schema = new Schema<IOs>({
|
|
49
|
+
osName: mongoose.Schema.Types.String,
|
|
50
|
+
osVersion: mongoose.Schema.Types.String,
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
const AppEventsSchema = new Schema<IAppEvent>(
|
|
54
|
+
{
|
|
55
|
+
clientId: {
|
|
56
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
57
|
+
ref: "client",
|
|
58
|
+
required: true,
|
|
59
|
+
},
|
|
60
|
+
variant: {
|
|
61
|
+
type: mongoose.Schema.Types.String,
|
|
62
|
+
},
|
|
63
|
+
viewId: {
|
|
64
|
+
type: String,
|
|
65
|
+
},
|
|
66
|
+
eventName: {
|
|
67
|
+
type: String,
|
|
68
|
+
},
|
|
69
|
+
performanceMetrics: PerformanceMetricsSchema,
|
|
70
|
+
engagementMetrics: EngagementMetricsSchema,
|
|
71
|
+
browser: browserSchema,
|
|
72
|
+
os: osSchema,
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
timestamps: true,
|
|
76
|
+
}
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
const AppEvent = model<IAppEvent>("appevent", AppEventsSchema);
|
|
80
|
+
|
|
81
|
+
export default AppEvent;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import mongoose, { Document, Schema, model } from "mongoose";
|
|
2
|
+
|
|
3
|
+
export interface IAudience extends Document {
|
|
4
|
+
name: string;
|
|
5
|
+
rules_js?: string;
|
|
6
|
+
client: mongoose.Schema.Types.ObjectId;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const AudienceSchema = new Schema<IAudience>({
|
|
10
|
+
name: {
|
|
11
|
+
type: String,
|
|
12
|
+
required: true,
|
|
13
|
+
},
|
|
14
|
+
rules_js: {
|
|
15
|
+
type: String,
|
|
16
|
+
},
|
|
17
|
+
client: {
|
|
18
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
19
|
+
ref: "client",
|
|
20
|
+
}
|
|
21
|
+
}, {
|
|
22
|
+
timestamps: true,
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
const Audience = model<IAudience>("audience", AudienceSchema);
|
|
26
|
+
|
|
27
|
+
export default Audience;
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import mongoose, { Document, Schema, model } from "mongoose";
|
|
2
|
+
|
|
3
|
+
export interface IPageTargeting extends Document {
|
|
4
|
+
condition: string;
|
|
5
|
+
routes: mongoose.Schema.Types.Mixed;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface IAudienceTargeting extends Document {
|
|
9
|
+
javascript: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface IVariants extends Document {
|
|
13
|
+
name: string;
|
|
14
|
+
javascript?: string;
|
|
15
|
+
css?: string;
|
|
16
|
+
traffic_allocation?: string;
|
|
17
|
+
slug?: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface IClientExperiment extends Document {
|
|
21
|
+
organisationId?: string;
|
|
22
|
+
client?: mongoose.Schema.Types.ObjectId;
|
|
23
|
+
viewId?: string;
|
|
24
|
+
javascript: string;
|
|
25
|
+
css: string;
|
|
26
|
+
name?: string;
|
|
27
|
+
status?: string;
|
|
28
|
+
experimentUrl: string;
|
|
29
|
+
pageTargeting: IPageTargeting;
|
|
30
|
+
audienceTargeting: IAudienceTargeting;
|
|
31
|
+
variants: IVariants;
|
|
32
|
+
createdAt?: Date;
|
|
33
|
+
updatedAt?: Date;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const PageTargetingSchema = new Schema<IPageTargeting>({
|
|
37
|
+
condition: {
|
|
38
|
+
type: String,
|
|
39
|
+
default: null,
|
|
40
|
+
},
|
|
41
|
+
routes: {
|
|
42
|
+
type: mongoose.Schema.Types.Mixed,
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
const AudienceTargetingSchema = new Schema<IAudienceTargeting>({
|
|
47
|
+
javascript: {
|
|
48
|
+
type: String,
|
|
49
|
+
default: "return true",
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
const VariantsSchema = new Schema<IVariants>({
|
|
54
|
+
name: {
|
|
55
|
+
type: String,
|
|
56
|
+
default: null,
|
|
57
|
+
},
|
|
58
|
+
traffic_allocation: {
|
|
59
|
+
type: Number,
|
|
60
|
+
default: null,
|
|
61
|
+
},
|
|
62
|
+
javascript: {
|
|
63
|
+
type: String,
|
|
64
|
+
default: null,
|
|
65
|
+
},
|
|
66
|
+
css: {
|
|
67
|
+
type: String,
|
|
68
|
+
default: null,
|
|
69
|
+
},
|
|
70
|
+
slug: {
|
|
71
|
+
type: String,
|
|
72
|
+
default: null,
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
const ClientExperimentSchema = new Schema<IClientExperiment>(
|
|
77
|
+
{
|
|
78
|
+
organisationId: {
|
|
79
|
+
type: String,
|
|
80
|
+
default: null,
|
|
81
|
+
},
|
|
82
|
+
name: String,
|
|
83
|
+
status: {
|
|
84
|
+
type: String,
|
|
85
|
+
default: "draft",
|
|
86
|
+
},
|
|
87
|
+
experimentUrl: String,
|
|
88
|
+
client: {
|
|
89
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
90
|
+
ref: "client",
|
|
91
|
+
},
|
|
92
|
+
viewId: {
|
|
93
|
+
type: String,
|
|
94
|
+
},
|
|
95
|
+
pageTargeting: [PageTargetingSchema],
|
|
96
|
+
audienceTargeting: AudienceTargetingSchema,
|
|
97
|
+
variants: [VariantsSchema],
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
timestamps: true,
|
|
101
|
+
}
|
|
102
|
+
);
|
|
103
|
+
|
|
104
|
+
ClientExperimentSchema.index({
|
|
105
|
+
client: 1,
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
const ClientExperiment = model<IClientExperiment>(
|
|
109
|
+
"clientexperiment",
|
|
110
|
+
ClientExperimentSchema
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
export default ClientExperiment;
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import mongoose, { Document, Schema, model } from "mongoose";
|
|
2
|
+
|
|
3
|
+
export interface IClientScriptSchema extends Document {
|
|
4
|
+
scriptUrl: string;
|
|
5
|
+
viewId: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface IClientScript extends Document {
|
|
9
|
+
organisationId?: string;
|
|
10
|
+
client?: mongoose.Schema.Types.ObjectId;
|
|
11
|
+
viewId?: string;
|
|
12
|
+
clientScriptURL: string;
|
|
13
|
+
jquery_include: string;
|
|
14
|
+
debug: Boolean;
|
|
15
|
+
restrict_debug: Boolean;
|
|
16
|
+
adhere_dnt: Boolean;
|
|
17
|
+
max_cookie_lifetime: Number;
|
|
18
|
+
activation_mode: string;
|
|
19
|
+
use_antiflicker: Boolean;
|
|
20
|
+
snippet_revision: Number;
|
|
21
|
+
rules: string;
|
|
22
|
+
rules_tracking: string;
|
|
23
|
+
tracker_url: string;
|
|
24
|
+
asset_url: string;
|
|
25
|
+
metadata_key_exp_1: mongoose.Schema.Types.Mixed;
|
|
26
|
+
metadata_key_exp_2: mongoose.Schema.Types.Mixed;
|
|
27
|
+
metadata_key_exp_3: mongoose.Schema.Types.Mixed;
|
|
28
|
+
metadata_key_var_1: mongoose.Schema.Types.Mixed;
|
|
29
|
+
metadata_key_var_2: mongoose.Schema.Types.Mixed;
|
|
30
|
+
metadata_key_var_3: mongoose.Schema.Types.Mixed;
|
|
31
|
+
cookie_domain: string;
|
|
32
|
+
snippet_version: Number;
|
|
33
|
+
storage: string;
|
|
34
|
+
run_only_on_reinit: Boolean;
|
|
35
|
+
allow_in_iframes: Boolean;
|
|
36
|
+
visual_editor_version: Number;
|
|
37
|
+
jscode: string;
|
|
38
|
+
csscode: string;
|
|
39
|
+
is_spa: Boolean;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const ClientScriptSchema = new Schema<IClientScript>(
|
|
43
|
+
{
|
|
44
|
+
organisationId: {
|
|
45
|
+
type: String,
|
|
46
|
+
default: null,
|
|
47
|
+
},
|
|
48
|
+
client: {
|
|
49
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
50
|
+
ref: "client",
|
|
51
|
+
},
|
|
52
|
+
viewId: {
|
|
53
|
+
type: String,
|
|
54
|
+
},
|
|
55
|
+
clientScriptURL: {
|
|
56
|
+
type: String,
|
|
57
|
+
},
|
|
58
|
+
jquery_include: {
|
|
59
|
+
type: String,
|
|
60
|
+
default: "false",
|
|
61
|
+
},
|
|
62
|
+
debug: {
|
|
63
|
+
type: Boolean,
|
|
64
|
+
default: false,
|
|
65
|
+
},
|
|
66
|
+
restrict_debug: {
|
|
67
|
+
type: Boolean,
|
|
68
|
+
default: false,
|
|
69
|
+
},
|
|
70
|
+
adhere_dnt: {
|
|
71
|
+
type: Boolean,
|
|
72
|
+
default: false,
|
|
73
|
+
},
|
|
74
|
+
max_cookie_lifetime: {
|
|
75
|
+
type: Number,
|
|
76
|
+
},
|
|
77
|
+
activation_mode: {
|
|
78
|
+
type: String,
|
|
79
|
+
},
|
|
80
|
+
use_antiflicker: {
|
|
81
|
+
type: Boolean,
|
|
82
|
+
default: false,
|
|
83
|
+
},
|
|
84
|
+
snippet_revision: {
|
|
85
|
+
type: Number,
|
|
86
|
+
default: 1,
|
|
87
|
+
},
|
|
88
|
+
rules: {
|
|
89
|
+
type: String,
|
|
90
|
+
default: "return true;"
|
|
91
|
+
},
|
|
92
|
+
rules_tracking: {
|
|
93
|
+
type: String,
|
|
94
|
+
default: "return true;"
|
|
95
|
+
},
|
|
96
|
+
tracker_url: {
|
|
97
|
+
type: String,
|
|
98
|
+
},
|
|
99
|
+
asset_url: {
|
|
100
|
+
type: String,
|
|
101
|
+
},
|
|
102
|
+
metadata_key_exp_1: {
|
|
103
|
+
type: mongoose.Schema.Types.Mixed,
|
|
104
|
+
},
|
|
105
|
+
metadata_key_exp_2: {
|
|
106
|
+
type: mongoose.Schema.Types.Mixed,
|
|
107
|
+
},
|
|
108
|
+
metadata_key_exp_3: {
|
|
109
|
+
type: mongoose.Schema.Types.Mixed,
|
|
110
|
+
},
|
|
111
|
+
metadata_key_var_1: {
|
|
112
|
+
type: mongoose.Schema.Types.Mixed,
|
|
113
|
+
},
|
|
114
|
+
metadata_key_var_2: {
|
|
115
|
+
type: mongoose.Schema.Types.Mixed,
|
|
116
|
+
},
|
|
117
|
+
metadata_key_var_3: {
|
|
118
|
+
type: mongoose.Schema.Types.Mixed,
|
|
119
|
+
},
|
|
120
|
+
cookie_domain: {
|
|
121
|
+
type: String,
|
|
122
|
+
},
|
|
123
|
+
snippet_version: {
|
|
124
|
+
type: Number,
|
|
125
|
+
},
|
|
126
|
+
storage: {
|
|
127
|
+
type: String,
|
|
128
|
+
default: "default",
|
|
129
|
+
},
|
|
130
|
+
run_only_on_reinit: {
|
|
131
|
+
type: Boolean,
|
|
132
|
+
default: false,
|
|
133
|
+
},
|
|
134
|
+
allow_in_iframes: {
|
|
135
|
+
type: Boolean,
|
|
136
|
+
default: false,
|
|
137
|
+
},
|
|
138
|
+
visual_editor_version: {
|
|
139
|
+
type: Number,
|
|
140
|
+
},
|
|
141
|
+
jscode: {
|
|
142
|
+
type: String,
|
|
143
|
+
},
|
|
144
|
+
csscode: {
|
|
145
|
+
type: String,
|
|
146
|
+
},
|
|
147
|
+
is_spa: {
|
|
148
|
+
type: Boolean,
|
|
149
|
+
default: false,
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
timestamps: true,
|
|
154
|
+
}
|
|
155
|
+
);
|
|
156
|
+
|
|
157
|
+
ClientScriptSchema.index({
|
|
158
|
+
client: 1,
|
|
159
|
+
viewId: 1,
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
const ClientScript = model<IClientScript>("clientscript", ClientScriptSchema);
|
|
163
|
+
|
|
164
|
+
export default ClientScript;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import mongoose, { Document, Schema, model } from "mongoose";
|
|
2
|
+
|
|
3
|
+
export interface IEnvironment extends Document {
|
|
4
|
+
name: string;
|
|
5
|
+
rules_js?: string;
|
|
6
|
+
client?: mongoose.Schema.Types.ObjectId;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const EnvironmentSchema = new Schema<IEnvironment>({
|
|
10
|
+
name: {
|
|
11
|
+
type: String,
|
|
12
|
+
required: true,
|
|
13
|
+
default: 'Default'
|
|
14
|
+
},
|
|
15
|
+
client: {
|
|
16
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
17
|
+
ref: "client",
|
|
18
|
+
},
|
|
19
|
+
rules_js: {
|
|
20
|
+
type: String,
|
|
21
|
+
default: "return true"
|
|
22
|
+
},
|
|
23
|
+
},{
|
|
24
|
+
timestamps: true
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
const Environment = model<IEnvironment>("environment", EnvironmentSchema);
|
|
28
|
+
|
|
29
|
+
export default Environment;
|