@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
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MultilayeredCache = void 0;
|
|
3
4
|
const ramda_1 = require("ramda");
|
|
4
5
|
class MultilayeredCache {
|
|
5
6
|
constructor(caches) {
|
|
@@ -7,7 +8,7 @@ class MultilayeredCache {
|
|
|
7
8
|
this.hits = 0;
|
|
8
9
|
this.total = 0;
|
|
9
10
|
this.get = async (key, fetcher) => {
|
|
10
|
-
let value;
|
|
11
|
+
let value = undefined;
|
|
11
12
|
let maxAge;
|
|
12
13
|
let successIndex = await this.findIndex(async (cache) => {
|
|
13
14
|
const [getValue, hasKey] = await Promise.all([cache.get(key), cache.has(key)]);
|
|
@@ -25,18 +26,18 @@ class MultilayeredCache {
|
|
|
25
26
|
}
|
|
26
27
|
successIndex = Infinity;
|
|
27
28
|
}
|
|
28
|
-
const failedCaches = ramda_1.slice(0, successIndex, this.caches);
|
|
29
|
-
const [firstPromise] = ramda_1.map(cache => cache.set(key, value, maxAge), failedCaches);
|
|
29
|
+
const failedCaches = (0, ramda_1.slice)(0, successIndex, this.caches);
|
|
30
|
+
const [firstPromise] = (0, ramda_1.map)(cache => cache.set(key, value, maxAge), failedCaches);
|
|
30
31
|
await firstPromise;
|
|
31
32
|
return value;
|
|
32
33
|
};
|
|
33
34
|
this.set = async (key, value, maxAge) => {
|
|
34
|
-
const isSet = await Promise.all(ramda_1.map(cache => cache.set(key, value, maxAge), this.caches));
|
|
35
|
-
return ramda_1.any(item => item, isSet);
|
|
35
|
+
const isSet = await Promise.all((0, ramda_1.map)(cache => cache.set(key, value, maxAge), this.caches));
|
|
36
|
+
return (0, ramda_1.any)(item => item, isSet);
|
|
36
37
|
};
|
|
37
38
|
this.has = async (key) => {
|
|
38
|
-
const hasList = await Promise.all(ramda_1.map(cache => cache.has(key), this.caches));
|
|
39
|
-
return ramda_1.any(item => item, hasList);
|
|
39
|
+
const hasList = await Promise.all((0, ramda_1.map)(cache => cache.has(key), this.caches));
|
|
40
|
+
return (0, ramda_1.any)(item => item, hasList);
|
|
40
41
|
};
|
|
41
42
|
this.getStats = (name = 'multilayred-cache') => {
|
|
42
43
|
const multilayerStats = {
|
package/lib/caches/index.js
CHANGED
|
@@ -1,9 +1,22 @@
|
|
|
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
|
-
|
|
17
|
+
__exportStar(require("./CacheLayer"), exports);
|
|
18
|
+
__exportStar(require("./DiskCache"), exports);
|
|
19
|
+
__exportStar(require("./LRUCache"), exports);
|
|
20
|
+
__exportStar(require("./LRUDiskCache"), exports);
|
|
21
|
+
__exportStar(require("./MultilayeredCache"), exports);
|
|
22
|
+
__exportStar(require("./typings"), exports);
|
package/lib/caches/typings.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type FetchResult<V> = {
|
|
2
2
|
value: V;
|
|
3
3
|
maxAge?: number;
|
|
4
4
|
};
|
|
5
|
-
export
|
|
5
|
+
export type DiskStats = {
|
|
6
6
|
hits: number;
|
|
7
7
|
total: number;
|
|
8
8
|
name: string;
|
|
9
9
|
};
|
|
10
|
-
export
|
|
10
|
+
export type LRUStats = {
|
|
11
11
|
itemCount: number;
|
|
12
12
|
length: number;
|
|
13
13
|
disposedItems: number;
|
|
@@ -17,13 +17,13 @@ export declare type LRUStats = {
|
|
|
17
17
|
name: string;
|
|
18
18
|
total: number;
|
|
19
19
|
};
|
|
20
|
-
export
|
|
20
|
+
export type MultilayerStats = {
|
|
21
21
|
hitRate: number | undefined;
|
|
22
22
|
hits: number;
|
|
23
23
|
total: number;
|
|
24
24
|
name: string;
|
|
25
25
|
};
|
|
26
|
-
export
|
|
26
|
+
export type LRUDiskCacheOptions = {
|
|
27
27
|
/**
|
|
28
28
|
* The maximum size of the cache, checked by applying the length
|
|
29
29
|
* function to all values in the cache. Not setting this is kind of silly,
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IOContext } from '../service/worker/runtime/typings';
|
|
2
|
+
import { HttpClient } from '../HttpClient/HttpClient';
|
|
3
|
+
import { InstanceOptions } from '../HttpClient/typings';
|
|
4
|
+
export type IOClientConstructor = new (context: IOContext, options?: InstanceOptions) => IOClient;
|
|
5
|
+
/**
|
|
6
|
+
* A client that can be instantiated by the Serviceruntime layer.
|
|
7
|
+
*/
|
|
8
|
+
export declare class IOClient {
|
|
9
|
+
protected context: IOContext;
|
|
10
|
+
protected options?: InstanceOptions | undefined;
|
|
11
|
+
protected http: HttpClient;
|
|
12
|
+
constructor(context: IOContext, options?: InstanceOptions | undefined);
|
|
13
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IOClient = void 0;
|
|
4
|
+
const HttpClient_1 = require("../HttpClient/HttpClient");
|
|
5
|
+
/**
|
|
6
|
+
* A client that can be instantiated by the Serviceruntime layer.
|
|
7
|
+
*/
|
|
8
|
+
class IOClient {
|
|
9
|
+
constructor(context, options) {
|
|
10
|
+
this.context = context;
|
|
11
|
+
this.options = options;
|
|
12
|
+
this.http = new HttpClient_1.HttpClient({
|
|
13
|
+
name: this.constructor.name,
|
|
14
|
+
...context,
|
|
15
|
+
...options,
|
|
16
|
+
metrics: options && options.metrics,
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.IOClient = IOClient;
|
|
@@ -1,32 +1,36 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
1
|
+
import { InstanceOptions } from '../HttpClient';
|
|
2
|
+
import { IOContext } from '../service/worker/runtime/typings';
|
|
3
|
+
import { Billing, Builder, MessagesGraphQL, Settings } from './apps';
|
|
4
|
+
import { CatalogGraphQL } from './apps/catalogGraphQL/index';
|
|
5
|
+
import { ID, MasterData, PaymentProvider } from './external';
|
|
6
|
+
import { Apps, Assets, BillingMetrics, Events, Registry, Router, VBase, Workspaces } from './infra';
|
|
7
|
+
import { IOClientConstructor } from './IOClient';
|
|
8
|
+
import { LicenseManager, Segment, Session, TenantClient } from './janus';
|
|
9
|
+
export type ClientsImplementation<T extends IOClients> = new (clientOptions: Record<string, InstanceOptions>, ctx: IOContext) => T;
|
|
6
10
|
export declare class IOClients {
|
|
7
11
|
private clientOptions;
|
|
8
12
|
private ctx;
|
|
9
13
|
private clients;
|
|
10
14
|
constructor(clientOptions: Record<string, InstanceOptions>, ctx: IOContext);
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
15
|
+
get apps(): Apps;
|
|
16
|
+
get assets(): Assets;
|
|
17
|
+
get billing(): Billing;
|
|
18
|
+
get billingMetrics(): BillingMetrics;
|
|
19
|
+
get builder(): Builder;
|
|
20
|
+
get events(): Events;
|
|
21
|
+
get id(): ID;
|
|
22
|
+
get licenseManager(): LicenseManager;
|
|
23
|
+
get masterdata(): MasterData;
|
|
24
|
+
get messagesGraphQL(): MessagesGraphQL;
|
|
25
|
+
get registry(): Registry;
|
|
26
|
+
get router(): Router;
|
|
27
|
+
get segment(): Segment;
|
|
28
|
+
get settings(): Settings;
|
|
29
|
+
get session(): Session;
|
|
30
|
+
get tenant(): TenantClient;
|
|
31
|
+
get vbase(): VBase;
|
|
32
|
+
get workspaces(): Workspaces;
|
|
33
|
+
get catalogGraphQL(): CatalogGraphQL;
|
|
34
|
+
get paymentProvider(): PaymentProvider;
|
|
31
35
|
protected getOrSet<TClient extends IOClientConstructor>(key: string, Implementation: TClient): InstanceType<TClient>;
|
|
32
36
|
}
|
package/lib/clients/IOClients.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
const
|
|
3
|
+
exports.IOClients = void 0;
|
|
4
|
+
const apps_1 = require("./apps");
|
|
5
|
+
const index_1 = require("./apps/catalogGraphQL/index");
|
|
6
|
+
const external_1 = require("./external");
|
|
7
|
+
const infra_1 = require("./infra");
|
|
8
|
+
const janus_1 = require("./janus");
|
|
5
9
|
class IOClients {
|
|
6
10
|
constructor(clientOptions, ctx) {
|
|
7
11
|
this.clientOptions = clientOptions;
|
|
@@ -9,67 +13,71 @@ class IOClients {
|
|
|
9
13
|
this.clients = {};
|
|
10
14
|
}
|
|
11
15
|
get apps() {
|
|
12
|
-
return this.getOrSet('apps',
|
|
16
|
+
return this.getOrSet('apps', infra_1.Apps);
|
|
13
17
|
}
|
|
14
18
|
get assets() {
|
|
15
|
-
return this.getOrSet('assets',
|
|
19
|
+
return this.getOrSet('assets', infra_1.Assets);
|
|
16
20
|
}
|
|
17
21
|
get billing() {
|
|
18
|
-
return this.getOrSet('billing',
|
|
22
|
+
return this.getOrSet('billing', apps_1.Billing);
|
|
19
23
|
}
|
|
20
24
|
get billingMetrics() {
|
|
21
|
-
return this.getOrSet('billingMetrics',
|
|
25
|
+
return this.getOrSet('billingMetrics', infra_1.BillingMetrics);
|
|
22
26
|
}
|
|
23
27
|
get builder() {
|
|
24
|
-
return this.getOrSet('builder',
|
|
28
|
+
return this.getOrSet('builder', apps_1.Builder);
|
|
25
29
|
}
|
|
26
30
|
get events() {
|
|
27
|
-
return this.getOrSet('events',
|
|
31
|
+
return this.getOrSet('events', infra_1.Events);
|
|
28
32
|
}
|
|
29
33
|
get id() {
|
|
30
|
-
return this.getOrSet('id',
|
|
34
|
+
return this.getOrSet('id', external_1.ID);
|
|
31
35
|
}
|
|
32
36
|
get licenseManager() {
|
|
33
|
-
return this.getOrSet('licenseManager',
|
|
37
|
+
return this.getOrSet('licenseManager', janus_1.LicenseManager);
|
|
34
38
|
}
|
|
35
|
-
get
|
|
36
|
-
return this.getOrSet('
|
|
37
|
-
}
|
|
38
|
-
get messages() {
|
|
39
|
-
return this.getOrSet('messages', _1.Messages);
|
|
39
|
+
get masterdata() {
|
|
40
|
+
return this.getOrSet('masterdata', external_1.MasterData);
|
|
40
41
|
}
|
|
41
42
|
get messagesGraphQL() {
|
|
42
|
-
return this.getOrSet('messagesGraphQL',
|
|
43
|
-
}
|
|
44
|
-
get metadata() {
|
|
45
|
-
return this.getOrSet('metadata', _1.Metadata);
|
|
43
|
+
return this.getOrSet('messagesGraphQL', apps_1.MessagesGraphQL);
|
|
46
44
|
}
|
|
47
45
|
get registry() {
|
|
48
|
-
return this.getOrSet('registry',
|
|
46
|
+
return this.getOrSet('registry', infra_1.Registry);
|
|
49
47
|
}
|
|
50
48
|
get router() {
|
|
51
|
-
return this.getOrSet('router',
|
|
49
|
+
return this.getOrSet('router', infra_1.Router);
|
|
52
50
|
}
|
|
53
51
|
get segment() {
|
|
54
|
-
return this.getOrSet('segment',
|
|
52
|
+
return this.getOrSet('segment', janus_1.Segment);
|
|
55
53
|
}
|
|
56
54
|
get settings() {
|
|
57
|
-
return this.getOrSet('settings',
|
|
55
|
+
return this.getOrSet('settings', apps_1.Settings);
|
|
58
56
|
}
|
|
59
57
|
get session() {
|
|
60
|
-
return this.getOrSet('session',
|
|
58
|
+
return this.getOrSet('session', janus_1.Session);
|
|
61
59
|
}
|
|
62
60
|
get tenant() {
|
|
63
|
-
return this.getOrSet('tenant',
|
|
61
|
+
return this.getOrSet('tenant', janus_1.TenantClient);
|
|
64
62
|
}
|
|
65
63
|
get vbase() {
|
|
66
|
-
return this.getOrSet('vbase',
|
|
64
|
+
return this.getOrSet('vbase', infra_1.VBase);
|
|
67
65
|
}
|
|
68
66
|
get workspaces() {
|
|
69
|
-
return this.getOrSet('workspaces',
|
|
67
|
+
return this.getOrSet('workspaces', infra_1.Workspaces);
|
|
68
|
+
}
|
|
69
|
+
get catalogGraphQL() {
|
|
70
|
+
return this.getOrSet('catalogGraphQL', index_1.CatalogGraphQL);
|
|
71
|
+
}
|
|
72
|
+
get paymentProvider() {
|
|
73
|
+
return this.getOrSet('paymentProvider', external_1.PaymentProvider);
|
|
70
74
|
}
|
|
71
75
|
getOrSet(key, Implementation) {
|
|
72
|
-
const options =
|
|
76
|
+
const options = {
|
|
77
|
+
...this.clientOptions.default,
|
|
78
|
+
...this.clientOptions[key],
|
|
79
|
+
metrics,
|
|
80
|
+
};
|
|
73
81
|
if (!this.clients[key]) {
|
|
74
82
|
this.clients[key] = new Implementation(this.ctx, options);
|
|
75
83
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { GraphQLClient } from '../HttpClient/GraphQLClient';
|
|
2
|
+
import { InstanceOptions } from '../HttpClient/typings';
|
|
3
|
+
import { IOContext } from '../service/worker/runtime/typings';
|
|
3
4
|
import { IOClient } from './IOClient';
|
|
4
|
-
import { InstanceOptions } from './typings';
|
|
5
5
|
/**
|
|
6
|
-
* A GraphQL client that can be instantiated by the
|
|
6
|
+
* A GraphQL client that can be instantiated by the Serviceruntime layer.
|
|
7
7
|
*/
|
|
8
8
|
export declare class IOGraphQLClient extends IOClient {
|
|
9
9
|
protected context: IOContext;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
3
|
+
exports.IOGraphQLClient = void 0;
|
|
4
|
+
const GraphQLClient_1 = require("../HttpClient/GraphQLClient");
|
|
4
5
|
const IOClient_1 = require("./IOClient");
|
|
5
6
|
/**
|
|
6
|
-
* A GraphQL client that can be instantiated by the
|
|
7
|
+
* A GraphQL client that can be instantiated by the Serviceruntime layer.
|
|
7
8
|
*/
|
|
8
9
|
class IOGraphQLClient extends IOClient_1.IOClient {
|
|
9
10
|
constructor(context, options) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { InstanceOptions } from '../../HttpClient/typings';
|
|
2
|
+
import { IOContext } from '../../service/worker/runtime/typings';
|
|
3
|
+
import { IOClient } from '../IOClient';
|
|
4
4
|
/**
|
|
5
5
|
* Used to perform calls on apps you declared a dependency for in your manifest.
|
|
6
6
|
*/
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
const typings_1 = require("
|
|
3
|
+
exports.AppClient = void 0;
|
|
4
|
+
const typings_1 = require("../../HttpClient/typings");
|
|
5
|
+
const routes_1 = require("../../service/worker/runtime/http/routes");
|
|
6
|
+
const IOClient_1 = require("../IOClient");
|
|
5
7
|
const useHttps = !process.env.VTEX_IO;
|
|
6
8
|
/**
|
|
7
9
|
* Used to perform calls on apps you declared a dependency for in your manifest.
|
|
@@ -15,15 +17,19 @@ class AppClient extends IOClient_1.IOClient {
|
|
|
15
17
|
let baseURL;
|
|
16
18
|
if (appVersion) {
|
|
17
19
|
const [major] = appVersion.split('.');
|
|
18
|
-
baseURL =
|
|
20
|
+
baseURL = (0, routes_1.formatPrivateRoute)({ account, workspace, vendor, name, major, protocol });
|
|
19
21
|
}
|
|
20
22
|
else {
|
|
21
23
|
console.warn(`${account} in ${workspace} is using old routing for ${app}. Please change vendor.app to vendor.app@major in client ${(options && options.name) || ''}`);
|
|
22
24
|
const service = [name, vendor].join('.'); // messages.vtex
|
|
23
25
|
baseURL = `http://${service}.${region}.vtex.io/${account}/${workspace}`;
|
|
24
26
|
}
|
|
25
|
-
super(context,
|
|
26
|
-
|
|
27
|
+
super(context, {
|
|
28
|
+
...options,
|
|
29
|
+
authType: typings_1.AuthType.bearer,
|
|
30
|
+
baseURL,
|
|
31
|
+
name,
|
|
32
|
+
});
|
|
27
33
|
}
|
|
28
34
|
}
|
|
29
35
|
exports.AppClient = AppClient;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { InstanceOptions } from '../../HttpClient/typings';
|
|
2
|
+
import { IOContext } from '../../service/worker/runtime/typings';
|
|
3
|
+
import { IOGraphQLClient } from '../IOGraphQLClient';
|
|
4
4
|
/**
|
|
5
5
|
* Used to perform calls on apps you declared a dependency for in your manifest.
|
|
6
6
|
*/
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
const typings_1 = require("
|
|
3
|
+
exports.AppGraphQLClient = void 0;
|
|
4
|
+
const typings_1 = require("../../HttpClient/typings");
|
|
5
|
+
const routes_1 = require("../../service/worker/runtime/http/routes");
|
|
6
|
+
const IOGraphQLClient_1 = require("../IOGraphQLClient");
|
|
5
7
|
const useHttps = !process.env.VTEX_IO;
|
|
6
8
|
/**
|
|
7
9
|
* Used to perform calls on apps you declared a dependency for in your manifest.
|
|
@@ -15,15 +17,19 @@ class AppGraphQLClient extends IOGraphQLClient_1.IOGraphQLClient {
|
|
|
15
17
|
let baseURL;
|
|
16
18
|
if (appVersion) {
|
|
17
19
|
const [major] = appVersion.split('.');
|
|
18
|
-
baseURL =
|
|
20
|
+
baseURL = (0, routes_1.formatPrivateRoute)({ account, workspace, major, name, vendor, protocol, path: '/_v/graphql' });
|
|
19
21
|
}
|
|
20
22
|
else {
|
|
21
23
|
console.warn(`${account} in ${workspace} is using old routing for ${app}. Please change vendor.app to vendor.app@major in client ${(options && options.name) || ''}`);
|
|
22
24
|
const service = [name, vendor].join('.'); // messages.vtex
|
|
23
25
|
baseURL = `http://${service}.${region}.vtex.io/${account}/${workspace}/_v/graphql`;
|
|
24
26
|
}
|
|
25
|
-
super(context,
|
|
26
|
-
|
|
27
|
+
super(context, {
|
|
28
|
+
...options,
|
|
29
|
+
authType: typings_1.AuthType.bearer,
|
|
30
|
+
baseURL,
|
|
31
|
+
name,
|
|
32
|
+
});
|
|
27
33
|
}
|
|
28
34
|
}
|
|
29
35
|
exports.AppGraphQLClient = AppGraphQLClient;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { InstanceOptions, RequestTracingConfig } from '../../HttpClient';
|
|
2
|
+
import { IOContext } from '../../service/worker/runtime/typings';
|
|
3
|
+
import { AppClient } from './AppClient';
|
|
4
|
+
export declare class Billing extends AppClient {
|
|
5
|
+
constructor(context: IOContext, options?: InstanceOptions);
|
|
6
|
+
status: (tracingConfig?: RequestTracingConfig) => Promise<ContractStatus>;
|
|
7
|
+
}
|
|
8
|
+
export declare enum ContractStatus {
|
|
9
|
+
ACTIVE = "active_contract",
|
|
10
|
+
INACTIVE = "inactive_contract",
|
|
11
|
+
NO_CONTRACT = "no_contract"
|
|
12
|
+
}
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
exports.ContractStatus = exports.Billing = void 0;
|
|
4
|
+
const AppClient_1 = require("./AppClient");
|
|
5
|
+
class Billing extends AppClient_1.AppClient {
|
|
5
6
|
constructor(context, options) {
|
|
6
7
|
super('vtex.billing@0.x', context, options);
|
|
7
|
-
this.status = () => this.http.get('/_v/contractStatus'
|
|
8
|
+
this.status = (tracingConfig) => this.http.get('/_v/contractStatus', {
|
|
9
|
+
tracing: {
|
|
10
|
+
requestSpanNameSuffix: 'billing-status',
|
|
11
|
+
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
12
|
+
},
|
|
13
|
+
});
|
|
8
14
|
}
|
|
9
15
|
}
|
|
10
16
|
exports.Billing = Billing;
|
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { ZlibOptions } from 'zlib';
|
|
3
|
-
import {
|
|
4
|
-
import { IOContext } from '
|
|
5
|
-
import { Change } from '
|
|
6
|
-
import { File } from '
|
|
3
|
+
import { InstanceOptions, RequestTracingConfig } from '../../HttpClient';
|
|
4
|
+
import { IOContext } from '../../service/worker/runtime/typings';
|
|
5
|
+
import { Change } from '../infra/Apps';
|
|
6
|
+
import { File } from '../infra/Registry';
|
|
7
|
+
import { AppClient } from './AppClient';
|
|
7
8
|
export declare class Builder extends AppClient {
|
|
8
9
|
private stickyHost;
|
|
9
10
|
constructor(ioContext: IOContext, opts?: InstanceOptions);
|
|
10
|
-
availability: (app: string, hintIndex: number) => Promise<{
|
|
11
|
+
availability: (app: string, hintIndex: number, tracingConfig?: RequestTracingConfig) => Promise<{
|
|
11
12
|
host: string;
|
|
12
13
|
hostname: string | undefined;
|
|
13
14
|
score: number;
|
|
14
15
|
}>;
|
|
15
|
-
clean: (app: string) => Promise<BuildResult>;
|
|
16
|
-
getPinnedDependencies: () => Promise<any>;
|
|
17
|
-
linkApp: (app: string, files: File[], zipOptions?: ZipOptions, params?: RequestParams) => Promise<BuildResult>;
|
|
18
|
-
publishApp: (app: string, files: File[], zipOptions?: ZipOptions, params?: RequestParams) => Promise<BuildResult>;
|
|
19
|
-
relinkApp: (app: string, changes: Change[], params?: RequestParams) => Promise<BuildResult>;
|
|
20
|
-
testApp: (app: string, files: File[], zipOptions?: ZipOptions, params?: RequestParams) => Promise<BuildResult>;
|
|
16
|
+
clean: (app: string, tracingConfig?: RequestTracingConfig) => Promise<BuildResult>;
|
|
17
|
+
getPinnedDependencies: (tracingConfig?: RequestTracingConfig) => Promise<any>;
|
|
18
|
+
linkApp: (app: string, files: File[], zipOptions?: ZipOptions, params?: RequestParams, tracingConfig?: RequestTracingConfig) => Promise<BuildResult>;
|
|
19
|
+
publishApp: (app: string, files: File[], zipOptions?: ZipOptions, params?: RequestParams, tracingConfig?: RequestTracingConfig) => Promise<BuildResult>;
|
|
20
|
+
relinkApp: (app: string, changes: Change[], params?: RequestParams, tracingConfig?: RequestTracingConfig) => Promise<BuildResult>;
|
|
21
|
+
testApp: (app: string, files: File[], zipOptions?: ZipOptions, params?: RequestParams, tracingConfig?: RequestTracingConfig) => Promise<BuildResult>;
|
|
21
22
|
private zipAndSend;
|
|
22
23
|
}
|
|
23
24
|
interface RequestParams {
|
|
@@ -3,9 +3,10 @@ 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.Builder = void 0;
|
|
6
7
|
const archiver_1 = __importDefault(require("archiver"));
|
|
7
|
-
const
|
|
8
|
-
const
|
|
8
|
+
const cache_1 = require("../../HttpClient/middlewares/cache");
|
|
9
|
+
const AppClient_1 = require("./AppClient");
|
|
9
10
|
const routes = {
|
|
10
11
|
Availability: (app) => `${routes.Builder}/availability/${app}`,
|
|
11
12
|
Builder: '/_v/builder/0',
|
|
@@ -16,10 +17,10 @@ const routes = {
|
|
|
16
17
|
Relink: (app) => `${routes.Builder}/relink/${app}`,
|
|
17
18
|
Test: (app) => `${routes.Builder}/test/${app}`,
|
|
18
19
|
};
|
|
19
|
-
class Builder extends
|
|
20
|
+
class Builder extends AppClient_1.AppClient {
|
|
20
21
|
constructor(ioContext, opts) {
|
|
21
22
|
super('vtex.builder-hub@0.x', ioContext, opts);
|
|
22
|
-
this.availability = async (app, hintIndex) => {
|
|
23
|
+
this.availability = async (app, hintIndex, tracingConfig) => {
|
|
23
24
|
const stickyHint = hintIndex === undefined || hintIndex === null ?
|
|
24
25
|
`request:${this.context.account}:${this.context.workspace}:${app}` :
|
|
25
26
|
`request:${this.context.account}:${this.context.workspace}:${app}:${hintIndex}`;
|
|
@@ -28,33 +29,53 @@ class Builder extends HttpClient_1.AppClient {
|
|
|
28
29
|
'x-vtex-sticky-host': stickyHint,
|
|
29
30
|
};
|
|
30
31
|
const metric = 'bh-availability';
|
|
31
|
-
const { data: { availability }, headers: { 'x-vtex-sticky-host': host }, } = await this.http.getRaw(routes.Availability(app), {
|
|
32
|
+
const { data: { availability }, headers: { 'x-vtex-sticky-host': host }, } = await this.http.getRaw(routes.Availability(app), { cacheable: cache_1.CacheType.None, headers, metric, tracing: {
|
|
33
|
+
requestSpanNameSuffix: metric,
|
|
34
|
+
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
35
|
+
} });
|
|
32
36
|
const { hostname, score } = availability;
|
|
33
37
|
return { host, hostname, score };
|
|
34
38
|
};
|
|
35
|
-
this.clean = (app) => {
|
|
36
|
-
const headers =
|
|
39
|
+
this.clean = (app, tracingConfig) => {
|
|
40
|
+
const headers = {
|
|
41
|
+
'Content-Type': 'application/json',
|
|
42
|
+
...this.stickyHost && { 'x-vtex-sticky-host': this.stickyHost },
|
|
43
|
+
};
|
|
37
44
|
const metric = 'bh-clean';
|
|
38
|
-
return this.http.post(routes.Clean(app), { headers, metric
|
|
45
|
+
return this.http.post(routes.Clean(app), { headers, metric, tracing: {
|
|
46
|
+
requestSpanNameSuffix: metric,
|
|
47
|
+
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
48
|
+
} });
|
|
39
49
|
};
|
|
40
|
-
this.getPinnedDependencies = () => {
|
|
41
|
-
return this.http.get(routes.PinnedDependencies()
|
|
50
|
+
this.getPinnedDependencies = (tracingConfig) => {
|
|
51
|
+
return this.http.get(routes.PinnedDependencies(), {
|
|
52
|
+
tracing: {
|
|
53
|
+
requestSpanNameSuffix: 'pinned-dependencies',
|
|
54
|
+
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
55
|
+
},
|
|
56
|
+
});
|
|
42
57
|
};
|
|
43
|
-
this.linkApp = (app, files, zipOptions = { sticky: true }, params = {}) => {
|
|
44
|
-
return this.zipAndSend(routes.Link(app), app, files, zipOptions, params);
|
|
58
|
+
this.linkApp = (app, files, zipOptions = { sticky: true }, params = {}, tracingConfig) => {
|
|
59
|
+
return this.zipAndSend(routes.Link(app), app, files, zipOptions, params, tracingConfig);
|
|
45
60
|
};
|
|
46
|
-
this.publishApp = (app, files, zipOptions = { sticky: true }, params = {}) => {
|
|
47
|
-
return this.zipAndSend(routes.Publish(app), app, files, zipOptions, params);
|
|
61
|
+
this.publishApp = (app, files, zipOptions = { sticky: true }, params = {}, tracingConfig) => {
|
|
62
|
+
return this.zipAndSend(routes.Publish(app), app, files, zipOptions, params, tracingConfig);
|
|
48
63
|
};
|
|
49
|
-
this.relinkApp = (app, changes, params = {}) => {
|
|
50
|
-
const headers =
|
|
64
|
+
this.relinkApp = (app, changes, params = {}, tracingConfig) => {
|
|
65
|
+
const headers = {
|
|
66
|
+
'Content-Type': 'application/json',
|
|
67
|
+
...this.stickyHost && { 'x-vtex-sticky-host': this.stickyHost },
|
|
68
|
+
};
|
|
51
69
|
const metric = 'bh-relink';
|
|
52
|
-
return this.http.put(routes.Relink(app), changes, { headers, metric, params
|
|
70
|
+
return this.http.put(routes.Relink(app), changes, { headers, metric, params, tracing: {
|
|
71
|
+
requestSpanNameSuffix: metric,
|
|
72
|
+
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
73
|
+
} });
|
|
53
74
|
};
|
|
54
|
-
this.testApp = (app, files, zipOptions = { sticky: true }, params = {}) => {
|
|
55
|
-
return this.zipAndSend(routes.Test(app), app, files, zipOptions, params);
|
|
75
|
+
this.testApp = (app, files, zipOptions = { sticky: true }, params = {}, tracingConfig) => {
|
|
76
|
+
return this.zipAndSend(routes.Test(app), app, files, zipOptions, params, tracingConfig);
|
|
56
77
|
};
|
|
57
|
-
this.zipAndSend = async (route, app, files, { tag, sticky, stickyHint, zlib } = {}, requestParams = {}) => {
|
|
78
|
+
this.zipAndSend = async (route, app, files, { tag, sticky, stickyHint, zlib } = {}, requestParams = {}, tracingConfig) => {
|
|
58
79
|
if (!(files[0] && files[0].path && files[0].content)) {
|
|
59
80
|
throw new Error('Argument files must be an array of {path, content}, where content can be a String, a Buffer or a ReadableStream.');
|
|
60
81
|
}
|
|
@@ -62,18 +83,25 @@ class Builder extends HttpClient_1.AppClient {
|
|
|
62
83
|
if (indexOfManifest === -1) {
|
|
63
84
|
throw new Error('No manifest.json file found in files.');
|
|
64
85
|
}
|
|
65
|
-
const zip = archiver_1.default('zip', { zlib });
|
|
86
|
+
const zip = (0, archiver_1.default)('zip', { zlib });
|
|
66
87
|
// Throw stream errors so they reject the promise chain.
|
|
67
88
|
zip.on('error', (e) => {
|
|
68
89
|
throw e;
|
|
69
90
|
});
|
|
70
91
|
const hint = stickyHint || `request:${this.context.account}:${this.context.workspace}:${app}`;
|
|
71
92
|
const metric = 'bh-zip-send';
|
|
72
|
-
const params = tag ?
|
|
93
|
+
const params = tag ? { ...requestParams, tag } : requestParams;
|
|
73
94
|
const request = this.http.postRaw(route, zip, {
|
|
74
|
-
headers:
|
|
95
|
+
headers: {
|
|
96
|
+
'Content-Type': 'application/octet-stream',
|
|
97
|
+
...sticky && { 'x-vtex-sticky-host': this.stickyHost || hint },
|
|
98
|
+
},
|
|
75
99
|
metric,
|
|
76
100
|
params,
|
|
101
|
+
tracing: {
|
|
102
|
+
requestSpanNameSuffix: metric,
|
|
103
|
+
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
104
|
+
},
|
|
77
105
|
});
|
|
78
106
|
files.forEach(({ content, path }) => zip.append(content, { name: path }));
|
|
79
107
|
const finalize = zip.finalize();
|