orbitx-core-models 9.0.3 → 9.0.4

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
@@ -8,6 +8,7 @@ import { Company } from "./models/company.model";
8
8
  import { Review } from "./models/review.model";
9
9
  import { Wallet } from "./models/wallet.model";
10
10
  import { StripeLog } from "./models/stripeLog.model";
11
+ import { Transaction } from "./models/transaction.model";
11
12
  import { Lead } from "./models/lead.model";
12
13
  import { TierConfig } from "./models/tierConfig.model";
13
14
  import { TierProgress } from "./models/tierProgress.model";
@@ -21,9 +22,10 @@ import { ICompany } from "./interfaces/company.interface";
21
22
  import { IReview } from "./interfaces/review.interface";
22
23
  import { IWallet } from "./interfaces/wallet.interface";
23
24
  import { IStripeLog } from "./interfaces/stripeLog.interface";
25
+ import { ITransaction } from "./interfaces/transaction.interface";
24
26
  import { ILead } from "./interfaces/lead.interface";
25
27
  import { ITierConfig } from "./interfaces/tierConfig.interface";
26
28
  import { ITierProgress } from "./interfaces/tierProgress.interface";
27
- export { Chat, Message, User, Vertical, Macro, Partner, Company, Review, Wallet, StripeLog, Lead, TierConfig, TierProgress, };
28
- export type { IChat, IMessage, IUser, IVertical, IMacro, IPartner, ICompany, IReview, IWallet, IStripeLog, ILead, ITierConfig, ITierProgress, };
29
+ export { Chat, Message, User, Vertical, Macro, Partner, Company, Review, Wallet, StripeLog, Transaction, Lead, TierConfig, TierProgress, };
30
+ export type { IChat, IMessage, IUser, IVertical, IMacro, IPartner, ICompany, IReview, IWallet, IStripeLog, ITransaction, ILead, ITierConfig, ITierProgress, };
29
31
  //# 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,EAA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,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;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAClE,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AAEpE,OAAO,EACL,IAAI,EACJ,OAAO,EACP,IAAI,EACJ,QAAQ,EACR,KAAK,EACL,OAAO,EACP,OAAO,EACP,MAAM,EACN,MAAM,EACN,SAAS,EACT,WAAW,EACX,IAAI,EACJ,UAAU,EACV,YAAY,GACb,CAAC;AACF,YAAY,EACV,KAAK,EACL,QAAQ,EACR,KAAK,EACL,SAAS,EACT,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,OAAO,EACP,UAAU,EACV,YAAY,EACZ,KAAK,EACL,WAAW,EACX,aAAa,GACd,CAAC"}
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TierProgress = exports.TierConfig = exports.Lead = exports.StripeLog = exports.Wallet = exports.Review = exports.Company = exports.Partner = exports.Macro = exports.Vertical = exports.User = exports.Message = exports.Chat = void 0;
3
+ exports.TierProgress = exports.TierConfig = exports.Lead = exports.Transaction = exports.StripeLog = exports.Wallet = exports.Review = exports.Company = 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; } });
@@ -22,6 +22,8 @@ const wallet_model_1 = require("./models/wallet.model");
22
22
  Object.defineProperty(exports, "Wallet", { enumerable: true, get: function () { return wallet_model_1.Wallet; } });
23
23
  const stripeLog_model_1 = require("./models/stripeLog.model");
24
24
  Object.defineProperty(exports, "StripeLog", { enumerable: true, get: function () { return stripeLog_model_1.StripeLog; } });
25
+ const transaction_model_1 = require("./models/transaction.model");
26
+ Object.defineProperty(exports, "Transaction", { enumerable: true, get: function () { return transaction_model_1.Transaction; } });
25
27
  const lead_model_1 = require("./models/lead.model");
26
28
  Object.defineProperty(exports, "Lead", { enumerable: true, get: function () { return lead_model_1.Lead; } });
27
29
  const tierConfig_model_1 = require("./models/tierConfig.model");
