@armi-wave/common 1.4.0 → 1.7.0

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.
Files changed (39) hide show
  1. package/build/enums/AccountType.d.ts +5 -0
  2. package/build/enums/AccountType.js +9 -0
  3. package/build/enums/PaidPlan.d.ts +3 -0
  4. package/build/enums/PaidPlan.js +7 -0
  5. package/build/enums/PostType.d.ts +7 -0
  6. package/build/enums/PostType.js +11 -0
  7. package/build/errors/bad-request-error.d.ts +9 -0
  8. package/build/errors/bad-request-error.js +18 -0
  9. package/build/errors/custom-error.d.ts +8 -0
  10. package/build/errors/custom-error.js +9 -0
  11. package/build/errors/database-connection-error.d.ts +9 -0
  12. package/build/errors/database-connection-error.js +22 -0
  13. package/build/errors/not-authorized-error.d.ts +8 -0
  14. package/build/errors/not-authorized-error.js +21 -0
  15. package/build/errors/not-found-error.d.ts +8 -0
  16. package/build/errors/not-found-error.js +21 -0
  17. package/build/errors/request-validation-error.d.ts +11 -0
  18. package/build/errors/request-validation-error.js +23 -0
  19. package/build/index.d.ts +14 -1
  20. package/build/index.js +35 -1
  21. package/build/middlewares/current-user.d.ts +14 -0
  22. package/build/middlewares/current-user.js +17 -0
  23. package/build/middlewares/error-handler.d.ts +2 -0
  24. package/build/middlewares/error-handler.js +17 -0
  25. package/build/middlewares/require-auth.d.ts +2 -0
  26. package/build/middlewares/require-auth.js +14 -0
  27. package/build/middlewares/validate-request.d.ts +2 -0
  28. package/build/middlewares/validate-request.js +16 -0
  29. package/build/models/Comment.d.ts +26 -0
  30. package/build/models/Comment.js +53 -0
  31. package/build/models/Post.d.ts +31 -0
  32. package/build/models/Post.js +61 -0
  33. package/build/models/User.d.ts +21 -17
  34. package/build/models/User.js +4 -0
  35. package/build/utils/CountryCodes.d.ts +5 -0
  36. package/build/utils/CountryCodes.js +1215 -0
  37. package/build/utils/CountryUtils.d.ts +5 -0
  38. package/build/utils/CountryUtils.js +42 -0
  39. package/package.json +7 -2
@@ -0,0 +1,5 @@
1
+ export default class CountryUtils {
2
+ static isValidCode(code: string): Promise<true | undefined>;
3
+ static isValidDialCode(dialCode: string): Promise<true | undefined>;
4
+ static getNameFromCode(code: string): Promise<string | undefined>;
5
+ }
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const countryCodes_1 = require("./countryCodes");
13
+ class CountryUtils {
14
+ static isValidCode(code) {
15
+ return __awaiter(this, void 0, void 0, function* () {
16
+ for (const country of countryCodes_1.countries) {
17
+ if (country.code == code) {
18
+ return true;
19
+ }
20
+ }
21
+ });
22
+ }
23
+ static isValidDialCode(dialCode) {
24
+ return __awaiter(this, void 0, void 0, function* () {
25
+ for (const country of countryCodes_1.countries) {
26
+ if (country.dialCode == dialCode) {
27
+ return true;
28
+ }
29
+ }
30
+ });
31
+ }
32
+ static getNameFromCode(code) {
33
+ return __awaiter(this, void 0, void 0, function* () {
34
+ for (const country of countryCodes_1.countries) {
35
+ if (country.code == code) {
36
+ return country.name;
37
+ }
38
+ }
39
+ });
40
+ }
41
+ }
42
+ exports.default = CountryUtils;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@armi-wave/common",
3
- "version": "1.4.0",
3
+ "version": "1.7.0",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",
@@ -13,5 +13,10 @@
13
13
  "pub": "git add . && git commit -m \"Updates\" && npm version feature && npm run build && npm publish"
14
14
  },
15
15
  "author": "Armiron Kurbalaj",
16
- "license": "ISC"
16
+ "license": "ISC",
17
+ "dependencies": {
18
+ "express": "^4.18.1",
19
+ "express-validator": "^6.14.2",
20
+ "jsonwebtoken": "^8.5.1"
21
+ }
17
22
  }