@riocrypto/common 1.0.376 → 1.0.379

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.
@@ -1,105 +1,104 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.BusinessUser = void 0;
7
- const mongoose_1 = __importDefault(require("mongoose"));
8
- const BusinessUserSchema = new mongoose_1.default.Schema({
9
- type: {
10
- type: String,
11
- required: true,
12
- },
13
- companyName: {
14
- type: String,
15
- required: true,
16
- },
17
- legalRepresentative: {
18
- type: String,
19
- required: true,
20
- },
21
- phoneNumber: {
22
- type: String,
23
- required: true,
24
- },
25
- email: {
26
- type: String,
27
- required: true,
28
- },
29
- street1: {
30
- type: String,
31
- required: true,
32
- },
33
- street2: {
34
- type: String,
35
- },
36
- city: {
37
- type: String,
38
- required: true,
39
- },
40
- state: {
41
- type: String,
42
- required: true,
43
- },
44
- postalCode: {
45
- type: String,
46
- required: true,
47
- },
48
- country: {
49
- type: String,
50
- required: true,
51
- },
52
- language: {
53
- type: String,
54
- },
55
- cpf: {
56
- type: String,
57
- },
58
- attributes: [
59
- {
60
- type: String,
61
- },
62
- ],
63
- kycStatus: {
64
- type: String,
65
- required: true,
66
- },
67
- COIFile: {
68
- type: String,
69
- },
70
- KYCReportFile: {
71
- type: String,
72
- },
73
- brokerId: {
74
- type: String,
75
- },
76
- platformFeeRanges: [
77
- {
78
- min: {
79
- type: Number,
80
- required: true,
3
+ exports.buildBusinessUser = void 0;
4
+ const buildBusinessUser = (mongoose) => {
5
+ const BusinessUserSchema = new mongoose.Schema({
6
+ type: {
7
+ type: String,
8
+ required: true,
9
+ },
10
+ companyName: {
11
+ type: String,
12
+ required: true,
13
+ },
14
+ legalRepresentative: {
15
+ type: String,
16
+ required: true,
17
+ },
18
+ phoneNumber: {
19
+ type: String,
20
+ required: true,
21
+ },
22
+ email: {
23
+ type: String,
24
+ required: true,
25
+ },
26
+ street1: {
27
+ type: String,
28
+ required: true,
29
+ },
30
+ street2: {
31
+ type: String,
32
+ },
33
+ city: {
34
+ type: String,
35
+ required: true,
36
+ },
37
+ state: {
38
+ type: String,
39
+ required: true,
40
+ },
41
+ postalCode: {
42
+ type: String,
43
+ required: true,
44
+ },
45
+ country: {
46
+ type: String,
47
+ required: true,
48
+ },
49
+ language: {
50
+ type: String,
51
+ },
52
+ cpf: {
53
+ type: String,
54
+ },
55
+ attributes: [
56
+ {
57
+ type: String,
81
58
  },
82
- max: {
83
- type: Number,
84
- required: true,
59
+ ],
60
+ kycStatus: {
61
+ type: String,
62
+ required: true,
63
+ },
64
+ COIFile: {
65
+ type: String,
66
+ },
67
+ KYCReportFile: {
68
+ type: String,
69
+ },
70
+ brokerId: {
71
+ type: String,
72
+ },
73
+ platformFeeRanges: [
74
+ {
75
+ min: {
76
+ type: Number,
77
+ required: true,
78
+ },
79
+ max: {
80
+ type: Number,
81
+ required: true,
82
+ },
83
+ fee: {
84
+ type: Number,
85
+ required: true,
86
+ },
85
87
  },
86
- fee: {
87
- type: Number,
88
- required: true,
88
+ ],
89
+ }, {
90
+ toJSON: {
91
+ transform(doc, ret) {
92
+ ret.id = ret._id;
93
+ delete ret._id;
94
+ delete ret.__v;
89
95
  },
90
96
  },
91
- ],
92
- }, {
93
- toJSON: {
94
- transform(doc, ret) {
95
- ret.id = ret._id;
96
- delete ret._id;
97
- delete ret.__v;
98
- },
99
- },
100
- });
101
- BusinessUserSchema.statics.build = (attrs) => {
102
- return new BusinessUser(attrs);
97
+ });
98
+ BusinessUserSchema.statics.build = (attrs) => {
99
+ return new BusinessUser(attrs);
100
+ };
101
+ const BusinessUser = mongoose.model("BusinessUser", BusinessUserSchema);
102
+ return BusinessUser;
103
103
  };
104
- const BusinessUser = mongoose_1.default.model("BusinessUser", BusinessUserSchema);
105
- exports.BusinessUser = BusinessUser;
104
+ exports.buildBusinessUser = buildBusinessUser;
@@ -1,4 +1,3 @@
1
- import mongoose from "mongoose";
2
1
  import { Country } from "../types/country";
3
2
  import { Fees } from "../types/fees";
4
3
  import { Fiat } from "../types/fiat";
@@ -9,6 +8,7 @@ import { PayoutMethod } from "../types/payout-method";
9
8
  import { Processor } from "../types/processor";
10
9
  import { Side } from "../types/side";
11
10
  import { USState } from "../types/us-state";
11
+ import { Mongoose, Model, Document } from "mongoose";
12
12
  interface OrderAttrs {
13
13
  userId: string;
14
14
  crypto: Crypto;
@@ -34,7 +34,7 @@ interface OrderAttrs {
34
34
  addressVerified?: boolean;
35
35
  brokerCustomerId?: string;
36
36
  }
37
- interface OrderDoc extends mongoose.Document {
37
+ interface OrderDoc extends Document {
38
38
  userId: string;
39
39
  status: OrderStatus;
40
40
  crypto: Crypto;
@@ -59,8 +59,8 @@ interface OrderDoc extends mongoose.Document {
59
59
  addressVerified?: boolean;
60
60
  brokerCustomerId?: string;
61
61
  }
62
- interface OrderModel extends mongoose.Model<OrderDoc> {
62
+ interface OrderModel extends Model<OrderDoc> {
63
63
  build(attrs: OrderAttrs): OrderDoc;
64
64
  }
65
- declare const Order: OrderModel;
66
- export { Order, OrderDoc };
65
+ declare const buildOrder: (mongoose: Mongoose) => OrderModel;
66
+ export { buildOrder, OrderDoc };
@@ -1,120 +1,119 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.Order = void 0;
7
- const mongoose_1 = __importDefault(require("mongoose"));
8
- const orderSchema = new mongoose_1.default.Schema({
9
- userId: {
10
- type: String,
11
- required: true,
12
- },
13
- status: {
14
- type: String,
15
- required: true,
16
- },
17
- crypto: {
18
- type: String,
19
- required: true,
20
- },
21
- side: {
22
- type: String,
23
- required: true,
24
- },
25
- fiat: {
26
- type: String,
27
- required: true,
28
- },
29
- paymentMethod: {
30
- type: String,
31
- },
32
- payoutMethod: {
33
- type: String,
34
- },
35
- createdAt: {
36
- type: mongoose_1.default.Schema.Types.Date,
37
- required: true,
38
- },
39
- cryptoAddress: {
40
- type: String,
41
- required: true,
42
- },
43
- country: {
44
- type: String,
45
- required: true,
46
- },
47
- state: {
48
- type: String,
49
- required: true,
50
- },
51
- amountFiat: {
52
- type: Number,
53
- },
54
- amountCrypto: {
55
- type: Number,
56
- },
57
- processor: {
58
- type: String,
59
- },
60
- liquidityProvider: {
61
- type: String,
62
- },
63
- depositTxId: {
64
- type: String,
65
- },
66
- withdrawalTxId: {
67
- type: String,
68
- },
69
- depositAddress: {
70
- type: String,
71
- },
72
- fees: {
73
- processingFeeCrypto: {
74
- type: Number,
3
+ exports.buildOrder = void 0;
4
+ const buildOrder = (mongoose) => {
5
+ const orderSchema = new mongoose.Schema({
6
+ userId: {
7
+ type: String,
8
+ required: true,
75
9
  },
76
- transferFeeCrypto: {
77
- type: Number,
10
+ status: {
11
+ type: String,
12
+ required: true,
78
13
  },
79
- platformFeeCrypto: {
80
- type: Number,
14
+ crypto: {
15
+ type: String,
16
+ required: true,
81
17
  },
82
- processingFeeFiat: {
83
- type: Number,
18
+ side: {
19
+ type: String,
20
+ required: true,
21
+ },
22
+ fiat: {
23
+ type: String,
24
+ required: true,
25
+ },
26
+ paymentMethod: {
27
+ type: String,
28
+ },
29
+ payoutMethod: {
30
+ type: String,
31
+ },
32
+ createdAt: {
33
+ type: mongoose.Schema.Types.Date,
34
+ required: true,
35
+ },
36
+ cryptoAddress: {
37
+ type: String,
38
+ required: true,
39
+ },
40
+ country: {
41
+ type: String,
42
+ required: true,
84
43
  },
85
- transferFeeFiat: {
44
+ state: {
45
+ type: String,
46
+ required: true,
47
+ },
48
+ amountFiat: {
86
49
  type: Number,
87
50
  },
88
- platformFeeFiat: {
51
+ amountCrypto: {
89
52
  type: Number,
90
53
  },
91
- partnerFeeFiat: {
54
+ processor: {
55
+ type: String,
56
+ },
57
+ liquidityProvider: {
58
+ type: String,
59
+ },
60
+ depositTxId: {
61
+ type: String,
62
+ },
63
+ withdrawalTxId: {
64
+ type: String,
65
+ },
66
+ depositAddress: {
67
+ type: String,
68
+ },
69
+ fees: {
70
+ processingFeeCrypto: {
71
+ type: Number,
72
+ },
73
+ transferFeeCrypto: {
74
+ type: Number,
75
+ },
76
+ platformFeeCrypto: {
77
+ type: Number,
78
+ },
79
+ processingFeeFiat: {
80
+ type: Number,
81
+ },
82
+ transferFeeFiat: {
83
+ type: Number,
84
+ },
85
+ platformFeeFiat: {
86
+ type: Number,
87
+ },
88
+ partnerFeeFiat: {
89
+ type: Number,
90
+ },
91
+ },
92
+ price: {
92
93
  type: Number,
93
94
  },
94
- },
95
- price: {
96
- type: Number,
97
- },
98
- partnerId: {
99
- type: String,
100
- },
101
- addressVerified: {
102
- type: Boolean,
103
- },
104
- brokerCustomerId: {
105
- type: String,
106
- },
107
- }, {
108
- toJSON: {
109
- transform(doc, ret) {
110
- ret.id = ret._id;
111
- delete ret._id;
112
- delete ret.__v;
113
- },
114
- },
115
- });
116
- orderSchema.statics.build = (attrs) => {
117
- return new Order(attrs);
95
+ partnerId: {
96
+ type: String,
97
+ },
98
+ addressVerified: {
99
+ type: Boolean,
100
+ },
101
+ brokerCustomerId: {
102
+ type: String,
103
+ },
104
+ }, {
105
+ toJSON: {
106
+ transform(doc, ret) {
107
+ ret.id = ret._id;
108
+ delete ret._id;
109
+ delete ret.__v;
110
+ },
111
+ },
112
+ });
113
+ orderSchema.statics.build = (attrs) => {
114
+ return new Order(attrs);
115
+ };
116
+ const Order = mongoose.model("Order", orderSchema);
117
+ return Order;
118
118
  };
119
- const Order = mongoose_1.default.model("Order", orderSchema);
120
- exports.Order = Order;
119
+ exports.buildOrder = buildOrder;
@@ -1,5 +1,5 @@
1
- import mongoose from "mongoose";
2
1
  import { PartnerStatus } from "../types/partner-status";
2
+ import { Mongoose, Document, Model } from "mongoose";
3
3
  interface PartnerAttrs {
4
4
  name: string;
5
5
  status: PartnerStatus;
@@ -13,7 +13,7 @@ interface PartnerAttrs {
13
13
  id: string;
14
14
  }[];
15
15
  }
16
- interface PartnerDoc extends mongoose.Document {
16
+ interface PartnerDoc extends Document {
17
17
  name: string;
18
18
  status: PartnerStatus;
19
19
  partnerFee: number;
@@ -26,8 +26,8 @@ interface PartnerDoc extends mongoose.Document {
26
26
  id: string;
27
27
  }[];
28
28
  }
29
- interface PartnerModel extends mongoose.Model<PartnerDoc> {
29
+ interface PartnerModel extends Model<PartnerDoc> {
30
30
  build(attrs: PartnerAttrs): PartnerDoc;
31
31
  }
32
- declare const Partner: PartnerModel;
33
- export { Partner, PartnerDoc };
32
+ declare const buildPartner: (mongoose: Mongoose) => PartnerModel;
33
+ export { buildPartner, PartnerDoc };
@@ -1,62 +1,61 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.Partner = void 0;
7
- const mongoose_1 = __importDefault(require("mongoose"));
8
- const PartnerSchema = new mongoose_1.default.Schema({
9
- name: {
10
- type: String,
11
- required: true,
12
- },
13
- status: {
14
- type: String,
15
- required: true,
16
- },
17
- partnerFee: {
18
- type: Number,
19
- required: true,
20
- },
21
- platformFee: {
22
- type: Number,
23
- required: true,
24
- },
25
- color: {
26
- type: String,
27
- },
28
- logo: {
29
- type: String,
30
- },
31
- apiKeys: [
32
- {
33
- value: {
34
- type: String,
35
- required: true,
36
- },
37
- label: {
38
- type: String,
3
+ exports.buildPartner = void 0;
4
+ const buildPartner = (mongoose) => {
5
+ const PartnerSchema = new mongoose.Schema({
6
+ name: {
7
+ type: String,
8
+ required: true,
9
+ },
10
+ status: {
11
+ type: String,
12
+ required: true,
13
+ },
14
+ partnerFee: {
15
+ type: Number,
16
+ required: true,
17
+ },
18
+ platformFee: {
19
+ type: Number,
20
+ required: true,
21
+ },
22
+ color: {
23
+ type: String,
24
+ },
25
+ logo: {
26
+ type: String,
27
+ },
28
+ apiKeys: [
29
+ {
30
+ value: {
31
+ type: String,
32
+ required: true,
33
+ },
34
+ label: {
35
+ type: String,
36
+ },
37
+ id: {
38
+ type: String,
39
+ required: true,
40
+ },
39
41
  },
40
- id: {
41
- type: String,
42
- required: true,
42
+ ],
43
+ }, {
44
+ toJSON: {
45
+ transform(doc, ret) {
46
+ ret.id = ret._id;
47
+ delete ret._id;
48
+ delete ret.__v;
49
+ ret.apiKeys.forEach((apiKey) => {
50
+ delete apiKey.value;
51
+ });
43
52
  },
44
53
  },
45
- ],
46
- }, {
47
- toJSON: {
48
- transform(doc, ret) {
49
- ret.id = ret._id;
50
- delete ret._id;
51
- delete ret.__v;
52
- ret.apiKeys.forEach((apiKey) => {
53
- delete apiKey.value;
54
- });
55
- },
56
- },
57
- });
58
- PartnerSchema.statics.build = (attrs) => {
59
- return new Partner(attrs);
54
+ });
55
+ PartnerSchema.statics.build = (attrs) => {
56
+ return new Partner(attrs);
57
+ };
58
+ const Partner = mongoose.model("Partner", PartnerSchema);
59
+ return Partner;
60
60
  };
61
- const Partner = mongoose_1.default.model("Partner", PartnerSchema);
62
- exports.Partner = Partner;
61
+ exports.buildPartner = buildPartner;
@@ -1,10 +1,10 @@
1
- import mongoose from "mongoose";
2
1
  import { Country } from "../types/country";
3
2
  import { KYCStatus } from "../types/kyc-status";
4
3
  import { Language } from "../types/language";
5
4
  import { USState } from "../types/us-state";
6
5
  import { UserAttribute } from "../types/user-attribute";
7
6
  import { UserType } from "../types/user-type";
7
+ import { Mongoose, Model, Document } from "mongoose";
8
8
  interface UserAttrs {
9
9
  type: UserType;
10
10
  firstName: string;
@@ -24,10 +24,11 @@ interface UserAttrs {
24
24
  attributes?: UserAttribute[];
25
25
  partnerId?: string;
26
26
  }
27
- interface UserModel extends mongoose.Model<UserDoc> {
27
+ interface UserModel extends Model<UserDoc> {
28
28
  build(attrs: UserAttrs): UserDoc;
29
29
  }
30
- interface UserDoc extends mongoose.Document {
30
+ interface UserDoc extends Document {
31
+ _id: string;
31
32
  type: UserType;
32
33
  firstName: string;
33
34
  lastName: string;
@@ -46,5 +47,5 @@ interface UserDoc extends mongoose.Document {
46
47
  attributes?: UserAttribute[];
47
48
  partnerId?: string;
48
49
  }
49
- declare const User: UserModel;
50
- export { User, UserDoc };
50
+ declare const buildUser: (mongoose: Mongoose) => UserModel;
51
+ export { buildUser, UserDoc };