codebase-models 1.0.7 → 2.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.
Files changed (148) hide show
  1. package/.github/workflows/npm-publish.yml +33 -0
  2. package/dist/index.d.ts +4 -3
  3. package/dist/index.js +7 -5
  4. package/dist/src/models/Announcement.d.ts +7 -8
  5. package/dist/src/models/Announcement.js +30 -10
  6. package/dist/src/models/AppEvent.d.ts +1 -3
  7. package/dist/src/models/AppEvent.js +1 -1
  8. package/dist/src/models/Audience.d.ts +2 -3
  9. package/dist/src/models/Audience.js +6 -1
  10. package/dist/src/models/{Experiments.d.ts → BqPreCompiledData.d.ts} +12 -32
  11. package/dist/src/models/{ClientExperiment.js → BqPreCompiledData.js} +26 -46
  12. package/dist/src/models/CVRReport.d.ts +2 -3
  13. package/dist/src/models/CVRReport.js +14 -1
  14. package/dist/src/models/Client.d.ts +2 -4
  15. package/dist/src/models/Client.js +32 -52
  16. package/dist/src/models/ClientAdditionalRevenue.d.ts +2 -4
  17. package/dist/src/models/ClientAdditionalRevenue.js +4 -3
  18. package/dist/src/models/ClientLearning.d.ts +2 -4
  19. package/dist/src/models/ClientLearning.js +11 -7
  20. package/dist/src/models/ClientLinks.d.ts +2 -4
  21. package/dist/src/models/ClientLinks.js +16 -7
  22. package/dist/src/models/ClientNextSteps.d.ts +2 -4
  23. package/dist/src/models/ClientNextSteps.js +4 -3
  24. package/dist/src/models/ClientNote.d.ts +2 -4
  25. package/dist/src/models/ClientNote.js +4 -3
  26. package/dist/src/models/ClientReportsTemp.d.ts +2 -4
  27. package/dist/src/models/ClientReportsTemp.js +21 -3
  28. package/dist/src/models/ClientRetention.d.ts +2 -3
  29. package/dist/src/models/ClientRetention.js +19 -1
  30. package/dist/src/models/ClientScript.d.ts +2 -4
  31. package/dist/src/models/ClientScript.js +25 -9
  32. package/dist/src/models/ClientStrategy.d.ts +2 -4
  33. package/dist/src/models/ClientStrategy.js +4 -3
  34. package/dist/src/models/ClientSurvay.d.ts +2 -7
  35. package/dist/src/models/ClientSurvay.js +6 -1
  36. package/dist/src/models/Environment.d.ts +3 -3
  37. package/dist/src/models/Environment.js +27 -3
  38. package/dist/src/models/Faqs.d.ts +2 -3
  39. package/dist/src/models/Faqs.js +6 -1
  40. package/dist/src/models/Feedback.d.ts +2 -4
  41. package/dist/src/models/Feedback.js +4 -3
  42. package/dist/src/models/Goal.d.ts +3 -4
  43. package/dist/src/models/Goal.js +34 -12
  44. package/dist/src/models/Hypothesis.d.ts +3 -3
  45. package/dist/src/models/Hypothesis.js +50 -10
  46. package/dist/src/models/HypothesisSheet.d.ts +2 -4
  47. package/dist/src/models/HypothesisSheet.js +27 -3
  48. package/dist/src/models/LandingPages.d.ts +4 -3
  49. package/dist/src/models/LandingPages.js +30 -1
  50. package/dist/src/models/NewIdeas.d.ts +2 -4
  51. package/dist/src/models/NewIdeas.js +4 -3
  52. package/dist/src/models/Notification.d.ts +2 -3
  53. package/dist/src/models/Notification.js +30 -2
  54. package/dist/src/models/{ClientExperiment.d.ts → Organization.d.ts} +18 -31
  55. package/dist/src/models/{Experiments.js → Organization.js} +36 -54
  56. package/dist/src/models/Page.d.ts +4 -4
  57. package/dist/src/models/Page.js +57 -5
  58. package/dist/src/models/PageElement.d.ts +4 -3
  59. package/dist/src/models/PageElement.js +60 -8
  60. package/dist/src/models/PageTestType.d.ts +3 -3
  61. package/dist/src/models/PageTestType.js +42 -6
  62. package/dist/src/models/Portfolio.d.ts +2 -3
  63. package/dist/src/models/Portfolio.js +6 -1
  64. package/dist/src/models/PrecalculationFilters.d.ts +34 -0
  65. package/dist/src/models/PrecalculationFilters.js +78 -0
  66. package/dist/src/models/QueryLog.d.ts +2 -4
  67. package/dist/src/models/QueryLog.js +4 -3
  68. package/dist/src/models/ReadNotification.d.ts +2 -3
  69. package/dist/src/models/ReadNotification.js +30 -2
  70. package/dist/src/models/Report.d.ts +3 -4
  71. package/dist/src/models/Report.js +33 -49
  72. package/dist/src/models/Role.d.ts +4 -3
  73. package/dist/src/models/Role.js +51 -8
  74. package/dist/src/models/SavedSegment.d.ts +2 -3
  75. package/dist/src/models/SavedSegment.js +6 -1
  76. package/dist/src/models/Segment.d.ts +2 -3
  77. package/dist/src/models/Segment.js +6 -1
  78. package/dist/src/models/SegmentCombination.d.ts +2 -3
  79. package/dist/src/models/SegmentCombination.js +6 -1
  80. package/dist/src/models/Snippet.d.ts +3 -4
  81. package/dist/src/models/Snippet.js +29 -4
  82. package/dist/src/models/StageInCustomerJourney.d.ts +4 -4
  83. package/dist/src/models/StageInCustomerJourney.js +56 -4
  84. package/dist/src/models/Tag.d.ts +2 -3
  85. package/dist/src/models/Tag.js +30 -2
  86. package/dist/src/models/Temp.d.ts +2 -3
  87. package/dist/src/models/Temp.js +30 -2
  88. package/dist/src/models/Test.d.ts +17 -18
  89. package/dist/src/models/Test.js +83 -186
  90. package/dist/src/models/TestSequentialValue.d.ts +2 -3
  91. package/dist/src/models/TestSequentialValue.js +6 -1
  92. package/dist/src/models/Tier.d.ts +2 -3
  93. package/dist/src/models/Tier.js +30 -2
  94. package/dist/src/models/Trigger.d.ts +2 -3
  95. package/dist/src/models/Trigger.js +30 -2
  96. package/dist/src/models/User.d.ts +2 -3
  97. package/dist/src/models/User.js +10 -11
  98. package/index.ts +6 -4
  99. package/package.json +1 -1
  100. package/src/models/Announcement.ts +51 -28
  101. package/src/models/AppEvent.ts +1 -1
  102. package/src/models/Audience.ts +7 -1
  103. package/src/models/BqPreCompiledData.ts +62 -0
  104. package/src/models/CVRReport.ts +18 -1
  105. package/src/models/Client.ts +40 -60
  106. package/src/models/ClientAdditionalRevenue.ts +5 -4
  107. package/src/models/ClientLearning.ts +12 -8
  108. package/src/models/ClientLinks.ts +19 -8
  109. package/src/models/ClientNextSteps.ts +5 -4
  110. package/src/models/ClientNote.ts +5 -4
  111. package/src/models/ClientReportsTemp.ts +25 -4
  112. package/src/models/ClientRetention.ts +28 -2
  113. package/src/models/ClientScript.ts +27 -10
  114. package/src/models/ClientStrategy.ts +5 -4
  115. package/src/models/ClientSurvay.ts +7 -1
  116. package/src/models/Environment.ts +32 -4
  117. package/src/models/Faqs.ts +7 -1
  118. package/src/models/Feedback.ts +5 -4
  119. package/src/models/Goal.ts +37 -13
  120. package/src/models/Hypothesis.ts +30 -9
  121. package/src/models/HypothesisSheet.ts +4 -3
  122. package/src/models/LandingPages.ts +35 -1
  123. package/src/models/NewIdeas.ts +5 -4
  124. package/src/models/Notification.ts +7 -1
  125. package/src/models/Organization.ts +86 -0
  126. package/src/models/Page.ts +63 -6
  127. package/src/models/PageElement.ts +39 -8
  128. package/src/models/PageTestType.ts +22 -5
  129. package/src/models/Portfolio.ts +7 -1
  130. package/src/models/PrecalculationFilters.ts +68 -0
  131. package/src/models/QueryLog.ts +5 -4
  132. package/src/models/ReadNotification.ts +7 -1
  133. package/src/models/Report.ts +55 -67
  134. package/src/models/Role.ts +32 -7
  135. package/src/models/SavedSegment.ts +7 -1
  136. package/src/models/Segment.ts +7 -1
  137. package/src/models/SegmentCombination.ts +7 -1
  138. package/src/models/Snippet.ts +33 -5
  139. package/src/models/StageInCustomerJourney.ts +34 -6
  140. package/src/models/Tag.ts +7 -1
  141. package/src/models/Temp.ts +7 -1
  142. package/src/models/Test.ts +156 -244
  143. package/src/models/TestSequentialValue.ts +7 -1
  144. package/src/models/Tier.ts +7 -1
  145. package/src/models/Trigger.ts +7 -1
  146. package/src/models/User.ts +12 -11
  147. package/src/models/ClientExperiment.ts +0 -113
  148. package/src/models/Experiments.ts +0 -118
