@azteam/express 1.2.286 → 1.2.287

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.
@@ -10,7 +10,7 @@ var _express = _interopRequireDefault(require("express"));
10
10
  var _socket = _interopRequireDefault(require("socket.io"));
11
11
  var _bodyParser = _interopRequireDefault(require("body-parser"));
12
12
  var _cookieParser = _interopRequireDefault(require("cookie-parser"));
13
- var _socket2 = _interopRequireDefault(require("socket.io-redis"));
13
+ var _redisAdapter = require("@socket.io/redis-adapter");
14
14
  var _lodash = _interopRequireDefault(require("lodash"));
15
15
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
16
16
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
@@ -142,7 +142,7 @@ var SocketServer = /*#__PURE__*/function () {
142
142
  }
143
143
  });
144
144
  if (this.options.redisConfig) {
145
- io.adapter((0, _socket2["default"])(this.options.redisConfig));
145
+ io.adapter((0, _redisAdapter.createAdapter)(this.options.redisConfig));
146
146
  }
147
147
  var msg = [];
148
148
  _lodash["default"].map(this.controllers, function (obj) {
package/lib/index.js CHANGED
@@ -47,18 +47,6 @@ Object.keys(_constant).forEach(function (key) {
47
47
  }
48
48
  });
49
49
  });
50
- var _validate = require("./validate");
51
- Object.keys(_validate).forEach(function (key) {
52
- if (key === "default" || key === "__esModule") return;
53
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
54
- if (key in exports && exports[key] === _validate[key]) return;
55
- Object.defineProperty(exports, key, {
56
- enumerable: true,
57
- get: function get() {
58
- return _validate[key];
59
- }
60
- });
61
- });
62
50
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
63
51
  var _default = _Server["default"];
64
52
  exports["default"] = _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azteam/express",
3
- "version": "1.2.286",
3
+ "version": "1.2.287",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./src/index.js",
6
6
  "scripts": {
@@ -22,7 +22,6 @@
22
22
  "express": "4.17.1",
23
23
  "express-async-errors": "3.1.1",
24
24
  "express-rate-limit": "5.1.3",
25
- "fastest-validator": "1.8.0",
26
25
  "helmet": "3.21.2",
27
26
  "jsonwebtoken": "8.2.1",
28
27
  "lodash": "4.17.21",
@@ -30,6 +29,6 @@
30
29
  "morgan": "1.10.0",
31
30
  "psl": "1.8.0",
32
31
  "socket.io": "4.4.1",
33
- "socket.io-redis": "6.1.0"
32
+ "@socket.io/redis-adapter": "6.1.0"
34
33
  }
35
34
  }
@@ -4,7 +4,7 @@ import express from 'express';
4
4
  import socketIO from 'socket.io';
5
5
  import bodyParser from 'body-parser';
6
6
  import cookieParser from 'cookie-parser';
7
- import redisAdapter from 'socket.io-redis';
7
+ import {createAdapter} from '@socket.io/redis-adapter';
8
8
  import _ from 'lodash';
9
9
 
10
10
  const wrap = (middleware) => (socket, next) => middleware(socket.request, {}, next);
@@ -95,7 +95,7 @@ class SocketServer {
95
95
  });
96
96
 
97
97
  if (this.options.redisConfig) {
98
- io.adapter(redisAdapter(this.options.redisConfig));
98
+ io.adapter(createAdapter(this.options.redisConfig));
99
99
  }
100
100
 
101
101
  const msg = [];
package/src/index.js CHANGED
@@ -5,7 +5,6 @@ import AdminController from './AdminController';
5
5
 
6
6
  export * from './middleware';
7
7
  export * from './constant';
8
- export * from './validate';
9
8
 
10
9
  export {Controller, AdminController};
11
10
 
