codebase-models 1.0.3 → 1.0.5
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 +2 -2
- package/dist/index.js +6 -13
- package/dist/src/models/Audience.d.ts +1 -1
- package/dist/src/models/Audience.js +1 -1
- package/dist/src/models/Client.d.ts +0 -2
- package/dist/src/models/Client.js +0 -6
- package/dist/src/models/Experiments.d.ts +2 -2
- package/dist/src/models/Test.d.ts +3 -3
- package/package.json +1 -1
- package/src/models/ClientRetention.ts +7 -0
- package/src/models/Report.ts +5 -0
package/dist/index.d.ts
CHANGED
|
@@ -68,6 +68,6 @@ import Trigger from "./src/models/Trigger";
|
|
|
68
68
|
import ClientScript from "./src/models/ClientScript";
|
|
69
69
|
import ClientExperiment from "./src/models/ClientExperiment";
|
|
70
70
|
import Audience from "./src/models/Audience";
|
|
71
|
-
import Environment from
|
|
71
|
+
import Environment from './src/models/Environment';
|
|
72
72
|
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, Experiments, Faq, Feedback, Goal, Hypothesis, HypothesisSheet, LandingPages, NewIdeas, Notification, Page, PageElement, PageTestType, Portfolio, ReadNotification, Role, SavedSegment, Segment, SegmentCombination, Snippet, StageInCustomerJourney, Tag, Temp, Tier, Trigger, ClientScript, ClientExperiment, Audience, Environment
|
|
73
|
+
export { Client, ClientReportsTemp, QueryLog, Report, Test, TestSequentialValue, User, AppEvent, Announcement, ClientAdditionalRevenue, ClientLearning, ClientLinks, ClientNextStep, ClientNote, ClientRetention, ClientStrategy, ClientSurvey, CVRReport, Experiments, Faq, Feedback, Goal, Hypothesis, HypothesisSheet, LandingPages, NewIdeas, Notification, Page, PageElement, PageTestType, Portfolio, ReadNotification, Role, SavedSegment, Segment, SegmentCombination, Snippet, StageInCustomerJourney, Tag, Temp, Tier, Trigger, ClientScript, ClientExperiment, Audience, Environment };
|
package/dist/index.js
CHANGED
|
@@ -127,26 +127,19 @@ function seedRoles() {
|
|
|
127
127
|
},
|
|
128
128
|
]);
|
|
129
129
|
}));
|
|
130
|
-
console.log("Roles seeded successfully");
|
|
131
130
|
}
|
|
132
131
|
});
|
|
133
132
|
}
|
|
134
133
|
function connect(uri, options) {
|
|
135
134
|
return __awaiter(this, void 0, void 0, function* () {
|
|
136
135
|
if (uri) {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
else {
|
|
143
|
-
console.log("Connecting to the database on URI: ", uri);
|
|
144
|
-
const mongooseConnection = yield mongoose_1.default.connect(uri, options);
|
|
145
|
-
if (mongooseConnection.connection.readyState === 1) {
|
|
146
|
-
yield seedRoles();
|
|
147
|
-
}
|
|
148
|
-
return mongooseConnection;
|
|
136
|
+
console.log("Connecting to the database on URI: ", uri);
|
|
137
|
+
const mongooseConnection = yield mongoose_1.default.connect(uri, options);
|
|
138
|
+
if (mongooseConnection.connection.readyState === 1) {
|
|
139
|
+
yield seedRoles();
|
|
140
|
+
console.log("Roles seeded successfully");
|
|
149
141
|
}
|
|
142
|
+
return mongooseConnection;
|
|
150
143
|
}
|
|
151
144
|
throw new Error("URI is required to connect to the database");
|
|
152
145
|
});
|
|
@@ -26,7 +26,7 @@ import mongoose, { Document } from "mongoose";
|
|
|
26
26
|
export interface IAudience extends Document {
|
|
27
27
|
name: string;
|
|
28
28
|
rules_js?: string;
|
|
29
|
-
client
|
|
29
|
+
client: mongoose.Schema.Types.ObjectId;
|
|
30
30
|
}
|
|
31
31
|
declare const Audience: mongoose.Model<IAudience, {}, {}, {}, mongoose.Document<unknown, {}, IAudience> & IAudience & {
|
|
32
32
|
_id: mongoose.Types.ObjectId;
|
|
@@ -44,8 +44,6 @@ export interface IClient extends Document {
|
|
|
44
44
|
bqClientId?: string;
|
|
45
45
|
defaultDataSet?: string;
|
|
46
46
|
NDAStatus?: boolean;
|
|
47
|
-
retainerValue: number;
|
|
48
|
-
useIntraDayTable: boolean;
|
|
49
47
|
}
|
|
50
48
|
declare const Client: mongoose.Model<IClient, {}, {}, {}, mongoose.Document<unknown, {}, IClient> & IClient & {
|
|
51
49
|
_id: mongoose.Types.ObjectId;
|
|
@@ -89,12 +89,6 @@ const ClientSchema = new mongoose_1.Schema({
|
|
|
89
89
|
type: Boolean,
|
|
90
90
|
default: false,
|
|
91
91
|
},
|
|
92
|
-
retainerValue: {
|
|
93
|
-
type: Number,
|
|
94
|
-
},
|
|
95
|
-
useIntraDayTable: {
|
|
96
|
-
type: Boolean,
|
|
97
|
-
},
|
|
98
92
|
}, { timestamps: true });
|
|
99
93
|
ClientSchema.index({ active: 1 });
|
|
100
94
|
const Client = (0, mongoose_1.model)("client", ClientSchema);
|
|
@@ -48,9 +48,9 @@ export interface IExperiments extends Document {
|
|
|
48
48
|
js: string;
|
|
49
49
|
reset_js: string;
|
|
50
50
|
csscode: string;
|
|
51
|
-
audiences
|
|
51
|
+
audiences: mongoose.Schema.Types.Array;
|
|
52
52
|
variations: IVariations;
|
|
53
|
-
environments
|
|
53
|
+
environments: mongoose.Schema.Types.Array;
|
|
54
54
|
}
|
|
55
55
|
declare const Experiments: mongoose.Model<IExperiments, {}, {}, {}, mongoose.Document<unknown, {}, IExperiments> & IExperiments & {
|
|
56
56
|
_id: mongoose.Types.ObjectId;
|
|
@@ -49,13 +49,13 @@ export interface ITest extends Document {
|
|
|
49
49
|
jscode: string;
|
|
50
50
|
reset_js: string;
|
|
51
51
|
csscode: string;
|
|
52
|
-
audiences
|
|
52
|
+
audiences: mongoose.Schema.Types.ObjectId[];
|
|
53
53
|
variations: IVariations[];
|
|
54
|
-
environments
|
|
54
|
+
environments: mongoose.Schema.Types.Array;
|
|
55
55
|
pages?: mongoose.Schema.Types.ObjectId[];
|
|
56
56
|
pageelement?: mongoose.Schema.Types.ObjectId[];
|
|
57
57
|
client?: mongoose.Schema.Types.ObjectId;
|
|
58
|
-
property
|
|
58
|
+
property: mongoose.Schema.Types.Mixed;
|
|
59
59
|
platform: string;
|
|
60
60
|
viewId: string;
|
|
61
61
|
goal?: mongoose.Schema.Types.ObjectId[];
|
package/package.json
CHANGED
|
@@ -28,6 +28,7 @@ const ClientRetentionSchema = new Schema<IClientRetention>(
|
|
|
28
28
|
year: {
|
|
29
29
|
type: Number,
|
|
30
30
|
required: true,
|
|
31
|
+
default: new Date().getFullYear(),
|
|
31
32
|
},
|
|
32
33
|
retentions: {
|
|
33
34
|
type: [
|
|
@@ -36,14 +37,19 @@ const ClientRetentionSchema = new Schema<IClientRetention>(
|
|
|
36
37
|
year: {
|
|
37
38
|
type: Number,
|
|
38
39
|
required: true,
|
|
40
|
+
default: new Date().getFullYear(),
|
|
39
41
|
},
|
|
40
42
|
month: {
|
|
41
43
|
type: Number,
|
|
42
44
|
required: true,
|
|
45
|
+
default: new Date().getMonth() + 1,
|
|
43
46
|
},
|
|
44
47
|
monthName: {
|
|
45
48
|
type: String,
|
|
46
49
|
required: true,
|
|
50
|
+
default: new Date().toLocaleString("default", {
|
|
51
|
+
month: "long",
|
|
52
|
+
}),
|
|
47
53
|
},
|
|
48
54
|
active: {
|
|
49
55
|
type: Boolean,
|
|
@@ -53,6 +59,7 @@ const ClientRetentionSchema = new Schema<IClientRetention>(
|
|
|
53
59
|
retainerValue: {
|
|
54
60
|
type: Number,
|
|
55
61
|
required: true,
|
|
62
|
+
default:0,
|
|
56
63
|
},
|
|
57
64
|
otherPayments: {
|
|
58
65
|
type: Number,
|
package/src/models/Report.ts
CHANGED
|
@@ -15,6 +15,7 @@ export interface IReports extends Document {
|
|
|
15
15
|
from?: Date;
|
|
16
16
|
to?: Date;
|
|
17
17
|
createdBy?: mongoose.Schema.Types.ObjectId;
|
|
18
|
+
excludedFromCalculations?: boolean;
|
|
18
19
|
createdAt?: Date;
|
|
19
20
|
updatedAt?: Date;
|
|
20
21
|
}
|
|
@@ -67,6 +68,10 @@ const ReportsSchema = new Schema<IReports>({
|
|
|
67
68
|
type: mongoose.Schema.Types.ObjectId,
|
|
68
69
|
ref: "user",
|
|
69
70
|
},
|
|
71
|
+
excludedFromCalculations: {
|
|
72
|
+
type: Boolean,
|
|
73
|
+
default: false
|
|
74
|
+
},
|
|
70
75
|
createdAt: {
|
|
71
76
|
type: Date,
|
|
72
77
|
default: new Date(),
|