@proteinjs/user-server 1.0.11 → 1.0.13

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 (44) hide show
  1. package/.eslintrc.js +20 -0
  2. package/.prettierignore +3 -0
  3. package/.prettierrc +8 -0
  4. package/CHANGELOG.md +14 -2
  5. package/LICENSE +21 -0
  6. package/dist/generated/index.js +1 -1
  7. package/dist/generated/index.js.map +1 -1
  8. package/dist/src/authentication/DbSessionStore.d.ts.map +1 -1
  9. package/dist/src/authentication/DbSessionStore.js +11 -6
  10. package/dist/src/authentication/DbSessionStore.js.map +1 -1
  11. package/dist/src/authentication/DefaultAdminCredentials.d.ts.map +1 -1
  12. package/dist/src/authentication/DefaultAdminCredentials.js +2 -1
  13. package/dist/src/authentication/DefaultAdminCredentials.js.map +1 -1
  14. package/dist/src/authentication/authenticate.d.ts.map +1 -1
  15. package/dist/src/authentication/authenticate.js +8 -5
  16. package/dist/src/authentication/authenticate.js.map +1 -1
  17. package/dist/src/authentication/destroySession.d.ts.map +1 -1
  18. package/dist/src/authentication/destroySession.js +2 -1
  19. package/dist/src/authentication/destroySession.js.map +1 -1
  20. package/dist/src/authorization/userCache.d.ts.map +1 -1
  21. package/dist/src/authorization/userCache.js +12 -2
  22. package/dist/src/authorization/userCache.js.map +1 -1
  23. package/dist/src/routes/createUser.d.ts.map +1 -1
  24. package/dist/src/routes/createUser.js +1 -1
  25. package/dist/src/routes/createUser.js.map +1 -1
  26. package/dist/src/routes/login.d.ts.map +1 -1
  27. package/dist/src/routes/login.js +1 -1
  28. package/dist/src/routes/login.js.map +1 -1
  29. package/dist/src/routes/logout.d.ts.map +1 -1
  30. package/dist/src/routes/logout.js +1 -1
  31. package/dist/src/routes/logout.js.map +1 -1
  32. package/generated/index.ts +8 -11
  33. package/index.ts +1 -1
  34. package/jest.config.js +8 -17
  35. package/package.json +10 -4
  36. package/src/authentication/DbSessionStore.ts +85 -77
  37. package/src/authentication/DefaultAdminCredentials.ts +10 -10
  38. package/src/authentication/authenticate.ts +24 -18
  39. package/src/authentication/destroySession.ts +5 -4
  40. package/src/authorization/userCache.ts +25 -15
  41. package/src/routes/createUser.ts +24 -24
  42. package/src/routes/login.ts +22 -22
  43. package/src/routes/logout.ts +22 -22
  44. package/tsconfig.json +17 -17
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
+ };
@@ -0,0 +1,3 @@
1
+ node_modules/
2
+ dist/
3
+ .DS_Store
package/.prettierrc ADDED
@@ -0,0 +1,8 @@
1
+ {
2
+ "trailingComma": "es5",
3
+ "tabWidth": 2,
4
+ "semi": true,
5
+ "singleQuote": true,
6
+ "jsxSingleQuote": true,
7
+ "printWidth": 120
8
+ }
package/CHANGELOG.md CHANGED
@@ -3,16 +3,28 @@
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
- ## [1.0.10](https://github.com/proteinjs/user/compare/@proteinjs/user-server@1.0.9...@proteinjs/user-server@1.0.10) (2024-05-09)
6
+ ## [1.0.13](https://github.com/proteinjs/user/compare/@proteinjs/user-server@1.0.12...@proteinjs/user-server@1.0.13) (2024-05-10)
7
7
 
8
8
 
9
9
  ### Bug Fixes
10
10
 
