codebase-models 3.1.8 → 3.2.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/dist/index.d.ts +1 -2
- package/dist/index.js +2 -4
- package/dist/src/models/Audience.d.ts +17 -0
- package/dist/src/models/Audience.js +58 -0
- package/dist/src/models/Page.d.ts +9 -0
- package/dist/src/models/Page.js +55 -0
- package/dist/src/models/Snippet.d.ts +0 -1
- package/dist/src/models/Snippet.js +1 -6
- package/dist/src/models/Test.d.ts +3 -0
- package/dist/src/models/Test.js +11 -5
- package/index.ts +2 -4
- package/package.json +1 -1
- package/src/models/Audience.ts +85 -0
- package/src/models/Page.ts +68 -1
- package/src/models/Snippet.ts +6 -11
- package/src/models/Test.ts +63 -54
- package/dist/src/models/SnippetVersion.d.ts +0 -34
- package/dist/src/models/SnippetVersion.js +0 -55
- package/src/models/SnippetVersion.ts +0 -46
package/dist/index.d.ts
CHANGED
|
@@ -57,7 +57,6 @@ import Organization from "./src/models/Organization";
|
|
|
57
57
|
import Role from "./src/models/Role";
|
|
58
58
|
import SavedSegment from "./src/models/SavedSegment";
|
|
59
59
|
import Snippet from "./src/models/Snippet";
|
|
60
|
-
import SnippetVersion from "./src/models/SnippetVersion";
|
|
61
60
|
import StageInCustomerJourney from "./src/models/StageInCustomerJourney";
|
|
62
61
|
import Tag from "./src/models/Tag";
|
|
63
62
|
import Temp from "./src/models/Temp";
|
|
@@ -84,4 +83,4 @@ import ApiLog from "./src/models/ApiLog";
|
|
|
84
83
|
import { ProviderType } from "./src/models/Provider";
|
|
85
84
|
import OldReport from "./src/models/OldReport";
|
|
86
85
|
export declare function connect(uri: string, options?: mongoose.ConnectOptions | undefined): Promise<typeof mongoose>;
|
|
87
|
-
export { generateRandomIID, RolesConstants, Client, ClientReportsTemp, Report, Provider, Test, TestSequentialValue, User, AppEvent, Announcement, ClientAdditionalRevenue, ClientLearning, ClientLinks, ClientNextStep, ClientNote, ClientRetention, ClientStrategy, ClientSurvey, CVRReport, Faq, Feedback, Goal, Hypothesis, HypothesisSheet, LandingPages, NewIdeas, Notification, Page, PageElement, PageTestType, Portfolio, ReadNotification, Role, CustomQuery, SavedSegment, TestTimeline, Snippet,
|
|
86
|
+
export { generateRandomIID, RolesConstants, Client, ClientReportsTemp, Report, Provider, Test, TestSequentialValue, User, AppEvent, Announcement, ClientAdditionalRevenue, ClientLearning, ClientLinks, ClientNextStep, ClientNote, ClientRetention, ClientStrategy, ClientSurvey, CVRReport, Faq, Feedback, Goal, Hypothesis, HypothesisSheet, LandingPages, NewIdeas, Notification, Page, PageElement, PageTestType, Portfolio, ReadNotification, Role, CustomQuery, SavedSegment, TestTimeline, Snippet, StageInCustomerJourney, Tag, Temp, Tier, Trigger, ClientScript, Audience, Environment, Organization, PrecalculationFilters, BqPreCompiledData, CronData, CronConfig, UserPermission, UserOrganization, Package, Invitation, Thread, ThreadMessage, ApiLog, ProviderType, OldReport, };
|
package/dist/index.js
CHANGED
|
@@ -12,8 +12,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.PrecalculationFilters = exports.Organization = exports.Environment = exports.Audience = exports.ClientScript = exports.Trigger = exports.Tier = exports.Temp = exports.Tag = exports.StageInCustomerJourney = exports.
|
|
16
|
-
exports.OldReport = exports.ProviderType = exports.ApiLog = exports.ThreadMessage = exports.Thread = exports.Invitation = exports.Package = exports.UserOrganization = exports.UserPermission = exports.CronConfig = exports.CronData =
|
|
15
|
+
exports.BqPreCompiledData = exports.PrecalculationFilters = exports.Organization = exports.Environment = exports.Audience = exports.ClientScript = exports.Trigger = exports.Tier = exports.Temp = exports.Tag = exports.StageInCustomerJourney = exports.Snippet = exports.TestTimeline = exports.SavedSegment = exports.CustomQuery = exports.Role = exports.ReadNotification = exports.Portfolio = exports.PageTestType = exports.PageElement = exports.Page = exports.Notification = exports.NewIdeas = exports.LandingPages = exports.HypothesisSheet = exports.Hypothesis = exports.Goal = exports.Feedback = exports.Faq = exports.CVRReport = exports.ClientSurvey = exports.ClientStrategy = exports.ClientRetention = exports.ClientNote = exports.ClientNextStep = exports.ClientLinks = exports.ClientLearning = exports.ClientAdditionalRevenue = exports.Announcement = exports.AppEvent = exports.User = exports.TestSequentialValue = exports.Test = exports.Provider = exports.Report = exports.ClientReportsTemp = exports.Client = exports.RolesConstants = exports.generateRandomIID = exports.connect = void 0;
|
|
16
|
+
exports.OldReport = exports.ProviderType = exports.ApiLog = exports.ThreadMessage = exports.Thread = exports.Invitation = exports.Package = exports.UserOrganization = exports.UserPermission = exports.CronConfig = exports.CronData = void 0;
|
|
17
17
|
const mongoose_1 = __importDefault(require("mongoose"));
|
|
18
18
|
const Client_1 = __importDefault(require("./src/models/Client"));
|
|
19
19
|
exports.Client = Client_1.default;
|
|
@@ -83,8 +83,6 @@ const SavedSegment_1 = __importDefault(require("./src/models/SavedSegment"));
|
|
|
83
83
|
exports.SavedSegment = SavedSegment_1.default;
|
|
84
84
|
const Snippet_1 = __importDefault(require("./src/models/Snippet"));
|
|
85
85
|
exports.Snippet = Snippet_1.default;
|
|
86
|
-
const SnippetVersion_1 = __importDefault(require("./src/models/SnippetVersion"));
|
|
87
|
-
exports.SnippetVersion = SnippetVersion_1.default;
|
|
88
86
|
const StageInCustomerJourney_1 = __importDefault(require("./src/models/StageInCustomerJourney"));
|
|
89
87
|
exports.StageInCustomerJourney = StageInCustomerJourney_1.default;
|
|
90
88
|
const Tag_1 = __importDefault(require("./src/models/Tag"));
|
|
@@ -23,14 +23,31 @@
|
|
|
23
23
|
/// <reference types="mongoose/types/virtuals" />
|
|
24
24
|
/// <reference types="mongoose/types/inferschematype" />
|
|
25
25
|
import mongoose, { Document } from "mongoose";
|
|
26
|
+
export interface IAudienceCondition extends Document {
|
|
27
|
+
iid: string;
|
|
28
|
+
name: string;
|
|
29
|
+
conditionType: string;
|
|
30
|
+
conditionGroupLabel: string;
|
|
31
|
+
conditions: IAudienceConditionItem[];
|
|
32
|
+
}
|
|
33
|
+
export interface IAudienceConditionItem extends Document {
|
|
34
|
+
iid: string;
|
|
35
|
+
rules_js: string;
|
|
36
|
+
rules_label: string;
|
|
37
|
+
conditionGroupLabel: string;
|
|
38
|
+
rules_value: string;
|
|
39
|
+
}
|
|
26
40
|
export interface IAudience extends Document {
|
|
27
41
|
iid: string;
|
|
28
42
|
organizationId?: mongoose.Schema.Types.ObjectId;
|
|
43
|
+
newSchema: boolean;
|
|
29
44
|
name: string;
|
|
30
45
|
rules_js?: string;
|
|
31
46
|
generic: boolean;
|
|
32
47
|
client?: mongoose.Schema.Types.ObjectId;
|
|
33
48
|
createdBy?: mongoose.Schema.Types.ObjectId;
|
|
49
|
+
conditions: IAudienceConditionItem[];
|
|
50
|
+
api_name: string;
|
|
34
51
|
}
|
|
35
52
|
declare const Audience: mongoose.Model<any, {}, {}, {}, any, any>;
|
|
36
53
|
export default Audience;
|
|
@@ -34,6 +34,52 @@ 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 conditionItemSchema = new mongoose_1.Schema({
|
|
38
|
+
iid: {
|
|
39
|
+
type: String,
|
|
40
|
+
trim: true,
|
|
41
|
+
default: () => (0, constant_1.generateRandomIID)(),
|
|
42
|
+
unique: true,
|
|
43
|
+
},
|
|
44
|
+
rules_js: {
|
|
45
|
+
type: String,
|
|
46
|
+
default: "",
|
|
47
|
+
trim: true,
|
|
48
|
+
},
|
|
49
|
+
rules_label: {
|
|
50
|
+
type: String,
|
|
51
|
+
default: "",
|
|
52
|
+
trim: true,
|
|
53
|
+
},
|
|
54
|
+
rules_value: {
|
|
55
|
+
type: String,
|
|
56
|
+
default: "Group",
|
|
57
|
+
trim: true,
|
|
58
|
+
},
|
|
59
|
+
conditionGroupLabel: {
|
|
60
|
+
type: String,
|
|
61
|
+
default: "advanced",
|
|
62
|
+
trim: true,
|
|
63
|
+
enum: ["advanced", "custom", "common"],
|
|
64
|
+
get: (value) => value.toLowerCase(),
|
|
65
|
+
set: (value) => value.toLowerCase(),
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
|
+
conditionItemSchema.index({ iid: 1 }, { unique: true });
|
|
69
|
+
const AudienceConditionSchema = new mongoose_1.Schema({
|
|
70
|
+
iid: {
|
|
71
|
+
type: String,
|
|
72
|
+
trim: true,
|
|
73
|
+
default: () => (0, constant_1.generateRandomIID)(),
|
|
74
|
+
unique: true,
|
|
75
|
+
},
|
|
76
|
+
name: {
|
|
77
|
+
type: String,
|
|
78
|
+
required: true,
|
|
79
|
+
trim: true,
|
|
80
|
+
},
|
|
81
|
+
conditions: [conditionItemSchema],
|
|
82
|
+
});
|
|
37
83
|
const AudienceSchema = new mongoose_1.Schema({
|
|
38
84
|
iid: {
|
|
39
85
|
type: String,
|
|
@@ -44,6 +90,10 @@ const AudienceSchema = new mongoose_1.Schema({
|
|
|
44
90
|
ref: "organization",
|
|
45
91
|
default: null,
|
|
46
92
|
},
|
|
93
|
+
newSchema: {
|
|
94
|
+
type: Boolean,
|
|
95
|
+
default: false,
|
|
96
|
+
},
|
|
47
97
|
name: {
|
|
48
98
|
type: String,
|
|
49
99
|
required: true,
|
|
@@ -55,6 +105,14 @@ const AudienceSchema = new mongoose_1.Schema({
|
|
|
55
105
|
type: Boolean,
|
|
56
106
|
default: false,
|
|
57
107
|
},
|
|
108
|
+
api_name: {
|
|
109
|
+
type: String,
|
|
110
|
+
slug: ["name"],
|
|
111
|
+
slugPaddingSize: 4,
|
|
112
|
+
unique: true,
|
|
113
|
+
trim: true,
|
|
114
|
+
},
|
|
115
|
+
conditions: AudienceConditionSchema,
|
|
58
116
|
client: {
|
|
59
117
|
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
60
118
|
ref: "client",
|
|
@@ -29,9 +29,17 @@ export interface IUrltargetings extends Document {
|
|
|
29
29
|
url: string;
|
|
30
30
|
url_type: string;
|
|
31
31
|
}
|
|
32
|
+
export interface IConditionItem extends Document {
|
|
33
|
+
iid: string;
|
|
34
|
+
name: string;
|
|
35
|
+
url?: string;
|
|
36
|
+
url_type?: string;
|
|
37
|
+
matchType?: string;
|
|
38
|
+
}
|
|
32
39
|
export interface IPage extends Document {
|
|
33
40
|
iid: string;
|
|
34
41
|
name: string;
|
|
42
|
+
newSchema: boolean;
|
|
35
43
|
client?: mongoose.Schema.Types.ObjectId;
|
|
36
44
|
organizationId?: mongoose.Schema.Types.ObjectId;
|
|
37
45
|
trigger: string;
|
|
@@ -41,6 +49,7 @@ export interface IPage extends Document {
|
|
|
41
49
|
deactivation_mode: string;
|
|
42
50
|
rules_js: string;
|
|
43
51
|
urltargetings: IUrltargetings[];
|
|
52
|
+
conditions: IConditionItem[];
|
|
44
53
|
generic: boolean;
|
|
45
54
|
isActive?: boolean;
|
|
46
55
|
createdBy?: mongoose.Schema.Types.ObjectId;
|
package/dist/src/models/Page.js
CHANGED
|
@@ -39,6 +39,53 @@ const mongoose_1 = __importStar(require("mongoose"));
|
|
|
39
39
|
const mongoose_slug_updater_1 = __importDefault(require("mongoose-slug-updater"));
|
|
40
40
|
const constant_1 = require("../constant");
|
|
41
41
|
mongoose_1.default.plugin(mongoose_slug_updater_1.default);
|
|
42
|
+
const ConditionItemSchema = new mongoose_1.Schema({
|
|
43
|
+
iid: {
|
|
44
|
+
type: String,
|
|
45
|
+
trim: true,
|
|
46
|
+
default: () => (0, constant_1.generateRandomIID)(),
|
|
47
|
+
unique: true,
|
|
48
|
+
},
|
|
49
|
+
url: {
|
|
50
|
+
type: String,
|
|
51
|
+
required: true,
|
|
52
|
+
trim: true,
|
|
53
|
+
},
|
|
54
|
+
url_type: {
|
|
55
|
+
type: String,
|
|
56
|
+
required: true,
|
|
57
|
+
trim: true,
|
|
58
|
+
},
|
|
59
|
+
matchType: {
|
|
60
|
+
type: String,
|
|
61
|
+
required: true,
|
|
62
|
+
trim: true,
|
|
63
|
+
enum: ["include", "exclude"],
|
|
64
|
+
get: (value) => value.toLowerCase(),
|
|
65
|
+
set: (value) => value.toLowerCase(),
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
const ConditionsSchema = new mongoose_1.Schema([
|
|
69
|
+
{
|
|
70
|
+
iid: {
|
|
71
|
+
type: String,
|
|
72
|
+
trim: true,
|
|
73
|
+
default: () => (0, constant_1.generateRandomIID)(),
|
|
74
|
+
unique: true,
|
|
75
|
+
},
|
|
76
|
+
name: {
|
|
77
|
+
type: String,
|
|
78
|
+
required: true,
|
|
79
|
+
trim: true,
|
|
80
|
+
},
|
|
81
|
+
conditionType: {
|
|
82
|
+
type: String,
|
|
83
|
+
required: true,
|
|
84
|
+
trim: true,
|
|
85
|
+
},
|
|
86
|
+
conditions: [ConditionItemSchema],
|
|
87
|
+
}
|
|
88
|
+
]);
|
|
42
89
|
const UrltargetingsSchema = new mongoose_1.Schema({
|
|
43
90
|
iid: {
|
|
44
91
|
type: String,
|
|
@@ -65,6 +112,10 @@ const PageSchema = new mongoose_1.Schema({
|
|
|
65
112
|
type: String,
|
|
66
113
|
trim: true,
|
|
67
114
|
},
|
|
115
|
+
newSchema: {
|
|
116
|
+
type: Boolean,
|
|
117
|
+
default: false,
|
|
118
|
+
},
|
|
68
119
|
name: {
|
|
69
120
|
type: String,
|
|
70
121
|
required: true,
|
|
@@ -104,6 +155,9 @@ const PageSchema = new mongoose_1.Schema({
|
|
|
104
155
|
type: String,
|
|
105
156
|
default: "reset",
|
|
106
157
|
trim: true,
|
|
158
|
+
// enum: ["reset", "deactivate"],
|
|
159
|
+
get: (value) => value.toLowerCase(),
|
|
160
|
+
set: (value) => value.toLowerCase(),
|
|
107
161
|
},
|
|
108
162
|
rules_js: {
|
|
109
163
|
type: String,
|
|
@@ -111,6 +165,7 @@ const PageSchema = new mongoose_1.Schema({
|
|
|
111
165
|
trim: true,
|
|
112
166
|
},
|
|
113
167
|
urltargetings: [UrltargetingsSchema],
|
|
168
|
+
conditions: [ConditionsSchema],
|
|
114
169
|
generic: {
|
|
115
170
|
type: Boolean,
|
|
116
171
|
default: false,
|
|
@@ -37,7 +37,6 @@ export interface ISnippet extends Document {
|
|
|
37
37
|
status?: string;
|
|
38
38
|
isActive?: boolean;
|
|
39
39
|
organizationId?: mongoose.Schema.Types.ObjectId;
|
|
40
|
-
versions?: mongoose.Schema.Types.ObjectId[];
|
|
41
40
|
}
|
|
42
41
|
declare const Snippet: mongoose.Model<any, {}, {}, {}, any, any>;
|
|
43
42
|
export default Snippet;
|
|
@@ -86,12 +86,7 @@ const SnippetSchema = new mongoose_1.Schema({
|
|
|
86
86
|
isActive: {
|
|
87
87
|
type: Boolean,
|
|
88
88
|
default: true,
|
|
89
|
-
}
|
|
90
|
-
versions: {
|
|
91
|
-
type: [mongoose_1.default.Schema.Types.ObjectId],
|
|
92
|
-
ref: "snippetversion",
|
|
93
|
-
default: [],
|
|
94
|
-
},
|
|
89
|
+
}
|
|
95
90
|
}, {
|
|
96
91
|
timestamps: true,
|
|
97
92
|
});
|
|
@@ -46,6 +46,9 @@ export interface ITest extends Document {
|
|
|
46
46
|
traffic_allocation_type: string;
|
|
47
47
|
traffic_allocation: number;
|
|
48
48
|
audiences_match_type: string;
|
|
49
|
+
pages_match_type: string;
|
|
50
|
+
page_targeting?: mongoose.Schema.Types.ObjectId;
|
|
51
|
+
audience_targeting?: mongoose.Schema.Types.ObjectId;
|
|
49
52
|
metadata_1: mongoose.Schema.Types.Mixed;
|
|
50
53
|
metadata_2: mongoose.Schema.Types.Mixed;
|
|
51
54
|
metadata_3: mongoose.Schema.Types.Mixed;
|
package/dist/src/models/Test.js
CHANGED
|
@@ -35,7 +35,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
35
35
|
const mongoose_1 = __importStar(require("mongoose"));
|
|
36
36
|
const constant_1 = require("../constant");
|
|
37
37
|
const VariationsSchema = new mongoose_1.Schema({
|
|
38
|
-
iid: {
|
|
38
|
+
iid: {
|
|
39
|
+
type: String,
|
|
39
40
|
trim: true,
|
|
40
41
|
unique: true,
|
|
41
42
|
},
|
|
@@ -62,12 +63,16 @@ const TestSchema = new mongoose_1.Schema({
|
|
|
62
63
|
status: {
|
|
63
64
|
type: String,
|
|
64
65
|
default: "draft",
|
|
65
|
-
enum: ["live", "draft", "ended", "paused", "preview", "running", "archive"]
|
|
66
|
+
enum: ["live", "draft", "ended", "paused", "preview", "running", "archive"],
|
|
67
|
+
transform: (value) => value.toLowerCase(),
|
|
66
68
|
},
|
|
67
69
|
name: { type: String, required: true },
|
|
68
70
|
traffic_allocation_type: { type: String, default: "manual", enum: ["manual", "multi-armed", "contextual"] },
|
|
69
71
|
traffic_allocation: { type: Number, default: 100 },
|
|
70
|
-
audiences_match_type: { type: String, default: "all" },
|
|
72
|
+
audiences_match_type: { type: String, default: "AND", enum: ["AND", "OR", "any", "all"] },
|
|
73
|
+
pages_match_type: { type: String, default: "AND", enum: ["AND", "OR", "any", "all"] },
|
|
74
|
+
page_targeting: { type: mongoose_1.default.Schema.Types.ObjectId, ref: "page", default: null },
|
|
75
|
+
audience_targeting: { type: mongoose_1.default.Schema.Types.ObjectId, ref: "audience", default: null },
|
|
71
76
|
// Metadata fields
|
|
72
77
|
metadata_1: { type: mongoose_1.default.Schema.Types.Mixed, default: null },
|
|
73
78
|
metadata_2: { type: mongoose_1.default.Schema.Types.Mixed, default: null },
|
|
@@ -146,7 +151,9 @@ const TestSchema = new mongoose_1.Schema({
|
|
|
146
151
|
pageNotContains: { type: String, default: null },
|
|
147
152
|
eventparameter: { type: String, default: null },
|
|
148
153
|
testid: { type: String, default: null },
|
|
149
|
-
testtool: { type: String, default: ""
|
|
154
|
+
testtool: { type: String, default: "",
|
|
155
|
+
transform: (value) => (value === null || value === void 0 ? void 0 : value.toLowerCase()) || "",
|
|
156
|
+
},
|
|
150
157
|
personalization: { type: Boolean, default: false },
|
|
151
158
|
qaMode: { type: Boolean, default: false },
|
|
152
159
|
dnt: { type: Boolean, default: false },
|
|
@@ -201,7 +208,6 @@ TestSchema.index({ iid: 1 });
|
|
|
201
208
|
TestSchema.index({ client: 1, status: 1 });
|
|
202
209
|
TestSchema.index({ client: 1, status: 1, livedate: 1 });
|
|
203
210
|
TestSchema.index({ client: 1, status: 1, enddate: 1 });
|
|
204
|
-
TestSchema.index({ client: 1, testtool: 1, status: 1 });
|
|
205
211
|
TestSchema.index({ name: 1 }, { collation: { locale: 'en', strength: 2 } }); // Case-insensitive search
|
|
206
212
|
TestSchema.index({ "variations._id": 1 });
|
|
207
213
|
TestSchema.index({ status: 1, livedate: 1 });
|
package/index.ts
CHANGED
|
@@ -34,7 +34,6 @@ import Organization from "./src/models/Organization";
|
|
|
34
34
|
import Role from "./src/models/Role";
|
|
35
35
|
import SavedSegment from "./src/models/SavedSegment";
|
|
36
36
|
import Snippet from "./src/models/Snippet";
|
|
37
|
-
import SnippetVersion from "./src/models/SnippetVersion";
|
|
38
37
|
import StageInCustomerJourney from "./src/models/StageInCustomerJourney";
|
|
39
38
|
import Tag from "./src/models/Tag";
|
|
40
39
|
import Temp from "./src/models/Temp";
|
|
@@ -80,7 +79,7 @@ async function seedRoles() {
|
|
|
80
79
|
},
|
|
81
80
|
},
|
|
82
81
|
]);
|
|
83
|
-
})
|
|
82
|
+
})
|
|
84
83
|
);
|
|
85
84
|
console.log("Roles seeded successfully");
|
|
86
85
|
}
|
|
@@ -88,7 +87,7 @@ async function seedRoles() {
|
|
|
88
87
|
|
|
89
88
|
export async function connect(
|
|
90
89
|
uri: string,
|
|
91
|
-
options?: mongoose.ConnectOptions | undefined
|
|
90
|
+
options?: mongoose.ConnectOptions | undefined
|
|
92
91
|
): Promise<typeof mongoose> {
|
|
93
92
|
if (uri) {
|
|
94
93
|
if (mongoose.connection.readyState === 1) {
|
|
@@ -146,7 +145,6 @@ export {
|
|
|
146
145
|
SavedSegment,
|
|
147
146
|
TestTimeline,
|
|
148
147
|
Snippet,
|
|
149
|
-
SnippetVersion,
|
|
150
148
|
StageInCustomerJourney,
|
|
151
149
|
Tag,
|
|
152
150
|
Temp,
|
package/package.json
CHANGED
package/src/models/Audience.ts
CHANGED
|
@@ -1,16 +1,89 @@
|
|
|
1
1
|
import mongoose, { Document, Schema, model } from "mongoose";
|
|
2
2
|
import { generateRandomIID } from "../constant";
|
|
3
3
|
|
|
4
|
+
export interface IAudienceCondition extends Document {
|
|
5
|
+
iid: string;
|
|
6
|
+
name: string;
|
|
7
|
+
conditionType: string;
|
|
8
|
+
conditionGroupLabel: string;
|
|
9
|
+
conditions: IAudienceConditionItem[];
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface IAudienceConditionItem extends Document {
|
|
13
|
+
iid: string;
|
|
14
|
+
rules_js: string;
|
|
15
|
+
rules_label: string;
|
|
16
|
+
conditionGroupLabel: string;
|
|
17
|
+
rules_value: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
4
20
|
export interface IAudience extends Document {
|
|
5
21
|
iid: string;
|
|
6
22
|
organizationId?: mongoose.Schema.Types.ObjectId;
|
|
23
|
+
newSchema: boolean;
|
|
7
24
|
name: string;
|
|
8
25
|
rules_js?: string;
|
|
9
26
|
generic: boolean;
|
|
10
27
|
client?: mongoose.Schema.Types.ObjectId;
|
|
11
28
|
createdBy?: mongoose.Schema.Types.ObjectId;
|
|
29
|
+
conditions: IAudienceConditionItem[];
|
|
30
|
+
api_name: string;
|
|
12
31
|
}
|
|
13
32
|
|
|
33
|
+
|
|
34
|
+
const conditionItemSchema = new Schema<IAudienceConditionItem>(
|
|
35
|
+
{
|
|
36
|
+
iid: {
|
|
37
|
+
type: String,
|
|
38
|
+
trim: true,
|
|
39
|
+
default: () => generateRandomIID(),
|
|
40
|
+
unique: true,
|
|
41
|
+
},
|
|
42
|
+
rules_js: {
|
|
43
|
+
type: String,
|
|
44
|
+
default: "",
|
|
45
|
+
trim: true,
|
|
46
|
+
},
|
|
47
|
+
rules_label: {
|
|
48
|
+
type: String,
|
|
49
|
+
default: "",
|
|
50
|
+
trim: true,
|
|
51
|
+
},
|
|
52
|
+
rules_value: {
|
|
53
|
+
type: String,
|
|
54
|
+
default: "Group",
|
|
55
|
+
trim: true,
|
|
56
|
+
},
|
|
57
|
+
conditionGroupLabel: {
|
|
58
|
+
type: String,
|
|
59
|
+
default: "advanced",
|
|
60
|
+
trim: true,
|
|
61
|
+
enum: ["advanced", "custom","common"],
|
|
62
|
+
get: (value: string) => value.toLowerCase(),
|
|
63
|
+
set: (value: string) => value.toLowerCase(),
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
conditionItemSchema.index({ iid: 1 }, { unique: true });
|
|
69
|
+
|
|
70
|
+
const AudienceConditionSchema = new Schema<IAudienceCondition>(
|
|
71
|
+
{
|
|
72
|
+
iid: {
|
|
73
|
+
type: String,
|
|
74
|
+
trim: true,
|
|
75
|
+
default: () => generateRandomIID(),
|
|
76
|
+
unique: true,
|
|
77
|
+
},
|
|
78
|
+
name: {
|
|
79
|
+
type: String,
|
|
80
|
+
required: true,
|
|
81
|
+
trim: true,
|
|
82
|
+
},
|
|
83
|
+
conditions: [conditionItemSchema],
|
|
84
|
+
}
|
|
85
|
+
);
|
|
86
|
+
|
|
14
87
|
const AudienceSchema = new Schema<IAudience>(
|
|
15
88
|
{
|
|
16
89
|
iid: {
|
|
@@ -22,6 +95,10 @@ const AudienceSchema = new Schema<IAudience>(
|
|
|
22
95
|
ref: "organization",
|
|
23
96
|
default: null,
|
|
24
97
|
},
|
|
98
|
+
newSchema: {
|
|
99
|
+
type: Boolean,
|
|
100
|
+
default: false,
|
|
101
|
+
},
|
|
25
102
|
name: {
|
|
26
103
|
type: String,
|
|
27
104
|
required: true,
|
|
@@ -33,6 +110,14 @@ const AudienceSchema = new Schema<IAudience>(
|
|
|
33
110
|
type: Boolean,
|
|
34
111
|
default: false,
|
|
35
112
|
},
|
|
113
|
+
api_name: {
|
|
114
|
+
type: String,
|
|
115
|
+
slug: ["name"],
|
|
116
|
+
slugPaddingSize: 4,
|
|
117
|
+
unique: true,
|
|
118
|
+
trim: true,
|
|
119
|
+
},
|
|
120
|
+
conditions: AudienceConditionSchema,
|
|
36
121
|
client: {
|
|
37
122
|
type: mongoose.Schema.Types.ObjectId,
|
|
38
123
|
ref: "client",
|
package/src/models/Page.ts
CHANGED
|
@@ -13,9 +13,18 @@ export interface IUrltargetings extends Document {
|
|
|
13
13
|
url_type: string;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
+
export interface IConditionItem extends Document {
|
|
17
|
+
iid: string;
|
|
18
|
+
name: string;
|
|
19
|
+
url?: string;
|
|
20
|
+
url_type?: string;
|
|
21
|
+
matchType?: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
16
24
|
export interface IPage extends Document {
|
|
17
25
|
iid: string;
|
|
18
26
|
name: string;
|
|
27
|
+
newSchema: boolean;
|
|
19
28
|
client?: mongoose.Schema.Types.ObjectId;
|
|
20
29
|
organizationId?: mongoose.Schema.Types.ObjectId;
|
|
21
30
|
trigger: string;
|
|
@@ -25,11 +34,61 @@ export interface IPage extends Document {
|
|
|
25
34
|
deactivation_mode: string;
|
|
26
35
|
rules_js: string;
|
|
27
36
|
urltargetings: IUrltargetings[];
|
|
37
|
+
conditions: IConditionItem[];
|
|
28
38
|
generic: boolean;
|
|
29
39
|
isActive?: boolean;
|
|
30
40
|
createdBy?: mongoose.Schema.Types.ObjectId;
|
|
31
41
|
}
|
|
32
42
|
|
|
43
|
+
const ConditionItemSchema = new Schema<IConditionItem>({
|
|
44
|
+
iid: {
|
|
45
|
+
type: String,
|
|
46
|
+
trim: true,
|
|
47
|
+
default: () => generateRandomIID(),
|
|
48
|
+
unique: true,
|
|
49
|
+
},
|
|
50
|
+
url: {
|
|
51
|
+
type: String,
|
|
52
|
+
required: true,
|
|
53
|
+
trim: true,
|
|
54
|
+
},
|
|
55
|
+
url_type: {
|
|
56
|
+
type: String,
|
|
57
|
+
required: true,
|
|
58
|
+
trim: true,
|
|
59
|
+
},
|
|
60
|
+
matchType: {
|
|
61
|
+
type: String,
|
|
62
|
+
required: true,
|
|
63
|
+
trim: true,
|
|
64
|
+
enum: ["include", "exclude"],
|
|
65
|
+
get: (value: string) => value.toLowerCase(),
|
|
66
|
+
set: (value: string) => value.toLowerCase(),
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
const ConditionsSchema = new Schema<IConditionItem[]>([
|
|
71
|
+
{
|
|
72
|
+
iid: {
|
|
73
|
+
type: String,
|
|
74
|
+
trim: true,
|
|
75
|
+
default: () => generateRandomIID(),
|
|
76
|
+
unique: true,
|
|
77
|
+
},
|
|
78
|
+
name: {
|
|
79
|
+
type: String,
|
|
80
|
+
required: true,
|
|
81
|
+
trim: true,
|
|
82
|
+
},
|
|
83
|
+
conditionType: {
|
|
84
|
+
type: String,
|
|
85
|
+
required: true,
|
|
86
|
+
trim: true,
|
|
87
|
+
},
|
|
88
|
+
conditions: [ConditionItemSchema],
|
|
89
|
+
}
|
|
90
|
+
]);
|
|
91
|
+
|
|
33
92
|
const UrltargetingsSchema = new Schema<IUrltargetings>({
|
|
34
93
|
iid: {
|
|
35
94
|
type: String,
|
|
@@ -57,6 +116,10 @@ const PageSchema = new Schema<IPage>({
|
|
|
57
116
|
type: String,
|
|
58
117
|
trim: true,
|
|
59
118
|
},
|
|
119
|
+
newSchema: {
|
|
120
|
+
type: Boolean,
|
|
121
|
+
default: false,
|
|
122
|
+
},
|
|
60
123
|
name: {
|
|
61
124
|
type: String,
|
|
62
125
|
required: true,
|
|
@@ -86,7 +149,7 @@ const PageSchema = new Schema<IPage>({
|
|
|
86
149
|
},
|
|
87
150
|
api_name: {
|
|
88
151
|
type: String,
|
|
89
|
-
slug: ["name"],
|
|
152
|
+
slug: ["name"],
|
|
90
153
|
slugPaddingSize: 4,
|
|
91
154
|
unique: true,
|
|
92
155
|
trim: true,
|
|
@@ -99,6 +162,9 @@ const PageSchema = new Schema<IPage>({
|
|
|
99
162
|
type: String,
|
|
100
163
|
default: "reset",
|
|
101
164
|
trim: true,
|
|
165
|
+
// enum: ["reset", "deactivate"],
|
|
166
|
+
get: (value: string) => value.toLowerCase(),
|
|
167
|
+
set: (value: string) => value.toLowerCase(),
|
|
102
168
|
},
|
|
103
169
|
rules_js: {
|
|
104
170
|
type: String,
|
|
@@ -106,6 +172,7 @@ const PageSchema = new Schema<IPage>({
|
|
|
106
172
|
trim: true,
|
|
107
173
|
},
|
|
108
174
|
urltargetings: [UrltargetingsSchema],
|
|
175
|
+
conditions: [ConditionsSchema],
|
|
109
176
|
generic: {
|
|
110
177
|
type: Boolean,
|
|
111
178
|
default: false,
|
package/src/models/Snippet.ts
CHANGED
|
@@ -14,7 +14,6 @@ export interface ISnippet extends Document {
|
|
|
14
14
|
status?: string;
|
|
15
15
|
isActive?: boolean;
|
|
16
16
|
organizationId?: mongoose.Schema.Types.ObjectId;
|
|
17
|
-
versions?: mongoose.Schema.Types.ObjectId[];
|
|
18
17
|
}
|
|
19
18
|
|
|
20
19
|
const SnippetSchema = new Schema<ISnippet>(
|
|
@@ -23,6 +22,7 @@ const SnippetSchema = new Schema<ISnippet>(
|
|
|
23
22
|
type: mongoose.Schema.Types.ObjectId,
|
|
24
23
|
ref: "organization",
|
|
25
24
|
default: null,
|
|
25
|
+
|
|
26
26
|
},
|
|
27
27
|
name: {
|
|
28
28
|
type: String,
|
|
@@ -75,21 +75,16 @@ const SnippetSchema = new Schema<ISnippet>(
|
|
|
75
75
|
status: {
|
|
76
76
|
type: String,
|
|
77
77
|
default: "live",
|
|
78
|
-
enum: ["live", "draft",
|
|
78
|
+
enum: ["live", "draft","running","paused","preview","ended"],
|
|
79
79
|
},
|
|
80
80
|
isActive: {
|
|
81
81
|
type: Boolean,
|
|
82
82
|
default: true,
|
|
83
|
-
}
|
|
84
|
-
versions: {
|
|
85
|
-
type: [mongoose.Schema.Types.ObjectId],
|
|
86
|
-
ref: "snippetversion",
|
|
87
|
-
default: [],
|
|
88
|
-
},
|
|
83
|
+
}
|
|
89
84
|
},
|
|
90
85
|
{
|
|
91
86
|
timestamps: true,
|
|
92
|
-
}
|
|
87
|
+
}
|
|
93
88
|
);
|
|
94
89
|
|
|
95
90
|
// Compound indexes for common query patterns
|
|
@@ -98,7 +93,7 @@ SnippetSchema.index({ organisationId: 1, client: 1 });
|
|
|
98
93
|
SnippetSchema.index({ client: 1, tags: 1 });
|
|
99
94
|
SnippetSchema.index({ client: 1, pageelement: 1 });
|
|
100
95
|
|
|
101
|
-
|
|
102
|
-
|
|
96
|
+
|
|
97
|
+
const Snippet = mongoose.models.snippet || model<ISnippet>("snippet", SnippetSchema);
|
|
103
98
|
|
|
104
99
|
export default Snippet;
|
package/src/models/Test.ts
CHANGED
|
@@ -26,6 +26,9 @@ export interface ITest extends Document {
|
|
|
26
26
|
traffic_allocation_type: string;
|
|
27
27
|
traffic_allocation: number;
|
|
28
28
|
audiences_match_type: string;
|
|
29
|
+
pages_match_type: string;
|
|
30
|
+
page_targeting?: mongoose.Schema.Types.ObjectId;
|
|
31
|
+
audience_targeting?: mongoose.Schema.Types.ObjectId;
|
|
29
32
|
// Metadata fields
|
|
30
33
|
metadata_1: mongoose.Schema.Types.Mixed;
|
|
31
34
|
metadata_2: mongoose.Schema.Types.Mixed;
|
|
@@ -82,7 +85,8 @@ export interface ITest extends Document {
|
|
|
82
85
|
}
|
|
83
86
|
|
|
84
87
|
const VariationsSchema = new Schema<IVariations>({
|
|
85
|
-
iid: {
|
|
88
|
+
iid: {
|
|
89
|
+
type: String,
|
|
86
90
|
trim: true,
|
|
87
91
|
unique: true,
|
|
88
92
|
},
|
|
@@ -103,88 +107,92 @@ const VariationsSchema = new Schema<IVariations>({
|
|
|
103
107
|
const TestSchema = new Schema<ITest>(
|
|
104
108
|
{
|
|
105
109
|
iid: { type: String, trim: true },
|
|
106
|
-
organizationId: {
|
|
107
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
110
|
+
organizationId: {
|
|
111
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
108
112
|
ref: "organization",
|
|
109
|
-
default: null
|
|
113
|
+
default: null
|
|
110
114
|
},
|
|
111
|
-
status: {
|
|
112
|
-
type: String,
|
|
115
|
+
status: {
|
|
116
|
+
type: String,
|
|
113
117
|
default: "draft",
|
|
114
|
-
enum: ["live", "draft", "ended", "paused", "preview", "running", "archive"]
|
|
118
|
+
enum: ["live", "draft", "ended", "paused", "preview", "running", "archive"],
|
|
119
|
+
transform: (value: string) => value.toLowerCase(),
|
|
115
120
|
},
|
|
116
121
|
name: { type: String, required: true },
|
|
117
122
|
traffic_allocation_type: { type: String, default: "manual", enum: ["manual", "multi-armed", "contextual"] },
|
|
118
123
|
traffic_allocation: { type: Number, default: 100 },
|
|
119
|
-
audiences_match_type: { type: String, default: "all" },
|
|
124
|
+
audiences_match_type: { type: String, default: "AND", enum: ["AND", "OR", "any", "all"] },
|
|
125
|
+
pages_match_type: { type: String, default: "AND", enum: ["AND", "OR", "any", "all"] },
|
|
126
|
+
page_targeting: { type: mongoose.Schema.Types.ObjectId, ref: "page", default: null },
|
|
127
|
+
audience_targeting: { type: mongoose.Schema.Types.ObjectId, ref: "audience", default: null },
|
|
120
128
|
// Metadata fields
|
|
121
129
|
metadata_1: { type: mongoose.Schema.Types.Mixed, default: null },
|
|
122
130
|
metadata_2: { type: mongoose.Schema.Types.Mixed, default: null },
|
|
123
131
|
metadata_3: { type: mongoose.Schema.Types.Mixed, default: null },
|
|
124
132
|
integrations_run_mode: { type: mongoose.Schema.Types.Mixed, default: null },
|
|
125
|
-
|
|
133
|
+
|
|
126
134
|
// Code fields
|
|
127
135
|
jscode: { type: String, default: "" },
|
|
128
136
|
reset_js: { type: String, default: "" },
|
|
129
137
|
csscode: { type: String, default: "" },
|
|
130
138
|
htmlcode: { type: String, default: "" },
|
|
131
|
-
|
|
139
|
+
|
|
132
140
|
// References with proper refs and defaults
|
|
133
|
-
audiences: {
|
|
134
|
-
type: [mongoose.Schema.Types.ObjectId],
|
|
135
|
-
ref: "audience",
|
|
136
|
-
default: []
|
|
141
|
+
audiences: {
|
|
142
|
+
type: [mongoose.Schema.Types.ObjectId],
|
|
143
|
+
ref: "audience",
|
|
144
|
+
default: []
|
|
137
145
|
},
|
|
138
|
-
pages: {
|
|
139
|
-
type: [mongoose.Schema.Types.ObjectId],
|
|
140
|
-
ref: "page",
|
|
141
|
-
default: []
|
|
146
|
+
pages: {
|
|
147
|
+
type: [mongoose.Schema.Types.ObjectId],
|
|
148
|
+
ref: "page",
|
|
149
|
+
default: []
|
|
142
150
|
},
|
|
143
151
|
variations: [VariationsSchema],
|
|
144
|
-
environments: {
|
|
145
|
-
type: [mongoose.Schema.Types.ObjectId],
|
|
146
|
-
ref: "environment",
|
|
147
|
-
default: []
|
|
152
|
+
environments: {
|
|
153
|
+
type: [mongoose.Schema.Types.ObjectId],
|
|
154
|
+
ref: "environment",
|
|
155
|
+
default: []
|
|
148
156
|
},
|
|
149
|
-
pageelement: {
|
|
150
|
-
type: [mongoose.Schema.Types.ObjectId],
|
|
151
|
-
ref: "pageelement",
|
|
152
|
-
default: []
|
|
157
|
+
pageelement: {
|
|
158
|
+
type: [mongoose.Schema.Types.ObjectId],
|
|
159
|
+
ref: "pageelement",
|
|
160
|
+
default: []
|
|
153
161
|
},
|
|
154
|
-
client: {
|
|
155
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
156
|
-
ref: "client"
|
|
162
|
+
client: {
|
|
163
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
164
|
+
ref: "client"
|
|
157
165
|
},
|
|
158
|
-
goal: {
|
|
159
|
-
type: [mongoose.Schema.Types.ObjectId],
|
|
160
|
-
ref: "goal",
|
|
161
|
-
default: []
|
|
166
|
+
goal: {
|
|
167
|
+
type: [mongoose.Schema.Types.ObjectId],
|
|
168
|
+
ref: "goal",
|
|
169
|
+
default: []
|
|
162
170
|
},
|
|
163
|
-
pagetesttype: {
|
|
164
|
-
type: [mongoose.Schema.Types.ObjectId],
|
|
165
|
-
ref: "pagetesttype",
|
|
166
|
-
default: []
|
|
171
|
+
pagetesttype: {
|
|
172
|
+
type: [mongoose.Schema.Types.ObjectId],
|
|
173
|
+
ref: "pagetesttype",
|
|
174
|
+
default: []
|
|
167
175
|
},
|
|
168
|
-
tags: {
|
|
169
|
-
type: [mongoose.Schema.Types.ObjectId],
|
|
170
|
-
ref: "tag",
|
|
171
|
-
default: []
|
|
176
|
+
tags: {
|
|
177
|
+
type: [mongoose.Schema.Types.ObjectId],
|
|
178
|
+
ref: "tag",
|
|
179
|
+
default: []
|
|
172
180
|
},
|
|
173
|
-
hypothesis: {
|
|
174
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
181
|
+
hypothesis: {
|
|
182
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
175
183
|
ref: "hypos"
|
|
176
184
|
},
|
|
177
|
-
trigger: {
|
|
178
|
-
type: [mongoose.Schema.Types.ObjectId],
|
|
179
|
-
ref: "trigger",
|
|
180
|
-
default: []
|
|
185
|
+
trigger: {
|
|
186
|
+
type: [mongoose.Schema.Types.ObjectId],
|
|
187
|
+
ref: "trigger",
|
|
188
|
+
default: []
|
|
181
189
|
},
|
|
182
|
-
stageincustomerjourney: {
|
|
183
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
184
|
-
ref: "stageincustomerjourney",
|
|
190
|
+
stageincustomerjourney: {
|
|
191
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
192
|
+
ref: "stageincustomerjourney",
|
|
185
193
|
default: null
|
|
186
194
|
},
|
|
187
|
-
|
|
195
|
+
|
|
188
196
|
// Test configuration
|
|
189
197
|
property: { type: mongoose.Schema.Types.Mixed, default: null },
|
|
190
198
|
platform: { type: String, default: "BQ" },
|
|
@@ -198,7 +206,9 @@ const TestSchema = new Schema<ITest>(
|
|
|
198
206
|
pageNotContains: { type: String, default: null },
|
|
199
207
|
eventparameter: { type: String, default: null },
|
|
200
208
|
testid: { type: String, default: null },
|
|
201
|
-
testtool: { type: String, default: ""
|
|
209
|
+
testtool: { type: String, default: "",
|
|
210
|
+
transform: (value: string) => value?.toLowerCase() || "",
|
|
211
|
+
},
|
|
202
212
|
personalization: { type: Boolean, default: false },
|
|
203
213
|
qaMode: { type: Boolean, default: false },
|
|
204
214
|
dnt: { type: Boolean, default: false },
|
|
@@ -220,7 +230,7 @@ const TestSchema = new Schema<ITest>(
|
|
|
220
230
|
timestamps: true
|
|
221
231
|
}
|
|
222
232
|
);
|
|
223
|
-
TestSchema.pre('save', async function(next) {
|
|
233
|
+
TestSchema.pre('save', async function (next) {
|
|
224
234
|
if (!this.iid) {
|
|
225
235
|
let unique = false;
|
|
226
236
|
while (!unique) {
|
|
@@ -254,7 +264,6 @@ TestSchema.index({ iid: 1 });
|
|
|
254
264
|
TestSchema.index({ client: 1, status: 1 });
|
|
255
265
|
TestSchema.index({ client: 1, status: 1, livedate: 1 });
|
|
256
266
|
TestSchema.index({ client: 1, status: 1, enddate: 1 });
|
|
257
|
-
TestSchema.index({ client: 1, testtool: 1, status: 1 });
|
|
258
267
|
TestSchema.index({ name: 1 }, { collation: { locale: 'en', strength: 2 } }); // Case-insensitive search
|
|
259
268
|
TestSchema.index({ "variations._id": 1 });
|
|
260
269
|
TestSchema.index({ status: 1, livedate: 1 });
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/// <reference types="mongoose/types/aggregate" />
|
|
2
|
-
/// <reference types="mongoose/types/callback" />
|
|
3
|
-
/// <reference types="mongoose/types/collection" />
|
|
4
|
-
/// <reference types="mongoose/types/connection" />
|
|
5
|
-
/// <reference types="mongoose/types/cursor" />
|
|
6
|
-
/// <reference types="mongoose/types/document" />
|
|
7
|
-
/// <reference types="mongoose/types/error" />
|
|
8
|
-
/// <reference types="mongoose/types/expressions" />
|
|
9
|
-
/// <reference types="mongoose/types/helpers" />
|
|
10
|
-
/// <reference types="mongoose/types/middlewares" />
|
|
11
|
-
/// <reference types="mongoose/types/indexes" />
|
|
12
|
-
/// <reference types="mongoose/types/models" />
|
|
13
|
-
/// <reference types="mongoose/types/mongooseoptions" />
|
|
14
|
-
/// <reference types="mongoose/types/pipelinestage" />
|
|
15
|
-
/// <reference types="mongoose/types/populate" />
|
|
16
|
-
/// <reference types="mongoose/types/query" />
|
|
17
|
-
/// <reference types="mongoose/types/schemaoptions" />
|
|
18
|
-
/// <reference types="mongoose/types/schematypes" />
|
|
19
|
-
/// <reference types="mongoose/types/session" />
|
|
20
|
-
/// <reference types="mongoose/types/types" />
|
|
21
|
-
/// <reference types="mongoose/types/utility" />
|
|
22
|
-
/// <reference types="mongoose/types/validation" />
|
|
23
|
-
/// <reference types="mongoose/types/virtuals" />
|
|
24
|
-
/// <reference types="mongoose/types/inferschematype" />
|
|
25
|
-
import mongoose, { Document } from "mongoose";
|
|
26
|
-
export interface ISnippetVersion extends Document {
|
|
27
|
-
snippetId: mongoose.Schema.Types.ObjectId;
|
|
28
|
-
htmlcode?: string;
|
|
29
|
-
csscode?: string;
|
|
30
|
-
jscode?: string;
|
|
31
|
-
createdBy?: mongoose.Schema.Types.ObjectId;
|
|
32
|
-
}
|
|
33
|
-
declare const SnippetVersion: mongoose.Model<any, {}, {}, {}, any, any>;
|
|
34
|
-
export default SnippetVersion;
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
const mongoose_1 = __importStar(require("mongoose"));
|
|
27
|
-
const SnippetVersionSchema = new mongoose_1.Schema({
|
|
28
|
-
snippetId: {
|
|
29
|
-
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
30
|
-
ref: "snippet",
|
|
31
|
-
required: true,
|
|
32
|
-
},
|
|
33
|
-
htmlcode: {
|
|
34
|
-
type: String,
|
|
35
|
-
default: "",
|
|
36
|
-
},
|
|
37
|
-
csscode: {
|
|
38
|
-
type: String,
|
|
39
|
-
default: "",
|
|
40
|
-
},
|
|
41
|
-
jscode: {
|
|
42
|
-
type: String,
|
|
43
|
-
default: "",
|
|
44
|
-
},
|
|
45
|
-
createdBy: {
|
|
46
|
-
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
47
|
-
ref: "user",
|
|
48
|
-
},
|
|
49
|
-
}, {
|
|
50
|
-
timestamps: true,
|
|
51
|
-
});
|
|
52
|
-
SnippetVersionSchema.index({ snippetId: 1, createdAt: -1 });
|
|
53
|
-
const SnippetVersion = mongoose_1.default.models.snippetversion ||
|
|
54
|
-
(0, mongoose_1.model)("snippetversion", SnippetVersionSchema);
|
|
55
|
-
exports.default = SnippetVersion;
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import mongoose, { Document, Schema, model } from "mongoose";
|
|
2
|
-
|
|
3
|
-
export interface ISnippetVersion extends Document {
|
|
4
|
-
snippetId: mongoose.Schema.Types.ObjectId;
|
|
5
|
-
htmlcode?: string;
|
|
6
|
-
csscode?: string;
|
|
7
|
-
jscode?: string;
|
|
8
|
-
createdBy?: mongoose.Schema.Types.ObjectId;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const SnippetVersionSchema = new Schema<ISnippetVersion>(
|
|
12
|
-
{
|
|
13
|
-
snippetId: {
|
|
14
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
15
|
-
ref: "snippet",
|
|
16
|
-
required: true,
|
|
17
|
-
},
|
|
18
|
-
htmlcode: {
|
|
19
|
-
type: String,
|
|
20
|
-
default: "",
|
|
21
|
-
},
|
|
22
|
-
csscode: {
|
|
23
|
-
type: String,
|
|
24
|
-
default: "",
|
|
25
|
-
},
|
|
26
|
-
jscode: {
|
|
27
|
-
type: String,
|
|
28
|
-
default: "",
|
|
29
|
-
},
|
|
30
|
-
createdBy: {
|
|
31
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
32
|
-
ref: "user",
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
timestamps: true,
|
|
37
|
-
},
|
|
38
|
-
);
|
|
39
|
-
|
|
40
|
-
SnippetVersionSchema.index({ snippetId: 1, createdAt: -1 });
|
|
41
|
-
|
|
42
|
-
const SnippetVersion =
|
|
43
|
-
mongoose.models.snippetversion ||
|
|
44
|
-
model<ISnippetVersion>("snippetversion", SnippetVersionSchema);
|
|
45
|
-
|
|
46
|
-
export default SnippetVersion;
|