@webiny/api-core 0.0.0-unstable.e2758ee1cf → 0.0.0-unstable.e6f0dc8ca7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ApiCoreFeature.d.ts +5 -1
- package/ApiCoreFeature.js +6 -0
- package/ApiCoreFeature.js.map +1 -1
- package/createApiCore.d.ts +1 -1
- package/createApiCore.js +2 -3
- package/createApiCore.js.map +1 -1
- package/domain/security/ApiToken.d.ts +1 -0
- package/domain/security/ApiToken.js +1 -0
- package/domain/security/ApiToken.js.map +1 -1
- package/exports/api/build-params.d.ts +1 -0
- package/exports/api/build-params.js +1 -0
- package/exports/api/build-params.js.map +1 -1
- package/exports/api/event-publisher.d.ts +1 -0
- package/exports/api/event-publisher.js +1 -0
- package/exports/api/event-publisher.js.map +1 -1
- package/exports/api/key-value-store.d.ts +1 -0
- package/exports/api/key-value-store.js +1 -0
- package/exports/api/key-value-store.js.map +1 -1
- package/exports/api/logger.d.ts +1 -0
- package/exports/api/logger.js +1 -0
- package/exports/api/logger.js.map +1 -1
- package/exports/api/security/api-key.d.ts +3 -3
- package/exports/api/security/api-key.js +3 -3
- package/exports/api/security/api-key.js.map +1 -1
- package/exports/api/security/authentication.d.ts +1 -1
- package/exports/api/security/authentication.js +1 -1
- package/exports/api/security/authentication.js.map +1 -1
- package/exports/api/security/role.d.ts +3 -3
- package/exports/api/security/role.js +3 -3
- package/exports/api/security/role.js.map +1 -1
- package/exports/api/security/user.d.ts +3 -3
- package/exports/api/security/user.js +3 -3
- package/exports/api/security/user.js.map +1 -1
- package/exports/api/security.d.ts +6 -0
- package/exports/api/security.js +5 -0
- package/exports/api/security.js.map +1 -1
- package/exports/api/system.d.ts +1 -1
- package/exports/api/system.js +1 -1
- package/exports/api/system.js.map +1 -1
- package/exports/api/tenancy.d.ts +4 -4
- package/exports/api/tenancy.js +4 -4
- package/exports/api/tenancy.js.map +1 -1
- package/exports/api.d.ts +7 -0
- package/exports/api.js +8 -0
- package/exports/api.js.map +1 -0
- package/features/ai/Ai.d.ts +26 -0
- package/features/ai/Ai.js +133 -0
- package/features/ai/Ai.js.map +1 -0
- package/features/ai/AiSdkTools.d.ts +11 -0
- package/features/ai/AiSdkTools.js +25 -0
- package/features/ai/AiSdkTools.js.map +1 -0
- package/features/ai/AnthropicSdkFactory.d.ts +10 -0
- package/features/ai/AnthropicSdkFactory.js +71 -0
- package/features/ai/AnthropicSdkFactory.js.map +1 -0
- package/features/ai/OpenAiSdkFactory.d.ts +10 -0
- package/features/ai/OpenAiSdkFactory.js +187 -0
- package/features/ai/OpenAiSdkFactory.js.map +1 -0
- package/features/ai/abstractions.d.ts +92 -0
- package/features/ai/abstractions.js +35 -0
- package/features/ai/abstractions.js.map +1 -0
- package/features/ai/feature.d.ts +4 -0
- package/features/ai/feature.js +16 -0
- package/features/ai/feature.js.map +1 -0
- package/features/ai/index.d.ts +3 -0
- package/features/ai/index.js +4 -0
- package/features/ai/index.js.map +1 -0
- package/features/buildParams/abstractions.d.ts +2 -0
- package/features/buildParams/abstractions.js +2 -0
- package/features/buildParams/abstractions.js.map +1 -1
- package/features/buildParams/feature.d.ts +5 -1
- package/features/encryption/EncryptionService.d.ts +10 -0
- package/features/encryption/EncryptionService.js +58 -0
- package/features/encryption/EncryptionService.js.map +1 -0
- package/features/encryption/abstractions.d.ts +9 -0
- package/features/encryption/abstractions.js +5 -0
- package/features/encryption/abstractions.js.map +1 -0
- package/features/encryption/feature.d.ts +4 -0
- package/features/encryption/feature.js +10 -0
- package/features/encryption/feature.js.map +1 -0
- package/features/encryption/index.d.ts +1 -0
- package/features/encryption/index.js +3 -0
- package/features/encryption/index.js.map +1 -0
- package/features/eventPublisher/abstractions.d.ts +2 -0
- package/features/eventPublisher/abstractions.js +3 -0
- package/features/eventPublisher/abstractions.js.map +1 -1
- package/features/eventPublisher/feature.d.ts +5 -1
- package/features/featureFlags/feature.d.ts +5 -1
- package/features/keyValueStore/GlobalKeyValueStore.js +3 -1
- package/features/keyValueStore/GlobalKeyValueStore.js.map +1 -1
- package/features/keyValueStore/KeyValueStoreRepository.d.ts +2 -2
- package/features/keyValueStore/KeyValueStoreRepository.js +2 -2
- package/features/keyValueStore/KeyValueStoreRepository.js.map +1 -1
- package/features/keyValueStore/abstractions.d.ts +10 -2
- package/features/keyValueStore/abstractions.js +4 -0
- package/features/keyValueStore/abstractions.js.map +1 -1
- package/features/keyValueStore/feature.d.ts +4 -1
- package/features/keyValueStore/feature.js.map +1 -1
- package/features/logger/abstractions.d.ts +1 -0
- package/features/logger/abstractions.js +1 -0
- package/features/logger/abstractions.js.map +1 -1
- package/features/logger/feature.d.ts +4 -1
- package/features/masker/Masker.d.ts +8 -0
- package/features/masker/Masker.js +21 -0
- package/features/masker/Masker.js.map +1 -0
- package/features/masker/abstractions.d.ts +11 -0
- package/features/masker/abstractions.js +4 -0
- package/features/masker/abstractions.js.map +1 -0
- package/features/masker/feature.d.ts +4 -0
- package/features/masker/feature.js +10 -0
- package/features/masker/feature.js.map +1 -0
- package/features/masker/index.d.ts +1 -0
- package/features/masker/index.js +3 -0
- package/features/masker/index.js.map +1 -0
- package/features/security/IdentityContext/abstractions.d.ts +1 -0
- package/features/security/IdentityContext/abstractions.js +1 -0
- package/features/security/IdentityContext/abstractions.js.map +1 -1
- package/features/security/IdentityContext/feature.d.ts +4 -1
- package/features/security/SecurityFeature.d.ts +5 -1
- package/features/security/apiKeys/CreateApiKey/CreateApiKeyUseCase.js +1 -1
- package/features/security/apiKeys/CreateApiKey/CreateApiKeyUseCase.js.map +1 -1
- package/features/security/apiKeys/CreateApiKey/abstractions.d.ts +1 -0
- package/features/security/apiKeys/CreateApiKey/abstractions.js +1 -0
- package/features/security/apiKeys/CreateApiKey/abstractions.js.map +1 -1
- package/features/security/apiKeys/CreateApiKey/events.d.ts +6 -4
- package/features/security/apiKeys/CreateApiKey/events.js +8 -4
- package/features/security/apiKeys/CreateApiKey/events.js.map +1 -1
- package/features/security/apiKeys/CreateApiKey/feature.d.ts +4 -1
- package/features/security/apiKeys/DeleteApiKey/abstractions.d.ts +1 -0
- package/features/security/apiKeys/DeleteApiKey/abstractions.js +1 -0
- package/features/security/apiKeys/DeleteApiKey/abstractions.js.map +1 -1
- package/features/security/apiKeys/DeleteApiKey/events.d.ts +6 -4
- package/features/security/apiKeys/DeleteApiKey/events.js +8 -4
- package/features/security/apiKeys/DeleteApiKey/events.js.map +1 -1
- package/features/security/apiKeys/DeleteApiKey/feature.d.ts +4 -1
- package/features/security/apiKeys/GetApiKey/abstractions.d.ts +1 -0
- package/features/security/apiKeys/GetApiKey/abstractions.js +1 -0
- package/features/security/apiKeys/GetApiKey/abstractions.js.map +1 -1
- package/features/security/apiKeys/GetApiKey/feature.d.ts +4 -1
- package/features/security/apiKeys/GetApiKeyBySlug/abstractions.d.ts +1 -0
- package/features/security/apiKeys/GetApiKeyBySlug/abstractions.js +1 -0
- package/features/security/apiKeys/GetApiKeyBySlug/abstractions.js.map +1 -1
- package/features/security/apiKeys/GetApiKeyBySlug/feature.d.ts +4 -1
- package/features/security/apiKeys/GetApiKeyByToken/abstractions.d.ts +1 -0
- package/features/security/apiKeys/GetApiKeyByToken/abstractions.js +1 -0
- package/features/security/apiKeys/GetApiKeyByToken/abstractions.js.map +1 -1
- package/features/security/apiKeys/GetApiKeyByToken/feature.d.ts +4 -1
- package/features/security/apiKeys/ListApiKeys/ListApiKeysUseCase.js +1 -1
- package/features/security/apiKeys/ListApiKeys/ListApiKeysUseCase.js.map +1 -1
- package/features/security/apiKeys/ListApiKeys/abstractions.d.ts +1 -0
- package/features/security/apiKeys/ListApiKeys/abstractions.js +1 -0
- package/features/security/apiKeys/ListApiKeys/abstractions.js.map +1 -1
- package/features/security/apiKeys/ListApiKeys/feature.d.ts +4 -1
- package/features/security/apiKeys/UpdateApiKey/UpdateApiKeyUseCase.js +1 -1
- package/features/security/apiKeys/UpdateApiKey/UpdateApiKeyUseCase.js.map +1 -1
- package/features/security/apiKeys/UpdateApiKey/abstractions.d.ts +1 -0
- package/features/security/apiKeys/UpdateApiKey/abstractions.js +1 -0
- package/features/security/apiKeys/UpdateApiKey/abstractions.js.map +1 -1
- package/features/security/apiKeys/UpdateApiKey/events.d.ts +6 -4
- package/features/security/apiKeys/UpdateApiKey/events.js +8 -4
- package/features/security/apiKeys/UpdateApiKey/events.js.map +1 -1
- package/features/security/apiKeys/UpdateApiKey/feature.d.ts +4 -1
- package/features/security/apiKeys/feature.d.ts +4 -1
- package/features/security/apiKeys/shared/abstractions.d.ts +5 -2
- package/features/security/apiKeys/shared/abstractions.js +3 -0
- package/features/security/apiKeys/shared/abstractions.js.map +1 -1
- package/features/security/apiKeys/shared/schemas.d.ts +10 -71
- package/features/security/apiKeys/shared/schemas.js +4 -4
- package/features/security/apiKeys/shared/schemas.js.map +1 -1
- package/features/security/authentication/AuthenticationContext/SetIdTokenCookie.d.ts +2 -2
- package/features/security/authentication/AuthenticationContext/SetIdTokenCookie.js +2 -2
- package/features/security/authentication/AuthenticationContext/SetIdTokenCookie.js.map +1 -1
- package/features/security/authentication/AuthenticationContext/abstractions.d.ts +1 -0
- package/features/security/authentication/AuthenticationContext/abstractions.js +1 -0
- package/features/security/authentication/AuthenticationContext/abstractions.js.map +1 -1
- package/features/security/authentication/AuthenticationContext/events.d.ts +6 -4
- package/features/security/authentication/AuthenticationContext/events.js +8 -4
- package/features/security/authentication/AuthenticationContext/events.js.map +1 -1
- package/features/security/authentication/AuthenticationContext/feature.d.ts +4 -1
- package/features/security/authentication/Authenticator/abstractions.d.ts +1 -0
- package/features/security/authentication/Authenticator/abstractions.js +1 -0
- package/features/security/authentication/Authenticator/abstractions.js.map +1 -1
- package/features/security/authorization/AuthorizationContext/AuthorizationContext.d.ts +1 -0
- package/features/security/authorization/AuthorizationContext/AuthorizationContext.js +14 -2
- package/features/security/authorization/AuthorizationContext/AuthorizationContext.js.map +1 -1
- package/features/security/authorization/AuthorizationContext/abstractions.d.ts +2 -0
- package/features/security/authorization/AuthorizationContext/abstractions.js +2 -0
- package/features/security/authorization/AuthorizationContext/abstractions.js.map +1 -1
- package/features/security/authorization/AuthorizationContext/feature.d.ts +4 -1
- package/features/security/authorization/Authorizer/abstractions.d.ts +1 -0
- package/features/security/authorization/Authorizer/abstractions.js +1 -0
- package/features/security/authorization/Authorizer/abstractions.js.map +1 -1
- package/features/security/authorization/GroupsTeamsAuthorizer/feature.d.ts +4 -1
- package/features/security/login/abstractions.d.ts +3 -2
- package/features/security/login/abstractions.js +4 -2
- package/features/security/login/abstractions.js.map +1 -1
- package/features/security/permissions/createPermissionSchema.d.ts +2 -0
- package/features/security/permissions/createPermissionSchema.js +8 -0
- package/features/security/permissions/createPermissionSchema.js.map +1 -0
- package/features/security/permissions/createPermissions.d.ts +5 -5
- package/features/security/permissions/createPermissions.js +198 -188
- package/features/security/permissions/createPermissions.js.map +1 -1
- package/features/security/permissions/index.d.ts +2 -1
- package/features/security/permissions/index.js +2 -1
- package/features/security/permissions/index.js.map +1 -1
- package/features/security/roles/CreateRole/CreateRoleUseCase.d.ts +1 -3
- package/features/security/roles/CreateRole/CreateRoleUseCase.js +3 -7
- package/features/security/roles/CreateRole/CreateRoleUseCase.js.map +1 -1
- package/features/security/roles/CreateRole/abstractions.d.ts +1 -0
- package/features/security/roles/CreateRole/abstractions.js +1 -0
- package/features/security/roles/CreateRole/abstractions.js.map +1 -1
- package/features/security/roles/CreateRole/events.d.ts +6 -4
- package/features/security/roles/CreateRole/events.js +8 -4
- package/features/security/roles/CreateRole/events.js.map +1 -1
- package/features/security/roles/CreateRole/feature.d.ts +4 -1
- package/features/security/roles/CreateRole/schema.d.ts +2 -20
- package/features/security/roles/CreateRole/schema.js +2 -2
- package/features/security/roles/CreateRole/schema.js.map +1 -1
- package/features/security/roles/DeleteRole/abstractions.d.ts +1 -0
- package/features/security/roles/DeleteRole/abstractions.js +1 -0
- package/features/security/roles/DeleteRole/abstractions.js.map +1 -1
- package/features/security/roles/DeleteRole/events.d.ts +6 -4
- package/features/security/roles/DeleteRole/events.js +8 -4
- package/features/security/roles/DeleteRole/events.js.map +1 -1
- package/features/security/roles/DeleteRole/feature.d.ts +4 -1
- package/features/security/roles/GetRole/abstractions.d.ts +1 -0
- package/features/security/roles/GetRole/abstractions.js +1 -0
- package/features/security/roles/GetRole/abstractions.js.map +1 -1
- package/features/security/roles/GetRole/feature.d.ts +4 -1
- package/features/security/roles/ListRoles/abstractions.d.ts +1 -0
- package/features/security/roles/ListRoles/abstractions.js +1 -0
- package/features/security/roles/ListRoles/abstractions.js.map +1 -1
- package/features/security/roles/ListRoles/feature.d.ts +4 -1
- package/features/security/roles/UpdateRole/UpdateRoleUseCase.js +1 -1
- package/features/security/roles/UpdateRole/UpdateRoleUseCase.js.map +1 -1
- package/features/security/roles/UpdateRole/abstractions.d.ts +1 -0
- package/features/security/roles/UpdateRole/abstractions.js +1 -0
- package/features/security/roles/UpdateRole/abstractions.js.map +1 -1
- package/features/security/roles/UpdateRole/events.d.ts +6 -4
- package/features/security/roles/UpdateRole/events.js +8 -4
- package/features/security/roles/UpdateRole/events.js.map +1 -1
- package/features/security/roles/UpdateRole/feature.d.ts +4 -1
- package/features/security/roles/UpdateRole/schema.d.ts +2 -18
- package/features/security/roles/UpdateRole/schema.js +2 -2
- package/features/security/roles/UpdateRole/schema.js.map +1 -1
- package/features/security/roles/feature.d.ts +4 -1
- package/features/security/roles/feature.js +2 -0
- package/features/security/roles/feature.js.map +1 -1
- package/features/security/roles/shared/RoleProvider.d.ts +13 -0
- package/features/security/roles/shared/RoleProvider.js +29 -0
- package/features/security/roles/shared/RoleProvider.js.map +1 -0
- package/features/security/roles/shared/RolesRepository.d.ts +3 -1
- package/features/security/roles/shared/RolesRepository.js +19 -18
- package/features/security/roles/shared/RolesRepository.js.map +1 -1
- package/features/security/roles/shared/abstractions.d.ts +19 -0
- package/features/security/roles/shared/abstractions.js +3 -0
- package/features/security/roles/shared/abstractions.js.map +1 -1
- package/features/security/shared/abstractions.d.ts +5 -14
- package/features/security/shared/abstractions.js +3 -16
- package/features/security/shared/abstractions.js.map +1 -1
- package/features/security/teams/CreateTeam/CreateTeamUseCase.d.ts +1 -3
- package/features/security/teams/CreateTeam/CreateTeamUseCase.js +3 -7
- package/features/security/teams/CreateTeam/CreateTeamUseCase.js.map +1 -1
- package/features/security/teams/CreateTeam/abstractions.d.ts +1 -0
- package/features/security/teams/CreateTeam/abstractions.js +1 -0
- package/features/security/teams/CreateTeam/abstractions.js.map +1 -1
- package/features/security/teams/CreateTeam/events.d.ts +6 -4
- package/features/security/teams/CreateTeam/events.js +8 -4
- package/features/security/teams/CreateTeam/events.js.map +1 -1
- package/features/security/teams/CreateTeam/feature.d.ts +4 -1
- package/features/security/teams/CreateTeam/index.d.ts +1 -1
- package/features/security/teams/CreateTeam/index.js +1 -1
- package/features/security/teams/CreateTeam/index.js.map +1 -1
- package/features/security/teams/CreateTeam/schema.d.ts +2 -12
- package/features/security/teams/DeleteTeam/abstractions.d.ts +1 -0
- package/features/security/teams/DeleteTeam/abstractions.js +1 -0
- package/features/security/teams/DeleteTeam/abstractions.js.map +1 -1
- package/features/security/teams/DeleteTeam/events.d.ts +6 -4
- package/features/security/teams/DeleteTeam/events.js +8 -4
- package/features/security/teams/DeleteTeam/events.js.map +1 -1
- package/features/security/teams/DeleteTeam/feature.d.ts +4 -1
- package/features/security/teams/GetTeam/abstractions.d.ts +1 -0
- package/features/security/teams/GetTeam/abstractions.js +1 -0
- package/features/security/teams/GetTeam/abstractions.js.map +1 -1
- package/features/security/teams/GetTeam/feature.d.ts +4 -1
- package/features/security/teams/ListTeams/abstractions.d.ts +1 -0
- package/features/security/teams/ListTeams/abstractions.js +1 -0
- package/features/security/teams/ListTeams/abstractions.js.map +1 -1
- package/features/security/teams/ListTeams/feature.d.ts +4 -1
- package/features/security/teams/UpdateTeam/UpdateTeamUseCase.js +1 -1
- package/features/security/teams/UpdateTeam/UpdateTeamUseCase.js.map +1 -1
- package/features/security/teams/UpdateTeam/abstractions.d.ts +1 -0
- package/features/security/teams/UpdateTeam/abstractions.js +1 -0
- package/features/security/teams/UpdateTeam/abstractions.js.map +1 -1
- package/features/security/teams/UpdateTeam/events.d.ts +6 -4
- package/features/security/teams/UpdateTeam/events.js +8 -4
- package/features/security/teams/UpdateTeam/events.js.map +1 -1
- package/features/security/teams/UpdateTeam/feature.d.ts +4 -1
- package/features/security/teams/UpdateTeam/schema.d.ts +2 -10
- package/features/security/teams/feature.d.ts +4 -1
- package/features/security/teams/feature.js +6 -0
- package/features/security/teams/feature.js.map +1 -1
- package/features/security/teams/shared/TeamProvider.d.ts +13 -0
- package/features/security/teams/shared/TeamProvider.js +29 -0
- package/features/security/teams/shared/TeamProvider.js.map +1 -0
- package/features/security/teams/shared/TeamsRepository.js +20 -18
- package/features/security/teams/shared/TeamsRepository.js.map +1 -1
- package/features/security/teams/shared/abstractions.d.ts +18 -0
- package/features/security/teams/shared/abstractions.js +3 -0
- package/features/security/teams/shared/abstractions.js.map +1 -1
- package/features/security/teams/shared/decorators/TeamsRepositoryCachingDecorator.d.ts +17 -0
- package/features/security/teams/shared/decorators/TeamsRepositoryCachingDecorator.js +76 -0
- package/features/security/teams/shared/decorators/TeamsRepositoryCachingDecorator.js.map +1 -0
- package/features/security/utils/verifyJwtUsingJwk.d.ts +2 -4
- package/features/security/utils/verifyJwtUsingJwk.js +1 -1
- package/features/security/utils/verifyJwtUsingJwk.js.map +1 -1
- package/features/system/InstallSystem/abstractions.d.ts +4 -5
- package/features/system/InstallSystem/abstractions.js +3 -4
- package/features/system/InstallSystem/abstractions.js.map +1 -1
- package/features/system/InstallSystem/events.js +2 -2
- package/features/system/InstallSystem/events.js.map +1 -1
- package/features/system/InstallSystem/feature.d.ts +5 -1
- package/features/system/InstallSystem/index.d.ts +1 -1
- package/features/system/InstallSystem/index.js +1 -1
- package/features/system/InstallSystem/index.js.map +1 -1
- package/features/system/SystemFeature.d.ts +4 -1
- package/features/task/TaskController/abstractions.d.ts +1 -0
- package/features/task/TaskController/abstractions.js +1 -0
- package/features/task/TaskController/abstractions.js.map +1 -1
- package/features/task/TaskDefinition/abstractions.d.ts +7 -1
- package/features/task/TaskDefinition/abstractions.js +1 -0
- package/features/task/TaskDefinition/abstractions.js.map +1 -1
- package/features/task/TaskService/abstractions.d.ts +1 -0
- package/features/task/TaskService/abstractions.js +1 -0
- package/features/task/TaskService/abstractions.js.map +1 -1
- package/features/tenancy/CreateTenant/abstractions.d.ts +9 -7
- package/features/tenancy/CreateTenant/abstractions.js +7 -5
- package/features/tenancy/CreateTenant/abstractions.js.map +1 -1
- package/features/tenancy/CreateTenant/events.js +3 -3
- package/features/tenancy/CreateTenant/events.js.map +1 -1
- package/features/tenancy/CreateTenant/feature.d.ts +5 -1
- package/features/tenancy/CreateTenant/index.d.ts +1 -1
- package/features/tenancy/CreateTenant/index.js +1 -1
- package/features/tenancy/CreateTenant/index.js.map +1 -1
- package/features/tenancy/DeleteTenant/abstractions.d.ts +9 -4
- package/features/tenancy/DeleteTenant/abstractions.js +7 -2
- package/features/tenancy/DeleteTenant/abstractions.js.map +1 -1
- package/features/tenancy/DeleteTenant/events.js +3 -3
- package/features/tenancy/DeleteTenant/events.js.map +1 -1
- package/features/tenancy/DeleteTenant/feature.d.ts +5 -1
- package/features/tenancy/DeleteTenant/index.d.ts +1 -1
- package/features/tenancy/DeleteTenant/index.js +1 -1
- package/features/tenancy/DeleteTenant/index.js.map +1 -1
- package/features/tenancy/GetRootTenant/feature.d.ts +5 -1
- package/features/tenancy/GetTenantById/abstractions.d.ts +3 -0
- package/features/tenancy/GetTenantById/abstractions.js +3 -9
- package/features/tenancy/GetTenantById/abstractions.js.map +1 -1
- package/features/tenancy/GetTenantById/feature.d.ts +5 -1
- package/features/tenancy/InstallTenant/abstractions.d.ts +5 -11
- package/features/tenancy/InstallTenant/abstractions.js +4 -13
- package/features/tenancy/InstallTenant/abstractions.js.map +1 -1
- package/features/tenancy/InstallTenant/events.js +2 -2
- package/features/tenancy/InstallTenant/events.js.map +1 -1
- package/features/tenancy/InstallTenant/feature.d.ts +5 -1
- package/features/tenancy/InstallTenant/index.d.ts +1 -1
- package/features/tenancy/InstallTenant/index.js +1 -1
- package/features/tenancy/InstallTenant/index.js.map +1 -1
- package/features/tenancy/ListTenants/feature.d.ts +5 -1
- package/features/tenancy/TenancyFeature.d.ts +4 -1
- package/features/tenancy/TenancyFeature.js.map +1 -1
- package/features/tenancy/TenantContext/abstractions.d.ts +1 -0
- package/features/tenancy/TenantContext/abstractions.js +1 -0
- package/features/tenancy/TenantContext/abstractions.js.map +1 -1
- package/features/tenancy/TenantContext/feature.d.ts +4 -1
- package/features/tenancy/UpdateTenant/abstractions.d.ts +9 -4
- package/features/tenancy/UpdateTenant/abstractions.js +7 -2
- package/features/tenancy/UpdateTenant/abstractions.js.map +1 -1
- package/features/tenancy/UpdateTenant/events.js +3 -3
- package/features/tenancy/UpdateTenant/events.js.map +1 -1
- package/features/tenancy/UpdateTenant/feature.d.ts +5 -1
- package/features/tenancy/UpdateTenant/index.d.ts +1 -1
- package/features/tenancy/UpdateTenant/index.js +1 -1
- package/features/tenancy/UpdateTenant/index.js.map +1 -1
- package/features/users/AdminUsersFeature.d.ts +4 -1
- package/features/users/AdminUsersFeature.js.map +1 -1
- package/features/users/CreateUser/CreateUserUseCase.js +1 -1
- package/features/users/CreateUser/CreateUserUseCase.js.map +1 -1
- package/features/users/CreateUser/abstractions.d.ts +1 -0
- package/features/users/CreateUser/abstractions.js +1 -1
- package/features/users/CreateUser/abstractions.js.map +1 -1
- package/features/users/CreateUser/events.d.ts +6 -4
- package/features/users/CreateUser/events.js +8 -4
- package/features/users/CreateUser/events.js.map +1 -1
- package/features/users/CreateUser/feature.d.ts +4 -1
- package/features/users/CreateUser/schema.d.ts +4 -36
- package/features/users/DeleteUser/abstractions.d.ts +1 -0
- package/features/users/DeleteUser/abstractions.js +1 -1
- package/features/users/DeleteUser/abstractions.js.map +1 -1
- package/features/users/DeleteUser/events.d.ts +6 -4
- package/features/users/DeleteUser/events.js +8 -4
- package/features/users/DeleteUser/events.js.map +1 -1
- package/features/users/DeleteUser/feature.d.ts +4 -1
- package/features/users/ExternalIdpUserSync/ExternalIdpUserSyncHandler.d.ts +3 -3
- package/features/users/ExternalIdpUserSync/ExternalIdpUserSyncHandler.js +2 -2
- package/features/users/ExternalIdpUserSync/ExternalIdpUserSyncHandler.js.map +1 -1
- package/features/users/ExternalIdpUserSync/feature.d.ts +4 -1
- package/features/users/GetIdentityProfile/feature.d.ts +4 -1
- package/features/users/GetUser/abstractions.d.ts +1 -0
- package/features/users/GetUser/abstractions.js +1 -1
- package/features/users/GetUser/abstractions.js.map +1 -1
- package/features/users/GetUser/feature.d.ts +4 -1
- package/features/users/ListUserTeams/abstractions.d.ts +1 -0
- package/features/users/ListUserTeams/abstractions.js +1 -1
- package/features/users/ListUserTeams/abstractions.js.map +1 -1
- package/features/users/ListUserTeams/feature.d.ts +4 -1
- package/features/users/ListUsers/abstractions.d.ts +1 -0
- package/features/users/ListUsers/abstractions.js +1 -1
- package/features/users/ListUsers/abstractions.js.map +1 -1
- package/features/users/ListUsers/feature.d.ts +4 -1
- package/features/users/UpdateUser/UpdateUserUseCase.js +1 -1
- package/features/users/UpdateUser/UpdateUserUseCase.js.map +1 -1
- package/features/users/UpdateUser/abstractions.d.ts +1 -0
- package/features/users/UpdateUser/abstractions.js +1 -1
- package/features/users/UpdateUser/abstractions.js.map +1 -1
- package/features/users/UpdateUser/events.d.ts +6 -4
- package/features/users/UpdateUser/events.js +8 -4
- package/features/users/UpdateUser/events.js.map +1 -1
- package/features/users/UpdateUser/feature.d.ts +4 -1
- package/features/users/UpdateUser/schema.d.ts +4 -30
- package/features/users/shared/abstractions.d.ts +1 -0
- package/features/users/shared/abstractions.js +1 -1
- package/features/users/shared/abstractions.js.map +1 -1
- package/features/wcp/WcpContext/WcpContext.d.ts +3 -0
- package/features/wcp/WcpContext/WcpContext.js +9 -0
- package/features/wcp/WcpContext/WcpContext.js.map +1 -1
- package/features/wcp/WcpContext/decorators/WcpContextWithFeatureFlagsDecorator.d.ts +15 -0
- package/features/wcp/WcpContext/decorators/WcpContextWithFeatureFlagsDecorator.js +24 -3
- package/features/wcp/WcpContext/decorators/WcpContextWithFeatureFlagsDecorator.js.map +1 -1
- package/features/wcp/WcpContext/feature.d.ts +5 -1
- package/features/wcp/WcpFeature.d.ts +4 -1
- package/features/wcp/WcpFeature.js.map +1 -1
- package/graphql/security/NotAuthorizedResponse.d.ts +1 -0
- package/graphql/security/NotAuthorizedResponse.js +1 -0
- package/graphql/security/NotAuthorizedResponse.js.map +1 -1
- package/graphql/wcp/graphql.js +1 -0
- package/graphql/wcp/graphql.js.map +1 -1
- package/idp/abstractions.d.ts +4 -0
- package/idp/abstractions.js +4 -0
- package/idp/abstractions.js.map +1 -1
- package/idp/feature.d.ts +4 -1
- package/legacy/security/createSecurityContext.js +0 -11
- package/legacy/security/createSecurityContext.js.map +1 -1
- package/legacy/security/plugins/authenticateUsingHttpHeader.d.ts +1 -1
- package/legacy/wcp/LegacyWcpContext.d.ts +3 -0
- package/legacy/wcp/LegacyWcpContext.js +9 -0
- package/legacy/wcp/LegacyWcpContext.js.map +1 -1
- package/legacy/wcp/context.d.ts +1 -3
- package/legacy/wcp/context.js +4 -2
- package/legacy/wcp/context.js.map +1 -1
- package/models/base/BaseModel.js +2 -2
- package/models/base/BaseModel.js.map +1 -1
- package/models/base/ModelBuilder.d.ts +2 -2
- package/models/base/ModelBuilder.js +21 -2
- package/models/base/ModelBuilder.js.map +1 -1
- package/models/cms/FieldBuilder.d.ts +3 -2
- package/models/cms/FieldBuilder.js +12 -17
- package/models/cms/FieldBuilder.js.map +1 -1
- package/models/cms/FieldBuilderRegistry.d.ts +1 -1
- package/models/cms/FieldBuilderRegistry.js.map +1 -1
- package/models/cms/FieldDefinitionsBuilder.d.ts +1 -0
- package/models/cms/FieldDefinitionsBuilder.js +15 -17
- package/models/cms/FieldDefinitionsBuilder.js.map +1 -1
- package/models/cms/PrivateCmsModelBuilder.js +1 -1
- package/models/cms/PrivateCmsModelBuilder.js.map +1 -1
- package/models/cms/abstractions.d.ts +1 -1
- package/models/cms/abstractions.js.map +1 -1
- package/models/cms/fieldsBuilder.md +4 -2
- package/models/simple/Page/abstractions.d.ts +1 -11
- package/package.json +27 -68
- package/types/security.d.ts +13 -10
- package/types/security.js.map +1 -1
- package/features/security/shared/abstractions.ts.bak +0 -52
- package/legacy/security/plugins/SecurityRolePlugin.d.ts +0 -16
- package/legacy/security/plugins/SecurityRolePlugin.js +0 -33
- package/legacy/security/plugins/SecurityRolePlugin.js.map +0 -1
- package/legacy/security/plugins/SecurityTeamPlugin.d.ts +0 -16
- package/legacy/security/plugins/SecurityTeamPlugin.js +0 -33
- package/legacy/security/plugins/SecurityTeamPlugin.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createAbstraction","ApiKeysRepository","ApiKeyFactory","ApiKeyProvider"],"sources":["abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport { Result } from \"@webiny/feature/api\";\nimport type { ApiKey, ListApiKeysInput } from \"./types.js\";\nimport {\n type ApiKeyNotFoundError,\n ApiKeyPersistenceError,\n ApiKeyValidationError\n} from \"./errors.js\";\n\nexport interface IApiKeysRepositoryErrors {\n base: ApiKeyNotFoundError | ApiKeyPersistenceError | ApiKeyValidationError;\n}\n\ntype RepositoryError = IApiKeysRepositoryErrors[keyof IApiKeysRepositoryErrors];\n\nexport interface IApiKeysRepository {\n get(id: string): Promise<Result<ApiKey, RepositoryError>>;\n getByToken(token: string): Promise<Result<ApiKey, RepositoryError>>;\n getBySlug(token: string): Promise<Result<ApiKey, RepositoryError>>;\n list(params: ListApiKeysInput): Promise<Result<ApiKey[], RepositoryError>>;\n create(data: ApiKey): Promise<Result<void, RepositoryError>>;\n update(data: ApiKey): Promise<Result<void, RepositoryError>>;\n delete(apiKey: ApiKey): Promise<Result<void, RepositoryError>>;\n}\n\nexport const ApiKeysRepository = createAbstraction<IApiKeysRepository>(\"ApiKeysRepository\");\n\nexport namespace ApiKeysRepository {\n export type Interface = IApiKeysRepository;\n export type Error = RepositoryError;\n}\n\nexport type CodeApiKey = Pick<ApiKey, \"name\" | \"permissions\" | \"slug\"> & {\n token: `wat_${string}`;\n};\n\nexport interface IApiKeyFactory {\n execute(): Promise<CodeApiKey[]
|
|
1
|
+
{"version":3,"names":["createAbstraction","ApiKeysRepository","ApiKeyFactory","ApiKeyProvider"],"sources":["abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport { Result } from \"@webiny/feature/api\";\nimport type { ApiKey, ListApiKeysInput } from \"./types.js\";\nimport {\n type ApiKeyNotFoundError,\n ApiKeyPersistenceError,\n ApiKeyValidationError\n} from \"./errors.js\";\n\nexport interface IApiKeysRepositoryErrors {\n base: ApiKeyNotFoundError | ApiKeyPersistenceError | ApiKeyValidationError;\n}\n\ntype RepositoryError = IApiKeysRepositoryErrors[keyof IApiKeysRepositoryErrors];\n\nexport interface IApiKeysRepository {\n get(id: string): Promise<Result<ApiKey, RepositoryError>>;\n getByToken(token: string): Promise<Result<ApiKey, RepositoryError>>;\n getBySlug(token: string): Promise<Result<ApiKey, RepositoryError>>;\n list(params: ListApiKeysInput): Promise<Result<ApiKey[], RepositoryError>>;\n create(data: ApiKey): Promise<Result<void, RepositoryError>>;\n update(data: ApiKey): Promise<Result<void, RepositoryError>>;\n delete(apiKey: ApiKey): Promise<Result<void, RepositoryError>>;\n}\n\n/** Persist and retrieve API keys. */\nexport const ApiKeysRepository = createAbstraction<IApiKeysRepository>(\"ApiKeysRepository\");\n\nexport namespace ApiKeysRepository {\n export type Interface = IApiKeysRepository;\n export type Error = RepositoryError;\n}\n\nexport type CodeApiKey = Pick<ApiKey, \"name\" | \"permissions\" | \"slug\"> & {\n token: `wat_${string}`;\n};\n\nexport interface IApiKeyFactory {\n execute(): Promise<CodeApiKey[]>;\n}\n\n/** Provide code-defined API keys. */\nexport const ApiKeyFactory = createAbstraction<IApiKeyFactory>(\"ApiKeyFactory\");\n\nexport namespace ApiKeyFactory {\n export type Interface = IApiKeyFactory;\n export type Return = Promise<CodeApiKey[]>;\n export type ApiKey = CodeApiKey;\n}\n\nexport interface IApiKeyProvider {\n getByToken(token: string): Promise<ApiKey | null>;\n getBySlug(slug: string): Promise<ApiKey | null>;\n}\n\n/** Retrieve API keys by token or slug. */\nexport const ApiKeyProvider = createAbstraction<IApiKeyProvider>(\"ApiKeyProvider\");\n\nexport namespace ApiKeyProvider {\n export type Interface = IApiKeyProvider;\n}\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,qBAAqB;AAyBvD;AACA,OAAO,MAAMC,iBAAiB,GAAGD,iBAAiB,CAAqB,mBAAmB,CAAC;AAe3F;AACA,OAAO,MAAME,aAAa,GAAGF,iBAAiB,CAAiB,eAAe,CAAC;AAa/E;AACA,OAAO,MAAMG,cAAc,GAAGH,iBAAiB,CAAkB,gBAAgB,CAAC","ignoreList":[]}
|
|
@@ -5,87 +5,26 @@ export declare const createApiKeyInputSchema: z.ZodObject<{
|
|
|
5
5
|
description: z.ZodString;
|
|
6
6
|
permissions: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
7
7
|
name: z.ZodString;
|
|
8
|
-
},
|
|
9
|
-
|
|
10
|
-
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
11
|
-
name: z.ZodString;
|
|
12
|
-
}, z.ZodTypeAny, "passthrough">>, "many">>>;
|
|
13
|
-
}, "strip", z.ZodTypeAny, {
|
|
14
|
-
permissions: z.objectOutputType<{
|
|
15
|
-
name: z.ZodString;
|
|
16
|
-
}, z.ZodTypeAny, "passthrough">[];
|
|
17
|
-
name: string;
|
|
18
|
-
description: string;
|
|
19
|
-
slug: string;
|
|
20
|
-
}, {
|
|
21
|
-
name: string;
|
|
22
|
-
description: string;
|
|
23
|
-
slug: string;
|
|
24
|
-
permissions?: z.objectInputType<{
|
|
25
|
-
name: z.ZodString;
|
|
26
|
-
}, z.ZodTypeAny, "passthrough">[] | undefined;
|
|
27
|
-
}>;
|
|
8
|
+
}, z.core.$loose>>>>;
|
|
9
|
+
}, z.core.$strip>;
|
|
28
10
|
export declare const updateApiKeyInputSchema: z.ZodObject<{
|
|
29
11
|
name: z.ZodOptional<z.ZodString>;
|
|
30
12
|
description: z.ZodOptional<z.ZodString>;
|
|
31
13
|
permissions: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
32
14
|
name: z.ZodString;
|
|
33
|
-
},
|
|
34
|
-
|
|
35
|
-
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
36
|
-
name: z.ZodString;
|
|
37
|
-
}, z.ZodTypeAny, "passthrough">>, "many">>>;
|
|
38
|
-
}, "strip", z.ZodTypeAny, {
|
|
39
|
-
permissions: z.objectOutputType<{
|
|
40
|
-
name: z.ZodString;
|
|
41
|
-
}, z.ZodTypeAny, "passthrough">[];
|
|
42
|
-
name?: string | undefined;
|
|
43
|
-
description?: string | undefined;
|
|
44
|
-
}, {
|
|
45
|
-
permissions?: z.objectInputType<{
|
|
46
|
-
name: z.ZodString;
|
|
47
|
-
}, z.ZodTypeAny, "passthrough">[] | undefined;
|
|
48
|
-
name?: string | undefined;
|
|
49
|
-
description?: string | undefined;
|
|
50
|
-
}>;
|
|
15
|
+
}, z.core.$loose>>>>;
|
|
16
|
+
}, z.core.$strip>;
|
|
51
17
|
export declare const listApiKeysInputSchema: z.ZodObject<{
|
|
52
18
|
where: z.ZodOptional<z.ZodObject<{
|
|
53
19
|
name: z.ZodOptional<z.ZodString>;
|
|
54
20
|
name_contains: z.ZodOptional<z.ZodString>;
|
|
55
21
|
description: z.ZodOptional<z.ZodString>;
|
|
56
22
|
description_contains: z.ZodOptional<z.ZodString>;
|
|
57
|
-
},
|
|
58
|
-
name?: string | undefined;
|
|
59
|
-
description?: string | undefined;
|
|
60
|
-
name_contains?: string | undefined;
|
|
61
|
-
description_contains?: string | undefined;
|
|
62
|
-
}, {
|
|
63
|
-
name?: string | undefined;
|
|
64
|
-
description?: string | undefined;
|
|
65
|
-
name_contains?: string | undefined;
|
|
66
|
-
description_contains?: string | undefined;
|
|
67
|
-
}>>;
|
|
23
|
+
}, z.core.$strip>>;
|
|
68
24
|
limit: z.ZodOptional<z.ZodNumber>;
|
|
69
25
|
after: z.ZodOptional<z.ZodString>;
|
|
70
|
-
sort: z.ZodOptional<z.ZodArray<z.ZodEnum<
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
description?: string | undefined;
|
|
76
|
-
name_contains?: string | undefined;
|
|
77
|
-
description_contains?: string | undefined;
|
|
78
|
-
} | undefined;
|
|
79
|
-
limit?: number | undefined;
|
|
80
|
-
after?: string | undefined;
|
|
81
|
-
}, {
|
|
82
|
-
sort?: ("createdOn_ASC" | "createdOn_DESC")[] | undefined;
|
|
83
|
-
where?: {
|
|
84
|
-
name?: string | undefined;
|
|
85
|
-
description?: string | undefined;
|
|
86
|
-
name_contains?: string | undefined;
|
|
87
|
-
description_contains?: string | undefined;
|
|
88
|
-
} | undefined;
|
|
89
|
-
limit?: number | undefined;
|
|
90
|
-
after?: string | undefined;
|
|
91
|
-
}>;
|
|
26
|
+
sort: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
27
|
+
createdOn_ASC: "createdOn_ASC";
|
|
28
|
+
createdOn_DESC: "createdOn_DESC";
|
|
29
|
+
}>>>;
|
|
30
|
+
}, z.core.$strip>;
|
|
@@ -3,16 +3,16 @@ export const createApiKeyInputSchema = z.object({
|
|
|
3
3
|
name: z.string().min(1),
|
|
4
4
|
slug: z.string().min(1),
|
|
5
5
|
description: z.string(),
|
|
6
|
-
permissions: z.array(z.
|
|
6
|
+
permissions: z.array(z.looseObject({
|
|
7
7
|
name: z.string()
|
|
8
|
-
})
|
|
8
|
+
})).optional().default([])
|
|
9
9
|
});
|
|
10
10
|
export const updateApiKeyInputSchema = z.object({
|
|
11
11
|
name: z.string().min(1).optional(),
|
|
12
12
|
description: z.string().optional(),
|
|
13
|
-
permissions: z.array(z.
|
|
13
|
+
permissions: z.array(z.looseObject({
|
|
14
14
|
name: z.string()
|
|
15
|
-
})
|
|
15
|
+
})).optional().default([])
|
|
16
16
|
});
|
|
17
17
|
export const listApiKeysInputSchema = z.object({
|
|
18
18
|
where: z.object({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["z","createApiKeyInputSchema","object","name","string","min","slug","description","permissions","array","
|
|
1
|
+
{"version":3,"names":["z","createApiKeyInputSchema","object","name","string","min","slug","description","permissions","array","looseObject","optional","default","updateApiKeyInputSchema","listApiKeysInputSchema","where","name_contains","description_contains","limit","number","int","positive","max","after","sort","enum"],"sources":["schemas.ts"],"sourcesContent":["import { z } from \"zod\";\n\nexport const createApiKeyInputSchema = z.object({\n name: z.string().min(1),\n slug: z.string().min(1),\n description: z.string(),\n permissions: z\n .array(z.looseObject({ name: z.string() }))\n .optional()\n .default([])\n});\n\nexport const updateApiKeyInputSchema = z.object({\n name: z.string().min(1).optional(),\n description: z.string().optional(),\n permissions: z\n .array(z.looseObject({ name: z.string() }))\n .optional()\n .default([])\n});\n\nexport const listApiKeysInputSchema = z.object({\n where: z\n .object({\n name: z.string().optional(),\n name_contains: z.string().optional(),\n description: z.string().optional(),\n description_contains: z.string().optional()\n })\n .optional(),\n limit: z.number().int().positive().max(100).optional(),\n after: z.string().optional(),\n sort: z.array(z.enum([\"createdOn_ASC\", \"createdOn_DESC\"])).optional()\n});\n"],"mappings":"AAAA,SAASA,CAAC,QAAQ,KAAK;AAEvB,OAAO,MAAMC,uBAAuB,GAAGD,CAAC,CAACE,MAAM,CAAC;EAC5CC,IAAI,EAAEH,CAAC,CAACI,MAAM,CAAC,CAAC,CAACC,GAAG,CAAC,CAAC,CAAC;EACvBC,IAAI,EAAEN,CAAC,CAACI,MAAM,CAAC,CAAC,CAACC,GAAG,CAAC,CAAC,CAAC;EACvBE,WAAW,EAAEP,CAAC,CAACI,MAAM,CAAC,CAAC;EACvBI,WAAW,EAAER,CAAC,CACTS,KAAK,CAACT,CAAC,CAACU,WAAW,CAAC;IAAEP,IAAI,EAAEH,CAAC,CAACI,MAAM,CAAC;EAAE,CAAC,CAAC,CAAC,CAC1CO,QAAQ,CAAC,CAAC,CACVC,OAAO,CAAC,EAAE;AACnB,CAAC,CAAC;AAEF,OAAO,MAAMC,uBAAuB,GAAGb,CAAC,CAACE,MAAM,CAAC;EAC5CC,IAAI,EAAEH,CAAC,CAACI,MAAM,CAAC,CAAC,CAACC,GAAG,CAAC,CAAC,CAAC,CAACM,QAAQ,CAAC,CAAC;EAClCJ,WAAW,EAAEP,CAAC,CAACI,MAAM,CAAC,CAAC,CAACO,QAAQ,CAAC,CAAC;EAClCH,WAAW,EAAER,CAAC,CACTS,KAAK,CAACT,CAAC,CAACU,WAAW,CAAC;IAAEP,IAAI,EAAEH,CAAC,CAACI,MAAM,CAAC;EAAE,CAAC,CAAC,CAAC,CAC1CO,QAAQ,CAAC,CAAC,CACVC,OAAO,CAAC,EAAE;AACnB,CAAC,CAAC;AAEF,OAAO,MAAME,sBAAsB,GAAGd,CAAC,CAACE,MAAM,CAAC;EAC3Ca,KAAK,EAAEf,CAAC,CACHE,MAAM,CAAC;IACJC,IAAI,EAAEH,CAAC,CAACI,MAAM,CAAC,CAAC,CAACO,QAAQ,CAAC,CAAC;IAC3BK,aAAa,EAAEhB,CAAC,CAACI,MAAM,CAAC,CAAC,CAACO,QAAQ,CAAC,CAAC;IACpCJ,WAAW,EAAEP,CAAC,CAACI,MAAM,CAAC,CAAC,CAACO,QAAQ,CAAC,CAAC;IAClCM,oBAAoB,EAAEjB,CAAC,CAACI,MAAM,CAAC,CAAC,CAACO,QAAQ,CAAC;EAC9C,CAAC,CAAC,CACDA,QAAQ,CAAC,CAAC;EACfO,KAAK,EAAElB,CAAC,CAACmB,MAAM,CAAC,CAAC,CAACC,GAAG,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC,CAACC,GAAG,CAAC,GAAG,CAAC,CAACX,QAAQ,CAAC,CAAC;EACtDY,KAAK,EAAEvB,CAAC,CAACI,MAAM,CAAC,CAAC,CAACO,QAAQ,CAAC,CAAC;EAC5Ba,IAAI,EAAExB,CAAC,CAACS,KAAK,CAACT,CAAC,CAACyB,IAAI,CAAC,CAAC,eAAe,EAAE,gBAAgB,CAAC,CAAC,CAAC,CAACd,QAAQ,CAAC;AACxE,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Reply } from "@webiny/handler";
|
|
2
|
-
import {
|
|
2
|
+
import { AfterAuthenticationEventHandler } from "../../../../features/security/authentication/AuthenticationContext/index.js";
|
|
3
3
|
import { AuthenticationContext } from "../../../../features/security/authentication/AuthenticationContext/index.js";
|
|
4
|
-
declare class SetIdTokenCookieImpl implements
|
|
4
|
+
declare class SetIdTokenCookieImpl implements AfterAuthenticationEventHandler.Interface {
|
|
5
5
|
private authenticationContext;
|
|
6
6
|
private reply;
|
|
7
7
|
constructor(authenticationContext: AuthenticationContext.Interface, reply: Reply.Interface);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import jwt from "jsonwebtoken";
|
|
2
2
|
import { createImplementation } from "@webiny/feature/api";
|
|
3
3
|
import { Reply } from "@webiny/handler";
|
|
4
|
-
import {
|
|
4
|
+
import { AfterAuthenticationEventHandler } from "./index.js";
|
|
5
5
|
import { AuthenticationContext } from "./index.js";
|
|
6
6
|
const get24HoursFromNow = () => {
|
|
7
7
|
const oneHour = 1000 * 60 * 60;
|
|
@@ -44,7 +44,7 @@ class SetIdTokenCookieImpl {
|
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
export const SetIdTokenCookie = createImplementation({
|
|
47
|
-
abstraction:
|
|
47
|
+
abstraction: AfterAuthenticationEventHandler,
|
|
48
48
|
implementation: SetIdTokenCookieImpl,
|
|
49
49
|
dependencies: [AuthenticationContext, Reply]
|
|
50
50
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["jwt","createImplementation","Reply","
|
|
1
|
+
{"version":3,"names":["jwt","createImplementation","Reply","AfterAuthenticationEventHandler","AuthenticationContext","get24HoursFromNow","oneHour","Date","getTime","toDate","timestamp","SetIdTokenCookieImpl","constructor","authenticationContext","reply","handle","token","getAuthToken","tokenData","decode","json","expiresOn","exp","setCookie","path","expires","sameSite","secure","httpOnly","header","SetIdTokenCookie","abstraction","implementation","dependencies"],"sources":["SetIdTokenCookie.ts"],"sourcesContent":["import jwt from \"jsonwebtoken\";\nimport { createImplementation } from \"@webiny/feature/api\";\nimport { Reply } from \"@webiny/handler\";\nimport { AfterAuthenticationEventHandler } from \"~/features/security/authentication/AuthenticationContext/index.js\";\nimport { AuthenticationContext } from \"~/features/security/authentication/AuthenticationContext/index.js\";\n\nconst get24HoursFromNow = () => {\n const oneHour = 1000 * 60 * 60;\n return new Date(new Date().getTime() + oneHour * 24);\n};\n\nconst toDate = (timestamp: number | undefined) => {\n return timestamp ? new Date(timestamp * 1000) : get24HoursFromNow();\n};\n\nclass SetIdTokenCookieImpl implements AfterAuthenticationEventHandler.Interface {\n constructor(\n private authenticationContext: AuthenticationContext.Interface,\n private reply: Reply.Interface\n ) {}\n\n async handle(): Promise<void> {\n const token = this.authenticationContext.getAuthToken();\n\n if (!token) {\n return;\n }\n\n // Attempt to acquire expiration from the token; fall back to \"expire in 24 hours\".\n // In most cases the token will be a JWT token, but it can also be a custom token, or an API key.\n const tokenData = jwt.decode(token, { json: true });\n const expiresOn = tokenData ? toDate(tokenData.exp) : get24HoursFromNow();\n\n // @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie\n this.reply.setCookie(\"wby-id-token\", token, {\n path: \"/\",\n expires: expiresOn,\n // Allow this cookie to be sent with cross-origin requests.\n sameSite: \"none\",\n // Only send this cookie to the server when HTTPS is used.\n // NOTE: `https` requirement is ignored for `localhost.\n secure: true,\n // Forbids JavaScript from accessing the cookie.\n httpOnly: true\n });\n\n this.reply.header(\"cache-control\", `no-cache=\"Set-Cookie\"`);\n }\n}\n\nexport const SetIdTokenCookie = createImplementation({\n abstraction: AfterAuthenticationEventHandler,\n implementation: SetIdTokenCookieImpl,\n dependencies: [AuthenticationContext, Reply]\n});\n"],"mappings":"AAAA,OAAOA,GAAG,MAAM,cAAc;AAC9B,SAASC,oBAAoB,QAAQ,qBAAqB;AAC1D,SAASC,KAAK,QAAQ,iBAAiB;AACvC,SAASC,+BAA+B;AACxC,SAASC,qBAAqB;AAE9B,MAAMC,iBAAiB,GAAGA,CAAA,KAAM;EAC5B,MAAMC,OAAO,GAAG,IAAI,GAAG,EAAE,GAAG,EAAE;EAC9B,OAAO,IAAIC,IAAI,CAAC,IAAIA,IAAI,CAAC,CAAC,CAACC,OAAO,CAAC,CAAC,GAAGF,OAAO,GAAG,EAAE,CAAC;AACxD,CAAC;AAED,MAAMG,MAAM,GAAIC,SAA6B,IAAK;EAC9C,OAAOA,SAAS,GAAG,IAAIH,IAAI,CAACG,SAAS,GAAG,IAAI,CAAC,GAAGL,iBAAiB,CAAC,CAAC;AACvE,CAAC;AAED,MAAMM,oBAAoB,CAAsD;EAC5EC,WAAWA,CACCC,qBAAsD,EACtDC,KAAsB,EAChC;IAAA,KAFUD,qBAAsD,GAAtDA,qBAAsD;IAAA,KACtDC,KAAsB,GAAtBA,KAAsB;EAC/B;EAEH,MAAMC,MAAMA,CAAA,EAAkB;IAC1B,MAAMC,KAAK,GAAG,IAAI,CAACH,qBAAqB,CAACI,YAAY,CAAC,CAAC;IAEvD,IAAI,CAACD,KAAK,EAAE;MACR;IACJ;;IAEA;IACA;IACA,MAAME,SAAS,GAAGlB,GAAG,CAACmB,MAAM,CAACH,KAAK,EAAE;MAAEI,IAAI,EAAE;IAAK,CAAC,CAAC;IACnD,MAAMC,SAAS,GAAGH,SAAS,GAAGT,MAAM,CAACS,SAAS,CAACI,GAAG,CAAC,GAAGjB,iBAAiB,CAAC,CAAC;;IAEzE;IACA,IAAI,CAACS,KAAK,CAACS,SAAS,CAAC,cAAc,EAAEP,KAAK,EAAE;MACxCQ,IAAI,EAAE,GAAG;MACTC,OAAO,EAAEJ,SAAS;MAClB;MACAK,QAAQ,EAAE,MAAM;MAChB;MACA;MACAC,MAAM,EAAE,IAAI;MACZ;MACAC,QAAQ,EAAE;IACd,CAAC,CAAC;IAEF,IAAI,CAACd,KAAK,CAACe,MAAM,CAAC,eAAe,EAAE,uBAAuB,CAAC;EAC/D;AACJ;AAEA,OAAO,MAAMC,gBAAgB,GAAG7B,oBAAoB,CAAC;EACjD8B,WAAW,EAAE5B,+BAA+B;EAC5C6B,cAAc,EAAErB,oBAAoB;EACpCsB,YAAY,EAAE,CAAC7B,qBAAqB,EAAEF,KAAK;AAC/C,CAAC,CAAC","ignoreList":[]}
|
|
@@ -3,6 +3,7 @@ export interface IAuthenticationContext {
|
|
|
3
3
|
authenticate(token: string): Promise<Identity>;
|
|
4
4
|
getAuthToken(): string | undefined;
|
|
5
5
|
}
|
|
6
|
+
/** Authenticate incoming requests and resolve the current identity. */
|
|
6
7
|
export declare const AuthenticationContext: import("@webiny/di").Abstraction<IAuthenticationContext>;
|
|
7
8
|
export declare namespace AuthenticationContext {
|
|
8
9
|
type Interface = IAuthenticationContext;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createAbstraction","AuthenticationContext"],"sources":["abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { Identity } from \"~/features/security/IdentityContext/Identity.js\";\n\nexport interface IAuthenticationContext {\n authenticate(token: string): Promise<Identity>;\n getAuthToken(): string | undefined;\n}\n\nexport const AuthenticationContext =\n createAbstraction<IAuthenticationContext>(\"AuthenticationContext\");\n\nexport namespace AuthenticationContext {\n export type Interface = IAuthenticationContext;\n}\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,qBAAqB;AAQvD,OAAO,MAAMC,qBAAqB,GAC9BD,iBAAiB,CAAyB,uBAAuB,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["createAbstraction","AuthenticationContext"],"sources":["abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { Identity } from \"~/features/security/IdentityContext/Identity.js\";\n\nexport interface IAuthenticationContext {\n authenticate(token: string): Promise<Identity>;\n getAuthToken(): string | undefined;\n}\n\n/** Authenticate incoming requests and resolve the current identity. */\nexport const AuthenticationContext =\n createAbstraction<IAuthenticationContext>(\"AuthenticationContext\");\n\nexport namespace AuthenticationContext {\n export type Interface = IAuthenticationContext;\n}\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,qBAAqB;AAQvD;AACA,OAAO,MAAMC,qBAAqB,GAC9BD,iBAAiB,CAAyB,uBAAuB,CAAC","ignoreList":[]}
|
|
@@ -8,8 +8,9 @@ export declare class BeforeAuthenticationEvent extends DomainEvent<BeforeAuthent
|
|
|
8
8
|
eventType: "authentication.beforeAuthentication";
|
|
9
9
|
getHandlerAbstraction(): import("@webiny/di").Abstraction<IEventHandler<BeforeAuthenticationEvent>>;
|
|
10
10
|
}
|
|
11
|
-
|
|
12
|
-
export declare
|
|
11
|
+
/** Hook into authentication lifecycle before authentication occurs. */
|
|
12
|
+
export declare const BeforeAuthenticationEventHandler: import("@webiny/di").Abstraction<IEventHandler<BeforeAuthenticationEvent>>;
|
|
13
|
+
export declare namespace BeforeAuthenticationEventHandler {
|
|
13
14
|
type Interface = IEventHandler<BeforeAuthenticationEvent>;
|
|
14
15
|
type Event = BeforeAuthenticationEvent;
|
|
15
16
|
}
|
|
@@ -21,8 +22,9 @@ export declare class AfterAuthenticationEvent extends DomainEvent<AfterAuthentic
|
|
|
21
22
|
eventType: "authentication.afterAuthentication";
|
|
22
23
|
getHandlerAbstraction(): import("@webiny/di").Abstraction<IEventHandler<AfterAuthenticationEvent>>;
|
|
23
24
|
}
|
|
24
|
-
|
|
25
|
-
export declare
|
|
25
|
+
/** Hook into authentication lifecycle after authentication occurs. */
|
|
26
|
+
export declare const AfterAuthenticationEventHandler: import("@webiny/di").Abstraction<IEventHandler<AfterAuthenticationEvent>>;
|
|
27
|
+
export declare namespace AfterAuthenticationEventHandler {
|
|
26
28
|
type Interface = IEventHandler<AfterAuthenticationEvent>;
|
|
27
29
|
type Event = AfterAuthenticationEvent;
|
|
28
30
|
}
|
|
@@ -3,16 +3,20 @@ import { createAbstraction } from "@webiny/feature/api";
|
|
|
3
3
|
export class BeforeAuthenticationEvent extends DomainEvent {
|
|
4
4
|
eventType = "authentication.beforeAuthentication";
|
|
5
5
|
getHandlerAbstraction() {
|
|
6
|
-
return
|
|
6
|
+
return BeforeAuthenticationEventHandler;
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
|
-
|
|
9
|
+
|
|
10
|
+
/** Hook into authentication lifecycle before authentication occurs. */
|
|
11
|
+
export const BeforeAuthenticationEventHandler = createAbstraction("BeforeAuthenticationEventHandler");
|
|
10
12
|
export class AfterAuthenticationEvent extends DomainEvent {
|
|
11
13
|
eventType = "authentication.afterAuthentication";
|
|
12
14
|
getHandlerAbstraction() {
|
|
13
|
-
return
|
|
15
|
+
return AfterAuthenticationEventHandler;
|
|
14
16
|
}
|
|
15
17
|
}
|
|
16
|
-
|
|
18
|
+
|
|
19
|
+
/** Hook into authentication lifecycle after authentication occurs. */
|
|
20
|
+
export const AfterAuthenticationEventHandler = createAbstraction("AfterAuthenticationEventHandler");
|
|
17
21
|
|
|
18
22
|
//# sourceMappingURL=events.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["DomainEvent","createAbstraction","BeforeAuthenticationEvent","eventType","getHandlerAbstraction","
|
|
1
|
+
{"version":3,"names":["DomainEvent","createAbstraction","BeforeAuthenticationEvent","eventType","getHandlerAbstraction","BeforeAuthenticationEventHandler","AfterAuthenticationEvent","AfterAuthenticationEventHandler"],"sources":["events.ts"],"sourcesContent":["import { DomainEvent } from \"~/features/eventPublisher/index.js\";\nimport { createAbstraction } from \"@webiny/feature/api\";\nimport type { IEventHandler } from \"~/features/eventPublisher/index.js\";\nimport type { Identity } from \"~/features/security/IdentityContext/Identity.js\";\n\nexport interface BeforeAuthenticationPayload {\n token: string;\n}\n\nexport class BeforeAuthenticationEvent extends DomainEvent<BeforeAuthenticationPayload> {\n eventType = \"authentication.beforeAuthentication\" as const;\n\n getHandlerAbstraction() {\n return BeforeAuthenticationEventHandler;\n }\n}\n\n/** Hook into authentication lifecycle before authentication occurs. */\nexport const BeforeAuthenticationEventHandler = createAbstraction<\n IEventHandler<BeforeAuthenticationEvent>\n>(\"BeforeAuthenticationEventHandler\");\n\nexport namespace BeforeAuthenticationEventHandler {\n export type Interface = IEventHandler<BeforeAuthenticationEvent>;\n export type Event = BeforeAuthenticationEvent;\n}\n\nexport interface AfterAuthenticationPayload {\n identity: Identity;\n token: string;\n}\n\nexport class AfterAuthenticationEvent extends DomainEvent<AfterAuthenticationPayload> {\n eventType = \"authentication.afterAuthentication\" as const;\n\n getHandlerAbstraction() {\n return AfterAuthenticationEventHandler;\n }\n}\n\n/** Hook into authentication lifecycle after authentication occurs. */\nexport const AfterAuthenticationEventHandler = createAbstraction<\n IEventHandler<AfterAuthenticationEvent>\n>(\"AfterAuthenticationEventHandler\");\n\nexport namespace AfterAuthenticationEventHandler {\n export type Interface = IEventHandler<AfterAuthenticationEvent>;\n export type Event = AfterAuthenticationEvent;\n}\n"],"mappings":"AAAA,SAASA,WAAW;AACpB,SAASC,iBAAiB,QAAQ,qBAAqB;AAQvD,OAAO,MAAMC,yBAAyB,SAASF,WAAW,CAA8B;EACpFG,SAAS,GAAG,qCAAqC;EAEjDC,qBAAqBA,CAAA,EAAG;IACpB,OAAOC,gCAAgC;EAC3C;AACJ;;AAEA;AACA,OAAO,MAAMA,gCAAgC,GAAGJ,iBAAiB,CAE/D,kCAAkC,CAAC;AAYrC,OAAO,MAAMK,wBAAwB,SAASN,WAAW,CAA6B;EAClFG,SAAS,GAAG,oCAAoC;EAEhDC,qBAAqBA,CAAA,EAAG;IACpB,OAAOG,+BAA+B;EAC1C;AACJ;;AAEA;AACA,OAAO,MAAMA,+BAA+B,GAAGN,iBAAiB,CAE9D,iCAAiC,CAAC","ignoreList":[]}
|
|
@@ -2,6 +2,7 @@ import type { IdentityData } from "../../../../features/security/IdentityContext
|
|
|
2
2
|
export interface IAuthenticator {
|
|
3
3
|
authenticate(token: string): Promise<IdentityData | null>;
|
|
4
4
|
}
|
|
5
|
+
/** Convert an authentication token into identity data. */
|
|
5
6
|
export declare const Authenticator: import("@webiny/di").Abstraction<IAuthenticator>;
|
|
6
7
|
export declare namespace Authenticator {
|
|
7
8
|
type Interface = IAuthenticator;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createAbstraction","Authenticator"],"sources":["abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { IdentityData } from \"~/features/security/IdentityContext/Identity.js\";\n\nexport interface IAuthenticator {\n authenticate(token: string): Promise<IdentityData | null>;\n}\n\nexport const Authenticator = createAbstraction<IAuthenticator>(\"Authenticator\");\n\nexport namespace Authenticator {\n export type Interface = IAuthenticator;\n}\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,qBAAqB;AAOvD,OAAO,MAAMC,aAAa,GAAGD,iBAAiB,CAAiB,eAAe,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["createAbstraction","Authenticator"],"sources":["abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { IdentityData } from \"~/features/security/IdentityContext/Identity.js\";\n\nexport interface IAuthenticator {\n authenticate(token: string): Promise<IdentityData | null>;\n}\n\n/** Convert an authentication token into identity data. */\nexport const Authenticator = createAbstraction<IAuthenticator>(\"Authenticator\");\n\nexport namespace Authenticator {\n export type Interface = IAuthenticator;\n}\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,qBAAqB;AAOvD;AACA,OAAO,MAAMC,aAAa,GAAGD,iBAAiB,CAAiB,eAAe,CAAC","ignoreList":[]}
|
|
@@ -43,12 +43,24 @@ export class AuthorizationContext {
|
|
|
43
43
|
transformPermissions(permissions) {
|
|
44
44
|
const transformers = this.getTransformers();
|
|
45
45
|
if (transformers.length === 0) {
|
|
46
|
-
return permissions;
|
|
46
|
+
return this.deduplicatePermissions(permissions);
|
|
47
47
|
}
|
|
48
|
-
|
|
48
|
+
const transformed = permissions.map(permission => {
|
|
49
49
|
// A transformer can return one or multiple permissions, so we flatten the result.
|
|
50
50
|
return transformers.map(t => t.execute(permission)).flat();
|
|
51
51
|
}).flat();
|
|
52
|
+
return this.deduplicatePermissions(transformed);
|
|
53
|
+
}
|
|
54
|
+
deduplicatePermissions(permissions) {
|
|
55
|
+
const seen = new Set();
|
|
56
|
+
return permissions.filter(permission => {
|
|
57
|
+
const key = JSON.stringify(permission);
|
|
58
|
+
if (seen.has(key)) {
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
seen.add(key);
|
|
62
|
+
return true;
|
|
63
|
+
});
|
|
52
64
|
}
|
|
53
65
|
}
|
|
54
66
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["AsyncLocalStorage","authorizationEnabledStorage","AuthorizationContext","constructor","getAuthorizers","getTransformers","loadPermissions","identity","permissions","permissionsLoader","Promise","resolve","authorizers","authorizer","authorize","Array","isArray","transformPermissions","isAuthorizationEnabled","override","getStore","withoutAuthorization","cb","run","clearPermissionsCache","undefined","transformers","length","map","permission","t","execute","flat"],"sources":["AuthorizationContext.ts"],"sourcesContent":["import { AsyncLocalStorage } from \"async_hooks\";\nimport { AuthorizationContext as Abstraction, PermissionTransformer } from \"./abstractions.js\";\nimport { Authorizer } from \"../Authorizer/index.js\";\nimport type { SecurityPermission } from \"~/types/security.js\";\nimport { Identity } from \"~/features/security/IdentityContext/index.js\";\n\nconst authorizationEnabledStorage = new AsyncLocalStorage<boolean>();\n\nexport class AuthorizationContext implements Abstraction.Interface {\n private permissions?: SecurityPermission[];\n private permissionsLoader?: Promise<SecurityPermission[]>;\n\n constructor(\n private getAuthorizers: () => Authorizer.Interface[],\n private getTransformers: () => PermissionTransformer.Interface[]\n ) {}\n\n async loadPermissions(identity: Identity): Promise<SecurityPermission[]> {\n if (this.permissions) {\n return this.permissions;\n }\n\n if (this.permissionsLoader) {\n return this.permissionsLoader;\n }\n\n this.permissionsLoader = new Promise<SecurityPermission[]>(async resolve => {\n // Execute authorizers in sequence until one returns permissions\n const authorizers = this.getAuthorizers();\n for (const authorizer of authorizers) {\n const permissions = await authorizer.authorize(identity);\n if (Array.isArray(permissions)) {\n this.permissions = this.transformPermissions(permissions);\n return resolve(this.permissions);\n }\n }\n\n // No authorizer returned permissions\n this.permissions = [];\n resolve(this.permissions);\n });\n\n return this.permissionsLoader;\n }\n\n isAuthorizationEnabled(): boolean {\n const override = authorizationEnabledStorage.getStore();\n return override ?? true;\n }\n\n withoutAuthorization<T>(cb: () => Promise<T>): Promise<T> {\n return authorizationEnabledStorage.run(false, cb);\n }\n\n clearPermissionsCache(): void {\n this.permissions = undefined;\n this.permissionsLoader = undefined;\n }\n\n private transformPermissions(permissions: SecurityPermission[]) {\n const transformers = this.getTransformers();\n if (transformers.length === 0) {\n return permissions;\n }\n\n
|
|
1
|
+
{"version":3,"names":["AsyncLocalStorage","authorizationEnabledStorage","AuthorizationContext","constructor","getAuthorizers","getTransformers","loadPermissions","identity","permissions","permissionsLoader","Promise","resolve","authorizers","authorizer","authorize","Array","isArray","transformPermissions","isAuthorizationEnabled","override","getStore","withoutAuthorization","cb","run","clearPermissionsCache","undefined","transformers","length","deduplicatePermissions","transformed","map","permission","t","execute","flat","seen","Set","filter","key","JSON","stringify","has","add"],"sources":["AuthorizationContext.ts"],"sourcesContent":["import { AsyncLocalStorage } from \"async_hooks\";\nimport { AuthorizationContext as Abstraction, PermissionTransformer } from \"./abstractions.js\";\nimport { Authorizer } from \"../Authorizer/index.js\";\nimport type { SecurityPermission } from \"~/types/security.js\";\nimport { Identity } from \"~/features/security/IdentityContext/index.js\";\n\nconst authorizationEnabledStorage = new AsyncLocalStorage<boolean>();\n\nexport class AuthorizationContext implements Abstraction.Interface {\n private permissions?: SecurityPermission[];\n private permissionsLoader?: Promise<SecurityPermission[]>;\n\n constructor(\n private getAuthorizers: () => Authorizer.Interface[],\n private getTransformers: () => PermissionTransformer.Interface[]\n ) {}\n\n async loadPermissions(identity: Identity): Promise<SecurityPermission[]> {\n if (this.permissions) {\n return this.permissions;\n }\n\n if (this.permissionsLoader) {\n return this.permissionsLoader;\n }\n\n this.permissionsLoader = new Promise<SecurityPermission[]>(async resolve => {\n // Execute authorizers in sequence until one returns permissions\n const authorizers = this.getAuthorizers();\n for (const authorizer of authorizers) {\n const permissions = await authorizer.authorize(identity);\n if (Array.isArray(permissions)) {\n this.permissions = this.transformPermissions(permissions);\n return resolve(this.permissions);\n }\n }\n\n // No authorizer returned permissions\n this.permissions = [];\n resolve(this.permissions);\n });\n\n return this.permissionsLoader;\n }\n\n isAuthorizationEnabled(): boolean {\n const override = authorizationEnabledStorage.getStore();\n return override ?? true;\n }\n\n withoutAuthorization<T>(cb: () => Promise<T>): Promise<T> {\n return authorizationEnabledStorage.run(false, cb);\n }\n\n clearPermissionsCache(): void {\n this.permissions = undefined;\n this.permissionsLoader = undefined;\n }\n\n private transformPermissions(permissions: SecurityPermission[]) {\n const transformers = this.getTransformers();\n if (transformers.length === 0) {\n return this.deduplicatePermissions(permissions);\n }\n\n const transformed = permissions\n .map(permission => {\n // A transformer can return one or multiple permissions, so we flatten the result.\n return transformers.map(t => t.execute(permission)).flat();\n })\n .flat();\n\n return this.deduplicatePermissions(transformed);\n }\n\n private deduplicatePermissions(permissions: SecurityPermission[]) {\n const seen = new Set<string>();\n\n return permissions.filter(permission => {\n const key = JSON.stringify(permission);\n if (seen.has(key)) {\n return false;\n }\n seen.add(key);\n return true;\n });\n }\n}\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,aAAa;AAM/C,MAAMC,2BAA2B,GAAG,IAAID,iBAAiB,CAAU,CAAC;AAEpE,OAAO,MAAME,oBAAoB,CAAkC;EAI/DC,WAAWA,CACCC,cAA4C,EAC5CC,eAAwD,EAClE;IAAA,KAFUD,cAA4C,GAA5CA,cAA4C;IAAA,KAC5CC,eAAwD,GAAxDA,eAAwD;EACjE;EAEH,MAAMC,eAAeA,CAACC,QAAkB,EAAiC;IACrE,IAAI,IAAI,CAACC,WAAW,EAAE;MAClB,OAAO,IAAI,CAACA,WAAW;IAC3B;IAEA,IAAI,IAAI,CAACC,iBAAiB,EAAE;MACxB,OAAO,IAAI,CAACA,iBAAiB;IACjC;IAEA,IAAI,CAACA,iBAAiB,GAAG,IAAIC,OAAO,CAAuB,MAAMC,OAAO,IAAI;MACxE;MACA,MAAMC,WAAW,GAAG,IAAI,CAACR,cAAc,CAAC,CAAC;MACzC,KAAK,MAAMS,UAAU,IAAID,WAAW,EAAE;QAClC,MAAMJ,WAAW,GAAG,MAAMK,UAAU,CAACC,SAAS,CAACP,QAAQ,CAAC;QACxD,IAAIQ,KAAK,CAACC,OAAO,CAACR,WAAW,CAAC,EAAE;UAC5B,IAAI,CAACA,WAAW,GAAG,IAAI,CAACS,oBAAoB,CAACT,WAAW,CAAC;UACzD,OAAOG,OAAO,CAAC,IAAI,CAACH,WAAW,CAAC;QACpC;MACJ;;MAEA;MACA,IAAI,CAACA,WAAW,GAAG,EAAE;MACrBG,OAAO,CAAC,IAAI,CAACH,WAAW,CAAC;IAC7B,CAAC,CAAC;IAEF,OAAO,IAAI,CAACC,iBAAiB;EACjC;EAEAS,sBAAsBA,CAAA,EAAY;IAC9B,MAAMC,QAAQ,GAAGlB,2BAA2B,CAACmB,QAAQ,CAAC,CAAC;IACvD,OAAOD,QAAQ,IAAI,IAAI;EAC3B;EAEAE,oBAAoBA,CAAIC,EAAoB,EAAc;IACtD,OAAOrB,2BAA2B,CAACsB,GAAG,CAAC,KAAK,EAAED,EAAE,CAAC;EACrD;EAEAE,qBAAqBA,CAAA,EAAS;IAC1B,IAAI,CAAChB,WAAW,GAAGiB,SAAS;IAC5B,IAAI,CAAChB,iBAAiB,GAAGgB,SAAS;EACtC;EAEQR,oBAAoBA,CAACT,WAAiC,EAAE;IAC5D,MAAMkB,YAAY,GAAG,IAAI,CAACrB,eAAe,CAAC,CAAC;IAC3C,IAAIqB,YAAY,CAACC,MAAM,KAAK,CAAC,EAAE;MAC3B,OAAO,IAAI,CAACC,sBAAsB,CAACpB,WAAW,CAAC;IACnD;IAEA,MAAMqB,WAAW,GAAGrB,WAAW,CAC1BsB,GAAG,CAACC,UAAU,IAAI;MACf;MACA,OAAOL,YAAY,CAACI,GAAG,CAACE,CAAC,IAAIA,CAAC,CAACC,OAAO,CAACF,UAAU,CAAC,CAAC,CAACG,IAAI,CAAC,CAAC;IAC9D,CAAC,CAAC,CACDA,IAAI,CAAC,CAAC;IAEX,OAAO,IAAI,CAACN,sBAAsB,CAACC,WAAW,CAAC;EACnD;EAEQD,sBAAsBA,CAACpB,WAAiC,EAAE;IAC9D,MAAM2B,IAAI,GAAG,IAAIC,GAAG,CAAS,CAAC;IAE9B,OAAO5B,WAAW,CAAC6B,MAAM,CAACN,UAAU,IAAI;MACpC,MAAMO,GAAG,GAAGC,IAAI,CAACC,SAAS,CAACT,UAAU,CAAC;MACtC,IAAII,IAAI,CAACM,GAAG,CAACH,GAAG,CAAC,EAAE;QACf,OAAO,KAAK;MAChB;MACAH,IAAI,CAACO,GAAG,CAACJ,GAAG,CAAC;MACb,OAAO,IAAI;IACf,CAAC,CAAC;EACN;AACJ","ignoreList":[]}
|
|
@@ -6,6 +6,7 @@ export interface IAuthorizationContext {
|
|
|
6
6
|
withoutAuthorization<T>(cb: () => Promise<T>): Promise<T>;
|
|
7
7
|
clearPermissionsCache(): void;
|
|
8
8
|
}
|
|
9
|
+
/** Load and cache security permissions for the current identity. */
|
|
9
10
|
export declare const AuthorizationContext: import("@webiny/di").Abstraction<IAuthorizationContext>;
|
|
10
11
|
export declare namespace AuthorizationContext {
|
|
11
12
|
type Interface = IAuthorizationContext;
|
|
@@ -13,6 +14,7 @@ export declare namespace AuthorizationContext {
|
|
|
13
14
|
export interface IPermissionTransformer {
|
|
14
15
|
execute(permission: SecurityPermission): SecurityPermission | SecurityPermission[];
|
|
15
16
|
}
|
|
17
|
+
/** Transform security permissions before they are applied. */
|
|
16
18
|
export declare const PermissionTransformer: import("@webiny/di").Abstraction<IPermissionTransformer>;
|
|
17
19
|
export declare namespace PermissionTransformer {
|
|
18
20
|
type Interface = IPermissionTransformer;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { createAbstraction } from "@webiny/feature/api";
|
|
2
|
+
/** Load and cache security permissions for the current identity. */
|
|
2
3
|
export const AuthorizationContext = createAbstraction("AuthorizationContext");
|
|
4
|
+
/** Transform security permissions before they are applied. */
|
|
3
5
|
export const PermissionTransformer = createAbstraction("PermissionTransformer");
|
|
4
6
|
|
|
5
7
|
//# sourceMappingURL=abstractions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createAbstraction","AuthorizationContext","PermissionTransformer"],"sources":["abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { SecurityPermission } from \"~/types/security.js\";\nimport { Identity } from \"~/features/security/IdentityContext/index.js\";\n\nexport interface IAuthorizationContext {\n loadPermissions(identity: Identity): Promise<SecurityPermission[]>;\n isAuthorizationEnabled(): boolean;\n withoutAuthorization<T>(cb: () => Promise<T>): Promise<T>;\n clearPermissionsCache(): void;\n}\n\nexport const AuthorizationContext =\n createAbstraction<IAuthorizationContext>(\"AuthorizationContext\");\n\nexport namespace AuthorizationContext {\n export type Interface = IAuthorizationContext;\n}\n\nexport interface IPermissionTransformer {\n execute(permission: SecurityPermission): SecurityPermission | SecurityPermission[];\n}\n\nexport const PermissionTransformer =\n createAbstraction<IPermissionTransformer>(\"PermissionTransformer\");\n\nexport namespace PermissionTransformer {\n export type Interface = IPermissionTransformer;\n export type Permission = SecurityPermission;\n export type Return = SecurityPermission | SecurityPermission[];\n}\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,qBAAqB;AAWvD,OAAO,MAAMC,oBAAoB,GAC7BD,iBAAiB,CAAwB,sBAAsB,CAAC;AAUpE,OAAO,MAAME,qBAAqB,GAC9BF,iBAAiB,CAAyB,uBAAuB,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["createAbstraction","AuthorizationContext","PermissionTransformer"],"sources":["abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { SecurityPermission } from \"~/types/security.js\";\nimport { Identity } from \"~/features/security/IdentityContext/index.js\";\n\nexport interface IAuthorizationContext {\n loadPermissions(identity: Identity): Promise<SecurityPermission[]>;\n isAuthorizationEnabled(): boolean;\n withoutAuthorization<T>(cb: () => Promise<T>): Promise<T>;\n clearPermissionsCache(): void;\n}\n\n/** Load and cache security permissions for the current identity. */\nexport const AuthorizationContext =\n createAbstraction<IAuthorizationContext>(\"AuthorizationContext\");\n\nexport namespace AuthorizationContext {\n export type Interface = IAuthorizationContext;\n}\n\nexport interface IPermissionTransformer {\n execute(permission: SecurityPermission): SecurityPermission | SecurityPermission[];\n}\n\n/** Transform security permissions before they are applied. */\nexport const PermissionTransformer =\n createAbstraction<IPermissionTransformer>(\"PermissionTransformer\");\n\nexport namespace PermissionTransformer {\n export type Interface = IPermissionTransformer;\n export type Permission = SecurityPermission;\n export type Return = SecurityPermission | SecurityPermission[];\n}\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,qBAAqB;AAWvD;AACA,OAAO,MAAMC,oBAAoB,GAC7BD,iBAAiB,CAAwB,sBAAsB,CAAC;AAUpE;AACA,OAAO,MAAME,qBAAqB,GAC9BF,iBAAiB,CAAyB,uBAAuB,CAAC","ignoreList":[]}
|
|
@@ -3,6 +3,7 @@ import { Identity } from "../../../../features/security/IdentityContext/index.js
|
|
|
3
3
|
export interface IAuthorizer {
|
|
4
4
|
authorize(identity: Identity): Promise<SecurityPermission[] | null>;
|
|
5
5
|
}
|
|
6
|
+
/** Retrieve permissions for an identity. */
|
|
6
7
|
export declare const Authorizer: import("@webiny/di").Abstraction<IAuthorizer>;
|
|
7
8
|
export declare namespace Authorizer {
|
|
8
9
|
type Interface = IAuthorizer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createAbstraction","Authorizer"],"sources":["abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { SecurityPermission } from \"~/types/security.js\";\nimport { Identity } from \"~/features/security/IdentityContext/index.js\";\n\nexport interface IAuthorizer {\n authorize(identity: Identity): Promise<SecurityPermission[] | null>;\n}\n\nexport const Authorizer = createAbstraction<IAuthorizer>(\"Authorizer\");\n\nexport namespace Authorizer {\n export type Interface = IAuthorizer;\n}\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,qBAAqB;AAQvD,OAAO,MAAMC,UAAU,GAAGD,iBAAiB,CAAc,YAAY,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["createAbstraction","Authorizer"],"sources":["abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { SecurityPermission } from \"~/types/security.js\";\nimport { Identity } from \"~/features/security/IdentityContext/index.js\";\n\nexport interface IAuthorizer {\n authorize(identity: Identity): Promise<SecurityPermission[] | null>;\n}\n\n/** Retrieve permissions for an identity. */\nexport const Authorizer = createAbstraction<IAuthorizer>(\"Authorizer\");\n\nexport namespace Authorizer {\n export type Interface = IAuthorizer;\n}\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,qBAAqB;AAQvD;AACA,OAAO,MAAMC,UAAU,GAAGD,iBAAiB,CAAc,YAAY,CAAC","ignoreList":[]}
|
|
@@ -8,8 +8,9 @@ export declare class AfterLoginEvent extends DomainEvent<AfterLoginPayload> {
|
|
|
8
8
|
eventType: "login.afterLogin";
|
|
9
9
|
getHandlerAbstraction(): import("@webiny/di").Abstraction<IEventHandler<AfterLoginEvent>>;
|
|
10
10
|
}
|
|
11
|
-
|
|
12
|
-
export declare
|
|
11
|
+
/** Hook into login lifecycle after a user logs in. */
|
|
12
|
+
export declare const AfterLoginEventHandler: import("@webiny/di").Abstraction<IEventHandler<AfterLoginEvent>>;
|
|
13
|
+
export declare namespace AfterLoginEventHandler {
|
|
13
14
|
type Interface = IEventHandler<AfterLoginEvent>;
|
|
14
15
|
type Event = AfterLoginEvent;
|
|
15
16
|
}
|
|
@@ -3,9 +3,11 @@ import { createAbstraction } from "@webiny/feature/api";
|
|
|
3
3
|
export class AfterLoginEvent extends DomainEvent {
|
|
4
4
|
eventType = "login.afterLogin";
|
|
5
5
|
getHandlerAbstraction() {
|
|
6
|
-
return
|
|
6
|
+
return AfterLoginEventHandler;
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
|
-
|
|
9
|
+
|
|
10
|
+
/** Hook into login lifecycle after a user logs in. */
|
|
11
|
+
export const AfterLoginEventHandler = createAbstraction("AfterLoginEventHandler");
|
|
10
12
|
|
|
11
13
|
//# sourceMappingURL=abstractions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["DomainEvent","createAbstraction","AfterLoginEvent","eventType","getHandlerAbstraction","
|
|
1
|
+
{"version":3,"names":["DomainEvent","createAbstraction","AfterLoginEvent","eventType","getHandlerAbstraction","AfterLoginEventHandler"],"sources":["abstractions.ts"],"sourcesContent":["import { DomainEvent } from \"~/features/eventPublisher/index.js\";\nimport type { IEventHandler } from \"~/features/eventPublisher/index.js\";\nimport { createAbstraction } from \"@webiny/feature/api\";\nimport { Identity } from \"~/features/security/IdentityContext/index.js\";\n\nexport interface AfterLoginPayload {\n identity: Identity;\n}\n\nexport class AfterLoginEvent extends DomainEvent<AfterLoginPayload> {\n eventType = \"login.afterLogin\" as const;\n\n getHandlerAbstraction() {\n return AfterLoginEventHandler;\n }\n}\n\n/** Hook into login lifecycle after a user logs in. */\nexport const AfterLoginEventHandler =\n createAbstraction<IEventHandler<AfterLoginEvent>>(\"AfterLoginEventHandler\");\n\nexport namespace AfterLoginEventHandler {\n export type Interface = IEventHandler<AfterLoginEvent>;\n export type Event = AfterLoginEvent;\n}\n"],"mappings":"AAAA,SAASA,WAAW;AAEpB,SAASC,iBAAiB,QAAQ,qBAAqB;AAOvD,OAAO,MAAMC,eAAe,SAASF,WAAW,CAAoB;EAChEG,SAAS,GAAG,kBAAkB;EAE9BC,qBAAqBA,CAAA,EAAG;IACpB,OAAOC,sBAAsB;EACjC;AACJ;;AAEA;AACA,OAAO,MAAMA,sBAAsB,GAC/BJ,iBAAiB,CAAiC,wBAAwB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createPermissionSchema","config","entities"],"sources":["createPermissionSchema.ts"],"sourcesContent":["import type { PermissionSchemaConfig } from \"./types.js\";\n\nexport function createPermissionSchema<const T extends PermissionSchemaConfig>(config: T): T {\n return {\n ...config,\n entities: config.entities ?? []\n };\n}\n"],"mappings":"AAEA,OAAO,SAASA,sBAAsBA,CAAyCC,MAAS,EAAK;EACzF,OAAO;IACH,GAAGA,MAAM;IACTC,QAAQ,EAAED,MAAM,CAACC,QAAQ,IAAI;EACjC,CAAC;AACL","ignoreList":[]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import type { Abstraction } from "@webiny/di";
|
|
1
2
|
import type { PermissionSchemaConfig } from "./types.js";
|
|
2
3
|
import type { Permissions } from "./types.js";
|
|
3
|
-
export declare function
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
};
|
|
4
|
+
export declare function createPermissionsAbstraction<const S extends PermissionSchemaConfig>(schema: S): Abstraction<Permissions<S>>;
|
|
5
|
+
export declare function createPermissionsFeature<const S extends PermissionSchemaConfig>(schema: S, abstraction: Abstraction<Permissions<S>>): {
|
|
6
|
+
name: string;
|
|
7
|
+
register(container: import("@webiny/di").Container): void;
|
|
8
8
|
};
|