codebase-models 2.0.6 → 2.0.8

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.
@@ -47,6 +47,6 @@ CVRReportSchema.index({ client: 1 });
47
47
  // Sparse index for reportLink
48
48
  CVRReportSchema.index({ reportLink: 1 }, { sparse: true });
49
49
  // TTL index for automatic cleanup of old reports (1 year)
50
- CVRReportSchema.index({ createdAt: 1 }, { expireAfterSeconds: 31536000 });
50
+ CVRReportSchema.index({ createdAt: 1 });
51
51
  const CVRReport = mongoose_1.default.models.cvrreport || (0, mongoose_1.model)("cvrreport", CVRReportSchema);
52
52
  exports.default = CVRReport;
@@ -78,6 +78,6 @@ ClientReportsTempSchema.index({ viewId: 1 }, { sparse: true });
78
78
  ClientReportsTempSchema.index({ organisationId: 1 }, { sparse: true });
79
79
  ClientReportsTempSchema.index({ test: 1 }, { sparse: true });
80
80
  // TTL index for automatic cleanup of old reports
81
- ClientReportsTempSchema.index({ date: 1 }, { expireAfterSeconds: 86400 }); // 24 hours
81
+ ClientReportsTempSchema.index({ date: 1 }); // 24 hours
82
82
  const ClientReportsTemp = mongoose_1.default.models.clientreportstemp || (0, mongoose_1.model)("clientreportstemp", ClientReportsTempSchema);
83
83
  exports.default = ClientReportsTemp;
