@vtex/api 6.48.1-beta → 6.48.1-beta.3
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/gen/manifest.schema +5 -3
- package/lib/HttpClient/GraphQLClient.d.ts +2 -1
- package/lib/HttpClient/GraphQLClient.js +5 -1
- package/lib/HttpClient/HttpClient.d.ts +6 -5
- package/lib/HttpClient/HttpClient.js +64 -21
- package/lib/HttpClient/agents.d.ts +3 -0
- package/lib/HttpClient/agents.js +37 -0
- package/lib/HttpClient/index.d.ts +1 -7
- package/lib/HttpClient/index.js +17 -16
- package/lib/HttpClient/middlewares/cache.d.ts +8 -2
- package/lib/HttpClient/middlewares/cache.js +126 -33
- package/lib/HttpClient/middlewares/cancellationToken.d.ts +1 -1
- package/lib/HttpClient/middlewares/cancellationToken.js +3 -1
- package/lib/HttpClient/middlewares/inflight.js +1 -0
- package/lib/HttpClient/middlewares/memoization.js +9 -1
- package/lib/HttpClient/middlewares/metrics.js +17 -31
- package/lib/HttpClient/middlewares/notFound.js +1 -0
- package/lib/HttpClient/middlewares/recorder.d.ts +1 -1
- package/lib/HttpClient/middlewares/recorder.js +20 -12
- package/lib/HttpClient/middlewares/request/HttpAgentSingleton.d.ts +11 -0
- package/lib/HttpClient/middlewares/request/HttpAgentSingleton.js +31 -0
- package/lib/HttpClient/middlewares/request/index.d.ts +18 -0
- package/lib/HttpClient/middlewares/request/index.js +85 -0
- package/lib/HttpClient/middlewares/request/setupAxios/index.d.ts +2 -0
- package/lib/HttpClient/middlewares/request/setupAxios/index.js +21 -0
- package/lib/HttpClient/middlewares/request/setupAxios/interceptors/exponentialBackoff.d.ts +2 -0
- package/lib/HttpClient/middlewares/request/setupAxios/interceptors/exponentialBackoff.js +54 -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 +56 -0
- package/lib/HttpClient/middlewares/request/setupAxios/interceptors/tracing/spanSetup.d.ts +4 -0
- package/lib/HttpClient/middlewares/request/setupAxios/interceptors/tracing/spanSetup.js +30 -0
- package/lib/HttpClient/middlewares/tracing.d.ts +15 -0
- package/lib/HttpClient/middlewares/tracing.js +61 -0
- package/lib/HttpClient/typings.d.ts +44 -10
- package/lib/HttpClient/typings.js +1 -0
- package/lib/caches/DiskCache.d.ts +1 -1
- package/lib/caches/DiskCache.js +1 -0
- package/lib/caches/LRUCache.d.ts +2 -2
- package/lib/caches/LRUCache.js +6 -1
- package/lib/caches/LRUDiskCache.d.ts +1 -1
- package/lib/caches/LRUDiskCache.js +6 -1
- package/lib/caches/MultilayeredCache.d.ts +1 -1
- package/lib/caches/MultilayeredCache.js +2 -1
- package/lib/caches/index.js +16 -7
- package/lib/{HttpClient → clients}/IOClient.d.ts +4 -4
- package/lib/clients/IOClient.js +20 -0
- package/lib/clients/IOClients.d.ts +28 -24
- package/lib/clients/IOClients.js +36 -28
- package/lib/{HttpClient → clients}/IOGraphQLClient.d.ts +4 -4
- package/lib/{HttpClient → clients}/IOGraphQLClient.js +3 -2
- package/lib/{HttpClient → clients/apps}/AppClient.d.ts +3 -3
- package/lib/{HttpClient → clients/apps}/AppClient.js +11 -5
- package/lib/{HttpClient → clients/apps}/AppGraphQLClient.d.ts +3 -3
- package/lib/{HttpClient → clients/apps}/AppGraphQLClient.js +11 -5
- package/lib/clients/apps/Billing.d.ts +12 -0
- package/lib/clients/{Billing.js → apps/Billing.js} +9 -3
- package/lib/clients/{Builder.d.ts → apps/Builder.d.ts} +12 -11
- package/lib/clients/{Builder.js → apps/Builder.js} +50 -22
- package/lib/clients/apps/MessagesGraphQL.d.ts +61 -0
- package/lib/clients/apps/MessagesGraphQL.js +122 -0
- package/lib/clients/{Settings.d.ts → apps/Settings.d.ts} +5 -4
- package/lib/clients/{Settings.js → apps/Settings.js} +15 -20
- package/lib/clients/apps/catalogGraphQL/brand.d.ts +13 -0
- package/lib/clients/apps/catalogGraphQL/brand.js +19 -0
- package/lib/clients/apps/catalogGraphQL/category.d.ts +11 -0
- package/lib/clients/apps/catalogGraphQL/category.js +17 -0
- package/lib/clients/apps/catalogGraphQL/index.d.ts +22 -0
- package/lib/clients/apps/catalogGraphQL/index.js +89 -0
- package/lib/clients/apps/catalogGraphQL/product.d.ts +25 -0
- package/lib/clients/apps/catalogGraphQL/product.js +31 -0
- package/lib/clients/apps/catalogGraphQL/sku.d.ts +26 -0
- package/lib/clients/apps/catalogGraphQL/sku.js +31 -0
- package/lib/clients/apps/index.d.ts +7 -0
- package/lib/clients/apps/index.js +19 -0
- package/lib/{HttpClient → clients/external}/ExternalClient.d.ts +3 -3
- package/lib/{HttpClient → clients/external}/ExternalClient.js +10 -2
- package/lib/clients/external/ID.d.ts +23 -0
- package/lib/clients/external/ID.js +61 -0
- package/lib/clients/external/Masterdata.d.ts +94 -0
- package/lib/clients/external/Masterdata.js +225 -0
- package/lib/clients/external/PaymentProvider.d.ts +31 -0
- package/lib/clients/external/PaymentProvider.js +43 -0
- package/lib/clients/external/index.d.ts +4 -0
- package/lib/clients/external/index.js +16 -0
- package/lib/clients/index.d.ts +9 -21
- package/lib/clients/index.js +23 -24
- package/lib/clients/infra/Apps.d.ts +88 -0
- package/lib/clients/infra/Apps.js +511 -0
- package/lib/clients/infra/Assets.d.ts +34 -0
- package/lib/clients/{Assets.js → infra/Assets.js} +75 -19
- package/lib/clients/infra/BillingMetrics.d.ts +13 -0
- package/lib/clients/infra/BillingMetrics.js +16 -0
- package/lib/clients/infra/Events.d.ts +12 -0
- package/lib/clients/infra/Events.js +34 -0
- package/lib/clients/infra/Housekeeper.d.ts +10 -0
- package/lib/clients/infra/Housekeeper.js +31 -0
- package/lib/{HttpClient → clients/infra}/InfraClient.d.ts +3 -3
- package/lib/{HttpClient → clients/infra}/InfraClient.js +10 -4
- package/lib/clients/infra/Registry.d.ts +59 -0
- package/lib/clients/{Registry.js → infra/Registry.js} +95 -33
- package/lib/clients/infra/Router.d.ts +34 -0
- package/lib/clients/infra/Router.js +82 -0
- package/lib/clients/infra/Sphinx.d.ts +13 -0
- package/lib/clients/infra/Sphinx.js +30 -0
- package/lib/clients/infra/VBase.d.ts +60 -0
- package/lib/clients/infra/VBase.js +197 -0
- package/lib/clients/infra/Workspaces.d.ts +18 -0
- package/lib/clients/infra/Workspaces.js +66 -0
- package/lib/clients/infra/index.d.ts +11 -0
- package/lib/clients/infra/index.js +23 -0
- package/lib/{HttpClient → clients/janus}/JanusClient.d.ts +3 -3
- package/lib/{HttpClient → clients/janus}/JanusClient.js +8 -3
- package/lib/clients/janus/LicenseManager.d.ts +7 -0
- package/lib/clients/{LicenseManager.js → janus/LicenseManager.js} +24 -8
- package/lib/clients/{Segment.d.ts → janus/Segment.d.ts} +7 -11
- package/lib/clients/janus/Segment.js +89 -0
- package/lib/clients/{Session.d.ts → janus/Session.d.ts} +4 -4
- package/lib/clients/{Session.js → janus/Session.js} +25 -13
- package/lib/clients/{Tenant.d.ts → janus/Tenant.d.ts} +6 -7
- package/lib/clients/janus/Tenant.js +29 -0
- package/lib/clients/janus/index.d.ts +5 -0
- package/lib/clients/janus/index.js +17 -0
- package/lib/constants.d.ts +49 -1
- package/lib/constants.js +55 -1
- package/lib/errors/AuthenticationError.js +1 -0
- package/lib/errors/ForbiddenError.js +1 -0
- package/lib/errors/NotFoundError.js +1 -0
- package/lib/errors/RequestCancelledError.js +1 -0
- package/lib/errors/ResolverError.d.ts +1 -1
- package/lib/errors/ResolverError.js +3 -2
- package/lib/errors/ResolverWarning.d.ts +1 -1
- package/lib/errors/ResolverWarning.js +3 -2
- package/lib/errors/TooManyRequestsError.js +1 -0
- package/lib/errors/UserInputError.js +1 -0
- package/lib/errors/index.js +18 -11
- package/lib/index.d.ts +9 -7
- package/lib/index.js +27 -16
- package/lib/metrics/MetricsAccumulator.d.ts +1 -18
- package/lib/metrics/MetricsAccumulator.js +39 -22
- package/lib/responses.d.ts +3 -44
- package/lib/service/index.d.ts +2 -0
- package/lib/service/index.js +34 -0
- package/lib/service/loaders.d.ts +8 -0
- package/lib/service/loaders.js +55 -0
- package/lib/service/logger/console.d.ts +10 -0
- package/lib/service/logger/console.js +37 -0
- package/lib/service/logger/index.d.ts +2 -28
- package/lib/service/logger/index.js +12 -68
- package/lib/service/logger/logger.d.ts +29 -0
- package/lib/service/logger/logger.js +62 -0
- package/lib/service/logger/metricsLogger.d.ts +40 -0
- package/lib/service/logger/metricsLogger.js +150 -0
- package/lib/service/master.d.ts +2 -0
- package/lib/service/master.js +88 -0
- package/lib/service/metrics/requestMetricsMiddleware.d.ts +2 -0
- package/lib/service/metrics/requestMetricsMiddleware.js +45 -0
- package/lib/service/tracing/TracerSingleton.d.ts +7 -0
- package/lib/service/tracing/TracerSingleton.js +49 -0
- package/lib/service/tracing/metrics/MetricNames.d.ts +60 -0
- package/lib/service/tracing/metrics/MetricNames.js +45 -0
- package/lib/service/tracing/metrics/instruments.d.ts +9 -0
- package/lib/service/tracing/metrics/instruments.js +12 -0
- package/lib/service/tracing/metrics/measurers/EventLoopLagMeasurer.d.ts +9 -0
- package/lib/service/tracing/metrics/measurers/EventLoopLagMeasurer.js +26 -0
- package/lib/service/tracing/tracingMiddlewares.d.ts +5 -0
- package/lib/service/tracing/tracingMiddlewares.js +114 -0
- package/lib/service/worker/index.d.ts +11 -0
- package/lib/service/worker/index.js +196 -0
- package/lib/service/worker/listeners.d.ts +3 -0
- package/lib/{utils/unhandled.js → service/worker/listeners.js} +10 -15
- package/lib/service/{Service.d.ts → worker/runtime/Service.d.ts} +5 -5
- package/lib/service/{Service.js → worker/runtime/Service.js} +3 -1
- package/lib/service/worker/runtime/builtIn/handlers.d.ts +4 -0
- package/lib/service/worker/runtime/builtIn/handlers.js +31 -0
- package/lib/service/worker/runtime/builtIn/middlewares.d.ts +4 -0
- package/lib/service/worker/runtime/builtIn/middlewares.js +41 -0
- package/lib/service/worker/runtime/events/index.d.ts +4 -0
- package/lib/service/worker/runtime/events/index.js +47 -0
- package/lib/service/worker/runtime/events/middlewares/body.d.ts +3 -0
- package/lib/service/worker/runtime/events/middlewares/body.js +26 -0
- package/lib/service/worker/runtime/events/middlewares/context.d.ts +3 -0
- package/lib/service/worker/runtime/events/middlewares/context.js +23 -0
- package/lib/service/worker/runtime/events/router.d.ts +2 -0
- package/lib/service/worker/runtime/events/router.js +28 -0
- package/lib/service/worker/runtime/graphql/index.d.ts +6 -0
- package/lib/service/worker/runtime/graphql/index.js +28 -0
- package/lib/service/worker/runtime/graphql/middlewares/context.d.ts +2 -0
- package/lib/service/worker/runtime/graphql/middlewares/context.js +17 -0
- package/lib/service/worker/runtime/graphql/middlewares/error.js +97 -0
- package/lib/service/worker/runtime/graphql/middlewares/query.d.ts +3 -0
- package/lib/service/worker/runtime/graphql/middlewares/query.js +53 -0
- package/lib/service/worker/runtime/graphql/middlewares/response.js +39 -0
- package/lib/service/worker/runtime/graphql/middlewares/run.d.ts +2 -0
- package/lib/service/worker/runtime/graphql/middlewares/run.js +20 -0
- package/lib/service/worker/runtime/graphql/middlewares/updateSchema.d.ts +5 -0
- package/lib/service/worker/runtime/graphql/middlewares/updateSchema.js +29 -0
- package/lib/service/worker/runtime/graphql/middlewares/upload.d.ts +4 -0
- package/lib/service/{graphql → worker/runtime/graphql}/middlewares/upload.js +1 -0
- package/lib/service/worker/runtime/graphql/schema/index.d.ts +7 -0
- package/lib/service/worker/runtime/graphql/schema/index.js +32 -0
- package/lib/service/worker/runtime/graphql/schema/messagesLoaderV2.d.ts +6 -0
- package/lib/service/worker/runtime/graphql/schema/messagesLoaderV2.js +80 -0
- package/lib/service/{graphql → worker/runtime/graphql}/schema/schemaDirectives/Auth.d.ts +1 -0
- package/lib/service/{graphql → worker/runtime/graphql}/schema/schemaDirectives/Auth.js +17 -10
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/CacheControl.d.ts +7 -0
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/CacheControl.js +38 -0
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/Deprecated.d.ts +11 -0
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/Deprecated.js +62 -0
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/Metric.d.ts +7 -0
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/Metric.js +41 -0
- package/lib/service/{graphql → worker/runtime/graphql}/schema/schemaDirectives/Sanitize.d.ts +1 -0
- package/lib/service/{graphql → worker/runtime/graphql}/schema/schemaDirectives/Sanitize.js +7 -0
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/Settings.d.ts +6 -0
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/Settings.js +35 -0
- package/lib/service/{graphql → worker/runtime/graphql}/schema/schemaDirectives/SmartCacheDirective.d.ts +1 -0
- package/lib/service/{graphql → worker/runtime/graphql}/schema/schemaDirectives/SmartCacheDirective.js +9 -3
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/TranslatableV2.d.ts +7 -0
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/TranslatableV2.js +40 -0
- package/lib/service/{graphql/schema/schemaDirectives/Translatable.d.ts → worker/runtime/graphql/schema/schemaDirectives/TranslateTo.d.ts} +2 -1
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/TranslateTo.js +34 -0
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/index.d.ts +22 -0
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/index.js +37 -0
- package/lib/service/worker/runtime/graphql/schema/typeDefs/index.d.ts +8 -0
- package/lib/service/worker/runtime/graphql/schema/typeDefs/index.js +13 -0
- package/lib/service/{graphql → worker/runtime/graphql}/schema/typeDefs/ioUpload.js +1 -0
- package/lib/service/{graphql → worker/runtime/graphql}/schema/typeDefs/sanitizedString.js +6 -1
- package/lib/service/worker/runtime/graphql/typings.d.ts +31 -0
- package/lib/service/worker/runtime/graphql/utils/cacheControl.d.ts +2 -0
- package/lib/service/worker/runtime/graphql/utils/cacheControl.js +33 -0
- package/lib/service/worker/runtime/graphql/utils/error.d.ts +2 -0
- package/lib/service/worker/runtime/graphql/utils/error.js +77 -0
- package/lib/service/{graphql → worker/runtime/graphql}/utils/pathname.js +1 -0
- package/lib/service/worker/runtime/graphql/utils/translations.d.ts +14 -0
- package/lib/service/worker/runtime/graphql/utils/translations.js +39 -0
- package/lib/service/worker/runtime/http/index.d.ts +5 -0
- package/lib/service/worker/runtime/http/index.js +59 -0
- package/lib/service/worker/runtime/http/middlewares/authTokens.d.ts +3 -0
- package/lib/service/{http → worker/runtime/http}/middlewares/authTokens.js +1 -0
- package/lib/service/worker/runtime/http/middlewares/cancellationToken.d.ts +3 -0
- package/lib/service/{http → worker/runtime/http}/middlewares/cancellationToken.js +3 -1
- package/lib/service/worker/runtime/http/middlewares/clients.d.ts +4 -0
- package/lib/service/{http → worker/runtime/http}/middlewares/clients.js +1 -0
- package/lib/service/worker/runtime/http/middlewares/context.d.ts +4 -0
- package/lib/service/worker/runtime/http/middlewares/context.js +37 -0
- package/lib/service/worker/runtime/http/middlewares/error.d.ts +2 -0
- package/lib/service/{http → worker/runtime/http}/middlewares/error.js +28 -15
- package/lib/service/worker/runtime/http/middlewares/rateLimit.d.ts +6 -0
- package/lib/service/worker/runtime/http/middlewares/rateLimit.js +43 -0
- package/lib/service/{http → worker/runtime/http}/middlewares/requestStats.d.ts +3 -3
- package/lib/service/{http → worker/runtime/http}/middlewares/requestStats.js +1 -0
- package/lib/service/worker/runtime/http/middlewares/setCookie.d.ts +3 -0
- package/lib/service/{http → worker/runtime/http}/middlewares/setCookie.js +1 -0
- package/lib/service/worker/runtime/http/middlewares/settings.d.ts +9 -0
- package/lib/service/worker/runtime/http/middlewares/settings.js +45 -0
- package/lib/service/worker/runtime/http/middlewares/timings.d.ts +3 -0
- package/lib/service/{http → worker/runtime/http}/middlewares/timings.js +22 -8
- package/lib/service/worker/runtime/http/middlewares/vary.d.ts +3 -0
- package/lib/service/{http → worker/runtime/http}/middlewares/vary.js +4 -3
- package/lib/service/worker/runtime/http/router.d.ts +2 -0
- package/lib/service/worker/runtime/http/router.js +24 -0
- package/lib/service/worker/runtime/http/routes.d.ts +19 -0
- package/lib/service/worker/runtime/http/routes.js +13 -0
- package/lib/service/worker/runtime/method.d.ts +9 -0
- package/lib/service/{method.js → worker/runtime/method.js} +1 -0
- package/lib/service/worker/runtime/statusTrack.d.ts +14 -0
- package/lib/service/worker/runtime/statusTrack.js +38 -0
- package/lib/service/{typings.d.ts → worker/runtime/typings.d.ts} +70 -36
- package/lib/service/worker/runtime/utils/compose.d.ts +5 -0
- package/lib/service/{utils → worker/runtime/utils}/compose.js +3 -2
- package/lib/service/worker/runtime/utils/context.d.ts +5 -0
- package/lib/service/worker/runtime/utils/context.js +41 -0
- package/lib/service/worker/runtime/utils/diff.d.ts +12 -0
- package/lib/service/worker/runtime/utils/diff.js +22 -0
- package/lib/service/worker/runtime/utils/recorder.d.ts +8 -0
- package/lib/service/worker/runtime/utils/recorder.js +38 -0
- package/lib/service/{graphql/utils/array.js → worker/runtime/utils/toArray.js} +1 -0
- package/lib/service/worker/runtime/utils/tokenBucket.d.ts +2 -0
- package/lib/service/worker/runtime/utils/tokenBucket.js +17 -0
- package/lib/tracing/LogEvents.d.ts +31 -0
- package/lib/tracing/LogEvents.js +3 -0
- package/lib/tracing/LogFields.d.ts +66 -0
- package/lib/tracing/LogFields.js +3 -0
- package/lib/tracing/Tags.d.ts +81 -0
- package/lib/tracing/Tags.js +8 -0
- package/lib/tracing/UserLandTracer.d.ts +27 -0
- package/lib/tracing/UserLandTracer.js +57 -0
- package/lib/tracing/errorReporting/ErrorReport.d.ts +31 -0
- package/lib/tracing/errorReporting/ErrorReport.js +71 -0
- package/lib/tracing/index.d.ts +9 -0
- package/lib/tracing/index.js +20 -0
- package/lib/tracing/spanReference/SpanReferenceTypes.d.ts +4 -0
- package/lib/tracing/spanReference/SpanReferenceTypes.js +8 -0
- package/lib/tracing/spanReference/createSpanReference.d.ts +3 -0
- package/lib/tracing/spanReference/createSpanReference.js +9 -0
- package/lib/tracing/utils.d.ts +13 -0
- package/lib/tracing/utils.js +41 -0
- package/lib/utils/MineWinsConflictsResolver.d.ts +6 -4
- package/lib/utils/MineWinsConflictsResolver.js +35 -17
- package/lib/utils/app.d.ts +3 -1
- package/lib/utils/app.js +4 -1
- package/lib/utils/appsStaleIfError.d.ts +1 -1
- package/lib/utils/appsStaleIfError.js +20 -7
- package/lib/utils/billingOptions.d.ts +36 -3
- package/lib/utils/billingOptions.js +8 -3
- package/lib/utils/binding.d.ts +3 -3
- package/lib/utils/binding.js +1 -0
- package/lib/utils/buildFullPath.d.ts +11 -0
- package/lib/utils/buildFullPath.js +54 -0
- package/lib/utils/cancel.d.ts +2 -2
- package/lib/utils/cancel.js +3 -1
- package/lib/utils/conflicts.mock.d.ts +17 -0
- package/lib/utils/conflicts.mock.js +28 -0
- package/lib/utils/domain.js +1 -0
- package/lib/utils/error.js +1 -0
- package/lib/utils/index.js +19 -12
- package/lib/utils/json.js +1 -0
- package/lib/utils/log.d.ts +1 -3
- package/lib/utils/log.js +3 -2
- package/lib/utils/message.js +5 -1
- package/lib/utils/renameBy.js +1 -0
- package/lib/utils/retry.js +3 -2
- package/lib/utils/status.js +1 -0
- package/lib/utils/tenant.d.ts +3 -3
- package/lib/utils/tenant.js +1 -0
- package/lib/utils/throwOnGraphQLErrors.js +1 -0
- package/lib/utils/time.d.ts +7 -7
- package/lib/utils/time.js +10 -2
- package/package.json +3 -3
- package/lib/HttpClient/IOClient.js +0 -14
- package/lib/HttpClient/factories/index.d.ts +0 -8
- package/lib/HttpClient/factories/index.js +0 -31
- package/lib/HttpClient/middlewares/request.d.ts +0 -10
- package/lib/HttpClient/middlewares/request.js +0 -87
- package/lib/IODataSource.d.ts +0 -27
- package/lib/IODataSource.js +0 -46
- package/lib/clients/Apps.d.ts +0 -84
- package/lib/clients/Apps.js +0 -326
- package/lib/clients/Assets.d.ts +0 -21
- package/lib/clients/Billing.d.ts +0 -11
- package/lib/clients/BillingMetrics.d.ts +0 -12
- package/lib/clients/BillingMetrics.js +0 -10
- package/lib/clients/Events.d.ts +0 -6
- package/lib/clients/Events.js +0 -19
- package/lib/clients/Housekeeper.d.ts +0 -11
- package/lib/clients/Housekeeper.js +0 -24
- package/lib/clients/ID.d.ts +0 -22
- package/lib/clients/ID.js +0 -48
- package/lib/clients/LicenseManager.d.ts +0 -6
- package/lib/clients/Logger.d.ts +0 -27
- package/lib/clients/Logger.js +0 -32
- package/lib/clients/Messages.d.ts +0 -18
- package/lib/clients/Messages.js +0 -20
- package/lib/clients/MessagesGraphQL.d.ts +0 -63
- package/lib/clients/MessagesGraphQL.js +0 -50
- package/lib/clients/Metadata.d.ts +0 -25
- package/lib/clients/Metadata.js +0 -53
- package/lib/clients/Registry.d.ts +0 -61
- package/lib/clients/Router.d.ts +0 -33
- package/lib/clients/Router.js +0 -50
- package/lib/clients/Segment.js +0 -69
- package/lib/clients/Sphinx.d.ts +0 -12
- package/lib/clients/Sphinx.js +0 -19
- package/lib/clients/Tenant.js +0 -13
- package/lib/clients/VBase.d.ts +0 -57
- package/lib/clients/VBase.js +0 -116
- package/lib/clients/Workspaces.d.ts +0 -17
- package/lib/clients/Workspaces.js +0 -38
- package/lib/service/Runtime.d.ts +0 -18
- package/lib/service/Runtime.js +0 -57
- package/lib/service/events/index.d.ts +0 -3
- package/lib/service/events/index.js +0 -21
- package/lib/service/graphql/index.d.ts +0 -7
- package/lib/service/graphql/index.js +0 -33
- package/lib/service/graphql/middlewares/error.js +0 -107
- package/lib/service/graphql/middlewares/formatters.d.ts +0 -2
- package/lib/service/graphql/middlewares/formatters.js +0 -64
- package/lib/service/graphql/middlewares/query.d.ts +0 -2
- package/lib/service/graphql/middlewares/query.js +0 -32
- package/lib/service/graphql/middlewares/response.js +0 -36
- package/lib/service/graphql/middlewares/run.d.ts +0 -4
- package/lib/service/graphql/middlewares/run.js +0 -55
- package/lib/service/graphql/middlewares/schema.d.ts +0 -2
- package/lib/service/graphql/middlewares/schema.js +0 -8
- package/lib/service/graphql/middlewares/timings.d.ts +0 -2
- package/lib/service/graphql/middlewares/timings.js +0 -10
- package/lib/service/graphql/middlewares/upload.d.ts +0 -7
- package/lib/service/graphql/schema/index.d.ts +0 -3
- package/lib/service/graphql/schema/index.js +0 -66
- package/lib/service/graphql/schema/messagesLoader.d.ts +0 -4
- package/lib/service/graphql/schema/messagesLoader.js +0 -41
- package/lib/service/graphql/schema/messagesLoaderV2.d.ts +0 -5
- package/lib/service/graphql/schema/messagesLoaderV2.js +0 -44
- package/lib/service/graphql/schema/schemaDirectives/Translatable.js +0 -54
- package/lib/service/graphql/schema/schemaDirectives/TranslatableV2.d.ts +0 -13
- package/lib/service/graphql/schema/schemaDirectives/TranslatableV2.js +0 -67
- package/lib/service/graphql/schema/schemaDirectives/index.d.ts +0 -13
- package/lib/service/graphql/schema/schemaDirectives/index.js +0 -17
- package/lib/service/graphql/schema/typeDefs/index.d.ts +0 -16
- package/lib/service/graphql/schema/typeDefs/index.js +0 -21
- package/lib/service/graphql/schema/typeDefs/ioMessage.d.ts +0 -8
- package/lib/service/graphql/schema/typeDefs/ioMessage.js +0 -33
- package/lib/service/graphql/typings.d.ts +0 -21
- package/lib/service/graphql/utils/cacheControl.d.ts +0 -6
- package/lib/service/graphql/utils/cacheControl.js +0 -38
- package/lib/service/graphql/utils/maxAgeEnum.d.ts +0 -6
- package/lib/service/graphql/utils/maxAgeEnum.js +0 -17
- package/lib/service/http/index.d.ts +0 -3
- package/lib/service/http/index.js +0 -18
- package/lib/service/http/middlewares/authTokens.d.ts +0 -3
- package/lib/service/http/middlewares/cancellationToken.d.ts +0 -3
- package/lib/service/http/middlewares/clients.d.ts +0 -4
- package/lib/service/http/middlewares/error.d.ts +0 -3
- package/lib/service/http/middlewares/setCookie.d.ts +0 -3
- package/lib/service/http/middlewares/timings.d.ts +0 -3
- package/lib/service/http/middlewares/vary.d.ts +0 -3
- package/lib/service/method.d.ts +0 -9
- package/lib/service/utils/compose.d.ts +0 -4
- package/lib/utils/MineWinsConflictsResolver.test.d.ts +0 -1
- package/lib/utils/MineWinsConflictsResolver.test.js +0 -134
- package/lib/utils/unhandled.d.ts +0 -1
- /package/lib/service/{graphql → worker/runtime/graphql}/middlewares/error.d.ts +0 -0
- /package/lib/service/{graphql → worker/runtime/graphql}/middlewares/response.d.ts +0 -0
- /package/lib/service/{graphql → worker/runtime/graphql}/schema/typeDefs/ioUpload.d.ts +0 -0
- /package/lib/service/{graphql → worker/runtime/graphql}/schema/typeDefs/sanitizedString.d.ts +0 -0
- /package/lib/service/{graphql → worker/runtime/graphql}/typings.js +0 -0
- /package/lib/service/{graphql → worker/runtime/graphql}/utils/pathname.d.ts +0 -0
- /package/lib/service/{typings.js → worker/runtime/typings.js} +0 -0
- /package/lib/service/{graphql/utils/array.d.ts → worker/runtime/utils/toArray.d.ts} +0 -0
package/gen/manifest.schema
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
"definitions": {
|
|
4
4
|
"BILLING_TYPE": {
|
|
5
5
|
"enum": [
|
|
6
|
-
"billable",
|
|
7
6
|
"free",
|
|
7
|
+
"billable",
|
|
8
8
|
"sponsored"
|
|
9
9
|
],
|
|
10
10
|
"type": "string"
|
|
@@ -110,6 +110,9 @@
|
|
|
110
110
|
"email": {
|
|
111
111
|
"type": "string"
|
|
112
112
|
},
|
|
113
|
+
"phone": {
|
|
114
|
+
"type": "string"
|
|
115
|
+
},
|
|
113
116
|
"url": {
|
|
114
117
|
"type": "string"
|
|
115
118
|
}
|
|
@@ -169,8 +172,7 @@
|
|
|
169
172
|
},
|
|
170
173
|
"type": "array"
|
|
171
174
|
},
|
|
172
|
-
"settingsSchema": {
|
|
173
|
-
},
|
|
175
|
+
"settingsSchema": {},
|
|
174
176
|
"title": {
|
|
175
177
|
"type": "string"
|
|
176
178
|
},
|
|
@@ -6,6 +6,7 @@ interface QueryOptions<Variables extends object> {
|
|
|
6
6
|
variables: Variables;
|
|
7
7
|
inflight?: boolean;
|
|
8
8
|
throwOnError?: boolean;
|
|
9
|
+
extensions?: Record<string, any>;
|
|
9
10
|
}
|
|
10
11
|
interface MutateOptions<Variables extends object> {
|
|
11
12
|
mutate: string;
|
|
@@ -21,7 +22,7 @@ export interface GraphQLResponse<T extends Serializable> {
|
|
|
21
22
|
export declare class GraphQLClient {
|
|
22
23
|
private http;
|
|
23
24
|
constructor(http: HttpClient);
|
|
24
|
-
query: <Data extends Serializable, Variables extends object>({ query, variables, inflight, throwOnError }: QueryOptions<Variables>, config?: RequestConfig) => Promise<GraphQLResponse<Data>>;
|
|
25
|
+
query: <Data extends Serializable, Variables extends object>({ query, variables, inflight, extensions, throwOnError }: QueryOptions<Variables>, config?: RequestConfig) => Promise<GraphQLResponse<Data>>;
|
|
25
26
|
mutate: <Data extends Serializable, Variables extends object>({ mutate, variables, throwOnError }: MutateOptions<Variables>, config?: RequestConfig) => Promise<GraphQLResponse<Data>>;
|
|
26
27
|
}
|
|
27
28
|
export {};
|
|
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.GraphQLClient = void 0;
|
|
6
7
|
const customGraphQLError_1 = __importDefault(require("../errors/customGraphQLError"));
|
|
7
8
|
const inflight_1 = require("./middlewares/inflight");
|
|
8
9
|
const throwOnGraphQLErrors = (message, response) => {
|
|
@@ -14,7 +15,10 @@ const throwOnGraphQLErrors = (message, response) => {
|
|
|
14
15
|
class GraphQLClient {
|
|
15
16
|
constructor(http) {
|
|
16
17
|
this.http = http;
|
|
17
|
-
this.query = ({ query, variables, inflight, throwOnError }, config = {}) => this.http.getWithBody(config.url || '', { query, variables
|
|
18
|
+
this.query = ({ query, variables, inflight, extensions, throwOnError }, config = {}) => this.http.getWithBody(config.url || '', { query, variables, extensions }, {
|
|
19
|
+
inflightKey: inflight !== false ? inflight_1.inflightUrlWithQuery : undefined,
|
|
20
|
+
...config,
|
|
21
|
+
})
|
|
18
22
|
.then(graphqlResponse => throwOnError === false
|
|
19
23
|
? graphqlResponse
|
|
20
24
|
: throwOnGraphQLErrors(this.http.name, graphqlResponse));
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { AxiosResponse } from 'axios';
|
|
3
3
|
import { IncomingMessage } from 'http';
|
|
4
|
-
import { IOContext } from '../service/typings';
|
|
4
|
+
import { IOContext } from '../service/worker/runtime/typings';
|
|
5
5
|
import { InstanceOptions, IOResponse, RequestConfig } from './typings';
|
|
6
6
|
declare type ClientOptions = IOContext & Partial<InstanceOptions>;
|
|
7
7
|
export declare class HttpClient {
|
|
8
|
-
static forWorkspace: (service: string, context: IOContext, opts: InstanceOptions) => HttpClient;
|
|
9
|
-
static forRoot: (service: string, context: IOContext, opts: InstanceOptions) => HttpClient;
|
|
10
|
-
static forExternal: (baseURL: string, context: IOContext, opts: InstanceOptions) => HttpClient;
|
|
11
8
|
name: string;
|
|
9
|
+
private logger;
|
|
10
|
+
private cacheableType;
|
|
11
|
+
private memoizable;
|
|
12
12
|
private runMiddlewares;
|
|
13
13
|
constructor(opts: ClientOptions);
|
|
14
14
|
get: <T = any>(url: string, config?: RequestConfig) => Promise<T>;
|
|
@@ -20,12 +20,13 @@ export declare class HttpClient {
|
|
|
20
20
|
}>;
|
|
21
21
|
getStream: (url: string, config?: RequestConfig) => Promise<IncomingMessage>;
|
|
22
22
|
put: <T = void>(url: string, data?: any, config?: RequestConfig) => Promise<T>;
|
|
23
|
+
putRaw: <T = void>(url: string, data?: any, config?: RequestConfig) => Promise<IOResponse<T>>;
|
|
23
24
|
post: <T = void>(url: string, data?: any, config?: RequestConfig) => Promise<T>;
|
|
24
25
|
postRaw: <T = void>(url: string, data?: any, config?: RequestConfig) => Promise<IOResponse<T>>;
|
|
25
26
|
patch: <T = void>(url: string, data?: any, config?: RequestConfig) => Promise<T>;
|
|
26
27
|
head: (url: string, config?: RequestConfig) => Promise<IOResponse<void>>;
|
|
27
28
|
delete: <T = void>(url: string, config?: RequestConfig | undefined) => Promise<IOResponse<T>>;
|
|
28
|
-
protected request: (config: RequestConfig) => Promise<AxiosResponse
|
|
29
|
+
protected request: (config: RequestConfig) => Promise<AxiosResponse>;
|
|
29
30
|
private getConfig;
|
|
30
31
|
}
|
|
31
32
|
export {};
|
|
@@ -3,13 +3,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.HttpClient = void 0;
|
|
6
7
|
const crypto_1 = require("crypto");
|
|
7
8
|
const koa_compose_1 = __importDefault(require("koa-compose"));
|
|
8
9
|
const p_limit_1 = __importDefault(require("p-limit"));
|
|
9
10
|
const constants_1 = require("../constants");
|
|
10
11
|
const binding_1 = require("../utils/binding");
|
|
11
12
|
const tenant_1 = require("../utils/tenant");
|
|
12
|
-
const factories_1 = require("./factories");
|
|
13
13
|
const cache_1 = require("./middlewares/cache");
|
|
14
14
|
const cancellationToken_1 = require("./middlewares/cancellationToken");
|
|
15
15
|
const inflight_1 = require("./middlewares/inflight");
|
|
@@ -18,6 +18,7 @@ const metrics_1 = require("./middlewares/metrics");
|
|
|
18
18
|
const notFound_1 = require("./middlewares/notFound");
|
|
19
19
|
const recorder_1 = require("./middlewares/recorder");
|
|
20
20
|
const request_1 = require("./middlewares/request");
|
|
21
|
+
const tracing_1 = require("./middlewares/tracing");
|
|
21
22
|
const DEFAULT_TIMEOUT_MS = 1000;
|
|
22
23
|
const noTransforms = [(data) => data];
|
|
23
24
|
class HttpClient {
|
|
@@ -31,40 +32,63 @@ class HttpClient {
|
|
|
31
32
|
return this.request(cacheableConfig);
|
|
32
33
|
};
|
|
33
34
|
this.getWithBody = (url, data, config = {}) => {
|
|
34
|
-
const
|
|
35
|
-
|
|
35
|
+
const deterministicReplacer = (_, v) => {
|
|
36
|
+
try {
|
|
37
|
+
return typeof v !== 'object' || v === null || Array.isArray(v) ? v :
|
|
38
|
+
Object.fromEntries(Object.entries(v).sort(([ka], [kb]) => ka < kb ? -1 : ka > kb ? 1 : 0));
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
// I don't believe this will ever happen, but just in case
|
|
42
|
+
// Also, I didn't include error as I am unsure if it would have sensitive information
|
|
43
|
+
this.logger.warn({ message: 'Error while sorting object for cache key' });
|
|
44
|
+
return v;
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
const bodyHash = crypto_1.createHash('md5').update(JSON.stringify(data, deterministicReplacer)).digest('hex');
|
|
48
|
+
const cacheableConfig = this.getConfig(url, {
|
|
49
|
+
...config,
|
|
50
|
+
data,
|
|
51
|
+
params: {
|
|
52
|
+
...config.params,
|
|
53
|
+
[constants_1.BODY_HASH]: bodyHash,
|
|
54
|
+
},
|
|
55
|
+
});
|
|
36
56
|
return this.request(cacheableConfig).then(response => response.data);
|
|
37
57
|
};
|
|
38
58
|
this.getBuffer = (url, config = {}) => {
|
|
39
|
-
const bufferConfig =
|
|
59
|
+
const bufferConfig = { cacheable: cache_1.CacheType.Disk, ...config, url, responseType: 'arraybuffer', transformResponse: noTransforms };
|
|
40
60
|
return this.request(bufferConfig);
|
|
41
61
|
};
|
|
42
62
|
this.getStream = (url, config = {}) => {
|
|
43
|
-
const streamConfig =
|
|
63
|
+
const streamConfig = { ...config, url, responseType: 'stream', transformResponse: noTransforms };
|
|
44
64
|
return this.request(streamConfig).then(response => response.data);
|
|
45
65
|
};
|
|
46
66
|
this.put = (url, data, config = {}) => {
|
|
47
|
-
const putConfig =
|
|
67
|
+
const putConfig = { ...config, url, data, method: 'put' };
|
|
48
68
|
return this.request(putConfig).then(response => response.data);
|
|
49
69
|
};
|
|
70
|
+
this.putRaw = (url, data, config = {}) => {
|
|
71
|
+
const putConfig = { ...config, url, data, method: 'put' };
|
|
72
|
+
return this.request(putConfig);
|
|
73
|
+
};
|
|
50
74
|
this.post = (url, data, config = {}) => {
|
|
51
|
-
const postConfig =
|
|
75
|
+
const postConfig = { ...config, url, data, method: 'post' };
|
|
52
76
|
return this.request(postConfig).then(response => response.data);
|
|
53
77
|
};
|
|
54
78
|
this.postRaw = (url, data, config = {}) => {
|
|
55
|
-
const postConfig =
|
|
79
|
+
const postConfig = { ...config, url, data, method: 'post' };
|
|
56
80
|
return this.request(postConfig);
|
|
57
81
|
};
|
|
58
82
|
this.patch = (url, data, config = {}) => {
|
|
59
|
-
const patchConfig =
|
|
83
|
+
const patchConfig = { ...config, url, data, method: 'patch' };
|
|
60
84
|
return this.request(patchConfig).then(response => response.data);
|
|
61
85
|
};
|
|
62
86
|
this.head = (url, config = {}) => {
|
|
63
|
-
const headConfig =
|
|
87
|
+
const headConfig = { ...config, url, method: 'head' };
|
|
64
88
|
return this.request(headConfig);
|
|
65
89
|
};
|
|
66
90
|
this.delete = (url, config) => {
|
|
67
|
-
const deleteConfig =
|
|
91
|
+
const deleteConfig = { ...config, url, method: 'delete' };
|
|
68
92
|
return this.request(deleteConfig);
|
|
69
93
|
};
|
|
70
94
|
this.request = async (config) => {
|
|
@@ -72,32 +96,51 @@ class HttpClient {
|
|
|
72
96
|
await this.runMiddlewares(context);
|
|
73
97
|
return context.response;
|
|
74
98
|
};
|
|
75
|
-
this.getConfig = (url, config = {}) => (
|
|
76
|
-
|
|
99
|
+
this.getConfig = (url, config = {}) => ({
|
|
100
|
+
cacheable: this.cacheableType,
|
|
101
|
+
memoizable: this.memoizable,
|
|
102
|
+
...config,
|
|
103
|
+
url,
|
|
104
|
+
});
|
|
105
|
+
const { baseURL, authToken, authType, memoryCache, diskCache, memoizable = true, asyncSetCache, locale, name, metrics, product, serverTiming, recorder, userAgent, timeout = DEFAULT_TIMEOUT_MS, segmentToken, sessionToken, retries, concurrency, headers: defaultHeaders, host, params, operationId, tenant, binding, verbose, cancellation, exponentialTimeoutCoefficient, initialBackoffDelay, exponentialBackoffCoefficient, httpsAgent, tracer, logger, cacheableType = cache_1.CacheType.Memory, } = opts;
|
|
77
106
|
this.name = name || baseURL || 'unknown';
|
|
107
|
+
this.logger = logger;
|
|
108
|
+
this.cacheableType = cacheableType;
|
|
109
|
+
this.memoizable = memoizable;
|
|
78
110
|
const limit = concurrency && concurrency > 0 && p_limit_1.default(concurrency) || undefined;
|
|
79
|
-
const headers =
|
|
111
|
+
const headers = {
|
|
112
|
+
...defaultHeaders,
|
|
113
|
+
'Accept-Encoding': 'gzip',
|
|
114
|
+
'User-Agent': userAgent,
|
|
115
|
+
...host ? { [constants_1.FORWARDED_HOST_HEADER]: host } : null,
|
|
116
|
+
...tenant ? { [constants_1.TENANT_HEADER]: tenant_1.formatTenantHeaderValue(tenant) } : null,
|
|
117
|
+
...binding ? { [constants_1.BINDING_HEADER]: binding_1.formatBindingHeaderValue(binding) } : null,
|
|
118
|
+
...locale ? { [constants_1.LOCALE_HEADER]: locale } : null,
|
|
119
|
+
...operationId ? { 'x-vtex-operation-id': operationId } : null,
|
|
120
|
+
...product ? { [constants_1.PRODUCT_HEADER]: product } : null,
|
|
121
|
+
...segmentToken ? { [constants_1.SEGMENT_HEADER]: segmentToken } : null,
|
|
122
|
+
...sessionToken ? { [constants_1.SESSION_HEADER]: sessionToken } : null,
|
|
123
|
+
};
|
|
80
124
|
if (authType && authToken) {
|
|
81
125
|
headers['Authorization'] = `${authType} ${authToken}`; // tslint:disable-line
|
|
82
126
|
}
|
|
83
127
|
const memoizedCache = new Map();
|
|
84
|
-
this.runMiddlewares = koa_compose_1.default([
|
|
85
|
-
|
|
128
|
+
this.runMiddlewares = koa_compose_1.default([
|
|
129
|
+
tracing_1.createHttpClientTracingMiddleware({ tracer, logger, clientName: this.name, hasDiskCacheMiddleware: !!diskCache, hasMemoryCacheMiddleware: !!memoryCache }),
|
|
130
|
+
...(opts.middlewares || []),
|
|
131
|
+
request_1.defaultsMiddleware({ baseURL, rawHeaders: headers, params, timeout, retries, verbose, exponentialTimeoutCoefficient, initialBackoffDelay, exponentialBackoffCoefficient, httpsAgent }),
|
|
86
132
|
metrics_1.metricsMiddleware({ metrics, serverTiming, name }),
|
|
87
133
|
memoization_1.memoizationMiddleware({ memoizedCache }),
|
|
88
134
|
...recorder ? [recorder_1.recorderMiddleware(recorder)] : [],
|
|
89
135
|
cancellationToken_1.cancellationToken(cancellation),
|
|
90
136
|
inflight_1.singleFlightMiddleware,
|
|
91
137
|
notFound_1.acceptNotFoundMiddleware,
|
|
92
|
-
...memoryCache ? [cache_1.cacheMiddleware({ type: cache_1.CacheType.Memory, storage: memoryCache })] : [],
|
|
93
|
-
...diskCache ? [cache_1.cacheMiddleware({ type: cache_1.CacheType.Disk, storage: diskCache })] : [],
|
|
138
|
+
...memoryCache ? [cache_1.cacheMiddleware({ type: cache_1.CacheType.Memory, storage: memoryCache, asyncSet: asyncSetCache })] : [],
|
|
139
|
+
...diskCache ? [cache_1.cacheMiddleware({ type: cache_1.CacheType.Disk, storage: diskCache, asyncSet: asyncSetCache })] : [],
|
|
94
140
|
notFound_1.notFoundFallbackMiddleware,
|
|
95
141
|
request_1.routerCacheMiddleware,
|
|
96
142
|
request_1.requestMiddleware(limit),
|
|
97
143
|
]);
|
|
98
144
|
}
|
|
99
145
|
}
|
|
100
|
-
HttpClient.forWorkspace = factories_1.forWorkspace;
|
|
101
|
-
HttpClient.forRoot = factories_1.forRoot;
|
|
102
|
-
HttpClient.forExternal = factories_1.forExternal;
|
|
103
146
|
exports.HttpClient = HttpClient;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import HttpAgent, { HttpOptions as AgentHttpOptions, HttpsAgent, HttpsOptions as AgentHttpsOptions } from 'agentkeepalive';
|
|
2
|
+
export declare const createHttpAgent: (opts?: Pick<AgentHttpOptions, "freeSocketKeepAliveTimeout" | "timeout" | "socketActiveTTL" | "keepAliveMsecs" | "maxSockets"> | undefined) => HttpAgent;
|
|
3
|
+
export declare const createHttpsAgent: (opts?: Pick<AgentHttpsOptions, "freeSocketKeepAliveTimeout" | "timeout" | "socketActiveTTL" | "keepAliveMsecs" | "maxSockets" | "rejectUnauthorized" | "maxCachedSessions" | "host" | "port" | "path" | "socket" | "checkServerIdentity" | "servername" | "session" | "minDHSize" | "lookup" | "ca" | "cert" | "sigalgs" | "ciphers" | "clientCertEngine" | "crl" | "dhparam" | "ecdhCurve" | "honorCipherOrder" | "key" | "privateKeyEngine" | "privateKeyIdentifier" | "maxVersion" | "minVersion" | "passphrase" | "pfx" | "secureOptions" | "secureProtocol" | "sessionIdContext" | "secureContext" | "enableTrace" | "requestCert" | "ALPNProtocols" | "SNICallback"> | undefined) => HttpsAgent;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.createHttpsAgent = exports.createHttpAgent = void 0;
|
|
23
|
+
const agentkeepalive_1 = __importStar(require("agentkeepalive"));
|
|
24
|
+
exports.createHttpAgent = (opts) => new agentkeepalive_1.default({
|
|
25
|
+
...opts,
|
|
26
|
+
freeSocketTimeout: 30 * 1000,
|
|
27
|
+
keepAlive: true,
|
|
28
|
+
maxFreeSockets: 256,
|
|
29
|
+
socketActiveTTL: 120 * 1000,
|
|
30
|
+
});
|
|
31
|
+
exports.createHttpsAgent = (opts) => new agentkeepalive_1.HttpsAgent({
|
|
32
|
+
...opts,
|
|
33
|
+
freeSocketTimeout: 30 * 1000,
|
|
34
|
+
keepAlive: true,
|
|
35
|
+
maxFreeSockets: 256,
|
|
36
|
+
socketActiveTTL: 120 * 1000,
|
|
37
|
+
});
|
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
export * from './AppClient';
|
|
2
|
-
export * from './ExternalClient';
|
|
3
1
|
export * from './HttpClient';
|
|
4
|
-
export * from './InfraClient';
|
|
5
|
-
export * from './IOClient';
|
|
6
|
-
export * from './JanusClient';
|
|
7
2
|
export * from './typings';
|
|
8
3
|
export * from './GraphQLClient';
|
|
9
|
-
export * from './
|
|
10
|
-
export * from './IOGraphQLClient';
|
|
4
|
+
export * from './agents';
|
|
11
5
|
export { Cached, CacheType } from './middlewares/cache';
|
|
12
6
|
export { inflightURL, inflightUrlWithQuery } from './middlewares/inflight';
|
package/lib/HttpClient/index.js
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
function
|
|
3
|
-
|
|
4
|
-
}
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
5
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
__export(require("./IOClient"));
|
|
11
|
-
__export(require("./JanusClient"));
|
|
12
|
-
__export(require("./typings"));
|
|
13
|
-
__export(require("./GraphQLClient"));
|
|
14
|
-
__export(require("./AppGraphQLClient"));
|
|
15
|
-
__export(require("./IOGraphQLClient"));
|
|
13
|
+
__exportStar(require("./HttpClient"), exports);
|
|
14
|
+
__exportStar(require("./typings"), exports);
|
|
15
|
+
__exportStar(require("./GraphQLClient"), exports);
|
|
16
|
+
__exportStar(require("./agents"), exports);
|
|
16
17
|
var cache_1 = require("./middlewares/cache");
|
|
17
|
-
exports
|
|
18
|
+
Object.defineProperty(exports, "CacheType", { enumerable: true, get: function () { return cache_1.CacheType; } });
|
|
18
19
|
var inflight_1 = require("./middlewares/inflight");
|
|
19
|
-
exports
|
|
20
|
-
exports
|
|
20
|
+
Object.defineProperty(exports, "inflightURL", { enumerable: true, get: function () { return inflight_1.inflightURL; } });
|
|
21
|
+
Object.defineProperty(exports, "inflightUrlWithQuery", { enumerable: true, get: function () { return inflight_1.inflightUrlWithQuery; } });
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { AxiosRequestConfig, AxiosResponse } from 'axios';
|
|
3
3
|
import { CacheLayer } from '../../caches/CacheLayer';
|
|
4
4
|
import { MiddlewareContext, RequestConfig } from '../typings';
|
|
5
|
-
export declare const cacheKey: (config: AxiosRequestConfig
|
|
5
|
+
export declare const cacheKey: (config: AxiosRequestConfig) => string;
|
|
6
6
|
export declare function isLocallyCacheable(arg: RequestConfig, type: CacheType): arg is CacheableRequestConfig;
|
|
7
7
|
export declare enum CacheType {
|
|
8
8
|
None = 0,
|
|
@@ -10,11 +10,17 @@ export declare enum CacheType {
|
|
|
10
10
|
Disk = 2,
|
|
11
11
|
Any = 3
|
|
12
12
|
}
|
|
13
|
+
export declare const enum CacheResult {
|
|
14
|
+
HIT = "HIT",
|
|
15
|
+
MISS = "MISS",
|
|
16
|
+
STALE = "STALE"
|
|
17
|
+
}
|
|
13
18
|
interface CacheOptions {
|
|
14
19
|
type: CacheType;
|
|
15
20
|
storage: CacheLayer<string, Cached>;
|
|
21
|
+
asyncSet?: boolean;
|
|
16
22
|
}
|
|
17
|
-
export declare const cacheMiddleware: ({ type, storage }: CacheOptions) => (ctx: MiddlewareContext, next: () => Promise<void>) => Promise<void>;
|
|
23
|
+
export declare const cacheMiddleware: ({ type, storage, asyncSet }: CacheOptions) => (ctx: MiddlewareContext, next: () => Promise<void>) => Promise<void>;
|
|
18
24
|
export interface Cached {
|
|
19
25
|
etag: string;
|
|
20
26
|
expiration: number;
|
|
@@ -1,27 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
3
|
+
exports.cacheMiddleware = exports.CacheType = exports.isLocallyCacheable = exports.cacheKey = void 0;
|
|
4
4
|
const constants_1 = require("../../constants");
|
|
5
|
-
const
|
|
5
|
+
const tracing_1 = require("../../tracing");
|
|
6
6
|
const RANGE_HEADER_QS_KEY = '__range_header';
|
|
7
7
|
const cacheableStatusCodes = [200, 203, 204, 206, 300, 301, 404, 405, 410, 414, 501]; // https://tools.ietf.org/html/rfc7231#section-6.1
|
|
8
8
|
exports.cacheKey = (config) => {
|
|
9
9
|
const { baseURL = '', url = '', params, headers } = config;
|
|
10
|
-
const locale = headers[
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
urlObject.searchParams.append(RANGE_HEADER_QS_KEY, headers.range);
|
|
15
|
-
}
|
|
10
|
+
const locale = headers === null || headers === void 0 ? void 0 : headers[constants_1.LOCALE_HEADER];
|
|
11
|
+
const encodedBaseURL = baseURL.replace(/\//g, '\\');
|
|
12
|
+
const encodedURL = url.replace(/\//g, '\\');
|
|
13
|
+
let key = `${locale}--${encodedBaseURL}--${encodedURL}?`;
|
|
16
14
|
if (params) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
Object.keys(params).sort().forEach(p => key = key.concat(`--${p}=${params[p]}`));
|
|
16
|
+
}
|
|
17
|
+
if (headers === null || headers === void 0 ? void 0 : headers.range) {
|
|
18
|
+
key = key.concat(`--${RANGE_HEADER_QS_KEY}=${headers.range}`);
|
|
20
19
|
}
|
|
21
|
-
|
|
22
|
-
const encodedPath = `${locale}/${urlObject.pathname}${urlObject.search}`.replace(/\//g, '\\\\');
|
|
23
|
-
// Add hostname as top level directory on disk cache
|
|
24
|
-
return `${urlObject.hostname}/${encodedPath}`;
|
|
20
|
+
return key;
|
|
25
21
|
};
|
|
26
22
|
const parseCacheHeaders = (headers) => {
|
|
27
23
|
const { 'cache-control': cacheControl = '', etag, age: ageStr } = headers;
|
|
@@ -51,36 +47,80 @@ var CacheType;
|
|
|
51
47
|
CacheType[CacheType["Disk"] = 2] = "Disk";
|
|
52
48
|
CacheType[CacheType["Any"] = 3] = "Any";
|
|
53
49
|
})(CacheType = exports.CacheType || (exports.CacheType = {}));
|
|
54
|
-
|
|
50
|
+
const CacheTypeNames = {
|
|
51
|
+
[CacheType.None]: 'none',
|
|
52
|
+
[CacheType.Memory]: 'memory',
|
|
53
|
+
[CacheType.Disk]: 'disk',
|
|
54
|
+
[CacheType.Any]: 'any',
|
|
55
|
+
};
|
|
56
|
+
exports.cacheMiddleware = ({ type, storage, asyncSet }) => {
|
|
57
|
+
const CACHE_RESULT_TAG = type === CacheType.Disk ? "http.cache.disk" /* HTTP_DISK_CACHE_RESULT */ : "http.cache.memory" /* HTTP_MEMORY_CACHE_RESULT */;
|
|
58
|
+
const cacheType = CacheTypeNames[type];
|
|
55
59
|
return async (ctx, next) => {
|
|
60
|
+
var _a, _b;
|
|
56
61
|
if (!isLocallyCacheable(ctx.config, type)) {
|
|
57
62
|
return await next();
|
|
58
63
|
}
|
|
64
|
+
const { rootSpan: span, tracer, logger } = (_a = ctx.tracing) !== null && _a !== void 0 ? _a : {};
|
|
59
65
|
const key = exports.cacheKey(ctx.config);
|
|
60
|
-
const segmentToken = ctx.config.headers[constants_1.SEGMENT_HEADER];
|
|
66
|
+
const segmentToken = (_b = ctx.config.headers) === null || _b === void 0 ? void 0 : _b[constants_1.SEGMENT_HEADER];
|
|
61
67
|
const keyWithSegment = key + segmentToken;
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
68
|
+
span === null || span === void 0 ? void 0 : span.log({
|
|
69
|
+
event: "cache-key-created" /* CACHE_KEY_CREATE */,
|
|
70
|
+
["cache-type" /* CACHE_TYPE */]: cacheType,
|
|
71
|
+
["key" /* KEY */]: key,
|
|
72
|
+
["key-with-segment" /* KEY_WITH_SEGMENT */]: keyWithSegment,
|
|
73
|
+
});
|
|
74
|
+
const cacheReadSpan = createCacheSpan(cacheType, 'read', tracer, span);
|
|
75
|
+
let cached = undefined;
|
|
76
|
+
try {
|
|
77
|
+
const cacheHasWithSegment = await storage.has(keyWithSegment);
|
|
78
|
+
cached = cacheHasWithSegment ? await storage.get(keyWithSegment) : await storage.get(key);
|
|
79
|
+
}
|
|
80
|
+
catch (error) {
|
|
81
|
+
tracing_1.ErrorReport.create({ originalError: error }).injectOnSpan(cacheReadSpan);
|
|
82
|
+
logger === null || logger === void 0 ? void 0 : logger.warn({ message: 'Error reading from the HttpClient cache', error });
|
|
83
|
+
}
|
|
84
|
+
finally {
|
|
85
|
+
cacheReadSpan === null || cacheReadSpan === void 0 ? void 0 : cacheReadSpan.finish();
|
|
86
|
+
}
|
|
87
|
+
if (cached && cached.response) {
|
|
65
88
|
const { etag: cachedEtag, response, expiration, responseType, responseEncoding } = cached;
|
|
66
|
-
if (
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
89
|
+
if (type === CacheType.Disk && responseType === 'arraybuffer') {
|
|
90
|
+
response.data = Buffer.from(response.data, responseEncoding);
|
|
91
|
+
}
|
|
92
|
+
const now = Date.now();
|
|
93
|
+
span === null || span === void 0 ? void 0 : span.log({
|
|
94
|
+
event: "local-cache-hit-info" /* LOCAL_CACHE_HIT_INFO */,
|
|
95
|
+
["cache-type" /* CACHE_TYPE */]: cacheType,
|
|
96
|
+
["etag" /* ETAG */]: cachedEtag,
|
|
97
|
+
["expiration-time" /* EXPIRATION_TIME */]: (expiration - now) / 1000,
|
|
98
|
+
["response-type" /* RESPONSE_TYPE */]: responseType,
|
|
99
|
+
["response-encoding" /* RESPONSE_ENCONDING */]: responseEncoding,
|
|
100
|
+
});
|
|
101
|
+
if (expiration > now) {
|
|
70
102
|
ctx.response = response;
|
|
71
103
|
ctx.cacheHit = {
|
|
72
104
|
memory: 1,
|
|
73
105
|
revalidated: 0,
|
|
74
106
|
router: 0,
|
|
75
107
|
};
|
|
108
|
+
span === null || span === void 0 ? void 0 : span.setTag(CACHE_RESULT_TAG, "HIT" /* HIT */);
|
|
76
109
|
return;
|
|
77
110
|
}
|
|
111
|
+
span === null || span === void 0 ? void 0 : span.setTag(CACHE_RESULT_TAG, "STALE" /* STALE */);
|
|
78
112
|
const validateStatus = addNotModified(ctx.config.validateStatus);
|
|
79
113
|
if (cachedEtag && validateStatus(response.status)) {
|
|
80
|
-
ctx.config.headers
|
|
114
|
+
ctx.config.headers = {
|
|
115
|
+
...ctx.config.headers,
|
|
116
|
+
'if-none-match': cachedEtag
|
|
117
|
+
};
|
|
81
118
|
ctx.config.validateStatus = validateStatus;
|
|
82
119
|
}
|
|
83
120
|
}
|
|
121
|
+
else {
|
|
122
|
+
span === null || span === void 0 ? void 0 : span.setTag(CACHE_RESULT_TAG, "MISS" /* MISS */);
|
|
123
|
+
}
|
|
84
124
|
await next();
|
|
85
125
|
if (!ctx.response) {
|
|
86
126
|
return;
|
|
@@ -98,28 +138,81 @@ exports.cacheMiddleware = ({ type, storage }) => {
|
|
|
98
138
|
const { age, etag, maxAge: headerMaxAge, noStore, noCache } = parseCacheHeaders(headers);
|
|
99
139
|
const { forceMaxAge } = ctx.config;
|
|
100
140
|
const maxAge = forceMaxAge && cacheableStatusCodes.includes(status) ? Math.max(forceMaxAge, headerMaxAge) : headerMaxAge;
|
|
141
|
+
span === null || span === void 0 ? void 0 : span.log({
|
|
142
|
+
event: "cache-config" /* CACHE_CONFIG */,
|
|
143
|
+
["cache-type" /* CACHE_TYPE */]: cacheType,
|
|
144
|
+
["age" /* AGE */]: age,
|
|
145
|
+
["calculated-max-age" /* CALCULATED_MAX_AGE */]: maxAge,
|
|
146
|
+
["max-age" /* MAX_AGE */]: headerMaxAge,
|
|
147
|
+
["force-max-age" /* FORCE_MAX_AGE */]: forceMaxAge,
|
|
148
|
+
["etag" /* ETAG */]: etag,
|
|
149
|
+
["no-cache" /* NO_CACHE */]: noCache,
|
|
150
|
+
["no-store" /* NO_STORE */]: noStore,
|
|
151
|
+
});
|
|
101
152
|
// Indicates this should NOT be cached and this request will not be considered a miss.
|
|
102
153
|
if (!forceMaxAge && (noStore || (noCache && !etag))) {
|
|
154
|
+
span === null || span === void 0 ? void 0 : span.log({ event: "no-local-cache-save" /* NO_LOCAL_CACHE_SAVE */, ["cache-type" /* CACHE_TYPE */]: cacheType });
|
|
103
155
|
return;
|
|
104
156
|
}
|
|
105
157
|
const shouldCache = maxAge || etag;
|
|
106
158
|
const varySession = ctx.response.headers.vary && ctx.response.headers.vary.includes(constants_1.SESSION_HEADER);
|
|
107
159
|
if (shouldCache && !varySession) {
|
|
108
|
-
const { responseType, responseEncoding } = ctx.config;
|
|
160
|
+
const { responseType, responseEncoding: configResponseEncoding } = ctx.config;
|
|
109
161
|
const currentAge = revalidated ? 0 : age;
|
|
110
162
|
const varySegment = ctx.response.headers.vary && ctx.response.headers.vary.includes(constants_1.SEGMENT_HEADER);
|
|
111
163
|
const setKey = varySegment ? keyWithSegment : key;
|
|
164
|
+
const responseEncoding = configResponseEncoding || (responseType === 'arraybuffer' ? 'base64' : undefined);
|
|
112
165
|
const cacheableData = type === CacheType.Disk && responseType === 'arraybuffer'
|
|
113
166
|
? data.toString(responseEncoding)
|
|
114
167
|
: data;
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
168
|
+
const now = Date.now();
|
|
169
|
+
const expiration = now + (maxAge - currentAge) * 1000;
|
|
170
|
+
const alreadyExpired = expiration <= now;
|
|
171
|
+
const reusingRevalidatedCache = cached && (ctx.response === cached.response);
|
|
172
|
+
const shouldSkipCacheUpdate = alreadyExpired && reusingRevalidatedCache;
|
|
173
|
+
if (shouldSkipCacheUpdate) {
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
const cacheWriteSpan = createCacheSpan(cacheType, 'write', tracer, span);
|
|
177
|
+
try {
|
|
178
|
+
const storageSet = () => storage.set(setKey, {
|
|
179
|
+
etag,
|
|
180
|
+
expiration,
|
|
181
|
+
response: { data: cacheableData, headers, status },
|
|
182
|
+
responseEncoding: responseEncoding,
|
|
183
|
+
responseType,
|
|
184
|
+
});
|
|
185
|
+
if (asyncSet) {
|
|
186
|
+
storageSet();
|
|
187
|
+
}
|
|
188
|
+
else {
|
|
189
|
+
await storageSet();
|
|
190
|
+
span === null || span === void 0 ? void 0 : span.log({
|
|
191
|
+
event: "local-cache-saved" /* LOCAL_CACHE_SAVED */,
|
|
192
|
+
["cache-type" /* CACHE_TYPE */]: cacheType,
|
|
193
|
+
["key-set" /* KEY_SET */]: setKey,
|
|
194
|
+
["age" /* AGE */]: currentAge,
|
|
195
|
+
["etag" /* ETAG */]: etag,
|
|
196
|
+
["expiration-time" /* EXPIRATION_TIME */]: (expiration - Date.now()) / 1000,
|
|
197
|
+
["response-encoding" /* RESPONSE_ENCONDING */]: responseEncoding,
|
|
198
|
+
["response-type" /* RESPONSE_TYPE */]: responseType,
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
catch (error) {
|
|
203
|
+
tracing_1.ErrorReport.create({ originalError: error }).injectOnSpan(cacheWriteSpan);
|
|
204
|
+
logger === null || logger === void 0 ? void 0 : logger.warn({ message: 'Error writing to the HttpClient cache', error });
|
|
205
|
+
}
|
|
206
|
+
finally {
|
|
207
|
+
cacheWriteSpan === null || cacheWriteSpan === void 0 ? void 0 : cacheWriteSpan.finish();
|
|
208
|
+
}
|
|
122
209
|
return;
|
|
123
210
|
}
|
|
211
|
+
span === null || span === void 0 ? void 0 : span.log({ event: "no-local-cache-save" /* NO_LOCAL_CACHE_SAVE */, ["cache-type" /* CACHE_TYPE */]: cacheType });
|
|
124
212
|
};
|
|
125
213
|
};
|
|
214
|
+
const createCacheSpan = (cacheType, operation, tracer, parentSpan) => {
|
|
215
|
+
if (tracer && tracer.isTraceSampled && cacheType === 'disk') {
|
|
216
|
+
return tracer.startSpan(`${operation}-disk-cache`, { childOf: parentSpan });
|
|
217
|
+
}
|
|
218
|
+
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { Cancellation } from '../../service/typings';
|
|
1
|
+
import { Cancellation } from '../../service/worker/runtime/typings';
|
|
2
2
|
import { MiddlewareContext } from '../typings';
|
|
3
3
|
export declare const cancellationToken: (cancellation?: Cancellation | undefined) => (ctx: MiddlewareContext, next: () => Promise<void>) => Promise<void>;
|
|
@@ -3,7 +3,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.cancellationToken = void 0;
|
|
6
7
|
const axios_1 = __importDefault(require("axios"));
|
|
8
|
+
const constants_1 = require("../../constants");
|
|
7
9
|
const production = process.env.VTEX_PRODUCTION === 'true';
|
|
8
10
|
const handleCancellation = (ctx, cancellation) => {
|
|
9
11
|
let cancellable = true;
|
|
@@ -46,7 +48,7 @@ exports.cancellationToken = (cancellation) => async (ctx, next) => {
|
|
|
46
48
|
if (!cancellation) {
|
|
47
49
|
return await next();
|
|
48
50
|
}
|
|
49
|
-
if (method && method.toUpperCase()
|
|
51
|
+
if (method && !constants_1.cancellableMethods.has(method.toUpperCase())) {
|
|
50
52
|
cancellation.cancelable = false;
|
|
51
53
|
}
|
|
52
54
|
if (!cancellation.cancelable || !cancellation.source) {
|