orbitx-core-models 2.0.1 → 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.
package/dist/index.d.ts CHANGED
@@ -3,11 +3,13 @@ import { Message } from "./models/message.model";
3
3
  import { User } from "./models/user.model";
4
4
  import { Vertical } from "./models/vertical.model";
5
5
  import { Macro } from "./models/macro.model";
6
+ import { Partner } from "./models/partner.model";
6
7
  import { IChat } from "./interfaces/chat.interface";
7
8
  import { IMacro } from "./interfaces/macro.interface";
8
9
  import { IVertical } from "./interfaces/vertical.interface";
9
10
  import { IMessage } from "./interfaces/message.interface";
10
11
  import { IUser } from "./interfaces/user.interface";
11
- export { Chat, Message, User, Vertical, Macro };
12
- export type { IChat, IMessage, IUser, IVertical, IMacro };
12
+ import { IPartner } from "./interfaces/partner.interface";
13
+ export { Chat, Message, User, Vertical, Macro, Partner };
14
+ export type { IChat, IMessage, IUser, IVertical, IMacro, IPartner };
13
15
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAG7C,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAC1D,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAEpD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;AAChD,YAAY,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAGjD,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAC1D,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAE1D,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;AACzD,YAAY,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC"}
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Macro = exports.Vertical = exports.User = exports.Message = exports.Chat = void 0;
3
+ exports.Partner = exports.Macro = exports.Vertical = exports.User = exports.Message = exports.Chat = void 0;
4
4
  // MODELS
5
5
  const chat_model_1 = require("./models/chat.model");
6
6
  Object.defineProperty(exports, "Chat", { enumerable: true, get: function () { return chat_model_1.Chat; } });
@@ -12,3 +12,5 @@ const vertical_model_1 = require("./models/vertical.model");
12
12
  Object.defineProperty(exports, "Vertical", { enumerable: true, get: function () { return vertical_model_1.Vertical; } });
13
13
  const macro_model_1 = require("./models/macro.model");
14
14
  Object.defineProperty(exports, "Macro", { enumerable: true, get: function () { return macro_model_1.Macro; } });