11
- * do not name a column the same name as a table ([1442a9f](https://github.com/proteinjs/user/commit/1442a9f665f88feafa8ccb83631ef2fb7d741f20))
11
+ * `userCache` should not contain the password hash ([90abf84](https://github.com/proteinjs/user/commit/90abf84e75e0ef1cd9bb07a789a65ef43a527e24))
12
+
13
+
14
+
15
+
12
16
 
17
+ ## [1.0.12](https://github.com/proteinjs/user/compare/@proteinjs/user-server@1.0.11...@proteinjs/user-server@1.0.12) (2024-05-10)
13
18
 
19
+ ### Bug Fixes
20
+
21
+ - add linting and lint all files ([71defcd](https://github.com/proteinjs/user/commit/71defcd78dc479d2eef1f624c746c879f4e31daa))
14
22
 
23
+ ## [1.0.10](https://github.com/proteinjs/user/compare/@proteinjs/user-server@1.0.9...@proteinjs/user-server@1.0.10) (2024-05-09)
24
+
25
+ ### Bug Fixes
15
26
 
27
+ - do not name a column the same name as a table ([1442a9f](https://github.com/proteinjs/user/commit/1442a9f665f88feafa8ccb83631ef2fb7d741f20))
16
28
 
17
29
  ## 1.0.1 (2024-04-19)
18
30
 
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.
@@ -24,7 +24,7 @@ require("crypto-js");
24
24
  require("express-session");
25
25
  require("moment");
26
26
  /** Generate Source Graph */
27
- var sourceGraph = "{\"options\":{\"directed\":true,\"multigraph\":false,\"compound\":false},\"nodes\":[{\"v\":\"@proteinjs/user-server/DbSessionStore\",\"value\":{\"packageName\":\"@proteinjs/user-server\",\"name\":\"DbSessionStore\",\"filePath\":\"/Users/brentbahry/workspaces/n3xa/packages/proteinjs/packages/user/packages/server/src/authentication/DbSessionStore.ts\",\"qualifiedName\":\"@proteinjs/user-server/DbSessionStore\",\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"properties\":[{\"name\":\"TWELVE_HOURS\",\"type\":null,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":true,\"visibility\":\"private\"},{\"name\":\"get\",\"type\":null,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"set\",\"type\":null,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"touch\",\"type\":null,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"destroy\",\"type\":null,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"}],\"methods\":[{\"name\":\"insertOrUpdate\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<void>\",\"filePath\":null,\"qualifiedName\":\"/Promise<void>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":true,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\",\"parameters\":[{\"name\":\"sessionId\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"session\",\"type\":{\"packageName\":\"\",\"name\":\"Express.SessionData\",\"filePath\":null,\"qualifiedName\":\"/Express.SessionData\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"cb\",\"type\":{\"packageName\":\"\",\"name\":\"(error?: any) => void\",\"filePath\":null,\"qualifiedName\":\"/(error?: any) => void\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"sweep\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<void>\",\"filePath\":null,\"qualifiedName\":\"/Promise<void>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":true,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\",\"parameters\":[]}],\"typeParameters\":[],\"directParentInterfaces\":[],\"directParentClasses\":[{\"packageName\":\"express-session\",\"name\":\"Store\",\"filePath\":null,\"qualifiedName\":\"express-session/Store\",\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParentInterfaces\":[],\"directParentClasses\":[]}],\"sourceType\":2}},{\"v\":\"express-session/Store\"},{\"v\":\"@proteinjs/user-server/userCache\",\"value\":{\"packageName\":\"@proteinjs/user-server\",\"name\":\"userCache\",\"filePath\":\"/Users/brentbahry/workspaces/n3xa/packages/proteinjs/packages/user/packages/server/src/authorization/userCache.ts\",\"qualifiedName\":\"@proteinjs/user-server/userCache\",\"type\":{\"packageName\":\"\",\"name\":\"SessionDataCache<User>\",\"filePath\":null,\"qualifiedName\":\"/SessionDataCache<User>\",\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/server-api\",\"name\":\"SessionDataCache\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/server-api/SessionDataCache\",\"typeParameters\":[\"@proteinjs/user/User\"],\"directParents\":null}]},\"isExported\":true,\"isConst\":true,\"sourceType\":0}},{\"v\":\"@proteinjs/server-api/SessionDataCache\"},{\"v\":\"@proteinjs/user-server/createUser\",\"value\":{\"packageName\":\"@proteinjs/user-server\",\"name\":\"createUser\",\"filePath\":\"/Users/brentbahry/workspaces/n3xa/packages/proteinjs/packages/user/packages/server/src/routes/createUser.ts\",\"qualifiedName\":\"@proteinjs/user-server/createUser\",\"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\"},{\"v\":\"@proteinjs/user-server/login\",\"value\":{\"packageName\":\"@proteinjs/user-server\",\"name\":\"login\",\"filePath\":\"/Users/brentbahry/workspaces/n3xa/packages/proteinjs/packages/user/packages/server/src/routes/login.ts\",\"qualifiedName\":\"@proteinjs/user-server/login\",\"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/user-server/logout\",\"value\":{\"packageName\":\"@proteinjs/user-server\",\"name\":\"logout\",\"filePath\":\"/Users/brentbahry/workspaces/n3xa/packages/proteinjs/packages/user/packages/server/src/routes/logout.ts\",\"qualifiedName\":\"@proteinjs/user-server/logout\",\"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}}],\"edges\":[{\"v\":\"@proteinjs/user-server/DbSessionStore\",\"w\":\"express-session/Store\",\"value\":\"extends class\"},{\"v\":\"@proteinjs/user-server/userCache\",\"w\":\"@proteinjs/server-api/SessionDataCache\",\"value\":\"has type\"},{\"v\":\"@proteinjs/user-server/createUser\",\"w\":\"@proteinjs/server-api/Route\",\"value\":\"has type\"},{\"v\":\"@proteinjs/user-server/login\",\"w\":\"@proteinjs/server-api/Route\",\"value\":\"has type\"},{\"v\":\"@proteinjs/user-server/logout\",\"w\":\"@proteinjs/server-api/Route\",\"value\":\"has type\"}]}";
27
+ var sourceGraph = "{\"options\":{\"directed\":true,\"multigraph\":false,\"compound\":false},\"nodes\":[{\"v\":\"@proteinjs/user-server/DbSessionStore\",\"value\":{\"packageName\":\"@proteinjs/user-server\",\"name\":\"DbSessionStore\",\"filePath\":\"/home/runner/work/user/user/packages/server/src/authentication/DbSessionStore.ts\",\"qualifiedName\":\"@proteinjs/user-server/DbSessionStore\",\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"properties\":[{\"name\":\"TWELVE_HOURS\",\"type\":null,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":true,\"visibility\":\"private\"},{\"name\":\"get\",\"type\":null,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"set\",\"type\":null,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"touch\",\"type\":null,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"destroy\",\"type\":null,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"}],\"methods\":[{\"name\":\"insertOrUpdate\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<void>\",\"filePath\":null,\"qualifiedName\":\"/Promise<void>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":true,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\",\"parameters\":[{\"name\":\"sessionId\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"session\",\"type\":{\"packageName\":\"\",\"name\":\"Express.SessionData\",\"filePath\":null,\"qualifiedName\":\"/Express.SessionData\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"cb\",\"type\":{\"packageName\":\"\",\"name\":\"(error?: any) => void\",\"filePath\":null,\"qualifiedName\":\"/(error?: any) => void\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"sweep\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<void>\",\"filePath\":null,\"qualifiedName\":\"/Promise<void>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":true,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\",\"parameters\":[]}],\"typeParameters\":[],\"directParentInterfaces\":[],\"directParentClasses\":[{\"packageName\":\"express-session\",\"name\":\"Store\",\"filePath\":null,\"qualifiedName\":\"express-session/Store\",\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParentInterfaces\":[],\"directParentClasses\":[]}],\"sourceType\":2}},{\"v\":\"express-session/Store\"},{\"v\":\"@proteinjs/user-server/userCache\",\"value\":{\"packageName\":\"@proteinjs/user-server\",\"name\":\"userCache\",\"filePath\":\"/home/runner/work/user/user/packages/server/src/authorization/userCache.ts\",\"qualifiedName\":\"@proteinjs/user-server/userCache\",\"type\":{\"packageName\":\"\",\"name\":\"SessionDataCache<User>\",\"filePath\":null,\"qualifiedName\":\"/SessionDataCache<User>\",\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/server-api\",\"name\":\"SessionDataCache\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/server-api/SessionDataCache\",\"typeParameters\":[\"@proteinjs/user/User\"],\"directParents\":null}]},\"isExported\":true,\"isConst\":true,\"sourceType\":0}},{\"v\":\"@proteinjs/server-api/SessionDataCache\"},{\"v\":\"@proteinjs/user-server/createUser\",\"value\":{\"packageName\":\"@proteinjs/user-server\",\"name\":\"createUser\",\"filePath\":\"/home/runner/work/user/user/packages/server/src/routes/createUser.ts\",\"qualifiedName\":\"@proteinjs/user-server/createUser\",\"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\"},{\"v\":\"@proteinjs/user-server/login\",\"value\":{\"packageName\":\"@proteinjs/user-server\",\"name\":\"login\",\"filePath\":\"/home/runner/work/user/user/packages/server/src/routes/login.ts\",\"qualifiedName\":\"@proteinjs/user-server/login\",\"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/user-server/logout\",\"value\":{\"packageName\":\"@proteinjs/user-server\",\"name\":\"logout\",\"filePath\":\"/home/runner/work/user/user/packages/server/src/routes/logout.ts\",\"qualifiedName\":\"@proteinjs/user-server/logout\",\"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}}],\"edges\":[{\"v\":\"@proteinjs/user-server/DbSessionStore\",\"w\":\"express-session/Store\",\"value\":\"extends class\"},{\"v\":\"@proteinjs/user-server/userCache\",\"w\":\"@proteinjs/server-api/SessionDataCache\",\"value\":\"has type\"},{\"v\":\"@proteinjs/user-server/createUser\",\"w\":\"@proteinjs/server-api/Route\",\"value\":\"has type\"},{\"v\":\"@proteinjs/user-server/login\",\"w\":\"@proteinjs/server-api/Route\",\"value\":\"has type\"},{\"v\":\"@proteinjs/user-server/logout\",\"w\":\"@proteinjs/server-api/Route\",\"value\":\"has type\"}]}";
28
28
  /** Generate Source Links */
29
29
  var DbSessionStore_1 = require("../src/authentication/DbSessionStore");
30
30
  var userCache_1 = require("../src/authorization/userCache");
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../generated/index.ts"],"names":[],"mappings":";AAAA,oCAAoC;;;;;;;;;;;;;;;;AAEpC,yBAAuB;AACvB,iCAA+B;AAC/B,iCAA+B;AAC/B,2BAAyB;AACzB,2BAAyB;AACzB,qBAAmB;AACnB,2BAAyB;AACzB,kBAAgB;AAGhB,4BAA4B;AAE5B,IAAM,WAAW,GAAG,2nMAA2nM,CAAC;AAGhpM,4BAA4B;AAE5B,uEAAsE;AACtE,4DAA2D;AAC3D,uDAAsD;AACtD,6CAA4C;AAC5C,+CAA8C;AAE9C,IAAM,WAAW,GAAG;IACnB,uCAAuC,EAAE,+BAAc;IACvD,kCAAkC,EAAE,qBAAS;IAC7C,mCAAmC,EAAE,uBAAU;IAC/C,8BAA8B,EAAE,aAAK;IACrC,+BAA+B,EAAE,eAAM;CACvC,CAAC;AAGF,kCAAkC;AAElC,oDAAyD;AACzD,6BAAgB,CAAC,KAAK,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;AAGjD,2CAAyB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../generated/index.ts"],"names":[],"mappings":";AAAA,oCAAoC;;;;;;;;;;;;;;;;AAEpC,yBAAuB;AACvB,iCAA+B;AAC/B,iCAA+B;AAC/B,2BAAyB;AACzB,2BAAyB;AACzB,qBAAmB;AACnB,2BAAyB;AACzB,kBAAgB;AAGhB,4BAA4B;AAE5B,IAAM,WAAW,GAAG,w7LAAw7L,CAAC;AAG78L,4BAA4B;AAE5B,uEAAsE;AACtE,4DAA2D;AAC3D,uDAAsD;AACtD,6CAA4C;AAC5C,+CAA8C;AAE9C,IAAM,WAAW,GAAG;IACnB,uCAAuC,EAAE,+BAAc;IACvD,kCAAkC,EAAE,qBAAS;IAC7C,mCAAmC,EAAE,uBAAU;IAC/C,8BAA8B,EAAE,aAAK;IACrC,+BAA+B,EAAE,eAAM;CACvC,CAAC;AAGF,kCAAkC;AAElC,oDAAyD;AACzD,6BAAgB,CAAC,KAAK,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;AAGjD,2CAAyB"}
@@ -1 +1 @@
1
- {"version":3,"file":"DbSessionStore.d.ts","sourceRoot":"","sources":["../../../src/authentication/DbSessionStore.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAKxC,qBAAa,cAAe,SAAQ,KAAK;IACrC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAuB;;IAO9D,GAAG,cAAe,MAAM,cAAc,GAAG,YAAY,QAAQ,WAAW,GAAC,IAAI,KAAK,IAAI,UAUrF;IAED,GAAG,cAAe,MAAM,WAAW,QAAQ,WAAW,iBAAgB,GAAG,KAAK,IAAI,uBAE9E;IAED,KAAK,cAAe,MAAM,WAAW,QAAQ,WAAW,iBAAgB,GAAG,KAAK,IAAI,uBAEnF;IAED;;;OAGG;IACN,OAAO,cAAe,MAAM,iBAAgB,GAAG,KAAK,IAAI,uBAOvD;YAEgB,cAAc;YAqCd,KAAK;CAWtB"}
1
+ {"version":3,"file":"DbSessionStore.d.ts","sourceRoot":"","sources":["../../../src/authentication/DbSessionStore.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAKxC,qBAAa,cAAe,SAAQ,KAAK;IACvC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAuB;;IAO3D,GAAG,cAAe,MAAM,cAAc,GAAG,YAAY,QAAQ,WAAW,GAAG,IAAI,KAAK,IAAI,UAUtF;IAEF,GAAG,cAAe,MAAM,WAAW,QAAQ,WAAW,iBAAgB,GAAG,KAAK,IAAI,uBAEhF;IAEF,KAAK,cAAe,MAAM,WAAW,QAAQ,WAAW,iBAAgB,GAAG,KAAK,IAAI,uBAElF;IAEF;;;OAGG;IACH,OAAO,cAAe,MAAM,iBAAgB,GAAG,KAAK,IAAI,uBAQtD;YAEY,cAAc;YA2Cd,KAAK;CAYpB"}
@@ -95,8 +95,9 @@ var DbSessionStore = /** @class */ (function (_super) {
95
95
  case 0: return [4 /*yield*/, (0, destroySession_1.destroySession)(sessionId)];
96
96
  case 1:
97
97
  _a.sent();
98
- if (cb)
98
+ if (cb) {
99
99
  cb();
100
+ }
100
101
  return [2 /*return*/];
101
102
  }
102
103
  });
@@ -114,8 +115,9 @@ var DbSessionStore = /** @class */ (function (_super) {
114
115
  case 0:
115
116
  // Only persist authenticated sessions
116
117
  if (!((_a = session.passport) === null || _a === void 0 ? void 0 : _a.user)) {
117
- if (cb)
118
+ if (cb) {
118
119
  cb();
120
+ }
119
121
  return [2 /*return*/];
120
122
  }
121
123
  return [4 /*yield*/, (0, db_1.getSystemDb)().get(user_1.tables.Session, { sessionId: sessionId })];
@@ -143,7 +145,7 @@ var DbSessionStore = /** @class */ (function (_super) {
143
145
  sessionId: sessionId,
144
146
  session: JSON.stringify(session),
145
147
  expires: session.cookie.expires,
146
- userEmail: (_c = session.passport) === null || _c === void 0 ? void 0 : _c.user
148
+ userEmail: (_c = session.passport) === null || _c === void 0 ? void 0 : _c.user,
147
149
  })];
148
150
  case 7:
149
151
  _d.sent();
@@ -154,8 +156,9 @@ var DbSessionStore = /** @class */ (function (_super) {
154
156
  console.error('Failed to create session', error_2);
155
157
  return [3 /*break*/, 9];
156
158
  case 9:
157
- if (cb)
159
+ if (cb) {
158
160
  cb();
161
+ }
159
162
  return [2 /*return*/];
160
163
  }
161
164
  });
@@ -168,10 +171,12 @@ var DbSessionStore = /** @class */ (function (_super) {
168
171
  switch (_a.label) {
169
172
  case 0: return [4 /*yield*/, (0, db_1.getSystemDb)().tableExists(user_1.tables.Session)];
170
173
  case 1:
171
- if (!(_a.sent()))
174
+ if (!(_a.sent())) {
172
175
  return [2 /*return*/];
176
+ }
173
177
  console.info("Sweeping expired sessions");
174
- qb = new db_1.QueryBuilderFactory().getQueryBuilder(user_1.tables.Session)
178
+ qb = new db_1.QueryBuilderFactory()
179
+ .getQueryBuilder(user_1.tables.Session)
175
180
  .condition({ field: 'expires', operator: '<=', value: new Date() });
176
181
  return [4 /*yield*/, (0, db_1.getSystemDb)().delete(user_1.tables.Session, qb)];
177
182
  case 2:
@@ -1 +1 @@
1
- {"version":3,"file":"DbSessionStore.js","sourceRoot":"","sources":["../../../src/authentication/DbSessionStore.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mDAAwC;AACxC,oCAAiE;AACjE,wCAAyC;AACzC,mDAAkD;AAElD;IAAoC,kCAAK;IAGxC;QAAA,YACO,iBAAO,SAEb;QAED,SAAG,GAAG,UAAC,SAAiB,EAAE,EAA4D;YACrF,CAAC;;;;gCACwB,qBAAM,IAAA,gBAAW,GAAE,CAAC,GAAG,CAAC,aAAM,CAAC,OAAO,EAAE,EAAE,SAAS,WAAA,EAAE,CAAC,EAAA;;4BAA/D,MAAM,GAAG,SAAsD;4BACrE,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AY,GAAG,IAAI,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,AAAtB,CAAuB;IAgG7D,qBAAC;CAAA,AAjGD,CAAoC,uBAAK,GAiGxC;AAjGY,wCAAc"}
@@ -1 +1 @@
1
- {"version":3,"file":"DefaultAdminCredentials.d.ts","sourceRoot":"","sources":["../../../src/authentication/DefaultAdminCredentials.ts"],"names":[],"mappings":"AAAA,qBAAa,uBAAuB;IAChC,OAAO,CAAC,MAAM,CAAC,WAAW,CAAqD;IAE/E,MAAM,CAAC,cAAc,CAAC,WAAW,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE;IAQzE,MAAM,CAAC,cAAc;;;;CAGxB"}
1
+ {"version":3,"file":"DefaultAdminCredentials.d.ts","sourceRoot":"","sources":["../../../src/authentication/DefaultAdminCredentials.ts"],"names":[],"mappings":"AAAA,qBAAa,uBAAuB;IAClC,OAAO,CAAC,MAAM,CAAC,WAAW,CAAqD;IAE/E,MAAM,CAAC,cAAc,CAAC,WAAW,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE;IAQzE,MAAM,CAAC,cAAc;;;;CAGtB"}
@@ -5,8 +5,9 @@ var DefaultAdminCredentials = /** @class */ (function () {
5
5
  function DefaultAdminCredentials() {
6
6
  }
7
7
  DefaultAdminCredentials.setCredentials = function (credentials) {
8
- if (DefaultAdminCredentials.CREDENTIALS)
8
+ if (DefaultAdminCredentials.CREDENTIALS) {
9
9
  return;
10
+ }
10
11
  DefaultAdminCredentials.CREDENTIALS = credentials;
11
12
  };
12
13
  DefaultAdminCredentials.getCredentials = function () {
@@ -1 +1 @@
1
- {"version":3,"file":"DefaultAdminCredentials.js","sourceRoot":"","sources":["../../../src/authentication/DefaultAdminCredentials.ts"],"names":[],"mappings":";;;AAAA;IAAA;IAcA,CAAC;IAXU,sCAAc,GAArB,UAAsB,WAAmD;QACrE,IAAI,uBAAuB,CAAC,WAAW;YACnC,OAAO;QAEX,uBAAuB,CAAC,WAAW,GAAG,WAAW,CAAC;IACtD,CAAC;IAGM,sCAAc,GAArB;QACI,OAAO,uBAAuB,CAAC,WAAW,CAAC;IAC/C,CAAC;IACL,8BAAC;AAAD,CAAC,AAdD,IAcC;AAdY,0DAAuB"}
1
+ {"version":3,"file":"DefaultAdminCredentials.js","sourceRoot":"","sources":["../../../src/authentication/DefaultAdminCredentials.ts"],"names":[],"mappings":";;;AAAA;IAAA;IAcA,CAAC;IAXQ,sCAAc,GAArB,UAAsB,WAAmD;QACvE,IAAI,uBAAuB,CAAC,WAAW,EAAE;YACvC,OAAO;SACR;QAED,uBAAuB,CAAC,WAAW,GAAG,WAAW,CAAC;IACpD,CAAC;IAEM,sCAAc,GAArB;QACE,OAAO,uBAAuB,CAAC,WAAW,CAAC;IAC7C,CAAC;IACH,8BAAC;AAAD,CAAC,AAdD,IAcC;AAdY,0DAAuB"}
@@ -1 +1 @@
1
- {"version":3,"file":"authenticate.d.ts","sourceRoot":"","sources":["../../../src/authentication/authenticate.ts"],"names":[],"mappings":"AAKA,wBAAgB,oBAAoB,CAAC,uBAAuB,CAAC,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,uBAKpG;AAED,wBAAsB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,GAAC,MAAM,CAAC,CAexF"}
1
+ {"version":3,"file":"authenticate.d.ts","sourceRoot":"","sources":["../../../src/authentication/authenticate.ts"],"names":[],"mappings":"AAKA,wBAAgB,oBAAoB,CAAC,uBAAuB,CAAC,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,uBAMpG;AAED,wBAAsB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,GAAG,MAAM,CAAC,CAoB1F"}
@@ -45,8 +45,9 @@ var db_1 = require("@proteinjs/db");
45
45
  var user_1 = require("@proteinjs/user");
46
46
  var DefaultAdminCredentials_1 = require("./DefaultAdminCredentials");
47
47
  function createAuthentication(defaultAdminCredentials) {
48
- if (defaultAdminCredentials)
48
+ if (defaultAdminCredentials) {
49
49
  DefaultAdminCredentials_1.DefaultAdminCredentials.setCredentials(defaultAdminCredentials);
50
+ }
50
51
  return authenticate;
51
52
  }
52
53
  exports.createAuthentication = createAuthentication;
@@ -57,23 +58,25 @@ function authenticate(email, password) {
57
58
  switch (_a.label) {
58
59
  case 0:
59
60
  defaultAdminCredentials = DefaultAdminCredentials_1.DefaultAdminCredentials.getCredentials();
60
- if (defaultAdminCredentials && defaultAdminCredentials.username == email && defaultAdminCredentials.password == password) {
61
+ if (defaultAdminCredentials &&
62
+ defaultAdminCredentials.username == email &&
63
+ defaultAdminCredentials.password == password) {
61
64
  console.info('Authenitcated default admin user');
62
65
  return [2 /*return*/, true];
63
66
  }
64
67
  return [4 /*yield*/, (0, db_1.getSystemDb)().query(user_1.tables.User, {
65
68
  email: email,
66
- password: (0, sha256_1.default)(password).toString()
69
+ password: (0, sha256_1.default)(password).toString(),
67
70
  })];
68
71
  case 1:
69
72
  users = _a.sent();
70
- if (users.length < 1)
73
+ if (users.length < 1) {
71
74
  return [2 /*return*/, 'User name or password incorrect'];
75
+ }
72
76
  return [2 /*return*/, true];
73
77
  }
74
78
  });
75
79
  });
76
80
  }
77
81
  exports.authenticate = authenticate;
78
- ;
79
82
  //# sourceMappingURL=authenticate.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"authenticate.js","sourceRoot":"","sources":["../../../src/authentication/authenticate.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4DAAsC;AACtC,oCAA4C;AAC5C,wCAAyC;AACzC,qEAAoE;AAEpE,SAAgB,oBAAoB,CAAC,uBAAgE;IAC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ACE,uBAAuB;wBACvB,uBAAuB,CAAC,QAAQ,IAAI,KAAK;wBACzC,uBAAuB,CAAC,QAAQ,IAAI,QAAQ,EAC5C;wBACA,OAAO,CAAC,IAAI,CAAC,kCAAkC,CAAC,CAAC;wBACjD,sBAAO,IAAI,EAAC;qBACb;oBAEa,qBAAM,IAAA,gBAAW,GAAE,CAAC,KAAK,CAAC,aAAM,CAAC,IAAI,EAAE;4BACnD,KAAK,OAAA;4BACL,QAAQ,EAAE,IAAA,gBAAM,EAAC,QAAQ,CAAC,CAAC,QAAQ,EAAE;yBACtC,CAAC,EAAA;;oBAHI,KAAK,GAAG,SAGZ;oBACF,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE;wBACpB,sBAAO,iCAAiC,EAAC;qBAC1C;oBAED,sBAAO,IAAI,EAAC;;;;CACb;AApBD,oCAoBC"}
@@ -1 +1 @@
1
- {"version":3,"file":"destroySession.d.ts","sourceRoot":"","sources":["../../../src/authentication/destroySession.ts"],"names":[],"mappings":"AAGA,wBAAsB,cAAc,CAAC,SAAS,CAAC,EAAE,MAAM,iBAKtD"}
1
+ {"version":3,"file":"destroySession.d.ts","sourceRoot":"","sources":["../../../src/authentication/destroySession.ts"],"names":[],"mappings":"AAGA,wBAAsB,cAAc,CAAC,SAAS,CAAC,EAAE,MAAM,iBAMtD"}
@@ -44,8 +44,9 @@ function destroySession(sessionId) {
44
44
  return __generator(this, function (_a) {
45
45
  switch (_a.label) {
46
46
  case 0:
47
- if (!sessionId)
47
+ if (!sessionId) {
48
48
  return [2 /*return*/];
49
+ }
49
50
  return [4 /*yield*/, (0, db_1.getSystemDb)().delete(user_1.tables.Session, { sessionId: sessionId })];
50
51
  case 1:
51
52
  _a.sent();
@@ -1 +1 @@
1
- {"version":3,"file":"destroySession.js","sourceRoot":"","sources":["../../../src/authentication/destroySession.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oCAA4C;AAC5C,wCAAyC;AAEzC,SAAsB,cAAc,CAAC,SAAkB;;;;;oBACnD,IAAI,CAAC,SAAS;wBACV,sBAAO;oBAEX,qBAAM,IAAA,gBAAW,GAAE,CAAC,MAAM,CAAC,aAAM,CAAC,OAAO,EAAE,EAAE,SAAS,WAAA,EAAE,CAAC,EAAA;;oBAAzD,SAAyD,CAAC;;;;;CAC7D;AALD,wCAKC"}
1
+ {"version":3,"file":"destroySession.js","sourceRoot":"","sources":["../../../src/authentication/destroySession.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oCAA4C;AAC5C,wCAAyC;AAEzC,SAAsB,cAAc,CAAC,SAAkB;;;;;oBACrD,IAAI,CAAC,SAAS,EAAE;wBACd,sBAAO;qBACR;oBAED,qBAAM,IAAA,gBAAW,GAAE,CAAC,MAAM,CAAC,aAAM,CAAC,OAAO,EAAE,EAAE,SAAS,WAAA,EAAE,CAAC,EAAA;;oBAAzD,SAAyD,CAAC;;;;;CAC3D;AAND,wCAMC"}
@@ -1 +1 @@
1
- {"version":3,"file":"userCache.d.ts","sourceRoot":"","sources":["../../../src/authorization/userCache.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,OAAO,EAAE,IAAI,EAA6C,MAAM,iBAAiB,CAAC;AAGlF,eAAO,MAAM,SAAS,EAAE,gBAAgB,CAAC,IAAI,CAgB5C,CAAA"}
1
+ {"version":3,"file":"userCache.d.ts","sourceRoot":"","sources":["../../../src/authorization/userCache.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,OAAO,EAAE,IAAI,EAA6C,MAAM,iBAAiB,CAAC;AAGlF,eAAO,MAAM,SAAS,EAAE,gBAAgB,CAAC,IAAI,CA0B5C,CAAC"}
@@ -55,16 +55,26 @@ exports.userCache = {
55
55
  if (!userEmail) return [3 /*break*/, 3];
56
56
  adminCredentials = DefaultAdminCredentials_1.DefaultAdminCredentials.getCredentials();
57
57
  if (!(adminCredentials && userEmail == adminCredentials.username)) return [3 /*break*/, 1];
58
- adminUser = { name: 'Admin', email: adminCredentials.username, password: adminCredentials.password, emailVerified: true, roles: 'admin', created: (0, moment_1.default)(), updated: (0, moment_1.default)(), id: 'admin' };
58
+ adminUser = {
59
+ name: 'Admin',
60
+ email: adminCredentials.username,
61
+ password: adminCredentials.password,
62
+ emailVerified: true,
63
+ roles: 'admin',
64
+ created: (0, moment_1.default)(),
65
+ updated: (0, moment_1.default)(),
66
+ id: 'admin',
67
+ };
59
68
  user = adminUser;
60
69
  return [3 /*break*/, 3];
61
70
  case 1: return [4 /*yield*/, (0, db_1.getSystemDb)().get(user_1.tables.User, { email: userEmail })];
62
71
  case 2:
63
72
  user = _a.sent();
73
+ delete user['password'];
64
74
  _a.label = 3;
65
75
  case 3: return [2 /*return*/, user];
66
76
  }
67
77
  });
68
- }); }
78
+ }); },
69
79
  };
70
80
  //# sourceMappingURL=userCache.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"userCache.js","sourceRoot":"","sources":["../../../src/authorization/userCache.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAA4B;AAE5B,oCAA4C;AAC5C,wCAAkF;AAClF,qFAAoF;AAEvE,QAAA,SAAS,GAA2B;IAC7C,GAAG,EAAE,6BAAsB;IAC3B,MAAM,EAAE,UAAO,SAAiB,EAAE,SAAiB;;;;;oBAC3C,IAAI,GAAG,gBAAS,CAAC;yBACjB,SAAS,EAAT,wBAAS;oBACH,gBAAgB,GAAG,iDAAuB,CAAC,cAAc,EAAE,CAAC;yBAC9D,CAAA,gBAAgB,IAAI,SAAS,IAAI,gBAAgB,CAAC,QAAQ,CAAA,EAA1D,wBAA0D;oBACpD,SAAS,GAAS,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,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AEV,qBAAM,IAAA,gBAAW,GAAE,CAAC,GAAG,CAAC,aAAM,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,EAAA;;oBAAjE,IAAI,GAAG,SAA0D,CAAC;oBAClE,OAAQ,IAAY,CAAC,UAAU,CAAC,CAAC;;wBAIrC,sBAAO,IAAI,EAAC;;;SACb;CACF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"createUser.d.ts","sourceRoot":"","sources":["../../../src/routes/createUser.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAK9C,eAAO,MAAM,UAAU,EAAE,KAyBxB,CAAA"}
1
+ {"version":3,"file":"createUser.d.ts","sourceRoot":"","sources":["../../../src/routes/createUser.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAK9C,eAAO,MAAM,UAAU,EAAE,KAyBxB,CAAC"}
@@ -78,6 +78,6 @@ exports.createUser = {
78
78
  return [2 /*return*/];
79
79
  }
80
80
  });
81
- }); }
81
+ }); },
82
82
  };
