@riocrypto/common-server 1.0.1522 → 1.0.1524

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 CHANGED
@@ -10,6 +10,8 @@ export * from "./services/apiKey";
10
10
  export * from "./services/password";
11
11
  export * from "./services/logger";
12
12
  export * from "./validators/require-admin-auth";
13
+ export * from "./validators/require-if-user-type";
14
+ export * from "./sanitizers/capitalize-first-letter";
13
15
  export * from "./models/admin-auth";
14
16
  export * from "./models/auth";
15
17
  export * from "./models/bank-payout";
package/build/index.js CHANGED
@@ -26,6 +26,8 @@ __exportStar(require("./services/apiKey"), exports);
26
26
  __exportStar(require("./services/password"), exports);
27
27
  __exportStar(require("./services/logger"), exports);
28
28
  __exportStar(require("./validators/require-admin-auth"), exports);
29
+ __exportStar(require("./validators/require-if-user-type"), exports);
30
+ __exportStar(require("./sanitizers/capitalize-first-letter"), exports);
29
31
  __exportStar(require("./models/admin-auth"), exports);
30
32
  __exportStar(require("./models/auth"), exports);
31
33
  __exportStar(require("./models/bank-payout"), exports);
@@ -0,0 +1 @@
1
+ export declare const capitalizeFirstLetter: (input: string) => string;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.capitalizeFirstLetter = void 0;
4
+ const capitalizeFirstLetter = (input) => {
5
+ return input.charAt(0).toUpperCase() + input.slice(1).toLowerCase();
6
+ };
7
+ exports.capitalizeFirstLetter = capitalizeFirstLetter;
@@ -0,0 +1,3 @@
1
+ import { UserType } from "@riocrypto/common";
2
+ import { CustomValidator } from "express-validator";
3
+ export declare const requireIfUserType: (typeValue: UserType) => CustomValidator;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.requireIfUserType = void 0;
4
+ const requireIfUserType = (typeValue) => {
5
+ return (value, { req, location, path }) => {
6
+ if (req.body.type === typeValue && value === undefined) {
7
+ throw new Error(`${path.charAt(0).toUpperCase() + path.slice(1)} is required when type is ${typeValue}`);
8
+ }
9
+ return true;
10
+ };
11
+ };
12
+ exports.requireIfUserType = requireIfUserType;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common-server",
3
- "version": "1.0.1522",
3
+ "version": "1.0.1524",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",
@@ -28,7 +28,7 @@
28
28
  "@google-cloud/storage": "^6.9.5",
29
29
  "@google-cloud/vision": "^4.0.2",
30
30
  "@hyperdx/node-opentelemetry": "^0.4.2",
31
- "@riocrypto/common": "^1.0.1362",
31
+ "@riocrypto/common": "^1.0.1365",
32
32
  "@types/express": "^4.17.13",
33
33
  "axios": "^0.27.2",
34
34
  "ccxt": "^3.0.30",