@vtex/api 6.47.0 → 6.48.1-beta
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 +0 -3
- package/lib/{clients/apps → HttpClient}/AppClient.d.ts +3 -3
- package/lib/{clients/apps → HttpClient}/AppClient.js +5 -10
- package/lib/{clients/apps → HttpClient}/AppGraphQLClient.d.ts +3 -3
- package/lib/{clients/apps → HttpClient}/AppGraphQLClient.js +5 -10
- package/lib/{clients/external → HttpClient}/ExternalClient.d.ts +3 -3
- package/lib/{clients/external → HttpClient}/ExternalClient.js +2 -9
- package/lib/HttpClient/GraphQLClient.d.ts +1 -2
- package/lib/HttpClient/GraphQLClient.js +1 -4
- package/lib/HttpClient/HttpClient.d.ts +5 -6
- package/lib/HttpClient/HttpClient.js +21 -63
- package/lib/{clients → HttpClient}/IOClient.d.ts +4 -4
- package/lib/HttpClient/IOClient.js +14 -0
- package/lib/{clients → HttpClient}/IOGraphQLClient.d.ts +4 -4
- package/lib/{clients → HttpClient}/IOGraphQLClient.js +2 -2
- package/lib/{clients/infra → HttpClient}/InfraClient.d.ts +3 -3
- package/lib/{clients/infra → HttpClient}/InfraClient.js +4 -9
- package/lib/{clients/janus → HttpClient}/JanusClient.d.ts +3 -3
- package/lib/{clients/janus → HttpClient}/JanusClient.js +3 -7
- package/lib/HttpClient/factories/index.d.ts +8 -0
- package/lib/HttpClient/factories/index.js +31 -0
- package/lib/HttpClient/index.d.ts +7 -1
- package/lib/HttpClient/index.js +7 -1
- package/lib/HttpClient/middlewares/cache.d.ts +2 -8
- package/lib/HttpClient/middlewares/cache.js +31 -120
- package/lib/HttpClient/middlewares/cancellationToken.d.ts +1 -1
- package/lib/HttpClient/middlewares/cancellationToken.js +1 -2
- package/lib/HttpClient/middlewares/memoization.js +1 -8
- package/lib/HttpClient/middlewares/metrics.js +31 -12
- package/lib/HttpClient/middlewares/recorder.d.ts +1 -1
- package/lib/HttpClient/middlewares/recorder.js +13 -16
- package/lib/HttpClient/middlewares/request.d.ts +10 -0
- package/lib/HttpClient/middlewares/request.js +87 -0
- package/lib/HttpClient/typings.d.ts +9 -43
- package/lib/IODataSource.d.ts +27 -0
- package/lib/IODataSource.js +46 -0
- package/lib/caches/LRUCache.js +1 -5
- package/lib/caches/LRUDiskCache.js +1 -5
- package/lib/clients/Apps.d.ts +84 -0
- package/lib/clients/Apps.js +326 -0
- package/lib/clients/Assets.d.ts +21 -0
- package/lib/clients/{infra/Assets.js → Assets.js} +19 -74
- package/lib/clients/Billing.d.ts +11 -0
- package/lib/clients/{apps/Billing.js → Billing.js} +3 -8
- package/lib/clients/BillingMetrics.d.ts +12 -0
- package/lib/clients/BillingMetrics.js +10 -0
- package/lib/clients/{apps/Builder.d.ts → Builder.d.ts} +11 -12
- package/lib/clients/{apps/Builder.js → Builder.js} +22 -49
- package/lib/clients/Events.d.ts +6 -0
- package/lib/clients/Events.js +19 -0
- package/lib/clients/Housekeeper.d.ts +11 -0
- package/lib/clients/Housekeeper.js +24 -0
- package/lib/clients/ID.d.ts +22 -0
- package/lib/clients/ID.js +48 -0
- package/lib/clients/IOClients.d.ts +24 -29
- package/lib/clients/IOClients.js +26 -36
- package/lib/clients/LicenseManager.d.ts +6 -0
- package/lib/clients/{janus/LicenseManager.js → LicenseManager.js} +8 -23
- package/lib/clients/Logger.d.ts +27 -0
- package/lib/clients/Logger.js +32 -0
- package/lib/clients/Messages.d.ts +18 -0
- package/lib/clients/Messages.js +20 -0
- package/lib/clients/MessagesGraphQL.d.ts +63 -0
- package/lib/clients/MessagesGraphQL.js +50 -0
- package/lib/clients/Metadata.d.ts +25 -0
- package/lib/clients/Metadata.js +53 -0
- package/lib/clients/Registry.d.ts +61 -0
- package/lib/clients/{infra/Registry.js → Registry.js} +33 -93
- package/lib/clients/Router.d.ts +33 -0
- package/lib/clients/Router.js +50 -0
- package/lib/clients/{janus/Segment.d.ts → Segment.d.ts} +11 -7
- package/lib/clients/Segment.js +69 -0
- package/lib/clients/{janus/Session.d.ts → Session.d.ts} +4 -4
- package/lib/clients/{janus/Session.js → Session.js} +13 -24
- package/lib/clients/{apps/Settings.d.ts → Settings.d.ts} +4 -5
- package/lib/clients/{apps/Settings.js → Settings.js} +20 -14
- package/lib/clients/Sphinx.d.ts +12 -0
- package/lib/clients/Sphinx.js +19 -0
- package/lib/clients/{janus/Tenant.d.ts → Tenant.d.ts} +7 -6
- package/lib/clients/Tenant.js +13 -0
- package/lib/clients/VBase.d.ts +57 -0
- package/lib/clients/VBase.js +116 -0
- package/lib/clients/Workspaces.d.ts +17 -0
- package/lib/clients/Workspaces.js +38 -0
- package/lib/clients/index.d.ts +21 -9
- package/lib/clients/index.js +21 -12
- package/lib/constants.d.ts +1 -49
- package/lib/constants.js +1 -54
- package/lib/errors/ResolverError.d.ts +1 -1
- package/lib/errors/ResolverError.js +2 -2
- package/lib/errors/ResolverWarning.d.ts +1 -1
- package/lib/errors/ResolverWarning.js +2 -2
- package/lib/index.d.ts +7 -9
- package/lib/index.js +6 -8
- package/lib/metrics/MetricsAccumulator.d.ts +18 -1
- package/lib/metrics/MetricsAccumulator.js +22 -38
- package/lib/responses.d.ts +44 -3
- package/lib/service/Runtime.d.ts +18 -0
- package/lib/service/Runtime.js +57 -0
- package/lib/service/{worker/runtime/Service.d.ts → Service.d.ts} +5 -5
- package/lib/service/{worker/runtime/Service.js → Service.js} +1 -2
- package/lib/service/events/index.d.ts +3 -0
- package/lib/service/events/index.js +21 -0
- package/lib/service/graphql/index.d.ts +7 -0
- package/lib/service/graphql/index.js +33 -0
- package/lib/service/graphql/middlewares/error.js +107 -0
- package/lib/service/graphql/middlewares/formatters.d.ts +2 -0
- package/lib/service/graphql/middlewares/formatters.js +64 -0
- package/lib/service/graphql/middlewares/query.d.ts +2 -0
- package/lib/service/graphql/middlewares/query.js +32 -0
- package/lib/service/graphql/middlewares/response.js +36 -0
- package/lib/service/graphql/middlewares/run.d.ts +4 -0
- package/lib/service/graphql/middlewares/run.js +55 -0
- package/lib/service/graphql/middlewares/schema.d.ts +2 -0
- package/lib/service/graphql/middlewares/schema.js +8 -0
- package/lib/service/graphql/middlewares/timings.d.ts +2 -0
- package/lib/service/graphql/middlewares/timings.js +10 -0
- package/lib/service/graphql/middlewares/upload.d.ts +7 -0
- package/lib/service/graphql/schema/index.d.ts +3 -0
- package/lib/service/graphql/schema/index.js +66 -0
- package/lib/service/graphql/schema/messagesLoader.d.ts +4 -0
- package/lib/service/graphql/schema/messagesLoader.js +41 -0
- package/lib/service/graphql/schema/messagesLoaderV2.d.ts +5 -0
- package/lib/service/graphql/schema/messagesLoaderV2.js +44 -0
- package/lib/service/{worker/runtime/graphql → graphql}/schema/schemaDirectives/Auth.d.ts +0 -1
- package/lib/service/{worker/runtime/graphql → graphql}/schema/schemaDirectives/Auth.js +5 -11
- package/lib/service/{worker/runtime/graphql → graphql}/schema/schemaDirectives/Sanitize.d.ts +0 -1
- package/lib/service/{worker/runtime/graphql → graphql}/schema/schemaDirectives/Sanitize.js +0 -6
- package/lib/service/{worker/runtime/graphql → graphql}/schema/schemaDirectives/SmartCacheDirective.d.ts +0 -1
- package/lib/service/{worker/runtime/graphql → graphql}/schema/schemaDirectives/SmartCacheDirective.js +3 -8
- package/lib/service/{worker/runtime/graphql/schema/schemaDirectives/TranslateTo.d.ts → graphql/schema/schemaDirectives/Translatable.d.ts} +1 -2
- package/lib/service/graphql/schema/schemaDirectives/Translatable.js +54 -0
- package/lib/service/graphql/schema/schemaDirectives/TranslatableV2.d.ts +13 -0
- package/lib/service/graphql/schema/schemaDirectives/TranslatableV2.js +67 -0
- package/lib/service/graphql/schema/schemaDirectives/index.d.ts +13 -0
- package/lib/service/graphql/schema/schemaDirectives/index.js +17 -0
- package/lib/service/graphql/schema/typeDefs/index.d.ts +16 -0
- package/lib/service/graphql/schema/typeDefs/index.js +21 -0
- package/lib/service/graphql/schema/typeDefs/ioMessage.d.ts +8 -0
- package/lib/service/graphql/schema/typeDefs/ioMessage.js +33 -0
- package/lib/service/{worker/runtime/graphql → graphql}/schema/typeDefs/sanitizedString.js +1 -5
- package/lib/service/graphql/typings.d.ts +21 -0
- package/lib/service/graphql/utils/cacheControl.d.ts +6 -0
- package/lib/service/graphql/utils/cacheControl.js +38 -0
- package/lib/service/graphql/utils/maxAgeEnum.d.ts +6 -0
- package/lib/service/graphql/utils/maxAgeEnum.js +17 -0
- package/lib/service/http/index.d.ts +3 -0
- package/lib/service/http/index.js +18 -0
- package/lib/service/http/middlewares/authTokens.d.ts +3 -0
- package/lib/service/http/middlewares/cancellationToken.d.ts +3 -0
- package/lib/service/{worker/runtime/http → http}/middlewares/cancellationToken.js +1 -2
- package/lib/service/http/middlewares/clients.d.ts +4 -0
- package/lib/service/http/middlewares/error.d.ts +3 -0
- package/lib/service/{worker/runtime/http → http}/middlewares/error.js +10 -19
- package/lib/service/{worker/runtime/http → http}/middlewares/requestStats.d.ts +3 -3
- package/lib/service/http/middlewares/setCookie.d.ts +3 -0
- package/lib/service/http/middlewares/timings.d.ts +3 -0
- package/lib/service/{worker/runtime/http → http}/middlewares/timings.js +8 -21
- package/lib/service/http/middlewares/vary.d.ts +3 -0
- package/lib/service/{worker/runtime/http → http}/middlewares/vary.js +3 -3
- package/lib/service/logger/index.d.ts +28 -2
- package/lib/service/logger/index.js +68 -5
- package/lib/service/method.d.ts +9 -0
- package/lib/service/{worker/runtime/typings.d.ts → typings.d.ts} +36 -70
- package/lib/service/utils/compose.d.ts +4 -0
- package/lib/service/{worker/runtime/utils → utils}/compose.js +2 -2
- package/lib/utils/MineWinsConflictsResolver.d.ts +4 -5
- package/lib/utils/MineWinsConflictsResolver.js +17 -23
- package/lib/utils/MineWinsConflictsResolver.test.d.ts +1 -0
- package/lib/utils/MineWinsConflictsResolver.test.js +134 -0
- package/lib/utils/app.d.ts +1 -3
- package/lib/utils/app.js +1 -3
- package/lib/utils/appsStaleIfError.d.ts +1 -1
- package/lib/utils/appsStaleIfError.js +2 -2
- package/lib/utils/billingOptions.d.ts +3 -36
- package/lib/utils/billingOptions.js +3 -7
- package/lib/utils/binding.d.ts +3 -3
- package/lib/utils/cancel.d.ts +2 -2
- package/lib/utils/cancel.js +1 -2
- package/lib/utils/log.d.ts +3 -1
- package/lib/utils/log.js +2 -2
- package/lib/utils/message.js +1 -4
- package/lib/utils/tenant.d.ts +3 -3
- package/lib/utils/time.d.ts +2 -4
- package/lib/utils/time.js +2 -9
- package/lib/utils/unhandled.d.ts +1 -0
- package/lib/{service/worker/listeners.js → utils/unhandled.js} +15 -9
- package/package.json +2 -2
- package/CHANGELOG.md +0 -1846
- package/lib/HttpClient/agents.d.ts +0 -3
- package/lib/HttpClient/agents.js +0 -24
- package/lib/HttpClient/middlewares/request/HttpAgentSingleton.d.ts +0 -11
- package/lib/HttpClient/middlewares/request/HttpAgentSingleton.js +0 -30
- package/lib/HttpClient/middlewares/request/index.d.ts +0 -18
- package/lib/HttpClient/middlewares/request/index.js +0 -84
- package/lib/HttpClient/middlewares/request/setupAxios/index.d.ts +0 -1
- package/lib/HttpClient/middlewares/request/setupAxios/index.js +0 -20
- package/lib/HttpClient/middlewares/request/setupAxios/interceptors/exponentialBackoff.d.ts +0 -2
- package/lib/HttpClient/middlewares/request/setupAxios/interceptors/exponentialBackoff.js +0 -53
- package/lib/HttpClient/middlewares/request/setupAxios/interceptors/index.d.ts +0 -2
- package/lib/HttpClient/middlewares/request/setupAxios/interceptors/index.js +0 -7
- package/lib/HttpClient/middlewares/request/setupAxios/interceptors/tracing/index.d.ts +0 -8
- package/lib/HttpClient/middlewares/request/setupAxios/interceptors/tracing/index.js +0 -53
- package/lib/HttpClient/middlewares/request/setupAxios/interceptors/tracing/spanSetup.d.ts +0 -4
- package/lib/HttpClient/middlewares/request/setupAxios/interceptors/tracing/spanSetup.js +0 -29
- package/lib/HttpClient/middlewares/tracing.d.ts +0 -15
- package/lib/HttpClient/middlewares/tracing.js +0 -56
- package/lib/clients/IOClient.js +0 -19
- package/lib/clients/apps/Billing.d.ts +0 -12
- package/lib/clients/apps/MessagesGraphQL.d.ts +0 -61
- package/lib/clients/apps/MessagesGraphQL.js +0 -121
- package/lib/clients/apps/catalogGraphQL/brand.d.ts +0 -13
- package/lib/clients/apps/catalogGraphQL/brand.js +0 -18
- package/lib/clients/apps/catalogGraphQL/category.d.ts +0 -11
- package/lib/clients/apps/catalogGraphQL/category.js +0 -16
- package/lib/clients/apps/catalogGraphQL/index.d.ts +0 -22
- package/lib/clients/apps/catalogGraphQL/index.js +0 -88
- package/lib/clients/apps/catalogGraphQL/product.d.ts +0 -25
- package/lib/clients/apps/catalogGraphQL/product.js +0 -30
- package/lib/clients/apps/catalogGraphQL/sku.d.ts +0 -26
- package/lib/clients/apps/catalogGraphQL/sku.js +0 -30
- package/lib/clients/apps/index.d.ts +0 -7
- package/lib/clients/apps/index.js +0 -12
- package/lib/clients/external/ID.d.ts +0 -23
- package/lib/clients/external/ID.js +0 -60
- package/lib/clients/external/Masterdata.d.ts +0 -94
- package/lib/clients/external/Masterdata.js +0 -224
- package/lib/clients/external/PaymentProvider.d.ts +0 -31
- package/lib/clients/external/PaymentProvider.js +0 -42
- package/lib/clients/external/index.d.ts +0 -4
- package/lib/clients/external/index.js +0 -9
- package/lib/clients/infra/Apps.d.ts +0 -88
- package/lib/clients/infra/Apps.js +0 -508
- package/lib/clients/infra/Assets.d.ts +0 -34
- package/lib/clients/infra/BillingMetrics.d.ts +0 -13
- package/lib/clients/infra/BillingMetrics.js +0 -15
- package/lib/clients/infra/Events.d.ts +0 -12
- package/lib/clients/infra/Events.js +0 -33
- package/lib/clients/infra/Housekeeper.d.ts +0 -10
- package/lib/clients/infra/Housekeeper.js +0 -30
- package/lib/clients/infra/Metadata.d.ts +0 -26
- package/lib/clients/infra/Metadata.js +0 -83
- package/lib/clients/infra/Registry.d.ts +0 -59
- package/lib/clients/infra/Router.d.ts +0 -34
- package/lib/clients/infra/Router.js +0 -81
- package/lib/clients/infra/Sphinx.d.ts +0 -13
- package/lib/clients/infra/Sphinx.js +0 -29
- package/lib/clients/infra/VBase.d.ts +0 -60
- package/lib/clients/infra/VBase.js +0 -196
- package/lib/clients/infra/Workspaces.d.ts +0 -18
- package/lib/clients/infra/Workspaces.js +0 -65
- package/lib/clients/infra/index.d.ts +0 -12
- package/lib/clients/infra/index.js +0 -17
- package/lib/clients/janus/LicenseManager.d.ts +0 -7
- package/lib/clients/janus/Segment.js +0 -88
- package/lib/clients/janus/Tenant.js +0 -28
- package/lib/clients/janus/index.d.ts +0 -5
- package/lib/clients/janus/index.js +0 -10
- package/lib/service/index.d.ts +0 -2
- package/lib/service/index.js +0 -30
- package/lib/service/loaders.d.ts +0 -8
- package/lib/service/loaders.js +0 -54
- package/lib/service/logger/console.d.ts +0 -10
- package/lib/service/logger/console.js +0 -36
- package/lib/service/logger/logger.d.ts +0 -29
- package/lib/service/logger/logger.js +0 -61
- package/lib/service/logger/metricsLogger.d.ts +0 -40
- package/lib/service/logger/metricsLogger.js +0 -149
- package/lib/service/master.d.ts +0 -2
- package/lib/service/master.js +0 -87
- package/lib/service/metrics/requestMetricsMiddleware.d.ts +0 -2
- package/lib/service/metrics/requestMetricsMiddleware.js +0 -44
- package/lib/service/tracing/TracerSingleton.d.ts +0 -7
- package/lib/service/tracing/TracerSingleton.js +0 -48
- package/lib/service/tracing/metrics/MetricNames.d.ts +0 -60
- package/lib/service/tracing/metrics/MetricNames.js +0 -44
- package/lib/service/tracing/metrics/instruments.d.ts +0 -9
- package/lib/service/tracing/metrics/instruments.js +0 -11
- package/lib/service/tracing/metrics/measurers/EventLoopLagMeasurer.d.ts +0 -9
- package/lib/service/tracing/metrics/measurers/EventLoopLagMeasurer.js +0 -25
- package/lib/service/tracing/tracingMiddlewares.d.ts +0 -5
- package/lib/service/tracing/tracingMiddlewares.js +0 -107
- package/lib/service/worker/index.d.ts +0 -11
- package/lib/service/worker/index.js +0 -195
- package/lib/service/worker/listeners.d.ts +0 -3
- package/lib/service/worker/runtime/builtIn/handlers.d.ts +0 -4
- package/lib/service/worker/runtime/builtIn/handlers.js +0 -30
- package/lib/service/worker/runtime/builtIn/middlewares.d.ts +0 -4
- package/lib/service/worker/runtime/builtIn/middlewares.js +0 -40
- package/lib/service/worker/runtime/events/index.d.ts +0 -4
- package/lib/service/worker/runtime/events/index.js +0 -46
- package/lib/service/worker/runtime/events/middlewares/body.d.ts +0 -3
- package/lib/service/worker/runtime/events/middlewares/body.js +0 -22
- package/lib/service/worker/runtime/events/middlewares/context.d.ts +0 -3
- package/lib/service/worker/runtime/events/middlewares/context.js +0 -22
- package/lib/service/worker/runtime/events/router.d.ts +0 -2
- package/lib/service/worker/runtime/events/router.js +0 -27
- package/lib/service/worker/runtime/graphql/index.d.ts +0 -6
- package/lib/service/worker/runtime/graphql/index.js +0 -27
- package/lib/service/worker/runtime/graphql/middlewares/context.d.ts +0 -2
- package/lib/service/worker/runtime/graphql/middlewares/context.js +0 -16
- package/lib/service/worker/runtime/graphql/middlewares/error.js +0 -93
- package/lib/service/worker/runtime/graphql/middlewares/query.d.ts +0 -2
- package/lib/service/worker/runtime/graphql/middlewares/query.js +0 -52
- package/lib/service/worker/runtime/graphql/middlewares/response.js +0 -38
- package/lib/service/worker/runtime/graphql/middlewares/run.d.ts +0 -2
- package/lib/service/worker/runtime/graphql/middlewares/run.js +0 -19
- package/lib/service/worker/runtime/graphql/middlewares/updateSchema.d.ts +0 -4
- package/lib/service/worker/runtime/graphql/middlewares/updateSchema.js +0 -28
- package/lib/service/worker/runtime/graphql/middlewares/upload.d.ts +0 -4
- package/lib/service/worker/runtime/graphql/schema/index.d.ts +0 -7
- package/lib/service/worker/runtime/graphql/schema/index.js +0 -31
- package/lib/service/worker/runtime/graphql/schema/messagesLoaderV2.d.ts +0 -6
- package/lib/service/worker/runtime/graphql/schema/messagesLoaderV2.js +0 -79
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/CacheControl.d.ts +0 -7
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/CacheControl.js +0 -37
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/Deprecated.d.ts +0 -11
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/Deprecated.js +0 -61
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/Metric.d.ts +0 -7
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/Metric.js +0 -40
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/Settings.d.ts +0 -6
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/Settings.js +0 -34
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/TranslatableV2.d.ts +0 -7
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/TranslatableV2.js +0 -39
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/TranslateTo.js +0 -33
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/index.d.ts +0 -22
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/index.js +0 -36
- package/lib/service/worker/runtime/graphql/schema/typeDefs/index.d.ts +0 -7
- package/lib/service/worker/runtime/graphql/schema/typeDefs/index.js +0 -12
- package/lib/service/worker/runtime/graphql/typings.d.ts +0 -31
- package/lib/service/worker/runtime/graphql/utils/cacheControl.d.ts +0 -1
- package/lib/service/worker/runtime/graphql/utils/cacheControl.js +0 -32
- package/lib/service/worker/runtime/graphql/utils/error.d.ts +0 -1
- package/lib/service/worker/runtime/graphql/utils/error.js +0 -76
- package/lib/service/worker/runtime/graphql/utils/translations.d.ts +0 -14
- package/lib/service/worker/runtime/graphql/utils/translations.js +0 -38
- package/lib/service/worker/runtime/http/index.d.ts +0 -5
- package/lib/service/worker/runtime/http/index.js +0 -58
- package/lib/service/worker/runtime/http/middlewares/authTokens.d.ts +0 -3
- package/lib/service/worker/runtime/http/middlewares/cancellationToken.d.ts +0 -3
- package/lib/service/worker/runtime/http/middlewares/clients.d.ts +0 -4
- package/lib/service/worker/runtime/http/middlewares/context.d.ts +0 -4
- package/lib/service/worker/runtime/http/middlewares/context.js +0 -36
- package/lib/service/worker/runtime/http/middlewares/error.d.ts +0 -2
- package/lib/service/worker/runtime/http/middlewares/rateLimit.d.ts +0 -6
- package/lib/service/worker/runtime/http/middlewares/rateLimit.js +0 -42
- package/lib/service/worker/runtime/http/middlewares/setCookie.d.ts +0 -3
- package/lib/service/worker/runtime/http/middlewares/settings.d.ts +0 -9
- package/lib/service/worker/runtime/http/middlewares/settings.js +0 -44
- package/lib/service/worker/runtime/http/middlewares/timings.d.ts +0 -3
- package/lib/service/worker/runtime/http/middlewares/vary.d.ts +0 -3
- package/lib/service/worker/runtime/http/router.d.ts +0 -2
- package/lib/service/worker/runtime/http/router.js +0 -23
- package/lib/service/worker/runtime/http/routes.d.ts +0 -19
- package/lib/service/worker/runtime/http/routes.js +0 -12
- package/lib/service/worker/runtime/method.d.ts +0 -9
- package/lib/service/worker/runtime/statusTrack.d.ts +0 -14
- package/lib/service/worker/runtime/statusTrack.js +0 -37
- package/lib/service/worker/runtime/utils/compose.d.ts +0 -5
- package/lib/service/worker/runtime/utils/context.d.ts +0 -2
- package/lib/service/worker/runtime/utils/context.js +0 -40
- package/lib/service/worker/runtime/utils/diff.d.ts +0 -12
- package/lib/service/worker/runtime/utils/diff.js +0 -21
- package/lib/service/worker/runtime/utils/recorder.d.ts +0 -8
- package/lib/service/worker/runtime/utils/recorder.js +0 -37
- package/lib/service/worker/runtime/utils/tokenBucket.d.ts +0 -2
- package/lib/service/worker/runtime/utils/tokenBucket.js +0 -16
- package/lib/tracing/LogEvents.d.ts +0 -31
- package/lib/tracing/LogEvents.js +0 -3
- package/lib/tracing/LogFields.d.ts +0 -66
- package/lib/tracing/LogFields.js +0 -3
- package/lib/tracing/Tags.d.ts +0 -81
- package/lib/tracing/Tags.js +0 -7
- package/lib/tracing/UserLandTracer.d.ts +0 -27
- package/lib/tracing/UserLandTracer.js +0 -56
- package/lib/tracing/errorReporting/ErrorReport.d.ts +0 -31
- package/lib/tracing/errorReporting/ErrorReport.js +0 -70
- package/lib/tracing/index.d.ts +0 -9
- package/lib/tracing/index.js +0 -19
- package/lib/tracing/spanReference/SpanReferenceTypes.d.ts +0 -4
- package/lib/tracing/spanReference/SpanReferenceTypes.js +0 -7
- package/lib/tracing/spanReference/createSpanReference.d.ts +0 -3
- package/lib/tracing/spanReference/createSpanReference.js +0 -8
- package/lib/tracing/utils.d.ts +0 -13
- package/lib/tracing/utils.js +0 -40
- package/lib/utils/conflicts.mock.d.ts +0 -17
- package/lib/utils/conflicts.mock.js +0 -27
- /package/lib/service/{worker/runtime/graphql → graphql}/middlewares/error.d.ts +0 -0
- /package/lib/service/{worker/runtime/graphql → graphql}/middlewares/response.d.ts +0 -0
- /package/lib/service/{worker/runtime/graphql → graphql}/middlewares/upload.js +0 -0
- /package/lib/service/{worker/runtime/graphql → graphql}/schema/typeDefs/ioUpload.d.ts +0 -0
- /package/lib/service/{worker/runtime/graphql → graphql}/schema/typeDefs/ioUpload.js +0 -0
- /package/lib/service/{worker/runtime/graphql → graphql}/schema/typeDefs/sanitizedString.d.ts +0 -0
- /package/lib/service/{worker/runtime/graphql → graphql}/typings.js +0 -0
- /package/lib/service/{worker/runtime/utils/toArray.d.ts → graphql/utils/array.d.ts} +0 -0
- /package/lib/service/{worker/runtime/utils/toArray.js → graphql/utils/array.js} +0 -0
- /package/lib/service/{worker/runtime/graphql → graphql}/utils/pathname.d.ts +0 -0
- /package/lib/service/{worker/runtime/graphql → graphql}/utils/pathname.js +0 -0
- /package/lib/service/{worker/runtime/http → http}/middlewares/authTokens.js +0 -0
- /package/lib/service/{worker/runtime/http → http}/middlewares/clients.js +0 -0
- /package/lib/service/{worker/runtime/http → http}/middlewares/requestStats.js +0 -0
- /package/lib/service/{worker/runtime/http → http}/middlewares/setCookie.js +0 -0
- /package/lib/service/{worker/runtime/method.js → method.js} +0 -0
- /package/lib/service/{worker/runtime/typings.js → typings.js} +0 -0
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const domain_1 = require("../../../../../utils/domain");
|
|
4
|
-
const PRIVATE_ROUTE_REGEX = /_v\/graphql\/private\/v*/;
|
|
5
|
-
const linked = !!process.env.VTEX_APP_LINK;
|
|
6
|
-
const isPrivateRoute = ({ request: { headers } }) => PRIVATE_ROUTE_REGEX.test(headers['x-forwarded-path'] || '');
|
|
7
|
-
const publicRegExp = (endpoint) => new RegExp(`.*${endpoint.replace('.', '\\.')}.*`);
|
|
8
|
-
const isPublicEndpoint = ({ request: { headers } }) => {
|
|
9
|
-
const host = headers['x-forwarded-host'];
|
|
10
|
-
if (headers.origin || !host) {
|
|
11
|
-
return false;
|
|
12
|
-
}
|
|
13
|
-
return domain_1.PUBLIC_DOMAINS.some(endpoint => publicRegExp(endpoint).test(host));
|
|
14
|
-
};
|
|
15
|
-
exports.cacheControlHTTP = (ctx) => {
|
|
16
|
-
const { graphql: { cacheControl: { maxAge, scope: scopeHint, noCache: noCacheHint, noStore: noStoreHint, }, }, vtex: { production, }, } = ctx;
|
|
17
|
-
const finalHeader = [];
|
|
18
|
-
const noCache = noCacheHint || !production || isPublicEndpoint(ctx);
|
|
19
|
-
if (noCache) {
|
|
20
|
-
finalHeader.push('no-cache');
|
|
21
|
-
}
|
|
22
|
-
const noStore = noStoreHint || linked;
|
|
23
|
-
if (noStore) {
|
|
24
|
-
finalHeader.push('no-store');
|
|
25
|
-
}
|
|
26
|
-
if (!noCache && !noStore) {
|
|
27
|
-
const scope = scopeHint === 'private' || isPrivateRoute(ctx) ? 'private' : 'public';
|
|
28
|
-
finalHeader.push(scope);
|
|
29
|
-
finalHeader.push(`max-age=${maxAge}`);
|
|
30
|
-
}
|
|
31
|
-
return finalHeader.join(',');
|
|
32
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const createFormatError: (ctx: import("../../typings").ServiceContext<import("../../../../..").IOClients, import("../../typings").RecorderState, import("../typings").GraphQLContext>) => (error: any) => any;
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const ramda_1 = require("ramda");
|
|
4
|
-
const error_1 = require("../../../../../utils/error");
|
|
5
|
-
const ERROR_FIELD_WHITELIST = ['message', 'path', 'stack', 'extensions', 'statusCode', 'name', 'headers', 'originalError', 'code'];
|
|
6
|
-
const QUERY_FIELDS = ['query', 'operationName', 'variables'];
|
|
7
|
-
const trimVariables = (variables) => {
|
|
8
|
-
if (variables) {
|
|
9
|
-
const stringifiedVariables = JSON.stringify(variables);
|
|
10
|
-
return stringifiedVariables.length <= 1024
|
|
11
|
-
? stringifiedVariables
|
|
12
|
-
: `${stringifiedVariables.slice(0, 992)} [Truncated: variables too long]`;
|
|
13
|
-
}
|
|
14
|
-
return '';
|
|
15
|
-
};
|
|
16
|
-
const detailsFromCtx = (ctx) => {
|
|
17
|
-
const { headers: { 'x-forwarded-host': forwardedHost, 'x-forwarded-proto': forwardedProto, 'x-vtex-platform': platform, }, vtex: { operationId, requestId, }, } = ctx;
|
|
18
|
-
const queryRest = ramda_1.pick(QUERY_FIELDS, ctx.graphql.query || {});
|
|
19
|
-
const variables = ctx.request.is('multipart/form-data')
|
|
20
|
-
? '[GraphQL Upload]'
|
|
21
|
-
: trimVariables(queryRest.variables);
|
|
22
|
-
const query = {
|
|
23
|
-
...queryRest,
|
|
24
|
-
variables,
|
|
25
|
-
};
|
|
26
|
-
return {
|
|
27
|
-
forwardedHost,
|
|
28
|
-
forwardedProto,
|
|
29
|
-
operationId,
|
|
30
|
-
platform,
|
|
31
|
-
query,
|
|
32
|
-
requestId,
|
|
33
|
-
};
|
|
34
|
-
};
|
|
35
|
-
const formatError = (error, details) => {
|
|
36
|
-
const formattedError = ramda_1.pick(ERROR_FIELD_WHITELIST, error);
|
|
37
|
-
if (!formattedError.extensions) {
|
|
38
|
-
formattedError.extensions = {
|
|
39
|
-
code: 'INTERNAL_SERVER_ERROR',
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
if (formattedError.originalError) {
|
|
43
|
-
formattedError.originalError = error_1.cleanError(formattedError.originalError);
|
|
44
|
-
if (formattedError.stack === formattedError.originalError.stack) {
|
|
45
|
-
delete formattedError.originalError.stack;
|
|
46
|
-
}
|
|
47
|
-
if (!formattedError.extensions.exception) {
|
|
48
|
-
formattedError.extensions.exception = {
|
|
49
|
-
message: formattedError.originalError.message,
|
|
50
|
-
name: formattedError.originalError.name,
|
|
51
|
-
...ramda_1.omit(error_1.SENSITIVE_EXCEPTION_FIELDS, formattedError.originalError),
|
|
52
|
-
sensitive: ramda_1.pick(error_1.SENSITIVE_EXCEPTION_FIELDS, formattedError.originalError),
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
56
|
-
const mergedException = { ...formattedError.originalError,
|
|
57
|
-
...formattedError.extensions.exception,
|
|
58
|
-
};
|
|
59
|
-
const extendedException = {
|
|
60
|
-
message: formattedError.originalError.message,
|
|
61
|
-
name: formattedError.originalError.name,
|
|
62
|
-
...ramda_1.omit(error_1.SENSITIVE_EXCEPTION_FIELDS, mergedException),
|
|
63
|
-
sensitive: ramda_1.pick(error_1.SENSITIVE_EXCEPTION_FIELDS, mergedException),
|
|
64
|
-
};
|
|
65
|
-
formattedError.extensions.exception = error_1.cleanError(extendedException);
|
|
66
|
-
}
|
|
67
|
-
// Make originalError not enumerable to prevent duplicated log and response information
|
|
68
|
-
Object.defineProperty(formattedError, 'originalError', { enumerable: false });
|
|
69
|
-
}
|
|
70
|
-
Object.assign(formattedError, details);
|
|
71
|
-
return formattedError;
|
|
72
|
-
};
|
|
73
|
-
exports.createFormatError = (ctx) => {
|
|
74
|
-
const details = detailsFromCtx(ctx);
|
|
75
|
-
return (error) => formatError(error, details);
|
|
76
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Behavior } from '../../../../../clients';
|
|
2
|
-
import { IOContext } from '../../typings';
|
|
3
|
-
export declare const CONTEXT_REGEX: RegExp;
|
|
4
|
-
export declare const FROM_REGEX: RegExp;
|
|
5
|
-
export declare const CONTENT_REGEX: RegExp;
|
|
6
|
-
export interface TranslatableMessageV2 {
|
|
7
|
-
from?: string;
|
|
8
|
-
content: string;
|
|
9
|
-
context?: string;
|
|
10
|
-
}
|
|
11
|
-
export declare type TranslationDirectiveType = 'translatableV2' | 'translateTo';
|
|
12
|
-
export declare const parseTranslatableStringV2: (rawMessage: string) => TranslatableMessageV2;
|
|
13
|
-
export declare const formatTranslatableStringV2: ({ from, content, context }: TranslatableMessageV2) => string;
|
|
14
|
-
export declare const handleSingleString: (ctx: IOContext, loader: import("dataloader")<import("../../../../../clients").Message, string>, behavior: Behavior, directiveName: TranslationDirectiveType) => (rawMessage: string | null) => Promise<string | null>;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CONTEXT_REGEX = /\(\(\((?<context>(.)*)\)\)\)/;
|
|
4
|
-
exports.FROM_REGEX = /\<\<\<(?<from>(.)*)\>\>\>/;
|
|
5
|
-
exports.CONTENT_REGEX = /\(\(\((?<context>(.)*)\)\)\)|\<\<\<(?<from>(.)*)\>\>\>/g;
|
|
6
|
-
exports.parseTranslatableStringV2 = (rawMessage) => {
|
|
7
|
-
var _a, _b, _c, _d;
|
|
8
|
-
const context = (_b = (_a = rawMessage.match(exports.CONTEXT_REGEX)) === null || _a === void 0 ? void 0 : _a.groups) === null || _b === void 0 ? void 0 : _b.context;
|
|
9
|
-
const from = (_d = (_c = rawMessage.match(exports.FROM_REGEX)) === null || _c === void 0 ? void 0 : _c.groups) === null || _d === void 0 ? void 0 : _d.from;
|
|
10
|
-
const content = rawMessage.replace(exports.CONTENT_REGEX, '');
|
|
11
|
-
return {
|
|
12
|
-
content: content === null || content === void 0 ? void 0 : content.trim(),
|
|
13
|
-
context: context === null || context === void 0 ? void 0 : context.trim(),
|
|
14
|
-
from: from === null || from === void 0 ? void 0 : from.trim(),
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
exports.formatTranslatableStringV2 = ({ from, content, context }) => `${content} ${context ? `(((${context})))` : ''} ${from ? `<<<${from}>>>` : ''}`;
|
|
18
|
-
exports.handleSingleString = (ctx, loader, behavior, directiveName) => async (rawMessage) => {
|
|
19
|
-
// Messages only know how to process non empty strings.
|
|
20
|
-
if (rawMessage == null) {
|
|
21
|
-
return rawMessage;
|
|
22
|
-
}
|
|
23
|
-
const { content, context, from: maybeFrom } = exports.parseTranslatableStringV2(rawMessage);
|
|
24
|
-
const { binding, tenant } = ctx;
|
|
25
|
-
if (content == null) {
|
|
26
|
-
throw new Error(`@${directiveName} directive needs a content to translate, but received ${JSON.stringify(rawMessage)}`);
|
|
27
|
-
}
|
|
28
|
-
const from = maybeFrom || (binding === null || binding === void 0 ? void 0 : binding.locale) || (tenant === null || tenant === void 0 ? void 0 : tenant.locale);
|
|
29
|
-
if (from == null) {
|
|
30
|
-
throw new Error(`@${directiveName} directive needs a source language to translate from. You can do this by either setting ${'`ctx.vtex.tenant`'} variable, call this app with the header ${'`x-vtex-tenant`'} or format the string with the ${'`formatTranslatableStringV2`'} function with the ${'`from`'} option set`);
|
|
31
|
-
}
|
|
32
|
-
return loader.load({
|
|
33
|
-
behavior,
|
|
34
|
-
content,
|
|
35
|
-
context,
|
|
36
|
-
from,
|
|
37
|
-
});
|
|
38
|
-
};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import TokenBucket from 'tokenbucket';
|
|
2
|
-
import { IOClients } from '../../../../clients/IOClients';
|
|
3
|
-
import { ClientsConfig, ParamsContext, RecorderState, ServiceRoute } from '../typings';
|
|
4
|
-
export declare const createPrivateHttpRoute: <T extends IOClients, U extends RecorderState, V extends ParamsContext>(clientsConfig: ClientsConfig<T>, serviceHandler: import("koa-compose").Middleware<import("../typings").ServiceContext<T, U, V>> | import("koa-compose").Middleware<import("../typings").ServiceContext<T, U, V>>[], serviceRoute: ServiceRoute, routeId: string, globalLimiter: TokenBucket | undefined) => import("koa-compose").ComposedMiddleware<import("../typings").ServiceContext<T, U, V>>;
|
|
5
|
-
export declare const createPublicHttpRoute: <T extends IOClients, U extends RecorderState, V extends ParamsContext>(clientsConfig: ClientsConfig<T>, serviceHandler: import("koa-compose").Middleware<import("../typings").ServiceContext<T, U, V>> | import("koa-compose").Middleware<import("../typings").ServiceContext<T, U, V>>[], serviceRoute: ServiceRoute, routeId: string, globalLimiter: TokenBucket | undefined) => import("koa-compose").ComposedMiddleware<import("../typings").ServiceContext<T, U, V>>;
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tracingMiddlewares_1 = require("../../../tracing/tracingMiddlewares");
|
|
4
|
-
const compose_1 = require("../utils/compose");
|
|
5
|
-
const toArray_1 = require("../utils/toArray");
|
|
6
|
-
const authTokens_1 = require("./middlewares/authTokens");
|
|
7
|
-
const cancellationToken_1 = require("./middlewares/cancellationToken");
|
|
8
|
-
const clients_1 = require("./middlewares/clients");
|
|
9
|
-
const context_1 = require("./middlewares/context");
|
|
10
|
-
const rateLimit_1 = require("./middlewares/rateLimit");
|
|
11
|
-
const requestStats_1 = require("./middlewares/requestStats");
|
|
12
|
-
const setCookie_1 = require("./middlewares/setCookie");
|
|
13
|
-
const settings_1 = require("./middlewares/settings");
|
|
14
|
-
const timings_1 = require("./middlewares/timings");
|
|
15
|
-
const vary_1 = require("./middlewares/vary");
|
|
16
|
-
exports.createPrivateHttpRoute = (clientsConfig, serviceHandler, serviceRoute, routeId, globalLimiter) => {
|
|
17
|
-
var _a, _b;
|
|
18
|
-
const { implementation, options } = clientsConfig;
|
|
19
|
-
const middlewares = toArray_1.toArray(serviceHandler);
|
|
20
|
-
const pipeline = [
|
|
21
|
-
tracingMiddlewares_1.nameSpanOperationMiddleware('private-handler', routeId),
|
|
22
|
-
context_1.createPvtContextMiddleware(routeId, serviceRoute),
|
|
23
|
-
cancellationToken_1.cancellationToken,
|
|
24
|
-
requestStats_1.trackIncomingRequestStats,
|
|
25
|
-
vary_1.vary,
|
|
26
|
-
authTokens_1.authTokens,
|
|
27
|
-
clients_1.clients(implementation, options),
|
|
28
|
-
...(serviceRoute.settingsType === 'workspace' || serviceRoute.settingsType === 'userAndWorkspace' ? [settings_1.getServiceSettings()] : []),
|
|
29
|
-
timings_1.timings,
|
|
30
|
-
rateLimit_1.concurrentRateLimiter((_a = serviceRoute === null || serviceRoute === void 0 ? void 0 : serviceRoute.rateLimitPerReplica) === null || _a === void 0 ? void 0 : _a.concurrent),
|
|
31
|
-
rateLimit_1.perMinuteRateLimiter((_b = serviceRoute === null || serviceRoute === void 0 ? void 0 : serviceRoute.rateLimitPerReplica) === null || _b === void 0 ? void 0 : _b.perMinute, globalLimiter),
|
|
32
|
-
tracingMiddlewares_1.traceUserLandRemainingPipelineMiddleware(),
|
|
33
|
-
...middlewares,
|
|
34
|
-
];
|
|
35
|
-
return compose_1.compose(pipeline);
|
|
36
|
-
};
|
|
37
|
-
exports.createPublicHttpRoute = (clientsConfig, serviceHandler, serviceRoute, routeId, globalLimiter) => {
|
|
38
|
-
var _a, _b;
|
|
39
|
-
const { implementation, options } = clientsConfig;
|
|
40
|
-
const middlewares = toArray_1.toArray(serviceHandler);
|
|
41
|
-
const pipeline = [
|
|
42
|
-
tracingMiddlewares_1.nameSpanOperationMiddleware('public-handler', routeId),
|
|
43
|
-
context_1.createPubContextMiddleware(routeId, serviceRoute),
|
|
44
|
-
cancellationToken_1.cancellationToken,
|
|
45
|
-
requestStats_1.trackIncomingRequestStats,
|
|
46
|
-
vary_1.vary,
|
|
47
|
-
authTokens_1.authTokens,
|
|
48
|
-
clients_1.clients(implementation, options),
|
|
49
|
-
...(serviceRoute.settingsType === 'workspace' || serviceRoute.settingsType === 'userAndWorkspace' ? [settings_1.getServiceSettings()] : []),
|
|
50
|
-
setCookie_1.removeSetCookie,
|
|
51
|
-
timings_1.timings,
|
|
52
|
-
rateLimit_1.concurrentRateLimiter((_a = serviceRoute === null || serviceRoute === void 0 ? void 0 : serviceRoute.rateLimitPerReplica) === null || _a === void 0 ? void 0 : _a.concurrent),
|
|
53
|
-
rateLimit_1.perMinuteRateLimiter((_b = serviceRoute === null || serviceRoute === void 0 ? void 0 : serviceRoute.rateLimitPerReplica) === null || _b === void 0 ? void 0 : _b.perMinute, globalLimiter),
|
|
54
|
-
tracingMiddlewares_1.traceUserLandRemainingPipelineMiddleware(),
|
|
55
|
-
...middlewares,
|
|
56
|
-
];
|
|
57
|
-
return compose_1.compose(pipeline);
|
|
58
|
-
};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { IOClients } from '../../../../../clients/IOClients';
|
|
2
|
-
import { ParamsContext, RecorderState, ServiceContext } from '../../typings';
|
|
3
|
-
export declare function authTokens<T extends IOClients, U extends RecorderState, V extends ParamsContext>(ctx: ServiceContext<T, U, V>, next: () => Promise<void>): Promise<void>;
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { IOClients } from '../../../../../clients/IOClients';
|
|
2
|
-
import { ParamsContext, RecorderState, ServiceContext } from '../../typings';
|
|
3
|
-
export declare function cancellationToken<T extends IOClients, U extends RecorderState, V extends ParamsContext>(ctx: ServiceContext<T, U, V>, next: () => Promise<void>): Promise<void>;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { ClientsImplementation, IOClients } from '../../../../../clients/IOClients';
|
|
2
|
-
import { InstanceOptions } from '../../../../../HttpClient';
|
|
3
|
-
import { ParamsContext, RecorderState, ServiceContext } from '../../typings';
|
|
4
|
-
export declare function clients<T extends IOClients, U extends RecorderState, V extends ParamsContext>(ClientsImpl: ClientsImplementation<T>, clientOptions: Record<string, InstanceOptions>): (ctx: ServiceContext<T, U, V>, next: () => Promise<void>) => Promise<void>;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { IOClients } from '../../../../../clients/IOClients';
|
|
2
|
-
import { ParamsContext, RecorderState, ServiceContext, ServiceRoute } from './../../typings';
|
|
3
|
-
export declare const createPvtContextMiddleware: (routeId: string, { smartcache }: ServiceRoute) => <T extends IOClients, U extends RecorderState, V extends ParamsContext>(ctx: ServiceContext<T, U, V>, next: () => Promise<void>) => Promise<void>;
|
|
4
|
-
export declare const createPubContextMiddleware: (routeId: string, { smartcache }: ServiceRoute) => <T extends IOClients, U extends RecorderState, V extends ParamsContext>(ctx: ServiceContext<T, U, V>, next: () => Promise<void>) => Promise<void>;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const querystring_1 = require("querystring");
|
|
4
|
-
const constants_1 = require("../../../../../constants");
|
|
5
|
-
const context_1 = require("../../utils/context");
|
|
6
|
-
exports.createPvtContextMiddleware = (routeId, { smartcache }) => {
|
|
7
|
-
return async function pvtContext(ctx, next) {
|
|
8
|
-
const { params, request: { header }, } = ctx;
|
|
9
|
-
ctx.vtex = {
|
|
10
|
-
...context_1.prepareHandlerCtx(header, ctx.tracing),
|
|
11
|
-
...(smartcache && { recorder: ctx.state.recorder }),
|
|
12
|
-
route: {
|
|
13
|
-
id: routeId,
|
|
14
|
-
params,
|
|
15
|
-
type: 'private',
|
|
16
|
-
},
|
|
17
|
-
};
|
|
18
|
-
await next();
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
|
-
exports.createPubContextMiddleware = (routeId, { smartcache }) => {
|
|
22
|
-
return async function pubContext(ctx, next) {
|
|
23
|
-
const { request: { header }, } = ctx;
|
|
24
|
-
ctx.vtex = {
|
|
25
|
-
...context_1.prepareHandlerCtx(header, ctx.tracing),
|
|
26
|
-
...(smartcache && { recorder: ctx.state.recorder }),
|
|
27
|
-
route: {
|
|
28
|
-
declarer: header[constants_1.COLOSSUS_ROUTE_DECLARER_HEADER],
|
|
29
|
-
id: routeId,
|
|
30
|
-
params: querystring_1.parse(header[constants_1.COLOSSUS_PARAMS_HEADER]),
|
|
31
|
-
type: 'public',
|
|
32
|
-
},
|
|
33
|
-
};
|
|
34
|
-
await next();
|
|
35
|
-
};
|
|
36
|
-
};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import TokenBucket from 'tokenbucket';
|
|
2
|
-
import { ServiceContext } from '../../typings';
|
|
3
|
-
declare function noopMiddleware(_: ServiceContext, next: () => Promise<void>): Promise<void>;
|
|
4
|
-
export declare function perMinuteRateLimiter(rateLimit?: number, globalLimiter?: TokenBucket): typeof noopMiddleware;
|
|
5
|
-
export declare function concurrentRateLimiter(rateLimit?: number): typeof noopMiddleware;
|
|
6
|
-
export {};
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const errors_1 = require("../../../../../errors");
|
|
4
|
-
const tokenBucket_1 = require("../../utils/tokenBucket");
|
|
5
|
-
const responseMessageConcurrent = 'Rate Exceeded: Too many requests in execution';
|
|
6
|
-
const responseMessagePerMinute = 'Rate Exceeded: Too many requests per minute';
|
|
7
|
-
function noopMiddleware(_, next) {
|
|
8
|
-
return next();
|
|
9
|
-
}
|
|
10
|
-
function perMinuteRateLimiter(rateLimit, globalLimiter) {
|
|
11
|
-
if (!rateLimit && !globalLimiter) {
|
|
12
|
-
return noopMiddleware;
|
|
13
|
-
}
|
|
14
|
-
const tokenBucket = tokenBucket_1.createTokenBucket(rateLimit, globalLimiter);
|
|
15
|
-
return function perMinuteRateMiddleware(ctx, next) {
|
|
16
|
-
if (!tokenBucket.removeTokensSync(1)) {
|
|
17
|
-
throw new errors_1.TooManyRequestsError(responseMessagePerMinute);
|
|
18
|
-
}
|
|
19
|
-
return next();
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
exports.perMinuteRateLimiter = perMinuteRateLimiter;
|
|
23
|
-
function concurrentRateLimiter(rateLimit) {
|
|
24
|
-
if (!rateLimit) {
|
|
25
|
-
return noopMiddleware;
|
|
26
|
-
}
|
|
27
|
-
let reqsInExecution = 0;
|
|
28
|
-
const maxRequests = rateLimit;
|
|
29
|
-
return async function concurrentRateMiddleware(ctx, next) {
|
|
30
|
-
if (reqsInExecution >= maxRequests) {
|
|
31
|
-
throw new errors_1.TooManyRequestsError(responseMessageConcurrent);
|
|
32
|
-
}
|
|
33
|
-
reqsInExecution++;
|
|
34
|
-
try {
|
|
35
|
-
await next();
|
|
36
|
-
}
|
|
37
|
-
finally {
|
|
38
|
-
reqsInExecution--;
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
exports.concurrentRateLimiter = concurrentRateLimiter;
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { IOClients } from '../../../../../clients/IOClients';
|
|
2
|
-
import { ParamsContext, RecorderState, ServiceContext } from '../../typings';
|
|
3
|
-
export declare function removeSetCookie<T extends IOClients, U extends RecorderState, V extends ParamsContext>(ctx: ServiceContext<T, U, V>, next: () => Promise<void>): Promise<void>;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { AppMetaInfo, Apps } from '../../../../../clients/infra/Apps';
|
|
2
|
-
import { IOClients } from '../../../../../clients/IOClients';
|
|
3
|
-
import { RequestTracingConfig } from '../../../../../HttpClient';
|
|
4
|
-
import { Assets } from './../../../../../clients/infra/Assets';
|
|
5
|
-
import { ParamsContext, RecorderState, ServiceContext } from './../../typings';
|
|
6
|
-
export declare const getFilteredDependencies: (appAtMajor: string, dependencies: AppMetaInfo[]) => AppMetaInfo[];
|
|
7
|
-
export declare const getDependenciesHash: (dependencies: AppMetaInfo[]) => string;
|
|
8
|
-
export declare const getDependenciesSettings: (apps: Apps, assets: Assets, tracingConfig?: RequestTracingConfig | undefined) => Promise<Record<string, any>[]>;
|
|
9
|
-
export declare const getServiceSettings: () => <T extends IOClients, U extends RecorderState, V extends ParamsContext>(ctx: ServiceContext<T, U, V>, next: () => Promise<void>) => Promise<void>;
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const crypto_1 = require("crypto");
|
|
4
|
-
const ramda_1 = require("ramda");
|
|
5
|
-
const constants_1 = require("../../../../../constants");
|
|
6
|
-
const app_1 = require("./../../../../../utils/app");
|
|
7
|
-
const joinIds = ramda_1.join('');
|
|
8
|
-
const dependsOnApp = (appAtMajor) => (a) => {
|
|
9
|
-
const [name, major] = appAtMajor.split('@');
|
|
10
|
-
const majorInt = major.includes('.') ? major.split('.')[0] : major;
|
|
11
|
-
const version = a._resolvedDependencies[name];
|
|
12
|
-
if (!version) {
|
|
13
|
-
return false;
|
|
14
|
-
}
|
|
15
|
-
const [depMajor] = version.split('.');
|
|
16
|
-
return majorInt === depMajor;
|
|
17
|
-
};
|
|
18
|
-
exports.getFilteredDependencies = (appAtMajor, dependencies) => {
|
|
19
|
-
const depends = dependsOnApp(appAtMajor);
|
|
20
|
-
return dependencies.filter(depends);
|
|
21
|
-
};
|
|
22
|
-
exports.getDependenciesHash = (dependencies) => {
|
|
23
|
-
const dependingApps = ramda_1.pluck('id', dependencies);
|
|
24
|
-
return crypto_1.createHash('md5')
|
|
25
|
-
.update(joinIds(dependingApps))
|
|
26
|
-
.digest('hex');
|
|
27
|
-
};
|
|
28
|
-
exports.getDependenciesSettings = async (apps, assets, tracingConfig) => {
|
|
29
|
-
const appId = constants_1.APP.ID;
|
|
30
|
-
const metaInfos = await apps.getAppsMetaInfos(undefined, undefined, tracingConfig);
|
|
31
|
-
const appAtMajor = app_1.appIdToAppAtMajor(appId);
|
|
32
|
-
return await assets.getSettings(metaInfos, appAtMajor, undefined, tracingConfig);
|
|
33
|
-
};
|
|
34
|
-
exports.getServiceSettings = () => {
|
|
35
|
-
return async function settingsContext(ctx, next) {
|
|
36
|
-
var _a;
|
|
37
|
-
const { clients: { apps, assets }, } = ctx;
|
|
38
|
-
const rootSpan = (_a = ctx.tracing) === null || _a === void 0 ? void 0 : _a.currentSpan;
|
|
39
|
-
const dependenciesSettings = await exports.getDependenciesSettings(apps, assets, { tracing: { rootSpan } });
|
|
40
|
-
// TODO: for now returning all settings, but the ideia is to do merge
|
|
41
|
-
ctx.vtex.settings = dependenciesSettings;
|
|
42
|
-
await next();
|
|
43
|
-
};
|
|
44
|
-
};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { IOClients } from '../../../../../clients/IOClients';
|
|
2
|
-
import { ParamsContext, RecorderState, ServiceContext } from '../../typings';
|
|
3
|
-
export declare function timings<T extends IOClients, U extends RecorderState, V extends ParamsContext>(ctx: ServiceContext<T, U, V>, next: () => Promise<void>): Promise<void>;
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { IOClients } from '../../../../../clients/IOClients';
|
|
2
|
-
import { ParamsContext, RecorderState, ServiceContext } from '../../typings';
|
|
3
|
-
export declare function vary<T extends IOClients, U extends RecorderState, V extends ParamsContext>(ctx: ServiceContext<T, U, V>, next: () => Promise<void>): Promise<void>;
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { HttpRoute, ServiceContext } from '../typings';
|
|
2
|
-
export declare const routerFromPublicHttpHandlers: (routes: Record<string, HttpRoute>) => (ctx: ServiceContext<import("../../../..").IOClients, import("../typings").RecorderState, import("../typings").ParamsContext>, next: () => Promise<void>) => Promise<void>;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const constants_1 = require("../../../../constants");
|
|
4
|
-
const logger_1 = require("../../../logger");
|
|
5
|
-
const console_1 = require("./../../../logger/console");
|
|
6
|
-
exports.routerFromPublicHttpHandlers = (routes) => {
|
|
7
|
-
return async (ctx, next) => {
|
|
8
|
-
var _a;
|
|
9
|
-
const routeId = ctx.get(constants_1.COLOSSUS_ROUTE_ID_HEADER);
|
|
10
|
-
if (!routeId) {
|
|
11
|
-
return next();
|
|
12
|
-
}
|
|
13
|
-
const handler = (_a = routes[routeId]) === null || _a === void 0 ? void 0 : _a.handler;
|
|
14
|
-
if (!handler) {
|
|
15
|
-
const msg = `Handler with id '${routeId}' not implemented.`;
|
|
16
|
-
ctx.status = 501;
|
|
17
|
-
ctx.body = msg;
|
|
18
|
-
console_1.logOnceToDevConsole(msg, logger_1.LogLevel.Error);
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
await handler(ctx, next);
|
|
22
|
-
};
|
|
23
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { ServiceJSON } from '../typings';
|
|
2
|
-
interface PrivateRouteInfo {
|
|
3
|
-
protocol?: 'http' | 'https';
|
|
4
|
-
vendor: string;
|
|
5
|
-
name: string;
|
|
6
|
-
major: string | number;
|
|
7
|
-
account: string;
|
|
8
|
-
workspace: string;
|
|
9
|
-
path?: string;
|
|
10
|
-
}
|
|
11
|
-
export declare const formatPrivateRoute: ({ protocol, vendor, name, major, account, workspace, path }: PrivateRouteInfo) => string;
|
|
12
|
-
export declare const formatPublicRoute: ({ workspace, account, endpoint, path }: {
|
|
13
|
-
workspace: string;
|
|
14
|
-
account: string;
|
|
15
|
-
endpoint: string;
|
|
16
|
-
path: string;
|
|
17
|
-
}) => string;
|
|
18
|
-
export declare const logAvailableRoutes: (service: ServiceJSON) => void;
|
|
19
|
-
export {};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const constants_1 = require("../../../../constants");
|
|
4
|
-
exports.formatPrivateRoute = ({ protocol = 'https', vendor, name, major, account, workspace, path }) => `${protocol}://app.io.vtex.com/${vendor}.${name}/v${major}/${account}/${workspace}${path || ''}`;
|
|
5
|
-
exports.formatPublicRoute = ({ workspace, account, endpoint, path }) => `https://${workspace}--${account}.${endpoint}${path}`;
|
|
6
|
-
const getPath = ({ public: publicRoute, path }) => publicRoute
|
|
7
|
-
? exports.formatPublicRoute({ workspace: constants_1.WORKSPACE, account: constants_1.ACCOUNT, endpoint: constants_1.PUBLIC_ENDPOINT, path })
|
|
8
|
-
: exports.formatPrivateRoute({ protocol: 'https', vendor: constants_1.APP.VENDOR, name: constants_1.APP.NAME, major: constants_1.APP.MAJOR, account: constants_1.ACCOUNT, workspace: constants_1.WORKSPACE, path });
|
|
9
|
-
exports.logAvailableRoutes = (service) => {
|
|
10
|
-
const available = Object.values(service.routes || {}).reduce((acc, route) => `${acc}\n${getPath(route)}`, 'Available service routes:');
|
|
11
|
-
console.info(available);
|
|
12
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { IOClients } from '../../../clients/IOClients';
|
|
2
|
-
import { ParamsContext, RecorderState, RouteHandler, ServiceContext } from './typings';
|
|
3
|
-
declare type HTTPMethods = 'GET' | 'HEAD' | 'POST' | 'PUT' | 'DELETE' | 'CONNECT' | 'OPTIONS' | 'TRACE' | 'PATCH' | 'DEFAULT';
|
|
4
|
-
declare type MethodOptions<ClientsT extends IOClients = IOClients, StateT extends RecorderState = RecorderState, CustomT extends ParamsContext = ParamsContext> = Partial<Record<HTTPMethods, RouteHandler<ClientsT, StateT, CustomT> | Array<RouteHandler<ClientsT, StateT, CustomT>>>>;
|
|
5
|
-
export declare function method<T extends IOClients, U extends RecorderState, V extends ParamsContext>(options: MethodOptions<T, U, V>): {
|
|
6
|
-
(ctx: ServiceContext<T, U, V>, next: () => Promise<void>): Promise<void>;
|
|
7
|
-
skipTimer: boolean;
|
|
8
|
-
};
|
|
9
|
-
export {};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { ServiceContext } from './typings';
|
|
2
|
-
export declare type StatusTrack = () => EnvMetric[];
|
|
3
|
-
export interface NamedMetric {
|
|
4
|
-
name: string;
|
|
5
|
-
[key: string]: any;
|
|
6
|
-
}
|
|
7
|
-
export interface EnvMetric extends NamedMetric {
|
|
8
|
-
production: boolean;
|
|
9
|
-
}
|
|
10
|
-
export declare const isStatusTrack: (message: any) => message is "statusTrack";
|
|
11
|
-
export declare const isStatusTrackBroadcast: (message: any) => message is "broadcastStatusTrack";
|
|
12
|
-
export declare const statusTrackHandler: (ctx: ServiceContext<import("../../..").IOClients, import("./typings").RecorderState, import("./typings").ParamsContext>) => Promise<void>;
|
|
13
|
-
export declare const trackStatus: () => void;
|
|
14
|
-
export declare const broadcastStatusTrack: () => void;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const cluster_1 = __importDefault(require("cluster"));
|
|
7
|
-
const constants_1 = require("../../../constants");
|
|
8
|
-
const BROADCAST_STATUS_TRACK = 'broadcastStatusTrack';
|
|
9
|
-
const STATUS_TRACK = 'statusTrack';
|
|
10
|
-
exports.isStatusTrack = (message) => message === STATUS_TRACK;
|
|
11
|
-
exports.isStatusTrackBroadcast = (message) => message === BROADCAST_STATUS_TRACK;
|
|
12
|
-
exports.statusTrackHandler = async (ctx) => {
|
|
13
|
-
var _a, _b, _c;
|
|
14
|
-
(_b = (_a = ctx.tracing) === null || _a === void 0 ? void 0 : _a.currentSpan) === null || _b === void 0 ? void 0 : _b.setOperationName('builtin:status-track');
|
|
15
|
-
if (!constants_1.LINKED) {
|
|
16
|
-
(_c = process.send) === null || _c === void 0 ? void 0 : _c.call(process, BROADCAST_STATUS_TRACK);
|
|
17
|
-
}
|
|
18
|
-
ctx.body = [];
|
|
19
|
-
return;
|
|
20
|
-
};
|
|
21
|
-
exports.trackStatus = () => {
|
|
22
|
-
global.metrics.statusTrack().forEach(status => {
|
|
23
|
-
logStatus(status);
|
|
24
|
-
});
|
|
25
|
-
};
|
|
26
|
-
exports.broadcastStatusTrack = () => Object.values(cluster_1.default.workers).forEach(worker => worker === null || worker === void 0 ? void 0 : worker.send(STATUS_TRACK));
|
|
27
|
-
const logStatus = (status) => console.log(JSON.stringify({
|
|
28
|
-
__VTEX_IO_LOG: true,
|
|
29
|
-
account: constants_1.ACCOUNT,
|
|
30
|
-
app: constants_1.APP.ID,
|
|
31
|
-
isLink: constants_1.LINKED,
|
|
32
|
-
pid: process.pid,
|
|
33
|
-
production: constants_1.PRODUCTION,
|
|
34
|
-
status,
|
|
35
|
-
type: 'metric/status',
|
|
36
|
-
workspace: constants_1.WORKSPACE,
|
|
37
|
-
}));
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import koaCompose from 'koa-compose';
|
|
2
|
-
import { IOClients } from '../../../../clients/IOClients';
|
|
3
|
-
import { ParamsContext, RecorderState } from '../typings';
|
|
4
|
-
export declare const compose: <ClientsT extends IOClients, StateT extends RecorderState, CustomT extends ParamsContext>(middlewares: koaCompose.Middleware<import("../typings").ServiceContext<ClientsT, StateT, CustomT>>[]) => koaCompose.ComposedMiddleware<import("../typings").ServiceContext<ClientsT, StateT, CustomT>>;
|
|
5
|
-
export declare const composeForEvents: <ClientsT extends IOClients, StateT extends RecorderState>(middlewares: koaCompose.Middleware<import("../typings").EventContext<ClientsT, StateT>>[]) => koaCompose.ComposedMiddleware<import("../typings").EventContext<ClientsT, StateT>>;
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { IOContext, TracingContext } from '../typings';
|
|
2
|
-
export declare const prepareHandlerCtx: (header: any, tracingContext?: TracingContext | undefined) => Pick<IOContext, "host" | "serverTiming" | "locale" | "account" | "workspace" | "region" | "logger" | "requestId" | "operationId" | "production" | "platform" | "authToken" | "adminUserAuthToken" | "storeUserAuthToken" | "product" | "recorder" | "userAgent" | "segmentToken" | "sessionToken" | "janusEnv" | "eventInfo" | "tenant" | "binding" | "cancellation" | "settings" | "tracer">;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const v4_1 = __importDefault(require("uuid/v4"));
|
|
7
|
-
const constants_1 = require("../../../../constants");
|
|
8
|
-
const UserLandTracer_1 = require("../../../../tracing/UserLandTracer");
|
|
9
|
-
const tenant_1 = require("../../../../utils/tenant");
|
|
10
|
-
const logger_1 = require("../../../logger");
|
|
11
|
-
const binding_1 = require("./../../../../utils/binding");
|
|
12
|
-
const getPlatform = (account) => {
|
|
13
|
-
return account.startsWith('gc-') ? 'gocommerce' : 'vtex';
|
|
14
|
-
};
|
|
15
|
-
exports.prepareHandlerCtx = (header, tracingContext) => {
|
|
16
|
-
var _a;
|
|
17
|
-
const partialContext = {
|
|
18
|
-
account: header[constants_1.ACCOUNT_HEADER],
|
|
19
|
-
authToken: header[constants_1.CREDENTIAL_HEADER],
|
|
20
|
-
binding: header[constants_1.BINDING_HEADER] ? binding_1.parseBindingHeaderValue(header[constants_1.BINDING_HEADER]) : undefined,
|
|
21
|
-
host: header[constants_1.FORWARDED_HOST_HEADER],
|
|
22
|
-
locale: header[constants_1.LOCALE_HEADER],
|
|
23
|
-
operationId: header[constants_1.OPERATION_ID_HEADER] || v4_1.default(),
|
|
24
|
-
platform: header[constants_1.PLATFORM_HEADER] || getPlatform(header[constants_1.ACCOUNT_HEADER]),
|
|
25
|
-
product: header[constants_1.PRODUCT_HEADER],
|
|
26
|
-
production: ((_a = header[constants_1.WORKSPACE_IS_PRODUCTION_HEADER]) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'true' || false,
|
|
27
|
-
region: constants_1.REGION,
|
|
28
|
-
requestId: header[constants_1.REQUEST_ID_HEADER],
|
|
29
|
-
segmentToken: header[constants_1.SEGMENT_HEADER],
|
|
30
|
-
sessionToken: header[constants_1.SESSION_HEADER],
|
|
31
|
-
tenant: header[constants_1.TENANT_HEADER] ? tenant_1.parseTenantHeaderValue(header[constants_1.TENANT_HEADER]) : undefined,
|
|
32
|
-
tracer: new UserLandTracer_1.UserLandTracer(tracingContext === null || tracingContext === void 0 ? void 0 : tracingContext.tracer, tracingContext === null || tracingContext === void 0 ? void 0 : tracingContext.currentSpan),
|
|
33
|
-
userAgent: process.env.VTEX_APP_ID || '',
|
|
34
|
-
workspace: header[constants_1.WORKSPACE_HEADER],
|
|
35
|
-
};
|
|
36
|
-
return {
|
|
37
|
-
...partialContext,
|
|
38
|
-
logger: new logger_1.Logger(partialContext),
|
|
39
|
-
};
|
|
40
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
export interface Snapshot {
|
|
3
|
-
usage: NodeJS.CpuUsage;
|
|
4
|
-
time: number;
|
|
5
|
-
}
|
|
6
|
-
interface CpuUsage {
|
|
7
|
-
user: number;
|
|
8
|
-
system: number;
|
|
9
|
-
}
|
|
10
|
-
export declare function cpuSnapshot(): Snapshot;
|
|
11
|
-
export declare function snapshotDiff(curr: Snapshot, last: Snapshot): CpuUsage;
|
|
12
|
-
export {};
|