package/src/validate.js DELETED
@@ -1,161 +0,0 @@
1
- export const schemaId = (optional = false) => ({
2
- type: 'string',
3
- length: 24,
4
- pattern: /^[A-Fa-f0-9]{24}$/,
5
- optional,
6
- });
7
-
8
- export const schemaEmail = (optional = false) => ({
9
- type: 'email',
10
- optional,
11
- });
12
-
13
- export const schemaUrl = (optional = false) => ({
14
- type: 'url',
15
- optional,
16
- });
17
-
18
- export const schemaBoolean = (optional = false) => ({
19
- type: 'boolean',
20
- convert: true,
21
- optional,
22
- });
23
-
24
- export const schemaDate = (optional = false) => ({
25
- type: 'number',
26
- convert: true,
27
- integer: true,
28
- optional,
29
- });
30
-
31
- export const schemaNumber = (optional = false) => ({
32
- type: 'number',
33
- convert: true,
34
- optional,
35
- });
36
- export const schemaInteger = (min = 0, max = 999999999, optional = false) => ({
37
- type: 'number',
38
- integer: true,
39
- convert: true,
40
- min,
41
- max,
42
- optional,
43
- });
44
-
45
- export const schemaString = (min = 1, max = 255, optional = false) => ({
46
- type: 'string',
47
- convert: true,
48
- trim: true,
49
- min,
50
- max,
51
- optional,
52
- });
53
- export const schemaPassword = (optional = false) => ({
54
- type: 'string',
55
- convert: true,
56
- min: 6,
57
- max: 32,
58
- optional,
59
- });
60
- export const schemaOTP = (optional = false) => ({
61
- type: 'string',
62
- length: 6,
63
- pattern: /\d+/,
64
- optional,
65
- });
66
- export const schemaIPv4 = (optional = false) => ({
67
- type: 'string',
68
- pattern: /^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}$/,
69
- optional,
70
- });
71
-
72
- export const schemaImage = (optional = false) => ({
73
- type: 'string',
74
- max: 255,
75
- optional,
76
- });
77
- export const schemaVideo = (optional = false) => ({
78
- type: 'string',
79
- max: 255,
80
- optional,
81
- });
82
- export const schemaPhoneNumber = (optional = false) => ({
83
- type: 'string',
84
- length: 10,
85
- pattern: /^((09|03|07|08|05)+([0-9]{8})\b)$/,
86
- optional,
87
- });
88
- export const schemaSlug = (optional = false) => ({
89
- type: 'string',
90
- convert: true,
91
- pattern: /[A-Za-z0-9_-]+/,
92
- lowercase: true,
93
- max: 300,
94
- optional,
95
- });
96
-
97
- export const schemaKey = (optional = false) => ({
98
- type: 'string',
99
- convert: true,
100
- pattern: /[A-Za-z0-9_-]+/,
101
- uppercase: true,
102
- max: 300,
103
- optional,
104
- });
105
-
106
- export const schemaVersion = (optional = false) => ({
107
- type: 'string',
108
- pattern: /^(\d+)\.(\d+)\.(\d+)$/,
109
- max: 300,
110
- optional,
111
- });
112
- export const schemaArray = (items, optional = false) => ({
113
- type: 'array',
114
- items,
115
- default: [],
116
- optional,
117
- });
118
- export const schemaJSON = (optional = false) => ({
119
- type: 'json',
120
- optional,
121
- });
122
-
123
- export const schemaGallery = (optional = false) => ({
124
- type: 'array',
125
- items: schemaImage(),
126
- optional,
127
- });
128
-
129
- export const schemaObject = (props = {}, optional = false) => ({
130
- type: 'object',
131
- strict: 'remove',
132
- props,
133
- optional,
134
- });
135
-
136
- export const schemaEnum = (values, optional = false) => ({
137
- type: 'enum',
138
- values,
139
- optional,
140
- });
141
-
142
- /* rules */
143
- export const rulesId = {
144
- id: schemaId(),
145
- };
146
- export const rulesSlug = {
147
- slug: schemaSlug(),
148
- };
149
- export const rulesKey = {
150
- key: schemaKey(),
151
- };
152
-
153
- export const rulesMetadata = {
154
- metadata_disable: schemaBoolean(true),
155
- metadata_title: schemaString(0, 255, true),
156
- metadata_title_og: schemaString(0, 255, true),
157
- metadata_description: schemaString(0, 255, true),
158
- metadata_description_og: schemaString(0, 255, true),
159
- metadata_keywords: schemaString(0, 255, true),
160
- metadata_image_url: schemaImage(true),
161
- };