@things-factory/auth-base 9.0.0-beta.8 → 9.0.2
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/config/config.development.js +1 -0
- package/dist-client/auth.js +2 -7
- package/dist-client/auth.js.map +1 -1
- package/dist-client/reducers/auth.js +9 -2
- package/dist-client/reducers/auth.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/controllers/change-pwd.js +5 -2
- package/dist-server/controllers/change-pwd.js.map +1 -1
- package/dist-server/controllers/checkin.js +1 -1
- package/dist-server/controllers/checkin.js.map +1 -1
- package/dist-server/controllers/delete-user.js +2 -2
- package/dist-server/controllers/delete-user.js.map +1 -1
- package/dist-server/controllers/profile.js +4 -1
- package/dist-server/controllers/profile.js.map +1 -1
- package/dist-server/controllers/reset-password.js +5 -2
- package/dist-server/controllers/reset-password.js.map +1 -1
- package/dist-server/controllers/signin.js +2 -2
- package/dist-server/controllers/signin.js.map +1 -1
- package/dist-server/controllers/signup.js +8 -1
- package/dist-server/controllers/signup.js.map +1 -1
- package/dist-server/errors/auth-error.js +3 -1
- package/dist-server/errors/auth-error.js.map +1 -1
- package/dist-server/middlewares/authenticate-401-middleware.js +22 -9
- package/dist-server/middlewares/authenticate-401-middleware.js.map +1 -1
- package/dist-server/middlewares/bypass-signin-middleware.d.ts +1 -0
- package/dist-server/middlewares/bypass-signin-middleware.js +20 -0
- package/dist-server/middlewares/bypass-signin-middleware.js.map +1 -0
- package/dist-server/middlewares/domain-authenticate-middleware.js +1 -5
- package/dist-server/middlewares/domain-authenticate-middleware.js.map +1 -1
- package/dist-server/middlewares/index.js +6 -1
- package/dist-server/middlewares/index.js.map +1 -1
- package/dist-server/middlewares/jwt-authenticate-middleware.js +1 -1
- package/dist-server/middlewares/jwt-authenticate-middleware.js.map +1 -1
- package/dist-server/migrations/1548206416130-SeedUser.js +11 -3
- package/dist-server/migrations/1548206416130-SeedUser.js.map +1 -1
- package/dist-server/router/auth-checkin-router.js +11 -13
- package/dist-server/router/auth-checkin-router.js.map +1 -1
- package/dist-server/router/auth-private-process-router.js +10 -4
- package/dist-server/router/auth-private-process-router.js.map +1 -1
- package/dist-server/router/auth-signup-router.js +5 -2
- package/dist-server/router/auth-signup-router.js.map +1 -1
- package/dist-server/router/oauth2/oauth2-authorize-router.js +5 -2
- package/dist-server/router/oauth2/oauth2-authorize-router.js.map +1 -1
- package/dist-server/router/oauth2/oauth2-router.js +1 -2
- package/dist-server/router/oauth2/oauth2-router.js.map +1 -1
- package/dist-server/router/oauth2/oauth2-server.js +21 -3
- package/dist-server/router/oauth2/oauth2-server.js.map +1 -1
- package/dist-server/router/site-root-router.js +1 -1
- package/dist-server/router/site-root-router.js.map +1 -1
- package/dist-server/router/webauthn-router.js +1 -1
- package/dist-server/router/webauthn-router.js.map +1 -1
- package/dist-server/routes.js +74 -48
- package/dist-server/routes.js.map +1 -1
- package/dist-server/service/app-binding/app-binding-types.js +3 -3
- package/dist-server/service/app-binding/app-binding-types.js.map +1 -1
- package/dist-server/service/app-binding/app-binding.js +6 -4
- package/dist-server/service/app-binding/app-binding.js.map +1 -1
- package/dist-server/service/appliance/appliance-mutation.js +37 -34
- package/dist-server/service/appliance/appliance-mutation.js.map +1 -1
- package/dist-server/service/appliance/appliance-types.js +18 -18
- package/dist-server/service/appliance/appliance-types.js.map +1 -1
- package/dist-server/service/appliance/appliance.d.ts +2 -0
- package/dist-server/service/appliance/appliance.js +61 -14
- package/dist-server/service/appliance/appliance.js.map +1 -1
- package/dist-server/service/application/application-mutation.js +22 -4
- package/dist-server/service/application/application-mutation.js.map +1 -1
- package/dist-server/service/application/application-types.js +24 -24
- package/dist-server/service/application/application-types.js.map +1 -1
- package/dist-server/service/application/application.d.ts +6 -6
- package/dist-server/service/application/application.js +22 -22
- package/dist-server/service/application/application.js.map +1 -1
- package/dist-server/service/auth-provider/auth-provider-mutation.js +29 -7
- package/dist-server/service/auth-provider/auth-provider-mutation.js.map +1 -1
- package/dist-server/service/auth-provider/auth-provider-parameter-spec.js +12 -7
- package/dist-server/service/auth-provider/auth-provider-parameter-spec.js.map +1 -1
- package/dist-server/service/auth-provider/auth-provider-type.js +24 -21
- package/dist-server/service/auth-provider/auth-provider-type.js.map +1 -1
- package/dist-server/service/auth-provider/auth-provider.js +35 -25
- package/dist-server/service/auth-provider/auth-provider.js.map +1 -1
- package/dist-server/service/domain-generator/domain-generator-mutation.js +1 -2
- package/dist-server/service/domain-generator/domain-generator-mutation.js.map +1 -1
- package/dist-server/service/domain-generator/domain-generator-types.js +17 -14
- package/dist-server/service/domain-generator/domain-generator-types.js.map +1 -1
- package/dist-server/service/domain-link/domain-link-mutation.d.ts +9 -0
- package/dist-server/service/domain-link/domain-link-mutation.js +133 -0
- package/dist-server/service/domain-link/domain-link-mutation.js.map +1 -0
- package/dist-server/service/domain-link/domain-link-query.d.ts +11 -0
- package/dist-server/service/domain-link/domain-link-query.js +75 -0
- package/dist-server/service/domain-link/domain-link-query.js.map +1 -0
- package/dist-server/service/domain-link/domain-link-types.d.ts +18 -0
- package/dist-server/service/domain-link/domain-link-types.js +66 -0
- package/dist-server/service/domain-link/domain-link-types.js.map +1 -0
- package/dist-server/service/domain-link/domain-link.d.ts +28 -0
- package/dist-server/service/domain-link/domain-link.js +105 -0
- package/dist-server/service/domain-link/domain-link.js.map +1 -0
- package/dist-server/service/domain-link/index.d.ts +6 -0
- package/dist-server/service/domain-link/index.js +10 -0
- package/dist-server/service/domain-link/index.js.map +1 -0
- package/dist-server/service/granted-role/granted-role-mutation.js +7 -7
- package/dist-server/service/granted-role/granted-role-mutation.js.map +1 -1
- package/dist-server/service/granted-role/granted-role.js +4 -4
- package/dist-server/service/granted-role/granted-role.js.map +1 -1
- package/dist-server/service/index.d.ts +3 -1
- package/dist-server/service/index.js +7 -2
- package/dist-server/service/index.js.map +1 -1
- package/dist-server/service/invitation/invitation-mutation.js +6 -2
- package/dist-server/service/invitation/invitation-mutation.js.map +1 -1
- package/dist-server/service/invitation/invitation-types.js +3 -3
- package/dist-server/service/invitation/invitation-types.js.map +1 -1
- package/dist-server/service/invitation/invitation.js +10 -10
- package/dist-server/service/invitation/invitation.js.map +1 -1
- package/dist-server/service/login-history/login-history-type.js +3 -3
- package/dist-server/service/login-history/login-history-type.js.map +1 -1
- package/dist-server/service/login-history/login-history.js +6 -6
- package/dist-server/service/login-history/login-history.js.map +1 -1
- package/dist-server/service/partner/partner-types.js +3 -3
- package/dist-server/service/partner/partner-types.js.map +1 -1
- package/dist-server/service/partner/partner.js +8 -8
- package/dist-server/service/partner/partner.js.map +1 -1
- package/dist-server/service/password-history/password-history.js +3 -3
- package/dist-server/service/password-history/password-history.js.map +1 -1
- package/dist-server/service/privilege/privilege-directive.js +1 -2
- package/dist-server/service/privilege/privilege-directive.js.map +1 -1
- package/dist-server/service/privilege/privilege-mutation.js +11 -2
- package/dist-server/service/privilege/privilege-mutation.js.map +1 -1
- package/dist-server/service/privilege/privilege.js +20 -20
- package/dist-server/service/privilege/privilege.js.map +1 -1
- package/dist-server/service/role/role-mutation.js +12 -2
- package/dist-server/service/role/role-mutation.js.map +1 -1
- package/dist-server/service/role/role-query.d.ts +7 -3
- package/dist-server/service/role/role-query.js +18 -10
- package/dist-server/service/role/role-query.js.map +1 -1
- package/dist-server/service/role/role-types.d.ts +4 -0
- package/dist-server/service/role/role-types.js +41 -27
- package/dist-server/service/role/role-types.js.map +1 -1
- package/dist-server/service/role/role.js +11 -11
- package/dist-server/service/role/role.js.map +1 -1
- package/dist-server/service/user/user-mutation.js +89 -41
- package/dist-server/service/user/user-mutation.js.map +1 -1
- package/dist-server/service/user/user-query.d.ts +1 -0
- package/dist-server/service/user/user-query.js +25 -9
- package/dist-server/service/user/user-query.js.map +1 -1
- package/dist-server/service/user/user-types.js +35 -32
- package/dist-server/service/user/user-types.js.map +1 -1
- package/dist-server/service/user/user.d.ts +5 -5
- package/dist-server/service/user/user.js +30 -22
- package/dist-server/service/user/user.js.map +1 -1
- package/dist-server/service/users-auth-providers/users-auth-providers.js +11 -8
- package/dist-server/service/users-auth-providers/users-auth-providers.js.map +1 -1
- package/dist-server/service/verification-token/verification-token.d.ts +3 -3
- package/dist-server/service/verification-token/verification-token.js +8 -8
- package/dist-server/service/verification-token/verification-token.js.map +1 -1
- package/dist-server/service/web-auth-credential/web-auth-credential.js +11 -10
- package/dist-server/service/web-auth-credential/web-auth-credential.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/dist-server/utils/access-token-cookie.js +1 -11
- package/dist-server/utils/access-token-cookie.js.map +1 -1
- package/dist-server/utils/check-user-belongs-domain.js +1 -2
- package/dist-server/utils/check-user-belongs-domain.js.map +1 -1
- package/dist-server/utils/get-domain-users.js +2 -2
- package/dist-server/utils/get-domain-users.js.map +1 -1
- package/dist-server/utils/get-user-domains.d.ts +0 -1
- package/dist-server/utils/get-user-domains.js +28 -22
- package/dist-server/utils/get-user-domains.js.map +1 -1
- package/package.json +6 -6
- package/dist-server/utils/get-domain-from-hostname.d.ts +0 -1
- package/dist-server/utils/get-domain-from-hostname.js +0 -9
- package/dist-server/utils/get-domain-from-hostname.js.map +0 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"granted-role-mutation.js","sourceRoot":"","sources":["../../../server/service/granted-role/granted-role-mutation.ts"],"names":[],"mappings":";;;AAkFA,0DAQC;AAED,0DA4BC;AAkBD,sDAiBC;;AA3JD,+CAAsE;AACtE,qCAA4D;AAE5D,iDAA6D;AAE7D,sDAA+C;AAC/C,6CAAsC;AACtC,yDAAiD;AACjD,6CAAsC;AACtC,uDAA+C;AAGxC,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;IAIxB,AAAN,KAAK,CAAC,UAAU,CACK,UAAkB,EACF,KAAkB,EAC9C,OAAwB;QAE/B,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QACpC,iEAAiE;QACjE,MAAM,cAAc,GAAW,MAAM,EAAE,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aAAZ,YAAY,uBAAZ,YAAY,CAAE,MAAM;QAAE,MAAM,eAAe,CAAC,MAAM,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,WAAwB,EAAE,EAAE,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,CAAA;AACxH,CAAC","sourcesContent":["import { Arg, Ctx, Directive, Mutation, Resolver } from 'type-graphql'\nimport { EntityManager, In, Not, Repository } from 'typeorm'\n\nimport { Domain, getRepository } from '@things-factory/shell'\n\nimport { Partner } from '../partner/partner.js'\nimport { Role } from '../role/role.js'\nimport { RolePatch } from '../role/role-types.js'\nimport { User } from '../user/user.js'\nimport { GrantedRole } from './granted-role.js'\n\n@Resolver(GrantedRole)\nexport class GrantedRoleMutation {\n @Directive('@privilege(category: \"partner\", privilege: \"mutation\")')\n @Directive('@transaction')\n @Mutation(returns => Boolean)\n async grantRoles(\n @Arg('customerId') customerId: string,\n @Arg('roles', type => [RolePatch]) roles: RolePatch[],\n @Ctx() context: ResolverContext\n ): Promise<Boolean> {\n const { tx, domain } = context.state\n // Check if current domain has partnership with passed `customer`\n const customerDomain: Domain = await tx.getRepository(Domain).findOneBy({ id: customerId })\n const customer: Partner = await tx.getRepository(Partner).findOne({\n where: { domain: { id: domain.id }, partnerDomain: { id: customerDomain.id } }\n })\n\n if (!customer) throw new Error(`Failed to find partnership with customer`)\n\n // Remove existing granted roles\n const grantedRoles: GrantedRole[] = await getGrantedRolesToCustomer(domain, customerDomain, tx)\n if (grantedRoles.length) {\n await tx.getRepository(GrantedRole).delete(grantedRoles.map((gr: GrantedRole) => gr.id))\n }\n\n // Insert newly granted roles\n await tx.getRepository(Role).findBy({\n id: In(roles.map((role: Partial<Role>) => role.id))\n })\n const newlyGrantedRoles: Partial<GrantedRole>[] = roles.map((role: Role) => {\n return {\n domain: customerDomain,\n role\n }\n })\n\n await tx.getRepository(GrantedRole).save(newlyGrantedRoles)\n\n // If there's someone having role which will be removed (refuse roles)\n // user roles should be removed as well\n const grantedRoleIds: string[] = roles.map((role: Partial<Role>) => role.id)\n const nonGrantedRoles: Role[] = await tx.getRepository(Role).find({\n where: { domain: { id: domain.id }, id: Not(In(grantedRoleIds)) }\n })\n\n if (nonGrantedRoles?.length) {\n // Find customer's user who has non granted roles already\n const nonGrantedRoleIds: string[] = nonGrantedRoles.map((role: Role) => role.id)\n\n let havingRefusedRoleCustomers: User[] = await getCustomerUsersByRoles(customerDomain, nonGrantedRoles, tx)\n havingRefusedRoleCustomers = havingRefusedRoleCustomers.map((customerUser: User) => {\n const customerDomains: Domain[] = customerUser.domains\n const customerDomainIds: string[] = customerDomains.map((domain: Domain) => domain.id)\n if (customerDomainIds.indexOf(domain.id) >= 0) {\n // Case for customer user is a member of current domain.\n // If user is a member of current domain user can have any roles of the domain even if the roles is not granted\n return customerUser\n } else {\n // Case for customer user is an user of partner domain.\n // An user of partner domain only can have granted roles\n customerUser.roles = customerUser.roles.filter((role: Role) => nonGrantedRoleIds.indexOf(role.id) < 0)\n return customerUser\n }\n })\n\n await tx.getRepository(User).save(havingRefusedRoleCustomers)\n }\n return true\n }\n}\n\nexport async function getGrantedCustomerUsers(\n domain: Domain,\n customerDomain: Domain,\n trx?: EntityManager\n): Promise<User[]> {\n const grantedRoles: GrantedRole[] = await getGrantedRolesToCustomer(domain, customerDomain, trx)\n const roles: Role[] = grantedRoles.map((grantedRole: GrantedRole) => grantedRole.role)\n return await getCustomerUsersByRoles(customerDomain, roles, trx)\n}\n\nexport async function getCustomerUsersByRoles(\n customerDomain: Domain,\n roles: Role[],\n trx?: EntityManager\n): Promise<User[]> {\n if (!roles.length) return []\n const userRepo: Repository<User> = trx?.getRepository(User) || getRepository(User)\n\n const customerUsers: User[] = await userRepo\n .createQueryBuilder('USER')\n .select('USER.id')\n .distinct(true)\n .leftJoin('USER.domains', 'U_DOMAIN')\n .leftJoin('USER.roles', 'U_ROLE')\n .where('U_DOMAIN.id = :customerDomainId', { customerDomainId: customerDomain.id })\n .groupBy('USER.id')\n .addGroupBy('U_ROLE.id')\n .having('U_ROLE.id IN (:...roleIds)', {\n roleIds: roles.map((role: Role) => role.id)\n })\n .getMany()\n\n return await userRepo.find({\n where: {\n id: In(customerUsers.map((user: User) => user.id))\n },\n relations: ['domains', 'roles', 'roles.domain']\n })\n}\n\nasync function getGrantedRolesToCustomer(\n domain: Domain,\n customerDomain: Domain,\n trx?: EntityManager\n): Promise<GrantedRole[]> {\n const grantedRoleRepo: Repository<GrantedRole> = trx?.getRepository(GrantedRole) || getRepository(GrantedRole)\n const grantedRoleQueryBuilder = grantedRoleRepo.createQueryBuilder('GRANTED_ROLE')\n return await grantedRoleQueryBuilder\n .leftJoinAndSelect('GRANTED_ROLE.domain', 'DOMAIN')\n .leftJoinAndSelect('GRANTED_ROLE.role', 'ROLE')\n .leftJoin('ROLE.domain', 'R_DOMAIN')\n .where('R_DOMAIN.id = :domainId', { domainId: domain.id })\n .andWhere('DOMAIN.id = :customerDomainId', { customerDomainId: customerDomain.id })\n .getMany()\n}\n\nexport async function terminateGrantedRoles(\n domain: Domain,\n customerDomain: Domain,\n trx?: EntityManager\n): Promise<void> {\n const userRepo: Repository<User> = trx?.getRepository(User) || getRepository(User)\n const grantedRoleRepo: Repository<GrantedRole> = trx?.getRepository(GrantedRole) || getRepository(GrantedRole)\n\n const grantedRoles: GrantedRole[] = await getGrantedRolesToCustomer(domain, customerDomain, trx)\n const customerUsers: User[] = await getGrantedCustomerUsers(domain, customerDomain, trx)\n\n for (let i: number = 0; i < customerUsers.length; i++) {\n customerUsers[i].roles = customerUsers[i].roles.filter((role: Role) => role.domain.id !== domain.id)\n }\n\n if (customerUsers?.length) await userRepo.save(customerUsers)\n if (grantedRoles?.length) await grantedRoleRepo.delete(grantedRoles.map((grantedRole: GrantedRole) => grantedRole.id))\n}\n"]}
|
1
|
+
{"version":3,"file":"granted-role-mutation.js","sourceRoot":"","sources":["../../../server/service/granted-role/granted-role-mutation.ts"],"names":[],"mappings":";;;AAkFA,0DAQC;AAED,0DA4BC;AAkBD,sD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,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,KAAK,MAAM,CAAC,EAAE,CAAC,CAAA;IACtG,CAAC;IAED,IAAI,aAAa,EAAE,MAAM;QAAE,MAAM,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,CAAA;IAC7D,IAAI,YAAY,EAAE,MAAM;QAAE,MAAM,eAAe,CAAC,MAAM,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,WAAwB,EAAE,EAAE,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,CAAA;AACxH,CAAC","sourcesContent":["import { Arg, Ctx, Directive, Mutation, Resolver } from 'type-graphql'\nimport { EntityManager, In, Not, Repository } from 'typeorm'\n\nimport { Domain, getRepository } from '@things-factory/shell'\n\nimport { Partner } from '../partner/partner.js'\nimport { Role } from '../role/role.js'\nimport { RolePatch } from '../role/role-types.js'\nimport { User } from '../user/user.js'\nimport { GrantedRole } from './granted-role.js'\n\n@Resolver(GrantedRole)\nexport class GrantedRoleMutation {\n @Directive('@privilege(category: \"partner\", privilege: \"mutation\")')\n @Directive('@transaction')\n @Mutation(returns => Boolean)\n async grantRoles(\n @Arg('customerId') customerId: string,\n @Arg('roles', type => [RolePatch]) roles: RolePatch[],\n @Ctx() context: ResolverContext\n ): Promise<Boolean> {\n const { tx, domain } = context.state\n // Check if current domain has partnership with passed `customer`\n const customerDomain: Domain = await tx.getRepository(Domain).findOneBy({ id: customerId })\n const customer: Partner = await tx.getRepository(Partner).findOne({\n where: { domain: { id: domain.id }, partnerDomain: { id: customerDomain.id } }\n })\n\n if (!customer) throw new Error(`Failed to find partnership with customer`)\n\n // Remove existing granted roles\n const grantedRoles: GrantedRole[] = await getGrantedRolesToCustomer(domain, customerDomain, tx)\n if (grantedRoles.length) {\n await tx.getRepository(GrantedRole).delete(grantedRoles.map((gr: GrantedRole) => gr.id))\n }\n\n // Insert newly granted roles\n await tx.getRepository(Role).findBy({\n id: In(roles.map((role: Partial<Role>) => role.id))\n })\n const newlyGrantedRoles: Partial<GrantedRole>[] = roles.map((role: Role) => {\n return {\n domain: customerDomain,\n role\n }\n })\n\n await tx.getRepository(GrantedRole).save(newlyGrantedRoles)\n\n // If there's someone having role which will be removed (refuse roles)\n // user roles should be removed as well\n const grantedRoleIds: string[] = roles.map((role: Partial<Role>) => role.id)\n const nonGrantedRoles: Role[] = await tx.getRepository(Role).find({\n where: { domain: { id: domain.id }, id: Not(In(grantedRoleIds)) }\n })\n\n if (nonGrantedRoles?.length) {\n // Find customer's user who has non granted roles already\n const nonGrantedRoleIds: string[] = nonGrantedRoles.map((role: Role) => role.id)\n\n let havingRefusedRoleCustomers: User[] = await getCustomerUsersByRoles(customerDomain, nonGrantedRoles, tx)\n havingRefusedRoleCustomers = havingRefusedRoleCustomers.map((customerUser: User) => {\n const customerDomains: Domain[] = customerUser.domains\n const customerDomainIds: string[] = customerDomains.map((domain: Domain) => domain.id)\n if (customerDomainIds.indexOf(domain.id) >= 0) {\n // Case for customer user is a member of current domain.\n // If user is a member of current domain user can have any roles of the domain even if the roles is not granted\n return customerUser\n } else {\n // Case for customer user is an user of partner domain.\n // An user of partner domain only can have granted roles\n customerUser.roles = customerUser.roles.filter((role: Role) => nonGrantedRoleIds.indexOf(role.id) < 0)\n return customerUser\n }\n })\n\n await tx.getRepository(User).save(havingRefusedRoleCustomers)\n }\n return true\n }\n}\n\nexport async function getGrantedCustomerUsers(\n domain: Domain,\n customerDomain: Domain,\n trx?: EntityManager\n): Promise<User[]> {\n const grantedRoles: GrantedRole[] = await getGrantedRolesToCustomer(domain, customerDomain, trx)\n const roles: Role[] = grantedRoles.map((grantedRole: GrantedRole) => grantedRole.role)\n return await getCustomerUsersByRoles(customerDomain, roles, trx)\n}\n\nexport async function getCustomerUsersByRoles(\n customerDomain: Domain,\n roles: Role[],\n trx?: EntityManager\n): Promise<User[]> {\n if (!roles.length) return []\n const userRepo: Repository<User> = trx?.getRepository(User) || getRepository(User)\n\n const customerUsers: User[] = await userRepo\n .createQueryBuilder('USER')\n .select('USER.id')\n .distinct(true)\n .leftJoin('USER.domains', 'U_DOMAIN')\n .leftJoin('USER.roles', 'U_ROLE')\n .where('U_DOMAIN.id = :customerDomainId', { customerDomainId: customerDomain.id })\n .groupBy('USER.id')\n .addGroupBy('U_ROLE.id')\n .having('U_ROLE.id IN (:...roleIds)', {\n roleIds: roles.map((role: Role) => role.id)\n })\n .getMany()\n\n return await userRepo.find({\n where: {\n id: In(customerUsers.map((user: User) => user.id))\n },\n relations: ['domains', 'roles', 'roles.domain']\n })\n}\n\nasync function getGrantedRolesToCustomer(\n domain: Domain,\n customerDomain: Domain,\n trx?: EntityManager\n): Promise<GrantedRole[]> {\n const grantedRoleRepo: Repository<GrantedRole> = trx?.getRepository(GrantedRole) || getRepository(GrantedRole)\n const grantedRoleQueryBuilder = grantedRoleRepo.createQueryBuilder('GRANTED_ROLE')\n return await grantedRoleQueryBuilder\n .leftJoinAndSelect('GRANTED_ROLE.domain', 'DOMAIN')\n .leftJoinAndSelect('GRANTED_ROLE.role', 'ROLE')\n .leftJoin('ROLE.domain', 'R_DOMAIN')\n .where('R_DOMAIN.id = :domainId', { domainId: domain.id })\n .andWhere('DOMAIN.id = :customerDomainId', { customerDomainId: customerDomain.id })\n .getMany()\n}\n\nexport async function terminateGrantedRoles(\n domain: Domain,\n customerDomain: Domain,\n trx?: EntityManager\n): Promise<void> {\n const userRepo: Repository<User> = trx?.getRepository(User) || getRepository(User)\n const grantedRoleRepo: Repository<GrantedRole> = trx?.getRepository(GrantedRole) || getRepository(GrantedRole)\n\n const grantedRoles: GrantedRole[] = await getGrantedRolesToCustomer(domain, customerDomain, trx)\n const customerUsers: User[] = await getGrantedCustomerUsers(domain, customerDomain, trx)\n\n for (let i: number = 0; i < customerUsers.length; i++) {\n customerUsers[i].roles = customerUsers[i].roles.filter((role: Role) => role.domain.id !== domain.id)\n }\n\n if (customerUsers?.length) await userRepo.save(customerUsers)\n if (grantedRoles?.length) await grantedRoleRepo.delete(grantedRoles.map((grantedRole: GrantedRole) => grantedRole.id))\n}\n"]}
|
@@ -11,12 +11,12 @@ let GrantedRole = class GrantedRole {
|
|
11
11
|
exports.GrantedRole = GrantedRole;
|
12
12
|
tslib_1.__decorate([
|
13
13
|
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
14
|
-
(0, type_graphql_1.Field)(type => type_graphql_1.ID),
|
14
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.ID, { description: 'Unique identifier for the granted role.' }),
|
15
15
|
tslib_1.__metadata("design:type", String)
|
16
16
|
], GrantedRole.prototype, "id", void 0);
|
17
17
|
tslib_1.__decorate([
|
18
18
|
(0, typeorm_1.ManyToOne)(type => role_js_1.Role),
|
19
|
-
(0, type_graphql_1.Field)(),
|
19
|
+
(0, type_graphql_1.Field)({ description: 'The role being granted.' }),
|
20
20
|
tslib_1.__metadata("design:type", role_js_1.Role)
|
21
21
|
], GrantedRole.prototype, "role", void 0);
|
22
22
|
tslib_1.__decorate([
|
@@ -25,7 +25,7 @@ tslib_1.__decorate([
|
|
25
25
|
], GrantedRole.prototype, "roleId", void 0);
|
26
26
|
tslib_1.__decorate([
|
27
27
|
(0, typeorm_1.ManyToOne)(type => shell_1.Domain),
|
28
|
-
(0, type_graphql_1.Field)(type => shell_1.Domain),
|
28
|
+
(0, type_graphql_1.Field)(type => shell_1.Domain, { description: 'The domain to which the role is granted.' }),
|
29
29
|
tslib_1.__metadata("design:type", shell_1.Domain)
|
30
30
|
], GrantedRole.prototype, "domain", void 0);
|
31
31
|
tslib_1.__decorate([
|
@@ -35,6 +35,6 @@ tslib_1.__decorate([
|
|
35
35
|
exports.GrantedRole = GrantedRole = tslib_1.__decorate([
|
36
36
|
(0, typeorm_1.Entity)(),
|
37
37
|
(0, typeorm_1.Index)('ix_granted_role_0', (grantedRole) => [grantedRole.role, grantedRole.domain], { unique: true }),
|
38
|
-
(0, type_graphql_1.ObjectType)()
|
38
|
+
(0, type_graphql_1.ObjectType)({ description: 'Represents a role that is granted to a specific domain.' })
|
39
39
|
], GrantedRole);
|
40
40
|
//# sourceMappingURL=granted-role.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"granted-role.js","sourceRoot":"","sources":["../../../server/service/granted-role/granted-role.ts"],"names":[],"mappings":";;;;AAAA,iDAA8C;AAC9C,6CAAsC;AACtC,+CAAoD;AACpD,qCAAsF;AAK/E,IAAM,WAAW,GAAjB,MAAM,WAAW;CAkBvB,CAAA;AAlBY,kCAAW;AAGb;IAFR,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,CAAC;;
|
1
|
+
{"version":3,"file":"granted-role.js","sourceRoot":"","sources":["../../../server/service/granted-role/granted-role.ts"],"names":[],"mappings":";;;;AAAA,iDAA8C;AAC9C,6CAAsC;AACtC,+CAAoD;AACpD,qCAAsF;AAK/E,IAAM,WAAW,GAAjB,MAAM,WAAW;CAkBvB,CAAA;AAlBY,kCAAW;AAGb;IAFR,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,EAAE,EAAE,WAAW,EAAE,yCAAyC,EAAE,CAAC;;uCAC3D;AAInB;IAFC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,cAAI,CAAC;IACvB,IAAA,oBAAK,EAAC,EAAE,WAAW,EAAE,yBAAyB,EAAE,CAAC;sCAC5C,cAAI;yCAAA;AAGV;IADC,IAAA,oBAAU,EAAC,CAAC,WAAwB,EAAE,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC;;2CAC7C;AAId;IAFC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;IACzB,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,EAAE,EAAE,WAAW,EAAE,0CAA0C,EAAE,CAAC;sCAC1E,cAAM;2CAAA;AAGf;IADC,IAAA,oBAAU,EAAC,CAAC,WAAwB,EAAE,EAAE,CAAC,WAAW,CAAC,MAAM,CAAC;;6CAC7C;sBAjBL,WAAW;IAHvB,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EAAC,mBAAmB,EAAE,CAAC,WAAwB,EAAE,EAAE,CAAC,CAAC,WAAW,CAAC,IAAI,EAAE,WAAW,CAAC,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IAClH,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,yDAAyD,EAAE,CAAC;GAC1E,WAAW,CAkBvB","sourcesContent":["import { Domain } from '@things-factory/shell'\nimport { Role } from '../role/role.js'\nimport { ObjectType, Field, ID } from 'type-graphql'\nimport { Entity, ManyToOne, PrimaryGeneratedColumn, Index, RelationId } from 'typeorm'\n\n@Entity()\n@Index('ix_granted_role_0', (grantedRole: GrantedRole) => [grantedRole.role, grantedRole.domain], { unique: true })\n@ObjectType({ description: 'Represents a role that is granted to a specific domain.' })\nexport class GrantedRole {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID, { description: 'Unique identifier for the granted role.' })\n readonly id: string\n\n @ManyToOne(type => Role)\n @Field({ description: 'The role being granted.' })\n role: Role\n\n @RelationId((grantedRole: GrantedRole) => grantedRole.role)\n roleId: string\n\n @ManyToOne(type => Domain)\n @Field(type => Domain, { description: 'The domain to which the role is granted.' })\n domain?: Domain\n\n @RelationId((grantedRole: GrantedRole) => grantedRole.domain)\n domainId: string\n}\n"]}
|
@@ -13,6 +13,7 @@ export * from './password-history/password-history.js';
|
|
13
13
|
export * from './verification-token/verification-token.js';
|
14
14
|
export * from './login-history/login-history.js';
|
15
15
|
export * from './web-auth-credential/web-auth-credential.js';
|
16
|
+
export * from './domain-link/domain-link.js';
|
16
17
|
export * from './app-binding/app-binding-types.js';
|
17
18
|
export * from './appliance/appliance-types.js';
|
18
19
|
export * from './application/application-types.js';
|
@@ -22,7 +23,8 @@ export * from './partner/partner-types.js';
|
|
22
23
|
export * from './privilege/privilege-types.js';
|
23
24
|
export * from './role/role-types.js';
|
24
25
|
export * from './user/user-types.js';
|
25
|
-
export
|
26
|
+
export * from './domain-link/domain-link-types.js';
|
27
|
+
export declare const entities: (typeof import("./web-auth-credential/web-auth-credential.js").WebAuthCredential | typeof import("./user/user.js").User | typeof import("./auth-provider/auth-provider.js").AuthProvider | typeof import("./users-auth-providers/users-auth-providers.js").UsersAuthProviders | typeof import("./role/role.js").Role | typeof import("./privilege/privilege.js").Privilege | typeof import("./verification-token/verification-token.js").VerificationToken | typeof import("./verification-token/verification-token.js").VerificationTokenType | typeof import("./password-history/password-history.js").PasswordHistory | typeof import("./invitation/invitation.js").Invitation | typeof import("./application/application.js").Application | typeof import("./login-history/login-history.js").LoginHistory | typeof import("./appliance/appliance.js").Appliance | typeof import("./granted-role/granted-role.js").GrantedRole | typeof import("./partner/partner.js").Partner | typeof import("./domain-link/domain-link.js").DomainLink)[];
|
26
28
|
export declare const schema: {
|
27
29
|
typeDefs: {
|
28
30
|
privilegeDirectiveTypeDefs: import("graphql").DocumentNode;
|
@@ -20,6 +20,7 @@ const index_js_13 = require("./role/index.js");
|
|
20
20
|
const index_js_14 = require("./user/index.js");
|
21
21
|
const index_js_15 = require("./verification-token/index.js");
|
22
22
|
const index_js_16 = require("./web-auth-credential/index.js");
|
23
|
+
const index_js_17 = require("./domain-link/index.js");
|
23
24
|
/* EXPORT ENTITY TYPES */
|
24
25
|
tslib_1.__exportStar(require("./users-auth-providers/users-auth-providers.js"), exports);
|
25
26
|
tslib_1.__exportStar(require("./auth-provider/auth-provider.js"), exports);
|
@@ -36,6 +37,7 @@ tslib_1.__exportStar(require("./password-history/password-history.js"), exports)
|
|
36
37
|
tslib_1.__exportStar(require("./verification-token/verification-token.js"), exports);
|
37
38
|
tslib_1.__exportStar(require("./login-history/login-history.js"), exports);
|
38
39
|
tslib_1.__exportStar(require("./web-auth-credential/web-auth-credential.js"), exports);
|
40
|
+
tslib_1.__exportStar(require("./domain-link/domain-link.js"), exports);
|
39
41
|
/* EXPORT TYPES */
|
40
42
|
tslib_1.__exportStar(require("./app-binding/app-binding-types.js"), exports);
|
41
43
|
tslib_1.__exportStar(require("./appliance/appliance-types.js"), exports);
|
@@ -46,6 +48,7 @@ tslib_1.__exportStar(require("./partner/partner-types.js"), exports);
|
|
46
48
|
tslib_1.__exportStar(require("./privilege/privilege-types.js"), exports);
|
47
49
|
tslib_1.__exportStar(require("./role/role-types.js"), exports);
|
48
50
|
tslib_1.__exportStar(require("./user/user-types.js"), exports);
|
51
|
+
tslib_1.__exportStar(require("./domain-link/domain-link-types.js"), exports);
|
49
52
|
exports.entities = [
|
50
53
|
/* ENTITIES */
|
51
54
|
...index_js_1.entities,
|
@@ -61,7 +64,8 @@ exports.entities = [
|
|
61
64
|
...index_js_11.entities,
|
62
65
|
...index_js_15.entities,
|
63
66
|
...index_js_9.entities,
|
64
|
-
...index_js_16.entities
|
67
|
+
...index_js_16.entities,
|
68
|
+
...index_js_17.entities
|
65
69
|
];
|
66
70
|
exports.schema = {
|
67
71
|
typeDefs: {
|
@@ -81,7 +85,8 @@ exports.schema = {
|
|
81
85
|
...index_js_8.resolvers,
|
82
86
|
...index_js_3.resolvers,
|
83
87
|
...index_js_6.resolvers,
|
84
|
-
...index_js_9.resolvers
|
88
|
+
...index_js_9.resolvers,
|
89
|
+
...index_js_17.resolvers
|
85
90
|
],
|
86
91
|
directives: {
|
87
92
|
privilege: privilege_directive_js_1.privilegeDirectiveResolver
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/service/index.ts"],"names":[],"mappings":";;;;AAAA,mCAAmC;AACnC,8DAGwC;AACxC,uDAA+G;AAC/G,qDAAwE;AACxE,mDAAqG;AACrG,qDAA2G;AAC3G,0DAAkF;AAClF,sDAA2G;AAC3G,oDAAuG;AACvG,uDAA8G;AAC9G,kDAA+F;AAC/F,2DAAiF;AACjF,oDAAqG;AACrG,+EAA2G;AAC3G,+CAAsF;AACtF,+CAAsF;AACtF,6DAAqF;AACrF,8DAAsF;
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/service/index.ts"],"names":[],"mappings":";;;;AAAA,mCAAmC;AACnC,8DAGwC;AACxC,uDAA+G;AAC/G,qDAAwE;AACxE,mDAAqG;AACrG,qDAA2G;AAC3G,0DAAkF;AAClF,sDAA2G;AAC3G,oDAAuG;AACvG,uDAA8G;AAC9G,kDAA+F;AAC/F,2DAAiF;AACjF,oDAAqG;AACrG,+EAA2G;AAC3G,+CAAsF;AACtF,+CAAsF;AACtF,6DAAqF;AACrF,8DAAsF;AACtF,sDAAwG;AAExG,yBAAyB;AACzB,yFAA8D;AAC9D,2EAAgD;AAChD,uEAA4C;AAC5C,mEAAwC;AACxC,mEAAwC;AACxC,yDAA8B;AAC9B,yDAA8B;AAC9B,+DAAoC;AACpC,yEAA8C;AAC9C,qEAA0C;AAC1C,uEAA4C;AAC5C,iFAAsD;AACtD,qFAA0D;AAC1D,2EAAgD;AAChD,uFAA4D;AAC5D,uEAA4C;AAE5C,kBAAkB;AAClB,6EAAkD;AAClD,yEAA8C;AAC9C,6EAAkD;AAClD,uFAA4D;AAC5D,2EAAgD;AAChD,qEAA0C;AAC1C,yEAA8C;AAC9C,+DAAoC;AACpC,+DAAoC;AACpC,6EAAkD;AAErC,QAAA,QAAQ,GAAG;IACtB,cAAc;IACd,GAAG,mBAA0B;IAC7B,GAAG,mBAAoB;IACvB,GAAG,mBAAmB;IACtB,GAAG,mBAAiB;IACpB,GAAG,oBAAiB;IACpB,GAAG,oBAAY;IACf,GAAG,oBAAY;IACf,GAAG,oBAAe;IAClB,GAAG,mBAAmB;IACtB,GAAG,mBAAkB;IACrB,GAAG,oBAAuB;IAC1B,GAAG,oBAAyB;IAC5B,GAAG,mBAAoB;IACvB,GAAG,oBAAyB;IAC5B,GAAG,oBAAkB;CACtB,CAAA;AAEY,QAAA,MAAM,GAAG;IACpB,QAAQ,EAAE;QACR,0BAA0B,EAA1B,mDAA0B;KAC3B;IAED,eAAe,EAAE;QACf,sBAAsB;QACtB,GAAG,oBAA2B;QAC9B,GAAG,oBAAqB;QACxB,GAAG,oBAAoB;QACvB,GAAG,oBAAkB;QACrB,GAAG,qBAAkB;QACrB,GAAG,qBAAa;QAChB,GAAG,qBAAa;QAChB,GAAG,qBAAgB;QACnB,GAAG,oBAAmB;QACtB,GAAG,oBAAkB;QACrB,GAAG,oBAAkB;QACrB,GAAG,oBAAuB;QAC1B,GAAG,oBAAoB;QACvB,GAAG,qBAAkB;KACtB;IACD,UAAU,EAAE;QACV,SAAS,EAAE,mDAA0B;KACtC;CACF,CAAA","sourcesContent":["/* IMPORT ENTITIES AND RESOLVERS */\nimport {\n entities as UsersAuthProvidersEntities,\n resolvers as UsersAuthProvidersResolvers\n} from './users-auth-providers/index.js'\nimport { entities as AuthProviderEntities, resolvers as AuthProviderResolvers } from './auth-provider/index.js'\nimport { resolvers as AppbindingResolver } from './app-binding/index.js'\nimport { entities as ApplianceEntities, resolvers as ApplianceResolvers } from './appliance/index.js'\nimport { entities as ApplicationEntities, resolvers as ApplicationResolvers } from './application/index.js'\nimport { resolvers as DomainGeneratorResolver } from './domain-generator/index.js'\nimport { entities as GrantedRoleEntities, resolvers as GrantedRoleResolver } from './granted-role/index.js'\nimport { entities as InvitationEntities, resolvers as InvitationResolver } from './invitation/index.js'\nimport { entities as LoginHistoryEntities, resolvers as LoginHistoryResolver } from './login-history/index.js'\nimport { entities as PartnerEntities, resolvers as PartnerResolvers } from './partner/index.js'\nimport { entities as PasswordHistoryEntities } from './password-history/index.js'\nimport { entities as PrivilegeEntities, resolvers as PrivilegeResolvers } from './privilege/index.js'\nimport { privilegeDirectiveResolver, privilegeDirectiveTypeDefs } from './privilege/privilege-directive.js'\nimport { entities as RoleEntities, resolvers as RoleResolvers } from './role/index.js'\nimport { entities as UserEntities, resolvers as UserResolvers } from './user/index.js'\nimport { entities as VerificationTokenEntities } from './verification-token/index.js'\nimport { entities as WebAuthCredentialEntities } from './web-auth-credential/index.js'\nimport { entities as DomainLinkEntities, resolvers as DomainLinkResolver } from './domain-link/index.js'\n\n/* EXPORT ENTITY TYPES */\nexport * from './users-auth-providers/users-auth-providers.js'\nexport * from './auth-provider/auth-provider.js'\nexport * from './application/application.js'\nexport * from './appliance/appliance.js'\nexport * from './privilege/privilege.js'\nexport * from './role/role.js'\nexport * from './user/user.js'\nexport * from './partner/partner.js'\nexport * from './granted-role/granted-role.js'\nexport * from './invitation/invitation.js'\nexport * from './app-binding/app-binding.js'\nexport * from './password-history/password-history.js'\nexport * from './verification-token/verification-token.js'\nexport * from './login-history/login-history.js'\nexport * from './web-auth-credential/web-auth-credential.js'\nexport * from './domain-link/domain-link.js'\n\n/* EXPORT TYPES */\nexport * from './app-binding/app-binding-types.js'\nexport * from './appliance/appliance-types.js'\nexport * from './application/application-types.js'\nexport * from './domain-generator/domain-generator-types.js'\nexport * from './invitation/invitation-types.js'\nexport * from './partner/partner-types.js'\nexport * from './privilege/privilege-types.js'\nexport * from './role/role-types.js'\nexport * from './user/user-types.js'\nexport * from './domain-link/domain-link-types.js'\n\nexport const entities = [\n /* ENTITIES */\n ...UsersAuthProvidersEntities,\n ...AuthProviderEntities,\n ...ApplicationEntities,\n ...ApplianceEntities,\n ...PrivilegeEntities,\n ...RoleEntities,\n ...UserEntities,\n ...PartnerEntities,\n ...GrantedRoleEntities,\n ...InvitationEntities,\n ...PasswordHistoryEntities,\n ...VerificationTokenEntities,\n ...LoginHistoryEntities,\n ...WebAuthCredentialEntities,\n ...DomainLinkEntities\n]\n\nexport const schema = {\n typeDefs: {\n privilegeDirectiveTypeDefs\n },\n\n resolverClasses: [\n /* RESOLVER CLASSES */\n ...UsersAuthProvidersResolvers,\n ...AuthProviderResolvers,\n ...ApplicationResolvers,\n ...ApplianceResolvers,\n ...PrivilegeResolvers,\n ...RoleResolvers,\n ...UserResolvers,\n ...PartnerResolvers,\n ...GrantedRoleResolver,\n ...InvitationResolver,\n ...AppbindingResolver,\n ...DomainGeneratorResolver,\n ...LoginHistoryResolver,\n ...DomainLinkResolver\n ],\n directives: {\n privilege: privilegeDirectiveResolver\n }\n}\n"]}
|
@@ -46,10 +46,14 @@ let InvitationMutation = class InvitationMutation {
|
|
46
46
|
reference
|
47
47
|
});
|
48
48
|
// update or create
|
49
|
-
return await invitationRepository.save(
|
49
|
+
return await invitationRepository.save({
|
50
|
+
creator: updater,
|
51
|
+
...oldone, // take only id from oldone for update
|
50
52
|
email,
|
51
53
|
reference,
|
52
|
-
type,
|
54
|
+
type,
|
55
|
+
updater: updater
|
56
|
+
});
|
53
57
|
}
|
54
58
|
};
|
55
59
|
exports.InvitationMutation = InvitationMutation;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"invitation-mutation.js","sourceRoot":"","sources":["../../../server/service/invitation/invitation-mutation.ts"],"names":[],"mappings":";;;;AAAA,qCAA+B;AAE/B,+CAA2D;AAC3D,qDAAqD;AAErD,iDAAqD;AAErD,wDAA6D;AAC7D,mEAAqE;AACrE,mDAA4C;AAGrC,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IAEvB,AAAN,KAAK,CAAC,gBAAgB,CACuB,KAAa,EACtC,SAAiB,EACtB,IAAY;QAEzB,MAAM,UAAU,GAAG,IAAA,qBAAa,EAAC,0BAAU,CAAC,CAAA;QAE5C,MAAM,UAAU,CAAC,MAAM,CAAC;YACtB,KAAK;YACL,SAAS;YACT,IAAI;SACL,CAAC,CAAA;QAEF,OAAO,IAAI,CAAA;IACb,CAAC;IAGK,AAAN,KAAK,CAAC,cAAc,CACyB,KAAa,EACtC,SAAiB,EACtB,IAAY,EAClB,OAAwB;QAE/B,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QACvC,MAAM,oBAAoB,GAAG,IAAA,qBAAa,EAAC,0BAAU,CAAC,CAAA;QAEtD,IAAI,IAAI,GAAG,MAAM,IAAA,qBAAa,EAAC,cAAI,CAAC,CAAC,OAAO,CAAC;YAC3C,KAAK,EAAE;gBACL,KAAK,EAAE,IAAA,eAAK,EAAC,KAAK,CAAC;gBACnB,MAAM,EAAE,oBAAU,CAAC,SAAS;aAC7B;SACF,CAAC,CAAA;QAEF,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,MAAM,IAAI,KAAK,CAAC,mBAAmB,KAAK,EAAE,CAAC,CAAA;QAC7C,CAAC;QAED,MAAM,IAAA,mCAAmB,EAAC;YACxB,UAAU,EAAE;gBACV,KAAK;gBACL,SAAS;gBACT,IAAI;aACL;YACD,IAAI;YACJ,OAAO;SACR,CAAC,CAAA;QAEF,MAAM,MAAM,GAAG,MAAM,oBAAoB,CAAC,SAAS,CAAC;YAClD,KAAK;YACL,IAAI;YACJ,SAAS;SACV,CAAC,CAAA;QAEF,mBAAmB;QACnB,OAAO,MAAM,oBAAoB,CAAC,IAAI
|
1
|
+
{"version":3,"file":"invitation-mutation.js","sourceRoot":"","sources":["../../../server/service/invitation/invitation-mutation.ts"],"names":[],"mappings":";;;;AAAA,qCAA+B;AAE/B,+CAA2D;AAC3D,qDAAqD;AAErD,iDAAqD;AAErD,wDAA6D;AAC7D,mEAAqE;AACrE,mDAA4C;AAGrC,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IAEvB,AAAN,KAAK,CAAC,gBAAgB,CACuB,KAAa,EACtC,SAAiB,EACtB,IAAY;QAEzB,MAAM,UAAU,GAAG,IAAA,qBAAa,EAAC,0BAAU,CAAC,CAAA;QAE5C,MAAM,UAAU,CAAC,MAAM,CAAC;YACtB,KAAK;YACL,SAAS;YACT,IAAI;SACL,CAAC,CAAA;QAEF,OAAO,IAAI,CAAA;IACb,CAAC;IAGK,AAAN,KAAK,CAAC,cAAc,CACyB,KAAa,EACtC,SAAiB,EACtB,IAAY,EAClB,OAAwB;QAE/B,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QACvC,MAAM,oBAAoB,GAAG,IAAA,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CAAmB,CAAC,CAAA;IACzC,mBAAA,IAAA,kBAAG,EAAC,WAAW,CAAC,CAAA;IAChB,mBAAA,IAAA,kBAAG,EAAC,MAAM,CAAC,CAAA;IACX,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;wDAyCP;6BAhEU,kBAAkB;IAD9B,IAAA,uBAAQ,EAAC,0BAAU,CAAC;GACR,kBAAkB,CAiE9B","sourcesContent":["import { ILike } from 'typeorm'\n\nimport { Arg, Ctx, Mutation, Resolver } from 'type-graphql'\nimport { GraphQLEmailAddress } from 'graphql-scalars'\n\nimport { getRepository } from '@things-factory/shell'\n\nimport { User, UserStatus } from '../../service/user/user.js'\nimport { sendInvitationEmail } from '../../controllers/invitation.js'\nimport { Invitation } from './invitation.js'\n\n@Resolver(Invitation)\nexport class InvitationMutation {\n @Mutation(returns => Boolean)\n async cancelInvitation(\n @Arg('email', type => GraphQLEmailAddress) email: string,\n @Arg('reference') reference: string,\n @Arg('type') type: string\n ) {\n const repository = getRepository(Invitation)\n\n await repository.delete({\n email,\n reference,\n type\n })\n\n return true\n }\n\n @Mutation(returns => Invitation)\n async sendInvitation(\n @Arg('email', type => GraphQLEmailAddress) email: string,\n @Arg('reference') reference: string,\n @Arg('type') type: string,\n @Ctx() context: ResolverContext\n ) {\n const { user: updater } = context.state\n const invitationRepository = getRepository(Invitation)\n\n var user = await getRepository(User).findOne({\n where: {\n email: ILike(email),\n status: UserStatus.ACTIVATED\n }\n })\n\n if (!user) {\n throw new Error(`user not found: ${email}`)\n }\n\n await sendInvitationEmail({\n invitation: {\n email,\n reference,\n type\n },\n user,\n context\n })\n\n const oldone = await invitationRepository.findOneBy({\n email,\n type,\n reference\n })\n\n // update or create\n return await invitationRepository.save({\n creator: updater,\n ...oldone, // take only id from oldone for update\n email,\n reference,\n type,\n updater: updater\n })\n }\n}\n"]}
|
@@ -8,14 +8,14 @@ let InvitationList = class InvitationList {
|
|
8
8
|
};
|
9
9
|
exports.InvitationList = InvitationList;
|
10
10
|
tslib_1.__decorate([
|
11
|
-
(0, type_graphql_1.Field)(type => [invitation_js_1.Invitation], { nullable: true }),
|
11
|
+
(0, type_graphql_1.Field)(type => [invitation_js_1.Invitation], { nullable: true, description: 'The list of invitation items.' }),
|
12
12
|
tslib_1.__metadata("design:type", Array)
|
13
13
|
], InvitationList.prototype, "items", void 0);
|
14
14
|
tslib_1.__decorate([
|
15
|
-
(0, type_graphql_1.Field)(type => type_graphql_1.Int, { nullable: true }),
|
15
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Int, { nullable: true, description: 'The total number of invitations.' }),
|
16
16
|
tslib_1.__metadata("design:type", Number)
|
17
17
|
], InvitationList.prototype, "total", void 0);
|
18
18
|
exports.InvitationList = InvitationList = tslib_1.__decorate([
|
19
|
-
(0, type_graphql_1.ObjectType)()
|
19
|
+
(0, type_graphql_1.ObjectType)({ description: 'A paginated list of invitations.' })
|
20
20
|
], InvitationList);
|
21
21
|
//# sourceMappingURL=invitation-types.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"invitation-types.js","sourceRoot":"","sources":["../../../server/service/invitation/invitation-types.ts"],"names":[],"mappings":";;;;AAAA,mDAA4C;AAC5C,+CAAqD;AAG9C,IAAM,cAAc,GAApB,MAAM,cAAc;CAM1B,CAAA;AANY,wCAAc;AAEzB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,0BAAU,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;
|
1
|
+
{"version":3,"file":"invitation-types.js","sourceRoot":"","sources":["../../../server/service/invitation/invitation-types.ts"],"names":[],"mappings":";;;;AAAA,mDAA4C;AAC5C,+CAAqD;AAG9C,IAAM,cAAc,GAApB,MAAM,cAAc;CAM1B,CAAA;AANY,wCAAc;AAEzB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,0BAAU,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,+BAA+B,EAAE,CAAC;;6CAC3E;AAGnB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,kCAAkC,EAAE,CAAC;;6CAC3E;yBALF,cAAc;IAD1B,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,kCAAkC,EAAE,CAAC;GACnD,cAAc,CAM1B","sourcesContent":["import { Invitation } from './invitation.js'\nimport { ObjectType, Field, Int } from 'type-graphql'\n\n@ObjectType({ description: 'A paginated list of invitations.' })\nexport class InvitationList {\n @Field(type => [Invitation], { nullable: true, description: 'The list of invitation items.' })\n items: Invitation[]\n\n @Field(type => Int, { nullable: true, description: 'The total number of invitations.' })\n total: number\n}\n"]}
|
@@ -11,42 +11,42 @@ let Invitation = class Invitation {
|
|
11
11
|
exports.Invitation = Invitation;
|
12
12
|
tslib_1.__decorate([
|
13
13
|
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
14
|
-
(0, type_graphql_1.Field)(type => type_graphql_1.ID),
|
14
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.ID, { description: 'Unique identifier for the invitation.' }),
|
15
15
|
tslib_1.__metadata("design:type", String)
|
16
16
|
], Invitation.prototype, "id", void 0);
|
17
17
|
tslib_1.__decorate([
|
18
18
|
(0, typeorm_1.Column)(),
|
19
|
-
(0, type_graphql_1.Field)(type => graphql_scalars_1.GraphQLEmailAddress),
|
19
|
+
(0, type_graphql_1.Field)(type => graphql_scalars_1.GraphQLEmailAddress, { description: 'The email address to which the invitation is sent.' }),
|
20
20
|
tslib_1.__metadata("design:type", String)
|
21
21
|
], Invitation.prototype, "email", void 0);
|
22
22
|
tslib_1.__decorate([
|
23
23
|
(0, typeorm_1.Column)(),
|
24
|
-
(0, type_graphql_1.Field)(),
|
24
|
+
(0, type_graphql_1.Field)({ description: 'A reference to the resource the user is invited to (e.g., company ID, bizplace ID).' }),
|
25
25
|
tslib_1.__metadata("design:type", String)
|
26
26
|
], Invitation.prototype, "reference", void 0);
|
27
27
|
tslib_1.__decorate([
|
28
28
|
(0, typeorm_1.Column)(),
|
29
|
-
(0, type_graphql_1.Field)(),
|
29
|
+
(0, type_graphql_1.Field)({ description: 'The type of resource the invitation is for (e.g., company, bizplace).' }),
|
30
30
|
tslib_1.__metadata("design:type", String)
|
31
31
|
], Invitation.prototype, "type", void 0);
|
32
32
|
tslib_1.__decorate([
|
33
33
|
(0, typeorm_1.Column)(),
|
34
|
-
(0, type_graphql_1.Field)(),
|
34
|
+
(0, type_graphql_1.Field)({ description: 'The unique token used to accept the invitation.' }),
|
35
35
|
tslib_1.__metadata("design:type", String)
|
36
36
|
], Invitation.prototype, "token", void 0);
|
37
37
|
tslib_1.__decorate([
|
38
38
|
(0, typeorm_1.CreateDateColumn)({ nullable: true }),
|
39
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
39
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The timestamp when the invitation was created.' }),
|
40
40
|
tslib_1.__metadata("design:type", Date)
|
41
41
|
], Invitation.prototype, "createdAt", void 0);
|
42
42
|
tslib_1.__decorate([
|
43
43
|
(0, typeorm_1.UpdateDateColumn)({ nullable: true }),
|
44
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
44
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The timestamp when the invitation was last updated.' }),
|
45
45
|
tslib_1.__metadata("design:type", Date)
|
46
46
|
], Invitation.prototype, "updatedAt", void 0);
|
47
47
|
tslib_1.__decorate([
|
48
48
|
(0, typeorm_1.ManyToOne)(type => user_js_1.User, { nullable: true }),
|
49
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
49
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The user who created the invitation.' }),
|
50
50
|
tslib_1.__metadata("design:type", user_js_1.User)
|
51
51
|
], Invitation.prototype, "creator", void 0);
|
52
52
|
tslib_1.__decorate([
|
@@ -55,7 +55,7 @@ tslib_1.__decorate([
|
|
55
55
|
], Invitation.prototype, "creatorId", void 0);
|
56
56
|
tslib_1.__decorate([
|
57
57
|
(0, typeorm_1.ManyToOne)(type => user_js_1.User, { nullable: true }),
|
58
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
58
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The user who last updated the invitation.' }),
|
59
59
|
tslib_1.__metadata("design:type", user_js_1.User)
|
60
60
|
], Invitation.prototype, "updater", void 0);
|
61
61
|
tslib_1.__decorate([
|
@@ -68,6 +68,6 @@ exports.Invitation = Invitation = tslib_1.__decorate([
|
|
68
68
|
unique: true
|
69
69
|
}),
|
70
70
|
(0, typeorm_1.Index)('ix_invitation_1', (invitation) => [invitation.token], { unique: true }),
|
71
|
-
(0, type_graphql_1.ObjectType)()
|
71
|
+
(0, type_graphql_1.ObjectType)({ description: 'Represents an invitation for a user to join a system or a specific resource.' })
|
72
72
|
], Invitation);
|
73
73
|
//# sourceMappingURL=invitation.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"invitation.js","sourceRoot":"","sources":["../../../server/service/invitation/invitation.ts"],"names":[],"mappings":";;;;AAAA,qCASgB;AAChB,+CAAoD;AACpD,qDAAqD;AACrD,6CAAsC;AAQ/B,IAAM,UAAU,GAAhB,MAAM,UAAU;CA0CtB,CAAA;AA1CY,gCAAU;AAGZ;IAFR,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,CAAC;;
|
1
|
+
{"version":3,"file":"invitation.js","sourceRoot":"","sources":["../../../server/service/invitation/invitation.ts"],"names":[],"mappings":";;;;AAAA,qCASgB;AAChB,+CAAoD;AACpD,qDAAqD;AACrD,6CAAsC;AAQ/B,IAAM,UAAU,GAAhB,MAAM,UAAU;CA0CtB,CAAA;AA1CY,gCAAU;AAGZ;IAFR,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,EAAC,I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,EAAC,IAAI,CAAC,EAAE,CAAC,cAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC3C,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,2CAA2C,EAAE,CAAC;sCAC3E,cAAI;2CAAA;AAGb;IADC,IAAA,oBAAU,EAAC,CAAC,UAAsB,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC;;6CAC1C;qBAzCN,UAAU;IANtB,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EAAC,iBAAiB,EAAE,CAAC,UAAsB,EAAE,EAAE,CAAC,CAAC,UAAU,CAAC,KAAK,EAAE,UAAU,CAAC,SAAS,EAAE,UAAU,CAAC,IAAI,CAAC,EAAE;QAC/G,MAAM,EAAE,IAAI;KACb,CAAC;IACD,IAAA,eAAK,EAAC,iBAAiB,EAAE,CAAC,UAAsB,EAAE,EAAE,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IAC1F,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,8EAA8E,EAAE,CAAC;GAC/F,UAAU,CA0CtB","sourcesContent":["import {\n CreateDateColumn,\n UpdateDateColumn,\n Entity,\n Index,\n Column,\n ManyToOne,\n RelationId,\n PrimaryGeneratedColumn\n} from 'typeorm'\nimport { ObjectType, Field, ID } from 'type-graphql'\nimport { GraphQLEmailAddress } from 'graphql-scalars'\nimport { User } from '../user/user.js'\n\n@Entity()\n@Index('ix_invitation_0', (invitation: Invitation) => [invitation.email, invitation.reference, invitation.type], {\n unique: true\n})\n@Index('ix_invitation_1', (invitation: Invitation) => [invitation.token], { unique: true })\n@ObjectType({ description: 'Represents an invitation for a user to join a system or a specific resource.' })\nexport class Invitation {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID, { description: 'Unique identifier for the invitation.' })\n readonly id: string\n\n @Column()\n @Field(type => GraphQLEmailAddress, { description: 'The email address to which the invitation is sent.' })\n email: string\n\n @Column()\n @Field({ description: 'A reference to the resource the user is invited to (e.g., company ID, bizplace ID).' })\n reference: string // company, bizplace\n\n @Column()\n @Field({ description: 'The type of resource the invitation is for (e.g., company, bizplace).' })\n type: string // company, bizplace, .. should think whether this column needs.\n\n @Column()\n @Field({ description: 'The unique token used to accept the invitation.' })\n token: string\n\n @CreateDateColumn({ nullable: true })\n @Field({ nullable: true, description: 'The timestamp when the invitation was created.' })\n createdAt: Date\n\n @UpdateDateColumn({ nullable: true })\n @Field({ nullable: true, description: 'The timestamp when the invitation was last updated.' })\n updatedAt: Date\n\n @ManyToOne(type => User, { nullable: true })\n @Field({ nullable: true, description: 'The user who created the invitation.' })\n creator: User\n\n @RelationId((invitation: Invitation) => invitation.creator)\n creatorId: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field({ nullable: true, description: 'The user who last updated the invitation.' })\n updater: User\n\n @RelationId((invitation: Invitation) => invitation.updater)\n updaterId: string\n}\n"]}
|
@@ -8,14 +8,14 @@ let LoginHistoryList = class LoginHistoryList {
|
|
8
8
|
};
|
9
9
|
exports.LoginHistoryList = LoginHistoryList;
|
10
10
|
tslib_1.__decorate([
|
11
|
-
(0, type_graphql_1.Field)(type => [login_history_js_1.LoginHistory]),
|
11
|
+
(0, type_graphql_1.Field)(type => [login_history_js_1.LoginHistory], { description: 'The list of login history items.' }),
|
12
12
|
tslib_1.__metadata("design:type", Array)
|
13
13
|
], LoginHistoryList.prototype, "items", void 0);
|
14
14
|
tslib_1.__decorate([
|
15
|
-
(0, type_graphql_1.Field)(type => type_graphql_1.Int),
|
15
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Int, { description: 'The total number of login history records.' }),
|
16
16
|
tslib_1.__metadata("design:type", Number)
|
17
17
|
], LoginHistoryList.prototype, "total", void 0);
|
18
18
|
exports.LoginHistoryList = LoginHistoryList = tslib_1.__decorate([
|
19
|
-
(0, type_graphql_1.ObjectType)()
|
19
|
+
(0, type_graphql_1.ObjectType)({ description: 'A paginated list of login history records.' })
|
20
20
|
], LoginHistoryList);
|
21
21
|
//# sourceMappingURL=login-history-type.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"login-history-type.js","sourceRoot":"","sources":["../../../server/service/login-history/login-history-type.ts"],"names":[],"mappings":";;;;AAAA,+CAAoE;AAEpE,yDAAiD;AAG1C,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;CAM5B,CAAA;AANY,4CAAgB;AAE3B;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,+BAAY,CAAC,CAAC;;+
|
1
|
+
{"version":3,"file":"login-history-type.js","sourceRoot":"","sources":["../../../server/service/login-history/login-history-type.ts"],"names":[],"mappings":";;;;AAAA,+CAAoE;AAEpE,yDAAiD;AAG1C,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;CAM5B,CAAA;AANY,4CAAgB;AAE3B;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,+BAAY,CAAC,EAAE,EAAE,WAAW,EAAE,kCAAkC,EAAE,CAAC;;+CAC9D;AAGrB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,EAAE,EAAE,WAAW,EAAE,4CAA4C,EAAE,CAAC;;+CACrE;2BALF,gBAAgB;IAD5B,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,4CAA4C,EAAE,CAAC;GAC7D,gBAAgB,CAM5B","sourcesContent":["import { Field, ID, InputType, Int, ObjectType } from 'type-graphql'\n\nimport { LoginHistory } from './login-history.js'\n\n@ObjectType({ description: 'A paginated list of login history records.' })\nexport class LoginHistoryList {\n @Field(type => [LoginHistory], { description: 'The list of login history items.' })\n items: LoginHistory[]\n\n @Field(type => Int, { description: 'The total number of login history records.' })\n total: number\n}\n"]}
|
@@ -19,12 +19,12 @@ let LoginHistory = LoginHistory_1 = class LoginHistory {
|
|
19
19
|
exports.LoginHistory = LoginHistory;
|
20
20
|
tslib_1.__decorate([
|
21
21
|
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
22
|
-
(0, type_graphql_1.Field)(type => type_graphql_1.ID),
|
22
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.ID, { description: 'Unique identifier for the login history record.' }),
|
23
23
|
tslib_1.__metadata("design:type", String)
|
24
24
|
], LoginHistory.prototype, "id", void 0);
|
25
25
|
tslib_1.__decorate([
|
26
26
|
(0, typeorm_1.ManyToOne)(type => shell_1.Domain),
|
27
|
-
(0, type_graphql_1.Field)(type => shell_1.Domain),
|
27
|
+
(0, type_graphql_1.Field)(type => shell_1.Domain, { description: 'The domain the user logged into.' }),
|
28
28
|
tslib_1.__metadata("design:type", shell_1.Domain)
|
29
29
|
], LoginHistory.prototype, "accessDomain", void 0);
|
30
30
|
tslib_1.__decorate([
|
@@ -33,7 +33,7 @@ tslib_1.__decorate([
|
|
33
33
|
], LoginHistory.prototype, "accessDomainId", void 0);
|
34
34
|
tslib_1.__decorate([
|
35
35
|
(0, typeorm_1.ManyToOne)(type => user_js_1.User),
|
36
|
-
(0, type_graphql_1.Field)(type => user_js_1.User),
|
36
|
+
(0, type_graphql_1.Field)(type => user_js_1.User, { description: 'The user who logged in.' }),
|
37
37
|
tslib_1.__metadata("design:type", user_js_1.User)
|
38
38
|
], LoginHistory.prototype, "accessUser", void 0);
|
39
39
|
tslib_1.__decorate([
|
@@ -42,17 +42,17 @@ tslib_1.__decorate([
|
|
42
42
|
], LoginHistory.prototype, "accessUserId", void 0);
|
43
43
|
tslib_1.__decorate([
|
44
44
|
(0, typeorm_1.Column)({ nullable: true }),
|
45
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
45
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The IP address from which the login attempt was made.' }),
|
46
46
|
tslib_1.__metadata("design:type", String)
|
47
47
|
], LoginHistory.prototype, "accessorIp", void 0);
|
48
48
|
tslib_1.__decorate([
|
49
49
|
(0, typeorm_1.CreateDateColumn)(),
|
50
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
50
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The timestamp of the login attempt.' }),
|
51
51
|
tslib_1.__metadata("design:type", Date)
|
52
52
|
], LoginHistory.prototype, "accessedAt", void 0);
|
53
53
|
exports.LoginHistory = LoginHistory = LoginHistory_1 = tslib_1.__decorate([
|
54
54
|
(0, typeorm_1.Entity)(),
|
55
55
|
(0, typeorm_1.Index)('ix_login_history_0', (loginHistory) => [loginHistory.accessDomain, loginHistory.accessUser]),
|
56
|
-
(0, type_graphql_1.ObjectType)()
|
56
|
+
(0, type_graphql_1.ObjectType)({ description: 'Records user login attempts.' })
|
57
57
|
], LoginHistory);
|
58
58
|
//# sourceMappingURL=login-history.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"login-history.js","sourceRoot":"","sources":["../../../server/service/login-history/login-history.ts"],"names":[],"mappings":";;;;;AAAA,+CAAoD;AACpD,qCAAgH;AAEhH,iDAA6D;AAE7D,6CAAsC;AAK/B,IAAM,YAAY,oBAAlB,MAAM,YAAY;IA2BvB,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,YAA6B,EAAE,UAAgB,EAAE,UAAkB;QACpF,MAAM,IAAA,qBAAa,EAAC,cAAY,CAAC,CAAC,IAAI,CAAC;YACrC,YAAY;YACZ,UAAU;YACV,UAAU;SACX,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAlCY,oCAAY;AAGd;IAFR,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,CAAC;;
|
1
|
+
{"version":3,"file":"login-history.js","sourceRoot":"","sources":["../../../server/service/login-history/login-history.ts"],"names":[],"mappings":";;;;;AAAA,+CAAoD;AACpD,qCAAgH;AAEhH,iDAA6D;AAE7D,6CAAsC;AAK/B,IAAM,YAAY,oBAAlB,MAAM,YAAY;IA2BvB,MAAM,CAAC,KAAK,CA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A;uBAzBL,YAAY;IAHxB,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EAAC,oBAAoB,EAAE,CAAC,YAA0B,EAAE,EAAE,CAAC,CAAC,YAAY,CAAC,YAAY,EAAE,YAAY,CAAC,UAAU,CAAC,CAAC;IACjH,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,8BAA8B,EAAE,CAAC;GAC/C,YAAY,CAkCxB","sourcesContent":["import { Field, ID, ObjectType } from 'type-graphql'\nimport { Column, CreateDateColumn, Entity, Index, ManyToOne, PrimaryGeneratedColumn, RelationId } from 'typeorm'\n\nimport { Domain, getRepository } from '@things-factory/shell'\n\nimport { User } from '../user/user.js'\n\n@Entity()\n@Index('ix_login_history_0', (loginHistory: LoginHistory) => [loginHistory.accessDomain, loginHistory.accessUser])\n@ObjectType({ description: 'Records user login attempts.' })\nexport class LoginHistory {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID, { description: 'Unique identifier for the login history record.' })\n readonly id: string\n\n @ManyToOne(type => Domain)\n @Field(type => Domain, { description: 'The domain the user logged into.' })\n accessDomain?: Domain\n\n @RelationId((loginHistory: LoginHistory) => loginHistory.accessDomain)\n accessDomainId: string\n\n @ManyToOne(type => User)\n @Field(type => User, { description: 'The user who logged in.' })\n accessUser: User\n\n @RelationId((loginHistory: LoginHistory) => loginHistory.accessUser)\n accessUserId: string\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'The IP address from which the login attempt was made.' })\n accessorIp: string\n\n @CreateDateColumn()\n @Field({ nullable: true, description: 'The timestamp of the login attempt.' })\n accessedAt: Date\n\n static async stamp(accessDomain: Partial<Domain>, accessUser: User, accessorIp: string): Promise<void> {\n await getRepository(LoginHistory).save({\n accessDomain,\n accessUser,\n accessorIp\n })\n }\n}\n"]}
|
@@ -8,14 +8,14 @@ let PartnerList = class PartnerList {
|
|
8
8
|
};
|
9
9
|
exports.PartnerList = PartnerList;
|
10
10
|
tslib_1.__decorate([
|
11
|
-
(0, type_graphql_1.Field)(type => [partner_js_1.Partner], { nullable: true }),
|
11
|
+
(0, type_graphql_1.Field)(type => [partner_js_1.Partner], { nullable: true, description: 'The list of partnership items.' }),
|
12
12
|
tslib_1.__metadata("design:type", Array)
|
13
13
|
], PartnerList.prototype, "items", void 0);
|
14
14
|
tslib_1.__decorate([
|
15
|
-
(0, type_graphql_1.Field)(type => type_graphql_1.Int, { nullable: true }),
|
15
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Int, { nullable: true, description: 'The total number of partnerships.' }),
|
16
16
|
tslib_1.__metadata("design:type", Number)
|
17
17
|
], PartnerList.prototype, "total", void 0);
|
18
18
|
exports.PartnerList = PartnerList = tslib_1.__decorate([
|
19
|
-
(0, type_graphql_1.ObjectType)()
|
19
|
+
(0, type_graphql_1.ObjectType)({ description: 'A paginated list of partnerships.' })
|
20
20
|
], PartnerList);
|
21
21
|
//# sourceMappingURL=partner-types.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"partner-types.js","sourceRoot":"","sources":["../../../server/service/partner/partner-types.ts"],"names":[],"mappings":";;;;AAAA,+CAAqD;AACrD,6CAAsC;AAG/B,IAAM,WAAW,GAAjB,MAAM,WAAW;CAMvB,CAAA;AANY,kCAAW;AAEtB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,oBAAO,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;
|
1
|
+
{"version":3,"file":"partner-types.js","sourceRoot":"","sources":["../../../server/service/partner/partner-types.ts"],"names":[],"mappings":";;;;AAAA,+CAAqD;AACrD,6CAAsC;AAG/B,IAAM,WAAW,GAAjB,MAAM,WAAW;CAMvB,CAAA;AANY,kCAAW;AAEtB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,oBAAO,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,gCAAgC,EAAE,CAAC;;0CAC5E;AAGhB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,mCAAmC,EAAE,CAAC;;0CAC5E;sBALF,WAAW;IADvB,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,mCAAmC,EAAE,CAAC;GACpD,WAAW,CAMvB","sourcesContent":["import { Field, Int, ObjectType } from 'type-graphql'\nimport { Partner } from './partner.js'\n\n@ObjectType({ description: 'A paginated list of partnerships.' })\nexport class PartnerList {\n @Field(type => [Partner], { nullable: true, description: 'The list of partnership items.' })\n items: Partner[]\n\n @Field(type => Int, { nullable: true, description: 'The total number of partnerships.' })\n total: number\n}\n"]}
|
@@ -11,12 +11,12 @@ let Partner = class Partner {
|
|
11
11
|
exports.Partner = Partner;
|
12
12
|
tslib_1.__decorate([
|
13
13
|
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
14
|
-
(0, type_graphql_1.Field)(type => type_graphql_1.ID),
|
14
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.ID, { description: 'Unique identifier for the partnership.' }),
|
15
15
|
tslib_1.__metadata("design:type", String)
|
16
16
|
], Partner.prototype, "id", void 0);
|
17
17
|
tslib_1.__decorate([
|
18
18
|
(0, typeorm_1.ManyToOne)(type => shell_1.Domain),
|
19
|
-
(0, type_graphql_1.Field)(type => shell_1.Domain),
|
19
|
+
(0, type_graphql_1.Field)(type => shell_1.Domain, { description: 'The domain initiating the partnership.' }),
|
20
20
|
tslib_1.__metadata("design:type", shell_1.Domain)
|
21
21
|
], Partner.prototype, "domain", void 0);
|
22
22
|
tslib_1.__decorate([
|
@@ -25,7 +25,7 @@ tslib_1.__decorate([
|
|
25
25
|
], Partner.prototype, "domainId", void 0);
|
26
26
|
tslib_1.__decorate([
|
27
27
|
(0, typeorm_1.ManyToOne)(type => shell_1.Domain),
|
28
|
-
(0, type_graphql_1.Field)(type => shell_1.Domain),
|
28
|
+
(0, type_graphql_1.Field)(type => shell_1.Domain, { description: 'The domain being partnered with.' }),
|
29
29
|
tslib_1.__metadata("design:type", shell_1.Domain)
|
30
30
|
], Partner.prototype, "partnerDomain", void 0);
|
31
31
|
tslib_1.__decorate([
|
@@ -34,17 +34,17 @@ tslib_1.__decorate([
|
|
34
34
|
], Partner.prototype, "partnerDomainId", void 0);
|
35
35
|
tslib_1.__decorate([
|
36
36
|
(0, typeorm_1.CreateDateColumn)(),
|
37
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
37
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The timestamp when the partnership was requested.' }),
|
38
38
|
tslib_1.__metadata("design:type", Date)
|
39
39
|
], Partner.prototype, "requestedAt", void 0);
|
40
40
|
tslib_1.__decorate([
|
41
41
|
(0, typeorm_1.UpdateDateColumn)(),
|
42
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
42
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The timestamp when the partnership was approved.' }),
|
43
43
|
tslib_1.__metadata("design:type", Date)
|
44
44
|
], Partner.prototype, "approvedAt", void 0);
|
45
45
|
tslib_1.__decorate([
|
46
46
|
(0, typeorm_1.ManyToOne)(type => user_js_1.User, { nullable: true }),
|
47
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
47
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The user who requested the partnership.' }),
|
48
48
|
tslib_1.__metadata("design:type", user_js_1.User)
|
49
49
|
], Partner.prototype, "requester", void 0);
|
50
50
|
tslib_1.__decorate([
|
@@ -53,7 +53,7 @@ tslib_1.__decorate([
|
|
53
53
|
], Partner.prototype, "requesterId", void 0);
|
54
54
|
tslib_1.__decorate([
|
55
55
|
(0, typeorm_1.ManyToOne)(type => user_js_1.User, { nullable: true }),
|
56
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
56
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The user who approved the partnership.' }),
|
57
57
|
tslib_1.__metadata("design:type", user_js_1.User)
|
58
58
|
], Partner.prototype, "approver", void 0);
|
59
59
|
tslib_1.__decorate([
|
@@ -63,6 +63,6 @@ tslib_1.__decorate([
|
|
63
63
|
exports.Partner = Partner = tslib_1.__decorate([
|
64
64
|
(0, typeorm_1.Entity)(),
|
65
65
|
(0, typeorm_1.Index)('ix_partner_0', (partner) => [partner.domain, partner.partnerDomain], { unique: true }),
|
66
|
-
(0, type_graphql_1.ObjectType)()
|
66
|
+
(0, type_graphql_1.ObjectType)({ description: 'Represents a partnership between two domains.' })
|
67
67
|
], Partner);
|
68
68
|
//# sourceMappingURL=partner.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"partner.js","sourceRoot":"","sources":["../../../server/service/partner/partner.ts"],"names":[],"mappings":";;;;AAAA,iDAA8C;AAC9C,qCAQgB;AAChB,+CAAoD;AACpD,6CAAsC;AAK/B,IAAM,OAAO,GAAb,MAAM,OAAO;CAwCnB,CAAA;AAxCY,0BAAO;AAGT;IAFR,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,CAAC;;
|
1
|
+
{"version":3,"file":"partner.js","sourceRoot":"","sources":["../../../server/service/partner/partner.ts"],"names":[],"mappings":";;;;AAAA,iDAA8C;AAC9C,qCAQgB;AAChB,+CAAoD;AACpD,6CAAsC;AAK/B,IAAM,OAAO,GAAb,MAAM,OAAO;CAwCnB,CAAA;AAxCY,0BAAO;AAGT;IAFR,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,EAAE,EAAE,WAAW,EAAE,wCAAwC,EAAE,CAAC;;mCAC1D;AAInB;IAFC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;IACzB,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,EAAE,EAAE,WAAW,EAAE,wCAAwC,EAAE,CAAC;sCACxE,cAAM;u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AC,OAAgB,EAAE,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC;;2CACjC;kBAvCP,OAAO;IAHnB,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EAAC,cAAc,EAAE,CAAC,OAAgB,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,aAAa,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IACtG,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,+CAA+C,EAAE,CAAC;GAChE,OAAO,CAwCnB","sourcesContent":["import { Domain } from '@things-factory/shell'\nimport {\n CreateDateColumn,\n Entity,\n Index,\n ManyToOne,\n PrimaryGeneratedColumn,\n UpdateDateColumn,\n RelationId\n} from 'typeorm'\nimport { ObjectType, Field, ID } from 'type-graphql'\nimport { User } from '../user/user.js'\n\n@Entity()\n@Index('ix_partner_0', (partner: Partner) => [partner.domain, partner.partnerDomain], { unique: true })\n@ObjectType({ description: 'Represents a partnership between two domains.' })\nexport class Partner {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID, { description: 'Unique identifier for the partnership.' })\n readonly id: string\n\n @ManyToOne(type => Domain)\n @Field(type => Domain, { description: 'The domain initiating the partnership.' })\n domain?: Domain\n\n @RelationId((partner: Partner) => partner.domain)\n domainId: string\n\n @ManyToOne(type => Domain)\n @Field(type => Domain, { description: 'The domain being partnered with.' })\n partnerDomain?: Domain\n\n @RelationId((partner: Partner) => partner.partnerDomain)\n partnerDomainId: string\n\n @CreateDateColumn()\n @Field({ nullable: true, description: 'The timestamp when the partnership was requested.' })\n requestedAt: Date\n\n @UpdateDateColumn()\n @Field({ nullable: true, description: 'The timestamp when the partnership was approved.' })\n approvedAt: Date\n\n @ManyToOne(type => User, { nullable: true })\n @Field({ nullable: true, description: 'The user who requested the partnership.' })\n requester: User\n\n @RelationId((partner: Partner) => partner.requester)\n requesterId: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field({ nullable: true, description: 'The user who approved the partnership.' })\n approver: User\n\n @RelationId((partner: Partner) => partner.approver)\n approverId: string\n}\n"]}
|
@@ -9,18 +9,18 @@ let PasswordHistory = class PasswordHistory {
|
|
9
9
|
exports.PasswordHistory = PasswordHistory;
|
10
10
|
tslib_1.__decorate([
|
11
11
|
(0, typeorm_1.PrimaryColumn)(),
|
12
|
-
(0, type_graphql_1.Field)(type => type_graphql_1.ID),
|
12
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.ID, { description: 'The ID of the user associated with this password history.' }),
|
13
13
|
tslib_1.__metadata("design:type", String)
|
14
14
|
], PasswordHistory.prototype, "userId", void 0);
|
15
15
|
tslib_1.__decorate([
|
16
16
|
(0, typeorm_1.Column)({
|
17
17
|
nullable: true
|
18
18
|
}),
|
19
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
19
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'A serialized list of past password hashes.' }),
|
20
20
|
tslib_1.__metadata("design:type", String)
|
21
21
|
], PasswordHistory.prototype, "history", void 0);
|
22
22
|
exports.PasswordHistory = PasswordHistory = tslib_1.__decorate([
|
23
23
|
(0, typeorm_1.Entity)(),
|
24
|
-
(0, type_graphql_1.ObjectType)()
|
24
|
+
(0, type_graphql_1.ObjectType)({ description: "Stores a user's password history to prevent reuse." })
|
25
25
|
], PasswordHistory);
|
26
26
|
//# sourceMappingURL=password-history.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"password-history.js","sourceRoot":"","sources":["../../../server/service/password-history/password-history.ts"],"names":[],"mappings":";;;;AAAA,qCAAuD;AACvD,+CAAoD;AAI7C,IAAM,eAAe,GAArB,MAAM,eAAe;CAU3B,CAAA;AAVY,0CAAe;AAG1B;IAFC,IAAA,uBAAa,GAAE;IACf,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,CAAC;;+
|
1
|
+
{"version":3,"file":"password-history.js","sourceRoot":"","sources":["../../../server/service/password-history/password-history.ts"],"names":[],"mappings":";;;;AAAA,qCAAuD;AACvD,+CAAoD;AAI7C,IAAM,eAAe,GAArB,MAAM,eAAe;CAU3B,CAAA;AAVY,0CAAe;AAG1B;IAFC,IAAA,uBAAa,GAAE;IACf,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,EAAE,EAAE,WAAW,EAAE,2DAA2D,EAAE,CAAC;;+CAClF;AAMd;IAJC,IAAA,gBAAM,EAAC;QACN,QAAQ,EAAE,IAAI;KACf,CAAC;IACD,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,4CAA4C,EAAE,CAAC;;gDACtE;0BATJ,eAAe;IAF3B,IAAA,gBAAM,GAAE;IACR,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,oDAAoD,EAAE,CAAC;GACrE,eAAe,CAU3B","sourcesContent":["import { Entity, Column, PrimaryColumn } from 'typeorm'\nimport { ObjectType, Field, ID } from 'type-graphql'\n\n@Entity()\n@ObjectType({ description: \"Stores a user's password history to prevent reuse.\" })\nexport class PasswordHistory {\n @PrimaryColumn()\n @Field(type => ID, { description: 'The ID of the user associated with this password history.' })\n userId: string\n\n @Column({\n nullable: true\n })\n @Field({ nullable: true, description: 'A serialized list of past password hashes.' })\n history: string\n}\n"]}
|