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.
- package/.github/workflows/npm-publish.yml +33 -0
- package/dist/index.d.ts +4 -3
- package/dist/index.js +7 -5
- package/dist/src/models/Announcement.d.ts +7 -8
- package/dist/src/models/Announcement.js +30 -10
- package/dist/src/models/AppEvent.d.ts +1 -3
- package/dist/src/models/AppEvent.js +1 -1
- package/dist/src/models/Audience.d.ts +2 -3
- package/dist/src/models/Audience.js +6 -1
- package/dist/src/models/{Experiments.d.ts → BqPreCompiledData.d.ts} +12 -32
- package/dist/src/models/{ClientExperiment.js → BqPreCompiledData.js} +26 -46
- package/dist/src/models/CVRReport.d.ts +2 -3
- package/dist/src/models/CVRReport.js +14 -1
- package/dist/src/models/Client.d.ts +2 -4
- package/dist/src/models/Client.js +32 -52
- package/dist/src/models/ClientAdditionalRevenue.d.ts +2 -4
- package/dist/src/models/ClientAdditionalRevenue.js +4 -3
- package/dist/src/models/ClientLearning.d.ts +2 -4
- package/dist/src/models/ClientLearning.js +11 -7
- package/dist/src/models/ClientLinks.d.ts +2 -4
- package/dist/src/models/ClientLinks.js +16 -7
- package/dist/src/models/ClientNextSteps.d.ts +2 -4
- package/dist/src/models/ClientNextSteps.js +4 -3
- package/dist/src/models/ClientNote.d.ts +2 -4
- package/dist/src/models/ClientNote.js +4 -3
- package/dist/src/models/ClientReportsTemp.d.ts +2 -4
- package/dist/src/models/ClientReportsTemp.js +21 -3
- package/dist/src/models/ClientRetention.d.ts +2 -3
- package/dist/src/models/ClientRetention.js +19 -1
- package/dist/src/models/ClientScript.d.ts +2 -4
- package/dist/src/models/ClientScript.js +25 -9
- package/dist/src/models/ClientStrategy.d.ts +2 -4
- package/dist/src/models/ClientStrategy.js +4 -3
- package/dist/src/models/ClientSurvay.d.ts +2 -7
- package/dist/src/models/ClientSurvay.js +6 -1
- package/dist/src/models/Environment.d.ts +3 -3
- package/dist/src/models/Environment.js +27 -3
- package/dist/src/models/Faqs.d.ts +2 -3
- package/dist/src/models/Faqs.js +6 -1
- package/dist/src/models/Feedback.d.ts +2 -4
- package/dist/src/models/Feedback.js +4 -3
- package/dist/src/models/Goal.d.ts +3 -4
- package/dist/src/models/Goal.js +34 -12
- package/dist/src/models/Hypothesis.d.ts +3 -3
- package/dist/src/models/Hypothesis.js +50 -10
- package/dist/src/models/HypothesisSheet.d.ts +2 -4
- package/dist/src/models/HypothesisSheet.js +27 -3
- package/dist/src/models/LandingPages.d.ts +4 -3
- package/dist/src/models/LandingPages.js +30 -1
- package/dist/src/models/NewIdeas.d.ts +2 -4
- package/dist/src/models/NewIdeas.js +4 -3
- package/dist/src/models/Notification.d.ts +2 -3
- package/dist/src/models/Notification.js +30 -2
- package/dist/src/models/{ClientExperiment.d.ts → Organization.d.ts} +18 -31
- package/dist/src/models/{Experiments.js → Organization.js} +36 -54
- package/dist/src/models/Page.d.ts +4 -4
- package/dist/src/models/Page.js +57 -5
- package/dist/src/models/PageElement.d.ts +4 -3
- package/dist/src/models/PageElement.js +60 -8
- package/dist/src/models/PageTestType.d.ts +3 -3
- package/dist/src/models/PageTestType.js +42 -6
- package/dist/src/models/Portfolio.d.ts +2 -3
- package/dist/src/models/Portfolio.js +6 -1
- package/dist/src/models/PrecalculationFilters.d.ts +34 -0
- package/dist/src/models/PrecalculationFilters.js +78 -0
- package/dist/src/models/QueryLog.d.ts +2 -4
- package/dist/src/models/QueryLog.js +4 -3
- package/dist/src/models/ReadNotification.d.ts +2 -3
- package/dist/src/models/ReadNotification.js +30 -2
- package/dist/src/models/Report.d.ts +3 -4
- package/dist/src/models/Report.js +33 -49
- package/dist/src/models/Role.d.ts +4 -3
- package/dist/src/models/Role.js +51 -8
- package/dist/src/models/SavedSegment.d.ts +2 -3
- package/dist/src/models/SavedSegment.js +6 -1
- package/dist/src/models/Segment.d.ts +2 -3
- package/dist/src/models/Segment.js +6 -1
- package/dist/src/models/SegmentCombination.d.ts +2 -3
- package/dist/src/models/SegmentCombination.js +6 -1
- package/dist/src/models/Snippet.d.ts +3 -4
- package/dist/src/models/Snippet.js +29 -4
- package/dist/src/models/StageInCustomerJourney.d.ts +4 -4
- package/dist/src/models/StageInCustomerJourney.js +56 -4
- package/dist/src/models/Tag.d.ts +2 -3
- package/dist/src/models/Tag.js +30 -2
- package/dist/src/models/Temp.d.ts +2 -3
- package/dist/src/models/Temp.js +30 -2
- package/dist/src/models/Test.d.ts +17 -18
- package/dist/src/models/Test.js +83 -186
- package/dist/src/models/TestSequentialValue.d.ts +2 -3
- package/dist/src/models/TestSequentialValue.js +6 -1
- package/dist/src/models/Tier.d.ts +2 -3
- package/dist/src/models/Tier.js +30 -2
- package/dist/src/models/Trigger.d.ts +2 -3
- package/dist/src/models/Trigger.js +30 -2
- package/dist/src/models/User.d.ts +2 -3
- package/dist/src/models/User.js +10 -11
- package/index.ts +6 -4
- package/package.json +1 -1
- package/src/models/Announcement.ts +51 -28
- package/src/models/AppEvent.ts +1 -1
- package/src/models/Audience.ts +7 -1
- package/src/models/BqPreCompiledData.ts +62 -0
- package/src/models/CVRReport.ts +18 -1
- package/src/models/Client.ts +40 -60
- package/src/models/ClientAdditionalRevenue.ts +5 -4
- package/src/models/ClientLearning.ts +12 -8
- package/src/models/ClientLinks.ts +19 -8
- package/src/models/ClientNextSteps.ts +5 -4
- package/src/models/ClientNote.ts +5 -4
- package/src/models/ClientReportsTemp.ts +25 -4
- package/src/models/ClientRetention.ts +28 -2
- package/src/models/ClientScript.ts +27 -10
- package/src/models/ClientStrategy.ts +5 -4
- package/src/models/ClientSurvay.ts +7 -1
- package/src/models/Environment.ts +32 -4
- package/src/models/Faqs.ts +7 -1
- package/src/models/Feedback.ts +5 -4
- package/src/models/Goal.ts +37 -13
- package/src/models/Hypothesis.ts +30 -9
- package/src/models/HypothesisSheet.ts +4 -3
- package/src/models/LandingPages.ts +35 -1
- package/src/models/NewIdeas.ts +5 -4
- package/src/models/Notification.ts +7 -1
- package/src/models/Organization.ts +86 -0
- package/src/models/Page.ts +63 -6
- package/src/models/PageElement.ts +39 -8
- package/src/models/PageTestType.ts +22 -5
- package/src/models/Portfolio.ts +7 -1
- package/src/models/PrecalculationFilters.ts +68 -0
- package/src/models/QueryLog.ts +5 -4
- package/src/models/ReadNotification.ts +7 -1
- package/src/models/Report.ts +55 -67
- package/src/models/Role.ts +32 -7
- package/src/models/SavedSegment.ts +7 -1
- package/src/models/Segment.ts +7 -1
- package/src/models/SegmentCombination.ts +7 -1
- package/src/models/Snippet.ts +33 -5
- package/src/models/StageInCustomerJourney.ts +34 -6
- package/src/models/Tag.ts +7 -1
- package/src/models/Temp.ts +7 -1
- package/src/models/Test.ts +156 -244
- package/src/models/TestSequentialValue.ts +7 -1
- package/src/models/Tier.ts +7 -1
- package/src/models/Trigger.ts +7 -1
- package/src/models/User.ts +12 -11
- package/src/models/ClientExperiment.ts +0 -113
- package/src/models/Experiments.ts +0 -118
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
|
|
2
|
+
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
|
|
3
|
+
|
|
4
|
+
name: Publish Codebase Shared Models on NPM
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
push:
|
|
8
|
+
branches:
|
|
9
|
+
- main
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
build:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v4
|
|
16
|
+
- uses: actions/setup-node@v4
|
|
17
|
+
with:
|
|
18
|
+
node-version: 20
|
|
19
|
+
- run: npm ci
|
|
20
|
+
|
|
21
|
+
publish-npm:
|
|
22
|
+
needs: build
|
|
23
|
+
runs-on: ubuntu-latest
|
|
24
|
+
steps:
|
|
25
|
+
- uses: actions/checkout@v4
|
|
26
|
+
- uses: actions/setup-node@v4
|
|
27
|
+
with:
|
|
28
|
+
node-version: 20
|
|
29
|
+
registry-url: https://registry.npmjs.org/
|
|
30
|
+
- run: npm ci
|
|
31
|
+
- run: npm publish
|
|
32
|
+
env:
|
|
33
|
+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
|
package/dist/index.d.ts
CHANGED
|
@@ -41,7 +41,6 @@ import ClientRetention from "./src/models/ClientRetention";
|
|
|
41
41
|
import ClientStrategy from "./src/models/ClientStrategy";
|
|
42
42
|
import ClientSurvey from "./src/models/ClientSurvay";
|
|
43
43
|
import CVRReport from "./src/models/CVRReport";
|
|
44
|
-
import Experiments from "./src/models/Experiments";
|
|
45
44
|
import Faq from "./src/models/Faqs";
|
|
46
45
|
import Feedback from "./src/models/Feedback";
|
|
47
46
|
import Goal from "./src/models/Goal";
|
|
@@ -55,6 +54,7 @@ import PageElement from "./src/models/PageElement";
|
|
|
55
54
|
import PageTestType from "./src/models/PageTestType";
|
|
56
55
|
import Portfolio from "./src/models/Portfolio";
|
|
57
56
|
import ReadNotification from "./src/models/ReadNotification";
|
|
57
|
+
import Organization from "./src/models/Organization";
|
|
58
58
|
import Role from "./src/models/Role";
|
|
59
59
|
import SavedSegment from "./src/models/SavedSegment";
|
|
60
60
|
import Segment from "./src/models/Segment";
|
|
@@ -66,8 +66,9 @@ import Temp from "./src/models/Temp";
|
|
|
66
66
|
import Tier from "./src/models/Tier";
|
|
67
67
|
import Trigger from "./src/models/Trigger";
|
|
68
68
|
import ClientScript from "./src/models/ClientScript";
|
|
69
|
-
import ClientExperiment from "./src/models/ClientExperiment";
|
|
70
69
|
import Audience from "./src/models/Audience";
|
|
71
70
|
import Environment from "./src/models/Environment";
|
|
71
|
+
import PrecalculationFilters from "./src/models/PrecalculationFilters";
|
|
72
|
+
import BqPreCompiledData from "./src/models/BqPreCompiledData";
|
|
72
73
|
export declare function connect(uri: string, options?: mongoose.ConnectOptions | undefined): Promise<typeof mongoose>;
|
|
73
|
-
export { Client, ClientReportsTemp, QueryLog, Report, Test, TestSequentialValue, User, AppEvent, Announcement, ClientAdditionalRevenue, ClientLearning, ClientLinks, ClientNextStep, ClientNote, ClientRetention, ClientStrategy, ClientSurvey, CVRReport,
|
|
74
|
+
export { Client, ClientReportsTemp, QueryLog, Report, 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, SavedSegment, Segment, SegmentCombination, Snippet, StageInCustomerJourney, Tag, Temp, Tier, Trigger, ClientScript, Audience, Environment, Organization, PrecalculationFilters, BqPreCompiledData, };
|
package/dist/index.js
CHANGED
|
@@ -12,7 +12,7 @@ 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.
|
|
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.SegmentCombination = exports.Segment = exports.SavedSegment = 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.Report = exports.QueryLog = exports.ClientReportsTemp = exports.Client = exports.connect = void 0;
|
|
16
16
|
const mongoose_1 = __importDefault(require("mongoose"));
|
|
17
17
|
const Client_1 = __importDefault(require("./src/models/Client"));
|
|
18
18
|
exports.Client = Client_1.default;
|
|
@@ -50,8 +50,6 @@ const ClientSurvay_1 = __importDefault(require("./src/models/ClientSurvay"));
|
|
|
50
50
|
exports.ClientSurvey = ClientSurvay_1.default;
|
|
51
51
|
const CVRReport_1 = __importDefault(require("./src/models/CVRReport"));
|
|
52
52
|
exports.CVRReport = CVRReport_1.default;
|
|
53
|
-
const Experiments_1 = __importDefault(require("./src/models/Experiments"));
|
|
54
|
-
exports.Experiments = Experiments_1.default;
|
|
55
53
|
const Faqs_1 = __importDefault(require("./src/models/Faqs"));
|
|
56
54
|
exports.Faq = Faqs_1.default;
|
|
57
55
|
const Feedback_1 = __importDefault(require("./src/models/Feedback"));
|
|
@@ -78,6 +76,8 @@ const Portfolio_1 = __importDefault(require("./src/models/Portfolio"));
|
|
|
78
76
|
exports.Portfolio = Portfolio_1.default;
|
|
79
77
|
const ReadNotification_1 = __importDefault(require("./src/models/ReadNotification"));
|
|
80
78
|
exports.ReadNotification = ReadNotification_1.default;
|
|
79
|
+
const Organization_1 = __importDefault(require("./src/models/Organization"));
|
|
80
|
+
exports.Organization = Organization_1.default;
|
|
81
81
|
const Role_1 = __importDefault(require("./src/models/Role"));
|
|
82
82
|
exports.Role = Role_1.default;
|
|
83
83
|
const SavedSegment_1 = __importDefault(require("./src/models/SavedSegment"));
|
|
@@ -100,12 +100,14 @@ const Trigger_1 = __importDefault(require("./src/models/Trigger"));
|
|
|
100
100
|
exports.Trigger = Trigger_1.default;
|
|
101
101
|
const ClientScript_1 = __importDefault(require("./src/models/ClientScript"));
|
|
102
102
|
exports.ClientScript = ClientScript_1.default;
|
|
103
|
-
const ClientExperiment_1 = __importDefault(require("./src/models/ClientExperiment"));
|
|
104
|
-
exports.ClientExperiment = ClientExperiment_1.default;
|
|
105
103
|
const Audience_1 = __importDefault(require("./src/models/Audience"));
|
|
106
104
|
exports.Audience = Audience_1.default;
|
|
107
105
|
const Environment_1 = __importDefault(require("./src/models/Environment"));
|
|
108
106
|
exports.Environment = Environment_1.default;
|
|
107
|
+
const PrecalculationFilters_1 = __importDefault(require("./src/models/PrecalculationFilters"));
|
|
108
|
+
exports.PrecalculationFilters = PrecalculationFilters_1.default;
|
|
109
|
+
const BqPreCompiledData_1 = __importDefault(require("./src/models/BqPreCompiledData"));
|
|
110
|
+
exports.BqPreCompiledData = BqPreCompiledData_1.default;
|
|
109
111
|
function seedRoles() {
|
|
110
112
|
return __awaiter(this, void 0, void 0, function* () {
|
|
111
113
|
const checkRoles = yield Role_1.default.countDocuments();
|
|
@@ -25,13 +25,12 @@
|
|
|
25
25
|
import mongoose, { Document } from "mongoose";
|
|
26
26
|
export interface IAnnouncement extends Document {
|
|
27
27
|
title: string;
|
|
28
|
-
description?:
|
|
29
|
-
active?:
|
|
30
|
-
forRoles?: mongoose.Schema.Types.ObjectId;
|
|
31
|
-
forUsers?: mongoose.Schema.Types.ObjectId;
|
|
32
|
-
readBy?: mongoose.Schema.Types.ObjectId;
|
|
28
|
+
description?: string;
|
|
29
|
+
active?: boolean;
|
|
30
|
+
forRoles?: mongoose.Schema.Types.ObjectId[];
|
|
31
|
+
forUsers?: mongoose.Schema.Types.ObjectId[];
|
|
32
|
+
readBy?: mongoose.Schema.Types.ObjectId[];
|
|
33
|
+
organizationId?: mongoose.Schema.Types.ObjectId;
|
|
33
34
|
}
|
|
34
|
-
declare const Announcement: mongoose.Model<
|
|
35
|
-
_id: mongoose.Types.ObjectId;
|
|
36
|
-
}, any>;
|
|
35
|
+
declare const Announcement: mongoose.Model<any, {}, {}, {}, any, any>;
|
|
37
36
|
export default Announcement;
|
|
@@ -25,35 +25,55 @@ 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 AnnouncementSchema = new mongoose_1.Schema({
|
|
28
|
+
organizationId: {
|
|
29
|
+
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
30
|
+
ref: "organization",
|
|
31
|
+
default: null,
|
|
32
|
+
},
|
|
28
33
|
title: {
|
|
29
34
|
type: String,
|
|
30
35
|
required: true,
|
|
36
|
+
trim: true
|
|
31
37
|
},
|
|
32
38
|
description: {
|
|
33
39
|
type: String,
|
|
34
|
-
|
|
40
|
+
trim: true
|
|
35
41
|
},
|
|
36
42
|
active: {
|
|
37
43
|
type: Boolean,
|
|
38
|
-
default: true
|
|
44
|
+
default: true
|
|
39
45
|
},
|
|
40
46
|
forRoles: {
|
|
41
47
|
type: [mongoose_1.default.Schema.Types.ObjectId],
|
|
42
48
|
required: true,
|
|
43
|
-
ref: "role"
|
|
49
|
+
ref: "role"
|
|
44
50
|
},
|
|
45
51
|
forUsers: {
|
|
46
52
|
type: [mongoose_1.default.Schema.Types.ObjectId],
|
|
47
|
-
|
|
48
|
-
ref: "user",
|
|
53
|
+
ref: "user"
|
|
49
54
|
},
|
|
50
55
|
readBy: {
|
|
51
56
|
type: [mongoose_1.default.Schema.Types.ObjectId],
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
},
|
|
57
|
+
ref: "user"
|
|
58
|
+
}
|
|
55
59
|
}, {
|
|
56
|
-
timestamps: true
|
|
60
|
+
timestamps: true
|
|
57
61
|
});
|
|
58
|
-
|
|
62
|
+
// Add compound indexes for better query performance
|
|
63
|
+
AnnouncementSchema.index({ active: 1, createdAt: -1 }); // For active announcements sorted by date
|
|
64
|
+
AnnouncementSchema.index({ forRoles: 1, active: 1 }); // For role-based announcements
|
|
65
|
+
AnnouncementSchema.index({ forUsers: 1, active: 1 }); // For user-specific announcements
|
|
66
|
+
AnnouncementSchema.index({ readBy: 1 }); // For tracking read status
|
|
67
|
+
AnnouncementSchema.index({ title: 1 }, { collation: { locale: 'en', strength: 2 } }); // Case-insensitive title search
|
|
68
|
+
// Add text index for full-text search
|
|
69
|
+
// AnnouncementSchema.index({
|
|
70
|
+
// title: 'text',
|
|
71
|
+
// description: 'text'
|
|
72
|
+
// }, {
|
|
73
|
+
// weights: {
|
|
74
|
+
// title: 10,
|
|
75
|
+
// description: 5
|
|
76
|
+
// }
|
|
77
|
+
// });
|
|
78
|
+
const Announcement = mongoose_1.default.models.announcement || (0, mongoose_1.model)("announcement", AnnouncementSchema);
|
|
59
79
|
exports.default = Announcement;
|
|
@@ -50,7 +50,5 @@ export interface IAppEvent extends Document {
|
|
|
50
50
|
performanceMetrics?: IPerformanceMetrics;
|
|
51
51
|
engagementMetrics?: IEngagementMetrics;
|
|
52
52
|
}
|
|
53
|
-
declare const AppEvent: mongoose.Model<
|
|
54
|
-
_id: mongoose.Types.ObjectId;
|
|
55
|
-
}, any>;
|
|
53
|
+
declare const AppEvent: mongoose.Model<any, {}, {}, {}, any, any>;
|
|
56
54
|
export default AppEvent;
|
|
@@ -62,5 +62,5 @@ const AppEventsSchema = new mongoose_1.Schema({
|
|
|
62
62
|
}, {
|
|
63
63
|
timestamps: true,
|
|
64
64
|
});
|
|
65
|
-
const AppEvent = (0, mongoose_1.model)("appevent", AppEventsSchema);
|
|
65
|
+
const AppEvent = mongoose_1.default.models.appevent || (0, mongoose_1.model)("appevent", AppEventsSchema);
|
|
66
66
|
exports.default = AppEvent;
|
|
@@ -24,11 +24,10 @@
|
|
|
24
24
|
/// <reference types="mongoose/types/inferschematype" />
|
|
25
25
|
import mongoose, { Document } from "mongoose";
|
|
26
26
|
export interface IAudience extends Document {
|
|
27
|
+
organizationId?: mongoose.Schema.Types.ObjectId;
|
|
27
28
|
name: string;
|
|
28
29
|
rules_js?: string;
|
|
29
30
|
client?: mongoose.Schema.Types.ObjectId;
|
|
30
31
|
}
|
|
31
|
-
declare const Audience: mongoose.Model<
|
|
32
|
-
_id: mongoose.Types.ObjectId;
|
|
33
|
-
}, any>;
|
|
32
|
+
declare const Audience: mongoose.Model<any, {}, {}, {}, any, any>;
|
|
34
33
|
export default Audience;
|
|
@@ -25,6 +25,11 @@ 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 AudienceSchema = new mongoose_1.Schema({
|
|
28
|
+
organizationId: {
|
|
29
|
+
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
30
|
+
ref: "organization",
|
|
31
|
+
default: null,
|
|
32
|
+
},
|
|
28
33
|
name: {
|
|
29
34
|
type: String,
|
|
30
35
|
required: true,
|
|
@@ -39,5 +44,5 @@ const AudienceSchema = new mongoose_1.Schema({
|
|
|
39
44
|
}, {
|
|
40
45
|
timestamps: true,
|
|
41
46
|
});
|
|
42
|
-
const Audience = (0, mongoose_1.model)("audience", AudienceSchema);
|
|
47
|
+
const Audience = mongoose_1.default.models.audience || (0, mongoose_1.model)("audience", AudienceSchema);
|
|
43
48
|
exports.default = Audience;
|
|
@@ -23,36 +23,16 @@
|
|
|
23
23
|
/// <reference types="mongoose/types/virtuals" />
|
|
24
24
|
/// <reference types="mongoose/types/inferschematype" />
|
|
25
25
|
import mongoose, { Document } from "mongoose";
|
|
26
|
-
export interface
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
css: string;
|
|
37
|
-
changesets: string;
|
|
26
|
+
export interface IBqPreCompiledData extends Document {
|
|
27
|
+
title: string;
|
|
28
|
+
organizationId: mongoose.Schema.Types.ObjectId;
|
|
29
|
+
client: mongoose.Schema.Types.ObjectId;
|
|
30
|
+
test: mongoose.Schema.Types.ObjectId;
|
|
31
|
+
from: Date;
|
|
32
|
+
to: Date;
|
|
33
|
+
filters: any;
|
|
34
|
+
otherFilters: any;
|
|
35
|
+
cloudurl: string;
|
|
38
36
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
name: string;
|
|
42
|
-
traffic_allocation: Number;
|
|
43
|
-
audiences_match_type: string;
|
|
44
|
-
metadata_1: mongoose.Schema.Types.Mixed;
|
|
45
|
-
metadata_2: mongoose.Schema.Types.Mixed;
|
|
46
|
-
metadata_3: mongoose.Schema.Types.Mixed;
|
|
47
|
-
integrations_run_mode: mongoose.Schema.Types.Mixed;
|
|
48
|
-
js: string;
|
|
49
|
-
reset_js: string;
|
|
50
|
-
csscode: string;
|
|
51
|
-
audiences?: mongoose.Schema.Types.Array;
|
|
52
|
-
variations: IVariations;
|
|
53
|
-
environments?: mongoose.Schema.Types.Array;
|
|
54
|
-
}
|
|
55
|
-
declare const Experiments: mongoose.Model<IExperiments, {}, {}, {}, mongoose.Document<unknown, {}, IExperiments> & IExperiments & {
|
|
56
|
-
_id: mongoose.Types.ObjectId;
|
|
57
|
-
}, any>;
|
|
58
|
-
export default Experiments;
|
|
37
|
+
declare const BqPreCompiledData: mongoose.Model<any, {}, {}, {}, any, any>;
|
|
38
|
+
export default BqPreCompiledData;
|
|
@@ -24,69 +24,49 @@ 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
|
|
28
|
-
|
|
27
|
+
const BqPreCompiledDataSchema = new mongoose_1.Schema({
|
|
28
|
+
title: {
|
|
29
29
|
type: String,
|
|
30
30
|
default: null,
|
|
31
31
|
},
|
|
32
|
-
|
|
33
|
-
type: mongoose_1.default.Schema.Types.
|
|
34
|
-
|
|
35
|
-
});
|
|
36
|
-
const AudienceTargetingSchema = new mongoose_1.Schema({
|
|
37
|
-
javascript: {
|
|
38
|
-
type: String,
|
|
39
|
-
default: "return true",
|
|
40
|
-
},
|
|
41
|
-
});
|
|
42
|
-
const VariantsSchema = new mongoose_1.Schema({
|
|
43
|
-
name: {
|
|
44
|
-
type: String,
|
|
32
|
+
organizationId: {
|
|
33
|
+
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
34
|
+
ref: "organization",
|
|
45
35
|
default: null,
|
|
46
36
|
},
|
|
47
|
-
|
|
48
|
-
type:
|
|
37
|
+
client: {
|
|
38
|
+
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
39
|
+
ref: "client",
|
|
49
40
|
default: null,
|
|
50
41
|
},
|
|
51
|
-
|
|
52
|
-
type:
|
|
42
|
+
test: {
|
|
43
|
+
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
44
|
+
ref: "test",
|
|
53
45
|
default: null,
|
|
54
46
|
},
|
|
55
|
-
|
|
56
|
-
type:
|
|
47
|
+
from: {
|
|
48
|
+
type: Date,
|
|
57
49
|
default: null,
|
|
58
50
|
},
|
|
59
|
-
|
|
60
|
-
type:
|
|
51
|
+
filters: {
|
|
52
|
+
type: Object,
|
|
61
53
|
default: null,
|
|
62
54
|
},
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
organisationId: {
|
|
66
|
-
type: String,
|
|
55
|
+
to: {
|
|
56
|
+
type: Date,
|
|
67
57
|
default: null,
|
|
68
58
|
},
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
default: "draft",
|
|
73
|
-
},
|
|
74
|
-
experimentUrl: String,
|
|
75
|
-
client: {
|
|
76
|
-
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
77
|
-
ref: "client",
|
|
59
|
+
otherFilters: {
|
|
60
|
+
type: Object,
|
|
61
|
+
default: null,
|
|
78
62
|
},
|
|
79
|
-
|
|
63
|
+
cloudurl: {
|
|
80
64
|
type: String,
|
|
65
|
+
default: null,
|
|
81
66
|
},
|
|
82
|
-
pageTargeting: [PageTargetingSchema],
|
|
83
|
-
audienceTargeting: AudienceTargetingSchema,
|
|
84
|
-
variants: [VariantsSchema],
|
|
85
67
|
}, {
|
|
86
|
-
timestamps: true
|
|
87
|
-
});
|
|
88
|
-
ClientExperimentSchema.index({
|
|
89
|
-
client: 1,
|
|
68
|
+
timestamps: true
|
|
90
69
|
});
|
|
91
|
-
|
|
92
|
-
|
|
70
|
+
BqPreCompiledDataSchema.index({ organizationId: 1, client: 1 });
|
|
71
|
+
const BqPreCompiledData = mongoose_1.default.models.bqprecompileddata || (0, mongoose_1.model)("bqprecompileddata", BqPreCompiledDataSchema);
|
|
72
|
+
exports.default = BqPreCompiledData;
|
|
@@ -24,10 +24,9 @@
|
|
|
24
24
|
/// <reference types="mongoose/types/inferschematype" />
|
|
25
25
|
import mongoose, { Document } from "mongoose";
|
|
26
26
|
export interface ICVRReport extends Document {
|
|
27
|
+
organizationId?: mongoose.Schema.Types.ObjectId;
|
|
27
28
|
reportLink?: string;
|
|
28
29
|
client?: mongoose.Schema.Types.ObjectId;
|
|
29
30
|
}
|
|
30
|
-
declare const CVRReport: mongoose.Model<
|
|
31
|
-
_id: mongoose.Types.ObjectId;
|
|
32
|
-
}, any>;
|
|
31
|
+
declare const CVRReport: mongoose.Model<any, {}, {}, {}, any, any>;
|
|
33
32
|
export default CVRReport;
|
|
@@ -25,16 +25,29 @@ 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 CVRReportSchema = new mongoose_1.Schema({
|
|
28
|
+
organizationId: {
|
|
29
|
+
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
30
|
+
ref: "organization",
|
|
31
|
+
default: null,
|
|
32
|
+
},
|
|
28
33
|
reportLink: {
|
|
29
34
|
type: String,
|
|
30
35
|
default: null,
|
|
36
|
+
trim: true,
|
|
31
37
|
},
|
|
32
38
|
client: {
|
|
33
39
|
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
34
40
|
ref: "client",
|
|
41
|
+
index: true,
|
|
35
42
|
},
|
|
36
43
|
}, {
|
|
37
44
|
timestamps: true,
|
|
38
45
|
});
|
|
39
|
-
|
|
46
|
+
// Compound index for client and reportLink
|
|
47
|
+
CVRReportSchema.index({ client: 1 });
|
|
48
|
+
// Sparse index for reportLink
|
|
49
|
+
CVRReportSchema.index({ reportLink: 1 }, { sparse: true });
|
|
50
|
+
// TTL index for automatic cleanup of old reports (1 year)
|
|
51
|
+
CVRReportSchema.index({ createdAt: 1 }, { expireAfterSeconds: 31536000 });
|
|
52
|
+
const CVRReport = mongoose_1.default.models.cvrreport || (0, mongoose_1.model)("cvrreport", CVRReportSchema);
|
|
40
53
|
exports.default = CVRReport;
|
|
@@ -29,7 +29,7 @@ export interface IProperty extends Document {
|
|
|
29
29
|
platform?: string;
|
|
30
30
|
}
|
|
31
31
|
export interface IClient extends Document {
|
|
32
|
-
|
|
32
|
+
organizationId?: mongoose.Schema.Types.ObjectId;
|
|
33
33
|
name: string;
|
|
34
34
|
slug?: string;
|
|
35
35
|
viewId?: string;
|
|
@@ -47,7 +47,5 @@ export interface IClient extends Document {
|
|
|
47
47
|
retainerValue: number;
|
|
48
48
|
useIntraDayTable: boolean;
|
|
49
49
|
}
|
|
50
|
-
declare const Client: mongoose.Model<
|
|
51
|
-
_id: mongoose.Types.ObjectId;
|
|
52
|
-
}, any>;
|
|
50
|
+
declare const Client: mongoose.Model<any, {}, {}, {}, any, any>;
|
|
53
51
|
export default Client;
|
|
@@ -32,70 +32,50 @@ mongoose_1.default.plugin(mongoose_slug_updater_1.default);
|
|
|
32
32
|
const PropertySchema = new mongoose_1.Schema({
|
|
33
33
|
propertyname: { type: String, required: true },
|
|
34
34
|
viewId: { type: String, required: true },
|
|
35
|
-
platform: { type: String,
|
|
35
|
+
platform: { type: String, default: "GA4" }
|
|
36
36
|
});
|
|
37
37
|
const ClientSchema = new mongoose_1.Schema({
|
|
38
|
-
|
|
38
|
+
organizationId: { type: mongoose_1.default.Schema.Types.ObjectId,
|
|
39
|
+
ref: "organization",
|
|
40
|
+
default: null },
|
|
41
|
+
name: { type: String, required: true },
|
|
42
|
+
slug: {
|
|
39
43
|
type: String,
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
type: String,
|
|
44
|
-
required: true,
|
|
45
|
-
},
|
|
46
|
-
slug: { type: String, slug: ["name"], slugPaddingSize: 4, unique: true },
|
|
47
|
-
viewId: {
|
|
48
|
-
type: String,
|
|
49
|
-
},
|
|
50
|
-
portfolioClient: {
|
|
51
|
-
type: Boolean,
|
|
52
|
-
default: false,
|
|
44
|
+
slug: ["name"],
|
|
45
|
+
slugPaddingSize: 4,
|
|
46
|
+
unique: true
|
|
53
47
|
},
|
|
48
|
+
viewId: { type: String },
|
|
49
|
+
portfolioClient: { type: Boolean, default: false },
|
|
54
50
|
gaproperties: [PropertySchema],
|
|
55
51
|
tier: {
|
|
56
52
|
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
57
53
|
ref: "tier",
|
|
58
|
-
default: null
|
|
59
|
-
},
|
|
60
|
-
active: {
|
|
61
|
-
type: Boolean,
|
|
62
|
-
default: true,
|
|
63
|
-
},
|
|
64
|
-
currency: {
|
|
65
|
-
type: String,
|
|
66
|
-
default: "USD",
|
|
67
|
-
},
|
|
68
|
-
logo: {
|
|
69
|
-
type: String,
|
|
70
|
-
default: "",
|
|
54
|
+
default: null
|
|
71
55
|
},
|
|
56
|
+
active: { type: Boolean, default: true },
|
|
57
|
+
currency: { type: String, default: "USD" },
|
|
58
|
+
logo: { type: String, default: "" },
|
|
72
59
|
createdBy: {
|
|
73
60
|
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
74
61
|
ref: "user",
|
|
75
|
-
default: null
|
|
62
|
+
default: null
|
|
76
63
|
},
|
|
77
|
-
onboardDate: {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
},
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
},
|
|
88
|
-
NDAStatus: {
|
|
89
|
-
type: Boolean,
|
|
90
|
-
default: false,
|
|
91
|
-
},
|
|
92
|
-
retainerValue: {
|
|
93
|
-
type: Number,
|
|
94
|
-
},
|
|
95
|
-
useIntraDayTable: {
|
|
96
|
-
type: Boolean,
|
|
97
|
-
},
|
|
98
|
-
}, { timestamps: true });
|
|
64
|
+
onboardDate: { type: Date, default: Date.now },
|
|
65
|
+
bqClientId: { type: String, default: null },
|
|
66
|
+
defaultDataSet: { type: String },
|
|
67
|
+
NDAStatus: { type: Boolean, default: false },
|
|
68
|
+
retainerValue: { type: Number },
|
|
69
|
+
useIntraDayTable: { type: Boolean }
|
|
70
|
+
}, {
|
|
71
|
+
timestamps: true
|
|
72
|
+
});
|
|
73
|
+
// Add compound indexes for better query performance
|
|
99
74
|
ClientSchema.index({ active: 1 });
|
|
100
|
-
|
|
75
|
+
ClientSchema.index({ organizationId: 1, active: 1 });
|
|
76
|
+
ClientSchema.index({ name: 1 }, { collation: { locale: 'en', strength: 2 } }); // Case-insensitive search
|
|
77
|
+
ClientSchema.index({ tier: 1, active: 1 }); // For tier-based queries
|
|
78
|
+
ClientSchema.index({ onboardDate: 1 }); // For date-based queries
|
|
79
|
+
ClientSchema.index({ portfolioClient: 1, active: 1 }); // For portfolio client queries
|
|
80
|
+
const Client = mongoose_1.default.models.client || (0, mongoose_1.model)("client", ClientSchema);
|
|
101
81
|
exports.default = Client;
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
/// <reference types="mongoose/types/inferschematype" />
|
|
25
25
|
import mongoose, { Document } from "mongoose";
|
|
26
26
|
export interface IClientAdditionalRevenue extends Document {
|
|
27
|
-
|
|
27
|
+
organizationId?: mongoose.Schema.Types.ObjectId;
|
|
28
28
|
client?: mongoose.Schema.Types.ObjectId;
|
|
29
29
|
additionalRevenueForTests: IAdditionalRevenue;
|
|
30
30
|
createdBy?: mongoose.Schema.Types.ObjectId;
|
|
@@ -35,7 +35,5 @@ export interface IAdditionalRevenue extends Document {
|
|
|
35
35
|
test?: mongoose.Schema.Types.ObjectId;
|
|
36
36
|
data_to_project?: mongoose.Schema.Types.Mixed;
|
|
37
37
|
}
|
|
38
|
-
declare const ClientAdditionalRevenue: mongoose.Model<
|
|
39
|
-
_id: mongoose.Types.ObjectId;
|
|
40
|
-
}, any>;
|
|
38
|
+
declare const ClientAdditionalRevenue: mongoose.Model<any, {}, {}, {}, any, any>;
|
|
41
39
|
export default ClientAdditionalRevenue;
|
|
@@ -44,8 +44,9 @@ const AdditionalRevenueSchema = new mongoose_1.Schema({
|
|
|
44
44
|
},
|
|
45
45
|
});
|
|
46
46
|
const ClientAdditionalRevenueSchema = new mongoose_1.Schema({
|
|
47
|
-
|
|
48
|
-
type:
|
|
47
|
+
organizationId: {
|
|
48
|
+
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
49
|
+
ref: "organization",
|
|
49
50
|
default: null,
|
|
50
51
|
},
|
|
51
52
|
client: {
|
|
@@ -64,5 +65,5 @@ const ClientAdditionalRevenueSchema = new mongoose_1.Schema({
|
|
|
64
65
|
ClientAdditionalRevenueSchema.index({
|
|
65
66
|
client: 1,
|
|
66
67
|
});
|
|
67
|
-
const ClientAdditionalRevenue = (0, mongoose_1.model)("clientadditionalrevenue", ClientAdditionalRevenueSchema);
|
|
68
|
+
const ClientAdditionalRevenue = mongoose_1.default.models.clientadditionalrevenue || (0, mongoose_1.model)("clientadditionalrevenue", ClientAdditionalRevenueSchema);
|
|
68
69
|
exports.default = ClientAdditionalRevenue;
|
|
@@ -25,12 +25,10 @@
|
|
|
25
25
|
import mongoose, { Document } from "mongoose";
|
|
26
26
|
export interface IClientLearning extends Document {
|
|
27
27
|
name: string;
|
|
28
|
-
|
|
28
|
+
organizationId?: mongoose.Schema.Types.ObjectId;
|
|
29
29
|
client?: mongoose.Schema.Types.ObjectId;
|
|
30
30
|
viewId?: string;
|
|
31
31
|
createdBy?: mongoose.Schema.Types.ObjectId;
|
|
32
32
|
}
|
|
33
|
-
declare const ClientLearning: mongoose.Model<
|
|
34
|
-
_id: mongoose.Types.ObjectId;
|
|
35
|
-
}, any>;
|
|
33
|
+
declare const ClientLearning: mongoose.Model<any, {}, {}, {}, any, any>;
|
|
36
34
|
export default ClientLearning;
|
|
@@ -28,9 +28,11 @@ const ClientLearningSchema = new mongoose_1.Schema({
|
|
|
28
28
|
name: {
|
|
29
29
|
type: String,
|
|
30
30
|
required: true,
|
|
31
|
+
trim: true,
|
|
31
32
|
},
|
|
32
|
-
|
|
33
|
-
type:
|
|
33
|
+
organizationId: {
|
|
34
|
+
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
35
|
+
ref: "organization",
|
|
34
36
|
default: null,
|
|
35
37
|
},
|
|
36
38
|
client: {
|
|
@@ -47,9 +49,11 @@ const ClientLearningSchema = new mongoose_1.Schema({
|
|
|
47
49
|
}, {
|
|
48
50
|
timestamps: true,
|
|
49
51
|
});
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
});
|
|
54
|
-
|
|
52
|
+
// Compound indexes for common query patterns
|
|
53
|
+
ClientLearningSchema.index({ client: 1 });
|
|
54
|
+
// Sparse indexes for optional fields
|
|
55
|
+
ClientLearningSchema.index({ organisationId: 1 }, { sparse: true });
|
|
56
|
+
// Case-insensitive index for name
|
|
57
|
+
ClientLearningSchema.index({ name: 1 }, { collation: { locale: 'en', strength: 2 } });
|
|
58
|
+
const ClientLearning = mongoose_1.default.models.clientlearning || (0, mongoose_1.model)("clientlearning", ClientLearningSchema);
|
|
55
59
|
exports.default = ClientLearning;
|