83
83
  //# sourceMappingURL=createUser.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"createUser.js","sourceRoot":"","sources":["../../../src/routes/createUser.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4DAAsC;AAEtC,oCAA4C;AAC5C,wCAAuD;AACvD,wCAAyC;AAE5B,QAAA,UAAU,GAAU;IAC7B,IAAI,EAAE,aAAM,CAAC,UAAU,CAAC,IAAI;IAC5B,MAAM,EAAE,aAAM,CAAC,UAAU,CAAC,MAAM;IAChC,SAAS,EAAE,UAAO,OAAO,EAAE,QAAQ;;;;;oBACzB,MAAM,GAAG,IAAI,aAAM,CAAC,YAAY,CAAC,CAAC;oBAClC,IAAI,GAAG,OAAO,CAAC,IAAY,CAAC;oBAC5B,EAAE,GAAG,IAAA,gBAAW,GAAE,C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YAAY,CAAC,CAAC;oBAClC,IAAI,GAAG,OAAO,CAAC,IAAY,CAAC;oBAC5B,EAAE,GAAG,IAAA,gBAAW,GAAE,CAAC;oBACN,qBAAM,EAAE,CAAC,GAAG,CAAC,aAAM,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC,EAAA;;oBAA7D,UAAU,GAAG,SAAgD;oBACnE,IAAI,UAAU,EAAE;wBACR,KAAK,GAAG,qCAAqC,CAAC;wBACpD,OAAO,CAAC,KAAK,CAAC,UAAG,KAAK,eAAK,IAAI,CAAC,KAAK,CAAE,CAAC,CAAC;wBACzC,QAAQ,CAAC,IAAI,CAAC,EAAE,KAAK,OAAA,EAAE,CAAC,CAAC;wBACzB,sBAAO;qBACR;oBAED,qBAAM,EAAE,CAAC,MAAM,CAAC,aAAM,CAAC,IAAI,EAAE;4BAC3B,IAAI,EAAE,IAAI,CAAC,IAAI;4BACf,KAAK,EAAE,IAAI,CAAC,KAAK;4BACjB,QAAQ,EAAE,IAAA,gBAAM,EAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,QAAQ,EAAE;4BAC1C,aAAa,EAAE,KAAK;4BACpB,KAAK,EAAE,EAAE;yBACV,CAAC,EAAA;;oBANF,SAME,CAAC;oBACH,MAAM,CAAC,IAAI,CAAC,wBAAiB,IAAI,CAAC,KAAK,CAAE,CAAC,CAAC;oBAC3C,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;;;;SACnB;CACF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../../src/routes/login.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAI9C,eAAO,MAAM,KAAK,EAAE,KAwBnB,CAAA"}
