@webiny/api-core 6.6.0-alpha.0 → 6.6.0-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ApiCoreFeature.js +12 -2
- 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/tasks.d.ts +1 -0
- package/exports/api/tasks.js +1 -1
- package/exports/api.d.ts +1 -1
- package/exports/api.js +1 -1
- package/features/ai/Ai.d.ts +5 -1
- package/features/ai/Ai.js +72 -29
- 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/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 +102 -7
- package/features/ai/abstractions.js +6 -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 +12 -0
- package/features/ai/feature.js.map +1 -1
- package/features/ai/index.d.ts +5 -3
- package/features/ai/index.js +3 -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 +102 -0
- package/features/debugger/DebuggerRouteDecorator.js.map +1 -0
- package/features/debugger/GraphQLDebuggerTransport.d.ts +28 -0
- package/features/debugger/GraphQLDebuggerTransport.js +45 -0
- package/features/debugger/GraphQLDebuggerTransport.js.map +1 -0
- package/features/debugger/__tests__/matchNamespace.test.d.ts +1 -0
- package/features/debugger/__tests__/matchNamespace.test.js +68 -0
- package/features/debugger/__tests__/matchNamespace.test.js.map +1 -0
- package/features/debugger/__tests__/serialize.test.d.ts +1 -0
- package/features/debugger/__tests__/serialize.test.js +220 -0
- package/features/debugger/__tests__/serialize.test.js.map +1 -0
- package/features/debugger/abstractions.d.ts +100 -0
- package/features/debugger/abstractions.js +6 -0
- package/features/debugger/abstractions.js.map +1 -0
- package/features/debugger/feature.d.ts +5 -0
- package/features/debugger/feature.js +15 -0
- package/features/debugger/feature.js.map +1 -0
- package/features/debugger/index.d.ts +12 -0
- package/features/debugger/index.js +7 -0
- package/features/debugger/limits.d.ts +18 -0
- package/features/debugger/limits.js +11 -0
- package/features/debugger/limits.js.map +1 -0
- package/features/debugger/matchNamespace.d.ts +14 -0
- package/features/debugger/matchNamespace.js +35 -0
- package/features/debugger/matchNamespace.js.map +1 -0
- package/features/debugger/parseNamespaceHeader.d.ts +7 -0
- package/features/debugger/parseNamespaceHeader.js +16 -0
- package/features/debugger/parseNamespaceHeader.js.map +1 -0
- package/features/debugger/permissions.d.ts +14 -0
- package/features/debugger/permissions.js +8 -0
- package/features/debugger/permissions.js.map +1 -0
- package/features/debugger/permissionsSchema.d.ts +17 -0
- package/features/debugger/permissionsSchema.js +18 -0
- package/features/debugger/permissionsSchema.js.map +1 -0
- package/features/debugger/serialize.d.ts +11 -0
- package/features/debugger/serialize.js +121 -0
- package/features/debugger/serialize.js.map +1 -0
- package/features/encryption/BuildParamsEncryptionConfig.d.ts +13 -0
- package/features/encryption/BuildParamsEncryptionConfig.js +19 -0
- package/features/encryption/BuildParamsEncryptionConfig.js.map +1 -0
- package/features/encryption/EncryptionKeyCacheFeature.d.ts +8 -0
- package/features/encryption/EncryptionKeyCacheFeature.js +11 -0
- package/features/encryption/EncryptionKeyCacheFeature.js.map +1 -0
- package/features/encryption/EncryptionService.d.ts +3 -2
- package/features/encryption/EncryptionService.js +15 -13
- package/features/encryption/EncryptionService.js.map +1 -1
- package/features/encryption/MemoryEncryptionKeyCache.d.ts +13 -0
- package/features/encryption/MemoryEncryptionKeyCache.js +26 -0
- package/features/encryption/MemoryEncryptionKeyCache.js.map +1 -0
- package/features/encryption/abstractions.d.ts +26 -0
- package/features/encryption/abstractions.js +3 -1
- package/features/encryption/abstractions.js.map +1 -1
- package/features/encryption/feature.js +2 -0
- package/features/encryption/feature.js.map +1 -1
- package/features/encryption/index.d.ts +3 -0
- package/features/encryption/index.js +3 -1
- package/features/featureFlags/decorators/FeatureFlagsWithLicenseDecorator.d.ts +13 -0
- package/features/featureFlags/decorators/FeatureFlagsWithLicenseDecorator.js +61 -0
- package/features/featureFlags/decorators/FeatureFlagsWithLicenseDecorator.js.map +1 -0
- package/features/hashing/BuildParamsHashingConfig.d.ts +11 -0
- package/features/hashing/BuildParamsHashingConfig.js +18 -0
- package/features/hashing/BuildParamsHashingConfig.js.map +1 -0
- package/features/hashing/ScryptHasher.d.ts +2 -2
- package/features/hashing/ScryptHasher.js +6 -8
- package/features/hashing/ScryptHasher.js.map +1 -1
- package/features/hashing/abstractions.d.ts +15 -0
- package/features/hashing/abstractions.js +2 -1
- package/features/hashing/abstractions.js.map +1 -1
- package/features/hashing/feature.js +2 -0
- package/features/hashing/feature.js.map +1 -1
- package/features/hashing/index.d.ts +1 -0
- package/features/hashing/index.js +1 -1
- package/features/httpClient/HttpClient.d.ts +7 -0
- package/features/httpClient/HttpClient.js +72 -0
- package/features/httpClient/HttpClient.js.map +1 -0
- package/features/httpClient/HttpRequestError.d.ts +10 -0
- package/features/httpClient/HttpRequestError.js +13 -0
- package/features/httpClient/HttpRequestError.js.map +1 -0
- package/features/httpClient/HttpStatusError.d.ts +12 -0
- package/features/httpClient/HttpStatusError.js +12 -0
- package/features/httpClient/HttpStatusError.js.map +1 -0
- package/features/httpClient/abstractions.d.ts +32 -0
- package/features/httpClient/abstractions.js +5 -0
- package/features/httpClient/abstractions.js.map +1 -0
- package/features/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/logger/NullLogger.d.ts +10 -0
- package/features/logger/NullLogger.js +12 -0
- package/features/logger/NullLogger.js.map +1 -0
- package/features/logger/index.d.ts +1 -0
- package/features/logger/index.js +1 -0
- package/features/publicUrls/NullPublicUrls.d.ts +11 -0
- package/features/publicUrls/NullPublicUrls.js +17 -0
- package/features/publicUrls/NullPublicUrls.js.map +1 -0
- package/features/publicUrls/PublicUrl.d.ts +24 -0
- package/features/publicUrls/PublicUrl.js +43 -0
- package/features/publicUrls/PublicUrl.js.map +1 -0
- package/features/publicUrls/__tests__/PublicUrl.test.d.ts +1 -0
- package/features/publicUrls/__tests__/PublicUrl.test.js +38 -0
- package/features/publicUrls/__tests__/PublicUrl.test.js.map +1 -0
- package/features/publicUrls/__tests__/PublicUrls.test.d.ts +1 -0
- package/features/publicUrls/__tests__/PublicUrls.test.js +14 -0
- package/features/publicUrls/__tests__/PublicUrls.test.js.map +1 -0
- package/features/publicUrls/abstractions.d.ts +27 -0
- package/features/publicUrls/abstractions.js +5 -0
- package/features/publicUrls/abstractions.js.map +1 -0
- package/features/publicUrls/feature.d.ts +8 -0
- package/features/publicUrls/feature.js +11 -0
- package/features/publicUrls/feature.js.map +1 -0
- package/features/publicUrls/index.d.ts +3 -0
- package/features/publicUrls/index.js +3 -0
- package/features/requestContext/RawAssumePermissions.d.ts +14 -0
- package/features/requestContext/RawAssumePermissions.js +19 -0
- package/features/requestContext/RawAssumePermissions.js.map +1 -0
- package/features/requestContext/abstractions.d.ts +22 -0
- package/features/requestContext/abstractions.js +2 -1
- package/features/requestContext/abstractions.js.map +1 -1
- package/features/requestContext/extractAssumePermissions.d.ts +14 -0
- package/features/requestContext/extractAssumePermissions.js +32 -0
- package/features/requestContext/extractAssumePermissions.js.map +1 -0
- package/features/requestContext/feature.d.ts +2 -1
- package/features/requestContext/feature.js +2 -0
- package/features/requestContext/feature.js.map +1 -1
- package/features/requestContext/index.d.ts +3 -1
- package/features/requestContext/index.js +2 -1
- package/features/security/IdentityContext/IdentityContext.d.ts +8 -4
- package/features/security/IdentityContext/IdentityContext.js +28 -11
- package/features/security/IdentityContext/IdentityContext.js.map +1 -1
- package/features/security/IdentityContext/abstractions.d.ts +6 -1
- package/features/security/IdentityContext/abstractions.js.map +1 -1
- package/features/security/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 +7 -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/AuthorizationContext/AuthorizationContext.d.ts +13 -3
- package/features/security/authorization/AuthorizationContext/AuthorizationContext.js +35 -22
- package/features/security/authorization/AuthorizationContext/AuthorizationContext.js.map +1 -1
- package/features/security/authorization/AuthorizationContext/abstractions.d.ts +2 -0
- package/features/security/authorization/AuthorizationContext/abstractions.js.map +1 -1
- package/features/security/authorization/AuthorizationContext/feature.js +6 -1
- package/features/security/authorization/AuthorizationContext/feature.js.map +1 -1
- package/features/security/authorization/GroupsTeamsAuthorizer/AssumedPermissions.d.ts +30 -0
- package/features/security/authorization/GroupsTeamsAuthorizer/AssumedPermissions.js +60 -0
- package/features/security/authorization/GroupsTeamsAuthorizer/AssumedPermissions.js.map +1 -0
- package/features/security/authorization/GroupsTeamsAuthorizer/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/{logger → slugify}/feature.d.ts +1 -1
- 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/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 +5 -1
- package/features/tenancy/TenantContext/TenantContext.js +31 -23
- package/features/tenancy/TenantContext/TenantContext.js.map +1 -1
- package/features/users/shared/loaders.js.map +1 -1
- package/features/users/shared/types.d.ts +9 -7
- package/features/wcp/WcpContext/WcpContext.d.ts +11 -0
- package/features/wcp/WcpContext/WcpContext.js +33 -0
- package/features/wcp/WcpContext/WcpContext.js.map +1 -1
- package/features/wcp/WcpContext/decorators/WcpContextWithFeatureFlagsDecorator.d.ts +14 -60
- package/features/wcp/WcpContext/decorators/WcpContextWithFeatureFlagsDecorator.js +77 -25
- package/features/wcp/WcpContext/decorators/WcpContextWithFeatureFlagsDecorator.js.map +1 -1
- package/features/wcp/WcpFeature.js +2 -0
- 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 +6 -14
- package/features/wcp/WcpLicenseProvider.js +3 -7
- package/features/wcp/WcpLicenseProvider.js.map +1 -1
- 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 +1 -0
- package/graphql/ApiCoreSchemaFactory.js +7 -1
- package/graphql/ApiCoreSchemaFactory.js.map +1 -1
- 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/SecuritySchemaFactory.d.ts +1 -0
- package/graphql/security/SecuritySchemaFactory.js +4 -0
- package/graphql/security/SecuritySchemaFactory.js.map +1 -1
- package/graphql/system/SystemSchemaFactory.d.ts +1 -0
- package/graphql/system/SystemSchemaFactory.js +4 -0
- package/graphql/system/SystemSchemaFactory.js.map +1 -1
- package/graphql/users/UsersSchemaFactory.d.ts +1 -0
- package/graphql/users/UsersSchemaFactory.js +4 -0
- package/graphql/users/UsersSchemaFactory.js.map +1 -1
- package/graphql/wcp/WcpSchemaFactory.d.ts +1 -0
- package/graphql/wcp/WcpSchemaFactory.js +6 -0
- package/graphql/wcp/WcpSchemaFactory.js.map +1 -1
- package/idp/JwksCache.d.ts +14 -3
- package/idp/JwksCache.js +97 -17
- package/idp/JwksCache.js.map +1 -1
- package/idp/JwksStoreFeature.d.ts +8 -0
- package/idp/JwksStoreFeature.js +11 -0
- package/idp/JwksStoreFeature.js.map +1 -0
- package/idp/MemoryJwksStore.d.ts +14 -0
- package/idp/MemoryJwksStore.js +21 -0
- package/idp/MemoryJwksStore.js.map +1 -0
- package/idp/OidcJwtIdentityProvider.js +5 -1
- package/idp/OidcJwtIdentityProvider.js.map +1 -1
- package/idp/abstractions.d.ts +24 -0
- package/idp/abstractions.js +2 -1
- package/idp/abstractions.js.map +1 -1
- package/idp/feature.js +1 -2
- package/idp/feature.js.map +1 -1
- package/idp/index.d.ts +1 -0
- package/idp/index.js +1 -0
- package/package.json +22 -22
- package/testing/environment.d.ts +14 -0
- package/testing/environment.js +18 -0
- package/testing/environment.js.map +1 -0
- package/types/security.d.ts +1 -1
- package/types/users.d.ts +2 -3
- package/features/logger/LoggerService.d.ts +0 -14
- package/features/logger/LoggerService.js +0 -48
- package/features/logger/LoggerService.js.map +0 -1
- package/features/logger/feature.js +0 -11
- package/features/logger/feature.js.map +0 -1
- package/features/wcp/loadWcpLicense.d.ts +0 -2
- package/features/wcp/loadWcpLicense.js +0 -51
- package/features/wcp/loadWcpLicense.js.map +0 -1
package/idp/feature.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { createFeature } from "@webiny/feature/api";
|
|
2
2
|
import { JwtAuthenticator } from "./JwtAuthenticator.js";
|
|
3
|
-
import { JwkCache } from "./abstractions.js";
|
|
4
3
|
import { JwksCache } from "./JwksCache.js";
|
|
5
4
|
import { OidcJwtIdentityProvider } from "./OidcJwtIdentityProvider.js";
|
|
6
5
|
const IdpAuthenticatorFeature = createFeature({
|
|
@@ -8,7 +7,7 @@ const IdpAuthenticatorFeature = createFeature({
|
|
|
8
7
|
register (container) {
|
|
9
8
|
container.register(JwtAuthenticator);
|
|
10
9
|
container.register(OidcJwtIdentityProvider);
|
|
11
|
-
container.
|
|
10
|
+
container.register(JwksCache).inSingletonScope();
|
|
12
11
|
}
|
|
13
12
|
});
|
|
14
13
|
export { IdpAuthenticatorFeature };
|
package/idp/feature.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"idp/feature.js","sources":["../../src/idp/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { JwtAuthenticator } from \"./JwtAuthenticator.js\";\nimport {
|
|
1
|
+
{"version":3,"file":"idp/feature.js","sources":["../../src/idp/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { JwtAuthenticator } from \"./JwtAuthenticator.js\";\nimport { JwksCache } from \"./JwksCache.js\";\nimport { OidcJwtIdentityProvider } from \"~/idp/OidcJwtIdentityProvider.js\";\n\nexport const IdpAuthenticatorFeature = createFeature({\n name: \"IdpAuthenticator\",\n register(container) {\n container.register(JwtAuthenticator);\n container.register(OidcJwtIdentityProvider);\n /*\n * Per request. The keys outlive it through JwksStore, which belongs in the root container\n * (JwksStoreFeature).\n */\n container.register(JwksCache).inSingletonScope();\n }\n});\n"],"names":["IdpAuthenticatorFeature","createFeature","container","JwtAuthenticator","OidcJwtIdentityProvider","JwksCache"],"mappings":";;;;AAKO,MAAMA,0BAA0BC,cAAc;IACjD,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;QACnBD,UAAU,QAAQ,CAACE;QAKnBF,UAAU,QAAQ,CAACG,WAAW,gBAAgB;IAClD;AACJ"}
|
package/idp/index.d.ts
CHANGED
package/idp/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/api-core",
|
|
3
|
-
"version": "6.6.0-alpha.
|
|
3
|
+
"version": "6.6.0-alpha.10",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -14,36 +14,36 @@
|
|
|
14
14
|
"./*": "./*"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@ai-sdk/anthropic": "4.0.
|
|
18
|
-
"@ai-sdk/
|
|
19
|
-
"@
|
|
20
|
-
"@
|
|
21
|
-
"@webiny/
|
|
22
|
-
"@webiny/
|
|
23
|
-
"@webiny/
|
|
24
|
-
"@webiny/
|
|
25
|
-
"@webiny/handler": "6.6.0-alpha.
|
|
26
|
-
"@webiny/
|
|
27
|
-
"@webiny/
|
|
28
|
-
"
|
|
17
|
+
"@ai-sdk/anthropic": "4.0.94",
|
|
18
|
+
"@ai-sdk/google": "4.0.109",
|
|
19
|
+
"@ai-sdk/openai": "4.0.106",
|
|
20
|
+
"@openrouter/ai-sdk-provider": "3.1.0",
|
|
21
|
+
"@webiny/api": "6.6.0-alpha.10",
|
|
22
|
+
"@webiny/api-graphql": "6.6.0-alpha.10",
|
|
23
|
+
"@webiny/di": "2.0.0",
|
|
24
|
+
"@webiny/error": "6.6.0-alpha.10",
|
|
25
|
+
"@webiny/event-handler-core": "6.6.0-alpha.10",
|
|
26
|
+
"@webiny/feature": "6.6.0-alpha.10",
|
|
27
|
+
"@webiny/feature-flags": "6.6.0-alpha.10",
|
|
28
|
+
"@webiny/handler": "6.6.0-alpha.10",
|
|
29
|
+
"@webiny/utils": "6.6.0-alpha.10",
|
|
30
|
+
"@webiny/wcp": "6.6.0-alpha.10",
|
|
31
|
+
"ai": "7.0.159",
|
|
29
32
|
"dataloader": "2.2.3",
|
|
30
33
|
"graphql": "16.14.2",
|
|
31
|
-
"jose": "6.2.
|
|
34
|
+
"jose": "6.2.14",
|
|
32
35
|
"jsonwebtoken": "9.0.3",
|
|
33
36
|
"lodash": "4.18.1",
|
|
34
|
-
"minimatch": "
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"zod": "4.4.3"
|
|
37
|
+
"minimatch": "11.0.3",
|
|
38
|
+
"slugify": "1.6.9",
|
|
39
|
+
"zod": "4.6.7"
|
|
38
40
|
},
|
|
39
41
|
"devDependencies": {
|
|
40
42
|
"@types/jsonwebtoken": "9.0.10",
|
|
41
|
-
"@webiny/build-tools": "6.6.0-alpha.
|
|
42
|
-
"@webiny/event-handler-core": "6.6.0-alpha.0",
|
|
43
|
-
"@webiny/project-utils": "6.6.0-alpha.0",
|
|
43
|
+
"@webiny/build-tools": "6.6.0-alpha.10",
|
|
44
44
|
"rimraf": "6.1.3",
|
|
45
45
|
"typescript": "7.0.2",
|
|
46
|
-
"vitest": "
|
|
46
|
+
"vitest": "5.0.5"
|
|
47
47
|
},
|
|
48
48
|
"publishConfig": {
|
|
49
49
|
"access": "public"
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type Plugin<T = Record<string, any>> = {
|
|
2
|
+
type: string;
|
|
3
|
+
name?: string;
|
|
4
|
+
init?: () => void;
|
|
5
|
+
[key: string]: any;
|
|
6
|
+
} & T;
|
|
7
|
+
export type PluginCollection = (Plugin | PluginCollection)[];
|
|
8
|
+
export interface StorageOperations<T = any> {
|
|
9
|
+
storageOperations: T;
|
|
10
|
+
plugins: PluginCollection;
|
|
11
|
+
}
|
|
12
|
+
export declare const getStorageOps: <T = any>(app: string) => StorageOperations<T>;
|
|
13
|
+
export declare const setStorageOps: (app: string, factory: () => StorageOperations) => void;
|
|
14
|
+
export declare const clearStorageOps: () => void;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const getStorageOps = (app)=>{
|
|
2
|
+
const storageOps = globalThis["__storageOps"];
|
|
3
|
+
if (void 0 === storageOps) throw new Error("Storage ops are not configured!");
|
|
4
|
+
const appStorageOps = storageOps[app];
|
|
5
|
+
if (void 0 === appStorageOps) throw new Error(`Storage ops for "${app}" are not configured! Have you configured "jest.setup.js" correctly?`);
|
|
6
|
+
return appStorageOps();
|
|
7
|
+
};
|
|
8
|
+
const setStorageOps = (app, factory)=>{
|
|
9
|
+
const storageOps = globalThis["__storageOps"] || {};
|
|
10
|
+
storageOps[app] = factory;
|
|
11
|
+
globalThis["__storageOps"] = storageOps;
|
|
12
|
+
};
|
|
13
|
+
const clearStorageOps = ()=>{
|
|
14
|
+
delete globalThis["__storageOps"];
|
|
15
|
+
};
|
|
16
|
+
export { clearStorageOps, getStorageOps, setStorageOps };
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=environment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"testing/environment.js","sources":["../../src/testing/environment.ts"],"sourcesContent":["export type Plugin<T = Record<string, any>> = {\n type: string;\n name?: string;\n init?: () => void;\n [key: string]: any;\n} & T;\n\nexport type PluginCollection = (Plugin | PluginCollection)[];\n\nexport interface StorageOperations<T = any> {\n storageOperations: T;\n plugins: PluginCollection;\n}\n\nexport const getStorageOps = <T = any>(app: string): StorageOperations<T> => {\n const storageOps = (globalThis as Record<string, any>)[\"__storageOps\"];\n\n if (typeof storageOps === \"undefined\") {\n throw new Error(`Storage ops are not configured!`);\n }\n\n const appStorageOps = storageOps[app];\n if (typeof appStorageOps === \"undefined\") {\n throw new Error(\n `Storage ops for \"${app}\" are not configured! Have you configured \"jest.setup.js\" correctly?`\n );\n }\n\n return appStorageOps();\n};\n\nexport const setStorageOps = (app: string, factory: () => StorageOperations): void => {\n const storageOps = (globalThis as Record<string, any>)[\"__storageOps\"] || {};\n storageOps[app] = factory;\n (globalThis as Record<string, any>)[\"__storageOps\"] = storageOps;\n};\n\nexport const clearStorageOps = (): void => {\n delete (globalThis as Record<string, any>)[\"__storageOps\"];\n};\n"],"names":["getStorageOps","app","storageOps","globalThis","Error","appStorageOps","setStorageOps","factory","clearStorageOps"],"mappings":"AAcO,MAAMA,gBAAgB,CAAUC;IACnC,MAAMC,aAAcC,UAAkC,CAAC,eAAe;IAEtE,IAAI,AAAsB,WAAfD,YACP,MAAM,IAAIE,MAAM;IAGpB,MAAMC,gBAAgBH,UAAU,CAACD,IAAI;IACrC,IAAI,AAAyB,WAAlBI,eACP,MAAM,IAAID,MACN,CAAC,iBAAiB,EAAEH,IAAI,oEAAoE,CAAC;IAIrG,OAAOI;AACX;AAEO,MAAMC,gBAAgB,CAACL,KAAaM;IACvC,MAAML,aAAcC,UAAkC,CAAC,eAAe,IAAI,CAAC;IAC3ED,UAAU,CAACD,IAAI,GAAGM;IACjBJ,UAAkC,CAAC,eAAe,GAAGD;AAC1D;AAEO,MAAMM,kBAAkB;IAC3B,OAAQL,UAAkC,CAAC,eAAe;AAC9D"}
|
package/types/security.d.ts
CHANGED
package/types/users.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ListUsersWhere } from "../features/users/shared/types.js";
|
|
1
2
|
export interface CreatedBy {
|
|
2
3
|
id: string;
|
|
3
4
|
displayName: string | null;
|
|
@@ -35,9 +36,7 @@ export interface GetUserParams {
|
|
|
35
36
|
};
|
|
36
37
|
}
|
|
37
38
|
export interface ListUsersParams {
|
|
38
|
-
where?:
|
|
39
|
-
id_in?: string[];
|
|
40
|
-
};
|
|
39
|
+
where?: ListUsersWhere;
|
|
41
40
|
sort?: string[];
|
|
42
41
|
}
|
|
43
42
|
export interface StorageOperationsListUsersParams extends ListUsersParams {
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Logger as LoggerAbstraction } from "./abstractions.js";
|
|
2
|
-
export declare class LoggerImpl implements LoggerAbstraction.Interface {
|
|
3
|
-
private pinoLogger;
|
|
4
|
-
constructor();
|
|
5
|
-
trace(objOrMsg: object | string, ...args: any[]): void;
|
|
6
|
-
debug(objOrMsg: object | string, ...args: any[]): void;
|
|
7
|
-
info(objOrMsg: object | string, ...args: any[]): void;
|
|
8
|
-
warn(objOrMsg: object | string, ...args: any[]): void;
|
|
9
|
-
error(objOrMsg: object | string, ...args: any[]): void;
|
|
10
|
-
fatal(objOrMsg: object | string, ...args: any[]): void;
|
|
11
|
-
log(objOrMsg: object | string, ...args: any[]): void;
|
|
12
|
-
private getLogLevel;
|
|
13
|
-
}
|
|
14
|
-
export declare const Logger: import("@webiny/di").Implementation<typeof LoggerImpl>;
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { createImplementation } from "@webiny/feature/api";
|
|
2
|
-
import { pino } from "pino";
|
|
3
|
-
import { Logger } from "./abstractions.js";
|
|
4
|
-
import { StructuredLogFormatter, pinoLambdaDestination } from "pino-lambda";
|
|
5
|
-
const DEFAULT_LOG_LEVEL = "info";
|
|
6
|
-
class LoggerImpl {
|
|
7
|
-
constructor(){
|
|
8
|
-
const level = this.getLogLevel();
|
|
9
|
-
const destination = pinoLambdaDestination({
|
|
10
|
-
formatter: new StructuredLogFormatter()
|
|
11
|
-
});
|
|
12
|
-
this.pinoLogger = pino({
|
|
13
|
-
level
|
|
14
|
-
}, destination);
|
|
15
|
-
}
|
|
16
|
-
trace(objOrMsg, ...args) {
|
|
17
|
-
this.pinoLogger.trace(objOrMsg, ...args);
|
|
18
|
-
}
|
|
19
|
-
debug(objOrMsg, ...args) {
|
|
20
|
-
this.pinoLogger.debug(objOrMsg, ...args);
|
|
21
|
-
}
|
|
22
|
-
info(objOrMsg, ...args) {
|
|
23
|
-
this.pinoLogger.info(objOrMsg, ...args);
|
|
24
|
-
}
|
|
25
|
-
warn(objOrMsg, ...args) {
|
|
26
|
-
this.pinoLogger.warn(objOrMsg, ...args);
|
|
27
|
-
}
|
|
28
|
-
error(objOrMsg, ...args) {
|
|
29
|
-
this.pinoLogger.error(objOrMsg, ...args);
|
|
30
|
-
}
|
|
31
|
-
fatal(objOrMsg, ...args) {
|
|
32
|
-
this.pinoLogger.fatal(objOrMsg, ...args);
|
|
33
|
-
}
|
|
34
|
-
log(objOrMsg, ...args) {
|
|
35
|
-
this.pinoLogger.info(objOrMsg, ...args);
|
|
36
|
-
}
|
|
37
|
-
getLogLevel() {
|
|
38
|
-
return process.env.WEBINY_API_LOG_LEVEL || DEFAULT_LOG_LEVEL;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
const LoggerService_Logger = createImplementation({
|
|
42
|
-
abstraction: Logger,
|
|
43
|
-
implementation: LoggerImpl,
|
|
44
|
-
dependencies: []
|
|
45
|
-
});
|
|
46
|
-
export { LoggerImpl, LoggerService_Logger as Logger };
|
|
47
|
-
|
|
48
|
-
//# sourceMappingURL=LoggerService.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"features/logger/LoggerService.js","sources":["../../../src/features/logger/LoggerService.ts"],"sourcesContent":["import { createImplementation } from \"@webiny/feature/api\";\nimport { type Logger as PinoLogger, pino } from \"pino\";\nimport { Logger as LoggerAbstraction } from \"./abstractions.js\";\n\n// TODO: We have `pino-lambda` hardcoded here simply b/c of lack of good infrastructure.\n// We want `pino-lambda` for AWS Lambda, but its setup step relies on context of the Lambda function. That's\n// why we also have it hardcoded in `createHandler` function in `handler-aws` package.\n// Once we have a better infrastructure for handling such cases, we should refactor this.\nimport { pinoLambdaDestination, StructuredLogFormatter } from \"pino-lambda\";\n\nconst DEFAULT_LOG_LEVEL = \"info\";\n\nexport class LoggerImpl implements LoggerAbstraction.Interface {\n private pinoLogger: PinoLogger;\n\n constructor() {\n const level = this.getLogLevel();\n const destination = pinoLambdaDestination({\n formatter: new StructuredLogFormatter()\n });\n this.pinoLogger = pino({ level }, destination);\n }\n\n trace(objOrMsg: object | string, ...args: any[]) {\n this.pinoLogger.trace(objOrMsg, ...args);\n }\n\n debug(objOrMsg: object | string, ...args: any[]) {\n this.pinoLogger.debug(objOrMsg, ...args);\n }\n\n info(objOrMsg: object | string, ...args: any[]) {\n this.pinoLogger.info(objOrMsg, ...args);\n }\n\n warn(objOrMsg: object | string, ...args: any[]) {\n this.pinoLogger.warn(objOrMsg, ...args);\n }\n\n error(objOrMsg: object | string, ...args: any[]) {\n this.pinoLogger.error(objOrMsg, ...args);\n }\n\n fatal(objOrMsg: object | string, ...args: any[]) {\n this.pinoLogger.fatal(objOrMsg, ...args);\n }\n\n log(objOrMsg: object | string, ...args: any[]) {\n this.pinoLogger.info(objOrMsg, ...args);\n }\n\n private getLogLevel() {\n return process.env.WEBINY_API_LOG_LEVEL || DEFAULT_LOG_LEVEL;\n }\n}\n\nexport const Logger = createImplementation({\n abstraction: LoggerAbstraction,\n implementation: LoggerImpl,\n dependencies: []\n});\n"],"names":["DEFAULT_LOG_LEVEL","LoggerImpl","level","destination","pinoLambdaDestination","StructuredLogFormatter","pino","objOrMsg","args","process","Logger","createImplementation","LoggerAbstraction"],"mappings":";;;;AAUA,MAAMA,oBAAoB;AAEnB,MAAMC;IAGT,aAAc;QACV,MAAMC,QAAQ,IAAI,CAAC,WAAW;QAC9B,MAAMC,cAAcC,sBAAsB;YACtC,WAAW,IAAIC;QACnB;QACA,IAAI,CAAC,UAAU,GAAGC,KAAK;YAAEJ;QAAM,GAAGC;IACtC;IAEA,MAAMI,QAAyB,EAAE,GAAGC,IAAW,EAAE;QAC7C,IAAI,CAAC,UAAU,CAAC,KAAK,CAACD,aAAaC;IACvC;IAEA,MAAMD,QAAyB,EAAE,GAAGC,IAAW,EAAE;QAC7C,IAAI,CAAC,UAAU,CAAC,KAAK,CAACD,aAAaC;IACvC;IAEA,KAAKD,QAAyB,EAAE,GAAGC,IAAW,EAAE;QAC5C,IAAI,CAAC,UAAU,CAAC,IAAI,CAACD,aAAaC;IACtC;IAEA,KAAKD,QAAyB,EAAE,GAAGC,IAAW,EAAE;QAC5C,IAAI,CAAC,UAAU,CAAC,IAAI,CAACD,aAAaC;IACtC;IAEA,MAAMD,QAAyB,EAAE,GAAGC,IAAW,EAAE;QAC7C,IAAI,CAAC,UAAU,CAAC,KAAK,CAACD,aAAaC;IACvC;IAEA,MAAMD,QAAyB,EAAE,GAAGC,IAAW,EAAE;QAC7C,IAAI,CAAC,UAAU,CAAC,KAAK,CAACD,aAAaC;IACvC;IAEA,IAAID,QAAyB,EAAE,GAAGC,IAAW,EAAE;QAC3C,IAAI,CAAC,UAAU,CAAC,IAAI,CAACD,aAAaC;IACtC;IAEQ,cAAc;QAClB,OAAOC,QAAQ,GAAG,CAAC,oBAAoB,IAAIT;IAC/C;AACJ;AAEO,MAAMU,uBAASC,qBAAqB;IACvC,aAAaC;IACb,gBAAgBX;IAChB,cAAc,EAAE;AACpB"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { createFeature } from "@webiny/feature/api";
|
|
2
|
-
import { Logger } from "./LoggerService.js";
|
|
3
|
-
const LoggerFeature = createFeature({
|
|
4
|
-
name: "LoggerFeature",
|
|
5
|
-
register (container) {
|
|
6
|
-
container.register(Logger);
|
|
7
|
-
}
|
|
8
|
-
});
|
|
9
|
-
export { LoggerFeature };
|
|
10
|
-
|
|
11
|
-
//# sourceMappingURL=feature.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"features/logger/feature.js","sources":["../../../src/features/logger/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { Logger } from \"./LoggerService.js\";\n\nexport const LoggerFeature = createFeature({\n name: \"LoggerFeature\",\n register(container) {\n container.register(Logger);\n }\n});\n"],"names":["LoggerFeature","createFeature","container","Logger"],"mappings":";;AAGO,MAAMA,gBAAgBC,cAAc;IACvC,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;IACvB;AACJ"}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { License, NullLicense, getWcpProjectEnvironment, getWcpProjectLicense } from "@webiny/wcp";
|
|
2
|
-
import { getWcpProjectLicenseCacheKey } from "./WcpContext/utils.js";
|
|
3
|
-
function resolveWcpProjectEnvironment() {
|
|
4
|
-
const fromBlob = getWcpProjectEnvironment();
|
|
5
|
-
if (fromBlob) return fromBlob;
|
|
6
|
-
const projectId = process.env.WEBINY_PROJECT_ID || process.env.WCP_PROJECT_ID;
|
|
7
|
-
const apiKey = process.env.WEBINY_PROJECT_API_KEY || process.env.WCP_PROJECT_ENVIRONMENT_API_KEY;
|
|
8
|
-
if (!projectId || !apiKey) return null;
|
|
9
|
-
const [orgId, project] = projectId.split("/");
|
|
10
|
-
if (!orgId || !project) return null;
|
|
11
|
-
return {
|
|
12
|
-
id: "",
|
|
13
|
-
apiKey,
|
|
14
|
-
org: {
|
|
15
|
-
id: orgId
|
|
16
|
-
},
|
|
17
|
-
project: {
|
|
18
|
-
id: project
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
const wcpProjectEnvironment = resolveWcpProjectEnvironment();
|
|
23
|
-
const cachedLicense = {
|
|
24
|
-
cacheKey: null,
|
|
25
|
-
project: null,
|
|
26
|
-
license: new NullLicense()
|
|
27
|
-
};
|
|
28
|
-
async function loadWcpLicense(testProjectLicense) {
|
|
29
|
-
if (testProjectLicense) cachedLicense.license = License.fromLicenseDto(testProjectLicense);
|
|
30
|
-
else if (wcpProjectEnvironment) {
|
|
31
|
-
const currentCacheKey = getWcpProjectLicenseCacheKey();
|
|
32
|
-
if (cachedLicense.cacheKey !== currentCacheKey) {
|
|
33
|
-
cachedLicense.cacheKey = currentCacheKey;
|
|
34
|
-
const decryptedLicenseDto = await getWcpProjectLicense({
|
|
35
|
-
orgId: wcpProjectEnvironment.org.id,
|
|
36
|
-
projectId: wcpProjectEnvironment.project.id,
|
|
37
|
-
projectEnvironmentApiKey: wcpProjectEnvironment.apiKey
|
|
38
|
-
});
|
|
39
|
-
if (decryptedLicenseDto) cachedLicense.project = {
|
|
40
|
-
orgId: decryptedLicenseDto.orgId,
|
|
41
|
-
projectId: decryptedLicenseDto.projectId,
|
|
42
|
-
package: decryptedLicenseDto.package
|
|
43
|
-
};
|
|
44
|
-
cachedLicense.license = License.fromLicenseDto(decryptedLicenseDto);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
return cachedLicense.license;
|
|
48
|
-
}
|
|
49
|
-
export { loadWcpLicense };
|
|
50
|
-
|
|
51
|
-
//# sourceMappingURL=loadWcpLicense.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"features/wcp/loadWcpLicense.js","sources":["../../../src/features/wcp/loadWcpLicense.ts"],"sourcesContent":["import { getWcpProjectLicense, getWcpProjectEnvironment, NullLicense } from \"@webiny/wcp\";\nimport type {\n DecryptedWcpProjectLicense,\n ILicense,\n WcpProjectEnvironment\n} from \"@webiny/wcp/types.js\";\nimport { License } from \"@webiny/wcp\";\nimport type { CachedWcpProjectLicense } from \"~/features/wcp/WcpContext/types.js\";\nimport { getWcpProjectLicenseCacheKey } from \"~/features/wcp/WcpContext/utils.js\";\n\n/**\n * Resolve the WCP project environment used to fetch the license. Prefer the CLI-computed\n * WCP_PROJECT_ENVIRONMENT blob (set by `applyWcpEnvVars` during `webiny serve` and the AWS deploy).\n * When it's absent — a CLI-less self-hosted deploy that boots the built handler directly (e.g.\n * `node start.mjs`) — derive the same org, project and api key straight from the runtime env, so a\n * fresh license can still be fetched.\n */\nfunction resolveWcpProjectEnvironment(): WcpProjectEnvironment | null {\n const fromBlob = getWcpProjectEnvironment();\n if (fromBlob) {\n return fromBlob;\n }\n\n const projectId = process.env.WEBINY_PROJECT_ID || process.env.WCP_PROJECT_ID;\n const apiKey =\n process.env.WEBINY_PROJECT_API_KEY || process.env.WCP_PROJECT_ENVIRONMENT_API_KEY;\n if (!projectId || !apiKey) {\n return null;\n }\n\n // WEBINY_PROJECT_ID has an \"orgId/projectId\" shape.\n const [orgId, project] = projectId.split(\"/\");\n if (!orgId || !project) {\n return null;\n }\n\n // `id` is intentionally empty. The WCP backend identifies the specific project environment\n // from the api key (sent as the request's authorization header); the license fetch only uses\n // org/project (URL path) + apiKey (auth), never the environment id. So there's nothing to fill.\n return { id: \"\", apiKey, org: { id: orgId }, project: { id: project } };\n}\n\nconst wcpProjectEnvironment = resolveWcpProjectEnvironment();\n\nconst cachedLicense: CachedWcpProjectLicense = {\n cacheKey: null,\n project: null,\n license: new NullLicense()\n};\n\nexport async function loadWcpLicense(\n testProjectLicense?: DecryptedWcpProjectLicense\n): 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"],"names":["resolveWcpProjectEnvironment","fromBlob","getWcpProjectEnvironment","projectId","process","apiKey","orgId","project","wcpProjectEnvironment","cachedLicense","NullLicense","loadWcpLicense","testProjectLicense","License","currentCacheKey","getWcpProjectLicenseCacheKey","decryptedLicenseDto","getWcpProjectLicense"],"mappings":";;AAiBA,SAASA;IACL,MAAMC,WAAWC;IACjB,IAAID,UACA,OAAOA;IAGX,MAAME,YAAYC,QAAQ,GAAG,CAAC,iBAAiB,IAAIA,QAAQ,GAAG,CAAC,cAAc;IAC7E,MAAMC,SACFD,QAAQ,GAAG,CAAC,sBAAsB,IAAIA,QAAQ,GAAG,CAAC,+BAA+B;IACrF,IAAI,CAACD,aAAa,CAACE,QACf,OAAO;IAIX,MAAM,CAACC,OAAOC,QAAQ,GAAGJ,UAAU,KAAK,CAAC;IACzC,IAAI,CAACG,SAAS,CAACC,SACX,OAAO;IAMX,OAAO;QAAE,IAAI;QAAIF;QAAQ,KAAK;YAAE,IAAIC;QAAM;QAAG,SAAS;YAAE,IAAIC;QAAQ;IAAE;AAC1E;AAEA,MAAMC,wBAAwBR;AAE9B,MAAMS,gBAAyC;IAC3C,UAAU;IACV,SAAS;IACT,SAAS,IAAIC;AACjB;AAEO,eAAeC,eAClBC,kBAA+C;IAE/C,IAAIA,oBACAH,cAAc,OAAO,GAAGI,QAAQ,cAAc,CAACD;SAC5C,IAAIJ,uBAAuB;QAC9B,MAAMM,kBAAkBC;QACxB,IAAIN,cAAc,QAAQ,KAAKK,iBAAiB;YAC5CL,cAAc,QAAQ,GAAGK;YAEzB,MAAME,sBAAsB,MAAMC,qBAAqB;gBACnD,OAAOT,sBAAsB,GAAG,CAAC,EAAE;gBACnC,WAAWA,sBAAsB,OAAO,CAAC,EAAE;gBAC3C,0BAA0BA,sBAAsB,MAAM;YAC1D;YAEA,IAAIQ,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"}
|