@proteinjs/user 1.2.17 → 1.2.18
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 +3 -1
- package/dist/generated/index.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/src/SharedRecord.d.ts +18 -0
- package/dist/src/SharedRecord.d.ts.map +1 -0
- package/dist/src/SharedRecord.js +132 -0
- package/dist/src/SharedRecord.js.map +1 -0
- package/dist/src/tables/AccessGrantTable.d.ts +22 -0
- package/dist/src/tables/AccessGrantTable.d.ts.map +1 -0
- package/dist/src/tables/AccessGrantTable.js +105 -0
- package/dist/src/tables/AccessGrantTable.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/dist/test/SharedRecord.test.d.ts +19 -0
- package/dist/test/SharedRecord.test.d.ts.map +1 -0
- package/dist/test/SharedRecord.test.js +324 -0
- package/dist/test/SharedRecord.test.js.map +1 -0
- package/generated/index.ts +3 -1
- package/index.ts +1 -0
- package/package.json +3 -3
- package/src/SharedRecord.ts +106 -0
- package/src/tables/AccessGrantTable.ts +57 -0
- package/src/tables/tables.ts +2 -0
- package/test/SharedRecord.test.ts +212 -0
|
@@ -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;AA+BhB,cAAc,UAAU,CAAC"}
|
package/dist/generated/index.js
CHANGED
|
@@ -22,14 +22,16 @@ 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/brentbahry/repos/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/UserRepo\",\"value\":{\"packageName\":\"@proteinjs/user\",\"name\":\"UserRepo\",\"filePath\":\"/Users/brentbahry/repos/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\":\"@proteinjs/user/Invite\",\"value\":{\"packageName\":\"@proteinjs/user\",\"name\":\"Invite\",\"filePath\":\"/Users/brentbahry/repos/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/brentbahry/repos/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/db/Table\"},{\"v\":\"@proteinjs/user/Session\",\"value\":{\"packageName\":\"@proteinjs/user\",\"name\":\"Session\",\"filePath\":\"/Users/brentbahry/repos/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/brentbahry/repos/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/brentbahry/repos/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/brentbahry/repos/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}},{\"v\":\"/Pick\"},{\"v\":\"@proteinjs/user/SignupService\",\"value\":{\"packageName\":\"@proteinjs/user\",\"name\":\"SignupService\",\"filePath\":\"/Users/brentbahry/repos/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/brentbahry/repos/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}}],\"edges\":[{\"v\":\"@proteinjs/user/ScopedRecord\",\"w\":\"@proteinjs/db/Record\",\"value\":\"extends interface\"},{\"v\":\"@proteinjs/user/UserRepo\",\"w\":\"@proteinjs/user-auth/AuthenticatedUserRepo\",\"value\":\"implements interface\"},{\"v\":\"@proteinjs/user/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\"},{\"v\":\"@proteinjs/user/SignupService\",\"w\":\"@proteinjs/service/Service\",\"value\":\"extends interface\"},{\"v\":\"@proteinjs/user/UpdateUserInfoService\",\"w\":\"@proteinjs/service/Service\",\"value\":\"extends interface\"}]}";
|
|
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\"}]}";
|
|
26
26
|
/** Generate Source Links */
|
|
27
27
|
var UserRepo_1 = require("../src/UserRepo");
|
|
28
|
+
var AccessGrantTable_1 = require("../src/tables/AccessGrantTable");
|
|
28
29
|
var InviteTable_1 = require("../src/tables/InviteTable");
|
|
29
30
|
var SessionTable_1 = require("../src/tables/SessionTable");
|
|
30
31
|
var UserTable_1 = require("../src/tables/UserTable");
|
|
31
32
|
var sourceLinks = {
|
|
32
33
|
'@proteinjs/user/UserRepo': UserRepo_1.UserRepo,
|
|
34
|
+
'@proteinjs/user/AccessGrantTable': AccessGrantTable_1.AccessGrantTable,
|
|
33
35
|
'@proteinjs/user/InviteTable': InviteTable_1.InviteTable,
|
|
34
36
|
'@proteinjs/user/SessionTable': SessionTable_1.SessionTable,
|
|
35
37
|
'@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,qriBAAqriB,CAAC;AAG1siB,4BAA4B;AAE5B,4CAA2C;AAC3C,mEAAkE;AAClE,yDAAwD;AACxD,2DAA0D;AAC1D,qDAAoD;AAEpD,IAAM,WAAW,GAAG;IACnB,0BAA0B,EAAE,mBAAQ;IACpC,kCAAkC,EAAE,mCAAgB;IACpD,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
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;AAEnC,cAAc,sBAAsB,CAAC"}
|
|
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"}
|
package/dist/index.js
CHANGED
|
@@ -24,5 +24,6 @@ __exportStar(require("./src/routes"), exports);
|
|
|
24
24
|
__exportStar(require("./src/cacheKeys"), exports);
|
|
25
25
|
__exportStar(require("./src/UserRepo"), exports);
|
|
26
26
|
__exportStar(require("./src/ScopedRecord"), exports);
|
|
27
|
+
__exportStar(require("./src/SharedRecord"), exports);
|
|
27
28
|
__exportStar(require("@proteinjs/user-auth"), exports);
|
|
28
29
|
//# sourceMappingURL=index.js.map
|
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;AAEnC,uDAAqC"}
|
|
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"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Columns, Db, Record, Table, Reference } from '@proteinjs/db';
|
|
2
|
+
export interface SharedRecord<T extends SharedRecord = any> extends Record {
|
|
3
|
+
permissionSource: Reference<T>;
|
|
4
|
+
permissionSourceTable: string;
|
|
5
|
+
}
|
|
6
|
+
export declare const getSharedDb: () => Db<SharedRecord<any>>;
|
|
7
|
+
export declare const getSharedDbWithOverride: () => Db<Omit<SharedRecord<any>, "permissionSource">>;
|
|
8
|
+
export declare const getSharedDbAsSystem: <R extends SharedRecord<any> = SharedRecord<any>>() => Db<R>;
|
|
9
|
+
export declare function getSharedTables(): Table<SharedRecord<any>>[];
|
|
10
|
+
export declare function isSharedTable(table: Table<any>): table is Table<SharedRecord>;
|
|
11
|
+
/**
|
|
12
|
+
* Wrapper function to add default Shared columns to your table's columns.
|
|
13
|
+
*
|
|
14
|
+
* @param columns your columns
|
|
15
|
+
* @returns recordColumns & sourceRecordColumns & your columns
|
|
16
|
+
*/
|
|
17
|
+
export declare function withSharedRecordColumns<T extends SharedRecord>(columns: Columns<Omit<T, keyof SharedRecord>>): Columns<SharedRecord> & Columns<Omit<T, keyof SharedRecord>>;
|
|
18
|
+
//# sourceMappingURL=SharedRecord.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SharedRecord.d.ts","sourceRoot":"","sources":["../../src/SharedRecord.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,EAAE,EAEF,MAAM,EACN,KAAK,EAKL,SAAS,EAGV,MAAM,eAAe,CAAC;AAMvB,MAAM,WAAW,YAAY,CAAC,CAAC,SAAS,YAAY,GAAG,GAAG,CAAE,SAAQ,MAAM;IACxE,gBAAgB,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;IAC/B,qBAAqB,EAAE,MAAM,CAAC;CAC/B;AAED,eAAO,MAAM,WAAW,6BAAsB,CAAC;AAC/C,eAAO,MAAM,uBAAuB,uDAAgD,CAAC;AAErF,eAAO,MAAM,mBAAmB,8DACkB,CAAC;AA2DnD,wBAAgB,eAAe,+BAE9B;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,KAAK,IAAI,KAAK,CAAC,YAAY,CAAC,CAE7E;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,CAAC,SAAS,YAAY,EAC5D,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,MAAM,YAAY,CAAC,CAAC,GAC5C,OAAO,CAAC,YAAY,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,MAAM,YAAY,CAAC,CAAC,CAE9D"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
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;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.withSharedRecordColumns = exports.isSharedTable = exports.getSharedTables = exports.getSharedDbAsSystem = exports.getSharedDbWithOverride = exports.getSharedDb = void 0;
|
|
40
|
+
var db_1 = require("@proteinjs/db");
|
|
41
|
+
var AccessGrantTable_1 = require("./tables/AccessGrantTable");
|
|
42
|
+
var UserRepo_1 = require("./UserRepo");
|
|
43
|
+
var UserTable_1 = require("./tables/UserTable");
|
|
44
|
+
exports.getSharedDb = (db_1.getDb);
|
|
45
|
+
exports.getSharedDbWithOverride = (db_1.getDb);
|
|
46
|
+
var getSharedDbAsSystem = function () {
|
|
47
|
+
return new db_1.Db(undefined, undefined, undefined, true);
|
|
48
|
+
};
|
|
49
|
+
exports.getSharedDbAsSystem = getSharedDbAsSystem;
|
|
50
|
+
var getSharedRecordColumns = function () {
|
|
51
|
+
return {
|
|
52
|
+
permissionSource: new db_1.DynamicReferenceColumn('permission_source', 'permission_source_table', true, {
|
|
53
|
+
defaultValue: function (table, insertObj) { return __awaiter(void 0, void 0, void 0, function () {
|
|
54
|
+
var user, db;
|
|
55
|
+
return __generator(this, function (_a) {
|
|
56
|
+
switch (_a.label) {
|
|
57
|
+
case 0:
|
|
58
|
+
user = new UserRepo_1.UserRepo().getUser();
|
|
59
|
+
db = (0, db_1.getDb)();
|
|
60
|
+
return [4 /*yield*/, db.insert(new AccessGrantTable_1.AccessGrantTable(), {
|
|
61
|
+
principal: new db_1.Reference(new UserTable_1.UserTable().name, user.id),
|
|
62
|
+
resource: new db_1.Reference(table.name, insertObj.id),
|
|
63
|
+
resourceTable: table.name,
|
|
64
|
+
accessLevel: 'admin',
|
|
65
|
+
})];
|
|
66
|
+
case 1:
|
|
67
|
+
_a.sent();
|
|
68
|
+
return [2 /*return*/, new db_1.Reference(table.name, insertObj.id)];
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
}); },
|
|
72
|
+
addToQuery: function (qb, runAsSystem) { return __awaiter(void 0, void 0, void 0, function () {
|
|
73
|
+
var subQuery;
|
|
74
|
+
return __generator(this, function (_a) {
|
|
75
|
+
if (runAsSystem) {
|
|
76
|
+
return [2 /*return*/];
|
|
77
|
+
}
|
|
78
|
+
subQuery = new db_1.QueryBuilder(new AccessGrantTable_1.AccessGrantTable().name);
|
|
79
|
+
subQuery.select({
|
|
80
|
+
fields: ['resource'],
|
|
81
|
+
});
|
|
82
|
+
subQuery.condition({
|
|
83
|
+
field: 'principal',
|
|
84
|
+
operator: '=',
|
|
85
|
+
value: new UserRepo_1.UserRepo().getUser().id,
|
|
86
|
+
});
|
|
87
|
+
subQuery.condition({
|
|
88
|
+
field: 'accessLevel',
|
|
89
|
+
operator: 'IN',
|
|
90
|
+
value: ['read', 'write', 'admin'],
|
|
91
|
+
});
|
|
92
|
+
subQuery.condition({
|
|
93
|
+
field: 'resourceTable',
|
|
94
|
+
operator: '=',
|
|
95
|
+
value: qb.tableName,
|
|
96
|
+
});
|
|
97
|
+
qb.condition({
|
|
98
|
+
field: 'permissionSource',
|
|
99
|
+
operator: 'IN',
|
|
100
|
+
value: subQuery,
|
|
101
|
+
});
|
|
102
|
+
return [2 /*return*/];
|
|
103
|
+
});
|
|
104
|
+
}); },
|
|
105
|
+
}),
|
|
106
|
+
permissionSourceTable: new db_1.DynamicReferenceTableNameColumn('permission_source_table', 'permission_source', {
|
|
107
|
+
defaultValue: function (table) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
108
|
+
return [2 /*return*/, table.name];
|
|
109
|
+
}); }); },
|
|
110
|
+
forceDefaultValue: true,
|
|
111
|
+
}),
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
function getSharedTables() {
|
|
115
|
+
return (0, db_1.getTables)().filter(function (table) { return isSharedTable(table); });
|
|
116
|
+
}
|
|
117
|
+
exports.getSharedTables = getSharedTables;
|
|
118
|
+
function isSharedTable(table) {
|
|
119
|
+
return !!(0, db_1.getColumnByName)(table, getSharedRecordColumns().permissionSource.name);
|
|
120
|
+
}
|
|
121
|
+
exports.isSharedTable = isSharedTable;
|
|
122
|
+
/**
|
|
123
|
+
* Wrapper function to add default Shared columns to your table's columns.
|
|
124
|
+
*
|
|
125
|
+
* @param columns your columns
|
|
126
|
+
* @returns recordColumns & sourceRecordColumns & your columns
|
|
127
|
+
*/
|
|
128
|
+
function withSharedRecordColumns(columns) {
|
|
129
|
+
return Object.assign(Object.assign({}, getSharedRecordColumns()), (0, db_1.withRecordColumns)(columns));
|
|
130
|
+
}
|
|
131
|
+
exports.withSharedRecordColumns = withSharedRecordColumns;
|
|
132
|
+
//# sourceMappingURL=SharedRecord.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SharedRecord.js","sourceRoot":"","sources":["../../src/SharedRecord.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oCAauB;AAEvB,8DAA0E;AAC1E,uCAAsC;AACtC,gDAA+C;AAOlC,QAAA,WAAW,GAAG,CAAA,UAAmB,CAAA,CAAC;AAClC,QAAA,uBAAuB,GAAG,CAAA,UAA6C,CAAA,CAAC;AAE9E,IAAM,mBAAmB,GAAG;IACjC,OAAA,IAAI,OAAE,CAAI,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,CAAC;AAAhD,CAAgD,CAAC;AADtC,QAAA,mBAAmB,uBACmB;AAEnD,IAAM,sBAAsB,GAAG;IAC7B,OAAO;QACL,gBAAgB,EAAE,IAAI,2BAAsB,CAAC,mBAAmB,EAAE,yBAAyB,EAAE,IAAI,EAAE;YACjG,YAAY,EAAE,UAAO,KAAK,EAAE,SAAS;;;;;4BAC7B,IAAI,GAAG,IAAI,mBAAQ,EAAE,CAAC,OAAO,EAAE,CAAC;4BAChC,EAAE,GAAG,IAAA,UAAK,GAAe,CAAC;4BAEhC,qBAAM,EAAE,CAAC,MAAM,CAAC,IAAI,mCAAgB,EAAwB,EAAE;oCAC5D,SAAS,EAAE,IAAI,cAAS,CAAC,IAAI,qBAAS,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC;oCACvD,QAAQ,EAAE,IAAI,cAAS,CAAC,KAAK,CAAC,IAAI,EAAE,SAAS,CAAC,EAAE,CAAC;oCACjD,aAAa,EAAE,KAAK,CAAC,IAAI;oCACzB,WAAW,EAAE,OAAO;iCACrB,CAAC,EAAA;;4BALF,SAKE,CAAC;4BAEH,sBAAO,IAAI,cAAS,CAAC,KAAK,CAAC,IAAI,EAAE,SAAS,CAAC,EAAE,CAAC,EAAC;;;iBAChD;YACD,UAAU,EAAE,UAAO,EAAE,EAAE,WAAW;;;oBAChC,IAAI,WAAW,EAAE;wBACf,sBAAO;qBACR;oBACK,QAAQ,GAAG,IAAI,iBAAY,CAAC,IAAI,mCAAgB,EAAE,CAAC,IAAI,CAAC,CAAC;oBAC/D,QAAQ,CAAC,MAAM,CAAC;wBACd,MAAM,EAAE,CAAC,UAAU,CAAC;qBACrB,CAAC,CAAC;oBAEH,QAAQ,CAAC,SAAS,CAAC;wBACjB,KAAK,EAAE,WAAW;wBAClB,QAAQ,EAAE,GAAG;wBACb,KAAK,EAAE,IAAI,mBAAQ,EAAE,CAAC,OAAO,EAAE,CAAC,EAAE;qBACnC,CAAC,CAAC;oBAEH,QAAQ,CAAC,SAAS,CAAC;wBACjB,KAAK,EAAE,aAAa;wBACpB,QAAQ,EAAE,IAAI;wBACd,KAAK,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC;qBAClC,CAAC,CAAC;oBAEH,QAAQ,CAAC,SAAS,CAAC;wBACjB,KAAK,EAAE,eAAe;wBACtB,QAAQ,EAAE,GAAG;wBACb,KAAK,EAAE,EAAE,CAAC,SAAS;qBACpB,CAAC,CAAC;oBAEH,EAAE,CAAC,SAAS,CAAC;wBACX,KAAK,EAAE,kBAAkB;wBACzB,QAAQ,EAAE,IAAI;wBACd,KAAK,EAAE,QAAQ;qBAChB,CAAC,CAAC;;;iBACJ;SACF,CAAC;QACF,qBAAqB,EAAE,IAAI,oCAA+B,CAAC,yBAAyB,EAAE,mBAAmB,EAAE;YACzG,YAAY,EAAE,UAAO,KAAK;gBAAK,sBAAA,KAAK,CAAC,IAAI,EAAA;qBAAA;YACzC,iBAAiB,EAAE,IAAI;SACxB,CAAC;KACH,CAAC;AACJ,CAAC,CAAC;AAEF,SAAgB,eAAe;IAC7B,OAAO,IAAA,cAAS,GAAgB,CAAC,MAAM,CAAC,UAAC,KAAK,IAAK,OAAA,aAAa,CAAC,KAAK,CAAC,EAApB,CAAoB,CAAC,CAAC;AAC3E,CAAC;AAFD,0CAEC;AAED,SAAgB,aAAa,CAAC,KAAiB;IAC7C,OAAO,CAAC,CAAC,IAAA,oBAAe,EAAC,KAAK,EAAE,sBAAsB,EAAE,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;AAClF,CAAC;AAFD,sCAEC;AAED;;;;;GAKG;AACH,SAAgB,uBAAuB,CACrC,OAA6C;IAE7C,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,sBAAsB,EAAE,CAAC,EAAE,IAAA,sBAAiB,EAAS,OAAO,CAAQ,CAAC,CAAC;AAC/G,CAAC;AAJD,0DAIC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Record, Reference } from '@proteinjs/db';
|
|
2
|
+
import { Table } from '@proteinjs/db';
|
|
3
|
+
export type AccessGrant = Record & {
|
|
4
|
+
principal: Reference<any>;
|
|
5
|
+
resource: Reference<any>;
|
|
6
|
+
resourceTable?: Table<any>['name'];
|
|
7
|
+
accessLevel: 'read' | 'write' | 'admin';
|
|
8
|
+
};
|
|
9
|
+
export declare class AccessGrantTable extends Table<AccessGrant> {
|
|
10
|
+
name: string;
|
|
11
|
+
columns: {
|
|
12
|
+
id: import("@proteinjs/db").Column<string, any>;
|
|
13
|
+
created: import("@proteinjs/db").Column<import("moment").Moment, any>;
|
|
14
|
+
updated: import("@proteinjs/db").Column<import("moment").Moment, any>;
|
|
15
|
+
} & {} & {
|
|
16
|
+
principal: import("@proteinjs/db").Column<Reference<any>, any>;
|
|
17
|
+
resource: import("@proteinjs/db").Column<Reference<any>, any>;
|
|
18
|
+
resourceTable: import("@proteinjs/db").Column<string | undefined, any>;
|
|
19
|
+
accessLevel: import("@proteinjs/db").Column<"read" | "write" | "admin", any>;
|
|
20
|
+
} & {};
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=AccessGrantTable.d.ts.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,105 @@
|
|
|
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 __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
28
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
+
function step(op) {
|
|
31
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
33
|
+
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;
|
|
34
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
+
switch (op[0]) {
|
|
36
|
+
case 0: case 1: t = op; break;
|
|
37
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
+
default:
|
|
41
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
+
if (t[2]) _.ops.pop();
|
|
46
|
+
_.trys.pop(); continue;
|
|
47
|
+
}
|
|
48
|
+
op = body.call(thisArg, _);
|
|
49
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
|
+
exports.AccessGrantTable = void 0;
|
|
55
|
+
var db_1 = require("@proteinjs/db");
|
|
56
|
+
var db_2 = require("@proteinjs/db");
|
|
57
|
+
var UserTable_1 = require("./UserTable");
|
|
58
|
+
var UserRepo_1 = require("../UserRepo");
|
|
59
|
+
var AccessGrantTable = /** @class */ (function (_super) {
|
|
60
|
+
__extends(AccessGrantTable, _super);
|
|
61
|
+
function AccessGrantTable() {
|
|
62
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
63
|
+
_this.name = 'access_grant';
|
|
64
|
+
_this.columns = (0, db_1.withRecordColumns)({
|
|
65
|
+
accessLevel: new db_1.StringColumn('access_level'),
|
|
66
|
+
principal: new db_1.ReferenceColumn('principal', UserTable_1.UserTable.name, false),
|
|
67
|
+
resource: new db_1.DynamicReferenceColumn('resource', 'resource_table', false),
|
|
68
|
+
resourceTable: new db_1.DynamicReferenceTableNameColumn('resource_table', 'resource', {
|
|
69
|
+
onBeforeInsert: function (insertObj, runAsSystem) { return __awaiter(_this, void 0, void 0, function () {
|
|
70
|
+
var resource, hasAdminAccess;
|
|
71
|
+
return __generator(this, function (_a) {
|
|
72
|
+
switch (_a.label) {
|
|
73
|
+
case 0:
|
|
74
|
+
if (runAsSystem) {
|
|
75
|
+
return [2 /*return*/];
|
|
76
|
+
}
|
|
77
|
+
return [4 /*yield*/, insertObj.resource.get()];
|
|
78
|
+
case 1:
|
|
79
|
+
resource = _a.sent();
|
|
80
|
+
if (!resource) {
|
|
81
|
+
return [2 /*return*/];
|
|
82
|
+
}
|
|
83
|
+
return [4 /*yield*/, (0, db_1.getDbAsSystem)().query(new AccessGrantTable(), {
|
|
84
|
+
accessLevel: 'admin',
|
|
85
|
+
principal: new UserRepo_1.UserRepo().getUser().id,
|
|
86
|
+
resource: insertObj.resource._id,
|
|
87
|
+
resourceTable: insertObj.resourceTable,
|
|
88
|
+
})];
|
|
89
|
+
case 2:
|
|
90
|
+
hasAdminAccess = (_a.sent()).length > 0;
|
|
91
|
+
if (!hasAdminAccess) {
|
|
92
|
+
throw new Error("User does not have admin access to resource");
|
|
93
|
+
}
|
|
94
|
+
return [2 /*return*/];
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
}); },
|
|
98
|
+
}),
|
|
99
|
+
});
|
|
100
|
+
return _this;
|
|
101
|
+
}
|
|
102
|
+
return AccessGrantTable;
|
|
103
|
+
}(db_2.Table));
|
|
104
|
+
exports.AccessGrantTable = AccessGrantTable;
|
|
105
|
+
//# sourceMappingURL=AccessGrantTable.js.map
|
|
@@ -0,0 +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,qEAkCC;QAjCC,UAAI,GAAG,cAAc,CAAC;QACtB,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,AAlCD,CAAsC,UAAK,GAkC1C;AAlCY,4CAAgB"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { AccessGrant } from './AccessGrantTable';
|
|
1
2
|
import { User } from './UserTable';
|
|
2
3
|
import { Session } from './SessionTable';
|
|
3
4
|
import { Table } from '@proteinjs/db';
|
|
4
5
|
import { Invite } from './InviteTable';
|
|
5
6
|
export declare const tables: {
|
|
7
|
+
AccessGrant: Table<AccessGrant>;
|
|
6
8
|
Invite: Table<Invite>;
|
|
7
9
|
User: Table<User>;
|
|
8
10
|
Session: Table<Session>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tables.d.ts","sourceRoot":"","sources":["../../../src/tables/tables.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,IAAI,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAgB,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,MAAM,EAAe,MAAM,eAAe,CAAC;AAEpD,eAAO,MAAM,MAAM
|
|
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;AAEpD,eAAO,MAAM,MAAM;;;;;CAKlB,CAAC"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.tables = void 0;
|
|
4
|
+
var AccessGrantTable_1 = require("./AccessGrantTable");
|
|
4
5
|
var UserTable_1 = require("./UserTable");
|
|
5
6
|
var SessionTable_1 = require("./SessionTable");
|
|
6
7
|
var InviteTable_1 = require("./InviteTable");
|
|
7
8
|
exports.tables = {
|
|
9
|
+
AccessGrant: new AccessGrantTable_1.AccessGrantTable(),
|
|
8
10
|
Invite: new InviteTable_1.InviteTable(),
|
|
9
11
|
User: new UserTable_1.UserTable(),
|
|
10
12
|
Session: new SessionTable_1.SessionTable(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tables.js","sourceRoot":"","sources":["../../../src/tables/tables.ts"],"names":[],"mappings":";;;AAAA,yCAA8C;AAC9C,+CAAuD;AAEvD,6CAAoD;AAEvC,QAAA,MAAM,GAAG;IACpB,MAAM,EAAE,IAAI,yBAAW,EAAmB;IAC1C,IAAI,EAAE,IAAI,qBAAS,EAAiB;IACpC,OAAO,EAAE,IAAI,2BAAY,EAAoB;CAC9C,CAAC"}
|
|
1
|
+
{"version":3,"file":"tables.js","sourceRoot":"","sources":["../../../src/tables/tables.ts"],"names":[],"mappings":";;;AAAA,uDAAmE;AACnE,yCAA8C;AAC9C,+CAAuD;AAEvD,6CAAoD;AAEvC,QAAA,MAAM,GAAG;IACpB,WAAW,EAAE,IAAI,mCAAgB,EAAwB;IACzD,MAAM,EAAE,IAAI,yBAAW,EAAmB;IAC1C,IAAI,EAAE,IAAI,qBAAS,EAAiB;IACpC,OAAO,EAAE,IAAI,2BAAY,EAAoB;CAC9C,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import moment from 'moment';
|
|
2
|
+
import { Reference, Table } from '@proteinjs/db';
|
|
3
|
+
import { SharedRecord } from '../src/SharedRecord';
|
|
4
|
+
export interface SharedItem extends SharedRecord {
|
|
5
|
+
name: string;
|
|
6
|
+
}
|
|
7
|
+
export declare class SharedItemTable extends Table<SharedItem> {
|
|
8
|
+
name: string;
|
|
9
|
+
columns: {
|
|
10
|
+
id: import("@proteinjs/db").Column<string, any>;
|
|
11
|
+
created: import("@proteinjs/db").Column<moment.Moment, any>;
|
|
12
|
+
updated: import("@proteinjs/db").Column<moment.Moment, any>;
|
|
13
|
+
permissionSource: import("@proteinjs/db").Column<Reference<any>, any>;
|
|
14
|
+
permissionSourceTable: import("@proteinjs/db").Column<string, any>;
|
|
15
|
+
} & {} & {
|
|
16
|
+
name: import("@proteinjs/db").Column<string, any>;
|
|
17
|
+
} & {};
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=SharedRecord.test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SharedRecord.test.d.ts","sourceRoot":"","sources":["../../test/SharedRecord.test.ts"],"names":[],"mappings":"AAEA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAuB,SAAS,EAAgB,KAAK,EAAE,MAAM,eAAe,CAAC;AAEpF,OAAO,EAAoC,YAAY,EAA2B,MAAM,qBAAqB,CAAC;AAM9G,MAAM,WAAW,UAAW,SAAQ,YAAY;IAC9C,IAAI,EAAE,MAAM,CAAC;CACd;AA8CD,qBAAa,eAAgB,SAAQ,KAAK,CAAC,UAAU,CAAC;IACpD,IAAI,SAA2B;IAC/B,OAAO;;;;;;;;WAEJ;CACJ"}
|