codebase-models 2.1.24 → 3.0.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.
Files changed (41) hide show
  1. package/.github/workflows/npm-publish-stage.yml +33 -0
  2. package/dist/index.d.ts +7 -4
  3. package/dist/index.js +14 -8
  4. package/dist/src/constant.d.ts +24 -1
  5. package/dist/src/constant.js +89 -3
  6. package/dist/src/models/Client.d.ts +1 -1
  7. package/dist/src/models/Client.js +7 -4
  8. package/dist/src/models/{SegmentCombination.d.ts → Invitation.d.ts} +15 -14
  9. package/dist/src/models/Invitation.js +55 -0
  10. package/dist/src/models/Organization.d.ts +8 -15
  11. package/dist/src/models/Organization.js +10 -58
  12. package/dist/src/models/{QueryLog.d.ts → Package.d.ts} +7 -7
  13. package/dist/src/models/{QueryLog.js → Package.js} +10 -19
  14. package/dist/src/models/{Segment.d.ts → Thread.d.ts} +7 -10
  15. package/dist/src/models/Thread.js +78 -0
  16. package/dist/src/models/ThreadMessage.d.ts +35 -0
  17. package/dist/src/models/ThreadMessage.js +86 -0
  18. package/dist/src/models/User.d.ts +8 -5
  19. package/dist/src/models/User.js +13 -37
  20. package/dist/src/models/UserIdentity.d.ts +35 -0
  21. package/dist/src/models/{SegmentCombination.js → UserIdentity.js} +11 -47
  22. package/dist/src/models/UserOrganization.d.ts +33 -0
  23. package/dist/src/models/{Segment.js → UserOrganization.js} +10 -33
  24. package/dist/src/models/UserPermission.d.ts +4 -11
  25. package/dist/src/models/UserPermission.js +27 -10
  26. package/index.ts +12 -6
  27. package/package.json +1 -1
  28. package/src/constant.ts +88 -3
  29. package/src/models/Client.ts +8 -5
  30. package/src/models/Invitation.ts +50 -0
  31. package/src/models/Organization.ts +18 -73
  32. package/src/models/Package.ts +24 -0
  33. package/src/models/Thread.ts +57 -0
  34. package/src/models/ThreadMessage.ts +67 -0
  35. package/src/models/User.ts +21 -43
  36. package/src/models/UserIdentity.ts +26 -0
  37. package/src/models/UserOrganization.ts +23 -0
  38. package/src/models/UserPermission.ts +31 -21
  39. package/src/models/QueryLog.ts +0 -35
  40. package/src/models/Segment.ts +0 -50
  41. package/src/models/SegmentCombination.ts +0 -68
@@ -0,0 +1,35 @@
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
+ export interface IThreadMessage extends Document {
27
+ iid: string;
28
+ organization: mongoose.Schema.Types.ObjectId;
29
+ thread: mongoose.Schema.Types.ObjectId;
30
+ status: string;
31
+ user: mongoose.Schema.Types.ObjectId;
32
+ message: mongoose.Schema.Types.Mixed;
33
+ }
34
+ declare const ThreadMessage: mongoose.Model<any, {}, {}, {}, any, any>;
35
+ export default ThreadMessage;
@@ -0,0 +1,86 @@
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
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
+ return new (P || (P = Promise))(function (resolve, reject) {
28
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
32
+ });
33
+ };
34
+ Object.defineProperty(exports, "__esModule", { value: true });
35
+ const mongoose_1 = __importStar(require("mongoose"));
36
+ const constant_1 = require("../constant");
37
+ const ThreadMessageSchema = new mongoose_1.Schema({
38
+ iid: {
39
+ type: String,
40
+ trim: true,
41
+ },
42
+ organization: {
43
+ type: mongoose_1.default.Schema.Types.ObjectId,
44
+ ref: "organization",
45
+ default: null,
46
+ },
47
+ thread: {
48
+ type: mongoose_1.default.Schema.Types.ObjectId,
49
+ ref: "thread",
50
+ default: null,
51
+ },
52
+ user: {
53
+ type: mongoose_1.default.Schema.Types.ObjectId,
54
+ ref: "user",
55
+ default: null,
56
+ },
57
+ status: {
58
+ type: String,
59
+ enum: ["pending", "success", "failed"],
60
+ default: "pending",
61
+ },
62
+ message: {
63
+ type: mongoose_1.default.Schema.Types.Mixed,
64
+ },
65
+ }, {
66
+ timestamps: true,
67
+ });
68
+ ThreadMessageSchema.pre('save', function (next) {
69
+ return __awaiter(this, void 0, void 0, function* () {
70
+ if (!this.iid) {
71
+ let unique = false;
72
+ while (!unique) {
73
+ const id = (0, constant_1.generateRandomIID)();
74
+ const existing = yield mongoose_1.default.models.threadmessage.findOne({ iid: id });
75
+ if (!existing) {
76
+ this.iid = id;
77
+ unique = true;
78
+ }
79
+ }
80
+ }
81
+ next();
82
+ });
83
+ });
84
+ ThreadMessageSchema.index({ iid: 1 }, { unique: true });
85
+ const ThreadMessage = mongoose_1.default.models.threadmessage || (0, mongoose_1.model)("threadmessage", ThreadMessageSchema);
86
+ exports.default = ThreadMessage;
@@ -24,21 +24,24 @@
24
24
  /// <reference types="mongoose/types/inferschematype" />
