@vtex/api 6.48.1-beta → 6.48.1-beta.2
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 +3 -2
- package/lib/HttpClient/GraphQLClient.js +5 -1
- package/lib/HttpClient/HttpClient.d.ts +9 -7
- package/lib/HttpClient/HttpClient.js +70 -27
- package/lib/HttpClient/agents.d.ts +6 -0
- package/lib/HttpClient/agents.js +43 -0
- package/lib/HttpClient/index.d.ts +1 -7
- package/lib/HttpClient/index.js +22 -16
- package/lib/HttpClient/middlewares/cache.d.ts +9 -3
- package/lib/HttpClient/middlewares/cache.js +130 -35
- package/lib/HttpClient/middlewares/cancellationToken.d.ts +2 -2
- package/lib/HttpClient/middlewares/cancellationToken.js +5 -2
- package/lib/HttpClient/middlewares/inflight.d.ts +1 -1
- package/lib/HttpClient/middlewares/inflight.js +7 -3
- package/lib/HttpClient/middlewares/memoization.d.ts +1 -1
- package/lib/HttpClient/middlewares/memoization.js +13 -4
- package/lib/HttpClient/middlewares/metrics.js +25 -38
- package/lib/HttpClient/middlewares/notFound.d.ts +1 -1
- package/lib/HttpClient/middlewares/notFound.js +5 -2
- package/lib/HttpClient/middlewares/recorder.d.ts +1 -1
- package/lib/HttpClient/middlewares/recorder.js +21 -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 +88 -0
- package/lib/HttpClient/middlewares/request/setupAxios/index.d.ts +1 -0
- package/lib/HttpClient/middlewares/request/setupAxios/index.js +22 -0
- package/lib/HttpClient/middlewares/request/setupAxios/interceptors/exponentialBackoff.d.ts +2 -0
- package/lib/HttpClient/middlewares/request/setupAxios/interceptors/exponentialBackoff.js +55 -0
- package/lib/HttpClient/middlewares/request/setupAxios/interceptors/index.d.ts +2 -0
- package/lib/HttpClient/middlewares/request/setupAxios/interceptors/index.js +8 -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 +32 -0
- package/lib/HttpClient/middlewares/tracing.d.ts +15 -0
- package/lib/HttpClient/middlewares/tracing.js +62 -0
- package/lib/HttpClient/typings.d.ts +46 -12
- package/lib/HttpClient/typings.js +1 -0
- package/lib/caches/DiskCache.d.ts +1 -1
- package/lib/caches/DiskCache.js +3 -2
- package/lib/caches/LRUCache.d.ts +3 -3
- package/lib/caches/LRUCache.js +6 -1
- package/lib/caches/LRUDiskCache.d.ts +2 -2
- package/lib/caches/LRUDiskCache.js +8 -3
- package/lib/caches/MultilayeredCache.d.ts +2 -2
- package/lib/caches/MultilayeredCache.js +8 -7
- package/lib/caches/index.js +20 -7
- package/lib/caches/typings.d.ts +5 -5
- package/lib/clients/IOClient.d.ts +13 -0
- package/lib/clients/IOClient.js +20 -0
- package/lib/clients/IOClients.d.ts +29 -25
- 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} +51 -23
- 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/apps/Settings.js +39 -0
- 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 +23 -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 +20 -0
- package/lib/clients/index.d.ts +9 -21
- package/lib/clients/index.js +27 -24
- package/lib/clients/infra/Apps.d.ts +93 -0
- package/lib/clients/infra/Apps.js +511 -0
- package/lib/clients/infra/Assets.d.ts +35 -0
- package/lib/clients/infra/Assets.js +166 -0
- 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 +65 -0
- package/lib/clients/infra/Registry.js +209 -0
- 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 +61 -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 +27 -0
- package/lib/{HttpClient → clients/janus}/JanusClient.d.ts +4 -4
- package/lib/{HttpClient → clients/janus}/JanusClient.js +8 -3
- package/lib/clients/janus/LicenseManager.d.ts +7 -0
- package/lib/clients/janus/LicenseManager.js +59 -0
- 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} +7 -8
- package/lib/clients/janus/Tenant.js +29 -0
- package/lib/clients/janus/index.d.ts +5 -0
- package/lib/clients/janus/index.js +21 -0
- package/lib/constants.d.ts +50 -2
- 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 +4 -3
- 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 +22 -11
- package/lib/index.d.ts +9 -7
- package/lib/index.js +31 -16
- package/lib/metrics/MetricsAccumulator.d.ts +3 -20
- package/lib/metrics/MetricsAccumulator.js +44 -27
- package/lib/responses.d.ts +5 -46
- package/lib/service/index.d.ts +2 -0
- package/lib/service/index.js +35 -0
- package/lib/service/loaders.d.ts +8 -0
- package/lib/service/loaders.js +57 -0
- package/lib/service/logger/console.d.ts +10 -0
- package/lib/service/logger/console.js +40 -0
- package/lib/service/logger/index.d.ts +2 -28
- package/lib/service/logger/index.js +16 -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 +89 -0
- package/lib/service/metrics/requestMetricsMiddleware.d.ts +2 -0
- package/lib/service/metrics/requestMetricsMiddleware.js +46 -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 +19 -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 +117 -0
- package/lib/service/worker/index.d.ts +11 -0
- package/lib/service/worker/index.js +197 -0
- package/lib/service/worker/listeners.d.ts +3 -0
- package/lib/{utils/unhandled.js → service/worker/listeners.js} +12 -16
- 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 +34 -0
- package/lib/service/worker/runtime/builtIn/middlewares.d.ts +4 -0
- package/lib/service/worker/runtime/builtIn/middlewares.js +43 -0
- package/lib/service/worker/runtime/events/index.d.ts +4 -0
- package/lib/service/worker/runtime/events/index.js +48 -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 +29 -0
- package/lib/service/worker/runtime/graphql/index.d.ts +6 -0
- package/lib/service/worker/runtime/graphql/index.js +29 -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 +54 -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 +21 -0
- package/lib/service/worker/runtime/graphql/middlewares/updateSchema.d.ts +5 -0
- package/lib/service/worker/runtime/graphql/middlewares/updateSchema.js +30 -0
- package/lib/service/worker/runtime/graphql/middlewares/upload.d.ts +4 -0
- package/lib/service/{graphql → worker/runtime/graphql}/middlewares/upload.js +2 -1
- package/lib/service/worker/runtime/graphql/schema/index.d.ts +7 -0
- package/lib/service/worker/runtime/graphql/schema/index.js +33 -0
- package/lib/service/worker/runtime/graphql/schema/messagesLoaderV2.d.ts +6 -0
- package/lib/service/worker/runtime/graphql/schema/messagesLoaderV2.js +81 -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 +14 -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 +8 -3
- 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 +34 -0
- package/lib/service/worker/runtime/graphql/utils/error.d.ts +2 -0
- package/lib/service/worker/runtime/graphql/utils/error.js +78 -0
- package/lib/service/worker/runtime/graphql/utils/pathname.js +9 -0
- package/lib/service/worker/runtime/graphql/utils/translations.d.ts +14 -0
- package/lib/service/worker/runtime/graphql/utils/translations.js +42 -0
- package/lib/service/worker/runtime/http/index.d.ts +5 -0
- package/lib/service/worker/runtime/http/index.js +61 -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 +39 -0
- package/lib/service/worker/runtime/http/middlewares/error.d.ts +2 -0
- package/lib/service/{http → worker/runtime/http}/middlewares/error.js +29 -16
- 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 +6 -5
- package/lib/service/worker/runtime/http/middlewares/settings.d.ts +9 -0
- package/lib/service/worker/runtime/http/middlewares/settings.js +49 -0
- package/lib/service/worker/runtime/http/middlewares/timings.d.ts +3 -0
- package/lib/service/{http → worker/runtime/http}/middlewares/timings.js +25 -11
- 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 +25 -0
- package/lib/service/worker/runtime/http/routes.d.ts +19 -0
- package/lib/service/worker/runtime/http/routes.js +16 -0
- package/lib/service/worker/runtime/method.d.ts +9 -0
- package/lib/service/{method.js → worker/runtime/method.js} +2 -1
- package/lib/service/worker/runtime/statusTrack.d.ts +14 -0
- package/lib/service/worker/runtime/statusTrack.js +43 -0
- package/lib/service/worker/runtime/typings.d.ts +173 -0
- package/lib/service/worker/runtime/utils/compose.d.ts +5 -0
- package/lib/service/worker/runtime/utils/compose.js +14 -0
- package/lib/service/worker/runtime/utils/context.d.ts +5 -0
- package/lib/service/worker/runtime/utils/context.js +42 -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/worker/runtime/utils/toArray.js +5 -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/{service/graphql/utils/array.js → tracing/LogEvents.js} +1 -1
- 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 +58 -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 +42 -0
- package/lib/utils/MineWinsConflictsResolver.d.ts +7 -5
- package/lib/utils/MineWinsConflictsResolver.js +40 -22
- package/lib/utils/app.d.ts +3 -1
- package/lib/utils/app.js +40 -21
- package/lib/utils/appsStaleIfError.d.ts +2 -1
- package/lib/utils/appsStaleIfError.js +33 -12
- package/lib/utils/billingOptions.d.ts +36 -3
- package/lib/utils/billingOptions.js +9 -3
- package/lib/utils/binding.d.ts +3 -3
- package/lib/utils/binding.js +5 -2
- 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 +2 -1
- package/lib/utils/error.js +6 -4
- package/lib/utils/index.js +23 -12
- package/lib/utils/json.js +1 -0
- package/lib/utils/log.d.ts +1 -3
- package/lib/utils/log.js +6 -4
- package/lib/utils/message.js +11 -4
- package/lib/utils/renameBy.js +3 -1
- package/lib/utils/retry.js +10 -7
- package/lib/utils/status.js +3 -1
- package/lib/utils/tenant.d.ts +3 -3
- package/lib/utils/tenant.js +5 -2
- package/lib/utils/throwOnGraphQLErrors.js +1 -0
- package/lib/utils/time.d.ts +7 -7
- package/lib/utils/time.js +29 -12
- package/package.json +3 -3
- package/lib/HttpClient/IOClient.d.ts +0 -13
- 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/Assets.js +0 -110
- 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/LicenseManager.js +0 -43
- 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/Registry.js +0 -147
- 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/Settings.js +0 -44
- 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/graphql/utils/pathname.js +0 -7
- 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/typings.d.ts +0 -139
- package/lib/service/utils/compose.d.ts +0 -4
- package/lib/service/utils/compose.js +0 -11
- 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,13 +6,14 @@ 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;
|
|
12
13
|
variables: Variables;
|
|
13
14
|
throwOnError?: boolean;
|
|
14
15
|
}
|
|
15
|
-
export
|
|
16
|
+
export type Serializable = object | boolean | string | number;
|
|
16
17
|
export interface GraphQLResponse<T extends Serializable> {
|
|
17
18
|
data?: T;
|
|
18
19
|
errors?: GraphQLError[];
|
|
@@ -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,15 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
2
3
|
import { AxiosResponse } from 'axios';
|
|
3
4
|
import { IncomingMessage } from 'http';
|
|
4
|
-
import { IOContext } from '../service/typings';
|
|
5
|
+
import { IOContext } from '../service/worker/runtime/typings';
|
|
5
6
|
import { InstanceOptions, IOResponse, RequestConfig } from './typings';
|
|
6
|
-
|
|
7
|
+
type ClientOptions = IOContext & Partial<InstanceOptions>;
|
|
7
8
|
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
9
|
name: string;
|
|
10
|
+
private logger;
|
|
11
|
+
private cacheableType;
|
|
12
|
+
private memoizable;
|
|
12
13
|
private runMiddlewares;
|
|
13
14
|
constructor(opts: ClientOptions);
|
|
14
15
|
get: <T = any>(url: string, config?: RequestConfig) => Promise<T>;
|
|
@@ -20,12 +21,13 @@ export declare class HttpClient {
|
|
|
20
21
|
}>;
|
|
21
22
|
getStream: (url: string, config?: RequestConfig) => Promise<IncomingMessage>;
|
|
22
23
|
put: <T = void>(url: string, data?: any, config?: RequestConfig) => Promise<T>;
|
|
24
|
+
putRaw: <T = void>(url: string, data?: any, config?: RequestConfig) => Promise<IOResponse<T>>;
|
|
23
25
|
post: <T = void>(url: string, data?: any, config?: RequestConfig) => Promise<T>;
|
|
24
26
|
postRaw: <T = void>(url: string, data?: any, config?: RequestConfig) => Promise<IOResponse<T>>;
|
|
25
27
|
patch: <T = void>(url: string, data?: any, config?: RequestConfig) => Promise<T>;
|
|
26
28
|
head: (url: string, config?: RequestConfig) => Promise<IOResponse<void>>;
|
|
27
|
-
delete: <T = void>(url: string, config?: RequestConfig
|
|
28
|
-
protected request: (config: RequestConfig) => Promise<AxiosResponse
|
|
29
|
+
delete: <T = void>(url: string, config?: RequestConfig) => Promise<IOResponse<T>>;
|
|
30
|
+
protected request: (config: RequestConfig) => Promise<AxiosResponse>;
|
|
29
31
|
private getConfig;
|
|
30
32
|
}
|
|
31
33
|
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 = (0, 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';
|
|
78
|
-
|
|
79
|
-
|
|
107
|
+
this.logger = logger;
|
|
108
|
+
this.cacheableType = cacheableType;
|
|
109
|
+
this.memoizable = memoizable;
|
|
110
|
+
const limit = concurrency && concurrency > 0 && (0, p_limit_1.default)(concurrency) || undefined;
|
|
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]: (0, tenant_1.formatTenantHeaderValue)(tenant) } : null,
|
|
117
|
+
...binding ? { [constants_1.BINDING_HEADER]: (0, 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
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
128
|
+
this.runMiddlewares = (0, koa_compose_1.default)([
|
|
129
|
+
(0, tracing_1.createHttpClientTracingMiddleware)({ tracer, logger, clientName: this.name, hasDiskCacheMiddleware: !!diskCache, hasMemoryCacheMiddleware: !!memoryCache }),
|
|
130
|
+
...(opts.middlewares || []),
|
|
131
|
+
(0, request_1.defaultsMiddleware)({ baseURL, rawHeaders: headers, params, timeout, retries, verbose, exponentialTimeoutCoefficient, initialBackoffDelay, exponentialBackoffCoefficient, httpsAgent }),
|
|
132
|
+
(0, metrics_1.metricsMiddleware)({ metrics, serverTiming, name }),
|
|
133
|
+
(0, memoization_1.memoizationMiddleware)({ memoizedCache }),
|
|
134
|
+
...recorder ? [(0, recorder_1.recorderMiddleware)(recorder)] : [],
|
|
135
|
+
(0, 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 ? [(0, cache_1.cacheMiddleware)({ type: cache_1.CacheType.Memory, storage: memoryCache, asyncSet: asyncSetCache })] : [],
|
|
139
|
+
...diskCache ? [(0, cache_1.cacheMiddleware)({ type: cache_1.CacheType.Disk, storage: diskCache, asyncSet: asyncSetCache })] : [],
|
|
94
140
|
notFound_1.notFoundFallbackMiddleware,
|
|
95
141
|
request_1.routerCacheMiddleware,
|
|
96
|
-
request_1.requestMiddleware(limit),
|
|
142
|
+
(0, 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,6 @@
|
|
|
1
|
+
import HttpAgent, { HttpOptions as AgentHttpOptions, HttpsAgent, HttpsOptions as AgentHttpsOptions } from 'agentkeepalive';
|
|
2
|
+
type HttpOptions = Omit<AgentHttpOptions, 'freeSocketTimeout' | 'keepAlive' | 'maxFreeSockets'>;
|
|
3
|
+
export declare const createHttpAgent: (opts?: HttpOptions) => HttpAgent;
|
|
4
|
+
type HttpsOptions = Omit<AgentHttpsOptions, 'freeSocketTimeout' | 'keepAlive' | 'maxFreeSockets'>;
|
|
5
|
+
export declare const createHttpsAgent: (opts?: HttpsOptions) => HttpsAgent;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.createHttpsAgent = exports.createHttpAgent = void 0;
|
|
27
|
+
const agentkeepalive_1 = __importStar(require("agentkeepalive"));
|
|
28
|
+
const createHttpAgent = (opts) => new agentkeepalive_1.default({
|
|
29
|
+
...opts,
|
|
30
|
+
freeSocketTimeout: 30 * 1000,
|
|
31
|
+
keepAlive: true,
|
|
32
|
+
maxFreeSockets: 256,
|
|
33
|
+
socketActiveTTL: 120 * 1000,
|
|
34
|
+
});
|
|
35
|
+
exports.createHttpAgent = createHttpAgent;
|
|
36
|
+
const createHttpsAgent = (opts) => new agentkeepalive_1.HttpsAgent({
|
|
37
|
+
...opts,
|
|
38
|
+
freeSocketTimeout: 30 * 1000,
|
|
39
|
+
keepAlive: true,
|
|
40
|
+
maxFreeSockets: 256,
|
|
41
|
+
socketActiveTTL: 120 * 1000,
|
|
42
|
+
});
|
|
43
|
+
exports.createHttpsAgent = createHttpsAgent;
|
|
@@ -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,26 @@
|
|
|
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
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
5
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
__export(require("./JanusClient"));
|
|
12
|
-
__export(require("./typings"));
|
|
13
|
-
__export(require("./GraphQLClient"));
|
|
14
|
-
__export(require("./AppGraphQLClient"));
|
|
15
|
-
__export(require("./IOGraphQLClient"));
|
|
17
|
+
exports.inflightUrlWithQuery = exports.inflightURL = exports.CacheType = void 0;
|
|
18
|
+
__exportStar(require("./HttpClient"), exports);
|
|
19
|
+
__exportStar(require("./typings"), exports);
|
|
20
|
+
__exportStar(require("./GraphQLClient"), exports);
|
|
21
|
+
__exportStar(require("./agents"), exports);
|
|
16
22
|
var cache_1 = require("./middlewares/cache");
|
|
17
|
-
exports
|
|
23
|
+
Object.defineProperty(exports, "CacheType", { enumerable: true, get: function () { return cache_1.CacheType; } });
|
|
18
24
|
var inflight_1 = require("./middlewares/inflight");
|
|
19
|
-
exports
|
|
20
|
-
exports
|
|
25
|
+
Object.defineProperty(exports, "inflightURL", { enumerable: true, get: function () { return inflight_1.inflightURL; } });
|
|
26
|
+
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;
|
|
@@ -22,7 +28,7 @@ export interface Cached {
|
|
|
22
28
|
responseType?: string;
|
|
23
29
|
responseEncoding?: BufferEncoding;
|
|
24
30
|
}
|
|
25
|
-
export
|
|
31
|
+
export type CacheableRequestConfig = RequestConfig & {
|
|
26
32
|
url: string;
|
|
27
33
|
cacheable: CacheType;
|
|
28
34
|
memoizable: boolean;
|