@vtex/api 6.48.1-beta → 6.48.1-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/gen/manifest.schema +5 -3
- package/lib/HttpClient/GraphQLClient.d.ts +2 -1
- package/lib/HttpClient/GraphQLClient.js +5 -1
- package/lib/HttpClient/HttpClient.d.ts +6 -5
- package/lib/HttpClient/HttpClient.js +64 -21
- package/lib/HttpClient/agents.d.ts +3 -0
- package/lib/HttpClient/agents.js +37 -0
- package/lib/HttpClient/index.d.ts +1 -7
- package/lib/HttpClient/index.js +17 -16
- package/lib/HttpClient/middlewares/cache.d.ts +8 -2
- package/lib/HttpClient/middlewares/cache.js +126 -33
- package/lib/HttpClient/middlewares/cancellationToken.d.ts +1 -1
- package/lib/HttpClient/middlewares/cancellationToken.js +3 -1
- package/lib/HttpClient/middlewares/inflight.js +1 -0
- package/lib/HttpClient/middlewares/memoization.js +9 -1
- package/lib/HttpClient/middlewares/metrics.js +17 -31
- package/lib/HttpClient/middlewares/notFound.js +1 -0
- package/lib/HttpClient/middlewares/recorder.d.ts +1 -1
- package/lib/HttpClient/middlewares/recorder.js +20 -12
- package/lib/HttpClient/middlewares/request/HttpAgentSingleton.d.ts +11 -0
- package/lib/HttpClient/middlewares/request/HttpAgentSingleton.js +31 -0
- package/lib/HttpClient/middlewares/request/index.d.ts +18 -0
- package/lib/HttpClient/middlewares/request/index.js +85 -0
- package/lib/HttpClient/middlewares/request/setupAxios/index.d.ts +2 -0
- package/lib/HttpClient/middlewares/request/setupAxios/index.js +21 -0
- package/lib/HttpClient/middlewares/request/setupAxios/interceptors/exponentialBackoff.d.ts +2 -0
- package/lib/HttpClient/middlewares/request/setupAxios/interceptors/exponentialBackoff.js +54 -0
- package/lib/HttpClient/middlewares/request/setupAxios/interceptors/index.d.ts +2 -0
- package/lib/HttpClient/middlewares/request/setupAxios/interceptors/index.js +7 -0
- package/lib/HttpClient/middlewares/request/setupAxios/interceptors/tracing/index.d.ts +8 -0
- package/lib/HttpClient/middlewares/request/setupAxios/interceptors/tracing/index.js +56 -0
- package/lib/HttpClient/middlewares/request/setupAxios/interceptors/tracing/spanSetup.d.ts +4 -0
- package/lib/HttpClient/middlewares/request/setupAxios/interceptors/tracing/spanSetup.js +30 -0
- package/lib/HttpClient/middlewares/tracing.d.ts +15 -0
- package/lib/HttpClient/middlewares/tracing.js +61 -0
- package/lib/HttpClient/typings.d.ts +44 -10
- package/lib/HttpClient/typings.js +1 -0
- package/lib/caches/DiskCache.d.ts +1 -1
- package/lib/caches/DiskCache.js +1 -0
- package/lib/caches/LRUCache.d.ts +2 -2
- package/lib/caches/LRUCache.js +6 -1
- package/lib/caches/LRUDiskCache.d.ts +1 -1
- package/lib/caches/LRUDiskCache.js +6 -1
- package/lib/caches/MultilayeredCache.d.ts +1 -1
- package/lib/caches/MultilayeredCache.js +2 -1
- package/lib/caches/index.js +16 -7
- package/lib/{HttpClient → clients}/IOClient.d.ts +4 -4
- package/lib/clients/IOClient.js +20 -0
- package/lib/clients/IOClients.d.ts +28 -24
- package/lib/clients/IOClients.js +36 -28
- package/lib/{HttpClient → clients}/IOGraphQLClient.d.ts +4 -4
- package/lib/{HttpClient → clients}/IOGraphQLClient.js +3 -2
- package/lib/{HttpClient → clients/apps}/AppClient.d.ts +3 -3
- package/lib/{HttpClient → clients/apps}/AppClient.js +11 -5
- package/lib/{HttpClient → clients/apps}/AppGraphQLClient.d.ts +3 -3
- package/lib/{HttpClient → clients/apps}/AppGraphQLClient.js +11 -5
- package/lib/clients/apps/Billing.d.ts +12 -0
- package/lib/clients/{Billing.js → apps/Billing.js} +9 -3
- package/lib/clients/{Builder.d.ts → apps/Builder.d.ts} +12 -11
- package/lib/clients/{Builder.js → apps/Builder.js} +50 -22
- package/lib/clients/apps/MessagesGraphQL.d.ts +61 -0
- package/lib/clients/apps/MessagesGraphQL.js +122 -0
- package/lib/clients/{Settings.d.ts → apps/Settings.d.ts} +5 -4
- package/lib/clients/{Settings.js → apps/Settings.js} +15 -20
- package/lib/clients/apps/catalogGraphQL/brand.d.ts +13 -0
- package/lib/clients/apps/catalogGraphQL/brand.js +19 -0
- package/lib/clients/apps/catalogGraphQL/category.d.ts +11 -0
- package/lib/clients/apps/catalogGraphQL/category.js +17 -0
- package/lib/clients/apps/catalogGraphQL/index.d.ts +22 -0
- package/lib/clients/apps/catalogGraphQL/index.js +89 -0
- package/lib/clients/apps/catalogGraphQL/product.d.ts +25 -0
- package/lib/clients/apps/catalogGraphQL/product.js +31 -0
- package/lib/clients/apps/catalogGraphQL/sku.d.ts +26 -0
- package/lib/clients/apps/catalogGraphQL/sku.js +31 -0
- package/lib/clients/apps/index.d.ts +7 -0
- package/lib/clients/apps/index.js +19 -0
- package/lib/{HttpClient → clients/external}/ExternalClient.d.ts +3 -3
- package/lib/{HttpClient → clients/external}/ExternalClient.js +10 -2
- package/lib/clients/external/ID.d.ts +23 -0
- package/lib/clients/external/ID.js +61 -0
- package/lib/clients/external/Masterdata.d.ts +94 -0
- package/lib/clients/external/Masterdata.js +225 -0
- package/lib/clients/external/PaymentProvider.d.ts +31 -0
- package/lib/clients/external/PaymentProvider.js +43 -0
- package/lib/clients/external/index.d.ts +4 -0
- package/lib/clients/external/index.js +16 -0
- package/lib/clients/index.d.ts +9 -21
- package/lib/clients/index.js +23 -24
- package/lib/clients/infra/Apps.d.ts +88 -0
- package/lib/clients/infra/Apps.js +511 -0
- package/lib/clients/infra/Assets.d.ts +34 -0
- package/lib/clients/{Assets.js → infra/Assets.js} +75 -19
- package/lib/clients/infra/BillingMetrics.d.ts +13 -0
- package/lib/clients/infra/BillingMetrics.js +16 -0
- package/lib/clients/infra/Events.d.ts +12 -0
- package/lib/clients/infra/Events.js +34 -0
- package/lib/clients/infra/Housekeeper.d.ts +10 -0
- package/lib/clients/infra/Housekeeper.js +31 -0
- package/lib/{HttpClient → clients/infra}/InfraClient.d.ts +3 -3
- package/lib/{HttpClient → clients/infra}/InfraClient.js +10 -4
- package/lib/clients/infra/Registry.d.ts +59 -0
- package/lib/clients/{Registry.js → infra/Registry.js} +95 -33
- package/lib/clients/infra/Router.d.ts +34 -0
- package/lib/clients/infra/Router.js +82 -0
- package/lib/clients/infra/Sphinx.d.ts +13 -0
- package/lib/clients/infra/Sphinx.js +30 -0
- package/lib/clients/infra/VBase.d.ts +60 -0
- package/lib/clients/infra/VBase.js +197 -0
- package/lib/clients/infra/Workspaces.d.ts +18 -0
- package/lib/clients/infra/Workspaces.js +66 -0
- package/lib/clients/infra/index.d.ts +11 -0
- package/lib/clients/infra/index.js +23 -0
- package/lib/{HttpClient → clients/janus}/JanusClient.d.ts +3 -3
- package/lib/{HttpClient → clients/janus}/JanusClient.js +8 -3
- package/lib/clients/janus/LicenseManager.d.ts +7 -0
- package/lib/clients/{LicenseManager.js → janus/LicenseManager.js} +24 -8
- package/lib/clients/{Segment.d.ts → janus/Segment.d.ts} +7 -11
- package/lib/clients/janus/Segment.js +89 -0
- package/lib/clients/{Session.d.ts → janus/Session.d.ts} +4 -4
- package/lib/clients/{Session.js → janus/Session.js} +25 -13
- package/lib/clients/{Tenant.d.ts → janus/Tenant.d.ts} +6 -7
- package/lib/clients/janus/Tenant.js +29 -0
- package/lib/clients/janus/index.d.ts +5 -0
- package/lib/clients/janus/index.js +17 -0
- package/lib/constants.d.ts +49 -1
- package/lib/constants.js +55 -1
- package/lib/errors/AuthenticationError.js +1 -0
- package/lib/errors/ForbiddenError.js +1 -0
- package/lib/errors/NotFoundError.js +1 -0
- package/lib/errors/RequestCancelledError.js +1 -0
- package/lib/errors/ResolverError.d.ts +1 -1
- package/lib/errors/ResolverError.js +3 -2
- package/lib/errors/ResolverWarning.d.ts +1 -1
- package/lib/errors/ResolverWarning.js +3 -2
- package/lib/errors/TooManyRequestsError.js +1 -0
- package/lib/errors/UserInputError.js +1 -0
- package/lib/errors/index.js +18 -11
- package/lib/index.d.ts +9 -7
- package/lib/index.js +27 -16
- package/lib/metrics/MetricsAccumulator.d.ts +1 -18
- package/lib/metrics/MetricsAccumulator.js +39 -22
- package/lib/responses.d.ts +3 -44
- package/lib/service/index.d.ts +2 -0
- package/lib/service/index.js +34 -0
- package/lib/service/loaders.d.ts +8 -0
- package/lib/service/loaders.js +55 -0
- package/lib/service/logger/console.d.ts +10 -0
- package/lib/service/logger/console.js +37 -0
- package/lib/service/logger/index.d.ts +2 -28
- package/lib/service/logger/index.js +12 -68
- package/lib/service/logger/logger.d.ts +29 -0
- package/lib/service/logger/logger.js +62 -0
- package/lib/service/logger/metricsLogger.d.ts +40 -0
- package/lib/service/logger/metricsLogger.js +150 -0
- package/lib/service/master.d.ts +2 -0
- package/lib/service/master.js +88 -0
- package/lib/service/metrics/requestMetricsMiddleware.d.ts +2 -0
- package/lib/service/metrics/requestMetricsMiddleware.js +45 -0
- package/lib/service/tracing/TracerSingleton.d.ts +7 -0
- package/lib/service/tracing/TracerSingleton.js +49 -0
- package/lib/service/tracing/metrics/MetricNames.d.ts +60 -0
- package/lib/service/tracing/metrics/MetricNames.js +45 -0
- package/lib/service/tracing/metrics/instruments.d.ts +9 -0
- package/lib/service/tracing/metrics/instruments.js +12 -0
- package/lib/service/tracing/metrics/measurers/EventLoopLagMeasurer.d.ts +9 -0
- package/lib/service/tracing/metrics/measurers/EventLoopLagMeasurer.js +26 -0
- package/lib/service/tracing/tracingMiddlewares.d.ts +5 -0
- package/lib/service/tracing/tracingMiddlewares.js +114 -0
- package/lib/service/worker/index.d.ts +11 -0
- package/lib/service/worker/index.js +196 -0
- package/lib/service/worker/listeners.d.ts +3 -0
- package/lib/{utils/unhandled.js → service/worker/listeners.js} +10 -15
- package/lib/service/{Service.d.ts → worker/runtime/Service.d.ts} +5 -5
- package/lib/service/{Service.js → worker/runtime/Service.js} +3 -1
- package/lib/service/worker/runtime/builtIn/handlers.d.ts +4 -0
- package/lib/service/worker/runtime/builtIn/handlers.js +31 -0
- package/lib/service/worker/runtime/builtIn/middlewares.d.ts +4 -0
- package/lib/service/worker/runtime/builtIn/middlewares.js +41 -0
- package/lib/service/worker/runtime/events/index.d.ts +4 -0
- package/lib/service/worker/runtime/events/index.js +47 -0
- package/lib/service/worker/runtime/events/middlewares/body.d.ts +3 -0
- package/lib/service/worker/runtime/events/middlewares/body.js +26 -0
- package/lib/service/worker/runtime/events/middlewares/context.d.ts +3 -0
- package/lib/service/worker/runtime/events/middlewares/context.js +23 -0
- package/lib/service/worker/runtime/events/router.d.ts +2 -0
- package/lib/service/worker/runtime/events/router.js +28 -0
- package/lib/service/worker/runtime/graphql/index.d.ts +6 -0
- package/lib/service/worker/runtime/graphql/index.js +28 -0
- package/lib/service/worker/runtime/graphql/middlewares/context.d.ts +2 -0
- package/lib/service/worker/runtime/graphql/middlewares/context.js +17 -0
- package/lib/service/worker/runtime/graphql/middlewares/error.js +97 -0
- package/lib/service/worker/runtime/graphql/middlewares/query.d.ts +3 -0
- package/lib/service/worker/runtime/graphql/middlewares/query.js +53 -0
- package/lib/service/worker/runtime/graphql/middlewares/response.js +39 -0
- package/lib/service/worker/runtime/graphql/middlewares/run.d.ts +2 -0
- package/lib/service/worker/runtime/graphql/middlewares/run.js +20 -0
- package/lib/service/worker/runtime/graphql/middlewares/updateSchema.d.ts +5 -0
- package/lib/service/worker/runtime/graphql/middlewares/updateSchema.js +29 -0
- package/lib/service/worker/runtime/graphql/middlewares/upload.d.ts +4 -0
- package/lib/service/{graphql → worker/runtime/graphql}/middlewares/upload.js +1 -0
- package/lib/service/worker/runtime/graphql/schema/index.d.ts +7 -0
- package/lib/service/worker/runtime/graphql/schema/index.js +32 -0
- package/lib/service/worker/runtime/graphql/schema/messagesLoaderV2.d.ts +6 -0
- package/lib/service/worker/runtime/graphql/schema/messagesLoaderV2.js +80 -0
- package/lib/service/{graphql → worker/runtime/graphql}/schema/schemaDirectives/Auth.d.ts +1 -0
- package/lib/service/{graphql → worker/runtime/graphql}/schema/schemaDirectives/Auth.js +17 -10
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/CacheControl.d.ts +7 -0
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/CacheControl.js +38 -0
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/Deprecated.d.ts +11 -0
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/Deprecated.js +62 -0
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/Metric.d.ts +7 -0
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/Metric.js +41 -0
- package/lib/service/{graphql → worker/runtime/graphql}/schema/schemaDirectives/Sanitize.d.ts +1 -0
- package/lib/service/{graphql → worker/runtime/graphql}/schema/schemaDirectives/Sanitize.js +7 -0
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/Settings.d.ts +6 -0
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/Settings.js +35 -0
- package/lib/service/{graphql → worker/runtime/graphql}/schema/schemaDirectives/SmartCacheDirective.d.ts +1 -0
- package/lib/service/{graphql → worker/runtime/graphql}/schema/schemaDirectives/SmartCacheDirective.js +9 -3
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/TranslatableV2.d.ts +7 -0
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/TranslatableV2.js +40 -0
- package/lib/service/{graphql/schema/schemaDirectives/Translatable.d.ts → worker/runtime/graphql/schema/schemaDirectives/TranslateTo.d.ts} +2 -1
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/TranslateTo.js +34 -0
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/index.d.ts +22 -0
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/index.js +37 -0
- package/lib/service/worker/runtime/graphql/schema/typeDefs/index.d.ts +8 -0
- package/lib/service/worker/runtime/graphql/schema/typeDefs/index.js +13 -0
- package/lib/service/{graphql → worker/runtime/graphql}/schema/typeDefs/ioUpload.js +1 -0
- package/lib/service/{graphql → worker/runtime/graphql}/schema/typeDefs/sanitizedString.js +6 -1
- package/lib/service/worker/runtime/graphql/typings.d.ts +31 -0
- package/lib/service/worker/runtime/graphql/utils/cacheControl.d.ts +2 -0
- package/lib/service/worker/runtime/graphql/utils/cacheControl.js +33 -0
- package/lib/service/worker/runtime/graphql/utils/error.d.ts +2 -0
- package/lib/service/worker/runtime/graphql/utils/error.js +77 -0
- package/lib/service/{graphql → worker/runtime/graphql}/utils/pathname.js +1 -0
- package/lib/service/worker/runtime/graphql/utils/translations.d.ts +14 -0
- package/lib/service/worker/runtime/graphql/utils/translations.js +39 -0
- package/lib/service/worker/runtime/http/index.d.ts +5 -0
- package/lib/service/worker/runtime/http/index.js +59 -0
- package/lib/service/worker/runtime/http/middlewares/authTokens.d.ts +3 -0
- package/lib/service/{http → worker/runtime/http}/middlewares/authTokens.js +1 -0
- package/lib/service/worker/runtime/http/middlewares/cancellationToken.d.ts +3 -0
- package/lib/service/{http → worker/runtime/http}/middlewares/cancellationToken.js +3 -1
- package/lib/service/worker/runtime/http/middlewares/clients.d.ts +4 -0
- package/lib/service/{http → worker/runtime/http}/middlewares/clients.js +1 -0
- package/lib/service/worker/runtime/http/middlewares/context.d.ts +4 -0
- package/lib/service/worker/runtime/http/middlewares/context.js +37 -0
- package/lib/service/worker/runtime/http/middlewares/error.d.ts +2 -0
- package/lib/service/{http → worker/runtime/http}/middlewares/error.js +28 -15
- package/lib/service/worker/runtime/http/middlewares/rateLimit.d.ts +6 -0
- package/lib/service/worker/runtime/http/middlewares/rateLimit.js +43 -0
- package/lib/service/{http → worker/runtime/http}/middlewares/requestStats.d.ts +3 -3
- package/lib/service/{http → worker/runtime/http}/middlewares/requestStats.js +1 -0
- package/lib/service/worker/runtime/http/middlewares/setCookie.d.ts +3 -0
- package/lib/service/{http → worker/runtime/http}/middlewares/setCookie.js +1 -0
- package/lib/service/worker/runtime/http/middlewares/settings.d.ts +9 -0
- package/lib/service/worker/runtime/http/middlewares/settings.js +45 -0
- package/lib/service/worker/runtime/http/middlewares/timings.d.ts +3 -0
- package/lib/service/{http → worker/runtime/http}/middlewares/timings.js +22 -8
- package/lib/service/worker/runtime/http/middlewares/vary.d.ts +3 -0
- package/lib/service/{http → worker/runtime/http}/middlewares/vary.js +4 -3
- package/lib/service/worker/runtime/http/router.d.ts +2 -0
- package/lib/service/worker/runtime/http/router.js +24 -0
- package/lib/service/worker/runtime/http/routes.d.ts +19 -0
- package/lib/service/worker/runtime/http/routes.js +13 -0
- package/lib/service/worker/runtime/method.d.ts +9 -0
- package/lib/service/{method.js → worker/runtime/method.js} +1 -0
- package/lib/service/worker/runtime/statusTrack.d.ts +14 -0
- package/lib/service/worker/runtime/statusTrack.js +38 -0
- package/lib/service/{typings.d.ts → worker/runtime/typings.d.ts} +70 -36
- package/lib/service/worker/runtime/utils/compose.d.ts +5 -0
- package/lib/service/{utils → worker/runtime/utils}/compose.js +3 -2
- package/lib/service/worker/runtime/utils/context.d.ts +5 -0
- package/lib/service/worker/runtime/utils/context.js +41 -0
- package/lib/service/worker/runtime/utils/diff.d.ts +12 -0
- package/lib/service/worker/runtime/utils/diff.js +22 -0
- package/lib/service/worker/runtime/utils/recorder.d.ts +8 -0
- package/lib/service/worker/runtime/utils/recorder.js +38 -0
- package/lib/service/{graphql/utils/array.js → worker/runtime/utils/toArray.js} +1 -0
- package/lib/service/worker/runtime/utils/tokenBucket.d.ts +2 -0
- package/lib/service/worker/runtime/utils/tokenBucket.js +17 -0
- package/lib/tracing/LogEvents.d.ts +31 -0
- package/lib/tracing/LogEvents.js +3 -0
- package/lib/tracing/LogFields.d.ts +66 -0
- package/lib/tracing/LogFields.js +3 -0
- package/lib/tracing/Tags.d.ts +81 -0
- package/lib/tracing/Tags.js +8 -0
- package/lib/tracing/UserLandTracer.d.ts +27 -0
- package/lib/tracing/UserLandTracer.js +57 -0
- package/lib/tracing/errorReporting/ErrorReport.d.ts +31 -0
- package/lib/tracing/errorReporting/ErrorReport.js +71 -0
- package/lib/tracing/index.d.ts +9 -0
- package/lib/tracing/index.js +20 -0
- package/lib/tracing/spanReference/SpanReferenceTypes.d.ts +4 -0
- package/lib/tracing/spanReference/SpanReferenceTypes.js +8 -0
- package/lib/tracing/spanReference/createSpanReference.d.ts +3 -0
- package/lib/tracing/spanReference/createSpanReference.js +9 -0
- package/lib/tracing/utils.d.ts +13 -0
- package/lib/tracing/utils.js +41 -0
- package/lib/utils/MineWinsConflictsResolver.d.ts +6 -4
- package/lib/utils/MineWinsConflictsResolver.js +35 -17
- package/lib/utils/app.d.ts +3 -1
- package/lib/utils/app.js +4 -1
- package/lib/utils/appsStaleIfError.d.ts +1 -1
- package/lib/utils/appsStaleIfError.js +20 -7
- package/lib/utils/billingOptions.d.ts +36 -3
- package/lib/utils/billingOptions.js +8 -3
- package/lib/utils/binding.d.ts +3 -3
- package/lib/utils/binding.js +1 -0
- package/lib/utils/buildFullPath.d.ts +11 -0
- package/lib/utils/buildFullPath.js +54 -0
- package/lib/utils/cancel.d.ts +2 -2
- package/lib/utils/cancel.js +3 -1
- package/lib/utils/conflicts.mock.d.ts +17 -0
- package/lib/utils/conflicts.mock.js +28 -0
- package/lib/utils/domain.js +1 -0
- package/lib/utils/error.js +1 -0
- package/lib/utils/index.js +19 -12
- package/lib/utils/json.js +1 -0
- package/lib/utils/log.d.ts +1 -3
- package/lib/utils/log.js +3 -2
- package/lib/utils/message.js +5 -1
- package/lib/utils/renameBy.js +1 -0
- package/lib/utils/retry.js +3 -2
- package/lib/utils/status.js +1 -0
- package/lib/utils/tenant.d.ts +3 -3
- package/lib/utils/tenant.js +1 -0
- package/lib/utils/throwOnGraphQLErrors.js +1 -0
- package/lib/utils/time.d.ts +7 -7
- package/lib/utils/time.js +10 -2
- package/package.json +3 -3
- package/lib/HttpClient/IOClient.js +0 -14
- package/lib/HttpClient/factories/index.d.ts +0 -8
- package/lib/HttpClient/factories/index.js +0 -31
- package/lib/HttpClient/middlewares/request.d.ts +0 -10
- package/lib/HttpClient/middlewares/request.js +0 -87
- package/lib/IODataSource.d.ts +0 -27
- package/lib/IODataSource.js +0 -46
- package/lib/clients/Apps.d.ts +0 -84
- package/lib/clients/Apps.js +0 -326
- package/lib/clients/Assets.d.ts +0 -21
- package/lib/clients/Billing.d.ts +0 -11
- package/lib/clients/BillingMetrics.d.ts +0 -12
- package/lib/clients/BillingMetrics.js +0 -10
- package/lib/clients/Events.d.ts +0 -6
- package/lib/clients/Events.js +0 -19
- package/lib/clients/Housekeeper.d.ts +0 -11
- package/lib/clients/Housekeeper.js +0 -24
- package/lib/clients/ID.d.ts +0 -22
- package/lib/clients/ID.js +0 -48
- package/lib/clients/LicenseManager.d.ts +0 -6
- package/lib/clients/Logger.d.ts +0 -27
- package/lib/clients/Logger.js +0 -32
- package/lib/clients/Messages.d.ts +0 -18
- package/lib/clients/Messages.js +0 -20
- package/lib/clients/MessagesGraphQL.d.ts +0 -63
- package/lib/clients/MessagesGraphQL.js +0 -50
- package/lib/clients/Metadata.d.ts +0 -25
- package/lib/clients/Metadata.js +0 -53
- package/lib/clients/Registry.d.ts +0 -61
- package/lib/clients/Router.d.ts +0 -33
- package/lib/clients/Router.js +0 -50
- package/lib/clients/Segment.js +0 -69
- package/lib/clients/Sphinx.d.ts +0 -12
- package/lib/clients/Sphinx.js +0 -19
- package/lib/clients/Tenant.js +0 -13
- package/lib/clients/VBase.d.ts +0 -57
- package/lib/clients/VBase.js +0 -116
- package/lib/clients/Workspaces.d.ts +0 -17
- package/lib/clients/Workspaces.js +0 -38
- package/lib/service/Runtime.d.ts +0 -18
- package/lib/service/Runtime.js +0 -57
- package/lib/service/events/index.d.ts +0 -3
- package/lib/service/events/index.js +0 -21
- package/lib/service/graphql/index.d.ts +0 -7
- package/lib/service/graphql/index.js +0 -33
- package/lib/service/graphql/middlewares/error.js +0 -107
- package/lib/service/graphql/middlewares/formatters.d.ts +0 -2
- package/lib/service/graphql/middlewares/formatters.js +0 -64
- package/lib/service/graphql/middlewares/query.d.ts +0 -2
- package/lib/service/graphql/middlewares/query.js +0 -32
- package/lib/service/graphql/middlewares/response.js +0 -36
- package/lib/service/graphql/middlewares/run.d.ts +0 -4
- package/lib/service/graphql/middlewares/run.js +0 -55
- package/lib/service/graphql/middlewares/schema.d.ts +0 -2
- package/lib/service/graphql/middlewares/schema.js +0 -8
- package/lib/service/graphql/middlewares/timings.d.ts +0 -2
- package/lib/service/graphql/middlewares/timings.js +0 -10
- package/lib/service/graphql/middlewares/upload.d.ts +0 -7
- package/lib/service/graphql/schema/index.d.ts +0 -3
- package/lib/service/graphql/schema/index.js +0 -66
- package/lib/service/graphql/schema/messagesLoader.d.ts +0 -4
- package/lib/service/graphql/schema/messagesLoader.js +0 -41
- package/lib/service/graphql/schema/messagesLoaderV2.d.ts +0 -5
- package/lib/service/graphql/schema/messagesLoaderV2.js +0 -44
- package/lib/service/graphql/schema/schemaDirectives/Translatable.js +0 -54
- package/lib/service/graphql/schema/schemaDirectives/TranslatableV2.d.ts +0 -13
- package/lib/service/graphql/schema/schemaDirectives/TranslatableV2.js +0 -67
- package/lib/service/graphql/schema/schemaDirectives/index.d.ts +0 -13
- package/lib/service/graphql/schema/schemaDirectives/index.js +0 -17
- package/lib/service/graphql/schema/typeDefs/index.d.ts +0 -16
- package/lib/service/graphql/schema/typeDefs/index.js +0 -21
- package/lib/service/graphql/schema/typeDefs/ioMessage.d.ts +0 -8
- package/lib/service/graphql/schema/typeDefs/ioMessage.js +0 -33
- package/lib/service/graphql/typings.d.ts +0 -21
- package/lib/service/graphql/utils/cacheControl.d.ts +0 -6
- package/lib/service/graphql/utils/cacheControl.js +0 -38
- package/lib/service/graphql/utils/maxAgeEnum.d.ts +0 -6
- package/lib/service/graphql/utils/maxAgeEnum.js +0 -17
- package/lib/service/http/index.d.ts +0 -3
- package/lib/service/http/index.js +0 -18
- package/lib/service/http/middlewares/authTokens.d.ts +0 -3
- package/lib/service/http/middlewares/cancellationToken.d.ts +0 -3
- package/lib/service/http/middlewares/clients.d.ts +0 -4
- package/lib/service/http/middlewares/error.d.ts +0 -3
- package/lib/service/http/middlewares/setCookie.d.ts +0 -3
- package/lib/service/http/middlewares/timings.d.ts +0 -3
- package/lib/service/http/middlewares/vary.d.ts +0 -3
- package/lib/service/method.d.ts +0 -9
- package/lib/service/utils/compose.d.ts +0 -4
- package/lib/utils/MineWinsConflictsResolver.test.d.ts +0 -1
- package/lib/utils/MineWinsConflictsResolver.test.js +0 -134
- package/lib/utils/unhandled.d.ts +0 -1
- /package/lib/service/{graphql → worker/runtime/graphql}/middlewares/error.d.ts +0 -0
- /package/lib/service/{graphql → worker/runtime/graphql}/middlewares/response.d.ts +0 -0
- /package/lib/service/{graphql → worker/runtime/graphql}/schema/typeDefs/ioUpload.d.ts +0 -0
- /package/lib/service/{graphql → worker/runtime/graphql}/schema/typeDefs/sanitizedString.d.ts +0 -0
- /package/lib/service/{graphql → worker/runtime/graphql}/typings.js +0 -0
- /package/lib/service/{graphql → worker/runtime/graphql}/utils/pathname.d.ts +0 -0
- /package/lib/service/{typings.js → worker/runtime/typings.js} +0 -0
- /package/lib/service/{graphql/utils/array.d.ts → worker/runtime/utils/toArray.d.ts} +0 -0
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { AppGraphQLClient, InstanceOptions } from '../HttpClient';
|
|
2
|
-
import { IOContext } from '../service/typings';
|
|
3
|
-
import { IOMessage } from '../utils/message';
|
|
4
|
-
declare type IOMessageInput = Pick<IOMessage, 'id' | 'content' | 'description' | 'behavior'>;
|
|
5
|
-
export interface IndexedMessageV2 {
|
|
6
|
-
messages: IOMessageInputV2[];
|
|
7
|
-
from: string;
|
|
8
|
-
}
|
|
9
|
-
export interface IOMessageInputV2 {
|
|
10
|
-
content: string;
|
|
11
|
-
context?: string;
|
|
12
|
-
behavior?: Behavior;
|
|
13
|
-
withAppsMetaInfo?: boolean;
|
|
14
|
-
}
|
|
15
|
-
export declare type Behavior = 'FULL' | 'USER_ONLY' | 'USER_AND_APP';
|
|
16
|
-
export interface IOMessageV2 extends IOMessageInputV2 {
|
|
17
|
-
from: string;
|
|
18
|
-
to: string;
|
|
19
|
-
}
|
|
20
|
-
interface MessagesInput {
|
|
21
|
-
provider: string;
|
|
22
|
-
messages: IOMessageInput[];
|
|
23
|
-
}
|
|
24
|
-
export interface IOMessageSaveInput extends IOMessageInput {
|
|
25
|
-
content: string;
|
|
26
|
-
}
|
|
27
|
-
export interface MessageSaveInputV2 {
|
|
28
|
-
srcLang: string;
|
|
29
|
-
srcMessage: string;
|
|
30
|
-
context?: string;
|
|
31
|
-
targetMessage: string;
|
|
32
|
-
groupContext?: string;
|
|
33
|
-
}
|
|
34
|
-
export interface Translate {
|
|
35
|
-
messages: MessagesInput[];
|
|
36
|
-
from?: string;
|
|
37
|
-
to: string;
|
|
38
|
-
}
|
|
39
|
-
export interface TranslateInputV2 {
|
|
40
|
-
indexedByFrom: IndexedMessageV2[];
|
|
41
|
-
to: string;
|
|
42
|
-
depTree?: string;
|
|
43
|
-
}
|
|
44
|
-
export interface SaveArgs {
|
|
45
|
-
to: string;
|
|
46
|
-
messagesByProvider: Array<{
|
|
47
|
-
messages: IOMessageSaveInput[];
|
|
48
|
-
provider: string;
|
|
49
|
-
}>;
|
|
50
|
-
}
|
|
51
|
-
export interface SaveArgsV2 {
|
|
52
|
-
fireEvent?: boolean;
|
|
53
|
-
to: string;
|
|
54
|
-
messages: MessageSaveInputV2[];
|
|
55
|
-
}
|
|
56
|
-
export declare class MessagesGraphQL extends AppGraphQLClient {
|
|
57
|
-
constructor(vtex: IOContext, options?: InstanceOptions);
|
|
58
|
-
translate: (args: Translate) => Promise<string[]>;
|
|
59
|
-
translateV2: (args: TranslateInputV2) => Promise<string[]>;
|
|
60
|
-
save: (args: SaveArgs) => Promise<boolean>;
|
|
61
|
-
saveV2: (args: SaveArgsV2) => Promise<boolean>;
|
|
62
|
-
}
|
|
63
|
-
export {};
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const ramda_1 = require("ramda");
|
|
4
|
-
const HttpClient_1 = require("../HttpClient");
|
|
5
|
-
class MessagesGraphQL extends HttpClient_1.AppGraphQLClient {
|
|
6
|
-
constructor(vtex, options) {
|
|
7
|
-
super('vtex.messages@1.x', vtex, options);
|
|
8
|
-
this.translate = async (args) => this.graphql.query({
|
|
9
|
-
query: `
|
|
10
|
-
query Translate($args: NewTranslateArgs!) {
|
|
11
|
-
newTranslate(args: $args)
|
|
12
|
-
}
|
|
13
|
-
`,
|
|
14
|
-
variables: { args },
|
|
15
|
-
}, {
|
|
16
|
-
metric: 'messages-translate',
|
|
17
|
-
}).then(ramda_1.path(['data', 'newTranslate']));
|
|
18
|
-
this.translateV2 = (args) => this.graphql.query({
|
|
19
|
-
query: `
|
|
20
|
-
query Translate($args: TranslateArgs!) {
|
|
21
|
-
translate(args: $args)
|
|
22
|
-
}
|
|
23
|
-
`,
|
|
24
|
-
variables: { args },
|
|
25
|
-
}, {
|
|
26
|
-
metric: 'messages-translate-v2',
|
|
27
|
-
}).then(ramda_1.path(['data', 'translate']));
|
|
28
|
-
this.save = (args) => this.graphql.mutate({
|
|
29
|
-
mutate: `
|
|
30
|
-
mutation Save($args: SaveArgs!) {
|
|
31
|
-
save(args: $args)
|
|
32
|
-
}
|
|
33
|
-
`,
|
|
34
|
-
variables: { args },
|
|
35
|
-
}, {
|
|
36
|
-
metric: 'messages-save-translation',
|
|
37
|
-
}).then(ramda_1.path(['data', 'save']));
|
|
38
|
-
this.saveV2 = (args) => this.graphql.mutate({
|
|
39
|
-
mutate: `
|
|
40
|
-
mutation SaveV2($args: SaveArgsV2!) {
|
|
41
|
-
saveV2(args: $args)
|
|
42
|
-
}
|
|
43
|
-
`,
|
|
44
|
-
variables: { args },
|
|
45
|
-
}, {
|
|
46
|
-
metric: 'messages-saveV2-translation',
|
|
47
|
-
}).then(ramda_1.path(['data', 'saveV2']));
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
exports.MessagesGraphQL = MessagesGraphQL;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { InfraClient, InstanceOptions } from '../HttpClient';
|
|
2
|
-
import { BucketMetadata } from '../responses';
|
|
3
|
-
import { IOContext } from '../service/typings';
|
|
4
|
-
export interface MetadataEntry {
|
|
5
|
-
Key: string;
|
|
6
|
-
Hash: string;
|
|
7
|
-
Value: any;
|
|
8
|
-
}
|
|
9
|
-
export interface MetadataEntryList {
|
|
10
|
-
Data: MetadataEntry[];
|
|
11
|
-
Next: string;
|
|
12
|
-
}
|
|
13
|
-
export declare class Metadata extends InfraClient {
|
|
14
|
-
constructor(context: IOContext, options?: InstanceOptions);
|
|
15
|
-
getBuckets: (bucket: string) => Promise<BucketMetadata>;
|
|
16
|
-
list: (bucket: string, includeValue: boolean, limit?: number | undefined, nextMarker?: string | undefined) => Promise<MetadataEntryList>;
|
|
17
|
-
listAll: (bucket: string, includeValue: boolean) => Promise<MetadataEntryList>;
|
|
18
|
-
get: (bucket: string, key: string) => Promise<any>;
|
|
19
|
-
save: (bucket: string, key: string, data: any) => Promise<void>;
|
|
20
|
-
saveAll: (bucket: string, data: {
|
|
21
|
-
[key: string]: any;
|
|
22
|
-
}) => Promise<void>;
|
|
23
|
-
delete: (bucket: string, key: string) => Promise<import("../HttpClient").IOResponse<void>>;
|
|
24
|
-
deleteAll: (bucket: string) => Promise<import("../HttpClient").IOResponse<void>>;
|
|
25
|
-
}
|
package/lib/clients/Metadata.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const HttpClient_1 = require("../HttpClient");
|
|
4
|
-
const appId = process.env.VTEX_APP_ID;
|
|
5
|
-
const [runningAppName] = appId ? appId.split('@') : [''];
|
|
6
|
-
const routes = {
|
|
7
|
-
Bucket: (bucket) => `/buckets/${runningAppName}/${bucket}`,
|
|
8
|
-
Metadata: (bucket) => `${routes.Bucket(bucket)}/metadata`,
|
|
9
|
-
MetadataKey: (bucket, key) => `${routes.Metadata(bucket)}/${key}`,
|
|
10
|
-
};
|
|
11
|
-
class Metadata extends HttpClient_1.InfraClient {
|
|
12
|
-
constructor(context, options) {
|
|
13
|
-
super('router', context, options);
|
|
14
|
-
this.getBuckets = (bucket) => {
|
|
15
|
-
return this.http.get(routes.Bucket(bucket), { metric: 'meta-get-buckets' });
|
|
16
|
-
};
|
|
17
|
-
this.list = (bucket, includeValue, limit, nextMarker) => {
|
|
18
|
-
const query = { value: includeValue, _limit: 10 };
|
|
19
|
-
if (limit && limit > 0) {
|
|
20
|
-
query._limit = limit;
|
|
21
|
-
}
|
|
22
|
-
if (nextMarker) {
|
|
23
|
-
query._marker = nextMarker;
|
|
24
|
-
}
|
|
25
|
-
const metric = 'meta-list';
|
|
26
|
-
return this.http.get(routes.Metadata(bucket), { params: query, metric });
|
|
27
|
-
};
|
|
28
|
-
this.listAll = (bucket, includeValue) => {
|
|
29
|
-
const query = { value: includeValue, _limit: 1000 };
|
|
30
|
-
const metric = 'meta-list-all';
|
|
31
|
-
return this.http.get(routes.Metadata(bucket), { params: query, metric });
|
|
32
|
-
};
|
|
33
|
-
this.get = (bucket, key) => {
|
|
34
|
-
return this.http.get(routes.MetadataKey(bucket, key), { metric: 'meta-get' });
|
|
35
|
-
};
|
|
36
|
-
this.save = (bucket, key, data) => {
|
|
37
|
-
return this.http.put(routes.MetadataKey(bucket, key), data, { metric: 'meta-save' });
|
|
38
|
-
};
|
|
39
|
-
this.saveAll = (bucket, data) => {
|
|
40
|
-
return this.http.put(routes.Metadata(bucket), data, { metric: 'meta-save-all' });
|
|
41
|
-
};
|
|
42
|
-
this.delete = (bucket, key) => {
|
|
43
|
-
return this.http.delete(routes.MetadataKey(bucket, key), { metric: 'meta-delete' });
|
|
44
|
-
};
|
|
45
|
-
this.deleteAll = (bucket) => {
|
|
46
|
-
return this.http.delete(routes.Metadata(bucket), { metric: 'meta-delete-all' });
|
|
47
|
-
};
|
|
48
|
-
if (runningAppName === '') {
|
|
49
|
-
throw new Error(`Invalid path to access Metadata. Variable VTEX_APP_ID is not available.`);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
exports.Metadata = Metadata;
|
|
@@ -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/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/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
|
-
}
|