@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,59 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { IncomingMessage } from 'http';
|
|
3
|
+
import { Readable, Writable } from 'stream';
|
|
4
|
+
import { ZlibOptions } from 'zlib';
|
|
5
|
+
import { InstanceOptions, RequestTracingConfig } from '../../HttpClient';
|
|
6
|
+
import { AppBundlePublished, AppFilesList, AppManifest, AppState } from '../../responses';
|
|
7
|
+
import { IOContext } from '../../service/worker/runtime/typings';
|
|
8
|
+
import { InfraClient } from './InfraClient';
|
|
9
|
+
export declare class Registry extends InfraClient {
|
|
10
|
+
constructor(context: IOContext, options?: InstanceOptions);
|
|
11
|
+
getAppState: (app: string, version: string, tracingConfig?: RequestTracingConfig | undefined) => Promise<AppState>;
|
|
12
|
+
publishApp: (files: File[], tag?: string | undefined, { zlib }?: ZipOptions, tracingConfig?: RequestTracingConfig | undefined) => Promise<AppBundlePublished>;
|
|
13
|
+
publishAppRc: (files: File[], tag?: string | undefined, { zlib }?: ZipOptions, tracingConfig?: RequestTracingConfig | undefined) => Promise<AppBundlePublished>;
|
|
14
|
+
listApps: (tracingConfig?: RequestTracingConfig | undefined) => Promise<RegistryAppsList>;
|
|
15
|
+
listVersionsByApp: (app: string, tracingConfig?: RequestTracingConfig | undefined) => Promise<RegistryAppVersionsList>;
|
|
16
|
+
deprecateApp: (app: string, version: string, tracingConfig?: RequestTracingConfig | undefined) => Promise<void>;
|
|
17
|
+
undeprecateApp: (app: string, version: string, tracingConfig?: RequestTracingConfig | undefined) => Promise<void>;
|
|
18
|
+
validateApp: (app: string, version: string, tracingConfig?: RequestTracingConfig | undefined) => Promise<void>;
|
|
19
|
+
getAppManifest: (app: string, version: string, opts?: AppsManifestOptions | undefined, tracingConfig?: RequestTracingConfig | undefined) => Promise<AppManifest>;
|
|
20
|
+
listAppFiles: (app: string, version: string, opts?: ListAppFilesOptions | undefined, tracingConfig?: RequestTracingConfig | undefined) => Promise<AppFilesList>;
|
|
21
|
+
getAppFile: (app: string, version: string, path: string, tracingConfig?: RequestTracingConfig | undefined) => Promise<{
|
|
22
|
+
data: Buffer;
|
|
23
|
+
headers: any;
|
|
24
|
+
}>;
|
|
25
|
+
getAppJSON: <T extends object | null>(app: string, version: string, path: string, nullIfNotFound?: boolean | undefined, tracingConfig?: RequestTracingConfig | undefined) => Promise<T>;
|
|
26
|
+
getAppFileStream: (app: string, version: string, path: string, tracingConfig?: RequestTracingConfig | undefined) => Promise<IncomingMessage>;
|
|
27
|
+
getAppBundle: (app: string, version: string, bundlePath: string, generatePackageJson: boolean, tracingConfig?: RequestTracingConfig | undefined) => Promise<Readable>;
|
|
28
|
+
unpackAppBundle: (app: string, version: string, bundlePath: string, unpackPath: string, generatePackageJson: boolean, tracingConfig?: RequestTracingConfig | undefined) => Promise<Writable>;
|
|
29
|
+
resolveDependenciesWithManifest: (manifest: AppManifest, filter?: string, tracingConfig?: RequestTracingConfig | undefined) => Promise<Record<string, string[]>>;
|
|
30
|
+
private publish;
|
|
31
|
+
}
|
|
32
|
+
interface ZipOptions {
|
|
33
|
+
zlib?: ZlibOptions;
|
|
34
|
+
}
|
|
35
|
+
export interface AppsManifestOptions {
|
|
36
|
+
resolveDeps: boolean;
|
|
37
|
+
}
|
|
38
|
+
export interface ListAppFilesOptions {
|
|
39
|
+
prefix: string;
|
|
40
|
+
}
|
|
41
|
+
export interface RegistryAppsListItem {
|
|
42
|
+
partialIdentifier: string;
|
|
43
|
+
location: string;
|
|
44
|
+
}
|
|
45
|
+
export interface RegistryAppsList {
|
|
46
|
+
data: RegistryAppsListItem[];
|
|
47
|
+
}
|
|
48
|
+
export interface RegistryAppVersionsListItem {
|
|
49
|
+
versionIdentifier: string;
|
|
50
|
+
location: string;
|
|
51
|
+
}
|
|
52
|
+
export interface RegistryAppVersionsList {
|
|
53
|
+
data: RegistryAppVersionsListItem[];
|
|
54
|
+
}
|
|
55
|
+
export interface File {
|
|
56
|
+
path: string;
|
|
57
|
+
content: any;
|
|
58
|
+
}
|
|
59
|
+
export {};
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const archiver_1 = __importDefault(require("archiver"));
|
|
7
|
+
const tar_fs_1 = require("tar-fs");
|
|
8
|
+
const zlib_1 = require("zlib");
|
|
9
|
+
const constants_1 = require("../../constants");
|
|
10
|
+
const HttpClient_1 = require("../../HttpClient");
|
|
11
|
+
const InfraClient_1 = require("./InfraClient");
|
|
12
|
+
const EMPTY_OBJECT = {};
|
|
13
|
+
const routes = {
|
|
14
|
+
App: (app) => `${routes.Registry}/${app}`,
|
|
15
|
+
AppBundle: (app, version, path) => {
|
|
16
|
+
return path ? `${routes.AppVersion(app, version)}/bundle/${path}` : `${routes.AppVersion(app, version)}/bundle`;
|
|
17
|
+
},
|
|
18
|
+
AppFile: (app, version, path) => `${routes.AppFiles(app, version)}/${path}`,
|
|
19
|
+
AppFiles: (app, version) => `${routes.AppVersion(app, version)}/files`,
|
|
20
|
+
AppState: (app, version) => `${routes.AppVersion(app, version)}/state`,
|
|
21
|
+
AppVersion: (app, version) => `${routes.App(app)}/${version}`,
|
|
22
|
+
Publish: '/v2/registry',
|
|
23
|
+
PublishRc: '/v2/registry/rc',
|
|
24
|
+
Registry: '/registry',
|
|
25
|
+
ResolveDependenciesWithManifest: '/v2/registry/_resolve',
|
|
26
|
+
};
|
|
27
|
+
class Registry extends InfraClient_1.InfraClient {
|
|
28
|
+
constructor(context, options) {
|
|
29
|
+
super('apps@0.x', { ...context, workspace: constants_1.DEFAULT_WORKSPACE }, options);
|
|
30
|
+
this.getAppState = (app, version, tracingConfig) => {
|
|
31
|
+
const metric = 'registry-app-state';
|
|
32
|
+
const inflightKey = HttpClient_1.inflightUrlWithQuery;
|
|
33
|
+
return this.http.get(routes.AppState(app, version), {
|
|
34
|
+
inflightKey,
|
|
35
|
+
metric,
|
|
36
|
+
tracing: {
|
|
37
|
+
requestSpanNameSuffix: metric,
|
|
38
|
+
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
this.publishApp = (files, tag, { zlib } = {}, tracingConfig) => {
|
|
43
|
+
return this.publish(routes.Publish, files, tag, { zlib }, tracingConfig);
|
|
44
|
+
};
|
|
45
|
+
this.publishAppRc = (files, tag, { zlib } = {}, tracingConfig) => {
|
|
46
|
+
return this.publish(routes.PublishRc, files, tag, { zlib }, tracingConfig);
|
|
47
|
+
};
|
|
48
|
+
this.listApps = (tracingConfig) => {
|
|
49
|
+
const inflightKey = HttpClient_1.inflightURL;
|
|
50
|
+
const metric = 'registry-list';
|
|
51
|
+
return this.http.get(routes.Registry, { inflightKey, metric, tracing: {
|
|
52
|
+
requestSpanNameSuffix: metric,
|
|
53
|
+
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
54
|
+
} });
|
|
55
|
+
};
|
|
56
|
+
this.listVersionsByApp = (app, tracingConfig) => {
|
|
57
|
+
const inflightKey = HttpClient_1.inflightURL;
|
|
58
|
+
const metric = 'registry-list-versions';
|
|
59
|
+
return this.http.get(routes.App(app), { inflightKey, metric, tracing: {
|
|
60
|
+
requestSpanNameSuffix: metric,
|
|
61
|
+
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
62
|
+
} });
|
|
63
|
+
};
|
|
64
|
+
this.deprecateApp = (app, version, tracingConfig) => {
|
|
65
|
+
const metric = 'registry-deprecate';
|
|
66
|
+
return this.http.patch(routes.AppVersion(app, version), { patchState: 'deprecate' }, { metric, tracing: {
|
|
67
|
+
requestSpanNameSuffix: metric,
|
|
68
|
+
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
69
|
+
} });
|
|
70
|
+
};
|
|
71
|
+
this.undeprecateApp = (app, version, tracingConfig) => {
|
|
72
|
+
const metric = 'registry-undeprecate';
|
|
73
|
+
return this.http.patch(routes.AppVersion(app, version), { patchState: 'undeprecate' }, { metric, tracing: {
|
|
74
|
+
requestSpanNameSuffix: metric,
|
|
75
|
+
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
76
|
+
} });
|
|
77
|
+
};
|
|
78
|
+
this.validateApp = (app, version, tracingConfig) => {
|
|
79
|
+
const metric = 'registry-validate';
|
|
80
|
+
return this.http.patch(routes.AppVersion(app, version), { patchState: 'validate' }, { metric, tracing: {
|
|
81
|
+
requestSpanNameSuffix: metric,
|
|
82
|
+
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
83
|
+
} });
|
|
84
|
+
};
|
|
85
|
+
this.getAppManifest = (app, version, opts, tracingConfig) => {
|
|
86
|
+
const inflightKey = HttpClient_1.inflightUrlWithQuery;
|
|
87
|
+
const params = opts;
|
|
88
|
+
const metric = 'registry-manifest';
|
|
89
|
+
return this.http.get(routes.AppVersion(app, version), { inflightKey, metric, params, tracing: {
|
|
90
|
+
requestSpanNameSuffix: metric,
|
|
91
|
+
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
92
|
+
} });
|
|
93
|
+
};
|
|
94
|
+
this.listAppFiles = (app, version, opts, tracingConfig) => {
|
|
95
|
+
const inflightKey = HttpClient_1.inflightUrlWithQuery;
|
|
96
|
+
const params = opts;
|
|
97
|
+
const metric = 'registry-list-files';
|
|
98
|
+
return this.http.get(routes.AppFiles(app, version), { inflightKey, metric, params, tracing: {
|
|
99
|
+
requestSpanNameSuffix: metric,
|
|
100
|
+
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
101
|
+
} });
|
|
102
|
+
};
|
|
103
|
+
this.getAppFile = (app, version, path, tracingConfig) => {
|
|
104
|
+
const inflightKey = HttpClient_1.inflightURL;
|
|
105
|
+
const metric = 'registry-get-file';
|
|
106
|
+
return this.http.getBuffer(routes.AppFile(app, version, path), {
|
|
107
|
+
cacheable: HttpClient_1.CacheType.Disk,
|
|
108
|
+
inflightKey,
|
|
109
|
+
metric,
|
|
110
|
+
tracing: {
|
|
111
|
+
requestSpanNameSuffix: metric,
|
|
112
|
+
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
113
|
+
},
|
|
114
|
+
});
|
|
115
|
+
};
|
|
116
|
+
this.getAppJSON = (app, version, path, nullIfNotFound, tracingConfig) => {
|
|
117
|
+
const inflightKey = HttpClient_1.inflightURL;
|
|
118
|
+
const metric = 'registry-get-json';
|
|
119
|
+
return this.http.get(routes.AppFile(app, version, path), {
|
|
120
|
+
cacheable: HttpClient_1.CacheType.Any,
|
|
121
|
+
inflightKey,
|
|
122
|
+
metric,
|
|
123
|
+
nullIfNotFound,
|
|
124
|
+
tracing: {
|
|
125
|
+
requestSpanNameSuffix: metric,
|
|
126
|
+
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
127
|
+
},
|
|
128
|
+
});
|
|
129
|
+
};
|
|
130
|
+
this.getAppFileStream = (app, version, path, tracingConfig) => {
|
|
131
|
+
const metric = 'registry-get-file-s';
|
|
132
|
+
return this.http.getStream(routes.AppFile(app, version, path), {
|
|
133
|
+
metric,
|
|
134
|
+
tracing: {
|
|
135
|
+
requestSpanNameSuffix: metric,
|
|
136
|
+
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
137
|
+
},
|
|
138
|
+
});
|
|
139
|
+
};
|
|
140
|
+
this.getAppBundle = (app, version, bundlePath, generatePackageJson, tracingConfig) => {
|
|
141
|
+
const params = generatePackageJson && { _packageJSONEngine: 'npm', _packageJSONFilter: 'vtex.render-builder@x' };
|
|
142
|
+
const metric = 'registry-get-bundle';
|
|
143
|
+
return this.http.getStream(routes.AppBundle(app, version, bundlePath), {
|
|
144
|
+
headers: {
|
|
145
|
+
Accept: 'application/x-gzip',
|
|
146
|
+
'Accept-Encoding': 'gzip',
|
|
147
|
+
},
|
|
148
|
+
metric,
|
|
149
|
+
params,
|
|
150
|
+
tracing: {
|
|
151
|
+
requestSpanNameSuffix: metric,
|
|
152
|
+
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
153
|
+
},
|
|
154
|
+
});
|
|
155
|
+
};
|
|
156
|
+
this.unpackAppBundle = (app, version, bundlePath, unpackPath, generatePackageJson, tracingConfig) => {
|
|
157
|
+
return this.getAppBundle(app, version, bundlePath, generatePackageJson, tracingConfig)
|
|
158
|
+
.then(stream => stream
|
|
159
|
+
.pipe(zlib_1.createGunzip())
|
|
160
|
+
.pipe(tar_fs_1.extract(unpackPath)));
|
|
161
|
+
};
|
|
162
|
+
this.resolveDependenciesWithManifest = (manifest, filter = '', tracingConfig) => {
|
|
163
|
+
const params = { filter };
|
|
164
|
+
const metric = 'registry-resolve-deps';
|
|
165
|
+
return this.http.post(routes.ResolveDependenciesWithManifest, manifest, { metric, params, tracing: {
|
|
166
|
+
requestSpanNameSuffix: metric,
|
|
167
|
+
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
168
|
+
} });
|
|
169
|
+
};
|
|
170
|
+
this.publish = async (route, files, tag, { zlib } = {}, tracingConfig) => {
|
|
171
|
+
if (!(files[0] && files[0].path && files[0].content)) {
|
|
172
|
+
throw new Error('Argument files must be an array of {path, content}, where content can be a String, a Buffer or a ReadableStream.');
|
|
173
|
+
}
|
|
174
|
+
const indexOfManifest = files.findIndex(({ path }) => path === 'manifest.json');
|
|
175
|
+
if (indexOfManifest === -1) {
|
|
176
|
+
throw new Error('No manifest.json file found in files.');
|
|
177
|
+
}
|
|
178
|
+
const zip = archiver_1.default('zip', { zlib });
|
|
179
|
+
// Throw stream errors so they reject the promise chain.
|
|
180
|
+
zip.on('error', (e) => {
|
|
181
|
+
throw e;
|
|
182
|
+
});
|
|
183
|
+
const metric = 'registry-publish';
|
|
184
|
+
const request = this.http.post(route, zip, {
|
|
185
|
+
headers: { 'Content-Type': 'application/zip' },
|
|
186
|
+
metric,
|
|
187
|
+
params: tag ? { tag } : EMPTY_OBJECT,
|
|
188
|
+
tracing: {
|
|
189
|
+
requestSpanNameSuffix: metric,
|
|
190
|
+
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
191
|
+
},
|
|
192
|
+
});
|
|
193
|
+
files.forEach(({ content, path }) => zip.append(content, { name: path }));
|
|
194
|
+
const finalize = zip.finalize();
|
|
195
|
+
try {
|
|
196
|
+
const [response] = await Promise.all([request, finalize]);
|
|
197
|
+
response.bundleSize = zip.pointer();
|
|
198
|
+
return response;
|
|
199
|
+
}
|
|
200
|
+
catch (e) {
|
|
201
|
+
e.bundleSize = zip.pointer();
|
|
202
|
+
throw e;
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
exports.Registry = Registry;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { InstanceOptions, RequestTracingConfig } from '../../HttpClient';
|
|
2
|
+
import { IOContext } from '../../service/worker/runtime/typings';
|
|
3
|
+
import { InfraClient } from './InfraClient';
|
|
4
|
+
export declare class Router extends InfraClient {
|
|
5
|
+
constructor(ioContext: IOContext, opts?: InstanceOptions);
|
|
6
|
+
listAvailableIoVersions: (tracingConfig?: RequestTracingConfig | undefined) => Promise<AvaiableIO[]>;
|
|
7
|
+
getInstalledIoVersion: (tracingConfig?: RequestTracingConfig | undefined) => Promise<AvaiableIO>;
|
|
8
|
+
installIo: (version: string, tracingConfig?: RequestTracingConfig | undefined) => Promise<void>;
|
|
9
|
+
listAvailableServices: (tracingConfig?: RequestTracingConfig | undefined) => Promise<AvailableServices>;
|
|
10
|
+
getAvailableVersions: (name: string, tracingConfig?: RequestTracingConfig | undefined) => Promise<AvailableServiceVersions>;
|
|
11
|
+
listInstalledServices: (tracingConfig?: RequestTracingConfig | undefined) => Promise<InstalledService[]>;
|
|
12
|
+
installService: (name: string, version: string, tracingConfig?: RequestTracingConfig | undefined) => Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
export interface AvaiableIO {
|
|
15
|
+
version: string;
|
|
16
|
+
tested: boolean;
|
|
17
|
+
services: {
|
|
18
|
+
[service: string]: string;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export declare type InstalledIO = AvaiableIO;
|
|
22
|
+
export interface AvailableServiceVersions {
|
|
23
|
+
versions: {
|
|
24
|
+
[region: string]: string[];
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export interface AvailableServices {
|
|
28
|
+
[service: string]: AvailableServiceVersions;
|
|
29
|
+
}
|
|
30
|
+
export interface InstalledService {
|
|
31
|
+
name: string;
|
|
32
|
+
version: string;
|
|
33
|
+
serviceIsolation: number;
|
|
34
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const InfraClient_1 = require("./InfraClient");
|
|
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 InfraClient_1.InfraClient {
|
|
13
|
+
constructor(ioContext, opts) {
|
|
14
|
+
super('router', ioContext, opts, true);
|
|
15
|
+
this.listAvailableIoVersions = (tracingConfig) => {
|
|
16
|
+
return this.http.get(routes.AvailableIoVersions, { tracing: {
|
|
17
|
+
requestSpanNameSuffix: 'list-io-versions',
|
|
18
|
+
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
19
|
+
} });
|
|
20
|
+
};
|
|
21
|
+
this.getInstalledIoVersion = (tracingConfig) => {
|
|
22
|
+
if (!this.context.account || !this.context.workspace) {
|
|
23
|
+
throw new Error('Missing client parameters: {account, workspace}');
|
|
24
|
+
}
|
|
25
|
+
return this.http.get(routes.InstalledIoVersion(this.context.account, this.context.workspace), {
|
|
26
|
+
tracing: {
|
|
27
|
+
requestSpanNameSuffix: 'get-installed-io-version',
|
|
28
|
+
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
this.installIo = (version, tracingConfig) => {
|
|
33
|
+
if (!this.context.account || !this.context.workspace) {
|
|
34
|
+
throw new Error('Missing client parameters: {account, workspace}');
|
|
35
|
+
}
|
|
36
|
+
return this.http.put(routes.InstalledIoVersion(this.context.account, this.context.workspace), { version }, { tracing: {
|
|
37
|
+
requestSpanNameSuffix: 'install-io',
|
|
38
|
+
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
39
|
+
} });
|
|
40
|
+
};
|
|
41
|
+
this.listAvailableServices = (tracingConfig) => {
|
|
42
|
+
return this.http.get(routes.AvailableServices, {
|
|
43
|
+
tracing: {
|
|
44
|
+
requestSpanNameSuffix: 'list-available-services',
|
|
45
|
+
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
this.getAvailableVersions = (name, tracingConfig) => {
|
|
50
|
+
return this.http.get(routes.AvailableServiceVersions(name), {
|
|
51
|
+
tracing: {
|
|
52
|
+
requestSpanNameSuffix: 'get-versions',
|
|
53
|
+
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
this.listInstalledServices = (tracingConfig) => {
|
|
58
|
+
if (!this.context.account || !this.context.workspace) {
|
|
59
|
+
throw new Error('Missing client parameters: {account, workspace}');
|
|
60
|
+
}
|
|
61
|
+
return this.http.get(routes.InstalledServices(this.context.account, this.context.workspace), {
|
|
62
|
+
tracing: {
|
|
63
|
+
requestSpanNameSuffix: 'list-installed-services',
|
|
64
|
+
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
this.installService = (name, version, tracingConfig) => {
|
|
69
|
+
if (!this.context.account || !this.context.workspace) {
|
|
70
|
+
throw new Error('Missing client parameters: {account, workspace}');
|
|
71
|
+
}
|
|
72
|
+
return this.http.post(routes.InstalledServices(this.context.account, this.context.workspace), { name, version }, {
|
|
73
|
+
tracing: {
|
|
74
|
+
requestSpanNameSuffix: 'install-service',
|
|
75
|
+
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
76
|
+
},
|
|
77
|
+
});
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
exports.Router = Router;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { InstanceOptions, RequestTracingConfig } from '../../HttpClient/typings';
|
|
2
|
+
import { IOContext } from '../../service/worker/runtime/typings';
|
|
3
|
+
import { InfraClient } from './InfraClient';
|
|
4
|
+
export declare class Sphinx extends InfraClient {
|
|
5
|
+
constructor(ioContext: IOContext, opts?: InstanceOptions);
|
|
6
|
+
validatePolicies: (policies: PolicyRequest[], tracingConfig?: RequestTracingConfig | undefined) => Promise<void>;
|
|
7
|
+
isAdmin: (email: string, tracingConfig?: RequestTracingConfig | undefined) => Promise<boolean>;
|
|
8
|
+
}
|
|
9
|
+
export interface PolicyRequest {
|
|
10
|
+
name: string;
|
|
11
|
+
reason: string;
|
|
12
|
+
attrs: Record<string, string>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const InfraClient_1 = require("./InfraClient");
|
|
4
|
+
class Sphinx extends InfraClient_1.InfraClient {
|
|
5
|
+
constructor(ioContext, opts) {
|
|
6
|
+
super('sphinx@0.x', ioContext, opts, false);
|
|
7
|
+
this.validatePolicies = (policies, tracingConfig) => {
|
|
8
|
+
const metric = 'sphinx-validate-policy';
|
|
9
|
+
return this.http.post('/policies/validate', { policies }, {
|
|
10
|
+
metric,
|
|
11
|
+
tracing: {
|
|
12
|
+
requestSpanNameSuffix: metric,
|
|
13
|
+
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
this.isAdmin = (email, tracingConfig) => {
|
|
18
|
+
const metric = 'sphinx-is-admin';
|
|
19
|
+
return this.http.get(`/user/${email}/isAdmin`, {
|
|
20
|
+
metric,
|
|
21
|
+
tracing: {
|
|
22
|
+
requestSpanNameSuffix: metric,
|
|
23
|
+
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.Sphinx = Sphinx;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { IncomingMessage } from 'http';
|
|
3
|
+
import { Readable } from 'stream';
|
|
4
|
+
import { Logger } from './../../service/logger/logger';
|
|
5
|
+
import { InstanceOptions, IOResponse, RequestTracingConfig } from '../../HttpClient';
|
|
6
|
+
import { BucketMetadata, FileListItem } from '../../responses';
|
|
7
|
+
import { IOContext } from '../../service/worker/runtime/typings';
|
|
8
|
+
import { InfraClient } from './InfraClient';
|
|
9
|
+
export declare class VBase extends InfraClient {
|
|
10
|
+
constructor(context: IOContext, options?: InstanceOptions);
|
|
11
|
+
getBucket: (bucket: string, tracingConfig?: RequestTracingConfig | undefined) => Promise<BucketMetadata>;
|
|
12
|
+
resetBucket: (bucket: string, tracingConfig?: RequestTracingConfig | undefined) => Promise<IOResponse<void>>;
|
|
13
|
+
listFiles: (bucket: string, opts?: string | VBaseOptions | undefined, tracingConfig?: RequestTracingConfig | undefined) => Promise<BucketFileList>;
|
|
14
|
+
getFile: (bucket: string, path: string, tracingConfig?: RequestTracingConfig | undefined) => Promise<{
|
|
15
|
+
data: Buffer;
|
|
16
|
+
headers: any;
|
|
17
|
+
}>;
|
|
18
|
+
getJSON: <T>(bucket: string, path: string, nullIfNotFound?: boolean | undefined, conflictsResolver?: ConflictsResolver<T> | undefined, tracingConfig?: RequestTracingConfig | undefined) => Promise<T>;
|
|
19
|
+
getRawJSON: <T>(bucket: string, path: string, nullIfNotFound?: boolean | undefined, conflictsResolver?: ConflictsResolver<T> | undefined, tracingConfig?: RequestTracingConfig | undefined) => Promise<IOResponse<T>>;
|
|
20
|
+
getFileStream: (bucket: string, path: string, tracingConfig?: RequestTracingConfig | undefined) => Promise<IncomingMessage>;
|
|
21
|
+
saveFile: (bucket: string, path: string, stream: Readable, gzip?: boolean, ttl?: number | undefined, tracingConfig?: RequestTracingConfig | undefined, ifMatch?: string | undefined) => Promise<void>;
|
|
22
|
+
getFileMetadata: (bucket: string, path: string, tracingConfig?: RequestTracingConfig | undefined) => Promise<IOResponse<void>>;
|
|
23
|
+
saveJSON: <T>(bucket: string, path: string, data: T, tracingConfig?: RequestTracingConfig | undefined, ifMatch?: string | undefined) => Promise<void>;
|
|
24
|
+
saveZippedContent: (bucket: string, path: string, stream: Readable, tracingConfig?: RequestTracingConfig | undefined, ifMatch?: string | undefined) => Promise<void>;
|
|
25
|
+
deleteFile: (bucket: string, path: string, tracingConfig?: RequestTracingConfig | undefined, ifMatch?: string | undefined) => Promise<IOResponse<void>>;
|
|
26
|
+
getConflicts: <T>(bucket: string, tracingConfig?: RequestTracingConfig | undefined) => Promise<T>;
|
|
27
|
+
resolveConflict: <T>(bucket: string, path: string, content: any, tracingConfig?: RequestTracingConfig | undefined) => Promise<T>;
|
|
28
|
+
private saveContent;
|
|
29
|
+
}
|
|
30
|
+
export interface BucketFileList {
|
|
31
|
+
data: FileListItem[];
|
|
32
|
+
next: string;
|
|
33
|
+
smartCacheHeaders: any;
|
|
34
|
+
}
|
|
35
|
+
export interface VBaseOptions {
|
|
36
|
+
prefix?: string;
|
|
37
|
+
next?: string;
|
|
38
|
+
limit?: number;
|
|
39
|
+
}
|
|
40
|
+
export interface VBaseSaveOptions {
|
|
41
|
+
gzip?: boolean;
|
|
42
|
+
unzip?: boolean;
|
|
43
|
+
ttl?: number;
|
|
44
|
+
}
|
|
45
|
+
export interface VBaseConflictData {
|
|
46
|
+
path: string;
|
|
47
|
+
base: VBaseConflict;
|
|
48
|
+
master: VBaseConflict;
|
|
49
|
+
mine: VBaseConflict;
|
|
50
|
+
}
|
|
51
|
+
export interface VBaseConflict {
|
|
52
|
+
contentOmitted: boolean;
|
|
53
|
+
deleted: boolean;
|
|
54
|
+
mimeType: string;
|
|
55
|
+
parsedContent?: any;
|
|
56
|
+
content: string;
|
|
57
|
+
}
|
|
58
|
+
export interface ConflictsResolver<T> {
|
|
59
|
+
resolve: (logger?: Logger) => T | Promise<T>;
|
|
60
|
+
}
|