typed-bridge 2.0.14 → 2.0.15

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.
@@ -27,7 +27,7 @@ const createBridge = (bridge, port, path = '/bridge') => {
27
27
  app.use(express_1.default.json());
28
28
  app.use(express_1.default.urlencoded({ extended: true }));
29
29
  // Typed bridge middleware
30
- let requestId = 1;
30
+ let requestId = 0;
31
31
  app.use((req, res, next) => {
32
32
  const _req = req;
33
33
  const xForwardedFor = req.headers['x-forwarded-for'];
@@ -36,16 +36,16 @@ const createBridge = (bridge, port, path = '/bridge') => {
36
36
  : (xForwardedFor || '').split(', ')[0] || req.socket.remoteAddress || '';
37
37
  if (ip === '::1')
38
38
  ip = '127.0.0.1';
39
+ // Set typed bridge header
40
+ res.setHeader('X-Powered-By', 'typed-bridge');
41
+ requestId++;
39
42
  // Bind data
40
43
  _req.bind = {
41
- id: 0,
44
+ id: requestId,
42
45
  ts: Date.now(),
43
46
  args: {},
44
47
  ip
45
48
  };
46
- // Set typed bridge header
47
- res.setHeader('X-Powered-By', 'typed-bridge');
48
- requestId++;
49
49
  // Log request
50
50
  if (__1.tbConfig.logs.request) {
51
51
  console.log(chalk_1.default.blueBright(`REQ | ${new Date().toISOString()} | ${requestId} :: ${req.method} | ${req.path} | ${ip}`));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "typed-bridge",
3
3
  "description": "Strictly typed server functions for typescript apps",
4
- "version": "2.0.14",
4
+ "version": "2.0.15",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "author": "neilveil",