1
+ {"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../../src/routes/login.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAI9C,eAAO,MAAM,KAAK,EAAE,KAwBnB,CAAC"}
@@ -71,6 +71,6 @@ exports.login = {
71
71
  return [2 /*return*/];
72
72
  }
73
73
  });
74
- }); }
74
+ }); },
75
75
  };
76
76
  //# sourceMappingURL=login.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"login.js","sourceRoot":"","sources":["../../../src/routes/login.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,wCAAyC;AACzC,+DAA8D;AAEjD,QAAA,KAAK,GAAU;IACxB,IAAI,EAAE,aAAM,CAAC,KAAK,CAAC,IAAI;IACvB,MAAM,EAAE,aAAM,CAAC,KAAK,CAAC,MAAM;IAC3B,SAAS,EAAE,UAAO,OAAY,EAAE,QAAQ;;;;;oBAC9B,WAAW,GAAsC,OAAO,CAAC,IAAI,CAAC;oBACpE,IAAI,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE;wBACvC,KAAK,GAAG,oCAAoC,CAAC;wBACnD,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;wBACrB,QAAQ,CAAC,IAAI,CAAC,EAAE,KAAK,OAAA,EAAE,CAAC,CAAC;wBACzB,sBAAO;qBACV;oBAEc,qBAAM,IAAA,2BAAY,EAAC,WAAW,CAAC,KAAK,EAAE,WAAW,CAAC,QAAQ,CAAC,EAAA;;oBAApE,MAAM,GAAG,SAA2D;oBAC1E,IAAI,MAAM,KAAK,IAAI,EAAE;wBACjB,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;wBACtB,QAAQ,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC;wBACjC,sBAAO;qBACV;oBAED,qBAAM,IAAI,OAAO,CAAC,UAAC,OAAO,EAAE,MAAM;4BAC9B,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;wBAC9C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AC,CAAC;;;;SACnB;CACF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"logout.d.ts","sourceRoot":"","sources":["../../../src/routes/logout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAI9C,eAAO,MAAM,MAAM,EAAE,KAuBpB,CAAA"}
