@nest-boot/auth 8.0.3-beta.1 → 8.0.3-beta.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.
Files changed (885) hide show
  1. package/README.md +538 -2
  2. package/dist/abilities/user.ability.d.ts +3 -0
  3. package/dist/abilities/user.ability.js +2 -0
  4. package/dist/abilities/user.ability.js.map +1 -1
  5. package/dist/abilities/workspace.ability.d.ts +3 -0
  6. package/dist/abilities/workspace.ability.js +2 -0
  7. package/dist/abilities/workspace.ability.js.map +1 -1
  8. package/dist/adapters/mikro-orm/adapter-config.js +1 -0
  9. package/dist/adapters/mikro-orm/adapter-config.js.map +1 -1
  10. package/dist/adapters/mikro-orm/create-custom-adapter.d.ts +3 -2
  11. package/dist/adapters/mikro-orm/entity-metadata-resolver.d.ts +2 -2
  12. package/dist/adapters/mikro-orm/entity-metadata-resolver.js +22 -0
  13. package/dist/adapters/mikro-orm/entity-metadata-resolver.js.map +1 -1
  14. package/dist/adapters/mikro-orm/where-compiler.d.ts +24 -24
  15. package/dist/adapters/mikro-orm-adapter.d.ts +6 -2
  16. package/dist/adapters/mikro-orm-adapter.js +2 -1
  17. package/dist/adapters/mikro-orm-adapter.js.map +1 -1
  18. package/dist/api-key-usage.interceptor.d.ts +5 -2
  19. package/dist/api-key-usage.interceptor.js +10 -8
  20. package/dist/api-key-usage.interceptor.js.map +1 -1
  21. package/dist/auth-handler.middleware.d.ts +3 -0
  22. package/dist/auth-handler.middleware.js +3 -0
  23. package/dist/auth-handler.middleware.js.map +1 -1
  24. package/dist/auth-module-options.interface.d.ts +31 -338
  25. package/dist/auth.constants.d.ts +4 -0
  26. package/dist/auth.constants.js +4 -0
  27. package/dist/auth.constants.js.map +1 -1
  28. package/dist/auth.guard.d.ts +31 -9
  29. package/dist/auth.guard.js +49 -106
  30. package/dist/auth.guard.js.map +1 -1
  31. package/dist/auth.middleware.d.ts +20 -6
  32. package/dist/auth.middleware.js +119 -48
  33. package/dist/auth.middleware.js.map +1 -1
  34. package/dist/auth.module-definition.d.ts +1 -1
  35. package/dist/auth.module.d.ts +28 -5
  36. package/dist/auth.module.js +87 -64
  37. package/dist/auth.module.js.map +1 -1
  38. package/dist/connections/account.connection-definition.d.ts +9 -0
  39. package/dist/connections/account.connection-definition.js +38 -0
  40. package/dist/connections/account.connection-definition.js.map +1 -0
  41. package/dist/connections/index.d.ts +8 -0
  42. package/dist/connections/index.js +9 -0
  43. package/dist/connections/index.js.map +1 -0
  44. package/dist/connections/invitation.connection-definition.d.ts +9 -0
  45. package/dist/connections/invitation.connection-definition.js +40 -0
  46. package/dist/connections/invitation.connection-definition.js.map +1 -0
  47. package/dist/connections/member.connection-definition.d.ts +9 -0
  48. package/dist/connections/member.connection-definition.js +52 -0
  49. package/dist/connections/member.connection-definition.js.map +1 -0
  50. package/dist/connections/session.connection-definition.d.ts +9 -0
  51. package/dist/connections/session.connection-definition.js +32 -0
  52. package/dist/connections/session.connection-definition.js.map +1 -0
  53. package/dist/connections/user-api-key.connection-definition.d.ts +13 -0
  54. package/dist/connections/user-api-key.connection-definition.js +60 -0
  55. package/dist/connections/user-api-key.connection-definition.js.map +1 -0
  56. package/dist/connections/user.connection-definition.d.ts +9 -0
  57. package/dist/connections/user.connection-definition.js +46 -0
  58. package/dist/connections/user.connection-definition.js.map +1 -0
  59. package/dist/connections/workspace-api-key.connection-definition.d.ts +13 -0
  60. package/dist/connections/workspace-api-key.connection-definition.js +60 -0
  61. package/dist/connections/workspace-api-key.connection-definition.js.map +1 -0
  62. package/dist/connections/workspace.connection-definition.d.ts +13 -0
  63. package/dist/connections/workspace.connection-definition.js +43 -0
  64. package/dist/connections/workspace.connection-definition.js.map +1 -0
  65. package/dist/decorators/can.decorator.d.ts +8 -0
  66. package/dist/decorators/can.decorator.js +8 -0
  67. package/dist/decorators/can.decorator.js.map +1 -1
  68. package/dist/decorators/current-api-key.decorator.d.ts +1 -0
  69. package/dist/decorators/current-api-key.decorator.js +3 -3
  70. package/dist/decorators/current-api-key.decorator.js.map +1 -1
  71. package/dist/decorators/current-member.decorator.d.ts +2 -0
  72. package/dist/decorators/current-member.decorator.js +6 -0
  73. package/dist/decorators/current-member.decorator.js.map +1 -0
  74. package/dist/decorators/current-session.decorator.d.ts +1 -0
  75. package/dist/decorators/current-session.decorator.js +3 -2
  76. package/dist/decorators/current-session.decorator.js.map +1 -1
  77. package/dist/decorators/current-user.decorator.d.ts +1 -0
  78. package/dist/decorators/current-user.decorator.js +3 -2
  79. package/dist/decorators/current-user.decorator.js.map +1 -1
  80. package/dist/decorators/current-workspace.decorator.d.ts +1 -0
  81. package/dist/decorators/current-workspace.decorator.js +3 -2
  82. package/dist/decorators/current-workspace.decorator.js.map +1 -1
  83. package/dist/decorators/index.d.ts +1 -1
  84. package/dist/decorators/index.js +1 -1
  85. package/dist/decorators/index.js.map +1 -1
  86. package/dist/decorators/public.decorator.d.ts +1 -0
  87. package/dist/decorators/public.decorator.js +1 -0
  88. package/dist/decorators/public.decorator.js.map +1 -1
  89. package/dist/decorators/user-can.decorator.d.ts +8 -0
  90. package/dist/decorators/user-can.decorator.js +8 -0
  91. package/dist/decorators/user-can.decorator.js.map +1 -1
  92. package/dist/decorators/workspace-can.decorator.d.ts +8 -0
  93. package/dist/decorators/workspace-can.decorator.js +8 -0
  94. package/dist/decorators/workspace-can.decorator.js.map +1 -1
  95. package/dist/entities/account.entity.d.ts +21 -3
  96. package/dist/entities/account.entity.js +67 -29
  97. package/dist/entities/account.entity.js.map +1 -1
  98. package/dist/entities/auth-entity-map.d.ts +21 -0
  99. package/dist/entities/auth-entity-map.js +22 -0
  100. package/dist/entities/auth-entity-map.js.map +1 -0
  101. package/dist/entities/index.d.ts +14 -3
  102. package/dist/entities/index.js +25 -3
  103. package/dist/entities/index.js.map +1 -1
  104. package/dist/entities/invitation.entity.d.ts +24 -0
  105. package/dist/entities/invitation.entity.js +117 -0
  106. package/dist/entities/invitation.entity.js.map +1 -0
  107. package/dist/entities/member.entity.d.ts +28 -0
  108. package/dist/entities/member.entity.js +126 -0
  109. package/dist/entities/member.entity.js.map +1 -0
  110. package/dist/entities/session.entity.d.ts +16 -6
  111. package/dist/entities/session.entity.js +57 -27
  112. package/dist/entities/session.entity.js.map +1 -1
  113. package/dist/entities/user-api-key.entity.d.ts +29 -0
  114. package/dist/entities/user-api-key.entity.js +147 -0
  115. package/dist/entities/user-api-key.entity.js.map +1 -0
  116. package/dist/entities/user.entity.d.ts +18 -2
  117. package/dist/entities/user.entity.js +104 -29
  118. package/dist/entities/user.entity.js.map +1 -1
  119. package/dist/entities/verification.entity.d.ts +8 -1
  120. package/dist/entities/verification.entity.js +27 -11
  121. package/dist/entities/verification.entity.js.map +1 -1
  122. package/dist/entities/workspace-api-key.entity.d.ts +29 -0
  123. package/dist/entities/workspace-api-key.entity.js +147 -0
  124. package/dist/entities/workspace-api-key.entity.js.map +1 -0
  125. package/dist/entities/workspace.entity.d.ts +10 -3
  126. package/dist/entities/workspace.entity.js +51 -20
  127. package/dist/entities/workspace.entity.js.map +1 -1
  128. package/dist/enums/index.d.ts +8 -0
  129. package/dist/enums/index.js +9 -0
  130. package/dist/enums/index.js.map +1 -0
  131. package/dist/enums/invitation-status.enum.d.ts +11 -0
  132. package/dist/enums/invitation-status.enum.js +17 -0
  133. package/dist/enums/invitation-status.enum.js.map +1 -0
  134. package/dist/enums/member-status.enum.d.ts +9 -0
  135. package/dist/enums/member-status.enum.js +15 -0
  136. package/dist/enums/member-status.enum.js.map +1 -0
  137. package/dist/enums/user-api-key-permission.enum.d.ts +4 -0
  138. package/dist/enums/user-api-key-permission.enum.js +11 -0
  139. package/dist/enums/user-api-key-permission.enum.js.map +1 -0
  140. package/dist/enums/user-permission.enum.d.ts +4 -0
  141. package/dist/enums/user-permission.enum.js +7 -0
  142. package/dist/enums/user-permission.enum.js.map +1 -0
  143. package/dist/enums/user-role.enum.d.ts +4 -0
  144. package/dist/enums/user-role.enum.js +6 -0
  145. package/dist/enums/user-role.enum.js.map +1 -0
  146. package/dist/enums/workspace-api-key-permission.enum.d.ts +4 -0
  147. package/dist/enums/workspace-api-key-permission.enum.js +11 -0
  148. package/dist/enums/workspace-api-key-permission.enum.js.map +1 -0
  149. package/dist/enums/workspace-permission.enum.d.ts +4 -0
  150. package/dist/enums/workspace-permission.enum.js +7 -0
  151. package/dist/enums/workspace-permission.enum.js.map +1 -0
  152. package/dist/enums/workspace-role.enum.d.ts +4 -0
  153. package/dist/enums/workspace-role.enum.js +9 -0
  154. package/dist/enums/workspace-role.enum.js.map +1 -0
  155. package/dist/index.d.ts +182 -12
  156. package/dist/index.js +181 -12
  157. package/dist/index.js.map +1 -1
  158. package/dist/infrastructure/api-key-authentication.service.d.ts +14 -0
  159. package/dist/infrastructure/api-key-authentication.service.js +78 -0
  160. package/dist/infrastructure/api-key-authentication.service.js.map +1 -0
  161. package/dist/infrastructure/auth-ability.factory.d.ts +15 -0
  162. package/dist/infrastructure/auth-ability.factory.js +91 -0
  163. package/dist/infrastructure/auth-ability.factory.js.map +1 -0
  164. package/dist/infrastructure/auth-enum-registry.d.ts +8 -0
  165. package/dist/infrastructure/auth-enum-registry.js +48 -0
  166. package/dist/infrastructure/auth-enum-registry.js.map +1 -0
  167. package/dist/infrastructure/auth-service.providers.d.ts +3 -0
  168. package/dist/infrastructure/auth-service.providers.js +72 -0
  169. package/dist/infrastructure/auth-service.providers.js.map +1 -0
  170. package/dist/infrastructure/create-contextual-auth-service.d.ts +10 -0
  171. package/dist/infrastructure/create-contextual-auth-service.js +50 -0
  172. package/dist/infrastructure/create-contextual-auth-service.js.map +1 -0
  173. package/dist/infrastructure/request-identity.d.ts +34 -0
  174. package/dist/infrastructure/request-identity.js +174 -0
  175. package/dist/infrastructure/request-identity.js.map +1 -0
  176. package/dist/infrastructure/revoked-authentication.exception.d.ts +4 -0
  177. package/dist/infrastructure/revoked-authentication.exception.js +5 -0
  178. package/dist/infrastructure/revoked-authentication.exception.js.map +1 -0
  179. package/dist/inputs/add-member.input.d.ts +5 -0
  180. package/dist/inputs/add-member.input.js +26 -0
  181. package/dist/inputs/add-member.input.js.map +1 -0
  182. package/dist/inputs/auth-change-email.input.d.ts +7 -0
  183. package/dist/inputs/auth-change-email.input.js +33 -0
  184. package/dist/inputs/auth-change-email.input.js.map +1 -0
  185. package/dist/inputs/auth-change-password.input.d.ts +9 -0
  186. package/dist/inputs/auth-change-password.input.js +40 -0
  187. package/dist/inputs/auth-change-password.input.js.map +1 -0
  188. package/dist/inputs/auth-delete-user.input.d.ts +9 -0
  189. package/dist/inputs/auth-delete-user.input.js +40 -0
  190. package/dist/inputs/auth-delete-user.input.js.map +1 -0
  191. package/dist/inputs/auth-link-social-account.input.d.ts +13 -0
  192. package/dist/inputs/auth-link-social-account.input.js +54 -0
  193. package/dist/inputs/auth-link-social-account.input.js.map +1 -0
  194. package/dist/inputs/auth-request-password-reset.input.d.ts +7 -0
  195. package/dist/inputs/auth-request-password-reset.input.js +33 -0
  196. package/dist/inputs/auth-request-password-reset.input.js.map +1 -0
  197. package/dist/inputs/auth-reset-password.input.d.ts +7 -0
  198. package/dist/inputs/auth-reset-password.input.js +33 -0
  199. package/dist/inputs/auth-reset-password.input.js.map +1 -0
  200. package/dist/inputs/auth-send-verification-email.input.d.ts +7 -0
  201. package/dist/inputs/auth-send-verification-email.input.js +33 -0
  202. package/dist/inputs/auth-send-verification-email.input.js.map +1 -0
  203. package/dist/inputs/auth-sign-in-social.input.d.ts +17 -0
  204. package/dist/inputs/auth-sign-in-social.input.js +68 -0
  205. package/dist/inputs/auth-sign-in-social.input.js.map +1 -0
  206. package/dist/inputs/auth-sign-in.input.d.ts +11 -0
  207. package/dist/inputs/auth-sign-in.input.js +47 -0
  208. package/dist/inputs/auth-sign-in.input.js.map +1 -0
  209. package/dist/inputs/auth-sign-up.input.d.ts +15 -0
  210. package/dist/inputs/auth-sign-up.input.js +61 -0
  211. package/dist/inputs/auth-sign-up.input.js.map +1 -0
  212. package/dist/inputs/auth-update-user.input.d.ts +7 -0
  213. package/dist/inputs/auth-update-user.input.js +33 -0
  214. package/dist/inputs/auth-update-user.input.js.map +1 -0
  215. package/dist/inputs/ban-user.input.d.ts +7 -0
  216. package/dist/inputs/ban-user.input.js +33 -0
  217. package/dist/inputs/ban-user.input.js.map +1 -0
  218. package/dist/inputs/create-invitation.input.d.ts +10 -0
  219. package/dist/inputs/create-invitation.input.js +41 -0
  220. package/dist/inputs/create-invitation.input.js.map +1 -0
  221. package/dist/inputs/create-user-api-key.input.d.ts +14 -0
  222. package/dist/inputs/create-user-api-key.input.js +55 -0
  223. package/dist/inputs/create-user-api-key.input.js.map +1 -0
  224. package/dist/inputs/create-user.input.d.ts +15 -0
  225. package/dist/inputs/create-user.input.js +56 -0
  226. package/dist/inputs/create-user.input.js.map +1 -0
  227. package/dist/inputs/create-workspace-api-key.input.d.ts +14 -0
  228. package/dist/inputs/create-workspace-api-key.input.js +55 -0
  229. package/dist/inputs/create-workspace-api-key.input.js.map +1 -0
  230. package/dist/inputs/create-workspace.input.d.ts +7 -0
  231. package/dist/inputs/create-workspace.input.js +28 -0
  232. package/dist/inputs/create-workspace.input.js.map +1 -0
  233. package/dist/inputs/set-member-permissions.input.d.ts +6 -0
  234. package/dist/inputs/set-member-permissions.input.js +27 -0
  235. package/dist/inputs/set-member-permissions.input.js.map +1 -0
  236. package/dist/inputs/set-member-roles.input.d.ts +6 -0
  237. package/dist/inputs/set-member-roles.input.js +27 -0
  238. package/dist/inputs/set-member-roles.input.js.map +1 -0
  239. package/dist/inputs/set-user-password.input.d.ts +5 -0
  240. package/dist/inputs/set-user-password.input.js +26 -0
  241. package/dist/inputs/set-user-password.input.js.map +1 -0
  242. package/dist/inputs/set-user-permissions.input.d.ts +6 -0
  243. package/dist/inputs/set-user-permissions.input.js +27 -0
  244. package/dist/inputs/set-user-permissions.input.js.map +1 -0
  245. package/dist/inputs/set-user-roles.input.d.ts +6 -0
  246. package/dist/inputs/set-user-roles.input.js +27 -0
  247. package/dist/inputs/set-user-roles.input.js.map +1 -0
  248. package/dist/inputs/update-member.input.d.ts +10 -0
  249. package/dist/inputs/update-member.input.js +43 -0
  250. package/dist/inputs/update-member.input.js.map +1 -0
  251. package/dist/inputs/update-user-api-key.input.d.ts +14 -0
  252. package/dist/inputs/update-user-api-key.input.js +50 -0
  253. package/dist/inputs/update-user-api-key.input.js.map +1 -0
  254. package/dist/inputs/update-user.input.d.ts +11 -0
  255. package/dist/inputs/update-user.input.js +47 -0
  256. package/dist/inputs/update-user.input.js.map +1 -0
  257. package/dist/inputs/update-workspace-api-key.input.d.ts +14 -0
  258. package/dist/inputs/update-workspace-api-key.input.js +50 -0
  259. package/dist/inputs/update-workspace-api-key.input.js.map +1 -0
  260. package/dist/inputs/update-workspace.input.d.ts +7 -0
  261. package/dist/inputs/update-workspace.input.js +28 -0
  262. package/dist/inputs/update-workspace.input.js.map +1 -0
  263. package/dist/inputs/user-id.input.d.ts +5 -0
  264. package/dist/inputs/user-id.input.js +26 -0
  265. package/dist/inputs/user-id.input.js.map +1 -0
  266. package/dist/interfaces/ability-rules.interface.d.ts +8 -0
  267. package/dist/interfaces/ability-rules.interface.js +2 -0
  268. package/dist/interfaces/ability-rules.interface.js.map +1 -0
  269. package/dist/interfaces/accept-invitation-result.interface.d.ts +9 -0
  270. package/dist/interfaces/accept-invitation-result.interface.js +2 -0
  271. package/dist/interfaces/accept-invitation-result.interface.js.map +1 -0
  272. package/dist/interfaces/add-member-options.interface.d.ts +7 -0
  273. package/dist/interfaces/add-member-options.interface.js +2 -0
  274. package/dist/interfaces/add-member-options.interface.js.map +1 -0
  275. package/dist/interfaces/auth-access-token.interface.d.ts +11 -0
  276. package/dist/interfaces/auth-access-token.interface.js +2 -0
  277. package/dist/interfaces/auth-access-token.interface.js.map +1 -0
  278. package/dist/interfaces/auth-account-info.interface.d.ts +11 -0
  279. package/dist/interfaces/auth-account-info.interface.js +2 -0
  280. package/dist/interfaces/auth-account-info.interface.js.map +1 -0
  281. package/dist/interfaces/auth-account.interface.d.ts +19 -0
  282. package/dist/interfaces/auth-account.interface.js +2 -0
  283. package/dist/interfaces/auth-account.interface.js.map +1 -0
  284. package/dist/interfaces/auth-change-email-confirmation-data.interface.d.ts +12 -0
  285. package/dist/interfaces/auth-change-email-confirmation-data.interface.js +2 -0
  286. package/dist/interfaces/auth-change-email-confirmation-data.interface.js.map +1 -0
  287. package/dist/interfaces/auth-delete-account-verification-data.interface.d.ts +10 -0
  288. package/dist/interfaces/auth-delete-account-verification-data.interface.js +2 -0
  289. package/dist/interfaces/auth-delete-account-verification-data.interface.js.map +1 -0
  290. package/dist/interfaces/auth-email-verification-data.interface.d.ts +10 -0
  291. package/dist/interfaces/auth-email-verification-data.interface.js +2 -0
  292. package/dist/interfaces/auth-email-verification-data.interface.js.map +1 -0
  293. package/dist/interfaces/auth-invitation-email-data.interface.d.ts +18 -0
  294. package/dist/interfaces/auth-invitation-email-data.interface.js +2 -0
  295. package/dist/interfaces/auth-invitation-email-data.interface.js.map +1 -0
  296. package/dist/interfaces/auth-module-account-linking-options.interface.d.ts +18 -0
  297. package/dist/interfaces/auth-module-account-linking-options.interface.js +2 -0
  298. package/dist/interfaces/auth-module-account-linking-options.interface.js.map +1 -0
  299. package/dist/interfaces/auth-module-account-options.interface.d.ts +16 -0
  300. package/dist/interfaces/auth-module-account-options.interface.js +2 -0
  301. package/dist/interfaces/auth-module-account-options.interface.js.map +1 -0
  302. package/dist/interfaces/auth-module-api-key-options.interface.d.ts +15 -0
  303. package/dist/interfaces/auth-module-api-key-options.interface.js +2 -0
  304. package/dist/interfaces/auth-module-api-key-options.interface.js.map +1 -0
  305. package/dist/interfaces/auth-module-change-email-options.interface.d.ts +10 -0
  306. package/dist/interfaces/auth-module-change-email-options.interface.js +2 -0
  307. package/dist/interfaces/auth-module-change-email-options.interface.js.map +1 -0
  308. package/dist/interfaces/auth-module-delete-user-options.interface.d.ts +15 -0
  309. package/dist/interfaces/auth-module-delete-user-options.interface.js +2 -0
  310. package/dist/interfaces/auth-module-delete-user-options.interface.js.map +1 -0
  311. package/dist/interfaces/auth-module-email-and-password-options.interface.d.ts +34 -0
  312. package/dist/interfaces/auth-module-email-and-password-options.interface.js +2 -0
  313. package/dist/interfaces/auth-module-email-and-password-options.interface.js.map +1 -0
  314. package/dist/interfaces/auth-module-email-verification-options.interface.d.ts +19 -0
  315. package/dist/interfaces/auth-module-email-verification-options.interface.js +2 -0
  316. package/dist/interfaces/auth-module-email-verification-options.interface.js.map +1 -0
  317. package/dist/interfaces/auth-module-middleware-options.interface.d.ts +11 -0
  318. package/dist/interfaces/auth-module-middleware-options.interface.js +2 -0
  319. package/dist/interfaces/auth-module-middleware-options.interface.js.map +1 -0
  320. package/dist/interfaces/auth-module-oauth-provider.interface.d.ts +91 -0
  321. package/dist/interfaces/auth-module-oauth-provider.interface.js +2 -0
  322. package/dist/interfaces/auth-module-oauth-provider.interface.js.map +1 -0
  323. package/dist/interfaces/auth-module-password-options.interface.d.ts +10 -0
  324. package/dist/interfaces/auth-module-password-options.interface.js +2 -0
  325. package/dist/interfaces/auth-module-password-options.interface.js.map +1 -0
  326. package/dist/interfaces/auth-module-session-cookie-cache-options.interface.d.ts +14 -0
  327. package/dist/interfaces/auth-module-session-cookie-cache-options.interface.js +2 -0
  328. package/dist/interfaces/auth-module-session-cookie-cache-options.interface.js.map +1 -0
  329. package/dist/interfaces/auth-module-session-cookie-cache-refresh-options.interface.d.ts +5 -0
  330. package/dist/interfaces/auth-module-session-cookie-cache-refresh-options.interface.js +2 -0
  331. package/dist/interfaces/auth-module-session-cookie-cache-refresh-options.interface.js.map +1 -0
  332. package/dist/interfaces/auth-module-session-options.interface.d.ts +16 -0
  333. package/dist/interfaces/auth-module-session-options.interface.js +2 -0
  334. package/dist/interfaces/auth-module-session-options.interface.js.map +1 -0
  335. package/dist/interfaces/auth-module-social-provider.interface.d.ts +109 -0
  336. package/dist/interfaces/auth-module-social-provider.interface.js +2 -0
  337. package/dist/interfaces/auth-module-social-provider.interface.js.map +1 -0
  338. package/dist/interfaces/auth-module-user-options.interface.d.ts +22 -0
  339. package/dist/interfaces/auth-module-user-options.interface.js +2 -0
  340. package/dist/interfaces/auth-module-user-options.interface.js.map +1 -0
  341. package/dist/interfaces/auth-module-workspace-options.interface.d.ts +19 -0
  342. package/dist/interfaces/auth-module-workspace-options.interface.js +2 -0
  343. package/dist/interfaces/auth-module-workspace-options.interface.js.map +1 -0
  344. package/dist/interfaces/auth-oauth-basic-token-endpoint-auth.interface.d.ts +5 -0
  345. package/dist/interfaces/auth-oauth-basic-token-endpoint-auth.interface.js +2 -0
  346. package/dist/interfaces/auth-oauth-basic-token-endpoint-auth.interface.js.map +1 -0
  347. package/dist/interfaces/auth-oauth-client-assertion-context.interface.d.ts +9 -0
  348. package/dist/interfaces/auth-oauth-client-assertion-context.interface.js +2 -0
  349. package/dist/interfaces/auth-oauth-client-assertion-context.interface.js.map +1 -0
  350. package/dist/interfaces/auth-oauth-custom-token-endpoint-auth.interface.d.ts +8 -0
  351. package/dist/interfaces/auth-oauth-custom-token-endpoint-auth.interface.js +2 -0
  352. package/dist/interfaces/auth-oauth-custom-token-endpoint-auth.interface.js.map +1 -0
  353. package/dist/interfaces/auth-oauth-mapped-user.interface.d.ts +15 -0
  354. package/dist/interfaces/auth-oauth-mapped-user.interface.js +2 -0
  355. package/dist/interfaces/auth-oauth-mapped-user.interface.js.map +1 -0
  356. package/dist/interfaces/auth-oauth-no-token-endpoint-auth.interface.d.ts +5 -0
  357. package/dist/interfaces/auth-oauth-no-token-endpoint-auth.interface.js +2 -0
  358. package/dist/interfaces/auth-oauth-no-token-endpoint-auth.interface.js.map +1 -0
  359. package/dist/interfaces/auth-oauth-post-token-endpoint-auth.interface.d.ts +5 -0
  360. package/dist/interfaces/auth-oauth-post-token-endpoint-auth.interface.js +2 -0
  361. package/dist/interfaces/auth-oauth-post-token-endpoint-auth.interface.js.map +1 -0
  362. package/dist/interfaces/auth-oauth-private-key-jwt-token-endpoint-auth.interface.d.ts +9 -0
  363. package/dist/interfaces/auth-oauth-private-key-jwt-token-endpoint-auth.interface.js +2 -0
  364. package/dist/interfaces/auth-oauth-private-key-jwt-token-endpoint-auth.interface.js.map +1 -0
  365. package/dist/interfaces/auth-oauth-profile.interface.d.ts +9 -0
  366. package/dist/interfaces/auth-oauth-profile.interface.js +2 -0
  367. package/dist/interfaces/auth-oauth-profile.interface.js.map +1 -0
  368. package/dist/interfaces/auth-oauth-refresh-context.interface.d.ts +7 -0
  369. package/dist/interfaces/auth-oauth-refresh-context.interface.js +2 -0
  370. package/dist/interfaces/auth-oauth-refresh-context.interface.js.map +1 -0
  371. package/dist/interfaces/auth-oauth-token-request-client-options.interface.d.ts +7 -0
  372. package/dist/interfaces/auth-oauth-token-request-client-options.interface.js +2 -0
  373. package/dist/interfaces/auth-oauth-token-request-client-options.interface.js.map +1 -0
  374. package/dist/interfaces/auth-oauth-token-request-context.interface.d.ts +15 -0
  375. package/dist/interfaces/auth-oauth-token-request-context.interface.js +2 -0
  376. package/dist/interfaces/auth-oauth-token-request-context.interface.js.map +1 -0
  377. package/dist/interfaces/auth-oauth-tokens.interface.d.ts +19 -0
  378. package/dist/interfaces/auth-oauth-tokens.interface.js +2 -0
  379. package/dist/interfaces/auth-oauth-tokens.interface.js.map +1 -0
  380. package/dist/interfaces/auth-oauth-user-info.interface.d.ts +13 -0
  381. package/dist/interfaces/auth-oauth-user-info.interface.js +2 -0
  382. package/dist/interfaces/auth-oauth-user-info.interface.js.map +1 -0
  383. package/dist/interfaces/auth-provider-user-info.interface.d.ts +13 -0
  384. package/dist/interfaces/auth-provider-user-info.interface.js +2 -0
  385. package/dist/interfaces/auth-provider-user-info.interface.js.map +1 -0
  386. package/dist/interfaces/auth-refreshed-token.interface.d.ts +19 -0
  387. package/dist/interfaces/auth-refreshed-token.interface.js +2 -0
  388. package/dist/interfaces/auth-refreshed-token.interface.js.map +1 -0
  389. package/dist/interfaces/auth-reset-password-data.interface.d.ts +10 -0
  390. package/dist/interfaces/auth-reset-password-data.interface.js +2 -0
  391. package/dist/interfaces/auth-reset-password-data.interface.js.map +1 -0
  392. package/dist/interfaces/auth-social-provider-user-info.interface.d.ts +8 -0
  393. package/dist/interfaces/auth-social-provider-user-info.interface.js +2 -0
  394. package/dist/interfaces/auth-social-provider-user-info.interface.js.map +1 -0
  395. package/dist/interfaces/auth-social-provider.interface.d.ts +7 -0
  396. package/dist/interfaces/auth-social-provider.interface.js +2 -0
  397. package/dist/interfaces/auth-social-provider.interface.js.map +1 -0
  398. package/dist/interfaces/auth-user.interface.d.ts +19 -0
  399. package/dist/interfaces/auth-user.interface.js +2 -0
  400. package/dist/interfaces/auth-user.interface.js.map +1 -0
  401. package/dist/interfaces/authenticated-session.interface.d.ts +9 -0
  402. package/dist/interfaces/authenticated-session.interface.js +2 -0
  403. package/dist/interfaces/authenticated-session.interface.js.map +1 -0
  404. package/dist/interfaces/ban-user-options.interface.d.ts +7 -0
  405. package/dist/interfaces/ban-user-options.interface.js +2 -0
  406. package/dist/interfaces/ban-user-options.interface.js.map +1 -0
  407. package/dist/interfaces/can-options.interface.d.ts +2 -0
  408. package/dist/interfaces/change-auth-email-options.interface.d.ts +7 -0
  409. package/dist/interfaces/change-auth-email-options.interface.js +2 -0
  410. package/dist/interfaces/change-auth-email-options.interface.js.map +1 -0
  411. package/dist/interfaces/change-auth-password-options.interface.d.ts +9 -0
  412. package/dist/interfaces/change-auth-password-options.interface.js +2 -0
  413. package/dist/interfaces/change-auth-password-options.interface.js.map +1 -0
  414. package/dist/interfaces/change-auth-password-result.interface.d.ts +5 -0
  415. package/dist/interfaces/change-auth-password-result.interface.js +2 -0
  416. package/dist/interfaces/change-auth-password-result.interface.js.map +1 -0
  417. package/dist/interfaces/create-api-key-options.interface.d.ts +14 -0
  418. package/dist/interfaces/create-api-key-options.interface.js +2 -0
  419. package/dist/interfaces/create-api-key-options.interface.js.map +1 -0
  420. package/dist/interfaces/create-invitation-options.interface.d.ts +9 -0
  421. package/dist/interfaces/create-invitation-options.interface.js +2 -0
  422. package/dist/interfaces/create-invitation-options.interface.js.map +1 -0
  423. package/dist/interfaces/create-user-options.interface.d.ts +13 -0
  424. package/dist/interfaces/create-user-options.interface.js +2 -0
  425. package/dist/interfaces/create-user-options.interface.js.map +1 -0
  426. package/dist/interfaces/create-workspace-options.interface.d.ts +5 -0
  427. package/dist/interfaces/create-workspace-options.interface.js +2 -0
  428. package/dist/interfaces/create-workspace-options.interface.js.map +1 -0
  429. package/dist/interfaces/created-api-key.interface.d.ts +8 -0
  430. package/dist/interfaces/created-api-key.interface.js +2 -0
  431. package/dist/interfaces/created-api-key.interface.js.map +1 -0
  432. package/dist/interfaces/delete-auth-user-options.interface.d.ts +9 -0
  433. package/dist/interfaces/delete-auth-user-options.interface.js +2 -0
  434. package/dist/interfaces/delete-auth-user-options.interface.js.map +1 -0
  435. package/dist/interfaces/delete-auth-user-result.interface.d.ts +7 -0
  436. package/dist/interfaces/delete-auth-user-result.interface.js +2 -0
  437. package/dist/interfaces/delete-auth-user-result.interface.js.map +1 -0
  438. package/dist/interfaces/impersonation-options.interface.d.ts +7 -0
  439. package/dist/interfaces/impersonation-options.interface.js +2 -0
  440. package/dist/interfaces/impersonation-options.interface.js.map +1 -0
  441. package/dist/interfaces/link-auth-social-account-options.interface.d.ts +21 -0
  442. package/dist/interfaces/link-auth-social-account-options.interface.js +2 -0
  443. package/dist/interfaces/link-auth-social-account-options.interface.js.map +1 -0
  444. package/dist/interfaces/link-auth-social-account-result.interface.d.ts +7 -0
  445. package/dist/interfaces/link-auth-social-account-result.interface.js +2 -0
  446. package/dist/interfaces/link-auth-social-account-result.interface.js.map +1 -0
  447. package/dist/interfaces/request-identity-patch.interface.d.ts +13 -0
  448. package/dist/interfaces/request-identity-patch.interface.js +2 -0
  449. package/dist/interfaces/request-identity-patch.interface.js.map +1 -0
  450. package/dist/interfaces/request-password-reset-options.interface.d.ts +7 -0
  451. package/dist/interfaces/request-password-reset-options.interface.js +2 -0
  452. package/dist/interfaces/request-password-reset-options.interface.js.map +1 -0
  453. package/dist/interfaces/request-password-reset-result.interface.d.ts +7 -0
  454. package/dist/interfaces/request-password-reset-result.interface.js +2 -0
  455. package/dist/interfaces/request-password-reset-result.interface.js.map +1 -0
  456. package/dist/interfaces/request-permissions.interface.d.ts +7 -0
  457. package/dist/interfaces/request-permissions.interface.js +2 -0
  458. package/dist/interfaces/request-permissions.interface.js.map +1 -0
  459. package/dist/interfaces/reset-password-options.interface.d.ts +7 -0
  460. package/dist/interfaces/reset-password-options.interface.js +2 -0
  461. package/dist/interfaces/reset-password-options.interface.js.map +1 -0
  462. package/dist/interfaces/route-argument-metadata-value.interface.d.ts +4 -0
  463. package/dist/interfaces/scope-policy-options.interface.d.ts +6 -0
  464. package/dist/interfaces/send-verification-email-options.interface.d.ts +7 -0
  465. package/dist/interfaces/send-verification-email-options.interface.js +2 -0
  466. package/dist/interfaces/send-verification-email-options.interface.js.map +1 -0
  467. package/dist/interfaces/serialized-ability-rule.interface.d.ts +7 -0
  468. package/dist/interfaces/sign-in-entity-result.interface.d.ts +7 -0
  469. package/dist/interfaces/sign-in-entity-result.interface.js +2 -0
  470. package/dist/interfaces/sign-in-entity-result.interface.js.map +1 -0
  471. package/dist/interfaces/sign-in-options.interface.d.ts +11 -0
  472. package/dist/interfaces/sign-in-options.interface.js +2 -0
  473. package/dist/interfaces/sign-in-options.interface.js.map +1 -0
  474. package/dist/interfaces/sign-in-result.interface.d.ts +12 -0
  475. package/dist/interfaces/sign-in-result.interface.js +2 -0
  476. package/dist/interfaces/sign-in-result.interface.js.map +1 -0
  477. package/dist/interfaces/sign-in-social-entity-result.interface.d.ts +7 -0
  478. package/dist/interfaces/sign-in-social-entity-result.interface.js +2 -0
  479. package/dist/interfaces/sign-in-social-entity-result.interface.js.map +1 -0
  480. package/dist/interfaces/sign-in-social-options.interface.d.ts +23 -0
  481. package/dist/interfaces/sign-in-social-options.interface.js +2 -0
  482. package/dist/interfaces/sign-in-social-options.interface.js.map +1 -0
  483. package/dist/interfaces/sign-in-social-result.interface.d.ts +12 -0
  484. package/dist/interfaces/sign-in-social-result.interface.js +2 -0
  485. package/dist/interfaces/sign-in-social-result.interface.js.map +1 -0
  486. package/dist/interfaces/sign-up-options.interface.d.ts +15 -0
  487. package/dist/interfaces/sign-up-options.interface.js +2 -0
  488. package/dist/interfaces/sign-up-options.interface.js.map +1 -0
  489. package/dist/interfaces/sign-up-result.interface.d.ts +8 -0
  490. package/dist/interfaces/sign-up-result.interface.js +2 -0
  491. package/dist/interfaces/sign-up-result.interface.js.map +1 -0
  492. package/dist/interfaces/unlink-auth-account-options.interface.d.ts +5 -0
  493. package/dist/interfaces/unlink-auth-account-options.interface.js +2 -0
  494. package/dist/interfaces/unlink-auth-account-options.interface.js.map +1 -0
  495. package/dist/interfaces/update-api-key-options.interface.d.ts +14 -0
  496. package/dist/interfaces/update-api-key-options.interface.js +2 -0
  497. package/dist/interfaces/update-api-key-options.interface.js.map +1 -0
  498. package/dist/interfaces/update-auth-user-options.interface.d.ts +7 -0
  499. package/dist/interfaces/update-auth-user-options.interface.js +2 -0
  500. package/dist/interfaces/update-auth-user-options.interface.js.map +1 -0
  501. package/dist/interfaces/update-member-options.interface.d.ts +10 -0
  502. package/dist/interfaces/update-member-options.interface.js +2 -0
  503. package/dist/interfaces/update-member-options.interface.js.map +1 -0
  504. package/dist/interfaces/update-user-options.interface.d.ts +11 -0
  505. package/dist/interfaces/update-user-options.interface.js +2 -0
  506. package/dist/interfaces/update-user-options.interface.js.map +1 -0
  507. package/dist/interfaces/update-workspace-options.interface.d.ts +5 -0
  508. package/dist/interfaces/update-workspace-options.interface.js +2 -0
  509. package/dist/interfaces/update-workspace-options.interface.js.map +1 -0
  510. package/dist/interfaces/user-api-key-validation.interface.d.ts +11 -0
  511. package/dist/interfaces/user-api-key-validation.interface.js +2 -0
  512. package/dist/interfaces/user-api-key-validation.interface.js.map +1 -0
  513. package/dist/interfaces/user-can-metadata.interface.d.ts +3 -0
  514. package/dist/interfaces/user-has-permissions-options.interface.d.ts +5 -0
  515. package/dist/interfaces/user-has-permissions-options.interface.js +2 -0
  516. package/dist/interfaces/user-has-permissions-options.interface.js.map +1 -0
  517. package/dist/interfaces/workspace-api-key-validation.interface.d.ts +11 -0
  518. package/dist/interfaces/workspace-api-key-validation.interface.js +2 -0
  519. package/dist/interfaces/workspace-api-key-validation.interface.js.map +1 -0
  520. package/dist/interfaces/workspace-can-metadata.interface.d.ts +3 -0
  521. package/dist/interfaces/workspace-has-permissions-options.interface.d.ts +5 -0
  522. package/dist/interfaces/workspace-has-permissions-options.interface.js +2 -0
  523. package/dist/interfaces/workspace-has-permissions-options.interface.js.map +1 -0
  524. package/dist/objects/accept-invitation-payload.object.d.ts +9 -0
  525. package/dist/objects/accept-invitation-payload.object.js +36 -0
  526. package/dist/objects/accept-invitation-payload.object.js.map +1 -0
  527. package/dist/objects/add-member-payload.object.d.ts +5 -0
  528. package/dist/objects/add-member-payload.object.js +24 -0
  529. package/dist/objects/add-member-payload.object.js.map +1 -0
  530. package/dist/objects/auth-ability-rule.object.d.ts +15 -0
  531. package/dist/objects/auth-ability-rule.object.js +55 -0
  532. package/dist/objects/auth-ability-rule.object.js.map +1 -0
  533. package/dist/objects/auth-change-password-result.object.d.ts +5 -0
  534. package/dist/objects/auth-change-password-result.object.js +24 -0
  535. package/dist/objects/auth-change-password-result.object.js.map +1 -0
  536. package/dist/objects/auth-delete-user-result.object.d.ts +7 -0
  537. package/dist/objects/auth-delete-user-result.object.js +30 -0
  538. package/dist/objects/auth-delete-user-result.object.js.map +1 -0
  539. package/dist/objects/auth-link-social-account-result.object.d.ts +7 -0
  540. package/dist/objects/auth-link-social-account-result.object.js +30 -0
  541. package/dist/objects/auth-link-social-account-result.object.js.map +1 -0
  542. package/dist/objects/auth-request-password-reset-result.object.d.ts +7 -0
  543. package/dist/objects/auth-request-password-reset-result.object.js +30 -0
  544. package/dist/objects/auth-request-password-reset-result.object.js.map +1 -0
  545. package/dist/objects/auth-sign-in-result.object.d.ts +12 -0
  546. package/dist/objects/auth-sign-in-result.object.js +43 -0
  547. package/dist/objects/auth-sign-in-result.object.js.map +1 -0
  548. package/dist/objects/auth-sign-in-social-result.object.d.ts +12 -0
  549. package/dist/objects/auth-sign-in-social-result.object.js +43 -0
  550. package/dist/objects/auth-sign-in-social-result.object.js.map +1 -0
  551. package/dist/objects/auth-social-provider.object.d.ts +7 -0
  552. package/dist/objects/auth-social-provider.object.js +30 -0
  553. package/dist/objects/auth-social-provider.object.js.map +1 -0
  554. package/dist/objects/ban-user-payload.object.d.ts +5 -0
  555. package/dist/objects/ban-user-payload.object.js +24 -0
  556. package/dist/objects/ban-user-payload.object.js.map +1 -0
  557. package/dist/objects/cancel-invitation-payload.object.d.ts +5 -0
  558. package/dist/objects/cancel-invitation-payload.object.js +24 -0
  559. package/dist/objects/cancel-invitation-payload.object.js.map +1 -0
  560. package/dist/objects/create-invitation-payload.object.d.ts +5 -0
  561. package/dist/objects/create-invitation-payload.object.js +24 -0
  562. package/dist/objects/create-invitation-payload.object.js.map +1 -0
  563. package/dist/objects/create-user-api-key-result.object.d.ts +10 -0
  564. package/dist/objects/create-user-api-key-result.object.js +33 -0
  565. package/dist/objects/create-user-api-key-result.object.js.map +1 -0
  566. package/dist/objects/create-user-payload.object.d.ts +5 -0
  567. package/dist/objects/create-user-payload.object.js +24 -0
  568. package/dist/objects/create-user-payload.object.js.map +1 -0
  569. package/dist/objects/create-workspace-api-key-result.object.d.ts +10 -0
  570. package/dist/objects/create-workspace-api-key-result.object.js +33 -0
  571. package/dist/objects/create-workspace-api-key-result.object.js.map +1 -0
  572. package/dist/objects/create-workspace-payload.object.d.ts +5 -0
  573. package/dist/objects/create-workspace-payload.object.js +24 -0
  574. package/dist/objects/create-workspace-payload.object.js.map +1 -0
  575. package/dist/objects/delete-user-payload.object.d.ts +5 -0
  576. package/dist/objects/delete-user-payload.object.js +24 -0
  577. package/dist/objects/delete-user-payload.object.js.map +1 -0
  578. package/dist/objects/delete-workspace-payload.object.d.ts +5 -0
  579. package/dist/objects/delete-workspace-payload.object.js +24 -0
  580. package/dist/objects/delete-workspace-payload.object.js.map +1 -0
  581. package/dist/objects/leave-workspace-payload.object.d.ts +5 -0
  582. package/dist/objects/leave-workspace-payload.object.js +24 -0
  583. package/dist/objects/leave-workspace-payload.object.js.map +1 -0
  584. package/dist/objects/reject-invitation-payload.object.d.ts +5 -0
  585. package/dist/objects/reject-invitation-payload.object.js +24 -0
  586. package/dist/objects/reject-invitation-payload.object.js.map +1 -0
  587. package/dist/objects/remove-member-payload.object.d.ts +5 -0
  588. package/dist/objects/remove-member-payload.object.js +24 -0
  589. package/dist/objects/remove-member-payload.object.js.map +1 -0
  590. package/dist/objects/set-member-permissions-payload.object.d.ts +5 -0
  591. package/dist/objects/set-member-permissions-payload.object.js +24 -0
  592. package/dist/objects/set-member-permissions-payload.object.js.map +1 -0
  593. package/dist/objects/set-member-roles-payload.object.d.ts +5 -0
  594. package/dist/objects/set-member-roles-payload.object.js +24 -0
  595. package/dist/objects/set-member-roles-payload.object.js.map +1 -0
  596. package/dist/objects/set-user-permissions-payload.object.d.ts +5 -0
  597. package/dist/objects/set-user-permissions-payload.object.js +24 -0
  598. package/dist/objects/set-user-permissions-payload.object.js.map +1 -0
  599. package/dist/objects/set-user-roles-payload.object.d.ts +5 -0
  600. package/dist/objects/set-user-roles-payload.object.js +24 -0
  601. package/dist/objects/set-user-roles-payload.object.js.map +1 -0
  602. package/dist/objects/sign-up-payload.object.d.ts +7 -0
  603. package/dist/objects/sign-up-payload.object.js +30 -0
  604. package/dist/objects/sign-up-payload.object.js.map +1 -0
  605. package/dist/objects/unban-user-payload.object.d.ts +5 -0
  606. package/dist/objects/unban-user-payload.object.js +24 -0
  607. package/dist/objects/unban-user-payload.object.js.map +1 -0
  608. package/dist/objects/update-member-payload.object.d.ts +5 -0
  609. package/dist/objects/update-member-payload.object.js +24 -0
  610. package/dist/objects/update-member-payload.object.js.map +1 -0
  611. package/dist/objects/update-user-payload.object.d.ts +5 -0
  612. package/dist/objects/update-user-payload.object.js +24 -0
  613. package/dist/objects/update-user-payload.object.js.map +1 -0
  614. package/dist/objects/update-workspace-payload.object.d.ts +5 -0
  615. package/dist/objects/update-workspace-payload.object.js +24 -0
  616. package/dist/objects/update-workspace-payload.object.js.map +1 -0
  617. package/dist/objects/user-api-key-permission-option.object.d.ts +8 -0
  618. package/dist/objects/user-api-key-permission-option.object.js +31 -0
  619. package/dist/objects/user-api-key-permission-option.object.js.map +1 -0
  620. package/dist/objects/user-permission-option.object.d.ts +8 -0
  621. package/dist/objects/user-permission-option.object.js +31 -0
  622. package/dist/objects/user-permission-option.object.js.map +1 -0
  623. package/dist/objects/user-role-option.object.d.ts +8 -0
  624. package/dist/objects/user-role-option.object.js +31 -0
  625. package/dist/objects/user-role-option.object.js.map +1 -0
  626. package/dist/objects/workspace-api-key-permission-option.object.d.ts +8 -0
  627. package/dist/objects/workspace-api-key-permission-option.object.js +31 -0
  628. package/dist/objects/workspace-api-key-permission-option.object.js.map +1 -0
  629. package/dist/objects/workspace-permission-option.object.d.ts +8 -0
  630. package/dist/objects/workspace-permission-option.object.js +31 -0
  631. package/dist/objects/workspace-permission-option.object.js.map +1 -0
  632. package/dist/objects/workspace-role-option.object.d.ts +8 -0
  633. package/dist/objects/workspace-role-option.object.js +31 -0
  634. package/dist/objects/workspace-role-option.object.js.map +1 -0
  635. package/dist/permission.constants.d.ts +23 -0
  636. package/dist/permission.constants.js +23 -0
  637. package/dist/permission.constants.js.map +1 -1
  638. package/dist/policies/create-scope-policy.d.ts +1 -0
  639. package/dist/policies/create-scope-policy.js +2 -1
  640. package/dist/policies/create-scope-policy.js.map +1 -1
  641. package/dist/policies/user-scope.policy.d.ts +8 -0
  642. package/dist/policies/user-scope.policy.js +8 -0
  643. package/dist/policies/user-scope.policy.js.map +1 -1
  644. package/dist/policies/workspace-scope.policy.d.ts +8 -0
  645. package/dist/policies/workspace-scope.policy.js +8 -0
  646. package/dist/policies/workspace-scope.policy.js.map +1 -1
  647. package/dist/resolvers/auth.resolver.d.ts +67 -0
  648. package/dist/resolvers/auth.resolver.js +279 -0
  649. package/dist/resolvers/auth.resolver.js.map +1 -0
  650. package/dist/resolvers/invitation.resolver.d.ts +32 -0
  651. package/dist/resolvers/invitation.resolver.js +134 -0
  652. package/dist/resolvers/invitation.resolver.js.map +1 -0
  653. package/dist/resolvers/member.resolver.d.ts +73 -0
  654. package/dist/resolvers/member.resolver.js +191 -0
  655. package/dist/resolvers/member.resolver.js.map +1 -0
  656. package/dist/resolvers/session.resolver.d.ts +33 -0
  657. package/dist/resolvers/session.resolver.js +156 -0
  658. package/dist/resolvers/session.resolver.js.map +1 -0
  659. package/dist/resolvers/user-api-key.resolver.d.ts +24 -0
  660. package/dist/resolvers/user-api-key.resolver.js +84 -0
  661. package/dist/resolvers/user-api-key.resolver.js.map +1 -0
  662. package/dist/resolvers/user.resolver.d.ts +75 -0
  663. package/dist/resolvers/user.resolver.js +289 -0
  664. package/dist/resolvers/user.resolver.js.map +1 -0
  665. package/dist/resolvers/workspace-api-key.resolver.d.ts +24 -0
  666. package/dist/resolvers/workspace-api-key.resolver.js +84 -0
  667. package/dist/resolvers/workspace-api-key.resolver.js.map +1 -0
  668. package/dist/resolvers/workspace.resolver.d.ts +80 -0
  669. package/dist/resolvers/workspace.resolver.js +211 -0
  670. package/dist/resolvers/workspace.resolver.js.map +1 -0
  671. package/dist/services/access-control.service.d.ts +52 -0
  672. package/dist/services/access-control.service.js +201 -0
  673. package/dist/services/access-control.service.js.map +1 -0
  674. package/dist/services/account.service.d.ts +14 -0
  675. package/dist/services/account.service.js +43 -0
  676. package/dist/services/account.service.js.map +1 -0
  677. package/dist/services/auth.service.d.ts +101 -0
  678. package/dist/services/auth.service.js +333 -0
  679. package/dist/services/auth.service.js.map +1 -0
  680. package/dist/services/invitation.service.d.ts +58 -0
  681. package/dist/services/invitation.service.js +386 -0
  682. package/dist/services/invitation.service.js.map +1 -0
  683. package/dist/services/member.service.d.ts +75 -0
  684. package/dist/services/member.service.js +390 -0
  685. package/dist/services/member.service.js.map +1 -0
  686. package/dist/services/session.service.d.ts +58 -0
  687. package/dist/services/session.service.js +313 -0
  688. package/dist/services/session.service.js.map +1 -0
  689. package/dist/services/user-api-key.service.d.ts +48 -0
  690. package/dist/services/user-api-key.service.js +260 -0
  691. package/dist/services/user-api-key.service.js.map +1 -0
  692. package/dist/services/user-deletion.service.d.ts +15 -0
  693. package/dist/services/user-deletion.service.js +50 -0
  694. package/dist/services/user-deletion.service.js.map +1 -0
  695. package/dist/services/user.service.d.ts +81 -0
  696. package/dist/services/user.service.js +479 -0
  697. package/dist/services/user.service.js.map +1 -0
  698. package/dist/services/workspace-api-key.service.d.ts +49 -0
  699. package/dist/services/workspace-api-key.service.js +272 -0
  700. package/dist/services/workspace-api-key.service.js.map +1 -0
  701. package/dist/services/workspace.service.d.ts +40 -0
  702. package/dist/services/workspace.service.js +202 -0
  703. package/dist/services/workspace.service.js.map +1 -0
  704. package/dist/tsconfig.tsbuildinfo +1 -1
  705. package/dist/types/api-key-validation.type.d.ts +4 -0
  706. package/dist/types/api-key-validation.type.js +2 -0
  707. package/dist/types/api-key-validation.type.js.map +1 -0
  708. package/dist/types/api-key.type.d.ts +4 -0
  709. package/dist/types/api-key.type.js +2 -0
  710. package/dist/types/api-key.type.js.map +1 -0
  711. package/dist/types/auth-account-selector.type.d.ts +12 -0
  712. package/dist/types/auth-account-selector.type.js +2 -0
  713. package/dist/types/auth-account-selector.type.js.map +1 -0
  714. package/dist/types/auth-invitation-email-inviter.type.d.ts +7 -0
  715. package/dist/types/auth-invitation-email-inviter.type.js +2 -0
  716. package/dist/types/auth-invitation-email-inviter.type.js.map +1 -0
  717. package/dist/types/auth-maybe-promise.type.d.ts +2 -0
  718. package/dist/types/auth-maybe-promise.type.js +2 -0
  719. package/dist/types/auth-maybe-promise.type.js.map +1 -0
  720. package/dist/types/auth-module-provider.type.d.ts +4 -0
  721. package/dist/types/auth-module-provider.type.js +2 -0
  722. package/dist/types/auth-module-provider.type.js.map +1 -0
  723. package/dist/types/auth-module-roles.type.d.ts +3 -1
  724. package/dist/types/auth-module-social-provider-id.type.d.ts +2 -0
  725. package/dist/types/auth-module-social-provider-id.type.js +2 -0
  726. package/dist/types/auth-module-social-provider-id.type.js.map +1 -0
  727. package/dist/types/auth-oauth-token-endpoint-auth.type.d.ts +7 -0
  728. package/dist/types/auth-oauth-token-endpoint-auth.type.js +2 -0
  729. package/dist/types/auth-oauth-token-endpoint-auth.type.js.map +1 -0
  730. package/dist/types/auth-send-invitation-email.type.d.ts +7 -0
  731. package/dist/types/auth-send-invitation-email.type.js +2 -0
  732. package/dist/types/auth-send-invitation-email.type.js.map +1 -0
  733. package/dist/types/auth-send-reset-password.type.d.ts +7 -0
  734. package/dist/types/auth-send-reset-password.type.js +2 -0
  735. package/dist/types/auth-send-reset-password.type.js.map +1 -0
  736. package/dist/types/auth-send-verification-email.type.d.ts +7 -0
  737. package/dist/types/auth-send-verification-email.type.js +2 -0
  738. package/dist/types/auth-send-verification-email.type.js.map +1 -0
  739. package/dist/types/build-user-ability-callback.type.d.ts +10 -4
  740. package/dist/types/build-workspace-ability-callback.type.d.ts +10 -4
  741. package/dist/types/can-subject-factory.type.d.ts +1 -0
  742. package/dist/types/can-subject.type.d.ts +1 -0
  743. package/dist/types/lowercase-identifier.type.d.ts +6 -0
  744. package/dist/types/lowercase-identifier.type.js +2 -0
  745. package/dist/types/lowercase-identifier.type.js.map +1 -0
  746. package/dist/types/permission-name.type.d.ts +3 -0
  747. package/dist/types/permission-name.type.js +2 -0
  748. package/dist/types/permission-name.type.js.map +1 -0
  749. package/dist/types/role-name.type.d.ts +3 -0
  750. package/dist/types/role-name.type.js +2 -0
  751. package/dist/types/role-name.type.js.map +1 -0
  752. package/dist/types/route-argument-metadata.type.d.ts +1 -0
  753. package/dist/user.constants.d.ts +8 -2
  754. package/dist/user.constants.js +24 -14
  755. package/dist/user.constants.js.map +1 -1
  756. package/dist/utils/api-key-credential.util.d.ts +4 -0
  757. package/dist/utils/api-key-credential.util.js +16 -0
  758. package/dist/utils/api-key-credential.util.js.map +1 -0
  759. package/dist/utils/api-key-permissions.util.d.ts +6 -0
  760. package/dist/utils/api-key-permissions.util.js +16 -0
  761. package/dist/utils/api-key-permissions.util.js.map +1 -0
  762. package/dist/utils/append-metadata.util.d.ts +1 -0
  763. package/dist/utils/append-metadata.util.js +1 -0
  764. package/dist/utils/append-metadata.util.js.map +1 -1
  765. package/dist/utils/apply-auth-response-cookies.util.d.ts +1 -0
  766. package/dist/utils/apply-auth-response-cookies.util.js +1 -0
  767. package/dist/utils/apply-auth-response-cookies.util.js.map +1 -1
  768. package/dist/utils/auth-role.util.d.ts +8 -2
  769. package/dist/utils/auth-role.util.js +22 -6
  770. package/dist/utils/auth-role.util.js.map +1 -1
  771. package/dist/utils/build-request-ability.util.d.ts +7 -0
  772. package/dist/utils/build-request-ability.util.js +25 -0
  773. package/dist/utils/build-request-ability.util.js.map +1 -0
  774. package/dist/utils/can.util.d.ts +1 -0
  775. package/dist/utils/can.util.js +1 -0
  776. package/dist/utils/can.util.js.map +1 -1
  777. package/dist/utils/create-email-verification-config.d.ts +1 -0
  778. package/dist/utils/create-email-verification-config.js +1 -0
  779. package/dist/utils/create-email-verification-config.js.map +1 -1
  780. package/dist/utils/create-generic-oauth-config.d.ts +1 -0
  781. package/dist/utils/create-generic-oauth-config.js +1 -0
  782. package/dist/utils/create-generic-oauth-config.js.map +1 -1
  783. package/dist/utils/create-permission-enum.util.d.ts +2 -0
  784. package/dist/utils/create-permission-enum.util.js +16 -0
  785. package/dist/utils/create-permission-enum.util.js.map +1 -0
  786. package/dist/utils/create-user-config.d.ts +2 -1
  787. package/dist/utils/create-user-config.js +1 -0
  788. package/dist/utils/create-user-config.js.map +1 -1
  789. package/dist/utils/estimate-entropy.d.ts +7 -0
  790. package/dist/utils/estimate-entropy.js +7 -0
  791. package/dist/utils/estimate-entropy.js.map +1 -1
  792. package/dist/utils/extend-ability.util.d.ts +4 -0
  793. package/dist/utils/extend-ability.util.js +62 -0
  794. package/dist/utils/extend-ability.util.js.map +1 -0
  795. package/dist/utils/extract-api-key.util.d.ts +1 -0
  796. package/dist/utils/extract-api-key.util.js +1 -0
  797. package/dist/utils/extract-api-key.util.js.map +1 -1
  798. package/dist/utils/get-current-api-key.util.d.ts +3 -0
  799. package/dist/utils/get-current-api-key.util.js +9 -0
  800. package/dist/utils/get-current-api-key.util.js.map +1 -0
  801. package/dist/utils/get-user-ability.util.d.ts +2 -1
  802. package/dist/utils/get-user-ability.util.js +5 -2
  803. package/dist/utils/get-user-ability.util.js.map +1 -1
  804. package/dist/utils/get-workspace-ability.util.d.ts +2 -1
  805. package/dist/utils/get-workspace-ability.util.js +5 -2
  806. package/dist/utils/get-workspace-ability.util.js.map +1 -1
  807. package/dist/utils/resolve-auth-catalog.util.d.ts +7 -0
  808. package/dist/utils/resolve-auth-catalog.util.js +34 -0
  809. package/dist/utils/resolve-auth-catalog.util.js.map +1 -0
  810. package/dist/utils/resolve-effective-permissions.util.d.ts +9 -0
  811. package/dist/utils/resolve-effective-permissions.util.js +18 -0
  812. package/dist/utils/resolve-effective-permissions.util.js.map +1 -0
  813. package/dist/utils/resolve-request-permissions.util.d.ts +6 -0
  814. package/dist/utils/resolve-request-permissions.util.js +44 -0
  815. package/dist/utils/resolve-request-permissions.util.js.map +1 -0
  816. package/dist/utils/run-auth-query.d.ts +4 -0
  817. package/dist/utils/run-auth-query.js +32 -2
  818. package/dist/utils/run-auth-query.js.map +1 -1
  819. package/dist/utils/serialize-ability-rules.util.d.ts +1 -0
  820. package/dist/utils/serialize-ability-rules.util.js +2 -1
  821. package/dist/utils/serialize-ability-rules.util.js.map +1 -1
  822. package/dist/utils/split-auth-providers.d.ts +2 -1
  823. package/dist/utils/split-auth-providers.js +1 -0
  824. package/dist/utils/split-auth-providers.js.map +1 -1
  825. package/dist/utils/user-can.util.d.ts +1 -0
  826. package/dist/utils/user-can.util.js +3 -12
  827. package/dist/utils/user-can.util.js.map +1 -1
  828. package/dist/utils/workspace-can.util.d.ts +1 -0
  829. package/dist/utils/workspace-can.util.js +4 -12
  830. package/dist/utils/workspace-can.util.js.map +1 -1
  831. package/dist/workspace.constants.d.ts +10 -3
  832. package/dist/workspace.constants.js +24 -13
  833. package/dist/workspace.constants.js.map +1 -1
  834. package/package.json +36 -13
  835. package/dist/access-control.service.d.ts +0 -18
  836. package/dist/access-control.service.js +0 -153
  837. package/dist/access-control.service.js.map +0 -1
  838. package/dist/api-key.service.d.ts +0 -75
  839. package/dist/api-key.service.js +0 -332
  840. package/dist/api-key.service.js.map +0 -1
  841. package/dist/auth.service.d.ts +0 -27
  842. package/dist/auth.service.js +0 -199
  843. package/dist/auth.service.js.map +0 -1
  844. package/dist/decorators/current-workspace-member.decorator.d.ts +0 -1
  845. package/dist/decorators/current-workspace-member.decorator.js +0 -5
  846. package/dist/decorators/current-workspace-member.decorator.js.map +0 -1
  847. package/dist/entities/api-key.entity.d.ts +0 -17
  848. package/dist/entities/api-key.entity.js +0 -92
  849. package/dist/entities/api-key.entity.js.map +0 -1
  850. package/dist/entities/resolve-auth-relation-target.d.ts +0 -3
  851. package/dist/entities/resolve-auth-relation-target.js +0 -30
  852. package/dist/entities/resolve-auth-relation-target.js.map +0 -1
  853. package/dist/entities/workspace-invitation.entity.d.ts +0 -14
  854. package/dist/entities/workspace-invitation.entity.js +0 -74
  855. package/dist/entities/workspace-invitation.entity.js.map +0 -1
  856. package/dist/entities/workspace-member.entity.d.ts +0 -16
  857. package/dist/entities/workspace-member.entity.js +0 -86
  858. package/dist/entities/workspace-member.entity.js.map +0 -1
  859. package/dist/interfaces/auth-role.interface.d.ts +0 -4
  860. package/dist/interfaces/auth-role.interface.js +0 -2
  861. package/dist/interfaces/auth-role.interface.js.map +0 -1
  862. package/dist/interfaces/auth-service.interface.d.ts +0 -160
  863. package/dist/interfaces/auth-service.interface.js +0 -2
  864. package/dist/interfaces/auth-service.interface.js.map +0 -1
  865. package/dist/interfaces/session-service.interface.d.ts +0 -5
  866. package/dist/interfaces/session-service.interface.js +0 -2
  867. package/dist/interfaces/session-service.interface.js.map +0 -1
  868. package/dist/interfaces/user-service.interface.d.ts +0 -44
  869. package/dist/interfaces/user-service.interface.js +0 -2
  870. package/dist/interfaces/user-service.interface.js.map +0 -1
  871. package/dist/interfaces/workspace-service.interface.d.ts +0 -37
  872. package/dist/interfaces/workspace-service.interface.js +0 -2
  873. package/dist/interfaces/workspace-service.interface.js.map +0 -1
  874. package/dist/session.service.d.ts +0 -18
  875. package/dist/session.service.js +0 -165
  876. package/dist/session.service.js.map +0 -1
  877. package/dist/user-deletion.service.d.ts +0 -19
  878. package/dist/user-deletion.service.js +0 -96
  879. package/dist/user-deletion.service.js.map +0 -1
  880. package/dist/user.service.d.ts +0 -54
  881. package/dist/user.service.js +0 -384
  882. package/dist/user.service.js.map +0 -1
  883. package/dist/workspace.service.d.ts +0 -59
  884. package/dist/workspace.service.js +0 -618
  885. package/dist/workspace.service.js.map +0 -1
