@webiny/api-core 6.4.11 → 6.6.0-alpha.1
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 +29 -5
- package/ApiCoreFeature.js.map +1 -1
- package/exports/api/security/api-key.d.ts +1 -0
- package/exports/api/security/api-key.js +1 -0
- package/exports/api.d.ts +3 -1
- package/exports/api.js +2 -1
- package/features/ai/Ai.d.ts +3 -3
- package/features/ai/Ai.js +60 -23
- package/features/ai/Ai.js.map +1 -1
- package/features/ai/AnthropicSdkFactory.js +12 -0
- package/features/ai/AnthropicSdkFactory.js.map +1 -1
- package/features/ai/OpenAiSdkFactory.js +16 -0
- package/features/ai/OpenAiSdkFactory.js.map +1 -1
- package/features/ai/TextExtractor/DefaultTextExtractor.d.ts +9 -0
- package/features/ai/TextExtractor/DefaultTextExtractor.js +28 -0
- package/features/ai/TextExtractor/DefaultTextExtractor.js.map +1 -0
- package/features/ai/TextExtractor/abstractions.d.ts +12 -0
- package/features/ai/TextExtractor/abstractions.js +5 -0
- package/features/ai/TextExtractor/abstractions.js.map +1 -0
- package/features/ai/TextExtractor/index.d.ts +3 -0
- package/features/ai/TextExtractor/index.js +2 -0
- package/features/ai/TextExtractor/parsers/docxParser.d.ts +1 -0
- package/features/ai/TextExtractor/parsers/docxParser.js +111 -0
- package/features/ai/TextExtractor/parsers/docxParser.js.map +1 -0
- package/features/ai/abstractions.d.ts +18 -7
- package/features/ai/abstractions.js +1 -2
- package/features/ai/abstractions.js.map +1 -1
- package/features/ai/events.d.ts +59 -0
- package/features/ai/events.js +41 -0
- package/features/ai/events.js.map +1 -0
- package/features/ai/feature.js +6 -2
- package/features/ai/feature.js.map +1 -1
- package/features/ai/index.d.ts +8 -2
- package/features/ai/index.js +4 -1
- package/features/ai/toolPipeline/AiOutputToolRegistry.d.ts +11 -0
- package/features/ai/toolPipeline/AiOutputToolRegistry.js +31 -0
- package/features/ai/toolPipeline/AiOutputToolRegistry.js.map +1 -0
- package/features/ai/toolPipeline/AiToolPipelineRunner.d.ts +10 -0
- package/features/ai/toolPipeline/AiToolPipelineRunner.js +36 -0
- package/features/ai/toolPipeline/AiToolPipelineRunner.js.map +1 -0
- package/features/ai/toolPipeline/abstractions.d.ts +23 -0
- package/features/ai/toolPipeline/abstractions.js +7 -0
- package/features/ai/toolPipeline/abstractions.js.map +1 -0
- package/features/ai/toolPipeline/index.d.ts +2 -0
- package/features/ai/toolPipeline/index.js +1 -0
- 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/featureFlags/decorators/FeatureFlagsWithLicenseDecorator.d.ts +13 -0
- package/features/featureFlags/decorators/FeatureFlagsWithLicenseDecorator.js +49 -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/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 +53 -0
- package/features/requestContext/abstractions.js +8 -0
- package/features/requestContext/abstractions.js.map +1 -0
- package/features/requestContext/feature.d.ts +11 -0
- package/features/requestContext/feature.js +17 -0
- package/features/requestContext/feature.js.map +1 -0
- package/features/requestContext/index.d.ts +2 -0
- package/features/requestContext/index.js +2 -0
- package/features/security/IdentityContext/IdentityContext.d.ts +3 -3
- package/features/security/IdentityContext/IdentityContext.js +6 -6
- package/features/security/IdentityContext/IdentityContext.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/GetApiKey/GetApiKeyUseCase.d.ts +1 -1
- package/features/security/apiKeys/GetApiKey/GetApiKeyUseCase.js.map +1 -1
- package/features/security/apiKeys/GetApiKeyBySlug/GetApiKeyBySlugUseCase.d.ts +1 -3
- package/features/security/apiKeys/GetApiKeyBySlug/GetApiKeyBySlugUseCase.js.map +1 -1
- package/features/security/apiKeys/GetApiKeyBySlug/abstractions.d.ts +1 -1
- package/features/security/apiKeys/GetApiKeyBySlug/abstractions.js.map +1 -1
- package/features/security/apiKeys/GetApiKeyByToken/GetApiKeyByTokenUseCase.d.ts +1 -3
- package/features/security/apiKeys/GetApiKeyByToken/GetApiKeyByTokenUseCase.js.map +1 -1
- package/features/security/apiKeys/GetApiKeyByToken/abstractions.d.ts +1 -1
- package/features/security/apiKeys/GetApiKeyByToken/abstractions.js.map +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 +11 -2
- package/features/security/apiKeys/feature.js.map +1 -1
- package/features/security/apiKeys/shared/ApiKeyProvider.d.ts +3 -5
- package/features/security/apiKeys/shared/ApiKeyProvider.js +6 -21
- package/features/security/apiKeys/shared/ApiKeyProvider.js.map +1 -1
- package/features/security/apiKeys/shared/ApiKeysRepository.d.ts +1 -0
- package/features/security/apiKeys/shared/ApiKeysRepository.js +19 -4
- package/features/security/apiKeys/shared/ApiKeysRepository.js.map +1 -1
- package/features/security/apiKeys/shared/generateToken.d.ts +1 -1
- package/features/security/apiKeys/shared/generateToken.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/apiKeys/shared/types.d.ts +1 -1
- package/features/security/authorization/GroupsTeamsAuthorizer/GetPermissionsFromIdentity.d.ts +4 -4
- package/features/security/authorization/GroupsTeamsAuthorizer/GetPermissionsFromIdentity.js +5 -5
- package/features/security/authorization/GroupsTeamsAuthorizer/GetPermissionsFromIdentity.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/Installer/RolesInstaller.js +0 -1
- package/features/security/roles/Installer/RolesInstaller.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/security/utils/getPermissionsFromRoles.d.ts +1 -1
- package/features/serviceDiscovery/ServiceDiscovery.d.ts +17 -0
- package/features/serviceDiscovery/ServiceDiscovery.js +22 -0
- package/features/serviceDiscovery/ServiceDiscovery.js.map +1 -0
- package/features/serviceDiscovery/__tests__/ServiceDiscovery.test.d.ts +1 -0
- package/features/serviceDiscovery/__tests__/ServiceDiscovery.test.js +111 -0
- package/features/serviceDiscovery/__tests__/ServiceDiscovery.test.js.map +1 -0
- package/features/serviceDiscovery/index.d.ts +3 -0
- package/features/serviceDiscovery/index.js +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 +76 -4
- package/features/task/TaskDefinition/abstractions.js +2 -1
- package/features/task/TaskDefinition/abstractions.js.map +1 -1
- package/features/tenancy/CreateTenant/CreateTenantUseCase.d.ts +1 -1
- package/features/tenancy/InstallTenant/InstallTenantUseCase.d.ts +1 -1
- package/features/tenancy/UpdateTenant/UpdateTenantUseCase.d.ts +2 -2
- package/features/users/CreateUser/decorators/CreateUserWithWcpIncrement.d.ts +1 -1
- package/features/wcp/WcpContext/WcpContext.d.ts +10 -5
- package/features/wcp/WcpContext/WcpContext.js +23 -2
- package/features/wcp/WcpContext/WcpContext.js.map +1 -1
- package/features/wcp/WcpContext/decorators/WcpContextWithFeatureFlagsDecorator.d.ts +25 -7
- package/features/wcp/WcpContext/decorators/WcpContextWithFeatureFlagsDecorator.js +57 -25
- 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 +15 -0
- package/graphql/ApiCoreSchemaFactory.js +52 -0
- package/graphql/ApiCoreSchemaFactory.js.map +1 -0
- package/graphql/featureFlags/FeatureFlagsSchemaFactory.d.ts +9 -0
- package/graphql/featureFlags/FeatureFlagsSchemaFactory.js +49 -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 +14 -0
- package/graphql/security/SecuritySchemaFactory.js +23 -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 +9 -0
- package/graphql/system/SystemSchemaFactory.js +66 -0
- package/graphql/system/SystemSchemaFactory.js.map +1 -0
- package/graphql/users/UsersSchemaFactory.d.ts +9 -0
- package/graphql/users/UsersSchemaFactory.js +191 -0
- package/graphql/users/UsersSchemaFactory.js.map +1 -0
- package/graphql/wcp/WcpSchemaFactory.d.ts +9 -0
- package/graphql/wcp/{graphql.js → WcpSchemaFactory.js} +28 -18
- package/graphql/wcp/WcpSchemaFactory.js.map +1 -0
- package/index.d.ts +3 -1
- package/index.js +3 -1
- package/package.json +21 -24
- 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 +1 -7
- package/types/tenancy.d.ts +0 -17
- package/types/users.d.ts +0 -13
- package/createApiCore.d.ts +0 -7
- package/createApiCore.js +0 -22
- package/createApiCore.js.map +0 -1
- package/features/ai/AiModelRegistry.d.ts +0 -12
- package/features/ai/AiModelRegistry.js +0 -28
- package/features/ai/AiModelRegistry.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 -33
- package/legacy/wcp/LegacyWcpContext.js +0 -84
- 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,21 @@
|
|
|
1
|
+
import type { Container } from "@webiny/di";
|
|
2
|
+
import type { ApiCoreStorageOperations } from "../../types/core.js";
|
|
3
|
+
/**
|
|
4
|
+
* Builds the api-core storage operations. Resolved + built synchronously inside
|
|
5
|
+
* ApiCoreFeature.register, so storage is wired the same way for every event — there is no
|
|
6
|
+
* out-of-feature construction or per-request async initializer. The concrete implementation is
|
|
7
|
+
* provided by a storage adapter (ApiCoreDdbFeature / ApiCoreSqlFeature) or, in tests, by
|
|
8
|
+
* registerApiCoreStorageOperations.
|
|
9
|
+
*/
|
|
10
|
+
export interface IApiCoreStorageOperationsFactory {
|
|
11
|
+
create(): ApiCoreStorageOperations;
|
|
12
|
+
}
|
|
13
|
+
export declare const ApiCoreStorageOperationsFactory: import("@webiny/di").Abstraction<IApiCoreStorageOperationsFactory>;
|
|
14
|
+
export declare namespace ApiCoreStorageOperationsFactory {
|
|
15
|
+
type Interface = IApiCoreStorageOperationsFactory;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Register pre-built storage operations as the factory. Used by tests (and anywhere the ops are
|
|
19
|
+
* already constructed) so ApiCoreFeature.register can resolve them like any adapter-provided factory.
|
|
20
|
+
*/
|
|
21
|
+
export declare const registerApiCoreStorageOperations: (container: Container, storageOperations: ApiCoreStorageOperations) => void;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createAbstraction } from "@webiny/feature/api";
|
|
2
|
+
const ApiCoreStorageOperationsFactory = createAbstraction("ApiCoreStorageOperationsFactory");
|
|
3
|
+
const registerApiCoreStorageOperations = (container, storageOperations)=>{
|
|
4
|
+
container.registerInstance(ApiCoreStorageOperationsFactory, {
|
|
5
|
+
create: ()=>storageOperations
|
|
6
|
+
});
|
|
7
|
+
};
|
|
8
|
+
export { ApiCoreStorageOperationsFactory, registerApiCoreStorageOperations };
|
|
9
|
+
|
|
10
|
+
//# sourceMappingURL=abstractions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/storageOperations/abstractions.js","sources":["../../../src/features/storageOperations/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { Container } from \"@webiny/di\";\nimport type { ApiCoreStorageOperations } from \"~/types/core.js\";\n\n/**\n * Builds the api-core storage operations. Resolved + built synchronously inside\n * ApiCoreFeature.register, so storage is wired the same way for every event — there is no\n * out-of-feature construction or per-request async initializer. The concrete implementation is\n * provided by a storage adapter (ApiCoreDdbFeature / ApiCoreSqlFeature) or, in tests, by\n * registerApiCoreStorageOperations.\n */\nexport interface IApiCoreStorageOperationsFactory {\n create(): ApiCoreStorageOperations;\n}\n\nexport const ApiCoreStorageOperationsFactory = createAbstraction<IApiCoreStorageOperationsFactory>(\n \"ApiCoreStorageOperationsFactory\"\n);\n\nexport namespace ApiCoreStorageOperationsFactory {\n export type Interface = IApiCoreStorageOperationsFactory;\n}\n\n/**\n * Register pre-built storage operations as the factory. Used by tests (and anywhere the ops are\n * already constructed) so ApiCoreFeature.register can resolve them like any adapter-provided factory.\n */\nexport const registerApiCoreStorageOperations = (\n container: Container,\n storageOperations: ApiCoreStorageOperations\n): void => {\n container.registerInstance(ApiCoreStorageOperationsFactory, {\n create: () => storageOperations\n });\n};\n"],"names":["ApiCoreStorageOperationsFactory","createAbstraction","registerApiCoreStorageOperations","container","storageOperations"],"mappings":";AAeO,MAAMA,kCAAkCC,kBAC3C;AAWG,MAAMC,mCAAmC,CAC5CC,WACAC;IAEAD,UAAU,gBAAgB,CAACH,iCAAiC;QACxD,QAAQ,IAAMI;IAClB;AACJ"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Slugify } from "../../features/slugify/abstractions.js";
|
|
2
|
+
import { StringFormatter } from "./abstractions.js";
|
|
3
|
+
/**
|
|
4
|
+
* The string formatter is the consumer-facing API for string transforms. It keeps each transform's
|
|
5
|
+
* logic in its own fine-grained, decoratable feature (e.g. `Slugify`) and just delegates to it, so a
|
|
6
|
+
* project can change one transform without reimplementing the whole formatter. More methods will be
|
|
7
|
+
* added here over time.
|
|
8
|
+
*/
|
|
9
|
+
declare class DefaultStringFormatterImpl implements StringFormatter.Interface {
|
|
10
|
+
private readonly slugifier;
|
|
11
|
+
constructor(slugifier: Slugify.Interface);
|
|
12
|
+
slugify(value: string): string;
|
|
13
|
+
}
|
|
14
|
+
export declare const DefaultStringFormatter: typeof DefaultStringFormatterImpl & {
|
|
15
|
+
__abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").IStringFormatter>;
|
|
16
|
+
};
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Slugify } from "../slugify/abstractions.js";
|
|
2
|
+
import { StringFormatter } from "./abstractions.js";
|
|
3
|
+
class DefaultStringFormatterImpl {
|
|
4
|
+
constructor(slugifier){
|
|
5
|
+
this.slugifier = slugifier;
|
|
6
|
+
}
|
|
7
|
+
slugify(value) {
|
|
8
|
+
return this.slugifier.execute(value);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
const DefaultStringFormatter = StringFormatter.createImplementation({
|
|
12
|
+
implementation: DefaultStringFormatterImpl,
|
|
13
|
+
dependencies: [
|
|
14
|
+
Slugify
|
|
15
|
+
]
|
|
16
|
+
});
|
|
17
|
+
export { DefaultStringFormatter };
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=DefaultStringFormatter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/stringFormatter/DefaultStringFormatter.js","sources":["../../../src/features/stringFormatter/DefaultStringFormatter.ts"],"sourcesContent":["import { Slugify } from \"~/features/slugify/abstractions.js\";\nimport { StringFormatter } from \"./abstractions.js\";\n\n/**\n * The string formatter is the consumer-facing API for string transforms. It keeps each transform's\n * logic in its own fine-grained, decoratable feature (e.g. `Slugify`) and just delegates to it, so a\n * project can change one transform without reimplementing the whole formatter. More methods will be\n * added here over time.\n */\nclass DefaultStringFormatterImpl implements StringFormatter.Interface {\n constructor(private readonly slugifier: Slugify.Interface) {}\n\n slugify(value: string): string {\n return this.slugifier.execute(value);\n }\n}\n\nexport const DefaultStringFormatter = StringFormatter.createImplementation({\n implementation: DefaultStringFormatterImpl,\n dependencies: [Slugify]\n});\n"],"names":["DefaultStringFormatterImpl","slugifier","value","DefaultStringFormatter","StringFormatter","Slugify"],"mappings":";;AASA,MAAMA;IACF,YAA6BC,SAA4B,CAAE;aAA9BA,SAAS,GAATA;IAA+B;IAE5D,QAAQC,KAAa,EAAU;QAC3B,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAACA;IAClC;AACJ;AAEO,MAAMC,yBAAyBC,gBAAgB,oBAAoB,CAAC;IACvE,gBAAgBJ;IAChB,cAAc;QAACK;KAAQ;AAC3B"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface IStringFormatter {
|
|
2
|
+
/**
|
|
3
|
+
* Turns a value into a URL-friendly slug. Delegates to the `Slugify` feature, so to change slug
|
|
4
|
+
* logic decorate `Slugify` alone rather than the whole string formatter.
|
|
5
|
+
*/
|
|
6
|
+
slugify(value: string): string;
|
|
7
|
+
}
|
|
8
|
+
export declare const StringFormatter: import("@webiny/di").Abstraction<IStringFormatter>;
|
|
9
|
+
export declare namespace StringFormatter {
|
|
10
|
+
type Interface = IStringFormatter;
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/stringFormatter/abstractions.js","sources":["../../../src/features/stringFormatter/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\n\nexport interface IStringFormatter {\n /**\n * Turns a value into a URL-friendly slug. Delegates to the `Slugify` feature, so to change slug\n * logic decorate `Slugify` alone rather than the whole string formatter.\n */\n slugify(value: string): string;\n}\n\nexport const StringFormatter = createAbstraction<IStringFormatter>(\"StringFormatter\");\n\nexport namespace StringFormatter {\n export type Interface = IStringFormatter;\n}\n"],"names":["StringFormatter","createAbstraction"],"mappings":";AAUO,MAAMA,kBAAkBC,kBAAoC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createFeature } from "@webiny/feature/api";
|
|
2
|
+
import { SlugifyFeature } from "../slugify/feature.js";
|
|
3
|
+
import { DefaultStringFormatter } from "./DefaultStringFormatter.js";
|
|
4
|
+
const StringFormatterFeature = createFeature({
|
|
5
|
+
name: "StringFormatterFeature",
|
|
6
|
+
register (container) {
|
|
7
|
+
SlugifyFeature.register(container);
|
|
8
|
+
container.register(DefaultStringFormatter);
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
export { StringFormatterFeature };
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=feature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/stringFormatter/feature.js","sources":["../../../src/features/stringFormatter/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { SlugifyFeature } from \"~/features/slugify/feature.js\";\nimport { DefaultStringFormatter } from \"./DefaultStringFormatter.js\";\n\nexport const StringFormatterFeature = createFeature({\n name: \"StringFormatterFeature\",\n register(container) {\n // Register the transforms the formatter delegates to, then the formatter itself.\n SlugifyFeature.register(container);\n container.register(DefaultStringFormatter);\n }\n});\n"],"names":["StringFormatterFeature","createFeature","container","SlugifyFeature","DefaultStringFormatter"],"mappings":";;;AAIO,MAAMA,yBAAyBC,cAAc;IAChD,MAAM;IACN,UAASC,SAAS;QAEdC,eAAe,QAAQ,CAACD;QACxBA,UAAU,QAAQ,CAACE;IACvB;AACJ"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import zod from "zod";
|
|
2
|
+
import type { Constructor } from "@webiny/di";
|
|
2
3
|
import type { GenericRecord } from "@webiny/api/types";
|
|
3
4
|
import type { ITask } from "../../../features/task/TaskService/index.js";
|
|
4
5
|
import { TaskController } from "../../../features/task/TaskController/index.js";
|
|
@@ -14,12 +15,33 @@ export interface ITaskOutput {
|
|
|
14
15
|
[key: string]: any;
|
|
15
16
|
}
|
|
16
17
|
/**
|
|
17
|
-
*
|
|
18
|
+
* The task's own definition, minus its behaviour.
|
|
19
|
+
*
|
|
20
|
+
* Handed to `run()` and to every lifecycle hook so a decorator can tell which task it is wrapping
|
|
21
|
+
* and act on the definition's own fields. A decorator is registered against the abstraction, so it
|
|
22
|
+
* wraps every task; without this it has nothing to branch on but a hardcoded list of ids, which
|
|
23
|
+
* means editing the decorator every time a task is added.
|
|
24
|
+
*
|
|
25
|
+
* This is {@link ITaskMetadata}: identity and policy, no behaviour. The object passed at runtime is
|
|
26
|
+
* the resolved task, so `run` is physically present; naming the metadata type here stops the obvious
|
|
27
|
+
* mistake of a handler calling `params.definition.run(...)` and recursing forever.
|
|
28
|
+
*
|
|
29
|
+
* Only the fields declared here arrive. A field a project adds to its own definition class is
|
|
30
|
+
* currently dropped, because `RunnableTaskDecorator` and `SelfCleaningTaskDecorator` are fixed
|
|
31
|
+
* pass-throughs that expose a known set of getters and nothing else. Making them forward unknown
|
|
32
|
+
* properties would turn a definition into a place to declare policy (a rate limit, a set of tags)
|
|
33
|
+
* that a decorator acts on; `taskDefinitionInParams.test.ts` pins the current behaviour so that
|
|
34
|
+
* change announces itself.
|
|
35
|
+
*/
|
|
36
|
+
export type ITaskDefinitionInfo = ITaskMetadata;
|
|
37
|
+
/**
|
|
38
|
+
* Task run params - the input data, plus the definition being run
|
|
18
39
|
* All runtime dependencies come from TaskController (injected separately)
|
|
19
40
|
*/
|
|
20
41
|
export interface ITaskRunParams<I extends ITaskInput = ITaskInput, O extends ITaskOutput = ITaskOutput> {
|
|
21
42
|
input: I;
|
|
22
43
|
controller: TaskController.Interface<I, O>;
|
|
44
|
+
definition: ITaskDefinitionInfo;
|
|
23
45
|
}
|
|
24
46
|
/**
|
|
25
47
|
* Data for creating a new task
|
|
@@ -35,6 +57,7 @@ export interface ITaskCreateData<I = ITaskInput> {
|
|
|
35
57
|
*/
|
|
36
58
|
export interface ITaskBeforeTriggerParams<I = ITaskInput> {
|
|
37
59
|
data: ITaskCreateData<I>;
|
|
60
|
+
definition: ITaskDefinitionInfo;
|
|
38
61
|
}
|
|
39
62
|
/**
|
|
40
63
|
* Task result status enum
|
|
@@ -70,11 +93,16 @@ export type ISelfCleanupEvent = "onSuccess" | "onError" | "onAbort";
|
|
|
70
93
|
export type ISelfCleanup = "always" | "never" | ISelfCleanupEvent | ISelfCleanupEvent[];
|
|
71
94
|
export type ITaskLifecycleHook<I extends ITaskInput = ITaskInput, O extends ITaskOutput = ITaskOutput> = {
|
|
72
95
|
task: ITask<I, O>;
|
|
96
|
+
definition: ITaskDefinitionInfo;
|
|
73
97
|
};
|
|
74
98
|
/**
|
|
75
|
-
*
|
|
99
|
+
* What a task IS: identity and runtime policy, with no behaviour and no dependencies.
|
|
100
|
+
*
|
|
101
|
+
* Listing tasks, resolving one by id, and applying defaults all need only this. Keeping it free of
|
|
102
|
+
* dependencies is the whole point — `GetTaskDefinitionUseCase` builds every registered definition
|
|
103
|
+
* to find one by id, so anything expensive here is paid 24 times per lookup.
|
|
76
104
|
*/
|
|
77
|
-
export interface
|
|
105
|
+
export interface ITaskMetadata {
|
|
78
106
|
id: string;
|
|
79
107
|
title: string;
|
|
80
108
|
description?: string;
|
|
@@ -82,6 +110,16 @@ export interface ITaskDefinition<I extends ITaskInput = ITaskInput, O extends IT
|
|
|
82
110
|
databaseLogs?: boolean;
|
|
83
111
|
isPrivate?: boolean;
|
|
84
112
|
selfCleanup?: ISelfCleanup;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* What a task DOES. This is the half that carries dependencies (a CMS context, an OpenSearch
|
|
116
|
+
* client), so it is built only for the task actually being run.
|
|
117
|
+
*
|
|
118
|
+
* The lifecycle hooks live here rather than on {@link ITaskMetadata} because they need the same
|
|
119
|
+
* dependencies `run()` does — see `MockDataManagerTask`, whose `onError` and `onAbort` both use the
|
|
120
|
+
* OpenSearch client injected for `run()`.
|
|
121
|
+
*/
|
|
122
|
+
export interface ITaskHandler<I extends ITaskInput = ITaskInput, O extends ITaskOutput = ITaskOutput> {
|
|
85
123
|
/**
|
|
86
124
|
* Core run method - receives ONLY input params
|
|
87
125
|
* All runtime dependencies (logging, state management, etc.) come from TaskController
|
|
@@ -101,23 +139,56 @@ export interface ITaskDefinition<I extends ITaskInput = ITaskInput, O extends IT
|
|
|
101
139
|
*/
|
|
102
140
|
createInputValidation?(params: ITaskCreateInputValidationParams): GenericRecord<keyof I, zod.Schema> | zod.Schema;
|
|
103
141
|
}
|
|
142
|
+
/**
|
|
143
|
+
* Core TaskDefinition - minimal interface
|
|
144
|
+
*
|
|
145
|
+
* TRANSITIONAL SHAPE. A definition supplies its behaviour in one of two ways:
|
|
146
|
+
*
|
|
147
|
+
* - the new way: `handler` names a {@link ITaskHandler} class, which the runner builds only for the
|
|
148
|
+
* task it is about to run;
|
|
149
|
+
* - the old way: the definition implements `run()` and the hooks itself, which forces every
|
|
150
|
+
* definition (and every dependency it injects) to be built just to look one up by id.
|
|
151
|
+
*
|
|
152
|
+
* `run` is optional ONLY to let both shapes coexist while packages migrate. Once every definition
|
|
153
|
+
* carries a `handler`, this interface becomes `ITaskMetadata & { handler }` and the optionality
|
|
154
|
+
* goes away. Exactly one of `run` or `handler` must be present; `GetTaskDefinitionUseCase` fails
|
|
155
|
+
* with {@link TaskDefinitionNotRunnableError} if neither is.
|
|
156
|
+
*/
|
|
157
|
+
export interface ITaskDefinition<I extends ITaskInput = ITaskInput, O extends ITaskOutput = ITaskOutput> extends ITaskMetadata, Partial<ITaskHandler<I, O>> {
|
|
158
|
+
handler?: Constructor<ITaskHandler<I, O>>;
|
|
159
|
+
}
|
|
104
160
|
export interface ITaskCreateInputValidationParams {
|
|
105
161
|
validator: typeof zod;
|
|
106
162
|
}
|
|
107
163
|
/** Define a long-running background task with lifecycle hooks. */
|
|
108
164
|
export declare const TaskDefinition: import("@webiny/di").Abstraction<ITaskDefinition<ITaskInput, ITaskOutput>>;
|
|
165
|
+
/**
|
|
166
|
+
* The behaviour half of a task, resolved on demand by the runner via
|
|
167
|
+
* `container.resolveImplementation(definition.handler)`. Registered implementations are NOT
|
|
168
|
+
* registered against this abstraction — the definition points at the class directly, exactly as
|
|
169
|
+
* `HttpRouteDefinition` points at its `HttpRouteHandler`.
|
|
170
|
+
*/
|
|
171
|
+
export declare const TaskHandler: import("@webiny/di").Abstraction<ITaskHandler<ITaskInput, ITaskOutput>>;
|
|
109
172
|
/**
|
|
110
173
|
* IRunnableTaskDefinition represents a TaskDefinition after decoration/processing.
|
|
111
174
|
* All optional runtime properties are guaranteed to have values (with defaults applied).
|
|
112
175
|
* Used internally by the task runner to ensure consistent behavior.
|
|
113
176
|
*/
|
|
114
|
-
export interface IRunnableTaskDefinition<I extends ITaskInput = ITaskInput, O extends ITaskOutput = ITaskOutput> extends
|
|
177
|
+
export interface IRunnableTaskDefinition<I extends ITaskInput = ITaskInput, O extends ITaskOutput = ITaskOutput> extends ITaskMetadata, ITaskHandler<I, O> {
|
|
115
178
|
isPrivate: boolean;
|
|
116
179
|
databaseLogs: boolean;
|
|
117
180
|
maxIterations: number;
|
|
118
181
|
}
|
|
182
|
+
export declare namespace TaskHandler {
|
|
183
|
+
type Interface<I extends ITaskInput = ITaskInput, O extends ITaskOutput = ITaskOutput> = ITaskHandler<I, O>;
|
|
184
|
+
type RunParams<I extends ITaskInput = ITaskInput, O extends ITaskOutput = ITaskOutput> = ITaskRunParams<I, O>;
|
|
185
|
+
type Result<I extends ITaskInput = ITaskInput, O extends ITaskOutput = ITaskOutput> = ITaskResult<I, O>;
|
|
186
|
+
type LifecycleHookParams<I extends ITaskInput = ITaskInput, O extends ITaskOutput = ITaskOutput> = ITaskLifecycleHook<I, O>;
|
|
187
|
+
}
|
|
119
188
|
export declare namespace TaskDefinition {
|
|
120
189
|
type Interface<I extends ITaskInput = ITaskInput, O extends ITaskOutput = ITaskOutput> = ITaskDefinition<I, O>;
|
|
190
|
+
type Metadata = ITaskMetadata;
|
|
191
|
+
type Handler<I extends ITaskInput = ITaskInput, O extends ITaskOutput = ITaskOutput> = ITaskHandler<I, O>;
|
|
121
192
|
type TaskInput = ITaskInput;
|
|
122
193
|
type TaskOutput = ITaskOutput;
|
|
123
194
|
type Runnable<I extends ITaskInput = ITaskInput, O extends ITaskOutput = ITaskOutput> = IRunnableTaskDefinition<I, O>;
|
|
@@ -132,6 +203,7 @@ export declare namespace TaskDefinition {
|
|
|
132
203
|
type TaskCreateData<I = ITaskInput> = ITaskCreateData<I>;
|
|
133
204
|
type BeforeTriggerParams<I = ITaskInput> = ITaskBeforeTriggerParams<I>;
|
|
134
205
|
type LifecycleHookParams<I extends ITaskInput = ITaskInput, O extends ITaskOutput = ITaskOutput> = ITaskLifecycleHook<I, O>;
|
|
206
|
+
type Info = ITaskDefinitionInfo;
|
|
135
207
|
type SelfCleanupEvent = ISelfCleanupEvent;
|
|
136
208
|
type SelfCleanup = ISelfCleanup;
|
|
137
209
|
}
|
|
@@ -7,6 +7,7 @@ var abstractions_TaskResultStatus = /*#__PURE__*/ function(TaskResultStatus) {
|
|
|
7
7
|
return TaskResultStatus;
|
|
8
8
|
}({});
|
|
9
9
|
const TaskDefinition = createAbstraction("TaskDefinition");
|
|
10
|
-
|
|
10
|
+
const TaskHandler = createAbstraction("TaskHandler");
|
|
11
|
+
export { TaskDefinition, TaskHandler, abstractions_TaskResultStatus as TaskResultStatus };
|
|
11
12
|
|
|
12
13
|
//# sourceMappingURL=abstractions.js.map
|
|
@@ -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. The object passed at runtime is\n * the resolved task, so `run` is physically present; naming the metadata type here stops the obvious\n * mistake of a handler calling `params.definition.run(...)` and 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 `RunnableTaskDecorator` and `SelfCleaningTaskDecorator` are fixed\n * pass-throughs that expose 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 — `GetTaskDefinitionUseCase` 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 * Core TaskDefinition - minimal interface\n *\n * TRANSITIONAL SHAPE. A definition supplies its behaviour in one of two ways:\n *\n * - the new way: `handler` names a {@link ITaskHandler} class, which the runner builds only for the\n * task it is about to run;\n * - the old way: the definition implements `run()` and the hooks itself, which forces every\n * definition (and every dependency it injects) to be built just to look one up by id.\n *\n * `run` is optional ONLY to let both shapes coexist while packages migrate. Once every definition\n * carries a `handler`, this interface becomes `ITaskMetadata & { handler }` and the optionality\n * goes away. Exactly one of `run` or `handler` must be present; `GetTaskDefinitionUseCase` fails\n * with {@link TaskDefinitionNotRunnableError} if neither is.\n */\nexport interface ITaskDefinition<\n I extends ITaskInput = ITaskInput,\n O extends ITaskOutput = ITaskOutput\n>\n extends ITaskMetadata, Partial<ITaskHandler<I, O>> {\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":";AA4EO,IAAKA,gCAAgBA,WAAAA,GAAAA,SAAhBA,gBAAgB;;;;;WAAhBA;;AAiIL,MAAMC,iBAAiBC,kBAAmC;AAQ1D,MAAMC,cAAcD,kBAAgC"}
|
|
@@ -8,7 +8,7 @@ declare class CreateTenantUseCaseImpl implements UseCaseAbstraction.Interface {
|
|
|
8
8
|
private eventPublisher;
|
|
9
9
|
private repository;
|
|
10
10
|
constructor(eventPublisher: EventPublisher.Interface, repository: CreateTenantRepository.Interface);
|
|
11
|
-
execute(data: CreateTenantInput): Promise<Result<
|
|
11
|
+
execute(data: CreateTenantInput): Promise<Result<never, CreateTenantError> | Result<Tenant, never>>;
|
|
12
12
|
}
|
|
13
13
|
export declare const CreateTenantUseCase: import("@webiny/di").Implementation<typeof CreateTenantUseCaseImpl>;
|
|
14
14
|
export {};
|
|
@@ -13,7 +13,7 @@ declare class InstallTenantUseCaseImpl implements UseCaseAbstraction.Interface {
|
|
|
13
13
|
private updateTenantUseCase;
|
|
14
14
|
private resolver;
|
|
15
15
|
constructor(tenantContext: TenantContext.Interface, eventPublisher: EventPublisher.Interface, appInstallers: AppInstaller.Interface[], updateTenantUseCase: UpdateTenantUseCase.Interface);
|
|
16
|
-
execute({ tenant, installationInput }: TenantInstallationInput): Promise<Result<void, never> | Result<never,
|
|
16
|
+
execute({ tenant, installationInput }: TenantInstallationInput): Promise<Result<void, never> | Result<never, InstallTenantError> | Result<never, InstallationDependencyError>>;
|
|
17
17
|
private rollback;
|
|
18
18
|
}
|
|
19
19
|
export declare const InstallTenantUseCase: import("@webiny/di").Implementation<typeof InstallTenantUseCaseImpl>;
|
|
@@ -9,9 +9,9 @@ declare class UpdateTenantUseCaseImpl implements UseCaseAbstraction.Interface {
|
|
|
9
9
|
private eventPublisher;
|
|
10
10
|
private repository;
|
|
11
11
|
constructor(getTenantById: GetTenantByIdUseCase.Interface, eventPublisher: EventPublisher.Interface, repository: UpdateTenantRepository.Interface);
|
|
12
|
-
execute(id: string, data: Partial<Tenant>): Promise<({
|
|
12
|
+
execute(id: string, data: Partial<Tenant>): Promise<Result<Tenant, never> | ({
|
|
13
13
|
_error: import("../GetTenantById/abstractions.js").GetTenantByIdError;
|
|
14
|
-
} & Result<Tenant, import("../GetTenantById/abstractions.js").GetTenantByIdError>)
|
|
14
|
+
} & Result<Tenant, import("../GetTenantById/abstractions.js").GetTenantByIdError>)>;
|
|
15
15
|
}
|
|
16
16
|
export declare const UpdateTenantUseCase: import("@webiny/di").Implementation<typeof UpdateTenantUseCaseImpl>;
|
|
17
17
|
export {};
|
|
@@ -5,7 +5,7 @@ declare class CreateUserWithWcpIncrementImpl implements CreateUserUseCase.Interf
|
|
|
5
5
|
private wcp;
|
|
6
6
|
private decoratee;
|
|
7
7
|
constructor(wcp: WcpContext.Interface, decoratee: CreateUserUseCase.Interface);
|
|
8
|
-
execute(input: CreateUserInput): Promise<import("@webiny/feature/api").Result<import("~/features/users/shared/types.js").AdminUser, import("../../shared/errors.js").
|
|
8
|
+
execute(input: CreateUserInput): Promise<import("@webiny/feature/api").Result<import("~/features/users/shared/types.js").AdminUser, import("../../shared/errors.js").EmailTakenError | import("../../shared/errors.js").NotAuthorizedError | import("../../shared/errors.js").UserNotFoundError | import("../../shared/errors.js").UserStorageError | import("../../shared/errors.js").UserValidationError>>;
|
|
9
9
|
}
|
|
10
10
|
export declare const CreateUserWithWcpIncrement: typeof CreateUserWithWcpIncrementImpl;
|
|
11
11
|
export {};
|
|
@@ -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;
|
|
@@ -27,7 +26,13 @@ export declare class WcpContextImpl implements WcpContext.Interface {
|
|
|
27
26
|
canUseHcmsFieldPermissions(): boolean;
|
|
28
27
|
canUseAiImageEnrichment(): boolean;
|
|
29
28
|
canUseAiPageGeneration(): boolean;
|
|
29
|
+
canUseAiPageTranslation(): boolean;
|
|
30
30
|
canUseAiLexicalGeneration(): boolean;
|
|
31
|
+
canUseAiEntryGeneration(): boolean;
|
|
32
|
+
canUseAiEntryComparison(): boolean;
|
|
33
|
+
canUseAiEntryTranslation(): boolean;
|
|
34
|
+
canUseAbTesting(): boolean;
|
|
35
|
+
canUseRemoteComponents(): boolean;
|
|
31
36
|
ensureCanUseFeature(wcpFeatureId: keyof typeof WCP_FEATURE_LABEL): void;
|
|
32
37
|
incrementSeats(): Promise<void>;
|
|
33
38
|
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;
|
|
@@ -108,9 +111,27 @@ class WcpContextImpl {
|
|
|
108
111
|
canUseAiPageGeneration() {
|
|
109
112
|
return this.license.canUseAiPageGeneration();
|
|
110
113
|
}
|
|
114
|
+
canUseAiPageTranslation() {
|
|
115
|
+
return this.license.canUseAiPageTranslation();
|
|
116
|
+
}
|
|
111
117
|
canUseAiLexicalGeneration() {
|
|
112
118
|
return this.license.canUseAiLexicalGeneration();
|
|
113
119
|
}
|
|
120
|
+
canUseAiEntryGeneration() {
|
|
121
|
+
return this.license.canUseAiEntryGeneration();
|
|
122
|
+
}
|
|
123
|
+
canUseAiEntryComparison() {
|
|
124
|
+
return this.license.canUseAiEntryComparison();
|
|
125
|
+
}
|
|
126
|
+
canUseAiEntryTranslation() {
|
|
127
|
+
return this.license.canUseAiEntryTranslation();
|
|
128
|
+
}
|
|
129
|
+
canUseAbTesting() {
|
|
130
|
+
return this.license.canUseAbTesting();
|
|
131
|
+
}
|
|
132
|
+
canUseRemoteComponents() {
|
|
133
|
+
return this.license.canUseRemoteComponents();
|
|
134
|
+
}
|
|
114
135
|
ensureCanUseFeature(wcpFeatureId) {
|
|
115
136
|
if (this.license.canUseFeature(wcpFeatureId)) return;
|
|
116
137
|
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 canUseAiLexicalGeneration(): boolean {\n return this.license.canUseAiLexicalGeneration();\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":"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"}
|
|
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 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 canUseAbTesting(): boolean {\n return this.license.canUseAbTesting();\n }\n\n canUseRemoteComponents(): boolean {\n return this.license.canUseRemoteComponents();\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":"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"}
|
|
@@ -8,8 +8,16 @@ declare class WcpContextWithFeatureFlagsDecoratorImpl implements WcpContext.Inte
|
|
|
8
8
|
getRawLicense(): import("@webiny/wcp/types.js").DecryptedWcpProjectLicense | null;
|
|
9
9
|
getProject(): import("@webiny/wcp/types.js").WcpProject | null;
|
|
10
10
|
getProjectWithFeatureFlags(): {
|
|
11
|
+
orgId: string;
|
|
12
|
+
projectId: string;
|
|
11
13
|
package: {
|
|
12
14
|
features: {
|
|
15
|
+
seats: {
|
|
16
|
+
enabled: true;
|
|
17
|
+
options: {
|
|
18
|
+
maxCount: number;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
13
21
|
multiTenancy: {
|
|
14
22
|
enabled: true;
|
|
15
23
|
options: {
|
|
@@ -48,23 +56,27 @@ declare class WcpContextWithFeatureFlagsDecoratorImpl implements WcpContext.Inte
|
|
|
48
56
|
options: {
|
|
49
57
|
websiteBuilder: {
|
|
50
58
|
pageGeneration: boolean | undefined;
|
|
59
|
+
pageTranslation: boolean | undefined;
|
|
51
60
|
};
|
|
52
61
|
fileManager: {
|
|
53
62
|
imageEnrichment: boolean | undefined;
|
|
54
63
|
};
|
|
55
64
|
lexicalGeneration: boolean | undefined;
|
|
65
|
+
cms: {
|
|
66
|
+
entryGeneration: boolean | undefined;
|
|
67
|
+
entryComparison: boolean | undefined;
|
|
68
|
+
entryTranslation: boolean | undefined;
|
|
69
|
+
};
|
|
56
70
|
};
|
|
57
71
|
};
|
|
58
|
-
|
|
59
|
-
enabled:
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
72
|
+
abTesting: {
|
|
73
|
+
enabled: boolean;
|
|
74
|
+
};
|
|
75
|
+
remoteComponents: {
|
|
76
|
+
enabled: boolean;
|
|
63
77
|
};
|
|
64
78
|
};
|
|
65
79
|
};
|
|
66
|
-
orgId: string;
|
|
67
|
-
projectId: string;
|
|
68
80
|
} | null;
|
|
69
81
|
getProjectEnvironment(): import("@webiny/wcp/types.js").WcpProjectEnvironment | null;
|
|
70
82
|
getProjectLicense(): import("@webiny/wcp/types.js").ILicense;
|
|
@@ -80,7 +92,13 @@ declare class WcpContextWithFeatureFlagsDecoratorImpl implements WcpContext.Inte
|
|
|
80
92
|
canUseHcmsFieldPermissions(): boolean;
|
|
81
93
|
canUseAiImageEnrichment(): boolean;
|
|
82
94
|
canUseAiPageGeneration(): boolean;
|
|
95
|
+
canUseAiPageTranslation(): boolean;
|
|
83
96
|
canUseAiLexicalGeneration(): boolean;
|
|
97
|
+
canUseAiEntryGeneration(): boolean;
|
|
98
|
+
canUseAiEntryComparison(): boolean;
|
|
99
|
+
canUseAiEntryTranslation(): boolean;
|
|
100
|
+
canUseAbTesting(): boolean;
|
|
101
|
+
canUseRemoteComponents(): boolean;
|
|
84
102
|
ensureCanUseFeature(featureId: keyof typeof WCP_FEATURE_LABEL): void;
|
|
85
103
|
incrementSeats(): Promise<void>;
|
|
86
104
|
decrementSeats(): Promise<void>;
|