@vtex/api 6.48.1-beta → 6.48.1-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/gen/manifest.schema +5 -3
- package/lib/HttpClient/GraphQLClient.d.ts +2 -1
- package/lib/HttpClient/GraphQLClient.js +5 -1
- package/lib/HttpClient/HttpClient.d.ts +6 -5
- package/lib/HttpClient/HttpClient.js +64 -21
- package/lib/HttpClient/agents.d.ts +3 -0
- package/lib/HttpClient/agents.js +37 -0
- package/lib/HttpClient/index.d.ts +1 -7
- package/lib/HttpClient/index.js +17 -16
- package/lib/HttpClient/middlewares/cache.d.ts +8 -2
- package/lib/HttpClient/middlewares/cache.js +126 -33
- package/lib/HttpClient/middlewares/cancellationToken.d.ts +1 -1
- package/lib/HttpClient/middlewares/cancellationToken.js +3 -1
- package/lib/HttpClient/middlewares/inflight.js +1 -0
- package/lib/HttpClient/middlewares/memoization.js +9 -1
- package/lib/HttpClient/middlewares/metrics.js +17 -31
- package/lib/HttpClient/middlewares/notFound.js +1 -0
- package/lib/HttpClient/middlewares/recorder.d.ts +1 -1
- package/lib/HttpClient/middlewares/recorder.js +20 -12
- package/lib/HttpClient/middlewares/request/HttpAgentSingleton.d.ts +11 -0
- package/lib/HttpClient/middlewares/request/HttpAgentSingleton.js +31 -0
- package/lib/HttpClient/middlewares/request/index.d.ts +18 -0
- package/lib/HttpClient/middlewares/request/index.js +85 -0
- package/lib/HttpClient/middlewares/request/setupAxios/index.d.ts +2 -0
- package/lib/HttpClient/middlewares/request/setupAxios/index.js +21 -0
- package/lib/HttpClient/middlewares/request/setupAxios/interceptors/exponentialBackoff.d.ts +2 -0
- package/lib/HttpClient/middlewares/request/setupAxios/interceptors/exponentialBackoff.js +54 -0
- package/lib/HttpClient/middlewares/request/setupAxios/interceptors/index.d.ts +2 -0
- package/lib/HttpClient/middlewares/request/setupAxios/interceptors/index.js +7 -0
- package/lib/HttpClient/middlewares/request/setupAxios/interceptors/tracing/index.d.ts +8 -0
- package/lib/HttpClient/middlewares/request/setupAxios/interceptors/tracing/index.js +56 -0
- package/lib/HttpClient/middlewares/request/setupAxios/interceptors/tracing/spanSetup.d.ts +4 -0
- package/lib/HttpClient/middlewares/request/setupAxios/interceptors/tracing/spanSetup.js +30 -0
- package/lib/HttpClient/middlewares/tracing.d.ts +15 -0
- package/lib/HttpClient/middlewares/tracing.js +61 -0
- package/lib/HttpClient/typings.d.ts +44 -10
- package/lib/HttpClient/typings.js +1 -0
- package/lib/caches/DiskCache.d.ts +1 -1
- package/lib/caches/DiskCache.js +1 -0
- package/lib/caches/LRUCache.d.ts +2 -2
- package/lib/caches/LRUCache.js +6 -1
- package/lib/caches/LRUDiskCache.d.ts +1 -1
- package/lib/caches/LRUDiskCache.js +6 -1
- package/lib/caches/MultilayeredCache.d.ts +1 -1
- package/lib/caches/MultilayeredCache.js +2 -1
- package/lib/caches/index.js +16 -7
- package/lib/{HttpClient → clients}/IOClient.d.ts +4 -4
- package/lib/clients/IOClient.js +20 -0
- package/lib/clients/IOClients.d.ts +28 -24
- package/lib/clients/IOClients.js +36 -28
- package/lib/{HttpClient → clients}/IOGraphQLClient.d.ts +4 -4
- package/lib/{HttpClient → clients}/IOGraphQLClient.js +3 -2
- package/lib/{HttpClient → clients/apps}/AppClient.d.ts +3 -3
- package/lib/{HttpClient → clients/apps}/AppClient.js +11 -5
- package/lib/{HttpClient → clients/apps}/AppGraphQLClient.d.ts +3 -3
- package/lib/{HttpClient → clients/apps}/AppGraphQLClient.js +11 -5
- package/lib/clients/apps/Billing.d.ts +12 -0
- package/lib/clients/{Billing.js → apps/Billing.js} +9 -3
- package/lib/clients/{Builder.d.ts → apps/Builder.d.ts} +12 -11
- package/lib/clients/{Builder.js → apps/Builder.js} +50 -22
- package/lib/clients/apps/MessagesGraphQL.d.ts +61 -0
- package/lib/clients/apps/MessagesGraphQL.js +122 -0
- package/lib/clients/{Settings.d.ts → apps/Settings.d.ts} +5 -4
- package/lib/clients/{Settings.js → apps/Settings.js} +15 -20
- package/lib/clients/apps/catalogGraphQL/brand.d.ts +13 -0
- package/lib/clients/apps/catalogGraphQL/brand.js +19 -0
- package/lib/clients/apps/catalogGraphQL/category.d.ts +11 -0
- package/lib/clients/apps/catalogGraphQL/category.js +17 -0
- package/lib/clients/apps/catalogGraphQL/index.d.ts +22 -0
- package/lib/clients/apps/catalogGraphQL/index.js +89 -0
- package/lib/clients/apps/catalogGraphQL/product.d.ts +25 -0
- package/lib/clients/apps/catalogGraphQL/product.js +31 -0
- package/lib/clients/apps/catalogGraphQL/sku.d.ts +26 -0
- package/lib/clients/apps/catalogGraphQL/sku.js +31 -0
- package/lib/clients/apps/index.d.ts +7 -0
- package/lib/clients/apps/index.js +19 -0
- package/lib/{HttpClient → clients/external}/ExternalClient.d.ts +3 -3
- package/lib/{HttpClient → clients/external}/ExternalClient.js +10 -2
- package/lib/clients/external/ID.d.ts +23 -0
- package/lib/clients/external/ID.js +61 -0
- package/lib/clients/external/Masterdata.d.ts +94 -0
- package/lib/clients/external/Masterdata.js +225 -0
- package/lib/clients/external/PaymentProvider.d.ts +31 -0
- package/lib/clients/external/PaymentProvider.js +43 -0
- package/lib/clients/external/index.d.ts +4 -0
- package/lib/clients/external/index.js +16 -0
- package/lib/clients/index.d.ts +9 -21
- package/lib/clients/index.js +23 -24
- package/lib/clients/infra/Apps.d.ts +88 -0
- package/lib/clients/infra/Apps.js +511 -0
- package/lib/clients/infra/Assets.d.ts +34 -0
- package/lib/clients/{Assets.js → infra/Assets.js} +75 -19
- package/lib/clients/infra/BillingMetrics.d.ts +13 -0
- package/lib/clients/infra/BillingMetrics.js +16 -0
- package/lib/clients/infra/Events.d.ts +12 -0
- package/lib/clients/infra/Events.js +34 -0
- package/lib/clients/infra/Housekeeper.d.ts +10 -0
- package/lib/clients/infra/Housekeeper.js +31 -0
- package/lib/{HttpClient → clients/infra}/InfraClient.d.ts +3 -3
- package/lib/{HttpClient → clients/infra}/InfraClient.js +10 -4
- package/lib/clients/infra/Registry.d.ts +59 -0
- package/lib/clients/{Registry.js → infra/Registry.js} +95 -33
- package/lib/clients/infra/Router.d.ts +34 -0
- package/lib/clients/infra/Router.js +82 -0
- package/lib/clients/infra/Sphinx.d.ts +13 -0
- package/lib/clients/infra/Sphinx.js +30 -0
- package/lib/clients/infra/VBase.d.ts +60 -0
- package/lib/clients/infra/VBase.js +197 -0
- package/lib/clients/infra/Workspaces.d.ts +18 -0
- package/lib/clients/infra/Workspaces.js +66 -0
- package/lib/clients/infra/index.d.ts +11 -0
- package/lib/clients/infra/index.js +23 -0
- package/lib/{HttpClient → clients/janus}/JanusClient.d.ts +3 -3
- package/lib/{HttpClient → clients/janus}/JanusClient.js +8 -3
- package/lib/clients/janus/LicenseManager.d.ts +7 -0
- package/lib/clients/{LicenseManager.js → janus/LicenseManager.js} +24 -8
- package/lib/clients/{Segment.d.ts → janus/Segment.d.ts} +7 -11
- package/lib/clients/janus/Segment.js +89 -0
- package/lib/clients/{Session.d.ts → janus/Session.d.ts} +4 -4
- package/lib/clients/{Session.js → janus/Session.js} +25 -13
- package/lib/clients/{Tenant.d.ts → janus/Tenant.d.ts} +6 -7
- package/lib/clients/janus/Tenant.js +29 -0
- package/lib/clients/janus/index.d.ts +5 -0
- package/lib/clients/janus/index.js +17 -0
- package/lib/constants.d.ts +49 -1
- package/lib/constants.js +55 -1
- package/lib/errors/AuthenticationError.js +1 -0
- package/lib/errors/ForbiddenError.js +1 -0
- package/lib/errors/NotFoundError.js +1 -0
- package/lib/errors/RequestCancelledError.js +1 -0
- package/lib/errors/ResolverError.d.ts +1 -1
- package/lib/errors/ResolverError.js +3 -2
- package/lib/errors/ResolverWarning.d.ts +1 -1
- package/lib/errors/ResolverWarning.js +3 -2
- package/lib/errors/TooManyRequestsError.js +1 -0
- package/lib/errors/UserInputError.js +1 -0
- package/lib/errors/index.js +18 -11
- package/lib/index.d.ts +9 -7
- package/lib/index.js +27 -16
- package/lib/metrics/MetricsAccumulator.d.ts +1 -18
- package/lib/metrics/MetricsAccumulator.js +39 -22
- package/lib/responses.d.ts +3 -44
- package/lib/service/index.d.ts +2 -0
- package/lib/service/index.js +34 -0
- package/lib/service/loaders.d.ts +8 -0
- package/lib/service/loaders.js +55 -0
- package/lib/service/logger/console.d.ts +10 -0
- package/lib/service/logger/console.js +37 -0
- package/lib/service/logger/index.d.ts +2 -28
- package/lib/service/logger/index.js +12 -68
- package/lib/service/logger/logger.d.ts +29 -0
- package/lib/service/logger/logger.js +62 -0
- package/lib/service/logger/metricsLogger.d.ts +40 -0
- package/lib/service/logger/metricsLogger.js +150 -0
- package/lib/service/master.d.ts +2 -0
- package/lib/service/master.js +88 -0
- package/lib/service/metrics/requestMetricsMiddleware.d.ts +2 -0
- package/lib/service/metrics/requestMetricsMiddleware.js +45 -0
- package/lib/service/tracing/TracerSingleton.d.ts +7 -0
- package/lib/service/tracing/TracerSingleton.js +49 -0
- package/lib/service/tracing/metrics/MetricNames.d.ts +60 -0
- package/lib/service/tracing/metrics/MetricNames.js +45 -0
- package/lib/service/tracing/metrics/instruments.d.ts +9 -0
- package/lib/service/tracing/metrics/instruments.js +12 -0
- package/lib/service/tracing/metrics/measurers/EventLoopLagMeasurer.d.ts +9 -0
- package/lib/service/tracing/metrics/measurers/EventLoopLagMeasurer.js +26 -0
- package/lib/service/tracing/tracingMiddlewares.d.ts +5 -0
- package/lib/service/tracing/tracingMiddlewares.js +114 -0
- package/lib/service/worker/index.d.ts +11 -0
- package/lib/service/worker/index.js +196 -0
- package/lib/service/worker/listeners.d.ts +3 -0
- package/lib/{utils/unhandled.js → service/worker/listeners.js} +10 -15
- package/lib/service/{Service.d.ts → worker/runtime/Service.d.ts} +5 -5
- package/lib/service/{Service.js → worker/runtime/Service.js} +3 -1
- package/lib/service/worker/runtime/builtIn/handlers.d.ts +4 -0
- package/lib/service/worker/runtime/builtIn/handlers.js +31 -0
- package/lib/service/worker/runtime/builtIn/middlewares.d.ts +4 -0
- package/lib/service/worker/runtime/builtIn/middlewares.js +41 -0
- package/lib/service/worker/runtime/events/index.d.ts +4 -0
- package/lib/service/worker/runtime/events/index.js +47 -0
- package/lib/service/worker/runtime/events/middlewares/body.d.ts +3 -0
- package/lib/service/worker/runtime/events/middlewares/body.js +26 -0
- package/lib/service/worker/runtime/events/middlewares/context.d.ts +3 -0
- package/lib/service/worker/runtime/events/middlewares/context.js +23 -0
- package/lib/service/worker/runtime/events/router.d.ts +2 -0
- package/lib/service/worker/runtime/events/router.js +28 -0
- package/lib/service/worker/runtime/graphql/index.d.ts +6 -0
- package/lib/service/worker/runtime/graphql/index.js +28 -0
- package/lib/service/worker/runtime/graphql/middlewares/context.d.ts +2 -0
- package/lib/service/worker/runtime/graphql/middlewares/context.js +17 -0
- package/lib/service/worker/runtime/graphql/middlewares/error.js +97 -0
- package/lib/service/worker/runtime/graphql/middlewares/query.d.ts +3 -0
- package/lib/service/worker/runtime/graphql/middlewares/query.js +53 -0
- package/lib/service/worker/runtime/graphql/middlewares/response.js +39 -0
- package/lib/service/worker/runtime/graphql/middlewares/run.d.ts +2 -0
- package/lib/service/worker/runtime/graphql/middlewares/run.js +20 -0
- package/lib/service/worker/runtime/graphql/middlewares/updateSchema.d.ts +5 -0
- package/lib/service/worker/runtime/graphql/middlewares/updateSchema.js +29 -0
- package/lib/service/worker/runtime/graphql/middlewares/upload.d.ts +4 -0
- package/lib/service/{graphql → worker/runtime/graphql}/middlewares/upload.js +1 -0
- package/lib/service/worker/runtime/graphql/schema/index.d.ts +7 -0
- package/lib/service/worker/runtime/graphql/schema/index.js +32 -0
- package/lib/service/worker/runtime/graphql/schema/messagesLoaderV2.d.ts +6 -0
- package/lib/service/worker/runtime/graphql/schema/messagesLoaderV2.js +80 -0
- package/lib/service/{graphql → worker/runtime/graphql}/schema/schemaDirectives/Auth.d.ts +1 -0
- package/lib/service/{graphql → worker/runtime/graphql}/schema/schemaDirectives/Auth.js +17 -10
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/CacheControl.d.ts +7 -0
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/CacheControl.js +38 -0
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/Deprecated.d.ts +11 -0
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/Deprecated.js +62 -0
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/Metric.d.ts +7 -0
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/Metric.js +41 -0
- package/lib/service/{graphql → worker/runtime/graphql}/schema/schemaDirectives/Sanitize.d.ts +1 -0
- package/lib/service/{graphql → worker/runtime/graphql}/schema/schemaDirectives/Sanitize.js +7 -0
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/Settings.d.ts +6 -0
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/Settings.js +35 -0
- package/lib/service/{graphql → worker/runtime/graphql}/schema/schemaDirectives/SmartCacheDirective.d.ts +1 -0
- package/lib/service/{graphql → worker/runtime/graphql}/schema/schemaDirectives/SmartCacheDirective.js +9 -3
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/TranslatableV2.d.ts +7 -0
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/TranslatableV2.js +40 -0
- package/lib/service/{graphql/schema/schemaDirectives/Translatable.d.ts → worker/runtime/graphql/schema/schemaDirectives/TranslateTo.d.ts} +2 -1
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/TranslateTo.js +34 -0
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/index.d.ts +22 -0
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/index.js +37 -0
- package/lib/service/worker/runtime/graphql/schema/typeDefs/index.d.ts +8 -0
- package/lib/service/worker/runtime/graphql/schema/typeDefs/index.js +13 -0
- package/lib/service/{graphql → worker/runtime/graphql}/schema/typeDefs/ioUpload.js +1 -0
- package/lib/service/{graphql → worker/runtime/graphql}/schema/typeDefs/sanitizedString.js +6 -1
- package/lib/service/worker/runtime/graphql/typings.d.ts +31 -0
- package/lib/service/worker/runtime/graphql/utils/cacheControl.d.ts +2 -0
- package/lib/service/worker/runtime/graphql/utils/cacheControl.js +33 -0
- package/lib/service/worker/runtime/graphql/utils/error.d.ts +2 -0
- package/lib/service/worker/runtime/graphql/utils/error.js +77 -0
- package/lib/service/{graphql → worker/runtime/graphql}/utils/pathname.js +1 -0
- package/lib/service/worker/runtime/graphql/utils/translations.d.ts +14 -0
- package/lib/service/worker/runtime/graphql/utils/translations.js +39 -0
- package/lib/service/worker/runtime/http/index.d.ts +5 -0
- package/lib/service/worker/runtime/http/index.js +59 -0
- package/lib/service/worker/runtime/http/middlewares/authTokens.d.ts +3 -0
- package/lib/service/{http → worker/runtime/http}/middlewares/authTokens.js +1 -0
- package/lib/service/worker/runtime/http/middlewares/cancellationToken.d.ts +3 -0
- package/lib/service/{http → worker/runtime/http}/middlewares/cancellationToken.js +3 -1
- package/lib/service/worker/runtime/http/middlewares/clients.d.ts +4 -0
- package/lib/service/{http → worker/runtime/http}/middlewares/clients.js +1 -0
- package/lib/service/worker/runtime/http/middlewares/context.d.ts +4 -0
- package/lib/service/worker/runtime/http/middlewares/context.js +37 -0
- package/lib/service/worker/runtime/http/middlewares/error.d.ts +2 -0
- package/lib/service/{http → worker/runtime/http}/middlewares/error.js +28 -15
- package/lib/service/worker/runtime/http/middlewares/rateLimit.d.ts +6 -0
- package/lib/service/worker/runtime/http/middlewares/rateLimit.js +43 -0
- package/lib/service/{http → worker/runtime/http}/middlewares/requestStats.d.ts +3 -3
- package/lib/service/{http → worker/runtime/http}/middlewares/requestStats.js +1 -0
- package/lib/service/worker/runtime/http/middlewares/setCookie.d.ts +3 -0
- package/lib/service/{http → worker/runtime/http}/middlewares/setCookie.js +1 -0
- package/lib/service/worker/runtime/http/middlewares/settings.d.ts +9 -0
- package/lib/service/worker/runtime/http/middlewares/settings.js +45 -0
- package/lib/service/worker/runtime/http/middlewares/timings.d.ts +3 -0
- package/lib/service/{http → worker/runtime/http}/middlewares/timings.js +22 -8
- package/lib/service/worker/runtime/http/middlewares/vary.d.ts +3 -0
- package/lib/service/{http → worker/runtime/http}/middlewares/vary.js +4 -3
- package/lib/service/worker/runtime/http/router.d.ts +2 -0
- package/lib/service/worker/runtime/http/router.js +24 -0
- package/lib/service/worker/runtime/http/routes.d.ts +19 -0
- package/lib/service/worker/runtime/http/routes.js +13 -0
- package/lib/service/worker/runtime/method.d.ts +9 -0
- package/lib/service/{method.js → worker/runtime/method.js} +1 -0
- package/lib/service/worker/runtime/statusTrack.d.ts +14 -0
- package/lib/service/worker/runtime/statusTrack.js +38 -0
- package/lib/service/{typings.d.ts → worker/runtime/typings.d.ts} +70 -36
- package/lib/service/worker/runtime/utils/compose.d.ts +5 -0
- package/lib/service/{utils → worker/runtime/utils}/compose.js +3 -2
- package/lib/service/worker/runtime/utils/context.d.ts +5 -0
- package/lib/service/worker/runtime/utils/context.js +41 -0
- package/lib/service/worker/runtime/utils/diff.d.ts +12 -0
- package/lib/service/worker/runtime/utils/diff.js +22 -0
- package/lib/service/worker/runtime/utils/recorder.d.ts +8 -0
- package/lib/service/worker/runtime/utils/recorder.js +38 -0
- package/lib/service/{graphql/utils/array.js → worker/runtime/utils/toArray.js} +1 -0
- package/lib/service/worker/runtime/utils/tokenBucket.d.ts +2 -0
- package/lib/service/worker/runtime/utils/tokenBucket.js +17 -0
- package/lib/tracing/LogEvents.d.ts +31 -0
- package/lib/tracing/LogEvents.js +3 -0
- package/lib/tracing/LogFields.d.ts +66 -0
- package/lib/tracing/LogFields.js +3 -0
- package/lib/tracing/Tags.d.ts +81 -0
- package/lib/tracing/Tags.js +8 -0
- package/lib/tracing/UserLandTracer.d.ts +27 -0
- package/lib/tracing/UserLandTracer.js +57 -0
- package/lib/tracing/errorReporting/ErrorReport.d.ts +31 -0
- package/lib/tracing/errorReporting/ErrorReport.js +71 -0
- package/lib/tracing/index.d.ts +9 -0
- package/lib/tracing/index.js +20 -0
- package/lib/tracing/spanReference/SpanReferenceTypes.d.ts +4 -0
- package/lib/tracing/spanReference/SpanReferenceTypes.js +8 -0
- package/lib/tracing/spanReference/createSpanReference.d.ts +3 -0
- package/lib/tracing/spanReference/createSpanReference.js +9 -0
- package/lib/tracing/utils.d.ts +13 -0
- package/lib/tracing/utils.js +41 -0
- package/lib/utils/MineWinsConflictsResolver.d.ts +6 -4
- package/lib/utils/MineWinsConflictsResolver.js +35 -17
- package/lib/utils/app.d.ts +3 -1
- package/lib/utils/app.js +4 -1
- package/lib/utils/appsStaleIfError.d.ts +1 -1
- package/lib/utils/appsStaleIfError.js +20 -7
- package/lib/utils/billingOptions.d.ts +36 -3
- package/lib/utils/billingOptions.js +8 -3
- package/lib/utils/binding.d.ts +3 -3
- package/lib/utils/binding.js +1 -0
- package/lib/utils/buildFullPath.d.ts +11 -0
- package/lib/utils/buildFullPath.js +54 -0
- package/lib/utils/cancel.d.ts +2 -2
- package/lib/utils/cancel.js +3 -1
- package/lib/utils/conflicts.mock.d.ts +17 -0
- package/lib/utils/conflicts.mock.js +28 -0
- package/lib/utils/domain.js +1 -0
- package/lib/utils/error.js +1 -0
- package/lib/utils/index.js +19 -12
- package/lib/utils/json.js +1 -0
- package/lib/utils/log.d.ts +1 -3
- package/lib/utils/log.js +3 -2
- package/lib/utils/message.js +5 -1
- package/lib/utils/renameBy.js +1 -0
- package/lib/utils/retry.js +3 -2
- package/lib/utils/status.js +1 -0
- package/lib/utils/tenant.d.ts +3 -3
- package/lib/utils/tenant.js +1 -0
- package/lib/utils/throwOnGraphQLErrors.js +1 -0
- package/lib/utils/time.d.ts +7 -7
- package/lib/utils/time.js +10 -2
- package/package.json +3 -3
- package/lib/HttpClient/IOClient.js +0 -14
- package/lib/HttpClient/factories/index.d.ts +0 -8
- package/lib/HttpClient/factories/index.js +0 -31
- package/lib/HttpClient/middlewares/request.d.ts +0 -10
- package/lib/HttpClient/middlewares/request.js +0 -87
- package/lib/IODataSource.d.ts +0 -27
- package/lib/IODataSource.js +0 -46
- package/lib/clients/Apps.d.ts +0 -84
- package/lib/clients/Apps.js +0 -326
- package/lib/clients/Assets.d.ts +0 -21
- package/lib/clients/Billing.d.ts +0 -11
- package/lib/clients/BillingMetrics.d.ts +0 -12
- package/lib/clients/BillingMetrics.js +0 -10
- package/lib/clients/Events.d.ts +0 -6
- package/lib/clients/Events.js +0 -19
- package/lib/clients/Housekeeper.d.ts +0 -11
- package/lib/clients/Housekeeper.js +0 -24
- package/lib/clients/ID.d.ts +0 -22
- package/lib/clients/ID.js +0 -48
- package/lib/clients/LicenseManager.d.ts +0 -6
- package/lib/clients/Logger.d.ts +0 -27
- package/lib/clients/Logger.js +0 -32
- package/lib/clients/Messages.d.ts +0 -18
- package/lib/clients/Messages.js +0 -20
- package/lib/clients/MessagesGraphQL.d.ts +0 -63
- package/lib/clients/MessagesGraphQL.js +0 -50
- package/lib/clients/Metadata.d.ts +0 -25
- package/lib/clients/Metadata.js +0 -53
- package/lib/clients/Registry.d.ts +0 -61
- package/lib/clients/Router.d.ts +0 -33
- package/lib/clients/Router.js +0 -50
- package/lib/clients/Segment.js +0 -69
- package/lib/clients/Sphinx.d.ts +0 -12
- package/lib/clients/Sphinx.js +0 -19
- package/lib/clients/Tenant.js +0 -13
- package/lib/clients/VBase.d.ts +0 -57
- package/lib/clients/VBase.js +0 -116
- package/lib/clients/Workspaces.d.ts +0 -17
- package/lib/clients/Workspaces.js +0 -38
- package/lib/service/Runtime.d.ts +0 -18
- package/lib/service/Runtime.js +0 -57
- package/lib/service/events/index.d.ts +0 -3
- package/lib/service/events/index.js +0 -21
- package/lib/service/graphql/index.d.ts +0 -7
- package/lib/service/graphql/index.js +0 -33
- package/lib/service/graphql/middlewares/error.js +0 -107
- package/lib/service/graphql/middlewares/formatters.d.ts +0 -2
- package/lib/service/graphql/middlewares/formatters.js +0 -64
- package/lib/service/graphql/middlewares/query.d.ts +0 -2
- package/lib/service/graphql/middlewares/query.js +0 -32
- package/lib/service/graphql/middlewares/response.js +0 -36
- package/lib/service/graphql/middlewares/run.d.ts +0 -4
- package/lib/service/graphql/middlewares/run.js +0 -55
- package/lib/service/graphql/middlewares/schema.d.ts +0 -2
- package/lib/service/graphql/middlewares/schema.js +0 -8
- package/lib/service/graphql/middlewares/timings.d.ts +0 -2
- package/lib/service/graphql/middlewares/timings.js +0 -10
- package/lib/service/graphql/middlewares/upload.d.ts +0 -7
- package/lib/service/graphql/schema/index.d.ts +0 -3
- package/lib/service/graphql/schema/index.js +0 -66
- package/lib/service/graphql/schema/messagesLoader.d.ts +0 -4
- package/lib/service/graphql/schema/messagesLoader.js +0 -41
- package/lib/service/graphql/schema/messagesLoaderV2.d.ts +0 -5
- package/lib/service/graphql/schema/messagesLoaderV2.js +0 -44
- package/lib/service/graphql/schema/schemaDirectives/Translatable.js +0 -54
- package/lib/service/graphql/schema/schemaDirectives/TranslatableV2.d.ts +0 -13
- package/lib/service/graphql/schema/schemaDirectives/TranslatableV2.js +0 -67
- package/lib/service/graphql/schema/schemaDirectives/index.d.ts +0 -13
- package/lib/service/graphql/schema/schemaDirectives/index.js +0 -17
- package/lib/service/graphql/schema/typeDefs/index.d.ts +0 -16
- package/lib/service/graphql/schema/typeDefs/index.js +0 -21
- package/lib/service/graphql/schema/typeDefs/ioMessage.d.ts +0 -8
- package/lib/service/graphql/schema/typeDefs/ioMessage.js +0 -33
- package/lib/service/graphql/typings.d.ts +0 -21
- package/lib/service/graphql/utils/cacheControl.d.ts +0 -6
- package/lib/service/graphql/utils/cacheControl.js +0 -38
- package/lib/service/graphql/utils/maxAgeEnum.d.ts +0 -6
- package/lib/service/graphql/utils/maxAgeEnum.js +0 -17
- package/lib/service/http/index.d.ts +0 -3
- package/lib/service/http/index.js +0 -18
- package/lib/service/http/middlewares/authTokens.d.ts +0 -3
- package/lib/service/http/middlewares/cancellationToken.d.ts +0 -3
- package/lib/service/http/middlewares/clients.d.ts +0 -4
- package/lib/service/http/middlewares/error.d.ts +0 -3
- package/lib/service/http/middlewares/setCookie.d.ts +0 -3
- package/lib/service/http/middlewares/timings.d.ts +0 -3
- package/lib/service/http/middlewares/vary.d.ts +0 -3
- package/lib/service/method.d.ts +0 -9
- package/lib/service/utils/compose.d.ts +0 -4
- package/lib/utils/MineWinsConflictsResolver.test.d.ts +0 -1
- package/lib/utils/MineWinsConflictsResolver.test.js +0 -134
- package/lib/utils/unhandled.d.ts +0 -1
- /package/lib/service/{graphql → worker/runtime/graphql}/middlewares/error.d.ts +0 -0
- /package/lib/service/{graphql → worker/runtime/graphql}/middlewares/response.d.ts +0 -0
- /package/lib/service/{graphql → worker/runtime/graphql}/schema/typeDefs/ioUpload.d.ts +0 -0
- /package/lib/service/{graphql → worker/runtime/graphql}/schema/typeDefs/sanitizedString.d.ts +0 -0
- /package/lib/service/{graphql → worker/runtime/graphql}/typings.js +0 -0
- /package/lib/service/{graphql → worker/runtime/graphql}/utils/pathname.d.ts +0 -0
- /package/lib/service/{typings.js → worker/runtime/typings.js} +0 -0
- /package/lib/service/{graphql/utils/array.d.ts → worker/runtime/utils/toArray.d.ts} +0 -0
|
@@ -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 | undefined) => 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 | undefined) => Promise<BuildResult>;
|
|
17
|
+
getPinnedDependencies: (tracingConfig?: RequestTracingConfig | undefined) => Promise<any>;
|
|
18
|
+
linkApp: (app: string, files: File[], zipOptions?: ZipOptions, params?: RequestParams, tracingConfig?: RequestTracingConfig | undefined) => Promise<BuildResult>;
|
|
19
|
+
publishApp: (app: string, files: File[], zipOptions?: ZipOptions, params?: RequestParams, tracingConfig?: RequestTracingConfig | undefined) => Promise<BuildResult>;
|
|
20
|
+
relinkApp: (app: string, changes: Change[], params?: RequestParams, tracingConfig?: RequestTracingConfig | undefined) => Promise<BuildResult>;
|
|
21
|
+
testApp: (app: string, files: File[], zipOptions?: ZipOptions, params?: RequestParams, tracingConfig?: RequestTracingConfig | undefined) => 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
|
}
|
|
@@ -69,11 +90,18 @@ class Builder extends HttpClient_1.AppClient {
|
|
|
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();
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { InstanceOptions, RequestTracingConfig } from '../../HttpClient';
|
|
2
|
+
import { IOContext } from '../../service/worker/runtime/typings';
|
|
3
|
+
import { AppGraphQLClient } from './AppGraphQLClient';
|
|
4
|
+
export interface IndexedByFrom {
|
|
5
|
+
messages: Array<Omit<Message, 'from'>>;
|
|
6
|
+
from: string;
|
|
7
|
+
}
|
|
8
|
+
export declare type Behavior = 'FULL' | 'USER_ONLY' | 'USER_AND_APP';
|
|
9
|
+
export interface Message {
|
|
10
|
+
content: string;
|
|
11
|
+
context?: string;
|
|
12
|
+
behavior?: Behavior;
|
|
13
|
+
from: string;
|
|
14
|
+
}
|
|
15
|
+
export interface MessageSaveInput {
|
|
16
|
+
srcLang: string;
|
|
17
|
+
srcMessage: string;
|
|
18
|
+
context?: string;
|
|
19
|
+
targetMessage: string;
|
|
20
|
+
groupContext?: string;
|
|
21
|
+
}
|
|
22
|
+
export interface TranslateInput {
|
|
23
|
+
indexedByFrom: IndexedByFrom[];
|
|
24
|
+
to: string;
|
|
25
|
+
depTree?: string;
|
|
26
|
+
encoding?: 'ICU' | 'HANDLEBARS';
|
|
27
|
+
}
|
|
28
|
+
export interface TranslateWithDependenciesInput {
|
|
29
|
+
indexedByFrom: IndexedByFrom[];
|
|
30
|
+
to: string;
|
|
31
|
+
depTree: string;
|
|
32
|
+
encoding?: 'ICU' | 'HANDLEBARS';
|
|
33
|
+
}
|
|
34
|
+
export interface SaveInput {
|
|
35
|
+
fireEvent?: boolean;
|
|
36
|
+
to: string;
|
|
37
|
+
messages: MessageSaveInput[];
|
|
38
|
+
}
|
|
39
|
+
export interface MessageInputV2 {
|
|
40
|
+
content: string;
|
|
41
|
+
context?: string;
|
|
42
|
+
behavior?: Behavior;
|
|
43
|
+
}
|
|
44
|
+
export interface MessageListV2 {
|
|
45
|
+
srcLang: string;
|
|
46
|
+
groupContext?: string;
|
|
47
|
+
context?: string;
|
|
48
|
+
translations: Translation[];
|
|
49
|
+
}
|
|
50
|
+
export interface Translation {
|
|
51
|
+
lang: string;
|
|
52
|
+
translation: string;
|
|
53
|
+
}
|
|
54
|
+
export declare class MessagesGraphQL extends AppGraphQLClient {
|
|
55
|
+
constructor(vtex: IOContext, options?: InstanceOptions);
|
|
56
|
+
translateV2(args: TranslateInput, tracingConfig?: RequestTracingConfig): Promise<string[]>;
|
|
57
|
+
translate(args: TranslateInput, tracingConfig?: RequestTracingConfig): Promise<string[]>;
|
|
58
|
+
translateWithDependencies(args: TranslateWithDependenciesInput, tracingConfig?: RequestTracingConfig): Promise<string[]>;
|
|
59
|
+
saveV2(args: SaveInput, tracingConfig?: RequestTracingConfig): Promise<boolean>;
|
|
60
|
+
userTranslations(args: IndexedByFrom, tracingConfig?: RequestTracingConfig): Promise<MessageListV2[]>;
|
|
61
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MessagesGraphQL = void 0;
|
|
4
|
+
const ramda_1 = require("ramda");
|
|
5
|
+
const AppGraphQLClient_1 = require("./AppGraphQLClient");
|
|
6
|
+
const MAX_BATCH_SIZE = 500;
|
|
7
|
+
class MessagesGraphQL extends AppGraphQLClient_1.AppGraphQLClient {
|
|
8
|
+
constructor(vtex, options) {
|
|
9
|
+
super('vtex.messages@1.x', vtex, options);
|
|
10
|
+
}
|
|
11
|
+
translateV2(args, tracingConfig) {
|
|
12
|
+
const { indexedByFrom, ...rest } = args;
|
|
13
|
+
const allMessages = indexedByFrom.reduce((acc, { from, messages }) => {
|
|
14
|
+
return acc.concat(messages.map(message => ({ from, message })));
|
|
15
|
+
}, []);
|
|
16
|
+
const batchedMessages = ramda_1.splitEvery(MAX_BATCH_SIZE, allMessages);
|
|
17
|
+
const metric = 'messages-translate-v2';
|
|
18
|
+
return Promise.all(batchedMessages.map(batch => {
|
|
19
|
+
const indexedBatch = batch.reduce((acc, { from, message }) => {
|
|
20
|
+
if (!acc[from]) {
|
|
21
|
+
acc[from] = {
|
|
22
|
+
from,
|
|
23
|
+
messages: [],
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
acc[from].messages.push(message);
|
|
27
|
+
return acc;
|
|
28
|
+
}, {});
|
|
29
|
+
const batchArgs = {
|
|
30
|
+
...rest,
|
|
31
|
+
indexedByFrom: ramda_1.values(indexedBatch),
|
|
32
|
+
};
|
|
33
|
+
return this.graphql.query({
|
|
34
|
+
query: `
|
|
35
|
+
query Translate($args: TranslateArgs!) {
|
|
36
|
+
translate(args: $args)
|
|
37
|
+
}
|
|
38
|
+
`,
|
|
39
|
+
variables: { args: batchArgs },
|
|
40
|
+
}, {
|
|
41
|
+
metric,
|
|
42
|
+
tracing: {
|
|
43
|
+
requestSpanNameSuffix: metric,
|
|
44
|
+
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
45
|
+
},
|
|
46
|
+
}).then(ramda_1.path(['data', 'translate']));
|
|
47
|
+
})).then(ramda_1.flatten);
|
|
48
|
+
}
|
|
49
|
+
async translate(args, tracingConfig) {
|
|
50
|
+
const metric = 'messages-translate-v2';
|
|
51
|
+
const response = await this.graphql.query({
|
|
52
|
+
query: `query Translate($args: TranslateArgs!) {
|
|
53
|
+
translate(args: $args)
|
|
54
|
+
}`,
|
|
55
|
+
variables: { args },
|
|
56
|
+
}, {
|
|
57
|
+
metric,
|
|
58
|
+
tracing: {
|
|
59
|
+
requestSpanNameSuffix: metric,
|
|
60
|
+
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
return response.data.translate;
|
|
64
|
+
}
|
|
65
|
+
async translateWithDependencies(args, tracingConfig) {
|
|
66
|
+
const metric = 'messages-translate-with-deps-v2';
|
|
67
|
+
const response = await this.graphql.query({
|
|
68
|
+
query: `query TranslateWithDeps($args: TranslateWithDependenciesArgs!) {
|
|
69
|
+
translateWithDependencies(args: $args)
|
|
70
|
+
}`,
|
|
71
|
+
variables: { args },
|
|
72
|
+
}, {
|
|
73
|
+
metric,
|
|
74
|
+
tracing: {
|
|
75
|
+
requestSpanNameSuffix: metric,
|
|
76
|
+
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
return response.data.translateWithDependencies;
|
|
80
|
+
}
|
|
81
|
+
async saveV2(args, tracingConfig) {
|
|
82
|
+
const metric = 'messages-saveV2-translation';
|
|
83
|
+
const response = await this.graphql.mutate({
|
|
84
|
+
mutate: `mutation SaveV2($args: SaveArgsV2!) {
|
|
85
|
+
saveV2(args: $args)
|
|
86
|
+
}`,
|
|
87
|
+
variables: { args },
|
|
88
|
+
}, {
|
|
89
|
+
metric,
|
|
90
|
+
tracing: {
|
|
91
|
+
requestSpanNameSuffix: metric,
|
|
92
|
+
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
93
|
+
},
|
|
94
|
+
});
|
|
95
|
+
return response.data.saveV2;
|
|
96
|
+
}
|
|
97
|
+
async userTranslations(args, tracingConfig) {
|
|
98
|
+
const metric = 'messages-user-translations';
|
|
99
|
+
const response = await this.graphql.query({
|
|
100
|
+
query: `query UserTranslations($args: IndexedMessages!){
|
|
101
|
+
userTranslations(args: $args) {
|
|
102
|
+
srcLang
|
|
103
|
+
groupContext
|
|
104
|
+
context
|
|
105
|
+
translations {
|
|
106
|
+
lang
|
|
107
|
+
translation
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}`,
|
|
111
|
+
variables: { args },
|
|
112
|
+
}, {
|
|
113
|
+
metric,
|
|
114
|
+
tracing: {
|
|
115
|
+
requestSpanNameSuffix: metric,
|
|
116
|
+
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
117
|
+
},
|
|
118
|
+
});
|
|
119
|
+
return response.data.userTranslations;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
exports.MessagesGraphQL = MessagesGraphQL;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { IOContext } from '
|
|
3
|
-
import { AppMetaInfo } from '
|
|
1
|
+
import { InstanceOptions, RequestTracingConfig } from '../../HttpClient';
|
|
2
|
+
import { IOContext } from '../../service/worker/runtime/typings';
|
|
3
|
+
import { AppMetaInfo } from '../infra/Apps';
|
|
4
|
+
import { AppClient } from './AppClient';
|
|
4
5
|
export interface SettingsParams {
|
|
5
6
|
merge?: boolean;
|
|
6
7
|
files?: string[];
|
|
@@ -9,5 +10,5 @@ export declare class Settings extends AppClient {
|
|
|
9
10
|
constructor(context: IOContext, options?: InstanceOptions);
|
|
10
11
|
getFilteredDependencies(appAtMajor: string, dependencies: AppMetaInfo[]): AppMetaInfo[];
|
|
11
12
|
getDependenciesHash(dependencies: AppMetaInfo[]): string;
|
|
12
|
-
getSettings(dependencies: AppMetaInfo[], appAtMajor: string, params?: SettingsParams): Promise<any>;
|
|
13
|
+
getSettings(dependencies: AppMetaInfo[], appAtMajor: string, params?: SettingsParams, tracingConfig?: RequestTracingConfig): Promise<any>;
|
|
13
14
|
}
|
|
@@ -1,43 +1,38 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
3
|
+
exports.Settings = void 0;
|
|
4
4
|
const ramda_1 = require("ramda");
|
|
5
|
-
const HttpClient_1 = require("
|
|
6
|
-
const
|
|
5
|
+
const HttpClient_1 = require("../../HttpClient");
|
|
6
|
+
const settings_1 = require("../../service/worker/runtime/http/middlewares/settings");
|
|
7
|
+
const app_1 = require("../../utils/app");
|
|
8
|
+
const AppClient_1 = require("./AppClient");
|
|
7
9
|
const LINKED_ROUTE = 'linked';
|
|
8
|
-
const dependsOnApp = (appAtMajor) => (a) => {
|
|
9
|
-
const [name, major] = appAtMajor.split('@');
|
|
10
|
-
const version = a._resolvedDependencies[name];
|
|
11
|
-
if (!version) {
|
|
12
|
-
return false;
|
|
13
|
-
}
|
|
14
|
-
const [depMajor] = version.split('.');
|
|
15
|
-
return major === depMajor;
|
|
16
|
-
};
|
|
17
|
-
const joinIds = ramda_1.join('');
|
|
18
10
|
const containsLinks = ramda_1.any(app_1.isLinkedApp);
|
|
19
|
-
class Settings extends
|
|
11
|
+
class Settings extends AppClient_1.AppClient {
|
|
20
12
|
constructor(context, options) {
|
|
21
13
|
super('vtex.settings-server@0.x', context, options);
|
|
22
14
|
}
|
|
23
15
|
getFilteredDependencies(appAtMajor, dependencies) {
|
|
24
|
-
|
|
25
|
-
return ramda_1.filter(depends, dependencies);
|
|
16
|
+
return settings_1.getFilteredDependencies(appAtMajor, dependencies);
|
|
26
17
|
}
|
|
27
18
|
getDependenciesHash(dependencies) {
|
|
28
|
-
|
|
29
|
-
return crypto_1.createHash('md5').update(joinIds(dependingApps)).digest('hex');
|
|
19
|
+
return settings_1.getDependenciesHash(dependencies);
|
|
30
20
|
}
|
|
31
|
-
async getSettings(dependencies, appAtMajor, params) {
|
|
21
|
+
async getSettings(dependencies, appAtMajor, params, tracingConfig) {
|
|
32
22
|
const filtered = this.getFilteredDependencies(appAtMajor, dependencies);
|
|
33
23
|
// Settings server exposes a smartCache-enabled route for when the workspace contains links.
|
|
34
24
|
const lastSegment = containsLinks(filtered)
|
|
35
25
|
? LINKED_ROUTE
|
|
36
26
|
: this.getDependenciesHash(filtered);
|
|
27
|
+
const metric = 'settings-get';
|
|
37
28
|
return this.http.get(`/settings/${appAtMajor}/${lastSegment}`, {
|
|
38
29
|
inflightKey: HttpClient_1.inflightUrlWithQuery,
|
|
39
|
-
metric
|
|
30
|
+
metric,
|
|
40
31
|
params,
|
|
32
|
+
tracing: {
|
|
33
|
+
requestSpanNameSuffix: metric,
|
|
34
|
+
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
35
|
+
},
|
|
41
36
|
});
|
|
42
37
|
}
|
|
43
38
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const query = "\nquery GetBrand($id: ID!) {\n brand (id: $id) {\n id\n name\n text\n keywords\n siteTitle\n active\n menuHome\n adWordsRemarketingCode\n lomadeeCampaignCode\n score\n }\n}\n";
|
|
2
|
+
export interface Brand {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
text?: string;
|
|
6
|
+
keywords?: string[];
|
|
7
|
+
siteTitle?: string;
|
|
8
|
+
active: boolean;
|
|
9
|
+
menuHome: boolean;
|
|
10
|
+
adWordsRemarketingCode?: string;
|
|
11
|
+
lomadeeCampaignCode?: string;
|
|
12
|
+
score?: number;
|
|
13
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.query = void 0;
|
|
4
|
+
exports.query = `
|
|
5
|
+
query GetBrand($id: ID!) {
|
|
6
|
+
brand (id: $id) {
|
|
7
|
+
id
|
|
8
|
+
name
|
|
9
|
+
text
|
|
10
|
+
keywords
|
|
11
|
+
siteTitle
|
|
12
|
+
active
|
|
13
|
+
menuHome
|
|
14
|
+
adWordsRemarketingCode
|
|
15
|
+
lomadeeCampaignCode
|
|
16
|
+
score
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
`;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const query = "\nquery GetCategory($id: ID!) {\n category (id: $id) {\n id\n name\n title\n parentCategoryId\n description\n isActive\n globalCategoryId\n score\n }\n}\n";
|
|
2
|
+
export interface Category {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
title?: string;
|
|
6
|
+
parentCategoryId?: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
isActive: boolean;
|
|
9
|
+
globalCategoryId: number;
|
|
10
|
+
score?: number;
|
|
11
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.query = void 0;
|
|
4
|
+
exports.query = `
|
|
5
|
+
query GetCategory($id: ID!) {
|
|
6
|
+
category (id: $id) {
|
|
7
|
+
id
|
|
8
|
+
name
|
|
9
|
+
title
|
|
10
|
+
parentCategoryId
|
|
11
|
+
description
|
|
12
|
+
isActive
|
|
13
|
+
globalCategoryId
|
|
14
|
+
score
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
`;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { AppGraphQLClient } from '..';
|
|
2
|
+
import { InstanceOptions, IOContext } from '../../..';
|
|
3
|
+
import { RequestTracingConfig } from '../../../HttpClient';
|
|
4
|
+
import { Brand } from './brand';
|
|
5
|
+
import { Category } from './category';
|
|
6
|
+
import { Product } from './product';
|
|
7
|
+
import { SKU } from './sku';
|
|
8
|
+
export declare class CatalogGraphQL extends AppGraphQLClient {
|
|
9
|
+
constructor(ctx: IOContext, opts?: InstanceOptions);
|
|
10
|
+
sku: (id: string, tracingConfig?: RequestTracingConfig | undefined) => Promise<{
|
|
11
|
+
sku: SKU;
|
|
12
|
+
} | undefined>;
|
|
13
|
+
product: (id: string, tracingConfig?: RequestTracingConfig | undefined) => Promise<{
|
|
14
|
+
product: Product;
|
|
15
|
+
} | undefined>;
|
|
16
|
+
category: (id: string, tracingConfig?: RequestTracingConfig | undefined) => Promise<{
|
|
17
|
+
category: Category;
|
|
18
|
+
} | undefined>;
|
|
19
|
+
brand: (id: string, tracingConfig?: RequestTracingConfig | undefined) => Promise<{
|
|
20
|
+
brand: Brand;
|
|
21
|
+
} | undefined>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CatalogGraphQL = void 0;
|
|
4
|
+
const ramda_1 = require("ramda");
|
|
5
|
+
const __1 = require("..");
|
|
6
|
+
const brand_1 = require("./brand");
|
|
7
|
+
const category_1 = require("./category");
|
|
8
|
+
const product_1 = require("./product");
|
|
9
|
+
const sku_1 = require("./sku");
|
|
10
|
+
class CatalogGraphQL extends __1.AppGraphQLClient {
|
|
11
|
+
constructor(ctx, opts) {
|
|
12
|
+
super('vtex.catalog-graphql@1.x', ctx, {
|
|
13
|
+
...opts,
|
|
14
|
+
headers: {
|
|
15
|
+
...opts && opts.headers,
|
|
16
|
+
cookie: `VtexIdclientAutCookie=${ctx.authToken}`,
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
this.sku = (id, tracingConfig) => {
|
|
20
|
+
const variables = {
|
|
21
|
+
identifier: {
|
|
22
|
+
field: 'id',
|
|
23
|
+
value: id,
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
return this.graphql
|
|
27
|
+
.query({
|
|
28
|
+
inflight: true,
|
|
29
|
+
query: sku_1.query,
|
|
30
|
+
variables,
|
|
31
|
+
}, {
|
|
32
|
+
forceMaxAge: 5,
|
|
33
|
+
tracing: {
|
|
34
|
+
requestSpanNameSuffix: 'catalog-sku',
|
|
35
|
+
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
36
|
+
},
|
|
37
|
+
})
|
|
38
|
+
.then(ramda_1.prop('data'));
|
|
39
|
+
};
|
|
40
|
+
this.product = (id, tracingConfig) => {
|
|
41
|
+
const variables = {
|
|
42
|
+
identifier: {
|
|
43
|
+
field: 'id',
|
|
44
|
+
value: id,
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
return this.graphql
|
|
48
|
+
.query({
|
|
49
|
+
inflight: true,
|
|
50
|
+
query: product_1.query,
|
|
51
|
+
variables,
|
|
52
|
+
}, {
|
|
53
|
+
forceMaxAge: 5,
|
|
54
|
+
tracing: {
|
|
55
|
+
requestSpanNameSuffix: 'catalog-product',
|
|
56
|
+
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
57
|
+
},
|
|
58
|
+
})
|
|
59
|
+
.then(ramda_1.prop('data'));
|
|
60
|
+
};
|
|
61
|
+
this.category = (id, tracingConfig) => this.graphql
|
|
62
|
+
.query({
|
|
63
|
+
inflight: true,
|
|
64
|
+
query: category_1.query,
|
|
65
|
+
variables: { id },
|
|
66
|
+
}, {
|
|
67
|
+
forceMaxAge: 5,
|
|
68
|
+
tracing: {
|
|
69
|
+
requestSpanNameSuffix: 'catalog-category',
|
|
70
|
+
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
71
|
+
},
|
|
72
|
+
})
|
|
73
|
+
.then(ramda_1.prop('data'));
|
|
74
|
+
this.brand = (id, tracingConfig) => this.graphql
|
|
75
|
+
.query({
|
|
76
|
+
inflight: true,
|
|
77
|
+
query: brand_1.query,
|
|
78
|
+
variables: { id },
|
|
79
|
+
}, {
|
|
80
|
+
forceMaxAge: 5,
|
|
81
|
+
tracing: {
|
|
82
|
+
requestSpanNameSuffix: 'catalog-brand',
|
|
83
|
+
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
84
|
+
},
|
|
85
|
+
})
|
|
86
|
+
.then(ramda_1.prop('data'));
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
exports.CatalogGraphQL = CatalogGraphQL;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export declare const query = "\nquery GetProduct ($identifier: ProductUniqueIdentifier!) {\n product (identifier: $identifier) {\n id\n brandId\n categoryId\n departmentId\n name\n linkId\n refId\n isVisible\n description\n shortDescription\n releaseDate\n keywords\n title\n isActive\n taxCode\n metaTagDescription\n supplierId\n showWithoutStock\n score\n salesChannel {\n id\n }\n }\n}\n";
|
|
2
|
+
export interface Product {
|
|
3
|
+
id: string;
|
|
4
|
+
brandId: string;
|
|
5
|
+
categoryId: string;
|
|
6
|
+
departmentId: string;
|
|
7
|
+
name: string;
|
|
8
|
+
linkId: string;
|
|
9
|
+
refId?: string;
|
|
10
|
+
isVisible: boolean;
|
|
11
|
+
description?: string;
|
|
12
|
+
shortDescription?: string;
|
|
13
|
+
releaseDate?: string;
|
|
14
|
+
keywords: string[];
|
|
15
|
+
title?: string;
|
|
16
|
+
isActive: boolean;
|
|
17
|
+
taxCode?: string;
|
|
18
|
+
metaTagDescription?: string;
|
|
19
|
+
supplierId?: string;
|
|
20
|
+
showWithoutStock: boolean;
|
|
21
|
+
score?: number;
|
|
22
|
+
salesChannel?: Array<{
|
|
23
|
+
id: string;
|
|
24
|
+
}>;
|
|
25
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.query = void 0;
|
|
4
|
+
exports.query = `
|
|
5
|
+
query GetProduct ($identifier: ProductUniqueIdentifier!) {
|
|
6
|
+
product (identifier: $identifier) {
|
|
7
|
+
id
|
|
8
|
+
brandId
|
|
9
|
+
categoryId
|
|
10
|
+
departmentId
|
|
11
|
+
name
|
|
12
|
+
linkId
|
|
13
|
+
refId
|
|
14
|
+
isVisible
|
|
15
|
+
description
|
|
16
|
+
shortDescription
|
|
17
|
+
releaseDate
|
|
18
|
+
keywords
|
|
19
|
+
title
|
|
20
|
+
isActive
|
|
21
|
+
taxCode
|
|
22
|
+
metaTagDescription
|
|
23
|
+
supplierId
|
|
24
|
+
showWithoutStock
|
|
25
|
+
score
|
|
26
|
+
salesChannel {
|
|
27
|
+
id
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
`;
|