@riocrypto/common-server 1.0.2591 → 1.0.2593

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.
@@ -3,14 +3,14 @@ declare global {
3
3
  namespace Express {
4
4
  interface Request {
5
5
  adminContext?: {
6
- adminId: string;
7
- adminEmail: string;
8
- adminName: string;
6
+ adminAuthId: string;
7
+ adminAuthEmail: string;
8
+ adminAuthName: string;
9
9
  };
10
10
  userContext?: {
11
- userId: string;
12
- phoneNumber: string;
13
- userName: string;
11
+ authId: string;
12
+ authPhoneNumber: string;
13
+ authName: string;
14
14
  };
15
15
  }
16
16
  }
@@ -34,9 +34,9 @@ const authContextMiddleware = (req, res, next) => __awaiter(void 0, void 0, void
34
34
  const adminAuth = yield AdminAuth.findById(decoded.id);
35
35
  if (adminAuth) {
36
36
  req.adminContext = {
37
- adminId: decoded.id,
38
- adminEmail: decoded.email,
39
- adminName: (0, common_1.getAuthName)(adminAuth.toJSON()),
37
+ adminAuthId: decoded.id,
38
+ adminAuthEmail: decoded.email,
39
+ adminAuthName: (0, common_1.getAuthName)(adminAuth.toJSON()),
40
40
  };
41
41
  }
42
42
  }
@@ -54,9 +54,9 @@ const authContextMiddleware = (req, res, next) => __awaiter(void 0, void 0, void
54
54
  const auth = yield Auth.findById(decoded.id);
55
55
  if (auth) {
56
56
  req.userContext = {
57
- userId: decoded.id,
58
- phoneNumber: decoded.phoneNumber,
59
- userName: (0, common_1.getAuthName)(auth.toJSON()),
57
+ authId: decoded.id,
58
+ authPhoneNumber: decoded.phoneNumber,
59
+ authName: (0, common_1.getAuthName)(auth.toJSON()),
60
60
  };
61
61
  }
62
62
  }
@@ -0,0 +1,34 @@
1
+ import { TreasuryProvider, Fiat } from "@riocrypto/common";
2
+ import { Mongoose, Model, Document } from "mongoose";
3
+ interface UnrecognizedCryptoPaymentAttrs {
4
+ createdAt: Date;
5
+ amount: number;
6
+ fiat: Fiat;
7
+ originAccountHolderName: string;
8
+ originAccountNumber?: string;
9
+ originCLABE?: string;
10
+ originBank?: string;
11
+ originCCI?: string;
12
+ reference?: string;
13
+ destinationTreasuryProvider?: TreasuryProvider;
14
+ destinationProviderId?: string;
15
+ }
16
+ interface UnrecognizedCryptoPaymentDoc extends Document {
17
+ id: string;
18
+ createdAt: Date;
19
+ amount: number;
20
+ fiat: Fiat;
21
+ originAccountHolderName: string;
22
+ originAccountNumber?: string;
23
+ originCLABE?: string;
24
+ originBank?: string;
25
+ originCCI?: string;
26
+ reference?: string;
27
+ destinationTreasuryProvider?: TreasuryProvider;
28
+ destinationProviderId?: string;
29
+ }
30
+ interface UnrecognizedCryptoPaymentModel extends Model<UnrecognizedCryptoPaymentDoc> {
31
+ build(attrs: UnrecognizedCryptoPaymentAttrs): UnrecognizedCryptoPaymentDoc;
32
+ }
33
+ declare const buildUnrecognizedCryptoPayment: (mongoose: Mongoose) => UnrecognizedCryptoPaymentModel;
34
+ export { buildUnrecognizedCryptoPayment, UnrecognizedCryptoPaymentDoc, UnrecognizedCryptoPaymentAttrs, };
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildUnrecognizedCryptoPayment = void 0;
4
+ const common_1 = require("@riocrypto/common");
5
+ const buildUnrecognizedCryptoPayment = (mongoose) => {
6
+ // if model is already defined, return it
7
+ if (mongoose.models.UnrecognizedCryptoPayment) {
8
+ return mongoose.model("UnrecognizedCryptoPayment");
9
+ }
10
+ const UnrecognizedCryptoPaymentSchema = new mongoose.Schema({
11
+ createdAt: {
12
+ type: Date,
13
+ required: true,
14
+ },
15
+ amount: {
16
+ type: Number,
17
+ required: true,
18
+ },
19
+ fiat: {
20
+ type: String,
21
+ required: true,
22
+ enum: Object.values(common_1.Crypto),
23
+ },
24
+ originAccountHolderName: {
25
+ type: String,
26
+ required: true,
27
+ },
28
+ originAccountNumber: {
29
+ type: String,
30
+ },
31
+ originCLABE: {
32
+ type: String,
33
+ },
34
+ originBank: {
35
+ type: String,
36
+ },
37
+ originCCI: {
38
+ type: String,
39
+ },
40
+ reference: {
41
+ type: String,
42
+ },
43
+ destinationTreasuryProvider: {
44
+ type: String,
45
+ enum: Object.values(common_1.TreasuryProvider),
46
+ },
47
+ destinationProviderId: {
48
+ type: String,
49
+ },
50
+ }, {
51
+ toJSON: {
52
+ transform(doc, ret) {
53
+ ret.id = ret._id.valueOf();
54
+ delete ret._id;
55
+ delete ret.__v;
56
+ },
57
+ },
58
+ });
59
+ UnrecognizedCryptoPaymentSchema.statics.build = (attrs) => {
60
+ return new UnrecognizedCryptoPayment(attrs);
61
+ };
62
+ const UnrecognizedCryptoPayment = mongoose.model("UnrecognizedCryptoPayment", UnrecognizedCryptoPaymentSchema);
63
+ return UnrecognizedCryptoPayment;
64
+ };
65
+ exports.buildUnrecognizedCryptoPayment = buildUnrecognizedCryptoPayment;
@@ -0,0 +1,32 @@
1
+ import { TreasuryProvider, Crypto, UnrecognizedCryptoPaymentDestinationType } from "@riocrypto/common";
2
+ import { Mongoose, Model, Document } from "mongoose";
3
+ interface UnrecognizedCryptoPaymentAttrs {
4
+ createdAt: Date;
5
+ amount: number;
6
+ crypto: Crypto;
7
+ originBlockchainAddress: string;
8
+ destinationBlockchainAddress: string;
9
+ blockchainTxId: string;
10
+ destinationType: UnrecognizedCryptoPaymentDestinationType;
11
+ destinationTreasuryProvider?: TreasuryProvider;
12
+ destinationTransactionalFireblocksVaultId?: string;
13
+ destinationProviderId?: string;
14
+ }
15
+ interface UnrecognizedCryptoPaymentDoc extends Document {
16
+ id: string;
17
+ createdAt: Date;
18
+ amount: number;
19
+ crypto: Crypto;
20
+ originBlockchainAddress: string;
21
+ destinationBlockchainAddress: string;
22
+ blockchainTxId: string;
23
+ destinationType: UnrecognizedCryptoPaymentDestinationType;
24
+ destinationTreasuryProvider?: TreasuryProvider;
25
+ destinationTransactionalFireblocksVaultId?: string;
26
+ destinationProviderId?: string;
27
+ }
28
+ interface UnrecognizedCryptoPaymentModel extends Model<UnrecognizedCryptoPaymentDoc> {
29
+ build(attrs: UnrecognizedCryptoPaymentAttrs): UnrecognizedCryptoPaymentDoc;
30
+ }
31
+ declare const buildUnrecognizedCryptoPayment: (mongoose: Mongoose) => UnrecognizedCryptoPaymentModel;
32
+ export { buildUnrecognizedCryptoPayment, UnrecognizedCryptoPaymentDoc, UnrecognizedCryptoPaymentAttrs, };
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildUnrecognizedCryptoPayment = void 0;
4
+ const common_1 = require("@riocrypto/common");
5
+ const buildUnrecognizedCryptoPayment = (mongoose) => {
6
+ // if model is already defined, return it
7
+ if (mongoose.models.UnrecognizedCryptoPayment) {
8
+ return mongoose.model("UnrecognizedCryptoPayment");
9
+ }
10
+ const UnrecognizedCryptoPaymentSchema = new mongoose.Schema({
11
+ createdAt: {
12
+ type: Date,
13
+ required: true,
14
+ },
15
+ amount: {
16
+ type: Number,
17
+ required: true,
18
+ },
19
+ crypto: {
20
+ type: String,
21
+ required: true,
22
+ enum: Object.values(common_1.Crypto),
23
+ },
24
+ originBlockchainAddress: {
25
+ type: String,
26
+ required: true,
27
+ },
28
+ destinationBlockchainAddress: {
29
+ type: String,
30
+ required: true,
31
+ },
32
+ blockchainTxId: {
33
+ type: String,
34
+ required: true,
35
+ },
36
+ destinationType: {
37
+ type: String,
38
+ required: true,
39
+ enum: Object.values(common_1.UnrecognizedCryptoPaymentDestinationType),
40
+ },
41
+ destinationTreasuryProvider: {
42
+ type: String,
43
+ enum: Object.values(common_1.TreasuryProvider),
44
+ },
45
+ destinationTransactionalFireblocksVaultId: {
46
+ type: String,
47
+ },
48
+ destinationProviderId: {
49
+ type: String,
50
+ },
51
+ }, {
52
+ toJSON: {
53
+ transform(doc, ret) {
54
+ ret.id = ret._id.valueOf();
55
+ delete ret._id;
56
+ delete ret.__v;
57
+ },
58
+ },
59
+ });
60
+ UnrecognizedCryptoPaymentSchema.statics.build = (attrs) => {
61
+ return new UnrecognizedCryptoPayment(attrs);
62
+ };
63
+ const UnrecognizedCryptoPayment = mongoose.model("UnrecognizedCryptoPayment", UnrecognizedCryptoPaymentSchema);
64
+ return UnrecognizedCryptoPayment;
65
+ };
66
+ exports.buildUnrecognizedCryptoPayment = buildUnrecognizedCryptoPayment;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common-server",
3
- "version": "1.0.2591",
3
+ "version": "1.0.2593",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",
@@ -28,7 +28,7 @@
28
28
  "@google-cloud/secret-manager": "^5.3.0",
29
29
  "@google-cloud/storage": "^6.9.5",
30
30
  "@hyperdx/node-opentelemetry": "^0.7.0",
31
- "@riocrypto/common": "^1.0.2388",
31
+ "@riocrypto/common": "^1.0.2389",
32
32
  "@types/express": "^4.17.13",
33
33
  "axios": "^1.7.4",
34
34
  "crypto-js": "^4.2.0",