1
+ {"version":3,"file":"logout.d.ts","sourceRoot":"","sources":["../../../src/routes/logout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAI9C,eAAO,MAAM,MAAM,EAAE,KAuBpB,CAAC"}
@@ -82,6 +82,6 @@ exports.logout = {
82
82
  return [2 /*return*/];
83
83
  }
84
84
  });
85
- }); }
85
+ }); },
86
86
  };
87
87
  //# sourceMappingURL=logout.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"logout.js","sourceRoot":"","sources":["../../../src/routes/logout.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,wCAAyC;AACzC,mEAAkE;AAErD,QAAA,MAAM,GAAU;IACzB,IAAI,EAAE,aAAM,CAAC,MAAM,CAAC,IAAI;IACxB,MAAM,EAAE,aAAM,CAAC,MAAM,CAAC,MAAM;IAC5B,SAAS,EAAE,UAAO,OAAY,EAAE,QAAQ;;;;gBACpC,oBAAoB;gBACpB,mCAAmC;gBACnC,2CAA2C;gBAC3C,iDAAiD;gBACjD,uBAAuB;gBACvB,6BAA6B;gBAC7B,sBAAsB;gBACtB,YAAY;gBAEZ,qBAAqB;gBACrB,UAAU;gBACV,MAAM;gBACN,2CAA2C;gBAC3C,2DAA2D;gBAC3D,+DAA+D;gBAC/D,qBAAM,IAAA,+BAAc,EAAC,OAAO,CAAC,SAAS,CAAC,EAAA;;oBAfvC,oBAAoB;oBACpB,mCAAmC;oBACnC,2CAA2C;oBAC3C,iDAAiD;oBACjD,uBAAuB;oBACvB,6BAA6B;oBAC7B,sBAAsB;oBAC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;CACF,CAAC"}
@@ -9,11 +9,10 @@ import 'crypto-js';
9
9
  import 'express-session';
10
10
  import 'moment';
11
11
 
12
-
13
12
  /** Generate Source Graph */
14
13
 
