@vtex/api 6.45.4
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/CHANGELOG.md +1685 -0
- package/README.md +65 -0
- package/gen/manifest.schema +189 -0
- package/lib/HttpClient/GraphQLClient.d.ts +28 -0
- package/lib/HttpClient/GraphQLClient.js +30 -0
- package/lib/HttpClient/HttpClient.d.ts +29 -0
- package/lib/HttpClient/HttpClient.js +130 -0
- package/lib/HttpClient/agents.d.ts +3 -0
- package/lib/HttpClient/agents.js +24 -0
- package/lib/HttpClient/index.d.ts +6 -0
- package/lib/HttpClient/index.js +14 -0
- package/lib/HttpClient/middlewares/cache.d.ts +35 -0
- package/lib/HttpClient/middlewares/cache.js +173 -0
- package/lib/HttpClient/middlewares/cancellationToken.d.ts +3 -0
- package/lib/HttpClient/middlewares/cancellationToken.js +72 -0
- package/lib/HttpClient/middlewares/inflight.d.ts +5 -0
- package/lib/HttpClient/middlewares/inflight.js +50 -0
- package/lib/HttpClient/middlewares/memoization.d.ts +7 -0
- package/lib/HttpClient/middlewares/memoization.js +40 -0
- package/lib/HttpClient/middlewares/metrics.d.ts +9 -0
- package/lib/HttpClient/middlewares/metrics.js +110 -0
- package/lib/HttpClient/middlewares/notFound.d.ts +7 -0
- package/lib/HttpClient/middlewares/notFound.js +20 -0
- package/lib/HttpClient/middlewares/recorder.d.ts +3 -0
- package/lib/HttpClient/middlewares/recorder.js +21 -0
- package/lib/HttpClient/middlewares/request/HttpAgentSingleton.d.ts +14 -0
- package/lib/HttpClient/middlewares/request/HttpAgentSingleton.js +37 -0
- package/lib/HttpClient/middlewares/request/index.d.ts +18 -0
- package/lib/HttpClient/middlewares/request/index.js +83 -0
- package/lib/HttpClient/middlewares/request/setupAxios/index.d.ts +1 -0
- package/lib/HttpClient/middlewares/request/setupAxios/index.js +20 -0
- package/lib/HttpClient/middlewares/request/setupAxios/interceptors/exponentialBackoff.d.ts +2 -0
- package/lib/HttpClient/middlewares/request/setupAxios/interceptors/exponentialBackoff.js +48 -0
- package/lib/HttpClient/middlewares/request/setupAxios/interceptors/index.d.ts +2 -0
- package/lib/HttpClient/middlewares/request/setupAxios/interceptors/index.js +7 -0
- package/lib/HttpClient/middlewares/request/setupAxios/interceptors/tracing/index.d.ts +8 -0
- package/lib/HttpClient/middlewares/request/setupAxios/interceptors/tracing/index.js +51 -0
- package/lib/HttpClient/middlewares/request/setupAxios/interceptors/tracing/spanSetup.d.ts +4 -0
- package/lib/HttpClient/middlewares/request/setupAxios/interceptors/tracing/spanSetup.js +29 -0
- package/lib/HttpClient/middlewares/tracing.d.ts +15 -0
- package/lib/HttpClient/middlewares/tracing.js +54 -0
- package/lib/HttpClient/typings.d.ts +123 -0
- package/lib/HttpClient/typings.js +11 -0
- package/lib/caches/CacheLayer.d.ts +7 -0
- package/lib/caches/CacheLayer.js +2 -0
- package/lib/caches/DiskCache.d.ts +17 -0
- package/lib/caches/DiskCache.js +70 -0
- package/lib/caches/LRUCache.d.ts +16 -0
- package/lib/caches/LRUCache.js +48 -0
- package/lib/caches/LRUDiskCache.d.ts +21 -0
- package/lib/caches/LRUDiskCache.js +132 -0
- package/lib/caches/MultilayeredCache.d.ts +14 -0
- package/lib/caches/MultilayeredCache.js +68 -0
- package/lib/caches/index.d.ts +6 -0
- package/lib/caches/index.js +9 -0
- package/lib/caches/typings.d.ts +48 -0
- package/lib/caches/typings.js +2 -0
- package/lib/clients/IOClient.d.ts +13 -0
- package/lib/clients/IOClient.js +19 -0
- package/lib/clients/IOClients.d.ts +37 -0
- package/lib/clients/IOClients.js +89 -0
- package/lib/clients/IOGraphQLClient.d.ts +13 -0
- package/lib/clients/IOGraphQLClient.js +16 -0
- package/lib/clients/apps/AppClient.d.ts +9 -0
- package/lib/clients/apps/AppClient.js +34 -0
- package/lib/clients/apps/AppGraphQLClient.d.ts +9 -0
- package/lib/clients/apps/AppGraphQLClient.js +34 -0
- package/lib/clients/apps/Billing.d.ts +12 -0
- package/lib/clients/apps/Billing.js +21 -0
- package/lib/clients/apps/Builder.d.ts +45 -0
- package/lib/clients/apps/Builder.js +114 -0
- package/lib/clients/apps/MessagesGraphQL.d.ts +61 -0
- package/lib/clients/apps/MessagesGraphQL.js +121 -0
- package/lib/clients/apps/Settings.d.ts +14 -0
- package/lib/clients/apps/Settings.js +38 -0
- package/lib/clients/apps/catalogGraphQL/brand.d.ts +13 -0
- package/lib/clients/apps/catalogGraphQL/brand.js +18 -0
- package/lib/clients/apps/catalogGraphQL/category.d.ts +11 -0
- package/lib/clients/apps/catalogGraphQL/category.js +16 -0
- package/lib/clients/apps/catalogGraphQL/index.d.ts +22 -0
- package/lib/clients/apps/catalogGraphQL/index.js +88 -0
- package/lib/clients/apps/catalogGraphQL/product.d.ts +25 -0
- package/lib/clients/apps/catalogGraphQL/product.js +30 -0
- package/lib/clients/apps/catalogGraphQL/sku.d.ts +26 -0
- package/lib/clients/apps/catalogGraphQL/sku.js +30 -0
- package/lib/clients/apps/index.d.ts +7 -0
- package/lib/clients/apps/index.js +12 -0
- package/lib/clients/external/ExternalClient.d.ts +9 -0
- package/lib/clients/external/ExternalClient.js +21 -0
- package/lib/clients/external/ID.d.ts +23 -0
- package/lib/clients/external/ID.js +60 -0
- package/lib/clients/external/Masterdata.d.ts +93 -0
- package/lib/clients/external/Masterdata.js +223 -0
- package/lib/clients/external/PaymentProvider.d.ts +31 -0
- package/lib/clients/external/PaymentProvider.js +42 -0
- package/lib/clients/external/index.d.ts +4 -0
- package/lib/clients/external/index.js +9 -0
- package/lib/clients/index.d.ts +9 -0
- package/lib/clients/index.js +17 -0
- package/lib/clients/infra/Apps.d.ts +88 -0
- package/lib/clients/infra/Apps.js +508 -0
- package/lib/clients/infra/Assets.d.ts +34 -0
- package/lib/clients/infra/Assets.js +165 -0
- package/lib/clients/infra/BillingMetrics.d.ts +13 -0
- package/lib/clients/infra/BillingMetrics.js +15 -0
- package/lib/clients/infra/Events.d.ts +12 -0
- package/lib/clients/infra/Events.js +33 -0
- package/lib/clients/infra/Housekeeper.d.ts +10 -0
- package/lib/clients/infra/Housekeeper.js +30 -0
- package/lib/clients/infra/InfraClient.d.ts +9 -0
- package/lib/clients/infra/InfraClient.js +34 -0
- package/lib/clients/infra/Metadata.d.ts +26 -0
- package/lib/clients/infra/Metadata.js +83 -0
- package/lib/clients/infra/Registry.d.ts +59 -0
- package/lib/clients/infra/Registry.js +207 -0
- package/lib/clients/infra/Router.d.ts +34 -0
- package/lib/clients/infra/Router.js +81 -0
- package/lib/clients/infra/Sphinx.d.ts +13 -0
- package/lib/clients/infra/Sphinx.js +29 -0
- package/lib/clients/infra/VBase.d.ts +60 -0
- package/lib/clients/infra/VBase.js +171 -0
- package/lib/clients/infra/Workspaces.d.ts +18 -0
- package/lib/clients/infra/Workspaces.js +65 -0
- package/lib/clients/infra/index.d.ts +12 -0
- package/lib/clients/infra/index.js +17 -0
- package/lib/clients/janus/JanusClient.d.ts +21 -0
- package/lib/clients/janus/JanusClient.js +30 -0
- package/lib/clients/janus/LicenseManager.d.ts +7 -0
- package/lib/clients/janus/LicenseManager.js +58 -0
- package/lib/clients/janus/Segment.d.ts +36 -0
- package/lib/clients/janus/Segment.js +79 -0
- package/lib/clients/janus/Session.d.ts +15 -0
- package/lib/clients/janus/Session.js +75 -0
- package/lib/clients/janus/Tenant.d.ts +29 -0
- package/lib/clients/janus/Tenant.js +28 -0
- package/lib/clients/janus/index.d.ts +5 -0
- package/lib/clients/janus/index.js +10 -0
- package/lib/constants.d.ts +59 -0
- package/lib/constants.js +65 -0
- package/lib/errors/AuthenticationError.d.ts +18 -0
- package/lib/errors/AuthenticationError.js +24 -0
- package/lib/errors/ForbiddenError.d.ts +18 -0
- package/lib/errors/ForbiddenError.js +24 -0
- package/lib/errors/NotFoundError.d.ts +18 -0
- package/lib/errors/NotFoundError.js +24 -0
- package/lib/errors/RequestCancelledError.d.ts +6 -0
- package/lib/errors/RequestCancelledError.js +11 -0
- package/lib/errors/ResolverError.d.ts +29 -0
- package/lib/errors/ResolverError.js +35 -0
- package/lib/errors/ResolverWarning.d.ts +21 -0
- package/lib/errors/ResolverWarning.js +28 -0
- package/lib/errors/TooManyRequestsError.d.ts +4 -0
- package/lib/errors/TooManyRequestsError.js +9 -0
- package/lib/errors/UserInputError.d.ts +18 -0
- package/lib/errors/UserInputError.js +24 -0
- package/lib/errors/customGraphQLError.d.ts +4 -0
- package/lib/errors/customGraphQLError.js +9 -0
- package/lib/errors/index.d.ts +8 -0
- package/lib/errors/index.js +13 -0
- package/lib/index.d.ts +17 -0
- package/lib/index.js +21 -0
- package/lib/metrics/MetricsAccumulator.d.ts +35 -0
- package/lib/metrics/MetricsAccumulator.js +125 -0
- package/lib/responses.d.ts +79 -0
- package/lib/responses.js +2 -0
- package/lib/service/index.d.ts +2 -0
- package/lib/service/index.js +30 -0
- package/lib/service/loaders.d.ts +8 -0
- package/lib/service/loaders.js +54 -0
- package/lib/service/logger/console.d.ts +10 -0
- package/lib/service/logger/console.js +36 -0
- package/lib/service/logger/index.d.ts +2 -0
- package/lib/service/logger/index.js +7 -0
- package/lib/service/logger/logger.d.ts +35 -0
- package/lib/service/logger/logger.js +73 -0
- package/lib/service/logger/metricsLogger.d.ts +40 -0
- package/lib/service/logger/metricsLogger.js +149 -0
- package/lib/service/master.d.ts +2 -0
- package/lib/service/master.js +91 -0
- package/lib/service/tracing/TracerSingleton.d.ts +7 -0
- package/lib/service/tracing/TracerSingleton.js +54 -0
- package/lib/service/tracing/metrics/MetricNames.d.ts +60 -0
- package/lib/service/tracing/metrics/MetricNames.js +44 -0
- package/lib/service/tracing/metrics/instruments.d.ts +9 -0
- package/lib/service/tracing/metrics/instruments.js +11 -0
- package/lib/service/tracing/metrics/measurers/EventLoopLagMeasurer.d.ts +9 -0
- package/lib/service/tracing/metrics/measurers/EventLoopLagMeasurer.js +25 -0
- package/lib/service/tracing/tracingMiddlewares.d.ts +5 -0
- package/lib/service/tracing/tracingMiddlewares.js +119 -0
- package/lib/service/worker/index.d.ts +11 -0
- package/lib/service/worker/index.js +193 -0
- package/lib/service/worker/listeners.d.ts +3 -0
- package/lib/service/worker/listeners.js +43 -0
- package/lib/service/worker/runtime/Service.d.ts +17 -0
- package/lib/service/worker/runtime/Service.js +23 -0
- package/lib/service/worker/runtime/builtIn/handlers.d.ts +4 -0
- package/lib/service/worker/runtime/builtIn/handlers.js +27 -0
- package/lib/service/worker/runtime/builtIn/middlewares.d.ts +4 -0
- package/lib/service/worker/runtime/builtIn/middlewares.js +40 -0
- package/lib/service/worker/runtime/events/index.d.ts +4 -0
- package/lib/service/worker/runtime/events/index.js +46 -0
- package/lib/service/worker/runtime/events/middlewares/body.d.ts +3 -0
- package/lib/service/worker/runtime/events/middlewares/body.js +22 -0
- package/lib/service/worker/runtime/events/middlewares/context.d.ts +3 -0
- package/lib/service/worker/runtime/events/middlewares/context.js +22 -0
- package/lib/service/worker/runtime/events/router.d.ts +2 -0
- package/lib/service/worker/runtime/events/router.js +27 -0
- package/lib/service/worker/runtime/graphql/index.d.ts +6 -0
- package/lib/service/worker/runtime/graphql/index.js +27 -0
- package/lib/service/worker/runtime/graphql/middlewares/context.d.ts +2 -0
- package/lib/service/worker/runtime/graphql/middlewares/context.js +16 -0
- package/lib/service/worker/runtime/graphql/middlewares/error.d.ts +2 -0
- package/lib/service/worker/runtime/graphql/middlewares/error.js +93 -0
- package/lib/service/worker/runtime/graphql/middlewares/query.d.ts +2 -0
- package/lib/service/worker/runtime/graphql/middlewares/query.js +52 -0
- package/lib/service/worker/runtime/graphql/middlewares/response.d.ts +2 -0
- package/lib/service/worker/runtime/graphql/middlewares/response.js +38 -0
- package/lib/service/worker/runtime/graphql/middlewares/run.d.ts +2 -0
- package/lib/service/worker/runtime/graphql/middlewares/run.js +19 -0
- package/lib/service/worker/runtime/graphql/middlewares/updateSchema.d.ts +4 -0
- package/lib/service/worker/runtime/graphql/middlewares/updateSchema.js +28 -0
- package/lib/service/worker/runtime/graphql/middlewares/upload.d.ts +4 -0
- package/lib/service/worker/runtime/graphql/middlewares/upload.js +12 -0
- package/lib/service/worker/runtime/graphql/schema/index.d.ts +7 -0
- package/lib/service/worker/runtime/graphql/schema/index.js +31 -0
- package/lib/service/worker/runtime/graphql/schema/messagesLoaderV2.d.ts +6 -0
- package/lib/service/worker/runtime/graphql/schema/messagesLoaderV2.js +79 -0
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/Auth.d.ts +6 -0
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/Auth.js +73 -0
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/CacheControl.d.ts +7 -0
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/CacheControl.js +37 -0
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/Deprecated.d.ts +11 -0
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/Deprecated.js +61 -0
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/Metric.d.ts +7 -0
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/Metric.js +40 -0
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/Sanitize.d.ts +9 -0
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/Sanitize.js +35 -0
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/Settings.d.ts +6 -0
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/Settings.js +34 -0
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/SmartCacheDirective.d.ts +6 -0
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/SmartCacheDirective.js +29 -0
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/TranslatableV2.d.ts +7 -0
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/TranslatableV2.js +39 -0
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/TranslateTo.d.ts +7 -0
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/TranslateTo.js +33 -0
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/index.d.ts +22 -0
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/index.js +36 -0
- package/lib/service/worker/runtime/graphql/schema/typeDefs/index.d.ts +7 -0
- package/lib/service/worker/runtime/graphql/schema/typeDefs/index.js +12 -0
- package/lib/service/worker/runtime/graphql/schema/typeDefs/ioUpload.d.ts +3 -0
- package/lib/service/worker/runtime/graphql/schema/typeDefs/ioUpload.js +16 -0
- package/lib/service/worker/runtime/graphql/schema/typeDefs/sanitizedString.d.ts +10 -0
- package/lib/service/worker/runtime/graphql/schema/typeDefs/sanitizedString.js +39 -0
- package/lib/service/worker/runtime/graphql/typings.d.ts +31 -0
- package/lib/service/worker/runtime/graphql/typings.js +2 -0
- package/lib/service/worker/runtime/graphql/utils/cacheControl.d.ts +1 -0
- package/lib/service/worker/runtime/graphql/utils/cacheControl.js +32 -0
- package/lib/service/worker/runtime/graphql/utils/error.d.ts +1 -0
- package/lib/service/worker/runtime/graphql/utils/error.js +76 -0
- package/lib/service/worker/runtime/graphql/utils/pathname.d.ts +1 -0
- package/lib/service/worker/runtime/graphql/utils/pathname.js +7 -0
- package/lib/service/worker/runtime/graphql/utils/translations.d.ts +14 -0
- package/lib/service/worker/runtime/graphql/utils/translations.js +38 -0
- package/lib/service/worker/runtime/http/index.d.ts +5 -0
- package/lib/service/worker/runtime/http/index.js +58 -0
- package/lib/service/worker/runtime/http/middlewares/authTokens.d.ts +3 -0
- package/lib/service/worker/runtime/http/middlewares/authTokens.js +12 -0
- package/lib/service/worker/runtime/http/middlewares/cancellationToken.d.ts +3 -0
- package/lib/service/worker/runtime/http/middlewares/cancellationToken.js +18 -0
- package/lib/service/worker/runtime/http/middlewares/clients.d.ts +4 -0
- package/lib/service/worker/runtime/http/middlewares/clients.js +12 -0
- package/lib/service/worker/runtime/http/middlewares/context.d.ts +4 -0
- package/lib/service/worker/runtime/http/middlewares/context.js +36 -0
- package/lib/service/worker/runtime/http/middlewares/error.d.ts +2 -0
- package/lib/service/worker/runtime/http/middlewares/error.js +84 -0
- package/lib/service/worker/runtime/http/middlewares/rateLimit.d.ts +6 -0
- package/lib/service/worker/runtime/http/middlewares/rateLimit.js +42 -0
- package/lib/service/worker/runtime/http/middlewares/requestStats.d.ts +17 -0
- package/lib/service/worker/runtime/http/middlewares/requestStats.js +40 -0
- package/lib/service/worker/runtime/http/middlewares/setCookie.d.ts +3 -0
- package/lib/service/worker/runtime/http/middlewares/setCookie.js +52 -0
- package/lib/service/worker/runtime/http/middlewares/settings.d.ts +9 -0
- package/lib/service/worker/runtime/http/middlewares/settings.js +43 -0
- package/lib/service/worker/runtime/http/middlewares/timings.d.ts +3 -0
- package/lib/service/worker/runtime/http/middlewares/timings.js +45 -0
- package/lib/service/worker/runtime/http/middlewares/vary.d.ts +3 -0
- package/lib/service/worker/runtime/http/middlewares/vary.js +52 -0
- package/lib/service/worker/runtime/http/router.d.ts +2 -0
- package/lib/service/worker/runtime/http/router.js +23 -0
- package/lib/service/worker/runtime/http/routes.d.ts +19 -0
- package/lib/service/worker/runtime/http/routes.js +12 -0
- package/lib/service/worker/runtime/method.d.ts +9 -0
- package/lib/service/worker/runtime/method.js +23 -0
- package/lib/service/worker/runtime/statusTrack.d.ts +14 -0
- package/lib/service/worker/runtime/statusTrack.js +37 -0
- package/lib/service/worker/runtime/typings.d.ts +172 -0
- package/lib/service/worker/runtime/typings.js +2 -0
- package/lib/service/worker/runtime/utils/compose.d.ts +5 -0
- package/lib/service/worker/runtime/utils/compose.js +11 -0
- package/lib/service/worker/runtime/utils/context.d.ts +2 -0
- package/lib/service/worker/runtime/utils/context.js +40 -0
- package/lib/service/worker/runtime/utils/diff.d.ts +12 -0
- package/lib/service/worker/runtime/utils/diff.js +21 -0
- package/lib/service/worker/runtime/utils/recorder.d.ts +8 -0
- package/lib/service/worker/runtime/utils/recorder.js +37 -0
- package/lib/service/worker/runtime/utils/toArray.d.ts +1 -0
- package/lib/service/worker/runtime/utils/toArray.js +3 -0
- package/lib/service/worker/runtime/utils/tokenBucket.d.ts +2 -0
- package/lib/service/worker/runtime/utils/tokenBucket.js +16 -0
- package/lib/tracing/LogEvents.d.ts +31 -0
- package/lib/tracing/LogEvents.js +3 -0
- package/lib/tracing/LogFields.d.ts +61 -0
- package/lib/tracing/LogFields.js +3 -0
- package/lib/tracing/Tags.d.ts +79 -0
- package/lib/tracing/Tags.js +7 -0
- package/lib/tracing/UserLandTracer.d.ts +27 -0
- package/lib/tracing/UserLandTracer.js +55 -0
- package/lib/tracing/errorReporting/ErrorReport.d.ts +31 -0
- package/lib/tracing/errorReporting/ErrorReport.js +61 -0
- package/lib/tracing/index.d.ts +9 -0
- package/lib/tracing/index.js +19 -0
- package/lib/tracing/spanReference/SpanReferenceTypes.d.ts +4 -0
- package/lib/tracing/spanReference/SpanReferenceTypes.js +7 -0
- package/lib/tracing/spanReference/createSpanReference.d.ts +3 -0
- package/lib/tracing/spanReference/createSpanReference.js +8 -0
- package/lib/tracing/utils.d.ts +13 -0
- package/lib/tracing/utils.js +40 -0
- package/lib/utils/MineWinsConflictsResolver.d.ts +28 -0
- package/lib/utils/MineWinsConflictsResolver.js +130 -0
- package/lib/utils/app.d.ts +23 -0
- package/lib/utils/app.js +48 -0
- package/lib/utils/appsStaleIfError.d.ts +11 -0
- package/lib/utils/appsStaleIfError.js +63 -0
- package/lib/utils/billingOptions.d.ts +36 -0
- package/lib/utils/billingOptions.js +9 -0
- package/lib/utils/binding.d.ts +13 -0
- package/lib/utils/binding.js +38 -0
- package/lib/utils/cancel.d.ts +3 -0
- package/lib/utils/cancel.js +12 -0
- package/lib/utils/domain.d.ts +1 -0
- package/lib/utils/domain.js +5 -0
- package/lib/utils/error.d.ts +8 -0
- package/lib/utils/error.js +94 -0
- package/lib/utils/index.d.ts +9 -0
- package/lib/utils/index.js +14 -0
- package/lib/utils/message.d.ts +25 -0
- package/lib/utils/message.js +23 -0
- package/lib/utils/renameBy.d.ts +1 -0
- package/lib/utils/renameBy.js +4 -0
- package/lib/utils/retry.d.ts +4 -0
- package/lib/utils/retry.js +32 -0
- package/lib/utils/status.d.ts +1 -0
- package/lib/utils/status.js +11 -0
- package/lib/utils/tenant.d.ts +5 -0
- package/lib/utils/tenant.js +6 -0
- package/lib/utils/throwOnGraphQLErrors.d.ts +2 -0
- package/lib/utils/throwOnGraphQLErrors.js +15 -0
- package/lib/utils/time.d.ts +31 -0
- package/lib/utils/time.js +118 -0
- package/package.json +127 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { CacheLayer } from './CacheLayer';
|
|
2
|
+
import { FetchResult, MultilayerStats } from './typings';
|
|
3
|
+
export declare class MultilayeredCache<K, V> implements CacheLayer<K, V> {
|
|
4
|
+
private caches;
|
|
5
|
+
private hits;
|
|
6
|
+
private total;
|
|
7
|
+
constructor(caches: Array<CacheLayer<K, V>>);
|
|
8
|
+
get: (key: K, fetcher?: (() => Promise<FetchResult<V>>) | undefined) => Promise<void | V>;
|
|
9
|
+
set: (key: K, value: V, maxAge?: number | undefined) => Promise<boolean>;
|
|
10
|
+
has: (key: K) => Promise<boolean>;
|
|
11
|
+
getStats: (name?: string) => MultilayerStats;
|
|
12
|
+
private findIndex;
|
|
13
|
+
private resetCounters;
|
|
14
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const ramda_1 = require("ramda");
|
|
4
|
+
class MultilayeredCache {
|
|
5
|
+
constructor(caches) {
|
|
6
|
+
this.caches = caches;
|
|
7
|
+
this.hits = 0;
|
|
8
|
+
this.total = 0;
|
|
9
|
+
this.get = async (key, fetcher) => {
|
|
10
|
+
let value;
|
|
11
|
+
let maxAge;
|
|
12
|
+
let successIndex = await this.findIndex(async (cache) => {
|
|
13
|
+
const [getValue, hasKey] = await Promise.all([cache.get(key), cache.has(key)]);
|
|
14
|
+
value = getValue;
|
|
15
|
+
return hasKey;
|
|
16
|
+
}, this.caches);
|
|
17
|
+
if (successIndex === -1) {
|
|
18
|
+
if (fetcher) {
|
|
19
|
+
const fetched = await fetcher();
|
|
20
|
+
value = fetched.value;
|
|
21
|
+
maxAge = fetched.maxAge;
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
successIndex = Infinity;
|
|
27
|
+
}
|
|
28
|
+
const failedCaches = ramda_1.slice(0, successIndex, this.caches);
|
|
29
|
+
const [firstPromise] = ramda_1.map(cache => cache.set(key, value, maxAge), failedCaches);
|
|
30
|
+
await firstPromise;
|
|
31
|
+
return value;
|
|
32
|
+
};
|
|
33
|
+
this.set = async (key, value, maxAge) => {
|
|
34
|
+
const isSet = await Promise.all(ramda_1.map(cache => cache.set(key, value, maxAge), this.caches));
|
|
35
|
+
return ramda_1.any(item => item, isSet);
|
|
36
|
+
};
|
|
37
|
+
this.has = async (key) => {
|
|
38
|
+
const hasList = await Promise.all(ramda_1.map(cache => cache.has(key), this.caches));
|
|
39
|
+
return ramda_1.any(item => item, hasList);
|
|
40
|
+
};
|
|
41
|
+
this.getStats = (name = 'multilayred-cache') => {
|
|
42
|
+
const multilayerStats = {
|
|
43
|
+
hitRate: this.total > 0 ? this.hits / this.total : undefined,
|
|
44
|
+
hits: this.hits,
|
|
45
|
+
name,
|
|
46
|
+
total: this.total,
|
|
47
|
+
};
|
|
48
|
+
this.resetCounters();
|
|
49
|
+
return multilayerStats;
|
|
50
|
+
};
|
|
51
|
+
this.findIndex = async (func, array) => {
|
|
52
|
+
this.total += 1;
|
|
53
|
+
for (let index = 0; index < array.length; index++) {
|
|
54
|
+
const hasKey = await func(array[index]);
|
|
55
|
+
if (hasKey) {
|
|
56
|
+
this.hits += 1;
|
|
57
|
+
return index;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return -1;
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
resetCounters() {
|
|
64
|
+
this.hits = 0;
|
|
65
|
+
this.total = 0;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
exports.MultilayeredCache = MultilayeredCache;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
function __export(m) {
|
|
3
|
+
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
|
4
|
+
}
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
__export(require("./DiskCache"));
|
|
7
|
+
__export(require("./LRUCache"));
|
|
8
|
+
__export(require("./LRUDiskCache"));
|
|
9
|
+
__export(require("./MultilayeredCache"));
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export declare type FetchResult<V> = {
|
|
2
|
+
value: V;
|
|
3
|
+
maxAge?: number;
|
|
4
|
+
};
|
|
5
|
+
export declare type DiskStats = {
|
|
6
|
+
hits: number;
|
|
7
|
+
total: number;
|
|
8
|
+
name: string;
|
|
9
|
+
};
|
|
10
|
+
export declare type LRUStats = {
|
|
11
|
+
itemCount: number;
|
|
12
|
+
length: number;
|
|
13
|
+
disposedItems: number;
|
|
14
|
+
hitRate: number | undefined;
|
|
15
|
+
hits: number;
|
|
16
|
+
max: number;
|
|
17
|
+
name: string;
|
|
18
|
+
total: number;
|
|
19
|
+
};
|
|
20
|
+
export declare type MultilayerStats = {
|
|
21
|
+
hitRate: number | undefined;
|
|
22
|
+
hits: number;
|
|
23
|
+
total: number;
|
|
24
|
+
name: string;
|
|
25
|
+
};
|
|
26
|
+
export declare type LRUDiskCacheOptions = {
|
|
27
|
+
/**
|
|
28
|
+
* The maximum size of the cache, checked by applying the length
|
|
29
|
+
* function to all values in the cache. Not setting this is kind of silly,
|
|
30
|
+
* since that's the whole purpose of this lib, but it defaults to `Infinity`.
|
|
31
|
+
*/
|
|
32
|
+
max?: number;
|
|
33
|
+
/**
|
|
34
|
+
* Maximum age in ms. Items are not pro-actively pruned out as they age,
|
|
35
|
+
* but if you try to get an item that is too old, it'll drop it and return
|
|
36
|
+
* undefined instead of giving it to you.
|
|
37
|
+
*/
|
|
38
|
+
maxAge?: number;
|
|
39
|
+
/**
|
|
40
|
+
* By default, if you set a `maxAge`, it'll only actually pull stale items
|
|
41
|
+
* out of the cache when you `get(key)`. (That is, it's not pre-emptively
|
|
42
|
+
* doing a `setTimeout` or anything.) If you set `stale:true`, it'll return
|
|
43
|
+
* the stale value before deleting it. If you don't set this, then it'll
|
|
44
|
+
* return `undefined` when you try to get a stale entry,
|
|
45
|
+
* as if it had already been deleted.
|
|
46
|
+
*/
|
|
47
|
+
stale?: boolean;
|
|
48
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IOContext } from '../service/worker/runtime/typings';
|
|
2
|
+
import { HttpClient } from '../HttpClient/HttpClient';
|
|
3
|
+
import { InstanceOptions } from '../HttpClient/typings';
|
|
4
|
+
export declare type IOClientConstructor = new (context: IOContext, options?: InstanceOptions) => IOClient;
|
|
5
|
+
/**
|
|
6
|
+
* A client that can be instantiated by the Serviceruntime layer.
|
|
7
|
+
*/
|
|
8
|
+
export declare class IOClient {
|
|
9
|
+
protected context: IOContext;
|
|
10
|
+
protected options?: InstanceOptions | undefined;
|
|
11
|
+
protected http: HttpClient;
|
|
12
|
+
constructor(context: IOContext, options?: InstanceOptions | undefined);
|
|
13
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const HttpClient_1 = require("../HttpClient/HttpClient");
|
|
4
|
+
/**
|
|
5
|
+
* A client that can be instantiated by the Serviceruntime layer.
|
|
6
|
+
*/
|
|
7
|
+
class IOClient {
|
|
8
|
+
constructor(context, options) {
|
|
9
|
+
this.context = context;
|
|
10
|
+
this.options = options;
|
|
11
|
+
this.http = new HttpClient_1.HttpClient({
|
|
12
|
+
name: this.constructor.name,
|
|
13
|
+
...context,
|
|
14
|
+
...options,
|
|
15
|
+
metrics: options && options.metrics,
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.IOClient = IOClient;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { InstanceOptions } from '../HttpClient';
|
|
2
|
+
import { IOContext } from '../service/worker/runtime/typings';
|
|
3
|
+
import { Billing, Builder, MessagesGraphQL, Settings } from './apps';
|
|
4
|
+
import { CatalogGraphQL } from './apps/catalogGraphQL/index';
|
|
5
|
+
import { ID, MasterData, PaymentProvider } from './external';
|
|
6
|
+
import { Apps, Assets, BillingMetrics, Events, Metadata, Registry, Router, VBase, Workspaces } from './infra';
|
|
7
|
+
import { IOClientConstructor } from './IOClient';
|
|
8
|
+
import { LicenseManager, Segment, Session, TenantClient } from './janus';
|
|
9
|
+
export declare type ClientsImplementation<T extends IOClients> = new (clientOptions: Record<string, InstanceOptions>, ctx: IOContext) => T;
|
|
10
|
+
export declare class IOClients {
|
|
11
|
+
private clientOptions;
|
|
12
|
+
private ctx;
|
|
13
|
+
private clients;
|
|
14
|
+
constructor(clientOptions: Record<string, InstanceOptions>, ctx: IOContext);
|
|
15
|
+
get apps(): Apps;
|
|
16
|
+
get assets(): Assets;
|
|
17
|
+
get billing(): Billing;
|
|
18
|
+
get billingMetrics(): BillingMetrics;
|
|
19
|
+
get builder(): Builder;
|
|
20
|
+
get events(): Events;
|
|
21
|
+
get id(): ID;
|
|
22
|
+
get licenseManager(): LicenseManager;
|
|
23
|
+
get masterdata(): MasterData;
|
|
24
|
+
get messagesGraphQL(): MessagesGraphQL;
|
|
25
|
+
get metadata(): Metadata;
|
|
26
|
+
get registry(): Registry;
|
|
27
|
+
get router(): Router;
|
|
28
|
+
get segment(): Segment;
|
|
29
|
+
get settings(): Settings;
|
|
30
|
+
get session(): Session;
|
|
31
|
+
get tenant(): TenantClient;
|
|
32
|
+
get vbase(): VBase;
|
|
33
|
+
get workspaces(): Workspaces;
|
|
34
|
+
get catalogGraphQL(): CatalogGraphQL;
|
|
35
|
+
get paymentProvider(): PaymentProvider;
|
|
36
|
+
protected getOrSet<TClient extends IOClientConstructor>(key: string, Implementation: TClient): InstanceType<TClient>;
|
|
37
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const apps_1 = require("./apps");
|
|
4
|
+
const index_1 = require("./apps/catalogGraphQL/index");
|
|
5
|
+
const external_1 = require("./external");
|
|
6
|
+
const infra_1 = require("./infra");
|
|
7
|
+
const janus_1 = require("./janus");
|
|
8
|
+
class IOClients {
|
|
9
|
+
constructor(clientOptions, ctx) {
|
|
10
|
+
this.clientOptions = clientOptions;
|
|
11
|
+
this.ctx = ctx;
|
|
12
|
+
this.clients = {};
|
|
13
|
+
}
|
|
14
|
+
get apps() {
|
|
15
|
+
return this.getOrSet('apps', infra_1.Apps);
|
|
16
|
+
}
|
|
17
|
+
get assets() {
|
|
18
|
+
return this.getOrSet('assets', infra_1.Assets);
|
|
19
|
+
}
|
|
20
|
+
get billing() {
|
|
21
|
+
return this.getOrSet('billing', apps_1.Billing);
|
|
22
|
+
}
|
|
23
|
+
get billingMetrics() {
|
|
24
|
+
return this.getOrSet('billingMetrics', infra_1.BillingMetrics);
|
|
25
|
+
}
|
|
26
|
+
get builder() {
|
|
27
|
+
return this.getOrSet('builder', apps_1.Builder);
|
|
28
|
+
}
|
|
29
|
+
get events() {
|
|
30
|
+
return this.getOrSet('events', infra_1.Events);
|
|
31
|
+
}
|
|
32
|
+
get id() {
|
|
33
|
+
return this.getOrSet('id', external_1.ID);
|
|
34
|
+
}
|
|
35
|
+
get licenseManager() {
|
|
36
|
+
return this.getOrSet('licenseManager', janus_1.LicenseManager);
|
|
37
|
+
}
|
|
38
|
+
get masterdata() {
|
|
39
|
+
return this.getOrSet('masterdata', external_1.MasterData);
|
|
40
|
+
}
|
|
41
|
+
get messagesGraphQL() {
|
|
42
|
+
return this.getOrSet('messagesGraphQL', apps_1.MessagesGraphQL);
|
|
43
|
+
}
|
|
44
|
+
get metadata() {
|
|
45
|
+
return this.getOrSet('metadata', infra_1.Metadata);
|
|
46
|
+
}
|
|
47
|
+
get registry() {
|
|
48
|
+
return this.getOrSet('registry', infra_1.Registry);
|
|
49
|
+
}
|
|
50
|
+
get router() {
|
|
51
|
+
return this.getOrSet('router', infra_1.Router);
|
|
52
|
+
}
|
|
53
|
+
get segment() {
|
|
54
|
+
return this.getOrSet('segment', janus_1.Segment);
|
|
55
|
+
}
|
|
56
|
+
get settings() {
|
|
57
|
+
return this.getOrSet('settings', apps_1.Settings);
|
|
58
|
+
}
|
|
59
|
+
get session() {
|
|
60
|
+
return this.getOrSet('session', janus_1.Session);
|
|
61
|
+
}
|
|
62
|
+
get tenant() {
|
|
63
|
+
return this.getOrSet('tenant', janus_1.TenantClient);
|
|
64
|
+
}
|
|
65
|
+
get vbase() {
|
|
66
|
+
return this.getOrSet('vbase', infra_1.VBase);
|
|
67
|
+
}
|
|
68
|
+
get workspaces() {
|
|
69
|
+
return this.getOrSet('workspaces', infra_1.Workspaces);
|
|
70
|
+
}
|
|
71
|
+
get catalogGraphQL() {
|
|
72
|
+
return this.getOrSet('catalogGraphQL', index_1.CatalogGraphQL);
|
|
73
|
+
}
|
|
74
|
+
get paymentProvider() {
|
|
75
|
+
return this.getOrSet('paymentProvider', external_1.PaymentProvider);
|
|
76
|
+
}
|
|
77
|
+
getOrSet(key, Implementation) {
|
|
78
|
+
const options = {
|
|
79
|
+
...this.clientOptions.default,
|
|
80
|
+
...this.clientOptions[key],
|
|
81
|
+
metrics,
|
|
82
|
+
};
|
|
83
|
+
if (!this.clients[key]) {
|
|
84
|
+
this.clients[key] = new Implementation(this.ctx, options);
|
|
85
|
+
}
|
|
86
|
+
return this.clients[key];
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
exports.IOClients = IOClients;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { GraphQLClient } from '../HttpClient/GraphQLClient';
|
|
2
|
+
import { InstanceOptions } from '../HttpClient/typings';
|
|
3
|
+
import { IOContext } from '../service/worker/runtime/typings';
|
|
4
|
+
import { IOClient } from './IOClient';
|
|
5
|
+
/**
|
|
6
|
+
* A GraphQL client that can be instantiated by the Serviceruntime layer.
|
|
7
|
+
*/
|
|
8
|
+
export declare class IOGraphQLClient extends IOClient {
|
|
9
|
+
protected context: IOContext;
|
|
10
|
+
protected options?: InstanceOptions | undefined;
|
|
11
|
+
protected graphql: GraphQLClient;
|
|
12
|
+
constructor(context: IOContext, options?: InstanceOptions | undefined);
|
|
13
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const GraphQLClient_1 = require("../HttpClient/GraphQLClient");
|
|
4
|
+
const IOClient_1 = require("./IOClient");
|
|
5
|
+
/**
|
|
6
|
+
* A GraphQL client that can be instantiated by the Serviceruntime layer.
|
|
7
|
+
*/
|
|
8
|
+
class IOGraphQLClient extends IOClient_1.IOClient {
|
|
9
|
+
constructor(context, options) {
|
|
10
|
+
super(context, options);
|
|
11
|
+
this.context = context;
|
|
12
|
+
this.options = options;
|
|
13
|
+
this.graphql = new GraphQLClient_1.GraphQLClient(this.http);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.IOGraphQLClient = IOGraphQLClient;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { InstanceOptions } from '../../HttpClient/typings';
|
|
2
|
+
import { IOContext } from '../../service/worker/runtime/typings';
|
|
3
|
+
import { IOClient } from '../IOClient';
|
|
4
|
+
/**
|
|
5
|
+
* Used to perform calls on apps you declared a dependency for in your manifest.
|
|
6
|
+
*/
|
|
7
|
+
export declare class AppClient extends IOClient {
|
|
8
|
+
constructor(app: string, context: IOContext, options?: InstanceOptions);
|
|
9
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const typings_1 = require("../../HttpClient/typings");
|
|
4
|
+
const routes_1 = require("../../service/worker/runtime/http/routes");
|
|
5
|
+
const IOClient_1 = require("../IOClient");
|
|
6
|
+
const useHttps = !process.env.VTEX_IO;
|
|
7
|
+
/**
|
|
8
|
+
* Used to perform calls on apps you declared a dependency for in your manifest.
|
|
9
|
+
*/
|
|
10
|
+
class AppClient extends IOClient_1.IOClient {
|
|
11
|
+
constructor(app, context, options) {
|
|
12
|
+
const { account, workspace, region } = context;
|
|
13
|
+
const [appName, appVersion] = app.split('@');
|
|
14
|
+
const [vendor, name] = appName.split('.'); // vtex.messages
|
|
15
|
+
const protocol = useHttps ? 'https' : 'http';
|
|
16
|
+
let baseURL;
|
|
17
|
+
if (appVersion) {
|
|
18
|
+
const [major] = appVersion.split('.');
|
|
19
|
+
baseURL = routes_1.formatPrivateRoute({ account, workspace, vendor, name, major, protocol });
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
console.warn(`${account} in ${workspace} is using old routing for ${app}. Please change vendor.app to vendor.app@major in client ${(options && options.name) || ''}`);
|
|
23
|
+
const service = [name, vendor].join('.'); // messages.vtex
|
|
24
|
+
baseURL = `http://${service}.${region}.vtex.io/${account}/${workspace}`;
|
|
25
|
+
}
|
|
26
|
+
super(context, {
|
|
27
|
+
...options,
|
|
28
|
+
authType: typings_1.AuthType.bearer,
|
|
29
|
+
baseURL,
|
|
30
|
+
name,
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.AppClient = AppClient;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { InstanceOptions } from '../../HttpClient/typings';
|
|
2
|
+
import { IOContext } from '../../service/worker/runtime/typings';
|
|
3
|
+
import { IOGraphQLClient } from '../IOGraphQLClient';
|
|
4
|
+
/**
|
|
5
|
+
* Used to perform calls on apps you declared a dependency for in your manifest.
|
|
6
|
+
*/
|
|
7
|
+
export declare class AppGraphQLClient extends IOGraphQLClient {
|
|
8
|
+
constructor(app: string, context: IOContext, options?: InstanceOptions);
|
|
9
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const typings_1 = require("../../HttpClient/typings");
|
|
4
|
+
const routes_1 = require("../../service/worker/runtime/http/routes");
|
|
5
|
+
const IOGraphQLClient_1 = require("../IOGraphQLClient");
|
|
6
|
+
const useHttps = !process.env.VTEX_IO;
|
|
7
|
+
/**
|
|
8
|
+
* Used to perform calls on apps you declared a dependency for in your manifest.
|
|
9
|
+
*/
|
|
10
|
+
class AppGraphQLClient extends IOGraphQLClient_1.IOGraphQLClient {
|
|
11
|
+
constructor(app, context, options) {
|
|
12
|
+
const { account, workspace, region } = context;
|
|
13
|
+
const [appName, appVersion] = app.split('@');
|
|
14
|
+
const [vendor, name] = appName.split('.'); // vtex.messages
|
|
15
|
+
const protocol = useHttps ? 'https' : 'http';
|
|
16
|
+
let baseURL;
|
|
17
|
+
if (appVersion) {
|
|
18
|
+
const [major] = appVersion.split('.');
|
|
19
|
+
baseURL = routes_1.formatPrivateRoute({ account, workspace, major, name, vendor, protocol, path: '/_v/graphql' });
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
console.warn(`${account} in ${workspace} is using old routing for ${app}. Please change vendor.app to vendor.app@major in client ${(options && options.name) || ''}`);
|
|
23
|
+
const service = [name, vendor].join('.'); // messages.vtex
|
|
24
|
+
baseURL = `http://${service}.${region}.vtex.io/${account}/${workspace}/_v/graphql`;
|
|
25
|
+
}
|
|
26
|
+
super(context, {
|
|
27
|
+
...options,
|
|
28
|
+
authType: typings_1.AuthType.bearer,
|
|
29
|
+
baseURL,
|
|
30
|
+
name,
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.AppGraphQLClient = AppGraphQLClient;
|