@@ -33,43 +33,65 @@ const GoalSchema = new mongoose_1.Schema({
33
33
  name: {
34
34
  type: String,
35
35
  required: true,
36
+ trim: true,
37
+ index: true,
36
38
  },
37
39
  details: {
38
40
  type: String,
39
41
  default: "",
42
+ trim: true,
40
43
  },
41
44
  slug: {
42
45
  type: String,
46
+ unique: true,
47
+ sparse: true,
43
48
  },
44
- organisationId: {
45
- type: String,
49
+ organizationId: {
50
+ type: mongoose_1.default.Schema.Types.ObjectId,
51
+ ref: "organization",
46
52
  default: null,
53
+ index: true,
47
54
  },
48
55
  client: {
49
56
  type: mongoose_1.default.Schema.Types.ObjectId,
50
57
  ref: "client",
58
+ index: true,
51
59
  },
52
60
  type: {
53
61
  type: String,
62
+ trim: true,
54
63
  },
55
64
  counting_method: {
56
65
  type: String,
66
+ trim: true,
57
67
  },
58
68
  css_selector: {
59
69
  type: String,
70
+ trim: true,
60
71
  },
61
- api_name: { type: String, slug: ["name"], slugPaddingSize: 4, unique: true },
62
- rules_js: {
72
+ api_name: {
63
73
  type: String,
74
+ slug: ["name"],
75
+ slugPaddingSize: 4,
76
+ unique: true,
77
+ trim: true,
64
78
  },
65
- createdAt: {
66
- type: Date,
67
- default: new Date(),
68
- },
69
- updatedAt: {
70
- type: Date,
71
- default: new Date(),
79
+ rules_js: {
80
+ type: String,
81
+ trim: true,
72
82
  },
83
+ isActive: {
84
+ type: Boolean,
85
+ default: true,
86
+ index: true,
87
+ }
88
+ }, {
89
+ timestamps: true
73
90
  });
74
- const Goal = (0, mongoose_1.model)("goal", GoalSchema);
91
+ // Compound indexes for common query patterns
92
+ GoalSchema.index({ client: 1 });
93
+ GoalSchema.index({ client: 1, isActive: 1 });
94
+ GoalSchema.index({ organizationId: 1, client: 1 });
95
+ GoalSchema.index({ client: 1, name: 1 }, { unique: true });
96
+ const Goal = mongoose_1.default.models.goal || (0, mongoose_1.model)("goal", GoalSchema);
75
97
  exports.default = Goal;
@@ -24,16 +24,16 @@
24
24
  /// <reference types="mongoose/types/inferschematype" />
25
25
  import mongoose, { Document } from "mongoose";
26
26
  export interface IHypothesis extends Document {
27
+ organizationId?: mongoose.Schema.Types.ObjectId;
27
28
  hypothesisNumber?: string;
28
29
  name: string;
29
30
  action: string;
30
31
  result: string;
31
32
  expectation: string;
32
33
  tagged?: string;
34
+ isActive?: boolean;
33
35
  createdAt?: Date;
34
36
  updatedAt?: Date;
35
37
  }
36
- declare const Hypothesis: mongoose.Model<IHypothesis, {}, {}, {}, mongoose.Document<unknown, {}, IHypothesis> & IHypothesis & {
37
- _id: mongoose.Types.ObjectId;
38
- }, any>;
38
+ declare const Hypothesis: mongoose.Model<any, {}, {}, {}, any, any>;
39
39
  export default Hypothesis;
@@ -1,38 +1,78 @@
1
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
+ };
2
25
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const mongoose_1 = require("mongoose");
26
+ const mongoose_1 = __importStar(require("mongoose"));
4
27
  const HypothesisSchema = new mongoose_1.Schema({
28
+ organizationId: {
29
+ type: mongoose_1.default.Schema.Types.ObjectId,
30
+ ref: "organization",
31
+ default: null,
32
+ },
5
33
  hypothesisNumber: {
6
34
  type: String,
35
+ trim: true,
36
+ index: true,
7
37
  },
8
38
  name: {
9
39
  type: String,
10
40
  required: true,
41
+ trim: true,
42
+ index: true,
11
43
  },
12
44
  action: {
13
45
  type: String,
14
46
  required: true,
47
+ trim: true,
15
48
  },
16
49
  result: {
17
50
  type: String,
18
51
  required: true,
52
+ trim: true,
19
53
  },
20
54
  expectation: {
21
55
  type: String,
22
56
  required: true,
57
+ trim: true,
23
58
  },
24
59
  tagged: {
25
60
  type: String,
26
61
  default: "General Purpose",
62
+ trim: true,
63
+ index: true,
27
64
  },
28
- createdAt: {
29
- type: Date,
30
- default: new Date(),
31
- },
32
- updatedAt: {
33
- type: Date,
34
- default: new Date(),
35
- },
65
+ isActive: {
66
+ type: Boolean,
67
+ default: true,
68
+ index: true,
69
+ }
70
+ }, {
71
+ timestamps: true
36
72
  });
37
- const Hypothesis = (0, mongoose_1.model)("hypos", HypothesisSchema);
73
+ // Compound indexes for common query patterns
74
+ HypothesisSchema.index({ hypothesisNumber: 1, isActive: 1 });
75
+ HypothesisSchema.index({ tagged: 1, isActive: 1 });
76
+ HypothesisSchema.index({ name: 1, isActive: 1 });
77
+ const Hypothesis = mongoose_1.default.models.hypothesis || (0, mongoose_1.model)("hypothesis", HypothesisSchema);
38
78
  exports.default = Hypothesis;
@@ -24,7 +24,7 @@
24
24
  /// <reference types="mongoose/types/inferschematype" />
25
25
  import mongoose, { Document } from "mongoose";
26
26
  export interface IHypothesisSheet extends Document {
27
- organizationId?: string;
27
+ organizationId?: mongoose.Schema.Types.ObjectId;
28
28
  client?: mongoose.Schema.Types.ObjectId;
29
29
  viewId?: string;
30
30
  pageelement?: mongoose.Schema.Types.ObjectId;
@@ -43,7 +43,5 @@ export interface IHypothesisSheet extends Document {
43
43
  thoughtsOfTeam?: Number;
44
44
  tested?: Boolean;
45
45
  }
46
- declare const HypothesisSheet: mongoose.Model<IHypothesisSheet, {}, {}, {}, mongoose.Document<unknown, {}, IHypothesisSheet> & IHypothesisSheet & {
47
- _id: mongoose.Types.ObjectId;
48
- }, any>;
46
+ declare const HypothesisSheet: mongoose.Model<any, {}, {}, {}, any, any>;
49
47
  export default HypothesisSheet;
@@ -1,14 +1,38 @@
1
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
+ };
2
25
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
27
  };
5
28
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const mongoose_1 = require("mongoose");
29
+ const mongoose_1 = __importStar(require("mongoose"));
7
30
  const constant_1 = __importDefault(require("../constant"));
8
31
  const HypothesisSheetSchema = new mongoose_1.Schema({
9
32
  organizationId: {
10
- type: String,
33
+ type: mongoose_1.default.Schema.Types.ObjectId,
11
34
  default: null,
35
+ ref: "organization",
12
36
  },
13
37
  client: {
14
38
  type: mongoose_1.Schema.Types.ObjectId,
@@ -85,5 +109,5 @@ const HypothesisSheetSchema = new mongoose_1.Schema({
85
109
  }, {
86
110
  timestamps: true,
87
111
  });
88
- const HypothesisSheet = (0, mongoose_1.model)("hypothesisSheet", HypothesisSheetSchema);
112
+ const HypothesisSheet = mongoose_1.default.models.hypothesissheet || (0, mongoose_1.model)("hypothesisSheet", HypothesisSheetSchema);
89
113
  exports.default = HypothesisSheet;
@@ -25,14 +25,15 @@
25
25
  import mongoose, { Document } from "mongoose";
26
26
  export interface ILandingPagesData extends Document {
27
27
  conversionRate?: Number;
28
+ lastUpdated?: Date;
28
29
  }
29
30
  export interface ILandingPages extends Document {
30
31
  title: string;
31
32
  client?: mongoose.Schema.Types.ObjectId;
33
+ organizationId?: mongoose.Schema.Types.ObjectId;
32
34
  screenshot?: string;
33
35
  dataPoints?: ILandingPagesData;
36
+ isActive?: boolean;
34
37
  }
35
- declare const LandingPages: mongoose.Model<ILandingPages, {}, {}, {}, mongoose.Document<unknown, {}, ILandingPages> & ILandingPages & {
36
- _id: mongoose.Types.ObjectId;
37
- }, any>;
38
+ declare const LandingPages: mongoose.Model<any, {}, {}, {}, any, any>;
38
39
  export default LandingPages;
@@ -27,28 +27,57 @@ const mongoose_1 = __importStar(require("mongoose"));
27
27
  const LandingPageDataSchema = new mongoose_1.Schema({
28
28
  conversionRate: {
29
29
  type: Number,
30
+ min: 0,
31
+ max: 100,
32
+ index: true,
30
33
  },
34
+ lastUpdated: {
35
+ type: Date,
36
+ default: Date.now,
37
+ }
31
38
  });
32
39
  const LandingPagesSchema = new mongoose_1.Schema({
33
40
  title: {
34
41
  type: String,
35
42
  required: true,
43
+ trim: true,
44
+ index: true,
36
45
  },
37
46
  client: {
38
47
  type: mongoose_1.default.Schema.Types.ObjectId,
39
48
  ref: "client",
40
49
  required: true,
50
+ index: true,
51
+ },
52
+ organizationId: {
53
+ type: mongoose_1.default.Schema.Types.ObjectId,
54
+ ref: "organization",
55
+ index: true,
41
56
  },
42
57
  screenshot: {
43
58
  type: String,
44
59
  default: null,
60
+ trim: true,
45
61
  },
46
62
  dataPoints: {
47
63
  type: LandingPageDataSchema,
48
64
  default: {},
49
65
  },
66
+ isActive: {
67
+ type: Boolean,
68
+ default: true,
69
+ index: true,
70
+ }
50
71
  }, {
51
72
  timestamps: true,
52
73
  });
53
- const LandingPages = (0, mongoose_1.model)("LandingPages", LandingPagesSchema);
74
+ // Compound indexes for common query patterns
75
+ LandingPagesSchema.index({ client: 1, title: 1 }, { unique: true });
76
+ LandingPagesSchema.index({ client: 1, isActive: 1 });
77
+ LandingPagesSchema.index({ organizationId: 1, client: 1 });
78
+ LandingPagesSchema.index({ organizationId: 1, title: 1 });
79
+ LandingPagesSchema.index({ client: 1, 'dataPoints.conversionRate': -1 });
80
+ // Text index for full-text search
81
+ LandingPagesSchema.index({ title: 'text' });
82
+ const LandingPages = mongoose_1.default.models.landingpages || (0, mongoose_1.model)("landingpages", LandingPagesSchema);
54
83
  exports.default = LandingPages;
@@ -24,7 +24,7 @@
24
24
  /// <reference types="mongoose/types/inferschematype" />
25
25
  import mongoose, { Document } from "mongoose";
26
26
  export interface INewIdeas extends Document {
27
- organisationId?: string;
27
+ organizationId?: mongoose.Schema.Types.ObjectId;
28
28
  ideaName: string;
29
29
  client?: mongoose.Schema.Types.ObjectId;
30
30
  hypothesis?: mongoose.Schema.Types.ObjectId;
@@ -34,7 +34,5 @@ export interface INewIdeas extends Document {
34
34
  totalPriority?: string;
35
35
  createdBy?: mongoose.Schema.Types.ObjectId;
36
36
  }
37
- declare const NewIdeas: mongoose.Model<INewIdeas, {}, {}, {}, mongoose.Document<unknown, {}, INewIdeas> & INewIdeas & {
38
- _id: mongoose.Types.ObjectId;
39
- }, any>;
37
+ declare const NewIdeas: mongoose.Model<any, {}, {}, {}, any, any>;
40
38
  export default NewIdeas;
@@ -25,8 +25,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  const mongoose_1 = __importStar(require("mongoose"));
27
27
  const NewIdeasSchema = new mongoose_1.Schema({
28
- organisationId: {
29
- type: String,
28
+ organizationId: {
29
+ type: mongoose_1.default.Schema.Types.ObjectId,
30
+ ref: "organization",
30
31
  default: null,
31
32
  },
32
33
  ideaName: {
@@ -66,5 +67,5 @@ NewIdeasSchema.index({
66
67
  client: 1,
67
68
  viewId: 1,
68
69
  });
69
- const NewIdeas = (0, mongoose_1.model)("Newideas", NewIdeasSchema);
70
+ const NewIdeas = mongoose_1.default.models.newideas || (0, mongoose_1.model)("newideas", NewIdeasSchema);
70
71
  exports.default = NewIdeas;
@@ -31,8 +31,7 @@ export interface INotification extends Document {
31
31
  archive?: boolean;
32
32
  module?: string;
33
33
  moduleData?: string;
34
+ organizationId?: mongoose.Schema.Types.ObjectId;
34
35
  }
35
- declare const Notification: mongoose.Model<INotification, {}, {}, {}, mongoose.Document<unknown, {}, INotification> & INotification & {
36
- _id: mongoose.Types.ObjectId;
37
- }, any>;
36
+ declare const Notification: mongoose.Model<any, {}, {}, {}, any, any>;
38
37
  export default Notification;
@@ -1,7 +1,35 @@
1
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
+ };
2
25
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const mongoose_1 = require("mongoose");
26
+ const mongoose_1 = __importStar(require("mongoose"));
4
27
  const NotificationSchema = new mongoose_1.Schema({
28
+ organizationId: {
29
+ type: mongoose_1.default.Schema.Types.ObjectId,
30
+ ref: "organization",
31
+ default: null,
32
+ },
5
33
  title: {
6
34
  type: String,
7
35
  },
@@ -29,5 +57,5 @@ const NotificationSchema = new mongoose_1.Schema({
29
57
  }, {
30
58
  timestamps: true,
31
59
  });
32
- const Notification = (0, mongoose_1.model)("notification", NotificationSchema);
60
+ const Notification = mongoose_1.default.models.notification || (0, mongoose_1.model)("notification", NotificationSchema);
33
61
  exports.default = Notification;
@@ -23,36 +23,23 @@
23
23
  /// <reference types="mongoose/types/virtuals" />
24
24
  /// <reference types="mongoose/types/inferschematype" />
25
25
  import mongoose, { Document } from "mongoose";
26
- export interface IPageTargeting extends Document {
27
- condition: string;
28
- routes: mongoose.Schema.Types.Mixed;
29
- }
30
- export interface IAudienceTargeting extends Document {
31
- javascript: string;
32
- }
33
- export interface IVariants extends Document {
26
+ export interface IOrganization extends Document {
34
27
  name: string;
35
- javascript?: string;
36
- css?: string;
37
- traffic_allocation?: string;
38
- slug?: string;
39
- }
40
- export interface IClientExperiment extends Document {
41
- organisationId?: string;
42
- client?: mongoose.Schema.Types.ObjectId;
43
- viewId?: string;
44
- javascript: string;
45
- css: string;
46
- name?: string;
47
- status?: string;
48
- experimentUrl: string;
49
- pageTargeting: IPageTargeting;
50
- audienceTargeting: IAudienceTargeting;
51
- variants: IVariants;
52
- createdAt?: Date;
53
- updatedAt?: Date;
28
+ description: string;
29
+ adminEmail: string;
30
+ adminContact: string;
31
+ createdBy: mongoose.Schema.Types.ObjectId;
32
+ address: string;
33
+ city: string;
34
+ state: string;
35
+ zip: string;
36
+ country: string;
37
+ phone: string;
38
+ logo: string;
39
+ website: string;
40
+ createdAt: Date;
41
+ updatedAt: Date;
42
+ isActive: boolean;
54
43
  }
55
- declare const ClientExperiment: mongoose.Model<IClientExperiment, {}, {}, {}, mongoose.Document<unknown, {}, IClientExperiment> & IClientExperiment & {
56
- _id: mongoose.Types.ObjectId;
57
- }, any>;
58
- export default ClientExperiment;
44
+ declare const Organization: mongoose.Model<any, {}, {}, {}, any, any>;
45
+ export default Organization;
@@ -24,85 +24,67 @@ 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 VariationsSchema = new mongoose_1.Schema({
27
+ const OrganizationSchema = new mongoose_1.Schema({
28
28
  name: {
29
29
  type: String,
30
+ required: true,
31
+ unique: true,
30
32
  },
31
- css_code: {
33
+ description: {
32
34
  type: String,
35
+ required: true,
33
36
  },
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
- js: {
37
+ adminEmail: {
50
38
  type: String,
39
+ required: true,
51
40
  },
52
- reset_js: {
41
+ adminContact: {
53
42
  type: String,
43
+ required: true,
54
44
  },
55
- css: {
56
- type: String,
45
+ createdBy: {
46
+ type: mongoose_1.default.Schema.Types.ObjectId,
47
+ ref: "user",
57
48
  },
58
- changesets: {
49
+ address: {
59
50
  type: String,
51
+ required: true,
60
52
  },
61
- });
62
- const ExperimentsSchema = new mongoose_1.Schema({
63
- status: {
53
+ city: {
64
54
  type: String,
55
+ required: true,
65
56
  },
66
- name: {
57
+ state: {
67
58
  type: String,
68
59
  required: true,
69
60
  },
70
- traffic_allocation: {
71
- type: Number,
72
- default: 100,
73
- },
74
- audiences_match_type: {
61
+ zip: {
75
62
  type: String,
76
- default: "all",
77
- },
78
- metadata_1: {
79
- type: mongoose_1.default.Schema.Types.Mixed,
80
- },
81
- metadata_2: {
82
- type: mongoose_1.default.Schema.Types.Mixed,
83
- },
84
- metadata_3: {
85
- type: mongoose_1.default.Schema.Types.Mixed,
86
- },
87
- integrations_run_mode: {
88
- type: mongoose_1.default.Schema.Types.Mixed,
63
+ required: true,
89
64
  },
90
- js: {
65
+ country: {
91
66
  type: String,
67
+ required: true,
92
68
  },
93
- reset_js: {
69
+ phone: {
94
70
  type: String,
71
+ required: true,
95
72
  },
96
- csscode: {
73
+ logo: {
97
74
  type: String,
75
+ required: true,
98
76
  },
99
- audiences: {
100
- type: mongoose_1.default.Schema.Types.Array,
77
+ website: {
78
+ type: String,
79
+ required: true,
101
80
  },
102
- variations: VariationsSchema,
103
- environments: {
104
- type: mongoose_1.default.Schema.Types.Array,
81
+ isActive: {
82
+ type: Boolean,
83
+ default: true,
105
84
  },
85
+ }, {
86
+ timestamps: true
106
87
  });
107
- const Experiments = (0, mongoose_1.model)("experiments", ExperimentsSchema);
108
- exports.default = Experiments;
88
+ const Organization = mongoose_1.default.models.organization || (0, mongoose_1.model)("organization", OrganizationSchema);
89
+ OrganizationSchema.index({ name: 1, isActive: 1 });
90
+ exports.default = Organization;
@@ -31,15 +31,15 @@ export interface IUrltargetings extends Document {
31
31
  export interface IPage extends Document {
32
32
  name: string;
33
33
  client?: mongoose.Schema.Types.ObjectId;
34
+ organizationId?: mongoose.Schema.Types.ObjectId;
34
35
  trigger: string;
35
36
  trigger_js: string;
36
37
  api_name: string;
37
38
  poll_on_rules: Boolean;
38
39
  deactivation_mode: string;
39
40
  rules_js: string;
40
- urltargetings: IUrltargetings;
41
+ urltargetings: IUrltargetings[];
42
+ isActive?: boolean;
41
43
  }
42
- declare const Page: mongoose.Model<IPage, {}, {}, {}, mongoose.Document<unknown, {}, IPage> & IPage & {
43
- _id: mongoose.Types.ObjectId;
44
- }, any>;
44
+ declare const Page: mongoose.Model<any, {}, {}, {}, any, any>;
45
45
  export default Page;