@proteinjs/user 1.2.18 → 1.3.1
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/CHANGELOG.md +23 -0
- package/LICENSE +21 -0
- package/dist/generated/index.d.ts.map +1 -1
- package/dist/generated/index.js +3 -1
- package/dist/generated/index.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/src/services/AccessInviteService.d.ts +25 -0
- package/dist/src/services/AccessInviteService.d.ts.map +1 -0
- package/dist/src/services/AccessInviteService.js +9 -0
- package/dist/src/services/AccessInviteService.js.map +1 -0
- package/dist/src/tables/AccessGrantTable.d.ts +1 -0
- package/dist/src/tables/AccessGrantTable.d.ts.map +1 -1
- package/dist/src/tables/AccessGrantTable.js +8 -0
- package/dist/src/tables/AccessGrantTable.js.map +1 -1
- package/dist/src/tables/AccessInviteTable.d.ts +30 -0
- package/dist/src/tables/AccessInviteTable.d.ts.map +1 -0
- package/dist/src/tables/AccessInviteTable.js +141 -0
- package/dist/src/tables/AccessInviteTable.js.map +1 -0
- package/dist/src/tables/tables.d.ts +2 -0
- package/dist/src/tables/tables.d.ts.map +1 -1
- package/dist/src/tables/tables.js +2 -0
- package/dist/src/tables/tables.js.map +1 -1
- package/generated/index.ts +10 -11
- package/index.ts +2 -0
- package/package.json +3 -2
- package/src/services/AccessInviteService.ts +30 -0
- package/src/tables/AccessGrantTable.ts +8 -0
- package/src/tables/AccessInviteTable.ts +73 -0
- package/src/tables/tables.ts +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,29 @@
|
|
|
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.3.1](https://github.com/proteinjs/user/compare/@proteinjs/user@1.3.0...@proteinjs/user@1.3.1) (2025-08-27)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* add auth prop to Access tables ([#7](https://github.com/proteinjs/user/issues/7)) ([a93ba88](https://github.com/proteinjs/user/commit/a93ba8834c69ea78ce4e6512df401a197a16915b))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# [1.3.0](https://github.com/proteinjs/user/compare/@proteinjs/user@1.2.17...@proteinjs/user@1.3.0) (2025-08-26)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* SharedRecord column type ([#5](https://github.com/proteinjs/user/issues/5)) [skip ci] ([d320303](https://github.com/proteinjs/user/commit/d320303db6a209bd11f08845edff61b136d09859))
|
|
23
|
+
* **user:** invites that create access grants when accepted ([#6](https://github.com/proteinjs/user/issues/6)) ([5ee1965](https://github.com/proteinjs/user/commit/5ee196519ebd08ca215aad75257af3b1fc60f778))
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
6
29
|
## [1.2.9](https://github.com/proteinjs/user/compare/@proteinjs/user@1.2.6...@proteinjs/user@1.2.9) (2025-02-07)
|
|
7
30
|
|
|
8
31
|
|
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.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../generated/index.ts"],"names":[],"mappings":"AAAA,oCAAoC;AAEpC,OAAO,eAAe,CAAC;AACvB,OAAO,uBAAuB,CAAC;AAC/B,OAAO,uBAAuB,CAAC;AAC/B,OAAO,oBAAoB,CAAC;AAC5B,OAAO,sBAAsB,CAAC;AAC9B,OAAO,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../generated/index.ts"],"names":[],"mappings":"AAAA,oCAAoC;AAEpC,OAAO,eAAe,CAAC;AACvB,OAAO,uBAAuB,CAAC;AAC/B,OAAO,uBAAuB,CAAC;AAC/B,OAAO,oBAAoB,CAAC;AAC5B,OAAO,sBAAsB,CAAC;AAC9B,OAAO,QAAQ,CAAC;AAiChB,cAAc,UAAU,CAAC"}
|
package/dist/generated/index.js
CHANGED
|
@@ -22,16 +22,18 @@ 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\":\"/Users/mauricio/dev/n3xa-dev/n3xa/packages/proteinjs/packages/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/SharedRecord\",\"value\":{\"packageName\":\"@proteinjs/user\",\"name\":\"SharedRecord\",\"filePath\":\"/Users/mauricio/dev/n3xa-dev/n3xa/packages/proteinjs/packages/user/packages/user/src/SharedRecord.ts\",\"qualifiedName\":\"@proteinjs/user/SharedRecord\",\"properties\":[{\"name\":\"permissionSource\",\"type\":{\"packageName\":\"\",\"name\":\"Reference<T>\",\"filePath\":null,\"qualifiedName\":\"/Reference<T>\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"permissionSourceTable\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"}],\"methods\":[],\"typeParameters\":[\"/T extends SharedRecord = any\"],\"directParents\":[{\"packageName\":\"@proteinjs/db\",\"name\":\"Record\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db/Record\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParents\":[]}],\"sourceType\":3}},{\"v\":\"@proteinjs/user/UserRepo\",\"value\":{\"packageName\":\"@proteinjs/user\",\"name\":\"UserRepo\",\"filePath\":\"/Users/mauricio/dev/n3xa-dev/n3xa/packages/proteinjs/packages/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\":\"/Pick\"},{\"v\":\"@proteinjs/user/SignupService\",\"value\":{\"packageName\":\"@proteinjs/user\",\"name\":\"SignupService\",\"filePath\":\"/Users/mauricio/dev/n3xa-dev/n3xa/packages/proteinjs/packages/user/packages/user/src/services/SignupService.ts\",\"qualifiedName\":\"@proteinjs/user/SignupService\",\"properties\":[],\"methods\":[{\"name\":\"createUser\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<void>\",\"filePath\":null,\"qualifiedName\":\"/Promise<void>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":true,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"user\",\"type\":{\"packageName\":\"@proteinjs/user\",\"name\":\"UserSignup\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/user/UserSignup\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"token\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"sendInvite\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<SendInviteResponse>\",\"filePath\":null,\"qualifiedName\":\"/Promise<SendInviteResponse>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":true,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"email\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"revokeInvite\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<void>\",\"filePath\":null,\"qualifiedName\":\"/Promise<void>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":true,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"email\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"initializeSignup\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<InitializeSignupResponse>\",\"filePath\":null,\"qualifiedName\":\"/Promise<InitializeSignupResponse>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":true,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"inviteToken\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}}]}],\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/service\",\"name\":\"Service\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/service/Service\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParents\":[]}],\"sourceType\":3}},{\"v\":\"@proteinjs/service/Service\"},{\"v\":\"@proteinjs/user/UpdateUserInfoService\",\"value\":{\"packageName\":\"@proteinjs/user\",\"name\":\"UpdateUserInfoService\",\"filePath\":\"/Users/mauricio/dev/n3xa-dev/n3xa/packages/proteinjs/packages/user/packages/user/src/services/UpdateUserInfoService.ts\",\"qualifiedName\":\"@proteinjs/user/UpdateUserInfoService\",\"properties\":[],\"methods\":[{\"name\":\"updateName\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<void>\",\"filePath\":null,\"qualifiedName\":\"/Promise<void>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":true,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"name\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"updatePassword\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<UpdatePasswordResponse>\",\"filePath\":null,\"qualifiedName\":\"/Promise<UpdatePasswordResponse>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":true,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"currentPassword\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"newPassword\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}}]}],\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/service\",\"name\":\"Service\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/service/Service\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParents\":[]}],\"sourceType\":3}},{\"v\":\"@proteinjs/user/AccessGrant\",\"value\":{\"packageName\":\"@proteinjs/user\",\"name\":\"AccessGrant\",\"filePath\":\"/Users/mauricio/dev/n3xa-dev/n3xa/packages/proteinjs/packages/user/packages/user/src/tables/AccessGrantTable.ts\",\"qualifiedName\":\"@proteinjs/user/AccessGrant\",\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/db\",\"name\":\"Record\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db/Record\",\"typeParameters\":[],\"directParents\":null},{\"packageName\":\"@proteinjs/user\",\"name\":\"{\\n principal: Reference<any>;\\n resource: Reference<any>;\\n resourceTable?: Table<any>['name'];\\n accessLevel: 'read' | 'write' | 'admin';\\n}\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/user/{\\n principal: Reference<any>;\\n resource: Reference<any>;\\n resourceTable?: Table<any>['name'];\\n accessLevel: 'read' | 'write' | 'admin';\\n}\",\"typeParameters\":[],\"directParents\":null}],\"sourceType\":1}},{\"v\":\"@proteinjs/user/AccessGrantTable\",\"value\":{\"packageName\":\"@proteinjs/user\",\"name\":\"AccessGrantTable\",\"filePath\":\"/Users/mauricio/dev/n3xa-dev/n3xa/packages/proteinjs/packages/user/packages/user/src/tables/AccessGrantTable.ts\",\"qualifiedName\":\"@proteinjs/user/AccessGrantTable\",\"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/AccessGrant\"],\"directParentInterfaces\":[],\"directParentClasses\":[]}],\"sourceType\":2}},{\"v\":\"@proteinjs/db/Table\"},{\"v\":\"@proteinjs/user/Invite\",\"value\":{\"packageName\":\"@proteinjs/user\",\"name\":\"Invite\",\"filePath\":\"/Users/mauricio/dev/n3xa-dev/n3xa/packages/proteinjs/packages/user/packages/user/src/tables/InviteTable.ts\",\"qualifiedName\":\"@proteinjs/user/Invite\",\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/db\",\"name\":\"Record\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db/Record\",\"typeParameters\":[],\"directParents\":null},{\"packageName\":\"@proteinjs/user\",\"name\":\"{\\n email: string;\\n token: string | null;\\n tokenExpiresAt: Moment | null;\\n invitedBy: string;\\n}\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/user/{\\n email: string;\\n token: string | null;\\n tokenExpiresAt: Moment | null;\\n invitedBy: string;\\n}\",\"typeParameters\":[],\"directParents\":null}],\"sourceType\":1}},{\"v\":\"@proteinjs/user/InviteTable\",\"value\":{\"packageName\":\"@proteinjs/user\",\"name\":\"InviteTable\",\"filePath\":\"/Users/mauricio/dev/n3xa-dev/n3xa/packages/proteinjs/packages/user/packages/user/src/tables/InviteTable.ts\",\"qualifiedName\":\"@proteinjs/user/InviteTable\",\"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/Invite\"],\"directParentInterfaces\":[],\"directParentClasses\":[]}],\"sourceType\":2}},{\"v\":\"@proteinjs/user/Session\",\"value\":{\"packageName\":\"@proteinjs/user\",\"name\":\"Session\",\"filePath\":\"/Users/mauricio/dev/n3xa-dev/n3xa/packages/proteinjs/packages/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\":\"/Users/mauricio/dev/n3xa-dev/n3xa/packages/proteinjs/packages/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/user/User\",\"value\":{\"packageName\":\"@proteinjs/user\",\"name\":\"User\",\"filePath\":\"/Users/mauricio/dev/n3xa-dev/n3xa/packages/proteinjs/packages/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 passwordResetToken?: string | null;\\n passwordResetTokenExpiration?: Moment | null;\\n emailVerified: boolean;\\n roles: string;\\n invitedBy?: string | null;\\n}\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/user/{\\n name: string;\\n email: string;\\n password: string;\\n passwordResetToken?: string | null;\\n passwordResetTokenExpiration?: Moment | null;\\n emailVerified: boolean;\\n roles: string;\\n invitedBy?: string | null;\\n}\",\"typeParameters\":[],\"directParents\":null}],\"sourceType\":1}},{\"v\":\"@proteinjs/user/UserTable\",\"value\":{\"packageName\":\"@proteinjs/user\",\"name\":\"UserTable\",\"filePath\":\"/Users/mauricio/dev/n3xa-dev/n3xa/packages/proteinjs/packages/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/SharedRecord\",\"w\":\"@proteinjs/db/Record\",\"value\":\"extends interface\"},{\"v\":\"@proteinjs/user/UserRepo\",\"w\":\"@proteinjs/user-auth/AuthenticatedUserRepo\",\"value\":\"implements interface\"},{\"v\":\"@proteinjs/user/SignupService\",\"w\":\"@proteinjs/service/Service\",\"value\":\"extends interface\"},{\"v\":\"@proteinjs/user/UpdateUserInfoService\",\"w\":\"@proteinjs/service/Service\",\"value\":\"extends interface\"},{\"v\":\"@proteinjs/user/AccessGrant\",\"w\":\"@proteinjs/db/Record\",\"value\":\"extends type\"},{\"v\":\"@proteinjs/user/AccessGrantTable\",\"w\":\"@proteinjs/db/Table\",\"value\":\"extends class\"},{\"v\":\"@proteinjs/user/Invite\",\"w\":\"@proteinjs/db/Record\",\"value\":\"extends type\"},{\"v\":\"@proteinjs/user/InviteTable\",\"w\":\"@proteinjs/db/Table\",\"value\":\"extends class\"},{\"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\"}]}";
|
|
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/SharedRecord\",\"value\":{\"packageName\":\"@proteinjs/user\",\"name\":\"SharedRecord\",\"filePath\":\"/home/runner/work/user/user/packages/user/src/SharedRecord.ts\",\"qualifiedName\":\"@proteinjs/user/SharedRecord\",\"properties\":[{\"name\":\"permissionSource\",\"type\":{\"packageName\":\"\",\"name\":\"Reference<T>\",\"filePath\":null,\"qualifiedName\":\"/Reference<T>\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"permissionSourceTable\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"}],\"methods\":[],\"typeParameters\":[\"/T extends SharedRecord = any\"],\"directParents\":[{\"packageName\":\"@proteinjs/db\",\"name\":\"Record\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db/Record\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParents\":[]}],\"sourceType\":3}},{\"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/AccessInviteService\",\"value\":{\"packageName\":\"@proteinjs/user\",\"name\":\"AccessInviteService\",\"filePath\":\"/home/runner/work/user/user/packages/user/src/services/AccessInviteService.ts\",\"qualifiedName\":\"@proteinjs/user/AccessInviteService\",\"properties\":[],\"methods\":[{\"name\":\"createAccessInvite\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<CreateAccessInviteResponse>\",\"filePath\":null,\"qualifiedName\":\"/Promise<CreateAccessInviteResponse>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":true,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"params\",\"type\":{\"packageName\":\"@proteinjs/user\",\"name\":\"CreateAccessInviteParams\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/user/CreateAccessInviteParams\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"acceptAccessInvite\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<T | undefined>\",\"filePath\":null,\"qualifiedName\":\"/Promise<T | undefined>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":true,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"token\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}}]}],\"typeParameters\":[\"/T extends Record\"],\"directParents\":[{\"packageName\":\"@proteinjs/service\",\"name\":\"Service\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/service/Service\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParents\":[]}],\"sourceType\":3}},{\"v\":\"@proteinjs/service/Service\"},{\"v\":\"/Pick\"},{\"v\":\"@proteinjs/user/SignupService\",\"value\":{\"packageName\":\"@proteinjs/user\",\"name\":\"SignupService\",\"filePath\":\"/home/runner/work/user/user/packages/user/src/services/SignupService.ts\",\"qualifiedName\":\"@proteinjs/user/SignupService\",\"properties\":[],\"methods\":[{\"name\":\"createUser\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<void>\",\"filePath\":null,\"qualifiedName\":\"/Promise<void>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":true,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"user\",\"type\":{\"packageName\":\"@proteinjs/user\",\"name\":\"UserSignup\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/user/UserSignup\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"token\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"sendInvite\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<SendInviteResponse>\",\"filePath\":null,\"qualifiedName\":\"/Promise<SendInviteResponse>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":true,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"email\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"revokeInvite\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<void>\",\"filePath\":null,\"qualifiedName\":\"/Promise<void>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":true,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"email\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"initializeSignup\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<InitializeSignupResponse>\",\"filePath\":null,\"qualifiedName\":\"/Promise<InitializeSignupResponse>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":true,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"inviteToken\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}}]}],\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/service\",\"name\":\"Service\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/service/Service\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParents\":[]}],\"sourceType\":3}},{\"v\":\"@proteinjs/user/UpdateUserInfoService\",\"value\":{\"packageName\":\"@proteinjs/user\",\"name\":\"UpdateUserInfoService\",\"filePath\":\"/home/runner/work/user/user/packages/user/src/services/UpdateUserInfoService.ts\",\"qualifiedName\":\"@proteinjs/user/UpdateUserInfoService\",\"properties\":[],\"methods\":[{\"name\":\"updateName\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<void>\",\"filePath\":null,\"qualifiedName\":\"/Promise<void>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":true,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"name\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"updatePassword\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<UpdatePasswordResponse>\",\"filePath\":null,\"qualifiedName\":\"/Promise<UpdatePasswordResponse>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":true,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"currentPassword\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"newPassword\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}}]}],\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/service\",\"name\":\"Service\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/service/Service\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParents\":[]}],\"sourceType\":3}},{\"v\":\"@proteinjs/user/AccessGrant\",\"value\":{\"packageName\":\"@proteinjs/user\",\"name\":\"AccessGrant\",\"filePath\":\"/home/runner/work/user/user/packages/user/src/tables/AccessGrantTable.ts\",\"qualifiedName\":\"@proteinjs/user/AccessGrant\",\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/db\",\"name\":\"Record\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db/Record\",\"typeParameters\":[],\"directParents\":null},{\"packageName\":\"@proteinjs/user\",\"name\":\"{\\n principal: Reference<any>;\\n resource: Reference<any>;\\n resourceTable?: Table<any>['name'];\\n accessLevel: 'read' | 'write' | 'admin';\\n}\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/user/{\\n principal: Reference<any>;\\n resource: Reference<any>;\\n resourceTable?: Table<any>['name'];\\n accessLevel: 'read' | 'write' | 'admin';\\n}\",\"typeParameters\":[],\"directParents\":null}],\"sourceType\":1}},{\"v\":\"@proteinjs/user/AccessGrantTable\",\"value\":{\"packageName\":\"@proteinjs/user\",\"name\":\"AccessGrantTable\",\"filePath\":\"/home/runner/work/user/user/packages/user/src/tables/AccessGrantTable.ts\",\"qualifiedName\":\"@proteinjs/user/AccessGrantTable\",\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"properties\":[{\"name\":\"name\",\"type\":null,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"auth\",\"type\":{\"packageName\":\"\",\"name\":\"Table<AccessGrant>['auth']\",\"filePath\":null,\"qualifiedName\":\"/Table<AccessGrant>['auth']\",\"typeParameters\":null,\"directParents\":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/AccessGrant\"],\"directParentInterfaces\":[],\"directParentClasses\":[]}],\"sourceType\":2}},{\"v\":\"@proteinjs/db/Table\"},{\"v\":\"@proteinjs/user/AccessInvite\",\"value\":{\"packageName\":\"@proteinjs/user\",\"name\":\"AccessInvite\",\"filePath\":\"/home/runner/work/user/user/packages/user/src/tables/AccessInviteTable.ts\",\"qualifiedName\":\"@proteinjs/user/AccessInvite\",\"typeParameters\":[\"/T extends Record = any\"],\"directParents\":[{\"packageName\":\"@proteinjs/db\",\"name\":\"Record\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db/Record\",\"typeParameters\":[],\"directParents\":null},{\"packageName\":\"@proteinjs/user\",\"name\":\"{\\n token?: string;\\n tokenExpiresAt: Moment;\\n resource: Reference<T>;\\n resourceTable: string;\\n accepted?: boolean;\\n acceptedBy?: Reference<User>;\\n acceptedAt?: Moment;\\n}\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/user/{\\n token?: string;\\n tokenExpiresAt: Moment;\\n resource: Reference<T>;\\n resourceTable: string;\\n accepted?: boolean;\\n acceptedBy?: Reference<User>;\\n acceptedAt?: Moment;\\n}\",\"typeParameters\":[],\"directParents\":null}],\"sourceType\":1}},{\"v\":\"@proteinjs/user/AccessInviteTable\",\"value\":{\"packageName\":\"@proteinjs/user\",\"name\":\"AccessInviteTable\",\"filePath\":\"/home/runner/work/user/user/packages/user/src/tables/AccessInviteTable.ts\",\"qualifiedName\":\"@proteinjs/user/AccessInviteTable\",\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"properties\":[{\"name\":\"name\",\"type\":null,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"auth\",\"type\":{\"packageName\":\"\",\"name\":\"Table<AccessInvite>['auth']\",\"filePath\":null,\"qualifiedName\":\"/Table<AccessInvite>['auth']\",\"typeParameters\":null,\"directParents\":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/AccessInvite\"],\"directParentInterfaces\":[],\"directParentClasses\":[]}],\"sourceType\":2}},{\"v\":\"@proteinjs/user/Invite\",\"value\":{\"packageName\":\"@proteinjs/user\",\"name\":\"Invite\",\"filePath\":\"/home/runner/work/user/user/packages/user/src/tables/InviteTable.ts\",\"qualifiedName\":\"@proteinjs/user/Invite\",\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/db\",\"name\":\"Record\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db/Record\",\"typeParameters\":[],\"directParents\":null},{\"packageName\":\"@proteinjs/user\",\"name\":\"{\\n email: string;\\n token: string | null;\\n tokenExpiresAt: Moment | null;\\n invitedBy: string;\\n}\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/user/{\\n email: string;\\n token: string | null;\\n tokenExpiresAt: Moment | null;\\n invitedBy: string;\\n}\",\"typeParameters\":[],\"directParents\":null}],\"sourceType\":1}},{\"v\":\"@proteinjs/user/InviteTable\",\"value\":{\"packageName\":\"@proteinjs/user\",\"name\":\"InviteTable\",\"filePath\":\"/home/runner/work/user/user/packages/user/src/tables/InviteTable.ts\",\"qualifiedName\":\"@proteinjs/user/InviteTable\",\"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/Invite\"],\"directParentInterfaces\":[],\"directParentClasses\":[]}],\"sourceType\":2}},{\"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/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 passwordResetToken?: string | null;\\n passwordResetTokenExpiration?: Moment | null;\\n emailVerified: boolean;\\n roles: string;\\n invitedBy?: string | null;\\n}\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/user/{\\n name: string;\\n email: string;\\n password: string;\\n passwordResetToken?: string | null;\\n passwordResetTokenExpiration?: Moment | null;\\n emailVerified: boolean;\\n roles: string;\\n invitedBy?: string | null;\\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/SharedRecord\",\"w\":\"@proteinjs/db/Record\",\"value\":\"extends interface\"},{\"v\":\"@proteinjs/user/UserRepo\",\"w\":\"@proteinjs/user-auth/AuthenticatedUserRepo\",\"value\":\"implements interface\"},{\"v\":\"@proteinjs/user/AccessInviteService\",\"w\":\"@proteinjs/service/Service\",\"value\":\"extends interface\"},{\"v\":\"@proteinjs/user/SignupService\",\"w\":\"@proteinjs/service/Service\",\"value\":\"extends interface\"},{\"v\":\"@proteinjs/user/UpdateUserInfoService\",\"w\":\"@proteinjs/service/Service\",\"value\":\"extends interface\"},{\"v\":\"@proteinjs/user/AccessGrant\",\"w\":\"@proteinjs/db/Record\",\"value\":\"extends type\"},{\"v\":\"@proteinjs/user/AccessGrantTable\",\"w\":\"@proteinjs/db/Table\",\"value\":\"extends class\"},{\"v\":\"@proteinjs/user/AccessInvite\",\"w\":\"@proteinjs/db/Record\",\"value\":\"extends type\"},{\"v\":\"@proteinjs/user/AccessInviteTable\",\"w\":\"@proteinjs/db/Table\",\"value\":\"extends class\"},{\"v\":\"@proteinjs/user/Invite\",\"w\":\"@proteinjs/db/Record\",\"value\":\"extends type\"},{\"v\":\"@proteinjs/user/InviteTable\",\"w\":\"@proteinjs/db/Table\",\"value\":\"extends class\"},{\"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 AccessGrantTable_1 = require("../src/tables/AccessGrantTable");
|
|
29
|
+
var AccessInviteTable_1 = require("../src/tables/AccessInviteTable");
|
|
29
30
|
var InviteTable_1 = require("../src/tables/InviteTable");
|
|
30
31
|
var SessionTable_1 = require("../src/tables/SessionTable");
|
|
31
32
|
var UserTable_1 = require("../src/tables/UserTable");
|
|
32
33
|
var sourceLinks = {
|
|
33
34
|
'@proteinjs/user/UserRepo': UserRepo_1.UserRepo,
|
|
34
35
|
'@proteinjs/user/AccessGrantTable': AccessGrantTable_1.AccessGrantTable,
|
|
36
|
+
'@proteinjs/user/AccessInviteTable': AccessInviteTable_1.AccessInviteTable,
|
|
35
37
|
'@proteinjs/user/InviteTable': InviteTable_1.InviteTable,
|
|
36
38
|
'@proteinjs/user/SessionTable': SessionTable_1.SessionTable,
|
|
37
39
|
'@proteinjs/user/UserTable': UserTable_1.UserTable,
|
|
@@ -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,gxqBAAgxqB,CAAC;AAGryqB,4BAA4B;AAE5B,4CAA2C;AAC3C,mEAAkE;AAClE,qEAAoE;AACpE,yDAAwD;AACxD,2DAA0D;AAC1D,qDAAoD;AAEpD,IAAM,WAAW,GAAG;IACnB,0BAA0B,EAAE,mBAAQ;IACpC,kCAAkC,EAAE,mCAAgB;IACpD,mCAAmC,EAAE,qCAAiB;IACtD,6BAA6B,EAAE,yBAAW;IAC1C,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"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
export * from './src/services/AccessInviteService';
|
|
1
2
|
export * from './src/services/SignupService';
|
|
2
3
|
export * from './src/services/UpdateUserInfoService';
|
|
4
|
+
export * from './src/tables/AccessInviteTable';
|
|
3
5
|
export * from './src/tables/InviteTable';
|
|
4
6
|
export * from './src/tables/UserTable';
|
|
5
7
|
export * from './src/tables/SessionTable';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sCAAsC,CAAC;AAErD,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,qBAAqB,CAAC;AACpC,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AAEnC,cAAc,sBAAsB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,cAAc,oCAAoC,CAAC;AACnD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sCAAsC,CAAC;AAErD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,qBAAqB,CAAC;AACpC,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AAEnC,cAAc,sBAAsB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -14,8 +14,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./src/services/AccessInviteService"), exports);
|
|
17
18
|
__exportStar(require("./src/services/SignupService"), exports);
|
|
18
19
|
__exportStar(require("./src/services/UpdateUserInfoService"), exports);
|
|
20
|
+
__exportStar(require("./src/tables/AccessInviteTable"), exports);
|
|
19
21
|
__exportStar(require("./src/tables/InviteTable"), exports);
|
|
20
22
|
__exportStar(require("./src/tables/UserTable"), exports);
|
|
21
23
|
__exportStar(require("./src/tables/SessionTable"), exports);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+DAA6C;AAC7C,uEAAqD;AAErD,2DAAyC;AACzC,yDAAuC;AACvC,4DAA0C;AAC1C,sDAAoC;AACpC,+CAA6B;AAC7B,kDAAgC;AAChC,iDAA+B;AAC/B,qDAAmC;AACnC,qDAAmC;AAEnC,uDAAqC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qEAAmD;AACnD,+DAA6C;AAC7C,uEAAqD;AAErD,iEAA+C;AAC/C,2DAAyC;AACzC,yDAAuC;AACvC,4DAA0C;AAC1C,sDAAoC;AACpC,+CAA6B;AAC7B,kDAAgC;AAChC,iDAA+B;AAC/B,qDAAmC;AACnC,qDAAmC;AAEnC,uDAAqC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Record } from '@proteinjs/db';
|
|
2
|
+
import type { Moment } from 'moment';
|
|
3
|
+
import { Service } from '@proteinjs/service';
|
|
4
|
+
export declare const getAccessInviteService: <T extends Record>() => () => AccessInviteService<T>;
|
|
5
|
+
export type CreateAccessInviteParams = {
|
|
6
|
+
resourceTable: string;
|
|
7
|
+
resourceId: string;
|
|
8
|
+
expiresInDays?: number;
|
|
9
|
+
};
|
|
10
|
+
export type CreateAccessInviteResponse = {
|
|
11
|
+
token: string;
|
|
12
|
+
tokenExpiresAt: Moment;
|
|
13
|
+
};
|
|
14
|
+
export interface AccessInviteService<T extends Record> extends Service {
|
|
15
|
+
/**
|
|
16
|
+
* Creates an access invite for a resource. Caller must have admin access to the resource.
|
|
17
|
+
* Returns a token and expiry which can be embedded as a query parameter in a shareable URL.
|
|
18
|
+
*/
|
|
19
|
+
createAccessInvite(params: CreateAccessInviteParams): Promise<CreateAccessInviteResponse>;
|
|
20
|
+
/**
|
|
21
|
+
* Accepts an access invite using the provided token. The current authenticated user will be granted access.
|
|
22
|
+
*/
|
|
23
|
+
acceptAccessInvite(token: string): Promise<T | undefined>;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=AccessInviteService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AccessInviteService.d.ts","sourceRoot":"","sources":["../../../src/services/AccessInviteService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC,OAAO,EAAE,OAAO,EAAkB,MAAM,oBAAoB,CAAC;AAE7D,eAAO,MAAM,sBAAsB,sDAC4C,CAAC;AAEhF,MAAM,MAAM,wBAAwB,GAAG;IACrC,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,MAAM,WAAW,mBAAmB,CAAC,CAAC,SAAS,MAAM,CAAE,SAAQ,OAAO;IACpE;;;OAGG;IACH,kBAAkB,CAAC,MAAM,EAAE,wBAAwB,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAAC;IAC1F;;OAEG;IACH,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC;CAC3D"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getAccessInviteService = void 0;
|
|
4
|
+
var service_1 = require("@proteinjs/service");
|
|
5
|
+
var getAccessInviteService = function () {
|
|
6
|
+
return (0, service_1.serviceFactory)('@proteinjs/user/AccessInviteService');
|
|
7
|
+
};
|
|
8
|
+
exports.getAccessInviteService = getAccessInviteService;
|
|
9
|
+
//# sourceMappingURL=AccessInviteService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AccessInviteService.js","sourceRoot":"","sources":["../../../src/services/AccessInviteService.ts"],"names":[],"mappings":";;;AAGA,8CAA6D;AAEtD,IAAM,sBAAsB,GAAG;IACpC,OAAA,IAAA,wBAAc,EAAyB,qCAAqC,CAAC;AAA7E,CAA6E,CAAC;AADnE,QAAA,sBAAsB,0BAC6C"}
|
|
@@ -8,6 +8,7 @@ export type AccessGrant = Record & {
|
|
|
8
8
|
};
|
|
9
9
|
export declare class AccessGrantTable extends Table<AccessGrant> {
|
|
10
10
|
name: string;
|
|
11
|
+
auth: Table<AccessGrant>['auth'];
|
|
11
12
|
columns: {
|
|
12
13
|
id: import("@proteinjs/db").Column<string, any>;
|
|
13
14
|
created: import("@proteinjs/db").Column<import("moment").Moment, any>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccessGrantTable.d.ts","sourceRoot":"","sources":["../../../src/tables/AccessGrantTable.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,MAAM,EACN,SAAS,EAIV,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAItC,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG;IACjC,SAAS,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC;IAC1B,QAAQ,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC;IACzB,aAAa,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC;IACnC,WAAW,EAAE,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC;CACzC,CAAC;AAEF,qBAAa,gBAAiB,SAAQ,KAAK,CAAC,WAAW,CAAC;IACtD,IAAI,SAAkB;IACtB,OAAO;;;;;;;;;WA+BJ;CACJ"}
|
|
1
|
+
{"version":3,"file":"AccessGrantTable.d.ts","sourceRoot":"","sources":["../../../src/tables/AccessGrantTable.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,MAAM,EACN,SAAS,EAIV,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAItC,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG;IACjC,SAAS,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC;IAC1B,QAAQ,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC;IACzB,aAAa,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC;IACnC,WAAW,EAAE,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC;CACzC,CAAC;AAEF,qBAAa,gBAAiB,SAAQ,KAAK,CAAC,WAAW,CAAC;IACtD,IAAI,SAAkB;IACtB,IAAI,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,CAO9B;IACF,OAAO;;;;;;;;;WA+BJ;CACJ"}
|
|
@@ -61,6 +61,14 @@ var AccessGrantTable = /** @class */ (function (_super) {
|
|
|
61
61
|
function AccessGrantTable() {
|
|
62
62
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
63
63
|
_this.name = 'access_grant';
|
|
64
|
+
_this.auth = {
|
|
65
|
+
db: {
|
|
66
|
+
all: 'authenticated',
|
|
67
|
+
},
|
|
68
|
+
service: {
|
|
69
|
+
all: 'authenticated',
|
|
70
|
+
},
|
|
71
|
+
};
|
|
64
72
|
_this.columns = (0, db_1.withRecordColumns)({
|
|
65
73
|
accessLevel: new db_1.StringColumn('access_level'),
|
|
66
74
|
principal: new db_1.ReferenceColumn('principal', UserTable_1.UserTable.name, false),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccessGrantTable.js","sourceRoot":"","sources":["../../../src/tables/AccessGrantTable.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oCASuB;AAEvB,oCAAsC;AACtC,yCAA8C;AAC9C,wCAAuC;AASvC;IAAsC,oCAAkB;IAAxD;QAAA,
|
|
1
|
+
{"version":3,"file":"AccessGrantTable.js","sourceRoot":"","sources":["../../../src/tables/AccessGrantTable.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oCASuB;AAEvB,oCAAsC;AACtC,yCAA8C;AAC9C,wCAAuC;AASvC;IAAsC,oCAAkB;IAAxD;QAAA,qEA0CC;QAzCC,UAAI,GAAG,cAAc,CAAC;QACtB,UAAI,GAA+B;YACjC,EAAE,EAAE;gBACF,GAAG,EAAE,eAAe;aACrB;YACD,OAAO,EAAE;gBACP,GAAG,EAAE,eAAe;aACrB;SACF,CAAC;QACF,aAAO,GAAG,IAAA,sBAAiB,EAAc;YACvC,WAAW,EAAE,IAAI,iBAAY,CAAC,cAAc,CAAC;YAC7C,SAAS,EAAE,IAAI,oBAAe,CAAO,WAAW,EAAE,qBAAS,CAAC,IAAI,EAAE,KAAK,CAAC;YACxE,QAAQ,EAAE,IAAI,2BAAsB,CAAM,UAAU,EAAE,gBAAgB,EAAE,KAAK,CAAC;YAC9E,aAAa,EAAE,IAAI,oCAA+B,CAAC,gBAAgB,EAAE,UAAU,EAAE;gBAC/E,cAAc,EAAE,UAAO,SAAsB,EAAE,WAAW;;;;;gCACxD,IAAI,WAAW,EAAE;oCACf,sBAAO;iCACR;gCAGgB,qBAAM,SAAS,CAAC,QAAQ,CAAC,GAAG,EAAE,EAAA;;gCAAzC,QAAQ,GAAG,SAA8B;gCAC/C,IAAI,CAAC,QAAQ,EAAE;oCACb,sBAAO;iCACR;gCAIG,qBAAM,IAAA,kBAAa,GAAE,CAAC,KAAK,CAAC,IAAI,gBAAgB,EAAwB,EAAE;wCACxE,WAAW,EAAE,OAAO;wCACpB,SAAS,EAAE,IAAI,mBAAQ,EAAE,CAAC,OAAO,EAAE,CAAC,EAAE;wCACtC,QAAQ,EAAE,SAAS,CAAC,QAAQ,CAAC,GAAG;wCAChC,aAAa,EAAE,SAAS,CAAC,aAAa;qCACvC,CAAC,EAAA;;gCAPA,cAAc,GAClB,CACE,SAKE,CACH,CAAC,MAAM,GAAG,CAAC;gCAEd,IAAI,CAAC,cAAc,EAAE;oCACnB,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;iCAChE;;;;qBACF;aACF,CAAC;SACH,CAAC,CAAC;;IACL,CAAC;IAAD,uBAAC;AAAD,CAAC,AA1CD,CAAsC,UAAK,GA0C1C;AA1CY,4CAAgB"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { Moment } from 'moment';
|
|
2
|
+
import { Record, Reference, Table } from '@proteinjs/db';
|
|
3
|
+
import { User } from './UserTable';
|
|
4
|
+
export type AccessInvite<T extends Record = any> = Record & {
|
|
5
|
+
token?: string;
|
|
6
|
+
tokenExpiresAt: Moment;
|
|
7
|
+
resource: Reference<T>;
|
|
8
|
+
resourceTable: string;
|
|
9
|
+
accepted?: boolean;
|
|
10
|
+
acceptedBy?: Reference<User>;
|
|
11
|
+
acceptedAt?: Moment;
|
|
12
|
+
};
|
|
13
|
+
export declare class AccessInviteTable extends Table<AccessInvite> {
|
|
14
|
+
name: string;
|
|
15
|
+
auth: Table<AccessInvite>['auth'];
|
|
16
|
+
columns: {
|
|
17
|
+
id: import("@proteinjs/db").Column<string, any>;
|
|
18
|
+
created: import("@proteinjs/db").Column<Moment, any>;
|
|
19
|
+
updated: import("@proteinjs/db").Column<Moment, any>;
|
|
20
|
+
} & {} & {
|
|
21
|
+
token: import("@proteinjs/db").Column<string | undefined, any>;
|
|
22
|
+
tokenExpiresAt: import("@proteinjs/db").Column<Moment, any>;
|
|
23
|
+
resource: import("@proteinjs/db").Column<Reference<any>, any>;
|
|
24
|
+
resourceTable: import("@proteinjs/db").Column<string, any>;
|
|
25
|
+
accepted: import("@proteinjs/db").Column<boolean | undefined, any>;
|
|
26
|
+
acceptedBy: import("@proteinjs/db").Column<Reference<User> | undefined, any>;
|
|
27
|
+
acceptedAt: import("@proteinjs/db").Column<Moment | undefined, any>;
|
|
28
|
+
} & {};
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=AccessInviteTable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AccessInviteTable.d.ts","sourceRoot":"","sources":["../../../src/tables/AccessInviteTable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC,OAAO,EAML,MAAM,EACN,SAAS,EAGT,KAAK,EAEN,MAAM,eAAe,CAAC;AAIvB,OAAO,EAAE,IAAI,EAAa,MAAM,aAAa,CAAC;AAE9C,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,MAAM,GAAG,GAAG,IAAI,MAAM,GAAG;IAC1D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC;IAC7B,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,qBAAa,iBAAkB,SAAQ,KAAK,CAAC,YAAY,CAAC;IACxD,IAAI,SAAmB;IACvB,IAAI,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,CAO/B;IACF,OAAO;;;;;;;;;;;;WA+BJ;CACJ"}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
18
|
+
if (k2 === undefined) k2 = k;
|
|
19
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
20
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
21
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
22
|
+
}
|
|
23
|
+
Object.defineProperty(o, k2, desc);
|
|
24
|
+
}) : (function(o, m, k, k2) {
|
|
25
|
+
if (k2 === undefined) k2 = k;
|
|
26
|
+
o[k2] = m[k];
|
|
27
|
+
}));
|
|
28
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
29
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
30
|
+
}) : function(o, v) {
|
|
31
|
+
o["default"] = v;
|
|
32
|
+
});
|
|
33
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
41
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
42
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
43
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
44
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
45
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
46
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
50
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
51
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
52
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
53
|
+
function step(op) {
|
|
54
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
55
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
56
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
57
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
58
|
+
switch (op[0]) {
|
|
59
|
+
case 0: case 1: t = op; break;
|
|
60
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
61
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
62
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
63
|
+
default:
|
|
64
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
65
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
66
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
67
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
68
|
+
if (t[2]) _.ops.pop();
|
|
69
|
+
_.trys.pop(); continue;
|
|
70
|
+
}
|
|
71
|
+
op = body.call(thisArg, _);
|
|
72
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
73
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
77
|
+
exports.AccessInviteTable = void 0;
|
|
78
|
+
var db_1 = require("@proteinjs/db");
|
|
79
|
+
var crypto = __importStar(require("crypto"));
|
|
80
|
+
var UserRepo_1 = require("../UserRepo");
|
|
81
|
+
var AccessGrantTable_1 = require("./AccessGrantTable");
|
|
82
|
+
var UserTable_1 = require("./UserTable");
|
|
83
|
+
var AccessInviteTable = /** @class */ (function (_super) {
|
|
84
|
+
__extends(AccessInviteTable, _super);
|
|
85
|
+
function AccessInviteTable() {
|
|
86
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
87
|
+
_this.name = 'access_invite';
|
|
88
|
+
_this.auth = {
|
|
89
|
+
db: {
|
|
90
|
+
all: 'authenticated',
|
|
91
|
+
},
|
|
92
|
+
service: {
|
|
93
|
+
all: 'authenticated',
|
|
94
|
+
},
|
|
95
|
+
};
|
|
96
|
+
_this.columns = (0, db_1.withRecordColumns)({
|
|
97
|
+
token: new db_1.StringColumn('token', {
|
|
98
|
+
defaultValue: function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
99
|
+
return [2 /*return*/, crypto.randomBytes(32).toString('hex')];
|
|
100
|
+
}); }); },
|
|
101
|
+
forceDefaultValue: true,
|
|
102
|
+
}),
|
|
103
|
+
tokenExpiresAt: new db_1.DateTimeColumn('expires_at'),
|
|
104
|
+
accepted: new db_1.BooleanColumn('accepted', { defaultValue: function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
105
|
+
return [2 /*return*/, false];
|
|
106
|
+
}); }); } }),
|
|
107
|
+
acceptedBy: new db_1.ReferenceColumn('accepted_by', new UserTable_1.UserTable().name, false),
|
|
108
|
+
acceptedAt: new db_1.DateTimeColumn('accepted_at'),
|
|
109
|
+
resource: new db_1.DynamicReferenceColumn('resource', 'resource_table'),
|
|
110
|
+
resourceTable: new db_1.DynamicReferenceTableNameColumn('resource_table', 'resource', {
|
|
111
|
+
onBeforeInsert: function (insertObj, runAsSystem) { return __awaiter(_this, void 0, void 0, function () {
|
|
112
|
+
var hasAdminAccess;
|
|
113
|
+
return __generator(this, function (_a) {
|
|
114
|
+
switch (_a.label) {
|
|
115
|
+
case 0:
|
|
116
|
+
if (runAsSystem) {
|
|
117
|
+
return [2 /*return*/];
|
|
118
|
+
}
|
|
119
|
+
return [4 /*yield*/, (0, db_1.getDbAsSystem)().query(new AccessGrantTable_1.AccessGrantTable(), {
|
|
120
|
+
accessLevel: 'admin',
|
|
121
|
+
principal: new UserRepo_1.UserRepo().getUser().id,
|
|
122
|
+
resource: insertObj.resource._id,
|
|
123
|
+
resourceTable: insertObj.resourceTable,
|
|
124
|
+
})];
|
|
125
|
+
case 1:
|
|
126
|
+
hasAdminAccess = (_a.sent()).length > 0;
|
|
127
|
+
if (!hasAdminAccess) {
|
|
128
|
+
throw new Error("User does not have admin access to resource");
|
|
129
|
+
}
|
|
130
|
+
return [2 /*return*/];
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
}); },
|
|
134
|
+
}),
|
|
135
|
+
});
|
|
136
|
+
return _this;
|
|
137
|
+
}
|
|
138
|
+
return AccessInviteTable;
|
|
139
|
+
}(db_1.Table));
|
|
140
|
+
exports.AccessInviteTable = AccessInviteTable;
|
|
141
|
+
//# sourceMappingURL=AccessInviteTable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AccessInviteTable.js","sourceRoot":"","sources":["../../../src/tables/AccessInviteTable.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,oCAYuB;AACvB,6CAAiC;AACjC,wCAAuC;AACvC,uDAAmE;AACnE,yCAA8C;AAY9C;IAAuC,qCAAmB;IAA1D;QAAA,qEA0CC;QAzCC,UAAI,GAAG,eAAe,CAAC;QACvB,UAAI,GAAgC;YAClC,EAAE,EAAE;gBACF,GAAG,EAAE,eAAe;aACrB;YACD,OAAO,EAAE;gBACP,GAAG,EAAE,eAAe;aACrB;SACF,CAAC;QACF,aAAO,GAAG,IAAA,sBAAiB,EAAe;YACxC,KAAK,EAAE,IAAI,iBAAY,CAAC,OAAO,EAAE;gBAC/B,YAAY,EAAE;oBAAY,sBAAA,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAA;yBAAA;gBAChE,iBAAiB,EAAE,IAAI;aACxB,CAAC;YACF,cAAc,EAAE,IAAI,mBAAc,CAAC,YAAY,CAAC;YAChD,QAAQ,EAAE,IAAI,kBAAa,CAAC,UAAU,EAAE,EAAE,YAAY,EAAE;oBAAY,sBAAA,KAAK,EAAA;yBAAA,EAAE,CAAC;YAC5E,UAAU,EAAE,IAAI,oBAAe,CAAC,aAAa,EAAE,IAAI,qBAAS,EAAE,CAAC,IAAI,EAAE,KAAK,CAAC;YAC3E,UAAU,EAAE,IAAI,mBAAc,CAAC,aAAa,CAAC;YAC7C,QAAQ,EAAE,IAAI,2BAAsB,CAAC,UAAU,EAAE,gBAAgB,CAAC;YAClE,aAAa,EAAE,IAAI,oCAA+B,CAAC,gBAAgB,EAAE,UAAU,EAAE;gBAC/E,cAAc,EAAE,UAAO,SAAuB,EAAE,WAAW;;;;;gCACzD,IAAI,WAAW,EAAE;oCACf,sBAAO;iCACR;gCAIG,qBAAM,IAAA,kBAAa,GAAE,CAAC,KAAK,CAAC,IAAI,mCAAgB,EAAwB,EAAE;wCACxE,WAAW,EAAE,OAAO;wCACpB,SAAS,EAAE,IAAI,mBAAQ,EAAE,CAAC,OAAO,EAAE,CAAC,EAAE;wCACtC,QAAQ,EAAE,SAAS,CAAC,QAAQ,CAAC,GAAG;wCAChC,aAAa,EAAE,SAAS,CAAC,aAAa;qCACvC,CAAC,EAAA;;gCAPA,cAAc,GAClB,CACE,SAKE,CACH,CAAC,MAAM,GAAG,CAAC;gCAEd,IAAI,CAAC,cAAc,EAAE;oCACnB,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;iCAChE;;;;qBACF;aACF,CAAC;SACH,CAAC,CAAC;;IACL,CAAC;IAAD,wBAAC;AAAD,CAAC,AA1CD,CAAuC,UAAK,GA0C3C;AA1CY,8CAAiB"}
|
|
@@ -3,8 +3,10 @@ import { User } from './UserTable';
|
|
|
3
3
|
import { Session } from './SessionTable';
|
|
4
4
|
import { Table } from '@proteinjs/db';
|
|
5
5
|
import { Invite } from './InviteTable';
|
|
6
|
+
import { AccessInvite } from './AccessInviteTable';
|
|
6
7
|
export declare const tables: {
|
|
7
8
|
AccessGrant: Table<AccessGrant>;
|
|
9
|
+
AccessInvite: Table<AccessInvite>;
|
|
8
10
|
Invite: Table<Invite>;
|
|
9
11
|
User: Table<User>;
|
|
10
12
|
Session: Table<Session>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tables.d.ts","sourceRoot":"","sources":["../../../src/tables/tables.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAoB,MAAM,oBAAoB,CAAC;AACnE,OAAO,EAAa,IAAI,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAgB,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,MAAM,EAAe,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"tables.d.ts","sourceRoot":"","sources":["../../../src/tables/tables.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAoB,MAAM,oBAAoB,CAAC;AACnE,OAAO,EAAa,IAAI,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAgB,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,MAAM,EAAe,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,YAAY,EAAqB,MAAM,qBAAqB,CAAC;AAEtE,eAAO,MAAM,MAAM;;;;;;CAMlB,CAAC"}
|
|
@@ -5,8 +5,10 @@ var AccessGrantTable_1 = require("./AccessGrantTable");
|
|
|
5
5
|
var UserTable_1 = require("./UserTable");
|
|
6
6
|
var SessionTable_1 = require("./SessionTable");
|
|
7
7
|
var InviteTable_1 = require("./InviteTable");
|
|
8
|
+
var AccessInviteTable_1 = require("./AccessInviteTable");
|
|
8
9
|
exports.tables = {
|
|
9
10
|
AccessGrant: new AccessGrantTable_1.AccessGrantTable(),
|
|
11
|
+
AccessInvite: new AccessInviteTable_1.AccessInviteTable(),
|
|
10
12
|
Invite: new InviteTable_1.InviteTable(),
|
|
11
13
|
User: new UserTable_1.UserTable(),
|
|
12
14
|
Session: new SessionTable_1.SessionTable(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tables.js","sourceRoot":"","sources":["../../../src/tables/tables.ts"],"names":[],"mappings":";;;AAAA,uDAAmE;AACnE,yCAA8C;AAC9C,+CAAuD;AAEvD,6CAAoD;
|
|
1
|
+
{"version":3,"file":"tables.js","sourceRoot":"","sources":["../../../src/tables/tables.ts"],"names":[],"mappings":";;;AAAA,uDAAmE;AACnE,yCAA8C;AAC9C,+CAAuD;AAEvD,6CAAoD;AACpD,yDAAsE;AAEzD,QAAA,MAAM,GAAG;IACpB,WAAW,EAAE,IAAI,mCAAgB,EAAwB;IACzD,YAAY,EAAE,IAAI,qCAAiB,EAAyB;IAC5D,MAAM,EAAE,IAAI,yBAAW,EAAmB;IAC1C,IAAI,EAAE,IAAI,qBAAS,EAAiB;IACpC,OAAO,EAAE,IAAI,2BAAY,EAAoB;CAC9C,CAAC"}
|
package/generated/index.ts
CHANGED
|
@@ -7,33 +7,32 @@ import '@proteinjs/service';
|
|
|
7
7
|
import '@proteinjs/user-auth';
|
|
8
8
|
import 'moment';
|
|
9
9
|
|
|
10
|
-
|
|
11
10
|
/** Generate Source Graph */
|
|
12
11
|
|
|
13
|
-
const sourceGraph = "{\"options\":{\"directed\":true,\"multigraph\":false,\"compound\":false},\"nodes\":[{\"v\":\"@proteinjs/user/ScopedRecord\",\"value\":{\"packageName\":\"@proteinjs/user\",\"name\":\"ScopedRecord\",\"filePath\":\"/Users/mauricio/dev/n3xa-dev/n3xa/packages/proteinjs/packages/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/SharedRecord\",\"value\":{\"packageName\":\"@proteinjs/user\",\"name\":\"SharedRecord\",\"filePath\":\"/Users/mauricio/dev/n3xa-dev/n3xa/packages/proteinjs/packages/user/packages/user/src/SharedRecord.ts\",\"qualifiedName\":\"@proteinjs/user/SharedRecord\",\"properties\":[{\"name\":\"permissionSource\",\"type\":{\"packageName\":\"\",\"name\":\"Reference<T>\",\"filePath\":null,\"qualifiedName\":\"/Reference<T>\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"permissionSourceTable\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"}],\"methods\":[],\"typeParameters\":[\"/T extends SharedRecord = any\"],\"directParents\":[{\"packageName\":\"@proteinjs/db\",\"name\":\"Record\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db/Record\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParents\":[]}],\"sourceType\":3}},{\"v\":\"@proteinjs/user/UserRepo\",\"value\":{\"packageName\":\"@proteinjs/user\",\"name\":\"UserRepo\",\"filePath\":\"/Users/mauricio/dev/n3xa-dev/n3xa/packages/proteinjs/packages/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\":\"/Pick\"},{\"v\":\"@proteinjs/user/SignupService\",\"value\":{\"packageName\":\"@proteinjs/user\",\"name\":\"SignupService\",\"filePath\":\"/Users/mauricio/dev/n3xa-dev/n3xa/packages/proteinjs/packages/user/packages/user/src/services/SignupService.ts\",\"qualifiedName\":\"@proteinjs/user/SignupService\",\"properties\":[],\"methods\":[{\"name\":\"createUser\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<void>\",\"filePath\":null,\"qualifiedName\":\"/Promise<void>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":true,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"user\",\"type\":{\"packageName\":\"@proteinjs/user\",\"name\":\"UserSignup\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/user/UserSignup\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"token\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"sendInvite\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<SendInviteResponse>\",\"filePath\":null,\"qualifiedName\":\"/Promise<SendInviteResponse>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":true,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"email\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"revokeInvite\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<void>\",\"filePath\":null,\"qualifiedName\":\"/Promise<void>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":true,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"email\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"initializeSignup\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<InitializeSignupResponse>\",\"filePath\":null,\"qualifiedName\":\"/Promise<InitializeSignupResponse>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":true,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"inviteToken\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}}]}],\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/service\",\"name\":\"Service\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/service/Service\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParents\":[]}],\"sourceType\":3}},{\"v\":\"@proteinjs/service/Service\"},{\"v\":\"@proteinjs/user/UpdateUserInfoService\",\"value\":{\"packageName\":\"@proteinjs/user\",\"name\":\"UpdateUserInfoService\",\"filePath\":\"/Users/mauricio/dev/n3xa-dev/n3xa/packages/proteinjs/packages/user/packages/user/src/services/UpdateUserInfoService.ts\",\"qualifiedName\":\"@proteinjs/user/UpdateUserInfoService\",\"properties\":[],\"methods\":[{\"name\":\"updateName\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<void>\",\"filePath\":null,\"qualifiedName\":\"/Promise<void>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":true,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"name\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"updatePassword\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<UpdatePasswordResponse>\",\"filePath\":null,\"qualifiedName\":\"/Promise<UpdatePasswordResponse>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":true,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"currentPassword\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"newPassword\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}}]}],\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/service\",\"name\":\"Service\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/service/Service\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParents\":[]}],\"sourceType\":3}},{\"v\":\"@proteinjs/user/AccessGrant\",\"value\":{\"packageName\":\"@proteinjs/user\",\"name\":\"AccessGrant\",\"filePath\":\"/Users/mauricio/dev/n3xa-dev/n3xa/packages/proteinjs/packages/user/packages/user/src/tables/AccessGrantTable.ts\",\"qualifiedName\":\"@proteinjs/user/AccessGrant\",\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/db\",\"name\":\"Record\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db/Record\",\"typeParameters\":[],\"directParents\":null},{\"packageName\":\"@proteinjs/user\",\"name\":\"{\\n principal: Reference<any>;\\n resource: Reference<any>;\\n resourceTable?: Table<any>['name'];\\n accessLevel: 'read' | 'write' | 'admin';\\n}\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/user/{\\n principal: Reference<any>;\\n resource: Reference<any>;\\n resourceTable?: Table<any>['name'];\\n accessLevel: 'read' | 'write' | 'admin';\\n}\",\"typeParameters\":[],\"directParents\":null}],\"sourceType\":1}},{\"v\":\"@proteinjs/user/AccessGrantTable\",\"value\":{\"packageName\":\"@proteinjs/user\",\"name\":\"AccessGrantTable\",\"filePath\":\"/Users/mauricio/dev/n3xa-dev/n3xa/packages/proteinjs/packages/user/packages/user/src/tables/AccessGrantTable.ts\",\"qualifiedName\":\"@proteinjs/user/AccessGrantTable\",\"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/AccessGrant\"],\"directParentInterfaces\":[],\"directParentClasses\":[]}],\"sourceType\":2}},{\"v\":\"@proteinjs/db/Table\"},{\"v\":\"@proteinjs/user/Invite\",\"value\":{\"packageName\":\"@proteinjs/user\",\"name\":\"Invite\",\"filePath\":\"/Users/mauricio/dev/n3xa-dev/n3xa/packages/proteinjs/packages/user/packages/user/src/tables/InviteTable.ts\",\"qualifiedName\":\"@proteinjs/user/Invite\",\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/db\",\"name\":\"Record\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db/Record\",\"typeParameters\":[],\"directParents\":null},{\"packageName\":\"@proteinjs/user\",\"name\":\"{\\n email: string;\\n token: string | null;\\n tokenExpiresAt: Moment | null;\\n invitedBy: string;\\n}\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/user/{\\n email: string;\\n token: string | null;\\n tokenExpiresAt: Moment | null;\\n invitedBy: string;\\n}\",\"typeParameters\":[],\"directParents\":null}],\"sourceType\":1}},{\"v\":\"@proteinjs/user/InviteTable\",\"value\":{\"packageName\":\"@proteinjs/user\",\"name\":\"InviteTable\",\"filePath\":\"/Users/mauricio/dev/n3xa-dev/n3xa/packages/proteinjs/packages/user/packages/user/src/tables/InviteTable.ts\",\"qualifiedName\":\"@proteinjs/user/InviteTable\",\"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/Invite\"],\"directParentInterfaces\":[],\"directParentClasses\":[]}],\"sourceType\":2}},{\"v\":\"@proteinjs/user/Session\",\"value\":{\"packageName\":\"@proteinjs/user\",\"name\":\"Session\",\"filePath\":\"/Users/mauricio/dev/n3xa-dev/n3xa/packages/proteinjs/packages/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\":\"/Users/mauricio/dev/n3xa-dev/n3xa/packages/proteinjs/packages/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/user/User\",\"value\":{\"packageName\":\"@proteinjs/user\",\"name\":\"User\",\"filePath\":\"/Users/mauricio/dev/n3xa-dev/n3xa/packages/proteinjs/packages/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 passwordResetToken?: string | null;\\n passwordResetTokenExpiration?: Moment | null;\\n emailVerified: boolean;\\n roles: string;\\n invitedBy?: string | null;\\n}\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/user/{\\n name: string;\\n email: string;\\n password: string;\\n passwordResetToken?: string | null;\\n passwordResetTokenExpiration?: Moment | null;\\n emailVerified: boolean;\\n roles: string;\\n invitedBy?: string | null;\\n}\",\"typeParameters\":[],\"directParents\":null}],\"sourceType\":1}},{\"v\":\"@proteinjs/user/UserTable\",\"value\":{\"packageName\":\"@proteinjs/user\",\"name\":\"UserTable\",\"filePath\":\"/Users/mauricio/dev/n3xa-dev/n3xa/packages/proteinjs/packages/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/SharedRecord\",\"w\":\"@proteinjs/db/Record\",\"value\":\"extends interface\"},{\"v\":\"@proteinjs/user/UserRepo\",\"w\":\"@proteinjs/user-auth/AuthenticatedUserRepo\",\"value\":\"implements interface\"},{\"v\":\"@proteinjs/user/SignupService\",\"w\":\"@proteinjs/service/Service\",\"value\":\"extends interface\"},{\"v\":\"@proteinjs/user/UpdateUserInfoService\",\"w\":\"@proteinjs/service/Service\",\"value\":\"extends interface\"},{\"v\":\"@proteinjs/user/AccessGrant\",\"w\":\"@proteinjs/db/Record\",\"value\":\"extends type\"},{\"v\":\"@proteinjs/user/AccessGrantTable\",\"w\":\"@proteinjs/db/Table\",\"value\":\"extends class\"},{\"v\":\"@proteinjs/user/Invite\",\"w\":\"@proteinjs/db/Record\",\"value\":\"extends type\"},{\"v\":\"@proteinjs/user/InviteTable\",\"w\":\"@proteinjs/db/Table\",\"value\":\"extends class\"},{\"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\"}]}";
|
|
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/SharedRecord","value":{"packageName":"@proteinjs/user","name":"SharedRecord","filePath":"/home/runner/work/user/user/packages/user/src/SharedRecord.ts","qualifiedName":"@proteinjs/user/SharedRecord","properties":[{"name":"permissionSource","type":{"packageName":"","name":"Reference<T>","filePath":null,"qualifiedName":"/Reference<T>","typeParameters":null,"directParents":null},"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public"},{"name":"permissionSourceTable","type":{"packageName":"","name":"string","filePath":null,"qualifiedName":"/string","typeParameters":null,"directParents":null},"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public"}],"methods":[],"typeParameters":["/T extends SharedRecord = any"],"directParents":[{"packageName":"@proteinjs/db","name":"Record","filePath":null,"qualifiedName":"@proteinjs/db/Record","properties":[],"methods":[],"typeParameters":[],"directParents":[]}],"sourceType":3}},{"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/AccessInviteService","value":{"packageName":"@proteinjs/user","name":"AccessInviteService","filePath":"/home/runner/work/user/user/packages/user/src/services/AccessInviteService.ts","qualifiedName":"@proteinjs/user/AccessInviteService","properties":[],"methods":[{"name":"createAccessInvite","returnType":{"packageName":"","name":"Promise<CreateAccessInviteResponse>","filePath":null,"qualifiedName":"/Promise<CreateAccessInviteResponse>","typeParameters":null,"directParents":null},"isAsync":false,"isOptional":false,"isAbstract":true,"isStatic":false,"visibility":"public","parameters":[{"name":"params","type":{"packageName":"@proteinjs/user","name":"CreateAccessInviteParams","filePath":null,"qualifiedName":"@proteinjs/user/CreateAccessInviteParams","typeParameters":null,"directParents":null}}]},{"name":"acceptAccessInvite","returnType":{"packageName":"","name":"Promise<T | undefined>","filePath":null,"qualifiedName":"/Promise<T | undefined>","typeParameters":null,"directParents":null},"isAsync":false,"isOptional":false,"isAbstract":true,"isStatic":false,"visibility":"public","parameters":[{"name":"token","type":{"packageName":"","name":"string","filePath":null,"qualifiedName":"/string","typeParameters":null,"directParents":null}}]}],"typeParameters":["/T extends Record"],"directParents":[{"packageName":"@proteinjs/service","name":"Service","filePath":null,"qualifiedName":"@proteinjs/service/Service","properties":[],"methods":[],"typeParameters":[],"directParents":[]}],"sourceType":3}},{"v":"@proteinjs/service/Service"},{"v":"/Pick"},{"v":"@proteinjs/user/SignupService","value":{"packageName":"@proteinjs/user","name":"SignupService","filePath":"/home/runner/work/user/user/packages/user/src/services/SignupService.ts","qualifiedName":"@proteinjs/user/SignupService","properties":[],"methods":[{"name":"createUser","returnType":{"packageName":"","name":"Promise<void>","filePath":null,"qualifiedName":"/Promise<void>","typeParameters":null,"directParents":null},"isAsync":false,"isOptional":false,"isAbstract":true,"isStatic":false,"visibility":"public","parameters":[{"name":"user","type":{"packageName":"@proteinjs/user","name":"UserSignup","filePath":null,"qualifiedName":"@proteinjs/user/UserSignup","typeParameters":null,"directParents":null}},{"name":"token","type":{"packageName":"","name":"string","filePath":null,"qualifiedName":"/string","typeParameters":null,"directParents":null}}]},{"name":"sendInvite","returnType":{"packageName":"","name":"Promise<SendInviteResponse>","filePath":null,"qualifiedName":"/Promise<SendInviteResponse>","typeParameters":null,"directParents":null},"isAsync":false,"isOptional":false,"isAbstract":true,"isStatic":false,"visibility":"public","parameters":[{"name":"email","type":{"packageName":"","name":"string","filePath":null,"qualifiedName":"/string","typeParameters":null,"directParents":null}}]},{"name":"revokeInvite","returnType":{"packageName":"","name":"Promise<void>","filePath":null,"qualifiedName":"/Promise<void>","typeParameters":null,"directParents":null},"isAsync":false,"isOptional":false,"isAbstract":true,"isStatic":false,"visibility":"public","parameters":[{"name":"email","type":{"packageName":"","name":"string","filePath":null,"qualifiedName":"/string","typeParameters":null,"directParents":null}}]},{"name":"initializeSignup","returnType":{"packageName":"","name":"Promise<InitializeSignupResponse>","filePath":null,"qualifiedName":"/Promise<InitializeSignupResponse>","typeParameters":null,"directParents":null},"isAsync":false,"isOptional":false,"isAbstract":true,"isStatic":false,"visibility":"public","parameters":[{"name":"inviteToken","type":{"packageName":"","name":"string","filePath":null,"qualifiedName":"/string","typeParameters":null,"directParents":null}}]}],"typeParameters":[],"directParents":[{"packageName":"@proteinjs/service","name":"Service","filePath":null,"qualifiedName":"@proteinjs/service/Service","properties":[],"methods":[],"typeParameters":[],"directParents":[]}],"sourceType":3}},{"v":"@proteinjs/user/UpdateUserInfoService","value":{"packageName":"@proteinjs/user","name":"UpdateUserInfoService","filePath":"/home/runner/work/user/user/packages/user/src/services/UpdateUserInfoService.ts","qualifiedName":"@proteinjs/user/UpdateUserInfoService","properties":[],"methods":[{"name":"updateName","returnType":{"packageName":"","name":"Promise<void>","filePath":null,"qualifiedName":"/Promise<void>","typeParameters":null,"directParents":null},"isAsync":false,"isOptional":false,"isAbstract":true,"isStatic":false,"visibility":"public","parameters":[{"name":"name","type":{"packageName":"","name":"string","filePath":null,"qualifiedName":"/string","typeParameters":null,"directParents":null}}]},{"name":"updatePassword","returnType":{"packageName":"","name":"Promise<UpdatePasswordResponse>","filePath":null,"qualifiedName":"/Promise<UpdatePasswordResponse>","typeParameters":null,"directParents":null},"isAsync":false,"isOptional":false,"isAbstract":true,"isStatic":false,"visibility":"public","parameters":[{"name":"currentPassword","type":{"packageName":"","name":"string","filePath":null,"qualifiedName":"/string","typeParameters":null,"directParents":null}},{"name":"newPassword","type":{"packageName":"","name":"string","filePath":null,"qualifiedName":"/string","typeParameters":null,"directParents":null}}]}],"typeParameters":[],"directParents":[{"packageName":"@proteinjs/service","name":"Service","filePath":null,"qualifiedName":"@proteinjs/service/Service","properties":[],"methods":[],"typeParameters":[],"directParents":[]}],"sourceType":3}},{"v":"@proteinjs/user/AccessGrant","value":{"packageName":"@proteinjs/user","name":"AccessGrant","filePath":"/home/runner/work/user/user/packages/user/src/tables/AccessGrantTable.ts","qualifiedName":"@proteinjs/user/AccessGrant","typeParameters":[],"directParents":[{"packageName":"@proteinjs/db","name":"Record","filePath":null,"qualifiedName":"@proteinjs/db/Record","typeParameters":[],"directParents":null},{"packageName":"@proteinjs/user","name":"{\\n principal: Reference<any>;\\n resource: Reference<any>;\\n resourceTable?: Table<any>[\'name\'];\\n accessLevel: \'read\' | \'write\' | \'admin\';\\n}","filePath":null,"qualifiedName":"@proteinjs/user/{\\n principal: Reference<any>;\\n resource: Reference<any>;\\n resourceTable?: Table<any>[\'name\'];\\n accessLevel: \'read\' | \'write\' | \'admin\';\\n}","typeParameters":[],"directParents":null}],"sourceType":1}},{"v":"@proteinjs/user/AccessGrantTable","value":{"packageName":"@proteinjs/user","name":"AccessGrantTable","filePath":"/home/runner/work/user/user/packages/user/src/tables/AccessGrantTable.ts","qualifiedName":"@proteinjs/user/AccessGrantTable","isAbstract":false,"isStatic":false,"visibility":"public","properties":[{"name":"name","type":null,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public"},{"name":"auth","type":{"packageName":"","name":"Table<AccessGrant>[\'auth\']","filePath":null,"qualifiedName":"/Table<AccessGrant>[\'auth\']","typeParameters":null,"directParents":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/AccessGrant"],"directParentInterfaces":[],"directParentClasses":[]}],"sourceType":2}},{"v":"@proteinjs/db/Table"},{"v":"@proteinjs/user/AccessInvite","value":{"packageName":"@proteinjs/user","name":"AccessInvite","filePath":"/home/runner/work/user/user/packages/user/src/tables/AccessInviteTable.ts","qualifiedName":"@proteinjs/user/AccessInvite","typeParameters":["/T extends Record = any"],"directParents":[{"packageName":"@proteinjs/db","name":"Record","filePath":null,"qualifiedName":"@proteinjs/db/Record","typeParameters":[],"directParents":null},{"packageName":"@proteinjs/user","name":"{\\n token?: string;\\n tokenExpiresAt: Moment;\\n resource: Reference<T>;\\n resourceTable: string;\\n accepted?: boolean;\\n acceptedBy?: Reference<User>;\\n acceptedAt?: Moment;\\n}","filePath":null,"qualifiedName":"@proteinjs/user/{\\n token?: string;\\n tokenExpiresAt: Moment;\\n resource: Reference<T>;\\n resourceTable: string;\\n accepted?: boolean;\\n acceptedBy?: Reference<User>;\\n acceptedAt?: Moment;\\n}","typeParameters":[],"directParents":null}],"sourceType":1}},{"v":"@proteinjs/user/AccessInviteTable","value":{"packageName":"@proteinjs/user","name":"AccessInviteTable","filePath":"/home/runner/work/user/user/packages/user/src/tables/AccessInviteTable.ts","qualifiedName":"@proteinjs/user/AccessInviteTable","isAbstract":false,"isStatic":false,"visibility":"public","properties":[{"name":"name","type":null,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public"},{"name":"auth","type":{"packageName":"","name":"Table<AccessInvite>[\'auth\']","filePath":null,"qualifiedName":"/Table<AccessInvite>[\'auth\']","typeParameters":null,"directParents":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/AccessInvite"],"directParentInterfaces":[],"directParentClasses":[]}],"sourceType":2}},{"v":"@proteinjs/user/Invite","value":{"packageName":"@proteinjs/user","name":"Invite","filePath":"/home/runner/work/user/user/packages/user/src/tables/InviteTable.ts","qualifiedName":"@proteinjs/user/Invite","typeParameters":[],"directParents":[{"packageName":"@proteinjs/db","name":"Record","filePath":null,"qualifiedName":"@proteinjs/db/Record","typeParameters":[],"directParents":null},{"packageName":"@proteinjs/user","name":"{\\n email: string;\\n token: string | null;\\n tokenExpiresAt: Moment | null;\\n invitedBy: string;\\n}","filePath":null,"qualifiedName":"@proteinjs/user/{\\n email: string;\\n token: string | null;\\n tokenExpiresAt: Moment | null;\\n invitedBy: string;\\n}","typeParameters":[],"directParents":null}],"sourceType":1}},{"v":"@proteinjs/user/InviteTable","value":{"packageName":"@proteinjs/user","name":"InviteTable","filePath":"/home/runner/work/user/user/packages/user/src/tables/InviteTable.ts","qualifiedName":"@proteinjs/user/InviteTable","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/Invite"],"directParentInterfaces":[],"directParentClasses":[]}],"sourceType":2}},{"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/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 passwordResetToken?: string | null;\\n passwordResetTokenExpiration?: Moment | null;\\n emailVerified: boolean;\\n roles: string;\\n invitedBy?: string | null;\\n}","filePath":null,"qualifiedName":"@proteinjs/user/{\\n name: string;\\n email: string;\\n password: string;\\n passwordResetToken?: string | null;\\n passwordResetTokenExpiration?: Moment | null;\\n emailVerified: boolean;\\n roles: string;\\n invitedBy?: string | null;\\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/SharedRecord","w":"@proteinjs/db/Record","value":"extends interface"},{"v":"@proteinjs/user/UserRepo","w":"@proteinjs/user-auth/AuthenticatedUserRepo","value":"implements interface"},{"v":"@proteinjs/user/AccessInviteService","w":"@proteinjs/service/Service","value":"extends interface"},{"v":"@proteinjs/user/SignupService","w":"@proteinjs/service/Service","value":"extends interface"},{"v":"@proteinjs/user/UpdateUserInfoService","w":"@proteinjs/service/Service","value":"extends interface"},{"v":"@proteinjs/user/AccessGrant","w":"@proteinjs/db/Record","value":"extends type"},{"v":"@proteinjs/user/AccessGrantTable","w":"@proteinjs/db/Table","value":"extends class"},{"v":"@proteinjs/user/AccessInvite","w":"@proteinjs/db/Record","value":"extends type"},{"v":"@proteinjs/user/AccessInviteTable","w":"@proteinjs/db/Table","value":"extends class"},{"v":"@proteinjs/user/Invite","w":"@proteinjs/db/Record","value":"extends type"},{"v":"@proteinjs/user/InviteTable","w":"@proteinjs/db/Table","value":"extends class"},{"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
|
|
|
18
17
|
import { UserRepo } from '../src/UserRepo';
|
|
19
18
|
import { AccessGrantTable } from '../src/tables/AccessGrantTable';
|
|
19
|
+
import { AccessInviteTable } from '../src/tables/AccessInviteTable';
|
|
20
20
|
import { InviteTable } from '../src/tables/InviteTable';
|
|
21
21
|
import { SessionTable } from '../src/tables/SessionTable';
|
|
22
22
|
import { UserTable } from '../src/tables/UserTable';
|
|
23
23
|
|
|
24
24
|
const sourceLinks = {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
'@proteinjs/user/UserRepo': UserRepo,
|
|
26
|
+
'@proteinjs/user/AccessGrantTable': AccessGrantTable,
|
|
27
|
+
'@proteinjs/user/AccessInviteTable': AccessInviteTable,
|
|
28
|
+
'@proteinjs/user/InviteTable': InviteTable,
|
|
29
|
+
'@proteinjs/user/SessionTable': SessionTable,
|
|
30
|
+
'@proteinjs/user/UserTable': UserTable,
|
|
30
31
|
};
|
|
31
32
|
|
|
32
|
-
|
|
33
33
|
/** Load Source Graph and Links */
|
|
34
34
|
|
|
35
35
|
import { SourceRepository } from '@proteinjs/reflection';
|
|
36
36
|
SourceRepository.merge(sourceGraph, sourceLinks);
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
export * from '../index';
|
|
38
|
+
export * from '../index';
|
package/index.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
export * from './src/services/AccessInviteService';
|
|
1
2
|
export * from './src/services/SignupService';
|
|
2
3
|
export * from './src/services/UpdateUserInfoService';
|
|
3
4
|
|
|
5
|
+
export * from './src/tables/AccessInviteTable';
|
|
4
6
|
export * from './src/tables/InviteTable';
|
|
5
7
|
export * from './src/tables/UserTable';
|
|
6
8
|
export * from './src/tables/SessionTable';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@proteinjs/user",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"description": "User management",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -44,5 +44,6 @@
|
|
|
44
44
|
"typescript": "5.2.2"
|
|
45
45
|
},
|
|
46
46
|
"main": "./dist/generated/index.js",
|
|
47
|
-
"types": "./dist/generated/index.d.ts"
|
|
47
|
+
"types": "./dist/generated/index.d.ts",
|
|
48
|
+
"gitHead": "a215c9abc89b5e1d35270ed3cb35091ff8ed4fb0"
|
|
48
49
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { Record } from '@proteinjs/db';
|
|
2
|
+
import type { Moment } from 'moment';
|
|
3
|
+
|
|
4
|
+
import { Service, serviceFactory } from '@proteinjs/service';
|
|
5
|
+
|
|
6
|
+
export const getAccessInviteService = <T extends Record>() =>
|
|
7
|
+
serviceFactory<AccessInviteService<T>>('@proteinjs/user/AccessInviteService');
|
|
8
|
+
|
|
9
|
+
export type CreateAccessInviteParams = {
|
|
10
|
+
resourceTable: string;
|
|
11
|
+
resourceId: string;
|
|
12
|
+
expiresInDays?: number;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export type CreateAccessInviteResponse = {
|
|
16
|
+
token: string;
|
|
17
|
+
tokenExpiresAt: Moment;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export interface AccessInviteService<T extends Record> extends Service {
|
|
21
|
+
/**
|
|
22
|
+
* Creates an access invite for a resource. Caller must have admin access to the resource.
|
|
23
|
+
* Returns a token and expiry which can be embedded as a query parameter in a shareable URL.
|
|
24
|
+
*/
|
|
25
|
+
createAccessInvite(params: CreateAccessInviteParams): Promise<CreateAccessInviteResponse>;
|
|
26
|
+
/**
|
|
27
|
+
* Accepts an access invite using the provided token. The current authenticated user will be granted access.
|
|
28
|
+
*/
|
|
29
|
+
acceptAccessInvite(token: string): Promise<T | undefined>;
|
|
30
|
+
}
|
|
@@ -22,6 +22,14 @@ export type AccessGrant = Record & {
|
|
|
22
22
|
|
|
23
23
|
export class AccessGrantTable extends Table<AccessGrant> {
|
|
24
24
|
name = 'access_grant';
|
|
25
|
+
auth: Table<AccessGrant>['auth'] = {
|
|
26
|
+
db: {
|
|
27
|
+
all: 'authenticated',
|
|
28
|
+
},
|
|
29
|
+
service: {
|
|
30
|
+
all: 'authenticated',
|
|
31
|
+
},
|
|
32
|
+
};
|
|
25
33
|
columns = withRecordColumns<AccessGrant>({
|
|
26
34
|
accessLevel: new StringColumn('access_level'),
|
|
27
35
|
principal: new ReferenceColumn<User>('principal', UserTable.name, false),
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { Moment } from 'moment';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
BooleanColumn,
|
|
5
|
+
DateTimeColumn,
|
|
6
|
+
DynamicReferenceColumn,
|
|
7
|
+
DynamicReferenceTableNameColumn,
|
|
8
|
+
getDbAsSystem,
|
|
9
|
+
Record,
|
|
10
|
+
Reference,
|
|
11
|
+
ReferenceColumn,
|
|
12
|
+
StringColumn,
|
|
13
|
+
Table,
|
|
14
|
+
withRecordColumns,
|
|
15
|
+
} from '@proteinjs/db';
|
|
16
|
+
import * as crypto from 'crypto';
|
|
17
|
+
import { UserRepo } from '../UserRepo';
|
|
18
|
+
import { AccessGrant, AccessGrantTable } from './AccessGrantTable';
|
|
19
|
+
import { User, UserTable } from './UserTable';
|
|
20
|
+
|
|
21
|
+
export type AccessInvite<T extends Record = any> = Record & {
|
|
22
|
+
token?: string;
|
|
23
|
+
tokenExpiresAt: Moment;
|
|
24
|
+
resource: Reference<T>;
|
|
25
|
+
resourceTable: string;
|
|
26
|
+
accepted?: boolean;
|
|
27
|
+
acceptedBy?: Reference<User>;
|
|
28
|
+
acceptedAt?: Moment;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export class AccessInviteTable extends Table<AccessInvite> {
|
|
32
|
+
name = 'access_invite';
|
|
33
|
+
auth: Table<AccessInvite>['auth'] = {
|
|
34
|
+
db: {
|
|
35
|
+
all: 'authenticated',
|
|
36
|
+
},
|
|
37
|
+
service: {
|
|
38
|
+
all: 'authenticated',
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
columns = withRecordColumns<AccessInvite>({
|
|
42
|
+
token: new StringColumn('token', {
|
|
43
|
+
defaultValue: async () => crypto.randomBytes(32).toString('hex'),
|
|
44
|
+
forceDefaultValue: true,
|
|
45
|
+
}),
|
|
46
|
+
tokenExpiresAt: new DateTimeColumn('expires_at'),
|
|
47
|
+
accepted: new BooleanColumn('accepted', { defaultValue: async () => false }),
|
|
48
|
+
acceptedBy: new ReferenceColumn('accepted_by', new UserTable().name, false),
|
|
49
|
+
acceptedAt: new DateTimeColumn('accepted_at'),
|
|
50
|
+
resource: new DynamicReferenceColumn('resource', 'resource_table'),
|
|
51
|
+
resourceTable: new DynamicReferenceTableNameColumn('resource_table', 'resource', {
|
|
52
|
+
onBeforeInsert: async (insertObj: AccessInvite, runAsSystem) => {
|
|
53
|
+
if (runAsSystem) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const hasAdminAccess =
|
|
58
|
+
(
|
|
59
|
+
await getDbAsSystem().query(new AccessGrantTable() as Table<AccessGrant>, {
|
|
60
|
+
accessLevel: 'admin',
|
|
61
|
+
principal: new UserRepo().getUser().id,
|
|
62
|
+
resource: insertObj.resource._id,
|
|
63
|
+
resourceTable: insertObj.resourceTable,
|
|
64
|
+
})
|
|
65
|
+
).length > 0;
|
|
66
|
+
|
|
67
|
+
if (!hasAdminAccess) {
|
|
68
|
+
throw new Error(`User does not have admin access to resource`);
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
}),
|
|
72
|
+
});
|
|
73
|
+
}
|
package/src/tables/tables.ts
CHANGED
|
@@ -3,9 +3,11 @@ import { UserTable, User } from './UserTable';
|
|
|
3
3
|
import { SessionTable, Session } from './SessionTable';
|
|
4
4
|
import { Table } from '@proteinjs/db';
|
|
5
5
|
import { Invite, InviteTable } from './InviteTable';
|
|
6
|
+
import { AccessInvite, AccessInviteTable } from './AccessInviteTable';
|
|
6
7
|
|
|
7
8
|
export const tables = {
|
|
8
9
|
AccessGrant: new AccessGrantTable() as Table<AccessGrant>,
|
|
10
|
+
AccessInvite: new AccessInviteTable() as Table<AccessInvite>,
|
|
9
11
|
Invite: new InviteTable() as Table<Invite>,
|
|
10
12
|
User: new UserTable() as Table<User>,
|
|
11
13
|
Session: new SessionTable() as Table<Session>,
|