@vtex/api 6.45.4
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/CHANGELOG.md +1685 -0
- package/README.md +65 -0
- package/gen/manifest.schema +189 -0
- package/lib/HttpClient/GraphQLClient.d.ts +28 -0
- package/lib/HttpClient/GraphQLClient.js +30 -0
- package/lib/HttpClient/HttpClient.d.ts +29 -0
- package/lib/HttpClient/HttpClient.js +130 -0
- package/lib/HttpClient/agents.d.ts +3 -0
- package/lib/HttpClient/agents.js +24 -0
- package/lib/HttpClient/index.d.ts +6 -0
- package/lib/HttpClient/index.js +14 -0
- package/lib/HttpClient/middlewares/cache.d.ts +35 -0
- package/lib/HttpClient/middlewares/cache.js +173 -0
- package/lib/HttpClient/middlewares/cancellationToken.d.ts +3 -0
- package/lib/HttpClient/middlewares/cancellationToken.js +72 -0
- package/lib/HttpClient/middlewares/inflight.d.ts +5 -0
- package/lib/HttpClient/middlewares/inflight.js +50 -0
- package/lib/HttpClient/middlewares/memoization.d.ts +7 -0
- package/lib/HttpClient/middlewares/memoization.js +40 -0
- package/lib/HttpClient/middlewares/metrics.d.ts +9 -0
- package/lib/HttpClient/middlewares/metrics.js +110 -0
- package/lib/HttpClient/middlewares/notFound.d.ts +7 -0
- package/lib/HttpClient/middlewares/notFound.js +20 -0
- package/lib/HttpClient/middlewares/recorder.d.ts +3 -0
- package/lib/HttpClient/middlewares/recorder.js +21 -0
- package/lib/HttpClient/middlewares/request/HttpAgentSingleton.d.ts +14 -0
- package/lib/HttpClient/middlewares/request/HttpAgentSingleton.js +37 -0
- package/lib/HttpClient/middlewares/request/index.d.ts +18 -0
- package/lib/HttpClient/middlewares/request/index.js +83 -0
- package/lib/HttpClient/middlewares/request/setupAxios/index.d.ts +1 -0
- package/lib/HttpClient/middlewares/request/setupAxios/index.js +20 -0
- package/lib/HttpClient/middlewares/request/setupAxios/interceptors/exponentialBackoff.d.ts +2 -0
- package/lib/HttpClient/middlewares/request/setupAxios/interceptors/exponentialBackoff.js +48 -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 +51 -0
- package/lib/HttpClient/middlewares/request/setupAxios/interceptors/tracing/spanSetup.d.ts +4 -0
- package/lib/HttpClient/middlewares/request/setupAxios/interceptors/tracing/spanSetup.js +29 -0
- package/lib/HttpClient/middlewares/tracing.d.ts +15 -0
- package/lib/HttpClient/middlewares/tracing.js +54 -0
- package/lib/HttpClient/typings.d.ts +123 -0
- package/lib/HttpClient/typings.js +11 -0
- package/lib/caches/CacheLayer.d.ts +7 -0
- package/lib/caches/CacheLayer.js +2 -0
- package/lib/caches/DiskCache.d.ts +17 -0
- package/lib/caches/DiskCache.js +70 -0
- package/lib/caches/LRUCache.d.ts +16 -0
- package/lib/caches/LRUCache.js +48 -0
- package/lib/caches/LRUDiskCache.d.ts +21 -0
- package/lib/caches/LRUDiskCache.js +132 -0
- package/lib/caches/MultilayeredCache.d.ts +14 -0
- package/lib/caches/MultilayeredCache.js +68 -0
- package/lib/caches/index.d.ts +6 -0
- package/lib/caches/index.js +9 -0
- package/lib/caches/typings.d.ts +48 -0
- package/lib/caches/typings.js +2 -0
- package/lib/clients/IOClient.d.ts +13 -0
- package/lib/clients/IOClient.js +19 -0
- package/lib/clients/IOClients.d.ts +37 -0
- package/lib/clients/IOClients.js +89 -0
- package/lib/clients/IOGraphQLClient.d.ts +13 -0
- package/lib/clients/IOGraphQLClient.js +16 -0
- package/lib/clients/apps/AppClient.d.ts +9 -0
- package/lib/clients/apps/AppClient.js +34 -0
- package/lib/clients/apps/AppGraphQLClient.d.ts +9 -0
- package/lib/clients/apps/AppGraphQLClient.js +34 -0
- package/lib/clients/apps/Billing.d.ts +12 -0
- package/lib/clients/apps/Billing.js +21 -0
- package/lib/clients/apps/Builder.d.ts +45 -0
- package/lib/clients/apps/Builder.js +114 -0
- package/lib/clients/apps/MessagesGraphQL.d.ts +61 -0
- package/lib/clients/apps/MessagesGraphQL.js +121 -0
- package/lib/clients/apps/Settings.d.ts +14 -0
- package/lib/clients/apps/Settings.js +38 -0
- package/lib/clients/apps/catalogGraphQL/brand.d.ts +13 -0
- package/lib/clients/apps/catalogGraphQL/brand.js +18 -0
- package/lib/clients/apps/catalogGraphQL/category.d.ts +11 -0
- package/lib/clients/apps/catalogGraphQL/category.js +16 -0
- package/lib/clients/apps/catalogGraphQL/index.d.ts +22 -0
- package/lib/clients/apps/catalogGraphQL/index.js +88 -0
- package/lib/clients/apps/catalogGraphQL/product.d.ts +25 -0
- package/lib/clients/apps/catalogGraphQL/product.js +30 -0
- package/lib/clients/apps/catalogGraphQL/sku.d.ts +26 -0
- package/lib/clients/apps/catalogGraphQL/sku.js +30 -0
- package/lib/clients/apps/index.d.ts +7 -0
- package/lib/clients/apps/index.js +12 -0
- package/lib/clients/external/ExternalClient.d.ts +9 -0
- package/lib/clients/external/ExternalClient.js +21 -0
- package/lib/clients/external/ID.d.ts +23 -0
- package/lib/clients/external/ID.js +60 -0
- package/lib/clients/external/Masterdata.d.ts +93 -0
- package/lib/clients/external/Masterdata.js +223 -0
- package/lib/clients/external/PaymentProvider.d.ts +31 -0
- package/lib/clients/external/PaymentProvider.js +42 -0
- package/lib/clients/external/index.d.ts +4 -0
- package/lib/clients/external/index.js +9 -0
- package/lib/clients/index.d.ts +9 -0
- package/lib/clients/index.js +17 -0
- package/lib/clients/infra/Apps.d.ts +88 -0
- package/lib/clients/infra/Apps.js +508 -0
- package/lib/clients/infra/Assets.d.ts +34 -0
- package/lib/clients/infra/Assets.js +165 -0
- package/lib/clients/infra/BillingMetrics.d.ts +13 -0
- package/lib/clients/infra/BillingMetrics.js +15 -0
- package/lib/clients/infra/Events.d.ts +12 -0
- package/lib/clients/infra/Events.js +33 -0
- package/lib/clients/infra/Housekeeper.d.ts +10 -0
- package/lib/clients/infra/Housekeeper.js +30 -0
- package/lib/clients/infra/InfraClient.d.ts +9 -0
- package/lib/clients/infra/InfraClient.js +34 -0
- package/lib/clients/infra/Metadata.d.ts +26 -0
- package/lib/clients/infra/Metadata.js +83 -0
- package/lib/clients/infra/Registry.d.ts +59 -0
- package/lib/clients/infra/Registry.js +207 -0
- package/lib/clients/infra/Router.d.ts +34 -0
- package/lib/clients/infra/Router.js +81 -0
- package/lib/clients/infra/Sphinx.d.ts +13 -0
- package/lib/clients/infra/Sphinx.js +29 -0
- package/lib/clients/infra/VBase.d.ts +60 -0
- package/lib/clients/infra/VBase.js +171 -0
- package/lib/clients/infra/Workspaces.d.ts +18 -0
- package/lib/clients/infra/Workspaces.js +65 -0
- package/lib/clients/infra/index.d.ts +12 -0
- package/lib/clients/infra/index.js +17 -0
- package/lib/clients/janus/JanusClient.d.ts +21 -0
- package/lib/clients/janus/JanusClient.js +30 -0
- package/lib/clients/janus/LicenseManager.d.ts +7 -0
- package/lib/clients/janus/LicenseManager.js +58 -0
- package/lib/clients/janus/Segment.d.ts +36 -0
- package/lib/clients/janus/Segment.js +79 -0
- package/lib/clients/janus/Session.d.ts +15 -0
- package/lib/clients/janus/Session.js +75 -0
- package/lib/clients/janus/Tenant.d.ts +29 -0
- package/lib/clients/janus/Tenant.js +28 -0
- package/lib/clients/janus/index.d.ts +5 -0
- package/lib/clients/janus/index.js +10 -0
- package/lib/constants.d.ts +59 -0
- package/lib/constants.js +65 -0
- package/lib/errors/AuthenticationError.d.ts +18 -0
- package/lib/errors/AuthenticationError.js +24 -0
- package/lib/errors/ForbiddenError.d.ts +18 -0
- package/lib/errors/ForbiddenError.js +24 -0
- package/lib/errors/NotFoundError.d.ts +18 -0
- package/lib/errors/NotFoundError.js +24 -0
- package/lib/errors/RequestCancelledError.d.ts +6 -0
- package/lib/errors/RequestCancelledError.js +11 -0
- package/lib/errors/ResolverError.d.ts +29 -0
- package/lib/errors/ResolverError.js +35 -0
- package/lib/errors/ResolverWarning.d.ts +21 -0
- package/lib/errors/ResolverWarning.js +28 -0
- package/lib/errors/TooManyRequestsError.d.ts +4 -0
- package/lib/errors/TooManyRequestsError.js +9 -0
- package/lib/errors/UserInputError.d.ts +18 -0
- package/lib/errors/UserInputError.js +24 -0
- package/lib/errors/customGraphQLError.d.ts +4 -0
- package/lib/errors/customGraphQLError.js +9 -0
- package/lib/errors/index.d.ts +8 -0
- package/lib/errors/index.js +13 -0
- package/lib/index.d.ts +17 -0
- package/lib/index.js +21 -0
- package/lib/metrics/MetricsAccumulator.d.ts +35 -0
- package/lib/metrics/MetricsAccumulator.js +125 -0
- package/lib/responses.d.ts +79 -0
- package/lib/responses.js +2 -0
- package/lib/service/index.d.ts +2 -0
- package/lib/service/index.js +30 -0
- package/lib/service/loaders.d.ts +8 -0
- package/lib/service/loaders.js +54 -0
- package/lib/service/logger/console.d.ts +10 -0
- package/lib/service/logger/console.js +36 -0
- package/lib/service/logger/index.d.ts +2 -0
- package/lib/service/logger/index.js +7 -0
- package/lib/service/logger/logger.d.ts +35 -0
- package/lib/service/logger/logger.js +73 -0
- package/lib/service/logger/metricsLogger.d.ts +40 -0
- package/lib/service/logger/metricsLogger.js +149 -0
- package/lib/service/master.d.ts +2 -0
- package/lib/service/master.js +91 -0
- package/lib/service/tracing/TracerSingleton.d.ts +7 -0
- package/lib/service/tracing/TracerSingleton.js +54 -0
- package/lib/service/tracing/metrics/MetricNames.d.ts +60 -0
- package/lib/service/tracing/metrics/MetricNames.js +44 -0
- package/lib/service/tracing/metrics/instruments.d.ts +9 -0
- package/lib/service/tracing/metrics/instruments.js +11 -0
- package/lib/service/tracing/metrics/measurers/EventLoopLagMeasurer.d.ts +9 -0
- package/lib/service/tracing/metrics/measurers/EventLoopLagMeasurer.js +25 -0
- package/lib/service/tracing/tracingMiddlewares.d.ts +5 -0
- package/lib/service/tracing/tracingMiddlewares.js +119 -0
- package/lib/service/worker/index.d.ts +11 -0
- package/lib/service/worker/index.js +193 -0
- package/lib/service/worker/listeners.d.ts +3 -0
- package/lib/service/worker/listeners.js +43 -0
- package/lib/service/worker/runtime/Service.d.ts +17 -0
- package/lib/service/worker/runtime/Service.js +23 -0
- package/lib/service/worker/runtime/builtIn/handlers.d.ts +4 -0
- package/lib/service/worker/runtime/builtIn/handlers.js +27 -0
- package/lib/service/worker/runtime/builtIn/middlewares.d.ts +4 -0
- package/lib/service/worker/runtime/builtIn/middlewares.js +40 -0
- package/lib/service/worker/runtime/events/index.d.ts +4 -0
- package/lib/service/worker/runtime/events/index.js +46 -0
- package/lib/service/worker/runtime/events/middlewares/body.d.ts +3 -0
- package/lib/service/worker/runtime/events/middlewares/body.js +22 -0
- package/lib/service/worker/runtime/events/middlewares/context.d.ts +3 -0
- package/lib/service/worker/runtime/events/middlewares/context.js +22 -0
- package/lib/service/worker/runtime/events/router.d.ts +2 -0
- package/lib/service/worker/runtime/events/router.js +27 -0
- package/lib/service/worker/runtime/graphql/index.d.ts +6 -0
- package/lib/service/worker/runtime/graphql/index.js +27 -0
- package/lib/service/worker/runtime/graphql/middlewares/context.d.ts +2 -0
- package/lib/service/worker/runtime/graphql/middlewares/context.js +16 -0
- package/lib/service/worker/runtime/graphql/middlewares/error.d.ts +2 -0
- package/lib/service/worker/runtime/graphql/middlewares/error.js +93 -0
- package/lib/service/worker/runtime/graphql/middlewares/query.d.ts +2 -0
- package/lib/service/worker/runtime/graphql/middlewares/query.js +52 -0
- package/lib/service/worker/runtime/graphql/middlewares/response.d.ts +2 -0
- package/lib/service/worker/runtime/graphql/middlewares/response.js +38 -0
- package/lib/service/worker/runtime/graphql/middlewares/run.d.ts +2 -0
- package/lib/service/worker/runtime/graphql/middlewares/run.js +19 -0
- package/lib/service/worker/runtime/graphql/middlewares/updateSchema.d.ts +4 -0
- package/lib/service/worker/runtime/graphql/middlewares/updateSchema.js +28 -0
- package/lib/service/worker/runtime/graphql/middlewares/upload.d.ts +4 -0
- package/lib/service/worker/runtime/graphql/middlewares/upload.js +12 -0
- package/lib/service/worker/runtime/graphql/schema/index.d.ts +7 -0
- package/lib/service/worker/runtime/graphql/schema/index.js +31 -0
- package/lib/service/worker/runtime/graphql/schema/messagesLoaderV2.d.ts +6 -0
- package/lib/service/worker/runtime/graphql/schema/messagesLoaderV2.js +79 -0
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/Auth.d.ts +6 -0
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/Auth.js +73 -0
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/CacheControl.d.ts +7 -0
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/CacheControl.js +37 -0
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/Deprecated.d.ts +11 -0
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/Deprecated.js +61 -0
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/Metric.d.ts +7 -0
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/Metric.js +40 -0
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/Sanitize.d.ts +9 -0
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/Sanitize.js +35 -0
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/Settings.d.ts +6 -0
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/Settings.js +34 -0
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/SmartCacheDirective.d.ts +6 -0
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/SmartCacheDirective.js +29 -0
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/TranslatableV2.d.ts +7 -0
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/TranslatableV2.js +39 -0
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/TranslateTo.d.ts +7 -0
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/TranslateTo.js +33 -0
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/index.d.ts +22 -0
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/index.js +36 -0
- package/lib/service/worker/runtime/graphql/schema/typeDefs/index.d.ts +7 -0
- package/lib/service/worker/runtime/graphql/schema/typeDefs/index.js +12 -0
- package/lib/service/worker/runtime/graphql/schema/typeDefs/ioUpload.d.ts +3 -0
- package/lib/service/worker/runtime/graphql/schema/typeDefs/ioUpload.js +16 -0
- package/lib/service/worker/runtime/graphql/schema/typeDefs/sanitizedString.d.ts +10 -0
- package/lib/service/worker/runtime/graphql/schema/typeDefs/sanitizedString.js +39 -0
- package/lib/service/worker/runtime/graphql/typings.d.ts +31 -0
- package/lib/service/worker/runtime/graphql/typings.js +2 -0
- package/lib/service/worker/runtime/graphql/utils/cacheControl.d.ts +1 -0
- package/lib/service/worker/runtime/graphql/utils/cacheControl.js +32 -0
- package/lib/service/worker/runtime/graphql/utils/error.d.ts +1 -0
- package/lib/service/worker/runtime/graphql/utils/error.js +76 -0
- package/lib/service/worker/runtime/graphql/utils/pathname.d.ts +1 -0
- package/lib/service/worker/runtime/graphql/utils/pathname.js +7 -0
- package/lib/service/worker/runtime/graphql/utils/translations.d.ts +14 -0
- package/lib/service/worker/runtime/graphql/utils/translations.js +38 -0
- package/lib/service/worker/runtime/http/index.d.ts +5 -0
- package/lib/service/worker/runtime/http/index.js +58 -0
- package/lib/service/worker/runtime/http/middlewares/authTokens.d.ts +3 -0
- package/lib/service/worker/runtime/http/middlewares/authTokens.js +12 -0
- package/lib/service/worker/runtime/http/middlewares/cancellationToken.d.ts +3 -0
- package/lib/service/worker/runtime/http/middlewares/cancellationToken.js +18 -0
- package/lib/service/worker/runtime/http/middlewares/clients.d.ts +4 -0
- package/lib/service/worker/runtime/http/middlewares/clients.js +12 -0
- package/lib/service/worker/runtime/http/middlewares/context.d.ts +4 -0
- package/lib/service/worker/runtime/http/middlewares/context.js +36 -0
- package/lib/service/worker/runtime/http/middlewares/error.d.ts +2 -0
- package/lib/service/worker/runtime/http/middlewares/error.js +84 -0
- package/lib/service/worker/runtime/http/middlewares/rateLimit.d.ts +6 -0
- package/lib/service/worker/runtime/http/middlewares/rateLimit.js +42 -0
- package/lib/service/worker/runtime/http/middlewares/requestStats.d.ts +17 -0
- package/lib/service/worker/runtime/http/middlewares/requestStats.js +40 -0
- package/lib/service/worker/runtime/http/middlewares/setCookie.d.ts +3 -0
- package/lib/service/worker/runtime/http/middlewares/setCookie.js +52 -0
- package/lib/service/worker/runtime/http/middlewares/settings.d.ts +9 -0
- package/lib/service/worker/runtime/http/middlewares/settings.js +43 -0
- package/lib/service/worker/runtime/http/middlewares/timings.d.ts +3 -0
- package/lib/service/worker/runtime/http/middlewares/timings.js +45 -0
- package/lib/service/worker/runtime/http/middlewares/vary.d.ts +3 -0
- package/lib/service/worker/runtime/http/middlewares/vary.js +52 -0
- package/lib/service/worker/runtime/http/router.d.ts +2 -0
- package/lib/service/worker/runtime/http/router.js +23 -0
- package/lib/service/worker/runtime/http/routes.d.ts +19 -0
- package/lib/service/worker/runtime/http/routes.js +12 -0
- package/lib/service/worker/runtime/method.d.ts +9 -0
- package/lib/service/worker/runtime/method.js +23 -0
- package/lib/service/worker/runtime/statusTrack.d.ts +14 -0
- package/lib/service/worker/runtime/statusTrack.js +37 -0
- package/lib/service/worker/runtime/typings.d.ts +172 -0
- package/lib/service/worker/runtime/typings.js +2 -0
- package/lib/service/worker/runtime/utils/compose.d.ts +5 -0
- package/lib/service/worker/runtime/utils/compose.js +11 -0
- package/lib/service/worker/runtime/utils/context.d.ts +2 -0
- package/lib/service/worker/runtime/utils/context.js +40 -0
- package/lib/service/worker/runtime/utils/diff.d.ts +12 -0
- package/lib/service/worker/runtime/utils/diff.js +21 -0
- package/lib/service/worker/runtime/utils/recorder.d.ts +8 -0
- package/lib/service/worker/runtime/utils/recorder.js +37 -0
- package/lib/service/worker/runtime/utils/toArray.d.ts +1 -0
- package/lib/service/worker/runtime/utils/toArray.js +3 -0
- package/lib/service/worker/runtime/utils/tokenBucket.d.ts +2 -0
- package/lib/service/worker/runtime/utils/tokenBucket.js +16 -0
- package/lib/tracing/LogEvents.d.ts +31 -0
- package/lib/tracing/LogEvents.js +3 -0
- package/lib/tracing/LogFields.d.ts +61 -0
- package/lib/tracing/LogFields.js +3 -0
- package/lib/tracing/Tags.d.ts +79 -0
- package/lib/tracing/Tags.js +7 -0
- package/lib/tracing/UserLandTracer.d.ts +27 -0
- package/lib/tracing/UserLandTracer.js +55 -0
- package/lib/tracing/errorReporting/ErrorReport.d.ts +31 -0
- package/lib/tracing/errorReporting/ErrorReport.js +61 -0
- package/lib/tracing/index.d.ts +9 -0
- package/lib/tracing/index.js +19 -0
- package/lib/tracing/spanReference/SpanReferenceTypes.d.ts +4 -0
- package/lib/tracing/spanReference/SpanReferenceTypes.js +7 -0
- package/lib/tracing/spanReference/createSpanReference.d.ts +3 -0
- package/lib/tracing/spanReference/createSpanReference.js +8 -0
- package/lib/tracing/utils.d.ts +13 -0
- package/lib/tracing/utils.js +40 -0
- package/lib/utils/MineWinsConflictsResolver.d.ts +28 -0
- package/lib/utils/MineWinsConflictsResolver.js +130 -0
- package/lib/utils/app.d.ts +23 -0
- package/lib/utils/app.js +48 -0
- package/lib/utils/appsStaleIfError.d.ts +11 -0
- package/lib/utils/appsStaleIfError.js +63 -0
- package/lib/utils/billingOptions.d.ts +36 -0
- package/lib/utils/billingOptions.js +9 -0
- package/lib/utils/binding.d.ts +13 -0
- package/lib/utils/binding.js +38 -0
- package/lib/utils/cancel.d.ts +3 -0
- package/lib/utils/cancel.js +12 -0
- package/lib/utils/domain.d.ts +1 -0
- package/lib/utils/domain.js +5 -0
- package/lib/utils/error.d.ts +8 -0
- package/lib/utils/error.js +94 -0
- package/lib/utils/index.d.ts +9 -0
- package/lib/utils/index.js +14 -0
- package/lib/utils/message.d.ts +25 -0
- package/lib/utils/message.js +23 -0
- package/lib/utils/renameBy.d.ts +1 -0
- package/lib/utils/renameBy.js +4 -0
- package/lib/utils/retry.d.ts +4 -0
- package/lib/utils/retry.js +32 -0
- package/lib/utils/status.d.ts +1 -0
- package/lib/utils/status.js +11 -0
- package/lib/utils/tenant.d.ts +5 -0
- package/lib/utils/tenant.js +6 -0
- package/lib/utils/throwOnGraphQLErrors.d.ts +2 -0
- package/lib/utils/throwOnGraphQLErrors.js +15 -0
- package/lib/utils/time.d.ts +31 -0
- package/lib/utils/time.js +118 -0
- package/package.json +127 -0
|
@@ -0,0 +1,171 @@
|
|
|
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 InfraClient_1 = require("./InfraClient");
|
|
11
|
+
const appId = process.env.VTEX_APP_ID;
|
|
12
|
+
const [runningAppName] = appId ? appId.split('@') : [''];
|
|
13
|
+
const routes = {
|
|
14
|
+
Bucket: (bucket) => `/buckets/${runningAppName}/${bucket}`,
|
|
15
|
+
Conflicts: (bucket) => `/buckets/${runningAppName}/${bucket}/conflicts`,
|
|
16
|
+
File: (bucket, path) => `${routes.Bucket(bucket)}/files/${path}`,
|
|
17
|
+
Files: (bucket) => `${routes.Bucket(bucket)}/files`,
|
|
18
|
+
};
|
|
19
|
+
const isVBaseOptions = (opts) => {
|
|
20
|
+
return typeof opts !== 'string' && !(opts instanceof String);
|
|
21
|
+
};
|
|
22
|
+
class VBase extends InfraClient_1.InfraClient {
|
|
23
|
+
constructor(context, options) {
|
|
24
|
+
super('vbase@2.x', context, options);
|
|
25
|
+
this.getBucket = (bucket, tracingConfig) => {
|
|
26
|
+
const inflightKey = HttpClient_1.inflightURL;
|
|
27
|
+
const metric = 'vbase-get-bucket';
|
|
28
|
+
return this.http.get(routes.Bucket(bucket), { inflightKey, metric, tracing: {
|
|
29
|
+
requestSpanNameSuffix: metric,
|
|
30
|
+
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
31
|
+
} });
|
|
32
|
+
};
|
|
33
|
+
this.resetBucket = (bucket, tracingConfig) => {
|
|
34
|
+
const metric = 'vbase-reset-bucket';
|
|
35
|
+
return this.http.delete(routes.Files(bucket), { metric, tracing: {
|
|
36
|
+
requestSpanNameSuffix: metric,
|
|
37
|
+
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
38
|
+
} });
|
|
39
|
+
};
|
|
40
|
+
this.listFiles = (bucket, opts, tracingConfig) => {
|
|
41
|
+
let params = {};
|
|
42
|
+
if (isVBaseOptions(opts)) {
|
|
43
|
+
params = opts;
|
|
44
|
+
}
|
|
45
|
+
else if (opts) {
|
|
46
|
+
params = { prefix: opts };
|
|
47
|
+
}
|
|
48
|
+
const metric = 'vbase-list';
|
|
49
|
+
const inflightKey = HttpClient_1.inflightUrlWithQuery;
|
|
50
|
+
return this.http.get(routes.Files(bucket), { inflightKey, metric, params, tracing: {
|
|
51
|
+
requestSpanNameSuffix: metric,
|
|
52
|
+
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
53
|
+
} });
|
|
54
|
+
};
|
|
55
|
+
this.getFile = (bucket, path, tracingConfig) => {
|
|
56
|
+
const inflightKey = HttpClient_1.inflightURL;
|
|
57
|
+
const metric = 'vbase-get-file';
|
|
58
|
+
return this.http.getBuffer(routes.File(bucket, path), { inflightKey, metric, tracing: {
|
|
59
|
+
requestSpanNameSuffix: metric,
|
|
60
|
+
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
61
|
+
} });
|
|
62
|
+
};
|
|
63
|
+
this.getJSON = (bucket, path, nullIfNotFound, conflictsResolver, tracingConfig) => {
|
|
64
|
+
return this.getRawJSON(bucket, path, nullIfNotFound, conflictsResolver, tracingConfig)
|
|
65
|
+
.then(response => response.data);
|
|
66
|
+
};
|
|
67
|
+
this.getRawJSON = (bucket, path, nullIfNotFound, conflictsResolver, tracingConfig) => {
|
|
68
|
+
const headers = conflictsResolver ? { 'X-Vtex-Detect-Conflicts': true } : {};
|
|
69
|
+
const inflightKey = HttpClient_1.inflightURL;
|
|
70
|
+
const metric = 'vbase-get-json';
|
|
71
|
+
return this.http.getRaw(routes.File(bucket, path), { headers, inflightKey, metric, nullIfNotFound, tracing: {
|
|
72
|
+
requestSpanNameSuffix: metric,
|
|
73
|
+
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
74
|
+
} })
|
|
75
|
+
.catch(async (error) => {
|
|
76
|
+
const { response } = error;
|
|
77
|
+
if (response && response.status === 409 && conflictsResolver) {
|
|
78
|
+
const conflictsMergedData = await conflictsResolver.resolve(this.context.logger);
|
|
79
|
+
return { ...response, data: conflictsMergedData };
|
|
80
|
+
}
|
|
81
|
+
throw error;
|
|
82
|
+
});
|
|
83
|
+
};
|
|
84
|
+
this.getFileStream = (bucket, path, tracingConfig) => {
|
|
85
|
+
const metric = 'vbase-get-file-s';
|
|
86
|
+
return this.http.getStream(routes.File(bucket, path), { metric, tracing: {
|
|
87
|
+
requestSpanNameSuffix: metric,
|
|
88
|
+
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
89
|
+
} });
|
|
90
|
+
};
|
|
91
|
+
this.saveFile = (bucket, path, stream, gzip = true, ttl, tracingConfig, ifMatch) => {
|
|
92
|
+
return this.saveContent(bucket, path, stream, { gzip, ttl }, tracingConfig, ifMatch);
|
|
93
|
+
};
|
|
94
|
+
this.getFileMetadata = (bucket, path, tracingConfig) => {
|
|
95
|
+
const metric = 'vbase-get-file-metadata';
|
|
96
|
+
return this.http.head(routes.File(bucket, path), { metric, tracing: {
|
|
97
|
+
requestSpanNameSuffix: metric,
|
|
98
|
+
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
99
|
+
} });
|
|
100
|
+
};
|
|
101
|
+
this.saveJSON = (bucket, path, data, tracingConfig, ifMatch) => {
|
|
102
|
+
const headers = { 'Content-Type': 'application/json' };
|
|
103
|
+
if (ifMatch) {
|
|
104
|
+
headers['If-Match'] = ifMatch;
|
|
105
|
+
}
|
|
106
|
+
const metric = 'vbase-save-json';
|
|
107
|
+
return this.http.put(routes.File(bucket, path), data, { headers, metric, tracing: {
|
|
108
|
+
requestSpanNameSuffix: metric,
|
|
109
|
+
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
110
|
+
} });
|
|
111
|
+
};
|
|
112
|
+
this.saveZippedContent = (bucket, path, stream, tracingConfig, ifMatch) => {
|
|
113
|
+
return this.saveContent(bucket, path, stream, { unzip: true }, tracingConfig, ifMatch);
|
|
114
|
+
};
|
|
115
|
+
this.deleteFile = (bucket, path, tracingConfig, ifMatch) => {
|
|
116
|
+
const headers = ifMatch ? { 'If-Match': ifMatch } : null;
|
|
117
|
+
const metric = 'vbase-delete-file';
|
|
118
|
+
return this.http.delete(routes.File(bucket, path), { headers, metric, tracing: {
|
|
119
|
+
requestSpanNameSuffix: metric,
|
|
120
|
+
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
121
|
+
} });
|
|
122
|
+
};
|
|
123
|
+
this.getConflicts = (bucket, tracingConfig) => {
|
|
124
|
+
const metric = 'vbase-get-conflicts';
|
|
125
|
+
return this.http.get(routes.Conflicts(bucket), { metric, tracing: {
|
|
126
|
+
requestSpanNameSuffix: metric,
|
|
127
|
+
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
128
|
+
} });
|
|
129
|
+
};
|
|
130
|
+
this.resolveConflict = (bucket, path, content, tracingConfig) => {
|
|
131
|
+
const data = [{
|
|
132
|
+
op: 'replace',
|
|
133
|
+
path,
|
|
134
|
+
value: content,
|
|
135
|
+
}];
|
|
136
|
+
const metric = 'vbase-resolve-conflicts';
|
|
137
|
+
return this.http.patch(routes.Conflicts(bucket), data, { metric, tracing: {
|
|
138
|
+
requestSpanNameSuffix: metric,
|
|
139
|
+
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
140
|
+
} });
|
|
141
|
+
};
|
|
142
|
+
this.saveContent = (bucket, path, stream, opts = {}, tracingConfig, ifMatch) => {
|
|
143
|
+
if (!stream.pipe || !stream.on) {
|
|
144
|
+
throw new Error(`Argument stream must be a readable stream`);
|
|
145
|
+
}
|
|
146
|
+
const params = opts.unzip ? { unzip: opts.unzip } : {};
|
|
147
|
+
const headers = {};
|
|
148
|
+
let finalStream = stream;
|
|
149
|
+
headers['Content-Type'] = mime_types_1.default.contentType(path_1.basename(path)) || 'application/octet-stream';
|
|
150
|
+
if (opts.gzip) {
|
|
151
|
+
headers['Content-Encoding'] = 'gzip';
|
|
152
|
+
finalStream = stream.pipe(zlib_1.createGzip());
|
|
153
|
+
}
|
|
154
|
+
if (opts.ttl && Number.isInteger(opts.ttl)) {
|
|
155
|
+
headers['X-VTEX-TTL'] = opts.ttl;
|
|
156
|
+
}
|
|
157
|
+
if (ifMatch) {
|
|
158
|
+
headers['If-Match'] = ifMatch;
|
|
159
|
+
}
|
|
160
|
+
const metric = 'vbase-save-blob';
|
|
161
|
+
return this.http.put(routes.File(bucket, path), finalStream, { headers, metric, params, tracing: {
|
|
162
|
+
requestSpanNameSuffix: metric,
|
|
163
|
+
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
164
|
+
} });
|
|
165
|
+
};
|
|
166
|
+
if (runningAppName === '') {
|
|
167
|
+
throw new Error(`Invalid path to access VBase. Variable VTEX_APP_ID is not available.`);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
exports.VBase = VBase;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { InstanceOptions, RequestTracingConfig } from '../../HttpClient';
|
|
2
|
+
import { IOContext } from '../../service/worker/runtime/typings';
|
|
3
|
+
import { InfraClient } from './InfraClient';
|
|
4
|
+
export declare class Workspaces extends InfraClient {
|
|
5
|
+
constructor(context: IOContext, options?: InstanceOptions);
|
|
6
|
+
list: (account: string, tracingConfig?: RequestTracingConfig | undefined) => Promise<WorkspaceMetadata[]>;
|
|
7
|
+
get: (account: string, workspace: string, tracingConfig?: RequestTracingConfig | undefined) => Promise<WorkspaceMetadata>;
|
|
8
|
+
set: (account: string, workspace: string, metadata: Partial<WorkspaceMetadata>, tracingConfig?: RequestTracingConfig | undefined) => Promise<void>;
|
|
9
|
+
create: (account: string, workspace: string, production: boolean, tracingConfig?: RequestTracingConfig | undefined) => Promise<void>;
|
|
10
|
+
delete: (account: string, workspace: string, tracingConfig?: RequestTracingConfig | undefined) => Promise<import("../../HttpClient").IOResponse<void>>;
|
|
11
|
+
reset: (account: string, workspace: string, metadata?: Partial<WorkspaceMetadata>, tracingConfig?: RequestTracingConfig | undefined) => Promise<void>;
|
|
12
|
+
promote: (account: string, workspace: string, tracingConfig?: RequestTracingConfig | undefined) => Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
export interface WorkspaceMetadata {
|
|
15
|
+
name: string;
|
|
16
|
+
weight: number;
|
|
17
|
+
production: boolean;
|
|
18
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const constants_1 = require("../../constants");
|
|
4
|
+
const InfraClient_1 = require("./InfraClient");
|
|
5
|
+
const routes = {
|
|
6
|
+
Account: (account) => `/${account}`,
|
|
7
|
+
Promote: (account) => `${routes.Workspace(account, constants_1.DEFAULT_WORKSPACE)}/_promote`,
|
|
8
|
+
Workspace: (account, workspace) => `${routes.Account(account)}/${workspace}`,
|
|
9
|
+
};
|
|
10
|
+
class Workspaces extends InfraClient_1.InfraClient {
|
|
11
|
+
constructor(context, options) {
|
|
12
|
+
super('router', context, options, true);
|
|
13
|
+
this.list = (account, tracingConfig) => {
|
|
14
|
+
const metric = 'workspaces-list';
|
|
15
|
+
return this.http.get(routes.Account(account), { metric, tracing: {
|
|
16
|
+
requestSpanNameSuffix: metric,
|
|
17
|
+
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
18
|
+
} });
|
|
19
|
+
};
|
|
20
|
+
this.get = (account, workspace, tracingConfig) => {
|
|
21
|
+
const metric = 'workspaces-get';
|
|
22
|
+
return this.http.get(routes.Workspace(account, workspace), { metric, tracing: {
|
|
23
|
+
requestSpanNameSuffix: metric,
|
|
24
|
+
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
25
|
+
} });
|
|
26
|
+
};
|
|
27
|
+
this.set = (account, workspace, metadata, tracingConfig) => {
|
|
28
|
+
const metric = 'workspaces-set';
|
|
29
|
+
return this.http.put(routes.Workspace(account, workspace), metadata, { metric, tracing: {
|
|
30
|
+
requestSpanNameSuffix: metric,
|
|
31
|
+
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
32
|
+
} });
|
|
33
|
+
};
|
|
34
|
+
this.create = (account, workspace, production, tracingConfig) => {
|
|
35
|
+
const metric = 'workspaces-create';
|
|
36
|
+
return this.http.post(routes.Account(account), { name: workspace, production }, { metric, tracing: {
|
|
37
|
+
requestSpanNameSuffix: metric,
|
|
38
|
+
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
39
|
+
} });
|
|
40
|
+
};
|
|
41
|
+
this.delete = (account, workspace, tracingConfig) => {
|
|
42
|
+
const metric = 'workspaces-delete';
|
|
43
|
+
return this.http.delete(routes.Workspace(account, workspace), { metric, tracing: {
|
|
44
|
+
requestSpanNameSuffix: metric,
|
|
45
|
+
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
46
|
+
} });
|
|
47
|
+
};
|
|
48
|
+
this.reset = (account, workspace, metadata = {}, tracingConfig) => {
|
|
49
|
+
const params = { reset: true };
|
|
50
|
+
const metric = 'workspaces-reset';
|
|
51
|
+
return this.http.put(routes.Workspace(account, workspace), metadata, { metric, params, tracing: {
|
|
52
|
+
requestSpanNameSuffix: metric,
|
|
53
|
+
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
54
|
+
} });
|
|
55
|
+
};
|
|
56
|
+
this.promote = (account, workspace, tracingConfig) => {
|
|
57
|
+
const metric = 'workspaces-promote';
|
|
58
|
+
return this.http.put(routes.Promote(account), { workspace }, { metric, tracing: {
|
|
59
|
+
requestSpanNameSuffix: metric,
|
|
60
|
+
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
61
|
+
} });
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
exports.Workspaces = Workspaces;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export * from './Apps';
|
|
2
|
+
export * from './Assets';
|
|
3
|
+
export * from './BillingMetrics';
|
|
4
|
+
export * from './Events';
|
|
5
|
+
export * from './Housekeeper';
|
|
6
|
+
export * from './InfraClient';
|
|
7
|
+
export * from './Metadata';
|
|
8
|
+
export * from './Registry';
|
|
9
|
+
export * from './Router';
|
|
10
|
+
export * from './VBase';
|
|
11
|
+
export * from './Workspaces';
|
|
12
|
+
export * from './Sphinx';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
function __export(m) {
|
|
3
|
+
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
|
4
|
+
}
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
__export(require("./Apps"));
|
|
7
|
+
__export(require("./Assets"));
|
|
8
|
+
__export(require("./BillingMetrics"));
|
|
9
|
+
__export(require("./Events"));
|
|
10
|
+
__export(require("./Housekeeper"));
|
|
11
|
+
__export(require("./InfraClient"));
|
|
12
|
+
__export(require("./Metadata"));
|
|
13
|
+
__export(require("./Registry"));
|
|
14
|
+
__export(require("./Router"));
|
|
15
|
+
__export(require("./VBase"));
|
|
16
|
+
__export(require("./Workspaces"));
|
|
17
|
+
__export(require("./Sphinx"));
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { InstanceOptions } from '../../HttpClient/typings';
|
|
2
|
+
import { IOContext } from '../../service/worker/runtime/typings';
|
|
3
|
+
import { ExternalClient } from '../external/ExternalClient';
|
|
4
|
+
declare type Environment = 'stable' | 'beta';
|
|
5
|
+
/**
|
|
6
|
+
* Used to perform calls on APIs in the VTEX Janus infrastructure, to which you must declare an outbound policy.
|
|
7
|
+
*
|
|
8
|
+
* Example policy:
|
|
9
|
+
*
|
|
10
|
+
* {
|
|
11
|
+
* "name": "outbound-access",
|
|
12
|
+
* "attrs": {
|
|
13
|
+
* "host": "portal.vtexcommercestable.com.br",
|
|
14
|
+
* "path": "/api/*"
|
|
15
|
+
* }
|
|
16
|
+
* }
|
|
17
|
+
*/
|
|
18
|
+
export declare class JanusClient extends ExternalClient {
|
|
19
|
+
constructor(context: IOContext, options?: InstanceOptions, environment?: Environment);
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const ExternalClient_1 = require("../external/ExternalClient");
|
|
4
|
+
/**
|
|
5
|
+
* Used to perform calls on APIs in the VTEX Janus infrastructure, to which you must declare an outbound policy.
|
|
6
|
+
*
|
|
7
|
+
* Example policy:
|
|
8
|
+
*
|
|
9
|
+
* {
|
|
10
|
+
* "name": "outbound-access",
|
|
11
|
+
* "attrs": {
|
|
12
|
+
* "host": "portal.vtexcommercestable.com.br",
|
|
13
|
+
* "path": "/api/*"
|
|
14
|
+
* }
|
|
15
|
+
* }
|
|
16
|
+
*/
|
|
17
|
+
class JanusClient extends ExternalClient_1.ExternalClient {
|
|
18
|
+
constructor(context, options, environment) {
|
|
19
|
+
const { account } = context;
|
|
20
|
+
const env = context.janusEnv === 'beta' || environment === 'beta' ? 'beta' : 'stable';
|
|
21
|
+
super(`http://portal.vtexcommerce${env}.com.br`, context, {
|
|
22
|
+
...options,
|
|
23
|
+
params: {
|
|
24
|
+
an: account,
|
|
25
|
+
...options === null || options === void 0 ? void 0 : options.params,
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.JanusClient = JanusClient;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { RequestTracingConfig } from '../../HttpClient';
|
|
2
|
+
import { JanusClient } from './JanusClient';
|
|
3
|
+
export declare class LicenseManager extends JanusClient {
|
|
4
|
+
getAccountData(VtexIdclientAutCookie: string, tracingConfig?: RequestTracingConfig): Promise<any>;
|
|
5
|
+
getTopbarData(VtexIdclientAutCookie: string, tracingConfig?: RequestTracingConfig): Promise<any>;
|
|
6
|
+
canAccessResource(VtexIdclientAutCookie: string, resourceKey: string, tracingConfig?: RequestTracingConfig): Promise<boolean>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const qs_1 = require("qs");
|
|
4
|
+
const JanusClient_1 = require("./JanusClient");
|
|
5
|
+
const TWO_MINUTES_S = 2 * 60;
|
|
6
|
+
const BASE_URL = '/api/license-manager';
|
|
7
|
+
const routes = {
|
|
8
|
+
accountData: `${BASE_URL}/account`,
|
|
9
|
+
resourceAccess: `${BASE_URL}/resources`,
|
|
10
|
+
topbarData: `${BASE_URL}/site/pvt/newtopbar`,
|
|
11
|
+
};
|
|
12
|
+
const inflightKey = ({ baseURL, url, params }) => {
|
|
13
|
+
return baseURL + url + qs_1.stringify(params, { arrayFormat: 'repeat', addQueryPrefix: true });
|
|
14
|
+
};
|
|
15
|
+
class LicenseManager extends JanusClient_1.JanusClient {
|
|
16
|
+
getAccountData(VtexIdclientAutCookie, tracingConfig) {
|
|
17
|
+
const metric = 'lm-account-data';
|
|
18
|
+
return this.http.get(routes.accountData, {
|
|
19
|
+
forceMaxAge: TWO_MINUTES_S,
|
|
20
|
+
headers: {
|
|
21
|
+
VtexIdclientAutCookie,
|
|
22
|
+
},
|
|
23
|
+
inflightKey,
|
|
24
|
+
metric,
|
|
25
|
+
tracing: {
|
|
26
|
+
requestSpanNameSuffix: metric,
|
|
27
|
+
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
getTopbarData(VtexIdclientAutCookie, tracingConfig) {
|
|
32
|
+
const metric = 'lm-topbar-data';
|
|
33
|
+
return this.http.get(routes.topbarData, {
|
|
34
|
+
headers: {
|
|
35
|
+
VtexIdclientAutCookie,
|
|
36
|
+
},
|
|
37
|
+
metric,
|
|
38
|
+
tracing: {
|
|
39
|
+
requestSpanNameSuffix: metric,
|
|
40
|
+
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
canAccessResource(VtexIdclientAutCookie, resourceKey, tracingConfig) {
|
|
45
|
+
const metric = 'lm-resource-access';
|
|
46
|
+
return this.http.get(`${routes.resourceAccess}/${resourceKey}/access`, {
|
|
47
|
+
headers: {
|
|
48
|
+
VtexIdclientAutCookie,
|
|
49
|
+
},
|
|
50
|
+
metric,
|
|
51
|
+
tracing: {
|
|
52
|
+
requestSpanNameSuffix: metric,
|
|
53
|
+
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
54
|
+
},
|
|
55
|
+
}).then(() => true, () => false);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
exports.LicenseManager = LicenseManager;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { RequestTracingConfig } from '../../HttpClient';
|
|
2
|
+
import { JanusClient } from './JanusClient';
|
|
3
|
+
export interface SegmentData {
|
|
4
|
+
campaigns?: any;
|
|
5
|
+
channel: number;
|
|
6
|
+
channelPrivacy?: 'public' | 'private';
|
|
7
|
+
priceTables?: any;
|
|
8
|
+
utm_campaign: string;
|
|
9
|
+
regionId?: string;
|
|
10
|
+
utm_source: string;
|
|
11
|
+
utmi_campaign: string;
|
|
12
|
+
currencyCode: string;
|
|
13
|
+
currencySymbol: string;
|
|
14
|
+
countryCode: string;
|
|
15
|
+
cultureInfo: string;
|
|
16
|
+
[key: string]: any;
|
|
17
|
+
}
|
|
18
|
+
export declare class Segment extends JanusClient {
|
|
19
|
+
/**
|
|
20
|
+
* Get the segment data using the current `ctx.vtex.segmentToken`
|
|
21
|
+
*
|
|
22
|
+
* @memberof Segment
|
|
23
|
+
*/
|
|
24
|
+
getSegment: (tracingConfig?: RequestTracingConfig | undefined) => Promise<SegmentData>;
|
|
25
|
+
/**
|
|
26
|
+
* Get the segment data from this specific segment token
|
|
27
|
+
*
|
|
28
|
+
* @memberof Segment
|
|
29
|
+
*/
|
|
30
|
+
getSegmentByToken: (token: string | null, tracingConfig?: RequestTracingConfig | undefined) => Promise<SegmentData>;
|
|
31
|
+
getOrCreateSegment: (query?: Record<string, string> | undefined, token?: string | undefined, tracingConfig?: RequestTracingConfig | undefined) => Promise<{
|
|
32
|
+
segmentData: SegmentData;
|
|
33
|
+
segmentToken: string;
|
|
34
|
+
}>;
|
|
35
|
+
private rawSegment;
|
|
36
|
+
}
|