@authup/server-core 1.0.0-beta.60 → 1.0.0-beta.62

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.
Files changed (172) hide show
  1. package/dist/adapters/database/domains/client-scope/entity.d.ts.map +1 -1
  2. package/dist/adapters/database/domains/client-scope/entity.mjs +16 -8
  3. package/dist/adapters/database/domains/client-scope/entity.mjs.map +1 -1
  4. package/dist/adapters/database/domains/identity-provider-account/entity.d.ts.map +1 -1
  5. package/dist/adapters/database/domains/identity-provider-account/entity.mjs +1 -1
  6. package/dist/adapters/database/domains/identity-provider-account/entity.mjs.map +1 -1
  7. package/dist/adapters/database/migrations/mysql/1786631686318-SortIndexesAndAccountUniqueness.d.ts +50 -0
  8. package/dist/adapters/database/migrations/mysql/1786631686318-SortIndexesAndAccountUniqueness.d.ts.map +1 -0
  9. package/dist/adapters/database/migrations/mysql/1786631686318-SortIndexesAndAccountUniqueness.mjs +86 -0
  10. package/dist/adapters/database/migrations/mysql/1786631686318-SortIndexesAndAccountUniqueness.mjs.map +1 -0
  11. package/dist/adapters/database/migrations/postgres/1786631686318-SortIndexesAndAccountUniqueness.d.ts +42 -0
  12. package/dist/adapters/database/migrations/postgres/1786631686318-SortIndexesAndAccountUniqueness.d.ts.map +1 -0
  13. package/dist/adapters/database/migrations/postgres/1786631686318-SortIndexesAndAccountUniqueness.mjs +80 -0
  14. package/dist/adapters/database/migrations/postgres/1786631686318-SortIndexesAndAccountUniqueness.mjs.map +1 -0
  15. package/dist/adapters/http/adapters/oauth2/grant-types/utils/credentials.mjs +1 -1
  16. package/dist/adapters/http/adapters/oauth2/grant-types/utils/guess.mjs +1 -1
  17. package/dist/adapters/http/controllers/entities/client/module.mjs +2 -2
  18. package/dist/adapters/http/controllers/entities/identity-provider/module.d.ts +12 -8
  19. package/dist/adapters/http/controllers/entities/identity-provider/module.d.ts.map +1 -1
  20. package/dist/adapters/http/controllers/entities/identity-provider/module.mjs +137 -88
  21. package/dist/adapters/http/controllers/entities/identity-provider/module.mjs.map +1 -1
  22. package/dist/adapters/http/controllers/entities/identity-provider/types.d.ts +7 -5
  23. package/dist/adapters/http/controllers/entities/identity-provider/types.d.ts.map +1 -1
  24. package/dist/adapters/http/controllers/entities/realm/module.mjs +2 -2
  25. package/dist/adapters/http/controllers/entities/session/module.mjs +2 -2
  26. package/dist/adapters/http/controllers/entities/user/module.mjs +2 -2
  27. package/dist/adapters/http/controllers/entities/user-authenticator/module.mjs +2 -2
  28. package/dist/adapters/http/controllers/workflows/authorize/module.d.ts.map +1 -1
  29. package/dist/adapters/http/controllers/workflows/authorize/module.mjs +9 -5
  30. package/dist/adapters/http/controllers/workflows/authorize/module.mjs.map +1 -1
  31. package/dist/adapters/http/controllers/workflows/token/utils/extract.mjs +2 -1
  32. package/dist/adapters/http/controllers/workflows/token/utils/extract.mjs.map +1 -1
  33. package/dist/adapters/http/middleware/built-in/assets.mjs +1 -1
  34. package/dist/adapters/http/request/helpers/param-id.d.ts.map +1 -1
  35. package/dist/adapters/http/request/helpers/param-id.mjs +2 -1
  36. package/dist/adapters/http/request/helpers/param-id.mjs.map +1 -1
  37. package/dist/adapters/http/ui/account-console/module.mjs +1 -1
  38. package/dist/adapters/http/ui/auth-console/http-client.mjs +1 -1
  39. package/dist/adapters/http/ui/auth-console/module.mjs +1 -1
  40. package/dist/adapters/http/ui/console-packages/module.d.ts +1 -1
  41. package/dist/adapters/http/ui/console-packages/module.mjs +2 -2
  42. package/dist/adapters/http/ui/console-packages/module.mjs.map +1 -1
  43. package/dist/adapters/http/ui/shared/html.d.ts.map +1 -1
  44. package/dist/adapters/http/ui/shared/html.mjs +1 -0
  45. package/dist/adapters/http/ui/shared/html.mjs.map +1 -1
  46. package/dist/app/index.mjs +3 -1
  47. package/dist/app/modules/config/read/env.mjs +1 -1
  48. package/dist/app/modules/database/repositories/event/repository.d.ts +2 -2
  49. package/dist/app/modules/database/repositories/event/repository.d.ts.map +1 -1
  50. package/dist/app/modules/database/repositories/event/repository.mjs +23 -6
  51. package/dist/app/modules/database/repositories/event/repository.mjs.map +1 -1
  52. package/dist/app/modules/database/repositories/identity-provider-account/repository.d.ts.map +1 -1
  53. package/dist/app/modules/database/repositories/identity-provider-account/repository.mjs +9 -1
  54. package/dist/app/modules/database/repositories/identity-provider-account/repository.mjs.map +1 -1
  55. package/dist/app/modules/http/modules/controller.d.ts.map +1 -1
  56. package/dist/app/modules/http/modules/controller.mjs +18 -6
  57. package/dist/app/modules/http/modules/controller.mjs.map +1 -1
  58. package/dist/app/modules/identity/constants.d.ts +2 -1
  59. package/dist/app/modules/identity/constants.d.ts.map +1 -1
  60. package/dist/app/modules/identity/constants.mjs +1 -0
  61. package/dist/app/modules/identity/constants.mjs.map +1 -1
  62. package/dist/app/modules/identity/index.mjs +3 -1
  63. package/dist/app/modules/identity/module.d.ts.map +1 -1
  64. package/dist/app/modules/identity/module.mjs +13 -3
  65. package/dist/app/modules/identity/module.mjs.map +1 -1
  66. package/dist/app/modules/identity/repositories/constants.d.ts +4 -0
  67. package/dist/app/modules/identity/repositories/constants.d.ts.map +1 -0
  68. package/dist/app/modules/identity/repositories/constants.mjs +12 -0
  69. package/dist/app/modules/identity/repositories/constants.mjs.map +1 -0
  70. package/dist/app/modules/identity/repositories/index.d.ts +1 -0
  71. package/dist/app/modules/identity/repositories/index.d.ts.map +1 -1
  72. package/dist/app/modules/identity/repositories/index.mjs +3 -1
  73. package/dist/app/modules/identity/repositories/provider/index.d.ts +1 -0
  74. package/dist/app/modules/identity/repositories/provider/index.d.ts.map +1 -1
  75. package/dist/app/modules/identity/repositories/provider/index.mjs +2 -1
  76. package/dist/app/modules/identity/repositories/provider/link.d.ts +9 -0
  77. package/dist/app/modules/identity/repositories/provider/link.d.ts.map +1 -0
  78. package/dist/app/modules/identity/repositories/provider/link.mjs +34 -0
  79. package/dist/app/modules/identity/repositories/provider/link.mjs.map +1 -0
  80. package/dist/app/modules/identity/repositories/user.d.ts +1 -0
  81. package/dist/app/modules/identity/repositories/user.d.ts.map +1 -1
  82. package/dist/app/modules/identity/repositories/user.mjs +3 -0
  83. package/dist/app/modules/identity/repositories/user.mjs.map +1 -1
  84. package/dist/app/modules/index.mjs +3 -1
  85. package/dist/app/modules/oauth2/repositories/authorize/state/repository.d.ts +1 -2
  86. package/dist/app/modules/oauth2/repositories/authorize/state/repository.d.ts.map +1 -1
  87. package/dist/app/modules/oauth2/repositories/authorize/state/repository.mjs +7 -16
  88. package/dist/app/modules/oauth2/repositories/authorize/state/repository.mjs.map +1 -1
  89. package/dist/app/modules/runtime/module.mjs +2 -2
  90. package/dist/cli/commands/migration.mjs +1 -1
  91. package/dist/core/entities/client-scope/schema.d.ts.map +1 -1
  92. package/dist/core/entities/client-scope/schema.mjs +16 -1
  93. package/dist/core/entities/client-scope/schema.mjs.map +1 -1
  94. package/dist/core/entities/event/constants.d.ts +9 -0
  95. package/dist/core/entities/event/constants.d.ts.map +1 -1
  96. package/dist/core/entities/event/constants.mjs +9 -1
  97. package/dist/core/entities/event/constants.mjs.map +1 -1
  98. package/dist/core/entities/event/index.mjs +2 -2
  99. package/dist/core/entities/event/types.d.ts +11 -2
  100. package/dist/core/entities/event/types.d.ts.map +1 -1
  101. package/dist/core/entities/identity-provider-account/types.d.ts +6 -0
  102. package/dist/core/entities/identity-provider-account/types.d.ts.map +1 -1
  103. package/dist/core/entities/identity-provider-account/types.mjs.map +1 -1
  104. package/dist/core/entities/index.mjs +2 -2
  105. package/dist/core/identity/entities/user/types.d.ts +1 -0
  106. package/dist/core/identity/entities/user/types.d.ts.map +1 -1
  107. package/dist/core/identity/index.mjs +12 -11
  108. package/dist/core/identity/provider/account/constants.d.ts +10 -0
  109. package/dist/core/identity/provider/account/constants.d.ts.map +1 -0
  110. package/dist/core/identity/provider/account/constants.mjs +16 -0
  111. package/dist/core/identity/provider/account/constants.mjs.map +1 -0
  112. package/dist/core/identity/provider/account/index.d.ts +1 -0
  113. package/dist/core/identity/provider/account/index.d.ts.map +1 -1
  114. package/dist/core/identity/provider/account/index.mjs +2 -1
  115. package/dist/core/identity/provider/account/module.d.ts +3 -0
  116. package/dist/core/identity/provider/account/module.d.ts.map +1 -1
  117. package/dist/core/identity/provider/account/module.mjs +54 -27
  118. package/dist/core/identity/provider/account/module.mjs.map +1 -1
  119. package/dist/core/identity/provider/account/types.d.ts +42 -0
  120. package/dist/core/identity/provider/account/types.d.ts.map +1 -1
  121. package/dist/core/identity/provider/authentication/index.mjs +1 -1
  122. package/dist/core/identity/provider/authentication/protocols/oauth2/module.d.ts +18 -0
  123. package/dist/core/identity/provider/authentication/protocols/oauth2/module.d.ts.map +1 -1
  124. package/dist/core/identity/provider/authentication/protocols/oauth2/module.mjs +55 -2
  125. package/dist/core/identity/provider/authentication/protocols/oauth2/module.mjs.map +1 -1
  126. package/dist/core/identity/provider/authentication/protocols/oauth2/types.d.ts +2 -0
  127. package/dist/core/identity/provider/authentication/protocols/oauth2/types.d.ts.map +1 -1
  128. package/dist/core/identity/provider/authentication/protocols/open-id/module.d.ts +0 -3
  129. package/dist/core/identity/provider/authentication/protocols/open-id/module.d.ts.map +1 -1
  130. package/dist/core/identity/provider/authentication/protocols/open-id/module.mjs +0 -17
  131. package/dist/core/identity/provider/authentication/protocols/open-id/module.mjs.map +1 -1
  132. package/dist/core/identity/provider/index.mjs +12 -11
  133. package/dist/core/index.mjs +15 -12
  134. package/dist/core/oauth2/authorization/code-request/verifier/module.d.ts.map +1 -1
  135. package/dist/core/oauth2/authorization/code-request/verifier/module.mjs +9 -2
  136. package/dist/core/oauth2/authorization/code-request/verifier/module.mjs.map +1 -1
  137. package/dist/core/oauth2/authorization/state/module.mjs +1 -2
  138. package/dist/core/oauth2/authorization/state/module.mjs.map +1 -1
  139. package/dist/core/oauth2/authorization/state/types.d.ts +5 -2
  140. package/dist/core/oauth2/authorization/state/types.d.ts.map +1 -1
  141. package/dist/core/oauth2/end-session/service.d.ts.map +1 -1
  142. package/dist/core/oauth2/end-session/service.mjs +1 -0
  143. package/dist/core/oauth2/end-session/service.mjs.map +1 -1
  144. package/dist/core/oauth2/federated-login/index.d.ts +3 -0
  145. package/dist/core/oauth2/federated-login/index.d.ts.map +1 -0
  146. package/dist/core/oauth2/federated-login/index.mjs +6 -0
  147. package/dist/core/oauth2/federated-login/module.d.ts +20 -0
  148. package/dist/core/oauth2/federated-login/module.d.ts.map +1 -0
  149. package/dist/core/oauth2/federated-login/module.mjs +137 -0
  150. package/dist/core/oauth2/federated-login/module.mjs.map +1 -0
  151. package/dist/core/oauth2/federated-login/types.d.ts +138 -0
  152. package/dist/core/oauth2/federated-login/types.d.ts.map +1 -0
  153. package/dist/core/oauth2/federated-login/types.mjs +31 -0
  154. package/dist/core/oauth2/federated-login/types.mjs.map +1 -0
  155. package/dist/core/oauth2/index.d.ts +1 -0
  156. package/dist/core/oauth2/index.d.ts.map +1 -1
  157. package/dist/core/oauth2/index.mjs +4 -1
  158. package/dist/core/provisioning/entities/policy/validator.d.ts.map +1 -1
  159. package/dist/core/provisioning/entities/policy/validator.mjs +2 -1
  160. package/dist/core/provisioning/entities/policy/validator.mjs.map +1 -1
  161. package/dist/core/provisioning/entities/realm/wildcard-validator.d.ts.map +1 -1
  162. package/dist/core/provisioning/entities/realm/wildcard-validator.mjs +2 -1
  163. package/dist/core/provisioning/entities/realm/wildcard-validator.mjs.map +1 -1
  164. package/dist/core/security/policy/evaluator.mjs.map +1 -1
  165. package/dist/index.mjs +3 -1
  166. package/dist/node_modules/@ebec/core/dist/index.mjs +130 -0
  167. package/dist/node_modules/@ebec/core/dist/index.mjs.map +1 -0
  168. package/dist/swagger.json +146 -18
  169. package/dist/utils/error.d.ts.map +1 -1
  170. package/dist/utils/error.mjs +5 -6
  171. package/dist/utils/error.mjs.map +1 -1
  172. package/package.json +28 -28
