@proteinjs/user 1.0.12 → 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.
- package/.eslintrc.js +20 -0
- package/.prettierignore +3 -0
- package/.prettierrc +8 -0
- package/CHANGELOG.md +8 -2
- package/LICENSE +21 -0
- package/dist/generated/index.js +1 -1
- package/dist/generated/index.js.map +1 -1
- package/dist/src/ScopedRecord.d.ts.map +1 -1
- package/dist/src/ScopedRecord.js +1 -1
- package/dist/src/ScopedRecord.js.map +1 -1
- package/dist/src/UserRepo.d.ts.map +1 -1
- package/dist/src/UserRepo.js.map +1 -1
- package/dist/src/routes.d.ts.map +1 -1
- package/dist/src/routes.js.map +1 -1
- package/dist/src/tables/SessionTable.d.ts.map +1 -1
- package/dist/src/tables/SessionTable.js +0 -1
- package/dist/src/tables/SessionTable.js.map +1 -1
- package/dist/src/tables/UserTable.d.ts.map +1 -1
- package/dist/src/tables/UserTable.js +0 -1
- package/dist/src/tables/UserTable.js.map +1 -1
- package/dist/src/tables/tables.d.ts.map +1 -1
- package/dist/src/tables/tables.js.map +1 -1
- package/dist/test/ScopedRecord.test.d.ts.map +1 -1
- package/dist/test/ScopedRecord.test.js +3 -2
- package/dist/test/ScopedRecord.test.js.map +1 -1
- package/generated/index.ts +6 -9
- package/index.ts +1 -1
- package/jest.config.js +8 -17
- package/package.json +10 -4
- package/src/ScopedRecord.ts +25 -14
- package/src/UserRepo.ts +9 -9
- package/src/cacheKeys.ts +1 -1
- package/src/routes.ts +2 -2
- package/src/tables/SessionTable.ts +13 -13
- package/src/tables/UserTable.ts +15 -15
- package/src/tables/tables.ts +1 -1
- package/test/ScopedRecord.test.ts +33 -28
- 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
|
+
};
|
package/.prettierignore
ADDED
package/.prettierrc
ADDED
package/CHANGELOG.md
CHANGED
|
@@ -3,16 +3,22 @@
|
|
|
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.
|
|
6
|
+
## [1.0.13](https://github.com/proteinjs/user/compare/@proteinjs/user@1.0.12...@proteinjs/user@1.0.13) (2024-05-10)
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
### Bug Fixes
|
|
10
10
|
|
|
11
|
-
*
|
|
11
|
+
* add linting and lint all files ([71defcd](https://github.com/proteinjs/user/commit/71defcd78dc479d2eef1f624c746c879f4e31daa))
|
|
12
|
+
|
|
13
|
+
|
|
12
14
|
|
|
13
15
|
|
|
14
16
|
|
|
17
|
+
## [1.0.11](https://github.com/proteinjs/user/compare/@proteinjs/user@1.0.10...@proteinjs/user@1.0.11) (2024-05-09)
|
|
18
|
+
|
|
19
|
+
### Bug Fixes
|
|
15
20
|
|
|
21
|
+
- do not name a column the same name as a table ([1442a9f](https://github.com/proteinjs/user/commit/1442a9f665f88feafa8ccb83631ef2fb7d741f20))
|
|
16
22
|
|
|
17
23
|
## 1.0.1 (2024-04-19)
|
|
18
24
|
|
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
|
@@ -22,7 +22,7 @@ require("@proteinjs/service");
|
|
|
22
22
|
require("@proteinjs/user-auth");
|
|
23
23
|
require("moment");
|
|
24
24
|
/** Generate Source Graph */
|
|
25
|
-
var sourceGraph = "{\"options\":{\"directed\":true,\"multigraph\":false,\"compound\":false},\"nodes\":[{\"v\":\"@proteinjs/user/ScopedRecord\",\"value\":{\"packageName\":\"@proteinjs/user\",\"name\":\"ScopedRecord\",\"filePath\":\"/
|
|
25
|
+
var sourceGraph = "{\"options\":{\"directed\":true,\"multigraph\":false,\"compound\":false},\"nodes\":[{\"v\":\"@proteinjs/user/ScopedRecord\",\"value\":{\"packageName\":\"@proteinjs/user\",\"name\":\"ScopedRecord\",\"filePath\":\"/home/runner/work/user/user/packages/user/src/ScopedRecord.ts\",\"qualifiedName\":\"@proteinjs/user/ScopedRecord\",\"properties\":[{\"name\":\"scope\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"}],\"methods\":[],\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/db\",\"name\":\"Record\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db/Record\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParents\":[]}],\"sourceType\":3}},{\"v\":\"@proteinjs/db/Record\"},{\"v\":\"@proteinjs/user/UserRepo\",\"value\":{\"packageName\":\"@proteinjs/user\",\"name\":\"UserRepo\",\"filePath\":\"/home/runner/work/user/user/packages/user/src/UserRepo.ts\",\"qualifiedName\":\"@proteinjs/user/UserRepo\",\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"properties\":[],\"methods\":[{\"name\":\"getUser\",\"returnType\":{\"packageName\":\"\",\"name\":\"Omit<User, 'roles'> & AuthenticatedUser\",\"filePath\":null,\"qualifiedName\":\"/Omit<User, 'roles'> & AuthenticatedUser\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[]},{\"name\":\"setUser\",\"returnType\":null,\"isAsync\":false,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"user\",\"type\":{\"packageName\":\"@proteinjs/user\",\"name\":\"User\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/user/User\",\"typeParameters\":null,\"directParents\":null}}]}],\"typeParameters\":[],\"directParentInterfaces\":[{\"packageName\":\"@proteinjs/user-auth\",\"name\":\"AuthenticatedUserRepo\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/user-auth/AuthenticatedUserRepo\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParents\":[]}],\"directParentClasses\":[],\"sourceType\":2}},{\"v\":\"@proteinjs/user-auth/AuthenticatedUserRepo\"},{\"v\":\"@proteinjs/user/Session\",\"value\":{\"packageName\":\"@proteinjs/user\",\"name\":\"Session\",\"filePath\":\"/home/runner/work/user/user/packages/user/src/tables/SessionTable.ts\",\"qualifiedName\":\"@proteinjs/user/Session\",\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/db\",\"name\":\"Record\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db/Record\",\"typeParameters\":[],\"directParents\":null},{\"packageName\":\"@proteinjs/user\",\"name\":\"{\\n sessionId: string;\\n session: string;\\n expires: Date;\\n userEmail: string;\\n}\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/user/{\\n sessionId: string;\\n session: string;\\n expires: Date;\\n userEmail: string;\\n}\",\"typeParameters\":[],\"directParents\":null}],\"sourceType\":1}},{\"v\":\"@proteinjs/user/SessionTable\",\"value\":{\"packageName\":\"@proteinjs/user\",\"name\":\"SessionTable\",\"filePath\":\"/home/runner/work/user/user/packages/user/src/tables/SessionTable.ts\",\"qualifiedName\":\"@proteinjs/user/SessionTable\",\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"properties\":[{\"name\":\"name\",\"type\":null,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"columns\",\"type\":null,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"}],\"methods\":[],\"typeParameters\":[],\"directParentInterfaces\":[],\"directParentClasses\":[{\"packageName\":\"@proteinjs/db\",\"name\":\"Table\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db/Table\",\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"properties\":[],\"methods\":[],\"typeParameters\":[\"@proteinjs/user/Session\"],\"directParentInterfaces\":[],\"directParentClasses\":[]}],\"sourceType\":2}},{\"v\":\"@proteinjs/db/Table\"},{\"v\":\"@proteinjs/user/User\",\"value\":{\"packageName\":\"@proteinjs/user\",\"name\":\"User\",\"filePath\":\"/home/runner/work/user/user/packages/user/src/tables/UserTable.ts\",\"qualifiedName\":\"@proteinjs/user/User\",\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/db\",\"name\":\"Record\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db/Record\",\"typeParameters\":[],\"directParents\":null},{\"packageName\":\"@proteinjs/user\",\"name\":\"{\\n name: string;\\n email: string;\\n password: string;\\n emailVerified: boolean;\\n roles: string;\\n}\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/user/{\\n name: string;\\n email: string;\\n password: string;\\n emailVerified: boolean;\\n roles: string;\\n}\",\"typeParameters\":[],\"directParents\":null}],\"sourceType\":1}},{\"v\":\"@proteinjs/user/UserTable\",\"value\":{\"packageName\":\"@proteinjs/user\",\"name\":\"UserTable\",\"filePath\":\"/home/runner/work/user/user/packages/user/src/tables/UserTable.ts\",\"qualifiedName\":\"@proteinjs/user/UserTable\",\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"properties\":[{\"name\":\"name\",\"type\":null,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"columns\",\"type\":null,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"}],\"methods\":[],\"typeParameters\":[],\"directParentInterfaces\":[],\"directParentClasses\":[{\"packageName\":\"@proteinjs/db\",\"name\":\"Table\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db/Table\",\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"properties\":[],\"methods\":[],\"typeParameters\":[\"@proteinjs/user/User\"],\"directParentInterfaces\":[],\"directParentClasses\":[]}],\"sourceType\":2}}],\"edges\":[{\"v\":\"@proteinjs/user/ScopedRecord\",\"w\":\"@proteinjs/db/Record\",\"value\":\"extends interface\"},{\"v\":\"@proteinjs/user/UserRepo\",\"w\":\"@proteinjs/user-auth/AuthenticatedUserRepo\",\"value\":\"implements interface\"},{\"v\":\"@proteinjs/user/Session\",\"w\":\"@proteinjs/db/Record\",\"value\":\"extends type\"},{\"v\":\"@proteinjs/user/SessionTable\",\"w\":\"@proteinjs/db/Table\",\"value\":\"extends class\"},{\"v\":\"@proteinjs/user/User\",\"w\":\"@proteinjs/db/Record\",\"value\":\"extends type\"},{\"v\":\"@proteinjs/user/UserTable\",\"w\":\"@proteinjs/db/Table\",\"value\":\"extends class\"}]}";
|
|
26
26
|
/** Generate Source Links */
|
|
27
27
|
var UserRepo_1 = require("../src/UserRepo");
|
|
28
28
|
var SessionTable_1 = require("../src/tables/SessionTable");
|
|
@@ -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,8BAA4B;AAC5B,gCAA8B;AAC9B,kBAAgB;AAGhB,4BAA4B;AAE5B,IAAM,WAAW,GAAG,
|
|
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,8BAA4B;AAC5B,gCAA8B;AAC9B,kBAAgB;AAGhB,4BAA4B;AAE5B,IAAM,WAAW,GAAG,u9MAAu9M,CAAC;AAG5+M,4BAA4B;AAE5B,4CAA2C;AAC3C,2DAA0D;AAC1D,qDAAoD;AAEpD,IAAM,WAAW,GAAG;IACnB,0BAA0B,EAAE,mBAAQ;IACpC,8BAA8B,EAAE,2BAAY;IAC5C,2BAA2B,EAAE,qBAAS;CACtC,CAAC;AAGF,kCAAkC;AAElC,oDAAyD;AACzD,6BAAgB,CAAC,KAAK,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;AAGjD,2CAAyB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScopedRecord.d.ts","sourceRoot":"","sources":["../../src/ScopedRecord.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"ScopedRecord.d.ts","sourceRoot":"","sources":["../../src/ScopedRecord.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EAEP,MAAM,EAGN,KAAK,EAGN,MAAM,eAAe,CAAC;AAGvB,MAAM,WAAW,YAAa,SAAQ,MAAM;IAC1C,KAAK,EAAE,MAAM,CAAC;CACf;AAED,eAAO,MAAM,WAAW,gDAAsB,CAAC;AAgB/C,wBAAgB,eAAe,0BAE9B;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,WAG9C;AAED;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CAAC,CAAC,SAAS,YAAY,EAC5D,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,MAAM,YAAY,CAAC,CAAC,GAC5C,OAAO,CAAC,YAAY,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,MAAM,YAAY,CAAC,CAAC,CAE9D"}
|
package/dist/src/ScopedRecord.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScopedRecord.js","sourceRoot":"","sources":["../../src/ScopedRecord.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"ScopedRecord.js","sourceRoot":"","s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
|
1
|
-
{"version":3,"file":"UserRepo.d.ts","sourceRoot":"","sources":["../../src/UserRepo.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAChF,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAG1C,qBAAa,QAAS,YAAW,qBAAqB;
|
|
1
|
+
{"version":3,"file":"UserRepo.d.ts","sourceRoot":"","sources":["../../src/UserRepo.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAChF,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAG1C,qBAAa,QAAS,YAAW,qBAAqB;IACpD,OAAO,IAAI,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,iBAAiB;IAMlD,OAAO,CAAC,IAAI,EAAE,IAAI;CAGnB"}
|
package/dist/src/UserRepo.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserRepo.js","sourceRoot":"","sources":["../../src/UserRepo.ts"],"names":[],"mappings":";;;AAAA,oDAAgD;AAGhD,yCAAqD;AAErD;IAAA;IAUA,CAAC;
|
|
1
|
+
{"version":3,"file":"UserRepo.js","sourceRoot":"","sources":["../../src/UserRepo.ts"],"names":[],"mappings":";;;AAAA,oDAAgD;AAGhD,yCAAqD;AAErD;IAAA;IAUA,CAAC;IATC,0BAAO,GAAP;QACE,IAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,oBAAO,CAAC,YAAY,CAAO,kCAAsB,CAAC,CAAC,CAAC;QACnF,IAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACtD,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,KAAK,OAAA,EAAE,CAAC,CAAC;IACxC,CAAC;IAED,0BAAO,GAAP,UAAQ,IAAU;QAChB,oBAAO,CAAC,YAAY,CAAC,kCAAsB,EAAE,IAAI,CAAC,CAAC;IACrD,CAAC;IACH,eAAC;AAAD,CAAC,AAVD,IAUC;AAVY,4BAAQ"}
|
package/dist/src/routes.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../src/routes.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM,EAAE;
|
|
1
|
+
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../src/routes.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM,EAAE;IAAE,CAAC,IAAI,EAAE,MAAM,GAAG;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,CAAA;KAAE,CAAA;CAI3G,CAAC"}
|
package/dist/src/routes.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes.js","sourceRoot":"","sources":["../../src/routes.ts"],"names":[],"mappings":";;;AAAa,QAAA,MAAM,
|
|
1
|
+
{"version":3,"file":"routes.js","sourceRoot":"","sources":["../../src/routes.ts"],"names":[],"mappings":";;;AAAa,QAAA,MAAM,GAA8F;IAC/G,UAAU,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,EAAE;IACpD,KAAK,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,EAAE;IAC9C,MAAM,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,EAAE,KAAK,EAAE;CAChD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SessionTable.d.ts","sourceRoot":"","sources":["../../../src/tables/SessionTable.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,KAAK,EAAE,MAAM,EAAqB,MAAM,eAAe,CAAC;AAE3F,MAAM,MAAM,OAAO,GAAG,MAAM,GAAG;
|
|
1
|
+
{"version":3,"file":"SessionTable.d.ts","sourceRoot":"","sources":["../../../src/tables/SessionTable.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,KAAK,EAAE,MAAM,EAAqB,MAAM,eAAe,CAAC;AAE3F,MAAM,MAAM,OAAO,GAAG,MAAM,GAAG;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,IAAI,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,qBAAa,YAAa,SAAQ,KAAK,CAAC,OAAO,CAAC;IAC9C,IAAI,SAAa;IACjB,OAAO;;;;;;;;;WAKJ;CACJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SessionTable.js","sourceRoot":"","sources":["../../../src/tables/SessionTable.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,oCAA2F;AAS3F;IAAkC,gCAAc;IAAhD;QAAA,qEAQC;
|
|
1
|
+
{"version":3,"file":"SessionTable.js","sourceRoot":"","sources":["../../../src/tables/SessionTable.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,oCAA2F;AAS3F;IAAkC,gCAAc;IAAhD;QAAA,qEAQC;QAPC,UAAI,GAAG,SAAS,CAAC;QACjB,aAAO,GAAG,IAAA,sBAAiB,EAAU;YACnC,SAAS,EAAE,IAAI,iBAAY,CAAC,YAAY,CAAC;YACzC,OAAO,EAAE,IAAI,iBAAY,CAAC,oBAAoB,EAAE,EAAE,EAAE,IAAI,CAAC;YACzD,OAAO,EAAE,IAAI,eAAU,CAAC,SAAS,CAAC;YAClC,SAAS,EAAE,IAAI,iBAAY,CAAC,YAAY,CAAC;SAC1C,CAAC,CAAC;;IACL,CAAC;IAAD,mBAAC;AAAD,CAAC,AARD,CAAkC,UAAK,GAQtC;AARY,oCAAY"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserTable.d.ts","sourceRoot":"","sources":["../../../src/tables/UserTable.ts"],"names":[],"mappings":"AAAA,OAAO,EAA+C,KAAK,EAAE,MAAM,EAAqB,MAAM,eAAe,CAAC;AAE9G,MAAM,MAAM,IAAI,GAAG,MAAM,GAAG;
|
|
1
|
+
{"version":3,"file":"UserTable.d.ts","sourceRoot":"","sources":["../../../src/tables/UserTable.ts"],"names":[],"mappings":"AAAA,OAAO,EAA+C,KAAK,EAAE,MAAM,EAAqB,MAAM,eAAe,CAAC;AAE9G,MAAM,MAAM,IAAI,GAAG,MAAM,GAAG;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,OAAO,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,qBAAa,SAAU,SAAQ,KAAK,CAAC,IAAI,CAAC;IACxC,IAAI,SAAU;IACd,OAAO;;;;;;;;;;WAMJ;CACJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserTable.js","sourceRoot":"","sources":["../../../src/tables/UserTable.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,oCAA8G;AAU9G;IAA+B,6BAAW;IAA1C;QAAA,qEASC;
|
|
1
|
+
{"version":3,"file":"UserTable.js","sourceRoot":"","sources":["../../../src/tables/UserTable.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,oCAA8G;AAU9G;IAA+B,6BAAW;IAA1C;QAAA,qEASC;QARC,UAAI,GAAG,MAAM,CAAC;QACd,aAAO,GAAG,IAAA,sBAAiB,EAAO;YAChC,IAAI,EAAE,IAAI,iBAAY,CAAC,MAAM,CAAC;YAC9B,KAAK,EAAE,IAAI,iBAAY,CAAC,OAAO,EAAE,EAAE,EAAE,GAAG,CAAC;YACzC,QAAQ,EAAE,IAAI,mBAAc,CAAC,UAAU,CAAC;YACxC,aAAa,EAAE,IAAI,kBAAa,CAAC,gBAAgB,CAAC;YAClD,KAAK,EAAE,IAAI,iBAAY,CAAC,OAAO,CAAC;SACjC,CAAC,CAAC;;IACL,CAAC;IAAD,gBAAC;AAAD,CAAC,AATD,CAA+B,UAAK,GASnC;AATY,8BAAS"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tables.d.ts","sourceRoot":"","sources":["../../../src/tables/tables.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,IAAI,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAgB,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEtC,eAAO,MAAM,MAAM;;;CAGlB,
|
|
1
|
+
{"version":3,"file":"tables.d.ts","sourceRoot":"","sources":["../../../src/tables/tables.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,IAAI,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAgB,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEtC,eAAO,MAAM,MAAM;;;CAGlB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tables.js","sourceRoot":"","sources":["../../../src/tables/tables.ts"],"names":[],"mappings":";;;AAAA,yCAA8C;AAC9C,+CAAuD;AAG1C,QAAA,MAAM,GAAG;IACpB,IAAI,EAAE,IAAI,qBAAS,EAAiB;IACpC,OAAO,EAAE,IAAI,2BAAY,EAAoB;CAC9C,
|
|
1
|
+
{"version":3,"file":"tables.js","sourceRoot":"","sources":["../../../src/tables/tables.ts"],"names":[],"mappings":";;;AAAA,yCAA8C;AAC9C,+CAAuD;AAG1C,QAAA,MAAM,GAAG;IACpB,IAAI,EAAE,IAAI,qBAAS,EAAiB;IACpC,OAAO,EAAE,IAAI,2BAAY,EAAoB;CAC9C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScopedRecord.test.d.ts","sourceRoot":"","sources":["../../test/ScopedRecord.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,EAAE,MAAM,EAAqB,MAAM,eAAe,
|
|
1
|
+
{"version":3,"file":"ScopedRecord.test.d.ts","sourceRoot":"","sources":["../../test/ScopedRecord.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,EAAE,MAAM,EAAqB,MAAM,eAAe,CAAC;AAGnF,MAAM,WAAW,QAAS,SAAQ,MAAM;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAMD,qBAAa,aAAc,SAAQ,KAAK,CAAC,QAAQ,CAAC;IAChD,IAAI,SAAoB;IACxB,OAAO;;;;;;;WAaJ;CACJ"}
|
|
@@ -74,7 +74,7 @@ var FavoriteTable = /** @class */ (function (_super) {
|
|
|
74
74
|
qb.condition({
|
|
75
75
|
field: 'scope',
|
|
76
76
|
operator: 'IN',
|
|
77
|
-
value: [veronicaScope]
|
|
77
|
+
value: [veronicaScope],
|
|
78
78
|
});
|
|
79
79
|
return [2 /*return*/];
|
|
80
80
|
});
|
|
@@ -108,8 +108,9 @@ var dropTable = function (table) { return __awaiter(void 0, void 0, void 0, func
|
|
|
108
108
|
}); };
|
|
109
109
|
var getTable = function (tableName) {
|
|
110
110
|
var userTable = new FavoriteTable();
|
|
111
|
-
if (userTable.name == tableName)
|
|
111
|
+
if (userTable.name == tableName) {
|
|
112
112
|
return userTable;
|
|
113
|
+
}
|
|
113
114
|
throw new Error('Cannot find test table');
|
|
114
115
|
};
|
|
115
116
|
var db = new db_1.Db(dbDriver, getTable);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScopedRecord.test.js","sourceRoot":"","sources":["../../test/ScopedRecord.test.ts"],"names":[],"mappings":";;;;;;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9
|
|
|
10
|
-
|
|
11
10
|
/** Generate Source Graph */
|
|
12
11
|
|
|
13
|
-
const sourceGraph =
|
|
14
|
-
|
|
12
|
+
const sourceGraph =
|
|
13
|
+
'{"options":{"directed":true,"multigraph":false,"compound":false},"nodes":[{"v":"@proteinjs/user/ScopedRecord","value":{"packageName":"@proteinjs/user","name":"ScopedRecord","filePath":"/home/runner/work/user/user/packages/user/src/ScopedRecord.ts","qualifiedName":"@proteinjs/user/ScopedRecord","properties":[{"name":"scope","type":{"packageName":"","name":"string","filePath":null,"qualifiedName":"/string","typeParameters":null,"directParents":null},"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public"}],"methods":[],"typeParameters":[],"directParents":[{"packageName":"@proteinjs/db","name":"Record","filePath":null,"qualifiedName":"@proteinjs/db/Record","properties":[],"methods":[],"typeParameters":[],"directParents":[]}],"sourceType":3}},{"v":"@proteinjs/db/Record"},{"v":"@proteinjs/user/UserRepo","value":{"packageName":"@proteinjs/user","name":"UserRepo","filePath":"/home/runner/work/user/user/packages/user/src/UserRepo.ts","qualifiedName":"@proteinjs/user/UserRepo","isAbstract":false,"isStatic":false,"visibility":"public","properties":[],"methods":[{"name":"getUser","returnType":{"packageName":"","name":"Omit<User, \'roles\'> & AuthenticatedUser","filePath":null,"qualifiedName":"/Omit<User, \'roles\'> & AuthenticatedUser","typeParameters":null,"directParents":null},"isAsync":false,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public","parameters":[]},{"name":"setUser","returnType":null,"isAsync":false,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public","parameters":[{"name":"user","type":{"packageName":"@proteinjs/user","name":"User","filePath":null,"qualifiedName":"@proteinjs/user/User","typeParameters":null,"directParents":null}}]}],"typeParameters":[],"directParentInterfaces":[{"packageName":"@proteinjs/user-auth","name":"AuthenticatedUserRepo","filePath":null,"qualifiedName":"@proteinjs/user-auth/AuthenticatedUserRepo","properties":[],"methods":[],"typeParameters":[],"directParents":[]}],"directParentClasses":[],"sourceType":2}},{"v":"@proteinjs/user-auth/AuthenticatedUserRepo"},{"v":"@proteinjs/user/Session","value":{"packageName":"@proteinjs/user","name":"Session","filePath":"/home/runner/work/user/user/packages/user/src/tables/SessionTable.ts","qualifiedName":"@proteinjs/user/Session","typeParameters":[],"directParents":[{"packageName":"@proteinjs/db","name":"Record","filePath":null,"qualifiedName":"@proteinjs/db/Record","typeParameters":[],"directParents":null},{"packageName":"@proteinjs/user","name":"{\\n sessionId: string;\\n session: string;\\n expires: Date;\\n userEmail: string;\\n}","filePath":null,"qualifiedName":"@proteinjs/user/{\\n sessionId: string;\\n session: string;\\n expires: Date;\\n userEmail: string;\\n}","typeParameters":[],"directParents":null}],"sourceType":1}},{"v":"@proteinjs/user/SessionTable","value":{"packageName":"@proteinjs/user","name":"SessionTable","filePath":"/home/runner/work/user/user/packages/user/src/tables/SessionTable.ts","qualifiedName":"@proteinjs/user/SessionTable","isAbstract":false,"isStatic":false,"visibility":"public","properties":[{"name":"name","type":null,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public"},{"name":"columns","type":null,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public"}],"methods":[],"typeParameters":[],"directParentInterfaces":[],"directParentClasses":[{"packageName":"@proteinjs/db","name":"Table","filePath":null,"qualifiedName":"@proteinjs/db/Table","isAbstract":false,"isStatic":false,"visibility":"public","properties":[],"methods":[],"typeParameters":["@proteinjs/user/Session"],"directParentInterfaces":[],"directParentClasses":[]}],"sourceType":2}},{"v":"@proteinjs/db/Table"},{"v":"@proteinjs/user/User","value":{"packageName":"@proteinjs/user","name":"User","filePath":"/home/runner/work/user/user/packages/user/src/tables/UserTable.ts","qualifiedName":"@proteinjs/user/User","typeParameters":[],"directParents":[{"packageName":"@proteinjs/db","name":"Record","filePath":null,"qualifiedName":"@proteinjs/db/Record","typeParameters":[],"directParents":null},{"packageName":"@proteinjs/user","name":"{\\n name: string;\\n email: string;\\n password: string;\\n emailVerified: boolean;\\n roles: string;\\n}","filePath":null,"qualifiedName":"@proteinjs/user/{\\n name: string;\\n email: string;\\n password: string;\\n emailVerified: boolean;\\n roles: string;\\n}","typeParameters":[],"directParents":null}],"sourceType":1}},{"v":"@proteinjs/user/UserTable","value":{"packageName":"@proteinjs/user","name":"UserTable","filePath":"/home/runner/work/user/user/packages/user/src/tables/UserTable.ts","qualifiedName":"@proteinjs/user/UserTable","isAbstract":false,"isStatic":false,"visibility":"public","properties":[{"name":"name","type":null,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public"},{"name":"columns","type":null,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public"}],"methods":[],"typeParameters":[],"directParentInterfaces":[],"directParentClasses":[{"packageName":"@proteinjs/db","name":"Table","filePath":null,"qualifiedName":"@proteinjs/db/Table","isAbstract":false,"isStatic":false,"visibility":"public","properties":[],"methods":[],"typeParameters":["@proteinjs/user/User"],"directParentInterfaces":[],"directParentClasses":[]}],"sourceType":2}}],"edges":[{"v":"@proteinjs/user/ScopedRecord","w":"@proteinjs/db/Record","value":"extends interface"},{"v":"@proteinjs/user/UserRepo","w":"@proteinjs/user-auth/AuthenticatedUserRepo","value":"implements interface"},{"v":"@proteinjs/user/Session","w":"@proteinjs/db/Record","value":"extends type"},{"v":"@proteinjs/user/SessionTable","w":"@proteinjs/db/Table","value":"extends class"},{"v":"@proteinjs/user/User","w":"@proteinjs/db/Record","value":"extends type"},{"v":"@proteinjs/user/UserTable","w":"@proteinjs/db/Table","value":"extends class"}]}';
|
|
15
14
|
|
|
16
15
|
/** Generate Source Links */
|
|
17
16
|
|
|
@@ -20,16 +19,14 @@ import { SessionTable } from '../src/tables/SessionTable';
|
|
|
20
19
|
import { UserTable } from '../src/tables/UserTable';
|
|
21
20
|
|
|
22
21
|
const sourceLinks = {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
'@proteinjs/user/UserRepo': UserRepo,
|
|
23
|
+
'@proteinjs/user/SessionTable': SessionTable,
|
|
24
|
+
'@proteinjs/user/UserTable': UserTable,
|
|
26
25
|
};
|
|
27
26
|
|
|
28
|
-
|
|
29
27
|
/** Load Source Graph and Links */
|
|
30
28
|
|
|
31
29
|
import { SourceRepository } from '@proteinjs/reflection';
|
|
32
30
|
SourceRepository.merge(sourceGraph, sourceLinks);
|
|
33
31
|
|
|
34
|
-
|
|
35
|
-
export * from '../index';
|
|
32
|
+
export * from '../index';
|
package/index.ts
CHANGED
package/jest.config.js
CHANGED
|
@@ -1,18 +1,9 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.13",
|
|
4
4
|
"description": "User management",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"@proteinjs/reflection": "1.1.1",
|
|
27
27
|
"@proteinjs/server-api": "1.1.1",
|
|
28
28
|
"@proteinjs/service": "1.0.9",
|
|
29
|
-
"@proteinjs/user-auth": "1.0.
|
|
29
|
+
"@proteinjs/user-auth": "^1.0.8",
|
|
30
30
|
"moment": "2.29.4"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
@@ -34,10 +34,16 @@
|
|
|
34
34
|
"@proteinjs/reflection-build": "1.0.16",
|
|
35
35
|
"@types/jest": "29.5.5",
|
|
36
36
|
"@types/node": "14.0.13",
|
|
37
|
+
"@typescript-eslint/eslint-plugin": "7.8.0",
|
|
38
|
+
"@typescript-eslint/parser": "7.8.0",
|
|
39
|
+
"eslint": "8.57.0",
|
|
40
|
+
"eslint-config-prettier": "9.1.0",
|
|
41
|
+
"eslint-plugin-prettier": "5.1.3",
|
|
37
42
|
"jest": "29.7.0",
|
|
38
43
|
"ts-jest": "29.1.1",
|
|
39
44
|
"typescript": "5.2.2"
|
|
40
45
|
},
|
|
41
46
|
"main": "./dist/generated/index.js",
|
|
42
|
-
"types": "./dist/generated/index.d.ts"
|
|
43
|
-
|
|
47
|
+
"types": "./dist/generated/index.d.ts",
|
|
48
|
+
"gitHead": "2fd5a5ee7f68e33bf8b6ba045fd5bbd043b36e3b"
|
|
49
|
+
}
|
package/src/ScopedRecord.ts
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
Columns,
|
|
3
|
+
StringColumn,
|
|
4
|
+
Record,
|
|
5
|
+
withRecordColumns,
|
|
6
|
+
getDb,
|
|
7
|
+
Table,
|
|
8
|
+
getColumnByName,
|
|
9
|
+
getTables,
|
|
10
|
+
} from '@proteinjs/db';
|
|
2
11
|
import { UserRepo } from './UserRepo';
|
|
3
12
|
|
|
4
13
|
export interface ScopedRecord extends Record {
|
|
@@ -8,21 +17,21 @@ export interface ScopedRecord extends Record {
|
|
|
8
17
|
export const getScopedDb = getDb<ScopedRecord>;
|
|
9
18
|
|
|
10
19
|
const scopedRecordColumns = {
|
|
11
|
-
scope: new StringColumn('scope', {
|
|
12
|
-
defaultValue: async () =>
|
|
13
|
-
addToQuery: async (qb) => {
|
|
14
|
-
qb.condition({
|
|
15
|
-
field: 'scope',
|
|
16
|
-
operator: 'IN',
|
|
17
|
-
value: [new UserRepo().getUser().id]
|
|
20
|
+
scope: new StringColumn('scope', {
|
|
21
|
+
defaultValue: async () => new UserRepo().getUser().id,
|
|
22
|
+
addToQuery: async (qb) => {
|
|
23
|
+
qb.condition({
|
|
24
|
+
field: 'scope',
|
|
25
|
+
operator: 'IN',
|
|
26
|
+
value: [new UserRepo().getUser().id],
|
|
18
27
|
});
|
|
19
28
|
},
|
|
20
29
|
ui: { hidden: true },
|
|
21
30
|
}),
|
|
22
|
-
}
|
|
31
|
+
};
|
|
23
32
|
|
|
24
33
|
export function getScopedTables() {
|
|
25
|
-
return getTables<ScopedRecord>().filter(table => isScopedTable(table));
|
|
34
|
+
return getTables<ScopedRecord>().filter((table) => isScopedTable(table));
|
|
26
35
|
}
|
|
27
36
|
|
|
28
37
|
export function isScopedTable(table: Table<any>) {
|
|
@@ -32,12 +41,14 @@ export function isScopedTable(table: Table<any>) {
|
|
|
32
41
|
|
|
33
42
|
/**
|
|
34
43
|
* Wrapper function to add default ScopedRecord columns to your table's columns.
|
|
35
|
-
*
|
|
44
|
+
*
|
|
36
45
|
* Note: using this requires an explicit dependency on moment@2.29.4 in your package (since transient dependencies are brittle by typescript's standards)
|
|
37
|
-
*
|
|
46
|
+
*
|
|
38
47
|
* @param columns your columns
|
|
39
48
|
* @returns recordColumns & sourceRecordColumns & your columns
|
|
40
49
|
*/
|
|
41
|
-
export function withScopedRecordColumns<T extends ScopedRecord>(
|
|
50
|
+
export function withScopedRecordColumns<T extends ScopedRecord>(
|
|
51
|
+
columns: Columns<Omit<T, keyof ScopedRecord>>
|
|
52
|
+
): Columns<ScopedRecord> & Columns<Omit<T, keyof ScopedRecord>> {
|
|
42
53
|
return Object.assign(Object.assign({}, scopedRecordColumns), withRecordColumns<Record>(columns) as any);
|
|
43
|
-
}
|
|
54
|
+
}
|
package/src/UserRepo.ts
CHANGED
|
@@ -4,13 +4,13 @@ import { User } from './tables/UserTable';
|
|
|
4
4
|
import { USER_SESSION_CACHE_KEY } from './cacheKeys';
|
|
5
5
|
|
|
6
6
|
export class UserRepo implements AuthenticatedUserRepo {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
getUser(): Omit<User, 'roles'> & AuthenticatedUser {
|
|
8
|
+
const user = Object.assign({}, Session.getDataByKey<User>(USER_SESSION_CACHE_KEY));
|
|
9
|
+
const roles = user.roles ? user.roles.split(',') : [];
|
|
10
|
+
return Object.assign(user, { roles });
|
|
11
|
+
}
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
13
|
+
setUser(user: User) {
|
|
14
|
+
Session.setDataByKey(USER_SESSION_CACHE_KEY, user);
|
|
15
|
+
}
|
|
16
|
+
}
|
package/src/cacheKeys.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const USER_SESSION_CACHE_KEY = '@proteinjs/user/userCache';
|
|
1
|
+
export const USER_SESSION_CACHE_KEY = '@proteinjs/user/userCache';
|
package/src/routes.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export const routes: {[name: string]: { path: string
|
|
1
|
+
export const routes: { [name: string]: { path: string; method: 'get' | 'post' | 'put' | 'patch' | 'delete' } } = {
|
|
2
2
|
createUser: { path: '/user/create', method: 'post' },
|
|
3
3
|
login: { path: '/user/login', method: 'post' },
|
|
4
4
|
logout: { path: '/user/logout', method: 'get' },
|
|
5
|
-
}
|
|
5
|
+
};
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { DateColumn, StringColumn, Table, Record, withRecordColumns } from '@proteinjs/db';
|
|
2
2
|
|
|
3
3
|
export type Session = Record & {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
4
|
+
sessionId: string;
|
|
5
|
+
session: string;
|
|
6
|
+
expires: Date;
|
|
7
|
+
userEmail: string;
|
|
8
|
+
};
|
|
9
9
|
|
|
10
10
|
export class SessionTable extends Table<Session> {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
11
|
+
name = 'session';
|
|
12
|
+
columns = withRecordColumns<Session>({
|
|
13
|
+
sessionId: new StringColumn('session_id'),
|
|
14
|
+
session: new StringColumn('serialized_session', {}, 4000),
|
|
15
|
+
expires: new DateColumn('expires'),
|
|
16
|
+
userEmail: new StringColumn('user_email'),
|
|
17
|
+
});
|
|
18
|
+
}
|
package/src/tables/UserTable.ts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { BooleanColumn, StringColumn, PasswordColumn, Table, Record, withRecordColumns } from '@proteinjs/db';
|
|
2
2
|
|
|
3
3
|
export type User = Record & {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
4
|
+
name: string;
|
|
5
|
+
email: string;
|
|
6
|
+
password: string;
|
|
7
|
+
emailVerified: boolean;
|
|
8
|
+
roles: string;
|
|
9
|
+
};
|
|
10
10
|
|
|
11
11
|
export class UserTable extends Table<User> {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
12
|
+
name = 'user';
|
|
13
|
+
columns = withRecordColumns<User>({
|
|
14
|
+
name: new StringColumn('name'),
|
|
15
|
+
email: new StringColumn('email', {}, 250),
|
|
16
|
+
password: new PasswordColumn('password'),
|
|
17
|
+
emailVerified: new BooleanColumn('email_verified'),
|
|
18
|
+
roles: new StringColumn('roles'),
|
|
19
|
+
});
|
|
20
|
+
}
|
package/src/tables/tables.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Db, StringColumn, Table, Record, withRecordColumns } from '@proteinjs/db'
|
|
2
|
-
import { KnexDriver } from '@proteinjs/db-driver-knex'
|
|
1
|
+
import { Db, StringColumn, Table, Record, withRecordColumns } from '@proteinjs/db';
|
|
2
|
+
import { KnexDriver } from '@proteinjs/db-driver-knex';
|
|
3
3
|
|
|
4
4
|
export interface Favorite extends Record {
|
|
5
|
-
|
|
5
|
+
name: string;
|
|
6
6
|
scope?: string;
|
|
7
7
|
}
|
|
8
8
|
|
|
@@ -11,36 +11,39 @@ const kevinUser = { name: 'Kevin', email: 'kev@tron.com' };
|
|
|
11
11
|
const veronicaScope = 'vvvveronica';
|
|
12
12
|
const kevinScope = 'kevinnn';
|
|
13
13
|
export class FavoriteTable extends Table<Favorite> {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
scope: new StringColumn('scope', {
|
|
18
|
-
defaultValue: async (favorite: Favorite) =>
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
14
|
+
name = 'user_test_user';
|
|
15
|
+
columns = withRecordColumns<Favorite>({
|
|
16
|
+
name: new StringColumn('name'),
|
|
17
|
+
scope: new StringColumn('scope', {
|
|
18
|
+
defaultValue: async (favorite: Favorite) =>
|
|
19
|
+
favorite.name.startsWith(veronicaUser.name) ? veronicaScope : kevinScope,
|
|
20
|
+
addToQuery: async (qb) => {
|
|
21
|
+
qb.condition({
|
|
22
|
+
field: 'scope',
|
|
23
|
+
operator: 'IN',
|
|
24
|
+
value: [veronicaScope],
|
|
24
25
|
});
|
|
25
26
|
},
|
|
26
27
|
}),
|
|
27
|
-
|
|
28
|
+
});
|
|
28
29
|
}
|
|
29
30
|
|
|
30
31
|
const dbDriver = new KnexDriver({
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
host: 'localhost',
|
|
33
|
+
user: 'root',
|
|
34
|
+
password: '',
|
|
35
|
+
dbName: 'test',
|
|
35
36
|
});
|
|
36
37
|
const dropTable = async (table: Table<any>) => {
|
|
37
|
-
if (await dbDriver.getKnex().schema.withSchema(dbDriver.getDbName()).hasTable(table.name))
|
|
38
|
-
|
|
39
|
-
}
|
|
38
|
+
if (await dbDriver.getKnex().schema.withSchema(dbDriver.getDbName()).hasTable(table.name)) {
|
|
39
|
+
await dbDriver.getKnex().schema.withSchema(dbDriver.getDbName()).dropTable(table.name);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
40
42
|
const getTable = (tableName: string) => {
|
|
41
43
|
const userTable = new FavoriteTable();
|
|
42
|
-
if (userTable.name == tableName)
|
|
44
|
+
if (userTable.name == tableName) {
|
|
43
45
|
return userTable;
|
|
46
|
+
}
|
|
44
47
|
|
|
45
48
|
throw new Error('Cannot find test table');
|
|
46
49
|
};
|
|
@@ -48,17 +51,19 @@ const db = new Db(dbDriver, getTable);
|
|
|
48
51
|
|
|
49
52
|
describe('Scoped Record', () => {
|
|
50
53
|
beforeAll(async () => {
|
|
51
|
-
if (dbDriver.start)
|
|
54
|
+
if (dbDriver.start) {
|
|
52
55
|
await dbDriver.start();
|
|
56
|
+
}
|
|
53
57
|
|
|
54
58
|
await dbDriver.getTableManager().loadTable(new FavoriteTable());
|
|
55
|
-
})
|
|
56
|
-
|
|
59
|
+
});
|
|
60
|
+
|
|
57
61
|
afterAll(async () => {
|
|
58
62
|
await dropTable(new FavoriteTable());
|
|
59
|
-
|
|
60
|
-
if (dbDriver.stop)
|
|
63
|
+
|
|
64
|
+
if (dbDriver.stop) {
|
|
61
65
|
await dbDriver.stop();
|
|
66
|
+
}
|
|
62
67
|
});
|
|
63
68
|
|
|
64
69
|
test('Query scoped records', async () => {
|
|
@@ -71,4 +76,4 @@ describe('Scoped Record', () => {
|
|
|
71
76
|
const favorites = await db.query(favoriteTable, {});
|
|
72
77
|
expect(favorites.length).toBe(3);
|
|
73
78
|
});
|
|
74
|
-
});
|
|
79
|
+
});
|
package/tsconfig.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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
|
+
}
|