@vtex/api 6.48.1-beta → 6.48.1-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/gen/manifest.schema +5 -3
- package/lib/HttpClient/GraphQLClient.d.ts +3 -2
- package/lib/HttpClient/GraphQLClient.js +5 -1
- package/lib/HttpClient/HttpClient.d.ts +9 -7
- package/lib/HttpClient/HttpClient.js +70 -27
- package/lib/HttpClient/agents.d.ts +6 -0
- package/lib/HttpClient/agents.js +43 -0
- package/lib/HttpClient/index.d.ts +1 -7
- package/lib/HttpClient/index.js +22 -16
- package/lib/HttpClient/middlewares/cache.d.ts +9 -3
- package/lib/HttpClient/middlewares/cache.js +130 -35
- package/lib/HttpClient/middlewares/cancellationToken.d.ts +2 -2
- package/lib/HttpClient/middlewares/cancellationToken.js +5 -2
- package/lib/HttpClient/middlewares/inflight.d.ts +1 -1
- package/lib/HttpClient/middlewares/inflight.js +7 -3
- package/lib/HttpClient/middlewares/memoization.d.ts +1 -1
- package/lib/HttpClient/middlewares/memoization.js +13 -4
- package/lib/HttpClient/middlewares/metrics.js +25 -38
- package/lib/HttpClient/middlewares/notFound.d.ts +1 -1
- package/lib/HttpClient/middlewares/notFound.js +5 -2
- package/lib/HttpClient/middlewares/recorder.d.ts +1 -1
- package/lib/HttpClient/middlewares/recorder.js +21 -12
- package/lib/HttpClient/middlewares/request/HttpAgentSingleton.d.ts +11 -0
- package/lib/HttpClient/middlewares/request/HttpAgentSingleton.js +31 -0
- package/lib/HttpClient/middlewares/request/index.d.ts +18 -0
- package/lib/HttpClient/middlewares/request/index.js +88 -0
- package/lib/HttpClient/middlewares/request/setupAxios/index.d.ts +1 -0
- package/lib/HttpClient/middlewares/request/setupAxios/index.js +22 -0
- package/lib/HttpClient/middlewares/request/setupAxios/interceptors/exponentialBackoff.d.ts +2 -0
- package/lib/HttpClient/middlewares/request/setupAxios/interceptors/exponentialBackoff.js +55 -0
- package/lib/HttpClient/middlewares/request/setupAxios/interceptors/index.d.ts +2 -0
- package/lib/HttpClient/middlewares/request/setupAxios/interceptors/index.js +8 -0
- package/lib/HttpClient/middlewares/request/setupAxios/interceptors/tracing/index.d.ts +8 -0
- package/lib/HttpClient/middlewares/request/setupAxios/interceptors/tracing/index.js +56 -0
- package/lib/HttpClient/middlewares/request/setupAxios/interceptors/tracing/spanSetup.d.ts +4 -0
- package/lib/HttpClient/middlewares/request/setupAxios/interceptors/tracing/spanSetup.js +32 -0
- package/lib/HttpClient/middlewares/tracing.d.ts +15 -0
- package/lib/HttpClient/middlewares/tracing.js +62 -0
- package/lib/HttpClient/typings.d.ts +46 -12
- package/lib/HttpClient/typings.js +1 -0
- package/lib/caches/DiskCache.d.ts +1 -1
- package/lib/caches/DiskCache.js +3 -2
- package/lib/caches/LRUCache.d.ts +3 -3
- package/lib/caches/LRUCache.js +6 -1
- package/lib/caches/LRUDiskCache.d.ts +2 -2
- package/lib/caches/LRUDiskCache.js +8 -3
- package/lib/caches/MultilayeredCache.d.ts +2 -2
- package/lib/caches/MultilayeredCache.js +8 -7
- package/lib/caches/index.js +20 -7
- package/lib/caches/typings.d.ts +5 -5
- package/lib/clients/IOClient.d.ts +13 -0
- package/lib/clients/IOClient.js +20 -0
- package/lib/clients/IOClients.d.ts +29 -25
- package/lib/clients/IOClients.js +36 -28
- package/lib/{HttpClient → clients}/IOGraphQLClient.d.ts +4 -4
- package/lib/{HttpClient → clients}/IOGraphQLClient.js +3 -2
- package/lib/{HttpClient → clients/apps}/AppClient.d.ts +3 -3
- package/lib/{HttpClient → clients/apps}/AppClient.js +11 -5
- package/lib/{HttpClient → clients/apps}/AppGraphQLClient.d.ts +3 -3
- package/lib/{HttpClient → clients/apps}/AppGraphQLClient.js +11 -5
- package/lib/clients/apps/Billing.d.ts +12 -0
- package/lib/clients/{Billing.js → apps/Billing.js} +9 -3
- package/lib/clients/{Builder.d.ts → apps/Builder.d.ts} +12 -11
- package/lib/clients/{Builder.js → apps/Builder.js} +51 -23
- package/lib/clients/apps/MessagesGraphQL.d.ts +61 -0
- package/lib/clients/apps/MessagesGraphQL.js +122 -0
- package/lib/clients/{Settings.d.ts → apps/Settings.d.ts} +5 -4
- package/lib/clients/apps/Settings.js +39 -0
- package/lib/clients/apps/catalogGraphQL/brand.d.ts +13 -0
- package/lib/clients/apps/catalogGraphQL/brand.js +19 -0
- package/lib/clients/apps/catalogGraphQL/category.d.ts +11 -0
- package/lib/clients/apps/catalogGraphQL/category.js +17 -0
- package/lib/clients/apps/catalogGraphQL/index.d.ts +22 -0
- package/lib/clients/apps/catalogGraphQL/index.js +89 -0
- package/lib/clients/apps/catalogGraphQL/product.d.ts +25 -0
- package/lib/clients/apps/catalogGraphQL/product.js +31 -0
- package/lib/clients/apps/catalogGraphQL/sku.d.ts +26 -0
- package/lib/clients/apps/catalogGraphQL/sku.js +31 -0
- package/lib/clients/apps/index.d.ts +7 -0
- package/lib/clients/apps/index.js +23 -0
- package/lib/{HttpClient → clients/external}/ExternalClient.d.ts +3 -3
- package/lib/{HttpClient → clients/external}/ExternalClient.js +10 -2
- package/lib/clients/external/ID.d.ts +23 -0
- package/lib/clients/external/ID.js +61 -0
- package/lib/clients/external/Masterdata.d.ts +94 -0
- package/lib/clients/external/Masterdata.js +225 -0
- package/lib/clients/external/PaymentProvider.d.ts +31 -0
- package/lib/clients/external/PaymentProvider.js +43 -0
- package/lib/clients/external/index.d.ts +4 -0
- package/lib/clients/external/index.js +20 -0
- package/lib/clients/index.d.ts +9 -21
- package/lib/clients/index.js +27 -24
- package/lib/clients/infra/Apps.d.ts +93 -0
- package/lib/clients/infra/Apps.js +511 -0
- package/lib/clients/infra/Assets.d.ts +35 -0
- package/lib/clients/infra/Assets.js +166 -0
- package/lib/clients/infra/BillingMetrics.d.ts +13 -0
- package/lib/clients/infra/BillingMetrics.js +16 -0
- package/lib/clients/infra/Events.d.ts +12 -0
- package/lib/clients/infra/Events.js +34 -0
- package/lib/clients/infra/Housekeeper.d.ts +10 -0
- package/lib/clients/infra/Housekeeper.js +31 -0
- package/lib/{HttpClient → clients/infra}/InfraClient.d.ts +3 -3
- package/lib/{HttpClient → clients/infra}/InfraClient.js +10 -4
- package/lib/clients/infra/Registry.d.ts +65 -0
- package/lib/clients/infra/Registry.js +209 -0
- package/lib/clients/infra/Router.d.ts +34 -0
- package/lib/clients/infra/Router.js +82 -0
- package/lib/clients/infra/Sphinx.d.ts +13 -0
- package/lib/clients/infra/Sphinx.js +30 -0
- package/lib/clients/infra/VBase.d.ts +61 -0
- package/lib/clients/infra/VBase.js +197 -0
- package/lib/clients/infra/Workspaces.d.ts +18 -0
- package/lib/clients/infra/Workspaces.js +66 -0
- package/lib/clients/infra/index.d.ts +11 -0
- package/lib/clients/infra/index.js +27 -0
- package/lib/{HttpClient → clients/janus}/JanusClient.d.ts +4 -4
- package/lib/{HttpClient → clients/janus}/JanusClient.js +8 -3
- package/lib/clients/janus/LicenseManager.d.ts +7 -0
- package/lib/clients/janus/LicenseManager.js +59 -0
- package/lib/clients/{Segment.d.ts → janus/Segment.d.ts} +7 -11
- package/lib/clients/janus/Segment.js +89 -0
- package/lib/clients/{Session.d.ts → janus/Session.d.ts} +4 -4
- package/lib/clients/{Session.js → janus/Session.js} +25 -13
- package/lib/clients/{Tenant.d.ts → janus/Tenant.d.ts} +7 -8
- package/lib/clients/janus/Tenant.js +29 -0
- package/lib/clients/janus/index.d.ts +5 -0
- package/lib/clients/janus/index.js +21 -0
- package/lib/constants.d.ts +50 -2
- package/lib/constants.js +55 -1
- package/lib/errors/AuthenticationError.js +1 -0
- package/lib/errors/ForbiddenError.js +1 -0
- package/lib/errors/NotFoundError.js +1 -0
- package/lib/errors/RequestCancelledError.js +1 -0
- package/lib/errors/ResolverError.d.ts +1 -1
- package/lib/errors/ResolverError.js +4 -3
- package/lib/errors/ResolverWarning.d.ts +1 -1
- package/lib/errors/ResolverWarning.js +3 -2
- package/lib/errors/TooManyRequestsError.js +1 -0
- package/lib/errors/UserInputError.js +1 -0
- package/lib/errors/index.js +22 -11
- package/lib/index.d.ts +9 -7
- package/lib/index.js +31 -16
- package/lib/metrics/MetricsAccumulator.d.ts +3 -20
- package/lib/metrics/MetricsAccumulator.js +44 -27
- package/lib/responses.d.ts +5 -46
- package/lib/service/index.d.ts +2 -0
- package/lib/service/index.js +35 -0
- package/lib/service/loaders.d.ts +8 -0
- package/lib/service/loaders.js +57 -0
- package/lib/service/logger/console.d.ts +10 -0
- package/lib/service/logger/console.js +40 -0
- package/lib/service/logger/index.d.ts +2 -28
- package/lib/service/logger/index.js +16 -68
- package/lib/service/logger/logger.d.ts +29 -0
- package/lib/service/logger/logger.js +62 -0
- package/lib/service/logger/metricsLogger.d.ts +40 -0
- package/lib/service/logger/metricsLogger.js +150 -0
- package/lib/service/master.d.ts +2 -0
- package/lib/service/master.js +89 -0
- package/lib/service/metrics/requestMetricsMiddleware.d.ts +2 -0
- package/lib/service/metrics/requestMetricsMiddleware.js +46 -0
- package/lib/service/tracing/TracerSingleton.d.ts +7 -0
- package/lib/service/tracing/TracerSingleton.js +49 -0
- package/lib/service/tracing/metrics/MetricNames.d.ts +60 -0
- package/lib/service/tracing/metrics/MetricNames.js +45 -0
- package/lib/service/tracing/metrics/instruments.d.ts +9 -0
- package/lib/service/tracing/metrics/instruments.js +19 -0
- package/lib/service/tracing/metrics/measurers/EventLoopLagMeasurer.d.ts +9 -0
- package/lib/service/tracing/metrics/measurers/EventLoopLagMeasurer.js +26 -0
- package/lib/service/tracing/tracingMiddlewares.d.ts +5 -0
- package/lib/service/tracing/tracingMiddlewares.js +117 -0
- package/lib/service/worker/index.d.ts +11 -0
- package/lib/service/worker/index.js +197 -0
- package/lib/service/worker/listeners.d.ts +3 -0
- package/lib/{utils/unhandled.js → service/worker/listeners.js} +12 -16
- package/lib/service/{Service.d.ts → worker/runtime/Service.d.ts} +5 -5
- package/lib/service/{Service.js → worker/runtime/Service.js} +3 -1
- package/lib/service/worker/runtime/builtIn/handlers.d.ts +4 -0
- package/lib/service/worker/runtime/builtIn/handlers.js +34 -0
- package/lib/service/worker/runtime/builtIn/middlewares.d.ts +4 -0
- package/lib/service/worker/runtime/builtIn/middlewares.js +43 -0
- package/lib/service/worker/runtime/events/index.d.ts +4 -0
- package/lib/service/worker/runtime/events/index.js +48 -0
- package/lib/service/worker/runtime/events/middlewares/body.d.ts +3 -0
- package/lib/service/worker/runtime/events/middlewares/body.js +26 -0
- package/lib/service/worker/runtime/events/middlewares/context.d.ts +3 -0
- package/lib/service/worker/runtime/events/middlewares/context.js +23 -0
- package/lib/service/worker/runtime/events/router.d.ts +2 -0
- package/lib/service/worker/runtime/events/router.js +29 -0
- package/lib/service/worker/runtime/graphql/index.d.ts +6 -0
- package/lib/service/worker/runtime/graphql/index.js +29 -0
- package/lib/service/worker/runtime/graphql/middlewares/context.d.ts +2 -0
- package/lib/service/worker/runtime/graphql/middlewares/context.js +17 -0
- package/lib/service/worker/runtime/graphql/middlewares/error.js +97 -0
- package/lib/service/worker/runtime/graphql/middlewares/query.d.ts +3 -0
- package/lib/service/worker/runtime/graphql/middlewares/query.js +54 -0
- package/lib/service/worker/runtime/graphql/middlewares/response.js +39 -0
- package/lib/service/worker/runtime/graphql/middlewares/run.d.ts +2 -0
- package/lib/service/worker/runtime/graphql/middlewares/run.js +21 -0
- package/lib/service/worker/runtime/graphql/middlewares/updateSchema.d.ts +5 -0
- package/lib/service/worker/runtime/graphql/middlewares/updateSchema.js +30 -0
- package/lib/service/worker/runtime/graphql/middlewares/upload.d.ts +4 -0
- package/lib/service/{graphql → worker/runtime/graphql}/middlewares/upload.js +2 -1
- package/lib/service/worker/runtime/graphql/schema/index.d.ts +7 -0
- package/lib/service/worker/runtime/graphql/schema/index.js +33 -0
- package/lib/service/worker/runtime/graphql/schema/messagesLoaderV2.d.ts +6 -0
- package/lib/service/worker/runtime/graphql/schema/messagesLoaderV2.js +81 -0
- package/lib/service/{graphql → worker/runtime/graphql}/schema/schemaDirectives/Auth.d.ts +1 -0
- package/lib/service/{graphql → worker/runtime/graphql}/schema/schemaDirectives/Auth.js +17 -10
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/CacheControl.d.ts +7 -0
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/CacheControl.js +38 -0
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/Deprecated.d.ts +11 -0
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/Deprecated.js +62 -0
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/Metric.d.ts +7 -0
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/Metric.js +41 -0
- package/lib/service/{graphql → worker/runtime/graphql}/schema/schemaDirectives/Sanitize.d.ts +1 -0
- package/lib/service/{graphql → worker/runtime/graphql}/schema/schemaDirectives/Sanitize.js +7 -0
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/Settings.d.ts +6 -0
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/Settings.js +35 -0
- package/lib/service/{graphql → worker/runtime/graphql}/schema/schemaDirectives/SmartCacheDirective.d.ts +1 -0
- package/lib/service/{graphql → worker/runtime/graphql}/schema/schemaDirectives/SmartCacheDirective.js +9 -3
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/TranslatableV2.d.ts +7 -0
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/TranslatableV2.js +40 -0
- package/lib/service/{graphql/schema/schemaDirectives/Translatable.d.ts → worker/runtime/graphql/schema/schemaDirectives/TranslateTo.d.ts} +2 -1
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/TranslateTo.js +34 -0
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/index.d.ts +22 -0
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/index.js +37 -0
- package/lib/service/worker/runtime/graphql/schema/typeDefs/index.d.ts +8 -0
- package/lib/service/worker/runtime/graphql/schema/typeDefs/index.js +14 -0
- package/lib/service/{graphql → worker/runtime/graphql}/schema/typeDefs/ioUpload.js +1 -0
- package/lib/service/{graphql → worker/runtime/graphql}/schema/typeDefs/sanitizedString.js +8 -3
- package/lib/service/worker/runtime/graphql/typings.d.ts +31 -0
- package/lib/service/worker/runtime/graphql/utils/cacheControl.d.ts +2 -0
- package/lib/service/worker/runtime/graphql/utils/cacheControl.js +34 -0
- package/lib/service/worker/runtime/graphql/utils/error.d.ts +2 -0
- package/lib/service/worker/runtime/graphql/utils/error.js +78 -0
- package/lib/service/worker/runtime/graphql/utils/pathname.js +9 -0
- package/lib/service/worker/runtime/graphql/utils/translations.d.ts +14 -0
- package/lib/service/worker/runtime/graphql/utils/translations.js +42 -0
- package/lib/service/worker/runtime/http/index.d.ts +5 -0
- package/lib/service/worker/runtime/http/index.js +61 -0
- package/lib/service/worker/runtime/http/middlewares/authTokens.d.ts +3 -0
- package/lib/service/{http → worker/runtime/http}/middlewares/authTokens.js +1 -0
- package/lib/service/worker/runtime/http/middlewares/cancellationToken.d.ts +3 -0
- package/lib/service/{http → worker/runtime/http}/middlewares/cancellationToken.js +3 -1
- package/lib/service/worker/runtime/http/middlewares/clients.d.ts +4 -0
- package/lib/service/{http → worker/runtime/http}/middlewares/clients.js +1 -0
- package/lib/service/worker/runtime/http/middlewares/context.d.ts +4 -0
- package/lib/service/worker/runtime/http/middlewares/context.js +39 -0
- package/lib/service/worker/runtime/http/middlewares/error.d.ts +2 -0
- package/lib/service/{http → worker/runtime/http}/middlewares/error.js +29 -16
- package/lib/service/worker/runtime/http/middlewares/rateLimit.d.ts +6 -0
- package/lib/service/worker/runtime/http/middlewares/rateLimit.js +43 -0
- package/lib/service/{http → worker/runtime/http}/middlewares/requestStats.d.ts +3 -3
- package/lib/service/{http → worker/runtime/http}/middlewares/requestStats.js +1 -0
- package/lib/service/worker/runtime/http/middlewares/setCookie.d.ts +3 -0
- package/lib/service/{http → worker/runtime/http}/middlewares/setCookie.js +6 -5
- package/lib/service/worker/runtime/http/middlewares/settings.d.ts +9 -0
- package/lib/service/worker/runtime/http/middlewares/settings.js +49 -0
- package/lib/service/worker/runtime/http/middlewares/timings.d.ts +3 -0
- package/lib/service/{http → worker/runtime/http}/middlewares/timings.js +25 -11
- package/lib/service/worker/runtime/http/middlewares/vary.d.ts +3 -0
- package/lib/service/{http → worker/runtime/http}/middlewares/vary.js +4 -3
- package/lib/service/worker/runtime/http/router.d.ts +2 -0
- package/lib/service/worker/runtime/http/router.js +25 -0
- package/lib/service/worker/runtime/http/routes.d.ts +19 -0
- package/lib/service/worker/runtime/http/routes.js +16 -0
- package/lib/service/worker/runtime/method.d.ts +9 -0
- package/lib/service/{method.js → worker/runtime/method.js} +2 -1
- package/lib/service/worker/runtime/statusTrack.d.ts +14 -0
- package/lib/service/worker/runtime/statusTrack.js +43 -0
- package/lib/service/worker/runtime/typings.d.ts +173 -0
- package/lib/service/worker/runtime/utils/compose.d.ts +5 -0
- package/lib/service/worker/runtime/utils/compose.js +14 -0
- package/lib/service/worker/runtime/utils/context.d.ts +5 -0
- package/lib/service/worker/runtime/utils/context.js +42 -0
- package/lib/service/worker/runtime/utils/diff.d.ts +12 -0
- package/lib/service/worker/runtime/utils/diff.js +22 -0
- package/lib/service/worker/runtime/utils/recorder.d.ts +8 -0
- package/lib/service/worker/runtime/utils/recorder.js +38 -0
- package/lib/service/worker/runtime/utils/toArray.js +5 -0
- package/lib/service/worker/runtime/utils/tokenBucket.d.ts +2 -0
- package/lib/service/worker/runtime/utils/tokenBucket.js +17 -0
- package/lib/tracing/LogEvents.d.ts +31 -0
- package/lib/{service/graphql/utils/array.js → tracing/LogEvents.js} +1 -1
- package/lib/tracing/LogFields.d.ts +66 -0
- package/lib/tracing/LogFields.js +3 -0
- package/lib/tracing/Tags.d.ts +81 -0
- package/lib/tracing/Tags.js +8 -0
- package/lib/tracing/UserLandTracer.d.ts +27 -0
- package/lib/tracing/UserLandTracer.js +58 -0
- package/lib/tracing/errorReporting/ErrorReport.d.ts +31 -0
- package/lib/tracing/errorReporting/ErrorReport.js +71 -0
- package/lib/tracing/index.d.ts +9 -0
- package/lib/tracing/index.js +20 -0
- package/lib/tracing/spanReference/SpanReferenceTypes.d.ts +4 -0
- package/lib/tracing/spanReference/SpanReferenceTypes.js +8 -0
- package/lib/tracing/spanReference/createSpanReference.d.ts +3 -0
- package/lib/tracing/spanReference/createSpanReference.js +9 -0
- package/lib/tracing/utils.d.ts +13 -0
- package/lib/tracing/utils.js +42 -0
- package/lib/utils/MineWinsConflictsResolver.d.ts +7 -5
- package/lib/utils/MineWinsConflictsResolver.js +40 -22
- package/lib/utils/app.d.ts +3 -1
- package/lib/utils/app.js +40 -21
- package/lib/utils/appsStaleIfError.d.ts +2 -1
- package/lib/utils/appsStaleIfError.js +33 -12
- package/lib/utils/billingOptions.d.ts +36 -3
- package/lib/utils/billingOptions.js +9 -3
- package/lib/utils/binding.d.ts +3 -3
- package/lib/utils/binding.js +5 -2
- package/lib/utils/cancel.d.ts +2 -2
- package/lib/utils/cancel.js +3 -1
- package/lib/utils/conflicts.mock.d.ts +17 -0
- package/lib/utils/conflicts.mock.js +28 -0
- package/lib/utils/domain.js +2 -1
- package/lib/utils/error.js +6 -4
- package/lib/utils/index.js +23 -12
- package/lib/utils/json.js +1 -0
- package/lib/utils/log.d.ts +1 -3
- package/lib/utils/log.js +6 -4
- package/lib/utils/message.js +11 -4
- package/lib/utils/renameBy.js +3 -1
- package/lib/utils/retry.js +10 -7
- package/lib/utils/status.js +3 -1
- package/lib/utils/tenant.d.ts +3 -3
- package/lib/utils/tenant.js +5 -2
- package/lib/utils/throwOnGraphQLErrors.js +1 -0
- package/lib/utils/time.d.ts +7 -7
- package/lib/utils/time.js +29 -12
- package/package.json +3 -3
- package/lib/HttpClient/IOClient.d.ts +0 -13
- package/lib/HttpClient/IOClient.js +0 -14
- package/lib/HttpClient/factories/index.d.ts +0 -8
- package/lib/HttpClient/factories/index.js +0 -31
- package/lib/HttpClient/middlewares/request.d.ts +0 -10
- package/lib/HttpClient/middlewares/request.js +0 -87
- package/lib/IODataSource.d.ts +0 -27
- package/lib/IODataSource.js +0 -46
- package/lib/clients/Apps.d.ts +0 -84
- package/lib/clients/Apps.js +0 -326
- package/lib/clients/Assets.d.ts +0 -21
- package/lib/clients/Assets.js +0 -110
- package/lib/clients/Billing.d.ts +0 -11
- package/lib/clients/BillingMetrics.d.ts +0 -12
- package/lib/clients/BillingMetrics.js +0 -10
- package/lib/clients/Events.d.ts +0 -6
- package/lib/clients/Events.js +0 -19
- package/lib/clients/Housekeeper.d.ts +0 -11
- package/lib/clients/Housekeeper.js +0 -24
- package/lib/clients/ID.d.ts +0 -22
- package/lib/clients/ID.js +0 -48
- package/lib/clients/LicenseManager.d.ts +0 -6
- package/lib/clients/LicenseManager.js +0 -43
- package/lib/clients/Logger.d.ts +0 -27
- package/lib/clients/Logger.js +0 -32
- package/lib/clients/Messages.d.ts +0 -18
- package/lib/clients/Messages.js +0 -20
- package/lib/clients/MessagesGraphQL.d.ts +0 -63
- package/lib/clients/MessagesGraphQL.js +0 -50
- package/lib/clients/Metadata.d.ts +0 -25
- package/lib/clients/Metadata.js +0 -53
- package/lib/clients/Registry.d.ts +0 -61
- package/lib/clients/Registry.js +0 -147
- package/lib/clients/Router.d.ts +0 -33
- package/lib/clients/Router.js +0 -50
- package/lib/clients/Segment.js +0 -69
- package/lib/clients/Settings.js +0 -44
- package/lib/clients/Sphinx.d.ts +0 -12
- package/lib/clients/Sphinx.js +0 -19
- package/lib/clients/Tenant.js +0 -13
- package/lib/clients/VBase.d.ts +0 -57
- package/lib/clients/VBase.js +0 -116
- package/lib/clients/Workspaces.d.ts +0 -17
- package/lib/clients/Workspaces.js +0 -38
- package/lib/service/Runtime.d.ts +0 -18
- package/lib/service/Runtime.js +0 -57
- package/lib/service/events/index.d.ts +0 -3
- package/lib/service/events/index.js +0 -21
- package/lib/service/graphql/index.d.ts +0 -7
- package/lib/service/graphql/index.js +0 -33
- package/lib/service/graphql/middlewares/error.js +0 -107
- package/lib/service/graphql/middlewares/formatters.d.ts +0 -2
- package/lib/service/graphql/middlewares/formatters.js +0 -64
- package/lib/service/graphql/middlewares/query.d.ts +0 -2
- package/lib/service/graphql/middlewares/query.js +0 -32
- package/lib/service/graphql/middlewares/response.js +0 -36
- package/lib/service/graphql/middlewares/run.d.ts +0 -4
- package/lib/service/graphql/middlewares/run.js +0 -55
- package/lib/service/graphql/middlewares/schema.d.ts +0 -2
- package/lib/service/graphql/middlewares/schema.js +0 -8
- package/lib/service/graphql/middlewares/timings.d.ts +0 -2
- package/lib/service/graphql/middlewares/timings.js +0 -10
- package/lib/service/graphql/middlewares/upload.d.ts +0 -7
- package/lib/service/graphql/schema/index.d.ts +0 -3
- package/lib/service/graphql/schema/index.js +0 -66
- package/lib/service/graphql/schema/messagesLoader.d.ts +0 -4
- package/lib/service/graphql/schema/messagesLoader.js +0 -41
- package/lib/service/graphql/schema/messagesLoaderV2.d.ts +0 -5
- package/lib/service/graphql/schema/messagesLoaderV2.js +0 -44
- package/lib/service/graphql/schema/schemaDirectives/Translatable.js +0 -54
- package/lib/service/graphql/schema/schemaDirectives/TranslatableV2.d.ts +0 -13
- package/lib/service/graphql/schema/schemaDirectives/TranslatableV2.js +0 -67
- package/lib/service/graphql/schema/schemaDirectives/index.d.ts +0 -13
- package/lib/service/graphql/schema/schemaDirectives/index.js +0 -17
- package/lib/service/graphql/schema/typeDefs/index.d.ts +0 -16
- package/lib/service/graphql/schema/typeDefs/index.js +0 -21
- package/lib/service/graphql/schema/typeDefs/ioMessage.d.ts +0 -8
- package/lib/service/graphql/schema/typeDefs/ioMessage.js +0 -33
- package/lib/service/graphql/typings.d.ts +0 -21
- package/lib/service/graphql/utils/cacheControl.d.ts +0 -6
- package/lib/service/graphql/utils/cacheControl.js +0 -38
- package/lib/service/graphql/utils/maxAgeEnum.d.ts +0 -6
- package/lib/service/graphql/utils/maxAgeEnum.js +0 -17
- package/lib/service/graphql/utils/pathname.js +0 -7
- package/lib/service/http/index.d.ts +0 -3
- package/lib/service/http/index.js +0 -18
- package/lib/service/http/middlewares/authTokens.d.ts +0 -3
- package/lib/service/http/middlewares/cancellationToken.d.ts +0 -3
- package/lib/service/http/middlewares/clients.d.ts +0 -4
- package/lib/service/http/middlewares/error.d.ts +0 -3
- package/lib/service/http/middlewares/setCookie.d.ts +0 -3
- package/lib/service/http/middlewares/timings.d.ts +0 -3
- package/lib/service/http/middlewares/vary.d.ts +0 -3
- package/lib/service/method.d.ts +0 -9
- package/lib/service/typings.d.ts +0 -139
- package/lib/service/utils/compose.d.ts +0 -4
- package/lib/service/utils/compose.js +0 -11
- package/lib/utils/MineWinsConflictsResolver.test.d.ts +0 -1
- package/lib/utils/MineWinsConflictsResolver.test.js +0 -134
- package/lib/utils/unhandled.d.ts +0 -1
- /package/lib/service/{graphql → worker/runtime/graphql}/middlewares/error.d.ts +0 -0
- /package/lib/service/{graphql → worker/runtime/graphql}/middlewares/response.d.ts +0 -0
- /package/lib/service/{graphql → worker/runtime/graphql}/schema/typeDefs/ioUpload.d.ts +0 -0
- /package/lib/service/{graphql → worker/runtime/graphql}/schema/typeDefs/sanitizedString.d.ts +0 -0
- /package/lib/service/{graphql → worker/runtime/graphql}/typings.js +0 -0
- /package/lib/service/{graphql → worker/runtime/graphql}/utils/pathname.d.ts +0 -0
- /package/lib/service/{typings.js → worker/runtime/typings.js} +0 -0
- /package/lib/service/{graphql/utils/array.d.ts → worker/runtime/utils/toArray.d.ts} +0 -0
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { IncomingMessage } from 'http';
|
|
3
|
-
import { Readable, Writable } from 'stream';
|
|
4
|
-
import { ZlibOptions } from 'zlib';
|
|
5
|
-
import { InfraClient, InstanceOptions } from '../HttpClient';
|
|
6
|
-
import { AppBundlePublished, AppFilesList, AppManifest } from '../responses';
|
|
7
|
-
import { IOContext } from '../service/typings';
|
|
8
|
-
export interface QueryStringInfo {
|
|
9
|
-
name: string;
|
|
10
|
-
value: boolean;
|
|
11
|
-
}
|
|
12
|
-
export declare class Registry extends InfraClient {
|
|
13
|
-
constructor(context: IOContext, options?: InstanceOptions);
|
|
14
|
-
publishApp: (files: File[], tag?: string | undefined, { zlib }?: ZipOptions) => Promise<AppBundlePublished>;
|
|
15
|
-
publishAppRc: (files: File[], tag?: string | undefined, { zlib }?: ZipOptions) => Promise<AppBundlePublished>;
|
|
16
|
-
listApps: () => Promise<RegistryAppsList>;
|
|
17
|
-
listVersionsByApp: (app: string) => Promise<RegistryAppVersionsList>;
|
|
18
|
-
deprecateApp: (app: string, version: string) => Promise<void>;
|
|
19
|
-
undeprecateApp: (app: string, version: string) => Promise<void>;
|
|
20
|
-
validateApp: (app: string, version: string, appQueryString?: QueryStringInfo | undefined) => Promise<void>;
|
|
21
|
-
getAppManifest: (app: string, version: string, opts?: AppsManifestOptions | undefined) => Promise<AppManifest>;
|
|
22
|
-
listAppFiles: (app: string, version: string, opts?: ListAppFilesOptions | undefined) => Promise<AppFilesList>;
|
|
23
|
-
getAppFile: (app: string, version: string, path: string) => Promise<{
|
|
24
|
-
data: Buffer;
|
|
25
|
-
headers: any;
|
|
26
|
-
}>;
|
|
27
|
-
getAppJSON: <T extends object | null>(app: string, version: string, path: string, nullIfNotFound?: boolean | undefined) => Promise<T>;
|
|
28
|
-
getAppFileStream: (app: string, version: string, path: string) => Promise<IncomingMessage>;
|
|
29
|
-
getAppBundle: (app: string, version: string, bundlePath: string, generatePackageJson: boolean) => Promise<Readable>;
|
|
30
|
-
unpackAppBundle: (app: string, version: string, bundlePath: string, unpackPath: string, generatePackageJson: boolean) => Promise<Writable>;
|
|
31
|
-
resolveDependenciesWithManifest: (manifest: AppManifest, filter?: string) => Promise<Record<string, string[]>>;
|
|
32
|
-
private publish;
|
|
33
|
-
}
|
|
34
|
-
interface ZipOptions {
|
|
35
|
-
zlib?: ZlibOptions;
|
|
36
|
-
}
|
|
37
|
-
export interface AppsManifestOptions {
|
|
38
|
-
resolveDeps: boolean;
|
|
39
|
-
}
|
|
40
|
-
export interface ListAppFilesOptions {
|
|
41
|
-
prefix: string;
|
|
42
|
-
}
|
|
43
|
-
export interface RegistryAppsListItem {
|
|
44
|
-
partialIdentifier: string;
|
|
45
|
-
location: string;
|
|
46
|
-
}
|
|
47
|
-
export interface RegistryAppsList {
|
|
48
|
-
data: RegistryAppsListItem[];
|
|
49
|
-
}
|
|
50
|
-
export interface RegistryAppVersionsListItem {
|
|
51
|
-
versionIdentifier: string;
|
|
52
|
-
location: string;
|
|
53
|
-
}
|
|
54
|
-
export interface RegistryAppVersionsList {
|
|
55
|
-
data: RegistryAppVersionsListItem[];
|
|
56
|
-
}
|
|
57
|
-
export interface File {
|
|
58
|
-
path: string;
|
|
59
|
-
content: any;
|
|
60
|
-
}
|
|
61
|
-
export {};
|
package/lib/clients/Registry.js
DELETED
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const archiver_1 = __importDefault(require("archiver"));
|
|
7
|
-
const tar_fs_1 = require("tar-fs");
|
|
8
|
-
const zlib_1 = require("zlib");
|
|
9
|
-
const constants_1 = require("../constants");
|
|
10
|
-
const HttpClient_1 = require("../HttpClient");
|
|
11
|
-
const EMPTY_OBJECT = {};
|
|
12
|
-
const routes = {
|
|
13
|
-
App: (app) => `${routes.Registry}/${app}`,
|
|
14
|
-
AppBundle: (app, version, path) => {
|
|
15
|
-
return path ? `${routes.AppVersion(app, version)}/bundle/${path}` : `${routes.AppVersion(app, version)}/bundle`;
|
|
16
|
-
},
|
|
17
|
-
AppFile: (app, version, path) => `${routes.AppFiles(app, version)}/${path}`,
|
|
18
|
-
AppFiles: (app, version) => `${routes.AppVersion(app, version)}/files`,
|
|
19
|
-
AppQueryString: (basePath, appQueryString) => appQueryString ? `${basePath}?${appQueryString.name}=${appQueryString.value}` : basePath,
|
|
20
|
-
AppVersion: (app, version) => `${routes.App(app)}/${version}`,
|
|
21
|
-
Publish: '/v2/registry',
|
|
22
|
-
PublishRc: '/v2/registry/rc',
|
|
23
|
-
Registry: '/registry',
|
|
24
|
-
ResolveDependenciesWithManifest: '/v2/registry/_resolve',
|
|
25
|
-
};
|
|
26
|
-
class Registry extends HttpClient_1.InfraClient {
|
|
27
|
-
constructor(context, options) {
|
|
28
|
-
super('apps@0.x', Object.assign({}, context, { workspace: constants_1.DEFAULT_WORKSPACE }), options);
|
|
29
|
-
this.publishApp = (files, tag, { zlib } = {}) => {
|
|
30
|
-
return this.publish(routes.Publish, files, tag, { zlib });
|
|
31
|
-
};
|
|
32
|
-
this.publishAppRc = (files, tag, { zlib } = {}) => {
|
|
33
|
-
return this.publish(routes.PublishRc, files, tag, { zlib });
|
|
34
|
-
};
|
|
35
|
-
this.listApps = () => {
|
|
36
|
-
const inflightKey = HttpClient_1.inflightURL;
|
|
37
|
-
const metric = 'registry-list';
|
|
38
|
-
return this.http.get(routes.Registry, { metric, inflightKey });
|
|
39
|
-
};
|
|
40
|
-
this.listVersionsByApp = (app) => {
|
|
41
|
-
const inflightKey = HttpClient_1.inflightURL;
|
|
42
|
-
const metric = 'registry-list-versions';
|
|
43
|
-
return this.http.get(routes.App(app), { metric, inflightKey });
|
|
44
|
-
};
|
|
45
|
-
this.deprecateApp = (app, version) => {
|
|
46
|
-
const metric = 'registry-deprecate';
|
|
47
|
-
return this.http.patch(routes.AppVersion(app, version), { patchState: 'deprecate' }, { metric });
|
|
48
|
-
};
|
|
49
|
-
this.undeprecateApp = (app, version) => {
|
|
50
|
-
const metric = 'registry-undeprecate';
|
|
51
|
-
return this.http.patch(routes.AppVersion(app, version), { patchState: 'undeprecate' }, { metric });
|
|
52
|
-
};
|
|
53
|
-
this.validateApp = (app, version, appQueryString) => {
|
|
54
|
-
const metric = 'registry-validate';
|
|
55
|
-
return this.http.patch(routes.AppQueryString(routes.AppVersion(app, version), appQueryString), { patchState: 'validate' }, { metric });
|
|
56
|
-
};
|
|
57
|
-
this.getAppManifest = (app, version, opts) => {
|
|
58
|
-
const inflightKey = HttpClient_1.inflightUrlWithQuery;
|
|
59
|
-
const params = opts;
|
|
60
|
-
const metric = 'registry-manifest';
|
|
61
|
-
return this.http.get(routes.AppVersion(app, version), { params, metric, inflightKey });
|
|
62
|
-
};
|
|
63
|
-
this.listAppFiles = (app, version, opts) => {
|
|
64
|
-
const inflightKey = HttpClient_1.inflightUrlWithQuery;
|
|
65
|
-
const params = opts;
|
|
66
|
-
const metric = 'registry-list-files';
|
|
67
|
-
return this.http.get(routes.AppFiles(app, version), { params, metric, inflightKey });
|
|
68
|
-
};
|
|
69
|
-
this.getAppFile = (app, version, path) => {
|
|
70
|
-
const inflightKey = HttpClient_1.inflightURL;
|
|
71
|
-
const metric = 'registry-get-file';
|
|
72
|
-
return this.http.getBuffer(routes.AppFile(app, version, path), {
|
|
73
|
-
cacheable: HttpClient_1.CacheType.Disk,
|
|
74
|
-
inflightKey,
|
|
75
|
-
metric,
|
|
76
|
-
});
|
|
77
|
-
};
|
|
78
|
-
this.getAppJSON = (app, version, path, nullIfNotFound) => {
|
|
79
|
-
const inflightKey = HttpClient_1.inflightURL;
|
|
80
|
-
const metric = 'registry-get-json';
|
|
81
|
-
return this.http.get(routes.AppFile(app, version, path), {
|
|
82
|
-
cacheable: HttpClient_1.CacheType.Any,
|
|
83
|
-
inflightKey,
|
|
84
|
-
metric,
|
|
85
|
-
nullIfNotFound,
|
|
86
|
-
});
|
|
87
|
-
};
|
|
88
|
-
this.getAppFileStream = (app, version, path) => {
|
|
89
|
-
return this.http.getStream(routes.AppFile(app, version, path), { metric: 'registry-get-file-s' });
|
|
90
|
-
};
|
|
91
|
-
this.getAppBundle = (app, version, bundlePath, generatePackageJson) => {
|
|
92
|
-
const params = generatePackageJson && { _packageJSONEngine: 'npm', _packageJSONFilter: 'vtex.render-builder@x' };
|
|
93
|
-
const metric = 'registry-get-bundle';
|
|
94
|
-
return this.http.getStream(routes.AppBundle(app, version, bundlePath), {
|
|
95
|
-
headers: {
|
|
96
|
-
Accept: 'application/x-gzip',
|
|
97
|
-
'Accept-Encoding': 'gzip',
|
|
98
|
-
},
|
|
99
|
-
metric,
|
|
100
|
-
params,
|
|
101
|
-
});
|
|
102
|
-
};
|
|
103
|
-
this.unpackAppBundle = (app, version, bundlePath, unpackPath, generatePackageJson) => {
|
|
104
|
-
return this.getAppBundle(app, version, bundlePath, generatePackageJson)
|
|
105
|
-
.then(stream => stream
|
|
106
|
-
.pipe(zlib_1.createGunzip())
|
|
107
|
-
.pipe(tar_fs_1.extract(unpackPath)));
|
|
108
|
-
};
|
|
109
|
-
this.resolveDependenciesWithManifest = (manifest, filter = '') => {
|
|
110
|
-
const params = { filter };
|
|
111
|
-
const metric = 'registry-resolve-deps';
|
|
112
|
-
return this.http.post(routes.ResolveDependenciesWithManifest, manifest, { params, metric });
|
|
113
|
-
};
|
|
114
|
-
this.publish = async (route, files, tag, { zlib } = {}) => {
|
|
115
|
-
if (!(files[0] && files[0].path && files[0].content)) {
|
|
116
|
-
throw new Error('Argument files must be an array of {path, content}, where content can be a String, a Buffer or a ReadableStream.');
|
|
117
|
-
}
|
|
118
|
-
const indexOfManifest = files.findIndex(({ path }) => path === 'manifest.json');
|
|
119
|
-
if (indexOfManifest === -1) {
|
|
120
|
-
throw new Error('No manifest.json file found in files.');
|
|
121
|
-
}
|
|
122
|
-
const zip = archiver_1.default('zip', { zlib });
|
|
123
|
-
// Throw stream errors so they reject the promise chain.
|
|
124
|
-
zip.on('error', (e) => {
|
|
125
|
-
throw e;
|
|
126
|
-
});
|
|
127
|
-
const metric = 'registry-publish';
|
|
128
|
-
const request = this.http.post(route, zip, {
|
|
129
|
-
headers: { 'Content-Type': 'application/zip' },
|
|
130
|
-
metric,
|
|
131
|
-
params: tag ? { tag } : EMPTY_OBJECT,
|
|
132
|
-
});
|
|
133
|
-
files.forEach(({ content, path }) => zip.append(content, { name: path }));
|
|
134
|
-
const finalize = zip.finalize();
|
|
135
|
-
try {
|
|
136
|
-
const [response] = await Promise.all([request, finalize]);
|
|
137
|
-
response.bundleSize = zip.pointer();
|
|
138
|
-
return response;
|
|
139
|
-
}
|
|
140
|
-
catch (e) {
|
|
141
|
-
e.bundleSize = zip.pointer();
|
|
142
|
-
throw e;
|
|
143
|
-
}
|
|
144
|
-
};
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
exports.Registry = Registry;
|
package/lib/clients/Router.d.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { InfraClient, InstanceOptions } from '../HttpClient';
|
|
2
|
-
import { IOContext } from '../service/typings';
|
|
3
|
-
export declare class Router extends InfraClient {
|
|
4
|
-
constructor(ioContext: IOContext, opts?: InstanceOptions);
|
|
5
|
-
listAvailableIoVersions: () => Promise<AvaiableIO[]>;
|
|
6
|
-
getInstalledIoVersion: () => Promise<AvaiableIO>;
|
|
7
|
-
installIo: (version: string) => Promise<void>;
|
|
8
|
-
listAvailableServices: () => Promise<AvailableServices>;
|
|
9
|
-
getAvailableVersions: (name: string) => Promise<AvailableServiceVersions>;
|
|
10
|
-
listInstalledServices: () => Promise<InstalledService[]>;
|
|
11
|
-
installService: (name: string, version: string) => Promise<void>;
|
|
12
|
-
}
|
|
13
|
-
export interface AvaiableIO {
|
|
14
|
-
version: string;
|
|
15
|
-
tested: boolean;
|
|
16
|
-
services: {
|
|
17
|
-
[service: string]: string;
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
export declare type InstalledIO = AvaiableIO;
|
|
21
|
-
export interface AvailableServiceVersions {
|
|
22
|
-
versions: {
|
|
23
|
-
[region: string]: string[];
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
export interface AvailableServices {
|
|
27
|
-
[service: string]: AvailableServiceVersions;
|
|
28
|
-
}
|
|
29
|
-
export interface InstalledService {
|
|
30
|
-
name: string;
|
|
31
|
-
version: string;
|
|
32
|
-
serviceIsolation: number;
|
|
33
|
-
}
|
package/lib/clients/Router.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const HttpClient_1 = require("../HttpClient");
|
|
4
|
-
const routes = {
|
|
5
|
-
AvailableIoVersions: '/_io',
|
|
6
|
-
AvailableServiceVersions: (service) => `${routes.AvailableServices}/${service}`,
|
|
7
|
-
AvailableServices: '/_services',
|
|
8
|
-
InstalledIoVersion: (account, workspace) => `/${account}/${workspace}/io`,
|
|
9
|
-
InstalledService: (account, workspace, name) => `/${routes.InstalledServices(account, workspace)}/services/${name}`,
|
|
10
|
-
InstalledServices: (account, workspace) => `/${account}/${workspace}/services`,
|
|
11
|
-
};
|
|
12
|
-
class Router extends HttpClient_1.InfraClient {
|
|
13
|
-
constructor(ioContext, opts) {
|
|
14
|
-
super('router', ioContext, opts, true);
|
|
15
|
-
this.listAvailableIoVersions = () => {
|
|
16
|
-
return this.http.get(routes.AvailableIoVersions);
|
|
17
|
-
};
|
|
18
|
-
this.getInstalledIoVersion = () => {
|
|
19
|
-
if (!this.context.account || !this.context.workspace) {
|
|
20
|
-
throw new Error('Missing client parameters: {account, workspace}');
|
|
21
|
-
}
|
|
22
|
-
return this.http.get(routes.InstalledIoVersion(this.context.account, this.context.workspace));
|
|
23
|
-
};
|
|
24
|
-
this.installIo = (version) => {
|
|
25
|
-
if (!this.context.account || !this.context.workspace) {
|
|
26
|
-
throw new Error('Missing client parameters: {account, workspace}');
|
|
27
|
-
}
|
|
28
|
-
return this.http.put(routes.InstalledIoVersion(this.context.account, this.context.workspace), { version });
|
|
29
|
-
};
|
|
30
|
-
this.listAvailableServices = () => {
|
|
31
|
-
return this.http.get(routes.AvailableServices);
|
|
32
|
-
};
|
|
33
|
-
this.getAvailableVersions = (name) => {
|
|
34
|
-
return this.http.get(routes.AvailableServiceVersions(name));
|
|
35
|
-
};
|
|
36
|
-
this.listInstalledServices = () => {
|
|
37
|
-
if (!this.context.account || !this.context.workspace) {
|
|
38
|
-
throw new Error('Missing client parameters: {account, workspace}');
|
|
39
|
-
}
|
|
40
|
-
return this.http.get(routes.InstalledServices(this.context.account, this.context.workspace));
|
|
41
|
-
};
|
|
42
|
-
this.installService = (name, version) => {
|
|
43
|
-
if (!this.context.account || !this.context.workspace) {
|
|
44
|
-
throw new Error('Missing client parameters: {account, workspace}');
|
|
45
|
-
}
|
|
46
|
-
return this.http.post(routes.InstalledServices(this.context.account, this.context.workspace), { name, version });
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
exports.Router = Router;
|
package/lib/clients/Segment.js
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const ramda_1 = require("ramda");
|
|
4
|
-
const constants_1 = require("../constants");
|
|
5
|
-
const HttpClient_1 = require("../HttpClient");
|
|
6
|
-
const Session_1 = require("./Session");
|
|
7
|
-
const SEGMENT_MAX_AGE_S = 60 * 60; // 60 minutes - segment is actually immutable
|
|
8
|
-
const ALLOWED_QUERY_PREFIXES = ['utm', 'cultureInfo', 'supportedLocales'];
|
|
9
|
-
const filterAndSortQuery = (query) => {
|
|
10
|
-
if (!query) {
|
|
11
|
-
return null;
|
|
12
|
-
}
|
|
13
|
-
const filteredKeys = Object.keys(query)
|
|
14
|
-
.filter((k) => !!k && ALLOWED_QUERY_PREFIXES.some((prefix) => k.startsWith(prefix)))
|
|
15
|
-
.sort();
|
|
16
|
-
return filteredKeys.reduce((acc, val) => {
|
|
17
|
-
acc[val] = query[val];
|
|
18
|
-
return acc;
|
|
19
|
-
}, {});
|
|
20
|
-
};
|
|
21
|
-
const routes = {
|
|
22
|
-
base: '/api/segments',
|
|
23
|
-
segments: (token) => token ? `${routes.base}/${token}` : routes.base,
|
|
24
|
-
};
|
|
25
|
-
class Segment extends HttpClient_1.JanusClient {
|
|
26
|
-
constructor() {
|
|
27
|
-
super(...arguments);
|
|
28
|
-
/**
|
|
29
|
-
* @deprecated Please use `getSegment` or `getSegmentByToken` instead.
|
|
30
|
-
*
|
|
31
|
-
* @memberof Segment
|
|
32
|
-
*/
|
|
33
|
-
this.segment = (query, token) => this.rawSegment(token || this.context.segmentToken, query).then(ramda_1.prop('data'));
|
|
34
|
-
/**
|
|
35
|
-
* Get the segment data using the current `ctx.vtex.segmentToken`
|
|
36
|
-
*
|
|
37
|
-
* @memberof Segment
|
|
38
|
-
*/
|
|
39
|
-
this.getSegment = () => this.rawSegment(this.context.segmentToken).then(ramda_1.prop('data'));
|
|
40
|
-
/**
|
|
41
|
-
* Get the segment data from this specific segment token
|
|
42
|
-
*
|
|
43
|
-
* @memberof Segment
|
|
44
|
-
*/
|
|
45
|
-
this.getSegmentByToken = (token) => this.rawSegment(token).then(ramda_1.prop('data'));
|
|
46
|
-
this.getOrCreateSegment = async (query, token) => {
|
|
47
|
-
const { data: segmentData, headers, } = await this.rawSegment(token, query);
|
|
48
|
-
return {
|
|
49
|
-
segmentData,
|
|
50
|
-
segmentToken: Session_1.extractSessionCookie(headers) || token,
|
|
51
|
-
};
|
|
52
|
-
};
|
|
53
|
-
this.rawSegment = (token, query) => {
|
|
54
|
-
const { product } = this.context;
|
|
55
|
-
const filteredQuery = filterAndSortQuery(query);
|
|
56
|
-
return this.http.getRaw(routes.segments(token), ({
|
|
57
|
-
forceMaxAge: SEGMENT_MAX_AGE_S,
|
|
58
|
-
headers: {
|
|
59
|
-
'Content-Type': 'application/json',
|
|
60
|
-
[constants_1.PRODUCT_HEADER]: product || '',
|
|
61
|
-
},
|
|
62
|
-
inflightKey: HttpClient_1.inflightUrlWithQuery,
|
|
63
|
-
metric: token ? 'segment-get-token' : 'segment-get-new',
|
|
64
|
-
params: Object.assign({}, filteredQuery, { session_path: product || '' }),
|
|
65
|
-
}));
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
exports.Segment = Segment;
|
package/lib/clients/Settings.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const crypto_1 = require("crypto");
|
|
4
|
-
const ramda_1 = require("ramda");
|
|
5
|
-
const HttpClient_1 = require("../HttpClient");
|
|
6
|
-
const app_1 = require("../utils/app");
|
|
7
|
-
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
|
-
const containsLinks = ramda_1.any(app_1.isLinkedApp);
|
|
19
|
-
class Settings extends HttpClient_1.AppClient {
|
|
20
|
-
constructor(context, options) {
|
|
21
|
-
super('vtex.settings-server@0.x', context, options);
|
|
22
|
-
}
|
|
23
|
-
getFilteredDependencies(appAtMajor, dependencies) {
|
|
24
|
-
const depends = dependsOnApp(appAtMajor);
|
|
25
|
-
return ramda_1.filter(depends, dependencies);
|
|
26
|
-
}
|
|
27
|
-
getDependenciesHash(dependencies) {
|
|
28
|
-
const dependingApps = ramda_1.pluck('id', dependencies);
|
|
29
|
-
return crypto_1.createHash('md5').update(joinIds(dependingApps)).digest('hex');
|
|
30
|
-
}
|
|
31
|
-
async getSettings(dependencies, appAtMajor, params) {
|
|
32
|
-
const filtered = this.getFilteredDependencies(appAtMajor, dependencies);
|
|
33
|
-
// Settings server exposes a smartCache-enabled route for when the workspace contains links.
|
|
34
|
-
const lastSegment = containsLinks(filtered)
|
|
35
|
-
? LINKED_ROUTE
|
|
36
|
-
: this.getDependenciesHash(filtered);
|
|
37
|
-
return this.http.get(`/settings/${appAtMajor}/${lastSegment}`, {
|
|
38
|
-
inflightKey: HttpClient_1.inflightUrlWithQuery,
|
|
39
|
-
metric: 'settings-get',
|
|
40
|
-
params,
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
exports.Settings = Settings;
|
package/lib/clients/Sphinx.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { IOContext } from '../service/typings';
|
|
2
|
-
import { InfraClient, InstanceOptions } from './../HttpClient';
|
|
3
|
-
export declare class Sphinx extends InfraClient {
|
|
4
|
-
constructor(ioContext: IOContext, opts?: InstanceOptions);
|
|
5
|
-
validatePolicies: (policies: PolicyRequest[]) => Promise<void>;
|
|
6
|
-
isAdmin: (email: string) => Promise<boolean>;
|
|
7
|
-
}
|
|
8
|
-
export interface PolicyRequest {
|
|
9
|
-
name: string;
|
|
10
|
-
reason: string;
|
|
11
|
-
attrs: Record<string, string>;
|
|
12
|
-
}
|
package/lib/clients/Sphinx.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const HttpClient_1 = require("./../HttpClient");
|
|
4
|
-
class Sphinx extends HttpClient_1.InfraClient {
|
|
5
|
-
constructor(ioContext, opts) {
|
|
6
|
-
super('sphinx@0.x', ioContext, opts, false);
|
|
7
|
-
this.validatePolicies = (policies) => {
|
|
8
|
-
return this.http.post('/policies/validate', { policies }, {
|
|
9
|
-
metric: 'sphinx-validate-policy',
|
|
10
|
-
});
|
|
11
|
-
};
|
|
12
|
-
this.isAdmin = (email) => {
|
|
13
|
-
return this.http.get(`/user/${email}/isAdmin`, {
|
|
14
|
-
metric: 'sphinx-is-admin',
|
|
15
|
-
});
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
exports.Sphinx = Sphinx;
|
package/lib/clients/Tenant.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const HttpClient_1 = require("../HttpClient");
|
|
4
|
-
const ExternalClient_1 = require("../HttpClient/ExternalClient");
|
|
5
|
-
class TenantClient extends ExternalClient_1.ExternalClient {
|
|
6
|
-
constructor(ctx, opts) {
|
|
7
|
-
super('http://portal.vtexcommercestable.com.br/api/tenant', ctx, Object.assign({}, opts, { params: {
|
|
8
|
-
q: ctx.account,
|
|
9
|
-
} }));
|
|
10
|
-
this.info = (config) => this.http.get('/tenants', Object.assign({ inflightKey: HttpClient_1.inflightUrlWithQuery, memoizeable: true, metric: 'get-tenant-info' }, config));
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
exports.TenantClient = TenantClient;
|
package/lib/clients/VBase.d.ts
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { IncomingMessage } from 'http';
|
|
3
|
-
import { Readable } from 'stream';
|
|
4
|
-
import { InfraClient, InstanceOptions } from '../HttpClient';
|
|
5
|
-
import { BucketMetadata, FileListItem } from '../responses';
|
|
6
|
-
import { IOContext } from '../service/typings';
|
|
7
|
-
export declare class VBase extends InfraClient {
|
|
8
|
-
constructor(context: IOContext, options?: InstanceOptions);
|
|
9
|
-
getBucket: (bucket: string) => Promise<BucketMetadata>;
|
|
10
|
-
resetBucket: (bucket: string) => Promise<import("../HttpClient").IOResponse<void>>;
|
|
11
|
-
listFiles: (bucket: string, opts?: string | VBaseOptions | undefined) => Promise<BucketFileList>;
|
|
12
|
-
getFile: (bucket: string, path: string) => Promise<{
|
|
13
|
-
data: Buffer;
|
|
14
|
-
headers: any;
|
|
15
|
-
}>;
|
|
16
|
-
getJSON: <T>(bucket: string, path: string, nullIfNotFound?: boolean | undefined, conflictsResolver?: ConflictsResolver | undefined) => Promise<{} | T>;
|
|
17
|
-
getFileStream: (bucket: string, path: string) => Promise<IncomingMessage>;
|
|
18
|
-
saveFile: (bucket: string, path: string, stream: Readable, gzip?: boolean, ttl?: number | undefined) => Promise<void>;
|
|
19
|
-
getFileMetadata: (bucket: string, path: string) => Promise<import("../HttpClient").IOResponse<void>>;
|
|
20
|
-
saveJSON: <T>(bucket: string, path: string, data: T) => Promise<void>;
|
|
21
|
-
saveZippedContent: (bucket: string, path: string, stream: Readable) => Promise<void>;
|
|
22
|
-
deleteFile: (bucket: string, path: string) => Promise<import("../HttpClient").IOResponse<void>>;
|
|
23
|
-
getConflicts: <T>(bucket: string) => Promise<T>;
|
|
24
|
-
resolveConflict: <T>(bucket: string, path: string, content: any) => Promise<T>;
|
|
25
|
-
private saveContent;
|
|
26
|
-
}
|
|
27
|
-
export interface BucketFileList {
|
|
28
|
-
data: FileListItem[];
|
|
29
|
-
next: string;
|
|
30
|
-
smartCacheHeaders: any;
|
|
31
|
-
}
|
|
32
|
-
export interface VBaseOptions {
|
|
33
|
-
prefix?: string;
|
|
34
|
-
_next?: string;
|
|
35
|
-
_limit?: number;
|
|
36
|
-
}
|
|
37
|
-
export interface VBaseSaveOptions {
|
|
38
|
-
gzip?: boolean;
|
|
39
|
-
unzip?: boolean;
|
|
40
|
-
ttl?: number;
|
|
41
|
-
}
|
|
42
|
-
export interface VBaseConflictData {
|
|
43
|
-
path: string;
|
|
44
|
-
base: VBaseConflict;
|
|
45
|
-
master: VBaseConflict;
|
|
46
|
-
mine: VBaseConflict;
|
|
47
|
-
}
|
|
48
|
-
export interface VBaseConflict {
|
|
49
|
-
contentOmitted: boolean;
|
|
50
|
-
deleted: boolean;
|
|
51
|
-
mimeType: string;
|
|
52
|
-
parsedContent?: any;
|
|
53
|
-
content: string;
|
|
54
|
-
}
|
|
55
|
-
export interface ConflictsResolver {
|
|
56
|
-
resolve: () => {};
|
|
57
|
-
}
|
package/lib/clients/VBase.js
DELETED
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const mime_types_1 = __importDefault(require("mime-types"));
|
|
7
|
-
const path_1 = require("path");
|
|
8
|
-
const zlib_1 = require("zlib");
|
|
9
|
-
const HttpClient_1 = require("../HttpClient");
|
|
10
|
-
const appId = process.env.VTEX_APP_ID;
|
|
11
|
-
const [runningAppName] = appId ? appId.split('@') : [''];
|
|
12
|
-
const routes = {
|
|
13
|
-
Bucket: (bucket) => `/buckets/${runningAppName}/${bucket}`,
|
|
14
|
-
Conflicts: (bucket) => `/buckets/${runningAppName}/${bucket}/conflicts`,
|
|
15
|
-
File: (bucket, path) => `${routes.Bucket(bucket)}/files/${path}`,
|
|
16
|
-
Files: (bucket) => `${routes.Bucket(bucket)}/files`,
|
|
17
|
-
};
|
|
18
|
-
const isVBaseOptions = (opts) => {
|
|
19
|
-
return typeof opts !== 'string' && !(opts instanceof String);
|
|
20
|
-
};
|
|
21
|
-
class VBase extends HttpClient_1.InfraClient {
|
|
22
|
-
constructor(context, options) {
|
|
23
|
-
super('vbase@2.x', context, options);
|
|
24
|
-
this.getBucket = (bucket) => {
|
|
25
|
-
const inflightKey = HttpClient_1.inflightURL;
|
|
26
|
-
const metric = 'vbase-get-bucket';
|
|
27
|
-
return this.http.get(routes.Bucket(bucket), { metric, inflightKey });
|
|
28
|
-
};
|
|
29
|
-
this.resetBucket = (bucket) => {
|
|
30
|
-
return this.http.delete(routes.Files(bucket), { metric: 'vbase-reset-bucket' });
|
|
31
|
-
};
|
|
32
|
-
this.listFiles = (bucket, opts) => {
|
|
33
|
-
let params = {};
|
|
34
|
-
if (isVBaseOptions(opts)) {
|
|
35
|
-
params = opts;
|
|
36
|
-
}
|
|
37
|
-
else if (opts) {
|
|
38
|
-
params = { prefix: opts };
|
|
39
|
-
}
|
|
40
|
-
const metric = 'vbase-list';
|
|
41
|
-
const inflightKey = HttpClient_1.inflightUrlWithQuery;
|
|
42
|
-
return this.http.get(routes.Files(bucket), { params, metric, inflightKey });
|
|
43
|
-
};
|
|
44
|
-
this.getFile = (bucket, path) => {
|
|
45
|
-
const inflightKey = HttpClient_1.inflightURL;
|
|
46
|
-
const metric = 'vbase-get-file';
|
|
47
|
-
return this.http.getBuffer(routes.File(bucket, path), { metric, inflightKey });
|
|
48
|
-
};
|
|
49
|
-
this.getJSON = (bucket, path, nullIfNotFound, conflictsResolver) => {
|
|
50
|
-
const headers = conflictsResolver ? { 'X-Vtex-Detect-Conflicts': true } : {};
|
|
51
|
-
const inflightKey = HttpClient_1.inflightURL;
|
|
52
|
-
const metric = 'vbase-get-json';
|
|
53
|
-
return this.http.get(routes.File(bucket, path), { nullIfNotFound, metric, inflightKey, headers })
|
|
54
|
-
.catch((error) => {
|
|
55
|
-
const { response } = error;
|
|
56
|
-
if (response && response.status === 409 && conflictsResolver) {
|
|
57
|
-
return conflictsResolver.resolve();
|
|
58
|
-
}
|
|
59
|
-
throw error;
|
|
60
|
-
});
|
|
61
|
-
};
|
|
62
|
-
this.getFileStream = (bucket, path) => {
|
|
63
|
-
return this.http.getStream(routes.File(bucket, path), { metric: 'vbase-get-file-s' });
|
|
64
|
-
};
|
|
65
|
-
this.saveFile = (bucket, path, stream, gzip = true, ttl) => {
|
|
66
|
-
return this.saveContent(bucket, path, stream, { gzip, ttl });
|
|
67
|
-
};
|
|
68
|
-
this.getFileMetadata = (bucket, path) => {
|
|
69
|
-
return this.http.head(routes.File(bucket, path), { metric: 'vbase-get-file-metadata' });
|
|
70
|
-
};
|
|
71
|
-
this.saveJSON = (bucket, path, data) => {
|
|
72
|
-
const headers = { 'Content-Type': 'application/json' };
|
|
73
|
-
const metric = 'vbase-save-json';
|
|
74
|
-
return this.http.put(routes.File(bucket, path), data, { headers, metric });
|
|
75
|
-
};
|
|
76
|
-
this.saveZippedContent = (bucket, path, stream) => {
|
|
77
|
-
return this.saveContent(bucket, path, stream, { unzip: true });
|
|
78
|
-
};
|
|
79
|
-
this.deleteFile = (bucket, path) => {
|
|
80
|
-
return this.http.delete(routes.File(bucket, path), { metric: 'vbase-delete-file' });
|
|
81
|
-
};
|
|
82
|
-
this.getConflicts = (bucket) => {
|
|
83
|
-
return this.http.get(routes.Conflicts(bucket), { metric: 'vbase-get-conflicts' });
|
|
84
|
-
};
|
|
85
|
-
this.resolveConflict = (bucket, path, content) => {
|
|
86
|
-
const data = [{
|
|
87
|
-
op: 'replace',
|
|
88
|
-
path,
|
|
89
|
-
value: content,
|
|
90
|
-
}];
|
|
91
|
-
return this.http.patch(routes.Conflicts(bucket), data, { metric: 'vbase-resolve-conflicts' });
|
|
92
|
-
};
|
|
93
|
-
this.saveContent = (bucket, path, stream, opts = {}) => {
|
|
94
|
-
if (!stream.pipe || !stream.on) {
|
|
95
|
-
throw new Error(`Argument stream must be a readable stream`);
|
|
96
|
-
}
|
|
97
|
-
const params = opts.unzip ? { unzip: opts.unzip } : {};
|
|
98
|
-
const headers = {};
|
|
99
|
-
let finalStream = stream;
|
|
100
|
-
headers['Content-Type'] = mime_types_1.default.contentType(path_1.basename(path)) || 'application/octet-stream';
|
|
101
|
-
if (opts.gzip) {
|
|
102
|
-
headers['Content-Encoding'] = 'gzip';
|
|
103
|
-
finalStream = stream.pipe(zlib_1.createGzip());
|
|
104
|
-
}
|
|
105
|
-
if (opts.ttl && Number.isInteger(opts.ttl)) {
|
|
106
|
-
headers['X-VTEX-TTL'] = opts.ttl;
|
|
107
|
-
}
|
|
108
|
-
const metric = 'vbase-save-blob';
|
|
109
|
-
return this.http.put(routes.File(bucket, path), finalStream, { headers, params, metric });
|
|
110
|
-
};
|
|
111
|
-
if (runningAppName === '') {
|
|
112
|
-
throw new Error(`Invalid path to access VBase. Variable VTEX_APP_ID is not available.`);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
exports.VBase = VBase;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { InfraClient, InstanceOptions } from '../HttpClient';
|
|
2
|
-
import { IOContext } from '../service/typings';
|
|
3
|
-
export declare class Workspaces extends InfraClient {
|
|
4
|
-
constructor(context: IOContext, options?: InstanceOptions);
|
|
5
|
-
list: (account: string) => Promise<WorkspaceMetadata[]>;
|
|
6
|
-
get: (account: string, workspace: string) => Promise<WorkspaceMetadata>;
|
|
7
|
-
set: (account: string, workspace: string, metadata: Partial<WorkspaceMetadata>) => Promise<void>;
|
|
8
|
-
create: (account: string, workspace: string, production: boolean) => Promise<void>;
|
|
9
|
-
delete: (account: string, workspace: string) => Promise<import("../HttpClient").IOResponse<void>>;
|
|
10
|
-
reset: (account: string, workspace: string, metadata?: Partial<WorkspaceMetadata>) => Promise<void>;
|
|
11
|
-
promote: (account: string, workspace: string, conflictResolutionStrategy?: string | undefined) => Promise<void>;
|
|
12
|
-
}
|
|
13
|
-
export interface WorkspaceMetadata {
|
|
14
|
-
name: string;
|
|
15
|
-
weight: number;
|
|
16
|
-
production: boolean;
|
|
17
|
-
}
|