25
25
  import mongoose, { Document } from "mongoose";
26
26
  export interface IUser extends Document {
27
+ iid: string;
27
28
  name: string;
28
29
  email: string;
30
+ image: string;
31
+ client: mongoose.Schema.Types.ObjectId[];
29
32
  password: string;
30
33
  token: string;
31
- role?: mongoose.Schema.Types.ObjectId[];
32
34
  deactivated: boolean;
33
- client?: mongoose.Schema.Types.ObjectId[];
34
35
  twoFactor: boolean;
35
- createdAt: Date;
36
- updatedAt: Date;
36
+ emailVerified: boolean;
37
37
  resetLink: string;
38
- organizationId?: mongoose.Schema.Types.ObjectId;
39
38
  bigqueryToken: string;
40
39
  expirybqToken: string;
41
40
  refreshToken: string;
41
+ createdAt: Date;
42
+ updatedAt: Date;
43
+ isSSOUser: boolean;
44
+ role: mongoose.Schema.Types.ObjectId[] | null;
42
45
  }
43
46
  declare const User: mongoose.Model<any, {}, {}, {}, any, any>;
44
47
  export default User;
@@ -24,48 +24,24 @@ 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 constant_1 = require("../constant");
27
28
  const UserSchema = new mongoose_1.Schema({
29
+ iid: { type: String, unique: true, default: () => (0, constant_1.generateRandomIID)() },
28
30
  name: String,
29
- email: {
30
- type: String,
31
- unique: true,
32
- required: true,
33
- },
34
- password: {
35
- type: String,
36
- required: true,
37
- },
31
+ email: { type: String, unique: true, required: true },
32
+ client: { type: [mongoose_1.default.Schema.Types.ObjectId], ref: "client", default: null },
33
+ password: { type: String, required: true },
34
+ image: String,
38
35
  token: String,
39
- role: {
40
- type: [mongoose_1.default.Schema.Types.ObjectId],
41
- ref: "role",
42
- },
43
- deactivated: {
44
- type: Boolean,
45
- default: false,
46
- },
47
- client: {
48
- type: [mongoose_1.default.Schema.Types.ObjectId],
49
- ref: "client",
50
- default: null,
51
- },
52
- twoFactor: {
53
- type: Boolean,
54
- default: false,
55
- },
56
- organizationId: {
57
- type: mongoose_1.default.Schema.Types.ObjectId,
58
- ref: "organization",
59
- default: null,
60
- },
36
+ deactivated: { type: Boolean, default: false },
37
+ twoFactor: { type: Boolean, default: false },
38
+ emailVerified: { type: Boolean, default: false },
39
+ resetLink: String,
61
40
  bigqueryToken: String,
62
41
  expirybqToken: String,
63
42
  refreshToken: String,
64
- }, {
65
- timestamps: true,
66
- });
67
- // Add compound indexes for common query patterns
68
- UserSchema.index({ organizationId: 1, role: 1 });
69
- UserSchema.index({ organizationId: 1, client: 1 });
43
+ isSSOUser: { type: Boolean, default: false },
44
+ role: { type: [mongoose_1.default.Schema.Types.ObjectId], ref: "role", default: null },
45
+ }, { timestamps: true });
70
46
  const User = mongoose_1.default.models.user || (0, mongoose_1.model)("user", UserSchema);
71
47
  exports.default = User;