@@ -1,332 +0,0 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- var __metadata = (this && this.__metadata) || function (k, v) {
8
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
- };
10
- var __param = (this && this.__param) || function (paramIndex, decorator) {
11
- return function (target, key) { decorator(target, key, paramIndex); }
12
- };
13
- var ApiKeyService_1;
14
- import { createHash, randomBytes } from "node:crypto";
15
- import { EntityManager, Reference, } from "@mikro-orm/core";
16
- import { RequestContext } from "@nest-boot/request-context";
17
- import { BadRequestException, ForbiddenException, Inject, Injectable, Logger, NotFoundException, UnauthorizedException, } from "@nestjs/common";
18
- import { AccessControlService } from "./access-control.service.js";
19
- import { MODULE_OPTIONS_TOKEN } from "./auth.module-definition.js";
20
- import { BaseApiKey, BaseWorkspaceMember, } from "./entities/index.js";
21
- import { DEFAULT_USER_PERMISSIONS, DEFAULT_USER_ROLE, DEFAULT_USER_ROLES, } from "./user.constants.js";
22
- import { normalizeAuthPermissions, resolveAuthPermissions, } from "./utils/auth-role.util.js";
23
- import { runAuthQuery } from "./utils/run-auth-query.js";
24
- import { DEFAULT_WORKSPACE_PERMISSIONS } from "./workspace.constants.js";
25
- let ApiKeyService = ApiKeyService_1 = class ApiKeyService {
26
- em;
27
- authOptions;
28
- accessControlService;
29
- logger = new Logger(ApiKeyService_1.name);
30
- constructor(em, authOptions, accessControlService) {
31
- this.em = em;
32
- this.authOptions = authOptions;
33
- this.accessControlService = accessControlService;
34
- }
35
- async getUserApiKey(id, user) {
36
- this.accessControlService.assertCurrentUser(user);
37
- this.accessControlService.assertUserCan("read", this.apiKeyEntity);
38
- return await this.getOwnedApiKey(id, user);
39
- }
40
- async getWorkspaceApiKey(id, workspace) {
41
- this.assertWorkspacePrincipal(workspace);
42
- this.accessControlService.assertWorkspaceCan("read", this.apiKeyEntity);
43
- return await this.getOwnedApiKey(id, workspace);
44
- }
45
- getUserListFilter(user) {
46
- this.accessControlService.assertCurrentUser(user);
47
- this.accessControlService.assertUserCan("read", this.apiKeyEntity);
48
- return this.getOwnedListFilter(user);
49
- }
50
- getWorkspaceListFilter(workspace) {
51
- this.assertWorkspacePrincipal(workspace);
52
- this.accessControlService.assertWorkspaceCan("read", this.apiKeyEntity);
53
- return this.getOwnedListFilter(workspace);
54
- }
55
- async createUserKey(user, options) {
56
- this.accessControlService.assertCurrentUser(user);
57
- this.accessControlService.assertUserCan("create", this.apiKeyEntity);
58
- const permissions = this.normalizeCreatePermissions(user, options);
59
- this.assertUserPermissionCeiling(user, permissions);
60
- return await this.createKey(user, options, permissions);
61
- }
62
- async createWorkspaceKey(workspace, options) {
63
- this.assertWorkspacePrincipal(workspace);
64
- this.accessControlService.assertWorkspaceCan("create", this.apiKeyEntity);
65
- const permissions = this.normalizeCreatePermissions(workspace, options);
66
- this.accessControlService.assertCanGrantWorkspacePermissions(permissions);
67
- return await this.createKey(workspace, options, permissions);
68
- }
69
- async updateUserKey(id, user, input) {
70
- this.accessControlService.assertCurrentUser(user);
71
- this.accessControlService.assertUserCan("update", this.apiKeyEntity);
72
- const apiKey = await this.findOwnedApiKey(id, user);
73
- const permissions = this.normalizeUpdatedPermissions(apiKey, input);
74
- const finalPermissions = permissions ?? this.normalizePermissions(user, apiKey.permissions ?? []);
75
- this.assertUserPermissionCeiling(user, finalPermissions);
76
- return await this.updateKey(apiKey, input, permissions);
77
- }
78
- async updateWorkspaceKey(id, workspace, input) {
79
- this.assertWorkspacePrincipal(workspace);
80
- this.accessControlService.assertWorkspaceCan("update", this.apiKeyEntity);
81
- const apiKey = await this.findOwnedApiKey(id, workspace);
82
- const permissions = this.normalizeUpdatedPermissions(apiKey, input);
83
- const finalPermissions = permissions ??
84
- this.normalizePermissions(this.unwrapOwner(apiKey), apiKey.permissions ?? []);
85
- this.accessControlService.assertCanGrantWorkspacePermissions(finalPermissions);
86
- return await this.updateKey(apiKey, input, permissions);
87
- }
88
- async deleteUserKey(id, user) {
89
- this.accessControlService.assertCurrentUser(user);
90
- this.accessControlService.assertUserCan("delete", this.apiKeyEntity);
91
- return await this.deleteKey(await this.findOwnedApiKey(id, user));
92
- }
93
- async deleteWorkspaceKey(id, workspace) {
94
- this.assertWorkspacePrincipal(workspace);
95
- this.accessControlService.assertWorkspaceCan("delete", this.apiKeyEntity);
96
- return await this.deleteKey(await this.findOwnedApiKey(id, workspace));
97
- }
98
- async validate(apiKey) {
99
- if (!apiKey) {
100
- throw new UnauthorizedException("Missing API key");
101
- }
102
- const row = await this.findValidationRow(apiKey);
103
- if (!row) {
104
- throw new UnauthorizedException("Invalid API key");
105
- }
106
- if (!row.apiKey.enabled) {
107
- throw new UnauthorizedException("API key is disabled");
108
- }
109
- if (row.apiKey.expiresAt && new Date(row.apiKey.expiresAt) <= new Date()) {
110
- throw new UnauthorizedException("API key has expired");
111
- }
112
- return row;
113
- }
114
- async recordUsage(apiKey) {
115
- const now = new Date();
116
- apiKey.lastUsedAt = now;
117
- apiKey.updatedAt = now;
118
- await this.runUnrestricted((em) => em.persist(apiKey).flush());
119
- return apiKey;
120
- }
121
- async runUnrestricted(callback) {
122
- return await runAuthQuery(this.em, callback);
123
- }
124
- async findOne(where) {
125
- return await this.runUnrestricted(async (em) => await em.findOne(this.apiKeyEntity, where, {
126
- populate: ["owner"],
127
- }));
128
- }
129
- async createKey(owner, options, permissions) {
130
- if (options.expiresAt && options.expiresAt <= new Date()) {
131
- throw new BadRequestException("API key expiration must be in the future");
132
- }
133
- const prefix = options.prefix ?? process.env.API_KEY_PREFIX ?? "sk";
134
- this.assertValidPrefix(prefix);
135
- const plaintextApiKey = `${prefix}${randomBytes(48).toString("base64url")}`;
136
- const entity = await this.runUnrestricted(async (em) => {
137
- const entity = em.create(this.apiKeyEntity, {
138
- enabled: true,
139
- expiresAt: options.expiresAt ?? null,
140
- key: this.hashApiKey(plaintextApiKey),
141
- name: options.name,
142
- owner,
143
- permissions,
144
- prefix,
145
- start: plaintextApiKey.slice(0, 8),
146
- });
147
- await em.persist(entity).flush();
148
- return entity;
149
- });
150
- this.logger.log("API key created", {
151
- apiKeyId: entity.id,
152
- ownerId: owner.id,
153
- ownerType: this.getOwnerType(owner),
154
- });
155
- return { apiKey: plaintextApiKey, entity };
156
- }
157
- async updateKey(apiKey, input, permissions) {
158
- if (input.expiresAt && input.expiresAt <= new Date()) {
159
- throw new BadRequestException("API key expiration must be in the future");
160
- }
161
- if (input.name !== undefined)
162
- apiKey.name = input.name;
163
- if (input.enabled !== undefined)
164
- apiKey.enabled = input.enabled;
165
- if (input.expiresAt !== undefined)
166
- apiKey.expiresAt = input.expiresAt;
167
- if (permissions !== undefined) {
168
- apiKey.permissions = permissions;
169
- }
170
- await this.runUnrestricted((em) => em.persist(apiKey).flush());
171
- return apiKey;
172
- }
173
- async deleteKey(apiKey) {
174
- await this.runUnrestricted((em) => em.remove(apiKey).flush());
175
- return apiKey;
176
- }
177
- async getOwnedApiKey(id, owner) {
178
- const apiKey = await this.findOne({ id });
179
- if (apiKey) {
180
- this.assertOwner(apiKey, owner);
181
- this.assertDelegatedApiKeyPermissionCeiling(apiKey.permissions ?? []);
182
- }
183
- return apiKey;
184
- }
185
- async findOwnedApiKey(id, owner) {
186
- const apiKey = await this.getOwnedApiKey(id, owner);
187
- if (!apiKey)
188
- throw new NotFoundException("API key not found");
189
- return apiKey;
190
- }
191
- getOwnedListFilter(owner) {
192
- const apiKey = this.getAuthenticatingApiKey();
193
- return {
194
- owner,
195
- ...(apiKey
196
- ? { permissions: { $contained: apiKey.permissions ?? [] } }
197
- : {}),
198
- };
199
- }
200
- assertWorkspacePrincipal(workspace) {
201
- this.accessControlService.assertCurrentWorkspace(workspace);
202
- const apiKey = this.getAuthenticatingApiKey();
203
- if (apiKey &&
204
- this.getOwnerType(this.unwrapOwner(apiKey)) === "workspace") {
205
- this.assertOwner(apiKey, workspace);
206
- return;
207
- }
208
- const member = RequestContext.get(BaseWorkspaceMember);
209
- if (member?.status !== "ACTIVE") {
210
- throw new ForbiddenException("An active workspace member is required");
211
- }
212
- this.accessControlService.assertCurrentWorkspaceMember(member);
213
- if (Reference.unwrapReference(member.workspace).id !== workspace.id) {
214
- throw new ForbiddenException("Workspace member does not belong to this workspace");
215
- }
216
- }
217
- assertOwner(apiKey, expectedOwner) {
218
- const owner = this.unwrapOwner(apiKey);
219
- if (this.getOwnerType(owner) !== this.getOwnerType(expectedOwner) ||
220
- owner.id !== expectedOwner.id) {
221
- throw new ForbiddenException("You are not allowed to access this API key");
222
- }
223
- }
224
- async findValidationRow(plaintextApiKey) {
225
- return await this.runUnrestricted(async () => {
226
- const entity = await this.findOne({
227
- key: this.hashApiKey(plaintextApiKey),
228
- });
229
- if (!entity)
230
- return null;
231
- const owner = this.unwrapOwner(entity);
232
- const ownerType = this.getOwnerType(owner);
233
- if (ownerType === "user") {
234
- const user = owner;
235
- if (user.banned &&
236
- (!user.banExpiresAt || user.banExpiresAt.getTime() > Date.now())) {
237
- return null;
238
- }
239
- return { apiKey: entity, ownerType, user };
240
- }
241
- if (owner.deletedAt)
242
- return null;
243
- return { apiKey: entity, ownerType, workspace: owner };
244
- });
245
- }
246
- getOwnerType(owner) {
247
- if (owner instanceof this.userEntity)
248
- return "user";
249
- if (owner instanceof this.workspaceEntity)
250
- return "workspace";
251
- throw new TypeError("Unsupported API key owner type");
252
- }
253
- unwrapOwner(apiKey) {
254
- return Reference.unwrapReference(apiKey.owner);
255
- }
256
- hashApiKey(apiKey) {
257
- return createHash("sha256").update(apiKey).digest("base64url");
258
- }
259
- assertValidPrefix(prefix) {
260
- if (prefix.length < 1 ||
261
- prefix.length > 32 ||
262
- !/^[a-z]/u.test(prefix) ||
263
- /[^a-z0-9]/u.test(prefix)) {
264
- throw new BadRequestException("API key prefix must contain 1–32 lowercase letters or digits and start with a lowercase letter");
265
- }
266
- }
267
- normalizePermissions(owner, permissions) {
268
- const ownerType = this.getOwnerType(owner);
269
- const userPermissions = this.authOptions.user?.permissions ?? DEFAULT_USER_PERMISSIONS;
270
- const workspacePermissions = this.authOptions.workspace?.permissions ?? DEFAULT_WORKSPACE_PERMISSIONS;
271
- const availablePermissions = ownerType === "user"
272
- ? [...userPermissions, ...workspacePermissions]
273
- : workspacePermissions;
274
- const normalizedPermissions = normalizeAuthPermissions(permissions, availablePermissions, ownerType === "user" ? "User API key" : "Workspace API key");
275
- this.assertPermissionCeiling(normalizedPermissions, this.authOptions.apiKey?.allowedPermissions ?? [
276
- ...userPermissions,
277
- ...workspacePermissions,
278
- ], "API key permissions exceed configured allowedPermissions");
279
- return normalizedPermissions;
280
- }
281
- normalizeCreatePermissions(owner, options) {
282
- return this.normalizePermissions(owner, options.permissions === undefined
283
- ? (this.authOptions.apiKey?.defaultPermissions ?? [])
284
- : (options.permissions ?? []));
285
- }
286
- normalizeUpdatedPermissions(apiKey, input) {
287
- return input.permissions === undefined
288
- ? undefined
289
- : this.normalizePermissions(this.unwrapOwner(apiKey), input.permissions ?? []);
290
- }
291
- assertUserPermissionCeiling(user, permissions) {
292
- const userPermissionCatalog = new Set(this.authOptions.user?.permissions ?? DEFAULT_USER_PERMISSIONS);
293
- const requestedUserPermissions = permissions.filter((permission) => userPermissionCatalog.has(permission));
294
- const effectivePermissions = resolveAuthPermissions(user.roles ?? [this.authOptions.user?.defaultRole ?? DEFAULT_USER_ROLE], user.permissions ?? [], this.authOptions.user?.roles ?? DEFAULT_USER_ROLES);
295
- this.assertPermissionCeiling(requestedUserPermissions, effectivePermissions, "User API key permissions exceed owner permissions");
296
- this.assertDelegatedApiKeyPermissionCeiling(permissions);
297
- }
298
- getAuthenticatingApiKey() {
299
- return RequestContext.isActive()
300
- ? (RequestContext.get(BaseApiKey) ?? null)
301
- : null;
302
- }
303
- assertDelegatedApiKeyPermissionCeiling(permissions) {
304
- const apiKey = this.getAuthenticatingApiKey();
305
- if (!apiKey)
306
- return;
307
- this.assertPermissionCeiling(permissions, apiKey.permissions ?? [], "API key permissions exceed authenticating API key permissions");
308
- }
309
- assertPermissionCeiling(requestedPermissions, effectivePermissions, message) {
310
- const effectivePermissionSet = new Set(effectivePermissions);
311
- const excessivePermissions = requestedPermissions.filter((permission) => !effectivePermissionSet.has(permission));
312
- if (excessivePermissions.length > 0) {
313
- throw new ForbiddenException(`${message}: ${excessivePermissions.join(", ")}`);
314
- }
315
- }
316
- get apiKeyEntity() {
317
- return this.authOptions.entities.apiKey;
318
- }
319
- get userEntity() {
320
- return this.authOptions.entities.user;
321
- }
322
- get workspaceEntity() {
323
- return this.authOptions.entities.workspace;
324
- }
325
- };
326
- ApiKeyService = ApiKeyService_1 = __decorate([
327
- Injectable(),
328
- __param(1, Inject(MODULE_OPTIONS_TOKEN)),
329
- __metadata("design:paramtypes", [EntityManager, Object, AccessControlService])
330
- ], ApiKeyService);
331
- export { ApiKeyService };
332
- //# sourceMappingURL=api-key.service.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"api-key.service.js","sourceRoot":"","sources":["../src/api-key.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAEtD,OAAO,EAEL,aAAa,EAEb,SAAS,GAEV,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,MAAM,EACN,UAAU,EACV,MAAM,EACN,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAEnE,OAAO,EACL,UAAU,EAGV,mBAAmB,GACpB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,wBAAwB,EACxB,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,wBAAwB,EACxB,sBAAsB,GACvB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,6BAA6B,EAAE,MAAM,0BAA0B,CAAC;AA6ElE,IAAM,aAAa,qBAAnB,MAAM,aAAa;IAUH;IAEF;IACA;IARF,MAAM,GAAG,IAAI,MAAM,CAAC,eAAa,CAAC,IAAI,CAAC,CAAC;IAGzD,YAEqB,EAAiB,EAEnB,WAA8B,EAC9B,oBAA0C;QAHxC,OAAE,GAAF,EAAE,CAAe;QAEnB,gBAAW,GAAX,WAAW,CAAmB;QAC9B,yBAAoB,GA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G,IAAI,CAAC,uBAAuB,EAAE,CAAC;QAC9C,IAAI,CAAC,MAAM;YAAE,OAAO;QAEpB,IAAI,CAAC,uBAAuB,CAC1B,WAAW,EACX,MAAM,CAAC,WAAW,IAAI,EAAE,EACxB,+DAA+D,CAChE,CAAC;IACJ,CAAC;IAEO,uBAAuB,CAC7B,oBAAuC,EACvC,oBAAuC,EACvC,OAAe;QAEf,MAAM,sBAAsB,GAAG,IAAI,GAAG,CAAC,oBAAoB,CAAC,CAAC;QAC7D,MAAM,oBAAoB,GAAG,oBAAoB,CAAC,MAAM,CACtD,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC,sBAAsB,CAAC,GAAG,CAAC,UAAU,CAAC,CACxD,CAAC;QACF,IAAI,oBAAoB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACpC,MAAM,IAAI,kBAAkB,CAC1B,GAAG,OAAO,KAAK,oBAAoB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CACjD,CAAC;QACJ,CAAC;IACH,CAAC;IAED,IAAY,YAAY;QACtB,OAAO,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,MAA6B,CAAC;IACjE,CAAC;IAED,IAAY,UAAU;QACpB,OAAO,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAyB,CAAC;IAC7D,CAAC;IAED,IAAY,eAAe;QACzB,OAAO,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,SAAmC,CAAC;IACvE,CAAC;CACF,CAAA;AAtdY,aAAa;IADzB,UAAU,EAAE;IAYR,WAAA,MAAM,CAAC,oBAAoB,CAAC,CAAA;qCADN,aAAa,UAGG,oBAAoB;GAblD,aAAa,CAsdzB"}
@@ -1,27 +0,0 @@
1
- import type { AuthAccessToken, AuthAccount, AuthAccountInfo, AuthAccountSelector, AuthProviderUserInfo, AuthRefreshedToken, AuthSocialProvider, AuthUser, ChangeAuthEmailOptions, ChangeAuthPasswordOptions, ChangeAuthPasswordResult, DeleteAuthUserOptions, DeleteAuthUserResult, LinkAuthSocialAccountOptions, LinkAuthSocialAccountResult, RequestPasswordResetOptions, RequestPasswordResetResult, ResetPasswordOptions, SendVerificationEmailOptions, SignInOptions, SignInResult, SignInSocialOptions, SignInSocialResult, SignUpOptions, SignUpResult, UnlinkAuthAccountOptions, UpdateAuthUserOptions } from "./interfaces/auth-service.interface.js";
2
- export declare class AuthService {
3
- constructor(auth: unknown);
4
- private readonly auth;
5
- listSocialProviders(): Promise<AuthSocialProvider[]>;
6
- signUp<User extends AuthUser = AuthUser>(options: SignUpOptions): Promise<SignUpResult<User>>;
7
- signIn<User extends AuthUser = AuthUser>(options: SignInOptions): Promise<SignInResult<User>>;
8
- signInSocial<User extends AuthUser = AuthUser>(options: SignInSocialOptions): Promise<SignInSocialResult<User>>;
9
- signOut(): Promise<boolean>;
10
- sendVerificationEmail(options: SendVerificationEmailOptions): Promise<boolean>;
11
- requestPasswordReset(options: RequestPasswordResetOptions): Promise<RequestPasswordResetResult>;
12
- resetPassword(options: ResetPasswordOptions): Promise<boolean>;
13
- verifyPassword(password: string): Promise<boolean>;
14
- updateUser(options: UpdateAuthUserOptions): Promise<boolean>;
15
- changeEmail(options: ChangeAuthEmailOptions): Promise<boolean>;
16
- changePassword(options: ChangeAuthPasswordOptions): Promise<ChangeAuthPasswordResult>;
17
- setPassword(newPassword: string): Promise<boolean>;
18
- deleteUser(options?: DeleteAuthUserOptions): Promise<DeleteAuthUserResult>;
19
- listAccounts(): Promise<AuthAccount[]>;
20
- linkSocialAccount(options: LinkAuthSocialAccountOptions): Promise<LinkAuthSocialAccountResult>;
21
- unlinkAccount(options: UnlinkAuthAccountOptions): Promise<boolean>;
22
- getAccessToken(selector: AuthAccountSelector): Promise<AuthAccessToken>;
23
- refreshToken(selector: AuthAccountSelector): Promise<AuthRefreshedToken>;
24
- accountInfo<UserInfo extends AuthProviderUserInfo = AuthProviderUserInfo, Data extends object = Record<string, unknown>>(selector: AuthAccountSelector): Promise<AuthAccountInfo<UserInfo, Data>>;
25
- private normalizeSignInResult;
26
- private normalizeSignInSocialResult;
27
- }
@@ -1,199 +0,0 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- var __metadata = (this && this.__metadata) || function (k, v) {
8
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
- };
10
- var __param = (this && this.__param) || function (paramIndex, decorator) {
11
- return function (target, key) { decorator(target, key, paramIndex); }
12
- };
13
- import { headers } from "@nest-boot/request-context";
14
- import { Inject, Injectable } from "@nestjs/common";
15
- import { AUTH_TOKEN } from "./auth.constants.js";
16
- import { applyAuthResponseCookies } from "./utils/apply-auth-response-cookies.util.js";
17
- let AuthService = class AuthService {
18
- constructor(auth) {
19
- this.auth = auth;
20
- }
21
- auth;
22
- async listSocialProviders() {
23
- const context = await this.auth.$context;
24
- return context.socialProviders.map(({ id, name }) => ({
25
- id,
26
- name,
27
- }));
28
- }
29
- async signUp(options) {
30
- const result = await this.auth.api.signUpEmail({
31
- body: options,
32
- headers: headers(),
33
- returnHeaders: true,
34
- });
35
- applyAuthResponseCookies(result.headers);
36
- return result.response;
37
- }
38
- async signIn(options) {
39
- const result = await this.auth.api.signInEmail({
40
- body: options,
41
- headers: headers(),
42
- returnHeaders: true,
43
- });
44
- applyAuthResponseCookies(result.headers);
45
- return this.normalizeSignInResult(result.response);
46
- }
47
- async signInSocial(options) {
48
- const result = await this.auth.api.signInSocial({
49
- body: options,
50
- headers: headers(),
51
- returnHeaders: true,
52
- });
53
- applyAuthResponseCookies(result.headers);
54
- return this.normalizeSignInSocialResult(result.response);
55
- }
56
- async signOut() {
57
- const result = await this.auth.api.signOut({
58
- headers: headers(),
59
- returnHeaders: true,
60
- });
61
- applyAuthResponseCookies(result.headers);
62
- return result.response.success;
63
- }
64
- async sendVerificationEmail(options) {
65
- const result = await this.auth.api.sendVerificationEmail({ body: options });
66
- return result.status;
67
- }
68
- async requestPasswordReset(options) {
69
- return await this.auth.api.requestPasswordReset({ body: options });
70
- }
71
- async resetPassword(options) {
72
- const result = await this.auth.api.resetPassword({ body: options });
73
- return result.status;
74
- }
75
- async verifyPassword(password) {
76
- const result = await this.auth.api.verifyPassword({
77
- body: { password },
78
- headers: headers(),
79
- });
80
- return result.status;
81
- }
82
- async updateUser(options) {
83
- const result = await this.auth.api.updateUser({
84
- body: options,
85
- headers: headers(),
86
- returnHeaders: true,
87
- });
88
- applyAuthResponseCookies(result.headers);
89
- return result.response.status;
90
- }
91
- async changeEmail(options) {
92
- const result = await this.auth.api.changeEmail({
93
- body: options,
94
- headers: headers(),
95
- returnHeaders: true,
96
- });
97
- applyAuthResponseCookies(result.headers);
98
- return result.response.status;
99
- }
100
- async changePassword(options) {
101
- const result = await this.auth.api.changePassword({
102
- body: options,
103
- headers: headers(),
104
- returnHeaders: true,
105
- });
106
- applyAuthResponseCookies(result.headers);
107
- return { token: result.response.token };
108
- }
109
- async setPassword(newPassword) {
110
- const result = await this.auth.api.setPassword({
111
- body: { newPassword },
112
- headers: headers(),
113
- });
114
- return result.status;
115
- }
116
- async deleteUser(options) {
117
- const result = await this.auth.api.deleteUser({
118
- body: options ?? {},
119
- headers: headers(),
120
- returnHeaders: true,
121
- });
122
- applyAuthResponseCookies(result.headers);
123
- return result.response;
124
- }
125
- async listAccounts() {
126
- return await this.auth.api.listUserAccounts({ headers: headers() });
127
- }
128
- async linkSocialAccount(options) {
129
- const result = await this.auth.api.linkSocialAccount({
130
- body: options,
131
- headers: headers(),
132
- returnHeaders: true,
133
- });
134
- applyAuthResponseCookies(result.headers);
135
- return result.response;
136
- }
137
- async unlinkAccount(options) {
138
- const result = await this.auth.api.unlinkAccount({
139
- body: options,
140
- headers: headers(),
141
- });
142
- return result.status;
143
- }
144
- async getAccessToken(selector) {
145
- const result = await this.auth.api.getAccessToken({
146
- body: selector,
147
- headers: headers(),
148
- });
149
- return {
150
- accessToken: result.accessToken,
151
- accessTokenExpiresAt: result.accessTokenExpiresAt ?? null,
152
- scopes: result.scopes,
153
- idToken: result.idToken ?? null,
154
- };
155
- }
156
- async refreshToken(selector) {
157
- const result = await this.auth.api.refreshToken({
158
- body: selector,
159
- headers: headers(),
160
- });
161
- return {
162
- accessToken: result.accessToken ?? null,
163
- refreshToken: result.refreshToken,
164
- accessTokenExpiresAt: result.accessTokenExpiresAt ?? null,
165
- refreshTokenExpiresAt: result.refreshTokenExpiresAt ?? null,
166
- scope: result.scope ?? null,
167
- idToken: result.idToken ?? null,
168
- providerId: result.providerId,
169
- accountId: result.accountId,
170
- };
171
- }
172
- async accountInfo(selector) {
173
- return (await this.auth.api.accountInfo({
174
- query: selector,
175
- headers: headers(),
176
- }));
177
- }
178
- normalizeSignInResult(result) {
179
- return {
180
- ...result,
181
- url: result.url ?? null,
182
- };
183
- }
184
- normalizeSignInSocialResult(result) {
185
- return {
186
- redirect: result.redirect,
187
- url: result.url ?? null,
188
- token: result.token ?? null,
189
- user: result.user ?? null,
190
- };
191
- }
192
- };
193
- AuthService = __decorate([
194
- Injectable(),
195
- __param(0, Inject(AUTH_TOKEN)),
196
- __metadata("design:paramtypes", [Object])
197
- ], AuthService);
198
- export { AuthService };
199
- //# sourceMappingURL=auth.service.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auth.service.js","sourceRoot":"","sources":["../src/auth.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEpD,OAAO,E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AAI;SACF,CAAC;IAC1B,CAAC;IAEO,2BAA2B,CAAwB,MAK1D;QACC,OAAO;YACL,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,GAAG,EAAE,MAAM,CAAC,GAAG,IAAI,IAAI;YACvB,KAAK,EAAE,MAAM,CAAC,KAAK,IAAI,IAAI;YAC3B,IAAI,EAAG,MAAM,CAAC,IAAyB,IAAI,IAAI;SAChD,CAAC;IACJ,CAAC;CACF,CAAA;AA9PY,WAAW;IADvB,UAAU,EAAE;IAME,WAAA,MAAM,CAAC,UAAU,CAAC,CAAA;;GALpB,WAAW,CA8PvB"}
@@ -1 +0,0 @@
1
- export declare const CurrentWorkspaceMember: (...dataOrPipes: any[]) => ParameterDecorator;
@@ -1,5 +0,0 @@
1
- import { RequestContext } from "@nest-boot/request-context";
2
- import { createParamDecorator } from "@nestjs/common";
3
- import { BaseWorkspaceMember } from "../entities/index.js";
4
- export const CurrentWorkspaceMember = createParamDecorator(() => RequestContext.get(BaseWorkspaceMember));
5
- //# sourceMappingURL=current-workspace-member.decorator.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"current-workspace-member.decorator.js","sourceRoot":"","sources":["../../src/decorators/current-workspace-member.decorator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAEtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAG3D,MAAM,CAAC,MAAM,sBAAsB,GAAG,oBAAoB,CAAC,GAAG,EAAE,CAC9D,cAAc,CAAC,GAAG,CAAC,mBAAmB,CAAC,CACxC,CAAC"}
@@ -1,17 +0,0 @@
1
- import { BaseEntity, type Opt, type Ref } from "@mikro-orm/core";
2
- import { BaseUser } from "./user.entity.js";
3
- import { BaseWorkspace } from "./workspace.entity.js";
4
- export declare class BaseApiKey extends BaseEntity {
5
- id: Opt<string>;
6
- name: string;
7
- start?: Opt<string> | null;
8
- prefix?: Opt<string> | null;
9
- key: string;
10
- enabled: Opt<boolean>;
11
- permissions: Opt<string[]>;
12
- createdAt: Opt<Date>;
13
- updatedAt: Opt<Date>;
14
- lastUsedAt?: Opt<Date> | null;
15
- expiresAt?: Opt<Date> | null;
16
- owner: Ref<BaseUser | BaseWorkspace>;
17
- }