@riocrypto/common-server 1.0.2915 → 1.0.2917
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/build/index.d.ts +9 -9
- package/build/index.js +10 -9
- package/build/models/STP-mxn-withdrawal.js +8 -0
- package/build/models/auth.js +4 -0
- package/build/models/user.js +3 -0
- package/package.json +1 -1
package/build/index.d.ts
CHANGED
|
@@ -159,15 +159,6 @@ export * from "./clients/cosigner-client";
|
|
|
159
159
|
export * from "./clients/bitso-client";
|
|
160
160
|
export * from "./clients/circle-client";
|
|
161
161
|
export * from "./clients/coincover-client";
|
|
162
|
-
export * from "./clients/google-sheets-api-client";
|
|
163
|
-
export * from "./clients/binance-client";
|
|
164
|
-
export * from "./clients/kraken-client";
|
|
165
|
-
export * from "./helpers/get-user-helper";
|
|
166
|
-
export * from "./helpers/get-processor-fees";
|
|
167
|
-
export * from "./helpers/get-network-fees";
|
|
168
|
-
export * from "./helpers/calculate-aggregate-volume-and-revenue";
|
|
169
|
-
export * from "./helpers/calculate-volume-and-revenue";
|
|
170
|
-
export * from "./helpers/get-user";
|
|
171
162
|
export * from "./helpers/unescape";
|
|
172
163
|
export * from "./helpers/sanitize-user-doc";
|
|
173
164
|
export * from "./helpers/sanitize-bank-account-doc";
|
|
@@ -201,3 +192,12 @@ export * from "./helpers/find-user-tier-forward-curve-rate";
|
|
|
201
192
|
export * from "./helpers/resolve-forward-curve-rate";
|
|
202
193
|
export * from "./helpers/get-resolved-forward-curve-tiers";
|
|
203
194
|
export * from "./helpers/get-fx-trading-policy";
|
|
195
|
+
export * from "./clients/google-sheets-api-client";
|
|
196
|
+
export * from "./clients/binance-client";
|
|
197
|
+
export * from "./clients/kraken-client";
|
|
198
|
+
export * from "./helpers/get-user-helper";
|
|
199
|
+
export * from "./helpers/get-processor-fees";
|
|
200
|
+
export * from "./helpers/get-network-fees";
|
|
201
|
+
export * from "./helpers/calculate-aggregate-volume-and-revenue";
|
|
202
|
+
export * from "./helpers/calculate-volume-and-revenue";
|
|
203
|
+
export * from "./helpers/get-user";
|
package/build/index.js
CHANGED
|
@@ -175,15 +175,6 @@ __exportStar(require("./clients/cosigner-client"), exports);
|
|
|
175
175
|
__exportStar(require("./clients/bitso-client"), exports);
|
|
176
176
|
__exportStar(require("./clients/circle-client"), exports);
|
|
177
177
|
__exportStar(require("./clients/coincover-client"), exports);
|
|
178
|
-
__exportStar(require("./clients/google-sheets-api-client"), exports);
|
|
179
|
-
__exportStar(require("./clients/binance-client"), exports);
|
|
180
|
-
__exportStar(require("./clients/kraken-client"), exports);
|
|
181
|
-
__exportStar(require("./helpers/get-user-helper"), exports);
|
|
182
|
-
__exportStar(require("./helpers/get-processor-fees"), exports);
|
|
183
|
-
__exportStar(require("./helpers/get-network-fees"), exports);
|
|
184
|
-
__exportStar(require("./helpers/calculate-aggregate-volume-and-revenue"), exports);
|
|
185
|
-
__exportStar(require("./helpers/calculate-volume-and-revenue"), exports);
|
|
186
|
-
__exportStar(require("./helpers/get-user"), exports);
|
|
187
178
|
__exportStar(require("./helpers/unescape"), exports);
|
|
188
179
|
__exportStar(require("./helpers/sanitize-user-doc"), exports);
|
|
189
180
|
__exportStar(require("./helpers/sanitize-bank-account-doc"), exports);
|
|
@@ -217,3 +208,13 @@ __exportStar(require("./helpers/find-user-tier-forward-curve-rate"), exports);
|
|
|
217
208
|
__exportStar(require("./helpers/resolve-forward-curve-rate"), exports);
|
|
218
209
|
__exportStar(require("./helpers/get-resolved-forward-curve-tiers"), exports);
|
|
219
210
|
__exportStar(require("./helpers/get-fx-trading-policy"), exports);
|
|
211
|
+
;
|
|
212
|
+
__exportStar(require("./clients/google-sheets-api-client"), exports);
|
|
213
|
+
__exportStar(require("./clients/binance-client"), exports);
|
|
214
|
+
__exportStar(require("./clients/kraken-client"), exports);
|
|
215
|
+
__exportStar(require("./helpers/get-user-helper"), exports);
|
|
216
|
+
__exportStar(require("./helpers/get-processor-fees"), exports);
|
|
217
|
+
__exportStar(require("./helpers/get-network-fees"), exports);
|
|
218
|
+
__exportStar(require("./helpers/calculate-aggregate-volume-and-revenue"), exports);
|
|
219
|
+
__exportStar(require("./helpers/calculate-volume-and-revenue"), exports);
|
|
220
|
+
__exportStar(require("./helpers/get-user"), exports);
|
|
@@ -71,6 +71,14 @@ const buildSTPMXNWithdrawal = (mongoose) => {
|
|
|
71
71
|
},
|
|
72
72
|
},
|
|
73
73
|
});
|
|
74
|
+
// The STP withdrawal webhook resolves the document from the id nested in this
|
|
75
|
+
// array. Unindexed it is a collection scan, which is what let STP time out
|
|
76
|
+
// waiting on us and redeliver the same notification.
|
|
77
|
+
STPMXNWithdrawalSchema.index({ "STPWithdrawals.STPWithdrawalId": 1 });
|
|
78
|
+
// Both are looked up on the payout path before every withdrawal and on every
|
|
79
|
+
// cosigner notification.
|
|
80
|
+
STPMXNWithdrawalSchema.index({ orderId: 1 });
|
|
81
|
+
STPMXNWithdrawalSchema.index({ bulkBankPayoutId: 1 });
|
|
74
82
|
STPMXNWithdrawalSchema.statics.build = (attrs) => {
|
|
75
83
|
return new STPMXNWithdrawal(attrs);
|
|
76
84
|
};
|
package/build/models/auth.js
CHANGED
|
@@ -208,6 +208,10 @@ const buildAuth = (mongoose) => {
|
|
|
208
208
|
unique: true,
|
|
209
209
|
partialFilterExpression: { phoneNumber: { $type: "string" } },
|
|
210
210
|
});
|
|
211
|
+
// API key validation runs before every authenticated request. Without this
|
|
212
|
+
// an unrecognised key costs a full collection scan, which is also a denial
|
|
213
|
+
// of service vector on the unauthenticated edge.
|
|
214
|
+
AuthSchema.index({ "apiKeys.value": 1 });
|
|
211
215
|
const Auth = mongoose.model("Auth", AuthSchema);
|
|
212
216
|
return Auth;
|
|
213
217
|
};
|
package/build/models/user.js
CHANGED
|
@@ -255,6 +255,9 @@ const buildUser = (mongoose) => {
|
|
|
255
255
|
userSchema.index({ brokerId: 1 });
|
|
256
256
|
// Serves the unfiltered admin listing, which sorts on createdAt alone.
|
|
257
257
|
userSchema.index({ createdAt: -1, _id: -1 });
|
|
258
|
+
// Resolving the user from the auth record runs on every authenticated
|
|
259
|
+
// request, so this stays on the hot path for the whole API.
|
|
260
|
+
userSchema.index({ authIds: 1 });
|
|
258
261
|
userSchema.statics.build = (attrs) => {
|
|
259
262
|
return new User(attrs);
|
|
260
263
|
};
|