@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
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import crypto from "node:crypto";
|
|
2
|
+
import { createImplementation } from "@webiny/feature/api";
|
|
3
|
+
import { Encryption as EncryptionAbstraction } from "./abstractions.js";
|
|
4
|
+
import { BuildParams } from "../buildParams/abstractions.js";
|
|
5
|
+
const DEFAULT_ALGORITHM = "aes-256-gcm";
|
|
6
|
+
function keyLengthForAlgorithm(algorithm) {
|
|
7
|
+
// Parse key size in bits from algorithm name (e.g. "aes-256-gcm" → 32 bytes).
|
|
8
|
+
const bits = parseInt(algorithm.split("-")[1]);
|
|
9
|
+
if (isNaN(bits)) {
|
|
10
|
+
throw new Error(`Cannot determine key length from algorithm "${algorithm}".`);
|
|
11
|
+
}
|
|
12
|
+
return bits / 8;
|
|
13
|
+
}
|
|
14
|
+
export class EncryptionImpl {
|
|
15
|
+
constructor(buildParams) {
|
|
16
|
+
const passphrase = buildParams.get("EncryptionPassphrase");
|
|
17
|
+
if (passphrase) {
|
|
18
|
+
// Salt is optional. It ensures two projects using the same passphrase derive different keys,
|
|
19
|
+
// but since passphrases should be unique per project anyway, it's extra insurance rather than a necessity.
|
|
20
|
+
const salt = buildParams.get("EncryptionSalt") ?? "";
|
|
21
|
+
this.algorithm = buildParams.get("EncryptionAlgorithm") ?? DEFAULT_ALGORITHM;
|
|
22
|
+
const keyLength = keyLengthForAlgorithm(this.algorithm);
|
|
23
|
+
this.key = crypto.scryptSync(passphrase, salt, keyLength);
|
|
24
|
+
} else {
|
|
25
|
+
this.key = null;
|
|
26
|
+
this.algorithm = DEFAULT_ALGORITHM;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
encrypt(value) {
|
|
30
|
+
if (!this.key) {
|
|
31
|
+
return value;
|
|
32
|
+
}
|
|
33
|
+
const iv = crypto.randomBytes(12);
|
|
34
|
+
const cipher = crypto.createCipheriv(this.algorithm, this.key, iv);
|
|
35
|
+
const encrypted = Buffer.concat([cipher.update(value, "utf8"), cipher.final()]);
|
|
36
|
+
const authTag = cipher.getAuthTag();
|
|
37
|
+
return Buffer.concat([iv, authTag, encrypted]).toString("base64");
|
|
38
|
+
}
|
|
39
|
+
decrypt(value) {
|
|
40
|
+
if (!this.key) {
|
|
41
|
+
return value;
|
|
42
|
+
}
|
|
43
|
+
const data = Buffer.from(value, "base64");
|
|
44
|
+
const iv = data.subarray(0, 12);
|
|
45
|
+
const authTag = data.subarray(12, 28);
|
|
46
|
+
const ciphertext = data.subarray(28);
|
|
47
|
+
const decipher = crypto.createDecipheriv(this.algorithm, this.key, iv);
|
|
48
|
+
decipher.setAuthTag(authTag);
|
|
49
|
+
return Buffer.concat([decipher.update(ciphertext), decipher.final()]).toString("utf8");
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
export const Encryption = createImplementation({
|
|
53
|
+
abstraction: EncryptionAbstraction,
|
|
54
|
+
implementation: EncryptionImpl,
|
|
55
|
+
dependencies: [BuildParams]
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
//# sourceMappingURL=EncryptionService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["crypto","createImplementation","Encryption","EncryptionAbstraction","BuildParams","DEFAULT_ALGORITHM","keyLengthForAlgorithm","algorithm","bits","parseInt","split","isNaN","Error","EncryptionImpl","constructor","buildParams","passphrase","get","salt","keyLength","key","scryptSync","encrypt","value","iv","randomBytes","cipher","createCipheriv","encrypted","Buffer","concat","update","final","authTag","getAuthTag","toString","decrypt","data","from","subarray","ciphertext","decipher","createDecipheriv","setAuthTag","abstraction","implementation","dependencies"],"sources":["EncryptionService.ts"],"sourcesContent":["import crypto from \"node:crypto\";\nimport { createImplementation } from \"@webiny/feature/api\";\nimport { Encryption as EncryptionAbstraction } from \"./abstractions.js\";\nimport { BuildParams } from \"../buildParams/abstractions.js\";\n\nconst DEFAULT_ALGORITHM = \"aes-256-gcm\";\n\nfunction keyLengthForAlgorithm(algorithm: string): number {\n // Parse key size in bits from algorithm name (e.g. \"aes-256-gcm\" → 32 bytes).\n const bits = parseInt(algorithm.split(\"-\")[1]);\n if (isNaN(bits)) {\n throw new Error(`Cannot determine key length from algorithm \"${algorithm}\".`);\n }\n return bits / 8;\n}\n\nexport class EncryptionImpl implements EncryptionAbstraction.Interface {\n private key: Buffer | null;\n private algorithm: string;\n\n constructor(buildParams: BuildParams.Interface) {\n const passphrase = buildParams.get<string>(\"EncryptionPassphrase\");\n\n if (passphrase) {\n // Salt is optional. It ensures two projects using the same passphrase derive different keys,\n // but since passphrases should be unique per project anyway, it's extra insurance rather than a necessity.\n const salt = buildParams.get<string>(\"EncryptionSalt\") ?? \"\";\n this.algorithm = buildParams.get<string>(\"EncryptionAlgorithm\") ?? DEFAULT_ALGORITHM;\n const keyLength = keyLengthForAlgorithm(this.algorithm);\n this.key = crypto.scryptSync(passphrase, salt, keyLength);\n } else {\n this.key = null;\n this.algorithm = DEFAULT_ALGORITHM;\n }\n }\n\n encrypt(value: string): string {\n if (!this.key) {\n return value;\n }\n const iv = crypto.randomBytes(12);\n const cipher = crypto.createCipheriv(this.algorithm, this.key, iv);\n const encrypted = Buffer.concat([cipher.update(value, \"utf8\"), cipher.final()]);\n const authTag = (cipher as crypto.CipherGCM).getAuthTag();\n return Buffer.concat([iv, authTag, encrypted]).toString(\"base64\");\n }\n\n decrypt(value: string): string {\n if (!this.key) {\n return value;\n }\n const data = Buffer.from(value, \"base64\");\n const iv = data.subarray(0, 12);\n const authTag = data.subarray(12, 28);\n const ciphertext = data.subarray(28);\n const decipher = crypto.createDecipheriv(this.algorithm, this.key, iv);\n (decipher as crypto.DecipherGCM).setAuthTag(authTag);\n return Buffer.concat([decipher.update(ciphertext), decipher.final()]).toString(\"utf8\");\n }\n}\n\nexport const Encryption = createImplementation({\n abstraction: EncryptionAbstraction,\n implementation: EncryptionImpl,\n dependencies: [BuildParams]\n});\n"],"mappings":"AAAA,OAAOA,MAAM,MAAM,aAAa;AAChC,SAASC,oBAAoB,QAAQ,qBAAqB;AAC1D,SAASC,UAAU,IAAIC,qBAAqB;AAC5C,SAASC,WAAW;AAEpB,MAAMC,iBAAiB,GAAG,aAAa;AAEvC,SAASC,qBAAqBA,CAACC,SAAiB,EAAU;EACtD;EACA,MAAMC,IAAI,GAAGC,QAAQ,CAACF,SAAS,CAACG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;EAC9C,IAAIC,KAAK,CAACH,IAAI,CAAC,EAAE;IACb,MAAM,IAAII,KAAK,CAAC,+CAA+CL,SAAS,IAAI,CAAC;EACjF;EACA,OAAOC,IAAI,GAAG,CAAC;AACnB;AAEA,OAAO,MAAMK,cAAc,CAA4C;EAInEC,WAAWA,CAACC,WAAkC,EAAE;IAC5C,MAAMC,UAAU,GAAGD,WAAW,CAACE,GAAG,CAAS,sBAAsB,CAAC;IAElE,IAAID,UAAU,EAAE;MACZ;MACA;MACA,MAAME,IAAI,GAAGH,WAAW,CAACE,GAAG,CAAS,gBAAgB,CAAC,IAAI,EAAE;MAC5D,IAAI,CAACV,SAAS,GAAGQ,WAAW,CAACE,GAAG,CAAS,qBAAqB,CAAC,IAAIZ,iBAAiB;MACpF,MAAMc,SAAS,GAAGb,qBAAqB,CAAC,IAAI,CAACC,SAAS,CAAC;MACvD,IAAI,CAACa,GAAG,GAAGpB,MAAM,CAACqB,UAAU,CAACL,UAAU,EAAEE,IAAI,EAAEC,SAAS,CAAC;IAC7D,CAAC,MAAM;MACH,IAAI,CAACC,GAAG,GAAG,IAAI;MACf,IAAI,CAACb,SAAS,GAAGF,iBAAiB;IACtC;EACJ;EAEAiB,OAAOA,CAACC,KAAa,EAAU;IAC3B,IAAI,CAAC,IAAI,CAACH,GAAG,EAAE;MACX,OAAOG,KAAK;IAChB;IACA,MAAMC,EAAE,GAAGxB,MAAM,CAACyB,WAAW,CAAC,EAAE,CAAC;IACjC,MAAMC,MAAM,GAAG1B,MAAM,CAAC2B,cAAc,CAAC,IAAI,CAACpB,SAAS,EAAE,IAAI,CAACa,GAAG,EAAEI,EAAE,CAAC;IAClE,MAAMI,SAAS,GAAGC,MAAM,CAACC,MAAM,CAAC,CAACJ,MAAM,CAACK,MAAM,CAACR,KAAK,EAAE,MAAM,CAAC,EAAEG,MAAM,CAACM,KAAK,CAAC,CAAC,CAAC,CAAC;IAC/E,MAAMC,OAAO,GAAIP,MAAM,CAAsBQ,UAAU,CAAC,CAAC;IACzD,OAAOL,MAAM,CAACC,MAAM,CAAC,CAACN,EAAE,EAAES,OAAO,EAAEL,SAAS,CAAC,CAAC,CAACO,QAAQ,CAAC,QAAQ,CAAC;EACrE;EAEAC,OAAOA,CAACb,KAAa,EAAU;IAC3B,IAAI,CAAC,IAAI,CAACH,GAAG,EAAE;MACX,OAAOG,KAAK;IAChB;IACA,MAAMc,IAAI,GAAGR,MAAM,CAACS,IAAI,CAACf,KAAK,EAAE,QAAQ,CAAC;IACzC,MAAMC,EAAE,GAAGa,IAAI,CAACE,QAAQ,CAAC,CAAC,EAAE,EAAE,CAAC;IAC/B,MAAMN,OAAO,GAAGI,IAAI,CAACE,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC;IACrC,MAAMC,UAAU,GAAGH,IAAI,CAACE,QAAQ,CAAC,EAAE,CAAC;IACpC,MAAME,QAAQ,GAAGzC,MAAM,CAAC0C,gBAAgB,CAAC,IAAI,CAACnC,SAAS,EAAE,IAAI,CAACa,GAAG,EAAEI,EAAE,CAAC;IACrEiB,QAAQ,CAAwBE,UAAU,CAACV,OAAO,CAAC;IACpD,OAAOJ,MAAM,CAACC,MAAM,CAAC,CAACW,QAAQ,CAACV,MAAM,CAACS,UAAU,CAAC,EAAEC,QAAQ,CAACT,KAAK,CAAC,CAAC,CAAC,CAAC,CAACG,QAAQ,CAAC,MAAM,CAAC;EAC1F;AACJ;AAEA,OAAO,MAAMjC,UAAU,GAAGD,oBAAoB,CAAC;EAC3C2C,WAAW,EAAEzC,qBAAqB;EAClC0C,cAAc,EAAEhC,cAAc;EAC9BiC,YAAY,EAAE,CAAC1C,WAAW;AAC9B,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface IEncryption {
|
|
2
|
+
encrypt(value: string): string;
|
|
3
|
+
decrypt(value: string): string;
|
|
4
|
+
}
|
|
5
|
+
/** Symmetric encryption and decryption using a configured secret key. */
|
|
6
|
+
export declare const Encryption: import("@webiny/di").Abstraction<IEncryption>;
|
|
7
|
+
export declare namespace Encryption {
|
|
8
|
+
type Interface = IEncryption;
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createAbstraction","Encryption"],"sources":["abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\n\nexport interface IEncryption {\n encrypt(value: string): string;\n decrypt(value: string): string;\n}\n\n/** Symmetric encryption and decryption using a configured secret key. */\nexport const Encryption = createAbstraction<IEncryption>(\"Encryption\");\n\nexport namespace Encryption {\n export type Interface = IEncryption;\n}\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,qBAAqB;AAOvD;AACA,OAAO,MAAMC,UAAU,GAAGD,iBAAiB,CAAc,YAAY,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createFeature } from "@webiny/feature/api";
|
|
2
|
+
import { Encryption } from "./EncryptionService.js";
|
|
3
|
+
export const EncryptionFeature = createFeature({
|
|
4
|
+
name: "EncryptionFeature",
|
|
5
|
+
register(container) {
|
|
6
|
+
container.register(Encryption);
|
|
7
|
+
}
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
//# sourceMappingURL=feature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createFeature","Encryption","EncryptionFeature","name","register","container"],"sources":["feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { Encryption } from \"./EncryptionService.js\";\n\nexport const EncryptionFeature = createFeature({\n name: \"EncryptionFeature\",\n register(container) {\n container.register(Encryption);\n }\n});\n"],"mappings":"AAAA,SAASA,aAAa,QAAQ,qBAAqB;AACnD,SAASC,UAAU;AAEnB,OAAO,MAAMC,iBAAiB,GAAGF,aAAa,CAAC;EAC3CG,IAAI,EAAE,mBAAmB;EACzBC,QAAQA,CAACC,SAAS,EAAE;IAChBA,SAAS,CAACD,QAAQ,CAACH,UAAU,CAAC;EAClC;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Encryption } from "./abstractions.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Encryption"],"sources":["index.ts"],"sourcesContent":["export { Encryption } from \"./abstractions.js\";\n"],"mappings":"AAAA,SAASA,UAAU","ignoreList":[]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Abstraction } from "@webiny/di";
|
|
2
|
+
/** Base class for all domain events. */
|
|
2
3
|
export declare abstract class DomainEvent<TPayload = void> {
|
|
3
4
|
abstract readonly eventType: string;
|
|
4
5
|
readonly occurredAt: Date;
|
|
@@ -12,6 +13,7 @@ export interface IEventHandler<TEvent extends DomainEvent<any> = DomainEvent<any
|
|
|
12
13
|
export interface IEventPublisher {
|
|
13
14
|
publish<TEvent extends DomainEvent<any>>(event: TEvent): Promise<void>;
|
|
14
15
|
}
|
|
16
|
+
/** Publish domain events to registered handlers. */
|
|
15
17
|
export declare const EventPublisher: Abstraction<IEventPublisher>;
|
|
16
18
|
export declare namespace EventPublisher {
|
|
17
19
|
type Interface = IEventPublisher;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { Abstraction } from "@webiny/di";
|
|
2
|
+
|
|
3
|
+
/** Base class for all domain events. */
|
|
2
4
|
export class DomainEvent {
|
|
3
5
|
constructor(payload) {
|
|
4
6
|
this.occurredAt = new Date();
|
|
@@ -9,6 +11,7 @@ export class DomainEvent {
|
|
|
9
11
|
}
|
|
10
12
|
}
|
|
11
13
|
}
|
|
14
|
+
/** Publish domain events to registered handlers. */
|
|
12
15
|
export const EventPublisher = new Abstraction("EventPublisher");
|
|
13
16
|
|
|
14
17
|
//# sourceMappingURL=abstractions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Abstraction","DomainEvent","constructor","payload","occurredAt","Date","undefined","EventPublisher"],"sources":["abstractions.ts"],"sourcesContent":["import { Abstraction } from \"@webiny/di\";\n\nexport abstract class DomainEvent<TPayload = void> {\n public abstract readonly eventType: string;\n public readonly occurredAt: Date;\n public readonly payload: TPayload extends void ? undefined : TPayload;\n\n constructor(payload: TPayload);\n constructor(payload?: never) {\n this.occurredAt = new Date();\n\n if (payload === undefined) {\n this.payload = undefined as any;\n } else {\n this.payload = payload;\n }\n }\n\n abstract getHandlerAbstraction(): Abstraction<IEventHandler<any>>;\n}\n\nexport interface IEventHandler<TEvent extends DomainEvent<any> = DomainEvent<any>> {\n handle(event: TEvent): Promise<void>;\n}\n\nexport interface IEventPublisher {\n publish<TEvent extends DomainEvent<any>>(event: TEvent): Promise<void>;\n}\n\nexport const EventPublisher = new Abstraction<IEventPublisher>(\"EventPublisher\");\n\nexport namespace EventPublisher {\n export type Interface = IEventPublisher;\n}\n"],"mappings":"AAAA,SAASA,WAAW,QAAQ,YAAY;
|
|
1
|
+
{"version":3,"names":["Abstraction","DomainEvent","constructor","payload","occurredAt","Date","undefined","EventPublisher"],"sources":["abstractions.ts"],"sourcesContent":["import { Abstraction } from \"@webiny/di\";\n\n/** Base class for all domain events. */\nexport abstract class DomainEvent<TPayload = void> {\n public abstract readonly eventType: string;\n public readonly occurredAt: Date;\n public readonly payload: TPayload extends void ? undefined : TPayload;\n\n constructor(payload: TPayload);\n constructor(payload?: never) {\n this.occurredAt = new Date();\n\n if (payload === undefined) {\n this.payload = undefined as any;\n } else {\n this.payload = payload;\n }\n }\n\n abstract getHandlerAbstraction(): Abstraction<IEventHandler<any>>;\n}\n\nexport interface IEventHandler<TEvent extends DomainEvent<any> = DomainEvent<any>> {\n handle(event: TEvent): Promise<void>;\n}\n\nexport interface IEventPublisher {\n publish<TEvent extends DomainEvent<any>>(event: TEvent): Promise<void>;\n}\n\n/** Publish domain events to registered handlers. */\nexport const EventPublisher = new Abstraction<IEventPublisher>(\"EventPublisher\");\n\nexport namespace EventPublisher {\n export type Interface = IEventPublisher;\n}\n"],"mappings":"AAAA,SAASA,WAAW,QAAQ,YAAY;;AAExC;AACA,OAAO,MAAeC,WAAW,CAAkB;EAM/CC,WAAWA,CAACC,OAAe,EAAE;IACzB,IAAI,CAACC,UAAU,GAAG,IAAIC,IAAI,CAAC,CAAC;IAE5B,IAAIF,OAAO,KAAKG,SAAS,EAAE;MACvB,IAAI,CAACH,OAAO,GAAGG,SAAgB;IACnC,CAAC,MAAM;MACH,IAAI,CAACH,OAAO,GAAGA,OAAO;IAC1B;EACJ;AAGJ;AAUA;AACA,OAAO,MAAMI,cAAc,GAAG,IAAIP,WAAW,CAAkB,gBAAgB,CAAC","ignoreList":[]}
|
|
@@ -14,7 +14,9 @@ class GlobalKeyValueStoreImpl {
|
|
|
14
14
|
}
|
|
15
15
|
async set(key, value, options) {
|
|
16
16
|
const scope = this.getScope(options);
|
|
17
|
-
return this.repository.set(key, value, scope
|
|
17
|
+
return this.repository.set(key, value, scope, {
|
|
18
|
+
expiresAt: options?.expiresAt
|
|
19
|
+
});
|
|
18
20
|
}
|
|
19
21
|
async delete(key, options) {
|
|
20
22
|
const scope = this.getScope(options);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createImplementation","KeyValueStoreRepository","GlobalKeyValueStore","ServiceAbstraction","DEFAULT_SCOPE","GlobalKeyValueStoreImpl","constructor","repository","getScope","options","scope","get","key","set","value","delete","abstraction","implementation","dependencies"],"sources":["GlobalKeyValueStore.ts"],"sourcesContent":["import { createImplementation } from \"@webiny/feature/api\";\nimport { Result } from \"@webiny/feature/api\";\nimport {\n KeyValueStoreRepository,\n GlobalKeyValueStore as ServiceAbstraction,\n IGlobalKeyValueStoreOptions\n} from \"./abstractions.js\";\n\nconst DEFAULT_SCOPE = \"global\";\n\nclass GlobalKeyValueStoreImpl implements ServiceAbstraction.Interface {\n constructor(private repository: KeyValueStoreRepository.Interface) {}\n\n private getScope(options?: IGlobalKeyValueStoreOptions): string {\n return options?.scope || DEFAULT_SCOPE;\n }\n\n async get<T = unknown>(\n key: string,\n options?: IGlobalKeyValueStoreOptions\n ): Promise<Result<T, ServiceAbstraction.Error>> {\n const scope = this.getScope(options);\n return this.repository.get<T>(key, scope);\n }\n\n async set(\n key: string,\n value: any,\n options?: IGlobalKeyValueStoreOptions\n ): Promise<Result<void, ServiceAbstraction.Error>> {\n const scope = this.getScope(options);\n return this.repository.set(key, value, scope);\n }\n\n async delete(\n key: string,\n options?: IGlobalKeyValueStoreOptions\n ): Promise<Result<void, ServiceAbstraction.Error>> {\n const scope = this.getScope(options);\n return this.repository.delete(key, scope);\n }\n}\n\nexport const GlobalKeyValueStore = createImplementation({\n abstraction: ServiceAbstraction,\n implementation: GlobalKeyValueStoreImpl,\n dependencies: [KeyValueStoreRepository]\n});\n"],"mappings":"AAAA,SAASA,oBAAoB,QAAQ,qBAAqB;AAE1D,SACIC,uBAAuB,EACvBC,mBAAmB,IAAIC,kBAAkB;AAI7C,MAAMC,aAAa,GAAG,QAAQ;AAE9B,MAAMC,uBAAuB,CAAyC;EAClEC,WAAWA,CAASC,UAA6C,EAAE;IAAA,KAA/CA,UAA6C,GAA7CA,UAA6C;EAAG;EAE5DC,QAAQA,CAACC,OAAqC,EAAU;IAC5D,OAAOA,OAAO,EAAEC,KAAK,IAAIN,aAAa;EAC1C;EAEA,MAAMO,GAAGA,CACLC,GAAW,EACXH,OAAqC,EACO;IAC5C,MAAMC,KAAK,GAAG,IAAI,CAACF,QAAQ,CAACC,OAAO,CAAC;IACpC,OAAO,IAAI,CAACF,UAAU,CAACI,GAAG,CAAIC,GAAG,EAAEF,KAAK,CAAC;EAC7C;EAEA,MAAMG,GAAGA,CACLD,GAAW,EACXE,KAAU,EACVL,OAAqC,EACU;IAC/C,MAAMC,KAAK,GAAG,IAAI,CAACF,QAAQ,CAACC,OAAO,CAAC;IACpC,OAAO,IAAI,CAACF,UAAU,CAACM,GAAG,CAACD,GAAG,EAAEE,KAAK,EAAEJ,KAAK,CAAC;
|
|
1
|
+
{"version":3,"names":["createImplementation","KeyValueStoreRepository","GlobalKeyValueStore","ServiceAbstraction","DEFAULT_SCOPE","GlobalKeyValueStoreImpl","constructor","repository","getScope","options","scope","get","key","set","value","expiresAt","delete","abstraction","implementation","dependencies"],"sources":["GlobalKeyValueStore.ts"],"sourcesContent":["import { createImplementation } from \"@webiny/feature/api\";\nimport { Result } from \"@webiny/feature/api\";\nimport {\n KeyValueStoreRepository,\n GlobalKeyValueStore as ServiceAbstraction,\n IGlobalKeyValueStoreOptions\n} from \"./abstractions.js\";\n\nconst DEFAULT_SCOPE = \"global\";\n\nclass GlobalKeyValueStoreImpl implements ServiceAbstraction.Interface {\n constructor(private repository: KeyValueStoreRepository.Interface) {}\n\n private getScope(options?: IGlobalKeyValueStoreOptions): string {\n return options?.scope || DEFAULT_SCOPE;\n }\n\n async get<T = unknown>(\n key: string,\n options?: IGlobalKeyValueStoreOptions\n ): Promise<Result<T, ServiceAbstraction.Error>> {\n const scope = this.getScope(options);\n return this.repository.get<T>(key, scope);\n }\n\n async set(\n key: string,\n value: any,\n options?: IGlobalKeyValueStoreOptions\n ): Promise<Result<void, ServiceAbstraction.Error>> {\n const scope = this.getScope(options);\n return this.repository.set(key, value, scope, {\n expiresAt: options?.expiresAt\n });\n }\n\n async delete(\n key: string,\n options?: IGlobalKeyValueStoreOptions\n ): Promise<Result<void, ServiceAbstraction.Error>> {\n const scope = this.getScope(options);\n return this.repository.delete(key, scope);\n }\n}\n\nexport const GlobalKeyValueStore = createImplementation({\n abstraction: ServiceAbstraction,\n implementation: GlobalKeyValueStoreImpl,\n dependencies: [KeyValueStoreRepository]\n});\n"],"mappings":"AAAA,SAASA,oBAAoB,QAAQ,qBAAqB;AAE1D,SACIC,uBAAuB,EACvBC,mBAAmB,IAAIC,kBAAkB;AAI7C,MAAMC,aAAa,GAAG,QAAQ;AAE9B,MAAMC,uBAAuB,CAAyC;EAClEC,WAAWA,CAASC,UAA6C,EAAE;IAAA,KAA/CA,UAA6C,GAA7CA,UAA6C;EAAG;EAE5DC,QAAQA,CAACC,OAAqC,EAAU;IAC5D,OAAOA,OAAO,EAAEC,KAAK,IAAIN,aAAa;EAC1C;EAEA,MAAMO,GAAGA,CACLC,GAAW,EACXH,OAAqC,EACO;IAC5C,MAAMC,KAAK,GAAG,IAAI,CAACF,QAAQ,CAACC,OAAO,CAAC;IACpC,OAAO,IAAI,CAACF,UAAU,CAACI,GAAG,CAAIC,GAAG,EAAEF,KAAK,CAAC;EAC7C;EAEA,MAAMG,GAAGA,CACLD,GAAW,EACXE,KAAU,EACVL,OAAqC,EACU;IAC/C,MAAMC,KAAK,GAAG,IAAI,CAACF,QAAQ,CAACC,OAAO,CAAC;IACpC,OAAO,IAAI,CAACF,UAAU,CAACM,GAAG,CAACD,GAAG,EAAEE,KAAK,EAAEJ,KAAK,EAAE;MAC1CK,SAAS,EAAEN,OAAO,EAAEM;IACxB,CAAC,CAAC;EACN;EAEA,MAAMC,MAAMA,CACRJ,GAAW,EACXH,OAAqC,EACU;IAC/C,MAAMC,KAAK,GAAG,IAAI,CAACF,QAAQ,CAACC,OAAO,CAAC;IACpC,OAAO,IAAI,CAACF,UAAU,CAACS,MAAM,CAACJ,GAAG,EAAEF,KAAK,CAAC;EAC7C;AACJ;AAEA,OAAO,MAAMR,mBAAmB,GAAGF,oBAAoB,CAAC;EACpDiB,WAAW,EAAEd,kBAAkB;EAC/Be,cAAc,EAAEb,uBAAuB;EACvCc,YAAY,EAAE,CAAClB,uBAAuB;AAC1C,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Result } from "@webiny/feature/api";
|
|
2
|
-
import { KeyValueStorageOperations, KeyValueStoreRepository as RepositoryAbstraction } from "./abstractions.js";
|
|
2
|
+
import { KeyValueStorageOperations, KeyValueStoreRepository as RepositoryAbstraction, type IKeyValueStoreSetOptions } from "./abstractions.js";
|
|
3
3
|
/**
|
|
4
4
|
* KeyValueStoreRepository implementation.
|
|
5
5
|
*
|
|
@@ -10,7 +10,7 @@ declare class KeyValueStoreRepositoryImpl implements RepositoryAbstraction.Inter
|
|
|
10
10
|
private storageOperations;
|
|
11
11
|
constructor(storageOperations: KeyValueStorageOperations.Interface);
|
|
12
12
|
get<T = unknown>(key: string, scope: string): Promise<Result<T, RepositoryAbstraction.Error>>;
|
|
13
|
-
set(key: string, value: any, scope: string): Promise<Result<void, RepositoryAbstraction.Error>>;
|
|
13
|
+
set(key: string, value: any, scope: string, options?: IKeyValueStoreSetOptions): Promise<Result<void, RepositoryAbstraction.Error>>;
|
|
14
14
|
delete(key: string, scope: string): Promise<Result<void, RepositoryAbstraction.Error>>;
|
|
15
15
|
}
|
|
16
16
|
export declare const KeyValueStoreRepository: import("@webiny/di").Implementation<typeof KeyValueStoreRepositoryImpl>;
|
|
@@ -24,9 +24,9 @@ class KeyValueStoreRepositoryImpl {
|
|
|
24
24
|
return Result.fail(new KeyValueStorageError(error));
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
-
async set(key, value, scope) {
|
|
27
|
+
async set(key, value, scope, options) {
|
|
28
28
|
try {
|
|
29
|
-
await this.storageOperations.set(key, value, scope);
|
|
29
|
+
await this.storageOperations.set(key, value, scope, options);
|
|
30
30
|
return Result.ok();
|
|
31
31
|
} catch (error) {
|
|
32
32
|
return Result.fail(new KeyValueStorageError(error));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createImplementation","Result","KeyValueStorageOperations","KeyValueStoreRepository","RepositoryAbstraction","KeyNotFoundError","KeyValueStorageError","KeyValueStoreRepositoryImpl","constructor","storageOperations","get","key","scope","record","fail","ok","value","error","set","delete","abstraction","implementation","dependencies"],"sources":["KeyValueStoreRepository.ts"],"sourcesContent":["import { createImplementation } from \"@webiny/feature/api\";\nimport { Result } from \"@webiny/feature/api\";\nimport {\n KeyValueStorageOperations,\n KeyValueStoreRepository as RepositoryAbstraction\n} from \"./abstractions.js\";\nimport { KeyNotFoundError, KeyValueStorageError } from \"./errors.js\";\n\n/**\n * KeyValueStoreRepository implementation.\n *\n * This repository passes key and scope separately to storage operations.\n * The storage layer is responsible for handling scope-based partitioning.\n */\nclass KeyValueStoreRepositoryImpl implements RepositoryAbstraction.Interface {\n constructor(private storageOperations: KeyValueStorageOperations.Interface) {}\n\n async get<T = unknown>(\n key: string,\n scope: string\n ): Promise<Result<T, RepositoryAbstraction.Error>> {\n try {\n const record = await this.storageOperations.get(key, scope);\n\n if (!record) {\n return Result.fail(new KeyNotFoundError(key));\n }\n\n return Result.ok(record.value as T);\n } catch (error) {\n return Result.fail(new KeyValueStorageError(error as Error));\n }\n }\n\n async set(\n key: string,\n value: any,\n scope: string\n ): Promise<Result<void, RepositoryAbstraction.Error>> {\n try {\n await this.storageOperations.set(key, value, scope);\n return Result.ok();\n } catch (error) {\n return Result.fail(new KeyValueStorageError(error as Error));\n }\n }\n\n async delete(key: string, scope: string): Promise<Result<void, RepositoryAbstraction.Error>> {\n try {\n await this.storageOperations.delete(key, scope);\n return Result.ok();\n } catch (error) {\n return Result.fail(new KeyValueStorageError(error as Error));\n }\n }\n}\n\nexport const KeyValueStoreRepository = createImplementation({\n abstraction: RepositoryAbstraction,\n implementation: KeyValueStoreRepositoryImpl,\n dependencies: [KeyValueStorageOperations]\n});\n"],"mappings":"AAAA,SAASA,oBAAoB,QAAQ,qBAAqB;AAC1D,SAASC,MAAM,QAAQ,qBAAqB;AAC5C,SACIC,yBAAyB,EACzBC,uBAAuB,IAAIC,qBAAqB;
|
|
1
|
+
{"version":3,"names":["createImplementation","Result","KeyValueStorageOperations","KeyValueStoreRepository","RepositoryAbstraction","KeyNotFoundError","KeyValueStorageError","KeyValueStoreRepositoryImpl","constructor","storageOperations","get","key","scope","record","fail","ok","value","error","set","options","delete","abstraction","implementation","dependencies"],"sources":["KeyValueStoreRepository.ts"],"sourcesContent":["import { createImplementation } from \"@webiny/feature/api\";\nimport { Result } from \"@webiny/feature/api\";\nimport {\n KeyValueStorageOperations,\n KeyValueStoreRepository as RepositoryAbstraction,\n type IKeyValueStoreSetOptions\n} from \"./abstractions.js\";\nimport { KeyNotFoundError, KeyValueStorageError } from \"./errors.js\";\n\n/**\n * KeyValueStoreRepository implementation.\n *\n * This repository passes key and scope separately to storage operations.\n * The storage layer is responsible for handling scope-based partitioning.\n */\nclass KeyValueStoreRepositoryImpl implements RepositoryAbstraction.Interface {\n constructor(private storageOperations: KeyValueStorageOperations.Interface) {}\n\n async get<T = unknown>(\n key: string,\n scope: string\n ): Promise<Result<T, RepositoryAbstraction.Error>> {\n try {\n const record = await this.storageOperations.get(key, scope);\n\n if (!record) {\n return Result.fail(new KeyNotFoundError(key));\n }\n\n return Result.ok(record.value as T);\n } catch (error) {\n return Result.fail(new KeyValueStorageError(error as Error));\n }\n }\n\n async set(\n key: string,\n value: any,\n scope: string,\n options?: IKeyValueStoreSetOptions\n ): Promise<Result<void, RepositoryAbstraction.Error>> {\n try {\n await this.storageOperations.set(key, value, scope, options);\n return Result.ok();\n } catch (error) {\n return Result.fail(new KeyValueStorageError(error as Error));\n }\n }\n\n async delete(key: string, scope: string): Promise<Result<void, RepositoryAbstraction.Error>> {\n try {\n await this.storageOperations.delete(key, scope);\n return Result.ok();\n } catch (error) {\n return Result.fail(new KeyValueStorageError(error as Error));\n }\n }\n}\n\nexport const KeyValueStoreRepository = createImplementation({\n abstraction: RepositoryAbstraction,\n implementation: KeyValueStoreRepositoryImpl,\n dependencies: [KeyValueStorageOperations]\n});\n"],"mappings":"AAAA,SAASA,oBAAoB,QAAQ,qBAAqB;AAC1D,SAASC,MAAM,QAAQ,qBAAqB;AAC5C,SACIC,yBAAyB,EACzBC,uBAAuB,IAAIC,qBAAqB;AAGpD,SAASC,gBAAgB,EAAEC,oBAAoB;;AAE/C;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,2BAA2B,CAA4C;EACzEC,WAAWA,CAASC,iBAAsD,EAAE;IAAA,KAAxDA,iBAAsD,GAAtDA,iBAAsD;EAAG;EAE7E,MAAMC,GAAGA,CACLC,GAAW,EACXC,KAAa,EACkC;IAC/C,IAAI;MACA,MAAMC,MAAM,GAAG,MAAM,IAAI,CAACJ,iBAAiB,CAACC,GAAG,CAACC,GAAG,EAAEC,KAAK,CAAC;MAE3D,IAAI,CAACC,MAAM,EAAE;QACT,OAAOZ,MAAM,CAACa,IAAI,CAAC,IAAIT,gBAAgB,CAACM,GAAG,CAAC,CAAC;MACjD;MAEA,OAAOV,MAAM,CAACc,EAAE,CAACF,MAAM,CAACG,KAAU,CAAC;IACvC,CAAC,CAAC,OAAOC,KAAK,EAAE;MACZ,OAAOhB,MAAM,CAACa,IAAI,CAAC,IAAIR,oBAAoB,CAACW,KAAc,CAAC,CAAC;IAChE;EACJ;EAEA,MAAMC,GAAGA,CACLP,GAAW,EACXK,KAAU,EACVJ,KAAa,EACbO,OAAkC,EACgB;IAClD,IAAI;MACA,MAAM,IAAI,CAACV,iBAAiB,CAACS,GAAG,CAACP,GAAG,EAAEK,KAAK,EAAEJ,KAAK,EAAEO,OAAO,CAAC;MAC5D,OAAOlB,MAAM,CAACc,EAAE,CAAC,CAAC;IACtB,CAAC,CAAC,OAAOE,KAAK,EAAE;MACZ,OAAOhB,MAAM,CAACa,IAAI,CAAC,IAAIR,oBAAoB,CAACW,KAAc,CAAC,CAAC;IAChE;EACJ;EAEA,MAAMG,MAAMA,CAACT,GAAW,EAAEC,KAAa,EAAsD;IACzF,IAAI;MACA,MAAM,IAAI,CAACH,iBAAiB,CAACW,MAAM,CAACT,GAAG,EAAEC,KAAK,CAAC;MAC/C,OAAOX,MAAM,CAACc,EAAE,CAAC,CAAC;IACtB,CAAC,CAAC,OAAOE,KAAK,EAAE;MACZ,OAAOhB,MAAM,CAACa,IAAI,CAAC,IAAIR,oBAAoB,CAACW,KAAc,CAAC,CAAC;IAChE;EACJ;AACJ;AAEA,OAAO,MAAMd,uBAAuB,GAAGH,oBAAoB,CAAC;EACxDqB,WAAW,EAAEjB,qBAAqB;EAClCkB,cAAc,EAAEf,2BAA2B;EAC3CgB,YAAY,EAAE,CAACrB,yBAAyB;AAC5C,CAAC,CAAC","ignoreList":[]}
|
|
@@ -6,12 +6,14 @@ export interface IKeyValueRecord {
|
|
|
6
6
|
}
|
|
7
7
|
export interface IGlobalKeyValueStoreOptions {
|
|
8
8
|
scope?: string;
|
|
9
|
+
expiresAt?: Date;
|
|
9
10
|
}
|
|
10
11
|
export interface IGlobalKeyValueStore {
|
|
11
12
|
get<T = unknown>(key: string, options?: IGlobalKeyValueStoreOptions): Promise<Result<T, KeyValueStoreRepository.Error>>;
|
|
12
13
|
set(key: string, value: any, options?: IGlobalKeyValueStoreOptions): Promise<Result<void, KeyValueStoreRepository.Error>>;
|
|
13
14
|
delete(key: string, options?: IGlobalKeyValueStoreOptions): Promise<Result<void, KeyValueStoreRepository.Error>>;
|
|
14
15
|
}
|
|
16
|
+
/** Global (non-tenant-scoped) key-value store. */
|
|
15
17
|
export declare const GlobalKeyValueStore: import("@webiny/di").Abstraction<IGlobalKeyValueStore>;
|
|
16
18
|
export declare namespace GlobalKeyValueStore {
|
|
17
19
|
type Interface = IGlobalKeyValueStore;
|
|
@@ -23,6 +25,7 @@ export interface IKeyValueStore {
|
|
|
23
25
|
set(key: string, value: any): Promise<Result<void, KeyValueStoreRepository.Error>>;
|
|
24
26
|
delete(key: string): Promise<Result<void, KeyValueStoreRepository.Error>>;
|
|
25
27
|
}
|
|
28
|
+
/** Tenant-scoped key-value store. */
|
|
26
29
|
export declare const KeyValueStore: import("@webiny/di").Abstraction<IKeyValueStore>;
|
|
27
30
|
export declare namespace KeyValueStore {
|
|
28
31
|
type Interface = IKeyValueStore;
|
|
@@ -33,11 +36,15 @@ export interface IKeyValueStoreRepositoryErrors {
|
|
|
33
36
|
base: KeyNotFoundError | KeyValueStorageError;
|
|
34
37
|
}
|
|
35
38
|
type RepositoryError = IKeyValueStoreRepositoryErrors[keyof IKeyValueStoreRepositoryErrors];
|
|
39
|
+
export interface IKeyValueStoreSetOptions {
|
|
40
|
+
expiresAt?: Date;
|
|
41
|
+
}
|
|
36
42
|
export interface IKeyValueStoreRepository {
|
|
37
43
|
get<T = unknown>(key: string, scope: string): Promise<Result<T, RepositoryError>>;
|
|
38
|
-
set(key: string, value: any, scope: string): Promise<Result<void, RepositoryError>>;
|
|
44
|
+
set(key: string, value: any, scope: string, options?: IKeyValueStoreSetOptions): Promise<Result<void, RepositoryError>>;
|
|
39
45
|
delete(key: string, scope: string): Promise<Result<void, RepositoryError>>;
|
|
40
46
|
}
|
|
47
|
+
/** Persist and retrieve key-value pairs. */
|
|
41
48
|
export declare const KeyValueStoreRepository: import("@webiny/di").Abstraction<IKeyValueStoreRepository>;
|
|
42
49
|
export declare namespace KeyValueStoreRepository {
|
|
43
50
|
type Interface = IKeyValueStoreRepository;
|
|
@@ -48,9 +55,10 @@ export interface IKeyValueStorageOperations {
|
|
|
48
55
|
key: string;
|
|
49
56
|
value: any;
|
|
50
57
|
} | null>;
|
|
51
|
-
set(key: string, value: any, scope: string): Promise<void>;
|
|
58
|
+
set(key: string, value: any, scope: string, options?: IKeyValueStoreSetOptions): Promise<void>;
|
|
52
59
|
delete(key: string, scope: string): Promise<void>;
|
|
53
60
|
}
|
|
61
|
+
/** Storage operations for key-value persistence. */
|
|
54
62
|
export declare const KeyValueStorageOperations: import("@webiny/di").Abstraction<IKeyValueStorageOperations>;
|
|
55
63
|
export declare namespace KeyValueStorageOperations {
|
|
56
64
|
type Interface = IKeyValueStorageOperations;
|
|
@@ -2,18 +2,22 @@ import { createAbstraction } from "@webiny/feature/api";
|
|
|
2
2
|
|
|
3
3
|
// GlobalKeyValueStore - Non-tenant-aware service
|
|
4
4
|
|
|
5
|
+
/** Global (non-tenant-scoped) key-value store. */
|
|
5
6
|
export const GlobalKeyValueStore = createAbstraction("GlobalKeyValueStore");
|
|
6
7
|
|
|
7
8
|
// KeyValueStore - Tenant-aware service
|
|
8
9
|
|
|
10
|
+
/** Tenant-scoped key-value store. */
|
|
9
11
|
export const KeyValueStore = createAbstraction("KeyValueStore");
|
|
10
12
|
|
|
11
13
|
// Repository
|
|
12
14
|
|
|
15
|
+
/** Persist and retrieve key-value pairs. */
|
|
13
16
|
export const KeyValueStoreRepository = createAbstraction("KeyValueStoreRepository");
|
|
14
17
|
|
|
15
18
|
// Storage Operations
|
|
16
19
|
|
|
20
|
+
/** Storage operations for key-value persistence. */
|
|
17
21
|
export const KeyValueStorageOperations = createAbstraction("KeyValueStorageOperations");
|
|
18
22
|
|
|
19
23
|
//# sourceMappingURL=abstractions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createAbstraction","GlobalKeyValueStore","KeyValueStore","KeyValueStoreRepository","KeyValueStorageOperations"],"sources":["abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport { Result } from \"@webiny/feature/api\";\nimport { KeyNotFoundError, KeyValueStorageError } from \"./errors.js\";\n\nexport interface IKeyValueRecord {\n key: string;\n value: any;\n}\n\n// GlobalKeyValueStore - Non-tenant-aware service\nexport interface IGlobalKeyValueStoreOptions {\n scope?: string;\n}\n\nexport interface IGlobalKeyValueStore {\n get<T = unknown>(\n key: string,\n options?: IGlobalKeyValueStoreOptions\n ): Promise<Result<T, KeyValueStoreRepository.Error>>;\n set(\n key: string,\n value: any,\n options?: IGlobalKeyValueStoreOptions\n ): Promise<Result<void, KeyValueStoreRepository.Error>>;\n delete(\n key: string,\n options?: IGlobalKeyValueStoreOptions\n ): Promise<Result<void, KeyValueStoreRepository.Error>>;\n}\n\nexport const GlobalKeyValueStore = createAbstraction<IGlobalKeyValueStore>(\"GlobalKeyValueStore\");\n\nexport namespace GlobalKeyValueStore {\n export type Interface = IGlobalKeyValueStore;\n export type KeyValueRecord = IKeyValueRecord;\n export type Error = KeyValueStoreRepository.Error;\n}\n\n// KeyValueStore - Tenant-aware service\nexport interface IKeyValueStore {\n get<T = unknown>(key: string): Promise<Result<T, KeyValueStoreRepository.Error>>;\n set(key: string, value: any): Promise<Result<void, KeyValueStoreRepository.Error>>;\n delete(key: string): Promise<Result<void, KeyValueStoreRepository.Error>>;\n}\n\nexport const KeyValueStore = createAbstraction<IKeyValueStore>(\"KeyValueStore\");\n\nexport namespace KeyValueStore {\n export type Interface = IKeyValueStore;\n export type KeyValueRecord = IKeyValueRecord;\n export type Error = KeyValueStoreRepository.Error;\n}\n\n// Repository\n\nexport interface IKeyValueStoreRepositoryErrors {\n base: KeyNotFoundError | KeyValueStorageError;\n}\n\ntype RepositoryError = IKeyValueStoreRepositoryErrors[keyof IKeyValueStoreRepositoryErrors];\n\nexport interface IKeyValueStoreRepository {\n get<T = unknown>(key: string, scope: string): Promise<Result<T, RepositoryError>>;\n set(key: string
|
|
1
|
+
{"version":3,"names":["createAbstraction","GlobalKeyValueStore","KeyValueStore","KeyValueStoreRepository","KeyValueStorageOperations"],"sources":["abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport { Result } from \"@webiny/feature/api\";\nimport { KeyNotFoundError, KeyValueStorageError } from \"./errors.js\";\n\nexport interface IKeyValueRecord {\n key: string;\n value: any;\n}\n\n// GlobalKeyValueStore - Non-tenant-aware service\nexport interface IGlobalKeyValueStoreOptions {\n scope?: string;\n expiresAt?: Date;\n}\n\nexport interface IGlobalKeyValueStore {\n get<T = unknown>(\n key: string,\n options?: IGlobalKeyValueStoreOptions\n ): Promise<Result<T, KeyValueStoreRepository.Error>>;\n set(\n key: string,\n value: any,\n options?: IGlobalKeyValueStoreOptions\n ): Promise<Result<void, KeyValueStoreRepository.Error>>;\n delete(\n key: string,\n options?: IGlobalKeyValueStoreOptions\n ): Promise<Result<void, KeyValueStoreRepository.Error>>;\n}\n\n/** Global (non-tenant-scoped) key-value store. */\nexport const GlobalKeyValueStore = createAbstraction<IGlobalKeyValueStore>(\"GlobalKeyValueStore\");\n\nexport namespace GlobalKeyValueStore {\n export type Interface = IGlobalKeyValueStore;\n export type KeyValueRecord = IKeyValueRecord;\n export type Error = KeyValueStoreRepository.Error;\n}\n\n// KeyValueStore - Tenant-aware service\nexport interface IKeyValueStore {\n get<T = unknown>(key: string): Promise<Result<T, KeyValueStoreRepository.Error>>;\n set(key: string, value: any): Promise<Result<void, KeyValueStoreRepository.Error>>;\n delete(key: string): Promise<Result<void, KeyValueStoreRepository.Error>>;\n}\n\n/** Tenant-scoped key-value store. */\nexport const KeyValueStore = createAbstraction<IKeyValueStore>(\"KeyValueStore\");\n\nexport namespace KeyValueStore {\n export type Interface = IKeyValueStore;\n export type KeyValueRecord = IKeyValueRecord;\n export type Error = KeyValueStoreRepository.Error;\n}\n\n// Repository\n\nexport interface IKeyValueStoreRepositoryErrors {\n base: KeyNotFoundError | KeyValueStorageError;\n}\n\ntype RepositoryError = IKeyValueStoreRepositoryErrors[keyof IKeyValueStoreRepositoryErrors];\n\nexport interface IKeyValueStoreSetOptions {\n expiresAt?: Date;\n}\n\nexport interface IKeyValueStoreRepository {\n get<T = unknown>(key: string, scope: string): Promise<Result<T, RepositoryError>>;\n set(\n key: string,\n value: any,\n scope: string,\n options?: IKeyValueStoreSetOptions\n ): Promise<Result<void, RepositoryError>>;\n delete(key: string, scope: string): Promise<Result<void, RepositoryError>>;\n}\n\n/** Persist and retrieve key-value pairs. */\nexport const KeyValueStoreRepository =\n createAbstraction<IKeyValueStoreRepository>(\"KeyValueStoreRepository\");\n\nexport namespace KeyValueStoreRepository {\n export type Interface = IKeyValueStoreRepository;\n export type Error = RepositoryError;\n}\n\n// Storage Operations\n\nexport interface IKeyValueStorageOperations {\n get(key: string, scope: string): Promise<{ key: string; value: any } | null>;\n set(key: string, value: any, scope: string, options?: IKeyValueStoreSetOptions): Promise<void>;\n delete(key: string, scope: string): Promise<void>;\n}\n\n/** Storage operations for key-value persistence. */\nexport const KeyValueStorageOperations = createAbstraction<IKeyValueStorageOperations>(\n \"KeyValueStorageOperations\"\n);\n\nexport namespace KeyValueStorageOperations {\n export type Interface = IKeyValueStorageOperations;\n}\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,qBAAqB;;AASvD;;AAsBA;AACA,OAAO,MAAMC,mBAAmB,GAAGD,iBAAiB,CAAuB,qBAAqB,CAAC;;AAQjG;;AAOA;AACA,OAAO,MAAME,aAAa,GAAGF,iBAAiB,CAAiB,eAAe,CAAC;;AAQ/E;;AAuBA;AACA,OAAO,MAAMG,uBAAuB,GAChCH,iBAAiB,CAA2B,yBAAyB,CAAC;;AAO1E;;AAQA;AACA,OAAO,MAAMI,yBAAyB,GAAGJ,iBAAiB,CACtD,2BACJ,CAAC","ignoreList":[]}
|
|
@@ -1 +1,4 @@
|
|
|
1
|
-
export declare const KeyValueStoreFeature:
|
|
1
|
+
export declare const KeyValueStoreFeature: {
|
|
2
|
+
name: string;
|
|
3
|
+
register(container: import("@webiny/di").Container, context: import("./abstractions.js").IKeyValueStorageOperations): void;
|
|
4
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createFeature","GlobalKeyValueStore","KeyValueStore","KeyValueStoreRepository","KeyValueStorageOperations","KeyValueStoreFeature","name","register","container","storageOperations","registerInstance","inSingletonScope"],"sources":["feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { GlobalKeyValueStore } from \"./GlobalKeyValueStore.js\";\nimport { KeyValueStore } from \"./KeyValueStore.js\";\nimport { KeyValueStoreRepository } from \"./KeyValueStoreRepository.js\";\nimport { KeyValueStorageOperations } from \"./abstractions.js\";\n\nexport const KeyValueStoreFeature = createFeature({\n name: \"KeyValueStore\",\n register(container, storageOperations
|
|
1
|
+
{"version":3,"names":["createFeature","GlobalKeyValueStore","KeyValueStore","KeyValueStoreRepository","KeyValueStorageOperations","KeyValueStoreFeature","name","register","container","storageOperations","registerInstance","inSingletonScope"],"sources":["feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { GlobalKeyValueStore } from \"./GlobalKeyValueStore.js\";\nimport { KeyValueStore } from \"./KeyValueStore.js\";\nimport { KeyValueStoreRepository } from \"./KeyValueStoreRepository.js\";\nimport { KeyValueStorageOperations } from \"./abstractions.js\";\n\nexport const KeyValueStoreFeature = createFeature<KeyValueStorageOperations.Interface>({\n name: \"KeyValueStore\",\n register(container, storageOperations) {\n // Register legacy storage operations\n container.registerInstance(KeyValueStorageOperations, storageOperations);\n\n container.register(KeyValueStoreRepository).inSingletonScope();\n container.register(GlobalKeyValueStore);\n container.register(KeyValueStore);\n }\n});\n"],"mappings":"AAAA,SAASA,aAAa,QAAQ,qBAAqB;AACnD,SAASC,mBAAmB;AAC5B,SAASC,aAAa;AACtB,SAASC,uBAAuB;AAChC,SAASC,yBAAyB;AAElC,OAAO,MAAMC,oBAAoB,GAAGL,aAAa,CAAsC;EACnFM,IAAI,EAAE,eAAe;EACrBC,QAAQA,CAACC,SAAS,EAAEC,iBAAiB,EAAE;IACnC;IACAD,SAAS,CAACE,gBAAgB,CAACN,yBAAyB,EAAEK,iBAAiB,CAAC;IAExED,SAAS,CAACD,QAAQ,CAACJ,uBAAuB,CAAC,CAACQ,gBAAgB,CAAC,CAAC;IAC9DH,SAAS,CAACD,QAAQ,CAACN,mBAAmB,CAAC;IACvCO,SAAS,CAACD,QAAQ,CAACL,aAAa,CAAC;EACrC;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -7,6 +7,7 @@ export interface ILogger {
|
|
|
7
7
|
fatal(objOrMsg: object | string, ...args: any[]): void;
|
|
8
8
|
log(objOrMsg: object | string, ...args: any[]): void;
|
|
9
9
|
}
|
|
10
|
+
/** Structured logging with multiple log levels. */
|
|
10
11
|
export declare const Logger: import("@webiny/di").Abstraction<ILogger>;
|
|
11
12
|
export declare namespace Logger {
|
|
12
13
|
type Interface = ILogger;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createAbstraction","Logger"],"sources":["abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\n\nexport interface ILogger {\n // Basic logging levels\n trace(objOrMsg: object | string, ...args: any[]): void;\n debug(objOrMsg: object | string, ...args: any[]): void;\n info(objOrMsg: object | string, ...args: any[]): void;\n warn(objOrMsg: object | string, ...args: any[]): void;\n error(objOrMsg: object | string, ...args: any[]): void;\n fatal(objOrMsg: object | string, ...args: any[]): void;\n\n // Generic log (defaults to 'info')\n log(objOrMsg: object | string, ...args: any[]): void;\n}\n\nexport const Logger = createAbstraction<ILogger>(\"Logger\");\n\nexport namespace Logger {\n export type Interface = ILogger;\n}\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,qBAAqB;AAevD,OAAO,MAAMC,MAAM,GAAGD,iBAAiB,CAAU,QAAQ,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["createAbstraction","Logger"],"sources":["abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\n\nexport interface ILogger {\n // Basic logging levels\n trace(objOrMsg: object | string, ...args: any[]): void;\n debug(objOrMsg: object | string, ...args: any[]): void;\n info(objOrMsg: object | string, ...args: any[]): void;\n warn(objOrMsg: object | string, ...args: any[]): void;\n error(objOrMsg: object | string, ...args: any[]): void;\n fatal(objOrMsg: object | string, ...args: any[]): void;\n\n // Generic log (defaults to 'info')\n log(objOrMsg: object | string, ...args: any[]): void;\n}\n\n/** Structured logging with multiple log levels. */\nexport const Logger = createAbstraction<ILogger>(\"Logger\");\n\nexport namespace Logger {\n export type Interface = ILogger;\n}\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,qBAAqB;AAevD;AACA,OAAO,MAAMC,MAAM,GAAGD,iBAAiB,CAAU,QAAQ,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Masker } from "./abstractions.js";
|
|
2
|
+
declare class MaskerImpl implements Masker.Interface {
|
|
3
|
+
mask(value: string, pattern?: number[]): string;
|
|
4
|
+
}
|
|
5
|
+
declare const _default: typeof MaskerImpl & {
|
|
6
|
+
__abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").IMasker>;
|
|
7
|
+
};
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Masker } from "./abstractions.js";
|
|
2
|
+
class MaskerImpl {
|
|
3
|
+
mask(value, pattern) {
|
|
4
|
+
if (!pattern) {
|
|
5
|
+
return "●".repeat(value.length);
|
|
6
|
+
}
|
|
7
|
+
const [start = 0, end = 0] = pattern;
|
|
8
|
+
if (start + end >= value.length) {
|
|
9
|
+
return "●".repeat(12);
|
|
10
|
+
}
|
|
11
|
+
const prefix = value.slice(0, start);
|
|
12
|
+
const suffix = end > 0 ? value.slice(-end) : "";
|
|
13
|
+
return `${prefix}${"●".repeat(12)}${suffix}`;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
export default Masker.createImplementation({
|
|
17
|
+
implementation: MaskerImpl,
|
|
18
|
+
dependencies: []
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
//# sourceMappingURL=Masker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Masker","MaskerImpl","mask","value","pattern","repeat","length","start","end","prefix","slice","suffix","createImplementation","implementation","dependencies"],"sources":["Masker.ts"],"sourcesContent":["import { Masker } from \"./abstractions.js\";\n\nclass MaskerImpl implements Masker.Interface {\n mask(value: string, pattern?: number[]): string {\n if (!pattern) {\n return \"●\".repeat(value.length);\n }\n\n const [start = 0, end = 0] = pattern;\n if (start + end >= value.length) {\n return \"●\".repeat(12);\n }\n\n const prefix = value.slice(0, start);\n const suffix = end > 0 ? value.slice(-end) : \"\";\n return `${prefix}${\"●\".repeat(12)}${suffix}`;\n }\n}\n\nexport default Masker.createImplementation({\n implementation: MaskerImpl,\n dependencies: []\n});\n"],"mappings":"AAAA,SAASA,MAAM;AAEf,MAAMC,UAAU,CAA6B;EACzCC,IAAIA,CAACC,KAAa,EAAEC,OAAkB,EAAU;IAC5C,IAAI,CAACA,OAAO,EAAE;MACV,OAAO,GAAG,CAACC,MAAM,CAACF,KAAK,CAACG,MAAM,CAAC;IACnC;IAEA,MAAM,CAACC,KAAK,GAAG,CAAC,EAAEC,GAAG,GAAG,CAAC,CAAC,GAAGJ,OAAO;IACpC,IAAIG,KAAK,GAAGC,GAAG,IAAIL,KAAK,CAACG,MAAM,EAAE;MAC7B,OAAO,GAAG,CAACD,MAAM,CAAC,EAAE,CAAC;IACzB;IAEA,MAAMI,MAAM,GAAGN,KAAK,CAACO,KAAK,CAAC,CAAC,EAAEH,KAAK,CAAC;IACpC,MAAMI,MAAM,GAAGH,GAAG,GAAG,CAAC,GAAGL,KAAK,CAACO,KAAK,CAAC,CAACF,GAAG,CAAC,GAAG,EAAE;IAC/C,OAAO,GAAGC,MAAM,GAAG,GAAG,CAACJ,MAAM,CAAC,EAAE,CAAC,GAAGM,MAAM,EAAE;EAChD;AACJ;AAEA,eAAeX,MAAM,CAACY,oBAAoB,CAAC;EACvCC,cAAc,EAAEZ,UAAU;EAC1Ba,YAAY,EAAE;AAClB,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface IMasker {
|
|
2
|
+
/**
|
|
3
|
+
* @param value Value to mask
|
|
4
|
+
* @param mask Masking pattern. The first number represents visible characters from the start, second - from the end.
|
|
5
|
+
*/
|
|
6
|
+
mask(value: string, mask?: number[]): string;
|
|
7
|
+
}
|
|
8
|
+
export declare const Masker: import("@webiny/di").Abstraction<IMasker>;
|
|
9
|
+
export declare namespace Masker {
|
|
10
|
+
type Interface = IMasker;
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createAbstraction","Masker"],"sources":["abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\n\nexport interface IMasker {\n /**\n * @param value Value to mask\n * @param mask Masking pattern. The first number represents visible characters from the start, second - from the end.\n */\n mask(value: string, mask?: number[]): string;\n}\n\nexport const Masker = createAbstraction<IMasker>(\"Masker\");\n\nexport namespace Masker {\n export type Interface = IMasker;\n}\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,qBAAqB;AAUvD,OAAO,MAAMC,MAAM,GAAGD,iBAAiB,CAAU,QAAQ,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createFeature } from "@webiny/feature/api";
|
|
2
|
+
import MaskerImplementation from "./Masker.js";
|
|
3
|
+
export const MaskerFeature = createFeature({
|
|
4
|
+
name: "MaskerFeature",
|
|
5
|
+
register(container) {
|
|
6
|
+
container.register(MaskerImplementation);
|
|
7
|
+
}
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
//# sourceMappingURL=feature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createFeature","MaskerImplementation","MaskerFeature","name","register","container"],"sources":["feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport MaskerImplementation from \"./Masker.js\";\n\nexport const MaskerFeature = createFeature({\n name: \"MaskerFeature\",\n register(container) {\n container.register(MaskerImplementation);\n }\n});\n"],"mappings":"AAAA,SAASA,aAAa,QAAQ,qBAAqB;AACnD,OAAOC,oBAAoB;AAE3B,OAAO,MAAMC,aAAa,GAAGF,aAAa,CAAC;EACvCG,IAAI,EAAE,eAAe;EACrBC,QAAQA,CAACC,SAAS,EAAE;IAChBA,SAAS,CAACD,QAAQ,CAACH,oBAAoB,CAAC;EAC5C;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Masker } from "./abstractions.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Masker"],"sources":["index.ts"],"sourcesContent":["export { Masker } from \"./abstractions.js\";\n"],"mappings":"AAAA,SAASA,MAAM","ignoreList":[]}
|
|
@@ -11,6 +11,7 @@ export interface IIdentityContext {
|
|
|
11
11
|
withoutAuthorization<T>(cb: () => Promise<T>): Promise<T>;
|
|
12
12
|
isAuthorizationEnabled(): boolean;
|
|
13
13
|
}
|
|
14
|
+
/** Provides access to the current identity and its permissions. */
|
|
14
15
|
export declare const IdentityContext: import("@webiny/di").Abstraction<IIdentityContext>;
|
|
15
16
|
export declare namespace IdentityContext {
|
|
16
17
|
type Interface = IIdentityContext;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createAbstraction","IdentityContext"],"sources":["abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { Identity } from \"./Identity.js\";\nimport type { SecurityPermission } from \"~/types/security.js\";\n\nexport interface IIdentityContext {\n // Identity methods\n getIdentity(): Identity;\n setIdentity(identity: Identity | undefined): void;\n withIdentity<T>(identity: Identity | undefined, cb: () => Promise<T>): Promise<T>;\n\n // Permission methods\n getPermission<TPermission extends SecurityPermission = SecurityPermission>(\n name: string\n ): Promise<TPermission | null>;\n\n getPermissions<TPermission extends SecurityPermission = SecurityPermission>(\n name: string\n ): Promise<TPermission[]>;\n\n listPermissions(): Promise<SecurityPermission[]>;\n\n hasFullAccess(): Promise<boolean>;\n\n // Authorization context methods\n withoutAuthorization<T>(cb: () => Promise<T>): Promise<T>;\n isAuthorizationEnabled(): boolean;\n}\n\nexport const IdentityContext = createAbstraction<IIdentityContext>(\"IdentityContext\");\n\nexport namespace IdentityContext {\n export type Interface = IIdentityContext;\n}\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,qBAAqB;AA4BvD,OAAO,MAAMC,eAAe,GAAGD,iBAAiB,CAAmB,iBAAiB,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["createAbstraction","IdentityContext"],"sources":["abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { Identity } from \"./Identity.js\";\nimport type { SecurityPermission } from \"~/types/security.js\";\n\nexport interface IIdentityContext {\n // Identity methods\n getIdentity(): Identity;\n setIdentity(identity: Identity | undefined): void;\n withIdentity<T>(identity: Identity | undefined, cb: () => Promise<T>): Promise<T>;\n\n // Permission methods\n getPermission<TPermission extends SecurityPermission = SecurityPermission>(\n name: string\n ): Promise<TPermission | null>;\n\n getPermissions<TPermission extends SecurityPermission = SecurityPermission>(\n name: string\n ): Promise<TPermission[]>;\n\n listPermissions(): Promise<SecurityPermission[]>;\n\n hasFullAccess(): Promise<boolean>;\n\n // Authorization context methods\n withoutAuthorization<T>(cb: () => Promise<T>): Promise<T>;\n isAuthorizationEnabled(): boolean;\n}\n\n/** Provides access to the current identity and its permissions. */\nexport const IdentityContext = createAbstraction<IIdentityContext>(\"IdentityContext\");\n\nexport namespace IdentityContext {\n export type Interface = IIdentityContext;\n}\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,qBAAqB;AA4BvD;AACA,OAAO,MAAMC,eAAe,GAAGD,iBAAiB,CAAmB,iBAAiB,CAAC","ignoreList":[]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Container } from "@webiny/di";
|
|
1
2
|
import type { SecurityStorageOperations as ISecurityStorageOperations } from "../../types/security.js";
|
|
2
3
|
/**
|
|
3
4
|
* Setup all security features in the DI container.
|
|
@@ -6,4 +7,7 @@ import type { SecurityStorageOperations as ISecurityStorageOperations } from "..
|
|
|
6
7
|
* @param container - DI container instance
|
|
7
8
|
* @param storageOperations - Storage operations implementation
|
|
8
9
|
*/
|
|
9
|
-
export declare const SecurityFeature:
|
|
10
|
+
export declare const SecurityFeature: {
|
|
11
|
+
name: string;
|
|
12
|
+
register(container: Container, context: ISecurityStorageOperations): void;
|
|
13
|
+
};
|
|
@@ -21,7 +21,7 @@ class CreateApiKeyUseCaseImpl {
|
|
|
21
21
|
}
|
|
22
22
|
const validation = createApiKeyInputSchema.safeParse(input);
|
|
23
23
|
if (!validation.success) {
|
|
24
|
-
return Result.fail(new ApiKeyValidationError(validation.error.
|
|
24
|
+
return Result.fail(new ApiKeyValidationError(validation.error.issues[0].message));
|
|
25
25
|
}
|
|
26
26
|
const token = generateToken();
|
|
27
27
|
const identity = this.identityContext.getIdentity();
|