@proteinjs/user 1.6.0 → 1.7.0
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/dist/generated/index.d.ts.map +1 -1
- package/dist/generated/index.js +5 -1
- package/dist/generated/index.js.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/src/RolesCatalog.d.ts +37 -0
- package/dist/src/RolesCatalog.d.ts.map +1 -0
- package/dist/src/RolesCatalog.js +51 -0
- package/dist/src/RolesCatalog.js.map +1 -0
- package/dist/src/UserRepo.d.ts.map +1 -1
- package/dist/src/UserRepo.js +4 -1
- package/dist/src/UserRepo.js.map +1 -1
- package/dist/src/permissions.d.ts +18 -0
- package/dist/src/permissions.d.ts.map +1 -0
- package/dist/src/permissions.js +21 -0
- package/dist/src/permissions.js.map +1 -0
- package/dist/src/services/RolesService.d.ts +15 -0
- package/dist/src/services/RolesService.d.ts.map +1 -0
- package/dist/src/services/RolesService.js +6 -0
- package/dist/src/services/RolesService.js.map +1 -0
- package/dist/src/tables/InviteTable.d.ts +9 -0
- package/dist/src/tables/InviteTable.d.ts.map +1 -1
- package/dist/src/tables/InviteTable.js +19 -0
- package/dist/src/tables/InviteTable.js.map +1 -1
- package/dist/src/tables/RoleGrantEventTable.d.ts +30 -0
- package/dist/src/tables/RoleGrantEventTable.d.ts.map +1 -0
- package/dist/src/tables/RoleGrantEventTable.js +45 -0
- package/dist/src/tables/RoleGrantEventTable.js.map +1 -0
- package/dist/src/tables/SessionTable.d.ts +7 -0
- package/dist/src/tables/SessionTable.d.ts.map +1 -1
- package/dist/src/tables/SessionTable.js +15 -0
- package/dist/src/tables/SessionTable.js.map +1 -1
- package/dist/src/tables/UserTable.d.ts +12 -2
- package/dist/src/tables/UserTable.d.ts.map +1 -1
- package/dist/src/tables/UserTable.js +30 -1
- package/dist/src/tables/UserTable.js.map +1 -1
- 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/dist/test/RolesCatalog.test.d.ts +2 -0
- package/dist/test/RolesCatalog.test.d.ts.map +1 -0
- package/dist/test/RolesCatalog.test.js +49 -0
- package/dist/test/RolesCatalog.test.js.map +1 -0
- package/dist/test/ScopedRecord.test.d.ts +1 -0
- package/dist/test/ScopedRecord.test.d.ts.map +1 -1
- package/dist/test/ScopedRecord.test.js +7 -0
- package/dist/test/ScopedRecord.test.js.map +1 -1
- package/dist/test/SharedRecord.test.d.ts +1 -0
- package/dist/test/SharedRecord.test.d.ts.map +1 -1
- package/dist/test/SharedRecord.test.js +13 -3
- package/dist/test/SharedRecord.test.js.map +1 -1
- package/dist/test/sessionTableAuth.test.d.ts +2 -0
- package/dist/test/sessionTableAuth.test.d.ts.map +1 -0
- package/dist/test/sessionTableAuth.test.js +81 -0
- package/dist/test/sessionTableAuth.test.js.map +1 -0
- package/dist/test/tablesAuth.test.d.ts +2 -0
- package/dist/test/tablesAuth.test.d.ts.map +1 -0
- package/dist/test/tablesAuth.test.js +68 -0
- package/dist/test/tablesAuth.test.js.map +1 -0
- package/generated/index.ts +5 -1
- package/index.ts +4 -0
- package/package.json +5 -5
- package/src/RolesCatalog.ts +56 -0
- package/src/UserRepo.ts +3 -1
- package/src/permissions.ts +17 -0
- package/src/services/RolesService.ts +16 -0
- package/src/tables/InviteTable.ts +19 -0
- package/src/tables/RoleGrantEventTable.ts +35 -0
- package/src/tables/SessionTable.ts +15 -0
- package/src/tables/UserTable.ts +33 -3
- package/src/tables/tables.ts +2 -0
- package/test/RolesCatalog.test.ts +54 -0
- package/test/ScopedRecord.test.ts +7 -0
- package/test/SharedRecord.test.ts +13 -3
- package/test/sessionTableAuth.test.ts +88 -0
- package/test/tablesAuth.test.ts +68 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var tables_1 = require("../src/tables/tables");
|
|
4
|
+
var permissions_1 = require("../src/permissions");
|
|
5
|
+
/**
|
|
6
|
+
* The users/roles split lives in these table schemas — invariants worth pinning so a drive-by
|
|
7
|
+
* edit cannot silently reopen a door:
|
|
8
|
+
* - user: 'users' permission covers viewing/managing records, EXCEPT roles — the roles column is
|
|
9
|
+
* service-protected (single write path: the Roles service).
|
|
10
|
+
* - role_grant_event: the audit trail is readable by 'roles' holders and has NO generic write
|
|
11
|
+
* door — an explicit auth block with no write grants is a lock, not an admin default.
|
|
12
|
+
* - session: 'sessions' holders read (a different trust than 'users' — rows carry auth
|
|
13
|
+
* material); writes are system-written, so there is NO generic write door.
|
|
14
|
+
* - invite: 'users' holders read and delete; creating rides SignupService only.
|
|
15
|
+
*/
|
|
16
|
+
describe('user table auth shape', function () {
|
|
17
|
+
it('gates every service door on the users permission', function () {
|
|
18
|
+
var _a;
|
|
19
|
+
expect((_a = tables_1.tables.User.auth) === null || _a === void 0 ? void 0 : _a.service).toEqual({
|
|
20
|
+
query: { permission: permissions_1.USER_PERMISSIONS.users },
|
|
21
|
+
insert: { permission: permissions_1.USER_PERMISSIONS.users },
|
|
22
|
+
update: { permission: permissions_1.USER_PERMISSIONS.users },
|
|
23
|
+
delete: { permission: permissions_1.USER_PERMISSIONS.users },
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
it("gates every db door on the users permission too \u2014 DbService's inner Db re-checks the db api\n as the calling user, so a service-only shape leaves the record surfaces admin-locked\n (live-observed: a users-holder's Users table denied)", function () {
|
|
27
|
+
var _a;
|
|
28
|
+
expect((_a = tables_1.tables.User.auth) === null || _a === void 0 ? void 0 : _a.db).toEqual({
|
|
29
|
+
query: { permission: permissions_1.USER_PERMISSIONS.users },
|
|
30
|
+
insert: { permission: permissions_1.USER_PERMISSIONS.users },
|
|
31
|
+
update: { permission: permissions_1.USER_PERMISSIONS.users },
|
|
32
|
+
delete: { permission: permissions_1.USER_PERMISSIONS.users },
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
it('service-protects the roles column (single write path: the Roles service)', function () {
|
|
36
|
+
var _a;
|
|
37
|
+
expect((_a = tables_1.tables.User.auth) === null || _a === void 0 ? void 0 : _a.serviceProtectedColumns).toEqual(['roles']);
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
describe('role_grant_event table auth shape', function () {
|
|
41
|
+
it('is readable by roles holders and has no generic write door', function () {
|
|
42
|
+
var _a, _b;
|
|
43
|
+
expect((_a = tables_1.tables.RoleGrantEvent.auth) === null || _a === void 0 ? void 0 : _a.db).toEqual({ query: { permission: permissions_1.USER_PERMISSIONS.roles } });
|
|
44
|
+
expect((_b = tables_1.tables.RoleGrantEvent.auth) === null || _b === void 0 ? void 0 : _b.service).toEqual({ query: { permission: permissions_1.USER_PERMISSIONS.roles } });
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
describe('session table auth shape', function () {
|
|
48
|
+
it('is readable by sessions holders and has no generic write door (writes are system-written)', function () {
|
|
49
|
+
var _a, _b;
|
|
50
|
+
expect((_a = tables_1.tables.Session.auth) === null || _a === void 0 ? void 0 : _a.db).toEqual({ query: { permission: permissions_1.USER_PERMISSIONS.sessions } });
|
|
51
|
+
expect((_b = tables_1.tables.Session.auth) === null || _b === void 0 ? void 0 : _b.service).toEqual({ query: { permission: permissions_1.USER_PERMISSIONS.sessions } });
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
describe('invite table auth shape', function () {
|
|
55
|
+
it('grants users-permission reads and deletes only; creation rides SignupService', function () {
|
|
56
|
+
var _a, _b;
|
|
57
|
+
expect((_a = tables_1.tables.Invite.auth) === null || _a === void 0 ? void 0 : _a.service).toEqual({
|
|
58
|
+
query: { permission: permissions_1.USER_PERMISSIONS.users },
|
|
59
|
+
delete: { permission: permissions_1.USER_PERMISSIONS.users },
|
|
60
|
+
});
|
|
61
|
+
// Mirrored on the db api — the record surfaces' inner Db re-checks it (see the user table).
|
|
62
|
+
expect((_b = tables_1.tables.Invite.auth) === null || _b === void 0 ? void 0 : _b.db).toEqual({
|
|
63
|
+
query: { permission: permissions_1.USER_PERMISSIONS.users },
|
|
64
|
+
delete: { permission: permissions_1.USER_PERMISSIONS.users },
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
//# sourceMappingURL=tablesAuth.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tablesAuth.test.js","sourceRoot":"","sources":["../../test/tablesAuth.test.ts"],"names":[],"mappings":";;AAAA,+CAA8C;AAC9C,kDAAsD;AAEtD;;;;;;;;;;GAUG;AAEH,QAAQ,CAAC,uBAAuB,EAAE;IAChC,EAAE,CAAC,kDAAkD,EAAE;;QACrD,MAAM,CAAC,MAAA,eAAM,CAAC,IAAI,CAAC,IAAI,0CAAE,OAAO,CAAC,CAAC,OAAO,CAAC;YACxC,KAAK,EAAE,EAAE,UAAU,EAAE,8BAAgB,CAAC,KAAK,EAAE;YAC7C,MAAM,EAAE,EAAE,UAAU,EAAE,8BAAgB,CAAC,KAAK,EAAE;YAC9C,MAAM,EAAE,EAAE,UAAU,EAAE,8BAAgB,CAAC,KAAK,EAAE;YAC9C,MAAM,EAAE,EAAE,UAAU,EAAE,8BAAgB,CAAC,KAAK,EAAE;SAC/C,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,0PAEsD,EAAE;;QACzD,MAAM,CAAC,MAAA,eAAM,CAAC,IAAI,CAAC,IAAI,0CAAE,EAAE,CAAC,CAAC,OAAO,CAAC;YACnC,KAAK,EAAE,EAAE,UAAU,EAAE,8BAAgB,CAAC,KAAK,EAAE;YAC7C,MAAM,EAAE,EAAE,UAAU,EAAE,8BAAgB,CAAC,KAAK,EAAE;YAC9C,MAAM,EAAE,EAAE,UAAU,EAAE,8BAAgB,CAAC,KAAK,EAAE;YAC9C,MAAM,EAAE,EAAE,UAAU,EAAE,8BAAgB,CAAC,KAAK,EAAE;SAC/C,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,0EAA0E,EAAE;;QAC7E,MAAM,CAAC,MAAA,eAAM,CAAC,IAAI,CAAC,IAAI,0CAAE,uBAAuB,CAAC,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;IACvE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,mCAAmC,EAAE;IAC5C,EAAE,CAAC,4DAA4D,EAAE;;QAC/D,MAAM,CAAC,MAAA,eAAM,CAAC,cAAc,CAAC,IAAI,0CAAE,EAAE,CAAC,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,UAAU,EAAE,8BAAgB,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAClG,MAAM,CAAC,MAAA,eAAM,CAAC,cAAc,CAAC,IAAI,0CAAE,OAAO,CAAC,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,UAAU,EAAE,8BAAgB,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IACzG,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,0BAA0B,EAAE;IACnC,EAAE,CAAC,2FAA2F,EAAE;;QAC9F,MAAM,CAAC,MAAA,eAAM,CAAC,OAAO,CAAC,IAAI,0CAAE,EAAE,CAAC,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,UAAU,EAAE,8BAAgB,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;QAC9F,MAAM,CAAC,MAAA,eAAM,CAAC,OAAO,CAAC,IAAI,0CAAE,OAAO,CAAC,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,UAAU,EAAE,8BAAgB,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;IACrG,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,yBAAyB,EAAE;IAClC,EAAE,CAAC,8EAA8E,EAAE;;QACjF,MAAM,CAAC,MAAA,eAAM,CAAC,MAAM,CAAC,IAAI,0CAAE,OAAO,CAAC,CAAC,OAAO,CAAC;YAC1C,KAAK,EAAE,EAAE,UAAU,EAAE,8BAAgB,CAAC,KAAK,EAAE;YAC7C,MAAM,EAAE,EAAE,UAAU,EAAE,8BAAgB,CAAC,KAAK,EAAE;SAC/C,CAAC,CAAC;QACH,4FAA4F;QAC5F,MAAM,CAAC,MAAA,eAAM,CAAC,MAAM,CAAC,IAAI,0CAAE,EAAE,CAAC,CAAC,OAAO,CAAC;YACrC,KAAK,EAAE,EAAE,UAAU,EAAE,8BAAgB,CAAC,KAAK,EAAE;YAC7C,MAAM,EAAE,EAAE,UAAU,EAAE,8BAAgB,CAAC,KAAK,EAAE;SAC/C,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/generated/index.ts
CHANGED
|
@@ -10,23 +10,27 @@ import 'moment';
|
|
|
10
10
|
|
|
11
11
|
/** Generate Source Graph */
|
|
12
12
|
|
|
13
|
-
const sourceGraph = "{\"options\":{\"directed\":true,\"multigraph\":false,\"compound\":false},\"nodes\":[{\"v\":\"@proteinjs/user/ScopedRecord\",\"value\":{\"packageName\":\"@proteinjs/user\",\"name\":\"ScopedRecord\",\"filePath\":\"/Users/brentbahry/repos/farm/n3xa2/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/brentbahry/repos/farm/n3xa2/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/brentbahry/repos/farm/n3xa2/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\":\"@proteinjs/user/AccessInviteService\",\"value\":{\"packageName\":\"@proteinjs/user\",\"name\":\"AccessInviteService\",\"filePath\":\"/Users/brentbahry/repos/farm/n3xa2/packages/proteinjs/packages/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\":\"/Users/brentbahry/repos/farm/n3xa2/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/user/UpdateUserInfoService\",\"value\":{\"packageName\":\"@proteinjs/user\",\"name\":\"UpdateUserInfoService\",\"filePath\":\"/Users/brentbahry/repos/farm/n3xa2/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/brentbahry/repos/farm/n3xa2/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' | 'owner';\\n}\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/user/{\\n principal: Reference<any>;\\n resource: Reference<any>;\\n resourceTable?: Table<any>['name'];\\n accessLevel: 'read' | 'write' | 'admin' | 'owner';\\n}\",\"typeParameters\":[],\"directParents\":null}],\"sourceType\":1}},{\"v\":\"@proteinjs/user/AccessGrantTable\",\"value\":{\"packageName\":\"@proteinjs/user\",\"name\":\"AccessGrantTable\",\"filePath\":\"/Users/brentbahry/repos/farm/n3xa2/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\":\"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\":\"indexes\",\"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/AccessInvite\",\"value\":{\"packageName\":\"@proteinjs/user\",\"name\":\"AccessInvite\",\"filePath\":\"/Users/brentbahry/repos/farm/n3xa2/packages/proteinjs/packages/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 accessLevel: AccessGrant['accessLevel'];\\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 accessLevel: AccessGrant['accessLevel'];\\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\":\"/Users/brentbahry/repos/farm/n3xa2/packages/proteinjs/packages/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\":\"/Users/brentbahry/repos/farm/n3xa2/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/brentbahry/repos/farm/n3xa2/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/brentbahry/repos/farm/n3xa2/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/brentbahry/repos/farm/n3xa2/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/brentbahry/repos/farm/n3xa2/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/brentbahry/repos/farm/n3xa2/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/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\"}]}";
|
|
13
|
+
const sourceGraph = "{\"options\":{\"directed\":true,\"multigraph\":false,\"compound\":false},\"nodes\":[{\"v\":\"@proteinjs/user/RoleCatalogEntry\",\"value\":{\"packageName\":\"@proteinjs/user\",\"name\":\"RoleCatalogEntry\",\"filePath\":\"/Users/brentbahry/repos/farm/n3xa2/packages/proteinjs/packages/user/packages/user/src/RolesCatalog.ts\",\"qualifiedName\":\"@proteinjs/user/RoleCatalogEntry\",\"properties\":[{\"name\":\"role\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"description\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"breakGlass\",\"type\":{\"packageName\":\"\",\"name\":\"boolean\",\"filePath\":null,\"qualifiedName\":\"/boolean\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":true,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"}],\"methods\":[],\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/reflection\",\"name\":\"Loadable\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/reflection/Loadable\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParents\":[]}],\"sourceType\":3}},{\"v\":\"@proteinjs/reflection/Loadable\"},{\"v\":\"@proteinjs/user/AdminRole\",\"value\":{\"packageName\":\"@proteinjs/user\",\"name\":\"AdminRole\",\"filePath\":\"/Users/brentbahry/repos/farm/n3xa2/packages/proteinjs/packages/user/packages/user/src/RolesCatalog.ts\",\"qualifiedName\":\"@proteinjs/user/AdminRole\",\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"properties\":[{\"name\":\"role\",\"type\":null,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"description\",\"type\":null,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"breakGlass\",\"type\":null,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"}],\"methods\":[],\"typeParameters\":[],\"directParentInterfaces\":[{\"packageName\":\"@proteinjs/user\",\"name\":\"RoleCatalogEntry\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/user/RoleCatalogEntry\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParents\":[]}],\"directParentClasses\":[],\"sourceType\":2}},{\"v\":\"@proteinjs/user/ScopedRecord\",\"value\":{\"packageName\":\"@proteinjs/user\",\"name\":\"ScopedRecord\",\"filePath\":\"/Users/brentbahry/repos/farm/n3xa2/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/brentbahry/repos/farm/n3xa2/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/brentbahry/repos/farm/n3xa2/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\":\"@proteinjs/user/AccessInviteService\",\"value\":{\"packageName\":\"@proteinjs/user\",\"name\":\"AccessInviteService\",\"filePath\":\"/Users/brentbahry/repos/farm/n3xa2/packages/proteinjs/packages/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\":\"@proteinjs/user/RolesService\",\"value\":{\"packageName\":\"@proteinjs/user\",\"name\":\"RolesService\",\"filePath\":\"/Users/brentbahry/repos/farm/n3xa2/packages/proteinjs/packages/user/packages/user/src/services/RolesService.ts\",\"qualifiedName\":\"@proteinjs/user/RolesService\",\"properties\":[],\"methods\":[{\"name\":\"grantRole\",\"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\":\"userId\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"role\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}}]},{\"name\":\"revokeRole\",\"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\":\"userId\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"role\",\"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\":\"/Pick\"},{\"v\":\"@proteinjs/user/SignupService\",\"value\":{\"packageName\":\"@proteinjs/user\",\"name\":\"SignupService\",\"filePath\":\"/Users/brentbahry/repos/farm/n3xa2/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/user/UpdateUserInfoService\",\"value\":{\"packageName\":\"@proteinjs/user\",\"name\":\"UpdateUserInfoService\",\"filePath\":\"/Users/brentbahry/repos/farm/n3xa2/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/brentbahry/repos/farm/n3xa2/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' | 'owner';\\n}\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/user/{\\n principal: Reference<any>;\\n resource: Reference<any>;\\n resourceTable?: Table<any>['name'];\\n accessLevel: 'read' | 'write' | 'admin' | 'owner';\\n}\",\"typeParameters\":[],\"directParents\":null}],\"sourceType\":1}},{\"v\":\"@proteinjs/user/AccessGrantTable\",\"value\":{\"packageName\":\"@proteinjs/user\",\"name\":\"AccessGrantTable\",\"filePath\":\"/Users/brentbahry/repos/farm/n3xa2/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\":\"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\":\"indexes\",\"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/AccessInvite\",\"value\":{\"packageName\":\"@proteinjs/user\",\"name\":\"AccessInvite\",\"filePath\":\"/Users/brentbahry/repos/farm/n3xa2/packages/proteinjs/packages/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 accessLevel: AccessGrant['accessLevel'];\\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 accessLevel: AccessGrant['accessLevel'];\\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\":\"/Users/brentbahry/repos/farm/n3xa2/packages/proteinjs/packages/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\":\"/Users/brentbahry/repos/farm/n3xa2/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/brentbahry/repos/farm/n3xa2/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\":\"auth\",\"type\":{\"packageName\":\"\",\"name\":\"Table<Invite>['auth']\",\"filePath\":null,\"qualifiedName\":\"/Table<Invite>['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/Invite\"],\"directParentInterfaces\":[],\"directParentClasses\":[]}],\"sourceType\":2}},{\"v\":\"@proteinjs/user/RoleGrantEvent\",\"value\":{\"packageName\":\"@proteinjs/user\",\"name\":\"RoleGrantEvent\",\"filePath\":\"/Users/brentbahry/repos/farm/n3xa2/packages/proteinjs/packages/user/packages/user/src/tables/RoleGrantEventTable.ts\",\"qualifiedName\":\"@proteinjs/user/RoleGrantEvent\",\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/db\",\"name\":\"Record\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db/Record\",\"typeParameters\":[],\"directParents\":null},{\"packageName\":\"@proteinjs/user\",\"name\":\"{\\n /** id of the user who made the change */\\n actor: string;\\n /** id of the user whose roles changed */\\n target: string;\\n role: string;\\n action: 'grant' | 'revoke';\\n}\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/user/{\\n /** id of the user who made the change */\\n actor: string;\\n /** id of the user whose roles changed */\\n target: string;\\n role: string;\\n action: 'grant' | 'revoke';\\n}\",\"typeParameters\":[],\"directParents\":null}],\"sourceType\":1}},{\"v\":\"@proteinjs/user/RoleGrantEventTable\",\"value\":{\"packageName\":\"@proteinjs/user\",\"name\":\"RoleGrantEventTable\",\"filePath\":\"/Users/brentbahry/repos/farm/n3xa2/packages/proteinjs/packages/user/packages/user/src/tables/RoleGrantEventTable.ts\",\"qualifiedName\":\"@proteinjs/user/RoleGrantEventTable\",\"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<RoleGrantEvent>['auth']\",\"filePath\":null,\"qualifiedName\":\"/Table<RoleGrantEvent>['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/RoleGrantEvent\"],\"directParentInterfaces\":[],\"directParentClasses\":[]}],\"sourceType\":2}},{\"v\":\"@proteinjs/user/Session\",\"value\":{\"packageName\":\"@proteinjs/user\",\"name\":\"Session\",\"filePath\":\"/Users/brentbahry/repos/farm/n3xa2/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/brentbahry/repos/farm/n3xa2/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\":\"auth\",\"type\":{\"packageName\":\"\",\"name\":\"Table<Session>['auth']\",\"filePath\":null,\"qualifiedName\":\"/Table<Session>['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/Session\"],\"directParentInterfaces\":[],\"directParentClasses\":[]}],\"sourceType\":2}},{\"v\":\"@proteinjs/user/User\",\"value\":{\"packageName\":\"@proteinjs/user\",\"name\":\"User\",\"filePath\":\"/Users/brentbahry/repos/farm/n3xa2/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 /** Role names from the roles catalog (see `RolesCatalog`). Written ONLY by the Roles service. */\\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 /** Role names from the roles catalog (see `RolesCatalog`). Written ONLY by the Roles service. */\\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/brentbahry/repos/farm/n3xa2/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\":\"auth\",\"type\":{\"packageName\":\"\",\"name\":\"Table<User>['auth']\",\"filePath\":null,\"qualifiedName\":\"/Table<User>['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/User\"],\"directParentInterfaces\":[],\"directParentClasses\":[]}],\"sourceType\":2}}],\"edges\":[{\"v\":\"@proteinjs/user/RoleCatalogEntry\",\"w\":\"@proteinjs/reflection/Loadable\",\"value\":\"extends interface\"},{\"v\":\"@proteinjs/user/AdminRole\",\"w\":\"@proteinjs/user/RoleCatalogEntry\",\"value\":\"implements interface\"},{\"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/RolesService\",\"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/RoleGrantEvent\",\"w\":\"@proteinjs/db/Record\",\"value\":\"extends type\"},{\"v\":\"@proteinjs/user/RoleGrantEventTable\",\"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
14
|
|
|
15
15
|
|
|
16
16
|
/** Generate Source Links */
|
|
17
17
|
|
|
18
|
+
import { AdminRole } from '../src/RolesCatalog';
|
|
18
19
|
import { UserRepo } from '../src/UserRepo';
|
|
19
20
|
import { AccessGrantTable } from '../src/tables/AccessGrantTable';
|
|
20
21
|
import { AccessInviteTable } from '../src/tables/AccessInviteTable';
|
|
21
22
|
import { InviteTable } from '../src/tables/InviteTable';
|
|
23
|
+
import { RoleGrantEventTable } from '../src/tables/RoleGrantEventTable';
|
|
22
24
|
import { SessionTable } from '../src/tables/SessionTable';
|
|
23
25
|
import { UserTable } from '../src/tables/UserTable';
|
|
24
26
|
|
|
25
27
|
const sourceLinks = {
|
|
28
|
+
'@proteinjs/user/AdminRole': AdminRole,
|
|
26
29
|
'@proteinjs/user/UserRepo': UserRepo,
|
|
27
30
|
'@proteinjs/user/AccessGrantTable': AccessGrantTable,
|
|
28
31
|
'@proteinjs/user/AccessInviteTable': AccessInviteTable,
|
|
29
32
|
'@proteinjs/user/InviteTable': InviteTable,
|
|
33
|
+
'@proteinjs/user/RoleGrantEventTable': RoleGrantEventTable,
|
|
30
34
|
'@proteinjs/user/SessionTable': SessionTable,
|
|
31
35
|
'@proteinjs/user/UserTable': UserTable,
|
|
32
36
|
};
|
package/index.ts
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
export * from './src/services/AccessInviteService';
|
|
2
|
+
export * from './src/services/RolesService';
|
|
2
3
|
export * from './src/services/SignupService';
|
|
3
4
|
export * from './src/services/UpdateUserInfoService';
|
|
4
5
|
|
|
5
6
|
export * from './src/tables/AccessGrantTable';
|
|
6
7
|
export * from './src/tables/AccessInviteTable';
|
|
7
8
|
export * from './src/tables/InviteTable';
|
|
9
|
+
export * from './src/tables/RoleGrantEventTable';
|
|
8
10
|
export * from './src/tables/UserTable';
|
|
9
11
|
export * from './src/tables/SessionTable';
|
|
10
12
|
export * from './src/tables/tables';
|
|
11
13
|
export * from './src/routes';
|
|
12
14
|
export * from './src/cacheKeys';
|
|
15
|
+
export * from './src/permissions';
|
|
16
|
+
export * from './src/RolesCatalog';
|
|
13
17
|
export * from './src/UserRepo';
|
|
14
18
|
export * from './src/ScopedRecord';
|
|
15
19
|
export * from './src/SharedRecord';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@proteinjs/user",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0",
|
|
4
4
|
"description": "User management",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -22,15 +22,15 @@
|
|
|
22
22
|
"test": "jest --passWithNoTests"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@proteinjs/db": "^1.
|
|
25
|
+
"@proteinjs/db": "^1.28.0",
|
|
26
26
|
"@proteinjs/reflection": "^1.1.12",
|
|
27
27
|
"@proteinjs/server-api": "^3.0.10",
|
|
28
|
-
"@proteinjs/service": "^1.
|
|
29
|
-
"@proteinjs/user-auth": "^1.
|
|
28
|
+
"@proteinjs/service": "^1.5.0",
|
|
29
|
+
"@proteinjs/user-auth": "^1.3.0",
|
|
30
30
|
"moment": "2.29.4"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@proteinjs/db-driver-knex": "^1.
|
|
33
|
+
"@proteinjs/db-driver-knex": "^1.8.0",
|
|
34
34
|
"@proteinjs/reflection-build": "^1.4.10",
|
|
35
35
|
"@types/jest": "29.5.5",
|
|
36
36
|
"@types/node": "14.0.13",
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Loadable, SourceRepository } from '@proteinjs/reflection';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A role known to the product. Consumers register entries by implementing this Loadable; admin
|
|
5
|
+
* surfaces render the catalog as a pick-list instead of free text, and the Roles service refuses
|
|
6
|
+
* to grant a role the catalog does not know.
|
|
7
|
+
*/
|
|
8
|
+
export interface RoleCatalogEntry extends Loadable {
|
|
9
|
+
/** Stable role name stored on user records (e.g. 'ops'). */
|
|
10
|
+
role: string;
|
|
11
|
+
/** What holding this role means, in plain words — shown in admin pick-lists. */
|
|
12
|
+
description: string;
|
|
13
|
+
/**
|
|
14
|
+
* Break-glass roles pass every role and permission check (see `UserAuth`) and are meant to be
|
|
15
|
+
* held by NOBODY day-to-day. Only 'admin' ships with this flag.
|
|
16
|
+
*/
|
|
17
|
+
breakGlass?: boolean;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const getRoleCatalogEntries = () =>
|
|
21
|
+
SourceRepository.get().objects<RoleCatalogEntry>('@proteinjs/user/RoleCatalogEntry');
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The built-in break-glass role: passes every role and permission check. Day-to-day access rides
|
|
25
|
+
* permission-mapped roles; admin exists for bootstrap and emergencies.
|
|
26
|
+
*/
|
|
27
|
+
export class AdminRole implements RoleCatalogEntry {
|
|
28
|
+
role = 'admin';
|
|
29
|
+
description = 'Break-glass superuser: passes every permission check. Held by nobody day-to-day.';
|
|
30
|
+
breakGlass = true;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* The registry of known roles: the built-in 'admin' plus consumer-registered `RoleCatalogEntry`
|
|
35
|
+
* implementations, deduped by role name (first registration wins; 'admin' cannot be redefined).
|
|
36
|
+
*/
|
|
37
|
+
export class RolesCatalog {
|
|
38
|
+
static getEntries(): RoleCatalogEntry[] {
|
|
39
|
+
const entries: RoleCatalogEntry[] = [new AdminRole()];
|
|
40
|
+
for (const entry of getRoleCatalogEntries()) {
|
|
41
|
+
if (!entries.some((existing) => existing.role === entry.role)) {
|
|
42
|
+
entries.push(entry);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return entries;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
static getEntry(role: string): RoleCatalogEntry | undefined {
|
|
50
|
+
return RolesCatalog.getEntries().find((entry) => entry.role === role);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
static isKnownRole(role: string): boolean {
|
|
54
|
+
return !!RolesCatalog.getEntry(role);
|
|
55
|
+
}
|
|
56
|
+
}
|
package/src/UserRepo.ts
CHANGED
|
@@ -6,7 +6,9 @@ import { USER_SESSION_CACHE_KEY } from './cacheKeys';
|
|
|
6
6
|
export class UserRepo implements AuthenticatedUserRepo {
|
|
7
7
|
getUser(): Omit<User, 'roles'> & AuthenticatedUser {
|
|
8
8
|
const user = Object.assign({}, Session.getDataByKey<User>(USER_SESSION_CACHE_KEY));
|
|
9
|
-
|
|
9
|
+
// Roles are stored typed (`role_list`); rows that predate the roles backfill migration read
|
|
10
|
+
// as null, and a context without session data has none — both mean "no roles".
|
|
11
|
+
const roles = user.roles ?? [];
|
|
10
12
|
return Object.assign(user, { roles });
|
|
11
13
|
}
|
|
12
14
|
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Abstract permission slugs the user-management surfaces declare. Seeing users and granting
|
|
3
|
+
* power are different trusts, so they are separate permissions. The consumer app maps slugs to
|
|
4
|
+
* its roles via `PermissionRolesMapping` (@proteinjs/user-auth); 'admin' passes both
|
|
5
|
+
* (break-glass).
|
|
6
|
+
*/
|
|
7
|
+
export const USER_PERMISSIONS = {
|
|
8
|
+
/** View and manage user records and invites — everything except the roles column. */
|
|
9
|
+
users: 'users',
|
|
10
|
+
/** Grant and revoke roles, through the Roles service only (audited per change). */
|
|
11
|
+
roles: 'roles',
|
|
12
|
+
/**
|
|
13
|
+
* View session records — a different trust than 'users' people-management (session rows carry
|
|
14
|
+
* auth material). Read-only by design: session writes are system-written (DbSessionStore).
|
|
15
|
+
*/
|
|
16
|
+
sessions: 'sessions',
|
|
17
|
+
} as const;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Service, serviceFactory } from '@proteinjs/service';
|
|
2
|
+
|
|
3
|
+
export const getRolesService = serviceFactory<RolesService>('@proteinjs/user/RolesService');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The ONE write path for user roles. The `user.roles` column is service-protected (generic
|
|
7
|
+
* record writes cannot touch it); every change lands here, is validated against the roles
|
|
8
|
+
* catalog, and writes a `role_grant_event` audit row (actor, target, role, action; `created` is
|
|
9
|
+
* the timestamp). Requires the 'roles' permission.
|
|
10
|
+
*/
|
|
11
|
+
export interface RolesService extends Service {
|
|
12
|
+
/** Add a catalog role to a user. Already held: no change, no audit row. */
|
|
13
|
+
grantRole(userId: string, role: string): Promise<void>;
|
|
14
|
+
/** Remove a role from a user. Not held: no change, no audit row. */
|
|
15
|
+
revokeRole(userId: string, role: string): Promise<void>;
|
|
16
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { StringColumn, Table, Record, withRecordColumns, DateTimeColumn } from '@proteinjs/db';
|
|
2
2
|
import { Moment } from 'moment';
|
|
3
|
+
import { USER_PERMISSIONS } from '../permissions';
|
|
3
4
|
|
|
4
5
|
export type Invite = Record & {
|
|
5
6
|
email: string;
|
|
@@ -10,6 +11,24 @@ export type Invite = Record & {
|
|
|
10
11
|
|
|
11
12
|
export class InviteTable extends Table<Invite> {
|
|
12
13
|
name = 'invite';
|
|
14
|
+
/**
|
|
15
|
+
* Invite management rides the 'users' permission: reads and deletes through the record
|
|
16
|
+
* surfaces; creating/refreshing an invite is `SignupService.sendInvite` ONLY (a generic insert
|
|
17
|
+
* would mint an invite that can never be redeemed — no token/expiry/inviter), so generic
|
|
18
|
+
* writes stay closed. The db doors mirror the service doors — `DbService`'s inner `Db`
|
|
19
|
+
* re-checks the db api as the calling user (see the user table); server code proper uses
|
|
20
|
+
* system paths, which bypass TableAuth.
|
|
21
|
+
*/
|
|
22
|
+
auth: Table<Invite>['auth'] = {
|
|
23
|
+
db: {
|
|
24
|
+
query: { permission: USER_PERMISSIONS.users },
|
|
25
|
+
delete: { permission: USER_PERMISSIONS.users },
|
|
26
|
+
},
|
|
27
|
+
service: {
|
|
28
|
+
query: { permission: USER_PERMISSIONS.users },
|
|
29
|
+
delete: { permission: USER_PERMISSIONS.users },
|
|
30
|
+
},
|
|
31
|
+
};
|
|
13
32
|
columns = withRecordColumns<Invite>({
|
|
14
33
|
email: new StringColumn('email', {}, 250),
|
|
15
34
|
token: new StringColumn('token'),
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { StringColumn, Table, Record, withRecordColumns } from '@proteinjs/db';
|
|
2
|
+
import { USER_PERMISSIONS } from '../permissions';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Audit row written by the Roles service for EVERY grant/revoke. The base `created` column is the
|
|
6
|
+
* change timestamp. Rows are append-only: readable by 'roles' holders, written only by the Roles
|
|
7
|
+
* service's system path — no generic door grants writes, so the trail cannot be edited from the
|
|
8
|
+
* record surfaces.
|
|
9
|
+
*/
|
|
10
|
+
export type RoleGrantEvent = Record & {
|
|
11
|
+
/** id of the user who made the change */
|
|
12
|
+
actor: string;
|
|
13
|
+
/** id of the user whose roles changed */
|
|
14
|
+
target: string;
|
|
15
|
+
role: string;
|
|
16
|
+
action: 'grant' | 'revoke';
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export class RoleGrantEventTable extends Table<RoleGrantEvent> {
|
|
20
|
+
name = 'role_grant_event';
|
|
21
|
+
auth: Table<RoleGrantEvent>['auth'] = {
|
|
22
|
+
db: {
|
|
23
|
+
query: { permission: USER_PERMISSIONS.roles },
|
|
24
|
+
},
|
|
25
|
+
service: {
|
|
26
|
+
query: { permission: USER_PERMISSIONS.roles },
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
columns = withRecordColumns<RoleGrantEvent>({
|
|
30
|
+
actor: new StringColumn('actor', {}, 36),
|
|
31
|
+
target: new StringColumn('target', {}, 36),
|
|
32
|
+
role: new StringColumn('role'),
|
|
33
|
+
action: new StringColumn<'grant' | 'revoke'>('action', {}, 16),
|
|
34
|
+
});
|
|
35
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { DateColumn, StringColumn, Table, Record, withRecordColumns } from '@proteinjs/db';
|
|
2
|
+
import { USER_PERMISSIONS } from '../permissions';
|
|
2
3
|
|
|
3
4
|
export type Session = Record & {
|
|
4
5
|
sessionId: string;
|
|
@@ -7,8 +8,22 @@ export type Session = Record & {
|
|
|
7
8
|
userEmail: string;
|
|
8
9
|
};
|
|
9
10
|
|
|
11
|
+
/**
|
|
12
|
+
* Readable by 'sessions' holders — its own permission because session rows carry auth material,
|
|
13
|
+
* a different trust than 'users' people-management. Writes are system-written (DbSessionStore
|
|
14
|
+
* rides getDbAsSystem, which bypasses TableAuth), so the explicit auth block grants no write
|
|
15
|
+
* door — a lock even for break-glass admin, the role_grant_event pattern.
|
|
16
|
+
*/
|
|
10
17
|
export class SessionTable extends Table<Session> {
|
|
11
18
|
name = 'session';
|
|
19
|
+
auth: Table<Session>['auth'] = {
|
|
20
|
+
db: {
|
|
21
|
+
query: { permission: USER_PERMISSIONS.sessions },
|
|
22
|
+
},
|
|
23
|
+
service: {
|
|
24
|
+
query: { permission: USER_PERMISSIONS.sessions },
|
|
25
|
+
},
|
|
26
|
+
};
|
|
12
27
|
columns = withRecordColumns<Session>({
|
|
13
28
|
sessionId: new StringColumn('session_id'),
|
|
14
29
|
session: new StringColumn('serialized_session', {}, 4000),
|
package/src/tables/UserTable.ts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
|
+
ArrayColumn,
|
|
2
3
|
BooleanColumn,
|
|
3
4
|
StringColumn,
|
|
4
5
|
PasswordColumn,
|
|
5
6
|
Table,
|
|
6
7
|
Record,
|
|
7
8
|
withRecordColumns,
|
|
8
|
-
UuidColumn,
|
|
9
9
|
DateTimeColumn,
|
|
10
10
|
} from '@proteinjs/db';
|
|
11
11
|
import { Moment } from 'moment';
|
|
12
|
+
import { USER_PERMISSIONS } from '../permissions';
|
|
12
13
|
|
|
13
14
|
export type User = Record & {
|
|
14
15
|
name: string;
|
|
@@ -17,12 +18,36 @@ export type User = Record & {
|
|
|
17
18
|
passwordResetToken?: string | null;
|
|
18
19
|
passwordResetTokenExpiration?: Moment | null;
|
|
19
20
|
emailVerified: boolean;
|
|
20
|
-
roles
|
|
21
|
+
/** Role names from the roles catalog (see `RolesCatalog`). Written ONLY by the Roles service. */
|
|
22
|
+
roles: string[];
|
|
21
23
|
invitedBy?: string | null;
|
|
22
24
|
};
|
|
23
25
|
|
|
24
26
|
export class UserTable extends Table<User> {
|
|
25
27
|
name = 'user';
|
|
28
|
+
/**
|
|
29
|
+
* The 'users' permission covers viewing and managing user records — EXCEPT roles. The roles
|
|
30
|
+
* column is service-protected: the ONLY write path is the Roles service (permission 'roles'),
|
|
31
|
+
* which also writes the role_grant_event audit row per change. The db doors mirror the
|
|
32
|
+
* service doors: `DbService`'s inner `Db` re-checks the db api as the calling user, so a
|
|
33
|
+
* service-only shape leaves the record surfaces admin-locked (server code proper still uses
|
|
34
|
+
* system paths, which bypass TableAuth).
|
|
35
|
+
*/
|
|
36
|
+
auth: Table<User>['auth'] = {
|
|
37
|
+
db: {
|
|
38
|
+
query: { permission: USER_PERMISSIONS.users },
|
|
39
|
+
insert: { permission: USER_PERMISSIONS.users },
|
|
40
|
+
update: { permission: USER_PERMISSIONS.users },
|
|
41
|
+
delete: { permission: USER_PERMISSIONS.users },
|
|
42
|
+
},
|
|
43
|
+
service: {
|
|
44
|
+
query: { permission: USER_PERMISSIONS.users },
|
|
45
|
+
insert: { permission: USER_PERMISSIONS.users },
|
|
46
|
+
update: { permission: USER_PERMISSIONS.users },
|
|
47
|
+
delete: { permission: USER_PERMISSIONS.users },
|
|
48
|
+
},
|
|
49
|
+
serviceProtectedColumns: ['roles'],
|
|
50
|
+
};
|
|
26
51
|
columns = withRecordColumns<User>({
|
|
27
52
|
name: new StringColumn('name'),
|
|
28
53
|
email: new StringColumn('email', {}, 250),
|
|
@@ -30,7 +55,12 @@ export class UserTable extends Table<User> {
|
|
|
30
55
|
passwordResetToken: new StringColumn('password_reset_token'),
|
|
31
56
|
passwordResetTokenExpiration: new DateTimeColumn('password_reset_token_expiration'),
|
|
32
57
|
emailVerified: new BooleanColumn('email_verified'),
|
|
33
|
-
|
|
58
|
+
/**
|
|
59
|
+
* Typed array in the `role_list` column. The legacy comma-string `roles` column (STRING(255))
|
|
60
|
+
* stays physically present but undeclared — Spanner cannot retype in place, so the cutover is
|
|
61
|
+
* new column + backfill (`@proteinjs/user-server` BackfillUserRolesArray) + this code cutover.
|
|
62
|
+
*/
|
|
63
|
+
roles: new ArrayColumn<string>('role_list'),
|
|
34
64
|
invitedBy: new StringColumn('invited_by'),
|
|
35
65
|
});
|
|
36
66
|
}
|