@@ -0,0 +1,35 @@
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
+ export interface IUserIdentity extends Document {
27
+ iid: string;
28
+ user: mongoose.Schema.Types.ObjectId;
29
+ provider: "google" | "microsoft" | "github" | "facebook" | "apple";
30
+ providerUserId: string;
31
+ email: string;
32
+ metadata?: any;
33
+ }
34
+ declare const UserIdentity: mongoose.Model<any, {}, {}, {}, any, any>;
35
+ export default UserIdentity;
@@ -24,50 +24,14 @@ 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 SegmentSchema = new mongoose_1.Schema({
28
- organizationId: {
29
- type: mongoose_1.default.Schema.Types.ObjectId,
30
- ref: "organization",
31
- default: null,
32
- },
33
- name: {
34
- type: String,
35
- },
36
- combination: {
37
- type: [],
38
- },
39
- gagroup: {
40
- typr: String,
41
- },
42
- secondaryFilters: {
43
- type: [],
44
- default: null,
45
- },
46
- segmentType: {
47
- type: String,
48
- default: "general",
49
- },
50
- client: {
51
- type: [mongoose_1.default.Schema.Types.ObjectId],
52
- ref: "client",
53
- default: null,
54
- },
55
- published: {
56
- type: Boolean,
57
- default: true,
58
- },
59
- order: {
60
- type: Number,
61
- default: 1,
62
- },
63
- createdAt: {
64
- type: Date,
65
- default: new Date(),
66
- },
67
- updatedAt: {
68
- type: Date,
69
- default: new Date(),
70
- },
71
- });
72
- const SegmentCombination = mongoose_1.default.models.segmentcombination || (0, mongoose_1.model)("segmentcombination", SegmentSchema);
73
- exports.default = SegmentCombination;
27
+ const constant_1 = require("../constant");
28
+ const UserIdentitySchema = new mongoose_1.Schema({
29
+ iid: { type: String, unique: true, default: () => (0, constant_1.generateRandomIID)() },
30
+ user: { type: mongoose_1.default.Schema.Types.ObjectId, ref: "user", required: true },
31
+ email: { type: String, unique: true, required: true },
32
+ providerUserId: { type: String, required: true },
33
+ provider: { type: String, enum: ["google", "microsoft", "github", "facebook", "apple"], required: true },
34
+ metadata: { type: mongoose_1.default.Schema.Types.Mixed, default: {} },
35
+ }, { timestamps: true });
36
+ const UserIdentity = mongoose_1.default.models.useridentity || (0, mongoose_1.model)("useridentity", UserIdentitySchema);
37
+ exports.default = UserIdentity;
@@ -0,0 +1,33 @@
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 from "mongoose";
26
+ export interface IUserOrganization extends Document {
27
+ iid: string;
28
+ user: mongoose.Schema.Types.ObjectId;
29
+ organization: mongoose.Schema.Types.ObjectId;
30
+ role: string;
31
+ }
32
+ declare const UserOrganization: mongoose.Model<any, {}, {}, {}, any, any>;
33
+ export default UserOrganization;
@@ -24,36 +24,13 @@ 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 SegmentSchema = new mongoose_1.Schema({
28
- organizationId: {
29
- type: mongoose_1.default.Schema.Types.ObjectId,
30
- ref: "organization",
31
- default: null,
32
- },
33
- name: {
34
- type: String,
35
- },
36
- key: {
37
- type: String,
38
- },
39
- values: {
40
- type: String,
41
- },
42
- segmentType: {
43
- type: String,
44
- default: "general",
45
- },
46
- client: {
47
- type: [mongoose_1.default.Schema.Types.ObjectId],
48
- ref: "client",
49
- default: null,
50
- },
51
- published: {
52
- type: Boolean,
53
- default: true,
54
- },
55
- }, {
56
- timestamps: true,
57
- });
58
- const Segment = mongoose_1.default.models.segment || (0, mongoose_1.model)("segment", SegmentSchema);
59
- exports.default = Segment;
27
+ const constant_1 = require("../constant");
28
+ const UserOrganizationSchema = new mongoose_1.Schema({
29
+ iid: { type: String, unique: true, default: () => (0, constant_1.generateRandomIID)() },
30
+ user: { type: mongoose_1.default.Schema.Types.ObjectId, ref: "user", required: true },
31
+ organization: { type: mongoose_1.default.Schema.Types.ObjectId, ref: "organization", required: true },
32
+ role: { type: String, enum: ["owner", "admin", "member"], default: "member" }
33
+ }, { timestamps: true });
34
+ UserOrganizationSchema.index({ user: 1, organization: 1 }, { unique: true });
35
+ const UserOrganization = mongoose_1.default.models.userorganization || (0, mongoose_1.model)("userorganization", UserOrganizationSchema);
36
+ exports.default = UserOrganization;
@@ -24,19 +24,12 @@
24
24
  /// <reference types="mongoose/types/inferschematype" />
25
25
  import mongoose, { Document } from "mongoose";