@@ -1 +1 @@
1
- {"version":3,"file":"module.mjs","names":["ClientIdentityRepository","IdentityProviderAttributeMappingRepository","IdentityProviderPermissionMappingRepository","IdentityProviderRoleMappingRepository","UserIdentityRepository","DatabaseInjectionKey","IdentityProviderAccountRepositoryAdapter","IdentityProviderRepositoryAdapter","ClientEntity","IdentityProviderRepository","RealmEntity","RoleEntity","UserPermissionEntity","UserRepository","UserRoleEntity","ClientRepositoryAdapter","RoleRepositoryAdapter","UserRepositoryAdapter","IdentityPermissionProvider","IdentityProviderAccountManager","IdentityProviderAttributeMapper","IdentityProviderLdapCollectionAuthenticator","IdentityProviderPermissionMapper","IdentityProviderRoleMapper","IdentityResolver","IdentityRoleProvider","LDAPInjectionKey","ModuleName","IdentityInjectionKey","IdentityModule","name","dependencies","IDENTITY","DATABASE","setup","container","dataSource","resolve","DataSource","realmRepository","clientRepository","userRepository","repository","userPermissionRepository","userRoleRepository","register","Resolver","useFactory","clientRepositoryAdapter","userRepositoryAdapter","roleRepositoryAdapter","RoleProvider","PermissionProvider","c","roleRepository","roleProvider","attributeMapperRepository","attributeMapper","roleMapperFinder","roleMapper","permissionMapperRepository","permissionMapper","providerAccountRepository","ProviderAccountManager","identityProviderRepository","ProviderLdapCollectionAuthenticator","accountManager","clientFactory","ClientFactory"],"sources":["../../../../src/app/modules/identity/module.ts"],"sourcesContent":["/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type {\n Client,\n Realm,\n Role,\n UserPermission,\n UserRole,\n} from '@authup/core-kit';\nimport type { Repository } from 'typeorm';\nimport {\n ClientIdentityRepository,\n IdentityProviderAttributeMappingRepository,\n IdentityProviderPermissionMappingRepository,\n IdentityProviderRoleMappingRepository,\n UserIdentityRepository,\n} from './repositories/index.ts';\nimport {\n DatabaseInjectionKey,\n IdentityProviderAccountRepositoryAdapter,\n IdentityProviderRepositoryAdapter,\n} from '../database/index.ts';\nimport {\n ClientEntity,\n IdentityProviderRepository,\n RealmEntity,\n RoleEntity,\n UserPermissionEntity,\n UserRepository,\n UserRoleEntity,\n} from '../../../adapters/database/domains/index.ts';\nimport {\n ClientRepositoryAdapter,\n RoleRepositoryAdapter,\n UserRepositoryAdapter,\n} from '../database/repositories/index.ts';\nimport type { IContainer } from 'eldin';\nimport {\n IdentityPermissionProvider,\n IdentityProviderAccountManager,\n IdentityProviderAttributeMapper,\n IdentityProviderLdapCollectionAuthenticator,\n IdentityProviderPermissionMapper,\n IdentityProviderRoleMapper,\n IdentityResolver,\n IdentityRoleProvider,\n} from '../../../core/index.ts';\nimport { LDAPInjectionKey } from '../ldap/index.ts';\n\nimport type { IModule } from 'orkos';\nimport { ModuleName } from '../constants.ts';\nimport { IdentityInjectionKey } from './constants.ts';\n\nexport class IdentityModule implements IModule {\n readonly name: string;\n\n readonly dependencies: string[];\n\n constructor() {\n this.name = ModuleName.IDENTITY;\n this.dependencies = [ModuleName.DATABASE];\n }\n\n async setup(container: IContainer): Promise<void> {\n const dataSource = container.resolve(DatabaseInjectionKey.DataSource);\n const realmRepository = container.resolve<Repository<Realm>>(RealmEntity);\n\n const clientRepository = new ClientIdentityRepository(\n container.resolve<Repository<Client>>(ClientEntity),\n );\n const userRepository = new UserIdentityRepository({\n repository: new UserRepository(dataSource),\n userPermissionRepository: container.resolve<Repository<UserPermission>>(UserPermissionEntity),\n userRoleRepository: container.resolve<Repository<UserRole>>(UserRoleEntity),\n });\n\n container.register(IdentityInjectionKey.Resolver, {\n useFactory: () => new IdentityResolver({\n clientRepository,\n userRepository,\n }),\n });\n\n // ---------------------------------------------\n\n const clientRepositoryAdapter = new ClientRepositoryAdapter({\n repository: container.resolve<Repository<Client>>(ClientEntity),\n realmRepository,\n });\n const userRepositoryAdapter = new UserRepositoryAdapter({\n repository: new UserRepository(dataSource),\n realmRepository,\n });\n const roleRepositoryAdapter = new RoleRepositoryAdapter({\n repository: container.resolve<Repository<Role>>(RoleEntity),\n realmRepository,\n });\n\n container.register(IdentityInjectionKey.RoleProvider, {\n useFactory: () => new IdentityRoleProvider({\n clientRepository: clientRepositoryAdapter,\n userRepository: userRepositoryAdapter,\n }),\n });\n\n container.register(IdentityInjectionKey.PermissionProvider, {\n useFactory: (c) => new IdentityPermissionProvider({\n clientRepository: clientRepositoryAdapter,\n userRepository: userRepositoryAdapter,\n roleRepository: roleRepositoryAdapter,\n roleProvider: c.resolve(IdentityInjectionKey.RoleProvider),\n }),\n });\n\n // ---------------------------------------------\n\n const attributeMapperRepository = new IdentityProviderAttributeMappingRepository(dataSource);\n const attributeMapper = new IdentityProviderAttributeMapper(attributeMapperRepository);\n\n const roleMapperFinder = new IdentityProviderRoleMappingRepository(dataSource);\n const roleMapper = new IdentityProviderRoleMapper(roleMapperFinder);\n\n const permissionMapperRepository = new IdentityProviderPermissionMappingRepository(dataSource);\n const permissionMapper = new IdentityProviderPermissionMapper(permissionMapperRepository);\n\n const providerAccountRepository = new IdentityProviderAccountRepositoryAdapter(dataSource);\n\n container.register(IdentityInjectionKey.ProviderAccountManager, {\n useFactory: () => new IdentityProviderAccountManager({\n repository: providerAccountRepository,\n userRepository,\n attributeMapper,\n roleMapper,\n permissionMapper,\n }),\n });\n\n // ---------------------------------------------\n\n const identityProviderRepository = new IdentityProviderRepositoryAdapter({\n repository: new IdentityProviderRepository(dataSource),\n realmRepository: container.resolve<Repository<Realm>>(RealmEntity),\n });\n container.register(IdentityInjectionKey.ProviderLdapCollectionAuthenticator, {\n useFactory: (c) => new IdentityProviderLdapCollectionAuthenticator({\n repository: identityProviderRepository,\n accountManager: c.resolve(IdentityInjectionKey.ProviderAccountManager),\n clientFactory: c.resolve(LDAPInjectionKey.ClientFactory),\n }),\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0DA,IAAa6B,iBAAb,MAAaA;CACAC;CAEAC;CAET,cAAc;EACV,KAAKD,OAAOH,WAAWK;EACvB,KAAKD,eAAe,CAACJ,WAAWM,QAAS;CAC7C;CAEA,MAAMC,MAAMC,WAAsC;EAC9C,MAAMC,aAAaD,UAAUE,QAAQhC,qBAAqBiC,UAAU;EACpE,MAAMC,kBAAkBJ,UAAUE,QA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4CAA4CkC,UAAAA;EACnF,MAAMyB,mBAAmB,IAAIvC,iCAAiCsC,0BAAAA;EAE9D,MAAME,4BAA4B,IAAIxD,yCAAyC8B,UAAAA;EAE/ED,UAAUU,SAASjB,qBAAqBmC,wBAAwB,EAC5DhB,kBAAkB,IAAI5B,+BAA+B;GACjDuB,YAAYoB;GACZrB;GACAgB;GACAE;GACAE;EACJ,CAAA,EACJ,CAAA;EAIA,MAAMG,6BAA6B,IAAIzD,kCAAkC;GACrEmC,YAAY,IAAIjC,2BAA2B2B,UAAAA;GAC3CG,iBAAiBJ,UAAUE,QAA2B3B,WAAAA;EAC1D,CAAA;EACAyB,UAAUU,SAASjB,qBAAqBqC,qCAAqC,EACzElB,aAAaM,MAAM,IAAIhC,4CAA4C;GAC/DqB,YAAYsB;GACZE,gBAAgBb,EAAEhB,QAAQT,qBAAqBmC,sBAAsB;GACrEI,eAAed,EAAEhB,QAAQX,iBAAiB0C,aAAa;EAC3D,CAAA,EACJ,CAAA;CACJ;AACJ"}
1
+ {"version":3,"file":"module.mjs","names":["ClientIdentityRepository","IdentityProviderAccountLinkStore","IdentityProviderAttributeMappingRepository","IdentityProviderPermissionMappingRepository","IdentityProviderRoleMappingRepository","UserIdentityRepository","DatabaseInjectionKey","IdentityProviderAccountRepositoryAdapter","IdentityProviderRepositoryAdapter","ClientEntity","IdentityProviderRepository","RealmEntity","RoleEntity","UserPermissionEntity","UserRepository","UserRoleEntity","ClientRepositoryAdapter","RoleRepositoryAdapter","UserRepositoryAdapter","IdentityPermissionProvider","IdentityProviderAccountManager","IdentityProviderAttributeMapper","IdentityProviderLdapCollectionAuthenticator","IdentityProviderPermissionMapper","IdentityProviderRoleMapper","IdentityResolver","IdentityRoleProvider","LDAPInjectionKey","LoggerInjectionKey","CacheInjectionKey","ModuleName","IdentityInjectionKey","IdentityModule","name","dependencies","IDENTITY","DATABASE","setup","container","dataSource","resolve","DataSource","realmRepository","clientRepository","userRepository","repository","userPermissionRepository","userRoleRepository","register","Resolver","useFactory","clientRepositoryAdapter","userRepositoryAdapter","roleRepositoryAdapter","RoleProvider","PermissionProvider","c","roleRepository","roleProvider","attributeMapperRepository","attributeMapper","roleMapperFinder","roleMapper","permissionMapperRepository","permissionMapper","providerAccountRepository","ProviderAccountManager","logger","ProviderAccountLinkStore","cache","identityProviderRepository","ProviderLdapCollectionAuthenticator","accountManager","clientFactory","ClientFactory"],"sources":["../../../../src/app/modules/identity/module.ts"],"sourcesContent":["/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type {\n Client,\n Realm,\n Role,\n UserPermission,\n UserRole,\n} from '@authup/core-kit';\nimport type { Repository } from 'typeorm';\nimport {\n ClientIdentityRepository,\n IdentityProviderAccountLinkStore,\n IdentityProviderAttributeMappingRepository,\n IdentityProviderPermissionMappingRepository,\n IdentityProviderRoleMappingRepository,\n UserIdentityRepository,\n} from './repositories/index.ts';\nimport {\n DatabaseInjectionKey,\n IdentityProviderAccountRepositoryAdapter,\n IdentityProviderRepositoryAdapter,\n} from '../database/index.ts';\nimport {\n ClientEntity,\n IdentityProviderRepository,\n RealmEntity,\n RoleEntity,\n UserPermissionEntity,\n UserRepository,\n UserRoleEntity,\n} from '../../../adapters/database/domains/index.ts';\nimport {\n ClientRepositoryAdapter,\n RoleRepositoryAdapter,\n UserRepositoryAdapter,\n} from '../database/repositories/index.ts';\nimport type { IContainer } from 'eldin';\nimport {\n IdentityPermissionProvider,\n IdentityProviderAccountManager,\n IdentityProviderAttributeMapper,\n IdentityProviderLdapCollectionAuthenticator,\n IdentityProviderPermissionMapper,\n IdentityProviderRoleMapper,\n IdentityResolver,\n IdentityRoleProvider,\n} from '../../../core/index.ts';\nimport { LDAPInjectionKey } from '../ldap/index.ts';\nimport { LoggerInjectionKey } from '../logger/index.ts';\nimport { CacheInjectionKey } from '../cache/index.ts';\n\nimport type { IModule } from 'orkos';\nimport { ModuleName } from '../constants.ts';\nimport { IdentityInjectionKey } from './constants.ts';\n\nexport class IdentityModule implements IModule {\n readonly name: string;\n\n readonly dependencies: string[];\n\n constructor() {\n this.name = ModuleName.IDENTITY;\n this.dependencies = [ModuleName.DATABASE];\n }\n\n async setup(container: IContainer): Promise<void> {\n const dataSource = container.resolve(DatabaseInjectionKey.DataSource);\n const realmRepository = container.resolve<Repository<Realm>>(RealmEntity);\n\n const clientRepository = new ClientIdentityRepository(\n container.resolve<Repository<Client>>(ClientEntity),\n );\n const userRepository = new UserIdentityRepository({\n repository: new UserRepository(dataSource),\n userPermissionRepository: container.resolve<Repository<UserPermission>>(UserPermissionEntity),\n userRoleRepository: container.resolve<Repository<UserRole>>(UserRoleEntity),\n });\n\n container.register(IdentityInjectionKey.Resolver, {\n useFactory: () => new IdentityResolver({\n clientRepository,\n userRepository,\n }),\n });\n\n // ---------------------------------------------\n\n const clientRepositoryAdapter = new ClientRepositoryAdapter({\n repository: container.resolve<Repository<Client>>(ClientEntity),\n realmRepository,\n });\n const userRepositoryAdapter = new UserRepositoryAdapter({\n repository: new UserRepository(dataSource),\n realmRepository,\n });\n const roleRepositoryAdapter = new RoleRepositoryAdapter({\n repository: container.resolve<Repository<Role>>(RoleEntity),\n realmRepository,\n });\n\n container.register(IdentityInjectionKey.RoleProvider, {\n useFactory: () => new IdentityRoleProvider({\n clientRepository: clientRepositoryAdapter,\n userRepository: userRepositoryAdapter,\n }),\n });\n\n container.register(IdentityInjectionKey.PermissionProvider, {\n useFactory: (c) => new IdentityPermissionProvider({\n clientRepository: clientRepositoryAdapter,\n userRepository: userRepositoryAdapter,\n roleRepository: roleRepositoryAdapter,\n roleProvider: c.resolve(IdentityInjectionKey.RoleProvider),\n }),\n });\n\n // ---------------------------------------------\n\n const attributeMapperRepository = new IdentityProviderAttributeMappingRepository(dataSource);\n const attributeMapper = new IdentityProviderAttributeMapper(attributeMapperRepository);\n\n const roleMapperFinder = new IdentityProviderRoleMappingRepository(dataSource);\n const roleMapper = new IdentityProviderRoleMapper(roleMapperFinder);\n\n const permissionMapperRepository = new IdentityProviderPermissionMappingRepository(dataSource);\n const permissionMapper = new IdentityProviderPermissionMapper(permissionMapperRepository);\n\n const providerAccountRepository = new IdentityProviderAccountRepositoryAdapter(dataSource);\n\n container.register(IdentityInjectionKey.ProviderAccountManager, {\n useFactory: (c) => new IdentityProviderAccountManager({\n repository: providerAccountRepository,\n userRepository,\n attributeMapper,\n roleMapper,\n permissionMapper,\n logger: c.resolve(LoggerInjectionKey),\n }),\n });\n\n container.register(IdentityInjectionKey.ProviderAccountLinkStore, {\n // lazy: the cache module is not a declared dependency of this\n // one, and a factory only runs once something resolves the store\n useFactory: (c) => {\n const cache = c.resolve(CacheInjectionKey);\n\n return new IdentityProviderAccountLinkStore(cache);\n },\n });\n\n // ---------------------------------------------\n\n const identityProviderRepository = new IdentityProviderRepositoryAdapter({\n repository: new IdentityProviderRepository(dataSource),\n realmRepository: container.resolve<Repository<Realm>>(RealmEntity),\n });\n container.register(IdentityInjectionKey.ProviderLdapCollectionAuthenticator, {\n useFactory: (c) => new IdentityProviderLdapCollectionAuthenticator({\n repository: identityProviderRepository,\n accountManager: c.resolve(IdentityInjectionKey.ProviderAccountManager),\n clientFactory: c.resolve(LDAPInjectionKey.ClientFactory),\n }),\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6DA,IAAagC,iBAAb,MAAaA;CACAC;CAEAC;CAET,cAAc;EACV,KAAKD,OAAOH,WAAWK;EACvB,KAAKD,eAAe,CAACJ,WAAWM,QAAS;CAC7C;CAEA,MAAMC,MAAMC,WAAsC;EAC9C,MAAMC,aAAaD,UAAUE,QAAQlC,qBAAqBmC,UAAU;EACpE,MAAMC,kBAAkBJ,UAAUE,QAA2B7B,WAAAA;EAE7D,MAAMgC,mBAAmB,IAAI3C,yBACzBsC,UAAUE,QAA4B/B,YAAAA,CAAAA;EAE1C,MAAMmC,iBAAiB,IAAIvC,uBAAuB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AAUU,SAASjB,qBAAqBmC,wBAAwB,EAC5DhB,aAAaM,MAAM,IAAIpC,+BAA+B;GAClDyB,YAAYoB;GACZrB;GACAgB;GACAE;GACAE;GACAG,QAAQX,EAAEhB,QAAQZ,kBAAAA;EACtB,CAAA,EACJ,CAAA;EAEAU,UAAUU,SAASjB,qBAAqBqC,0BAA0B,EAG9DlB,aAAaM,MAAAA;GACT,MAAMa,QAAQb,EAAEhB,QAAQX,iBAAAA;GAExB,OAAO,IAAI5B,iCAAiCoE,KAAAA;EAChD,EACJ,CAAA;EAIA,MAAMC,6BAA6B,IAAI9D,kCAAkC;GACrEqC,YAAY,IAAInC,2BAA2B6B,UAAAA;GAC3CG,iBAAiBJ,UAAUE,QAA2B7B,WAAAA;EAC1D,CAAA;EACA2B,UAAUU,SAASjB,qBAAqBwC,qCAAqC,EACzErB,aAAaM,MAAM,IAAIlC,4CAA4C;GAC/DuB,YAAYyB;GACZE,gBAAgBhB,EAAEhB,QAAQT,qBAAqBmC,sBAAsB;GACrEO,eAAejB,EAAEhB,QAAQb,iBAAiB+C,aAAa;EAC3D,CAAA,EACJ,CAAA;CACJ;AACJ"}
@@ -0,0 +1,4 @@
1
+ export declare enum CacheIdentityPrefix {
2
+ PROVIDER_ACCOUNT_LINK = "identity_provider_account_link"
3
+ }
4
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../src/app/modules/identity/repositories/constants.ts"],"names":[],"mappings":"AAOA,oBAAY,mBAAmB;IAC3B,qBAAqB,mCAAmC;CAC3D"}
@@ -0,0 +1,12 @@
1
+ import "node:path";
2
+ import "node:url";
3
+ import.meta.url;
4
+ //#region src/app/modules/identity/repositories/constants.ts
5
+ var CacheIdentityPrefix = /*#__PURE__*/ function(CacheIdentityPrefix) {
6
+ CacheIdentityPrefix["PROVIDER_ACCOUNT_LINK"] = "identity_provider_account_link";
7
+ return CacheIdentityPrefix;
8
+ }({});
9
+ //#endregion
10
+ export { CacheIdentityPrefix };
11
+
12
+ //# sourceMappingURL=constants.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.mjs","names":["CacheIdentityPrefix"],"sources":["../../../../../src/app/modules/identity/repositories/constants.ts"],"sourcesContent":["/*\n * Copyright (c) 2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nexport enum CacheIdentityPrefix {\n PROVIDER_ACCOUNT_LINK = 'identity_provider_account_link',\n}\n"],"mappings":";;;;AAOA,IAAO,sBAAKA,uBAAAA,qBAAAA;;CAAAA,OAAAA;AAEX,EAAA,CAAA,CAAA"}
@@ -1,4 +1,5 @@
1
1
  export * from './provider/index.ts';
2
+ export * from './constants.ts';
2
3
  export * from './client.ts';
3
4
  export * from './user.ts';
4
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/app/modules/identity/repositories/index.ts"],"names":[],"mappings":"AAOA,cAAc,qBAAqB,CAAC;AAEpC,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/app/modules/identity/repositories/index.ts"],"names":[],"mappings":"AAOA,cAAc,qBAAqB,CAAC;AAEpC,cAAc,gBAAgB,CAAC;AAE/B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC"}
@@ -4,7 +4,9 @@ import.meta.url;
4
4
  import { IdentityProviderAttributeMappingRepository } from "./provider/mapper/attribute.mjs";
5
5
  import { IdentityProviderPermissionMappingRepository } from "./provider/mapper/permission.mjs";
6
6
  import { IdentityProviderRoleMappingRepository } from "./provider/mapper/role.mjs";
7
+ import { CacheIdentityPrefix } from "./constants.mjs";
8
+ import { IdentityProviderAccountLinkStore } from "./provider/link.mjs";
7
9
  import "./provider/index.mjs";
8
10
  import { ClientIdentityRepository } from "./client.mjs";
9
11
  import { UserIdentityRepository } from "./user.mjs";
10
- export { ClientIdentityRepository, IdentityProviderAttributeMappingRepository, IdentityProviderPermissionMappingRepository, IdentityProviderRoleMappingRepository, UserIdentityRepository };
12
+ export { CacheIdentityPrefix, ClientIdentityRepository, IdentityProviderAccountLinkStore, IdentityProviderAttributeMappingRepository, IdentityProviderPermissionMappingRepository, IdentityProviderRoleMappingRepository, UserIdentityRepository };
@@ -1,2 +1,3 @@
1
1
  export * from './mapper/index.ts';
2
+ export * from './link.ts';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/app/modules/identity/repositories/provider/index.ts"],"names":[],"mappings":"AAOA,cAAc,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/app/modules/identity/repositories/provider/index.ts"],"names":[],"mappings":"AAOA,cAAc,mBAAmB,CAAC;AAClC,cAAc,WAAW,CAAC"}
@@ -5,4 +5,5 @@ import { IdentityProviderAttributeMappingRepository } from "./mapper/attribute.m
5
5
  import { IdentityProviderPermissionMappingRepository } from "./mapper/permission.mjs";
6
6
  import { IdentityProviderRoleMappingRepository } from "./mapper/role.mjs";
7
7
  import "./mapper/index.mjs";
8
- export { IdentityProviderAttributeMappingRepository, IdentityProviderPermissionMappingRepository, IdentityProviderRoleMappingRepository };
8
+ import { IdentityProviderAccountLinkStore } from "./link.mjs";
9
+ export { IdentityProviderAccountLinkStore, IdentityProviderAttributeMappingRepository, IdentityProviderPermissionMappingRepository, IdentityProviderRoleMappingRepository };
@@ -0,0 +1,9 @@
1
+ import type { ICache } from '@authup/server-kit';
2
+ import type { IIdentityProviderAccountLinkStore, IdentityProviderAccountLink } from '../../../../../core/index.ts';
3
+ export declare class IdentityProviderAccountLinkStore implements IIdentityProviderAccountLinkStore {
4
+ protected cache: ICache;
5
+ constructor(cache: ICache);
6
+ save(data: IdentityProviderAccountLink): Promise<string>;
7
+ consume(handle: string): Promise<IdentityProviderAccountLink | null>;
8
+ }
9
+ //# sourceMappingURL=link.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../../../../../../src/app/modules/identity/repositories/provider/link.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,KAAK,EACR,iCAAiC,EACjC,2BAA2B,EAC9B,MAAM,8BAA8B,CAAC;AAItC,qBAAa,gCAAiC,YAAW,iCAAiC;IACtF,SAAS,CAAC,KAAK,EAAG,MAAM,CAAC;gBAEb,KAAK,EAAE,MAAM;IAInB,IAAI,CAAC,IAAI,EAAE,2BAA2B,GAAG,OAAO,CAAC,MAAM,CAAC;IAexD,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,2BAA2B,GAAG,IAAI,CAAC;CAY7E"}
@@ -0,0 +1,34 @@
1
+ import "node:path";
2
+ import "node:url";
3
+ import.meta.url;
4
+ import { IDENTITY_PROVIDER_ACCOUNT_LINK_TTL } from "../../../../../core/identity/provider/account/constants.mjs";
5
+ import "../../../../../core/index.mjs";
6
+ import { CacheIdentityPrefix } from "../constants.mjs";
7
+ import { createNanoID } from "@authup/kit";
8
+ import { buildCacheKey } from "@authup/server-kit";
9
+ //#region src/app/modules/identity/repositories/provider/link.ts
10
+ var IdentityProviderAccountLinkStore = class {
11
+ cache;
12
+ constructor(cache) {
13
+ this.cache = cache;
14
+ }
15
+ async save(data) {
16
+ const handle = createNanoID();
17
+ await this.cache.set(buildCacheKey({
18
+ prefix: CacheIdentityPrefix.PROVIDER_ACCOUNT_LINK,
19
+ key: handle
20
+ }), data, { ttl: IDENTITY_PROVIDER_ACCOUNT_LINK_TTL });
21
+ return handle;
22
+ }
23
+ async consume(handle) {
24
+ const key = buildCacheKey({
25
+ prefix: CacheIdentityPrefix.PROVIDER_ACCOUNT_LINK,
26
+ key: handle
27
+ });
28
+ return this.cache.pop(key);
29
+ }
30
+ };
31
+ //#endregion
32
+ export { IdentityProviderAccountLinkStore };
33
+
34
+ //# sourceMappingURL=link.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"link.mjs","names":["createNanoID","buildCacheKey","IDENTITY_PROVIDER_ACCOUNT_LINK_TTL","CacheIdentityPrefix","IdentityProviderAccountLinkStore","cache","save","data","handle","set","prefix","PROVIDER_ACCOUNT_LINK","key","ttl","consume","pop"],"sources":["../../../../../../src/app/modules/identity/repositories/provider/link.ts"],"sourcesContent":["/*\n * Copyright (c) 2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { createNanoID } from '@authup/kit';\nimport type { ICache } from '@authup/server-kit';\nimport { buildCacheKey } from '@authup/server-kit';\nimport type {\n IIdentityProviderAccountLinkStore,\n IdentityProviderAccountLink,\n} from '../../../../../core/index.ts';\nimport { IDENTITY_PROVIDER_ACCOUNT_LINK_TTL } from '../../../../../core/index.ts';\nimport { CacheIdentityPrefix } from '../constants.ts';\n\nexport class IdentityProviderAccountLinkStore implements IIdentityProviderAccountLinkStore {\n protected cache : ICache;\n\n constructor(cache: ICache) {\n this.cache = cache;\n }\n\n async save(data: IdentityProviderAccountLink): Promise<string> {\n const handle = createNanoID();\n\n await this.cache.set(\n buildCacheKey({\n prefix: CacheIdentityPrefix.PROVIDER_ACCOUNT_LINK,\n key: handle,\n }),\n data,\n { ttl: IDENTITY_PROVIDER_ACCOUNT_LINK_TTL },\n );\n\n return handle;\n }\n\n async consume(handle: string): Promise<IdentityProviderAccountLink | null> {\n const key = buildCacheKey({\n prefix: CacheIdentityPrefix.PROVIDER_ACCOUNT_LINK,\n key: handle,\n });\n\n // `pop` is the atomic read-and-drop (redis GETDEL, one tick on the\n // memory adapter). A get followed by a drop is two round-trips, and\n // two simultaneous redemptions of one handle would both read the\n // payload before either drop landed.\n return this.cache.pop<IdentityProviderAccountLink>(key);\n }\n}\n"],"mappings":";;;;;;;;;AAiBA,IAAaI,mCAAb,MAAaA;CACCC;CAEV,YAAYA,OAAe;EACvB,KAAKA,QAAQA;CACjB;CAEA,MAAMC,KAAKC,MAAoD;EAC3D,MAAMC,SAASR,aAAAA;EAEf,MAAM,KAAKK,MAAMI,IACbR,cAAc;GACVS,QAAQP,oBAAoBQ;GAC5BC,KAAKJ;EACT,CAAA,GACAD,MACA,EAAEM,KAAKX,mCAAmC,CAAA;EAG9C,OAAOM;CACX;CAEA,MAAMM,QAAQN,QAA6D;EACvE,MAAMI,MAAMX,cAAc;GACtBS,QAAQP,oBAAoBQ;GAC5BC,KAAKJ;EACT,CAAA;EAMA,OAAO,KAAKH,MAAMU,IAAiCH,GAAAA;CACvD;AACJ"}
@@ -18,6 +18,7 @@ export declare class UserIdentityRepository implements IUserIdentityRepository {
18
18
  findOneBy(where: Record<string, any>): Promise<User | null>;
19
19
  private find;
20
20
  saveOneWithEA(user: Partial<User>, extraAttributes: Record<string, any>): Promise<User>;
21
+ remove(user: User): Promise<void>;
21
22
  savePermissions(user: User, items: IdentityProviderMapperElement[]): Promise<void>;
22
23
  saveRoles(user: User, items: IdentityProviderMapperElement[]): Promise<void>;
23
24
  }
@@ -1 +1 @@
1
- {"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../../../../../src/app/modules/identity/repositories/user.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,IAAI,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAGvE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C,OAAO,KAAK,EAAE,uBAAuB,EAAE,6BAA6B,EAAE,MAAM,2BAA2B,CAAC;AAExG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gDAAgD,CAAC;AAGrF,MAAM,MAAM,6BAA6B,GAAG;IACxC,UAAU,EAAE,cAAc,CAAC;IAC3B,wBAAwB,EAAE,UAAU,CAAC,cAAc,CAAC,CAAC;IAC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EAAE,6BAA6B,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAwDlF,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,6BAA6B,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAqDrF"}
@@ -53,6 +53,9 @@ var UserIdentityRepository = class {
53
53
  const entity = this.repository.create(user);
54
54
  return this.repository.saveOneWithEA(entity, extraAttributes);
55
55
  }
56
+ async remove(user) {
57
+ await this.repository.remove(user);
58
+ }
56
59
  async savePermissions(user, items) {
57
60
  const { userPermissionRepository: repository } = this;
58
61
  const ids = items.map((item) => item.value);
@@ -1 +1 @@
1
- {"version":3,"file":"user.mjs","names":["isUUID","buildRedisKeyPath","In","IdentityProviderMapperOperation","CachePrefix","UserIdentityRepository","repository","userPermissionRepository","userRoleRepository","ctx","findOneById","id","find","findOneByName","realm","findOneByIdOrName","idOrName","findOneBy","where","key","realmKey","query","createQueryBuilder","leftJoinAndSelect","isId","name","trim","toLowerCase","andWhere","realmId","realmName","columns","metadata","column","isSelect","addSelect","propertyName","cache","prefix","USER","entity","getOne","extendOneWithEA","saveOneWithEA","user","extraAttributes","create","savePermissions","items","ids","map","item","value","idsToDelete","filter","operation","DELETE","entities","findBy","userId","permissionId","entitiesToDelete","index","indexOf","push","length","remove","entitiesToCreate","CREATE","findIndex","userRealmId","permissionRealmId","save","saveRoles","roleId","roleRealmId"],"sources":["../../../../../src/app/modules/identity/repositories/user.ts"],"sourcesContent":["/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { User, UserPermission, UserRole } from '@authup/core-kit';\nimport { isUUID } from '@authup/kit';\nimport { buildRedisKeyPath } from '@authup/server-kit';\nimport type { Repository } from 'typeorm';\nimport { In } from 'typeorm';\nimport type { IUserIdentityRepository, IdentityProviderMapperElement } from '../../../../core/index.ts';\nimport { IdentityProviderMapperOperation } from '../../../../core/index.ts';\nimport type { UserRepository } from '../../../../adapters/database/domains/index.ts';\nimport { CachePrefix } from '../../../../adapters/database/domains/index.ts';\n\nexport type UserIdentityRepositoryContext = {\n repository: UserRepository,\n userPermissionRepository: Repository<UserPermission>,\n userRoleRepository: Repository<UserRole>,\n};\n\nexport class UserIdentityRepository implements IUserIdentityRepository {\n private readonly repository: UserRepository;\n\n private readonly userPermissionRepository: Repository<UserPermission>;\n\n private readonly userRoleRepository: Repository<UserRole>;\n\n constructor(ctx: UserIdentityRepositoryContext) {\n this.repository = ctx.repository;\n this.userPermissionRepository = ctx.userPermissionRepository;\n this.userRoleRepository = ctx.userRoleRepository;\n }\n\n async findOneById(id: string): Promise<User | null> {\n return this.find(id);\n }\n\n async findOneByName(id: string, realm?: string): Promise<User | null> {\n return this.find(id, realm);\n }\n\n async findOneByIdOrName(idOrName: string, realm?: string): Promise<User | null> {\n return this.find(idOrName, realm);\n }\n\n async findOneBy(where: Record<string, any>): Promise<User | null> {\n return this.repository.findOneBy(where);\n }\n\n private async find(key: string, realmKey?: string) : Promise<User | null> {\n const query = this.repository.createQueryBuilder('user')\n .leftJoinAndSelect('user.realm', 'realm');\n\n const isId = isUUID(key);\n if (isId) {\n query.where('user.id = :id', { id: key });\n } else {\n query.where('user.name = :name', { name: key.trim().toLowerCase() });\n\n if (realmKey) {\n if (isUUID(realmKey)) {\n query.andWhere('user.realmId = :realmId', { realmId: realmKey });\n } else {\n query.andWhere('realm.name = :realmName', { realmName: realmKey.trim().toLowerCase() });\n }\n }\n }\n\n const { columns } = this.repository.metadata;\n for (const column of columns) {\n if (!column.isSelect) {\n query.addSelect(`user.${column.propertyName}`);\n }\n }\n\n if (isId) {\n query.cache(\n buildRedisKeyPath({\n prefix: CachePrefix.USER,\n key,\n }),\n 60_000,\n );\n }\n\n const entity = await query.getOne();\n if (entity) {\n return this.repository.extendOneWithEA(entity);\n }\n\n return null;\n }\n\n async saveOneWithEA(user: Partial<User>, extraAttributes: Record<string, any>): Promise<User> {\n const entity = this.repository.create(user);\n return this.repository.saveOneWithEA(entity, extraAttributes);\n }\n\n async savePermissions(user: User, items: IdentityProviderMapperElement[]): Promise<void> {\n const { userPermissionRepository: repository } = this;\n\n const ids = items.map((item) => item.value);\n\n const idsToDelete = items\n .filter((item) => item.operation === IdentityProviderMapperOperation.DELETE)\n .map((item) => item.value);\n\n const entities = await repository.findBy({\n userId: user.id,\n permissionId: In(ids),\n });\n\n const entitiesToDelete : UserPermission[] = [];\n for (const entity of entities) {\n const index = idsToDelete.indexOf(entity.permissionId);\n if (index === -1) {\n continue;\n }\n\n entitiesToDelete.push(entity);\n }\n\n if (entitiesToDelete.length > 0) {\n await repository.remove(entitiesToDelete);\n }\n\n const entitiesToCreate : UserPermission[] = [];\n for (const item of items) {\n if (item.operation !== IdentityProviderMapperOperation.CREATE) {\n continue;\n }\n\n const index = entities.findIndex(\n (entity) => entity.permissionId === item.value,\n );\n if (index !== -1) {\n continue;\n }\n\n const entity = repository.create({\n userId: user.id,\n userRealmId: user.realmId,\n permissionId: item.value as string,\n permissionRealmId: item.realmId as string,\n });\n\n entitiesToCreate.push(entity);\n }\n\n if (entitiesToCreate.length > 0) {\n await repository.save(entitiesToCreate);\n }\n }\n\n async saveRoles(user: User, items: IdentityProviderMapperElement[]): Promise<void> {\n const { userRoleRepository: repository } = this;\n\n const ids = items.map((item) => item.value);\n\n const idsToDelete = items\n .filter((item) => item.operation === IdentityProviderMapperOperation.DELETE)\n .map((item) => item.value);\n\n const entities = await repository.findBy({\n userId: user.id,\n roleId: In(ids),\n });\n\n const entitiesToDelete : UserRole[] = [];\n for (const entity of entities) {\n const index = idsToDelete.indexOf(entity.roleId);\n if (index === -1) {\n continue;\n }\n\n entitiesToDelete.push(entity);\n }\n\n if (entitiesToDelete.length > 0) {\n await repository.remove(entitiesToDelete);\n }\n\n const entitiesToCreate : UserRole[] = [];\n for (const item of items) {\n if (item.operation !== IdentityProviderMapperOperation.CREATE) {\n continue;\n }\n\n const index = entities.findIndex((entity) => entity.roleId === item.value);\n if (index !== -1) {\n continue;\n }\n\n const entity = repository.create({\n userId: user.id,\n userRealmId: user.realmId,\n roleId: item.value as string,\n roleRealmId: item.realmId as string,\n });\n\n entitiesToCreate.push(entity);\n }\n\n if (entitiesToCreate.length > 0) {\n await repository.save(entitiesToCreate);\n }\n }\n}\n"],"mappings":";;;;;;;;;;;AAuBA,IAAaK,yBAAb,MAAaA;CACQC;CAEAC;CAEAC;CAEjB,YAAYC,KAAoC;EAC5C,KAAKH,aAAaG,IAAIH;EACtB,KAAKC,2BAA2BE,IAAIF;EACpC,KAAKC,qBAAqBC,IAAID;CAClC;CAEA,MAAME,YAAYC,IAAkC;EAChD,OAAO,KAAKC,KAAKD,EAAAA;CACrB;CAEA,MAAME,cAAcF,IAAYG,OAAsC;EAClE,OAAO,KAAKF,KAAKD,IAAIG,KAAAA;CACzB;CAEA,MAAMC,kBAAkBC,UAAkBF,OAAsC;EAC5E,OAAO,KAAKF,KAAKI,UAAUF,KAAAA;CAC/B;CAEA,MAAMG,UAAUC,OAAkD;EAC9D,OAAO,KAAKZ,WAAWW,UAAUC,KAAAA;CACrC;CAEA,MAAcN,KAAKO,KAAaC,UAA0C;EACtE,MAAMC,QAAQ,KAAKf,WAAWgB,mBAAmB,MAAA,CAAA,CAC5CC,kBAAkB,cAAc,OAAA;EAErC,MAAMC,OAAOxB,OAAOmB,GAAAA;EACpB,IAAIK,MACAH,MAAMH,MAAM,iBAAiB,EAAEP,IAAIQ,IAAI,CAAA;OACpC;GACHE,MAAMH,MAAM,qBAAqB,EAAEO,MAAMN,IAAIO,KAAI,CAAA,CAAGC,YAAW,EAAG,CAAA;GAElE,IAAIP,UACA,IAAIpB,OAAOoB,QAAAA,GACPC,MAAMO,SAAS,2BAA2B,EAAEC,SAAST,SAAS,CAAA;QAE9DC,MAAMO,SAAS,2BAA2B,EAAEE,WAAWV,SAASM,KAAI,CAAA,CAAGC,YAAW,EAAG,CAAA;EAGjG;EAEA,MAAM,EAAEI,YAAY,KAAKzB,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2B,iBAAiBF,SAAS,GAC1B,MAAM3D,WAAWkE,KAAKL,gBAAAA;CAE9B;AACJ"}
1
+ {"version":3,"file":"user.mjs","names":["isUUID","buildRedisKeyPath","In","IdentityProviderMapperOperation","CachePrefix","UserIdentityRepository","repository","userPermissionRepository","userRoleRepository","ctx","findOneById","id","find","findOneByName","realm","findOneByIdOrName","idOrName","findOneBy","where","key","realmKey","query","createQueryBuilder","leftJoinAndSelect","isId","name","trim","toLowerCase","andWhere","realmId","realmName","columns","metadata","column","isSelect","addSelect","propertyName","cache","prefix","USER","entity","getOne","extendOneWithEA","saveOneWithEA","user","extraAttributes","create","remove","savePermissions","items","ids","map","item","value","idsToDelete","filter","operation","DELETE","entities","findBy","userId","permissionId","entitiesToDelete","index","indexOf","push","length","entitiesToCreate","CREATE","findIndex","userRealmId","permissionRealmId","save","saveRoles","roleId","roleRealmId"],"sources":["../../../../../src/app/modules/identity/repositories/user.ts"],"sourcesContent":["/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { User, UserPermission, UserRole } from '@authup/core-kit';\nimport { isUUID } from '@authup/kit';\nimport { buildRedisKeyPath } from '@authup/server-kit';\nimport type { Repository } from 'typeorm';\nimport { In } from 'typeorm';\nimport type { IUserIdentityRepository, IdentityProviderMapperElement } from '../../../../core/index.ts';\nimport { IdentityProviderMapperOperation } from '../../../../core/index.ts';\nimport type { UserEntity, UserRepository } from '../../../../adapters/database/domains/index.ts';\nimport { CachePrefix } from '../../../../adapters/database/domains/index.ts';\n\nexport type UserIdentityRepositoryContext = {\n repository: UserRepository,\n userPermissionRepository: Repository<UserPermission>,\n userRoleRepository: Repository<UserRole>,\n};\n\nexport class UserIdentityRepository implements IUserIdentityRepository {\n private readonly repository: UserRepository;\n\n private readonly userPermissionRepository: Repository<UserPermission>;\n\n private readonly userRoleRepository: Repository<UserRole>;\n\n constructor(ctx: UserIdentityRepositoryContext) {\n this.repository = ctx.repository;\n this.userPermissionRepository = ctx.userPermissionRepository;\n this.userRoleRepository = ctx.userRoleRepository;\n }\n\n async findOneById(id: string): Promise<User | null> {\n return this.find(id);\n }\n\n async findOneByName(id: string, realm?: string): Promise<User | null> {\n return this.find(id, realm);\n }\n\n async findOneByIdOrName(idOrName: string, realm?: string): Promise<User | null> {\n return this.find(idOrName, realm);\n }\n\n async findOneBy(where: Record<string, any>): Promise<User | null> {\n return this.repository.findOneBy(where);\n }\n\n private async find(key: string, realmKey?: string) : Promise<User | null> {\n const query = this.repository.createQueryBuilder('user')\n .leftJoinAndSelect('user.realm', 'realm');\n\n const isId = isUUID(key);\n if (isId) {\n query.where('user.id = :id', { id: key });\n } else {\n query.where('user.name = :name', { name: key.trim().toLowerCase() });\n\n if (realmKey) {\n if (isUUID(realmKey)) {\n query.andWhere('user.realmId = :realmId', { realmId: realmKey });\n } else {\n query.andWhere('realm.name = :realmName', { realmName: realmKey.trim().toLowerCase() });\n }\n }\n }\n\n const { columns } = this.repository.metadata;\n for (const column of columns) {\n if (!column.isSelect) {\n query.addSelect(`user.${column.propertyName}`);\n }\n }\n\n if (isId) {\n query.cache(\n buildRedisKeyPath({\n prefix: CachePrefix.USER,\n key,\n }),\n 60_000,\n );\n }\n\n const entity = await query.getOne();\n if (entity) {\n return this.repository.extendOneWithEA(entity);\n }\n\n return null;\n }\n\n async saveOneWithEA(user: Partial<User>, extraAttributes: Record<string, any>): Promise<User> {\n const entity = this.repository.create(user);\n return this.repository.saveOneWithEA(entity, extraAttributes);\n }\n\n async remove(user: User): Promise<void> {\n await this.repository.remove(user as UserEntity);\n }\n\n async savePermissions(user: User, items: IdentityProviderMapperElement[]): Promise<void> {\n const { userPermissionRepository: repository } = this;\n\n const ids = items.map((item) => item.value);\n\n const idsToDelete = items\n .filter((item) => item.operation === IdentityProviderMapperOperation.DELETE)\n .map((item) => item.value);\n\n const entities = await repository.findBy({\n userId: user.id,\n permissionId: In(ids),\n });\n\n const entitiesToDelete : UserPermission[] = [];\n for (const entity of entities) {\n const index = idsToDelete.indexOf(entity.permissionId);\n if (index === -1) {\n continue;\n }\n\n entitiesToDelete.push(entity);\n }\n\n if (entitiesToDelete.length > 0) {\n await repository.remove(entitiesToDelete);\n }\n\n const entitiesToCreate : UserPermission[] = [];\n for (const item of items) {\n if (item.operation !== IdentityProviderMapperOperation.CREATE) {\n continue;\n }\n\n const index = entities.findIndex(\n (entity) => entity.permissionId === item.value,\n );\n if (index !== -1) {\n continue;\n }\n\n const entity = repository.create({\n userId: user.id,\n userRealmId: user.realmId,\n permissionId: item.value as string,\n permissionRealmId: item.realmId as string,\n });\n\n entitiesToCreate.push(entity);\n }\n\n if (entitiesToCreate.length > 0) {\n await repository.save(entitiesToCreate);\n }\n }\n\n async saveRoles(user: User, items: IdentityProviderMapperElement[]): Promise<void> {\n const { userRoleRepository: repository } = this;\n\n const ids = items.map((item) => item.value);\n\n const idsToDelete = items\n .filter((item) => item.operation === IdentityProviderMapperOperation.DELETE)\n .map((item) => item.value);\n\n const entities = await repository.findBy({\n userId: user.id,\n roleId: In(ids),\n });\n\n const entitiesToDelete : UserRole[] = [];\n for (const entity of entities) {\n const index = idsToDelete.indexOf(entity.roleId);\n if (index === -1) {\n continue;\n }\n\n entitiesToDelete.push(entity);\n }\n\n if (entitiesToDelete.length > 0) {\n await repository.remove(entitiesToDelete);\n }\n\n const entitiesToCreate : UserRole[] = [];\n for (const item of items) {\n if (item.operation !== IdentityProviderMapperOperation.CREATE) {\n continue;\n }\n\n const index = entities.findIndex((entity) => entity.roleId === item.value);\n if (index !== -1) {\n continue;\n }\n\n const entity = repository.create({\n userId: user.id,\n userRealmId: user.realmId,\n roleId: item.value as string,\n roleRealmId: item.realmId as string,\n });\n\n entitiesToCreate.push(entity);\n }\n\n if (entitiesToCreate.length > 0) {\n await repository.save(entitiesToCreate);\n }\n }\n}\n"],"mappings":";;;;;;;;;;;AAuBA,IAAaK,yBAAb,MAAaA;CACQC;CAEAC;CAEAC;CA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EAC1B;EAEA,IAAI2B,iBAAiBD,SAAS,GAC1B,MAAM5D,WAAWkE,KAAKL,gBAAAA;CAE9B;CAEA,MAAMM,UAAU7B,MAAYK,OAAuD;EAC/E,MAAM,EAAEzC,oBAAoBF,eAAe;EAE3C,MAAM4C,MAAMD,MAAME,KAAKC,SAASA,KAAKC,KAAK;EAE1C,MAAMC,cAAcL,MACfM,QAAQH,SAASA,KAAKI,cAAcrD,gCAAgCsD,MAAM,CAAA,CAC1EN,KAAKC,SAASA,KAAKC,KAAK;EAE7B,MAAMK,WAAW,MAAMpD,WAAWqD,OAAO;GACrCC,QAAQhB,KAAKjC;GACb+D,QAAQxE,GAAGgD,GAAAA;EACf,CAAA;EAEA,MAAMY,mBAAgC,CAAA;EACtC,KAAK,MAAMtB,UAAUkB,UAAU;GAE3B,IADcJ,YAAYU,QAAQxB,OAAOkC,MACrCX,MAAU,IACV;GAGJD,iBAAiBG,KAAKzB,MAAAA;EAC1B;EAEA,IAAIsB,iBAAiBI,SAAS,GAC1B,MAAM5D,WAAWyC,OAAOe,gBAAAA;EAG5B,MAAMK,mBAAgC,CAAA;EACtC,KAAK,MAAMf,QAAQH,OAAO;GACtB,IAAIG,KAAKI,cAAcrD,gCAAgCiE,QACnD;GAIJ,IADcV,SAASW,WAAW7B,WAAWA,OAAOkC,WAAWtB,KAAKC,KAChEU,MAAU,IACV;GAGJ,MAAMvB,SAASlC,WAAWwC,OAAO;IAC7Bc,QAAQhB,KAAKjC;IACb2D,aAAa1B,KAAKf;IAClB6C,QAAQtB,KAAKC;IACbsB,aAAavB,KAAKvB;GACtB,CAAA;GAEAsC,iBAAiBF,KAAKzB,MAAAA;EAC1B;EAEA,IAAI2B,iBAAiBD,SAAS,GAC1B,MAAM5D,WAAWkE,KAAKL,gBAAAA;CAE9B;AACJ"}
@@ -58,6 +58,8 @@ import { IdentityInjectionKey } from "./identity/constants.mjs";
58
58
  import { IdentityProviderAttributeMappingRepository } from "./identity/repositories/provider/mapper/attribute.mjs";
59
59
  import { IdentityProviderPermissionMappingRepository } from "./identity/repositories/provider/mapper/permission.mjs";
60
60
  import { IdentityProviderRoleMappingRepository } from "./identity/repositories/provider/mapper/role.mjs";
61
+ import { CacheIdentityPrefix } from "./identity/repositories/constants.mjs";
62
+ import { IdentityProviderAccountLinkStore } from "./identity/repositories/provider/link.mjs";
61
63
  import { ClientIdentityRepository } from "./identity/repositories/client.mjs";
62
64
  import { UserIdentityRepository } from "./identity/repositories/user.mjs";
63
65
  import { LDAPInjectionKey } from "./ldap/constants.mjs";
@@ -81,4 +83,4 @@ import { ProvisionerModule } from "./provisioning/module.mjs";
81
83
  import "./provisioning/index.mjs";
82
84
  import { RuntimeModule } from "./runtime/module.mjs";
83
85
  import "./runtime/index.mjs";
84
- export { AuthenticationInjectionKey, AuthenticationModule, CacheInjectionKey, CacheModule, ClientIdentityRepository, ClientPermissionRepositoryAdapter, ClientRepositoryAdapter, ClientRoleRepositoryAdapter, ClientScopeRepositoryAdapter, ComponentsModule, CompositeProvisioningSource, ConfigEnvironmentVariableName, ConfigInjectionKey, ConfigModule, DatabaseInjectionKey, DatabaseModule, DefaultProvisioningSource, EventRepositoryAdapter, FileProvisioningSource, HTTPInjectionKey, HTTPModule, IdentityInjectionKey, IdentityModule, IdentityProviderAccountRepositoryAdapter, IdentityProviderAttributeMappingRepository, IdentityProviderPermissionMappingRepository, IdentityProviderRepositoryAdapter, IdentityProviderRoleMappingRepository, IdentityProviderRoleMappingRepositoryAdapter, KeyRepositoryAdapter, LDAPInjectionKey, LazyWildcardRealmProvisioner, LdapModule, LoggerInjectionKey, LoggerModule, MailInjectionKey, MailModule, MailTemplateRendererInjectionKey, MetricsInjectionKey, ModuleName, OAuth2InjectionToken, OAuth2Module, PermissionDatabaseProvider, PermissionPolicyRepositoryAdapter, PermissionRepositoryAdapter, PolicyRepositoryAdapter, PromAuthFlowMetrics, ProvisionerModule, ProvisioningInjectionKey, RealmRepositoryAdapter, RoleAttributeRepositoryAdapter, RolePermissionRepositoryAdapter, RoleRepositoryAdapter, RuntimeModule, ScopeRepositoryAdapter, SessionRepository, TrustAnchorRepositoryAdapter, UserAttributeRepositoryAdapter, UserAuthenticatorRepositoryAdapter, UserIdentityRepository, UserPermissionRepositoryAdapter, UserRepositoryAdapter, UserRoleRepositoryAdapter, expandToOrigins, getAppOrigins, readConfig, readConfigRaw, readConfigRawFromEnv, readConfigRawFromFS };
86
+ export { AuthenticationInjectionKey, AuthenticationModule, CacheIdentityPrefix, CacheInjectionKey, CacheModule, ClientIdentityRepository, ClientPermissionRepositoryAdapter, ClientRepositoryAdapter, ClientRoleRepositoryAdapter, ClientScopeRepositoryAdapter, ComponentsModule, CompositeProvisioningSource, ConfigEnvironmentVariableName, ConfigInjectionKey, ConfigModule, DatabaseInjectionKey, DatabaseModule, DefaultProvisioningSource, EventRepositoryAdapter, FileProvisioningSource, HTTPInjectionKey, HTTPModule, IdentityInjectionKey, IdentityModule, IdentityProviderAccountLinkStore, IdentityProviderAccountRepositoryAdapter, IdentityProviderAttributeMappingRepository, IdentityProviderPermissionMappingRepository, IdentityProviderRepositoryAdapter, IdentityProviderRoleMappingRepository, IdentityProviderRoleMappingRepositoryAdapter, KeyRepositoryAdapter, LDAPInjectionKey, LazyWildcardRealmProvisioner, LdapModule, LoggerInjectionKey, LoggerModule, MailInjectionKey, MailModule, MailTemplateRendererInjectionKey, MetricsInjectionKey, ModuleName, OAuth2InjectionToken, OAuth2Module, PermissionDatabaseProvider, PermissionPolicyRepositoryAdapter, PermissionRepositoryAdapter, PolicyRepositoryAdapter, PromAuthFlowMetrics, ProvisionerModule, ProvisioningInjectionKey, RealmRepositoryAdapter, RoleAttributeRepositoryAdapter, RolePermissionRepositoryAdapter, RoleRepositoryAdapter, RuntimeModule, ScopeRepositoryAdapter, SessionRepository, TrustAnchorRepositoryAdapter, UserAttributeRepositoryAdapter, UserAuthenticatorRepositoryAdapter, UserIdentityRepository, UserPermissionRepositoryAdapter, UserRepositoryAdapter, UserRoleRepositoryAdapter, expandToOrigins, getAppOrigins, readConfig, readConfigRaw, readConfigRawFromEnv, readConfigRawFromFS };
@@ -3,8 +3,7 @@ import type { IOAuth2AuthorizeStateRepository, OAuth2AuthorizationState } from '
3
3
  export declare class OAuth2AuthorizationStateRepository implements IOAuth2AuthorizeStateRepository {
4
4
  protected cache: ICache;
5
5
  constructor(cache: ICache);
6
- findOneById(key: string): Promise<OAuth2AuthorizationState | null>;
7
- remove(key: string): Promise<void>;
8
6
  insert(data: OAuth2AuthorizationState): Promise<string>;
7
+ popOneById(key: string): Promise<OAuth2AuthorizationState | null>;
9
8
  }
10
9
  //# sourceMappingURL=repository.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"repository.d.ts","sourceRoot":"","sources":["../../../../../../../src/app/modules/oauth2/repositories/authorize/state/repository.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,KAAK,EAAE,+BAA+B,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAGjH,qBAAa,kCAAmC,YAAW,+BAA+B;IACtF,SAAS,CAAC,KAAK,EAAG,MAAM,CAAC;gBAEb,KAAK,EAAE,MAAM;IAInB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,wBAAwB,GAAG,IAAI,CAAC;IAalE,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IASlC,MAAM,CAAC,IAAI,EAAE,wBAAwB,GAAG,OAAO,CAAC,MAAM,CAAC;CAchE"}
1
+ {"version":3,"file":"repository.d.ts","sourceRoot":"","sources":["../../../../../../../src/app/modules/oauth2/repositories/authorize/state/repository.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,KAAK,EAAE,+BAA+B,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAGjH,qBAAa,kCAAmC,YAAW,+BAA+B;IACtF,SAAS,CAAC,KAAK,EAAG,MAAM,CAAC;gBAEb,KAAK,EAAE,MAAM;IAInB,MAAM,CAAC,IAAI,EAAE,wBAAwB,GAAG,OAAO,CAAC,MAAM,CAAC;IAevD,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,wBAAwB,GAAG,IAAI,CAAC;CAM1E"}
@@ -10,29 +10,20 @@ var OAuth2AuthorizationStateRepository = class {
10
10
  constructor(cache) {
11
11
  this.cache = cache;
12
12
  }
13
- async findOneById(key) {
14
- const id = buildCacheKey({
15
- prefix: CacheOAuth2Prefix.AUTHORIZATION_CODE,
16
- key
17
- });
18
- const payload = await this.cache.get(id);
19
- if (payload) return payload;
20
- return null;
21
- }
22
- async remove(key) {
23
- await this.cache.drop(buildCacheKey({
24
- prefix: CacheOAuth2Prefix.AUTHORIZATION_CODE,
25
- key
26
- }));
27
- }
28
13
  async insert(data) {
29
14
  const state = createNanoID();
30
15
  await this.cache.set(buildCacheKey({
31
- prefix: CacheOAuth2Prefix.AUTHORIZATION_CODE,
16
+ prefix: CacheOAuth2Prefix.AUTHORIZATION_STATE,
32
17
  key: state
33
18
  }), data, { ttl: 18e5 });
34
19
  return state;
35
20
  }
21
+ async popOneById(key) {
22
+ return this.cache.pop(buildCacheKey({
23
+ prefix: CacheOAuth2Prefix.AUTHORIZATION_STATE,
24
+ key
25
+ }));
26
+ }
36
27
  };
37
28
  //#endregion
38
29
  export { OAuth2AuthorizationStateRepository };
@@ -1 +1 @@
1
- {"version":3,"file":"repository.mjs","names":["createNanoID","buildCacheKey","CacheOAuth2Prefix","OAuth2AuthorizationStateRepository","cache","findOneById","key","id","prefix","AUTHORIZATION_CODE","payload","get","remove","drop","insert","data","state","set","ttl"],"sources":["../../../../../../../src/app/modules/oauth2/repositories/authorize/state/repository.ts"],"sourcesContent":["/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { createNanoID } from '@authup/kit';\nimport type { ICache } from '@authup/server-kit';\nimport { buildCacheKey } from '@authup/server-kit';\nimport type { IOAuth2AuthorizeStateRepository, OAuth2AuthorizationState } from '../../../../../../core/index.ts';\nimport { CacheOAuth2Prefix } from '../../constants.ts';\n\nexport class OAuth2AuthorizationStateRepository implements IOAuth2AuthorizeStateRepository {\n protected cache : ICache;\n\n constructor(cache: ICache) {\n this.cache = cache;\n }\n\n async findOneById(key: string): Promise<OAuth2AuthorizationState | null> {\n const id = buildCacheKey({\n prefix: CacheOAuth2Prefix.AUTHORIZATION_CODE,\n key, \n });\n const payload = await this.cache.get<OAuth2AuthorizationState>(id);\n if (payload) {\n return payload;\n }\n\n return null;\n }\n\n async remove(key: string): Promise<void> {\n await this.cache.drop(\n buildCacheKey({\n prefix: CacheOAuth2Prefix.AUTHORIZATION_CODE,\n key, \n }),\n );\n }\n\n async insert(data: OAuth2AuthorizationState): Promise<string> {\n const state = createNanoID();\n\n await this.cache.set(\n buildCacheKey({\n prefix: CacheOAuth2Prefix.AUTHORIZATION_CODE,\n key: state, \n }),\n data,\n { ttl: 1000 * 60 * 30 }, // 30 min\n );\n\n return state;\n }\n}\n"],"mappings":";;;;;;;AAaA,IAAaG,qCAAb,MAAaA;CACCC;CAEV,YAAYA,OAAe;EACvB,KAAKA,QAAQA;CACjB;CAEA,MAAMC,YAAYC,KAAuD;EACrE,MAAMC,KAAKN,cAAc;GACrBO,QAAQN,kBAAkBO;GAC1BH;EACJ,CAAA;EACA,MAAMI,UAAU,MAAM,KAAKN,MAAMO,IAA8BJ,EAAAA;EAC/D,IAAIG,SACA,OAAOA;EAGX,OAAO;CACX;CAEA,MAAME,OAAON,KAA4B;EACrC,MAAM,KAAKF,MAAMS,KACbZ,cAAc;GACVO,QAAQN,kBAAkBO;GAC1BH;EACJ,CAAA,CAAA;CAER;CAEA,MAAMQ,OAAOC,MAAiD;EAC1D,MAAMC,QAAQhB,aAAAA;EAEd,MAAM,KAAKI,MAAMa,IACbhB,cAAc;GACVO,QAAQN,kBAAkBO;GAC1BH,KAAKU;EACT,CAAA,GACAD,MACA,EAAEG,KAAK,KAAe,CAAA;EAG1B,OAAOF;CACX;AACJ"}
1
+ {"version":3,"file":"repository.mjs","names":["createNanoID","buildCacheKey","CacheOAuth2Prefix","OAuth2AuthorizationStateRepository","cache","insert","data","state","set","prefix","AUTHORIZATION_STATE","key","ttl","popOneById","pop"],"sources":["../../../../../../../src/app/modules/oauth2/repositories/authorize/state/repository.ts"],"sourcesContent":["/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { createNanoID } from '@authup/kit';\nimport type { ICache } from '@authup/server-kit';\nimport { buildCacheKey } from '@authup/server-kit';\nimport type { IOAuth2AuthorizeStateRepository, OAuth2AuthorizationState } from '../../../../../../core/index.ts';\nimport { CacheOAuth2Prefix } from '../../constants.ts';\n\nexport class OAuth2AuthorizationStateRepository implements IOAuth2AuthorizeStateRepository {\n protected cache : ICache;\n\n constructor(cache: ICache) {\n this.cache = cache;\n }\n\n async insert(data: OAuth2AuthorizationState): Promise<string> {\n const state = createNanoID();\n\n await this.cache.set(\n buildCacheKey({\n prefix: CacheOAuth2Prefix.AUTHORIZATION_STATE,\n key: state,\n }),\n data,\n { ttl: 1000 * 60 * 30 }, // 30 min\n );\n\n return state;\n }\n\n async popOneById(key: string): Promise<OAuth2AuthorizationState | null> {\n return this.cache.pop<OAuth2AuthorizationState>(buildCacheKey({\n prefix: CacheOAuth2Prefix.AUTHORIZATION_STATE,\n key,\n }));\n }\n}\n"],"mappings":";;;;;;;AAaA,IAAaG,qCAAb,MAAaA;CACCC;CAEV,YAAYA,OAAe;EACvB,KAAKA,QAAQA;CACjB;CAEA,MAAMC,OAAOC,MAAiD;EAC1D,MAAMC,QAAQP,aAAAA;EAEd,MAAM,KAAKI,MAAMI,IACbP,cAAc;GACVQ,QAAQP,kBAAkBQ;GAC1BC,KAAKJ;EACT,CAAA,GACAD,MACA,EAAEM,KAAK,KAAe,CAAA;EAG1B,OAAOL;CACX;CAEA,MAAMM,WAAWF,KAAuD;EACpE,OAAO,KAAKP,MAAMU,IAA8Bb,cAAc;GAC1DQ,QAAQP,kBAAkBQ;GAC1BC;EACJ,CAAA,CAAA;CACJ;AACJ"}
@@ -1,13 +1,13 @@
1
1
  import "node:path";
2
2
  import "node:url";
3
3
  import.meta.url;
4
+ import { resolveURL } from "../../../utils/url.mjs";
5
+ import "../../../utils/index.mjs";
4
6
  import { ModuleName } from "../constants.mjs";
5
7
  import { ConfigInjectionKey } from "../config/constants.mjs";
6
8
  import "../config/index.mjs";
7
9
  import { LoggerInjectionKey } from "../logger/constants.mjs";
8
10
  import "../logger/index.mjs";
9
- import { resolveURL } from "../../../utils/url.mjs";
10
- import "../../../utils/index.mjs";
11
11
  //#region src/app/modules/runtime/module.ts
12
12
  var RuntimeModule = class {
13
13
  name;
@@ -11,9 +11,9 @@ import { ApplicationBuilder } from "../../app/builder.mjs";
11
11
  import "../../app/index.mjs";
12
12
  import { createCLIConfigModule } from "../config.mjs";
13
13
  import { DataSource } from "typeorm";
14
+ import { checkDatabase, createDatabase, dropDatabase, generateMigration, transformFilePath } from "typeorm-extension";
14
15
  import path from "node:path";
15
16
  import process from "node:process";
16
- import { checkDatabase, createDatabase, dropDatabase, generateMigration, transformFilePath } from "typeorm-extension";
17
17
  import { defineCommand } from "citty";
18
18
  //#region src/cli/commands/migration.ts
19
19
  var MigrationOperation = /*#__PURE__*/ function(MigrationOperation) {
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../src/core/entities/client-scope/schema.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAMpD,eAAO,MAAM,iBAAiB,gDA2B5B,CAAC"}
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../src/core/entities/client-scope/schema.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAMpD,eAAO,MAAM,iBAAiB,gDA8C5B,CAAC"}
@@ -17,7 +17,9 @@ const clientScopeSchema = defineSchema({
17
17
  ["scopeId"],
18
18
  ["default"],
19
19
  ["clientRealmId"],
20
- ["scopeRealmId"]
20
+ ["scopeRealmId"],
21
+ ["createdAt"],
22
+ ["updatedAt"]
21
23
  ],
22
24
  fields: { default: [
23
25
  "id",
@@ -44,6 +46,19 @@ const clientScopeSchema = defineSchema({
44
46
  allowed: ["client", "scope"],
45
47
  validate: createRelationsReadGate(schemaMapping)
46
48
  },
49
+ sorts: {
50
+ allowed: [
51
+ "id",
52
+ "default",
53
+ "clientId",
54
+ "clientRealmId",
55
+ "scopeId",
56
+ "scopeRealmId",
57
+ "createdAt",
58
+ "updatedAt"
59
+ ],
60
+ indexed: true
61
+ },
47
62
  pagination: { maxLimit: 50 },
48
63
  schemaMapping
49
64
  });
@@ -1 +1 @@
1
- {"version":3,"file":"schema.mjs","names":["defineSchema","EntityType","createRelationsReadGate","schemaMapping","client","CLIENT","scope","SCOPE","clientScopeSchema","name","CLIENT_SCOPE","indexes","fields","default","filters","allowed","indexed","relations","validate","pagination","maxLimit"],"sources":["../../../../src/core/entities/client-scope/schema.ts"],"sourcesContent":["/*\n * Copyright (c) 2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { defineSchema } from '@rapiq/core';\nimport type { ClientScope } from '@authup/core-kit';\nimport { EntityType } from '@authup/core-kit';\nimport { createRelationsReadGate } from '../../query/relations.ts';\n\nconst schemaMapping = { client: EntityType.CLIENT, scope: EntityType.SCOPE };\n\nexport const clientScopeSchema = defineSchema<ClientScope>({\n name: EntityType.CLIENT_SCOPE,\n indexes: [\n ['id'],\n ['clientId', 'scopeId'],\n ['scopeId'],\n ['default'],\n ['clientRealmId'],\n ['scopeRealmId'],\n ],\n // see user-role schema — explicit root projection for include= decodes\n fields: {\n default: [\n 'id',\n 'default',\n 'clientId',\n 'clientRealmId',\n 'scopeId',\n 'scopeRealmId',\n 'createdAt',\n 'updatedAt',\n ],\n },\n filters: { allowed: ['clientId', 'scopeId', 'default', 'id', 'clientRealmId', 'scopeRealmId'], indexed: true },\n relations: { allowed: ['client', 'scope'], validate: createRelationsReadGate(schemaMapping) },\n pagination: { maxLimit: 50 },\n schemaMapping,\n});\n"],"mappings":";;;;;;;AAYA,MAAMG,gBAAgB;CAAEC,QAAQH,WAAWI;CAAQC,OAAOL,WAAWM;AAAM;AAE3E,MAAaC,oBAAoBR,aAA0B;CACvDS,MAAMR,WAAWS;CACjBC,SAAS;EACL,CAAC,IAAK;EACN,CAAC,YAAY,SAAU;EACvB,CAAC,SAAU;EACX,CAAC,SAAU;EACX,CAAC,eAAgB;EACjB,CAAC,cAAe;CACnB;CAEDC,QAAQ,EACJC,SAAS;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACH,EACL;CACAC,SAAS;EAAEC,SAAS;GAAC;GAAY;GAAW;GAAW;GAAM;GAAiB;EAAe;EAAEC,SAAS;CAAK;CAC7GC,WAAW;EAAEF,SAAS,CAAC,UAAU,OAAQ;EAAEG,UAAUhB,wBAAwBC,aAAAA;CAAe;CAC5FgB,YAAY,EAAEC,UAAU,GAAG;CAC3BjB;AACJ,CAAA"}
1
+ {"version":3,"file":"schema.mjs","names":["defineSchema","EntityType","createRelationsReadGate","schemaMapping","client","CLIENT","scope","SCOPE","clientScopeSchema","name","CLIENT_SCOPE","indexes","fields","default","filters","allowed","indexed","relations","validate","sorts","pagination","maxLimit"],"sources":["../../../../src/core/entities/client-scope/schema.ts"],"sourcesContent":["/*\n * Copyright (c) 2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { defineSchema } from '@rapiq/core';\nimport type { ClientScope } from '@authup/core-kit';\nimport { EntityType } from '@authup/core-kit';\nimport { createRelationsReadGate } from '../../query/relations.ts';\n\nconst schemaMapping = { client: EntityType.CLIENT, scope: EntityType.SCOPE };\n\nexport const clientScopeSchema = defineSchema<ClientScope>({\n name: EntityType.CLIENT_SCOPE,\n indexes: [\n ['id'],\n ['clientId', 'scopeId'],\n ['scopeId'],\n ['default'],\n ['clientRealmId'],\n ['scopeRealmId'],\n ['createdAt'],\n ['updatedAt'],\n ],\n // see user-role schema — explicit root projection for include= decodes\n fields: {\n default: [\n 'id',\n 'default',\n 'clientId',\n 'clientRealmId',\n 'scopeId',\n 'scopeRealmId',\n 'createdAt',\n 'updatedAt',\n ],\n },\n filters: { allowed: ['clientId', 'scopeId', 'default', 'id', 'clientRealmId', 'scopeRealmId'], indexed: true },\n relations: { allowed: ['client', 'scope'], validate: createRelationsReadGate(schemaMapping) },\n // wider than the junction siblings' id/createdAt/updatedAt on purpose:\n // every column here is already indexed and already sorts today through\n // the missing-allow-list fallback, so a narrow list would demote the\n // rest from working-and-sorted to silently unsorted (#3441)\n sorts: {\n allowed: [\n 'id',\n 'default',\n 'clientId',\n 'clientRealmId',\n 'scopeId',\n 'scopeRealmId',\n 'createdAt',\n 'updatedAt',\n ],\n indexed: true,\n },\n pagination: { maxLimit: 50 },\n schemaMapping,\n});\n"],"mappings":";;;;;;;AAYA,MAAMG,gBAAgB;CAAEC,QAAQH,WAAWI;CAAQC,OAAOL,WAAWM;AAAM;AAE3E,MAAaC,oBAAoBR,aAA0B;CACvDS,MAAMR,WAAWS;CACjBC,SAAS;EACL,CAAC,IAAK;EACN,CAAC,YAAY,SAAU;EACvB,CAAC,SAAU;EACX,CAAC,SAAU;EACX,CAAC,eAAgB;EACjB,CAAC,cAAe;EAChB,CAAC,WAAY;EACb,CAAC,WAAY;CAChB;CAEDC,QAAQ,EACJC,SAAS;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACH,EACL;CACAC,SAAS;EAAEC,SAAS;GAAC;GAAY;GAAW;GAAW;GAAM;GAAiB;EAAe;EAAEC,SAAS;CAAK;CAC7GC,WAAW;EAAEF,SAAS,CAAC,UAAU,OAAQ;EAAEG,UAAUhB,wBAAwBC,aAAAA;CAAe;CAK5FgB,OAAO;EACHJ,SAAS;GACL;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACH;EACDC,SAAS;CACb;CACAI,YAAY,EAAEC,UAAU,GAAG;CAC3BlB;AACJ,CAAA"}
@@ -4,6 +4,15 @@
4
4
  * EVENT_LOG_RETENTION_DAYS, 0 = keep forever).
5
5
  */
6
6
  export declare const EVENT_LOG_RETENTION_DAYS_DEFAULT = 90;
7
+ /**
8
+ * Rows removed per statement by the retention sweep. The sweep runs every
9
+ * minute on every replica, and the first one after a retention change (or the
10
+ * day a full retention window first matures) can match millions of rows. A
11
+ * single unbounded DELETE would then be one long transaction, issued
12
+ * concurrently by every replica. Batching keeps each statement bounded; the
13
+ * sweep still drains by looping.
14
+ */
15
+ export declare const EVENT_RETENTION_SWEEP_BATCH_SIZE = 1000;
7
16
  /**
8
17
  * Column bound for the denormalized actor name. Shared by the write boundary
9
18
  * (EventService.record truncates to it) and every reader that matches stored
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/core/entities/event/constants.ts"],"names":[],"mappings":"AAOA;;;;GAIG;AACH,eAAO,MAAM,gCAAgC,KAAK,CAAC;AAEnD;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B,MAAM,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/core/entities/event/constants.ts"],"names":[],"mappings":"AAOA;;;;GAIG;AACH,eAAO,MAAM,gCAAgC,KAAK,CAAC;AAEnD;;;;;;;GAOG;AACH,eAAO,MAAM,gCAAgC,OAAO,CAAC;AAErD;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B,MAAM,CAAC"}
@@ -8,12 +8,20 @@ import.meta.url;
8
8
  * EVENT_LOG_RETENTION_DAYS, 0 = keep forever).
9
9
  */ const EVENT_LOG_RETENTION_DAYS_DEFAULT = 90;
10
10
  /**
11
+ * Rows removed per statement by the retention sweep. The sweep runs every
12
+ * minute on every replica, and the first one after a retention change (or the
13
+ * day a full retention window first matures) can match millions of rows. A
14
+ * single unbounded DELETE would then be one long transaction, issued
15
+ * concurrently by every replica. Batching keeps each statement bounded; the
16
+ * sweep still drains by looping.
17
+ */ const EVENT_RETENTION_SWEEP_BATCH_SIZE = 1e3;
18
+ /**
11
19
  * Column bound for the denormalized actor name. Shared by the write boundary
12
20
  * (EventService.record truncates to it) and every reader that matches stored
13
21
  * rows by actor name (the login throttle) so the two cannot drift — an
14
22
  * untruncated lookup key never matches its own truncated rows.
15
23
  */ const EVENT_ACTOR_NAME_MAX_LENGTH = 128;
16
24
  //#endregion
17
- export { EVENT_ACTOR_NAME_MAX_LENGTH, EVENT_LOG_RETENTION_DAYS_DEFAULT };
25
+ export { EVENT_ACTOR_NAME_MAX_LENGTH, EVENT_LOG_RETENTION_DAYS_DEFAULT, EVENT_RETENTION_SWEEP_BATCH_SIZE };
18
26
 
19
27
  //# sourceMappingURL=constants.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.mjs","names":["EVENT_LOG_RETENTION_DAYS_DEFAULT","EVENT_ACTOR_NAME_MAX_LENGTH"],"sources":["../../../../src/core/entities/event/constants.ts"],"sourcesContent":["/*\n * Copyright (c) 2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\n/**\n * Default retention for persisted security events in days (hosted-provider\n * posture, Okta-parity; raise via eventLogRetentionDays /\n * EVENT_LOG_RETENTION_DAYS, 0 = keep forever).\n */\nexport const EVENT_LOG_RETENTION_DAYS_DEFAULT = 90;\n\n/**\n * Column bound for the denormalized actor name. Shared by the write boundary\n * (EventService.record truncates to it) and every reader that matches stored\n * rows by actor name (the login throttle) so the two cannot drift — an\n * untruncated lookup key never matches its own truncated rows.\n */\nexport const EVENT_ACTOR_NAME_MAX_LENGTH = 128;\n"],"mappings":";;;;;;;;GAYA,MAAaA,mCAAmC;;;;;;GAQhD,MAAaC,8BAA8B"}
1
+ {"version":3,"file":"constants.mjs","names":["EVENT_LOG_RETENTION_DAYS_DEFAULT","EVENT_RETENTION_SWEEP_BATCH_SIZE","EVENT_ACTOR_NAME_MAX_LENGTH"],"sources":["../../../../src/core/entities/event/constants.ts"],"sourcesContent":["/*\n * Copyright (c) 2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\n/**\n * Default retention for persisted security events in days (hosted-provider\n * posture, Okta-parity; raise via eventLogRetentionDays /\n * EVENT_LOG_RETENTION_DAYS, 0 = keep forever).\n */\nexport const EVENT_LOG_RETENTION_DAYS_DEFAULT = 90;\n\n/**\n * Rows removed per statement by the retention sweep. The sweep runs every\n * minute on every replica, and the first one after a retention change (or the\n * day a full retention window first matures) can match millions of rows. A\n * single unbounded DELETE would then be one long transaction, issued\n * concurrently by every replica. Batching keeps each statement bounded; the\n * sweep still drains by looping.\n */\nexport const EVENT_RETENTION_SWEEP_BATCH_SIZE = 1000;\n\n/**\n * Column bound for the denormalized actor name. Shared by the write boundary\n * (EventService.record truncates to it) and every reader that matches stored\n * rows by actor name (the login throttle) so the two cannot drift — an\n * untruncated lookup key never matches its own truncated rows.\n */\nexport const EVENT_ACTOR_NAME_MAX_LENGTH = 128;\n"],"mappings":";;;;;;;;GAYA,MAAaA,mCAAmC;;;;;;;;GAUhD,MAAaC,mCAAmC;;;;;;GAQhD,MAAaC,8BAA8B"}
@@ -1,10 +1,10 @@
1
1
  import "node:path";
2
2
  import "node:url";
3
3
  import.meta.url;
4
- import { EVENT_ACTOR_NAME_MAX_LENGTH, EVENT_LOG_RETENTION_DAYS_DEFAULT } from "./constants.mjs";
4
+ import { EVENT_ACTOR_NAME_MAX_LENGTH, EVENT_LOG_RETENTION_DAYS_DEFAULT, EVENT_RETENTION_SWEEP_BATCH_SIZE } from "./constants.mjs";
5
5
  import { eventSchema } from "./schema.mjs";
6
6
  import { EVENT_DIFF_SECRET_KEY_REGEX, EVENT_DIFF_VALUE_MAX_LENGTH, buildEntityDiff } from "./diff.mjs";
7
7
  import { EntityEventHandler } from "./entity-event-handler.mjs";
8
8
  import { sanitizeEventData } from "./sanitize.mjs";
9
9
  import { EventService } from "./service.mjs";
10
- export { EVENT_ACTOR_NAME_MAX_LENGTH, EVENT_DIFF_SECRET_KEY_REGEX, EVENT_DIFF_VALUE_MAX_LENGTH, EVENT_LOG_RETENTION_DAYS_DEFAULT, EntityEventHandler, EventService, buildEntityDiff, eventSchema, sanitizeEventData };
10
+ export { EVENT_ACTOR_NAME_MAX_LENGTH, EVENT_DIFF_SECRET_KEY_REGEX, EVENT_DIFF_VALUE_MAX_LENGTH, EVENT_LOG_RETENTION_DAYS_DEFAULT, EVENT_RETENTION_SWEEP_BATCH_SIZE, EntityEventHandler, EventService, buildEntityDiff, eventSchema, sanitizeEventData };
@@ -42,10 +42,19 @@ export interface IEventRepository {
42
42
  /**
43
43
  * Retention sweep: drop every expiring row whose expiresAt lies before
44
44
  * the given instant (non-expiring rows are kept forever). Returns the
45
- * number of removed rows.
45
+ * number of removed rows. Removal is batched (see
46
+ * EVENT_RETENTION_SWEEP_BATCH_SIZE).
46
47
  */
47
- deleteExpired(now: string): Promise<number>;
48
+ deleteExpired(now: string, options?: EventDeleteExpiredOptions): Promise<number>;
48
49
  }
50
+ export type EventDeleteExpiredOptions = {
51
+ /**
52
+ * Rows removed per statement. Defaults to
53
+ * EVENT_RETENTION_SWEEP_BATCH_SIZE, which anything that is not a positive
54
+ * safe integer also falls back to.
55
+ */
56
+ batchSize?: number;
57
+ };
49
58
  export type EventRecordInput = {
50
59
  scope: `${EventScope}`;
51
60
  name: `${EventName}`;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/core/entities/event/types.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACR,KAAK,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BAAuB,GAAG;IAClC,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAC9B,SAAS,EAAE,GAAG,YAAY,EAAE,GAAG,IAAI,CAAC;IACpC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG;IACpC;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,MAAM,WAAW,aAAa;IAC1B;;;OAGG;IACH,MAAM,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE/C;;;;OAIG;IACH,OAAO,CACH,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC1B,KAAK,EAAE,YAAY,EACnB,OAAO,CAAC,EAAE,uBAAuB,GAClC,OAAO,CAAC,8BAA8B,CAAC,KAAK,CAAC,CAAC,CAAC;IAElD;;OAEG;IACH,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,OAAO,CAAC,EAAE,uBAAuB,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;CAC9F"}
@@ -44,6 +44,12 @@ export interface IIdentityProviderAccountRepository {
44
44
  * Find identity account with user relation (federated login + link flow).
45
45
  */
46
46
  findOneByProviderIdentity(identity: IdentityProviderIdentity): Promise<IdentityProviderAccount | null>;
47
+ /**
48
+ * Throws `EntityConflictError` (`@authup/errors`) when the row violates
49
+ * EITHER unique index, (providerUserId, providerId) or (providerId,
50
+ * userId): the driver does not tell them apart, so the caller
51
+ * classifies by re-reading the identity.
52
+ */
47
53
  save(entity: DeepPartial<IdentityProviderAccount>): Promise<IdentityProviderAccount>;
48
54
  }
49
55
  export type IdentityProviderAccountServiceReadOptions = {
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/core/entities/identity-provider-account/types.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,KAAK,EAAE,YAAY,EAAE,8BAA8B,EAAE,MAAM,oBAAoB,CAAC;AACvF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAEjF;;GAEG;AACH,eAAO,MAAM,qCAAqC,0EAMxC,CAAC;AAEX,MAAM,MAAM,sCAAsC,GAAG;IACjD;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;;GAIG;AACH,MAAM,WAAW,kCAAkC;IAC/C,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,sCAAsC,GAAG,OAAO,CAAC,8BAA8B,CAAC,uBAAuB,CAAC,CAAC,CAAC;IAE5I,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,uBAAuB,GAAG,IAAI,CAAC,CAAC;IAEjE,MAAM,CAAC,MAAM,EAAE,uBAAuB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEvD;;;;;;;;;OASG;IACH,aAAa,CAAC,MAAM,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAA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