@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/task/TaskDefinition/abstractions.js","sources":["../../../../src/features/task/TaskDefinition/abstractions.ts"],"sourcesContent":["import zod from \"zod\";\nimport { createAbstraction } from \"@webiny/feature/api\";\nimport type { GenericRecord } from \"@webiny/api/types\";\nimport type { ITask } from \"~/features/task/TaskService/index.js\";\nimport { TaskController } from \"~/features/task/TaskController/index.js\";\n\nexport type ITaskInput = GenericRecord;\n\nexport interface IResponseError {\n message: string;\n code?: string | null;\n data?: GenericRecord | null;\n stack?: string;\n}\n\nexport interface ITaskOutput {\n error?: IResponseError;\n [key: string]: any;\n}\n\n/**\n * Task run params - ONLY the input data\n * All runtime dependencies come from TaskController (injected separately)\n */\nexport interface ITaskRunParams<\n I extends ITaskInput = ITaskInput,\n O extends ITaskOutput = ITaskOutput\n> {\n input: I;\n controller: TaskController.Interface<I, O>;\n}\n\n/**\n * Data for creating a new task\n */\nexport interface ITaskCreateData<I = ITaskInput> {\n definitionId: string;\n name: string;\n input: I;\n parentId?: string;\n}\n\n/**\n * Parameters for onBeforeTrigger lifecycle hook\n */\nexport interface ITaskBeforeTriggerParams<I = ITaskInput> {\n data: ITaskCreateData<I>;\n}\n\n/**\n * Task result status enum\n */\nexport enum TaskResultStatus {\n DONE = \"done\",\n CONTINUE = \"continue\",\n ERROR = \"error\",\n ABORTED = \"aborted\"\n}\n\n/**\n * Specific result types\n */\nexport interface ITaskResultDone<O extends ITaskOutput = ITaskOutput> {\n status: TaskResultStatus.DONE;\n message?: string;\n output?: O;\n}\n\nexport interface ITaskResultContinue<I = ITaskInput> {\n status: TaskResultStatus.CONTINUE;\n input: I;\n wait?: number; // seconds to wait before next iteration\n}\n\nexport interface ITaskResultError {\n status: TaskResultStatus.ERROR;\n error: IResponseError;\n}\n\nexport interface ITaskResultAborted {\n status: TaskResultStatus.ABORTED;\n}\n\nexport type ITaskResult<I = ITaskInput, O extends ITaskOutput = ITaskOutput> =\n | ITaskResultDone<O>\n | ITaskResultContinue<I>\n | ITaskResultError\n | ITaskResultAborted;\n\nexport type ISelfCleanupEvent = \"onSuccess\" | \"onError\" | \"onAbort\";\n\nexport type ISelfCleanup = \"always\" | \"never\" | ISelfCleanupEvent | ISelfCleanupEvent[];\n\nexport type ITaskLifecycleHook<\n I extends ITaskInput = ITaskInput,\n O extends ITaskOutput = ITaskOutput\n> = {\n task: ITask<I, O>;\n};\n\n/**\n * Core TaskDefinition - minimal interface\n */\nexport interface ITaskDefinition<\n I extends ITaskInput = ITaskInput,\n O extends ITaskOutput = ITaskOutput\n> {\n id: string;\n title: string;\n description?: string;\n maxIterations?: number;\n databaseLogs?: boolean;\n isPrivate?: boolean;\n selfCleanup?: ISelfCleanup;\n\n /**\n * Core run method - receives ONLY input params\n * All runtime dependencies (logging, state management, etc.) come from TaskController\n */\n run(params: ITaskRunParams<I, O>): Promise<ITaskResult<I, O>>;\n\n /**\n * Optional lifecycle hooks - receive task data, no context.\n */\n onBeforeTrigger?(params: ITaskBeforeTriggerParams<I>): Promise<void>;\n onDone?(params: ITaskLifecycleHook<I, O>): Promise<void>;\n onError?(params: ITaskLifecycleHook<I, O>): Promise<void>;\n onAbort?(params: ITaskLifecycleHook<I, O>): Promise<void>;\n onMaxIterations?(params: ITaskLifecycleHook<I, O>): Promise<void>;\n /**\n * Create a validation schema for the task input.\n * This will be used to validate the input before the task is triggered.\n */\n createInputValidation?(\n params: ITaskCreateInputValidationParams\n ): GenericRecord<keyof I, zod.Schema> | zod.Schema;\n}\n\nexport interface ITaskCreateInputValidationParams {\n validator: typeof zod;\n}\n\n/** Define a long-running background task with lifecycle hooks. */\nexport const TaskDefinition = createAbstraction<ITaskDefinition>(\"TaskDefinition\");\n\n/**\n * IRunnableTaskDefinition represents a TaskDefinition after decoration/processing.\n * All optional runtime properties are guaranteed to have values (with defaults applied).\n * Used internally by the task runner to ensure consistent behavior.\n */\nexport interface IRunnableTaskDefinition<\n I extends ITaskInput = ITaskInput,\n O extends ITaskOutput = ITaskOutput\n> extends ITaskDefinition<I, O> {\n // Override optional properties to be required with guaranteed values\n isPrivate: boolean;\n databaseLogs: boolean;\n maxIterations: number;\n}\n\nexport namespace TaskDefinition {\n export type Interface<\n I extends ITaskInput = ITaskInput,\n O extends ITaskOutput = ITaskOutput\n > = ITaskDefinition<I, O>;\n\n export type TaskInput = ITaskInput;\n\n export type TaskOutput = ITaskOutput;\n\n export type Runnable<\n I extends ITaskInput = ITaskInput,\n O extends ITaskOutput = ITaskOutput\n > = IRunnableTaskDefinition<I, O>;\n\n export type RunParams<\n I extends ITaskInput = ITaskInput,\n O extends ITaskOutput = ITaskOutput\n > = ITaskRunParams<I, O>;\n\n export type Result<\n I extends ITaskInput = ITaskInput,\n O extends ITaskOutput = ITaskOutput\n > = ITaskResult<I, O>;\n\n export type Task<\n I extends ITaskInput = ITaskInput,\n O extends ITaskOutput = ITaskOutput\n > = ITask<I, O>;\n\n export type ResultDone<O extends ITaskOutput = ITaskOutput> = ITaskResultDone<O>;\n export type ResultContinue<I = ITaskInput> = ITaskResultContinue<I>;\n export type ResultError = ITaskResultError;\n export type ResultAborted = ITaskResultAborted;\n export type CreateInputValidationParams = ITaskCreateInputValidationParams;\n export type TaskCreateData<I = ITaskInput> = ITaskCreateData<I>;\n export type BeforeTriggerParams<I = ITaskInput> = ITaskBeforeTriggerParams<I>;\n export type LifecycleHookParams<\n I extends ITaskInput = ITaskInput,\n O extends ITaskOutput = ITaskOutput\n > = ITaskLifecycleHook<I, O>;\n\n export type SelfCleanupEvent = ISelfCleanupEvent;\n export type SelfCleanup = ISelfCleanup;\n}\n"],"names":["TaskResultStatus","TaskDefinition","createAbstraction"],"mappings":";AAoDO,IAAKA,gCAAgBA,WAAAA,GAAAA,SAAhBA,gBAAgB;;;;;WAAhBA;;AA2FL,MAAMC,iBAAiBC,kBAAmC"}
|
|
1
|
+
{"version":3,"file":"features/task/TaskDefinition/abstractions.js","sources":["../../../../src/features/task/TaskDefinition/abstractions.ts"],"sourcesContent":["import zod from \"zod\";\nimport type { Constructor } from \"@webiny/di\";\nimport { createAbstraction } from \"@webiny/feature/api\";\nimport type { GenericRecord } from \"@webiny/api/types\";\nimport type { ITask } from \"~/features/task/TaskService/index.js\";\nimport { TaskController } from \"~/features/task/TaskController/index.js\";\n\nexport type ITaskInput = GenericRecord;\n\nexport interface IResponseError {\n message: string;\n code?: string | null;\n data?: GenericRecord | null;\n stack?: string;\n}\n\nexport interface ITaskOutput {\n error?: IResponseError;\n [key: string]: any;\n}\n\n/**\n * The task's own definition, minus its behaviour.\n *\n * Handed to `run()` and to every lifecycle hook so a decorator can tell which task it is wrapping\n * and act on the definition's own fields. A decorator is registered against the abstraction, so it\n * wraps every task; without this it has nothing to branch on but a hardcoded list of ids, which\n * means editing the decorator every time a task is added.\n *\n * This is {@link ITaskMetadata}: identity and policy, no behaviour and no handler pointer. The\n * object passed at runtime is the resolved task, so `run` is physically present; naming the metadata\n * type here stops the obvious mistake of a handler calling `params.definition.run(...)` and\n * recursing forever.\n *\n * Only the fields declared here arrive. A field a project adds to its own definition class is\n * currently dropped, because `TaskDefinitionDefaultsDecorator` is a fixed pass-through that\n * exposes a known set of getters and nothing else. Making them forward unknown\n * properties would turn a definition into a place to declare policy (a rate limit, a set of tags)\n * that a decorator acts on; `taskDefinitionInParams.test.ts` pins the current behaviour so that\n * change announces itself.\n */\nexport type ITaskDefinitionInfo = ITaskMetadata;\n\n/**\n * Task run params - the input data, plus the definition being run\n * All runtime dependencies come from TaskController (injected separately)\n */\nexport interface ITaskRunParams<\n I extends ITaskInput = ITaskInput,\n O extends ITaskOutput = ITaskOutput\n> {\n input: I;\n controller: TaskController.Interface<I, O>;\n definition: ITaskDefinitionInfo;\n}\n\n/**\n * Data for creating a new task\n */\nexport interface ITaskCreateData<I = ITaskInput> {\n definitionId: string;\n name: string;\n input: I;\n parentId?: string;\n}\n\n/**\n * Parameters for onBeforeTrigger lifecycle hook\n */\nexport interface ITaskBeforeTriggerParams<I = ITaskInput> {\n data: ITaskCreateData<I>;\n definition: ITaskDefinitionInfo;\n}\n\n/**\n * Task result status enum\n */\nexport enum TaskResultStatus {\n DONE = \"done\",\n CONTINUE = \"continue\",\n ERROR = \"error\",\n ABORTED = \"aborted\"\n}\n\n/**\n * Specific result types\n */\nexport interface ITaskResultDone<O extends ITaskOutput = ITaskOutput> {\n status: TaskResultStatus.DONE;\n message?: string;\n output?: O;\n}\n\nexport interface ITaskResultContinue<I = ITaskInput> {\n status: TaskResultStatus.CONTINUE;\n input: I;\n wait?: number; // seconds to wait before next iteration\n}\n\nexport interface ITaskResultError {\n status: TaskResultStatus.ERROR;\n error: IResponseError;\n}\n\nexport interface ITaskResultAborted {\n status: TaskResultStatus.ABORTED;\n}\n\nexport type ITaskResult<I = ITaskInput, O extends ITaskOutput = ITaskOutput> =\n | ITaskResultDone<O>\n | ITaskResultContinue<I>\n | ITaskResultError\n | ITaskResultAborted;\n\nexport type ISelfCleanupEvent = \"onSuccess\" | \"onError\" | \"onAbort\";\n\nexport type ISelfCleanup = \"always\" | \"never\" | ISelfCleanupEvent | ISelfCleanupEvent[];\n\nexport type ITaskLifecycleHook<\n I extends ITaskInput = ITaskInput,\n O extends ITaskOutput = ITaskOutput\n> = {\n task: ITask<I, O>;\n definition: ITaskDefinitionInfo;\n};\n\n/**\n * What a task IS: identity and runtime policy, with no behaviour and no dependencies.\n *\n * Listing tasks, resolving one by id, and applying defaults all need only this. Keeping it free of\n * dependencies is the whole point — `GetRunnableTaskDefinitionUseCase` builds every registered definition\n * to find one by id, so anything expensive here is paid 24 times per lookup.\n */\nexport interface ITaskMetadata {\n id: string;\n title: string;\n description?: string;\n maxIterations?: number;\n databaseLogs?: boolean;\n isPrivate?: boolean;\n selfCleanup?: ISelfCleanup;\n}\n\n/**\n * What a task DOES. This is the half that carries dependencies (a CMS context, an OpenSearch\n * client), so it is built only for the task actually being run.\n *\n * The lifecycle hooks live here rather than on {@link ITaskMetadata} because they need the same\n * dependencies `run()` does — see `MockDataManagerTask`, whose `onError` and `onAbort` both use the\n * OpenSearch client injected for `run()`.\n */\nexport interface ITaskHandler<\n I extends ITaskInput = ITaskInput,\n O extends ITaskOutput = ITaskOutput\n> {\n /**\n * Core run method - receives ONLY input params\n * All runtime dependencies (logging, state management, etc.) come from TaskController\n */\n run(params: ITaskRunParams<I, O>): Promise<ITaskResult<I, O>>;\n\n /**\n * Optional lifecycle hooks - receive task data, no context.\n */\n onBeforeTrigger?(params: ITaskBeforeTriggerParams<I>): Promise<void>;\n onDone?(params: ITaskLifecycleHook<I, O>): Promise<void>;\n onError?(params: ITaskLifecycleHook<I, O>): Promise<void>;\n onAbort?(params: ITaskLifecycleHook<I, O>): Promise<void>;\n onMaxIterations?(params: ITaskLifecycleHook<I, O>): Promise<void>;\n /**\n * Create a validation schema for the task input.\n * This will be used to validate the input before the task is triggered.\n */\n createInputValidation?(\n params: ITaskCreateInputValidationParams\n ): GenericRecord<keyof I, zod.Schema> | zod.Schema;\n}\n\n/**\n * What you register: a task's {@link ITaskMetadata} plus the class that does the work.\n *\n * The definition takes no dependencies of its own, so `GetRunnableTaskDefinitionUseCase` can build every\n * registered one to find a task by id without constructing anything expensive. Only the winner's\n * `handler` gets built.\n */\nexport interface ITaskDefinition<\n I extends ITaskInput = ITaskInput,\n O extends ITaskOutput = ITaskOutput\n> extends ITaskMetadata {\n handler: Constructor<ITaskHandler<I, O>>;\n}\n\nexport interface ITaskCreateInputValidationParams {\n validator: typeof zod;\n}\n\n/** Define a long-running background task with lifecycle hooks. */\nexport const TaskDefinition = createAbstraction<ITaskDefinition>(\"TaskDefinition\");\n\n/**\n * The behaviour half of a task, resolved on demand by the runner via\n * `container.resolveImplementation(definition.handler)`. Registered implementations are NOT\n * registered against this abstraction — the definition points at the class directly, exactly as\n * `HttpRouteDefinition` points at its `HttpRouteHandler`.\n */\nexport const TaskHandler = createAbstraction<ITaskHandler>(\"TaskHandler\");\n\n/**\n * IRunnableTaskDefinition represents a TaskDefinition after decoration/processing.\n * All optional runtime properties are guaranteed to have values (with defaults applied).\n * Used internally by the task runner to ensure consistent behavior.\n */\nexport interface IRunnableTaskDefinition<\n I extends ITaskInput = ITaskInput,\n O extends ITaskOutput = ITaskOutput\n>\n extends ITaskMetadata, ITaskHandler<I, O> {\n // Override optional properties to be required with guaranteed values\n isPrivate: boolean;\n databaseLogs: boolean;\n maxIterations: number;\n}\n\nexport namespace TaskHandler {\n export type Interface<\n I extends ITaskInput = ITaskInput,\n O extends ITaskOutput = ITaskOutput\n > = ITaskHandler<I, O>;\n\n export type RunParams<\n I extends ITaskInput = ITaskInput,\n O extends ITaskOutput = ITaskOutput\n > = ITaskRunParams<I, O>;\n\n export type Result<\n I extends ITaskInput = ITaskInput,\n O extends ITaskOutput = ITaskOutput\n > = ITaskResult<I, O>;\n\n export type LifecycleHookParams<\n I extends ITaskInput = ITaskInput,\n O extends ITaskOutput = ITaskOutput\n > = ITaskLifecycleHook<I, O>;\n}\n\nexport namespace TaskDefinition {\n export type Interface<\n I extends ITaskInput = ITaskInput,\n O extends ITaskOutput = ITaskOutput\n > = ITaskDefinition<I, O>;\n\n export type Metadata = ITaskMetadata;\n\n export type Handler<\n I extends ITaskInput = ITaskInput,\n O extends ITaskOutput = ITaskOutput\n > = ITaskHandler<I, O>;\n\n export type TaskInput = ITaskInput;\n\n export type TaskOutput = ITaskOutput;\n\n export type Runnable<\n I extends ITaskInput = ITaskInput,\n O extends ITaskOutput = ITaskOutput\n > = IRunnableTaskDefinition<I, O>;\n\n export type RunParams<\n I extends ITaskInput = ITaskInput,\n O extends ITaskOutput = ITaskOutput\n > = ITaskRunParams<I, O>;\n\n export type Result<\n I extends ITaskInput = ITaskInput,\n O extends ITaskOutput = ITaskOutput\n > = ITaskResult<I, O>;\n\n export type Task<\n I extends ITaskInput = ITaskInput,\n O extends ITaskOutput = ITaskOutput\n > = ITask<I, O>;\n\n export type ResultDone<O extends ITaskOutput = ITaskOutput> = ITaskResultDone<O>;\n export type ResultContinue<I = ITaskInput> = ITaskResultContinue<I>;\n export type ResultError = ITaskResultError;\n export type ResultAborted = ITaskResultAborted;\n export type CreateInputValidationParams = ITaskCreateInputValidationParams;\n export type TaskCreateData<I = ITaskInput> = ITaskCreateData<I>;\n export type BeforeTriggerParams<I = ITaskInput> = ITaskBeforeTriggerParams<I>;\n export type LifecycleHookParams<\n I extends ITaskInput = ITaskInput,\n O extends ITaskOutput = ITaskOutput\n > = ITaskLifecycleHook<I, O>;\n\n export type Info = ITaskDefinitionInfo;\n\n export type SelfCleanupEvent = ISelfCleanupEvent;\n export type SelfCleanup = ISelfCleanup;\n}\n"],"names":["TaskResultStatus","TaskDefinition","createAbstraction","TaskHandler"],"mappings":";AA6EO,IAAKA,gCAAgBA,WAAAA,GAAAA,SAAhBA,gBAAgB;;;;;WAAhBA;;AAwHL,MAAMC,iBAAiBC,kBAAmC;AAQ1D,MAAMC,cAAcD,kBAAgC"}
|
|
@@ -7,6 +7,7 @@ declare class TenantContextImpl implements Abstraction.Interface {
|
|
|
7
7
|
constructor(getRootTenant: GetRootTenantUseCase.Interface);
|
|
8
8
|
getTenant(): Tenant;
|
|
9
9
|
setTenant(tenant: Tenant): void;
|
|
10
|
+
private restoreTenant;
|
|
10
11
|
withRootTenant<T>(cb: () => T): Promise<T>;
|
|
11
12
|
withEachTenant<TReturn>(tenants: Tenant[], cb: (tenant: Tenant) => Promise<TReturn>): Promise<TReturn[]>;
|
|
12
13
|
withTenant<TReturn>(tenant: Tenant, cb: (tenant: Tenant) => Promise<TReturn>): Promise<TReturn>;
|
|
@@ -14,8 +14,11 @@ class TenantContextImpl {
|
|
|
14
14
|
if (tenant.isInstalled && "disabled" === tenant.status) throw new TenantIsDisabledError();
|
|
15
15
|
this.currentTenant = tenant;
|
|
16
16
|
}
|
|
17
|
+
restoreTenant(tenant) {
|
|
18
|
+
this.currentTenant = tenant;
|
|
19
|
+
}
|
|
17
20
|
async withRootTenant(cb) {
|
|
18
|
-
const initialTenant = this.
|
|
21
|
+
const initialTenant = this.currentTenant;
|
|
19
22
|
const rootTenant = await this.getRootTenant.execute();
|
|
20
23
|
if (!rootTenant.isOk()) return rootTenant.error;
|
|
21
24
|
const tenant = rootTenant.value;
|
|
@@ -23,28 +26,30 @@ class TenantContextImpl {
|
|
|
23
26
|
try {
|
|
24
27
|
return await cb();
|
|
25
28
|
} finally{
|
|
26
|
-
this.
|
|
29
|
+
this.restoreTenant(initialTenant);
|
|
27
30
|
}
|
|
28
31
|
}
|
|
29
32
|
async withEachTenant(tenants, cb) {
|
|
30
|
-
const initialTenant = this.
|
|
33
|
+
const initialTenant = this.currentTenant;
|
|
31
34
|
const results = [];
|
|
32
35
|
for (const tenant of tenants){
|
|
33
36
|
this.setTenant(tenant);
|
|
34
37
|
try {
|
|
35
38
|
results.push(await cb(tenant));
|
|
36
39
|
} finally{
|
|
37
|
-
this.
|
|
40
|
+
this.restoreTenant(initialTenant);
|
|
38
41
|
}
|
|
39
42
|
}
|
|
40
43
|
return results;
|
|
41
44
|
}
|
|
42
45
|
async withTenant(tenant, cb) {
|
|
43
|
-
const initialTenant = this.
|
|
46
|
+
const initialTenant = this.currentTenant;
|
|
44
47
|
this.setTenant(tenant);
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
+
try {
|
|
49
|
+
return await cb(tenant);
|
|
50
|
+
} finally{
|
|
51
|
+
this.restoreTenant(initialTenant);
|
|
52
|
+
}
|
|
48
53
|
}
|
|
49
54
|
}
|
|
50
55
|
const TenantContext_TenantContext = createImplementation({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/tenancy/TenantContext/TenantContext.js","sources":["../../../../src/features/tenancy/TenantContext/TenantContext.ts"],"sourcesContent":["import { createImplementation } from \"@webiny/feature/api\";\nimport { TenantContext as Abstraction } from \"./abstractions.js\";\nimport type { Tenant } from \"~/types/tenancy.js\";\nimport { GetRootTenantUseCase } from \"~/features/tenancy/GetRootTenant/index.js\";\nimport { TenantIsDisabledError } from \"./errors.js\";\n\nclass TenantContextImpl implements Abstraction.Interface {\n private currentTenant: Tenant | null = null;\n\n constructor(private getRootTenant: GetRootTenantUseCase.Interface) {}\n\n getTenant(): Tenant {\n return this.currentTenant!;\n }\n\n setTenant(tenant: Tenant): void {\n if (tenant.isInstalled && tenant.status === \"disabled\") {\n throw new TenantIsDisabledError();\n }\n this.currentTenant = tenant;\n }\n\n async withRootTenant<T>(cb: () => T): Promise<T> {\n const initialTenant = this.
|
|
1
|
+
{"version":3,"file":"features/tenancy/TenantContext/TenantContext.js","sources":["../../../../src/features/tenancy/TenantContext/TenantContext.ts"],"sourcesContent":["import { createImplementation } from \"@webiny/feature/api\";\nimport { TenantContext as Abstraction } from \"./abstractions.js\";\nimport type { Tenant } from \"~/types/tenancy.js\";\nimport { GetRootTenantUseCase } from \"~/features/tenancy/GetRootTenant/index.js\";\nimport { TenantIsDisabledError } from \"./errors.js\";\n\nclass TenantContextImpl implements Abstraction.Interface {\n private currentTenant: Tenant | null = null;\n\n constructor(private getRootTenant: GetRootTenantUseCase.Interface) {}\n\n getTenant(): Tenant {\n return this.currentTenant!;\n }\n\n setTenant(tenant: Tenant): void {\n if (tenant.isInstalled && tenant.status === \"disabled\") {\n throw new TenantIsDisabledError();\n }\n this.currentTenant = tenant;\n }\n\n /*\n * Puts back the tenant that was current before a `with*` call. That can be none at all: work\n * outside an HTTP request (a background task, a scheduled action) starts without a tenant.\n * Restoring is not switching, so it skips the checks `setTenant` makes.\n */\n private restoreTenant(tenant: Tenant | null): void {\n this.currentTenant = tenant;\n }\n\n async withRootTenant<T>(cb: () => T): Promise<T> {\n const initialTenant = this.currentTenant;\n const rootTenant = await this.getRootTenant.execute();\n if (!rootTenant.isOk()) {\n return rootTenant.error as T;\n }\n\n const tenant = rootTenant.value;\n\n this.setTenant(tenant);\n try {\n return await cb();\n } finally {\n // Make sure that, whatever happens in the callback, the tenant is set back to the initial one.\n this.restoreTenant(initialTenant);\n }\n }\n\n async withEachTenant<TReturn>(\n tenants: Tenant[],\n cb: (tenant: Tenant) => Promise<TReturn>\n ): Promise<TReturn[]> {\n const initialTenant = this.currentTenant;\n const results = [];\n for (const tenant of tenants) {\n this.setTenant(tenant);\n try {\n results.push(await cb(tenant));\n } finally {\n this.restoreTenant(initialTenant);\n }\n }\n return results;\n }\n\n async withTenant<TReturn>(\n tenant: Tenant,\n cb: (tenant: Tenant) => Promise<TReturn>\n ): Promise<TReturn> {\n const initialTenant = this.currentTenant;\n this.setTenant(tenant);\n try {\n return await cb(tenant);\n } finally {\n // Make sure that, whatever happens in the callback, the tenant is set back to the initial one.\n this.restoreTenant(initialTenant);\n }\n }\n}\n\nexport const TenantContext = createImplementation({\n abstraction: Abstraction,\n implementation: TenantContextImpl,\n dependencies: [GetRootTenantUseCase]\n});\n"],"names":["TenantContextImpl","getRootTenant","tenant","TenantIsDisabledError","cb","initialTenant","rootTenant","tenants","results","TenantContext","createImplementation","Abstraction","GetRootTenantUseCase"],"mappings":";;;;AAMA,MAAMA;IAGF,YAAoBC,aAA6C,CAAE;aAA/CA,aAAa,GAAbA;aAFZ,aAAa,GAAkB;IAE6B;IAEpE,YAAoB;QAChB,OAAO,IAAI,CAAC,aAAa;IAC7B;IAEA,UAAUC,MAAc,EAAQ;QAC5B,IAAIA,OAAO,WAAW,IAAIA,AAAkB,eAAlBA,OAAO,MAAM,EACnC,MAAM,IAAIC;QAEd,IAAI,CAAC,aAAa,GAAGD;IACzB;IAOQ,cAAcA,MAAqB,EAAQ;QAC/C,IAAI,CAAC,aAAa,GAAGA;IACzB;IAEA,MAAM,eAAkBE,EAAW,EAAc;QAC7C,MAAMC,gBAAgB,IAAI,CAAC,aAAa;QACxC,MAAMC,aAAa,MAAM,IAAI,CAAC,aAAa,CAAC,OAAO;QACnD,IAAI,CAACA,WAAW,IAAI,IAChB,OAAOA,WAAW,KAAK;QAG3B,MAAMJ,SAASI,WAAW,KAAK;QAE/B,IAAI,CAAC,SAAS,CAACJ;QACf,IAAI;YACA,OAAO,MAAME;QACjB,SAAU;YAEN,IAAI,CAAC,aAAa,CAACC;QACvB;IACJ;IAEA,MAAM,eACFE,OAAiB,EACjBH,EAAwC,EACtB;QAClB,MAAMC,gBAAgB,IAAI,CAAC,aAAa;QACxC,MAAMG,UAAU,EAAE;QAClB,KAAK,MAAMN,UAAUK,QAAS;YAC1B,IAAI,CAAC,SAAS,CAACL;YACf,IAAI;gBACAM,QAAQ,IAAI,CAAC,MAAMJ,GAAGF;YAC1B,SAAU;gBACN,IAAI,CAAC,aAAa,CAACG;YACvB;QACJ;QACA,OAAOG;IACX;IAEA,MAAM,WACFN,MAAc,EACdE,EAAwC,EACxB;QAChB,MAAMC,gBAAgB,IAAI,CAAC,aAAa;QACxC,IAAI,CAAC,SAAS,CAACH;QACf,IAAI;YACA,OAAO,MAAME,GAAGF;QACpB,SAAU;YAEN,IAAI,CAAC,aAAa,CAACG;QACvB;IACJ;AACJ;AAEO,MAAMI,8BAAgBC,qBAAqB;IAC9C,aAAaC;IACb,gBAAgBX;IAChB,cAAc;QAACY;KAAqB;AACxC"}
|
|
@@ -27,10 +27,12 @@ export type GetUserInput = {
|
|
|
27
27
|
id?: never;
|
|
28
28
|
email: string;
|
|
29
29
|
};
|
|
30
|
+
export interface ListUsersWhere {
|
|
31
|
+
id_in?: string[];
|
|
32
|
+
teams_in?: string[];
|
|
33
|
+
}
|
|
30
34
|
export interface ListUsersInput {
|
|
31
|
-
where?:
|
|
32
|
-
id_in?: string[];
|
|
33
|
-
};
|
|
35
|
+
where?: ListUsersWhere;
|
|
34
36
|
sort?: string[];
|
|
35
37
|
}
|
|
36
38
|
export interface StorageOperationsGetUserParams {
|
|
@@ -40,10 +42,10 @@ export interface StorageOperationsGetUserParams {
|
|
|
40
42
|
email?: string;
|
|
41
43
|
};
|
|
42
44
|
}
|
|
45
|
+
export interface StorageOperationsListUsersWhere extends ListUsersWhere {
|
|
46
|
+
tenant: string;
|
|
47
|
+
}
|
|
43
48
|
export interface StorageOperationsListUsersParams {
|
|
44
|
-
where:
|
|
45
|
-
tenant: string;
|
|
46
|
-
id_in?: string[];
|
|
47
|
-
};
|
|
49
|
+
where: StorageOperationsListUsersWhere;
|
|
48
50
|
sort?: string[];
|
|
49
51
|
}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import type { WCP_FEATURE_LABEL } from "@webiny/wcp";
|
|
2
2
|
import type { DecryptedWcpProjectLicense, ILicense, WcpProjectEnvironment, WcpProject } from "@webiny/wcp/types.js";
|
|
3
3
|
import { WcpContext } from "./abstractions.js";
|
|
4
|
-
|
|
5
|
-
testProjectLicense?: DecryptedWcpProjectLicense;
|
|
6
|
-
}
|
|
4
|
+
import type { WcpLicenseProvider } from "../WcpLicenseProvider.js";
|
|
7
5
|
export declare class WcpContextImpl implements WcpContext.Interface {
|
|
8
|
-
private
|
|
9
|
-
constructor(
|
|
6
|
+
private licenseProvider;
|
|
7
|
+
constructor(licenseProvider: WcpLicenseProvider.Interface);
|
|
8
|
+
private get license();
|
|
10
9
|
private getWcpProjectUrl;
|
|
11
10
|
private updateSeats;
|
|
12
11
|
private updateTenants;
|
|
@@ -29,9 +28,17 @@ export declare class WcpContextImpl implements WcpContext.Interface {
|
|
|
29
28
|
canUseAiPageGeneration(): boolean;
|
|
30
29
|
canUseAiPageTranslation(): boolean;
|
|
31
30
|
canUseAiLexicalGeneration(): boolean;
|
|
31
|
+
canUseAiAdminAssistant(): boolean;
|
|
32
32
|
canUseAiEntryGeneration(): boolean;
|
|
33
33
|
canUseAiEntryComparison(): boolean;
|
|
34
34
|
canUseAiEntryTranslation(): boolean;
|
|
35
|
+
canUseAiPowerups(): boolean;
|
|
36
|
+
canUseAbTesting(): boolean;
|
|
37
|
+
canUseRemoteComponents(): boolean;
|
|
38
|
+
canUseCollaboration(): boolean;
|
|
39
|
+
canUseComments(): boolean;
|
|
40
|
+
canUseActivityLog(): boolean;
|
|
41
|
+
canUseLanguages(): boolean;
|
|
35
42
|
ensureCanUseFeature(wcpFeatureId: keyof typeof WCP_FEATURE_LABEL): void;
|
|
36
43
|
incrementSeats(): Promise<void>;
|
|
37
44
|
decrementSeats(): Promise<void>;
|
|
@@ -3,8 +3,11 @@ import error from "@webiny/error";
|
|
|
3
3
|
import { wcpFetch } from "./utils.js";
|
|
4
4
|
const wcpProjectEnvironment = getWcpProjectEnvironment();
|
|
5
5
|
class WcpContextImpl {
|
|
6
|
-
constructor(
|
|
7
|
-
this.
|
|
6
|
+
constructor(licenseProvider){
|
|
7
|
+
this.licenseProvider = licenseProvider;
|
|
8
|
+
}
|
|
9
|
+
get license() {
|
|
10
|
+
return this.licenseProvider.get();
|
|
8
11
|
}
|
|
9
12
|
getWcpProjectUrl(path = "") {
|
|
10
13
|
if (!wcpProjectEnvironment) return null;
|
|
@@ -114,6 +117,9 @@ class WcpContextImpl {
|
|
|
114
117
|
canUseAiLexicalGeneration() {
|
|
115
118
|
return this.license.canUseAiLexicalGeneration();
|
|
116
119
|
}
|
|
120
|
+
canUseAiAdminAssistant() {
|
|
121
|
+
return this.license.canUseAiAdminAssistant();
|
|
122
|
+
}
|
|
117
123
|
canUseAiEntryGeneration() {
|
|
118
124
|
return this.license.canUseAiEntryGeneration();
|
|
119
125
|
}
|
|
@@ -123,6 +129,27 @@ class WcpContextImpl {
|
|
|
123
129
|
canUseAiEntryTranslation() {
|
|
124
130
|
return this.license.canUseAiEntryTranslation();
|
|
125
131
|
}
|
|
132
|
+
canUseAiPowerups() {
|
|
133
|
+
return this.license.canUseAiPowerups();
|
|
134
|
+
}
|
|
135
|
+
canUseAbTesting() {
|
|
136
|
+
return this.license.canUseAbTesting();
|
|
137
|
+
}
|
|
138
|
+
canUseRemoteComponents() {
|
|
139
|
+
return this.license.canUseRemoteComponents();
|
|
140
|
+
}
|
|
141
|
+
canUseCollaboration() {
|
|
142
|
+
return this.license.canUseCollaboration();
|
|
143
|
+
}
|
|
144
|
+
canUseComments() {
|
|
145
|
+
return this.license.canUseComments();
|
|
146
|
+
}
|
|
147
|
+
canUseActivityLog() {
|
|
148
|
+
return this.license.canUseActivityLog();
|
|
149
|
+
}
|
|
150
|
+
canUseLanguages() {
|
|
151
|
+
return this.license.canUseLanguages();
|
|
152
|
+
}
|
|
126
153
|
ensureCanUseFeature(wcpFeatureId) {
|
|
127
154
|
if (this.license.canUseFeature(wcpFeatureId)) return;
|
|
128
155
|
let message = `The ${wcpFeatureId} Webiny Control Panel feature cannot be used because your project license does not permit it.`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/wcp/WcpContext/WcpContext.js","sources":["../../../../src/features/wcp/WcpContext/WcpContext.ts"],"sourcesContent":["import type { WCP_FEATURE_LABEL } from \"@webiny/wcp\";\nimport { getWcpApiUrl, getWcpAppUrl, getWcpProjectEnvironment } from \"@webiny/wcp\";\nimport WError from \"@webiny/error\";\nimport type {\n DecryptedWcpProjectLicense,\n ILicense,\n WcpProjectEnvironment,\n WcpProject\n} from \"@webiny/wcp/types.js\";\nimport { WcpContext } from \"./abstractions.js\";\nimport { wcpFetch } from \"./utils.js\";\n\nconst wcpProjectEnvironment = getWcpProjectEnvironment();\n\nexport interface CreateWcpContextParams {\n testProjectLicense?: DecryptedWcpProjectLicense;\n}\n\nexport class WcpContextImpl implements WcpContext.Interface {\n constructor(private license: ILicense) {}\n\n private getWcpProjectUrl(path = \"\"): string | null {\n if (!wcpProjectEnvironment) {\n return null;\n }\n\n const orgId = wcpProjectEnvironment.org.id;\n const projectId = wcpProjectEnvironment.project.id;\n const url = [\"/orgs\", orgId, \"projects\", projectId, path].filter(Boolean).join(\"/\");\n return getWcpApiUrl(url);\n }\n\n private async updateSeats(operation: \"increment\" | \"decrement\"): Promise<void> {\n if (!wcpProjectEnvironment) {\n return;\n }\n\n const updateSeatsUrl = this.getWcpProjectUrl(\"package/seats\");\n\n const response = await wcpFetch({\n url: updateSeatsUrl!,\n authorization: wcpProjectEnvironment.apiKey,\n body: { operation },\n meta: {\n action: operation + \"Seats\"\n }\n });\n\n if (response.error) {\n const message = response.message || `Failed to ${operation} user seats.`;\n console.error(message, response.status, response.statusText);\n throw new WError(message, \"WCP_CANNOT_UPDATE_USER_TENANTS\");\n }\n }\n\n private async updateTenants(operation: \"increment\" | \"decrement\"): Promise<void> {\n if (!wcpProjectEnvironment) {\n return;\n }\n\n const updateTenantsUrl = this.getWcpProjectUrl(\"package/tenants\");\n\n const response = await wcpFetch({\n url: updateTenantsUrl!,\n authorization: wcpProjectEnvironment.apiKey,\n body: { operation },\n meta: {\n action: operation + \"Tenants\"\n }\n });\n\n if (response.error) {\n const message = response.message || `Failed to ${operation} tenants.`;\n console.error(message, response.status, response.statusText);\n throw new WError(message, \"WCP_CANNOT_UPDATE_USER_TENANTS\");\n }\n }\n\n getRawLicense(): DecryptedWcpProjectLicense | null {\n return this.license.getRawLicense();\n }\n\n getProject(): WcpProject | null {\n return this.license.getProject();\n }\n\n getProjectWithFeatureFlags(): WcpProject | null {\n return this.getProject();\n }\n\n getProjectEnvironment(): WcpProjectEnvironment | null {\n return wcpProjectEnvironment;\n }\n\n getProjectLicense(): ILicense {\n return this.license;\n }\n\n canUseFeature(wcpFeatureId: keyof typeof WCP_FEATURE_LABEL): boolean {\n return this.license.canUseFeature(wcpFeatureId);\n }\n\n canUseAacl(): boolean {\n return this.license.canUseAacl();\n }\n\n canUseTeams(): boolean {\n return this.license.canUseTeams();\n }\n\n canUseFolderLevelPermissions(): boolean {\n return this.license.canUseFolderLevelPermissions();\n }\n\n canUsePrivateFiles(): boolean {\n return this.license.canUsePrivateFiles();\n }\n\n canUseAuditLogs(): boolean {\n return this.license.canUseAuditLogs();\n }\n\n canUseRecordLocking(): boolean {\n return this.license.canUseRecordLocking();\n }\n\n canUseFileManagerThreatDetection(): boolean {\n return this.license.canUseFileManagerThreatDetection();\n }\n\n canUseWorkflows(): boolean {\n return this.license.canUseWorkflows();\n }\n\n canUseHcmsFieldPermissions(): boolean {\n return this.license.canUseHcmsFieldPermissions();\n }\n\n canUseAiImageEnrichment(): boolean {\n return this.license.canUseAiImageEnrichment();\n }\n\n canUseAiPageGeneration(): boolean {\n return this.license.canUseAiPageGeneration();\n }\n\n canUseAiPageTranslation(): boolean {\n return this.license.canUseAiPageTranslation();\n }\n\n canUseAiLexicalGeneration(): boolean {\n return this.license.canUseAiLexicalGeneration();\n }\n\n canUseAiEntryGeneration(): boolean {\n return this.license.canUseAiEntryGeneration();\n }\n\n canUseAiEntryComparison(): boolean {\n return this.license.canUseAiEntryComparison();\n }\n\n canUseAiEntryTranslation(): boolean {\n return this.license.canUseAiEntryTranslation();\n }\n\n ensureCanUseFeature(wcpFeatureId: keyof typeof WCP_FEATURE_LABEL): void {\n if (this.license.canUseFeature(wcpFeatureId)) {\n return;\n }\n\n let message = `The ${wcpFeatureId} Webiny Control Panel feature cannot be used because your project license does not permit it.`;\n if (wcpProjectEnvironment) {\n const { org, project } = wcpProjectEnvironment;\n const upgradeProjectLicenseLink = getWcpAppUrl(`/${org.id}/${project.id}/settings`);\n message += ` To upgrade your project license, please use the following link: ${upgradeProjectLicenseLink}.`;\n }\n\n throw new WError(message, \"WCP_CANNOT_USE_FEATURE\", { wcpFeatureId });\n }\n\n async incrementSeats(): Promise<void> {\n await this.updateSeats(\"increment\");\n }\n\n async decrementSeats(): Promise<void> {\n await this.updateSeats(\"decrement\");\n }\n\n async incrementTenants(): Promise<void> {\n await this.updateTenants(\"increment\");\n }\n\n async decrementTenants(): Promise<void> {\n await this.updateTenants(\"decrement\");\n }\n\n toDto() {\n return this.getRawLicense();\n }\n}\n"],"names":["wcpProjectEnvironment","getWcpProjectEnvironment","WcpContextImpl","license","path","orgId","projectId","url","Boolean","getWcpApiUrl","operation","updateSeatsUrl","response","wcpFetch","message","console","WError","updateTenantsUrl","wcpFeatureId","org","project","upgradeProjectLicenseLink","getWcpAppUrl"],"mappings":";;;AAYA,MAAMA,wBAAwBC;AAMvB,MAAMC;IACT,YAAoBC,OAAiB,CAAE;aAAnBA,OAAO,GAAPA;IAAoB;IAEhC,iBAAiBC,OAAO,EAAE,EAAiB;QAC/C,IAAI,CAACJ,uBACD,OAAO;QAGX,MAAMK,QAAQL,sBAAsB,GAAG,CAAC,EAAE;QAC1C,MAAMM,YAAYN,sBAAsB,OAAO,CA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,oBAAoBA,YAA4C,EAAQ;QACpE,IAAI,IAAI,CAAC,OAAO,CAAC,aAAa,CAACA,eAC3B;QAGJ,IAAIJ,UAAU,CAAC,IAAI,EAAEI,aAAa,6FAA6F,CAAC;QAChI,IAAIlB,uBAAuB;YACvB,MAAM,EAAEmB,GAAG,EAAEC,OAAO,EAAE,GAAGpB;YACzB,MAAMqB,4BAA4BC,aAAa,CAAC,CAAC,EAAEH,IAAI,EAAE,CAAC,CAAC,EAAEC,QAAQ,EAAE,CAAC,SAAS,CAAC;YAClFN,WAAW,CAAC,iEAAiE,EAAEO,0BAA0B,CAAC,CAAC;QAC/G;QAEA,MAAM,IAAIL,MAAOF,SAAS,0BAA0B;YAAEI;QAAa;IACvE;IAEA,MAAM,iBAAgC;QAClC,MAAM,IAAI,CAAC,WAAW,CAAC;IAC3B;IAEA,MAAM,iBAAgC;QAClC,MAAM,IAAI,CAAC,WAAW,CAAC;IAC3B;IAEA,MAAM,mBAAkC;QACpC,MAAM,IAAI,CAAC,aAAa,CAAC;IAC7B;IAEA,MAAM,mBAAkC;QACpC,MAAM,IAAI,CAAC,aAAa,CAAC;IAC7B;IAEA,QAAQ;QACJ,OAAO,IAAI,CAAC,aAAa;IAC7B;AACJ"}
|
|
1
|
+
{"version":3,"file":"features/wcp/WcpContext/WcpContext.js","sources":["../../../../src/features/wcp/WcpContext/WcpContext.ts"],"sourcesContent":["import type { WCP_FEATURE_LABEL } from \"@webiny/wcp\";\nimport { getWcpApiUrl, getWcpAppUrl, getWcpProjectEnvironment } from \"@webiny/wcp\";\nimport WError from \"@webiny/error\";\nimport type {\n DecryptedWcpProjectLicense,\n ILicense,\n WcpProjectEnvironment,\n WcpProject\n} from \"@webiny/wcp/types.js\";\nimport { WcpContext } from \"./abstractions.js\";\nimport { wcpFetch } from \"./utils.js\";\nimport type { WcpLicenseProvider } from \"../WcpLicenseProvider.js\";\n\nconst wcpProjectEnvironment = getWcpProjectEnvironment();\n\nexport class WcpContextImpl implements WcpContext.Interface {\n constructor(private licenseProvider: WcpLicenseProvider.Interface) {}\n\n private get license(): ILicense {\n return this.licenseProvider.get();\n }\n\n private getWcpProjectUrl(path = \"\"): string | null {\n if (!wcpProjectEnvironment) {\n return null;\n }\n\n const orgId = wcpProjectEnvironment.org.id;\n const projectId = wcpProjectEnvironment.project.id;\n const url = [\"/orgs\", orgId, \"projects\", projectId, path].filter(Boolean).join(\"/\");\n return getWcpApiUrl(url);\n }\n\n private async updateSeats(operation: \"increment\" | \"decrement\"): Promise<void> {\n if (!wcpProjectEnvironment) {\n return;\n }\n\n const updateSeatsUrl = this.getWcpProjectUrl(\"package/seats\");\n\n const response = await wcpFetch({\n url: updateSeatsUrl!,\n authorization: wcpProjectEnvironment.apiKey,\n body: { operation },\n meta: {\n action: operation + \"Seats\"\n }\n });\n\n if (response.error) {\n const message = response.message || `Failed to ${operation} user seats.`;\n console.error(message, response.status, response.statusText);\n throw new WError(message, \"WCP_CANNOT_UPDATE_USER_TENANTS\");\n }\n }\n\n private async updateTenants(operation: \"increment\" | \"decrement\"): Promise<void> {\n if (!wcpProjectEnvironment) {\n return;\n }\n\n const updateTenantsUrl = this.getWcpProjectUrl(\"package/tenants\");\n\n const response = await wcpFetch({\n url: updateTenantsUrl!,\n authorization: wcpProjectEnvironment.apiKey,\n body: { operation },\n meta: {\n action: operation + \"Tenants\"\n }\n });\n\n if (response.error) {\n const message = response.message || `Failed to ${operation} tenants.`;\n console.error(message, response.status, response.statusText);\n throw new WError(message, \"WCP_CANNOT_UPDATE_USER_TENANTS\");\n }\n }\n\n getRawLicense(): DecryptedWcpProjectLicense | null {\n return this.license.getRawLicense();\n }\n\n getProject(): WcpProject | null {\n return this.license.getProject();\n }\n\n getProjectWithFeatureFlags(): WcpProject | null {\n return this.getProject();\n }\n\n getProjectEnvironment(): WcpProjectEnvironment | null {\n return wcpProjectEnvironment;\n }\n\n getProjectLicense(): ILicense {\n return this.license;\n }\n\n canUseFeature(wcpFeatureId: keyof typeof WCP_FEATURE_LABEL): boolean {\n return this.license.canUseFeature(wcpFeatureId);\n }\n\n canUseAacl(): boolean {\n return this.license.canUseAacl();\n }\n\n canUseTeams(): boolean {\n return this.license.canUseTeams();\n }\n\n canUseFolderLevelPermissions(): boolean {\n return this.license.canUseFolderLevelPermissions();\n }\n\n canUsePrivateFiles(): boolean {\n return this.license.canUsePrivateFiles();\n }\n\n canUseAuditLogs(): boolean {\n return this.license.canUseAuditLogs();\n }\n\n canUseRecordLocking(): boolean {\n return this.license.canUseRecordLocking();\n }\n\n canUseFileManagerThreatDetection(): boolean {\n return this.license.canUseFileManagerThreatDetection();\n }\n\n canUseWorkflows(): boolean {\n return this.license.canUseWorkflows();\n }\n\n canUseHcmsFieldPermissions(): boolean {\n return this.license.canUseHcmsFieldPermissions();\n }\n\n canUseAiImageEnrichment(): boolean {\n return this.license.canUseAiImageEnrichment();\n }\n\n canUseAiPageGeneration(): boolean {\n return this.license.canUseAiPageGeneration();\n }\n\n canUseAiPageTranslation(): boolean {\n return this.license.canUseAiPageTranslation();\n }\n\n canUseAiLexicalGeneration(): boolean {\n return this.license.canUseAiLexicalGeneration();\n }\n\n canUseAiAdminAssistant(): boolean {\n return this.license.canUseAiAdminAssistant();\n }\n\n canUseAiEntryGeneration(): boolean {\n return this.license.canUseAiEntryGeneration();\n }\n\n canUseAiEntryComparison(): boolean {\n return this.license.canUseAiEntryComparison();\n }\n\n canUseAiEntryTranslation(): boolean {\n return this.license.canUseAiEntryTranslation();\n }\n\n canUseAiPowerups(): boolean {\n return this.license.canUseAiPowerups();\n }\n\n canUseAbTesting(): boolean {\n return this.license.canUseAbTesting();\n }\n\n canUseRemoteComponents(): boolean {\n return this.license.canUseRemoteComponents();\n }\n\n canUseCollaboration(): boolean {\n return this.license.canUseCollaboration();\n }\n\n canUseComments(): boolean {\n return this.license.canUseComments();\n }\n\n canUseActivityLog(): boolean {\n return this.license.canUseActivityLog();\n }\n\n canUseLanguages(): boolean {\n return this.license.canUseLanguages();\n }\n\n ensureCanUseFeature(wcpFeatureId: keyof typeof WCP_FEATURE_LABEL): void {\n if (this.license.canUseFeature(wcpFeatureId)) {\n return;\n }\n\n let message = `The ${wcpFeatureId} Webiny Control Panel feature cannot be used because your project license does not permit it.`;\n if (wcpProjectEnvironment) {\n const { org, project } = wcpProjectEnvironment;\n const upgradeProjectLicenseLink = getWcpAppUrl(`/${org.id}/${project.id}/settings`);\n message += ` To upgrade your project license, please use the following link: ${upgradeProjectLicenseLink}.`;\n }\n\n throw new WError(message, \"WCP_CANNOT_USE_FEATURE\", { wcpFeatureId });\n }\n\n async incrementSeats(): Promise<void> {\n await this.updateSeats(\"increment\");\n }\n\n async decrementSeats(): Promise<void> {\n await this.updateSeats(\"decrement\");\n }\n\n async incrementTenants(): Promise<void> {\n await this.updateTenants(\"increment\");\n }\n\n async decrementTenants(): Promise<void> {\n await this.updateTenants(\"decrement\");\n }\n\n toDto() {\n return this.getRawLicense();\n }\n}\n"],"names":["wcpProjectEnvironment","getWcpProjectEnvironment","WcpContextImpl","licenseProvider","path","orgId","projectId","url","Boolean","getWcpApiUrl","operation","updateSeatsUrl","response","wcpFetch","message","console","WError","updateTenantsUrl","wcpFeatureId","org","project","upgradeProjectLicenseLink","getWcpAppUrl"],"mappings":";;;AAaA,MAAMA,wBAAwBC;AAEvB,MAAMC;IACT,YAAoBC,eAA6C,CAAE;aAA/CA,eAAe,GAAfA;IAAgD;IAEpE,IAAY,UAAoB;QAC5B,OAAO,IAAI,CAAC,eAAe,CAAC,GAAG;IACnC;IAEQ,iBAAiBC,OAAO,EAAE,EAAiB;QAC/C,IAAI,CAACJ,uBACD,OAAO;QAGX,MAAMK,QAAQL,sBAAsB,GAAG,CAAC,EAAE;QAC1C,MAAMM,YAAYN,sBAAsB,OAAO,CAAC,EAAE;QAClD,MAAMO,MAAM;YAAC;YAASF;YAAO;YAAYC;YAAWF;SAAK,CAAC,MAAM,CAACI,SAAS,IAAI,CAAC;QAC/E,OAAOC,aAAaF;IACxB;IAEA,MAAc,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type { WcpProject } from "@webiny/wcp/types.js";
|
|
2
3
|
import { WcpContext } from "../abstractions.js";
|
|
3
4
|
import { FeatureFlags } from "../../../featureFlags/abstractions.js";
|
|
4
5
|
declare class WcpContextWithFeatureFlagsDecoratorImpl implements WcpContext.Interface {
|
|
@@ -6,72 +7,8 @@ declare class WcpContextWithFeatureFlagsDecoratorImpl implements WcpContext.Inte
|
|
|
6
7
|
private decoratee;
|
|
7
8
|
constructor(featureFlags: FeatureFlags.Interface, decoratee: WcpContext.Interface);
|
|
8
9
|
getRawLicense(): import("@webiny/wcp/types.js").DecryptedWcpProjectLicense | null;
|
|
9
|
-
getProject():
|
|
10
|
-
getProjectWithFeatureFlags():
|
|
11
|
-
orgId: string;
|
|
12
|
-
projectId: string;
|
|
13
|
-
package: {
|
|
14
|
-
features: {
|
|
15
|
-
seats: {
|
|
16
|
-
enabled: true;
|
|
17
|
-
options: {
|
|
18
|
-
maxCount: number;
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
|
-
multiTenancy: {
|
|
22
|
-
enabled: true;
|
|
23
|
-
options: {
|
|
24
|
-
maxCount: {
|
|
25
|
-
type: import("@webiny/wcp/types.js").MT_OPTIONS_MAX_COUNT_TYPE;
|
|
26
|
-
count?: number;
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
|
-
advancedPublishingWorkflow: {
|
|
31
|
-
enabled: boolean;
|
|
32
|
-
};
|
|
33
|
-
advancedAccessControlLayer: {
|
|
34
|
-
enabled: boolean;
|
|
35
|
-
options: {
|
|
36
|
-
teams: boolean;
|
|
37
|
-
privateFiles: boolean;
|
|
38
|
-
folderLevelPermissions: boolean;
|
|
39
|
-
hcmsFieldPermissions: boolean;
|
|
40
|
-
};
|
|
41
|
-
};
|
|
42
|
-
auditLogs: {
|
|
43
|
-
enabled: boolean;
|
|
44
|
-
};
|
|
45
|
-
recordLocking: {
|
|
46
|
-
enabled: boolean;
|
|
47
|
-
};
|
|
48
|
-
fileManager: {
|
|
49
|
-
enabled: boolean;
|
|
50
|
-
options: {
|
|
51
|
-
threatDetection: boolean;
|
|
52
|
-
};
|
|
53
|
-
};
|
|
54
|
-
aiPowerups: {
|
|
55
|
-
enabled: boolean;
|
|
56
|
-
options: {
|
|
57
|
-
websiteBuilder: {
|
|
58
|
-
pageGeneration: boolean | undefined;
|
|
59
|
-
pageTranslation: boolean | undefined;
|
|
60
|
-
};
|
|
61
|
-
fileManager: {
|
|
62
|
-
imageEnrichment: boolean | undefined;
|
|
63
|
-
};
|
|
64
|
-
lexicalGeneration: boolean | undefined;
|
|
65
|
-
cms: {
|
|
66
|
-
entryGeneration: boolean | undefined;
|
|
67
|
-
entryComparison: boolean | undefined;
|
|
68
|
-
entryTranslation: boolean | undefined;
|
|
69
|
-
};
|
|
70
|
-
};
|
|
71
|
-
};
|
|
72
|
-
};
|
|
73
|
-
};
|
|
74
|
-
} | null;
|
|
10
|
+
getProject(): WcpProject | null;
|
|
11
|
+
getProjectWithFeatureFlags(): WcpProject | null;
|
|
75
12
|
getProjectEnvironment(): import("@webiny/wcp/types.js").WcpProjectEnvironment | null;
|
|
76
13
|
getProjectLicense(): import("@webiny/wcp/types.js").ILicense;
|
|
77
14
|
canUseFeature(wcpFeatureId: keyof typeof WCP_FEATURE_LABEL): boolean;
|
|
@@ -88,9 +25,17 @@ declare class WcpContextWithFeatureFlagsDecoratorImpl implements WcpContext.Inte
|
|
|
88
25
|
canUseAiPageGeneration(): boolean;
|
|
89
26
|
canUseAiPageTranslation(): boolean;
|
|
90
27
|
canUseAiLexicalGeneration(): boolean;
|
|
28
|
+
canUseAiAdminAssistant(): boolean;
|
|
91
29
|
canUseAiEntryGeneration(): boolean;
|
|
92
30
|
canUseAiEntryComparison(): boolean;
|
|
93
31
|
canUseAiEntryTranslation(): boolean;
|
|
32
|
+
canUseAiPowerups(): boolean;
|
|
33
|
+
canUseAbTesting(): boolean;
|
|
34
|
+
canUseRemoteComponents(): boolean;
|
|
35
|
+
canUseCollaboration(): boolean;
|
|
36
|
+
canUseComments(): boolean;
|
|
37
|
+
canUseActivityLog(): boolean;
|
|
38
|
+
canUseLanguages(): boolean;
|
|
94
39
|
ensureCanUseFeature(featureId: keyof typeof WCP_FEATURE_LABEL): void;
|
|
95
40
|
incrementSeats(): Promise<void>;
|
|
96
41
|
decrementSeats(): Promise<void>;
|
|
@@ -24,51 +24,65 @@ class WcpContextWithFeatureFlagsDecoratorImpl {
|
|
|
24
24
|
multiTenancy: project.package.features.multiTenancy,
|
|
25
25
|
advancedPublishingWorkflow: {
|
|
26
26
|
...project.package.features.advancedPublishingWorkflow,
|
|
27
|
-
enabled: flags.
|
|
27
|
+
enabled: flags.isEnabled("advancedPublishingWorkflow") ? project.package.features.advancedPublishingWorkflow.enabled : false
|
|
28
28
|
},
|
|
29
29
|
advancedAccessControlLayer: {
|
|
30
30
|
...project.package.features.advancedAccessControlLayer,
|
|
31
|
-
enabled: flags.
|
|
31
|
+
enabled: flags.isEnabled("advancedAccessControlLayer") ? project.package.features.advancedAccessControlLayer.enabled : false,
|
|
32
32
|
options: {
|
|
33
|
-
teams: flags.
|
|
34
|
-
privateFiles: flags.
|
|
35
|
-
folderLevelPermissions: flags.
|
|
36
|
-
hcmsFieldPermissions: flags.
|
|
33
|
+
teams: flags.isEnabled("advancedAccessControlLayer.teams") ? project.package.features.advancedAccessControlLayer.options.teams : false,
|
|
34
|
+
privateFiles: flags.isEnabled("advancedAccessControlLayer.privateFiles") ? project.package.features.advancedAccessControlLayer.options.privateFiles : false,
|
|
35
|
+
folderLevelPermissions: flags.isEnabled("advancedAccessControlLayer.folderLevelPermissions") ? project.package.features.advancedAccessControlLayer.options.folderLevelPermissions : false,
|
|
36
|
+
hcmsFieldPermissions: flags.isEnabled("advancedAccessControlLayer.hcmsFieldPermissions") ? project.package.features.advancedAccessControlLayer.options.hcmsFieldPermissions : false
|
|
37
37
|
}
|
|
38
38
|
},
|
|
39
39
|
auditLogs: {
|
|
40
40
|
...project.package.features.auditLogs,
|
|
41
|
-
enabled: flags.
|
|
41
|
+
enabled: flags.isEnabled("auditLogs") ? project.package.features.auditLogs.enabled : false
|
|
42
42
|
},
|
|
43
43
|
recordLocking: {
|
|
44
44
|
...project.package.features.recordLocking,
|
|
45
|
-
enabled: flags.
|
|
45
|
+
enabled: flags.isEnabled("recordLocking") ? project.package.features.recordLocking.enabled : false
|
|
46
46
|
},
|
|
47
47
|
fileManager: {
|
|
48
48
|
...project.package.features.fileManager,
|
|
49
49
|
enabled: project.package.features.fileManager.enabled,
|
|
50
50
|
options: {
|
|
51
|
-
threatDetection: flags.
|
|
51
|
+
threatDetection: flags.isEnabled("fileManager.threatDetection") ? project.package.features.fileManager.options.threatDetection : false
|
|
52
52
|
}
|
|
53
53
|
},
|
|
54
54
|
aiPowerups: {
|
|
55
55
|
...project.package.features.aiPowerups,
|
|
56
|
-
enabled: flags.
|
|
56
|
+
enabled: flags.isEnabled("aiPowerups") ? project.package.features.aiPowerups?.enabled : false,
|
|
57
57
|
options: {
|
|
58
58
|
websiteBuilder: {
|
|
59
|
-
pageGeneration: flags.
|
|
60
|
-
pageTranslation: flags.
|
|
59
|
+
pageGeneration: flags.isEnabled("aiPowerups.websiteBuilder.pageGeneration") ? project.package.features.aiPowerups?.options?.websiteBuilder?.pageGeneration : false,
|
|
60
|
+
pageTranslation: flags.isEnabled("aiPowerups.websiteBuilder.pageTranslation") ? project.package.features.aiPowerups?.options?.websiteBuilder?.pageTranslation : false
|
|
61
61
|
},
|
|
62
62
|
fileManager: {
|
|
63
|
-
imageEnrichment: flags.
|
|
63
|
+
imageEnrichment: flags.isEnabled("aiPowerups.fileManager.imageEnrichment") ? project.package.features.aiPowerups?.options?.fileManager?.imageEnrichment : false
|
|
64
64
|
},
|
|
65
|
-
lexicalGeneration: flags.
|
|
65
|
+
lexicalGeneration: flags.isEnabled("aiPowerups.lexicalGeneration") ? project.package.features.aiPowerups?.options?.lexicalGeneration : false,
|
|
66
|
+
adminAssistant: flags.isEnabled("aiPowerups.adminAssistant") ? project.package.features.aiPowerups?.options?.adminAssistant : false,
|
|
67
|
+
remoteComponents: flags.isEnabled("aiPowerups.remoteComponents") ? project.package.features.aiPowerups?.options?.remoteComponents : false,
|
|
66
68
|
cms: {
|
|
67
|
-
entryGeneration: flags.
|
|
68
|
-
entryComparison: flags.
|
|
69
|
-
entryTranslation: flags.
|
|
69
|
+
entryGeneration: flags.isEnabled("aiPowerups.cms.entryGeneration") ? project.package.features.aiPowerups?.options?.cms?.entryGeneration : false,
|
|
70
|
+
entryComparison: flags.isEnabled("aiPowerups.cms.entryComparison") ? project.package.features.aiPowerups?.options?.cms?.entryComparison : false,
|
|
71
|
+
entryTranslation: flags.isEnabled("aiPowerups.cms.entryTranslation") ? project.package.features.aiPowerups?.options?.cms?.entryTranslation : false
|
|
70
72
|
}
|
|
71
73
|
}
|
|
74
|
+
},
|
|
75
|
+
abTesting: {
|
|
76
|
+
...project.package.features.abTesting,
|
|
77
|
+
enabled: flags.isEnabled("abTesting") ? project.package.features.abTesting?.enabled : false
|
|
78
|
+
},
|
|
79
|
+
collaboration: {
|
|
80
|
+
...project.package.features.collaboration,
|
|
81
|
+
enabled: flags.isEnabled("collaboration") ? project.package.features.collaboration?.enabled : false,
|
|
82
|
+
options: {
|
|
83
|
+
comments: flags.isEnabled("collaboration.comments") ? project.package.features.collaboration?.options?.comments : false,
|
|
84
|
+
activityLog: flags.isEnabled("collaboration.activityLog") ? project.package.features.collaboration?.options?.activityLog : false
|
|
85
|
+
}
|
|
72
86
|
}
|
|
73
87
|
}
|
|
74
88
|
}
|
|
@@ -84,52 +98,76 @@ class WcpContextWithFeatureFlagsDecoratorImpl {
|
|
|
84
98
|
return this.decoratee.canUseFeature(wcpFeatureId);
|
|
85
99
|
}
|
|
86
100
|
canUseAacl() {
|
|
87
|
-
return this.decoratee.canUseAacl() && this.featureFlags.get().
|
|
101
|
+
return this.decoratee.canUseAacl() && this.featureFlags.get().isEnabled("advancedAccessControlLayer");
|
|
88
102
|
}
|
|
89
103
|
canUseTeams() {
|
|
90
|
-
return this.decoratee.canUseTeams() && this.featureFlags.get().
|
|
104
|
+
return this.decoratee.canUseTeams() && this.featureFlags.get().isEnabled("advancedAccessControlLayer.teams");
|
|
91
105
|
}
|
|
92
106
|
canUseFolderLevelPermissions() {
|
|
93
|
-
return this.decoratee.canUseFolderLevelPermissions() && this.featureFlags.get().
|
|
107
|
+
return this.decoratee.canUseFolderLevelPermissions() && this.featureFlags.get().isEnabled("advancedAccessControlLayer.folderLevelPermissions");
|
|
94
108
|
}
|
|
95
109
|
canUsePrivateFiles() {
|
|
96
|
-
return this.decoratee.canUsePrivateFiles() && this.featureFlags.get().
|
|
110
|
+
return this.decoratee.canUsePrivateFiles() && this.featureFlags.get().isEnabled("advancedAccessControlLayer.privateFiles");
|
|
97
111
|
}
|
|
98
112
|
canUseAuditLogs() {
|
|
99
|
-
return this.decoratee.canUseAuditLogs() && this.featureFlags.get().
|
|
113
|
+
return this.decoratee.canUseAuditLogs() && this.featureFlags.get().isEnabled("auditLogs");
|
|
100
114
|
}
|
|
101
115
|
canUseRecordLocking() {
|
|
102
|
-
return this.decoratee.canUseRecordLocking() && this.featureFlags.get().
|
|
116
|
+
return this.decoratee.canUseRecordLocking() && this.featureFlags.get().isEnabled("recordLocking");
|
|
103
117
|
}
|
|
104
118
|
canUseFileManagerThreatDetection() {
|
|
105
|
-
return this.decoratee.canUseFileManagerThreatDetection() && this.featureFlags.get().
|
|
119
|
+
return this.decoratee.canUseFileManagerThreatDetection() && this.featureFlags.get().isEnabled("fileManager.threatDetection");
|
|
106
120
|
}
|
|
107
121
|
canUseWorkflows() {
|
|
108
|
-
return this.decoratee.canUseWorkflows() && this.featureFlags.get().
|
|
122
|
+
return this.decoratee.canUseWorkflows() && this.featureFlags.get().isEnabled("advancedPublishingWorkflow");
|
|
109
123
|
}
|
|
110
124
|
canUseHcmsFieldPermissions() {
|
|
111
|
-
return this.decoratee.canUseHcmsFieldPermissions() && this.featureFlags.get().
|
|
125
|
+
return this.decoratee.canUseHcmsFieldPermissions() && this.featureFlags.get().isEnabled("advancedAccessControlLayer.hcmsFieldPermissions");
|
|
112
126
|
}
|
|
113
127
|
canUseAiImageEnrichment() {
|
|
114
|
-
return this.decoratee.canUseAiImageEnrichment() && this.featureFlags.get().
|
|
128
|
+
return this.decoratee.canUseAiImageEnrichment() && this.featureFlags.get().isEnabled("aiPowerups.fileManager.imageEnrichment");
|
|
115
129
|
}
|
|
116
130
|
canUseAiPageGeneration() {
|
|
117
|
-
return this.decoratee.canUseAiPageGeneration() && this.featureFlags.get().
|
|
131
|
+
return this.decoratee.canUseAiPageGeneration() && this.featureFlags.get().isEnabled("aiPowerups.websiteBuilder.pageGeneration");
|
|
118
132
|
}
|
|
119
133
|
canUseAiPageTranslation() {
|
|
120
|
-
return this.decoratee.canUseAiPageTranslation() && this.featureFlags.get().
|
|
134
|
+
return this.decoratee.canUseAiPageTranslation() && this.featureFlags.get().isEnabled("aiPowerups.websiteBuilder.pageTranslation");
|
|
121
135
|
}
|
|
122
136
|
canUseAiLexicalGeneration() {
|
|
123
|
-
return this.decoratee.canUseAiLexicalGeneration() && this.featureFlags.get().
|
|
137
|
+
return this.decoratee.canUseAiLexicalGeneration() && this.featureFlags.get().isEnabled("aiPowerups.lexicalGeneration");
|
|
138
|
+
}
|
|
139
|
+
canUseAiAdminAssistant() {
|
|
140
|
+
return this.decoratee.canUseAiAdminAssistant() && this.featureFlags.get().isEnabled("aiPowerups.adminAssistant");
|
|
124
141
|
}
|
|
125
142
|
canUseAiEntryGeneration() {
|
|
126
|
-
return this.decoratee.canUseAiEntryGeneration() && this.featureFlags.get().
|
|
143
|
+
return this.decoratee.canUseAiEntryGeneration() && this.featureFlags.get().isEnabled("aiPowerups.cms.entryGeneration");
|
|
127
144
|
}
|
|
128
145
|
canUseAiEntryComparison() {
|
|
129
|
-
return this.decoratee.canUseAiEntryComparison() && this.featureFlags.get().
|
|
146
|
+
return this.decoratee.canUseAiEntryComparison() && this.featureFlags.get().isEnabled("aiPowerups.cms.entryComparison");
|
|
130
147
|
}
|
|
131
148
|
canUseAiEntryTranslation() {
|
|
132
|
-
return this.decoratee.canUseAiEntryTranslation() && this.featureFlags.get().
|
|
149
|
+
return this.decoratee.canUseAiEntryTranslation() && this.featureFlags.get().isEnabled("aiPowerups.cms.entryTranslation");
|
|
150
|
+
}
|
|
151
|
+
canUseAiPowerups() {
|
|
152
|
+
return this.decoratee.canUseAiPowerups() && this.featureFlags.get().isEnabled("aiPowerups");
|
|
153
|
+
}
|
|
154
|
+
canUseAbTesting() {
|
|
155
|
+
return this.decoratee.canUseAbTesting() && this.featureFlags.get().isEnabled("abTesting");
|
|
156
|
+
}
|
|
157
|
+
canUseRemoteComponents() {
|
|
158
|
+
return this.decoratee.canUseRemoteComponents() && this.featureFlags.get().isEnabled("aiPowerups.remoteComponents");
|
|
159
|
+
}
|
|
160
|
+
canUseCollaboration() {
|
|
161
|
+
return this.decoratee.canUseCollaboration() && this.featureFlags.get().isEnabled("collaboration");
|
|
162
|
+
}
|
|
163
|
+
canUseComments() {
|
|
164
|
+
return this.decoratee.canUseComments() && this.featureFlags.get().isEnabled("collaboration.comments");
|
|
165
|
+
}
|
|
166
|
+
canUseActivityLog() {
|
|
167
|
+
return this.decoratee.canUseActivityLog() && this.featureFlags.get().isEnabled("collaboration.activityLog");
|
|
168
|
+
}
|
|
169
|
+
canUseLanguages() {
|
|
170
|
+
return this.decoratee.canUseLanguages() && this.featureFlags.get().isEnabled("languages");
|
|
133
171
|
}
|
|
134
172
|
ensureCanUseFeature(featureId) {
|
|
135
173
|
return this.decoratee.ensureCanUseFeature(featureId);
|