15
- const sourceGraph = "{\"options\":{\"directed\":true,\"multigraph\":false,\"compound\":false},\"nodes\":[{\"v\":\"@proteinjs/user-server/DbSessionStore\",\"value\":{\"packageName\":\"@proteinjs/user-server\",\"name\":\"DbSessionStore\",\"filePath\":\"/Users/brentbahry/workspaces/n3xa/packages/proteinjs/packages/user/packages/server/src/authentication/DbSessionStore.ts\",\"qualifiedName\":\"@proteinjs/user-server/DbSessionStore\",\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"properties\":[{\"name\":\"TWELVE_HOURS\",\"type\":null,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":true,\"visibility\":\"private\"},{\"name\":\"get\",\"type\":null,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"set\",\"type\":null,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"touch\",\"type\":null,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"destroy\",\"type\":null,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"}],\"methods\":[{\"name\":\"insertOrUpdate\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<void>\",\"filePath\":null,\"qualifiedName\":\"/Promise<void>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":true,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\",\"parameters\":[{\"name\":\"sessionId\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"session\",\"type\":{\"packageName\":\"\",\"name\":\"Express.SessionData\",\"filePath\":null,\"qualifiedName\":\"/Express.SessionData\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"cb\",\"type\":{\"packageName\":\"\",\"name\":\"(error?: any) => void\",\"filePath\":null,\"qualifiedName\":\"/(error?: any) => void\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"sweep\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<void>\",\"filePath\":null,\"qualifiedName\":\"/Promise<void>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":true,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\",\"parameters\":[]}],\"typeParameters\":[],\"directParentInterfaces\":[],\"directParentClasses\":[{\"packageName\":\"express-session\",\"name\":\"Store\",\"filePath\":null,\"qualifiedName\":\"express-session/Store\",\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParentInterfaces\":[],\"directParentClasses\":[]}],\"sourceType\":2}},{\"v\":\"express-session/Store\"},{\"v\":\"@proteinjs/user-server/userCache\",\"value\":{\"packageName\":\"@proteinjs/user-server\",\"name\":\"userCache\",\"filePath\":\"/Users/brentbahry/workspaces/n3xa/packages/proteinjs/packages/user/packages/server/src/authorization/userCache.ts\",\"qualifiedName\":\"@proteinjs/user-server/userCache\",\"type\":{\"packageName\":\"\",\"name\":\"SessionDataCache<User>\",\"filePath\":null,\"qualifiedName\":\"/SessionDataCache<User>\",\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/server-api\",\"name\":\"SessionDataCache\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/server-api/SessionDataCache\",\"typeParameters\":[\"@proteinjs/user/User\"],\"directParents\":null}]},\"isExported\":true,\"isConst\":true,\"sourceType\":0}},{\"v\":\"@proteinjs/server-api/SessionDataCache\"},{\"v\":\"@proteinjs/user-server/createUser\",\"value\":{\"packageName\":\"@proteinjs/user-server\",\"name\":\"createUser\",\"filePath\":\"/Users/brentbahry/workspaces/n3xa/packages/proteinjs/packages/user/packages/server/src/routes/createUser.ts\",\"qualifiedName\":\"@proteinjs/user-server/createUser\",\"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\"},{\"v\":\"@proteinjs/user-server/login\",\"value\":{\"packageName\":\"@proteinjs/user-server\",\"name\":\"login\",\"filePath\":\"/Users/brentbahry/workspaces/n3xa/packages/proteinjs/packages/user/packages/server/src/routes/login.ts\",\"qualifiedName\":\"@proteinjs/user-server/login\",\"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/user-server/logout\",\"value\":{\"packageName\":\"@proteinjs/user-server\",\"name\":\"logout\",\"filePath\":\"/Users/brentbahry/workspaces/n3xa/packages/proteinjs/packages/user/packages/server/src/routes/logout.ts\",\"qualifiedName\":\"@proteinjs/user-server/logout\",\"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}}],\"edges\":[{\"v\":\"@proteinjs/user-server/DbSessionStore\",\"w\":\"express-session/Store\",\"value\":\"extends class\"},{\"v\":\"@proteinjs/user-server/userCache\",\"w\":\"@proteinjs/server-api/SessionDataCache\",\"value\":\"has type\"},{\"v\":\"@proteinjs/user-server/createUser\",\"w\":\"@proteinjs/server-api/Route\",\"value\":\"has type\"},{\"v\":\"@proteinjs/user-server/login\",\"w\":\"@proteinjs/server-api/Route\",\"value\":\"has type\"},{\"v\":\"@proteinjs/user-server/logout\",\"w\":\"@proteinjs/server-api/Route\",\"value\":\"has type\"}]}";
16
-
14
+ const sourceGraph =
15
+ '{"options":{"directed":true,"multigraph":false,"compound":false},"nodes":[{"v":"@proteinjs/user-server/DbSessionStore","value":{"packageName":"@proteinjs/user-server","name":"DbSessionStore","filePath":"/home/runner/work/user/user/packages/server/src/authentication/DbSessionStore.ts","qualifiedName":"@proteinjs/user-server/DbSessionStore","isAbstract":false,"isStatic":false,"visibility":"public","properties":[{"name":"TWELVE_HOURS","type":null,"isOptional":false,"isAbstract":false,"isStatic":true,"visibility":"private"},{"name":"get","type":null,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public"},{"name":"set","type":null,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public"},{"name":"touch","type":null,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public"},{"name":"destroy","type":null,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public"}],"methods":[{"name":"insertOrUpdate","returnType":{"packageName":"","name":"Promise<void>","filePath":null,"qualifiedName":"/Promise<void>","typeParameters":null,"directParents":null},"isAsync":true,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"private","parameters":[{"name":"sessionId","type":{"packageName":"","name":"string","filePath":null,"qualifiedName":"/string","typeParameters":null,"directParents":null}},{"name":"session","type":{"packageName":"","name":"Express.SessionData","filePath":null,"qualifiedName":"/Express.SessionData","typeParameters":null,"directParents":null}},{"name":"cb","type":{"packageName":"","name":"(error?: any) => void","filePath":null,"qualifiedName":"/(error?: any) => void","typeParameters":null,"directParents":null}}]},{"name":"sweep","returnType":{"packageName":"","name":"Promise<void>","filePath":null,"qualifiedName":"/Promise<void>","typeParameters":null,"directParents":null},"isAsync":true,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"private","parameters":[]}],"typeParameters":[],"directParentInterfaces":[],"directParentClasses":[{"packageName":"express-session","name":"Store","filePath":null,"qualifiedName":"express-session/Store","isAbstract":false,"isStatic":false,"visibility":"public","properties":[],"methods":[],"typeParameters":[],"directParentInterfaces":[],"directParentClasses":[]}],"sourceType":2}},{"v":"express-session/Store"},{"v":"@proteinjs/user-server/userCache","value":{"packageName":"@proteinjs/user-server","name":"userCache","filePath":"/home/runner/work/user/user/packages/server/src/authorization/userCache.ts","qualifiedName":"@proteinjs/user-server/userCache","type":{"packageName":"","name":"SessionDataCache<User>","filePath":null,"qualifiedName":"/SessionDataCache<User>","typeParameters":[],"directParents":[{"packageName":"@proteinjs/server-api","name":"SessionDataCache","filePath":null,"qualifiedName":"@proteinjs/server-api/SessionDataCache","typeParameters":["@proteinjs/user/User"],"directParents":null}]},"isExported":true,"isConst":true,"sourceType":0}},{"v":"@proteinjs/server-api/SessionDataCache"},{"v":"@proteinjs/user-server/createUser","value":{"packageName":"@proteinjs/user-server","name":"createUser","filePath":"/home/runner/work/user/user/packages/server/src/routes/createUser.ts","qualifiedName":"@proteinjs/user-server/createUser","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"},{"v":"@proteinjs/user-server/login","value":{"packageName":"@proteinjs/user-server","name":"login","filePath":"/home/runner/work/user/user/packages/server/src/routes/login.ts","qualifiedName":"@proteinjs/user-server/login","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/user-server/logout","value":{"packageName":"@proteinjs/user-server","name":"logout","filePath":"/home/runner/work/user/user/packages/server/src/routes/logout.ts","qualifiedName":"@proteinjs/user-server/logout","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}}],"edges":[{"v":"@proteinjs/user-server/DbSessionStore","w":"express-session/Store","value":"extends class"},{"v":"@proteinjs/user-server/userCache","w":"@proteinjs/server-api/SessionDataCache","value":"has type"},{"v":"@proteinjs/user-server/createUser","w":"@proteinjs/server-api/Route","value":"has type"},{"v":"@proteinjs/user-server/login","w":"@proteinjs/server-api/Route","value":"has type"},{"v":"@proteinjs/user-server/logout","w":"@proteinjs/server-api/Route","value":"has type"}]}';
17
16
 
18
17
  /** Generate Source Links */
19
18
 
@@ -24,18 +23,16 @@ import { login } from '../src/routes/login';
24
23
  import { logout } from '../src/routes/logout';
25
24
 
26
25
  const sourceLinks = {
27
- '@proteinjs/user-server/DbSessionStore': DbSessionStore,
28
- '@proteinjs/user-server/userCache': userCache,
29
- '@proteinjs/user-server/createUser': createUser,
30
- '@proteinjs/user-server/login': login,
31
- '@proteinjs/user-server/logout': logout,
26
+ '@proteinjs/user-server/DbSessionStore': DbSessionStore,
27
+ '@proteinjs/user-server/userCache': userCache,
28
+ '@proteinjs/user-server/createUser': createUser,
29
+ '@proteinjs/user-server/login': login,
30
+ '@proteinjs/user-server/logout': logout,
32
31
  };
33
32
 
34
-
35
33
  /** Load Source Graph and Links */
36
34
 
37
35
  import { SourceRepository } from '@proteinjs/reflection';
38
36
  SourceRepository.merge(sourceGraph, sourceLinks);
39
37
 
40
-
41
- export * from '../index';
38
+ export * from '../index';
package/index.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  export { createAuthentication } from './src/authentication/authenticate';
2
- export * from './src/authentication/DbSessionStore';
2
+ export * from './src/authentication/DbSessionStore';
package/jest.config.js CHANGED
@@ -1,18 +1,9 @@
1
1
  module.exports = {
2
- "roots": [
3
- "<rootDir>/test"
4
- ],
5
- "transform": {
6
- "^.+\\.tsx?$": "ts-jest"
7
- },
8
- "testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.tsx?$",
9
- "moduleFileExtensions": [
10
- "ts",
11
- "tsx",
12
- "js",
13
- "jsx",
14
- "json",
15
- "node"
16
- ],
17
- "testEnvironment": "node"
18
- }
2
+ roots: ['<rootDir>/test'],
3
+ transform: {
4
+ '^.+\\.tsx?$': 'ts-jest',
5
+ },
6
+ testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.tsx?$',
7
+ moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
8
+ testEnvironment: 'node',
9
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proteinjs/user-server",
3
- "version": "1.0.11",
3
+ "version": "1.0.13",
4
4
  "description": "User server components",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -24,7 +24,7 @@
24
24
  "@proteinjs/db": "1.0.15",
25
25
  "@proteinjs/reflection": "1.1.1",
26
26
  "@proteinjs/server-api": "1.1.1",
27
- "@proteinjs/user": "^1.0.12",
27
+ "@proteinjs/user": "^1.0.13",
28
28
  "@proteinjs/util": "1.1.0",
29
29
  "crypto-js": "4.0.0",
30
30
  "express-session": "1.17.1",
@@ -35,8 +35,14 @@
35
35
  "@types/crypto-js": "4.0.1",
36
36
  "@types/express-session": "1.17.0",
37
37
  "@types/node": "14.0.13",
38
+ "@typescript-eslint/eslint-plugin": "7.8.0",
39
+ "@typescript-eslint/parser": "7.8.0",
40
+ "eslint": "8.57.0",
41
+ "eslint-config-prettier": "9.1.0",
42
+ "eslint-plugin-prettier": "5.1.3",
38
43
  "typescript": "5.2.2"
39
44
  },
40
45
  "main": "./dist/generated/index.js",
41
- "types": "./dist/generated/index.d.ts"
42
- }
46
+ "types": "./dist/generated/index.d.ts",
47
+ "gitHead": "c8b2ef70c1811cbd9c8c09f98d67dadd60235fd2"
48
+ }
@@ -4,92 +4,100 @@ import { tables } from '@proteinjs/user';
4
4
  import { destroySession } from './destroySession';
