@proteinjs/server 1.1.1 → 1.1.3
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/.eslintrc.js +20 -0
- package/.prettierignore +3 -0
- package/.prettierrc +8 -0
- package/CHANGELOG.md +11 -44
- package/LICENSE +21 -0
- package/dist/generated/index.js +1 -1
- package/dist/generated/index.js.map +1 -1
- package/dist/jest.config.d.ts +1 -1
- package/dist/jest.config.js +6 -15
- package/dist/jest.config.js.map +1 -1
- package/dist/src/NodeSessionDataStorage.d.ts.map +1 -1
- package/dist/src/NodeSessionDataStorage.js +13 -7
- package/dist/src/NodeSessionDataStorage.js.map +1 -1
- package/dist/src/loadRoutes.d.ts.map +1 -1
- package/dist/src/loadRoutes.js +14 -7
- package/dist/src/loadRoutes.js.map +1 -1
- package/dist/src/routes/healthCheck.d.ts.map +1 -1
- package/dist/src/routes/healthCheck.js +1 -1
- package/dist/src/routes/healthCheck.js.map +1 -1
- package/dist/src/routes/reactApp.d.ts.map +1 -1
- package/dist/src/routes/reactApp.js +7 -4
- package/dist/src/routes/reactApp.js.map +1 -1
- package/dist/src/startServer.d.ts.map +1 -1
- package/dist/src/startServer.js +25 -12
- package/dist/src/startServer.js.map +1 -1
- package/dist/webpack.config.js +15 -15
- package/dist/webpack.config.js.map +1 -1
- package/generated/index.ts +5 -8
- package/index.ts +1 -1
- package/jest.config.js +8 -17
- package/package.json +76 -70
- package/src/NodeSessionDataStorage.ts +35 -29
- package/src/loadRoutes.ts +124 -103
- package/src/nodeModulesPath.ts +1 -1
- package/src/routes/healthCheck.ts +7 -7
- package/src/routes/reactApp.ts +43 -36
- package/src/startServer.ts +164 -132
- package/tsconfig.json +17 -17
- package/webpack.config.js +20 -20
package/.eslintrc.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'plugin:prettier/recommended', 'prettier'],
|
|
3
|
+
parser: '@typescript-eslint/parser',
|
|
4
|
+
plugins: ['@typescript-eslint', 'prettier'],
|
|
5
|
+
root: true,
|
|
6
|
+
ignorePatterns: ['**/dist/*', '**/node_modules/*'],
|
|
7
|
+
|
|
8
|
+
rules: {
|
|
9
|
+
'prettier/prettier': ['warn'],
|
|
10
|
+
curly: ['warn'],
|
|
11
|
+
'eol-last': ['warn', 'always'],
|
|
12
|
+
'keyword-spacing': ['warn', { before: true }],
|
|
13
|
+
'no-undef': 'off',
|
|
14
|
+
'@typescript-eslint/no-unused-vars': 'off',
|
|
15
|
+
'@typescript-eslint/no-var-requires': 'off',
|
|
16
|
+
'@typescript-eslint/no-explicit-any': 'off',
|
|
17
|
+
'@typescript-eslint/prefer-as-const': 'off',
|
|
18
|
+
'@typescript-eslint/ban-types': 'off',
|
|
19
|
+
},
|
|
20
|
+
};
|
package/.prettierignore
ADDED
package/.prettierrc
ADDED
package/CHANGELOG.md
CHANGED
|
@@ -3,97 +3,64 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
### Features
|
|
6
|
+
## [1.1.3](https://github.com/proteinjs/server/compare/@proteinjs/server@1.1.2...@proteinjs/server@1.1.3) (2024-05-10)
|
|
10
7
|
|
|
11
|
-
* `ServerConfig` now accepts a bundles directory instead of bundle paths (deprecated) so the server can support dynamic bundle names (ie. when you generate a hash as part of the bundle name for cache busting) ([f3d7cef](https://github.com/proteinjs/server/commit/f3d7cefd58cb0b220470e886e161fbc028ca2df9))
|
|
12
8
|
|
|
9
|
+
### Bug Fixes
|
|
13
10
|
|
|
11
|
+
* add linting and lint all files ([2b4e1e6](https://github.com/proteinjs/server/commit/2b4e1e6332e16328c3a3d3c846def74f819bbf39))
|
|
14
12
|
|
|
15
13
|
|
|
16
14
|
|
|
17
|
-
## [1.0.11](https://github.com/proteinjs/server/compare/@proteinjs/server@1.0.10...@proteinjs/server@1.0.11) (2024-04-24)
|
|
18
15
|
|
|
19
16
|
|
|
20
|
-
|
|
17
|
+
# [1.1.0](https://github.com/proteinjs/server/compare/@proteinjs/server@1.0.17...@proteinjs/server@1.1.0) (2024-05-06)
|
|
21
18
|
|
|
22
|
-
|
|
19
|
+
### Features
|
|
23
20
|
|
|
21
|
+
- `ServerConfig` now accepts a bundles directory instead of bundle paths (deprecated) so the server can support dynamic bundle names (ie. when you generate a hash as part of the bundle name for cache busting) ([f3d7cef](https://github.com/proteinjs/server/commit/f3d7cefd58cb0b220470e886e161fbc028ca2df9))
|
|
24
22
|
|
|
23
|
+
## [1.0.11](https://github.com/proteinjs/server/compare/@proteinjs/server@1.0.10...@proteinjs/server@1.0.11) (2024-04-24)
|
|
25
24
|
|
|
25
|
+
### Bug Fixes
|
|
26
26
|
|
|
27
|
+
- `ServerConfig` now requires a node_modules path to use hot client builds ([d0d14bd](https://github.com/proteinjs/server/commit/d0d14bda27e391ddb6493c714f5cf5220c1976fc))
|
|
27
28
|
|
|
28
29
|
## [1.0.9](https://github.com/proteinjs/server/compare/@proteinjs/server@1.0.8...@proteinjs/server@1.0.9) (2024-04-20)
|
|
29
30
|
|
|
30
31
|
**Note:** Version bump only for package @proteinjs/server
|
|
31
32
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
33
|
## [1.0.8](https://github.com/proteinjs/server/compare/@proteinjs/server@1.0.7...@proteinjs/server@1.0.8) (2024-04-19)
|
|
37
34
|
|
|
38
35
|
**Note:** Version bump only for package @proteinjs/server
|
|
39
36
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
37
|
## [1.0.7](https://github.com/brentbahry/server/compare/@proteinjs/server@1.0.6...@proteinjs/server@1.0.7) (2024-04-19)
|
|
45
38
|
|
|
46
|
-
|
|
47
39
|
### Bug Fixes
|
|
48
40
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
41
|
+
- fixed server version ([dcea65a](https://github.com/brentbahry/server/commit/dcea65a231c894ff7872f48b9b6d36b44d28b72e))
|
|
54
42
|
|
|
55
43
|
## [1.0.6](https://github.com/brentbahry/server/compare/@proteinjs/server@1.0.5...@proteinjs/server@1.0.6) (2024-04-19)
|
|
56
44
|
|
|
57
45
|
**Note:** Version bump only for package @proteinjs/server
|
|
58
46
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
47
|
## [1.0.5](https://github.com/brentbahry/server/compare/@proteinjs/server@1.0.4...@proteinjs/server@1.0.5) (2024-04-19)
|
|
64
48
|
|
|
65
49
|
**Note:** Version bump only for package @proteinjs/server
|
|
66
50
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
51
|
## [1.0.4](https://github.com/brentbahry/server/compare/@proteinjs/server@1.0.3...@proteinjs/server@1.0.4) (2024-04-19)
|
|
72
52
|
|
|
73
53
|
**Note:** Version bump only for package @proteinjs/server
|
|
74
54
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
55
|
## [1.0.3](https://github.com/brentbahry/server/compare/@proteinjs/server@1.0.2...@proteinjs/server@1.0.3) (2024-04-19)
|
|
80
56
|
|
|
81
57
|
**Note:** Version bump only for package @proteinjs/server
|
|
82
58
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
59
|
## [1.0.2](https://github.com/brentbahry/server/compare/@proteinjs/server@1.0.1...@proteinjs/server@1.0.2) (2024-04-19)
|
|
88
60
|
|
|
89
|
-
|
|
90
61
|
### Bug Fixes
|
|
91
62
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
63
|
+
- [server] added dep (was devDep) @pmmmwh/react-refresh-webpack-plugin ([49479d1](https://github.com/brentbahry/server/commit/49479d1b23e0d767bb0d00731002a2bf77ede892))
|
|
97
64
|
|
|
98
65
|
## 1.0.1 (2024-04-19)
|
|
99
66
|
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Brent Bahry
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/generated/index.js
CHANGED
|
@@ -46,7 +46,7 @@ require("webpack");
|
|
|
46
46
|
require("webpack-dev-middleware");
|
|
47
47
|
require("webpack-hot-middleware");
|
|
48
48
|
/** Generate Source Graph */
|
|
49
|
-
var sourceGraph = "{\"options\":{\"directed\":true,\"multigraph\":false,\"compound\":false},\"nodes\":[{\"v\":\"@proteinjs/server/NodeSessionDataStorage\",\"value\":{\"packageName\":\"@proteinjs/server\",\"name\":\"NodeSessionDataStorage\",\"filePath\":\"/
|
|
49
|
+
var sourceGraph = "{\"options\":{\"directed\":true,\"multigraph\":false,\"compound\":false},\"nodes\":[{\"v\":\"@proteinjs/server/NodeSessionDataStorage\",\"value\":{\"packageName\":\"@proteinjs/server\",\"name\":\"NodeSessionDataStorage\",\"filePath\":\"/home/runner/work/server/server/packages/server/src/NodeSessionDataStorage.ts\",\"qualifiedName\":\"@proteinjs/server/NodeSessionDataStorage\",\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"properties\":[{\"name\":\"HOOK_INITIALIZED\",\"type\":null,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":true,\"visibility\":\"private\"},{\"name\":\"SESSION_DATA\",\"type\":{\"packageName\":\"@proteinjs/server\",\"name\":\"{ [id: string]: SessionData }\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/server/{ [id: string]: SessionData }\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":true,\"visibility\":\"private\"},{\"name\":\"environment\",\"type\":null,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"}],\"methods\":[{\"name\":\"setData\",\"returnType\":null,\"isAsync\":false,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"data\",\"type\":{\"packageName\":\"@proteinjs/server-api\",\"name\":\"SessionData\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/server-api/SessionData\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"getData\",\"returnType\":{\"packageName\":\"@proteinjs/server-api\",\"name\":\"SessionData\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/server-api/SessionData\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[]},{\"name\":\"initHook\",\"returnType\":null,\"isAsync\":false,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\",\"parameters\":[]}],\"typeParameters\":[],\"directParentInterfaces\":[{\"packageName\":\"@proteinjs/server-api\",\"name\":\"SessionDataStorage\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/server-api/SessionDataStorage\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParents\":[]}],\"directParentClasses\":[],\"sourceType\":2}},{\"v\":\"@proteinjs/server-api/SessionDataStorage\"},{\"v\":\"/string\"},{\"v\":\"@proteinjs/server/healthCheck\",\"value\":{\"packageName\":\"@proteinjs/server\",\"name\":\"healthCheck\",\"filePath\":\"/home/runner/work/server/server/packages/server/src/routes/healthCheck.ts\",\"qualifiedName\":\"@proteinjs/server/healthCheck\",\"type\":{\"packageName\":\"@proteinjs/server-api\",\"name\":\"Route\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/server-api/Route\",\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/server-api\",\"name\":\"Route\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/server-api/Route\",\"typeParameters\":[],\"directParents\":null}]},\"isExported\":true,\"isConst\":true,\"sourceType\":0}},{\"v\":\"@proteinjs/server-api/Route\"}],\"edges\":[{\"v\":\"@proteinjs/server/NodeSessionDataStorage\",\"w\":\"@proteinjs/server-api/SessionDataStorage\",\"value\":\"implements interface\"},{\"v\":\"@proteinjs/server/healthCheck\",\"w\":\"@proteinjs/server-api/Route\",\"value\":\"has type\"}]}";
|
|
50
50
|
/** Generate Source Links */
|
|
51
51
|
var NodeSessionDataStorage_1 = require("../src/NodeSessionDataStorage");
|
|
52
52
|
var healthCheck_1 = require("../src/routes/healthCheck");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../generated/index.ts"],"names":[],"mappings":";AAAA,oCAAoC;;;;;;;;;;;;;;;;AAEpC,gDAA8C;AAC9C,yBAAuB;AACvB,iCAA+B;AAC/B,iCAA+B;AAC/B,2BAAyB;AACzB,gCAA8B;AAC9B,uBAAqB;AACrB,kBAAgB;AAChB,uBAAqB;AACrB,yBAAuB;AACvB,6BAA2B;AAC3B,kBAAgB;AAChB,mBAAiB;AACjB,2BAAyB;AACzB,uBAAqB;AACrB,oBAAkB;AAClB,0BAAwB;AACxB,mBAAiB;AACjB,iBAAe;AACf,wBAAsB;AACtB,yBAAuB;AACvB,oCAAkC;AAClC,6BAA2B;AAC3B,qBAAmB;AACnB,sBAAoB;AACpB,eAAa;AACb,gBAAc;AACd,mBAAiB;AACjB,kCAAgC;AAChC,kCAAgC;AAGhC,4BAA4B;AAE5B,IAAM,WAAW,GAAG,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../generated/index.ts"],"names":[],"mappings":";AAAA,oCAAoC;;;;;;;;;;;;;;;;AAEpC,gDAA8C;AAC9C,yBAAuB;AACvB,iCAA+B;AAC/B,iCAA+B;AAC/B,2BAAyB;AACzB,gCAA8B;AAC9B,uBAAqB;AACrB,kBAAgB;AAChB,uBAAqB;AACrB,yBAAuB;AACvB,6BAA2B;AAC3B,kBAAgB;AAChB,mBAAiB;AACjB,2BAAyB;AACzB,uBAAqB;AACrB,oBAAkB;AAClB,0BAAwB;AACxB,mBAAiB;AACjB,iBAAe;AACf,wBAAsB;AACtB,yBAAuB;AACvB,oCAAkC;AAClC,6BAA2B;AAC3B,qBAAmB;AACnB,sBAAoB;AACpB,eAAa;AACb,gBAAc;AACd,mBAAiB;AACjB,kCAAgC;AAChC,kCAAgC;AAGhC,4BAA4B;AAE5B,IAAM,WAAW,GAAG,0xGAA0xG,CAAC;AAG/yG,4BAA4B;AAE5B,wEAAuE;AACvE,yDAAwD;AAExD,IAAM,WAAW,GAAG;IACnB,0CAA0C,EAAE,+CAAsB;IAClE,+BAA+B,EAAE,yBAAW;CAC5C,CAAC;AAGF,kCAAkC;AAElC,oDAAyD;AACzD,6BAAgB,CAAC,KAAK,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;AAGjD,2CAAyB"}
|
package/dist/jest.config.d.ts
CHANGED
package/dist/jest.config.js
CHANGED
|
@@ -1,20 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
module.exports = {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
"transform": {
|
|
7
|
-
"^.+\\.tsx?$": "ts-jest"
|
|
3
|
+
roots: ['<rootDir>/test'],
|
|
4
|
+
transform: {
|
|
5
|
+
'^.+\\.tsx?$': 'ts-jest',
|
|
8
6
|
},
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
"tsx",
|
|
13
|
-
"js",
|
|
14
|
-
"jsx",
|
|
15
|
-
"json",
|
|
16
|
-
"node"
|
|
17
|
-
],
|
|
18
|
-
"testEnvironment": "node"
|
|
7
|
+
testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.tsx?$',
|
|
8
|
+
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
|
|
9
|
+
testEnvironment: 'node',
|
|
19
10
|
};
|
|
20
11
|
//# sourceMappingURL=jest.config.js.map
|
package/dist/jest.config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jest.config.js","sourceRoot":"","sources":["../jest.config.js"],"names":[],"mappings":";AAAA,MAAM,CAAC,OAAO,GAAG;
|
|
1
|
+
{"version":3,"file":"jest.config.js","sourceRoot":"","sources":["../jest.config.js"],"names":[],"mappings":";AAAA,MAAM,CAAC,OAAO,GAAG;IACf,KAAK,EAAE,CAAC,gBAAgB,CAAC;IACzB,SAAS,EAAE;QACT,aAAa,EAAE,SAAS;KACzB;IACD,SAAS,EAAE,4CAA4C;IACvD,oBAAoB,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC;IAChE,eAAe,EAAE,MAAM;CACxB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NodeSessionDataStorage.d.ts","sourceRoot":"","sources":["../../src/NodeSessionDataStorage.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAExE,qBAAa,sBAAuB,YAAW,kBAAkB;
|
|
1
|
+
{"version":3,"file":"NodeSessionDataStorage.d.ts","sourceRoot":"","sources":["../../src/NodeSessionDataStorage.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAExE,qBAAa,sBAAuB,YAAW,kBAAkB;IAC/D,OAAO,CAAC,MAAM,CAAC,gBAAgB,CAAS;IACxC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAqC;IACzE,WAAW,SAAoB;IAE/B,OAAO,CAAC,IAAI,EAAE,WAAW;IAYzB,OAAO,IAAI,WAAW;IAQtB,OAAO,CAAC,QAAQ;CAiBjB"}
|
|
@@ -10,28 +10,34 @@ var NodeSessionDataStorage = /** @class */ (function () {
|
|
|
10
10
|
this.environment = 'node';
|
|
11
11
|
}
|
|
12
12
|
NodeSessionDataStorage.prototype.setData = function (data) {
|
|
13
|
-
if (!NodeSessionDataStorage.HOOK_INITIALIZED)
|
|
13
|
+
if (!NodeSessionDataStorage.HOOK_INITIALIZED) {
|
|
14
14
|
this.initHook();
|
|
15
|
-
|
|
15
|
+
}
|
|
16
|
+
if (NodeSessionDataStorage.SESSION_DATA[async_hooks_1.default.executionAsyncId()]) {
|
|
16
17
|
return;
|
|
18
|
+
}
|
|
17
19
|
NodeSessionDataStorage.SESSION_DATA[async_hooks_1.default.executionAsyncId()] = data;
|
|
18
20
|
};
|
|
19
21
|
NodeSessionDataStorage.prototype.getData = function () {
|
|
20
|
-
if (!NodeSessionDataStorage.HOOK_INITIALIZED)
|
|
22
|
+
if (!NodeSessionDataStorage.HOOK_INITIALIZED) {
|
|
21
23
|
this.initHook();
|
|
24
|
+
}
|
|
22
25
|
return NodeSessionDataStorage.SESSION_DATA[async_hooks_1.default.executionAsyncId()];
|
|
23
26
|
};
|
|
24
27
|
NodeSessionDataStorage.prototype.initHook = function () {
|
|
25
|
-
async_hooks_1.default
|
|
28
|
+
async_hooks_1.default
|
|
29
|
+
.createHook({
|
|
26
30
|
init: function (asyncId, type, triggerAsyncId, resource) {
|
|
27
|
-
if (!NodeSessionDataStorage.SESSION_DATA[triggerAsyncId])
|
|
31
|
+
if (!NodeSessionDataStorage.SESSION_DATA[triggerAsyncId]) {
|
|
28
32
|
return;
|
|
33
|
+
}
|
|
29
34
|
NodeSessionDataStorage.SESSION_DATA[asyncId] = NodeSessionDataStorage.SESSION_DATA[triggerAsyncId];
|
|
30
35
|
},
|
|
31
36
|
destroy: function (asyncId) {
|
|
32
37
|
delete NodeSessionDataStorage.SESSION_DATA[asyncId];
|
|
33
|
-
}
|
|
34
|
-
})
|
|
38
|
+
},
|
|
39
|
+
})
|
|
40
|
+
.enable();
|
|
35
41
|
NodeSessionDataStorage.HOOK_INITIALIZED = true;
|
|
36
42
|
};
|
|
37
43
|
NodeSessionDataStorage.HOOK_INITIALIZED = false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NodeSessionDataStorage.js","sourceRoot":"","sources":["../../src/NodeSessionDataStorage.ts"],"names":[],"mappings":";;;;;;AAAA,4DAAqC;AAGrC;IAAA;
|
|
1
|
+
{"version":3,"file":"NodeSessionDataStorage.js","sourceRoot":"","sources":["../../src/NodeSessionDataStorage.ts"],"names":[],"mappings":";;;;;;AAAA,4DAAqC;AAGrC;IAAA;QAGE,gBAAW,GAAG,MAAgB,CAAC;IAuCjC,CAAC;IArCC,wCAAO,GAAP,UAAQ,IAAiB;QACvB,IAAI,CAAC,sBAAsB,CAAC,gBAAgB,EAAE;YAC5C,IAAI,CAAC,QAAQ,EAAE,CAAC;SACjB;QAED,IAAI,sBAAsB,CAAC,YAAY,CAAC,qBAAU,CAAC,gBAAgB,EAAE,CAAC,EAAE;YACtE,OAAO;SACR;QAED,sBAAsB,CAAC,YAAY,CAAC,qBAAU,CAAC,gBAAgB,EAAE,CAAC,GAAG,IAAI,CAAC;IAC5E,CAAC;IAED,wCAAO,GAAP;QACE,IAAI,CAAC,sBAAsB,CAAC,gBAAgB,EAAE;YAC5C,IAAI,CAAC,QAAQ,EAAE,CAAC;SACjB;QAED,OAAO,sBAAsB,CAAC,YAAY,CAAC,qBAAU,CAAC,gBAAgB,EAAE,CAAC,CAAC;IAC5E,CAAC;IAEO,yCAAQ,GAAhB;QACE,qBAAU;aACP,UAAU,CAAC;YACV,IAAI,EAAE,UAAC,OAAe,EAAE,IAAY,EAAE,cAAsB,EAAE,QAAgB;gBAC5E,IAAI,CAAC,sBAAsB,CAAC,YAAY,CAAC,cAAc,CAAC,EAAE;oBACxD,OAAO;iBACR;gBAED,sBAAsB,CAAC,YAAY,CAAC,OAAO,CAAC,GAAG,sBAAsB,CAAC,YAAY,CAAC,cAAc,CAAC,CAAC;YACrG,CAAC;YACD,OAAO,EAAE,UAAC,OAAe;gBACvB,OAAO,sBAAsB,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;YACtD,CAAC;SACF,CAAC;aACD,MAAM,EAAE,CAAC;QACZ,sBAAsB,CAAC,gBAAgB,GAAG,IAAI,CAAC;IACjD,CAAC;IAxCc,uCAAgB,GAAG,KAAK,AAAR,CAAS;IAChB,mCAAY,GAAkC,EAAE,AAApC,CAAqC;IAwC3E,6BAAC;CAAA,AA1CD,IA0CC;AA1CY,wDAAsB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadRoutes.d.ts","sourceRoot":"","sources":["../../src/loadRoutes.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAE9B,OAAO,
|
|
1
|
+
{"version":3,"file":"loadRoutes.d.ts","sourceRoot":"","sources":["../../src/loadRoutes.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAE9B,OAAO,EACL,YAAY,EACZ,KAAK,EAKN,MAAM,uBAAuB,CAAC;AAM/B,wBAAgB,UAAU,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,QA4BxF;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,QAalG"}
|
package/dist/src/loadRoutes.js
CHANGED
|
@@ -65,8 +65,9 @@ function loadRoutes(routes, server, config) {
|
|
|
65
65
|
var wildcardRoute = wildcardRoutes_1[_a];
|
|
66
66
|
server[wildcardRoute.method](getPath(wildcardRoute.path), wrapRoute(wildcardRoute.onRequest.bind(wildcardRoute), config));
|
|
67
67
|
}
|
|
68
|
-
if (starRoute)
|
|
68
|
+
if (starRoute) {
|
|
69
69
|
server[starRoute.method](starRoute.path, wrapRoute(starRoute.onRequest.bind(starRoute), config));
|
|
70
|
+
}
|
|
70
71
|
}
|
|
71
72
|
exports.loadRoutes = loadRoutes;
|
|
72
73
|
function loadDefaultStarRoute(routes, server, config) {
|
|
@@ -103,8 +104,9 @@ function wrapRoute(route, config) {
|
|
|
103
104
|
if (!config.authenticate) return [3 /*break*/, 2];
|
|
104
105
|
return [4 /*yield*/, new Promise(function (resolve, reject) {
|
|
105
106
|
passport_1.default.authenticate('local', function (err, user, info) {
|
|
106
|
-
if (err)
|
|
107
|
+
if (err) {
|
|
107
108
|
reject(err);
|
|
109
|
+
}
|
|
108
110
|
resolve();
|
|
109
111
|
})(request, response, next);
|
|
110
112
|
})];
|
|
@@ -135,8 +137,9 @@ function wrapRoute(route, config) {
|
|
|
135
137
|
case 7:
|
|
136
138
|
if (!(_e < requestListeners_1.length)) return [3 /*break*/, 12];
|
|
137
139
|
listener = requestListeners_1[_e];
|
|
138
|
-
if (!listener.beforeRequest)
|
|
140
|
+
if (!listener.beforeRequest) {
|
|
139
141
|
return [3 /*break*/, 11];
|
|
142
|
+
}
|
|
140
143
|
_g.label = 8;
|
|
141
144
|
case 8:
|
|
142
145
|
_g.trys.push([8, 10, , 11]);
|
|
@@ -155,10 +158,12 @@ function wrapRoute(route, config) {
|
|
|
155
158
|
sixtyMinutes = 1000 * 60 * 60;
|
|
156
159
|
timeout = typeof ((_a = config.request) === null || _a === void 0 ? void 0 : _a.timeoutMs) !== 'undefined' ? config.request.timeoutMs : sixtyMinutes;
|
|
157
160
|
request.setTimeout(timeout, function () {
|
|
158
|
-
if (response.locals.requestNumber)
|
|
161
|
+
if (response.locals.requestNumber) {
|
|
159
162
|
logger.warn("[#".concat(response.locals.requestNumber, "] Timed out ").concat(request.originalUrl));
|
|
160
|
-
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
161
165
|
logger.warn("Timed out ".concat(request.originalUrl));
|
|
166
|
+
}
|
|
162
167
|
});
|
|
163
168
|
_g.label = 13;
|
|
164
169
|
case 13:
|
|
@@ -178,8 +183,9 @@ function wrapRoute(route, config) {
|
|
|
178
183
|
case 17:
|
|
179
184
|
if (!(_f < requestListeners_2.length)) return [3 /*break*/, 22];
|
|
180
185
|
listener = requestListeners_2[_f];
|
|
181
|
-
if (!listener.afterRequest)
|
|
186
|
+
if (!listener.afterRequest) {
|
|
182
187
|
return [3 /*break*/, 21];
|
|
188
|
+
}
|
|
183
189
|
_g.label = 18;
|
|
184
190
|
case 18:
|
|
185
191
|
_g.trys.push([18, 20, , 21]);
|
|
@@ -205,8 +211,9 @@ function wrapRoute(route, config) {
|
|
|
205
211
|
function basicAuthCredentials(request) {
|
|
206
212
|
var b64auth = (request.headers.authorization || '').split(' ')[1] || '';
|
|
207
213
|
var _a = Buffer.from(b64auth, 'base64').toString().split(':'), username = _a[0], password = _a[1];
|
|
208
|
-
if (!username || !password)
|
|
214
|
+
if (!username || !password) {
|
|
209
215
|
return null;
|
|
216
|
+
}
|
|
210
217
|
return { username: username, password: password };
|
|
211
218
|
}
|
|
212
219
|
//# sourceMappingURL=loadRoutes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadRoutes.js","sourceRoot":"","sources":["../../src/loadRoutes.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,sDAAgC;AAChC,
|
|
1
|
+
{"version":3,"file":"loadRoutes.js","sourceRoot":"","sources":["../../src/loadRoutes.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,sDAAgC;AAChC,oDAO+B;AAC/B,8CAAmD;AACnD,wCAAyC;AAEzC,IAAM,MAAM,GAAG,IAAI,aAAM,CAAC,QAAQ,CAAC,CAAC;AAEpC,SAAgB,UAAU,CAAC,MAAe,EAAE,MAAuB,EAAE,MAAoB;IACvF,IAAI,SAAS,GAAiB,IAAI,CAAC;IACnC,IAAM,cAAc,GAAY,EAAE,CAAC;IACnC,KAAoB,UAAM,EAAN,iBAAM,EAAN,oBAAM,EAAN,IAAM,EAAE;QAAvB,IAAM,KAAK,eAAA;QACd,MAAM,CAAC,IAAI,CAAC,yBAAkB,KAAK,CAAC,IAAI,CAAE,CAAC,CAAC;QAC5C,IAAI,KAAK,CAAC,IAAI,IAAI,GAAG,EAAE;YACrB,SAAS,GAAG,KAAK,CAAC;YAClB,SAAS;SACV;QAED,IAAI,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;YAC5B,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAC3B,SAAS;SACV;QAED,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,SAAS,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;KAC3F;IAED,KAA4B,UAAc,EAAd,iCAAc,EAAd,4BAAc,EAAd,IA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;wBAA9C,SAA8C,CAAC;;;;wBAE/C,MAAM,CAAC,KAAK,CAAC,kDAAkD,EAAE,OAAK,CAAC,CAAC;;;wBARrD,IAAgB,CAAA;;;wBAYvC,IAAI,EAAE,CAAC;;;;;KACR,CAAC;AACJ,CAAC;AAED,SAAS,oBAAoB,CAAC,OAAwB;IACpD,IAAM,OAAO,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,aAAa,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IACpE,IAAA,KAAuB,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,EAA1E,QAAQ,QAAA,EAAE,QAAQ,QAAwD,CAAC;IAClF,IAAI,CAAC,QAAQ,IAAI,CAAC,QAAQ,EAAE;QAC1B,OAAO,IAAI,CAAC;KACb;IAED,OAAO,EAAE,QAAQ,UAAA,EAAE,QAAQ,UAAA,EAAE,CAAC;AAChC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"healthCheck.d.ts","sourceRoot":"","sources":["../../../src/routes/healthCheck.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAE9C,eAAO,MAAM,WAAW,EAAE,KAOzB,
|
|
1
|
+
{"version":3,"file":"healthCheck.d.ts","sourceRoot":"","sources":["../../../src/routes/healthCheck.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAE9C,eAAO,MAAM,WAAW,EAAE,KAOzB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"healthCheck.js","sourceRoot":"","sources":["../../../src/routes/healthCheck.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEa,QAAA,WAAW,GAAU;
|
|
1
|
+
{"version":3,"file":"healthCheck.js","sourceRoot":"","sources":["../../../src/routes/healthCheck.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEa,QAAA,WAAW,GAAU;IAChC,IAAI,EAAE,cAAc;IACpB,MAAM,EAAE,KAAK;IACb,OAAO,EAAE,IAAI;IACb,SAAS,EAAE,UAAO,OAAO,EAAE,QAAQ;;YACjC,QAAQ,CAAC,IAAI,EAAE,CAAC;;;SACjB;CACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reactApp.d.ts","sourceRoot":"","sources":["../../../src/routes/reactApp.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAA4B,MAAM,uBAAuB,CAAC;AAG/E,eAAO,MAAM,cAAc,iBAAkB,YAAY;;;
|
|
1
|
+
{"version":3,"file":"reactApp.d.ts","sourceRoot":"","sources":["../../../src/routes/reactApp.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAA4B,MAAM,uBAAuB,CAAC;AAG/E,eAAO,MAAM,cAAc,iBAAkB,YAAY;;;yBAI1B,GAAG,YAAY,GAAG,KAAG,QAAQ,IAAI,CAAC;CA6BhE,CAAC"}
|
|
@@ -54,10 +54,12 @@ var createReactApp = function (serverConfig) {
|
|
|
54
54
|
return __generator(this, function (_k) {
|
|
55
55
|
switch (_k.label) {
|
|
56
56
|
case 0:
|
|
57
|
-
if (request.path.startsWith('/static'))
|
|
57
|
+
if (request.path.startsWith('/static')) {
|
|
58
58
|
return [2 /*return*/];
|
|
59
|
-
|
|
59
|
+
}
|
|
60
|
+
if (!(((_g = serverConfig.staticContent) === null || _g === void 0 ? void 0 : _g.bundlePaths) || ((_h = serverConfig.staticContent) === null || _h === void 0 ? void 0 : _h.bundlesDir))) {
|
|
60
61
|
throw new Error("ServerConfig.bundlePath or ServerConfig.bundlesDir must be provided to serve a react app");
|
|
62
|
+
}
|
|
61
63
|
helmet = react_helmet_1.default.renderStatic();
|
|
62
64
|
_b = (_a = response).send;
|
|
63
65
|
_e = (_d = "<!DOCTYPE html>\n <html ".concat(helmet.htmlAttributes, ">\n <head>\n <meta charset='utf-8' />\n <meta name='viewport' content='width=device-width, initial-scale=1.0'>\n <link href='").concat(((_j = serverConfig.staticContent) === null || _j === void 0 ? void 0 : _j.faviconPath) ? path_1.default.join('/static/', serverConfig.staticContent.faviconPath) : '', "' rel='icon' type='image/x-icon' />\n ").concat(helmet.title.toString(), "\n ").concat(helmet.meta.toString(), "\n ").concat(helmet.link.toString(), "\n </head>\n <body ").concat(helmet.bodyAttributes.toString(), ">\n <div id='app'></div>\n <script>proteinjs = {};</script>\n ")).concat;
|
|
@@ -70,7 +72,7 @@ var createReactApp = function (serverConfig) {
|
|
|
70
72
|
return [2 /*return*/];
|
|
71
73
|
}
|
|
72
74
|
});
|
|
73
|
-
}); }
|
|
75
|
+
}); },
|
|
74
76
|
};
|
|
75
77
|
};
|
|
76
78
|
exports.createReactApp = createReactApp;
|
|
@@ -81,8 +83,9 @@ function bundleScriptTags(serverConfig) {
|
|
|
81
83
|
return __generator(this, function (_h) {
|
|
82
84
|
switch (_h.label) {
|
|
83
85
|
case 0:
|
|
84
|
-
if (!(((_a = serverConfig.staticContent) === null || _a === void 0 ? void 0 : _a.bundlePaths) || ((_b = serverConfig.staticContent) === null || _b === void 0 ? void 0 : _b.bundlesDir)))
|
|
86
|
+
if (!(((_a = serverConfig.staticContent) === null || _a === void 0 ? void 0 : _a.bundlePaths) || ((_b = serverConfig.staticContent) === null || _b === void 0 ? void 0 : _b.bundlesDir))) {
|
|
85
87
|
return [2 /*return*/];
|
|
88
|
+
}
|
|
86
89
|
scriptTags = [];
|
|
87
90
|
if (!((_c = serverConfig.staticContent) === null || _c === void 0 ? void 0 : _c.bundlePaths)) return [3 /*break*/, 1];
|
|
88
91
|
for (_i = 0, _f = serverConfig.staticContent.bundlePaths; _i < _f.length; _i++) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reactApp.js","sourceRoot":"","sources":["../../../src/routes/reactApp.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8CAAwB;AACxB,8DAAuC;AACvC,oDAA+E;AAC/E,kDAA0C;AAEnC,IAAM,cAAc,GAAG,UAAC,YAA0B;
|
|
1
|
+
{"version":3,"file":"reactApp.js","sourceRoot":"","sources":["../../../src/routes/reactApp.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8CAAwB;AACxB,8DAAuC;AACvC,oDAA+E;AAC/E,kDAA0C;AAEnC,IAAM,cAAc,GAAG,UAAC,YAA0B;IACvD,OAAO;QACL,IAAI,EAAE,GAAG;QACT,MAAM,EAAE,KAAc;QACtB,SAAS,EAAE,UAAO,OAAY,EAAE,QAAa;;;;;;wBAC3C,IAAI,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE;4BACtC,sBAAO;yBACR;wBAED,IAAI,CAAC,CAAC,CAAA,MAAA,YAAY,CAAC,aAAa,0CAAE,WAAW,MAAI,MAAA,YAAY,CAAC,aAAa,0CAAE,UAAU,CAAA,CAAC,EAAE;4BACxF,MAAM,IAAI,KAAK,CAAC,0FAA0F,CAAC,CAAC;yBAC7G;wBAEK,MAAM,GAAG,sBAAW,CAAC,YAAY,EAAE,CAAC;wBAC1C,KAAA,CAAA,KAAA,QAAQ,CAAA,CAAC,IAAI,CAAA;oFACK,MAAM,CAAC,cAAc,kOAIP,CAAA,MAAA,YAAY,CAAC,aAAa,0CAAE,WAAW,EAAC,CAAC,CAAC,cAAI,CAAC,IAAI,CAAC,UAAU,EAAE,YAAY,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,EAAE,0EACxH,MAAM,CAAC,KAAK,CAAC,QAAQ,EAAE,uCACvB,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,uCACt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S,EAAE;wBAAvB,QAAQ;wBACX,YAAY,GAAG,cAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,aAAa,CAAC,gBAAgB,EAAE,QAAQ,CAAC,CAAC;wBAC1F,UAAU,CAAC,IAAI,CAAC,uBAAgB,cAAI,CAAC,IAAI,CAAC,UAAU,EAAE,YAAY,CAAC,gBAAa,CAAC,CAAC;qBACnF;;wBAGH,sBAAO,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,EAAC;;;;CAC9B;AAED,SAAe,wBAAwB;;;;;;oBAC/B,OAAO,GAAG,IAAA,qCAAwB,GAAE,CAAC;oBACrC,UAAU,GAAa,EAAE,CAAC;0BACJ,EAAP,mBAAO;;;yBAAP,CAAA,qBAAO,CAAA;oBAAjB,MAAM;oBACf,KAAA,CAAA,KAAA,UAAU,CAAA,CAAC,IAAI,CAAA;;oBAAY,qBAAM,MAAM,CAAC,MAAM,EAAE,EAAA;;oBAAhD,cAAgB,sBAAW,SAAqB,eAAW,EAAC,CAAC;;;oBAD1C,IAAO,CAAA;;wBAI5B,sBAAO,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,EAAC;;;;CAC9B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"startServer.d.ts","sourceRoot":"","sources":["../../src/startServer.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,YAAY,EAAa,MAAM,uBAAuB,CAAC;AAQhE,wBAAsB,WAAW,CAAC,MAAM,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"startServer.d.ts","sourceRoot":"","sources":["../../src/startServer.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,YAAY,EAAa,MAAM,uBAAuB,CAAC;AAQhE,wBAAsB,WAAW,CAAC,MAAM,EAAE,YAAY,iBAuBrD"}
|
package/dist/src/startServer.js
CHANGED
|
@@ -108,14 +108,19 @@ function configureRequests(server) {
|
|
|
108
108
|
server.use(body_parser_1.default.json({ limit: '100mb' }));
|
|
109
109
|
server.use(body_parser_1.default.urlencoded({
|
|
110
110
|
extended: true,
|
|
111
|
-
limit: '100mb'
|
|
111
|
+
limit: '100mb',
|
|
112
112
|
}));
|
|
113
113
|
server.disable('x-powered-by');
|
|
114
114
|
}
|
|
115
115
|
function initializeHotReloading(server, config) {
|
|
116
116
|
var _a, _b;
|
|
117
|
-
if (!process.env.DEVELOPMENT ||
|
|
117
|
+
if (!process.env.DEVELOPMENT ||
|
|
118
|
+
process.env.DISABLE_HOT_CLIENT_BUILDS ||
|
|
119
|
+
!config.hotClientBuilds ||
|
|
120
|
+
!((_a = config.staticContent) === null || _a === void 0 ? void 0 : _a.staticContentDir) ||
|
|
121
|
+
!((_b = config.staticContent) === null || _b === void 0 ? void 0 : _b.appEntryPath)) {
|
|
118
122
|
return;
|
|
123
|
+
}
|
|
119
124
|
var wpConfig = Object.assign({}, getWebpackConfig(config));
|
|
120
125
|
wpConfig['entry'] = { app: ['webpack-hot-middleware/client', config.staticContent.appEntryPath] };
|
|
121
126
|
wpConfig['output']['path'] = config.staticContent.staticContentDir;
|
|
@@ -144,8 +149,9 @@ function configureHttps(server) {
|
|
|
144
149
|
}
|
|
145
150
|
function configureStaticContentRouter(server, config) {
|
|
146
151
|
var _a;
|
|
147
|
-
if (!((_a = config.staticContent) === null || _a === void 0 ? void 0 : _a.staticContentDir))
|
|
152
|
+
if (!((_a = config.staticContent) === null || _a === void 0 ? void 0 : _a.staticContentDir)) {
|
|
148
153
|
return;
|
|
154
|
+
}
|
|
149
155
|
server.use(staticContentPath, express_1.default.static(config.staticContent.staticContentDir));
|
|
150
156
|
logger.info("Serving static content on path: ".concat(staticContentPath, ", serving from directory: ").concat(config.staticContent.staticContentDir));
|
|
151
157
|
}
|
|
@@ -157,23 +163,26 @@ function configureSession(server, config) {
|
|
|
157
163
|
resave: false,
|
|
158
164
|
saveUninitialized: false,
|
|
159
165
|
cookie: {
|
|
160
|
-
maxAge: sixtyDays
|
|
166
|
+
maxAge: sixtyDays,
|
|
161
167
|
},
|
|
162
|
-
rolling: true
|
|
168
|
+
rolling: true,
|
|
163
169
|
};
|
|
164
170
|
if (!process.env.DEVELOPMENT) {
|
|
165
171
|
server.set('trust proxy', 1);
|
|
166
|
-
if (!sessionOptions.cookie)
|
|
172
|
+
if (!sessionOptions.cookie) {
|
|
167
173
|
sessionOptions.cookie = {};
|
|
174
|
+
}
|
|
168
175
|
sessionOptions.cookie.secure = true;
|
|
169
176
|
}
|
|
170
|
-
if (config.session)
|
|
177
|
+
if (config.session) {
|
|
171
178
|
sessionOptions = Object.assign(sessionOptions, config.session);
|
|
179
|
+
}
|
|
172
180
|
server.use((0, express_session_1.default)(sessionOptions));
|
|
173
181
|
server.use(passport_1.default.initialize());
|
|
174
182
|
server.use(passport_1.default.session());
|
|
175
|
-
if (config.authenticate)
|
|
183
|
+
if (config.authenticate) {
|
|
176
184
|
initializeAuthentication(config.authenticate);
|
|
185
|
+
}
|
|
177
186
|
}
|
|
178
187
|
function initializeAuthentication(authenticate) {
|
|
179
188
|
passport_1.default.use(new passport_local_1.default.Strategy(function (username, password, done) {
|
|
@@ -186,8 +195,9 @@ function initializeAuthentication(authenticate) {
|
|
|
186
195
|
return [4 /*yield*/, authenticate(username, password)];
|
|
187
196
|
case 1:
|
|
188
197
|
result = _a.sent();
|
|
189
|
-
if (result === true)
|
|
198
|
+
if (result === true) {
|
|
190
199
|
return [2 /*return*/, done(null, { username: username })];
|
|
200
|
+
}
|
|
191
201
|
return [2 /*return*/, done(new Error(result))];
|
|
192
202
|
}
|
|
193
203
|
});
|
|
@@ -215,13 +225,15 @@ function beforeRequest(server, config) {
|
|
|
215
225
|
next();
|
|
216
226
|
});
|
|
217
227
|
}
|
|
218
|
-
if ((_c = config.request) === null || _c === void 0 ? void 0 : _c.beforeRequest)
|
|
228
|
+
if ((_c = config.request) === null || _c === void 0 ? void 0 : _c.beforeRequest) {
|
|
219
229
|
server.use(config.request.beforeRequest);
|
|
230
|
+
}
|
|
220
231
|
}
|
|
221
232
|
function afterRequest(server, config) {
|
|
222
233
|
var _a, _b, _c;
|
|
223
|
-
if ((_a = config.request) === null || _a === void 0 ? void 0 : _a.afterRequest)
|
|
234
|
+
if ((_a = config.request) === null || _a === void 0 ? void 0 : _a.afterRequest) {
|
|
224
235
|
server.use(config.request.afterRequest);
|
|
236
|
+
}
|
|
225
237
|
if (((_b = config.request) === null || _b === void 0 ? void 0 : _b.disableRequestLogging) == false || typeof ((_c = config.request) === null || _c === void 0 ? void 0 : _c.disableRequestLogging) === 'undefined') {
|
|
226
238
|
server.use(function (request, response, next) {
|
|
227
239
|
if (request.path.startsWith('/static') || request.path.startsWith('/favicon.ico')) {
|
|
@@ -236,8 +248,9 @@ function afterRequest(server, config) {
|
|
|
236
248
|
function start(server, config) {
|
|
237
249
|
var port = config.port ? config.port : 3000;
|
|
238
250
|
server.listen(port, function () {
|
|
239
|
-
if (process.env.DEVELOPMENT)
|
|
251
|
+
if (process.env.DEVELOPMENT) {
|
|
240
252
|
logger.info("Starting in development mode");
|
|
253
|
+
}
|
|
241
254
|
logger.info("Server listening on port: ".concat(port));
|
|
242
255
|
});
|
|
243
256
|
}
|