15
+ const partner_model_1 = require("./models/partner.model");
16
+ Object.defineProperty(exports, "Partner", { enumerable: true, get: function () { return partner_model_1.Partner; } });
@@ -0,0 +1,38 @@
1
+ import { Types } from "mongoose";
2
+ export interface IAccountInfo {
3
+ firmName: string;
4
+ firmWebsite?: string;
5
+ firmOwner: string;
6
+ ownerPhone: string;
7
+ ownerEmail: string;
8
+ firmRepresentative?: string;
9
+ representativePhone?: string;
10
+ representativeEmail?: string;
11
+ firmAddress: string;
12
+ city: string;
13
+ state: string;
14
+ country: string;
15
+ taxId?: string;
16
+ registrationNo?: string;
17
+ businessType?: string;
18
+ }
19
+ export interface IPayoutInfo {
20
+ bankName?: string;
21
+ accountNumber?: string;
22
+ branchDetails?: string;
23
+ linkedCard?: string;
24
+ }
25
+ export interface IPayoutTier {
26
+ payoutInfo: IPayoutInfo;
27
+ tier: "Bronze" | "Silver" | "Gold";
28
+ featureAccess?: string[];
29
+ }
30
+ export interface IPartner {
31
+ _id?: Types.ObjectId;
32
+ accountInfo: IAccountInfo;
33
+ payoutTier: IPayoutTier;
34
+ status: "Active" | "Inactive";
35
+ createdAt?: Date;
36
+ updatedAt?: Date;
37
+ }
38
+ //# sourceMappingURL=partner.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"partner.interface.d.ts","sourceRoot":"","sources":["../../src/interfaces/partner.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEjC,MAAM,WA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from "../interfaces/partner.interface";
3
+ export declare const Partner: mongoose.Model<IPartner, {}, {}, {}, mongoose.Document<unknown, {}, IPartner, {}, {}> & IPartner & Required<{
4
+ _id: mongoose.Types.ObjectId;
5
+ }> & {
6
+ __v: number;
7
+ }, any>;
8
+ export default Partner;
9
+ //# sourceMappingURL=partner.model.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"partner.model.d.ts","sourceRoot":"","sources":["../../src/models/partner.model.ts"],"names":[],"mappings":"AAAA,OAAO,QAAoB,MAAM,UAAU,CAAC;AAC5C,OAAO,EACL,QAAQ,EAGT,MAAM,iCAAiC,CAAC;AAyGzC,eAAO,MAAM,OAAO;;;;OAAqD,CAAC;AAC1E,eAAe,OAAO,CAAC"}
@@ -0,0 +1,122 @@
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 () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.Partner = void 0;
37
+ const mongoose_1 = __importStar(require("mongoose"));
38
+ const accountInfoSchema = new mongoose_1.Schema({
39
+ firmName: { type: String, required: true, trim: true },
40
+ firmWebsite: {
41
+ type: String,
42
+ trim: true,
43
+ validate: {
44
+ validator: (v) => !v ? true : /^https?:\/\/[^\s$.?#].[^\s]*$/.test(v),
45
+ message: "Invalid URL format",
46
+ },
47
+ },
48
+ firmOwner: { type: String, required: true, trim: true },
49
+ ownerPhone: {
50
+ type: String,
51
+ required: true,
52
+ trim: true,
53
+ validate: {
54
+ validator: (v) => /^\+?[\d\s-]{7,15}$/.test(v),
55
+ message: "Invalid phone number format",
56
+ },
57
+ },
58
+ ownerEmail: {
59
+ type: String,
60
+ required: true,
61
+ lowercase: true,
62
+ match: [/^\S+@\S+\.\S+$/, "Invalid email format"],
63
+ },
64
+ firmRepresentative: { type: String, trim: true },
65
+ representativePhone: {
66
+ type: String,
67
+ trim: true,
68
+ validate: {
69
+ validator: (v) => (!v ? true : /^\+?[\d\s-]{7,15}$/.test(v)),
70
+ message: "Invalid phone number format",
71
+ },
72
+ },
73
+ representativeEmail: {
74
+ type: String,
75
+ trim: true,
76
+ lowercase: true,
77
+ match: [/^\S+@\S+\.\S+$/, "Invalid email format"],
78
+ },
79
+ firmAddress: { type: String, required: true, trim: true },
80
+ city: { type: String, required: true, trim: true },
81
+ state: { type: String, required: true, trim: true },
82
+ country: { type: String, required: true, trim: true },
83
+ taxId: { type: String, trim: true },
84
+ registrationNo: { type: String, trim: true },
85
+ businessType: { type: String, trim: true },
86
+ });
87
+ const payoutTierSchema = new mongoose_1.Schema({
88
+ payoutInfo: {
89
+ bankName: { type: String, trim: true },
90
+ accountNumber: { type: String, trim: true },
91
+ branchDetails: { type: String, trim: true },
92
+ linkedCard: { type: String, trim: true },
93
+ },
94
+ tier: {
95
+ type: String,
96
+ enum: ["Bronze", "Silver", "Gold"],
97
+ default: "Bronze",
98
+ },
99
+ featureAccess: {
100
+ type: [String],
101
+ default: [],
102
+ },
103
+ });
104
+ const partnerSchema = new mongoose_1.Schema({
105
+ accountInfo: accountInfoSchema,
106
+ payoutTier: payoutTierSchema,
107
+ status: {
108
+ type: String,
109
+ enum: ["Active", "Inactive"],
110
+ default: "Active",
111
+ },
112
+ }, {
113
+ timestamps: true,
114
+ toJSON: { virtuals: true },
115
+ toObject: { virtuals: true },
116
+ });
117
+ // Indexes
118
+ partnerSchema.index({ "accountInfo.firmName": 1 });
119
+ partnerSchema.index({ "accountInfo.firmOwner": 1 });
120
+ partnerSchema.index({ "accountInfo.firmWebsite": 1 });
121
+ exports.Partner = mongoose_1.default.model("Partner", partnerSchema);
122
+ exports.default = exports.Partner;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "orbitx-core-models",
3
- "version": "2.0.1",
3
+ "version": "3.0.0",
4
4
  "description": "Shared Mongoose models and interfaces for OrbitX services",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",