5
5
 
6
6
  export class DbSessionStore extends Store {
7
- private static readonly TWELVE_HOURS = 1000 * 60 * 60 * 12;
7
+ private static readonly TWELVE_HOURS = 1000 * 60 * 60 * 12;
8
8
 
9
- constructor() {
10
- super();
11
- setInterval(this.sweep, DbSessionStore.TWELVE_HOURS);
12
- }
9
+ constructor() {
10
+ super();
11
+ setInterval(this.sweep, DbSessionStore.TWELVE_HOURS);
12
+ }
13
13
 
14
- get = (sessionId: string, cb: (error: any, session?: Express.SessionData|null) => void) => {
15
- (async () => {
16
- const result = await getSystemDb().get(tables.Session, { sessionId });
17
- if (!result) {
18
- cb(null);
19
- return;
20
- }
14
+ get = (sessionId: string, cb: (error: any, session?: Express.SessionData | null) => void) => {
15
+ (async () => {
16
+ const result = await getSystemDb().get(tables.Session, { sessionId });
17
+ if (!result) {
18
+ cb(null);
19
+ return;
20
+ }
21
21
 
22
- return cb(null, JSON.parse(result.session));
23
- })();
24
- }
22
+ return cb(null, JSON.parse(result.session));
23
+ })();
24
+ };
25
25
 
26
- set = (sessionId: string, session: Express.SessionData, cb?: (error?: any) => void) => {
27
- this.insertOrUpdate(sessionId, session, cb);
28
- }
29
-
30
- touch = (sessionId: string, session: Express.SessionData, cb?: (error?: any) => void) => {
31
- this.insertOrUpdate(sessionId, session, cb);
32
- }
26
+ set = (sessionId: string, session: Express.SessionData, cb?: (error?: any) => void) => {
27
+ this.insertOrUpdate(sessionId, session, cb);
28
+ };
29
+
30
+ touch = (sessionId: string, session: Express.SessionData, cb?: (error?: any) => void) => {
31
+ this.insertOrUpdate(sessionId, session, cb);
32
+ };
33
33
 
34
- /**
35
- * Does not get called since request.logout is broken
36
- * See logout.ts
37
- */
38
- destroy = (sessionId: string, cb?: (error?: any) => void) => {
39
- // console.info('in destroy');
40
- (async () => {
41
- await destroySession(sessionId);
42
- if (cb)
43
- cb();
44
- })();
45
- }
34
+ /**
35
+ * Does not get called since request.logout is broken
36
+ * See logout.ts
37
+ */
38
+ destroy = (sessionId: string, cb?: (error?: any) => void) => {
39
+ // console.info('in destroy');
40
+ (async () => {
41
+ await destroySession(sessionId);
42
+ if (cb) {
43
+ cb();
44
+ }
45
+ })();
46
+ };
46
47
 
47
- private async insertOrUpdate(sessionId: string, session: Express.SessionData, cb?: (error?: any) => void): Promise<void> {
48
- // Only persist authenticated sessions
49
- if (!session.passport?.user) {
50
- if (cb)
51
- cb();
48
+ private async insertOrUpdate(
49
+ sessionId: string,
50
+ session: Express.SessionData,
51
+ cb?: (error?: any) => void
52
+ ): Promise<void> {
53
+ // Only persist authenticated sessions
54
+ if (!session.passport?.user) {
55
+ if (cb) {
56
+ cb();
57
+ }
52
58
 
53
- return;
54
- }
59
+ return;
60
+ }
55
61
 
56
- const sessionRecord = await getSystemDb().get(tables.Session, { sessionId });
57
- if (sessionRecord) {
58
- try {
59
- sessionRecord.session = JSON.stringify(session);
60
- sessionRecord.expires = (<Date>session.cookie.expires);
61
- sessionRecord.userEmail = session.passport?.user;
62
- await getSystemDb().update(tables.Session, sessionRecord, { sessionId });
63
- } catch (error) {
64
- console.error('Failed to update session', error);
65
- }
66
- } else {
67
- try {
68
- await getSystemDb().insert(tables.Session, {
69
- sessionId,
70
- session: JSON.stringify(session),
71
- expires: (<Date>session.cookie.expires),
72
- userEmail: session.passport?.user
73
- });
74
- } catch (error) {
75
- // race condition on insert
76
- console.error('Failed to create session', error);
77
- }
78
- }
62
+ const sessionRecord = await getSystemDb().get(tables.Session, { sessionId });
63
+ if (sessionRecord) {
64
+ try {
65
+ sessionRecord.session = JSON.stringify(session);
66
+ sessionRecord.expires = <Date>session.cookie.expires;
67
+ sessionRecord.userEmail = session.passport?.user;
68
+ await getSystemDb().update(tables.Session, sessionRecord, { sessionId });
69
+ } catch (error) {
70
+ console.error('Failed to update session', error);
71
+ }
72
+ } else {
73
+ try {
74
+ await getSystemDb().insert(tables.Session, {
75
+ sessionId,
76
+ session: JSON.stringify(session),
77
+ expires: <Date>session.cookie.expires,
78
+ userEmail: session.passport?.user,
79
+ });
80
+ } catch (error) {
81
+ // race condition on insert
82
+ console.error('Failed to create session', error);
83
+ }
84
+ }
79
85
 
80
- if (cb)
81
- cb();
86
+ if (cb) {
87
+ cb();
82
88
  }
89
+ }
83
90
 
84
- private async sweep(): Promise<void> {
85
- if (!await getSystemDb().tableExists(tables.Session))
86
- return;
91
+ private async sweep(): Promise<void> {
92
+ if (!(await getSystemDb().tableExists(tables.Session))) {
93
+ return;
94
+ }
87
95
 
88
- console.info(`Sweeping expired sessions`);
89
- const qb = new QueryBuilderFactory().getQueryBuilder(tables.Session)
90
- .condition({ field: 'expires', operator: '<=', value: new Date() })
91
- ;
92
- const deleteCount = await getSystemDb().delete(tables.Session, qb);
93
- console.info(`Swept ${deleteCount} expired sessions`);
94
- }
95
- }
96
+ console.info(`Sweeping expired sessions`);
97
+ const qb = new QueryBuilderFactory()
98
+ .getQueryBuilder(tables.Session)
99
+ .condition({ field: 'expires', operator: '<=', value: new Date() });
100
+ const deleteCount = await getSystemDb().delete(tables.Session, qb);
101
+ console.info(`Swept ${deleteCount} expired sessions`);
102
+ }
103
+ }
@@ -1,15 +1,15 @@
1
1
  export class DefaultAdminCredentials {
2
- private static CREDENTIALS: { username: string, password: string } | undefined;
2
+ private static CREDENTIALS: { username: string; password: string } | undefined;
3
3
 
4
- static setCredentials(credentials: { username: string, password: string }) {
5
- if (DefaultAdminCredentials.CREDENTIALS)
6
- return;
7
-
8
- DefaultAdminCredentials.CREDENTIALS = credentials;
4
+ static setCredentials(credentials: { username: string; password: string }) {
5
+ if (DefaultAdminCredentials.CREDENTIALS) {
6
+ return;
9
7
  }
10
8
 
9
+ DefaultAdminCredentials.CREDENTIALS = credentials;
10
+ }
11
11
 
12
- static getCredentials() {
13
- return DefaultAdminCredentials.CREDENTIALS;
14
- }
15
- }
12
+ static getCredentials() {
13
+ return DefaultAdminCredentials.CREDENTIALS;
14
+ }
15
+ }
@@ -3,26 +3,32 @@ import { getSystemDb } from '@proteinjs/db';
3
3
  import { tables } from '@proteinjs/user';
4
4
  import { DefaultAdminCredentials } from './DefaultAdminCredentials';
5
5
 
6
- export function createAuthentication(defaultAdminCredentials?: { username: string, password: string }) {
7
- if (defaultAdminCredentials)
8
- DefaultAdminCredentials.setCredentials(defaultAdminCredentials);
6
+ export function createAuthentication(defaultAdminCredentials?: { username: string; password: string }) {
7
+ if (defaultAdminCredentials) {
8
+ DefaultAdminCredentials.setCredentials(defaultAdminCredentials);
9
+ }
9
10
 
10
- return authenticate;
11
+ return authenticate;
11
12
  }
12
13
 
13
- export async function authenticate(email: string, password: string): Promise<true|string> {
14
- const defaultAdminCredentials = DefaultAdminCredentials.getCredentials();
15
- if (defaultAdminCredentials && defaultAdminCredentials.username == email && defaultAdminCredentials.password == password) {
16
- console.info('Authenitcated default admin user');
17
- return true;
18
- }
14
+ export async function authenticate(email: string, password: string): Promise<true | string> {
15
+ const defaultAdminCredentials = DefaultAdminCredentials.getCredentials();
16
+ if (
17
+ defaultAdminCredentials &&
18
+ defaultAdminCredentials.username == email &&
19
+ defaultAdminCredentials.password == password
20
+ ) {
21
+ console.info('Authenitcated default admin user');
22
+ return true;
23
+ }
19
24
 
20
- const users = await getSystemDb().query(tables.User, {
21
- email,
22
- password: sha256(password).toString()
23
- });
24
- if (users.length < 1)
25
- return 'User name or password incorrect';
25
+ const users = await getSystemDb().query(tables.User, {
26
+ email,
27
+ password: sha256(password).toString(),
28
+ });
29
+ if (users.length < 1) {
30
+ return 'User name or password incorrect';
31
+ }
26
32
 
27
- return true;
28
- };
33
+ return true;
34
+ }
@@ -2,8 +2,9 @@ import { getSystemDb } from '@proteinjs/db';
2
2
  import { tables } from '@proteinjs/user';
3
3
 
4
4
  export async function destroySession(sessionId?: string) {
5
- if (!sessionId)
6
- return;
5
+ if (!sessionId) {
6
+ return;
7
+ }
7
8
 
8
- await getSystemDb().delete(tables.Session, { sessionId });
9
- }
9
+ await getSystemDb().delete(tables.Session, { sessionId });
10
+ }
@@ -5,19 +5,29 @@ import { User, tables, guestUser, USER_SESSION_CACHE_KEY } from '@proteinjs/user
5
5
  import { DefaultAdminCredentials } from '../authentication/DefaultAdminCredentials';