@@ -50,7 +50,6 @@ const ClientScriptSchema = new mongoose_1.Schema({
50
50
  },
51
51
  viewId: {
52
52
  type: String,
53
- index: true,
54
53
  },
55
54
  clientScriptURL: {
56
55
  type: String,
@@ -31,6 +31,7 @@ export interface IEnvironment extends Document {
31
31
  organizationId?: mongoose.Schema.Types.ObjectId;
32
32
  isActive?: boolean;
33
33
  default?: boolean;
34
+ qa?: boolean;
34
35
  }
35
36
  declare const Environment: mongoose.Model<any, {}, {}, {}, any, any>;
36
37
  export default Environment;
@@ -66,6 +66,10 @@ const EnvironmentSchema = new mongoose_1.Schema({
66
66
  isActive: {
67
67
  type: Boolean,
68
68
  default: true,
69
+ },
70
+ qa: {
71
+ type: Boolean,
72
+ default: false,
69
73
  }
70
74
  }, {
71
75
  timestamps: true
@@ -48,7 +48,6 @@ const GoalSchema = new mongoose_1.Schema({
48
48
  type: String,
49
49
  required: true,
50
50
  trim: true,
51
- index: true,
52
51
  },
53
52
  details: {
54
53
  type: String,
@@ -45,7 +45,6 @@ const PageElementSchema = new mongoose_1.Schema({
45
45
  organizationId: {
46
46
  type: mongoose_1.default.Schema.Types.ObjectId,
47
47
  ref: "organization",
48
- index: true,
49
48
  default: null,
50
49
  },
51
50
  client: {
@@ -35,7 +35,6 @@ const PageTestTypeSchema = new mongoose_1.Schema({
35
35
  required: true,
36
36
  unique: true,
37
37
  trim: true,
38
- index: true,
39
38
  },
40
39
  details: {
41
40
  type: String,
@@ -49,7 +48,6 @@ const PageTestTypeSchema = new mongoose_1.Schema({
49
48
  isActive: {
50
49
  type: Boolean,
51
50
  default: true,
52
- index: true,
53
51
  }
54
52
  }, {
55
53
  timestamps: true
@@ -31,7 +31,6 @@ const RoleSchema = new mongoose_1.Schema({
31
31
  required: true,
32
32
  enum: ["USER", "ADMIN", "EDITOR", "COLLABORATOR", "CLIENT"],
33
33
  trim: true,
34
- index: true,
35
34
  uppercase: true,
36
35
  },
37
36
  description: {
@@ -41,13 +40,11 @@ const RoleSchema = new mongoose_1.Schema({
41
40
  organizationId: {
42
41
  type: mongoose_1.default.Schema.Types.ObjectId,
43
42
  ref: "organization",
44
- index: true,
45
43
  default: null,
46
44
  },
47
45
  isActive: {
48
46
  type: Boolean,
49
47
  default: true,
50
- index: true,
51
48
  }
52
49
  }, {
53
50
  timestamps: true
@@ -29,20 +29,17 @@ const SnippetSchema = new mongoose_1.Schema({
29
29
  type: mongoose_1.default.Schema.Types.ObjectId,
30
30
  ref: "organization",
31
31
  default: null,
32
- index: true,
33
32
  },
34
33
  name: {
35
34
  type: String,
36
35
  required: true,
37
36
  unique: true,
38
37
  trim: true,
39
- index: true,
40
38
  },
41
39
  pageelement: {
42
40
  type: [mongoose_1.default.Schema.Types.ObjectId],
43
41
  ref: "pageelement",
44
42
  default: [],
45
- index: true,
46
43
  },
47
44
  client: {
48
45
  type: mongoose_1.default.Schema.Types.ObjectId,
@@ -80,7 +77,6 @@ const SnippetSchema = new mongoose_1.Schema({
80
77
  test: {
81
78
  type: mongoose_1.default.Schema.Types.ObjectId,
82
79
  ref: "test",
83
- index: true,
84
80
  },
85
81
  status: {
86
82
  type: String,
@@ -48,7 +48,6 @@ const StageInCustomerJourneySchema = new mongoose_1.Schema({
48
48
  type: String,
49
49
  required: true,
50
50
  trim: true,
51
- index: true,
52
51
  },
53
52
  stages: {
54
53
  type: String,
@@ -66,17 +65,14 @@ const StageInCustomerJourneySchema = new mongoose_1.Schema({
66
65
  type: mongoose_1.default.Schema.Types.ObjectId,
67
66
  default: null,
68
67
  ref: "organization",
69
- index: true,
70
68
  },
71
69
  client: {
72
70
  type: mongoose_1.default.Schema.Types.ObjectId,
73
71
  ref: "client",
74
- index: true,
75
72
  },
76
73
  isActive: {
77
74
  type: Boolean,
78
75
  default: true,
79
- index: true,
80
76
  }
81
77
  }, {
82
78
  timestamps: true,
@@ -78,6 +78,7 @@ export interface ITest extends Document {
78
78
  testid: string;
79
79
  testtool: string;
80
80
  personalization: boolean;
81
+ qaMode: boolean;
81
82
  kameleoontestdetails: mongoose.Schema.Types.Mixed;
82
83
  vwotestdetails: mongoose.Schema.Types.Mixed;
83
84
  triggerevents: any[];
@@ -143,6 +143,7 @@ const TestSchema = new mongoose_1.Schema({
143
143
  testid: { type: String, default: null },
144
144
  testtool: { type: String, default: "" },
145
145
  personalization: { type: Boolean, default: false },
146
+ qaMode: { type: Boolean, default: false },
146
147
  kameleoontestdetails: { type: mongoose_1.default.Schema.Types.Mixed, default: null },
147
148
  vwotestdetails: { type: mongoose_1.default.Schema.Types.Mixed, default: null },
148
149
  triggerevents: { type: [], default: [] },
@@ -200,6 +201,6 @@ TestSchema.index({ status: 1, enddate: 1 });
200
201
  TestSchema.index({ status: 1 }, { partialFilterExpression: { status: { $in: ['live', 'running', 'draft', 'paused', 'preview', 'ended'] } } });
201
202
  TestSchema.index({ client: 1, status: 1 }, { partialFilterExpression: { status: { $in: ['live', 'running', 'draft', 'paused', 'preview', 'ended'] } } });
202
203
  // Add TTL index for automatic cleanup of ended tests after 1 year
203
- TestSchema.index({ enddate: 1 }, { expireAfterSeconds: 31536000 });
204
+ TestSchema.index({ enddate: 1 });
204
205
  const Test = mongoose_1.default.models.test || (0, mongoose_1.model)("test", TestSchema);
205
206
  exports.default = Test;
@@ -41,7 +41,7 @@ const TestTimelineSchema = new mongoose_1.Schema({
41
41
  },
42
42
  event: {
43
43
  type: String,
44
- enum: ["test_created", "test_updated", "test_deleted"],
44
+ enum: ["test_created", "test_updated", "test_status_changed", "test_deleted", "variant_created", "variant_updated", "variant_deleted"],
45
45
  },
46
46
  organizationId: {
47
47
  type: mongoose_1.default.Schema.Types.ObjectId,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codebase-models",
3
- "version": "2.0.6",
3
+ "version": "2.0.8",
4
4
  "description": "Common models for codebase",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -35,7 +35,7 @@ CVRReportSchema.index({ client: 1 });
35
35
  CVRReportSchema.index({ reportLink: 1 }, { sparse: true });
36
36
 
37
37
  // TTL index for automatic cleanup of old reports (1 year)
38
- CVRReportSchema.index({ createdAt: 1 }, { expireAfterSeconds: 31536000 });
38
+ CVRReportSchema.index({ createdAt: 1 });
39
39
 
40
40
  const CVRReport = mongoose.models.cvrreport || model<ICVRReport>("cvrreport", CVRReportSchema);
41
41
  export default CVRReport;
@@ -73,7 +73,7 @@ ClientReportsTempSchema.index({ organisationId: 1 }, { sparse: true });
73
73
  ClientReportsTempSchema.index({ test: 1 }, { sparse: true });
74
74
 
75
75
  // TTL index for automatic cleanup of old reports
76
- ClientReportsTempSchema.index({ date: 1 }, { expireAfterSeconds: 86400 }); // 24 hours
76
+ ClientReportsTempSchema.index({ date: 1 }); // 24 hours
77
77
 
78
78
  const ClientReportsTemp = mongoose.models.clientreportstemp || model<IClientReportsTemp>(
79
79
  "clientreportstemp",
@@ -57,7 +57,6 @@ const ClientScriptSchema = new Schema<IClientScript>(
57
57
  },
58
58
  viewId: {
59
59
  type: String,
60
- index: true,
61
60
  },
62
61
  clientScriptURL: {
63
62
  type: String,
@@ -9,6 +9,7 @@ export interface IEnvironment extends Document {
9
9
  organizationId?: mongoose.Schema.Types.ObjectId;
10
10
  isActive?: boolean;
11
11
  default?: boolean;
12
+ qa?: boolean;
12
13
  }
13
14
 
14
15
  const EnvironmentSchema = new Schema<IEnvironment>({
@@ -44,7 +45,11 @@ const EnvironmentSchema = new Schema<IEnvironment>({
44
45
  isActive: {
45
46
  type: Boolean,
46
47
  default: true,
47
- }
48
+ },
49
+ qa: {
50
+ type: Boolean,
51
+ default: false,
52
+ }
48
53
  }, {
49
54
  timestamps: true
50
55
  });
@@ -29,7 +29,6 @@ const GoalSchema = new Schema<IGoal>({
29
29
  type: String,
30
30
  required: true,
31
31
  trim: true,
32
- index: true,
33
32
  },
34
33
  details: {
35
34
  type: String,
@@ -28,7 +28,6 @@ const PageElementSchema = new Schema<IPageElement>({
28
28
  organizationId: {
29
29
  type: mongoose.Schema.Types.ObjectId,
30
30
  ref: "organization",
31
- index: true,
32
31
  default: null,
33
32
  },
34
33
  client: {
@@ -20,7 +20,6 @@ const PageTestTypeSchema = new Schema<IPageTestType>({
20
20
  required: true,
21
21
  unique: true,
22
22
  trim: true,
23
- index: true,
24
23
  },
25
24
  details: {
26
25
  type: String,
@@ -34,7 +33,6 @@ const PageTestTypeSchema = new Schema<IPageTestType>({
34
33
  isActive: {
35
34
  type: Boolean,
36
35
  default: true,
37
- index: true,
38
36
  }
39
37
  }, {
40
38
  timestamps: true
@@ -16,7 +16,6 @@ const RoleSchema = new Schema<IRole>({
16
16
  required: true,
17
17
  enum: ["USER", "ADMIN", "EDITOR", "COLLABORATOR", "CLIENT"],
18
18
  trim: true,
19
- index: true,
20
19
  uppercase: true,
21
20
  },
22
21
  description: {
@@ -26,13 +25,12 @@ const RoleSchema = new Schema<IRole>({
26
25
  organizationId: {
27
26
  type: mongoose.Schema.Types.ObjectId,
28
27
  ref: "organization",
29
- index: true,
30
28
  default: null,
31
29
  },
32
30
  isActive: {
33
31
  type: Boolean,
34
32
  default: true,
35
- index: true,
33
+
36
34
  }
37
35
  }, {
38
36
  timestamps: true
@@ -22,20 +22,18 @@ const SnippetSchema = new Schema<ISnippet>(
22
22
  type: mongoose.Schema.Types.ObjectId,
23
23
  ref: "organization",
24
24
  default: null,
25
- index: true,
25
+
26
26
  },
27
27
  name: {
28
28
  type: String,
29
29
  required: true,
30
30
  unique: true,
31
31
  trim: true,
32
- index: true,
33
32
  },
34
33
  pageelement: {
35
34
  type: [mongoose.Schema.Types.ObjectId],
36
35
  ref: "pageelement",
37
36
  default: [],
38
- index: true,
39
37
  },
40
38
  client: {
41
39
  type: mongoose.Schema.Types.ObjectId,
@@ -73,7 +71,6 @@ const SnippetSchema = new Schema<ISnippet>(
73
71
  test: {
74
72
  type: mongoose.Schema.Types.ObjectId,
75
73
  ref: "test",
76
- index: true,
77
74
  },
78
75
  status: {
79
76
  type: String,
@@ -23,7 +23,6 @@ const StageInCustomerJourneySchema = new Schema<IStageInCustomerJourney>(
23
23
  type: String,
24
24
  required: true,
25
25
  trim: true,
26
- index: true,
27
26
  },
28
27
  stages: {
29
28
  type: String,
@@ -41,17 +40,14 @@ const StageInCustomerJourneySchema = new Schema<IStageInCustomerJourney>(
41
40
  type: mongoose.Schema.Types.ObjectId,
42
41
  default: null,
43
42
  ref: "organization",
44
- index: true,
45
43
  },
46
44
  client: {
47
45
  type: mongoose.Schema.Types.ObjectId,
48
46
  ref: "client",
49
- index: true,
50
47
  },
51
48
  isActive: {
52
49
  type: Boolean,
53
50
  default: true,
54
- index: true,
55
51
  }
56
52
  },
57
53
  {
@@ -50,7 +50,6 @@ export interface ITest extends Document {
50
50
  hypothesis?: mongoose.Schema.Types.ObjectId;
51
51
  trigger?: mongoose.Schema.Types.ObjectId[];
52
52
  stageincustomerjourney?: mongoose.Schema.Types.ObjectId;
53
-
54
53
  // Test configuration
55
54
  property?: mongoose.Schema.Types.Mixed;
56
55
  platform: string;
@@ -66,6 +65,7 @@ export interface ITest extends Document {
66
65
  testid: string;
67
66
  testtool: string;
68
67
  personalization: boolean;
68
+ qaMode: boolean;
69
69
  kameleoontestdetails: mongoose.Schema.Types.Mixed;
70
70
  vwotestdetails: mongoose.Schema.Types.Mixed;
71
71
  triggerevents: any[];
@@ -193,6 +193,7 @@ const TestSchema = new Schema<ITest>(
193
193
  testid: { type: String, default: null },
194
194
  testtool: { type: String, default: "" },
195
195
  personalization: { type: Boolean, default: false },
196
+ qaMode: { type: Boolean, default: false },
196
197
  kameleoontestdetails: { type: mongoose.Schema.Types.Mixed, default: null },
197
198
  vwotestdetails: { type: mongoose.Schema.Types.Mixed, default: null },
198
199
  triggerevents: { type: [], default: [] },
@@ -254,7 +255,7 @@ TestSchema.index({ status: 1 }, { partialFilterExpression: { status: { $in: ['li
254
255
  TestSchema.index({ client: 1, status: 1 }, { partialFilterExpression: { status: { $in: ['live', 'running', 'draft', 'paused', 'preview', 'ended'] } } });
255
256
 
256
257
  // Add TTL index for automatic cleanup of ended tests after 1 year
257
- TestSchema.index({ enddate: 1 }, { expireAfterSeconds: 31536000 });
258
+ TestSchema.index({ enddate: 1 });
258
259
 
259
260
  const Test = mongoose.models.test || model<ITest>("test", TestSchema);
260
261
 
@@ -20,7 +20,7 @@ const TestTimelineSchema = new Schema<ITestTimeline>({
20
20
  },
21
21
  event: {
22
22
  type: String,
23
- enum: ["test_created", "test_updated", "test_deleted"],
23
+ enum: ["test_created", "test_updated","test_status_changed", "test_deleted", "variant_created", "variant_updated", "variant_deleted"],
24
24
  },
25
25
  organizationId: {
26
26
  type: mongoose.Schema.Types.ObjectId,