@webiny/api-core 0.0.0-unstable.a4f3e4ea8b → 0.0.0-unstable.a85ef555b2
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 +2 -2
- package/ApiCoreFeature.js +35 -5
- 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.js +16 -6
- package/features/ai/Ai.js.map +1 -1
- package/features/ai/AiModelRegistry.d.ts +3 -1
- package/features/ai/AiModelRegistry.js +16 -7
- package/features/ai/AiModelRegistry.js.map +1 -1
- 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/DEVELOPERS.md +69 -12
- 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 +90 -7
- package/features/ai/abstractions.js +5 -2
- package/features/ai/abstractions.js.map +1 -1
- package/features/ai/feature.js +6 -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/dateFormatter/DefaultDateFormatter.d.ts +15 -0
- package/features/dateFormatter/DefaultDateFormatter.js +20 -0
- package/features/dateFormatter/DefaultDateFormatter.js.map +1 -0
- package/features/dateFormatter/abstractions.d.ts +13 -0
- package/features/dateFormatter/abstractions.js +5 -0
- package/features/dateFormatter/abstractions.js.map +1 -0
- package/features/dateFormatter/feature.d.ts +4 -0
- package/features/dateFormatter/feature.js +11 -0
- package/features/dateFormatter/feature.js.map +1 -0
- package/features/dateFormatter/index.d.ts +3 -0
- package/features/dateFormatter/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 +107 -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/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 +2 -1
- package/features/encryption/EncryptionService.js +11 -4
- 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 +11 -0
- package/features/encryption/abstractions.js +2 -1
- package/features/encryption/abstractions.js.map +1 -1
- package/features/encryption/index.d.ts +1 -0
- package/features/encryption/index.js +1 -0
- package/features/featureFlags/decorators/FeatureFlagsWithLicenseDecorator.d.ts +13 -0
- package/features/featureFlags/decorators/FeatureFlagsWithLicenseDecorator.js +62 -0
- package/features/featureFlags/decorators/FeatureFlagsWithLicenseDecorator.js.map +1 -0
- package/features/hashing/ScryptHasher.d.ts +11 -0
- package/features/hashing/ScryptHasher.js +74 -0
- package/features/hashing/ScryptHasher.js.map +1 -0
- package/features/hashing/abstractions.d.ts +18 -0
- package/features/hashing/abstractions.js +5 -0
- package/features/hashing/abstractions.js.map +1 -0
- package/features/hashing/feature.d.ts +4 -0
- package/features/hashing/feature.js +11 -0
- package/features/hashing/feature.js.map +1 -0
- package/features/hashing/index.d.ts +2 -0
- package/features/hashing/index.js +1 -0
- 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/httpClient/feature.d.ts +4 -0
- 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/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/RawAuthToken.d.ts +14 -0
- package/features/requestContext/RawAuthToken.js +19 -0
- package/features/requestContext/RawAuthToken.js.map +1 -0
- package/features/requestContext/RawTenantId.d.ts +14 -0
- package/features/requestContext/RawTenantId.js +19 -0
- package/features/requestContext/RawTenantId.js.map +1 -0
- package/features/requestContext/RequestIdentityLoader.d.ts +19 -0
- package/features/requestContext/RequestIdentityLoader.js +26 -0
- package/features/requestContext/RequestIdentityLoader.js.map +1 -0
- package/features/requestContext/RequestTenantLoader.d.ts +18 -0
- package/features/requestContext/RequestTenantLoader.js +52 -0
- package/features/requestContext/RequestTenantLoader.js.map +1 -0
- package/features/requestContext/abstractions.d.ts +75 -0
- package/features/requestContext/abstractions.js +9 -0
- package/features/requestContext/abstractions.js.map +1 -0
- 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 +12 -0
- package/features/requestContext/feature.js +19 -0
- package/features/requestContext/feature.js.map +1 -0
- package/features/requestContext/index.d.ts +4 -0
- package/features/requestContext/index.js +3 -0
- package/features/security/IdentityContext/IdentityContext.d.ts +4 -3
- package/features/security/IdentityContext/IdentityContext.js +9 -6
- package/features/security/IdentityContext/IdentityContext.js.map +1 -1
- package/features/security/IdentityContext/abstractions.d.ts +5 -0
- package/features/security/IdentityContext/abstractions.js.map +1 -1
- package/features/security/apiKeys/ApiKeyAuthenticator.d.ts +14 -0
- package/features/security/apiKeys/ApiKeyAuthenticator.js +36 -0
- package/features/security/apiKeys/ApiKeyAuthenticator.js.map +1 -0
- package/features/security/apiKeys/ApiKeyAuthorizer.d.ts +10 -0
- package/features/security/apiKeys/ApiKeyAuthorizer.js +15 -0
- package/features/security/apiKeys/ApiKeyAuthorizer.js.map +1 -0
- package/features/security/apiKeys/CreateApiKey/CreateApiKeyUseCase.js +11 -6
- package/features/security/apiKeys/CreateApiKey/CreateApiKeyUseCase.js.map +1 -1
- package/features/security/apiKeys/GetApiKeyBySlug/GetApiKeyBySlugUseCase.d.ts +1 -1
- package/features/security/apiKeys/GetApiKeyByToken/GetApiKeyByTokenUseCase.d.ts +1 -1
- package/features/security/apiKeys/UpdateApiKey/UpdateApiKeyUseCase.js +9 -3
- package/features/security/apiKeys/UpdateApiKey/UpdateApiKeyUseCase.js.map +1 -1
- package/features/security/apiKeys/feature.js +4 -0
- package/features/security/apiKeys/feature.js.map +1 -1
- package/features/security/apiKeys/shared/schemas.d.ts +2 -2
- package/features/security/apiKeys/shared/schemas.js +2 -2
- package/features/security/apiKeys/shared/schemas.js.map +1 -1
- package/features/security/authorization/AuthorizationContext/AuthorizationContext.d.ts +12 -3
- package/features/security/authorization/AuthorizationContext/AuthorizationContext.js +31 -18
- 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/GetPermissionsFromIdentity.d.ts +3 -3
- package/features/security/authorization/GroupsTeamsAuthorizer/GetPermissionsFromIdentity.js +5 -5
- package/features/security/authorization/GroupsTeamsAuthorizer/GetPermissionsFromIdentity.js.map +1 -1
- package/features/security/authorization/GroupsTeamsAuthorizer/feature.js +2 -0
- package/features/security/authorization/GroupsTeamsAuthorizer/feature.js.map +1 -1
- package/features/security/roles/CreateRole/CreateRoleUseCase.js +11 -6
- package/features/security/roles/CreateRole/CreateRoleUseCase.js.map +1 -1
- package/features/security/roles/CreateRole/schema.d.ts +1 -1
- package/features/security/roles/CreateRole/schema.js +1 -1
- package/features/security/roles/CreateRole/schema.js.map +1 -1
- package/features/security/roles/UpdateRole/UpdateRoleUseCase.js +9 -3
- package/features/security/roles/UpdateRole/UpdateRoleUseCase.js.map +1 -1
- package/features/security/roles/UpdateRole/schema.d.ts +1 -1
- package/features/security/roles/UpdateRole/schema.js +1 -1
- package/features/security/roles/UpdateRole/schema.js.map +1 -1
- package/features/security/shared/description.d.ts +4 -0
- package/features/security/shared/description.js +7 -0
- package/features/security/shared/description.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/CreateTeam/CreateTeamUseCase.d.ts +3 -1
- package/features/security/teams/CreateTeam/CreateTeamUseCase.js +20 -8
- package/features/security/teams/CreateTeam/CreateTeamUseCase.js.map +1 -1
- package/features/security/teams/CreateTeam/schema.d.ts +1 -1
- package/features/security/teams/CreateTeam/schema.js +1 -1
- package/features/security/teams/CreateTeam/schema.js.map +1 -1
- package/features/security/teams/UpdateTeam/UpdateTeamUseCase.d.ts +3 -1
- package/features/security/teams/UpdateTeam/UpdateTeamUseCase.js +20 -5
- package/features/security/teams/UpdateTeam/UpdateTeamUseCase.js.map +1 -1
- package/features/security/teams/UpdateTeam/schema.d.ts +1 -1
- package/features/security/teams/UpdateTeam/schema.js +1 -1
- package/features/security/teams/UpdateTeam/schema.js.map +1 -1
- package/features/security/teams/shared/resolveRoleIdentifiers.d.ts +17 -0
- package/features/security/teams/shared/resolveRoleIdentifiers.js +32 -0
- package/features/security/teams/shared/resolveRoleIdentifiers.js.map +1 -0
- package/features/slugify/DefaultSlugify.d.ts +8 -0
- package/features/slugify/DefaultSlugify.js +20 -0
- package/features/slugify/DefaultSlugify.js.map +1 -0
- package/features/slugify/abstractions.d.ts +12 -0
- package/features/slugify/abstractions.js +5 -0
- package/features/slugify/abstractions.js.map +1 -0
- package/features/slugify/feature.d.ts +4 -0
- package/features/slugify/feature.js +11 -0
- package/features/slugify/feature.js.map +1 -0
- package/features/slugify/index.d.ts +3 -0
- package/features/slugify/index.js +2 -0
- package/features/storageOperations/abstractions.d.ts +21 -0
- package/features/storageOperations/abstractions.js +10 -0
- package/features/storageOperations/abstractions.js.map +1 -0
- package/features/stringFormatter/DefaultStringFormatter.d.ts +17 -0
- package/features/stringFormatter/DefaultStringFormatter.js +19 -0
- package/features/stringFormatter/DefaultStringFormatter.js.map +1 -0
- package/features/stringFormatter/abstractions.d.ts +11 -0
- package/features/stringFormatter/abstractions.js +5 -0
- package/features/stringFormatter/abstractions.js.map +1 -0
- package/features/stringFormatter/feature.d.ts +4 -0
- package/features/stringFormatter/feature.js +13 -0
- package/features/stringFormatter/feature.js.map +1 -0
- package/features/stringFormatter/index.d.ts +3 -0
- package/features/stringFormatter/index.js +2 -0
- package/features/task/TaskDefinition/abstractions.d.ts +69 -4
- package/features/task/TaskDefinition/abstractions.js +2 -1
- package/features/task/TaskDefinition/abstractions.js.map +1 -1
- package/features/tenancy/TenantContext/TenantContext.d.ts +1 -0
- package/features/tenancy/TenantContext/TenantContext.js +13 -8
- package/features/tenancy/TenantContext/TenantContext.js.map +1 -1
- package/features/users/shared/types.d.ts +9 -7
- package/features/wcp/WcpContext/WcpContext.d.ts +12 -5
- package/features/wcp/WcpContext/WcpContext.js +29 -2
- package/features/wcp/WcpContext/WcpContext.js.map +1 -1
- package/features/wcp/WcpContext/decorators/WcpContextWithFeatureFlagsDecorator.d.ts +11 -66
- package/features/wcp/WcpContext/decorators/WcpContextWithFeatureFlagsDecorator.js +71 -33
- package/features/wcp/WcpContext/decorators/WcpContextWithFeatureFlagsDecorator.js.map +1 -1
- package/features/wcp/WcpContext/feature.d.ts +1 -2
- package/features/wcp/WcpContext/feature.js +2 -2
- package/features/wcp/WcpContext/feature.js.map +1 -1
- package/features/wcp/WcpContext/index.d.ts +0 -1
- package/features/wcp/WcpContext/types.d.ts +0 -4
- package/features/wcp/WcpFeature.d.ts +1 -1
- package/features/wcp/WcpFeature.js +7 -2
- package/features/wcp/WcpFeature.js.map +1 -1
- package/features/wcp/WcpLicenseLoader.d.ts +25 -0
- package/features/wcp/WcpLicenseLoader.js +58 -0
- package/features/wcp/WcpLicenseLoader.js.map +1 -0
- package/features/wcp/WcpLicenseProvider.d.ts +21 -0
- package/features/wcp/WcpLicenseProvider.js +14 -0
- package/features/wcp/WcpLicenseProvider.js.map +1 -0
- package/features/wcp/resolveWcpProjectEnvironment.d.ts +9 -0
- package/features/wcp/resolveWcpProjectEnvironment.js +23 -0
- package/features/wcp/resolveWcpProjectEnvironment.js.map +1 -0
- package/graphql/ApiCoreSchemaFactory.d.ts +16 -0
- package/graphql/ApiCoreSchemaFactory.js +58 -0
- package/graphql/ApiCoreSchemaFactory.js.map +1 -0
- package/graphql/featureFlags/FeatureFlagsSchemaFactory.d.ts +10 -0
- package/graphql/featureFlags/FeatureFlagsSchemaFactory.js +53 -0
- package/graphql/featureFlags/FeatureFlagsSchemaFactory.js.map +1 -0
- package/graphql/security/NotAuthorizedResponse.d.ts +1 -1
- package/graphql/security/NotAuthorizedResponse.js +1 -1
- package/graphql/security/NotAuthorizedResponse.js.map +1 -1
- package/graphql/security/SecuritySchemaFactory.d.ts +15 -0
- package/graphql/security/SecuritySchemaFactory.js +27 -0
- package/graphql/security/SecuritySchemaFactory.js.map +1 -0
- package/graphql/security/addApiKeySchema.d.ts +2 -0
- package/graphql/security/{apiKey.gql.js → addApiKeySchema.js} +45 -27
- package/graphql/security/addApiKeySchema.js.map +1 -0
- package/graphql/security/addIdentitySchema.d.ts +2 -0
- package/graphql/security/{identity.gql.js → addIdentitySchema.js} +52 -35
- package/graphql/security/addIdentitySchema.js.map +1 -0
- package/graphql/security/addRoleSchema.d.ts +2 -0
- package/graphql/security/addRoleSchema.js +137 -0
- package/graphql/security/addRoleSchema.js.map +1 -0
- package/graphql/security/addSecurityBaseSchema.d.ts +2 -0
- package/graphql/security/{base.gql.js → addSecurityBaseSchema.js} +14 -16
- package/graphql/security/addSecurityBaseSchema.js.map +1 -0
- package/graphql/security/addTeamSchema.d.ts +2 -0
- package/graphql/security/addTeamSchema.js +157 -0
- package/graphql/security/addTeamSchema.js.map +1 -0
- package/graphql/system/SystemSchemaFactory.d.ts +10 -0
- package/graphql/system/SystemSchemaFactory.js +70 -0
- package/graphql/system/SystemSchemaFactory.js.map +1 -0
- package/graphql/users/UsersSchemaFactory.d.ts +10 -0
- package/graphql/users/UsersSchemaFactory.js +195 -0
- package/graphql/users/UsersSchemaFactory.js.map +1 -0
- package/graphql/wcp/WcpSchemaFactory.d.ts +10 -0
- package/graphql/wcp/{graphql.js → WcpSchemaFactory.js} +32 -18
- package/graphql/wcp/WcpSchemaFactory.js.map +1 -0
- 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 +3 -1
- package/index.js +3 -1
- package/package.json +22 -22
- package/testing/environment.d.ts +14 -0
- package/testing/environment.js +18 -0
- package/testing/environment.js.map +1 -0
- package/types/core.d.ts +17 -5
- package/types/security.d.ts +0 -6
- package/types/tenancy.d.ts +0 -17
- package/types/users.d.ts +2 -16
- package/createApiCore.d.ts +0 -7
- package/createApiCore.js +0 -26
- package/createApiCore.js.map +0 -1
- package/graphql/security/apiKey.gql.d.ts +0 -4
- package/graphql/security/apiKey.gql.js.map +0 -1
- package/graphql/security/base.gql.d.ts +0 -4
- package/graphql/security/base.gql.js.map +0 -1
- package/graphql/security/identity.gql.d.ts +0 -4
- package/graphql/security/identity.gql.js.map +0 -1
- package/graphql/security/index.d.ts +0 -1
- package/graphql/security/index.js +0 -15
- package/graphql/security/index.js.map +0 -1
- package/graphql/security/role.gql.d.ts +0 -4
- package/graphql/security/role.gql.js +0 -106
- package/graphql/security/role.gql.js.map +0 -1
- package/graphql/security/team.gql.d.ts +0 -4
- package/graphql/security/team.gql.js +0 -119
- package/graphql/security/team.gql.js.map +0 -1
- package/graphql/system/createSystemGraphQL.d.ts +0 -2
- package/graphql/system/createSystemGraphQL.js +0 -54
- package/graphql/system/createSystemGraphQL.js.map +0 -1
- package/graphql/users/user.gql.d.ts +0 -3
- package/graphql/users/user.gql.js +0 -167
- package/graphql/users/user.gql.js.map +0 -1
- package/graphql/wcp/graphql.d.ts +0 -2
- package/graphql/wcp/graphql.js.map +0 -1
- package/legacy/security/LegacyContext.d.ts +0 -36
- package/legacy/security/LegacyContext.js +0 -152
- package/legacy/security/LegacyContext.js.map +0 -1
- package/legacy/security/createSecurityContext.d.ts +0 -3
- package/legacy/security/createSecurityContext.js +0 -10
- package/legacy/security/createSecurityContext.js.map +0 -1
- package/legacy/security/plugins/apiKeyAuthentication.d.ts +0 -7
- package/legacy/security/plugins/apiKeyAuthentication.js +0 -20
- package/legacy/security/plugins/apiKeyAuthentication.js.map +0 -1
- package/legacy/security/plugins/apiKeyAuthorization.d.ts +0 -6
- package/legacy/security/plugins/apiKeyAuthorization.js +0 -13
- package/legacy/security/plugins/apiKeyAuthorization.js.map +0 -1
- package/legacy/security/plugins/authenticateUsingCookie.d.ts +0 -5
- package/legacy/security/plugins/authenticateUsingCookie.js +0 -23
- package/legacy/security/plugins/authenticateUsingCookie.js.map +0 -1
- package/legacy/security/plugins/authenticateUsingHttpHeader.d.ts +0 -5
- package/legacy/security/plugins/authenticateUsingHttpHeader.js +0 -20
- package/legacy/security/plugins/authenticateUsingHttpHeader.js.map +0 -1
- package/legacy/security/plugins/secureHeaders.d.ts +0 -1
- package/legacy/security/plugins/secureHeaders.js +0 -30
- package/legacy/security/plugins/secureHeaders.js.map +0 -1
- package/legacy/tenancy/LegacyContext.d.ts +0 -15
- package/legacy/tenancy/LegacyContext.js +0 -57
- package/legacy/tenancy/LegacyContext.js.map +0 -1
- package/legacy/tenancy/createTenancyContext.d.ts +0 -3
- package/legacy/tenancy/createTenancyContext.js +0 -31
- package/legacy/tenancy/createTenancyContext.js.map +0 -1
- package/legacy/users/LegacyContext.d.ts +0 -13
- package/legacy/users/LegacyContext.js +0 -55
- package/legacy/users/LegacyContext.js.map +0 -1
- package/legacy/users/createAdminUsersContext.d.ts +0 -3
- package/legacy/users/createAdminUsersContext.js +0 -12
- package/legacy/users/createAdminUsersContext.js.map +0 -1
- package/legacy/wcp/LegacyWcpContext.d.ts +0 -37
- package/legacy/wcp/LegacyWcpContext.js +0 -96
- package/legacy/wcp/LegacyWcpContext.js.map +0 -1
- package/legacy/wcp/context.d.ts +0 -5
- package/legacy/wcp/context.js +0 -46
- package/legacy/wcp/context.js.map +0 -1
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { FeatureFlags } from "../../../featureFlags/abstractions.js";
|
|
2
|
+
import { RawAssumePermissions } from "../../../requestContext/abstractions.js";
|
|
3
|
+
import { RolesRepository } from "../../roles/shared/abstractions.js";
|
|
4
|
+
import { TeamsRepository } from "../../teams/shared/abstractions.js";
|
|
5
|
+
import { getPermissionsFromRoles } from "../../utils/getPermissionsFromRoles.js";
|
|
6
|
+
import { PermissionsProcessor } from "./abstractions.js";
|
|
7
|
+
function grantsFullAccess(permissions) {
|
|
8
|
+
return permissions.some((permission)=>"*" === permission.name);
|
|
9
|
+
}
|
|
10
|
+
class AssumedPermissionsImpl {
|
|
11
|
+
constructor(rawAssumePermissions, featureFlags, rolesRepository, teamsRepository, decoratee){
|
|
12
|
+
this.rawAssumePermissions = rawAssumePermissions;
|
|
13
|
+
this.featureFlags = featureFlags;
|
|
14
|
+
this.rolesRepository = rolesRepository;
|
|
15
|
+
this.teamsRepository = teamsRepository;
|
|
16
|
+
this.decoratee = decoratee;
|
|
17
|
+
}
|
|
18
|
+
async getPermissions(identity) {
|
|
19
|
+
const target = this.rawAssumePermissions.get();
|
|
20
|
+
const own = await this.decoratee.getPermissions(identity);
|
|
21
|
+
if (!target) return own;
|
|
22
|
+
if (!own || !grantsFullAccess(own)) return own;
|
|
23
|
+
const roles = await this.loadAssumedRoles(target);
|
|
24
|
+
return getPermissionsFromRoles(roles);
|
|
25
|
+
}
|
|
26
|
+
async loadAssumedRoles(target) {
|
|
27
|
+
if ("role" === target.type) return this.loadRoles([
|
|
28
|
+
target.id
|
|
29
|
+
]);
|
|
30
|
+
const teamsEnabled = this.featureFlags.get().isEnabled("advancedAccessControlLayer.teams");
|
|
31
|
+
if (!teamsEnabled) return [];
|
|
32
|
+
const teamResult = await this.teamsRepository.get({
|
|
33
|
+
id: target.id
|
|
34
|
+
});
|
|
35
|
+
if (teamResult.isFail()) return [];
|
|
36
|
+
return this.loadRoles(teamResult.value.roles);
|
|
37
|
+
}
|
|
38
|
+
async loadRoles(roleIds) {
|
|
39
|
+
if (0 === roleIds.length) return [];
|
|
40
|
+
const result = await this.rolesRepository.list({
|
|
41
|
+
where: {
|
|
42
|
+
id_in: roleIds
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
if (result.isFail()) return [];
|
|
46
|
+
return result.value;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
const AssumedPermissions = PermissionsProcessor.createDecorator({
|
|
50
|
+
decorator: AssumedPermissionsImpl,
|
|
51
|
+
dependencies: [
|
|
52
|
+
RawAssumePermissions,
|
|
53
|
+
FeatureFlags,
|
|
54
|
+
RolesRepository,
|
|
55
|
+
TeamsRepository
|
|
56
|
+
]
|
|
57
|
+
});
|
|
58
|
+
export { AssumedPermissions };
|
|
59
|
+
|
|
60
|
+
//# sourceMappingURL=AssumedPermissions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/security/authorization/GroupsTeamsAuthorizer/AssumedPermissions.js","sources":["../../../../../src/features/security/authorization/GroupsTeamsAuthorizer/AssumedPermissions.ts"],"sourcesContent":["import { FeatureFlags } from \"~/features/featureFlags/abstractions.js\";\nimport { RawAssumePermissions } from \"~/features/requestContext/abstractions.js\";\nimport { Identity } from \"~/features/security/IdentityContext/index.js\";\nimport { RolesRepository } from \"~/features/security/roles/shared/abstractions.js\";\nimport { TeamsRepository } from \"~/features/security/teams/shared/abstractions.js\";\nimport { getPermissionsFromRoles } from \"~/features/security/utils/getPermissionsFromRoles.js\";\nimport type { SecurityRole } from \"~/types/security.js\";\nimport { PermissionsProcessor } from \"./abstractions.js\";\n\nfunction grantsFullAccess(permissions: PermissionsProcessor.Permissions): boolean {\n return permissions.some(permission => permission.name === \"*\");\n}\n\n/**\n * Evaluates the request against a role or team the caller asked to preview, instead of against the\n * caller's own roles. This is what makes \"view the Admin as an Editor\" honest: lists shrink and\n * writes fail server-side, rather than the Admin merely hiding buttons over unrestricted data.\n *\n * Previewing is available only to callers who already have full access, and it can only ever take\n * permissions away. See the guard in `getPermissions` for why the check cannot go through\n * IdentityContext.\n */\nclass AssumedPermissionsImpl implements PermissionsProcessor.Interface {\n constructor(\n private rawAssumePermissions: RawAssumePermissions.Interface,\n private featureFlags: FeatureFlags.Interface,\n private rolesRepository: RolesRepository.Interface,\n private teamsRepository: TeamsRepository.Interface,\n private decoratee: PermissionsProcessor.Interface\n ) {}\n\n async getPermissions(identity: Identity): Promise<PermissionsProcessor.Permissions | null> {\n const target = this.rawAssumePermissions.get();\n const own = await this.decoratee.getPermissions(identity);\n\n if (!target) {\n return own;\n }\n\n /*\n * The guard runs against the caller's OWN permissions, and they have to come from the\n * decoratee. IdentityContext.hasFullAccess() would resolve them through the Authorizer,\n * which lands back in this decorator, so the check would be re-entrant. Order matters too:\n * read the real permissions, verify them, and only then substitute.\n */\n if (!own || !grantsFullAccess(own)) {\n return own;\n }\n\n const roles = await this.loadAssumedRoles(target);\n\n /*\n * A preview request that resolves to no roles grants nothing. Falling back to `own` would\n * hand the caller their real full access while the Admin still claims they are previewing\n * a restricted role, which is the one outcome this feature must never produce.\n */\n return getPermissionsFromRoles(roles);\n }\n\n private async loadAssumedRoles(target: RawAssumePermissions.Target): Promise<SecurityRole[]> {\n if (target.type === \"role\") {\n return this.loadRoles([target.id]);\n }\n\n const teamsEnabled = this.featureFlags.get().isEnabled(\"advancedAccessControlLayer.teams\");\n if (!teamsEnabled) {\n return [];\n }\n\n const teamResult = await this.teamsRepository.get({ id: target.id });\n if (teamResult.isFail()) {\n return [];\n }\n\n return this.loadRoles(teamResult.value.roles);\n }\n\n private async loadRoles(roleIds: string[]): Promise<SecurityRole[]> {\n if (roleIds.length === 0) {\n return [];\n }\n\n const result = await this.rolesRepository.list({ where: { id_in: roleIds } });\n if (result.isFail()) {\n return [];\n }\n\n return result.value;\n }\n}\n\nexport const AssumedPermissions = PermissionsProcessor.createDecorator({\n decorator: AssumedPermissionsImpl,\n dependencies: [RawAssumePermissions, FeatureFlags, RolesRepository, TeamsRepository]\n});\n"],"names":["grantsFullAccess","permissions","permission","AssumedPermissionsImpl","rawAssumePermissions","featureFlags","rolesRepository","teamsRepository","decoratee","identity","target","own","roles","getPermissionsFromRoles","teamsEnabled","teamResult","roleIds","result","AssumedPermissions","PermissionsProcessor","RawAssumePermissions","FeatureFlags","RolesRepository","TeamsRepository"],"mappings":";;;;;;AASA,SAASA,iBAAiBC,WAA6C;IACnE,OAAOA,YAAY,IAAI,CAACC,CAAAA,aAAcA,AAAoB,QAApBA,WAAW,IAAI;AACzD;AAWA,MAAMC;IACF,YACYC,oBAAoD,EACpDC,YAAoC,EACpCC,eAA0C,EAC1CC,eAA0C,EAC1CC,SAAyC,CACnD;aALUJ,oBAAoB,GAApBA;aACAC,YAAY,GAAZA;aACAC,eAAe,GAAfA;aACAC,eAAe,GAAfA;aACAC,SAAS,GAATA;IACT;IAEH,MAAM,eAAeC,QAAkB,EAAoD;QACvF,MAAMC,SAAS,IAAI,CAAC,oBAAoB,CAAC,GAAG;QAC5C,MAAMC,MAAM,MAAM,IAAI,CAAC,SAAS,CAAC,cAAc,CAACF;QAEhD,IAAI,CAACC,QACD,OAAOC;QASX,IAAI,CAACA,OAAO,CAACX,iBAAiBW,MAC1B,OAAOA;QAGX,MAAMC,QAAQ,MAAM,IAAI,CAAC,gBAAgB,CAACF;QAO1C,OAAOG,wBAAwBD;IACnC;IAEA,MAAc,iBAAiBF,MAAmC,EAA2B;QACzF,IAAIA,AAAgB,WAAhBA,OAAO,IAAI,EACX,OAAO,IAAI,CAAC,SAAS,CAAC;YAACA,OAAO,EAAE;SAAC;QAGrC,MAAMI,eAAe,IAAI,CAAC,YAAY,CAAC,GAAG,GAAG,SAAS,CAAC;QACvD,IAAI,CAACA,cACD,OAAO,EAAE;QAGb,MAAMC,aAAa,MAAM,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC;YAAE,IAAIL,OAAO,EAAE;QAAC;QAClE,IAAIK,WAAW,MAAM,IACjB,OAAO,EAAE;QAGb,OAAO,IAAI,CAAC,SAAS,CAACA,WAAW,KAAK,CAAC,KAAK;IAChD;IAEA,MAAc,UAAUC,OAAiB,EAA2B;QAChE,IAAIA,AAAmB,MAAnBA,QAAQ,MAAM,EACd,OAAO,EAAE;QAGb,MAAMC,SAAS,MAAM,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC;YAAE,OAAO;gBAAE,OAAOD;YAAQ;QAAE;QAC3E,IAAIC,OAAO,MAAM,IACb,OAAO,EAAE;QAGb,OAAOA,OAAO,KAAK;IACvB;AACJ;AAEO,MAAMC,qBAAqBC,qBAAqB,eAAe,CAAC;IACnE,WAAWhB;IACX,cAAc;QAACiB;QAAsBC;QAAcC;QAAiBC;KAAgB;AACxF"}
|
package/features/security/authorization/GroupsTeamsAuthorizer/GetPermissionsFromIdentity.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FeatureFlags } from "../../../../features/featureFlags/abstractions.js";
|
|
2
2
|
import { Identity } from "../../../../features/security/IdentityContext/index.js";
|
|
3
3
|
import { PermissionsProcessor } from "./abstractions.js";
|
|
4
4
|
import { RolesRepository } from "../../../../features/security/roles/shared/abstractions.js";
|
|
@@ -7,11 +7,11 @@ import { AdminUsersRepository } from "../../../../features/users/shared/abstract
|
|
|
7
7
|
export type RoleId = string | undefined;
|
|
8
8
|
export type TeamId = string | undefined;
|
|
9
9
|
declare class GetPermissionsFromGroupsAndTeamsImpl implements PermissionsProcessor.Interface {
|
|
10
|
-
private
|
|
10
|
+
private featureFlags;
|
|
11
11
|
private usersRepository;
|
|
12
12
|
private rolesRepository;
|
|
13
13
|
private teamsRepository;
|
|
14
|
-
constructor(
|
|
14
|
+
constructor(featureFlags: FeatureFlags.Interface, usersRepository: AdminUsersRepository.Interface, rolesRepository: RolesRepository.Interface, teamsRepository: TeamsRepository.Interface);
|
|
15
15
|
getPermissions(identity: Identity): Promise<{
|
|
16
16
|
name: string;
|
|
17
17
|
_src: string;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FeatureFlags } from "../../../featureFlags/abstractions.js";
|
|
2
2
|
import { PermissionsProcessor } from "./abstractions.js";
|
|
3
3
|
import { RolesRepository } from "../../roles/shared/abstractions.js";
|
|
4
4
|
import { TeamsRepository } from "../../teams/shared/abstractions.js";
|
|
5
5
|
import { getPermissionsFromRoles } from "../../utils/getPermissionsFromRoles.js";
|
|
6
6
|
import { AdminUsersRepository } from "../../../users/shared/abstractions.js";
|
|
7
7
|
class GetPermissionsFromGroupsAndTeamsImpl {
|
|
8
|
-
constructor(
|
|
9
|
-
this.
|
|
8
|
+
constructor(featureFlags, usersRepository, rolesRepository, teamsRepository){
|
|
9
|
+
this.featureFlags = featureFlags;
|
|
10
10
|
this.usersRepository = usersRepository;
|
|
11
11
|
this.rolesRepository = rolesRepository;
|
|
12
12
|
this.teamsRepository = teamsRepository;
|
|
@@ -32,7 +32,7 @@ class GetPermissionsFromGroupsAndTeamsImpl {
|
|
|
32
32
|
const loadedRolesByIds = rolesResult.isOk() ? rolesResult.value : [];
|
|
33
33
|
loadedRoles.push(...loadedRolesByIds);
|
|
34
34
|
}
|
|
35
|
-
if (this.
|
|
35
|
+
if (this.featureFlags.get().isEnabled("advancedAccessControlLayer.teams")) {
|
|
36
36
|
teamIds.push(...user.teams ?? []);
|
|
37
37
|
const filteredTeamIds = teamIds.filter(Boolean);
|
|
38
38
|
const dedupedTeamIds = Array.from(new Set(filteredTeamIds));
|
|
@@ -65,7 +65,7 @@ class GetPermissionsFromGroupsAndTeamsImpl {
|
|
|
65
65
|
const GetPermissionsFromIdentity = PermissionsProcessor.createImplementation({
|
|
66
66
|
implementation: GetPermissionsFromGroupsAndTeamsImpl,
|
|
67
67
|
dependencies: [
|
|
68
|
-
|
|
68
|
+
FeatureFlags,
|
|
69
69
|
AdminUsersRepository,
|
|
70
70
|
RolesRepository,
|
|
71
71
|
TeamsRepository
|
package/features/security/authorization/GroupsTeamsAuthorizer/GetPermissionsFromIdentity.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/security/authorization/GroupsTeamsAuthorizer/GetPermissionsFromIdentity.js","sources":["../../../../../src/features/security/authorization/GroupsTeamsAuthorizer/GetPermissionsFromIdentity.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"features/security/authorization/GroupsTeamsAuthorizer/GetPermissionsFromIdentity.js","sources":["../../../../../src/features/security/authorization/GroupsTeamsAuthorizer/GetPermissionsFromIdentity.ts"],"sourcesContent":["import { FeatureFlags } from \"~/features/featureFlags/abstractions.js\";\nimport type { SecurityRole } from \"~/types/security.js\";\nimport { Identity } from \"~/features/security/IdentityContext/index.js\";\nimport { PermissionsProcessor } from \"./abstractions.js\";\nimport { RolesRepository } from \"~/features/security/roles/shared/abstractions.js\";\nimport { TeamsRepository } from \"~/features/security/teams/shared/abstractions.js\";\nimport { getPermissionsFromRoles } from \"~/features/security/utils/getPermissionsFromRoles.js\";\nimport { AdminUsersRepository } from \"~/features/users/shared/abstractions.js\";\n\nexport type RoleId = string | undefined;\nexport type TeamId = string | undefined;\n\nclass GetPermissionsFromGroupsAndTeamsImpl implements PermissionsProcessor.Interface {\n constructor(\n private featureFlags: FeatureFlags.Interface,\n private usersRepository: AdminUsersRepository.Interface,\n private rolesRepository: RolesRepository.Interface,\n private teamsRepository: TeamsRepository.Interface\n ) {}\n\n async getPermissions(identity: Identity) {\n const userResult = await this.usersRepository.get({ id: identity.id });\n if (userResult.isFail()) {\n return null;\n }\n\n const user = userResult.value;\n\n // Load roles that are associated with the current identity. Also load roles\n // that are assigned via one or more teams (if the Teams feature is enabled).\n const roleIds: RoleId[] = [];\n const teamIds: TeamId[] = [];\n\n roleIds.push(...(user.roles ?? []));\n\n const filteredRoleIds = roleIds.filter(Boolean) as string[];\n const dedupedRoleIds = Array.from(new Set(filteredRoleIds));\n\n const loadedRoles: SecurityRole[] = [];\n\n if (dedupedRoleIds.length > 0) {\n const rolesResult = await this.rolesRepository.list({\n where: { id_in: dedupedRoleIds }\n });\n\n const loadedRolesByIds = rolesResult.isOk() ? rolesResult.value : [];\n loadedRoles.push(...loadedRolesByIds);\n }\n\n if (this.featureFlags.get().isEnabled(\"advancedAccessControlLayer.teams\")) {\n teamIds.push(...(user.teams ?? []));\n\n const filteredTeamIds = teamIds.filter(Boolean) as string[];\n const dedupedTeamIds = Array.from(new Set(filteredTeamIds));\n\n if (dedupedTeamIds.length > 0) {\n const teamsResult = await this.teamsRepository.list({\n where: { id_in: dedupedTeamIds }\n });\n\n const loadedTeams = teamsResult.isOk() ? teamsResult.value : [];\n\n // Upon returning teams, we're filtering out team roles that were already loaded.\n // Also note that `team.roles` contains role IDs, not slugs.\n const roleIdsFromTeams = loadedTeams\n .flatMap(team => team.roles)\n .filter(roleId => {\n const alreadyLoaded = loadedRoles.find(role => role.id === roleId);\n return !alreadyLoaded;\n });\n\n if (roleIdsFromTeams.length > 0) {\n const moreRolesResult = await this.rolesRepository.list({\n where: { id_in: roleIdsFromTeams }\n });\n\n const rolesFromTeams = moreRolesResult.isOk() ? moreRolesResult.value : [];\n loadedRoles.push(...rolesFromTeams);\n }\n }\n }\n\n if (loadedRoles.length > 0) {\n return getPermissionsFromRoles(loadedRoles);\n }\n\n return null;\n }\n}\n\nexport const GetPermissionsFromIdentity = PermissionsProcessor.createImplementation({\n implementation: GetPermissionsFromGroupsAndTeamsImpl,\n dependencies: [FeatureFlags, AdminUsersRepository, RolesRepository, TeamsRepository]\n});\n"],"names":["GetPermissionsFromGroupsAndTeamsImpl","featureFlags","usersRepository","rolesRepository","teamsRepository","identity","userResult","user","roleIds","teamIds","filteredRoleIds","Boolean","dedupedRoleIds","Array","Set","loadedRoles","rolesResult","loadedRolesByIds","filteredTeamIds","dedupedTeamIds","teamsResult","loadedTeams","roleIdsFromTeams","team","roleId","alreadyLoaded","role","moreRolesResult","rolesFromTeams","getPermissionsFromRoles","GetPermissionsFromIdentity","PermissionsProcessor","FeatureFlags","AdminUsersRepository","RolesRepository","TeamsRepository"],"mappings":";;;;;;AAYA,MAAMA;IACF,YACYC,YAAoC,EACpCC,eAA+C,EAC/CC,eAA0C,EAC1CC,eAA0C,CACpD;aAJUH,YAAY,GAAZA;aACAC,eAAe,GAAfA;aACAC,eAAe,GAAfA;aACAC,eAAe,GAAfA;IACT;IAEH,MAAM,eAAeC,QAAkB,EAAE;QACrC,MAAMC,aAAa,MAAM,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC;YAAE,IAAID,SAAS,EAAE;QAAC;QACpE,IAAIC,WAAW,MAAM,IACjB,OAAO;QAGX,MAAMC,OAAOD,WAAW,KAAK;QAI7B,MAAME,UAAoB,EAAE;QAC5B,MAAMC,UAAoB,EAAE;QAE5BD,QAAQ,IAAI,IAAKD,KAAK,KAAK,IAAI,EAAE;QAEjC,MAAMG,kBAAkBF,QAAQ,MAAM,CAACG;QACvC,MAAMC,iBAAiBC,MAAM,IAAI,CAAC,IAAIC,IAAIJ;QAE1C,MAAMK,cAA8B,EAAE;QAEtC,IAAIH,eAAe,MAAM,GAAG,GAAG;YAC3B,MAAMI,cAAc,MAAM,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC;gBAChD,OAAO;oBAAE,OAAOJ;gBAAe;YACnC;YAEA,MAAMK,mBAAmBD,YAAY,IAAI,KAAKA,YAAY,KAAK,GAAG,EAAE;YACpED,YAAY,IAAI,IAAIE;QACxB;QAEA,IAAI,IAAI,CAAC,YAAY,CAAC,GAAG,GAAG,SAAS,CAAC,qCAAqC;YACvER,QAAQ,IAAI,IAAKF,KAAK,KAAK,IAAI,EAAE;YAEjC,MAAMW,kBAAkBT,QAAQ,MAAM,CAACE;YACvC,MAAMQ,iBAAiBN,MAAM,IAAI,CAAC,IAAIC,IAAII;YAE1C,IAAIC,eAAe,MAAM,GAAG,GAAG;gBAC3B,MAAMC,cAAc,MAAM,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC;oBAChD,OAAO;wBAAE,OAAOD;oBAAe;gBACnC;gBAEA,MAAME,cAAcD,YAAY,IAAI,KAAKA,YAAY,KAAK,GAAG,EAAE;gBAI/D,MAAME,mBAAmBD,YACpB,OAAO,CAACE,CAAAA,OAAQA,KAAK,KAAK,EAC1B,MAAM,CAACC,CAAAA;oBACJ,MAAMC,gBAAgBV,YAAY,IAAI,CAACW,CAAAA,OAAQA,KAAK,EAAE,KAAKF;oBAC3D,OAAO,CAACC;gBACZ;gBAEJ,IAAIH,iBAAiB,MAAM,GAAG,GAAG;oBAC7B,MAAMK,kBAAkB,MAAM,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC;wBACpD,OAAO;4BAAE,OAAOL;wBAAiB;oBACrC;oBAEA,MAAMM,iBAAiBD,gBAAgB,IAAI,KAAKA,gBAAgB,KAAK,GAAG,EAAE;oBAC1EZ,YAAY,IAAI,IAAIa;gBACxB;YACJ;QACJ;QAEA,IAAIb,YAAY,MAAM,GAAG,GACrB,OAAOc,wBAAwBd;QAGnC,OAAO;IACX;AACJ;AAEO,MAAMe,6BAA6BC,qBAAqB,oBAAoB,CAAC;IAChF,gBAAgB/B;IAChB,cAAc;QAACgC;QAAcC;QAAsBC;QAAiBC;KAAgB;AACxF"}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { createFeature } from "@webiny/feature/api";
|
|
2
2
|
import { RolesTeamsAuthorizer } from "./RolesTeamsAuthorizer.js";
|
|
3
3
|
import { GetPermissionsFromIdentity } from "./GetPermissionsFromIdentity.js";
|
|
4
|
+
import { AssumedPermissions } from "./AssumedPermissions.js";
|
|
4
5
|
const GroupsTeamsAuthorizerFeature = createFeature({
|
|
5
6
|
name: "GroupsTeamsAuthorizer",
|
|
6
7
|
register (container) {
|
|
7
8
|
container.register(RolesTeamsAuthorizer).inSingletonScope();
|
|
8
9
|
container.register(GetPermissionsFromIdentity);
|
|
10
|
+
container.registerDecorator(AssumedPermissions);
|
|
9
11
|
}
|
|
10
12
|
});
|
|
11
13
|
export { GroupsTeamsAuthorizerFeature };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/security/authorization/GroupsTeamsAuthorizer/feature.js","sources":["../../../../../src/features/security/authorization/GroupsTeamsAuthorizer/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { RolesTeamsAuthorizer } from \"./RolesTeamsAuthorizer.js\";\nimport { GetPermissionsFromIdentity } from \"./GetPermissionsFromIdentity.js\";\n\nexport const GroupsTeamsAuthorizerFeature = createFeature({\n name: \"GroupsTeamsAuthorizer\",\n register(container) {\n container.register(RolesTeamsAuthorizer).inSingletonScope();\n container.register(GetPermissionsFromIdentity);\n }\n});\n"],"names":["GroupsTeamsAuthorizerFeature","createFeature","container","RolesTeamsAuthorizer","GetPermissionsFromIdentity"],"mappings":"
|
|
1
|
+
{"version":3,"file":"features/security/authorization/GroupsTeamsAuthorizer/feature.js","sources":["../../../../../src/features/security/authorization/GroupsTeamsAuthorizer/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { RolesTeamsAuthorizer } from \"./RolesTeamsAuthorizer.js\";\nimport { GetPermissionsFromIdentity } from \"./GetPermissionsFromIdentity.js\";\nimport { AssumedPermissions } from \"./AssumedPermissions.js\";\n\nexport const GroupsTeamsAuthorizerFeature = createFeature({\n name: \"GroupsTeamsAuthorizer\",\n register(container) {\n container.register(RolesTeamsAuthorizer).inSingletonScope();\n container.register(GetPermissionsFromIdentity);\n container.registerDecorator(AssumedPermissions);\n }\n});\n"],"names":["GroupsTeamsAuthorizerFeature","createFeature","container","RolesTeamsAuthorizer","GetPermissionsFromIdentity","AssumedPermissions"],"mappings":";;;;AAKO,MAAMA,+BAA+BC,cAAc;IACtD,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC,sBAAsB,gBAAgB;QACzDD,UAAU,QAAQ,CAACE;QACnBF,UAAU,iBAAiB,CAACG;IAChC;AACJ"}
|
|
@@ -7,6 +7,7 @@ import { IdentityContext } from "../../IdentityContext/abstractions.js";
|
|
|
7
7
|
import { createRoleValidation } from "./schema.js";
|
|
8
8
|
import { RoleAfterCreateEvent, RoleBeforeCreateEvent } from "./events.js";
|
|
9
9
|
import { NotAuthorizedError, RoleExistsError, RoleValidationError } from "../shared/errors.js";
|
|
10
|
+
import { descriptionOnCreate } from "../../shared/description.js";
|
|
10
11
|
class CreateRoleUseCaseImpl {
|
|
11
12
|
constructor(identityContext, eventPublisher, repository){
|
|
12
13
|
this.identityContext = identityContext;
|
|
@@ -24,12 +25,16 @@ class CreateRoleUseCaseImpl {
|
|
|
24
25
|
slug: data.slug
|
|
25
26
|
});
|
|
26
27
|
if (existingRoleResult.isOk()) return Result.fail(new RoleExistsError(data.slug));
|
|
28
|
+
const createInput = {
|
|
29
|
+
...data,
|
|
30
|
+
description: descriptionOnCreate(data.description)
|
|
31
|
+
};
|
|
27
32
|
const role = {
|
|
28
33
|
id: mdbid(),
|
|
29
|
-
name:
|
|
30
|
-
slug:
|
|
31
|
-
description:
|
|
32
|
-
permissions:
|
|
34
|
+
name: createInput.name,
|
|
35
|
+
slug: createInput.slug,
|
|
36
|
+
description: descriptionOnCreate(createInput.description),
|
|
37
|
+
permissions: createInput.permissions,
|
|
33
38
|
system: input.system || false,
|
|
34
39
|
createdOn: new Date().toISOString(),
|
|
35
40
|
createdBy: {
|
|
@@ -41,13 +46,13 @@ class CreateRoleUseCaseImpl {
|
|
|
41
46
|
};
|
|
42
47
|
await this.eventPublisher.publish(new RoleBeforeCreateEvent({
|
|
43
48
|
role,
|
|
44
|
-
input:
|
|
49
|
+
input: createInput
|
|
45
50
|
}));
|
|
46
51
|
const result = await this.repository.create(role);
|
|
47
52
|
if (result.isFail()) return Result.fail(result.error);
|
|
48
53
|
await this.eventPublisher.publish(new RoleAfterCreateEvent({
|
|
49
54
|
role,
|
|
50
|
-
input:
|
|
55
|
+
input: createInput
|
|
51
56
|
}));
|
|
52
57
|
return Result.ok(role);
|
|
53
58
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/security/roles/CreateRole/CreateRoleUseCase.js","sources":["../../../../../src/features/security/roles/CreateRole/CreateRoleUseCase.ts"],"sourcesContent":["import { mdbid } from \"@webiny/utils\";\nimport { createImplementation } from \"@webiny/feature/api\";\nimport { Result } from \"@webiny/feature/api\";\nimport { EventPublisher } from \"~/features/eventPublisher/index.js\";\nimport { CreateRoleUseCase as UseCaseAbstraction } from \"./abstractions.js\";\nimport { RolesRepository } from \"../shared/abstractions.js\";\nimport { IdentityContext } from \"../../IdentityContext/abstractions.js\";\nimport { createRoleValidation } from \"./schema.js\";\nimport { RoleBeforeCreateEvent, RoleAfterCreateEvent } from \"./events.js\";\nimport type { Role, CreateRoleInput } from \"../shared/types.js\";\nimport { NotAuthorizedError, RoleExistsError, RoleValidationError } from \"../shared/errors.js\";\n\nclass CreateRoleUseCaseImpl implements UseCaseAbstraction.Interface {\n constructor(\n private identityContext: IdentityContext.Interface,\n private eventPublisher: EventPublisher.Interface,\n private repository: RolesRepository.Interface\n ) {}\n\n async execute(input: CreateRoleInput): Promise<Result<Role, UseCaseAbstraction.Error>> {\n const hasPermission = await this.identityContext.getPermission(\"security.role\");\n\n if (!hasPermission) {\n return Result.fail(new NotAuthorizedError());\n }\n\n const validation = createRoleValidation.safeParse(input);\n if (!validation.success) {\n return Result.fail(new RoleValidationError(validation.error.issues[0].message));\n }\n\n const identity = this.identityContext.getIdentity();\n const data = validation.data;\n\n // Check if role with same slug already exists\n const existingRoleResult = await this.repository.get({ slug: data.slug });\n if (existingRoleResult.isOk()) {\n return Result.fail(new RoleExistsError(data.slug));\n }\n\n const role: Role = {\n id: mdbid(),\n name:
|
|
1
|
+
{"version":3,"file":"features/security/roles/CreateRole/CreateRoleUseCase.js","sources":["../../../../../src/features/security/roles/CreateRole/CreateRoleUseCase.ts"],"sourcesContent":["import { mdbid } from \"@webiny/utils\";\nimport { createImplementation } from \"@webiny/feature/api\";\nimport { Result } from \"@webiny/feature/api\";\nimport { EventPublisher } from \"~/features/eventPublisher/index.js\";\nimport { CreateRoleUseCase as UseCaseAbstraction } from \"./abstractions.js\";\nimport { RolesRepository } from \"../shared/abstractions.js\";\nimport { IdentityContext } from \"../../IdentityContext/abstractions.js\";\nimport { createRoleValidation } from \"./schema.js\";\nimport { RoleBeforeCreateEvent, RoleAfterCreateEvent } from \"./events.js\";\nimport type { Role, CreateRoleInput } from \"../shared/types.js\";\nimport { NotAuthorizedError, RoleExistsError, RoleValidationError } from \"../shared/errors.js\";\nimport { descriptionOnCreate } from \"../../shared/description.js\";\n\nclass CreateRoleUseCaseImpl implements UseCaseAbstraction.Interface {\n constructor(\n private identityContext: IdentityContext.Interface,\n private eventPublisher: EventPublisher.Interface,\n private repository: RolesRepository.Interface\n ) {}\n\n async execute(input: CreateRoleInput): Promise<Result<Role, UseCaseAbstraction.Error>> {\n const hasPermission = await this.identityContext.getPermission(\"security.role\");\n\n if (!hasPermission) {\n return Result.fail(new NotAuthorizedError());\n }\n\n const validation = createRoleValidation.safeParse(input);\n if (!validation.success) {\n return Result.fail(new RoleValidationError(validation.error.issues[0].message));\n }\n\n const identity = this.identityContext.getIdentity();\n const data = validation.data;\n\n // Check if role with same slug already exists\n const existingRoleResult = await this.repository.get({ slug: data.slug });\n if (existingRoleResult.isOk()) {\n return Result.fail(new RoleExistsError(data.slug));\n }\n\n // Normalised up front so that null reaches neither the entity nor the published events.\n const createInput: CreateRoleInput = {\n ...data,\n description: descriptionOnCreate(data.description)\n };\n\n const role: Role = {\n id: mdbid(),\n name: createInput.name,\n slug: createInput.slug,\n description: descriptionOnCreate(createInput.description),\n permissions: createInput.permissions,\n system: input.system || false,\n createdOn: new Date().toISOString(),\n createdBy: {\n id: identity.id,\n displayName: identity.displayName,\n type: identity.type\n },\n plugin: false\n };\n\n await this.eventPublisher.publish(new RoleBeforeCreateEvent({ role, input: createInput }));\n\n const result = await this.repository.create(role);\n\n if (result.isFail()) {\n return Result.fail(result.error);\n }\n\n await this.eventPublisher.publish(new RoleAfterCreateEvent({ role, input: createInput }));\n\n return Result.ok(role);\n }\n}\n\nexport const CreateRoleUseCase = createImplementation({\n abstraction: UseCaseAbstraction,\n implementation: CreateRoleUseCaseImpl,\n dependencies: [IdentityContext, EventPublisher, RolesRepository]\n});\n"],"names":["CreateRoleUseCaseImpl","identityContext","eventPublisher","repository","input","hasPermission","Result","NotAuthorizedError","validation","createRoleValidation","RoleValidationError","identity","data","existingRoleResult","RoleExistsError","createInput","descriptionOnCreate","role","mdbid","Date","RoleBeforeCreateEvent","result","RoleAfterCreateEvent","CreateRoleUseCase","createImplementation","UseCaseAbstraction","IdentityContext","EventPublisher","RolesRepository"],"mappings":";;;;;;;;;;AAaA,MAAMA;IACF,YACYC,eAA0C,EAC1CC,cAAwC,EACxCC,UAAqC,CAC/C;aAHUF,eAAe,GAAfA;aACAC,cAAc,GAAdA;aACAC,UAAU,GAAVA;IACT;IAEH,MAAM,QAAQC,KAAsB,EAAmD;QACnF,MAAMC,gBAAgB,MAAM,IAAI,CAAC,eAAe,CAAC,aAAa,CAAC;QAE/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,WAAW,IAAI,CAAC,eAAe,CAAC,WAAW;QACjD,MAAMC,OAAOJ,WAAW,IAAI;QAG5B,MAAMK,qBAAqB,MAAM,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;YAAE,MAAMD,KAAK,IAAI;QAAC;QACvE,IAAIC,mBAAmB,IAAI,IACvB,OAAOP,OAAO,IAAI,CAAC,IAAIQ,gBAAgBF,KAAK,IAAI;QAIpD,MAAMG,cAA+B;YACjC,GAAGH,IAAI;YACP,aAAaI,oBAAoBJ,KAAK,WAAW;QACrD;QAEA,MAAMK,OAAa;YACf,IAAIC;YACJ,MAAMH,YAAY,IAAI;YACtB,MAAMA,YAAY,IAAI;YACtB,aAAaC,oBAAoBD,YAAY,WAAW;YACxD,aAAaA,YAAY,WAAW;YACpC,QAAQX,MAAM,MAAM,IAAI;YACxB,WAAW,IAAIe,OAAO,WAAW;YACjC,WAAW;gBACP,IAAIR,SAAS,EAAE;gBACf,aAAaA,SAAS,WAAW;gBACjC,MAAMA,SAAS,IAAI;YACvB;YACA,QAAQ;QACZ;QAEA,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,IAAIS,sBAAsB;YAAEH;YAAM,OAAOF;QAAY;QAEvF,MAAMM,SAAS,MAAM,IAAI,CAAC,UAAU,CAAC,MAAM,CAACJ;QAE5C,IAAII,OAAO,MAAM,IACb,OAAOf,OAAO,IAAI,CAACe,OAAO,KAAK;QAGnC,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,IAAIC,qBAAqB;YAAEL;YAAM,OAAOF;QAAY;QAEtF,OAAOT,OAAO,EAAE,CAACW;IACrB;AACJ;AAEO,MAAMM,sCAAoBC,qBAAqB;IAClD,aAAaC;IACb,gBAAgBzB;IAChB,cAAc;QAAC0B;QAAiBC;QAAgBC;KAAgB;AACpE"}
|
|
@@ -2,7 +2,7 @@ import { z } from "zod";
|
|
|
2
2
|
export declare const createRoleValidation: z.ZodObject<{
|
|
3
3
|
name: z.ZodString;
|
|
4
4
|
slug: z.ZodString;
|
|
5
|
-
description: z.
|
|
5
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
6
6
|
permissions: z.ZodArray<z.ZodObject<{
|
|
7
7
|
name: z.ZodString;
|
|
8
8
|
}, z.core.$loose>>;
|
|
@@ -2,7 +2,7 @@ import { z } from "zod";
|
|
|
2
2
|
const createRoleValidation = z.object({
|
|
3
3
|
name: z.string().min(3),
|
|
4
4
|
slug: z.string().min(3),
|
|
5
|
-
description: z.string().max(500).
|
|
5
|
+
description: z.string().max(500).nullish(),
|
|
6
6
|
permissions: z.array(z.looseObject({
|
|
7
7
|
name: z.string()
|
|
8
8
|
}))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/security/roles/CreateRole/schema.js","sources":["../../../../../src/features/security/roles/CreateRole/schema.ts"],"sourcesContent":["import { z } from \"zod\";\n\nexport const createRoleValidation = z.object({\n name: z.string().min(3),\n slug: z.string().min(3),\n description: z.string().max(500).
|
|
1
|
+
{"version":3,"file":"features/security/roles/CreateRole/schema.js","sources":["../../../../../src/features/security/roles/CreateRole/schema.ts"],"sourcesContent":["import { z } from \"zod\";\n\nexport const createRoleValidation = z.object({\n name: z.string().min(3),\n slug: z.string().min(3),\n // Nullable in the GraphQL schema - see `descriptionOnCreate` for why this is `.nullish()`.\n // `.optional().default(\"\")` did NOT cover this: Zod applies a default to `undefined` only, so\n // an explicit null still failed validation.\n description: z.string().max(500).nullish(),\n permissions: z.array(z.looseObject({ name: z.string() }))\n});\n"],"names":["createRoleValidation","z"],"mappings":";AAEO,MAAMA,uBAAuBC,EAAE,MAAM,CAAC;IACzC,MAAMA,EAAE,MAAM,GAAG,GAAG,CAAC;IACrB,MAAMA,EAAE,MAAM,GAAG,GAAG,CAAC;IAIrB,aAAaA,EAAE,MAAM,GAAG,GAAG,CAAC,KAAK,OAAO;IACxC,aAAaA,EAAE,KAAK,CAACA,EAAE,WAAW,CAAC;QAAE,MAAMA,EAAE,MAAM;IAAG;AAC1D"}
|
|
@@ -5,6 +5,7 @@ import { IdentityContext } from "../../IdentityContext/abstractions.js";
|
|
|
5
5
|
import { EventPublisher } from "../../../eventPublisher/index.js";
|
|
6
6
|
import { updateRoleValidation } from "./schema.js";
|
|
7
7
|
import { RoleAfterUpdateEvent, RoleBeforeUpdateEvent } from "./events.js";
|
|
8
|
+
import { descriptionOnUpdate } from "../../shared/description.js";
|
|
8
9
|
import { CannotUpdatePluginRolesError, NotAuthorizedError, RoleValidationError } from "../shared/errors.js";
|
|
9
10
|
class UpdateRoleUseCaseImpl {
|
|
10
11
|
constructor(repository, identityContext, eventPublisher){
|
|
@@ -23,21 +24,26 @@ class UpdateRoleUseCaseImpl {
|
|
|
23
24
|
if (existingResult.isFail()) return Result.fail(existingResult.error);
|
|
24
25
|
const existingRole = existingResult.value;
|
|
25
26
|
if (existingRole.plugin) return Result.fail(new CannotUpdatePluginRolesError());
|
|
27
|
+
const { description, ...rest } = validation.data;
|
|
28
|
+
const changes = {
|
|
29
|
+
...rest,
|
|
30
|
+
...descriptionOnUpdate(description)
|
|
31
|
+
};
|
|
26
32
|
const updatedRole = {
|
|
27
33
|
...existingRole,
|
|
28
|
-
...
|
|
34
|
+
...changes
|
|
29
35
|
};
|
|
30
36
|
await this.eventPublisher.publish(new RoleBeforeUpdateEvent({
|
|
31
37
|
original: existingRole,
|
|
32
38
|
updated: updatedRole,
|
|
33
|
-
input:
|
|
39
|
+
input: changes
|
|
34
40
|
}));
|
|
35
41
|
const result = await this.repository.update(updatedRole);
|
|
36
42
|
if (result.isFail()) return Result.fail(result.error);
|
|
37
43
|
await this.eventPublisher.publish(new RoleAfterUpdateEvent({
|
|
38
44
|
original: existingRole,
|
|
39
45
|
updated: updatedRole,
|
|
40
|
-
input:
|
|
46
|
+
input: changes
|
|
41
47
|
}));
|
|
42
48
|
return Result.ok(updatedRole);
|
|
43
49
|
}
|
|
@@ -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 {\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 const updatedRole: Role = {\n ...existingRole,\n ...
|
|
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":";;;;;;;;;AAeA,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,GAAGD,IAAI;YACP,GAAGE,oBAAoBH,YAAY;QACvC;QAEA,MAAMI,cAAoB;YACtB,GAAGN,YAAY;YACf,GAAGI,OAAO;QACd;QAEA,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAC7B,IAAIG,sBAAsB;YACtB,UAAUP;YACV,SAASM;YACT,OAAOF;QACX;QAGJ,MAAMI,SAAS,MAAM,IAAI,CAAC,UAAU,CAAC,MAAM,CAACF;QAE5C,IAAIE,OAAO,MAAM,IACb,OAAOd,OAAO,IAAI,CAACc,OAAO,KAAK;QAGnC,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAC7B,IAAIC,qBAAqB;YACrB,UAAUT;YACV,SAASM;YACT,OAAOF;QACX;QAGJ,OAAOV,OAAO,EAAE,CAACY;IACrB;AACJ;AAEO,MAAMI,sCAAoBC,kBAAAA,oBAA4B,CAAC;IAC1D,gBAAgBxB;IAChB,cAAc;QAACyB;QAAiBC;QAAiBC;KAAe;AACpE"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
export declare const updateRoleValidation: z.ZodObject<{
|
|
3
3
|
name: z.ZodOptional<z.ZodString>;
|
|
4
|
-
description: z.ZodOptional<z.ZodString
|
|
4
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
5
5
|
permissions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
6
6
|
name: z.ZodString;
|
|
7
7
|
}, z.core.$loose>>>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
const updateRoleValidation = z.object({
|
|
3
3
|
name: z.string().min(3).optional(),
|
|
4
|
-
description: z.string().max(500).
|
|
4
|
+
description: z.string().max(500).nullish(),
|
|
5
5
|
permissions: z.array(z.looseObject({
|
|
6
6
|
name: z.string()
|
|
7
7
|
})).optional()
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/security/roles/UpdateRole/schema.js","sources":["../../../../../src/features/security/roles/UpdateRole/schema.ts"],"sourcesContent":["import { z } from \"zod\";\n\nexport const updateRoleValidation = z.object({\n name: z.string().min(3).optional(),\n description: z.string().max(500).
|
|
1
|
+
{"version":3,"file":"features/security/roles/UpdateRole/schema.js","sources":["../../../../../src/features/security/roles/UpdateRole/schema.ts"],"sourcesContent":["import { z } from \"zod\";\n\nexport const updateRoleValidation = z.object({\n name: z.string().min(3).optional(),\n // Nullable in the GraphQL schema - see `descriptionOnUpdate` for why this is `.nullish()` and\n // must not carry a `.transform()`.\n description: z.string().max(500).nullish(),\n permissions: z.array(z.looseObject({ name: z.string() })).optional()\n});\n"],"names":["updateRoleValidation","z"],"mappings":";AAEO,MAAMA,uBAAuBC,EAAE,MAAM,CAAC;IACzC,MAAMA,EAAE,MAAM,GAAG,GAAG,CAAC,GAAG,QAAQ;IAGhC,aAAaA,EAAE,MAAM,GAAG,GAAG,CAAC,KAAK,OAAO;IACxC,aAAaA,EAAE,KAAK,CAACA,EAAE,WAAW,CAAC;QAAE,MAAMA,EAAE,MAAM;IAAG,IAAI,QAAQ;AACtE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/security/shared/description.js","sources":["../../../../src/features/security/shared/description.ts"],"sourcesContent":["// Roles, teams and API keys all declare `description: String` in the GraphQL schema - nullable -\n// while their domain types store a plain string and use \"\" to mean \"no description\". Clients\n// therefore legitimately send null, and the admin app does exactly that: it reads an entity saved\n// without a description and submits the edit form again unchanged.\n//\n// Zod's `.optional()` accepts only `undefined`, so those requests used to fail with\n// \"Invalid input: expected string, received null\". The input schemas use `.nullish()` instead, and\n// these two helpers map what comes out of them onto the domain type.\n//\n// Note the schemas must NOT do this mapping via `.transform()`: a transform makes the key required\n// in the parsed output rather than optional, so spreading a parsed update onto a stored entity\n// would write `description: undefined` and wipe the stored value on every partial update.\n\nexport const descriptionOnCreate = (value: string | null | undefined): string => value ?? \"\";\n\n// Returns a patch rather than a value, because on a partial update an absent `description` has to\n// leave the stored one alone, while an explicit null clears it.\nexport const descriptionOnUpdate = (value: string | null | undefined): { description?: string } =>\n value === undefined ? {} : { description: value ?? \"\" };\n"],"names":["descriptionOnCreate","value","descriptionOnUpdate","undefined"],"mappings":"AAaO,MAAMA,sBAAsB,CAACC,QAA6CA,SAAS;AAInF,MAAMC,sBAAsB,CAACD,QAChCA,AAAUE,WAAVF,QAAsB,CAAC,IAAI;QAAE,aAAaA,SAAS;IAAG"}
|
|
@@ -2,13 +2,15 @@ import { Result } from "@webiny/feature/api";
|
|
|
2
2
|
import { EventPublisher } from "../../../../features/eventPublisher/index.js";
|
|
3
3
|
import { CreateTeam } from "./abstractions.js";
|
|
4
4
|
import { TeamsRepository } from "../shared/abstractions.js";
|
|
5
|
+
import { RolesRepository } from "../../roles/shared/abstractions.js";
|
|
5
6
|
import { IdentityContext } from "../../IdentityContext/abstractions.js";
|
|
6
7
|
import type { Team, CreateTeamInput } from "../shared/types.js";
|
|
7
8
|
export declare class CreateTeamUseCase implements CreateTeam.Interface {
|
|
8
9
|
private identityContext;
|
|
9
10
|
private eventPublisher;
|
|
10
11
|
private repository;
|
|
11
|
-
|
|
12
|
+
private rolesRepository;
|
|
13
|
+
constructor(identityContext: IdentityContext.Interface, eventPublisher: EventPublisher.Interface, repository: TeamsRepository.Interface, rolesRepository: RolesRepository.Interface);
|
|
12
14
|
execute(input: CreateTeamInput): Promise<Result<Team, CreateTeam.Error>>;
|
|
13
15
|
}
|
|
14
16
|
export declare const CreateTeamUseCaseImpl: import("@webiny/di").Implementation<typeof CreateTeamUseCase>;
|
|
@@ -3,15 +3,19 @@ import { Result, createImplementation } from "@webiny/feature/api";
|
|
|
3
3
|
import { EventPublisher } from "../../../eventPublisher/index.js";
|
|
4
4
|
import { CreateTeam } from "./abstractions.js";
|
|
5
5
|
import { TeamsRepository } from "../shared/abstractions.js";
|
|
6
|
+
import { RolesRepository } from "../../roles/shared/abstractions.js";
|
|
6
7
|
import { IdentityContext } from "../../IdentityContext/abstractions.js";
|
|
7
8
|
import { createTeamValidation } from "./schema.js";
|
|
8
9
|
import { TeamAfterCreateEvent, TeamBeforeCreateEvent } from "./events.js";
|
|
9
10
|
import { NotAuthorizedError, TeamExistsError, TeamValidationError } from "../shared/errors.js";
|
|
11
|
+
import { descriptionOnCreate } from "../../shared/description.js";
|
|
12
|
+
import { resolveRoleIdentifiers } from "../shared/resolveRoleIdentifiers.js";
|
|
10
13
|
class CreateTeamUseCase {
|
|
11
|
-
constructor(identityContext, eventPublisher, repository){
|
|
14
|
+
constructor(identityContext, eventPublisher, repository, rolesRepository){
|
|
12
15
|
this.identityContext = identityContext;
|
|
13
16
|
this.eventPublisher = eventPublisher;
|
|
14
17
|
this.repository = repository;
|
|
18
|
+
this.rolesRepository = rolesRepository;
|
|
15
19
|
}
|
|
16
20
|
async execute(input) {
|
|
17
21
|
const hasPermission = await this.identityContext.getPermission("security.team");
|
|
@@ -24,12 +28,19 @@ class CreateTeamUseCase {
|
|
|
24
28
|
slug: data.slug
|
|
25
29
|
});
|
|
26
30
|
if (existingTeamResult.isOk()) return Result.fail(new TeamExistsError(data.slug));
|
|
31
|
+
const roleIdsResult = await resolveRoleIdentifiers(this.rolesRepository, data.roles);
|
|
32
|
+
if (roleIdsResult.isFail()) return Result.fail(roleIdsResult.error);
|
|
33
|
+
const createInput = {
|
|
34
|
+
...data,
|
|
35
|
+
description: descriptionOnCreate(data.description),
|
|
36
|
+
roles: roleIdsResult.value
|
|
37
|
+
};
|
|
27
38
|
const team = {
|
|
28
39
|
id: mdbid(),
|
|
29
|
-
name:
|
|
30
|
-
slug:
|
|
31
|
-
description:
|
|
32
|
-
roles:
|
|
40
|
+
name: createInput.name,
|
|
41
|
+
slug: createInput.slug,
|
|
42
|
+
description: descriptionOnCreate(createInput.description),
|
|
43
|
+
roles: createInput.roles,
|
|
33
44
|
system: input.system || false,
|
|
34
45
|
createdOn: new Date().toISOString(),
|
|
35
46
|
createdBy: {
|
|
@@ -41,13 +52,13 @@ class CreateTeamUseCase {
|
|
|
41
52
|
};
|
|
42
53
|
await this.eventPublisher.publish(new TeamBeforeCreateEvent({
|
|
43
54
|
team,
|
|
44
|
-
input:
|
|
55
|
+
input: createInput
|
|
45
56
|
}));
|
|
46
57
|
const result = await this.repository.create(team);
|
|
47
58
|
if (result.isFail()) return Result.fail(result.error);
|
|
48
59
|
await this.eventPublisher.publish(new TeamAfterCreateEvent({
|
|
49
60
|
team,
|
|
50
|
-
input:
|
|
61
|
+
input: createInput
|
|
51
62
|
}));
|
|
52
63
|
return Result.ok(team);
|
|
53
64
|
}
|
|
@@ -58,7 +69,8 @@ const CreateTeamUseCaseImpl = createImplementation({
|
|
|
58
69
|
dependencies: [
|
|
59
70
|
IdentityContext,
|
|
60
71
|
EventPublisher,
|
|
61
|
-
TeamsRepository
|
|
72
|
+
TeamsRepository,
|
|
73
|
+
RolesRepository
|
|
62
74
|
]
|
|
63
75
|
});
|
|
64
76
|
export { CreateTeamUseCase, CreateTeamUseCaseImpl };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/security/teams/CreateTeam/CreateTeamUseCase.js","sources":["../../../../../src/features/security/teams/CreateTeam/CreateTeamUseCase.ts"],"sourcesContent":["import { mdbid } from \"@webiny/utils\";\nimport { createImplementation } from \"@webiny/feature/api\";\nimport { Result } from \"@webiny/feature/api\";\nimport { EventPublisher } from \"~/features/eventPublisher/index.js\";\nimport { CreateTeam } from \"./abstractions.js\";\nimport { TeamsRepository } from \"../shared/abstractions.js\";\nimport { IdentityContext } from \"../../IdentityContext/abstractions.js\";\nimport { createTeamValidation } from \"./schema.js\";\nimport { TeamBeforeCreateEvent, TeamAfterCreateEvent } from \"./events.js\";\nimport type { Team, CreateTeamInput } from \"../shared/types.js\";\nimport { NotAuthorizedError, TeamExistsError, TeamValidationError } from \"../shared/errors.js\";\n\nexport class CreateTeamUseCase implements CreateTeam.Interface {\n constructor(\n private identityContext: IdentityContext.Interface,\n private eventPublisher: EventPublisher.Interface,\n private repository: TeamsRepository.Interface\n ) {}\n\n async execute(input: CreateTeamInput): Promise<Result<Team, CreateTeam.Error>> {\n const hasPermission = await this.identityContext.getPermission(\"security.team\");\n\n if (!hasPermission) {\n return Result.fail(new NotAuthorizedError());\n }\n\n const validation = createTeamValidation.safeParse(input);\n if (!validation.success) {\n return Result.fail(new TeamValidationError(validation.error.issues[0].message));\n }\n\n const identity = this.identityContext.getIdentity();\n const data = validation.data;\n\n // Check if team with same slug already exists\n const existingTeamResult = await this.repository.get({ slug: data.slug });\n if (existingTeamResult.isOk()) {\n return Result.fail(new TeamExistsError(data.slug));\n }\n\n const team: Team = {\n id: mdbid(),\n name:
|
|
1
|
+
{"version":3,"file":"features/security/teams/CreateTeam/CreateTeamUseCase.js","sources":["../../../../../src/features/security/teams/CreateTeam/CreateTeamUseCase.ts"],"sourcesContent":["import { mdbid } from \"@webiny/utils\";\nimport { createImplementation } from \"@webiny/feature/api\";\nimport { Result } from \"@webiny/feature/api\";\nimport { EventPublisher } from \"~/features/eventPublisher/index.js\";\nimport { CreateTeam } from \"./abstractions.js\";\nimport { TeamsRepository } from \"../shared/abstractions.js\";\nimport { RolesRepository } from \"../../roles/shared/abstractions.js\";\nimport { IdentityContext } from \"../../IdentityContext/abstractions.js\";\nimport { createTeamValidation } from \"./schema.js\";\nimport { TeamBeforeCreateEvent, TeamAfterCreateEvent } from \"./events.js\";\nimport type { Team, CreateTeamInput } from \"../shared/types.js\";\nimport { NotAuthorizedError, TeamExistsError, TeamValidationError } from \"../shared/errors.js\";\nimport { descriptionOnCreate } from \"../../shared/description.js\";\nimport { resolveRoleIdentifiers } from \"../shared/resolveRoleIdentifiers.js\";\n\nexport class CreateTeamUseCase implements CreateTeam.Interface {\n constructor(\n private identityContext: IdentityContext.Interface,\n private eventPublisher: EventPublisher.Interface,\n private repository: TeamsRepository.Interface,\n private rolesRepository: RolesRepository.Interface\n ) {}\n\n async execute(input: CreateTeamInput): Promise<Result<Team, CreateTeam.Error>> {\n const hasPermission = await this.identityContext.getPermission(\"security.team\");\n\n if (!hasPermission) {\n return Result.fail(new NotAuthorizedError());\n }\n\n const validation = createTeamValidation.safeParse(input);\n if (!validation.success) {\n return Result.fail(new TeamValidationError(validation.error.issues[0].message));\n }\n\n const identity = this.identityContext.getIdentity();\n const data = validation.data;\n\n // Check if team with same slug already exists\n const existingTeamResult = await this.repository.get({ slug: data.slug });\n if (existingTeamResult.isOk()) {\n return Result.fail(new TeamExistsError(data.slug));\n }\n\n // A slug here would be stored verbatim and then match no role, leaving a team that grants\n // nothing. Resolved before the entity is built so the events carry the stored IDs.\n const roleIdsResult = await resolveRoleIdentifiers(this.rolesRepository, data.roles);\n\n if (roleIdsResult.isFail()) {\n return Result.fail(roleIdsResult.error);\n }\n\n // Normalised up front so that null reaches neither the entity nor the published events.\n const createInput: CreateTeamInput = {\n ...data,\n description: descriptionOnCreate(data.description),\n roles: roleIdsResult.value\n };\n\n const team: Team = {\n id: mdbid(),\n name: createInput.name,\n slug: createInput.slug,\n description: descriptionOnCreate(createInput.description),\n roles: createInput.roles,\n system: input.system || false,\n createdOn: new Date().toISOString(),\n createdBy: {\n id: identity.id,\n displayName: identity.displayName,\n type: identity.type\n },\n plugin: false\n };\n\n await this.eventPublisher.publish(new TeamBeforeCreateEvent({ team, input: createInput }));\n\n const result = await this.repository.create(team);\n\n if (result.isFail()) {\n return Result.fail(result.error);\n }\n\n await this.eventPublisher.publish(new TeamAfterCreateEvent({ team, input: createInput }));\n\n return Result.ok(team);\n }\n}\n\nexport const CreateTeamUseCaseImpl = createImplementation({\n abstraction: CreateTeam,\n implementation: CreateTeamUseCase,\n dependencies: [IdentityContext, EventPublisher, TeamsRepository, RolesRepository]\n});\n"],"names":["CreateTeamUseCase","identityContext","eventPublisher","repository","rolesRepository","input","hasPermission","Result","NotAuthorizedError","validation","createTeamValidation","TeamValidationError","identity","data","existingTeamResult","TeamExistsError","roleIdsResult","resolveRoleIdentifiers","createInput","descriptionOnCreate","team","mdbid","Date","TeamBeforeCreateEvent","result","TeamAfterCreateEvent","CreateTeamUseCaseImpl","createImplementation","CreateTeam","IdentityContext","EventPublisher","TeamsRepository","RolesRepository"],"mappings":";;;;;;;;;;;;AAeO,MAAMA;IACT,YACYC,eAA0C,EAC1CC,cAAwC,EACxCC,UAAqC,EACrCC,eAA0C,CACpD;aAJUH,eAAe,GAAfA;aACAC,cAAc,GAAdA;aACAC,UAAU,GAAVA;aACAC,eAAe,GAAfA;IACT;IAEH,MAAM,QAAQC,KAAsB,EAA2C;QAC3E,MAAMC,gBAAgB,MAAM,IAAI,CAAC,eAAe,CAAC,aAAa,CAAC;QAE/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,WAAW,IAAI,CAAC,eAAe,CAAC,WAAW;QACjD,MAAMC,OAAOJ,WAAW,IAAI;QAG5B,MAAMK,qBAAqB,MAAM,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;YAAE,MAAMD,KAAK,IAAI;QAAC;QACvE,IAAIC,mBAAmB,IAAI,IACvB,OAAOP,OAAO,IAAI,CAAC,IAAIQ,gBAAgBF,KAAK,IAAI;QAKpD,MAAMG,gBAAgB,MAAMC,uBAAuB,IAAI,CAAC,eAAe,EAAEJ,KAAK,KAAK;QAEnF,IAAIG,cAAc,MAAM,IACpB,OAAOT,OAAO,IAAI,CAACS,cAAc,KAAK;QAI1C,MAAME,cAA+B;YACjC,GAAGL,IAAI;YACP,aAAaM,oBAAoBN,KAAK,WAAW;YACjD,OAAOG,cAAc,KAAK;QAC9B;QAEA,MAAMI,OAAa;YACf,IAAIC;YACJ,MAAMH,YAAY,IAAI;YACtB,MAAMA,YAAY,IAAI;YACtB,aAAaC,oBAAoBD,YAAY,WAAW;YACxD,OAAOA,YAAY,KAAK;YACxB,QAAQb,MAAM,MAAM,IAAI;YACxB,WAAW,IAAIiB,OAAO,WAAW;YACjC,WAAW;gBACP,IAAIV,SAAS,EAAE;gBACf,aAAaA,SAAS,WAAW;gBACjC,MAAMA,SAAS,IAAI;YACvB;YACA,QAAQ;QACZ;QAEA,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,IAAIW,sBAAsB;YAAEH;YAAM,OAAOF;QAAY;QAEvF,MAAMM,SAAS,MAAM,IAAI,CAAC,UAAU,CAAC,MAAM,CAACJ;QAE5C,IAAII,OAAO,MAAM,IACb,OAAOjB,OAAO,IAAI,CAACiB,OAAO,KAAK;QAGnC,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,IAAIC,qBAAqB;YAAEL;YAAM,OAAOF;QAAY;QAEtF,OAAOX,OAAO,EAAE,CAACa;IACrB;AACJ;AAEO,MAAMM,wBAAwBC,qBAAqB;IACtD,aAAaC;IACb,gBAAgB5B;IAChB,cAAc;QAAC6B;QAAiBC;QAAgBC;QAAiBC;KAAgB;AACrF"}
|
|
@@ -2,6 +2,6 @@ import { z } from "zod";
|
|
|
2
2
|
export declare const createTeamValidation: z.ZodObject<{
|
|
3
3
|
name: z.ZodString;
|
|
4
4
|
slug: z.ZodString;
|
|
5
|
-
description: z.
|
|
5
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
6
6
|
roles: z.ZodArray<z.ZodString>;
|
|
7
7
|
}, z.core.$strip>;
|
|
@@ -2,7 +2,7 @@ import { z } from "zod";
|
|
|
2
2
|
const createTeamValidation = z.object({
|
|
3
3
|
name: z.string().min(3),
|
|
4
4
|
slug: z.string().min(3),
|
|
5
|
-
description: z.string().max(500).
|
|
5
|
+
description: z.string().max(500).nullish(),
|
|
6
6
|
roles: z.array(z.string())
|
|
7
7
|
});
|
|
8
8
|
export { createTeamValidation };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/security/teams/CreateTeam/schema.js","sources":["../../../../../src/features/security/teams/CreateTeam/schema.ts"],"sourcesContent":["import { z } from \"zod\";\n\nexport const createTeamValidation = z.object({\n name: z.string().min(3),\n slug: z.string().min(3),\n description: z.string().max(500).
|
|
1
|
+
{"version":3,"file":"features/security/teams/CreateTeam/schema.js","sources":["../../../../../src/features/security/teams/CreateTeam/schema.ts"],"sourcesContent":["import { z } from \"zod\";\n\nexport const createTeamValidation = z.object({\n name: z.string().min(3),\n slug: z.string().min(3),\n // Nullable in the GraphQL schema - see `descriptionOnCreate` for why this is `.nullish()`.\n description: z.string().max(500).nullish(),\n roles: z.array(z.string())\n});\n"],"names":["createTeamValidation","z"],"mappings":";AAEO,MAAMA,uBAAuBC,EAAE,MAAM,CAAC;IACzC,MAAMA,EAAE,MAAM,GAAG,GAAG,CAAC;IACrB,MAAMA,EAAE,MAAM,GAAG,GAAG,CAAC;IAErB,aAAaA,EAAE,MAAM,GAAG,GAAG,CAAC,KAAK,OAAO;IACxC,OAAOA,EAAE,KAAK,CAACA,EAAE,MAAM;AAC3B"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Result } from "@webiny/feature/api";
|
|
2
2
|
import { UpdateTeam } from "./abstractions.js";
|
|
3
3
|
import { TeamsRepository } from "../shared/abstractions.js";
|
|
4
|
+
import { RolesRepository } from "../../roles/shared/abstractions.js";
|
|
4
5
|
import { IdentityContext } from "../../IdentityContext/abstractions.js";
|
|
5
6
|
import { EventPublisher } from "../../../../features/eventPublisher/index.js";
|
|
6
7
|
import type { Team, UpdateTeamInput } from "../shared/types.js";
|
|
@@ -8,7 +9,8 @@ export declare class UpdateTeamUseCase {
|
|
|
8
9
|
private repository;
|
|
9
10
|
private identityContext;
|
|
10
11
|
private eventPublisher;
|
|
11
|
-
|
|
12
|
+
private rolesRepository;
|
|
13
|
+
constructor(repository: TeamsRepository.Interface, identityContext: IdentityContext.Interface, eventPublisher: EventPublisher.Interface, rolesRepository: RolesRepository.Interface);
|
|
12
14
|
execute(id: string, input: UpdateTeamInput): Promise<Result<Team, UpdateTeam.Error>>;
|
|
13
15
|
}
|
|
14
16
|
export declare const UpdateTeamUseCaseImpl: import("@webiny/di").Implementation<typeof UpdateTeamUseCase>;
|