26
26
  export interface IUserPermission extends Document {
27
+ iid: string;
27
28
  userId: mongoose.Schema.Types.ObjectId;
28
29
  clientId: mongoose.Schema.Types.ObjectId;
29
- permissions: {
30
- dashboard: boolean;
31
- reporting: boolean;
32
- insights: boolean;
33
- documentsAndLinks: boolean;
34
- cvrReports: boolean;
35
- abTesting: boolean;
36
- abTestingDefault: boolean;
37
- manageExperiments: boolean;
38
- preCalculations: boolean;
39
- };
30
+ organizationId: mongoose.Schema.Types.ObjectId;
31
+ role: string;
32
+ permissions: mongoose.Schema.Types.Mixed;
40
33
  createdAt: Date;
41
34
  updatedAt: Date;
42
35
  }
@@ -24,7 +24,13 @@ 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 constant_1 = require("../constant");
27
28
  const UserPermissionSchema = new mongoose_1.Schema({
29
+ iid: {
30
+ type: String,
31
+ unique: true,
32
+ default: () => (0, constant_1.generateRandomIID)()
33
+ },
28
34
  userId: {
29
35
  type: mongoose_1.default.Schema.Types.ObjectId,
30
36
  ref: "user",
@@ -35,17 +41,28 @@ const UserPermissionSchema = new mongoose_1.Schema({
35
41
  ref: "client",
36
42
  required: true,
37
43
  },
38
- permissions: {
39
- abTestingDefault: { type: Boolean, default: true },
40
- abTesting: { type: Boolean, default: false },
41
- preCalculations: { type: Boolean, default: false },
42
- reporting: { type: Boolean, default: true },
43
- insights: { type: Boolean, default: true },
44
- documentsAndLinks: { type: Boolean, default: true },
45
- cvrReports: { type: Boolean, default: true },
46
- manageExperiments: { type: Boolean, default: false },
47
- dashboard: { type: Boolean, default: true },
44
+ role: {
45
+ type: String,
46
+ enum: ["member", "admin", "owner"],
47
+ default: "member",
48
+ },
49
+ organizationId: {
50
+ type: mongoose_1.default.Schema.Types.ObjectId,
51
+ ref: "organization",
52
+ required: true,
48
53
  },
54
+ permissions: { type: mongoose_1.default.Schema.Types.Mixed, required: true, default: constant_1.PackageFeaturesConstants },
55
+ // permissions: {
56
+ // abTestingDefault: { type: Boolean, default: true },
57
+ // abTesting: { type: Boolean, default: false },
58
+ // preCalculations: { type: Boolean, default: false },
59
+ // reporting: { type: Boolean, default: true },
60
+ // insights: { type: Boolean, default: true },
61
+ // documentsAndLinks: { type: Boolean, default: true },
62
+ // cvrReports: { type: Boolean, default: true },
63
+ // manageExperiments: { type: Boolean, default: false },
64
+ // dashboard: { type: Boolean, default: true },
65
+ // },
49
66
  }, {
50
67
  timestamps: true,
51
68
  });
package/index.ts CHANGED
@@ -2,7 +2,6 @@ import mongoose from "mongoose";
2
2
 
3
3
  import Client from "./src/models/Client";
4
4
  import ClientReportsTemp from "./src/models/ClientReportsTemp";
5
- import QueryLog from "./src/models/QueryLog";
6
5
  import Report from "./src/models/Report";
7
6
  import Test from "./src/models/Test";
8
7
  import TestSequentialValue from "./src/models/TestSequentialValue";
@@ -34,8 +33,6 @@ import ReadNotification from "./src/models/ReadNotification";
34
33
  import Organization from "./src/models/Organization";
35
34
  import Role from "./src/models/Role";
36
35
  import SavedSegment from "./src/models/SavedSegment";
37
- import Segment from "./src/models/Segment";
38
- import SegmentCombination from "./src/models/SegmentCombination";
39
36
  import Snippet from "./src/models/Snippet";
40
37
  import StageInCustomerJourney from "./src/models/StageInCustomerJourney";
41
38
  import Tag from "./src/models/Tag";
@@ -53,6 +50,12 @@ import { generateRandomIID, RolesConstants } from "./src/constant";
53
50
  import TestTimeline from "./src/models/TestTimeline";
54
51
  import CronData from "./src/models/CronData";
55
52
  import CronConfig from "./src/models/CronConfig";
53
+ import UserIdentity from "./src/models/UserIdentity";
54
+ import UserOrganization from "./src/models/UserOrganization";
55
+ import Package from "./src/models/Package";
56
+ import Invitation from "./src/models/Invitation";
57
+ import Thread from "./src/models/Thread";
58
+ import ThreadMessage from "./src/models/ThreadMessage";
56
59
  async function seedRoles() {
57
60
  const checkRoles = await Role.countDocuments();
58
61
  if (checkRoles < RolesConstants.length) {
@@ -105,7 +108,6 @@ export {
105
108
  RolesConstants,
106
109
  Client,
107
110
  ClientReportsTemp,
108
- QueryLog,
109
111
  Report,
110
112
  Test,
111
113
  TestSequentialValue,
@@ -138,8 +140,6 @@ export {
138
140
  CustomQuery,
139
141
  SavedSegment,
140
142
  TestTimeline,
141
- Segment,
142
- SegmentCombination,
143
143
  Snippet,
144
144
  StageInCustomerJourney,
145
145
  Tag,
@@ -155,4 +155,10 @@ export {
155
155
  CronData,
156
156
  CronConfig,
157
157
  UserPermission,
158
+ UserIdentity,
159
+ UserOrganization,
160
+ Package,
161
+ Invitation,
162
+ Thread,
163
+ ThreadMessage,
158
164
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codebase-models",
3
- "version": "2.1.24",
3
+ "version": "3.0.0",
4
4
  "description": "Common models for codebase",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
package/src/constant.ts CHANGED
@@ -16,8 +16,6 @@ const HypothesisSheetConstants = {
16
16
  const RolesConstants = [
17
17
  "USER",
18
18
  "ADMIN",
19
- // "EDITOR",
20
- // "COLLABORATOR",
21
19
  "CLIENT",
22
20
  "EXTERNAL",
23
21
  "QA",
@@ -41,6 +39,93 @@ const generateRandomIID = (): string => {
41
39
  );
42
40
  }
43
41
  };
42
+ const PermissionsConstants = {
43
+ dashboard: "dashboard",
44
+ reporting: "reporting",
45
+ insights: "insights",
46
+ documentsAndLinks: "documentsAndLinks",
47
+ cvrReports: "cvrReports",
48
+ abTesting: "abTesting",
49
+ abTestingDefault: "abTestingDefault",
50
+ manageOrganizations: "manageOrganizations",
51
+ manageInvitations: "manageInvitations",
52
+ manageClients: "manageClients",
53
+ };
54
+
55
+ const PackageFeaturesConstants = [
56
+ {
57
+ name: "DASHBOARD",
58
+ value: true,
59
+ description: "Access to the dashboard",
60
+ allowedCount: null,
61
+ },
62
+ {
63
+ name: "REPORTING",
64
+ value: true,
65
+ description: "Access to the reporting",
66
+ allowedCount: null,
67
+ },
68
+ {
69
+ name: "INSIGHTS",
70
+ value: true,
71
+ description: "Access to the insights",
72
+ allowedCount: null,
73
+ },
74
+ {
75
+ name: "DOCUMENTSANDLINKS",
76
+ value: true,
77
+ description: "Access to the documents and links",
78
+ allowedCount: 5,
79
+ },
80
+ {
81
+ name: "CVRREPORTS",
82
+ value: true,
83
+ description: "Access to the cvr reports",
84
+ allowedCount: null,
85
+ },
86
+ {
87
+ name: "ABTESTING",
88
+ value: false,
89
+ description: "Access to the ab testing",
90
+ allowedCount: null,
91
+ },
92
+ {
93
+ name: "ABTESTINGDEFAULT",
94
+ value: true,
95
+ description: "Access to the ab testing default",
96
+ allowedCount: null,
97
+ },
98
+ {
99
+ name: "MANAGEEXPERIMENTS",
100
+ value: true,
101
+ description: "Access to the experiments",
102
+ allowedCount: null,
103
+ },
104
+ {
105
+ name: "PRECALCULATIONS",
106
+ value: false,
107
+ description: "Access to the pre calculations",
108
+ allowedCount: null,
109
+ },
110
+ {
111
+ name: "MANAGEORGANIZATIONS",
112
+ value: true,
113
+ description: "Access to the organizations",
114
+ allowedCount: 1,
115
+ },
116
+ {
117
+ name: "MANAGEINVITATIONS",
118
+ value: true,
119
+ description: "Access to the invitations",
120
+ allowedCount: 1,
121
+ },
122
+ {
123
+ name: "MANAGECLIENTS",
124
+ value: true,
125
+ description: "Access to the clients",
126
+ allowedCount: 3,
127
+ },
128
+ ];
44
129
 
45
- export { generateRandomIID, RolesConstants };
130
+ export { generateRandomIID, RolesConstants, PermissionsConstants, PackageFeaturesConstants };
46
131
  export default HypothesisSheetConstants;