codebase-models 3.2.1 → 3.2.2
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/src/models/Audience.d.ts +19 -0
- package/dist/src/models/Audience.js +48 -5
- package/dist/src/models/Page.d.ts +6 -0
- package/dist/src/models/Page.js +25 -2
- package/package.json +1 -1
- package/src/models/Audience.ts +69 -6
- package/src/models/Page.ts +32 -2
- package/src/models/Test.ts +3 -3
|
@@ -30,6 +30,25 @@ export interface IAudienceCondition extends Document {
|
|
|
30
30
|
conditionGroupLabel: string;
|
|
31
31
|
conditions: IAudienceConditionItem[];
|
|
32
32
|
}
|
|
33
|
+
export interface IConditionItem extends Document {
|
|
34
|
+
iid: string;
|
|
35
|
+
name: string;
|
|
36
|
+
url?: string;
|
|
37
|
+
url_type?: string;
|
|
38
|
+
matchType?: string;
|
|
39
|
+
type?: string;
|
|
40
|
+
metadata?: mongoose.Schema.Types.Mixed;
|
|
41
|
+
rules_js?: string;
|
|
42
|
+
rules_label?: string;
|
|
43
|
+
conditionGroupLabel?: string;
|
|
44
|
+
rules_value?: string;
|
|
45
|
+
}
|
|
46
|
+
export interface IConditionGroup extends Document {
|
|
47
|
+
iid: string;
|
|
48
|
+
name: string;
|
|
49
|
+
matchType: string;
|
|
50
|
+
conditions: IConditionItem[];
|
|
51
|
+
}
|
|
33
52
|
export interface IAudienceConditionItem extends Document {
|
|
34
53
|
iid: string;
|
|
35
54
|
type: string;
|
|
@@ -34,7 +34,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
34
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
35
|
const mongoose_1 = __importStar(require("mongoose"));
|
|
36
36
|
const constant_1 = require("../constant");
|
|
37
|
-
const
|
|
37
|
+
const ConditionItemSchema = new mongoose_1.Schema({
|
|
38
38
|
iid: {
|
|
39
39
|
type: String,
|
|
40
40
|
trim: true,
|
|
@@ -43,9 +43,9 @@ const conditionItemSchema = new mongoose_1.Schema({
|
|
|
43
43
|
},
|
|
44
44
|
type: {
|
|
45
45
|
type: String,
|
|
46
|
-
default: "
|
|
46
|
+
default: "advanced_js_code",
|
|
47
47
|
trim: true,
|
|
48
|
-
enum: ["js_code", "url_param", "cookie", "header", "user_agent", "location", "local_storage", "session_storage", "query_param"],
|
|
48
|
+
// enum: ["js_code", "url_param", "cookie", "header", "user_agent", "location", "local_storage", "session_storage", "query_param"],
|
|
49
49
|
},
|
|
50
50
|
rules_js: {
|
|
51
51
|
type: String,
|
|
@@ -75,7 +75,50 @@ const conditionItemSchema = new mongoose_1.Schema({
|
|
|
75
75
|
set: (value) => value.toLowerCase(),
|
|
76
76
|
},
|
|
77
77
|
});
|
|
78
|
-
|
|
78
|
+
const conditionGroupSchema = new mongoose_1.Schema({
|
|
79
|
+
iid: {
|
|
80
|
+
type: String,
|
|
81
|
+
trim: true,
|
|
82
|
+
default: () => (0, constant_1.generateRandomIID)(),
|
|
83
|
+
unique: true,
|
|
84
|
+
},
|
|
85
|
+
name: {
|
|
86
|
+
type: String,
|
|
87
|
+
required: true,
|
|
88
|
+
trim: true,
|
|
89
|
+
},
|
|
90
|
+
matchType: {
|
|
91
|
+
type: String,
|
|
92
|
+
required: true,
|
|
93
|
+
trim: true,
|
|
94
|
+
enum: ["AND", "OR"],
|
|
95
|
+
default: "OR",
|
|
96
|
+
},
|
|
97
|
+
conditions: [ConditionItemSchema],
|
|
98
|
+
});
|
|
99
|
+
const ConditionsSchema = new mongoose_1.Schema([
|
|
100
|
+
{
|
|
101
|
+
iid: {
|
|
102
|
+
type: String,
|
|
103
|
+
trim: true,
|
|
104
|
+
default: () => (0, constant_1.generateRandomIID)(),
|
|
105
|
+
unique: true,
|
|
106
|
+
},
|
|
107
|
+
name: {
|
|
108
|
+
type: String,
|
|
109
|
+
required: true,
|
|
110
|
+
trim: true,
|
|
111
|
+
},
|
|
112
|
+
matchType: {
|
|
113
|
+
type: String,
|
|
114
|
+
required: true,
|
|
115
|
+
trim: true,
|
|
116
|
+
enum: ["AND", "OR"],
|
|
117
|
+
default: "AND",
|
|
118
|
+
},
|
|
119
|
+
conditionGroups: [conditionGroupSchema],
|
|
120
|
+
}
|
|
121
|
+
]);
|
|
79
122
|
const AudienceSchema = new mongoose_1.Schema({
|
|
80
123
|
iid: {
|
|
81
124
|
type: String,
|
|
@@ -108,7 +151,7 @@ const AudienceSchema = new mongoose_1.Schema({
|
|
|
108
151
|
unique: true,
|
|
109
152
|
trim: true,
|
|
110
153
|
},
|
|
111
|
-
conditions: [
|
|
154
|
+
conditions: [ConditionsSchema],
|
|
112
155
|
client: {
|
|
113
156
|
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
114
157
|
ref: "client",
|
|
@@ -54,5 +54,11 @@ export interface IPage extends Document {
|
|
|
54
54
|
isActive?: boolean;
|
|
55
55
|
createdBy?: mongoose.Schema.Types.ObjectId;
|
|
56
56
|
}
|
|
57
|
+
export interface IConditionGroup extends Document {
|
|
58
|
+
iid: string;
|
|
59
|
+
name: string;
|
|
60
|
+
matchType: string;
|
|
61
|
+
conditions: IConditionItem[];
|
|
62
|
+
}
|
|
57
63
|
declare const Page: mongoose.Model<any, {}, {}, {}, any, any>;
|
|
58
64
|
export default Page;
|
package/dist/src/models/Page.js
CHANGED
|
@@ -65,6 +65,27 @@ const ConditionItemSchema = new mongoose_1.Schema({
|
|
|
65
65
|
set: (value) => value.toLowerCase(),
|
|
66
66
|
}
|
|
67
67
|
});
|
|
68
|
+
const conditionGroupSchema = new mongoose_1.Schema({
|
|
69
|
+
iid: {
|
|
70
|
+
type: String,
|
|
71
|
+
trim: true,
|
|
72
|
+
default: () => (0, constant_1.generateRandomIID)(),
|
|
73
|
+
unique: true,
|
|
74
|
+
},
|
|
75
|
+
name: {
|
|
76
|
+
type: String,
|
|
77
|
+
required: true,
|
|
78
|
+
trim: true,
|
|
79
|
+
},
|
|
80
|
+
matchType: {
|
|
81
|
+
type: String,
|
|
82
|
+
required: true,
|
|
83
|
+
trim: true,
|
|
84
|
+
enum: ["AND", "OR"],
|
|
85
|
+
default: "OR",
|
|
86
|
+
},
|
|
87
|
+
conditions: [ConditionItemSchema],
|
|
88
|
+
});
|
|
68
89
|
const ConditionsSchema = new mongoose_1.Schema([
|
|
69
90
|
{
|
|
70
91
|
iid: {
|
|
@@ -78,12 +99,14 @@ const ConditionsSchema = new mongoose_1.Schema([
|
|
|
78
99
|
required: true,
|
|
79
100
|
trim: true,
|
|
80
101
|
},
|
|
81
|
-
|
|
102
|
+
matchType: {
|
|
82
103
|
type: String,
|
|
83
104
|
required: true,
|
|
84
105
|
trim: true,
|
|
106
|
+
enum: ["AND", "OR"],
|
|
107
|
+
default: "AND",
|
|
85
108
|
},
|
|
86
|
-
|
|
109
|
+
conditionGroups: [conditionGroupSchema],
|
|
87
110
|
}
|
|
88
111
|
]);
|
|
89
112
|
const UrltargetingsSchema = new mongoose_1.Schema({
|
package/package.json
CHANGED
package/src/models/Audience.ts
CHANGED
|
@@ -8,6 +8,27 @@ export interface IAudienceCondition extends Document {
|
|
|
8
8
|
conditionGroupLabel: string;
|
|
9
9
|
conditions: IAudienceConditionItem[];
|
|
10
10
|
}
|
|
11
|
+
export interface IConditionItem extends Document {
|
|
12
|
+
iid: string;
|
|
13
|
+
name: string;
|
|
14
|
+
url?: string;
|
|
15
|
+
url_type?: string;
|
|
16
|
+
matchType?: string;
|
|
17
|
+
type?: string;
|
|
18
|
+
metadata?: mongoose.Schema.Types.Mixed;
|
|
19
|
+
rules_js?: string;
|
|
20
|
+
rules_label?: string;
|
|
21
|
+
conditionGroupLabel?: string;
|
|
22
|
+
rules_value?: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
export interface IConditionGroup extends Document {
|
|
27
|
+
iid: string;
|
|
28
|
+
name: string;
|
|
29
|
+
matchType: string;
|
|
30
|
+
conditions: IConditionItem[];
|
|
31
|
+
}
|
|
11
32
|
|
|
12
33
|
export interface IAudienceConditionItem extends Document {
|
|
13
34
|
iid: string;
|
|
@@ -33,7 +54,7 @@ export interface IAudience extends Document {
|
|
|
33
54
|
}
|
|
34
55
|
|
|
35
56
|
|
|
36
|
-
const
|
|
57
|
+
const ConditionItemSchema = new Schema<IConditionItem>(
|
|
37
58
|
{
|
|
38
59
|
iid: {
|
|
39
60
|
type: String,
|
|
@@ -43,9 +64,9 @@ const conditionItemSchema = new Schema<IAudienceConditionItem>(
|
|
|
43
64
|
},
|
|
44
65
|
type: {
|
|
45
66
|
type: String,
|
|
46
|
-
default: "
|
|
67
|
+
default: "advanced_js_code",
|
|
47
68
|
trim: true,
|
|
48
|
-
enum: ["js_code", "url_param", "cookie", "header", "user_agent", "location", "local_storage", "session_storage", "query_param"],
|
|
69
|
+
// enum: ["js_code", "url_param", "cookie", "header", "user_agent", "location", "local_storage", "session_storage", "query_param"],
|
|
49
70
|
},
|
|
50
71
|
rules_js: {
|
|
51
72
|
type: String,
|
|
@@ -76,8 +97,50 @@ const conditionItemSchema = new Schema<IAudienceConditionItem>(
|
|
|
76
97
|
},
|
|
77
98
|
},
|
|
78
99
|
);
|
|
79
|
-
|
|
80
|
-
|
|
100
|
+
const conditionGroupSchema = new Schema<IConditionGroup>({
|
|
101
|
+
iid: {
|
|
102
|
+
type: String,
|
|
103
|
+
trim: true,
|
|
104
|
+
default: () => generateRandomIID(),
|
|
105
|
+
unique: true,
|
|
106
|
+
},
|
|
107
|
+
name: {
|
|
108
|
+
type: String,
|
|
109
|
+
required: true,
|
|
110
|
+
trim: true,
|
|
111
|
+
},
|
|
112
|
+
matchType: {
|
|
113
|
+
type: String,
|
|
114
|
+
required: true,
|
|
115
|
+
trim: true,
|
|
116
|
+
enum: ["AND", "OR"],
|
|
117
|
+
default: "OR",
|
|
118
|
+
},
|
|
119
|
+
conditions: [ConditionItemSchema],
|
|
120
|
+
});
|
|
121
|
+
const ConditionsSchema = new Schema<IConditionItem[]>([
|
|
122
|
+
{
|
|
123
|
+
iid: {
|
|
124
|
+
type: String,
|
|
125
|
+
trim: true,
|
|
126
|
+
default: () => generateRandomIID(),
|
|
127
|
+
unique: true,
|
|
128
|
+
},
|
|
129
|
+
name: {
|
|
130
|
+
type: String,
|
|
131
|
+
required: true,
|
|
132
|
+
trim: true,
|
|
133
|
+
},
|
|
134
|
+
matchType: {
|
|
135
|
+
type: String,
|
|
136
|
+
required: true,
|
|
137
|
+
trim: true,
|
|
138
|
+
enum: ["AND", "OR"],
|
|
139
|
+
default: "AND",
|
|
140
|
+
},
|
|
141
|
+
conditionGroups: [conditionGroupSchema],
|
|
142
|
+
}
|
|
143
|
+
]);
|
|
81
144
|
|
|
82
145
|
const AudienceSchema = new Schema<IAudience>(
|
|
83
146
|
{
|
|
@@ -112,7 +175,7 @@ const AudienceSchema = new Schema<IAudience>(
|
|
|
112
175
|
unique: true,
|
|
113
176
|
trim: true,
|
|
114
177
|
},
|
|
115
|
-
conditions: [
|
|
178
|
+
conditions: [ConditionsSchema],
|
|
116
179
|
client: {
|
|
117
180
|
type: mongoose.Schema.Types.ObjectId,
|
|
118
181
|
ref: "client",
|
package/src/models/Page.ts
CHANGED
|
@@ -67,6 +67,34 @@ const ConditionItemSchema = new Schema<IConditionItem>({
|
|
|
67
67
|
}
|
|
68
68
|
});
|
|
69
69
|
|
|
70
|
+
export interface IConditionGroup extends Document {
|
|
71
|
+
iid: string;
|
|
72
|
+
name: string;
|
|
73
|
+
matchType: string;
|
|
74
|
+
conditions: IConditionItem[];
|
|
75
|
+
}
|
|
76
|
+
const conditionGroupSchema = new Schema<IConditionGroup>({
|
|
77
|
+
iid: {
|
|
78
|
+
type: String,
|
|
79
|
+
trim: true,
|
|
80
|
+
default: () => generateRandomIID(),
|
|
81
|
+
unique: true,
|
|
82
|
+
},
|
|
83
|
+
name: {
|
|
84
|
+
type: String,
|
|
85
|
+
required: true,
|
|
86
|
+
trim: true,
|
|
87
|
+
},
|
|
88
|
+
matchType: {
|
|
89
|
+
type: String,
|
|
90
|
+
required: true,
|
|
91
|
+
trim: true,
|
|
92
|
+
enum: ["AND", "OR"],
|
|
93
|
+
default: "OR",
|
|
94
|
+
},
|
|
95
|
+
conditions: [ConditionItemSchema],
|
|
96
|
+
});
|
|
97
|
+
|
|
70
98
|
const ConditionsSchema = new Schema<IConditionItem[]>([
|
|
71
99
|
{
|
|
72
100
|
iid: {
|
|
@@ -80,12 +108,14 @@ const ConditionsSchema = new Schema<IConditionItem[]>([
|
|
|
80
108
|
required: true,
|
|
81
109
|
trim: true,
|
|
82
110
|
},
|
|
83
|
-
|
|
111
|
+
matchType: {
|
|
84
112
|
type: String,
|
|
85
113
|
required: true,
|
|
86
114
|
trim: true,
|
|
115
|
+
enum: ["AND", "OR"],
|
|
116
|
+
default: "AND",
|
|
87
117
|
},
|
|
88
|
-
|
|
118
|
+
conditionGroups: [conditionGroupSchema],
|
|
89
119
|
}
|
|
90
120
|
]);
|
|
91
121
|
|
package/src/models/Test.ts
CHANGED
|
@@ -7,8 +7,8 @@ export interface IVariations extends Document {
|
|
|
7
7
|
css_code: string;
|
|
8
8
|
baseline: boolean;
|
|
9
9
|
traffic_allocation: number;
|
|
10
|
-
metadata_1: mongoose.Schema.Types.Mixed;
|
|
11
|
-
metadata_2: mongoose.Schema.Types.Mixed;
|
|
10
|
+
metadata_1: mongoose.Schema.Types.Mixed; // use to store redirect url settings
|
|
11
|
+
metadata_2: mongoose.Schema.Types.Mixed; // use to store screenshots and other metadata
|
|
12
12
|
metadata_3: mongoose.Schema.Types.Mixed;
|
|
13
13
|
jscode: string;
|
|
14
14
|
reset_js: string;
|
|
@@ -27,7 +27,7 @@ export interface ITest extends Document {
|
|
|
27
27
|
traffic_allocation_type: string;
|
|
28
28
|
traffic_allocation: number;
|
|
29
29
|
// Metadata fields
|
|
30
|
-
metadata_1: mongoose.Schema.Types.Mixed;
|
|
30
|
+
metadata_1: mongoose.Schema.Types.Mixed; // used to store test description and other metadata
|
|
31
31
|
metadata_2: mongoose.Schema.Types.Mixed;
|
|
32
32
|
metadata_3: mongoose.Schema.Types.Mixed;
|
|
33
33
|
integrations_run_mode: mongoose.Schema.Types.Mixed;
|