@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
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ErrorReportBase, ErrorReportCreateArgs } from '@vtex/node-error-report';
|
|
2
|
+
import { Span } from 'opentracing';
|
|
3
|
+
import { IOContext } from '../../service/worker/runtime/typings';
|
|
4
|
+
export declare class ErrorReport extends ErrorReportBase {
|
|
5
|
+
/**
|
|
6
|
+
* Create a new ErrorReport wrapping args.originalError
|
|
7
|
+
*
|
|
8
|
+
* In case the args.originalError argument is already an ErrorReport
|
|
9
|
+
* instance, then ErrorReport.create just returns it. If it's not,
|
|
10
|
+
* it returns a new ErrorReport wrapping the error. This way you can
|
|
11
|
+
* use ErrorReport.create on a catchAll, e.g.:
|
|
12
|
+
*
|
|
13
|
+
* ```
|
|
14
|
+
* try {
|
|
15
|
+
* await next()
|
|
16
|
+
* } catch(err) {
|
|
17
|
+
* ErrorReport.create({ originalError: err }).injectOnSpan(span)
|
|
18
|
+
* }
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* More docs on the ErrorReport available on: https://github.com/vtex/node-error-report
|
|
22
|
+
*/
|
|
23
|
+
static create(args: ErrorReportCreateArgs): ErrorReport;
|
|
24
|
+
/**
|
|
25
|
+
* Inject information about the error wrapped by this ErrorReport
|
|
26
|
+
* instance on the provided Span. If a logger is provided and the
|
|
27
|
+
* span is part of a **sampled** trace, then the error will be logged.
|
|
28
|
+
*/
|
|
29
|
+
injectOnSpan(span?: Span, logger?: IOContext['logger']): this;
|
|
30
|
+
private shouldLogToSplunk;
|
|
31
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ErrorReport = void 0;
|
|
4
|
+
const node_error_report_1 = require("@vtex/node-error-report");
|
|
5
|
+
const __1 = require("..");
|
|
6
|
+
const utils_1 = require("../utils");
|
|
7
|
+
class ErrorReport extends node_error_report_1.ErrorReportBase {
|
|
8
|
+
/**
|
|
9
|
+
* Create a new ErrorReport wrapping args.originalError
|
|
10
|
+
*
|
|
11
|
+
* In case the args.originalError argument is already an ErrorReport
|
|
12
|
+
* instance, then ErrorReport.create just returns it. If it's not,
|
|
13
|
+
* it returns a new ErrorReport wrapping the error. This way you can
|
|
14
|
+
* use ErrorReport.create on a catchAll, e.g.:
|
|
15
|
+
*
|
|
16
|
+
* ```
|
|
17
|
+
* try {
|
|
18
|
+
* await next()
|
|
19
|
+
* } catch(err) {
|
|
20
|
+
* ErrorReport.create({ originalError: err }).injectOnSpan(span)
|
|
21
|
+
* }
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* More docs on the ErrorReport available on: https://github.com/vtex/node-error-report
|
|
25
|
+
*/
|
|
26
|
+
static create(args) {
|
|
27
|
+
if (args.originalError instanceof ErrorReport) {
|
|
28
|
+
return args.originalError;
|
|
29
|
+
}
|
|
30
|
+
return new ErrorReport(node_error_report_1.createErrorReportBaseArgs(args));
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Inject information about the error wrapped by this ErrorReport
|
|
34
|
+
* instance on the provided Span. If a logger is provided and the
|
|
35
|
+
* span is part of a **sampled** trace, then the error will be logged.
|
|
36
|
+
*/
|
|
37
|
+
injectOnSpan(span, logger) {
|
|
38
|
+
var _a, _b, _c, _d;
|
|
39
|
+
span === null || span === void 0 ? void 0 : span.setTag(__1.TracingTags.ERROR, 'true');
|
|
40
|
+
const indexedLogs = {
|
|
41
|
+
["error.kind" /* ERROR_KIND */]: this.kind,
|
|
42
|
+
["error.id" /* ERROR_ID */]: this.metadata.errorId,
|
|
43
|
+
};
|
|
44
|
+
if (node_error_report_1.isRequestInfo(this.parsedInfo) &&
|
|
45
|
+
this.parsedInfo.response &&
|
|
46
|
+
node_error_report_1.isInfraErrorData((_a = this.parsedInfo.response) === null || _a === void 0 ? void 0 : _a.data)) {
|
|
47
|
+
indexedLogs["error.server.code" /* ERROR_SERVER_CODE */] = this.parsedInfo.response.data.code;
|
|
48
|
+
indexedLogs["error.server.request_id" /* ERROR_SERVER_REQUEST_ID */] = this.parsedInfo.response.data.requestId;
|
|
49
|
+
}
|
|
50
|
+
const serializableError = this.toObject();
|
|
51
|
+
span === null || span === void 0 ? void 0 : span.log({
|
|
52
|
+
event: 'error',
|
|
53
|
+
...indexedLogs,
|
|
54
|
+
["error.message" /* ERROR_MESSAGE */]: serializableError.message,
|
|
55
|
+
["error.metadata.metrics.InstantiationTime" /* ERROR_METADATA_METRICS_INSTANTIATION_TIME */]: (_b = serializableError.metadata) === null || _b === void 0 ? void 0 : _b.reportCount,
|
|
56
|
+
["error.metadata.reportCount" /* ERROR_METADATA_REPORT_COUNT */]: (_d = (_c = serializableError.metadata) === null || _c === void 0 ? void 0 : _c.metrics) === null || _d === void 0 ? void 0 : _d.instantiationTime,
|
|
57
|
+
["error.stack" /* ERROR_STACK */]: serializableError.stack,
|
|
58
|
+
["error.code" /* ERROR_CODE */]: serializableError.code,
|
|
59
|
+
});
|
|
60
|
+
if (logger && this.shouldLogToSplunk(span)) {
|
|
61
|
+
logger.error(serializableError);
|
|
62
|
+
this.markErrorAsReported();
|
|
63
|
+
}
|
|
64
|
+
return this;
|
|
65
|
+
}
|
|
66
|
+
shouldLogToSplunk(span) {
|
|
67
|
+
var _a;
|
|
68
|
+
return !this.isErrorReported() && ((_a = utils_1.getTraceInfo(span)) === null || _a === void 0 ? void 0 : _a.isSampled);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
exports.ErrorReport = ErrorReport;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FORMAT_HTTP_HEADERS, Span } from 'opentracing';
|
|
2
|
+
export { ErrorKindsBase as ErrorKinds } from '@vtex/node-error-report';
|
|
3
|
+
export { ErrorReport } from './errorReporting/ErrorReport';
|
|
4
|
+
export { createSpanReference } from './spanReference/createSpanReference';
|
|
5
|
+
export { SpanReferenceTypes } from './spanReference/SpanReferenceTypes';
|
|
6
|
+
export { UserlandTags as TracingTags } from './Tags';
|
|
7
|
+
export { createTracingContextFromCarrier, IUserLandTracer } from './UserLandTracer';
|
|
8
|
+
export { getTraceInfo, TraceInfo } from './utils';
|
|
9
|
+
export { Span, FORMAT_HTTP_HEADERS };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FORMAT_HTTP_HEADERS = exports.Span = void 0;
|
|
4
|
+
const opentracing_1 = require("opentracing");
|
|
5
|
+
Object.defineProperty(exports, "FORMAT_HTTP_HEADERS", { enumerable: true, get: function () { return opentracing_1.FORMAT_HTTP_HEADERS; } });
|
|
6
|
+
Object.defineProperty(exports, "Span", { enumerable: true, get: function () { return opentracing_1.Span; } });
|
|
7
|
+
var node_error_report_1 = require("@vtex/node-error-report");
|
|
8
|
+
Object.defineProperty(exports, "ErrorKinds", { enumerable: true, get: function () { return node_error_report_1.ErrorKindsBase; } });
|
|
9
|
+
var ErrorReport_1 = require("./errorReporting/ErrorReport");
|
|
10
|
+
Object.defineProperty(exports, "ErrorReport", { enumerable: true, get: function () { return ErrorReport_1.ErrorReport; } });
|
|
11
|
+
var createSpanReference_1 = require("./spanReference/createSpanReference");
|
|
12
|
+
Object.defineProperty(exports, "createSpanReference", { enumerable: true, get: function () { return createSpanReference_1.createSpanReference; } });
|
|
13
|
+
var SpanReferenceTypes_1 = require("./spanReference/SpanReferenceTypes");
|
|
14
|
+
Object.defineProperty(exports, "SpanReferenceTypes", { enumerable: true, get: function () { return SpanReferenceTypes_1.SpanReferenceTypes; } });
|
|
15
|
+
var Tags_1 = require("./Tags");
|
|
16
|
+
Object.defineProperty(exports, "TracingTags", { enumerable: true, get: function () { return Tags_1.UserlandTags; } });
|
|
17
|
+
var UserLandTracer_1 = require("./UserLandTracer");
|
|
18
|
+
Object.defineProperty(exports, "createTracingContextFromCarrier", { enumerable: true, get: function () { return UserLandTracer_1.createTracingContextFromCarrier; } });
|
|
19
|
+
var utils_1 = require("./utils");
|
|
20
|
+
Object.defineProperty(exports, "getTraceInfo", { enumerable: true, get: function () { return utils_1.getTraceInfo; } });
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SpanReferenceTypes = void 0;
|
|
4
|
+
var SpanReferenceTypes;
|
|
5
|
+
(function (SpanReferenceTypes) {
|
|
6
|
+
SpanReferenceTypes[SpanReferenceTypes["CHILD_OF"] = 0] = "CHILD_OF";
|
|
7
|
+
SpanReferenceTypes[SpanReferenceTypes["FOLLOWS_FROM"] = 1] = "FOLLOWS_FROM";
|
|
8
|
+
})(SpanReferenceTypes = exports.SpanReferenceTypes || (exports.SpanReferenceTypes = {}));
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createSpanReference = void 0;
|
|
4
|
+
const opentracing_1 = require("opentracing");
|
|
5
|
+
const SpanReferenceTypes_1 = require("./SpanReferenceTypes");
|
|
6
|
+
function createSpanReference(span, type) {
|
|
7
|
+
return new opentracing_1.Reference(type === SpanReferenceTypes_1.SpanReferenceTypes.CHILD_OF ? opentracing_1.REFERENCE_CHILD_OF : opentracing_1.REFERENCE_FOLLOWS_FROM, span.context());
|
|
8
|
+
}
|
|
9
|
+
exports.createSpanReference = createSpanReference;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Span } from 'opentracing';
|
|
2
|
+
export interface TraceInfo {
|
|
3
|
+
traceId?: string;
|
|
4
|
+
isSampled: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare function getTraceInfo(span?: Span): TraceInfo;
|
|
7
|
+
/**
|
|
8
|
+
* Do a shallow copy of a headers object and redacts sensitive information.
|
|
9
|
+
*
|
|
10
|
+
* @param headersObj The headers object
|
|
11
|
+
* @param resultFieldsPrefix The prefix that will be added to each field on the result object
|
|
12
|
+
*/
|
|
13
|
+
export declare const cloneAndSanitizeHeaders: (headersObj: Record<string, any>, resultFieldsPrefix?: string) => Record<string, string>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.cloneAndSanitizeHeaders = exports.getTraceInfo = void 0;
|
|
4
|
+
const node_error_report_1 = require("@vtex/node-error-report");
|
|
5
|
+
function getTraceInfo(span) {
|
|
6
|
+
var _a, _b, _c;
|
|
7
|
+
const spanContext = span === null || span === void 0 ? void 0 : span.context();
|
|
8
|
+
return {
|
|
9
|
+
isSampled: (_c = (_b = (_a = spanContext) === null || _a === void 0 ? void 0 : _a.isSampled) === null || _b === void 0 ? void 0 : _b.call(_a)) !== null && _c !== void 0 ? _c : false,
|
|
10
|
+
traceId: spanContext === null || spanContext === void 0 ? void 0 : spanContext.toTraceId(),
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
exports.getTraceInfo = getTraceInfo;
|
|
14
|
+
/**
|
|
15
|
+
* Do a shallow copy of a headers object and redacts sensitive information.
|
|
16
|
+
*
|
|
17
|
+
* @param headersObj The headers object
|
|
18
|
+
* @param resultFieldsPrefix The prefix that will be added to each field on the result object
|
|
19
|
+
*/
|
|
20
|
+
exports.cloneAndSanitizeHeaders = (headersObj, resultFieldsPrefix = '') => {
|
|
21
|
+
const ret = {};
|
|
22
|
+
const entries = Object.entries(headersObj);
|
|
23
|
+
for (const [key, val] of entries) {
|
|
24
|
+
// Most of the time val is a string, but there are some cases, for example when we do a axios interceptor,
|
|
25
|
+
// that a header field can contain an object, for example:
|
|
26
|
+
// ```
|
|
27
|
+
// "common": {
|
|
28
|
+
// "Accept": "application/json, text/plain, */*"
|
|
29
|
+
// },
|
|
30
|
+
// "delete": { },
|
|
31
|
+
// "get": { },
|
|
32
|
+
// "head": { },
|
|
33
|
+
// "post": {
|
|
34
|
+
// "Content-Type": "application/x-www-form-urlencoded"
|
|
35
|
+
// },
|
|
36
|
+
// ```
|
|
37
|
+
// In those corner cases we probably won't have a sensitive string as key, so we don't treat them here
|
|
38
|
+
ret[`${resultFieldsPrefix}${key}`] = node_error_report_1.authFields.includes(key) ? node_error_report_1.sanitizeAuth(val) : val;
|
|
39
|
+
}
|
|
40
|
+
return ret;
|
|
41
|
+
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Logger } from './../service/logger/logger';
|
|
2
|
+
import { ConflictsResolver, VBase } from '../clients/infra/VBase';
|
|
2
3
|
declare type Configuration = Record<string, ConfigurationData | ConfigurationData[] | object> | ConfigurationData[];
|
|
3
4
|
declare type ConfigurationData = Record<string, object>;
|
|
4
|
-
export declare class MineWinsConflictsResolver implements ConflictsResolver {
|
|
5
|
+
export declare class MineWinsConflictsResolver<T> implements ConflictsResolver<T> {
|
|
5
6
|
/***
|
|
6
7
|
* Take mine and merge with master keys that have no conflict
|
|
7
8
|
* We use base to decide wether a key was deleted or not
|
|
@@ -11,8 +12,9 @@ export declare class MineWinsConflictsResolver implements ConflictsResolver {
|
|
|
11
12
|
private filePath;
|
|
12
13
|
private comparableKeys;
|
|
13
14
|
constructor(client: VBase, bucket: string, filePath: string, comparableKeys?: string[]);
|
|
14
|
-
resolve(): Promise<any>;
|
|
15
|
-
|
|
15
|
+
resolve(logger?: Logger): Promise<any>;
|
|
16
|
+
resolveAll(): Promise<(Record<string, object | Record<string, object> | Record<string, object>[]> | Record<string, object>[])[]>;
|
|
17
|
+
protected mergeMineWins(base: Configuration, master: Configuration, mine: Configuration): Record<string, object | Record<string, object> | Record<string, object>[]> | Record<string, object>[];
|
|
16
18
|
private parseConflict;
|
|
17
19
|
private serializeContentByMimetype;
|
|
18
20
|
private parseContentByMimetype;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MineWinsConflictsResolver = void 0;
|
|
3
4
|
const js_base64_1 = require("js-base64");
|
|
4
5
|
const ramda_1 = require("ramda");
|
|
5
6
|
const util_1 = require("util");
|
|
@@ -10,12 +11,15 @@ class MineWinsConflictsResolver {
|
|
|
10
11
|
this.filePath = filePath;
|
|
11
12
|
this.comparableKeys = comparableKeys;
|
|
12
13
|
}
|
|
13
|
-
async resolve() {
|
|
14
|
-
return await this.client.getConflicts(this.bucket).then(data => {
|
|
14
|
+
async resolve(logger) {
|
|
15
|
+
return await this.client.getConflicts(this.bucket).then((data) => {
|
|
15
16
|
const { data: conflicts } = data;
|
|
16
|
-
const selectedConflict = conflicts.find(conflict => conflict.path === this.filePath);
|
|
17
|
+
const selectedConflict = conflicts.find((conflict) => conflict.path === this.filePath);
|
|
17
18
|
if (!selectedConflict) {
|
|
18
|
-
|
|
19
|
+
throw {
|
|
20
|
+
message: 'No conflict could be found.',
|
|
21
|
+
status: 404,
|
|
22
|
+
};
|
|
19
23
|
}
|
|
20
24
|
selectedConflict.base.parsedContent = this.parseConflict(selectedConflict.base);
|
|
21
25
|
selectedConflict.master.parsedContent = this.parseConflict(selectedConflict.master);
|
|
@@ -24,6 +28,17 @@ class MineWinsConflictsResolver {
|
|
|
24
28
|
return resolved;
|
|
25
29
|
});
|
|
26
30
|
}
|
|
31
|
+
async resolveAll() {
|
|
32
|
+
const conflictsResponse = await this.client.getConflicts(this.bucket);
|
|
33
|
+
const { data: conflicts } = conflictsResponse;
|
|
34
|
+
const resolvedConflicts = conflicts.map((conflict) => {
|
|
35
|
+
conflict.base.parsedContent = this.parseConflict(conflict.base);
|
|
36
|
+
conflict.master.parsedContent = this.parseConflict(conflict.master);
|
|
37
|
+
conflict.mine.parsedContent = this.parseConflict(conflict.mine);
|
|
38
|
+
return this.resolveConflictMineWins(conflict);
|
|
39
|
+
});
|
|
40
|
+
return resolvedConflicts;
|
|
41
|
+
}
|
|
27
42
|
mergeMineWins(base, master, mine) {
|
|
28
43
|
if (util_1.isArray(master)) {
|
|
29
44
|
return this.mergeMineWinsArray((base || []), master, (mine || []));
|
|
@@ -53,19 +68,22 @@ class MineWinsConflictsResolver {
|
|
|
53
68
|
}
|
|
54
69
|
resolveConflictMineWins(conflict) {
|
|
55
70
|
if (!conflict) {
|
|
56
|
-
|
|
71
|
+
throw {
|
|
72
|
+
message: 'No conflict could be found.',
|
|
73
|
+
status: 404,
|
|
74
|
+
};
|
|
57
75
|
}
|
|
58
76
|
const { base, master, mine, path } = conflict;
|
|
59
|
-
this.mergeMineWins(base.parsedContent, master.parsedContent, mine.parsedContent);
|
|
77
|
+
const merged = this.mergeMineWins(base.parsedContent, master.parsedContent, mine.parsedContent);
|
|
60
78
|
const mergedContent = {
|
|
61
|
-
content: js_base64_1.Base64.encode(this.serializeContentByMimetype(
|
|
79
|
+
content: js_base64_1.Base64.encode(this.serializeContentByMimetype(merged, conflict.mine.mimeType)),
|
|
62
80
|
mimeType: conflict.mine.mimeType,
|
|
63
81
|
};
|
|
64
82
|
this.client.resolveConflict(this.bucket, path, mergedContent);
|
|
65
|
-
return
|
|
83
|
+
return merged;
|
|
66
84
|
}
|
|
67
85
|
mergeMineWinsObject(base, master, mine) {
|
|
68
|
-
const merged =
|
|
86
|
+
const merged = { ...master, ...mine };
|
|
69
87
|
Object.entries(merged).forEach(([key, value]) => {
|
|
70
88
|
if (master[key] == null && base && base[key] != null && ramda_1.equals(value, base[key])) {
|
|
71
89
|
delete merged[key]; // value deleted from master with no conflict
|
|
@@ -88,10 +106,10 @@ class MineWinsConflictsResolver {
|
|
|
88
106
|
return mine;
|
|
89
107
|
}
|
|
90
108
|
removeMasterDeletedElements(base, master, mine) {
|
|
91
|
-
base.forEach(baseItem => {
|
|
109
|
+
base.forEach((baseItem) => {
|
|
92
110
|
const foundInMaster = this.isObjectInArray(baseItem, master);
|
|
93
111
|
if (!foundInMaster) {
|
|
94
|
-
const foundInMine = mine.findIndex(mineItem => ramda_1.equals(mineItem, baseItem));
|
|
112
|
+
const foundInMine = mine.findIndex((mineItem) => ramda_1.equals(mineItem, baseItem));
|
|
95
113
|
if (foundInMine > -1) {
|
|
96
114
|
mine.splice(foundInMine, 1);
|
|
97
115
|
}
|
|
@@ -99,21 +117,21 @@ class MineWinsConflictsResolver {
|
|
|
99
117
|
});
|
|
100
118
|
}
|
|
101
119
|
isObjectInArray(obj, array) {
|
|
102
|
-
return array.find(item => ramda_1.equals(item, obj));
|
|
120
|
+
return array.find((item) => ramda_1.equals(item, obj));
|
|
103
121
|
}
|
|
104
122
|
appendMasterAddedElements(base, master, mine) {
|
|
105
|
-
master.forEach(item => {
|
|
123
|
+
master.forEach((item) => {
|
|
106
124
|
if (this.shouldAddToMine(item, base, mine)) {
|
|
107
125
|
mine.push(item);
|
|
108
126
|
}
|
|
109
127
|
});
|
|
110
128
|
}
|
|
111
129
|
shouldAddToMine(item, base, mine) {
|
|
112
|
-
if (this.comparableKeys && Object.keys(item).some(key => this.comparableKeys.includes(key))) {
|
|
113
|
-
return (!mine.some(mineItem => this.comparableKeys.some(key => ramda_1.eqProps(key, item, mineItem))) &&
|
|
114
|
-
!base.some(baseItem =>
|
|
130
|
+
if (this.comparableKeys && Object.keys(item).some((key) => this.comparableKeys.includes(key))) {
|
|
131
|
+
return (!mine.some((mineItem) => this.comparableKeys.some((key) => ramda_1.eqProps(key, item, mineItem))) &&
|
|
132
|
+
!base.some((baseItem) => ramda_1.equals(baseItem, item)));
|
|
115
133
|
}
|
|
116
|
-
return !mine.some(mineItem => ramda_1.equals(mineItem, item)) && !base.some(baseItem => ramda_1.equals(baseItem, item));
|
|
134
|
+
return !mine.some((mineItem) => ramda_1.equals(mineItem, item)) && !base.some((baseItem) => ramda_1.equals(baseItem, item));
|
|
117
135
|
}
|
|
118
136
|
}
|
|
119
137
|
exports.MineWinsConflictsResolver = MineWinsConflictsResolver;
|
package/lib/utils/app.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AppMetaInfo } from '../clients/Apps';
|
|
1
|
+
import { AppMetaInfo } from '../clients/infra/Apps';
|
|
2
2
|
export declare const removeBuild: (id: string) => string;
|
|
3
3
|
export declare const removeVersionFromAppId: (appId: string) => string;
|
|
4
4
|
export declare const extractVersionFromAppId: (appId: string) => string;
|
|
@@ -13,6 +13,8 @@ export declare const versionToMajorRange: (version: string) => string;
|
|
|
13
13
|
export declare const formatMajorLocator: (name: string, version: string) => string;
|
|
14
14
|
export declare const appIdToAppAtMajor: (appId: string) => string;
|
|
15
15
|
export declare const isValidAppIdOrLocator: (appId: string) => boolean;
|
|
16
|
+
export declare const sameMajor: (v1: string, v2: string) => boolean;
|
|
17
|
+
export declare const majorEqualAndGreaterThan: (v1: string, v2: string) => boolean;
|
|
16
18
|
export interface ParsedLocator {
|
|
17
19
|
name: string;
|
|
18
20
|
version: string;
|
package/lib/utils/app.js
CHANGED
|
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.majorEqualAndGreaterThan = exports.sameMajor = exports.isValidAppIdOrLocator = exports.appIdToAppAtMajor = exports.formatMajorLocator = exports.versionToMajorRange = exports.versionToMajor = exports.satisfies = exports.formatAppId = exports.parseAppId = exports.isLinkedApp = exports.formatLocator = exports.transformToLinkedLocator = exports.extractVersionFromAppId = exports.removeVersionFromAppId = exports.removeBuild = void 0;
|
|
6
7
|
const semver_1 = __importDefault(require("semver"));
|
|
7
8
|
// Note: The name that composes the part of the appId that precedes the
|
|
8
9
|
// character '@' includes the name given to the app and the vendor name.
|
|
@@ -23,7 +24,7 @@ exports.parseAppId = (appId) => {
|
|
|
23
24
|
version: splittedVersion[0],
|
|
24
25
|
};
|
|
25
26
|
};
|
|
26
|
-
exports.formatAppId = ({ locator, build }) => build ? `${locator}+${build}` : locator;
|
|
27
|
+
exports.formatAppId = ({ locator, build }) => (build ? `${locator}+${build}` : locator);
|
|
27
28
|
exports.satisfies = (appId, version) => {
|
|
28
29
|
const { version: appVer } = exports.parseAppId(appId);
|
|
29
30
|
return semver_1.default.satisfies(appVer, version);
|
|
@@ -44,3 +45,5 @@ const APP_ID_REGEX = /^[\w\-]+\.[\w\-]+@(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-
|
|
|
44
45
|
exports.isValidAppIdOrLocator = (appId) => {
|
|
45
46
|
return APP_ID_REGEX.test(appId);
|
|
46
47
|
};
|
|
48
|
+
exports.sameMajor = (v1, v2) => exports.versionToMajor(v1) === exports.versionToMajor(v2);
|
|
49
|
+
exports.majorEqualAndGreaterThan = (v1, v2) => exports.sameMajor(v1, v2) && semver_1.default.gt(v1, v2);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { AppMetaInfo, Apps } from '..';
|
|
3
3
|
import { CacheLayer } from '../caches';
|
|
4
4
|
import { Logger } from '../service/logger';
|
|
5
|
-
export declare const getMetaInfoKey: (account: string) => string;
|
|
5
|
+
export declare const getMetaInfoKey: (account: string, workspace: string) => string;
|
|
6
6
|
export declare const updateMetaInfoCache: (cacheStorage: CacheLayer<string, AppMetaInfo[]>, account: string, workspace: string, dependencies: AppMetaInfo[], logger: Logger) => Promise<void>;
|
|
7
7
|
export declare const saveVersion: (app: string, cacheStorage: CacheLayer<string, string>) => Promise<void>;
|
|
8
8
|
export declare const getFallbackFile: (app: string, path: string, cacheStorage: CacheLayer<string, string>, apps: Apps) => Promise<{
|
|
@@ -1,19 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
};
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
5
14
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
6
15
|
if (mod && mod.__esModule) return mod;
|
|
7
16
|
var result = {};
|
|
8
|
-
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result
|
|
9
|
-
result
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
10
19
|
return result;
|
|
11
20
|
};
|
|
21
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
|
+
};
|
|
12
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.getFallbackFile = exports.saveVersion = exports.updateMetaInfoCache = exports.getMetaInfoKey = void 0;
|
|
13
26
|
const crypto_1 = __importDefault(require("crypto"));
|
|
14
27
|
const ramda_1 = require("ramda");
|
|
15
28
|
const semver = __importStar(require("semver"));
|
|
16
|
-
exports.getMetaInfoKey = (account) => `${account}-meta-infos`;
|
|
29
|
+
exports.getMetaInfoKey = (account, workspace) => `${account}-${workspace}-meta-infos`;
|
|
17
30
|
const hashMD5 = (text) => crypto_1.default
|
|
18
31
|
.createHash('md5')
|
|
19
32
|
.update(text)
|
|
@@ -22,7 +35,7 @@ exports.updateMetaInfoCache = async (cacheStorage, account, workspace, dependenc
|
|
|
22
35
|
if (workspace !== 'master') {
|
|
23
36
|
return;
|
|
24
37
|
}
|
|
25
|
-
const key = exports.getMetaInfoKey(account);
|
|
38
|
+
const key = exports.getMetaInfoKey(account, workspace);
|
|
26
39
|
const hash = hashMD5(dependencies.toString());
|
|
27
40
|
try {
|
|
28
41
|
const storedDependencies = await cacheStorage.get(key) || '';
|
|
@@ -1,3 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
|
|
1
|
+
export declare const isFreeBillingOptions: (billingOptions: BillingOptions) => boolean;
|
|
2
|
+
export interface BillingOptions {
|
|
3
|
+
type: BILLING_TYPE;
|
|
4
|
+
support: Support;
|
|
5
|
+
availableCountries: string[];
|
|
6
|
+
plans?: Plan[];
|
|
7
|
+
}
|
|
8
|
+
export declare enum BILLING_TYPE {
|
|
9
|
+
FREE = "free",
|
|
10
|
+
BILLABLE = "billable",
|
|
11
|
+
SPONSORED = "sponsored"
|
|
12
|
+
}
|
|
13
|
+
export interface PriceMetric {
|
|
14
|
+
id: string;
|
|
15
|
+
ranges: Range[];
|
|
16
|
+
customUrl: string;
|
|
17
|
+
}
|
|
18
|
+
export interface Range {
|
|
19
|
+
exclusiveFrom: number;
|
|
20
|
+
inclusiveTo?: number;
|
|
21
|
+
multiplier: number;
|
|
22
|
+
}
|
|
23
|
+
export interface Plan {
|
|
24
|
+
id: string;
|
|
25
|
+
currency: string;
|
|
26
|
+
price: Price;
|
|
27
|
+
}
|
|
28
|
+
export interface Price {
|
|
29
|
+
subscription?: number;
|
|
30
|
+
metrics?: PriceMetric[];
|
|
31
|
+
}
|
|
32
|
+
export interface Support {
|
|
33
|
+
email: string;
|
|
34
|
+
url?: string;
|
|
35
|
+
phone?: string;
|
|
36
|
+
}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
exports.isFreeBillingOptions = (billingOptions) => billingOptions.
|
|
5
|
-
|
|
3
|
+
exports.BILLING_TYPE = exports.isFreeBillingOptions = void 0;
|
|
4
|
+
exports.isFreeBillingOptions = (billingOptions) => billingOptions.type === BILLING_TYPE.FREE;
|
|
5
|
+
var BILLING_TYPE;
|
|
6
|
+
(function (BILLING_TYPE) {
|
|
7
|
+
BILLING_TYPE["FREE"] = "free";
|
|
8
|
+
BILLING_TYPE["BILLABLE"] = "billable";
|
|
9
|
+
BILLING_TYPE["SPONSORED"] = "sponsored";
|
|
10
|
+
})(BILLING_TYPE = exports.BILLING_TYPE || (exports.BILLING_TYPE = {}));
|
package/lib/utils/binding.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export interface
|
|
1
|
+
export interface BindingHeader {
|
|
2
2
|
id?: string;
|
|
3
3
|
rootPath?: string;
|
|
4
4
|
locale: string;
|
|
@@ -8,6 +8,6 @@ declare enum BindingHeaderFormat {
|
|
|
8
8
|
webframework0 = "v0+webframework",
|
|
9
9
|
kuberouter0 = "v0+kuberouter"
|
|
10
10
|
}
|
|
11
|
-
export declare const formatBindingHeaderValue: (binding:
|
|
12
|
-
export declare const parseBindingHeaderValue: (value: string) =>
|
|
11
|
+
export declare const formatBindingHeaderValue: (binding: BindingHeader, format?: BindingHeaderFormat) => string;
|
|
12
|
+
export declare const parseBindingHeaderValue: (value: string) => BindingHeader;
|
|
13
13
|
export {};
|
package/lib/utils/binding.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseBindingHeaderValue = exports.formatBindingHeaderValue = void 0;
|
|
3
4
|
var BindingHeaderFormat;
|
|
4
5
|
(function (BindingHeaderFormat) {
|
|
5
6
|
BindingHeaderFormat["webframework0"] = "v0+webframework";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a new URL by combining the baseURL with the requestedURL,
|
|
3
|
+
* only when the requestedURL is not already an absolute URL.
|
|
4
|
+
* If the requestURL is absolute, this function returns the requestedURL untouched.
|
|
5
|
+
*
|
|
6
|
+
* @param {string} baseURL The base URL
|
|
7
|
+
* @param {string} requestedURL Absolute or relative URL to combine
|
|
8
|
+
*
|
|
9
|
+
* @returns {string} The combined full path
|
|
10
|
+
*/
|
|
11
|
+
export default function (baseURL?: string, requestedURL?: string, allowAbsoluteUrls?: boolean): string | undefined;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// This module is part of the Axios library.
|
|
3
|
+
// It is used to build a full URL by combining a base URL with a relative URL.
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
// It is originally not intended to be used directly, but rather as a utility function within the Axios library.
|
|
6
|
+
// Since Axios 1.0, this function is not exported by default, and the team does not recommend using it directly,
|
|
7
|
+
// as it may not be available in future versions.
|
|
8
|
+
// The function takes a base URL and a relative URL as input, and returns the full URL.
|
|
9
|
+
// It handles both absolute and relative URLs, and ensures that the resulting URL is properly formatted.
|
|
10
|
+
// It is used internally by Axios to construct the full URL for HTTP requests.
|
|
11
|
+
/**
|
|
12
|
+
* Creates a new URL by combining the baseURL with the requestedURL,
|
|
13
|
+
* only when the requestedURL is not already an absolute URL.
|
|
14
|
+
* If the requestURL is absolute, this function returns the requestedURL untouched.
|
|
15
|
+
*
|
|
16
|
+
* @param {string} baseURL The base URL
|
|
17
|
+
* @param {string} requestedURL Absolute or relative URL to combine
|
|
18
|
+
*
|
|
19
|
+
* @returns {string} The combined full path
|
|
20
|
+
*/
|
|
21
|
+
function default_1(baseURL, requestedURL, allowAbsoluteUrls) {
|
|
22
|
+
let isRelativeUrl = !isAbsoluteURL(requestedURL);
|
|
23
|
+
if (baseURL && (isRelativeUrl || allowAbsoluteUrls == false)) {
|
|
24
|
+
return combineURLs(baseURL, requestedURL);
|
|
25
|
+
}
|
|
26
|
+
return requestedURL;
|
|
27
|
+
}
|
|
28
|
+
exports.default = default_1;
|
|
29
|
+
/**
|
|
30
|
+
* Determines whether the specified URL is absolute
|
|
31
|
+
*
|
|
32
|
+
* @param {string} url The URL to test
|
|
33
|
+
*
|
|
34
|
+
* @returns {boolean} True if the specified URL is absolute, otherwise false
|
|
35
|
+
*/
|
|
36
|
+
function isAbsoluteURL(url) {
|
|
37
|
+
// A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
|
|
38
|
+
// RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
|
|
39
|
+
// by any combination of letters, digits, plus, period, or hyphen.
|
|
40
|
+
return !!url && /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Creates a new URL by combining the specified URLs
|
|
44
|
+
*
|
|
45
|
+
* @param {string} baseURL The base URL
|
|
46
|
+
* @param {string} relativeURL The relative URL
|
|
47
|
+
*
|
|
48
|
+
* @returns {string} The combined URL
|
|
49
|
+
*/
|
|
50
|
+
function combineURLs(baseURL, relativeURL) {
|
|
51
|
+
return relativeURL && baseURL
|
|
52
|
+
? baseURL.replace(/\/?\/$/, '') + '/' + relativeURL.replace(/^\/+/, '')
|
|
53
|
+
: baseURL;
|
|
54
|
+
}
|
package/lib/utils/cancel.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { RouteHandler } from '../service/typings';
|
|
1
|
+
import { ParamsContext, RecorderState, RouteHandler } from '../service/worker/runtime/typings';
|
|
2
2
|
import { IOClients } from './../clients/IOClients';
|
|
3
|
-
export declare function cancel<T extends IOClients, U, V>(middleware: RouteHandler<T, U, V>): RouteHandler<T, U, V>;
|
|
3
|
+
export declare function cancel<T extends IOClients, U extends RecorderState, V extends ParamsContext>(middleware: RouteHandler<T, U, V>): RouteHandler<T, U, V>;
|
package/lib/utils/cancel.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.cancel = void 0;
|
|
3
4
|
function cancel(middleware) {
|
|
4
5
|
return async (ctx, next) => {
|
|
5
|
-
|
|
6
|
+
var _a, _b;
|
|
7
|
+
if ((_b = (_a = ctx.vtex) === null || _a === void 0 ? void 0 : _a.cancellation) === null || _b === void 0 ? void 0 : _b.cancelled) {
|
|
6
8
|
return;
|
|
7
9
|
}
|
|
8
10
|
await middleware(ctx, next);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare function getMockConflicts(path: string, base: object, mine: object, master: object): {
|
|
2
|
+
data: {
|
|
3
|
+
base: {
|
|
4
|
+
content: string;
|
|
5
|
+
mimeType: string;
|
|
6
|
+
};
|
|
7
|
+
master: {
|
|
8
|
+
content: string;
|
|
9
|
+
mimeType: string;
|
|
10
|
+
};
|
|
11
|
+
mine: {
|
|
12
|
+
content: string;
|
|
13
|
+
mimeType: string;
|
|
14
|
+
};
|
|
15
|
+
path: string;
|
|
16
|
+
}[];
|
|
17
|
+
};
|