codebase-models 3.0.8 → 3.1.0
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 +3 -2
- package/dist/index.js +6 -4
- package/dist/src/models/{UserIdentity.d.ts → ApiLog.d.ts} +10 -7
- package/dist/src/models/{UserIdentity.js → ApiLog.js} +47 -10
- package/index.ts +4 -2
- package/package.json +1 -1
- package/src/constant.ts +2 -0
- package/src/models/ApiLog.ts +67 -0
- package/src/models/UserIdentity.ts +0 -26
package/dist/index.d.ts
CHANGED
|
@@ -73,11 +73,12 @@ import { generateRandomIID, RolesConstants } from "./src/constant";
|
|
|
73
73
|
import TestTimeline from "./src/models/TestTimeline";
|
|
74
74
|
import CronData from "./src/models/CronData";
|
|
75
75
|
import CronConfig from "./src/models/CronConfig";
|
|
76
|
-
import UserIdentity from "./src/models/UserIdentity";
|
|
77
76
|
import UserOrganization from "./src/models/UserOrganization";
|
|
78
77
|
import Package from "./src/models/Package";
|
|
79
78
|
import Invitation from "./src/models/Invitation";
|
|
80
79
|
import Thread from "./src/models/Thread";
|
|
81
80
|
import ThreadMessage from "./src/models/ThreadMessage";
|
|
81
|
+
import Provider from "./src/models/Provider";
|
|
82
|
+
import ApiLog from "./src/models/ApiLog";
|
|
82
83
|
export declare function connect(uri: string, options?: mongoose.ConnectOptions | undefined): Promise<typeof mongoose>;
|
|
83
|
-
export { generateRandomIID, RolesConstants, Client, ClientReportsTemp, 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, TestTimeline, Snippet, StageInCustomerJourney, Tag, Temp, Tier, Trigger, ClientScript, Audience, Environment, Organization, PrecalculationFilters, BqPreCompiledData, CronData, CronConfig, UserPermission,
|
|
84
|
+
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, };
|
package/dist/index.js
CHANGED
|
@@ -12,8 +12,8 @@ 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.
|
|
16
|
-
exports.ThreadMessage = exports.Thread = exports.Invitation = exports.Package = exports.UserOrganization = 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.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.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;
|
|
@@ -116,8 +116,6 @@ const CronData_1 = __importDefault(require("./src/models/CronData"));
|
|
|
116
116
|
exports.CronData = CronData_1.default;
|
|
117
117
|
const CronConfig_1 = __importDefault(require("./src/models/CronConfig"));
|
|
118
118
|
exports.CronConfig = CronConfig_1.default;
|
|
119
|
-
const UserIdentity_1 = __importDefault(require("./src/models/UserIdentity"));
|
|
120
|
-
exports.UserIdentity = UserIdentity_1.default;
|
|
121
119
|
const UserOrganization_1 = __importDefault(require("./src/models/UserOrganization"));
|
|
122
120
|
exports.UserOrganization = UserOrganization_1.default;
|
|
123
121
|
const Package_1 = __importDefault(require("./src/models/Package"));
|
|
@@ -128,6 +126,10 @@ const Thread_1 = __importDefault(require("./src/models/Thread"));
|
|
|
128
126
|
exports.Thread = Thread_1.default;
|
|
129
127
|
const ThreadMessage_1 = __importDefault(require("./src/models/ThreadMessage"));
|
|
130
128
|
exports.ThreadMessage = ThreadMessage_1.default;
|
|
129
|
+
const Provider_1 = __importDefault(require("./src/models/Provider"));
|
|
130
|
+
exports.Provider = Provider_1.default;
|
|
131
|
+
const ApiLog_1 = __importDefault(require("./src/models/ApiLog"));
|
|
132
|
+
exports.ApiLog = ApiLog_1.default;
|
|
131
133
|
function seedRoles() {
|
|
132
134
|
return __awaiter(this, void 0, void 0, function* () {
|
|
133
135
|
const checkRoles = yield Role_1.default.countDocuments();
|
|
@@ -23,13 +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
|
|
26
|
+
export interface IApiLog extends Document {
|
|
27
27
|
iid: string;
|
|
28
|
+
apiName: string;
|
|
29
|
+
organizationId?: mongoose.Schema.Types.ObjectId;
|
|
30
|
+
client: mongoose.Schema.Types.ObjectId;
|
|
28
31
|
user: mongoose.Schema.Types.ObjectId;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
metadata
|
|
32
|
+
endpoint: string;
|
|
33
|
+
createdAt: Date;
|
|
34
|
+
updatedAt: Date;
|
|
35
|
+
metadata: mongoose.Schema.Types.Mixed;
|
|
33
36
|
}
|
|
34
|
-
declare const
|
|
35
|
-
export default
|
|
37
|
+
declare const ApiLog: mongoose.Model<any, {}, {}, {}, any, any>;
|
|
38
|
+
export default ApiLog;
|
|
@@ -25,13 +25,50 @@ 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 constant_1 = require("../constant");
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
},
|
|
36
|
-
|
|
37
|
-
|
|
28
|
+
const Provider_1 = require("./Provider");
|
|
29
|
+
const ApiLogSchema = new mongoose_1.Schema({
|
|
30
|
+
iid: {
|
|
31
|
+
type: String,
|
|
32
|
+
trim: true,
|
|
33
|
+
unique: true,
|
|
34
|
+
default: () => (0, constant_1.generateRandomIID)(),
|
|
35
|
+
},
|
|
36
|
+
apiName: {
|
|
37
|
+
type: String,
|
|
38
|
+
required: true,
|
|
39
|
+
enum: Object.values(Provider_1.ProviderType),
|
|
40
|
+
trim: true,
|
|
41
|
+
},
|
|
42
|
+
organizationId: {
|
|
43
|
+
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
44
|
+
ref: "organization",
|
|
45
|
+
default: null,
|
|
46
|
+
required: true,
|
|
47
|
+
},
|
|
48
|
+
client: {
|
|
49
|
+
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
50
|
+
ref: "client",
|
|
51
|
+
default: null,
|
|
52
|
+
required: true,
|
|
53
|
+
},
|
|
54
|
+
user: {
|
|
55
|
+
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
56
|
+
ref: "user",
|
|
57
|
+
default: null,
|
|
58
|
+
required: true,
|
|
59
|
+
},
|
|
60
|
+
endpoint: {
|
|
61
|
+
type: String,
|
|
62
|
+
required: true,
|
|
63
|
+
trim: true,
|
|
64
|
+
},
|
|
65
|
+
metadata: {
|
|
66
|
+
type: mongoose_1.default.Schema.Types.Mixed,
|
|
67
|
+
default: null,
|
|
68
|
+
trim: true,
|
|
69
|
+
},
|
|
70
|
+
}, {
|
|
71
|
+
timestamps: true
|
|
72
|
+
});
|
|
73
|
+
const ApiLog = mongoose_1.default.models.apiLog || (0, mongoose_1.model)("apiLog", ApiLogSchema);
|
|
74
|
+
exports.default = ApiLog;
|
package/index.ts
CHANGED
|
@@ -50,12 +50,13 @@ import { generateRandomIID, RolesConstants } from "./src/constant";
|
|
|
50
50
|
import TestTimeline from "./src/models/TestTimeline";
|
|
51
51
|
import CronData from "./src/models/CronData";
|
|
52
52
|
import CronConfig from "./src/models/CronConfig";
|
|
53
|
-
import UserIdentity from "./src/models/UserIdentity";
|
|
54
53
|
import UserOrganization from "./src/models/UserOrganization";
|
|
55
54
|
import Package from "./src/models/Package";
|
|
56
55
|
import Invitation from "./src/models/Invitation";
|
|
57
56
|
import Thread from "./src/models/Thread";
|
|
58
57
|
import ThreadMessage from "./src/models/ThreadMessage";
|
|
58
|
+
import Provider from "./src/models/Provider";
|
|
59
|
+
import ApiLog from "./src/models/ApiLog";
|
|
59
60
|
async function seedRoles() {
|
|
60
61
|
const checkRoles = await Role.countDocuments();
|
|
61
62
|
if (checkRoles < RolesConstants.length) {
|
|
@@ -109,6 +110,7 @@ export {
|
|
|
109
110
|
Client,
|
|
110
111
|
ClientReportsTemp,
|
|
111
112
|
Report,
|
|
113
|
+
Provider,
|
|
112
114
|
Test,
|
|
113
115
|
TestSequentialValue,
|
|
114
116
|
User,
|
|
@@ -155,10 +157,10 @@ export {
|
|
|
155
157
|
CronData,
|
|
156
158
|
CronConfig,
|
|
157
159
|
UserPermission,
|
|
158
|
-
UserIdentity,
|
|
159
160
|
UserOrganization,
|
|
160
161
|
Package,
|
|
161
162
|
Invitation,
|
|
162
163
|
Thread,
|
|
163
164
|
ThreadMessage,
|
|
165
|
+
ApiLog,
|
|
164
166
|
};
|
package/package.json
CHANGED
package/src/constant.ts
CHANGED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import mongoose, { Document, Schema, model } from "mongoose";
|
|
2
|
+
import { generateRandomIID } from "../constant";
|
|
3
|
+
import { ProviderType } from "./Provider";
|
|
4
|
+
|
|
5
|
+
export interface IApiLog extends Document {
|
|
6
|
+
iid: string;
|
|
7
|
+
apiName: string;
|
|
8
|
+
organizationId?: mongoose.Schema.Types.ObjectId;
|
|
9
|
+
client: mongoose.Schema.Types.ObjectId;
|
|
10
|
+
user: mongoose.Schema.Types.ObjectId;
|
|
11
|
+
endpoint: string;
|
|
12
|
+
createdAt: Date;
|
|
13
|
+
updatedAt: Date;
|
|
14
|
+
metadata: mongoose.Schema.Types.Mixed;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const ApiLogSchema = new Schema<IApiLog>(
|
|
18
|
+
{
|
|
19
|
+
iid: {
|
|
20
|
+
type: String,
|
|
21
|
+
trim: true,
|
|
22
|
+
unique: true,
|
|
23
|
+
default: () => generateRandomIID(),
|
|
24
|
+
},
|
|
25
|
+
apiName: {
|
|
26
|
+
type: String,
|
|
27
|
+
required: true,
|
|
28
|
+
enum: Object.values(ProviderType) as [string],
|
|
29
|
+
trim: true,
|
|
30
|
+
},
|
|
31
|
+
organizationId: {
|
|
32
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
33
|
+
ref: "organization",
|
|
34
|
+
default: null,
|
|
35
|
+
required: true,
|
|
36
|
+
},
|
|
37
|
+
client: {
|
|
38
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
39
|
+
ref: "client",
|
|
40
|
+
default: null,
|
|
41
|
+
required: true,
|
|
42
|
+
},
|
|
43
|
+
user: {
|
|
44
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
45
|
+
ref: "user",
|
|
46
|
+
default: null,
|
|
47
|
+
required: true,
|
|
48
|
+
},
|
|
49
|
+
endpoint: {
|
|
50
|
+
type: String,
|
|
51
|
+
required: true,
|
|
52
|
+
trim: true,
|
|
53
|
+
},
|
|
54
|
+
metadata: {
|
|
55
|
+
type: mongoose.Schema.Types.Mixed,
|
|
56
|
+
default: null,
|
|
57
|
+
trim: true,
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
timestamps: true
|
|
62
|
+
}
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
const ApiLog = mongoose.models.apiLog || model<IApiLog>("apiLog", ApiLogSchema);
|
|
66
|
+
|
|
67
|
+
export default ApiLog;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import mongoose, { Document, Schema, model } from "mongoose";
|
|
2
|
-
import { generateRandomIID } from "../constant";
|
|
3
|
-
|
|
4
|
-
export interface IUserIdentity extends Document {
|
|
5
|
-
iid: string;
|
|
6
|
-
user: mongoose.Schema.Types.ObjectId;
|
|
7
|
-
provider: "google" | "microsoft" | "github" | "facebook" | "apple";
|
|
8
|
-
providerUserId: string;
|
|
9
|
-
email: string;
|
|
10
|
-
metadata?: any;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const UserIdentitySchema = new Schema<IUserIdentity>(
|
|
14
|
-
{
|
|
15
|
-
iid: { type: String, unique: true, default: () => generateRandomIID() },
|
|
16
|
-
user: { type: mongoose.Schema.Types.ObjectId, ref: "user", required: true },
|
|
17
|
-
email: { type: String, unique: true, required: true },
|
|
18
|
-
providerUserId: { type: String, required: true },
|
|
19
|
-
provider: { type: String, enum: ["google", "microsoft", "github", "facebook", "apple"], required: true },
|
|
20
|
-
metadata: { type: mongoose.Schema.Types.Mixed, default: {} },
|
|
21
|
-
},
|
|
22
|
-
{ timestamps: true }
|
|
23
|
-
);
|
|
24
|
-
|
|
25
|
-
const UserIdentity = mongoose.models.useridentity || model<IUserIdentity>("useridentity", UserIdentitySchema);
|
|
26
|
-
export default UserIdentity;
|