6
6
 
7
7
  export const userCache: SessionDataCache<User> = {
8
- key: USER_SESSION_CACHE_KEY,
9
- create: async (sessionId: string, userEmail: string): Promise<User> => {
10
- let user = guestUser;
11
- if (userEmail) {
12
- const adminCredentials = DefaultAdminCredentials.getCredentials();
13
- if (adminCredentials && userEmail == adminCredentials.username) {
14
- const adminUser: User = { name: 'Admin', email: adminCredentials.username, password: adminCredentials.password, emailVerified: true, roles: 'admin', created: moment(), updated: moment(), id: 'admin' };
15
- user = adminUser;
16
- } else {
17
- user = await getSystemDb().get(tables.User, { email: userEmail });
18
- }
19
- }
20
-
21
- return user;
8
+ key: USER_SESSION_CACHE_KEY,
9
+ create: async (sessionId: string, userEmail: string): Promise<User> => {
10
+ let user = guestUser;
11
+ if (userEmail) {
12
+ const adminCredentials = DefaultAdminCredentials.getCredentials();
13
+ if (adminCredentials && userEmail == adminCredentials.username) {
14
+ const adminUser: User = {
15
+ name: 'Admin',
16
+ email: adminCredentials.username,
17
+ password: adminCredentials.password,
18
+ emailVerified: true,
19
+ roles: 'admin',
20
+ created: moment(),
21
+ updated: moment(),
22
+ id: 'admin',
23
+ };
24
+ user = adminUser;
25
+ } else {
26
+ user = await getSystemDb().get(tables.User, { email: userEmail });
27
+ delete (user as any)['password'];
28
+ }
22
29
  }
23
- }
30
+
31
+ return user;
32
+ },
33
+ };
@@ -5,28 +5,28 @@ import { User, tables, routes } from '@proteinjs/user';
5
5
  import { Logger } from '@proteinjs/util';
6
6
 
7
7
  export const createUser: Route = {
8
- path: routes.createUser.path,
9
- method: routes.createUser.method,
10
- onRequest: async (request, response): Promise<void> => {
11
- const logger = new Logger('createUser');
12
- const user = request.body as User;
13
- const db = getSystemDb();
14
- const userRecord = await db.get(tables.User, { email: user.email });
15
- if (userRecord) {
16
- const error = `User with this email already exists`;
17
- console.error(`${error}: ${user.email}`);
18
- response.send({ error });
19
- return;
20
- }
21
-
22
- await db.insert(tables.User, {
23
- name: user.name,
24
- email: user.email,
25
- password: sha256(user.password).toString(),
26
- emailVerified: false,
27
- roles: '',
28
- });
29
- logger.info(`Created user: ${user.email}`);
30
- response.send({});
8
+ path: routes.createUser.path,
9
+ method: routes.createUser.method,
10
+ onRequest: async (request, response): Promise<void> => {
11
+ const logger = new Logger('createUser');
12
+ const user = request.body as User;
13
+ const db = getSystemDb();
14
+ const userRecord = await db.get(tables.User, { email: user.email });
15
+ if (userRecord) {
16
+ const error = `User with this email already exists`;
17
+ console.error(`${error}: ${user.email}`);
18
+ response.send({ error });
19
+ return;
31
20
  }
32
- }
21
+
22
+ await db.insert(tables.User, {
23
+ name: user.name,
24
+ email: user.email,
25
+ password: sha256(user.password).toString(),
26
+ emailVerified: false,
27
+ roles: '',
28
+ });
29
+ logger.info(`Created user: ${user.email}`);
30
+ response.send({});
31
+ },
32
+ };
@@ -3,27 +3,27 @@ import { routes } from '@proteinjs/user';
3
3
  import { authenticate } from '../authentication/authenticate';
4
4
 
5
5
  export const login: Route = {
6
- path: routes.login.path,
7
- method: routes.login.method,
8
- onRequest: async (request: any, response): Promise<void> => {
9
- const credentials: {email: string, password: string} = request.body;
10
- if (!credentials.email || !credentials.password) {
11
- const error = `Email and password cannot be blank`;
12
- console.error(error);
13
- response.send({ error });
14
- return;
15
- }
16
-
17
- const result = await authenticate(credentials.email, credentials.password);
18
- if (result !== true) {
19
- console.error(result);
20
- response.send({ error: result });
21
- return;
22
- }
6
+ path: routes.login.path,
7
+ method: routes.login.method,
8
+ onRequest: async (request: any, response): Promise<void> => {
9
+ const credentials: { email: string; password: string } = request.body;
10
+ if (!credentials.email || !credentials.password) {
11
+ const error = `Email and password cannot be blank`;
12
+ console.error(error);
13
+ response.send({ error });
14
+ return;
15
+ }
23
16
 
24
- await new Promise((resolve, reject) => {
25
- request.login(credentials.email, resolve);
26
- });
27
- response.send({});
17
+ const result = await authenticate(credentials.email, credentials.password);
18
+ if (result !== true) {
19
+ console.error(result);
20
+ response.send({ error: result });
21
+ return;
28
22
  }
29
- }
23
+
24
+ await new Promise((resolve, reject) => {
25
+ request.login(credentials.email, resolve);
26
+ });
27
+ response.send({});
28
+ },
29
+ };
@@ -3,26 +3,26 @@ import { routes } from '@proteinjs/user';
3
3
  import { destroySession } from '../authentication/destroySession';
4
4
 
5
5
  export const logout: Route = {
6
- path: routes.logout.path,
7
- method: routes.logout.method,
8
- onRequest: async (request: any, response): Promise<void> => {
9
- // request.logout();
10
- // await request.session.destroy();
11
- // await new Promise((resolve, reject) => {
12
- // request.session?.destroy((error: any) => {
13
- // if (error) {
14
- // reject(error);
15
- // return;
16
- // }
6
+ path: routes.logout.path,
7
+ method: routes.logout.method,
8
+ onRequest: async (request: any, response): Promise<void> => {
9
+ // request.logout();
10
+ // await request.session.destroy();
11
+ // await new Promise((resolve, reject) => {
12
+ // request.session?.destroy((error: any) => {
13
+ // if (error) {
14
+ // reject(error);
15
+ // return;
16
+ // }
17
17
 
18
- // resolve();
19
- // });
20
- // });
21
- // delete request._passport?.session?.user;
22
- // console.info(`request.sessionID: ${request.sessionID}`);
23
- // console.info(`request.session?.id: ${request.session?.id}`);
24
- await destroySession(request.sessionID);
25
- request.session.passport.user = null;
26
- response.redirect('/login');
27
- }
28
- }
18
+ // resolve();
19
+ // });
20
+ // });
21
+ // delete request._passport?.session?.user;
22
+ // console.info(`request.sessionID: ${request.sessionID}`);
23
+ // console.info(`request.session?.id: ${request.session?.id}`);
24
+ await destroySession(request.sessionID);
25
+ request.session.passport.user = null;
26
+ response.redirect('/login');
27
+ },
28
+ };
package/tsconfig.json CHANGED
@@ -1,18 +1,18 @@
1
1
  {
2
- "compilerOptions": {
3
- "rootDir": "./",
4
- "target": "es5",
5
- "module": "commonjs",
6
- "declaration": true,
7
- "declarationMap": true,
8
- "sourceMap": true,
9
- "outDir": "./dist/",
10
- "strict": true,
11
- "noImplicitAny": true,
12
- "esModuleInterop": true,
13
- "skipLibCheck": true,
14
- "forceConsistentCasingInFileNames": true,
15
- "resolveJsonModule": true,
16
- "jsx": "react"
17
- }
18
- }
2
+ "compilerOptions": {
3
+ "rootDir": "./",
4
+ "target": "es5",
5
+ "module": "commonjs",
6
+ "declaration": true,
7
+ "declarationMap": true,
8
+ "sourceMap": true,
9
+ "outDir": "./dist/",
10
+ "strict": true,
11
+ "noImplicitAny": true,
12
+ "esModuleInterop": true,
13
+ "skipLibCheck": true,
14
+ "forceConsistentCasingInFileNames": true,
15
+ "resolveJsonModule": true,
16
+ "jsx": "react"
17
+ }
18
+ }