codebase-models 3.1.1 → 3.1.2
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/Log.d.ts +47 -0
- package/dist/src/models/Log.js +34 -0
- package/index.ts +3 -0
- package/package.json +1 -1
- package/src/models/Log.ts +59 -0
package/dist/index.d.ts
CHANGED
|
@@ -81,5 +81,6 @@ import ThreadMessage from "./src/models/ThreadMessage";
|
|
|
81
81
|
import Provider from "./src/models/Provider";
|
|
82
82
|
import ApiLog from "./src/models/ApiLog";
|
|
83
83
|
import { ProviderType } from "./src/models/Provider";
|
|
84
|
+
import Log from "./src/models/Log";
|
|
84
85
|
export declare function connect(uri: string, options?: mongoose.ConnectOptions | undefined): Promise<typeof mongoose>;
|
|
85
|
-
export { generateRandomIID, RolesConstants, Client, ClientReportsTemp, Report, Provider, 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, TestTimeline, Snippet, StageInCustomerJourney, Tag, Temp, Tier, Trigger, ClientScript, Audience, Environment, Organization, PrecalculationFilters, BqPreCompiledData, CronData, CronConfig, UserPermission, UserOrganization, Package, Invitation, Thread, ThreadMessage, ApiLog, ProviderType, };
|
|
86
|
+
export { generateRandomIID, RolesConstants, Client, ClientReportsTemp, Report, Provider, 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, TestTimeline, Snippet, StageInCustomerJourney, Tag, Temp, Tier, Trigger, ClientScript, Audience, Environment, Organization, PrecalculationFilters, BqPreCompiledData, CronData, CronConfig, UserPermission, UserOrganization, Package, Invitation, Thread, ThreadMessage, ApiLog, ProviderType, Log, };
|
package/dist/index.js
CHANGED
|
@@ -13,7 +13,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
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.TestTimeline = 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.Provider = exports.Report = exports.ClientReportsTemp = exports.Client = exports.RolesConstants = exports.generateRandomIID = exports.connect = void 0;
|
|
16
|
-
exports.ProviderType = exports.ApiLog = exports.ThreadMessage = exports.Thread = exports.Invitation = exports.Package = exports.UserOrganization = exports.UserPermission = exports.CronConfig = exports.CronData = void 0;
|
|
16
|
+
exports.Log = exports.ProviderType = exports.ApiLog = exports.ThreadMessage = exports.Thread = exports.Invitation = exports.Package = exports.UserOrganization = exports.UserPermission = exports.CronConfig = exports.CronData = void 0;
|
|
17
17
|
const mongoose_1 = __importDefault(require("mongoose"));
|
|
18
18
|
const Client_1 = __importDefault(require("./src/models/Client"));
|
|
19
19
|
exports.Client = Client_1.default;
|
|
@@ -132,6 +132,8 @@ const ApiLog_1 = __importDefault(require("./src/models/ApiLog"));
|
|
|
132
132
|
exports.ApiLog = ApiLog_1.default;
|
|
133
133
|
const Provider_2 = require("./src/models/Provider");
|
|
134
134
|
Object.defineProperty(exports, "ProviderType", { enumerable: true, get: function () { return Provider_2.ProviderType; } });
|
|
135
|
+
const Log_1 = __importDefault(require("./src/models/Log"));
|
|
136
|
+
exports.Log = Log_1.default;
|
|
135
137
|
function seedRoles() {
|
|
136
138
|
return __awaiter(this, void 0, void 0, function* () {
|
|
137
139
|
const checkRoles = yield Role_1.default.countDocuments();
|
|
@@ -0,0 +1,47 @@
|
|
|
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 { Document } from "mongoose";
|
|
26
|
+
export interface ILogMeta {
|
|
27
|
+
operationType?: string;
|
|
28
|
+
operationName?: string;
|
|
29
|
+
rootFields?: string[];
|
|
30
|
+
userId?: string;
|
|
31
|
+
ip?: string;
|
|
32
|
+
clientFullUrl?: string;
|
|
33
|
+
clientId?: string;
|
|
34
|
+
organizationId?: string;
|
|
35
|
+
timestamp?: string;
|
|
36
|
+
[key: string]: any;
|
|
37
|
+
}
|
|
38
|
+
export interface ILog extends Document {
|
|
39
|
+
level: string;
|
|
40
|
+
message: string;
|
|
41
|
+
meta: ILogMeta;
|
|
42
|
+
timestamp: Date;
|
|
43
|
+
}
|
|
44
|
+
declare const Log: import("mongoose").Model<ILog, {}, {}, {}, Document<unknown, {}, ILog> & ILog & {
|
|
45
|
+
_id: import("mongoose").Types.ObjectId;
|
|
46
|
+
}, any>;
|
|
47
|
+
export default Log;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const mongoose_1 = require("mongoose");
|
|
4
|
+
const LogSchema = new mongoose_1.Schema({
|
|
5
|
+
level: {
|
|
6
|
+
type: String,
|
|
7
|
+
required: true,
|
|
8
|
+
trim: true,
|
|
9
|
+
},
|
|
10
|
+
message: {
|
|
11
|
+
type: String,
|
|
12
|
+
required: true,
|
|
13
|
+
},
|
|
14
|
+
meta: {
|
|
15
|
+
type: mongoose_1.Schema.Types.Mixed,
|
|
16
|
+
default: {},
|
|
17
|
+
},
|
|
18
|
+
timestamp: {
|
|
19
|
+
type: Date,
|
|
20
|
+
default: Date.now,
|
|
21
|
+
},
|
|
22
|
+
}, {
|
|
23
|
+
collection: "logs",
|
|
24
|
+
timestamps: false,
|
|
25
|
+
});
|
|
26
|
+
LogSchema.index({
|
|
27
|
+
"meta.rootFields": 1,
|
|
28
|
+
"meta.userId": 1,
|
|
29
|
+
"meta.clientId": 1,
|
|
30
|
+
"meta.timestamp": -1,
|
|
31
|
+
});
|
|
32
|
+
LogSchema.index({ "meta.operationType": 1 });
|
|
33
|
+
const Log = (0, mongoose_1.model)("Log", LogSchema);
|
|
34
|
+
exports.default = Log;
|
package/index.ts
CHANGED
|
@@ -58,6 +58,8 @@ import ThreadMessage from "./src/models/ThreadMessage";
|
|
|
58
58
|
import Provider from "./src/models/Provider";
|
|
59
59
|
import ApiLog from "./src/models/ApiLog";
|
|
60
60
|
import { ProviderType } from "./src/models/Provider";
|
|
61
|
+
import Log from "./src/models/Log";
|
|
62
|
+
|
|
61
63
|
async function seedRoles() {
|
|
62
64
|
const checkRoles = await Role.countDocuments();
|
|
63
65
|
if (checkRoles < RolesConstants.length) {
|
|
@@ -165,4 +167,5 @@ export {
|
|
|
165
167
|
ThreadMessage,
|
|
166
168
|
ApiLog,
|
|
167
169
|
ProviderType,
|
|
170
|
+
Log,
|
|
168
171
|
};
|
package/package.json
CHANGED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { Document, Schema, model } from "mongoose";
|
|
2
|
+
|
|
3
|
+
export interface ILogMeta {
|
|
4
|
+
operationType?: string;
|
|
5
|
+
operationName?: string;
|
|
6
|
+
rootFields?: string[];
|
|
7
|
+
userId?: string;
|
|
8
|
+
ip?: string;
|
|
9
|
+
clientFullUrl?: string;
|
|
10
|
+
clientId?: string;
|
|
11
|
+
organizationId?: string;
|
|
12
|
+
timestamp?: string;
|
|
13
|
+
[key: string]: any;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface ILog extends Document {
|
|
17
|
+
level: string;
|
|
18
|
+
message: string;
|
|
19
|
+
meta: ILogMeta;
|
|
20
|
+
timestamp: Date;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const LogSchema = new Schema<ILog>(
|
|
24
|
+
{
|
|
25
|
+
level: {
|
|
26
|
+
type: String,
|
|
27
|
+
required: true,
|
|
28
|
+
trim: true,
|
|
29
|
+
},
|
|
30
|
+
message: {
|
|
31
|
+
type: String,
|
|
32
|
+
required: true,
|
|
33
|
+
},
|
|
34
|
+
meta: {
|
|
35
|
+
type: Schema.Types.Mixed,
|
|
36
|
+
default: {},
|
|
37
|
+
},
|
|
38
|
+
timestamp: {
|
|
39
|
+
type: Date,
|
|
40
|
+
default: Date.now,
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
collection: "logs",
|
|
45
|
+
timestamps: false,
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
LogSchema.index({
|
|
50
|
+
"meta.rootFields": 1,
|
|
51
|
+
"meta.userId": 1,
|
|
52
|
+
"meta.clientId": 1,
|
|
53
|
+
"meta.timestamp": -1,
|
|
54
|
+
});
|
|
55
|
+
LogSchema.index({ "meta.operationType": 1 });
|
|
56
|
+
|
|
57
|
+
const Log = model<ILog>("Log", LogSchema);
|
|
58
|
+
|
|
59
|
+
export default Log;
|