@@ -0,0 +1,19 @@
1
+ import { Types } from "mongoose";
2
+ export type TransactionType = "payout" | "transfer";
3
+ export type TransactionStatus = "pending" | "paid" | "failed";
4
+ export type TransactionSource = "lead-target" | "commission";
5
+ export interface ITransaction {
6
+ _id?: Types.ObjectId;
7
+ txnId?: string;
8
+ idempotencyKey?: string;
9
+ stripeType: TransactionType;
10
+ amount: number;
11
+ description?: string;
12
+ status: TransactionStatus;
13
+ bankLast4?: string | null;
14
+ stripeIntentId?: string | null;
15
+ source: TransactionSource;
16
+ createdAt?: Date;
17
+ updatedAt?: Date;
18
+ }
19
+ //# sourceMappingURL=transaction.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transaction.interface.d.ts","sourceRoot":"","sources":["../../src/interfaces/transaction.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEjC,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,UAAU,CAAC;AACpD,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,MAAM,GAAG,QAAQ,CAAC;AAC9D,MAAM,MAAM,iBAAiB,GAAG,aAAa,GAAG,YAAY,CAAC;AAE7D,MAAM,WAAW,YAAY;IAC3B,GAAG,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,eAAe,CAAC;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,iBAAiB,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,MAAM,EAAE,iBAAiB,CAAC;IAC1B,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,SAAS,CAAC,EAAE,IAAI,CAAC;CAClB"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,9 @@
1
+ import mongoose from "mongoose";
2
+ import { ITransaction } from "../interfaces/transaction.interface";
3
+ export declare const Transaction: mongoose.Model<ITransaction, {}, {}, {}, mongoose.Document<unknown, {}, ITransaction, {}, {}> & ITransaction & Required<{
4
+ _id: mongoose.Types.ObjectId;
5
+ }> & {
6
+ __v: number;
7
+ }, any>;
8
+ export default Transaction;
9
+ //# sourceMappingURL=transaction.model.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transaction.model.d.ts","sourceRoot":"","sources":["../../src/models/transaction.model.ts"],"names":[],"mappings":"AAAA,OAAO,QAAoB,MAAM,UAAU,CAAC;AAE5C,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AAmEnE,eAAO,MAAM,WAAW;;;;OAGvB,CAAC;AACF,eAAe,WAAW,CAAC"}
@@ -0,0 +1,92 @@
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.Transaction = void 0;
37
+ const mongoose_1 = __importStar(require("mongoose"));
38
+ const crypto_1 = require("crypto");
39
+ const generateTxnId = () => `TXN-${(0, crypto_1.randomUUID)().split("-")[0].toUpperCase()}`;
40
+ const generateIdempotencyKey = () => (0, crypto_1.randomUUID)();
41
+ const transactionSchema = new mongoose_1.Schema({
42
+ txnId: {
43
+ type: String,
44
+ unique: true,
45
+ index: true,
46
+ default: generateTxnId,
47
+ },
48
+ idempotencyKey: {
49
+ type: String,
50
+ unique: true,
51
+ index: true,
52
+ default: generateIdempotencyKey,
53
+ },
54
+ stripeType: {
55
+ type: String,
56
+ enum: ["payout", "transfer"],
57
+ required: true,
58
+ },
59
+ amount: {
60
+ type: Number,
61
+ required: true,
62
+ min: 0,
63
+ },
64
+ description: {
65
+ type: String,
66
+ trim: true,
67
+ },
68
+ status: {
69
+ type: String,
70
+ enum: ["pending", "paid", "failed"],
71
+ required: true,
72
+ index: true,
73
+ },
74
+ bankLast4: {
75
+ type: String,
76
+ match: /^[0-9]{4}$/,
77
+ },
78
+ stripeIntentId: {
79
+ type: String,
80
+ index: true,
81
+ },
82
+ source: {
83
+ type: String,
84
+ enum: ["lead-target", "commission"],
85
+ required: true,
86
+ },
87
+ }, {
88
+ timestamps: true,
89
+ versionKey: false,
90
+ });
91
+ exports.Transaction = mongoose_1.default.model("Transaction", transactionSchema);
92
+ exports.default = exports.Transaction;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "orbitx-core-models",
3
- "version": "9.0.3",
3
+ "version": "9.0.4",
4
4
  "description": "Shared Mongoose models and interfaces for OrbitX services",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",