@webiny/api-core 0.0.0-unstable.9f53ea597d → 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.d.ts +3 -1
- package/features/ai/Ai.js +36 -28
- package/features/ai/Ai.js.map +1 -1
- package/features/ai/AiModelRegistry.d.ts +14 -0
- package/features/ai/AiModelRegistry.js +39 -0
- package/features/ai/AiModelRegistry.js.map +1 -0
- package/features/ai/AiSdkToolHandlerResolver.d.ts +11 -0
- package/features/ai/AiSdkToolHandlerResolver.js +19 -0
- package/features/ai/AiSdkToolHandlerResolver.js.map +1 -0
- package/features/ai/AiSdkTools.d.ts +4 -3
- package/features/ai/AiSdkTools.js +11 -9
- package/features/ai/AiSdkTools.js.map +1 -1
- package/features/ai/AnthropicSdkFactory.js +24 -4
- package/features/ai/AnthropicSdkFactory.js.map +1 -1
- package/features/ai/DEVELOPERS.md +183 -0
- package/features/ai/GoogleSdkFactory.d.ts +10 -0
- package/features/ai/GoogleSdkFactory.js +65 -0
- package/features/ai/GoogleSdkFactory.js.map +1 -0
- package/features/ai/OpenAiSdkFactory.js +67 -11
- package/features/ai/OpenAiSdkFactory.js.map +1 -1
- package/features/ai/OpenRouterSdkFactory.d.ts +10 -0
- package/features/ai/OpenRouterSdkFactory.js +112 -0
- package/features/ai/OpenRouterSdkFactory.js.map +1 -0
- package/features/ai/RemoteAiModelCatalog.d.ts +13 -0
- package/features/ai/RemoteAiModelCatalog.js +74 -0
- package/features/ai/RemoteAiModelCatalog.js.map +1 -0
- package/features/ai/abstractions.d.ts +102 -7
- package/features/ai/abstractions.js +6 -2
- package/features/ai/abstractions.js.map +1 -1
- package/features/ai/feature.js +10 -0
- package/features/ai/feature.js.map +1 -1
- package/features/ai/index.d.ts +2 -4
- package/features/ai/index.js +1 -1
- package/features/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/Installer/RolesInstaller.js +1 -0
- 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/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 +11 -5
- package/features/wcp/WcpContext/WcpContext.js +26 -2
- package/features/wcp/WcpContext/WcpContext.js.map +1 -1
- package/features/wcp/WcpContext/decorators/WcpContextWithFeatureFlagsDecorator.d.ts +10 -69
- package/features/wcp/WcpContext/decorators/WcpContextWithFeatureFlagsDecorator.js +66 -35
- 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} +31 -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 -21
- 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 -38
- package/legacy/wcp/LegacyWcpContext.js +0 -99
- 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,15 +0,0 @@
|
|
|
1
|
-
import { Container } from "@webiny/di";
|
|
2
|
-
import type { CreateTenantInput, ListTenantsParams, Tenancy, Tenant } from "../../types/tenancy.js";
|
|
3
|
-
export declare class LegacyContext implements Tenancy {
|
|
4
|
-
private container;
|
|
5
|
-
constructor(container: Container);
|
|
6
|
-
createTenant(data: CreateTenantInput): Promise<Tenant>;
|
|
7
|
-
getCurrentTenant(): Tenant;
|
|
8
|
-
getRootTenant(): Promise<Tenant>;
|
|
9
|
-
getTenantById(id: string): Promise<Tenant>;
|
|
10
|
-
listTenants(params?: ListTenantsParams): Promise<Tenant[]>;
|
|
11
|
-
setCurrentTenant(tenant: Tenant): void;
|
|
12
|
-
withEachTenant<TReturn>(tenants: Tenant[], cb: (tenant: Tenant) => Promise<TReturn>): Promise<TReturn[]>;
|
|
13
|
-
withRootTenant<T>(cb: () => T): Promise<T>;
|
|
14
|
-
withTenant<TReturn>(tenant: Tenant, cb: (tenant: Tenant) => Promise<TReturn>): Promise<TReturn>;
|
|
15
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { CreateTenantUseCase } from "../../features/tenancy/CreateTenant/abstractions.js";
|
|
2
|
-
import { GetRootTenantUseCase } from "../../features/tenancy/GetRootTenant/abstractions.js";
|
|
3
|
-
import { GetTenantByIdUseCase } from "../../features/tenancy/GetTenantById/abstractions.js";
|
|
4
|
-
import { ListTenantsUseCase } from "../../features/tenancy/ListTenants/abstractions.js";
|
|
5
|
-
import { TenantContext } from "../../features/tenancy/TenantContext/abstractions.js";
|
|
6
|
-
class LegacyContext {
|
|
7
|
-
constructor(container){
|
|
8
|
-
this.container = container;
|
|
9
|
-
}
|
|
10
|
-
async createTenant(data) {
|
|
11
|
-
const useCase = this.container.resolve(CreateTenantUseCase);
|
|
12
|
-
const result = await useCase.execute(data);
|
|
13
|
-
if (result.isFail()) throw result.error;
|
|
14
|
-
return result.value;
|
|
15
|
-
}
|
|
16
|
-
getCurrentTenant() {
|
|
17
|
-
const tenantContext = this.container.resolve(TenantContext);
|
|
18
|
-
return tenantContext.getTenant();
|
|
19
|
-
}
|
|
20
|
-
async getRootTenant() {
|
|
21
|
-
const useCase = this.container.resolve(GetRootTenantUseCase);
|
|
22
|
-
const result = await useCase.execute();
|
|
23
|
-
if (result.isFail()) throw result.error;
|
|
24
|
-
return result.value;
|
|
25
|
-
}
|
|
26
|
-
async getTenantById(id) {
|
|
27
|
-
const useCase = this.container.resolve(GetTenantByIdUseCase);
|
|
28
|
-
const result = await useCase.execute(id);
|
|
29
|
-
if (result.isFail()) throw result.error;
|
|
30
|
-
return result.value;
|
|
31
|
-
}
|
|
32
|
-
async listTenants(params) {
|
|
33
|
-
const useCase = this.container.resolve(ListTenantsUseCase);
|
|
34
|
-
const result = await useCase.execute(params);
|
|
35
|
-
if (result.isFail()) throw result.error;
|
|
36
|
-
return result.value;
|
|
37
|
-
}
|
|
38
|
-
setCurrentTenant(tenant) {
|
|
39
|
-
const tenantContext = this.container.resolve(TenantContext);
|
|
40
|
-
tenantContext.setTenant(tenant);
|
|
41
|
-
}
|
|
42
|
-
async withEachTenant(tenants, cb) {
|
|
43
|
-
const tenantContext = this.container.resolve(TenantContext);
|
|
44
|
-
return tenantContext.withEachTenant(tenants, cb);
|
|
45
|
-
}
|
|
46
|
-
async withRootTenant(cb) {
|
|
47
|
-
const tenantContext = this.container.resolve(TenantContext);
|
|
48
|
-
return tenantContext.withRootTenant(cb);
|
|
49
|
-
}
|
|
50
|
-
async withTenant(tenant, cb) {
|
|
51
|
-
const tenantContext = this.container.resolve(TenantContext);
|
|
52
|
-
return tenantContext.withTenant(tenant, cb);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
export { LegacyContext };
|
|
56
|
-
|
|
57
|
-
//# sourceMappingURL=LegacyContext.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"legacy/tenancy/LegacyContext.js","sources":["../../../src/legacy/tenancy/LegacyContext.ts"],"sourcesContent":["import { Container } from \"@webiny/di\";\nimport type { CreateTenantInput, ListTenantsParams, Tenancy, Tenant } from \"~/types/tenancy.js\";\nimport { CreateTenantUseCase } from \"~/features/tenancy/CreateTenant/abstractions.js\";\nimport { GetRootTenantUseCase } from \"~/features/tenancy/GetRootTenant/abstractions.js\";\nimport { GetTenantByIdUseCase } from \"~/features/tenancy/GetTenantById/abstractions.js\";\nimport { ListTenantsUseCase } from \"~/features/tenancy/ListTenants/abstractions.js\";\nimport { TenantContext } from \"~/features/tenancy/TenantContext/abstractions.js\";\n\nexport class LegacyContext implements Tenancy {\n constructor(private container: Container) {}\n\n async createTenant(data: CreateTenantInput): Promise<Tenant> {\n const useCase = this.container.resolve(CreateTenantUseCase);\n const result = await useCase.execute(data);\n\n if (result.isFail()) {\n throw result.error;\n }\n\n return result.value;\n }\n\n getCurrentTenant(): Tenant {\n const tenantContext = this.container.resolve(TenantContext);\n return tenantContext.getTenant();\n }\n\n async getRootTenant(): Promise<Tenant> {\n const useCase = this.container.resolve(GetRootTenantUseCase);\n const result = await useCase.execute();\n\n if (result.isFail()) {\n throw result.error;\n }\n\n return result.value;\n }\n\n async getTenantById(id: string): Promise<Tenant> {\n const useCase = this.container.resolve(GetTenantByIdUseCase);\n const result = await useCase.execute(id);\n\n if (result.isFail()) {\n throw result.error;\n }\n\n return result.value;\n }\n\n async listTenants(params?: ListTenantsParams): Promise<Tenant[]> {\n const useCase = this.container.resolve(ListTenantsUseCase);\n const result = await useCase.execute(params);\n\n if (result.isFail()) {\n throw result.error;\n }\n\n return result.value;\n }\n\n setCurrentTenant(tenant: Tenant): void {\n const tenantContext = this.container.resolve(TenantContext);\n tenantContext.setTenant(tenant);\n }\n\n async withEachTenant<TReturn>(\n tenants: Tenant[],\n cb: (tenant: Tenant) => Promise<TReturn>\n ): Promise<TReturn[]> {\n const tenantContext = this.container.resolve(TenantContext);\n return tenantContext.withEachTenant(tenants, cb);\n }\n\n async withRootTenant<T>(cb: () => T): Promise<T> {\n const tenantContext = this.container.resolve(TenantContext);\n return tenantContext.withRootTenant(cb);\n }\n\n async withTenant<TReturn>(\n tenant: Tenant,\n cb: (tenant: Tenant) => Promise<TReturn>\n ): Promise<TReturn> {\n const tenantContext = this.container.resolve(TenantContext);\n return tenantContext.withTenant(tenant, cb);\n }\n}\n"],"names":["LegacyContext","container","data","useCase","CreateTenantUseCase","result","tenantContext","TenantContext","GetRootTenantUseCase","id","GetTenantByIdUseCase","params","ListTenantsUseCase","tenant","tenants","cb"],"mappings":";;;;;AAQO,MAAMA;IACT,YAAoBC,SAAoB,CAAE;aAAtBA,SAAS,GAATA;IAAuB;IAE3C,MAAM,aAAaC,IAAuB,EAAmB;QACzD,MAAMC,UAAU,IAAI,CAAC,SAAS,CAAC,OAAO,CAACC;QACvC,MAAMC,SAAS,MAAMF,QAAQ,OAAO,CAACD;QAErC,IAAIG,OAAO,MAAM,IACb,MAAMA,OAAO,KAAK;QAGtB,OAAOA,OAAO,KAAK;IACvB;IAEA,mBAA2B;QACvB,MAAMC,gBAAgB,IAAI,CAAC,SAAS,CAAC,OAAO,CAACC;QAC7C,OAAOD,cAAc,SAAS;IAClC;IAEA,MAAM,gBAAiC;QACnC,MAAMH,UAAU,IAAI,CAAC,SAAS,CAAC,OAAO,CAACK;QACvC,MAAMH,SAAS,MAAMF,QAAQ,OAAO;QAEpC,IAAIE,OAAO,MAAM,IACb,MAAMA,OAAO,KAAK;QAGtB,OAAOA,OAAO,KAAK;IACvB;IAEA,MAAM,cAAcI,EAAU,EAAmB;QAC7C,MAAMN,UAAU,IAAI,CAAC,SAAS,CAAC,OAAO,CAACO;QACvC,MAAML,SAAS,MAAMF,QAAQ,OAAO,CAACM;QAErC,IAAIJ,OAAO,MAAM,IACb,MAAMA,OAAO,KAAK;QAGtB,OAAOA,OAAO,KAAK;IACvB;IAEA,MAAM,YAAYM,MAA0B,EAAqB;QAC7D,MAAMR,UAAU,IAAI,CAAC,SAAS,CAAC,OAAO,CAACS;QACvC,MAAMP,SAAS,MAAMF,QAAQ,OAAO,CAACQ;QAErC,IAAIN,OAAO,MAAM,IACb,MAAMA,OAAO,KAAK;QAGtB,OAAOA,OAAO,KAAK;IACvB;IAEA,iBAAiBQ,MAAc,EAAQ;QACnC,MAAMP,gBAAgB,IAAI,CAAC,SAAS,CAAC,OAAO,CAACC;QAC7CD,cAAc,SAAS,CAACO;IAC5B;IAEA,MAAM,eACFC,OAAiB,EACjBC,EAAwC,EACtB;QAClB,MAAMT,gBAAgB,IAAI,CAAC,SAAS,CAAC,OAAO,CAACC;QAC7C,OAAOD,cAAc,cAAc,CAACQ,SAASC;IACjD;IAEA,MAAM,eAAkBA,EAAW,EAAc;QAC7C,MAAMT,gBAAgB,IAAI,CAAC,SAAS,CAAC,OAAO,CAACC;QAC7C,OAAOD,cAAc,cAAc,CAACS;IACxC;IAEA,MAAM,WACFF,MAAc,EACdE,EAAwC,EACxB;QAChB,MAAMT,gBAAgB,IAAI,CAAC,SAAS,CAAC,OAAO,CAACC;QAC7C,OAAOD,cAAc,UAAU,CAACO,QAAQE;IAC5C;AACJ"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { ContextPlugin } from "@webiny/api";
|
|
2
|
-
import { Request } from "@webiny/handler";
|
|
3
|
-
import { GetTenantByIdUseCase } from "../../features/tenancy/GetTenantById/index.js";
|
|
4
|
-
import { TenantContext } from "../../features/tenancy/TenantContext/index.js";
|
|
5
|
-
import { LegacyContext } from "./LegacyContext.js";
|
|
6
|
-
import { RootTenantValue } from "../../domain/tenancy/RootTenantValue.js";
|
|
7
|
-
const createTenancyContext = ()=>new ContextPlugin(async (context)=>{
|
|
8
|
-
let tenantId = "root";
|
|
9
|
-
const request = context.container.resolve(Request);
|
|
10
|
-
const multiTenancy = context.wcp.canUseFeature("multiTenancy");
|
|
11
|
-
if (!request) throw new Error("MISSING CONTEXT REQUEST");
|
|
12
|
-
if (multiTenancy) {
|
|
13
|
-
const { headers = {} } = request;
|
|
14
|
-
tenantId = headers["x-tenant"] ?? "root";
|
|
15
|
-
}
|
|
16
|
-
context.plugins.register({
|
|
17
|
-
type: "wcp-telemetry-tracker"
|
|
18
|
-
});
|
|
19
|
-
const getTenantById = context.container.resolve(GetTenantByIdUseCase);
|
|
20
|
-
const tenantContext = context.container.resolve(TenantContext);
|
|
21
|
-
const tenantResult = await getTenantById.execute(tenantId);
|
|
22
|
-
if (tenantResult.isOk()) tenantContext.setTenant(tenantResult.value);
|
|
23
|
-
else {
|
|
24
|
-
if ("root" !== tenantId) throw new Error("Unable to load tenant!");
|
|
25
|
-
tenantContext.setTenant(RootTenantValue.create());
|
|
26
|
-
}
|
|
27
|
-
context.tenancy = new LegacyContext(context.container);
|
|
28
|
-
});
|
|
29
|
-
export { createTenancyContext };
|
|
30
|
-
|
|
31
|
-
//# sourceMappingURL=createTenancyContext.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"legacy/tenancy/createTenancyContext.js","sources":["../../../src/legacy/tenancy/createTenancyContext.ts"],"sourcesContent":["import { ContextPlugin } from \"@webiny/api\";\nimport { Request } from \"@webiny/handler\";\nimport type { ApiCoreContext } from \"~/types/core.js\";\nimport { GetTenantByIdUseCase } from \"~/features/tenancy/GetTenantById/index.js\";\nimport { TenantContext } from \"~/features/tenancy/TenantContext/index.js\";\nimport { LegacyContext } from \"~/legacy/tenancy/LegacyContext.js\";\nimport { RootTenantValue } from \"~/domain/tenancy/RootTenantValue.js\";\n\nexport const createTenancyContext = () => {\n return new ContextPlugin<ApiCoreContext>(async context => {\n let tenantId = \"root\";\n\n const request = context.container.resolve(Request);\n\n const multiTenancy = context.wcp.canUseFeature(\"multiTenancy\");\n if (!request) {\n throw new Error(\"MISSING CONTEXT REQUEST\");\n }\n\n if (multiTenancy) {\n const { headers = {} } = request;\n\n tenantId = (headers[\"x-tenant\"] as string) ?? \"root\";\n }\n\n // Add WCP telemetry identifier\n // This tenancy package is used by GraphQL, Headless CMS, and PB import/export functions\n context.plugins.register({ type: \"wcp-telemetry-tracker\" });\n\n // We need to load tenant, and set the current tenant context.\n const getTenantById = context.container.resolve(GetTenantByIdUseCase);\n const tenantContext = context.container.resolve(TenantContext);\n\n const tenantResult = await getTenantById.execute(tenantId);\n if (tenantResult.isOk()) {\n tenantContext.setTenant(tenantResult.value);\n } else {\n // If there's no `root` tenant, it means system installation wasn't finished yet.\n // But all other tenants should throw an error.\n if (tenantId !== \"root\") {\n throw new Error(\"Unable to load tenant!\");\n }\n\n // Mock root tenant so the system can bootstrap\n tenantContext.setTenant(RootTenantValue.create());\n }\n\n // Set up legacy context. We use this API in many places across our codebase, and this will provide\n // a working bridge until everything is migrated to use DI container.\n context.tenancy = new LegacyContext(context.container);\n });\n};\n"],"names":["createTenancyContext","ContextPlugin","context","tenantId","request","Request","multiTenancy","Error","headers","getTenantById","GetTenantByIdUseCase","tenantContext","TenantContext","tenantResult","RootTenantValue","LegacyContext"],"mappings":";;;;;;AAQO,MAAMA,uBAAuB,IACzB,IAAIC,cAA8B,OAAMC;QAC3C,IAAIC,WAAW;QAEf,MAAMC,UAAUF,QAAQ,SAAS,CAAC,OAAO,CAACG;QAE1C,MAAMC,eAAeJ,QAAQ,GAAG,CAAC,aAAa,CAAC;QAC/C,IAAI,CAACE,SACD,MAAM,IAAIG,MAAM;QAGpB,IAAID,cAAc;YACd,MAAM,EAAEE,UAAU,CAAC,CAAC,EAAE,GAAGJ;YAEzBD,WAAYK,OAAO,CAAC,WAAW,IAAe;QAClD;QAIAN,QAAQ,OAAO,CAAC,QAAQ,CAAC;YAAE,MAAM;QAAwB;QAGzD,MAAMO,gBAAgBP,QAAQ,SAAS,CAAC,OAAO,CAACQ;QAChD,MAAMC,gBAAgBT,QAAQ,SAAS,CAAC,OAAO,CAACU;QAEhD,MAAMC,eAAe,MAAMJ,cAAc,OAAO,CAACN;QACjD,IAAIU,aAAa,IAAI,IACjBF,cAAc,SAAS,CAACE,aAAa,KAAK;aACvC;YAGH,IAAIV,AAAa,WAAbA,UACA,MAAM,IAAII,MAAM;YAIpBI,cAAc,SAAS,CAACG,gBAAgB,MAAM;QAClD;QAIAZ,QAAQ,OAAO,GAAG,IAAIa,cAAcb,QAAQ,SAAS;IACzD"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { Container } from "@webiny/di";
|
|
2
|
-
import type { Team } from "../../types/security.js";
|
|
3
|
-
import type { AdminUsers, AdminUser, CreateUserInput, UpdateUserInput, GetUserParams, ListUsersParams } from "../../types/users.js";
|
|
4
|
-
export declare class LegacyContext implements AdminUsers {
|
|
5
|
-
private container;
|
|
6
|
-
constructor(container: Container);
|
|
7
|
-
getUser<TUser extends AdminUser = AdminUser>(params: GetUserParams): Promise<TUser>;
|
|
8
|
-
listUsers<TUser extends AdminUser = AdminUser>(params?: ListUsersParams): Promise<TUser[]>;
|
|
9
|
-
listUserTeams(id: string): Promise<Team[]>;
|
|
10
|
-
createUser<TUser extends AdminUser = AdminUser>(data: CreateUserInput): Promise<TUser>;
|
|
11
|
-
updateUser<TUser extends AdminUser = AdminUser>(id: string, data: UpdateUserInput): Promise<TUser>;
|
|
12
|
-
deleteUser(id: string): Promise<void>;
|
|
13
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { GetUserUseCase } from "../../features/users/GetUser/index.js";
|
|
2
|
-
import { ListUsersUseCase } from "../../features/users/ListUsers/index.js";
|
|
3
|
-
import { ListUserTeamsUseCase } from "../../features/users/ListUserTeams/index.js";
|
|
4
|
-
import { CreateUserUseCase } from "../../features/users/CreateUser/index.js";
|
|
5
|
-
import { UpdateUserUseCase } from "../../features/users/UpdateUser/index.js";
|
|
6
|
-
import { DeleteUserUseCase } from "../../features/users/DeleteUser/index.js";
|
|
7
|
-
class LegacyContext {
|
|
8
|
-
constructor(container){
|
|
9
|
-
this.container = container;
|
|
10
|
-
}
|
|
11
|
-
async getUser(params) {
|
|
12
|
-
const useCase = this.container.resolve(GetUserUseCase);
|
|
13
|
-
let input;
|
|
14
|
-
input = params.where.id ? {
|
|
15
|
-
id: params.where.id
|
|
16
|
-
} : {
|
|
17
|
-
email: params.where.email
|
|
18
|
-
};
|
|
19
|
-
const result = await useCase.execute(input);
|
|
20
|
-
if (result.isFail()) throw new Error(result.error.message);
|
|
21
|
-
return result.value;
|
|
22
|
-
}
|
|
23
|
-
async listUsers(params) {
|
|
24
|
-
const useCase = this.container.resolve(ListUsersUseCase);
|
|
25
|
-
const result = await useCase.execute(params);
|
|
26
|
-
if (result.isFail()) throw new Error(result.error.message);
|
|
27
|
-
return result.value;
|
|
28
|
-
}
|
|
29
|
-
async listUserTeams(id) {
|
|
30
|
-
const useCase = this.container.resolve(ListUserTeamsUseCase);
|
|
31
|
-
const result = await useCase.execute(id);
|
|
32
|
-
if (result.isFail()) throw new Error(result.error.message);
|
|
33
|
-
return result.value;
|
|
34
|
-
}
|
|
35
|
-
async createUser(data) {
|
|
36
|
-
const useCase = this.container.resolve(CreateUserUseCase);
|
|
37
|
-
const result = await useCase.execute(data);
|
|
38
|
-
if (result.isFail()) throw new Error(result.error.message);
|
|
39
|
-
return result.value;
|
|
40
|
-
}
|
|
41
|
-
async updateUser(id, data) {
|
|
42
|
-
const useCase = this.container.resolve(UpdateUserUseCase);
|
|
43
|
-
const result = await useCase.execute(id, data);
|
|
44
|
-
if (result.isFail()) throw new Error(result.error.message);
|
|
45
|
-
return result.value;
|
|
46
|
-
}
|
|
47
|
-
async deleteUser(id) {
|
|
48
|
-
const useCase = this.container.resolve(DeleteUserUseCase);
|
|
49
|
-
const result = await useCase.execute(id);
|
|
50
|
-
if (result.isFail()) throw new Error(result.error.message);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
export { LegacyContext };
|
|
54
|
-
|
|
55
|
-
//# sourceMappingURL=LegacyContext.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"legacy/users/LegacyContext.js","sources":["../../../src/legacy/users/LegacyContext.ts"],"sourcesContent":["import type { Container } from \"@webiny/di\";\nimport type { Team } from \"~/types/security.js\";\nimport type {\n AdminUsers,\n AdminUser,\n CreateUserInput,\n UpdateUserInput,\n GetUserParams,\n ListUsersParams\n} from \"~/types/users.js\";\nimport { GetUserUseCase } from \"~/features/users/GetUser/index.js\";\nimport { ListUsersUseCase } from \"~/features/users/ListUsers/index.js\";\nimport { ListUserTeamsUseCase } from \"~/features/users/ListUserTeams/index.js\";\nimport { CreateUserUseCase } from \"~/features/users/CreateUser/index.js\";\nimport { UpdateUserUseCase } from \"~/features/users/UpdateUser/index.js\";\nimport { DeleteUserUseCase } from \"~/features/users/DeleteUser/index.js\";\nimport type { GetUserInput } from \"~/features/users/shared/types.js\";\n\nexport class LegacyContext implements AdminUsers {\n constructor(private container: Container) {}\n\n async getUser<TUser extends AdminUser = AdminUser>(params: GetUserParams): Promise<TUser> {\n const useCase = this.container.resolve(GetUserUseCase);\n let input: GetUserInput;\n if (params.where.id) {\n input = { id: params.where.id! };\n } else {\n input = { email: params.where.email! };\n }\n const result = await useCase.execute(input);\n\n if (result.isFail()) {\n throw new Error(result.error.message);\n }\n\n return result.value as TUser;\n }\n\n async listUsers<TUser extends AdminUser = AdminUser>(\n params?: ListUsersParams\n ): Promise<TUser[]> {\n const useCase = this.container.resolve(ListUsersUseCase);\n const result = await useCase.execute(params);\n\n if (result.isFail()) {\n throw new Error(result.error.message);\n }\n\n return result.value as TUser[];\n }\n\n async listUserTeams(id: string): Promise<Team[]> {\n const useCase = this.container.resolve(ListUserTeamsUseCase);\n const result = await useCase.execute(id);\n\n if (result.isFail()) {\n throw new Error(result.error.message);\n }\n\n return result.value;\n }\n\n async createUser<TUser extends AdminUser = AdminUser>(data: CreateUserInput): Promise<TUser> {\n const useCase = this.container.resolve(CreateUserUseCase);\n const result = await useCase.execute(data);\n\n if (result.isFail()) {\n throw new Error(result.error.message);\n }\n\n return result.value as TUser;\n }\n\n async updateUser<TUser extends AdminUser = AdminUser>(\n id: string,\n data: UpdateUserInput\n ): Promise<TUser> {\n const useCase = this.container.resolve(UpdateUserUseCase);\n const result = await useCase.execute(id, data);\n\n if (result.isFail()) {\n throw new Error(result.error.message);\n }\n\n return result.value as TUser;\n }\n\n async deleteUser(id: string): Promise<void> {\n const useCase = this.container.resolve(DeleteUserUseCase);\n const result = await useCase.execute(id);\n\n if (result.isFail()) {\n throw new Error(result.error.message);\n }\n }\n}\n"],"names":["LegacyContext","container","params","useCase","GetUserUseCase","input","result","Error","ListUsersUseCase","id","ListUserTeamsUseCase","data","CreateUserUseCase","UpdateUserUseCase","DeleteUserUseCase"],"mappings":";;;;;;AAkBO,MAAMA;IACT,YAAoBC,SAAoB,CAAE;aAAtBA,SAAS,GAATA;IAAuB;IAE3C,MAAM,QAA6CC,MAAqB,EAAkB;QACtF,MAAMC,UAAU,IAAI,CAAC,SAAS,CAAC,OAAO,CAACC;QACvC,IAAIC;QAEAA,QADAH,OAAO,KAAK,CAAC,EAAE,GACP;YAAE,IAAIA,OAAO,KAAK,CAAC,EAAE;QAAE,IAEvB;YAAE,OAAOA,OAAO,KAAK,CAAC,KAAK;QAAE;QAEzC,MAAMI,SAAS,MAAMH,QAAQ,OAAO,CAACE;QAErC,IAAIC,OAAO,MAAM,IACb,MAAM,IAAIC,MAAMD,OAAO,KAAK,CAAC,OAAO;QAGxC,OAAOA,OAAO,KAAK;IACvB;IAEA,MAAM,UACFJ,MAAwB,EACR;QAChB,MAAMC,UAAU,IAAI,CAAC,SAAS,CAAC,OAAO,CAACK;QACvC,MAAMF,SAAS,MAAMH,QAAQ,OAAO,CAACD;QAErC,IAAII,OAAO,MAAM,IACb,MAAM,IAAIC,MAAMD,OAAO,KAAK,CAAC,OAAO;QAGxC,OAAOA,OAAO,KAAK;IACvB;IAEA,MAAM,cAAcG,EAAU,EAAmB;QAC7C,MAAMN,UAAU,IAAI,CAAC,SAAS,CAAC,OAAO,CAACO;QACvC,MAAMJ,SAAS,MAAMH,QAAQ,OAAO,CAACM;QAErC,IAAIH,OAAO,MAAM,IACb,MAAM,IAAIC,MAAMD,OAAO,KAAK,CAAC,OAAO;QAGxC,OAAOA,OAAO,KAAK;IACvB;IAEA,MAAM,WAAgDK,IAAqB,EAAkB;QACzF,MAAMR,UAAU,IAAI,CAAC,SAAS,CAAC,OAAO,CAACS;QACvC,MAAMN,SAAS,MAAMH,QAAQ,OAAO,CAACQ;QAErC,IAAIL,OAAO,MAAM,IACb,MAAM,IAAIC,MAAMD,OAAO,KAAK,CAAC,OAAO;QAGxC,OAAOA,OAAO,KAAK;IACvB;IAEA,MAAM,WACFG,EAAU,EACVE,IAAqB,EACP;QACd,MAAMR,UAAU,IAAI,CAAC,SAAS,CAAC,OAAO,CAACU;QACvC,MAAMP,SAAS,MAAMH,QAAQ,OAAO,CAACM,IAAIE;QAEzC,IAAIL,OAAO,MAAM,IACb,MAAM,IAAIC,MAAMD,OAAO,KAAK,CAAC,OAAO;QAGxC,OAAOA,OAAO,KAAK;IACvB;IAEA,MAAM,WAAWG,EAAU,EAAiB;QACxC,MAAMN,UAAU,IAAI,CAAC,SAAS,CAAC,OAAO,CAACW;QACvC,MAAMR,SAAS,MAAMH,QAAQ,OAAO,CAACM;QAErC,IAAIH,OAAO,MAAM,IACb,MAAM,IAAIC,MAAMD,OAAO,KAAK,CAAC,OAAO;IAE5C;AACJ"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { ContextPlugin } from "@webiny/api";
|
|
2
|
-
import { LegacyContext } from "./LegacyContext.js";
|
|
3
|
-
import { createUsersGraphQL } from "../../graphql/users/user.gql.js";
|
|
4
|
-
const createAdminUsersContext = ()=>[
|
|
5
|
-
new ContextPlugin(async (context)=>{
|
|
6
|
-
context.adminUsers = new LegacyContext(context.container);
|
|
7
|
-
context.plugins.register(createUsersGraphQL());
|
|
8
|
-
})
|
|
9
|
-
];
|
|
10
|
-
export { createAdminUsersContext };
|
|
11
|
-
|
|
12
|
-
//# sourceMappingURL=createAdminUsersContext.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"legacy/users/createAdminUsersContext.js","sources":["../../../src/legacy/users/createAdminUsersContext.ts"],"sourcesContent":["import { ContextPlugin } from \"@webiny/api\";\nimport { LegacyContext } from \"./LegacyContext.js\";\nimport { createUsersGraphQL } from \"~/graphql/users/user.gql.js\";\nimport type { ApiCoreContext } from \"~/types/core.js\";\n\nexport const createAdminUsersContext = () => {\n return [\n new ContextPlugin<ApiCoreContext>(async context => {\n // Attach legacy context interface\n context.adminUsers = new LegacyContext(context.container);\n\n context.plugins.register(createUsersGraphQL());\n })\n ];\n};\n"],"names":["createAdminUsersContext","ContextPlugin","context","LegacyContext","createUsersGraphQL"],"mappings":";;;AAKO,MAAMA,0BAA0B,IAC5B;QACH,IAAIC,cAA8B,OAAMC;YAEpCA,QAAQ,UAAU,GAAG,IAAIC,cAAcD,QAAQ,SAAS;YAExDA,QAAQ,OAAO,CAAC,QAAQ,CAACE;QAC7B;KACH"}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { Container } from "@webiny/di";
|
|
2
|
-
import type { WCP_FEATURE_LABEL } from "@webiny/wcp";
|
|
3
|
-
import type { DecryptedWcpProjectLicense, ILicense, WcpProject, WcpProjectEnvironment } from "@webiny/wcp/types.js";
|
|
4
|
-
import { WcpContextObject } from "../../features/wcp/WcpContext/types.js";
|
|
5
|
-
export declare class LegacyWcpContext implements WcpContextObject {
|
|
6
|
-
private container;
|
|
7
|
-
constructor(container: Container);
|
|
8
|
-
private getWcpContext;
|
|
9
|
-
getRawLicense(): DecryptedWcpProjectLicense | null;
|
|
10
|
-
getProject(): WcpProject | null;
|
|
11
|
-
getProjectWithFeatureFlags(): WcpProject | null;
|
|
12
|
-
getProjectLicense(): ILicense;
|
|
13
|
-
getProjectEnvironment(): WcpProjectEnvironment | null;
|
|
14
|
-
canUseFeature(wcpFeatureId: keyof typeof WCP_FEATURE_LABEL): boolean;
|
|
15
|
-
canUseAacl(): boolean;
|
|
16
|
-
canUseTeams(): boolean;
|
|
17
|
-
canUseFolderLevelPermissions(): boolean;
|
|
18
|
-
canUsePrivateFiles(): boolean;
|
|
19
|
-
canUseAuditLogs(): boolean;
|
|
20
|
-
canUseRecordLocking(): boolean;
|
|
21
|
-
canUseFileManagerThreatDetection(): boolean;
|
|
22
|
-
canUseWorkflows(): boolean;
|
|
23
|
-
canUseHcmsFieldPermissions(): boolean;
|
|
24
|
-
canUseAiImageEnrichment(): boolean;
|
|
25
|
-
canUseAiPageGeneration(): boolean;
|
|
26
|
-
canUseAiPageTranslation(): boolean;
|
|
27
|
-
canUseAiLexicalGeneration(): boolean;
|
|
28
|
-
canUseAiEntryGeneration(): boolean;
|
|
29
|
-
canUseAiEntryComparison(): boolean;
|
|
30
|
-
canUseAiEntryTranslation(): boolean;
|
|
31
|
-
canUseAbTesting(): boolean;
|
|
32
|
-
ensureCanUseFeature(featureId: keyof typeof WCP_FEATURE_LABEL): void;
|
|
33
|
-
incrementSeats(): Promise<void>;
|
|
34
|
-
decrementSeats(): Promise<void>;
|
|
35
|
-
incrementTenants(): Promise<void>;
|
|
36
|
-
decrementTenants(): Promise<void>;
|
|
37
|
-
toDto(): DecryptedWcpProjectLicense | null;
|
|
38
|
-
}
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import { WcpContext } from "../../features/wcp/WcpContext/index.js";
|
|
2
|
-
class LegacyWcpContext {
|
|
3
|
-
constructor(container){
|
|
4
|
-
this.container = container;
|
|
5
|
-
}
|
|
6
|
-
getWcpContext() {
|
|
7
|
-
return this.container.resolve(WcpContext);
|
|
8
|
-
}
|
|
9
|
-
getRawLicense() {
|
|
10
|
-
return this.getWcpContext().getRawLicense();
|
|
11
|
-
}
|
|
12
|
-
getProject() {
|
|
13
|
-
return this.getWcpContext().getProject();
|
|
14
|
-
}
|
|
15
|
-
getProjectWithFeatureFlags() {
|
|
16
|
-
return this.getWcpContext().getProjectWithFeatureFlags();
|
|
17
|
-
}
|
|
18
|
-
getProjectLicense() {
|
|
19
|
-
return this.getWcpContext().getProjectLicense();
|
|
20
|
-
}
|
|
21
|
-
getProjectEnvironment() {
|
|
22
|
-
return this.getWcpContext().getProjectEnvironment();
|
|
23
|
-
}
|
|
24
|
-
canUseFeature(wcpFeatureId) {
|
|
25
|
-
return this.getWcpContext().canUseFeature(wcpFeatureId);
|
|
26
|
-
}
|
|
27
|
-
canUseAacl() {
|
|
28
|
-
return this.getWcpContext().canUseAacl();
|
|
29
|
-
}
|
|
30
|
-
canUseTeams() {
|
|
31
|
-
return this.getWcpContext().canUseTeams();
|
|
32
|
-
}
|
|
33
|
-
canUseFolderLevelPermissions() {
|
|
34
|
-
return this.getWcpContext().canUseFolderLevelPermissions();
|
|
35
|
-
}
|
|
36
|
-
canUsePrivateFiles() {
|
|
37
|
-
return this.getWcpContext().canUsePrivateFiles();
|
|
38
|
-
}
|
|
39
|
-
canUseAuditLogs() {
|
|
40
|
-
return this.getWcpContext().canUseAuditLogs();
|
|
41
|
-
}
|
|
42
|
-
canUseRecordLocking() {
|
|
43
|
-
return this.getWcpContext().canUseRecordLocking();
|
|
44
|
-
}
|
|
45
|
-
canUseFileManagerThreatDetection() {
|
|
46
|
-
return this.getWcpContext().canUseFileManagerThreatDetection();
|
|
47
|
-
}
|
|
48
|
-
canUseWorkflows() {
|
|
49
|
-
return this.getWcpContext().canUseWorkflows();
|
|
50
|
-
}
|
|
51
|
-
canUseHcmsFieldPermissions() {
|
|
52
|
-
return this.getWcpContext().canUseHcmsFieldPermissions();
|
|
53
|
-
}
|
|
54
|
-
canUseAiImageEnrichment() {
|
|
55
|
-
return this.getWcpContext().canUseAiImageEnrichment();
|
|
56
|
-
}
|
|
57
|
-
canUseAiPageGeneration() {
|
|
58
|
-
return this.getWcpContext().canUseAiPageGeneration();
|
|
59
|
-
}
|
|
60
|
-
canUseAiPageTranslation() {
|
|
61
|
-
return this.getWcpContext().canUseAiPageTranslation();
|
|
62
|
-
}
|
|
63
|
-
canUseAiLexicalGeneration() {
|
|
64
|
-
return this.getWcpContext().canUseAiLexicalGeneration();
|
|
65
|
-
}
|
|
66
|
-
canUseAiEntryGeneration() {
|
|
67
|
-
return this.getWcpContext().canUseAiEntryGeneration();
|
|
68
|
-
}
|
|
69
|
-
canUseAiEntryComparison() {
|
|
70
|
-
return this.getWcpContext().canUseAiEntryComparison();
|
|
71
|
-
}
|
|
72
|
-
canUseAiEntryTranslation() {
|
|
73
|
-
return this.getWcpContext().canUseAiEntryTranslation();
|
|
74
|
-
}
|
|
75
|
-
canUseAbTesting() {
|
|
76
|
-
return this.getWcpContext().canUseAbTesting();
|
|
77
|
-
}
|
|
78
|
-
ensureCanUseFeature(featureId) {
|
|
79
|
-
this.getWcpContext().ensureCanUseFeature(featureId);
|
|
80
|
-
}
|
|
81
|
-
async incrementSeats() {
|
|
82
|
-
await this.getWcpContext().incrementSeats();
|
|
83
|
-
}
|
|
84
|
-
async decrementSeats() {
|
|
85
|
-
await this.getWcpContext().decrementSeats();
|
|
86
|
-
}
|
|
87
|
-
async incrementTenants() {
|
|
88
|
-
await this.getWcpContext().incrementTenants();
|
|
89
|
-
}
|
|
90
|
-
async decrementTenants() {
|
|
91
|
-
await this.getWcpContext().decrementTenants();
|
|
92
|
-
}
|
|
93
|
-
toDto() {
|
|
94
|
-
return this.getWcpContext().toDto();
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
export { LegacyWcpContext };
|
|
98
|
-
|
|
99
|
-
//# sourceMappingURL=LegacyWcpContext.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"legacy/wcp/LegacyWcpContext.js","sources":["../../../src/legacy/wcp/LegacyWcpContext.ts"],"sourcesContent":["import { Container } from \"@webiny/di\";\nimport type { WCP_FEATURE_LABEL } from \"@webiny/wcp\";\nimport type {\n DecryptedWcpProjectLicense,\n ILicense,\n WcpProject,\n WcpProjectEnvironment\n} from \"@webiny/wcp/types.js\";\nimport { WcpContextObject } from \"~/features/wcp/WcpContext/types.js\";\nimport { WcpContext } from \"~/features/wcp/WcpContext/index.js\";\n\nexport class LegacyWcpContext implements WcpContextObject {\n constructor(private container: Container) {}\n\n private getWcpContext(): WcpContext.Interface {\n return this.container.resolve(WcpContext);\n }\n\n getRawLicense(): DecryptedWcpProjectLicense | null {\n return this.getWcpContext().getRawLicense();\n }\n\n getProject(): WcpProject | null {\n return this.getWcpContext().getProject();\n }\n\n getProjectWithFeatureFlags(): WcpProject | null {\n return this.getWcpContext().getProjectWithFeatureFlags();\n }\n\n getProjectLicense(): ILicense {\n return this.getWcpContext().getProjectLicense();\n }\n\n getProjectEnvironment(): WcpProjectEnvironment | null {\n return this.getWcpContext().getProjectEnvironment();\n }\n\n canUseFeature(wcpFeatureId: keyof typeof WCP_FEATURE_LABEL): boolean {\n return this.getWcpContext().canUseFeature(wcpFeatureId);\n }\n\n canUseAacl(): boolean {\n return this.getWcpContext().canUseAacl();\n }\n\n canUseTeams(): boolean {\n return this.getWcpContext().canUseTeams();\n }\n\n canUseFolderLevelPermissions(): boolean {\n return this.getWcpContext().canUseFolderLevelPermissions();\n }\n\n canUsePrivateFiles(): boolean {\n return this.getWcpContext().canUsePrivateFiles();\n }\n\n canUseAuditLogs(): boolean {\n return this.getWcpContext().canUseAuditLogs();\n }\n\n canUseRecordLocking(): boolean {\n return this.getWcpContext().canUseRecordLocking();\n }\n\n canUseFileManagerThreatDetection(): boolean {\n return this.getWcpContext().canUseFileManagerThreatDetection();\n }\n\n canUseWorkflows(): boolean {\n return this.getWcpContext().canUseWorkflows();\n }\n\n canUseHcmsFieldPermissions(): boolean {\n return this.getWcpContext().canUseHcmsFieldPermissions();\n }\n\n canUseAiImageEnrichment(): boolean {\n return this.getWcpContext().canUseAiImageEnrichment();\n }\n\n canUseAiPageGeneration(): boolean {\n return this.getWcpContext().canUseAiPageGeneration();\n }\n\n canUseAiPageTranslation(): boolean {\n return this.getWcpContext().canUseAiPageTranslation();\n }\n\n canUseAiLexicalGeneration(): boolean {\n return this.getWcpContext().canUseAiLexicalGeneration();\n }\n\n canUseAiEntryGeneration(): boolean {\n return this.getWcpContext().canUseAiEntryGeneration();\n }\n\n canUseAiEntryComparison(): boolean {\n return this.getWcpContext().canUseAiEntryComparison();\n }\n\n canUseAiEntryTranslation(): boolean {\n return this.getWcpContext().canUseAiEntryTranslation();\n }\n\n canUseAbTesting(): boolean {\n return this.getWcpContext().canUseAbTesting();\n }\n\n ensureCanUseFeature(featureId: keyof typeof WCP_FEATURE_LABEL): void {\n this.getWcpContext().ensureCanUseFeature(featureId);\n }\n\n async incrementSeats(): Promise<void> {\n await this.getWcpContext().incrementSeats();\n }\n\n async decrementSeats(): Promise<void> {\n await this.getWcpContext().decrementSeats();\n }\n\n async incrementTenants(): Promise<void> {\n await this.getWcpContext().incrementTenants();\n }\n\n async decrementTenants(): Promise<void> {\n await this.getWcpContext().decrementTenants();\n }\n\n toDto(): DecryptedWcpProjectLicense | null {\n return this.getWcpContext().toDto();\n }\n}\n"],"names":["LegacyWcpContext","container","WcpContext","wcpFeatureId","featureId"],"mappings":";AAWO,MAAMA;IACT,YAAoBC,SAAoB,CAAE;aAAtBA,SAAS,GAATA;IAAuB;IAEnC,gBAAsC;QAC1C,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAACC;IAClC;IAEA,gBAAmD;QAC/C,OAAO,IAAI,CAAC,aAAa,GAAG,aAAa;IAC7C;IAEA,aAAgC;QAC5B,OAAO,IAAI,CAAC,aAAa,GAAG,UAAU;IAC1C;IAEA,6BAAgD;QAC5C,OAAO,IAAI,CAAC,aAAa,GAAG,0BAA0B;IAC1D;IAEA,oBAA8B;QAC1B,OAAO,IAAI,CAAC,aAAa,GAAG,iBAAiB;IACjD;IAEA,wBAAsD;QAClD,OAAO,IAAI,CAAC,aAAa,GAAG,qBAAqB;IACrD;IAEA,cAAcC,YAA4C,EAAW;QACjE,OAAO,IAAI,CAAC,aAAa,GAAG,aAAa,CAACA;IAC9C;IAEA,aAAsB;QAClB,OAAO,IAAI,CAAC,aAAa,GAAG,UAAU;IAC1C;IAEA,cAAuB;QACnB,OAAO,IAAI,CAAC,aAAa,GAAG,WAAW;IAC3C;IAEA,+BAAwC;QACpC,OAAO,IAAI,CAAC,aAAa,GAAG,4BAA4B;IAC5D;IAEA,qBAA8B;QAC1B,OAAO,IAAI,CAAC,aAAa,GAAG,kBAAkB;IAClD;IAEA,kBAA2B;QACvB,OAAO,IAAI,CAAC,aAAa,GAAG,eAAe;IAC/C;IAEA,sBAA+B;QAC3B,OAAO,IAAI,CAAC,aAAa,GAAG,mBAAmB;IACnD;IAEA,mCAA4C;QACxC,OAAO,IAAI,CAAC,aAAa,GAAG,gCAAgC;IAChE;IAEA,kBAA2B;QACvB,OAAO,IAAI,CAAC,aAAa,GAAG,eAAe;IAC/C;IAEA,6BAAsC;QAClC,OAAO,IAAI,CAAC,aAAa,GAAG,0BAA0B;IAC1D;IAEA,0BAAmC;QAC/B,OAAO,IAAI,CAAC,aAAa,GAAG,uBAAuB;IACvD;IAEA,yBAAkC;QAC9B,OAAO,IAAI,CAAC,aAAa,GAAG,sBAAsB;IACtD;IAEA,0BAAmC;QAC/B,OAAO,IAAI,CAAC,aAAa,GAAG,uBAAuB;IACvD;IAEA,4BAAqC;QACjC,OAAO,IAAI,CAAC,aAAa,GAAG,yBAAyB;IACzD;IAEA,0BAAmC;QAC/B,OAAO,IAAI,CAAC,aAAa,GAAG,uBAAuB;IACvD;IAEA,0BAAmC;QAC/B,OAAO,IAAI,CAAC,aAAa,GAAG,uBAAuB;IACvD;IAEA,2BAAoC;QAChC,OAAO,IAAI,CAAC,aAAa,GAAG,wBAAwB;IACxD;IAEA,kBAA2B;QACvB,OAAO,IAAI,CAAC,aAAa,GAAG,eAAe;IAC/C;IAEA,oBAAoBC,SAAyC,EAAQ;QACjE,IAAI,CAAC,aAAa,GAAG,mBAAmB,CAACA;IAC7C;IAEA,MAAM,iBAAgC;QAClC,MAAM,IAAI,CAAC,aAAa,GAAG,cAAc;IAC7C;IAEA,MAAM,iBAAgC;QAClC,MAAM,IAAI,CAAC,aAAa,GAAG,cAAc;IAC7C;IAEA,MAAM,mBAAkC;QACpC,MAAM,IAAI,CAAC,aAAa,GAAG,gBAAgB;IAC/C;IAEA,MAAM,mBAAkC;QACpC,MAAM,IAAI,CAAC,aAAa,GAAG,gBAAgB;IAC/C;IAEA,QAA2C;QACvC,OAAO,IAAI,CAAC,aAAa,GAAG,KAAK;IACrC;AACJ"}
|
package/legacy/wcp/context.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { DecryptedWcpProjectLicense } from "@webiny/wcp/types.js";
|
|
2
|
-
export interface CreateWcpContextParams {
|
|
3
|
-
testProjectLicense?: DecryptedWcpProjectLicense;
|
|
4
|
-
}
|
|
5
|
-
export declare const createWcpContext: (params?: CreateWcpContextParams) => import("@webiny/handler/index.js").RegisterExtensionPlugin<import("@webiny/handler/types.js").Context>;
|
package/legacy/wcp/context.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { License, NullLicense, getWcpProjectEnvironment, getWcpProjectLicense } from "@webiny/wcp";
|
|
2
|
-
import { createRegisterExtensionPlugin } from "@webiny/handler/plugins/RegisterExtensionPlugin.js";
|
|
3
|
-
import { getWcpProjectLicenseCacheKey } from "../../features/wcp/WcpContext/utils.js";
|
|
4
|
-
import { WcpFeature } from "../../features/wcp/WcpFeature.js";
|
|
5
|
-
import { LegacyWcpContext } from "./LegacyWcpContext.js";
|
|
6
|
-
import { createWcpGraphQL } from "../../graphql/wcp/graphql.js";
|
|
7
|
-
const wcpProjectEnvironment = getWcpProjectEnvironment();
|
|
8
|
-
const cachedLicense = {
|
|
9
|
-
cacheKey: null,
|
|
10
|
-
project: null,
|
|
11
|
-
license: new NullLicense()
|
|
12
|
-
};
|
|
13
|
-
async function loadLicense(testProjectLicense) {
|
|
14
|
-
if (testProjectLicense) cachedLicense.license = License.fromLicenseDto(testProjectLicense);
|
|
15
|
-
else if (wcpProjectEnvironment) {
|
|
16
|
-
const currentCacheKey = getWcpProjectLicenseCacheKey();
|
|
17
|
-
if (cachedLicense.cacheKey !== currentCacheKey) {
|
|
18
|
-
cachedLicense.cacheKey = currentCacheKey;
|
|
19
|
-
const decryptedLicenseDto = await getWcpProjectLicense({
|
|
20
|
-
orgId: wcpProjectEnvironment.org.id,
|
|
21
|
-
projectId: wcpProjectEnvironment.project.id,
|
|
22
|
-
projectEnvironmentApiKey: wcpProjectEnvironment.apiKey
|
|
23
|
-
});
|
|
24
|
-
if (decryptedLicenseDto) cachedLicense.project = {
|
|
25
|
-
orgId: decryptedLicenseDto.orgId,
|
|
26
|
-
projectId: decryptedLicenseDto.projectId,
|
|
27
|
-
package: decryptedLicenseDto.package
|
|
28
|
-
};
|
|
29
|
-
cachedLicense.license = License.fromLicenseDto(decryptedLicenseDto);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
return cachedLicense.license;
|
|
33
|
-
}
|
|
34
|
-
const createWcpContext = (params = {})=>{
|
|
35
|
-
const plugin = createRegisterExtensionPlugin(async (context)=>{
|
|
36
|
-
const license = await loadLicense(params.testProjectLicense);
|
|
37
|
-
WcpFeature.register(context.container, license);
|
|
38
|
-
context.wcp = new LegacyWcpContext(context.container);
|
|
39
|
-
context.plugins.register(createWcpGraphQL());
|
|
40
|
-
});
|
|
41
|
-
plugin.name = "wcp.context.create";
|
|
42
|
-
return plugin;
|
|
43
|
-
};
|
|
44
|
-
export { createWcpContext };
|
|
45
|
-
|
|
46
|
-
//# sourceMappingURL=context.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"legacy/wcp/context.js","sources":["../../../src/legacy/wcp/context.ts"],"sourcesContent":["import { getWcpProjectLicense, getWcpProjectEnvironment, NullLicense } from \"@webiny/wcp\";\nimport type { DecryptedWcpProjectLicense, ILicense } from \"@webiny/wcp/types.js\";\nimport { License } from \"@webiny/wcp\";\nimport { createRegisterExtensionPlugin } from \"@webiny/handler/plugins/RegisterExtensionPlugin.js\";\nimport type { CachedWcpProjectLicense } from \"~/features/wcp/WcpContext/types.js\";\nimport { getWcpProjectLicenseCacheKey } from \"~/features/wcp/WcpContext/utils.js\";\nimport { WcpFeature } from \"~/features/wcp/WcpFeature.js\";\nimport { LegacyWcpContext } from \"./LegacyWcpContext.js\";\nimport { createWcpGraphQL } from \"~/graphql/wcp/graphql.js\";\n\nconst wcpProjectEnvironment = getWcpProjectEnvironment();\n\nconst cachedLicense: CachedWcpProjectLicense = {\n cacheKey: null,\n project: null,\n license: new NullLicense()\n};\n\nasync function loadLicense(testProjectLicense?: DecryptedWcpProjectLicense): Promise<ILicense> {\n if (testProjectLicense) {\n cachedLicense.license = License.fromLicenseDto(testProjectLicense);\n } else if (wcpProjectEnvironment) {\n const currentCacheKey = getWcpProjectLicenseCacheKey();\n if (cachedLicense.cacheKey !== currentCacheKey) {\n cachedLicense.cacheKey = currentCacheKey;\n // Pull the project license from the WCP API.\n const decryptedLicenseDto = await getWcpProjectLicense({\n orgId: wcpProjectEnvironment.org.id,\n projectId: wcpProjectEnvironment.project.id,\n projectEnvironmentApiKey: wcpProjectEnvironment.apiKey\n });\n\n if (decryptedLicenseDto) {\n cachedLicense.project = {\n orgId: decryptedLicenseDto.orgId,\n projectId: decryptedLicenseDto.projectId,\n package: decryptedLicenseDto.package\n };\n }\n\n cachedLicense.license = License.fromLicenseDto(decryptedLicenseDto);\n }\n }\n\n return cachedLicense.license;\n}\n\nexport interface CreateWcpContextParams {\n testProjectLicense?: DecryptedWcpProjectLicense;\n}\n\nexport const createWcpContext = (params: CreateWcpContextParams = {}) => {\n const plugin = createRegisterExtensionPlugin(async context => {\n const license = await loadLicense(params.testProjectLicense);\n\n WcpFeature.register(context.container, license);\n\n // @ts-expect-error This is a legacy property\n context.wcp = new LegacyWcpContext(context.container);\n\n context.plugins.register(createWcpGraphQL());\n });\n\n plugin.name = \"wcp.context.create\";\n\n return plugin;\n};\n"],"names":["wcpProjectEnvironment","getWcpProjectEnvironment","cachedLicense","NullLicense","loadLicense","testProjectLicense","License","currentCacheKey","getWcpProjectLicenseCacheKey","decryptedLicenseDto","getWcpProjectLicense","createWcpContext","params","plugin","createRegisterExtensionPlugin","context","license","WcpFeature","LegacyWcpContext","createWcpGraphQL"],"mappings":";;;;;;AAUA,MAAMA,wBAAwBC;AAE9B,MAAMC,gBAAyC;IAC3C,UAAU;IACV,SAAS;IACT,SAAS,IAAIC;AACjB;AAEA,eAAeC,YAAYC,kBAA+C;IACtE,IAAIA,oBACAH,cAAc,OAAO,GAAGI,QAAQ,cAAc,CAACD;SAC5C,IAAIL,uBAAuB;QAC9B,MAAMO,kBAAkBC;QACxB,IAAIN,cAAc,QAAQ,KAAKK,iBAAiB;YAC5CL,cAAc,QAAQ,GAAGK;YAEzB,MAAME,sBAAsB,MAAMC,qBAAqB;gBACnD,OAAOV,sBAAsB,GAAG,CAAC,EAAE;gBACnC,WAAWA,sBAAsB,OAAO,CAAC,EAAE;gBAC3C,0BAA0BA,sBAAsB,MAAM;YAC1D;YAEA,IAAIS,qBACAP,cAAc,OAAO,GAAG;gBACpB,OAAOO,oBAAoB,KAAK;gBAChC,WAAWA,oBAAoB,SAAS;gBACxC,SAASA,oBAAoB,OAAO;YACxC;YAGJP,cAAc,OAAO,GAAGI,QAAQ,cAAc,CAACG;QACnD;IACJ;IAEA,OAAOP,cAAc,OAAO;AAChC;AAMO,MAAMS,mBAAmB,CAACC,SAAiC,CAAC,CAAC;IAChE,MAAMC,SAASC,8BAA8B,OAAMC;QAC/C,MAAMC,UAAU,MAAMZ,YAAYQ,OAAO,kBAAkB;QAE3DK,WAAW,QAAQ,CAACF,QAAQ,SAAS,EAAEC;QAGvCD,QAAQ,GAAG,GAAG,IAAIG,iBAAiBH,QAAQ,SAAS;QAEpDA,QAAQ,OAAO,CAAC,QAAQ,CAACI;IAC7B;IAEAN,OAAO,IAAI,GAAG;IAEd,OAAOA;AACX"}
|