codebase-models 2.0.3 → 2.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 -1
- package/dist/index.js +3 -1
- package/dist/src/models/CustomQuery.d.ts +37 -0
- package/dist/src/models/CustomQuery.js +39 -0
- package/dist/src/models/PrecalculationFilters.d.ts +7 -0
- package/dist/src/models/PrecalculationFilters.js +11 -1
- package/index.ts +2 -0
- package/package.json +1 -1
- package/src/models/CustomQuery.ts +29 -0
- package/src/models/PrecalculationFilters.ts +20 -1
package/dist/index.d.ts
CHANGED
|
@@ -70,5 +70,6 @@ import Audience from "./src/models/Audience";
|
|
|
70
70
|
import Environment from "./src/models/Environment";
|
|
71
71
|
import PrecalculationFilters from "./src/models/PrecalculationFilters";
|
|
72
72
|
import BqPreCompiledData from "./src/models/BqPreCompiledData";
|
|
73
|
+
import CustomQuery from "./src/models/CustomQuery";
|
|
73
74
|
export declare function connect(uri: string, options?: mongoose.ConnectOptions | undefined): Promise<typeof mongoose>;
|
|
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, };
|
|
75
|
+
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, CustomQuery, 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.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;
|
|
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.CustomQuery = 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;
|
|
@@ -108,6 +108,8 @@ const PrecalculationFilters_1 = __importDefault(require("./src/models/Precalcula
|
|
|
108
108
|
exports.PrecalculationFilters = PrecalculationFilters_1.default;
|
|
109
109
|
const BqPreCompiledData_1 = __importDefault(require("./src/models/BqPreCompiledData"));
|
|
110
110
|
exports.BqPreCompiledData = BqPreCompiledData_1.default;
|
|
111
|
+
const CustomQuery_1 = __importDefault(require("./src/models/CustomQuery"));
|
|
112
|
+
exports.CustomQuery = CustomQuery_1.default;
|
|
111
113
|
function seedRoles() {
|
|
112
114
|
return __awaiter(this, void 0, void 0, function* () {
|
|
113
115
|
const checkRoles = yield Role_1.default.countDocuments();
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/// <reference types="mongoose/types/aggregate" />
|
|
2
|
+
/// <reference types="mongoose/types/callback" />
|
|
3
|
+
/// <reference types="mongoose/types/collection" />
|
|
4
|
+
/// <reference types="mongoose/types/connection" />
|
|
5
|
+
/// <reference types="mongoose/types/cursor" />
|
|
6
|
+
/// <reference types="mongoose/types/document" />
|
|
7
|
+
/// <reference types="mongoose/types/error" />
|
|
8
|
+
/// <reference types="mongoose/types/expressions" />
|
|
9
|
+
/// <reference types="mongoose/types/helpers" />
|
|
10
|
+
/// <reference types="mongoose/types/middlewares" />
|
|
11
|
+
/// <reference types="mongoose/types/indexes" />
|
|
12
|
+
/// <reference types="mongoose/types/models" />
|
|
13
|
+
/// <reference types="mongoose/types/mongooseoptions" />
|
|
14
|
+
/// <reference types="mongoose/types/pipelinestage" />
|
|
15
|
+
/// <reference types="mongoose/types/populate" />
|
|
16
|
+
/// <reference types="mongoose/types/query" />
|
|
17
|
+
/// <reference types="mongoose/types/schemaoptions" />
|
|
18
|
+
/// <reference types="mongoose/types/schematypes" />
|
|
19
|
+
/// <reference types="mongoose/types/session" />
|
|
20
|
+
/// <reference types="mongoose/types/types" />
|
|
21
|
+
/// <reference types="mongoose/types/utility" />
|
|
22
|
+
/// <reference types="mongoose/types/validation" />
|
|
23
|
+
/// <reference types="mongoose/types/virtuals" />
|
|
24
|
+
/// <reference types="mongoose/types/inferschematype" />
|
|
25
|
+
import mongoose, { Document } from 'mongoose';
|
|
26
|
+
interface ICustomQuery extends Document {
|
|
27
|
+
organizationId?: mongoose.Schema.Types.ObjectId;
|
|
28
|
+
title: string;
|
|
29
|
+
module: string;
|
|
30
|
+
client: mongoose.Schema.Types.ObjectId;
|
|
31
|
+
query: string;
|
|
32
|
+
createdBy?: mongoose.Schema.Types.ObjectId;
|
|
33
|
+
}
|
|
34
|
+
declare const CustomQuery: mongoose.Model<ICustomQuery, {}, {}, {}, mongoose.Document<unknown, {}, ICustomQuery> & ICustomQuery & {
|
|
35
|
+
_id: mongoose.Types.ObjectId;
|
|
36
|
+
}, any>;
|
|
37
|
+
export default CustomQuery;
|
|
@@ -0,0 +1,39 @@
|
|
|
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
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
const mongoose_1 = __importStar(require("mongoose"));
|
|
27
|
+
const CustomQuerySchema = new mongoose_1.Schema({
|
|
28
|
+
organizationId: { type: mongoose_1.default.Schema.Types.ObjectId, ref: "organization", default: null },
|
|
29
|
+
title: { type: String, required: true },
|
|
30
|
+
module: { type: String, required: true },
|
|
31
|
+
client: { type: mongoose_1.default.Schema.Types.ObjectId, ref: 'client', required: true },
|
|
32
|
+
query: { type: String, required: true },
|
|
33
|
+
createdBy: { type: mongoose_1.default.Schema.Types.ObjectId, ref: 'user', default: null },
|
|
34
|
+
}, {
|
|
35
|
+
timestamps: true, // Automatically adds createdAt and updatedAt fields
|
|
36
|
+
});
|
|
37
|
+
CustomQuerySchema.index({ module: 1, client: 1 }, { unique: true });
|
|
38
|
+
const CustomQuery = (0, mongoose_1.model)('CustomQuery', CustomQuerySchema);
|
|
39
|
+
exports.default = CustomQuery;
|
|
@@ -23,8 +23,15 @@
|
|
|
23
23
|
/// <reference types="mongoose/types/virtuals" />
|
|
24
24
|
/// <reference types="mongoose/types/inferschematype" />
|
|
25
25
|
import mongoose, { Document } from "mongoose";
|
|
26
|
+
export interface IFilters extends Document {
|
|
27
|
+
matchType: string;
|
|
28
|
+
value: string;
|
|
29
|
+
eventKey: string;
|
|
30
|
+
eventValue: string;
|
|
31
|
+
}
|
|
26
32
|
export interface IPrecalculationFilters extends Document {
|
|
27
33
|
title: string;
|
|
34
|
+
filterString: string;
|
|
28
35
|
organizationId: mongoose.Schema.Types.ObjectId;
|
|
29
36
|
client: mongoose.Schema.Types.ObjectId;
|
|
30
37
|
filters: any;
|
|
@@ -24,11 +24,21 @@ 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 FiltersSchema = new mongoose_1.Schema({
|
|
28
|
+
matchType: { type: String, required: true },
|
|
29
|
+
value: { type: String, required: true },
|
|
30
|
+
eventKey: { type: String },
|
|
31
|
+
eventValue: { type: String },
|
|
32
|
+
});
|
|
27
33
|
const PrecalculationFiltersSchema = new mongoose_1.Schema({
|
|
28
34
|
title: {
|
|
29
35
|
type: String,
|
|
30
36
|
trim: true,
|
|
31
37
|
},
|
|
38
|
+
filterString: {
|
|
39
|
+
type: String,
|
|
40
|
+
required: true,
|
|
41
|
+
},
|
|
32
42
|
organizationId: {
|
|
33
43
|
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
34
44
|
ref: "organization",
|
|
@@ -38,7 +48,7 @@ const PrecalculationFiltersSchema = new mongoose_1.Schema({
|
|
|
38
48
|
ref: "client",
|
|
39
49
|
},
|
|
40
50
|
filters: {
|
|
41
|
-
type:
|
|
51
|
+
type: FiltersSchema,
|
|
42
52
|
required: true,
|
|
43
53
|
},
|
|
44
54
|
otherFilters: {
|
package/index.ts
CHANGED
|
@@ -47,6 +47,7 @@ import Audience from "./src/models/Audience";
|
|
|
47
47
|
import Environment from "./src/models/Environment";
|
|
48
48
|
import PrecalculationFilters from "./src/models/PrecalculationFilters";
|
|
49
49
|
import BqPreCompiledData from "./src/models/BqPreCompiledData";
|
|
50
|
+
import CustomQuery from "./src/models/CustomQuery";
|
|
50
51
|
|
|
51
52
|
async function seedRoles() {
|
|
52
53
|
const checkRoles = await Role.countDocuments();
|
|
@@ -128,6 +129,7 @@ export {
|
|
|
128
129
|
Portfolio,
|
|
129
130
|
ReadNotification,
|
|
130
131
|
Role,
|
|
132
|
+
CustomQuery,
|
|
131
133
|
SavedSegment,
|
|
132
134
|
Segment,
|
|
133
135
|
SegmentCombination,
|
package/package.json
CHANGED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import mongoose, { Schema, model, Document } from 'mongoose';
|
|
2
|
+
|
|
3
|
+
interface ICustomQuery extends Document {
|
|
4
|
+
organizationId?: mongoose.Schema.Types.ObjectId;
|
|
5
|
+
title: string;
|
|
6
|
+
module: string;
|
|
7
|
+
client: mongoose.Schema.Types.ObjectId;
|
|
8
|
+
query: string;
|
|
9
|
+
createdBy?: mongoose.Schema.Types.ObjectId;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const CustomQuerySchema = new Schema<ICustomQuery>(
|
|
13
|
+
{
|
|
14
|
+
organizationId: { type: mongoose.Schema.Types.ObjectId, ref: "organization", default: null },
|
|
15
|
+
title: { type: String, required: true },
|
|
16
|
+
module: { type: String, required: true },
|
|
17
|
+
client: { type: mongoose.Schema.Types.ObjectId, ref: 'client', required: true },
|
|
18
|
+
query: { type: String, required: true },
|
|
19
|
+
createdBy: { type: mongoose.Schema.Types.ObjectId, ref: 'user', default: null },
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
timestamps: true, // Automatically adds createdAt and updatedAt fields
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
CustomQuerySchema.index({ module: 1, client: 1 }, { unique: true });
|
|
26
|
+
|
|
27
|
+
const CustomQuery = model<ICustomQuery>('CustomQuery', CustomQuerySchema);
|
|
28
|
+
|
|
29
|
+
export default CustomQuery;
|
|
@@ -1,18 +1,37 @@
|
|
|
1
1
|
import mongoose, { Document, Schema, model } from "mongoose";
|
|
2
2
|
|
|
3
|
+
export interface IFilters extends Document {
|
|
4
|
+
matchType: string;
|
|
5
|
+
value: string;
|
|
6
|
+
eventKey: string;
|
|
7
|
+
eventValue: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
3
10
|
export interface IPrecalculationFilters extends Document {
|
|
4
11
|
title: string;
|
|
12
|
+
filterString: string;
|
|
5
13
|
organizationId: mongoose.Schema.Types.ObjectId;
|
|
6
14
|
client: mongoose.Schema.Types.ObjectId;
|
|
7
15
|
filters: any;
|
|
8
16
|
otherFilters: any;
|
|
9
17
|
}
|
|
10
18
|
|
|
19
|
+
const FiltersSchema = new Schema<IFilters>({
|
|
20
|
+
matchType: { type: String, required: true },
|
|
21
|
+
value: { type: String, required: true },
|
|
22
|
+
eventKey: { type: String },
|
|
23
|
+
eventValue: { type: String },
|
|
24
|
+
});
|
|
25
|
+
|
|
11
26
|
const PrecalculationFiltersSchema = new Schema<IPrecalculationFilters>({
|
|
12
27
|
title: {
|
|
13
28
|
type: String,
|
|
14
29
|
trim: true,
|
|
15
30
|
},
|
|
31
|
+
filterString: {
|
|
32
|
+
type: String,
|
|
33
|
+
required: true,
|
|
34
|
+
},
|
|
16
35
|
organizationId: {
|
|
17
36
|
type: mongoose.Schema.Types.ObjectId,
|
|
18
37
|
ref: "organization",
|
|
@@ -22,7 +41,7 @@ const PrecalculationFiltersSchema = new Schema<IPrecalculationFilters>({
|
|
|
22
41
|
ref: "client",
|
|
23
42
|
},
|
|
24
43
|
filters: {
|
|
25
|
-
type:
|
|
44
|
+
type: FiltersSchema,
|
|
26
45
|
required: true,
|
|
27
46
|
},
|
|
28
47
|
otherFilters: {
|