@webiny/api-core 6.6.0-alpha.1 → 6.6.0-alpha.11
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.js +10 -2
- package/ApiCoreFeature.js.map +1 -1
- package/exports/api/tasks.d.ts +1 -0
- package/exports/api/tasks.js +1 -1
- package/exports/api.d.ts +2 -1
- package/exports/api.js +2 -1
- package/features/ai/Ai.d.ts +3 -1
- package/features/ai/Ai.js +36 -28
- package/features/ai/Ai.js.map +1 -1
- package/features/ai/AiModelRegistry.d.ts +14 -0
- package/features/ai/AiModelRegistry.js +39 -0
- package/features/ai/AiModelRegistry.js.map +1 -0
- package/features/ai/AiSdkToolHandlerResolver.d.ts +11 -0
- package/features/ai/AiSdkToolHandlerResolver.js +19 -0
- package/features/ai/AiSdkToolHandlerResolver.js.map +1 -0
- package/features/ai/AiSdkTools.d.ts +4 -3
- package/features/ai/AiSdkTools.js +11 -9
- package/features/ai/AiSdkTools.js.map +1 -1
- package/features/ai/AnthropicSdkFactory.js +12 -4
- package/features/ai/AnthropicSdkFactory.js.map +1 -1
- package/features/ai/DEVELOPERS.md +183 -0
- package/features/ai/GoogleSdkFactory.d.ts +10 -0
- package/features/ai/GoogleSdkFactory.js +65 -0
- package/features/ai/GoogleSdkFactory.js.map +1 -0
- package/features/ai/OpenAiSdkFactory.js +51 -11
- package/features/ai/OpenAiSdkFactory.js.map +1 -1
- package/features/ai/OpenRouterSdkFactory.d.ts +10 -0
- package/features/ai/OpenRouterSdkFactory.js +112 -0
- package/features/ai/OpenRouterSdkFactory.js.map +1 -0
- package/features/ai/RemoteAiModelCatalog.d.ts +13 -0
- package/features/ai/RemoteAiModelCatalog.js +74 -0
- package/features/ai/RemoteAiModelCatalog.js.map +1 -0
- package/features/ai/abstractions.d.ts +82 -6
- package/features/ai/abstractions.js +6 -2
- package/features/ai/abstractions.js.map +1 -1
- package/features/ai/feature.js +10 -0
- package/features/ai/feature.js.map +1 -1
- package/features/ai/index.d.ts +2 -4
- package/features/ai/index.js +1 -1
- package/features/cdnCache/NullCdnCache.d.ts +8 -0
- package/features/cdnCache/NullCdnCache.js +11 -0
- package/features/cdnCache/NullCdnCache.js.map +1 -0
- package/features/cdnCache/abstractions.d.ts +20 -0
- package/features/cdnCache/abstractions.js +5 -0
- package/features/cdnCache/abstractions.js.map +1 -0
- package/features/cdnCache/feature.d.ts +8 -0
- package/features/cdnCache/feature.js +11 -0
- package/features/cdnCache/feature.js.map +1 -0
- package/features/cdnCache/index.d.ts +2 -0
- package/features/cdnCache/index.js +2 -0
- package/features/debugger/Debugger.d.ts +30 -0
- package/features/debugger/Debugger.js +142 -0
- package/features/debugger/Debugger.js.map +1 -0
- package/features/debugger/DebuggerRouteDecorator.d.ts +45 -0
- package/features/debugger/DebuggerRouteDecorator.js +102 -0
- package/features/debugger/DebuggerRouteDecorator.js.map +1 -0
- package/features/debugger/GraphQLDebuggerTransport.d.ts +28 -0
- package/features/debugger/GraphQLDebuggerTransport.js +45 -0
- package/features/debugger/GraphQLDebuggerTransport.js.map +1 -0
- package/features/debugger/__tests__/matchNamespace.test.d.ts +1 -0
- package/features/debugger/__tests__/matchNamespace.test.js +68 -0
- package/features/debugger/__tests__/matchNamespace.test.js.map +1 -0
- package/features/debugger/__tests__/serialize.test.d.ts +1 -0
- package/features/debugger/__tests__/serialize.test.js +220 -0
- package/features/debugger/__tests__/serialize.test.js.map +1 -0
- package/features/debugger/abstractions.d.ts +100 -0
- package/features/debugger/abstractions.js +6 -0
- package/features/debugger/abstractions.js.map +1 -0
- package/features/debugger/feature.d.ts +5 -0
- package/features/debugger/feature.js +15 -0
- package/features/debugger/feature.js.map +1 -0
- package/features/debugger/index.d.ts +12 -0
- package/features/debugger/index.js +7 -0
- package/features/debugger/limits.d.ts +18 -0
- package/features/debugger/limits.js +11 -0
- package/features/debugger/limits.js.map +1 -0
- package/features/debugger/matchNamespace.d.ts +14 -0
- package/features/debugger/matchNamespace.js +35 -0
- package/features/debugger/matchNamespace.js.map +1 -0
- package/features/debugger/parseNamespaceHeader.d.ts +7 -0
- package/features/debugger/parseNamespaceHeader.js +16 -0
- package/features/debugger/parseNamespaceHeader.js.map +1 -0
- package/features/debugger/permissions.d.ts +14 -0
- package/features/debugger/permissions.js +8 -0
- package/features/debugger/permissions.js.map +1 -0
- package/features/debugger/permissionsSchema.d.ts +17 -0
- package/features/debugger/permissionsSchema.js +18 -0
- package/features/debugger/permissionsSchema.js.map +1 -0
- package/features/debugger/serialize.d.ts +11 -0
- package/features/debugger/serialize.js +121 -0
- package/features/debugger/serialize.js.map +1 -0
- package/features/encryption/BuildParamsEncryptionConfig.d.ts +13 -0
- package/features/encryption/BuildParamsEncryptionConfig.js +19 -0
- package/features/encryption/BuildParamsEncryptionConfig.js.map +1 -0
- package/features/encryption/EncryptionKeyCacheFeature.d.ts +8 -0
- package/features/encryption/EncryptionKeyCacheFeature.js +11 -0
- package/features/encryption/EncryptionKeyCacheFeature.js.map +1 -0
- package/features/encryption/EncryptionService.d.ts +3 -2
- package/features/encryption/EncryptionService.js +15 -13
- package/features/encryption/EncryptionService.js.map +1 -1
- package/features/encryption/MemoryEncryptionKeyCache.d.ts +13 -0
- package/features/encryption/MemoryEncryptionKeyCache.js +26 -0
- package/features/encryption/MemoryEncryptionKeyCache.js.map +1 -0
- package/features/encryption/abstractions.d.ts +26 -0
- package/features/encryption/abstractions.js +3 -1
- package/features/encryption/abstractions.js.map +1 -1
- package/features/encryption/feature.js +2 -0
- package/features/encryption/feature.js.map +1 -1
- package/features/encryption/index.d.ts +3 -0
- package/features/encryption/index.js +3 -1
- package/features/featureFlags/decorators/FeatureFlagsWithLicenseDecorator.js +13 -1
- package/features/featureFlags/decorators/FeatureFlagsWithLicenseDecorator.js.map +1 -1
- package/features/hashing/BuildParamsHashingConfig.d.ts +11 -0
- package/features/hashing/BuildParamsHashingConfig.js +18 -0
- package/features/hashing/BuildParamsHashingConfig.js.map +1 -0
- package/features/hashing/ScryptHasher.d.ts +2 -2
- package/features/hashing/ScryptHasher.js +6 -8
- package/features/hashing/ScryptHasher.js.map +1 -1
- package/features/hashing/abstractions.d.ts +15 -0
- package/features/hashing/abstractions.js +2 -1
- package/features/hashing/abstractions.js.map +1 -1
- package/features/hashing/feature.js +2 -0
- package/features/hashing/feature.js.map +1 -1
- package/features/hashing/index.d.ts +1 -0
- package/features/hashing/index.js +1 -1
- package/features/httpClient/HttpClient.d.ts +7 -0
- package/features/httpClient/HttpClient.js +72 -0
- package/features/httpClient/HttpClient.js.map +1 -0
- package/features/httpClient/HttpRequestError.d.ts +10 -0
- package/features/httpClient/HttpRequestError.js +13 -0
- package/features/httpClient/HttpRequestError.js.map +1 -0
- package/features/httpClient/HttpStatusError.d.ts +12 -0
- package/features/httpClient/HttpStatusError.js +12 -0
- package/features/httpClient/HttpStatusError.js.map +1 -0
- package/features/httpClient/abstractions.d.ts +32 -0
- package/features/httpClient/abstractions.js +5 -0
- package/features/httpClient/abstractions.js.map +1 -0
- package/features/{logger → httpClient}/feature.d.ts +1 -1
- package/features/httpClient/feature.js +11 -0
- package/features/httpClient/feature.js.map +1 -0
- package/features/httpClient/index.d.ts +3 -0
- package/features/httpClient/index.js +3 -0
- package/features/keyValueStore/GlobalKeyValueStore.d.ts +9 -3
- package/features/keyValueStore/GlobalKeyValueStore.js +12 -2
- package/features/keyValueStore/GlobalKeyValueStore.js.map +1 -1
- package/features/keyValueStore/KeyValueStore.d.ts +6 -2
- package/features/keyValueStore/KeyValueStore.js +13 -3
- package/features/keyValueStore/KeyValueStore.js.map +1 -1
- package/features/keyValueStore/KeyValueStoreRepository.d.ts +8 -2
- package/features/keyValueStore/KeyValueStoreRepository.js +82 -4
- package/features/keyValueStore/KeyValueStoreRepository.js.map +1 -1
- package/features/keyValueStore/abstractions.d.ts +132 -14
- package/features/keyValueStore/abstractions.js.map +1 -1
- package/features/keyValueStore/errors.d.ts +29 -0
- package/features/keyValueStore/errors.js +49 -1
- package/features/keyValueStore/errors.js.map +1 -1
- package/features/keyValueStore/index.d.ts +4 -1
- package/features/keyValueStore/index.js +1 -1
- package/features/logger/NullLogger.d.ts +10 -0
- package/features/logger/NullLogger.js +12 -0
- package/features/logger/NullLogger.js.map +1 -0
- package/features/logger/index.d.ts +1 -0
- package/features/logger/index.js +1 -0
- package/features/publicUrls/NullPublicUrls.d.ts +11 -0
- package/features/publicUrls/NullPublicUrls.js +17 -0
- package/features/publicUrls/NullPublicUrls.js.map +1 -0
- package/features/publicUrls/PublicUrl.d.ts +24 -0
- package/features/publicUrls/PublicUrl.js +43 -0
- package/features/publicUrls/PublicUrl.js.map +1 -0
- package/features/publicUrls/__tests__/PublicUrl.test.d.ts +1 -0
- package/features/publicUrls/__tests__/PublicUrl.test.js +38 -0
- package/features/publicUrls/__tests__/PublicUrl.test.js.map +1 -0
- package/features/publicUrls/__tests__/PublicUrls.test.d.ts +1 -0
- package/features/publicUrls/__tests__/PublicUrls.test.js +14 -0
- package/features/publicUrls/__tests__/PublicUrls.test.js.map +1 -0
- package/features/publicUrls/abstractions.d.ts +27 -0
- package/features/publicUrls/abstractions.js +5 -0
- package/features/publicUrls/abstractions.js.map +1 -0
- package/features/publicUrls/feature.d.ts +8 -0
- package/features/publicUrls/feature.js +11 -0
- package/features/publicUrls/feature.js.map +1 -0
- package/features/publicUrls/index.d.ts +3 -0
- package/features/publicUrls/index.js +3 -0
- package/features/requestContext/RawAssumePermissions.d.ts +14 -0
- package/features/requestContext/RawAssumePermissions.js +19 -0
- package/features/requestContext/RawAssumePermissions.js.map +1 -0
- package/features/requestContext/abstractions.d.ts +22 -0
- package/features/requestContext/abstractions.js +2 -1
- package/features/requestContext/abstractions.js.map +1 -1
- package/features/requestContext/extractAssumePermissions.d.ts +14 -0
- package/features/requestContext/extractAssumePermissions.js +32 -0
- package/features/requestContext/extractAssumePermissions.js.map +1 -0
- package/features/requestContext/feature.d.ts +2 -1
- package/features/requestContext/feature.js +2 -0
- package/features/requestContext/feature.js.map +1 -1
- package/features/requestContext/index.d.ts +3 -1
- package/features/requestContext/index.js +2 -1
- package/features/requestStorage/abstractions.d.ts +23 -0
- package/features/requestStorage/abstractions.js +5 -0
- package/features/requestStorage/abstractions.js.map +1 -0
- package/features/requestStorage/index.d.ts +1 -0
- package/features/requestStorage/index.js +1 -0
- package/features/security/IdentityContext/IdentityContext.d.ts +6 -2
- package/features/security/IdentityContext/IdentityContext.js +24 -7
- package/features/security/IdentityContext/IdentityContext.js.map +1 -1
- package/features/security/IdentityContext/abstractions.d.ts +6 -1
- package/features/security/IdentityContext/abstractions.js.map +1 -1
- package/features/security/authorization/AuthorizationContext/AuthorizationContext.d.ts +13 -3
- package/features/security/authorization/AuthorizationContext/AuthorizationContext.js +35 -22
- 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.map +1 -1
- package/features/security/authorization/AuthorizationContext/feature.js +6 -1
- package/features/security/authorization/AuthorizationContext/feature.js.map +1 -1
- package/features/security/authorization/GroupsTeamsAuthorizer/AssumedPermissions.d.ts +30 -0
- package/features/security/authorization/GroupsTeamsAuthorizer/AssumedPermissions.js +60 -0
- package/features/security/authorization/GroupsTeamsAuthorizer/AssumedPermissions.js.map +1 -0
- package/features/security/authorization/GroupsTeamsAuthorizer/feature.js +2 -0
- package/features/security/authorization/GroupsTeamsAuthorizer/feature.js.map +1 -1
- package/features/security/roles/Installer/RolesInstaller.js +1 -0
- package/features/security/roles/Installer/RolesInstaller.js.map +1 -1
- package/features/security/roles/NotifyRoleChange/NotifyOnRoleCreatedHandler.d.ts +11 -0
- package/features/security/roles/NotifyRoleChange/NotifyOnRoleCreatedHandler.js +22 -0
- package/features/security/roles/NotifyRoleChange/NotifyOnRoleCreatedHandler.js.map +1 -0
- package/features/security/roles/NotifyRoleChange/NotifyOnRoleDeletedHandler.d.ts +11 -0
- package/features/security/roles/NotifyRoleChange/NotifyOnRoleDeletedHandler.js +22 -0
- package/features/security/roles/NotifyRoleChange/NotifyOnRoleDeletedHandler.js.map +1 -0
- package/features/security/roles/NotifyRoleChange/NotifyOnRoleUpdatedHandler.d.ts +11 -0
- package/features/security/roles/NotifyRoleChange/NotifyOnRoleUpdatedHandler.js +22 -0
- package/features/security/roles/NotifyRoleChange/NotifyOnRoleUpdatedHandler.js.map +1 -0
- package/features/security/roles/NotifyRoleChange/NotifyRoleChangeUseCase.d.ts +11 -0
- package/features/security/roles/NotifyRoleChange/NotifyRoleChangeUseCase.js +40 -0
- package/features/security/roles/NotifyRoleChange/NotifyRoleChangeUseCase.js.map +1 -0
- package/features/security/roles/NotifyRoleChange/abstractions.d.ts +21 -0
- package/features/security/roles/NotifyRoleChange/abstractions.js +8 -0
- package/features/security/roles/NotifyRoleChange/abstractions.js.map +1 -0
- package/features/security/roles/NotifyRoleChange/feature.d.ts +5 -0
- package/features/security/roles/NotifyRoleChange/feature.js +17 -0
- package/features/security/roles/NotifyRoleChange/feature.js.map +1 -0
- package/features/security/roles/NotifyRoleChange/index.d.ts +2 -0
- package/features/security/roles/NotifyRoleChange/index.js +2 -0
- package/features/security/roles/UpdateRole/UpdateRoleUseCase.js +2 -1
- package/features/security/roles/UpdateRole/UpdateRoleUseCase.js.map +1 -1
- package/features/security/roles/feature.js +2 -0
- package/features/security/roles/feature.js.map +1 -1
- package/features/security/shared/definedOnly.d.ts +1 -0
- package/features/security/shared/definedOnly.js +8 -0
- package/features/security/shared/definedOnly.js.map +1 -0
- package/features/security/shared/index.d.ts +1 -0
- package/features/security/shared/index.js +1 -0
- package/features/security/teams/NotifyTeamChange/NotifyOnTeamChangeHandlers.d.ts +29 -0
- package/features/security/teams/NotifyTeamChange/NotifyOnTeamChangeHandlers.js +58 -0
- package/features/security/teams/NotifyTeamChange/NotifyOnTeamChangeHandlers.js.map +1 -0
- package/features/security/teams/NotifyTeamChange/NotifyTeamChangeUseCase.d.ts +11 -0
- package/features/security/teams/NotifyTeamChange/NotifyTeamChangeUseCase.js +40 -0
- package/features/security/teams/NotifyTeamChange/NotifyTeamChangeUseCase.js.map +1 -0
- package/features/security/teams/NotifyTeamChange/abstractions.d.ts +21 -0
- package/features/security/teams/NotifyTeamChange/abstractions.js +8 -0
- package/features/security/teams/NotifyTeamChange/abstractions.js.map +1 -0
- package/features/security/teams/NotifyTeamChange/feature.d.ts +5 -0
- package/features/security/teams/NotifyTeamChange/feature.js +15 -0
- package/features/security/teams/NotifyTeamChange/feature.js.map +1 -0
- package/features/security/teams/NotifyTeamChange/index.d.ts +2 -0
- package/features/security/teams/NotifyTeamChange/index.js +2 -0
- package/features/security/teams/UpdateTeam/UpdateTeamUseCase.js +2 -1
- package/features/security/teams/UpdateTeam/UpdateTeamUseCase.js.map +1 -1
- package/features/security/teams/feature.js +2 -0
- package/features/security/teams/feature.js.map +1 -1
- package/features/task/TaskDefinition/abstractions.d.ts +13 -20
- package/features/task/TaskDefinition/abstractions.js.map +1 -1
- package/features/task/TaskService/abstractions.d.ts +7 -0
- package/features/task/TaskService/abstractions.js.map +1 -1
- package/features/tenancy/TenantContext/TenantContext.d.ts +5 -1
- package/features/tenancy/TenantContext/TenantContext.js +31 -23
- package/features/tenancy/TenantContext/TenantContext.js.map +1 -1
- package/features/users/shared/loaders.js.map +1 -1
- package/features/users/shared/types.d.ts +9 -7
- package/features/wcp/WcpContext/WcpContext.d.ts +6 -1
- package/features/wcp/WcpContext/WcpContext.js +17 -2
- package/features/wcp/WcpContext/WcpContext.js.map +1 -1
- package/features/wcp/WcpContext/decorators/WcpContextWithFeatureFlagsDecorator.d.ts +9 -73
- package/features/wcp/WcpContext/decorators/WcpContextWithFeatureFlagsDecorator.js +25 -5
- package/features/wcp/WcpContext/decorators/WcpContextWithFeatureFlagsDecorator.js.map +1 -1
- package/features/wcp/WcpLicenseLoader.js.map +1 -1
- package/features/wcp/resolveWcpProjectEnvironment.d.ts +1 -1
- package/features/wcp/resolveWcpProjectEnvironment.js.map +1 -1
- package/features/websockets/SendToIdentity/NullSendToIdentityUseCase.d.ts +20 -0
- package/features/websockets/SendToIdentity/NullSendToIdentityUseCase.js +24 -0
- package/features/websockets/SendToIdentity/NullSendToIdentityUseCase.js.map +1 -0
- package/features/websockets/SendToIdentity/abstractions.d.ts +19 -0
- package/features/websockets/SendToIdentity/abstractions.js +5 -0
- package/features/websockets/SendToIdentity/abstractions.js.map +1 -0
- package/features/websockets/WebsocketServiceError.d.ts +7 -0
- package/features/websockets/WebsocketServiceError.js +14 -0
- package/features/websockets/WebsocketServiceError.js.map +1 -0
- package/features/websockets/index.d.ts +6 -0
- package/features/websockets/index.js +3 -0
- package/features/websockets/types.d.ts +15 -0
- package/features/websockets/types.js +0 -0
- package/graphql/ApiCoreSchemaFactory.d.ts +1 -0
- package/graphql/ApiCoreSchemaFactory.js +7 -1
- package/graphql/ApiCoreSchemaFactory.js.map +1 -1
- package/graphql/featureFlags/FeatureFlagsSchemaFactory.d.ts +1 -0
- package/graphql/featureFlags/FeatureFlagsSchemaFactory.js +4 -0
- package/graphql/featureFlags/FeatureFlagsSchemaFactory.js.map +1 -1
- package/graphql/security/SecuritySchemaFactory.d.ts +1 -0
- package/graphql/security/SecuritySchemaFactory.js +4 -0
- package/graphql/security/SecuritySchemaFactory.js.map +1 -1
- package/graphql/system/SystemSchemaFactory.d.ts +1 -0
- package/graphql/system/SystemSchemaFactory.js +4 -0
- package/graphql/system/SystemSchemaFactory.js.map +1 -1
- package/graphql/users/UsersSchemaFactory.d.ts +1 -0
- package/graphql/users/UsersSchemaFactory.js +4 -0
- package/graphql/users/UsersSchemaFactory.js.map +1 -1
- package/graphql/wcp/WcpSchemaFactory.d.ts +1 -0
- package/graphql/wcp/WcpSchemaFactory.js +5 -1
- package/graphql/wcp/WcpSchemaFactory.js.map +1 -1
- package/idp/JwksCache.d.ts +14 -3
- package/idp/JwksCache.js +97 -17
- package/idp/JwksCache.js.map +1 -1
- package/idp/JwksStoreFeature.d.ts +8 -0
- package/idp/JwksStoreFeature.js +11 -0
- package/idp/JwksStoreFeature.js.map +1 -0
- package/idp/MemoryJwksStore.d.ts +14 -0
- package/idp/MemoryJwksStore.js +21 -0
- package/idp/MemoryJwksStore.js.map +1 -0
- package/idp/OidcJwtIdentityProvider.js +5 -1
- package/idp/OidcJwtIdentityProvider.js.map +1 -1
- package/idp/abstractions.d.ts +24 -0
- package/idp/abstractions.js +2 -1
- package/idp/abstractions.js.map +1 -1
- package/idp/feature.js +1 -2
- package/idp/feature.js.map +1 -1
- package/idp/index.d.ts +1 -0
- package/idp/index.js +1 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/package.json +21 -21
- package/types/users.d.ts +2 -3
- package/features/logger/LoggerService.d.ts +0 -14
- package/features/logger/LoggerService.js +0 -48
- package/features/logger/LoggerService.js.map +0 -1
- package/features/logger/feature.js +0 -11
- package/features/logger/feature.js.map +0 -1
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { RoleAfterUpdateEventHandler } from "../UpdateRole/index.js";
|
|
2
|
+
import { NotifyRoleChangeUseCase } from "./abstractions.js";
|
|
3
|
+
class NotifyOnRoleUpdatedHandlerImpl {
|
|
4
|
+
constructor(notifyRoleChange){
|
|
5
|
+
this.notifyRoleChange = notifyRoleChange;
|
|
6
|
+
}
|
|
7
|
+
async handle(event) {
|
|
8
|
+
await this.notifyRoleChange.execute({
|
|
9
|
+
id: event.payload.updated.id,
|
|
10
|
+
change: "updated"
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
const NotifyOnRoleUpdatedHandler = RoleAfterUpdateEventHandler.createImplementation({
|
|
15
|
+
implementation: NotifyOnRoleUpdatedHandlerImpl,
|
|
16
|
+
dependencies: [
|
|
17
|
+
NotifyRoleChangeUseCase
|
|
18
|
+
]
|
|
19
|
+
});
|
|
20
|
+
export { NotifyOnRoleUpdatedHandler };
|
|
21
|
+
|
|
22
|
+
//# sourceMappingURL=NotifyOnRoleUpdatedHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/security/roles/NotifyRoleChange/NotifyOnRoleUpdatedHandler.js","sources":["../../../../../src/features/security/roles/NotifyRoleChange/NotifyOnRoleUpdatedHandler.ts"],"sourcesContent":["import { RoleAfterUpdateEventHandler } from \"~/features/security/roles/UpdateRole/index.js\";\nimport { NotifyRoleChangeUseCase } from \"./abstractions.js\";\n\nclass NotifyOnRoleUpdatedHandlerImpl implements RoleAfterUpdateEventHandler.Interface {\n constructor(private notifyRoleChange: NotifyRoleChangeUseCase.Interface) {}\n\n async handle(event: RoleAfterUpdateEventHandler.Event): Promise<void> {\n await this.notifyRoleChange.execute({ id: event.payload.updated.id, change: \"updated\" });\n }\n}\n\nexport const NotifyOnRoleUpdatedHandler = RoleAfterUpdateEventHandler.createImplementation({\n implementation: NotifyOnRoleUpdatedHandlerImpl,\n dependencies: [NotifyRoleChangeUseCase]\n});\n"],"names":["NotifyOnRoleUpdatedHandlerImpl","notifyRoleChange","event","NotifyOnRoleUpdatedHandler","RoleAfterUpdateEventHandler","NotifyRoleChangeUseCase"],"mappings":";;AAGA,MAAMA;IACF,YAAoBC,gBAAmD,CAAE;aAArDA,gBAAgB,GAAhBA;IAAsD;IAE1E,MAAM,OAAOC,KAAwC,EAAiB;QAClE,MAAM,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC;YAAE,IAAIA,MAAM,OAAO,CAAC,OAAO,CAAC,EAAE;YAAE,QAAQ;QAAU;IAC1F;AACJ;AAEO,MAAMC,6BAA6BC,4BAA4B,oBAAoB,CAAC;IACvF,gBAAgBJ;IAChB,cAAc;QAACK;KAAwB;AAC3C"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { IdentityContext } from "../../../../features/security/IdentityContext/abstractions.js";
|
|
2
|
+
import { WebsocketsSendToIdentityUseCase } from "../../../../features/websockets/index.js";
|
|
3
|
+
import { NotifyRoleChangeUseCase as UseCaseAbstraction } from "./abstractions.js";
|
|
4
|
+
declare class NotifyRoleChangeUseCaseImpl implements UseCaseAbstraction.Interface {
|
|
5
|
+
private identityContext;
|
|
6
|
+
private sendToIdentity;
|
|
7
|
+
constructor(identityContext: IdentityContext.Interface, sendToIdentity: WebsocketsSendToIdentityUseCase.Interface);
|
|
8
|
+
execute({ id, change }: UseCaseAbstraction.Params): Promise<void>;
|
|
9
|
+
}
|
|
10
|
+
export declare const NotifyRoleChangeUseCase: import("@webiny/di").Implementation<typeof NotifyRoleChangeUseCaseImpl>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { createImplementation } from "@webiny/di";
|
|
2
|
+
import { IdentityContext } from "../../IdentityContext/abstractions.js";
|
|
3
|
+
import { WebsocketsSendToIdentityUseCase } from "../../../websockets/index.js";
|
|
4
|
+
import { NotifyRoleChangeUseCase, ROLE_CREATED_WEBSOCKET_ACTION, ROLE_DELETED_WEBSOCKET_ACTION, ROLE_UPDATED_WEBSOCKET_ACTION } from "./abstractions.js";
|
|
5
|
+
const ACTIONS = {
|
|
6
|
+
created: ROLE_CREATED_WEBSOCKET_ACTION,
|
|
7
|
+
updated: ROLE_UPDATED_WEBSOCKET_ACTION,
|
|
8
|
+
deleted: ROLE_DELETED_WEBSOCKET_ACTION
|
|
9
|
+
};
|
|
10
|
+
class NotifyRoleChangeUseCaseImpl {
|
|
11
|
+
constructor(identityContext, sendToIdentity){
|
|
12
|
+
this.identityContext = identityContext;
|
|
13
|
+
this.sendToIdentity = sendToIdentity;
|
|
14
|
+
}
|
|
15
|
+
async execute({ id, change }) {
|
|
16
|
+
const recipient = this.identityContext.getIdentity()?.id;
|
|
17
|
+
if (!recipient) return;
|
|
18
|
+
try {
|
|
19
|
+
await this.sendToIdentity.execute({
|
|
20
|
+
id: recipient
|
|
21
|
+
}, {
|
|
22
|
+
action: ACTIONS[change],
|
|
23
|
+
data: {
|
|
24
|
+
id
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
} catch {}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
const NotifyRoleChangeUseCase_NotifyRoleChangeUseCase = createImplementation({
|
|
31
|
+
abstraction: NotifyRoleChangeUseCase,
|
|
32
|
+
implementation: NotifyRoleChangeUseCaseImpl,
|
|
33
|
+
dependencies: [
|
|
34
|
+
IdentityContext,
|
|
35
|
+
WebsocketsSendToIdentityUseCase
|
|
36
|
+
]
|
|
37
|
+
});
|
|
38
|
+
export { NotifyRoleChangeUseCase_NotifyRoleChangeUseCase as NotifyRoleChangeUseCase };
|
|
39
|
+
|
|
40
|
+
//# sourceMappingURL=NotifyRoleChangeUseCase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/security/roles/NotifyRoleChange/NotifyRoleChangeUseCase.js","sources":["../../../../../src/features/security/roles/NotifyRoleChange/NotifyRoleChangeUseCase.ts"],"sourcesContent":["import { createImplementation } from \"@webiny/di\";\nimport { IdentityContext } from \"~/features/security/IdentityContext/abstractions.js\";\nimport { WebsocketsSendToIdentityUseCase } from \"~/features/websockets/index.js\";\nimport { ROLE_CREATED_WEBSOCKET_ACTION } from \"./abstractions.js\";\nimport { ROLE_DELETED_WEBSOCKET_ACTION } from \"./abstractions.js\";\nimport { ROLE_UPDATED_WEBSOCKET_ACTION } from \"./abstractions.js\";\nimport { NotifyRoleChangeUseCase as UseCaseAbstraction } from \"./abstractions.js\";\n\nconst ACTIONS: Record<UseCaseAbstraction.Params[\"change\"], string> = {\n created: ROLE_CREATED_WEBSOCKET_ACTION,\n updated: ROLE_UPDATED_WEBSOCKET_ACTION,\n deleted: ROLE_DELETED_WEBSOCKET_ACTION\n};\n\n/*\n * Changes the admin makes itself are announced too: the admin applies them by id, so the tab that\n * made the change ends up where it already was and the user's other tabs catch up.\n *\n * The change is saved whether or not the message goes out, so a failed send is swallowed rather than\n * failing the write. The admin then shows the change after its next reload.\n */\nclass NotifyRoleChangeUseCaseImpl implements UseCaseAbstraction.Interface {\n constructor(\n private identityContext: IdentityContext.Interface,\n private sendToIdentity: WebsocketsSendToIdentityUseCase.Interface\n ) {}\n\n async execute({ id, change }: UseCaseAbstraction.Params): Promise<void> {\n const recipient = this.identityContext.getIdentity()?.id;\n if (!recipient) {\n return;\n }\n\n try {\n await this.sendToIdentity.execute(\n { id: recipient },\n { action: ACTIONS[change], data: { id } }\n );\n } catch {\n // See above.\n }\n }\n}\n\nexport const NotifyRoleChangeUseCase = createImplementation({\n abstraction: UseCaseAbstraction,\n implementation: NotifyRoleChangeUseCaseImpl,\n dependencies: [IdentityContext, WebsocketsSendToIdentityUseCase]\n});\n"],"names":["ACTIONS","ROLE_CREATED_WEBSOCKET_ACTION","ROLE_UPDATED_WEBSOCKET_ACTION","ROLE_DELETED_WEBSOCKET_ACTION","NotifyRoleChangeUseCaseImpl","identityContext","sendToIdentity","id","change","recipient","NotifyRoleChangeUseCase","createImplementation","UseCaseAbstraction","IdentityContext","WebsocketsSendToIdentityUseCase"],"mappings":";;;;AAQA,MAAMA,UAA+D;IACjE,SAASC;IACT,SAASC;IACT,SAASC;AACb;AASA,MAAMC;IACF,YACYC,eAA0C,EAC1CC,cAAyD,CACnE;aAFUD,eAAe,GAAfA;aACAC,cAAc,GAAdA;IACT;IAEH,MAAM,QAAQ,EAAEC,EAAE,EAAEC,MAAM,EAA6B,EAAiB;QACpE,MAAMC,YAAY,IAAI,CAAC,eAAe,CAAC,WAAW,IAAI;QACtD,IAAI,CAACA,WACD;QAGJ,IAAI;YACA,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAC7B;gBAAE,IAAIA;YAAU,GAChB;gBAAE,QAAQT,OAAO,CAACQ,OAAO;gBAAE,MAAM;oBAAED;gBAAG;YAAE;QAEhD,EAAE,OAAM,CAER;IACJ;AACJ;AAEO,MAAMG,kDAA0BC,qBAAqB;IACxD,aAAaC;IACb,gBAAgBR;IAChB,cAAc;QAACS;QAAiBC;KAAgC;AACpE"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sent to the user's open admin tabs when a role changes. The admin keeps its own roles list, and a
|
|
3
|
+
* change made on the server (by the assistant's role tools, for one) never passes through it, so
|
|
4
|
+
* without these the Roles view shows the old list until a reload. Each carries the role id only; the
|
|
5
|
+
* admin reads the role back, or drops it for `deleted`.
|
|
6
|
+
*/
|
|
7
|
+
export declare const ROLE_CREATED_WEBSOCKET_ACTION = "security.role.created";
|
|
8
|
+
export declare const ROLE_UPDATED_WEBSOCKET_ACTION = "security.role.updated";
|
|
9
|
+
export declare const ROLE_DELETED_WEBSOCKET_ACTION = "security.role.deleted";
|
|
10
|
+
export interface NotifyRoleChangeParams {
|
|
11
|
+
id: string;
|
|
12
|
+
change: "created" | "updated" | "deleted";
|
|
13
|
+
}
|
|
14
|
+
export interface INotifyRoleChangeUseCase {
|
|
15
|
+
execute(params: NotifyRoleChangeParams): Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
export declare const NotifyRoleChangeUseCase: import("@webiny/di").Abstraction<INotifyRoleChangeUseCase>;
|
|
18
|
+
export declare namespace NotifyRoleChangeUseCase {
|
|
19
|
+
type Interface = INotifyRoleChangeUseCase;
|
|
20
|
+
type Params = NotifyRoleChangeParams;
|
|
21
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createAbstraction } from "@webiny/feature/api";
|
|
2
|
+
const ROLE_CREATED_WEBSOCKET_ACTION = "security.role.created";
|
|
3
|
+
const ROLE_UPDATED_WEBSOCKET_ACTION = "security.role.updated";
|
|
4
|
+
const ROLE_DELETED_WEBSOCKET_ACTION = "security.role.deleted";
|
|
5
|
+
const NotifyRoleChangeUseCase = createAbstraction("Security/NotifyRoleChangeUseCase");
|
|
6
|
+
export { NotifyRoleChangeUseCase, ROLE_CREATED_WEBSOCKET_ACTION, ROLE_DELETED_WEBSOCKET_ACTION, ROLE_UPDATED_WEBSOCKET_ACTION };
|
|
7
|
+
|
|
8
|
+
//# sourceMappingURL=abstractions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/security/roles/NotifyRoleChange/abstractions.js","sources":["../../../../../src/features/security/roles/NotifyRoleChange/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\n\n/**\n * Sent to the user's open admin tabs when a role changes. The admin keeps its own roles list, and a\n * change made on the server (by the assistant's role tools, for one) never passes through it, so\n * without these the Roles view shows the old list until a reload. Each carries the role id only; the\n * admin reads the role back, or drops it for `deleted`.\n */\nexport const ROLE_CREATED_WEBSOCKET_ACTION = \"security.role.created\";\nexport const ROLE_UPDATED_WEBSOCKET_ACTION = \"security.role.updated\";\nexport const ROLE_DELETED_WEBSOCKET_ACTION = \"security.role.deleted\";\n\nexport interface NotifyRoleChangeParams {\n id: string;\n change: \"created\" | \"updated\" | \"deleted\";\n}\n\nexport interface INotifyRoleChangeUseCase {\n execute(params: NotifyRoleChangeParams): Promise<void>;\n}\n\nexport const NotifyRoleChangeUseCase = createAbstraction<INotifyRoleChangeUseCase>(\n \"Security/NotifyRoleChangeUseCase\"\n);\n\nexport namespace NotifyRoleChangeUseCase {\n export type Interface = INotifyRoleChangeUseCase;\n export type Params = NotifyRoleChangeParams;\n}\n"],"names":["ROLE_CREATED_WEBSOCKET_ACTION","ROLE_UPDATED_WEBSOCKET_ACTION","ROLE_DELETED_WEBSOCKET_ACTION","NotifyRoleChangeUseCase","createAbstraction"],"mappings":";AAQO,MAAMA,gCAAgC;AACtC,MAAMC,gCAAgC;AACtC,MAAMC,gCAAgC;AAWtC,MAAMC,0BAA0BC,kBACnC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { createFeature } from "@webiny/feature/api";
|
|
2
|
+
import { NotifyRoleChangeUseCase } from "./NotifyRoleChangeUseCase.js";
|
|
3
|
+
import { NotifyOnRoleCreatedHandler } from "./NotifyOnRoleCreatedHandler.js";
|
|
4
|
+
import { NotifyOnRoleUpdatedHandler } from "./NotifyOnRoleUpdatedHandler.js";
|
|
5
|
+
import { NotifyOnRoleDeletedHandler } from "./NotifyOnRoleDeletedHandler.js";
|
|
6
|
+
const NotifyRoleChangeFeature = createFeature({
|
|
7
|
+
name: "NotifyRoleChange",
|
|
8
|
+
register (container) {
|
|
9
|
+
container.register(NotifyRoleChangeUseCase);
|
|
10
|
+
container.register(NotifyOnRoleCreatedHandler);
|
|
11
|
+
container.register(NotifyOnRoleUpdatedHandler);
|
|
12
|
+
container.register(NotifyOnRoleDeletedHandler);
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
export { NotifyRoleChangeFeature };
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=feature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/security/roles/NotifyRoleChange/feature.js","sources":["../../../../../src/features/security/roles/NotifyRoleChange/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { NotifyRoleChangeUseCase } from \"./NotifyRoleChangeUseCase.js\";\nimport { NotifyOnRoleCreatedHandler } from \"./NotifyOnRoleCreatedHandler.js\";\nimport { NotifyOnRoleUpdatedHandler } from \"./NotifyOnRoleUpdatedHandler.js\";\nimport { NotifyOnRoleDeletedHandler } from \"./NotifyOnRoleDeletedHandler.js\";\n\n/** Tells the user's open admin tabs when a role is created, updated or deleted. */\nexport const NotifyRoleChangeFeature = createFeature({\n name: \"NotifyRoleChange\",\n register(container) {\n container.register(NotifyRoleChangeUseCase);\n container.register(NotifyOnRoleCreatedHandler);\n container.register(NotifyOnRoleUpdatedHandler);\n container.register(NotifyOnRoleDeletedHandler);\n }\n});\n"],"names":["NotifyRoleChangeFeature","createFeature","container","NotifyRoleChangeUseCase","NotifyOnRoleCreatedHandler","NotifyOnRoleUpdatedHandler","NotifyOnRoleDeletedHandler"],"mappings":";;;;;AAOO,MAAMA,0BAA0BC,cAAc;IACjD,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;QACnBD,UAAU,QAAQ,CAACE;QACnBF,UAAU,QAAQ,CAACG;QACnBH,UAAU,QAAQ,CAACI;IACvB;AACJ"}
|
|
@@ -6,6 +6,7 @@ import { EventPublisher } from "../../../eventPublisher/index.js";
|
|
|
6
6
|
import { updateRoleValidation } from "./schema.js";
|
|
7
7
|
import { RoleAfterUpdateEvent, RoleBeforeUpdateEvent } from "./events.js";
|
|
8
8
|
import { descriptionOnUpdate } from "../../shared/description.js";
|
|
9
|
+
import { definedOnly } from "../../shared/definedOnly.js";
|
|
9
10
|
import { CannotUpdatePluginRolesError, NotAuthorizedError, RoleValidationError } from "../shared/errors.js";
|
|
10
11
|
class UpdateRoleUseCaseImpl {
|
|
11
12
|
constructor(repository, identityContext, eventPublisher){
|
|
@@ -26,7 +27,7 @@ class UpdateRoleUseCaseImpl {
|
|
|
26
27
|
if (existingRole.plugin) return Result.fail(new CannotUpdatePluginRolesError());
|
|
27
28
|
const { description, ...rest } = validation.data;
|
|
28
29
|
const changes = {
|
|
29
|
-
...rest,
|
|
30
|
+
...definedOnly(rest),
|
|
30
31
|
...descriptionOnUpdate(description)
|
|
31
32
|
};
|
|
32
33
|
const updatedRole = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/security/roles/UpdateRole/UpdateRoleUseCase.js","sources":["../../../../../src/features/security/roles/UpdateRole/UpdateRoleUseCase.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport { UpdateRoleUseCase as UseCase } from \"./abstractions.js\";\nimport { RolesRepository } from \"../shared/abstractions.js\";\nimport { IdentityContext } from \"../../IdentityContext/abstractions.js\";\nimport { EventPublisher } from \"~/features/eventPublisher/index.js\";\nimport { updateRoleValidation } from \"./schema.js\";\nimport { RoleBeforeUpdateEvent, RoleAfterUpdateEvent } from \"./events.js\";\nimport type { Role, UpdateRoleInput } from \"../shared/types.js\";\nimport { descriptionOnUpdate } from \"../../shared/description.js\";\nimport {\n NotAuthorizedError,\n CannotUpdatePluginRolesError,\n RoleValidationError\n} from \"../shared/errors.js\";\n\nclass UpdateRoleUseCaseImpl implements UseCase.Interface {\n private repository: RolesRepository.Interface;\n private identityContext: IdentityContext.Interface;\n private eventPublisher: EventPublisher.Interface;\n\n constructor(\n repository: RolesRepository.Interface,\n identityContext: IdentityContext.Interface,\n eventPublisher: EventPublisher.Interface\n ) {\n this.repository = repository;\n this.identityContext = identityContext;\n this.eventPublisher = eventPublisher;\n }\n\n async execute(id: string, input: UpdateRoleInput): Promise<Result<Role, UseCase.Error>> {\n const hasPermission = await this.identityContext.getPermission(\"security.role\");\n if (!hasPermission) {\n return Result.fail(new NotAuthorizedError());\n }\n\n const validation = updateRoleValidation.safeParse(input);\n if (!validation.success) {\n return Result.fail(new RoleValidationError(validation.error.issues[0].message));\n }\n\n const existingResult = await this.repository.get({ id });\n if (existingResult.isFail()) {\n return Result.fail(existingResult.error);\n }\n\n const existingRole = existingResult.value;\n\n // Check if role is created via plugin\n if (existingRole.plugin) {\n return Result.fail(new CannotUpdatePluginRolesError());\n }\n\n // `description` is pulled out of the spread because it is the one field that accepts null.\n // Normalising it here keeps null out of both the entity and the published events, whose\n // input type declares `description?: string`.\n const { description, ...rest } = validation.data;\n\n const changes: UpdateRoleInput = {\n ...rest,\n ...descriptionOnUpdate(description)\n };\n\n const updatedRole: Role = {\n ...existingRole,\n ...changes\n };\n\n await this.eventPublisher.publish(\n new RoleBeforeUpdateEvent({\n original: existingRole,\n updated: updatedRole,\n input: changes\n })\n );\n\n const result = await this.repository.update(updatedRole);\n\n if (result.isFail()) {\n return Result.fail(result.error);\n }\n\n await this.eventPublisher.publish(\n new RoleAfterUpdateEvent({\n original: existingRole,\n updated: updatedRole,\n input: changes\n })\n );\n\n return Result.ok(updatedRole);\n }\n}\n\nexport const UpdateRoleUseCase = UseCase.createImplementation({\n implementation: UpdateRoleUseCaseImpl,\n dependencies: [RolesRepository, IdentityContext, EventPublisher]\n});\n"],"names":["UpdateRoleUseCaseImpl","repository","identityContext","eventPublisher","id","input","hasPermission","Result","NotAuthorizedError","validation","updateRoleValidation","RoleValidationError","existingResult","existingRole","CannotUpdatePluginRolesError","description","rest","changes","descriptionOnUpdate","updatedRole","RoleBeforeUpdateEvent","result","RoleAfterUpdateEvent","UpdateRoleUseCase","UseCase","RolesRepository","IdentityContext","EventPublisher"],"mappings":"
|
|
1
|
+
{"version":3,"file":"features/security/roles/UpdateRole/UpdateRoleUseCase.js","sources":["../../../../../src/features/security/roles/UpdateRole/UpdateRoleUseCase.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport { UpdateRoleUseCase as UseCase } from \"./abstractions.js\";\nimport { RolesRepository } from \"../shared/abstractions.js\";\nimport { IdentityContext } from \"../../IdentityContext/abstractions.js\";\nimport { EventPublisher } from \"~/features/eventPublisher/index.js\";\nimport { updateRoleValidation } from \"./schema.js\";\nimport { RoleBeforeUpdateEvent, RoleAfterUpdateEvent } from \"./events.js\";\nimport type { Role, UpdateRoleInput } from \"../shared/types.js\";\nimport { descriptionOnUpdate } from \"../../shared/description.js\";\nimport { definedOnly } from \"../../shared/definedOnly.js\";\nimport {\n NotAuthorizedError,\n CannotUpdatePluginRolesError,\n RoleValidationError\n} from \"../shared/errors.js\";\n\nclass UpdateRoleUseCaseImpl implements UseCase.Interface {\n private repository: RolesRepository.Interface;\n private identityContext: IdentityContext.Interface;\n private eventPublisher: EventPublisher.Interface;\n\n constructor(\n repository: RolesRepository.Interface,\n identityContext: IdentityContext.Interface,\n eventPublisher: EventPublisher.Interface\n ) {\n this.repository = repository;\n this.identityContext = identityContext;\n this.eventPublisher = eventPublisher;\n }\n\n async execute(id: string, input: UpdateRoleInput): Promise<Result<Role, UseCase.Error>> {\n const hasPermission = await this.identityContext.getPermission(\"security.role\");\n if (!hasPermission) {\n return Result.fail(new NotAuthorizedError());\n }\n\n const validation = updateRoleValidation.safeParse(input);\n if (!validation.success) {\n return Result.fail(new RoleValidationError(validation.error.issues[0].message));\n }\n\n const existingResult = await this.repository.get({ id });\n if (existingResult.isFail()) {\n return Result.fail(existingResult.error);\n }\n\n const existingRole = existingResult.value;\n\n // Check if role is created via plugin\n if (existingRole.plugin) {\n return Result.fail(new CannotUpdatePluginRolesError());\n }\n\n // `description` is pulled out of the spread because it is the one field that accepts null.\n // Normalising it here keeps null out of both the entity and the published events, whose\n // input type declares `description?: string`.\n const { description, ...rest } = validation.data;\n\n const changes: UpdateRoleInput = {\n ...definedOnly(rest),\n ...descriptionOnUpdate(description)\n };\n\n const updatedRole: Role = {\n ...existingRole,\n ...changes\n };\n\n await this.eventPublisher.publish(\n new RoleBeforeUpdateEvent({\n original: existingRole,\n updated: updatedRole,\n input: changes\n })\n );\n\n const result = await this.repository.update(updatedRole);\n\n if (result.isFail()) {\n return Result.fail(result.error);\n }\n\n await this.eventPublisher.publish(\n new RoleAfterUpdateEvent({\n original: existingRole,\n updated: updatedRole,\n input: changes\n })\n );\n\n return Result.ok(updatedRole);\n }\n}\n\nexport const UpdateRoleUseCase = UseCase.createImplementation({\n implementation: UpdateRoleUseCaseImpl,\n dependencies: [RolesRepository, IdentityContext, EventPublisher]\n});\n"],"names":["UpdateRoleUseCaseImpl","repository","identityContext","eventPublisher","id","input","hasPermission","Result","NotAuthorizedError","validation","updateRoleValidation","RoleValidationError","existingResult","existingRole","CannotUpdatePluginRolesError","description","rest","changes","definedOnly","descriptionOnUpdate","updatedRole","RoleBeforeUpdateEvent","result","RoleAfterUpdateEvent","UpdateRoleUseCase","UseCase","RolesRepository","IdentityContext","EventPublisher"],"mappings":";;;;;;;;;;AAgBA,MAAMA;IAKF,YACIC,UAAqC,EACrCC,eAA0C,EAC1CC,cAAwC,CAC1C;QACE,IAAI,CAAC,UAAU,GAAGF;QAClB,IAAI,CAAC,eAAe,GAAGC;QACvB,IAAI,CAAC,cAAc,GAAGC;IAC1B;IAEA,MAAM,QAAQC,EAAU,EAAEC,KAAsB,EAAwC;QACpF,MAAMC,gBAAgB,MAAM,IAAI,CAAC,eAAe,CAAC,aAAa,CAAC;QAC/D,IAAI,CAACA,eACD,OAAOC,OAAO,IAAI,CAAC,IAAIC;QAG3B,MAAMC,aAAaC,qBAAqB,SAAS,CAACL;QAClD,IAAI,CAACI,WAAW,OAAO,EACnB,OAAOF,OAAO,IAAI,CAAC,IAAII,oBAAoBF,WAAW,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,OAAO;QAGjF,MAAMG,iBAAiB,MAAM,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;YAAER;QAAG;QACtD,IAAIQ,eAAe,MAAM,IACrB,OAAOL,OAAO,IAAI,CAACK,eAAe,KAAK;QAG3C,MAAMC,eAAeD,eAAe,KAAK;QAGzC,IAAIC,aAAa,MAAM,EACnB,OAAON,OAAO,IAAI,CAAC,IAAIO;QAM3B,MAAM,EAAEC,WAAW,EAAE,GAAGC,MAAM,GAAGP,WAAW,IAAI;QAEhD,MAAMQ,UAA2B;YAC7B,GAAGC,YAAYF,KAAK;YACpB,GAAGG,oBAAoBJ,YAAY;QACvC;QAEA,MAAMK,cAAoB;YACtB,GAAGP,YAAY;YACf,GAAGI,OAAO;QACd;QAEA,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAC7B,IAAII,sBAAsB;YACtB,UAAUR;YACV,SAASO;YACT,OAAOH;QACX;QAGJ,MAAMK,SAAS,MAAM,IAAI,CAAC,UAAU,CAAC,MAAM,CAACF;QAE5C,IAAIE,OAAO,MAAM,IACb,OAAOf,OAAO,IAAI,CAACe,OAAO,KAAK;QAGnC,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAC7B,IAAIC,qBAAqB;YACrB,UAAUV;YACV,SAASO;YACT,OAAOH;QACX;QAGJ,OAAOV,OAAO,EAAE,CAACa;IACrB;AACJ;AAEO,MAAMI,sCAAoBC,kBAAAA,oBAA4B,CAAC;IAC1D,gBAAgBzB;IAChB,cAAc;QAAC0B;QAAiBC;QAAiBC;KAAe;AACpE"}
|
|
@@ -7,6 +7,7 @@ import { ListRolesFeature } from "./ListRoles/feature.js";
|
|
|
7
7
|
import { CreateRoleFeature } from "./CreateRole/feature.js";
|
|
8
8
|
import { UpdateRoleFeature } from "./UpdateRole/feature.js";
|
|
9
9
|
import { DeleteRoleFeature } from "./DeleteRole/feature.js";
|
|
10
|
+
import { NotifyRoleChangeFeature } from "./NotifyRoleChange/index.js";
|
|
10
11
|
import { RoleInstaller } from "./Installer/RolesInstaller.js";
|
|
11
12
|
const RolesFeature = createFeature({
|
|
12
13
|
name: "Roles",
|
|
@@ -19,6 +20,7 @@ const RolesFeature = createFeature({
|
|
|
19
20
|
CreateRoleFeature.register(container);
|
|
20
21
|
UpdateRoleFeature.register(container);
|
|
21
22
|
DeleteRoleFeature.register(container);
|
|
23
|
+
NotifyRoleChangeFeature.register(container);
|
|
22
24
|
container.register(RoleInstaller);
|
|
23
25
|
}
|
|
24
26
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/security/roles/feature.js","sources":["../../../../src/features/security/roles/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { RolesRepository } from \"./shared/RolesRepository.js\";\nimport { RoleProvider } from \"./shared/RoleProvider.js\";\nimport { RolesRepositoryCachingDecorator } from \"./shared/decorators/RolesRepositoryCachingDecorator.js\";\nimport { GetRoleFeature } from \"./GetRole/feature.js\";\nimport { ListRolesFeature } from \"./ListRoles/feature.js\";\nimport { CreateRoleFeature } from \"./CreateRole/feature.js\";\nimport { UpdateRoleFeature } from \"./UpdateRole/feature.js\";\nimport { DeleteRoleFeature } from \"./DeleteRole/feature.js\";\nimport { RoleInstaller } from \"~/features/security/roles/Installer/RolesInstaller.js\";\n\nexport const RolesFeature = createFeature({\n name: \"Roles\",\n register(container) {\n // Register repository in singleton scope\n container.register(RolesRepository).inSingletonScope();\n container.register(RoleProvider).inSingletonScope();\n\n // Register caching decorator\n container.registerDecorator(RolesRepositoryCachingDecorator);\n\n // Register all use cases\n GetRoleFeature.register(container);\n ListRolesFeature.register(container);\n CreateRoleFeature.register(container);\n UpdateRoleFeature.register(container);\n DeleteRoleFeature.register(container);\n\n container.register(RoleInstaller);\n }\n});\n"],"names":["RolesFeature","createFeature","container","RolesRepository","RoleProvider","RolesRepositoryCachingDecorator","GetRoleFeature","ListRolesFeature","CreateRoleFeature","UpdateRoleFeature","DeleteRoleFeature","RoleInstaller"],"mappings":"
|
|
1
|
+
{"version":3,"file":"features/security/roles/feature.js","sources":["../../../../src/features/security/roles/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { RolesRepository } from \"./shared/RolesRepository.js\";\nimport { RoleProvider } from \"./shared/RoleProvider.js\";\nimport { RolesRepositoryCachingDecorator } from \"./shared/decorators/RolesRepositoryCachingDecorator.js\";\nimport { GetRoleFeature } from \"./GetRole/feature.js\";\nimport { ListRolesFeature } from \"./ListRoles/feature.js\";\nimport { CreateRoleFeature } from \"./CreateRole/feature.js\";\nimport { UpdateRoleFeature } from \"./UpdateRole/feature.js\";\nimport { DeleteRoleFeature } from \"./DeleteRole/feature.js\";\nimport { NotifyRoleChangeFeature } from \"./NotifyRoleChange/index.js\";\nimport { RoleInstaller } from \"~/features/security/roles/Installer/RolesInstaller.js\";\n\nexport const RolesFeature = createFeature({\n name: \"Roles\",\n register(container) {\n // Register repository in singleton scope\n container.register(RolesRepository).inSingletonScope();\n container.register(RoleProvider).inSingletonScope();\n\n // Register caching decorator\n container.registerDecorator(RolesRepositoryCachingDecorator);\n\n // Register all use cases\n GetRoleFeature.register(container);\n ListRolesFeature.register(container);\n CreateRoleFeature.register(container);\n UpdateRoleFeature.register(container);\n DeleteRoleFeature.register(container);\n NotifyRoleChangeFeature.register(container);\n\n container.register(RoleInstaller);\n }\n});\n"],"names":["RolesFeature","createFeature","container","RolesRepository","RoleProvider","RolesRepositoryCachingDecorator","GetRoleFeature","ListRolesFeature","CreateRoleFeature","UpdateRoleFeature","DeleteRoleFeature","NotifyRoleChangeFeature","RoleInstaller"],"mappings":";;;;;;;;;;;AAYO,MAAMA,eAAeC,cAAc;IACtC,MAAM;IACN,UAASC,SAAS;QAEdA,UAAU,QAAQ,CAACC,iBAAiB,gBAAgB;QACpDD,UAAU,QAAQ,CAACE,cAAc,gBAAgB;QAGjDF,UAAU,iBAAiB,CAACG;QAG5BC,eAAe,QAAQ,CAACJ;QACxBK,iBAAiB,QAAQ,CAACL;QAC1BM,kBAAkB,QAAQ,CAACN;QAC3BO,kBAAkB,QAAQ,CAACP;QAC3BQ,kBAAkB,QAAQ,CAACR;QAC3BS,wBAAwB,QAAQ,CAACT;QAEjCA,UAAU,QAAQ,CAACU;IACvB;AACJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const definedOnly: <T extends object>(value: T) => Partial<T>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/security/shared/definedOnly.js","sources":["../../../../src/features/security/shared/definedOnly.ts"],"sourcesContent":["// Drops keys whose value is `undefined`. Zod copies a key the caller sent as `undefined` into the\n// parsed output, so spreading a parsed update onto a stored entity would overwrite that field with\n// `undefined`. To an update, an absent key and an `undefined` one both mean \"leave the field alone\".\nexport const definedOnly = <T extends object>(value: T): Partial<T> => {\n const defined: Partial<T> = {};\n\n // `Object.keys` types its result as `string[]`; these are the keys of `value`.\n for (const key of Object.keys(value) as Array<keyof T>) {\n if (value[key] !== undefined) {\n defined[key] = value[key];\n }\n }\n\n return defined;\n};\n"],"names":["definedOnly","value","defined","key","Object","undefined"],"mappings":"AAGO,MAAMA,cAAc,CAAmBC;IAC1C,MAAMC,UAAsB,CAAC;IAG7B,KAAK,MAAMC,OAAOC,OAAO,IAAI,CAACH,OAC1B,IAAIA,AAAeI,WAAfJ,KAAK,CAACE,IAAI,EACVD,OAAO,CAACC,IAAI,GAAGF,KAAK,CAACE,IAAI;IAIjC,OAAOD;AACX"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { TeamAfterCreateEventHandler } from "../../../../features/security/teams/CreateTeam/index.js";
|
|
2
|
+
import { TeamAfterUpdateEventHandler } from "../../../../features/security/teams/UpdateTeam/index.js";
|
|
3
|
+
import { TeamAfterDeleteEventHandler } from "../../../../features/security/teams/DeleteTeam/index.js";
|
|
4
|
+
import { NotifyTeamChangeUseCase } from "./abstractions.js";
|
|
5
|
+
declare class NotifyOnTeamCreatedHandlerImpl implements TeamAfterCreateEventHandler.Interface {
|
|
6
|
+
private notifyTeamChange;
|
|
7
|
+
constructor(notifyTeamChange: NotifyTeamChangeUseCase.Interface);
|
|
8
|
+
handle(event: TeamAfterCreateEventHandler.Event): Promise<void>;
|
|
9
|
+
}
|
|
10
|
+
export declare const NotifyOnTeamCreatedHandler: typeof NotifyOnTeamCreatedHandlerImpl & {
|
|
11
|
+
__abstraction: import("@webiny/di").Abstraction<import("../../../eventPublisher/abstractions.js").IEventHandler<import("../CreateTeam/events.js").TeamAfterCreateEvent>>;
|
|
12
|
+
};
|
|
13
|
+
declare class NotifyOnTeamUpdatedHandlerImpl implements TeamAfterUpdateEventHandler.Interface {
|
|
14
|
+
private notifyTeamChange;
|
|
15
|
+
constructor(notifyTeamChange: NotifyTeamChangeUseCase.Interface);
|
|
16
|
+
handle(event: TeamAfterUpdateEventHandler.Event): Promise<void>;
|
|
17
|
+
}
|
|
18
|
+
export declare const NotifyOnTeamUpdatedHandler: typeof NotifyOnTeamUpdatedHandlerImpl & {
|
|
19
|
+
__abstraction: import("@webiny/di").Abstraction<import("../../../eventPublisher/abstractions.js").IEventHandler<import("~/features/security/teams/UpdateTeam/index.js").TeamAfterUpdateEvent>>;
|
|
20
|
+
};
|
|
21
|
+
declare class NotifyOnTeamDeletedHandlerImpl implements TeamAfterDeleteEventHandler.Interface {
|
|
22
|
+
private notifyTeamChange;
|
|
23
|
+
constructor(notifyTeamChange: NotifyTeamChangeUseCase.Interface);
|
|
24
|
+
handle(event: TeamAfterDeleteEventHandler.Event): Promise<void>;
|
|
25
|
+
}
|
|
26
|
+
export declare const NotifyOnTeamDeletedHandler: typeof NotifyOnTeamDeletedHandlerImpl & {
|
|
27
|
+
__abstraction: import("@webiny/di").Abstraction<import("../../../eventPublisher/abstractions.js").IEventHandler<import("~/features/security/teams/DeleteTeam/index.js").TeamAfterDeleteEvent>>;
|
|
28
|
+
};
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { TeamAfterCreateEventHandler } from "../CreateTeam/index.js";
|
|
2
|
+
import { TeamAfterUpdateEventHandler } from "../UpdateTeam/index.js";
|
|
3
|
+
import { TeamAfterDeleteEventHandler } from "../DeleteTeam/index.js";
|
|
4
|
+
import { NotifyTeamChangeUseCase } from "./abstractions.js";
|
|
5
|
+
class NotifyOnTeamCreatedHandlerImpl {
|
|
6
|
+
constructor(notifyTeamChange){
|
|
7
|
+
this.notifyTeamChange = notifyTeamChange;
|
|
8
|
+
}
|
|
9
|
+
async handle(event) {
|
|
10
|
+
await this.notifyTeamChange.execute({
|
|
11
|
+
id: event.payload.team.id,
|
|
12
|
+
change: "created"
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
const NotifyOnTeamCreatedHandler = TeamAfterCreateEventHandler.createImplementation({
|
|
17
|
+
implementation: NotifyOnTeamCreatedHandlerImpl,
|
|
18
|
+
dependencies: [
|
|
19
|
+
NotifyTeamChangeUseCase
|
|
20
|
+
]
|
|
21
|
+
});
|
|
22
|
+
class NotifyOnTeamUpdatedHandlerImpl {
|
|
23
|
+
constructor(notifyTeamChange){
|
|
24
|
+
this.notifyTeamChange = notifyTeamChange;
|
|
25
|
+
}
|
|
26
|
+
async handle(event) {
|
|
27
|
+
await this.notifyTeamChange.execute({
|
|
28
|
+
id: event.payload.updated.id,
|
|
29
|
+
change: "updated"
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
const NotifyOnTeamUpdatedHandler = TeamAfterUpdateEventHandler.createImplementation({
|
|
34
|
+
implementation: NotifyOnTeamUpdatedHandlerImpl,
|
|
35
|
+
dependencies: [
|
|
36
|
+
NotifyTeamChangeUseCase
|
|
37
|
+
]
|
|
38
|
+
});
|
|
39
|
+
class NotifyOnTeamDeletedHandlerImpl {
|
|
40
|
+
constructor(notifyTeamChange){
|
|
41
|
+
this.notifyTeamChange = notifyTeamChange;
|
|
42
|
+
}
|
|
43
|
+
async handle(event) {
|
|
44
|
+
await this.notifyTeamChange.execute({
|
|
45
|
+
id: event.payload.team.id,
|
|
46
|
+
change: "deleted"
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
const NotifyOnTeamDeletedHandler = TeamAfterDeleteEventHandler.createImplementation({
|
|
51
|
+
implementation: NotifyOnTeamDeletedHandlerImpl,
|
|
52
|
+
dependencies: [
|
|
53
|
+
NotifyTeamChangeUseCase
|
|
54
|
+
]
|
|
55
|
+
});
|
|
56
|
+
export { NotifyOnTeamCreatedHandler, NotifyOnTeamDeletedHandler, NotifyOnTeamUpdatedHandler };
|
|
57
|
+
|
|
58
|
+
//# sourceMappingURL=NotifyOnTeamChangeHandlers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/security/teams/NotifyTeamChange/NotifyOnTeamChangeHandlers.js","sources":["../../../../../src/features/security/teams/NotifyTeamChange/NotifyOnTeamChangeHandlers.ts"],"sourcesContent":["import { TeamAfterCreateEventHandler } from \"~/features/security/teams/CreateTeam/index.js\";\nimport { TeamAfterUpdateEventHandler } from \"~/features/security/teams/UpdateTeam/index.js\";\nimport { TeamAfterDeleteEventHandler } from \"~/features/security/teams/DeleteTeam/index.js\";\nimport { NotifyTeamChangeUseCase } from \"./abstractions.js\";\n\nclass NotifyOnTeamCreatedHandlerImpl implements TeamAfterCreateEventHandler.Interface {\n constructor(private notifyTeamChange: NotifyTeamChangeUseCase.Interface) {}\n\n async handle(event: TeamAfterCreateEventHandler.Event): Promise<void> {\n await this.notifyTeamChange.execute({ id: event.payload.team.id, change: \"created\" });\n }\n}\n\nexport const NotifyOnTeamCreatedHandler = TeamAfterCreateEventHandler.createImplementation({\n implementation: NotifyOnTeamCreatedHandlerImpl,\n dependencies: [NotifyTeamChangeUseCase]\n});\n\nclass NotifyOnTeamUpdatedHandlerImpl implements TeamAfterUpdateEventHandler.Interface {\n constructor(private notifyTeamChange: NotifyTeamChangeUseCase.Interface) {}\n\n async handle(event: TeamAfterUpdateEventHandler.Event): Promise<void> {\n await this.notifyTeamChange.execute({ id: event.payload.updated.id, change: \"updated\" });\n }\n}\n\nexport const NotifyOnTeamUpdatedHandler = TeamAfterUpdateEventHandler.createImplementation({\n implementation: NotifyOnTeamUpdatedHandlerImpl,\n dependencies: [NotifyTeamChangeUseCase]\n});\n\nclass NotifyOnTeamDeletedHandlerImpl implements TeamAfterDeleteEventHandler.Interface {\n constructor(private notifyTeamChange: NotifyTeamChangeUseCase.Interface) {}\n\n async handle(event: TeamAfterDeleteEventHandler.Event): Promise<void> {\n await this.notifyTeamChange.execute({ id: event.payload.team.id, change: \"deleted\" });\n }\n}\n\nexport const NotifyOnTeamDeletedHandler = TeamAfterDeleteEventHandler.createImplementation({\n implementation: NotifyOnTeamDeletedHandlerImpl,\n dependencies: [NotifyTeamChangeUseCase]\n});\n"],"names":["NotifyOnTeamCreatedHandlerImpl","notifyTeamChange","event","NotifyOnTeamCreatedHandler","TeamAfterCreateEventHandler","NotifyTeamChangeUseCase","NotifyOnTeamUpdatedHandlerImpl","NotifyOnTeamUpdatedHandler","TeamAfterUpdateEventHandler","NotifyOnTeamDeletedHandlerImpl","NotifyOnTeamDeletedHandler","TeamAfterDeleteEventHandler"],"mappings":";;;;AAKA,MAAMA;IACF,YAAoBC,gBAAmD,CAAE;aAArDA,gBAAgB,GAAhBA;IAAsD;IAE1E,MAAM,OAAOC,KAAwC,EAAiB;QAClE,MAAM,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC;YAAE,IAAIA,MAAM,OAAO,CAAC,IAAI,CAAC,EAAE;YAAE,QAAQ;QAAU;IACvF;AACJ;AAEO,MAAMC,6BAA6BC,4BAA4B,oBAAoB,CAAC;IACvF,gBAAgBJ;IAChB,cAAc;QAACK;KAAwB;AAC3C;AAEA,MAAMC;IACF,YAAoBL,gBAAmD,CAAE;aAArDA,gBAAgB,GAAhBA;IAAsD;IAE1E,MAAM,OAAOC,KAAwC,EAAiB;QAClE,MAAM,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC;YAAE,IAAIA,MAAM,OAAO,CAAC,OAAO,CAAC,EAAE;YAAE,QAAQ;QAAU;IAC1F;AACJ;AAEO,MAAMK,6BAA6BC,4BAA4B,oBAAoB,CAAC;IACvF,gBAAgBF;IAChB,cAAc;QAACD;KAAwB;AAC3C;AAEA,MAAMI;IACF,YAAoBR,gBAAmD,CAAE;aAArDA,gBAAgB,GAAhBA;IAAsD;IAE1E,MAAM,OAAOC,KAAwC,EAAiB;QAClE,MAAM,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC;YAAE,IAAIA,MAAM,OAAO,CAAC,IAAI,CAAC,EAAE;YAAE,QAAQ;QAAU;IACvF;AACJ;AAEO,MAAMQ,6BAA6BC,4BAA4B,oBAAoB,CAAC;IACvF,gBAAgBF;IAChB,cAAc;QAACJ;KAAwB;AAC3C"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { IdentityContext } from "../../../../features/security/IdentityContext/abstractions.js";
|
|
2
|
+
import { WebsocketsSendToIdentityUseCase } from "../../../../features/websockets/index.js";
|
|
3
|
+
import { NotifyTeamChangeUseCase as UseCaseAbstraction } from "./abstractions.js";
|
|
4
|
+
declare class NotifyTeamChangeUseCaseImpl implements UseCaseAbstraction.Interface {
|
|
5
|
+
private identityContext;
|
|
6
|
+
private sendToIdentity;
|
|
7
|
+
constructor(identityContext: IdentityContext.Interface, sendToIdentity: WebsocketsSendToIdentityUseCase.Interface);
|
|
8
|
+
execute({ id, change }: UseCaseAbstraction.Params): Promise<void>;
|
|
9
|
+
}
|
|
10
|
+
export declare const NotifyTeamChangeUseCase: import("@webiny/di").Implementation<typeof NotifyTeamChangeUseCaseImpl>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { createImplementation } from "@webiny/di";
|
|
2
|
+
import { IdentityContext } from "../../IdentityContext/abstractions.js";
|
|
3
|
+
import { WebsocketsSendToIdentityUseCase } from "../../../websockets/index.js";
|
|
4
|
+
import { NotifyTeamChangeUseCase, TEAM_CREATED_WEBSOCKET_ACTION, TEAM_DELETED_WEBSOCKET_ACTION, TEAM_UPDATED_WEBSOCKET_ACTION } from "./abstractions.js";
|
|
5
|
+
const ACTIONS = {
|
|
6
|
+
created: TEAM_CREATED_WEBSOCKET_ACTION,
|
|
7
|
+
updated: TEAM_UPDATED_WEBSOCKET_ACTION,
|
|
8
|
+
deleted: TEAM_DELETED_WEBSOCKET_ACTION
|
|
9
|
+
};
|
|
10
|
+
class NotifyTeamChangeUseCaseImpl {
|
|
11
|
+
constructor(identityContext, sendToIdentity){
|
|
12
|
+
this.identityContext = identityContext;
|
|
13
|
+
this.sendToIdentity = sendToIdentity;
|
|
14
|
+
}
|
|
15
|
+
async execute({ id, change }) {
|
|
16
|
+
const recipient = this.identityContext.getIdentity()?.id;
|
|
17
|
+
if (!recipient) return;
|
|
18
|
+
try {
|
|
19
|
+
await this.sendToIdentity.execute({
|
|
20
|
+
id: recipient
|
|
21
|
+
}, {
|
|
22
|
+
action: ACTIONS[change],
|
|
23
|
+
data: {
|
|
24
|
+
id
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
} catch {}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
const NotifyTeamChangeUseCase_NotifyTeamChangeUseCase = createImplementation({
|
|
31
|
+
abstraction: NotifyTeamChangeUseCase,
|
|
32
|
+
implementation: NotifyTeamChangeUseCaseImpl,
|
|
33
|
+
dependencies: [
|
|
34
|
+
IdentityContext,
|
|
35
|
+
WebsocketsSendToIdentityUseCase
|
|
36
|
+
]
|
|
37
|
+
});
|
|
38
|
+
export { NotifyTeamChangeUseCase_NotifyTeamChangeUseCase as NotifyTeamChangeUseCase };
|
|
39
|
+
|
|
40
|
+
//# sourceMappingURL=NotifyTeamChangeUseCase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/security/teams/NotifyTeamChange/NotifyTeamChangeUseCase.js","sources":["../../../../../src/features/security/teams/NotifyTeamChange/NotifyTeamChangeUseCase.ts"],"sourcesContent":["import { createImplementation } from \"@webiny/di\";\nimport { IdentityContext } from \"~/features/security/IdentityContext/abstractions.js\";\nimport { WebsocketsSendToIdentityUseCase } from \"~/features/websockets/index.js\";\nimport {\n TEAM_CREATED_WEBSOCKET_ACTION,\n TEAM_DELETED_WEBSOCKET_ACTION,\n TEAM_UPDATED_WEBSOCKET_ACTION,\n NotifyTeamChangeUseCase as UseCaseAbstraction\n} from \"./abstractions.js\";\n\nconst ACTIONS: Record<UseCaseAbstraction.Params[\"change\"], string> = {\n created: TEAM_CREATED_WEBSOCKET_ACTION,\n updated: TEAM_UPDATED_WEBSOCKET_ACTION,\n deleted: TEAM_DELETED_WEBSOCKET_ACTION\n};\n\n/*\n * Changes the admin makes itself are announced too: the admin applies them by id, so the tab that\n * made the change ends up where it already was and the user's other tabs catch up.\n *\n * The change is saved whether or not the message goes out, so a failed send is swallowed rather than\n * failing the write. The admin then shows the change after its next reload.\n */\nclass NotifyTeamChangeUseCaseImpl implements UseCaseAbstraction.Interface {\n constructor(\n private identityContext: IdentityContext.Interface,\n private sendToIdentity: WebsocketsSendToIdentityUseCase.Interface\n ) {}\n\n async execute({ id, change }: UseCaseAbstraction.Params): Promise<void> {\n const recipient = this.identityContext.getIdentity()?.id;\n if (!recipient) {\n return;\n }\n\n try {\n await this.sendToIdentity.execute(\n { id: recipient },\n { action: ACTIONS[change], data: { id } }\n );\n } catch {\n // See above.\n }\n }\n}\n\nexport const NotifyTeamChangeUseCase = createImplementation({\n abstraction: UseCaseAbstraction,\n implementation: NotifyTeamChangeUseCaseImpl,\n dependencies: [IdentityContext, WebsocketsSendToIdentityUseCase]\n});\n"],"names":["ACTIONS","TEAM_CREATED_WEBSOCKET_ACTION","TEAM_UPDATED_WEBSOCKET_ACTION","TEAM_DELETED_WEBSOCKET_ACTION","NotifyTeamChangeUseCaseImpl","identityContext","sendToIdentity","id","change","recipient","NotifyTeamChangeUseCase","createImplementation","UseCaseAbstraction","IdentityContext","WebsocketsSendToIdentityUseCase"],"mappings":";;;;AAUA,MAAMA,UAA+D;IACjE,SAASC;IACT,SAASC;IACT,SAASC;AACb;AASA,MAAMC;IACF,YACYC,eAA0C,EAC1CC,cAAyD,CACnE;aAFUD,eAAe,GAAfA;aACAC,cAAc,GAAdA;IACT;IAEH,MAAM,QAAQ,EAAEC,EAAE,EAAEC,MAAM,EAA6B,EAAiB;QACpE,MAAMC,YAAY,IAAI,CAAC,eAAe,CAAC,WAAW,IAAI;QACtD,IAAI,CAACA,WACD;QAGJ,IAAI;YACA,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAC7B;gBAAE,IAAIA;YAAU,GAChB;gBAAE,QAAQT,OAAO,CAACQ,OAAO;gBAAE,MAAM;oBAAED;gBAAG;YAAE;QAEhD,EAAE,OAAM,CAER;IACJ;AACJ;AAEO,MAAMG,kDAA0BC,qBAAqB;IACxD,aAAaC;IACb,gBAAgBR;IAChB,cAAc;QAACS;QAAiBC;KAAgC;AACpE"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sent to the user's open admin tabs when a team changes. The admin keeps its own teams list, and a
|
|
3
|
+
* change made on the server (by the assistant's team tools, for one) never passes through it, so
|
|
4
|
+
* without these the Teams view shows the old list until a reload. Each carries the team id only; the
|
|
5
|
+
* admin reads the team back, or drops it for `deleted`.
|
|
6
|
+
*/
|
|
7
|
+
export declare const TEAM_CREATED_WEBSOCKET_ACTION = "security.team.created";
|
|
8
|
+
export declare const TEAM_UPDATED_WEBSOCKET_ACTION = "security.team.updated";
|
|
9
|
+
export declare const TEAM_DELETED_WEBSOCKET_ACTION = "security.team.deleted";
|
|
10
|
+
export interface NotifyTeamChangeParams {
|
|
11
|
+
id: string;
|
|
12
|
+
change: "created" | "updated" | "deleted";
|
|
13
|
+
}
|
|
14
|
+
export interface INotifyTeamChangeUseCase {
|
|
15
|
+
execute(params: NotifyTeamChangeParams): Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
export declare const NotifyTeamChangeUseCase: import("@webiny/di").Abstraction<INotifyTeamChangeUseCase>;
|
|
18
|
+
export declare namespace NotifyTeamChangeUseCase {
|
|
19
|
+
type Interface = INotifyTeamChangeUseCase;
|
|
20
|
+
type Params = NotifyTeamChangeParams;
|
|
21
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createAbstraction } from "@webiny/feature/api";
|
|
2
|
+
const TEAM_CREATED_WEBSOCKET_ACTION = "security.team.created";
|
|
3
|
+
const TEAM_UPDATED_WEBSOCKET_ACTION = "security.team.updated";
|
|
4
|
+
const TEAM_DELETED_WEBSOCKET_ACTION = "security.team.deleted";
|
|
5
|
+
const NotifyTeamChangeUseCase = createAbstraction("Security/NotifyTeamChangeUseCase");
|
|
6
|
+
export { NotifyTeamChangeUseCase, TEAM_CREATED_WEBSOCKET_ACTION, TEAM_DELETED_WEBSOCKET_ACTION, TEAM_UPDATED_WEBSOCKET_ACTION };
|
|
7
|
+
|
|
8
|
+
//# sourceMappingURL=abstractions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/security/teams/NotifyTeamChange/abstractions.js","sources":["../../../../../src/features/security/teams/NotifyTeamChange/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\n\n/**\n * Sent to the user's open admin tabs when a team changes. The admin keeps its own teams list, and a\n * change made on the server (by the assistant's team tools, for one) never passes through it, so\n * without these the Teams view shows the old list until a reload. Each carries the team id only; the\n * admin reads the team back, or drops it for `deleted`.\n */\nexport const TEAM_CREATED_WEBSOCKET_ACTION = \"security.team.created\";\nexport const TEAM_UPDATED_WEBSOCKET_ACTION = \"security.team.updated\";\nexport const TEAM_DELETED_WEBSOCKET_ACTION = \"security.team.deleted\";\n\nexport interface NotifyTeamChangeParams {\n id: string;\n change: \"created\" | \"updated\" | \"deleted\";\n}\n\nexport interface INotifyTeamChangeUseCase {\n execute(params: NotifyTeamChangeParams): Promise<void>;\n}\n\nexport const NotifyTeamChangeUseCase = createAbstraction<INotifyTeamChangeUseCase>(\n \"Security/NotifyTeamChangeUseCase\"\n);\n\nexport namespace NotifyTeamChangeUseCase {\n export type Interface = INotifyTeamChangeUseCase;\n export type Params = NotifyTeamChangeParams;\n}\n"],"names":["TEAM_CREATED_WEBSOCKET_ACTION","TEAM_UPDATED_WEBSOCKET_ACTION","TEAM_DELETED_WEBSOCKET_ACTION","NotifyTeamChangeUseCase","createAbstraction"],"mappings":";AAQO,MAAMA,gCAAgC;AACtC,MAAMC,gCAAgC;AACtC,MAAMC,gCAAgC;AAWtC,MAAMC,0BAA0BC,kBACnC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { createFeature } from "@webiny/feature/api";
|
|
2
|
+
import { NotifyTeamChangeUseCase } from "./NotifyTeamChangeUseCase.js";
|
|
3
|
+
import { NotifyOnTeamCreatedHandler, NotifyOnTeamDeletedHandler, NotifyOnTeamUpdatedHandler } from "./NotifyOnTeamChangeHandlers.js";
|
|
4
|
+
const NotifyTeamChangeFeature = createFeature({
|
|
5
|
+
name: "NotifyTeamChange",
|
|
6
|
+
register (container) {
|
|
7
|
+
container.register(NotifyTeamChangeUseCase);
|
|
8
|
+
container.register(NotifyOnTeamCreatedHandler);
|
|
9
|
+
container.register(NotifyOnTeamUpdatedHandler);
|
|
10
|
+
container.register(NotifyOnTeamDeletedHandler);
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
export { NotifyTeamChangeFeature };
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=feature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/security/teams/NotifyTeamChange/feature.js","sources":["../../../../../src/features/security/teams/NotifyTeamChange/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { NotifyTeamChangeUseCase } from \"./NotifyTeamChangeUseCase.js\";\nimport {\n NotifyOnTeamCreatedHandler,\n NotifyOnTeamDeletedHandler,\n NotifyOnTeamUpdatedHandler\n} from \"./NotifyOnTeamChangeHandlers.js\";\n\n/** Tells the user's open admin tabs when a team is created, updated or deleted. */\nexport const NotifyTeamChangeFeature = createFeature({\n name: \"NotifyTeamChange\",\n register(container) {\n container.register(NotifyTeamChangeUseCase);\n container.register(NotifyOnTeamCreatedHandler);\n container.register(NotifyOnTeamUpdatedHandler);\n container.register(NotifyOnTeamDeletedHandler);\n }\n});\n"],"names":["NotifyTeamChangeFeature","createFeature","container","NotifyTeamChangeUseCase","NotifyOnTeamCreatedHandler","NotifyOnTeamUpdatedHandler","NotifyOnTeamDeletedHandler"],"mappings":";;;AASO,MAAMA,0BAA0BC,cAAc;IACjD,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;QACnBD,UAAU,QAAQ,CAACE;QACnBF,UAAU,QAAQ,CAACG;QACnBH,UAAU,QAAQ,CAACI;IACvB;AACJ"}
|
|
@@ -7,6 +7,7 @@ import { EventPublisher } from "../../../eventPublisher/index.js";
|
|
|
7
7
|
import { updateTeamValidation } from "./schema.js";
|
|
8
8
|
import { TeamAfterUpdateEvent, TeamBeforeUpdateEvent } from "./events.js";
|
|
9
9
|
import { descriptionOnUpdate } from "../../shared/description.js";
|
|
10
|
+
import { definedOnly } from "../../shared/definedOnly.js";
|
|
10
11
|
import { resolveRoleIdentifiers } from "../shared/resolveRoleIdentifiers.js";
|
|
11
12
|
import { CannotUpdatePluginTeamsError, CannotUpdateSystemTeamsError, NotAuthorizedError, TeamValidationError } from "../shared/errors.js";
|
|
12
13
|
class UpdateTeamUseCase {
|
|
@@ -30,7 +31,7 @@ class UpdateTeamUseCase {
|
|
|
30
31
|
if (existingTeam.plugin) return Result.fail(new CannotUpdatePluginTeamsError());
|
|
31
32
|
const { description, ...rest } = validation.data;
|
|
32
33
|
const changes = {
|
|
33
|
-
...rest,
|
|
34
|
+
...definedOnly(rest),
|
|
34
35
|
...descriptionOnUpdate(description)
|
|
35
36
|
};
|
|
36
37
|
if (changes.roles) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/security/teams/UpdateTeam/UpdateTeamUseCase.js","sources":["../../../../../src/features/security/teams/UpdateTeam/UpdateTeamUseCase.ts"],"sourcesContent":["import { createImplementation } from \"@webiny/feature/api\";\nimport { Result } from \"@webiny/feature/api\";\nimport { UpdateTeam } from \"./abstractions.js\";\nimport { TeamsRepository } from \"../shared/abstractions.js\";\nimport { RolesRepository } from \"../../roles/shared/abstractions.js\";\nimport { IdentityContext } from \"../../IdentityContext/abstractions.js\";\nimport { EventPublisher } from \"~/features/eventPublisher/index.js\";\nimport { updateTeamValidation } from \"./schema.js\";\nimport { TeamBeforeUpdateEvent, TeamAfterUpdateEvent } from \"./events.js\";\nimport type { Team, UpdateTeamInput } from \"../shared/types.js\";\nimport { descriptionOnUpdate } from \"../../shared/description.js\";\nimport { resolveRoleIdentifiers } from \"../shared/resolveRoleIdentifiers.js\";\nimport {\n NotAuthorizedError,\n CannotUpdatePluginTeamsError,\n CannotUpdateSystemTeamsError,\n TeamValidationError\n} from \"../shared/errors.js\";\n\nexport class UpdateTeamUseCase {\n private repository: TeamsRepository.Interface;\n private identityContext: IdentityContext.Interface;\n private eventPublisher: EventPublisher.Interface;\n private rolesRepository: RolesRepository.Interface;\n\n constructor(\n repository: TeamsRepository.Interface,\n identityContext: IdentityContext.Interface,\n eventPublisher: EventPublisher.Interface,\n rolesRepository: RolesRepository.Interface\n ) {\n this.repository = repository;\n this.identityContext = identityContext;\n this.eventPublisher = eventPublisher;\n this.rolesRepository = rolesRepository;\n }\n\n async execute(id: string, input: UpdateTeamInput): Promise<Result<Team, UpdateTeam.Error>> {\n const hasPermission = await this.identityContext.getPermission(\"security.team\");\n if (!hasPermission) {\n return Result.fail(new NotAuthorizedError());\n }\n\n const validation = updateTeamValidation.safeParse(input);\n if (!validation.success) {\n return Result.fail(new TeamValidationError(validation.error.issues[0].message));\n }\n\n const existingResult = await this.repository.get({ id });\n if (existingResult.isFail()) {\n return Result.fail(existingResult.error);\n }\n\n const existingTeam = existingResult.value;\n\n // Check if team is system team\n if (existingTeam.system) {\n return Result.fail(new CannotUpdateSystemTeamsError());\n }\n\n // Check if team is created via plugin\n if (existingTeam.plugin) {\n return Result.fail(new CannotUpdatePluginTeamsError());\n }\n\n // `description` is pulled out of the spread because it is the one field that accepts null.\n // Normalising it here keeps null out of both the entity and the published events, whose\n // input type declares `description?: string`.\n const { description, ...rest } = validation.data;\n\n const changes: UpdateTeamInput = {\n ...rest,\n ...descriptionOnUpdate(description)\n };\n\n /*\n * Only when the update mentions roles. An update that omits them must leave the stored ones\n * alone, and resolving an absent list would cost a read and write an empty array.\n */\n if (changes.roles) {\n const roleIdsResult = await resolveRoleIdentifiers(this.rolesRepository, changes.roles);\n\n if (roleIdsResult.isFail()) {\n return Result.fail(roleIdsResult.error);\n }\n\n changes.roles = roleIdsResult.value;\n }\n\n const updatedTeam: Team = {\n ...existingTeam,\n ...changes\n };\n\n await this.eventPublisher.publish(\n new TeamBeforeUpdateEvent({\n original: existingTeam,\n updated: updatedTeam,\n input: changes\n })\n );\n\n const result = await this.repository.update(updatedTeam);\n\n if (result.isFail()) {\n return Result.fail(result.error);\n }\n\n await this.eventPublisher.publish(\n new TeamAfterUpdateEvent({\n original: existingTeam,\n updated: updatedTeam,\n input: changes\n })\n );\n\n return Result.ok(updatedTeam);\n }\n}\n\nexport const UpdateTeamUseCaseImpl = createImplementation({\n abstraction: UpdateTeam,\n implementation: UpdateTeamUseCase,\n dependencies: [TeamsRepository, IdentityContext, EventPublisher, RolesRepository]\n});\n"],"names":["UpdateTeamUseCase","repository","identityContext","eventPublisher","rolesRepository","id","input","hasPermission","Result","NotAuthorizedError","validation","updateTeamValidation","TeamValidationError","existingResult","existingTeam","CannotUpdateSystemTeamsError","CannotUpdatePluginTeamsError","description","rest","changes","descriptionOnUpdate","roleIdsResult","resolveRoleIdentifiers","updatedTeam","TeamBeforeUpdateEvent","result","TeamAfterUpdateEvent","UpdateTeamUseCaseImpl","createImplementation","UpdateTeam","TeamsRepository","IdentityContext","EventPublisher","RolesRepository"],"mappings":"
|
|
1
|
+
{"version":3,"file":"features/security/teams/UpdateTeam/UpdateTeamUseCase.js","sources":["../../../../../src/features/security/teams/UpdateTeam/UpdateTeamUseCase.ts"],"sourcesContent":["import { createImplementation } from \"@webiny/feature/api\";\nimport { Result } from \"@webiny/feature/api\";\nimport { UpdateTeam } from \"./abstractions.js\";\nimport { TeamsRepository } from \"../shared/abstractions.js\";\nimport { RolesRepository } from \"../../roles/shared/abstractions.js\";\nimport { IdentityContext } from \"../../IdentityContext/abstractions.js\";\nimport { EventPublisher } from \"~/features/eventPublisher/index.js\";\nimport { updateTeamValidation } from \"./schema.js\";\nimport { TeamBeforeUpdateEvent, TeamAfterUpdateEvent } from \"./events.js\";\nimport type { Team, UpdateTeamInput } from \"../shared/types.js\";\nimport { descriptionOnUpdate } from \"../../shared/description.js\";\nimport { definedOnly } from \"../../shared/definedOnly.js\";\nimport { resolveRoleIdentifiers } from \"../shared/resolveRoleIdentifiers.js\";\nimport {\n NotAuthorizedError,\n CannotUpdatePluginTeamsError,\n CannotUpdateSystemTeamsError,\n TeamValidationError\n} from \"../shared/errors.js\";\n\nexport class UpdateTeamUseCase {\n private repository: TeamsRepository.Interface;\n private identityContext: IdentityContext.Interface;\n private eventPublisher: EventPublisher.Interface;\n private rolesRepository: RolesRepository.Interface;\n\n constructor(\n repository: TeamsRepository.Interface,\n identityContext: IdentityContext.Interface,\n eventPublisher: EventPublisher.Interface,\n rolesRepository: RolesRepository.Interface\n ) {\n this.repository = repository;\n this.identityContext = identityContext;\n this.eventPublisher = eventPublisher;\n this.rolesRepository = rolesRepository;\n }\n\n async execute(id: string, input: UpdateTeamInput): Promise<Result<Team, UpdateTeam.Error>> {\n const hasPermission = await this.identityContext.getPermission(\"security.team\");\n if (!hasPermission) {\n return Result.fail(new NotAuthorizedError());\n }\n\n const validation = updateTeamValidation.safeParse(input);\n if (!validation.success) {\n return Result.fail(new TeamValidationError(validation.error.issues[0].message));\n }\n\n const existingResult = await this.repository.get({ id });\n if (existingResult.isFail()) {\n return Result.fail(existingResult.error);\n }\n\n const existingTeam = existingResult.value;\n\n // Check if team is system team\n if (existingTeam.system) {\n return Result.fail(new CannotUpdateSystemTeamsError());\n }\n\n // Check if team is created via plugin\n if (existingTeam.plugin) {\n return Result.fail(new CannotUpdatePluginTeamsError());\n }\n\n // `description` is pulled out of the spread because it is the one field that accepts null.\n // Normalising it here keeps null out of both the entity and the published events, whose\n // input type declares `description?: string`.\n const { description, ...rest } = validation.data;\n\n const changes: UpdateTeamInput = {\n ...definedOnly(rest),\n ...descriptionOnUpdate(description)\n };\n\n /*\n * Only when the update mentions roles. An update that omits them must leave the stored ones\n * alone, and resolving an absent list would cost a read and write an empty array.\n */\n if (changes.roles) {\n const roleIdsResult = await resolveRoleIdentifiers(this.rolesRepository, changes.roles);\n\n if (roleIdsResult.isFail()) {\n return Result.fail(roleIdsResult.error);\n }\n\n changes.roles = roleIdsResult.value;\n }\n\n const updatedTeam: Team = {\n ...existingTeam,\n ...changes\n };\n\n await this.eventPublisher.publish(\n new TeamBeforeUpdateEvent({\n original: existingTeam,\n updated: updatedTeam,\n input: changes\n })\n );\n\n const result = await this.repository.update(updatedTeam);\n\n if (result.isFail()) {\n return Result.fail(result.error);\n }\n\n await this.eventPublisher.publish(\n new TeamAfterUpdateEvent({\n original: existingTeam,\n updated: updatedTeam,\n input: changes\n })\n );\n\n return Result.ok(updatedTeam);\n }\n}\n\nexport const UpdateTeamUseCaseImpl = createImplementation({\n abstraction: UpdateTeam,\n implementation: UpdateTeamUseCase,\n dependencies: [TeamsRepository, IdentityContext, EventPublisher, RolesRepository]\n});\n"],"names":["UpdateTeamUseCase","repository","identityContext","eventPublisher","rolesRepository","id","input","hasPermission","Result","NotAuthorizedError","validation","updateTeamValidation","TeamValidationError","existingResult","existingTeam","CannotUpdateSystemTeamsError","CannotUpdatePluginTeamsError","description","rest","changes","definedOnly","descriptionOnUpdate","roleIdsResult","resolveRoleIdentifiers","updatedTeam","TeamBeforeUpdateEvent","result","TeamAfterUpdateEvent","UpdateTeamUseCaseImpl","createImplementation","UpdateTeam","TeamsRepository","IdentityContext","EventPublisher","RolesRepository"],"mappings":";;;;;;;;;;;;AAoBO,MAAMA;IAMT,YACIC,UAAqC,EACrCC,eAA0C,EAC1CC,cAAwC,EACxCC,eAA0C,CAC5C;QACE,IAAI,CAAC,UAAU,GAAGH;QAClB,IAAI,CAAC,eAAe,GAAGC;QACvB,IAAI,CAAC,cAAc,GAAGC;QACtB,IAAI,CAAC,eAAe,GAAGC;IAC3B;IAEA,MAAM,QAAQC,EAAU,EAAEC,KAAsB,EAA2C;QACvF,MAAMC,gBAAgB,MAAM,IAAI,CAAC,eAAe,CAAC,aAAa,CAAC;QAC/D,IAAI,CAACA,eACD,OAAOC,OAAO,IAAI,CAAC,IAAIC;QAG3B,MAAMC,aAAaC,qBAAqB,SAAS,CAACL;QAClD,IAAI,CAACI,WAAW,OAAO,EACnB,OAAOF,OAAO,IAAI,CAAC,IAAII,oBAAoBF,WAAW,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,OAAO;QAGjF,MAAMG,iBAAiB,MAAM,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;YAAER;QAAG;QACtD,IAAIQ,eAAe,MAAM,IACrB,OAAOL,OAAO,IAAI,CAACK,eAAe,KAAK;QAG3C,MAAMC,eAAeD,eAAe,KAAK;QAGzC,IAAIC,aAAa,MAAM,EACnB,OAAON,OAAO,IAAI,CAAC,IAAIO;QAI3B,IAAID,aAAa,MAAM,EACnB,OAAON,OAAO,IAAI,CAAC,IAAIQ;QAM3B,MAAM,EAAEC,WAAW,EAAE,GAAGC,MAAM,GAAGR,WAAW,IAAI;QAEhD,MAAMS,UAA2B;YAC7B,GAAGC,YAAYF,KAAK;YACpB,GAAGG,oBAAoBJ,YAAY;QACvC;QAMA,IAAIE,QAAQ,KAAK,EAAE;YACf,MAAMG,gBAAgB,MAAMC,uBAAuB,IAAI,CAAC,eAAe,EAAEJ,QAAQ,KAAK;YAEtF,IAAIG,cAAc,MAAM,IACpB,OAAOd,OAAO,IAAI,CAACc,cAAc,KAAK;YAG1CH,QAAQ,KAAK,GAAGG,cAAc,KAAK;QACvC;QAEA,MAAME,cAAoB;YACtB,GAAGV,YAAY;YACf,GAAGK,OAAO;QACd;QAEA,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAC7B,IAAIM,sBAAsB;YACtB,UAAUX;YACV,SAASU;YACT,OAAOL;QACX;QAGJ,MAAMO,SAAS,MAAM,IAAI,CAAC,UAAU,CAAC,MAAM,CAACF;QAE5C,IAAIE,OAAO,MAAM,IACb,OAAOlB,OAAO,IAAI,CAACkB,OAAO,KAAK;QAGnC,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAC7B,IAAIC,qBAAqB;YACrB,UAAUb;YACV,SAASU;YACT,OAAOL;QACX;QAGJ,OAAOX,OAAO,EAAE,CAACgB;IACrB;AACJ;AAEO,MAAMI,wBAAwBC,qBAAqB;IACtD,aAAaC;IACb,gBAAgB9B;IAChB,cAAc;QAAC+B;QAAiBC;QAAiBC;QAAgBC;KAAgB;AACrF"}
|
|
@@ -7,6 +7,7 @@ import { ListTeamsFeature } from "./ListTeams/feature.js";
|
|
|
7
7
|
import { CreateTeamFeature } from "./CreateTeam/feature.js";
|
|
8
8
|
import { UpdateTeamFeature } from "./UpdateTeam/feature.js";
|
|
9
9
|
import { DeleteTeamFeature } from "./DeleteTeam/feature.js";
|
|
10
|
+
import { NotifyTeamChangeFeature } from "./NotifyTeamChange/index.js";
|
|
10
11
|
const TeamsFeature = createFeature({
|
|
11
12
|
name: "Teams",
|
|
12
13
|
register (container) {
|
|
@@ -18,6 +19,7 @@ const TeamsFeature = createFeature({
|
|
|
18
19
|
CreateTeamFeature.register(container);
|
|
19
20
|
UpdateTeamFeature.register(container);
|
|
20
21
|
DeleteTeamFeature.register(container);
|
|
22
|
+
NotifyTeamChangeFeature.register(container);
|
|
21
23
|
}
|
|
22
24
|
});
|
|
23
25
|
export { TeamsFeature };
|