codebase-models 1.0.6 → 1.0.7
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 +13 -6
- package/dist/src/models/Audience.d.ts +1 -1
- package/dist/src/models/Audience.js +1 -1
- package/dist/src/models/Client.d.ts +2 -0
- package/dist/src/models/Client.js +6 -0
- package/dist/src/models/ClientRetention.js +7 -0
- package/dist/src/models/Experiments.d.ts +2 -2
- package/dist/src/models/Report.d.ts +1 -0
- package/dist/src/models/Report.js +4 -0
- package/dist/src/models/Test.d.ts +3 -3
- package/package.json +1 -1
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,19 +127,26 @@ function seedRoles() {
|
|
|
127
127
|
},
|
|
128
128
|
]);
|
|
129
129
|
}));
|
|
130
|
+
console.log("Roles seeded successfully");
|
|
130
131
|
}
|
|
131
132
|
});
|
|
132
133
|
}
|
|
133
134
|
function connect(uri, options) {
|
|
134
135
|
return __awaiter(this, void 0, void 0, function* () {
|
|
135
136
|
if (uri) {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
137
|
+
if (mongoose_1.default.connection.readyState === 1) {
|
|
138
|
+
// Already connected
|
|
139
|
+
console.log("Already connected to the database");
|
|
140
|
+
return mongoose_1.default;
|
|
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;
|
|
141
149
|
}
|
|
142
|
-
return mongooseConnection;
|
|
143
150
|
}
|
|
144
151
|
throw new Error("URI is required to connect to the database");
|
|
145
152
|
});
|
|
@@ -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,6 +44,8 @@ export interface IClient extends Document {
|
|
|
44
44
|
bqClientId?: string;
|
|
45
45
|
defaultDataSet?: string;
|
|
46
46
|
NDAStatus?: boolean;
|
|
47
|
+
retainerValue: number;
|
|
48
|
+
useIntraDayTable: boolean;
|
|
47
49
|
}
|
|
48
50
|
declare const Client: mongoose.Model<IClient, {}, {}, {}, mongoose.Document<unknown, {}, IClient> & IClient & {
|
|
49
51
|
_id: mongoose.Types.ObjectId;
|
|
@@ -89,6 +89,12 @@ 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
|
+
},
|
|
92
98
|
}, { timestamps: true });
|
|
93
99
|
ClientSchema.index({ active: 1 });
|
|
94
100
|
const Client = (0, mongoose_1.model)("client", ClientSchema);
|
|
@@ -37,6 +37,7 @@ const ClientRetentionSchema = new mongoose_1.Schema({
|
|
|
37
37
|
year: {
|
|
38
38
|
type: Number,
|
|
39
39
|
required: true,
|
|
40
|
+
default: new Date().getFullYear(),
|
|
40
41
|
},
|
|
41
42
|
retentions: {
|
|
42
43
|
type: [
|
|
@@ -45,14 +46,19 @@ const ClientRetentionSchema = new mongoose_1.Schema({
|
|
|
45
46
|
year: {
|
|
46
47
|
type: Number,
|
|
47
48
|
required: true,
|
|
49
|
+
default: new Date().getFullYear(),
|
|
48
50
|
},
|
|
49
51
|
month: {
|
|
50
52
|
type: Number,
|
|
51
53
|
required: true,
|
|
54
|
+
default: new Date().getMonth() + 1,
|
|
52
55
|
},
|
|
53
56
|
monthName: {
|
|
54
57
|
type: String,
|
|
55
58
|
required: true,
|
|
59
|
+
default: new Date().toLocaleString("default", {
|
|
60
|
+
month: "long",
|
|
61
|
+
}),
|
|
56
62
|
},
|
|
57
63
|
active: {
|
|
58
64
|
type: Boolean,
|
|
@@ -62,6 +68,7 @@ const ClientRetentionSchema = new mongoose_1.Schema({
|
|
|
62
68
|
retainerValue: {
|
|
63
69
|
type: Number,
|
|
64
70
|
required: true,
|
|
71
|
+
default: 0,
|
|
65
72
|
},
|
|
66
73
|
otherPayments: {
|
|
67
74
|
type: Number,
|
|
@@ -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[];
|