@vtex/api 6.47.0 → 6.48.1-beta
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 +0 -3
- package/lib/{clients/apps → HttpClient}/AppClient.d.ts +3 -3
- package/lib/{clients/apps → HttpClient}/AppClient.js +5 -10
- package/lib/{clients/apps → HttpClient}/AppGraphQLClient.d.ts +3 -3
- package/lib/{clients/apps → HttpClient}/AppGraphQLClient.js +5 -10
- package/lib/{clients/external → HttpClient}/ExternalClient.d.ts +3 -3
- package/lib/{clients/external → HttpClient}/ExternalClient.js +2 -9
- package/lib/HttpClient/GraphQLClient.d.ts +1 -2
- package/lib/HttpClient/GraphQLClient.js +1 -4
- package/lib/HttpClient/HttpClient.d.ts +5 -6
- package/lib/HttpClient/HttpClient.js +21 -63
- package/lib/{clients → HttpClient}/IOClient.d.ts +4 -4
- package/lib/HttpClient/IOClient.js +14 -0
- package/lib/{clients → HttpClient}/IOGraphQLClient.d.ts +4 -4
- package/lib/{clients → HttpClient}/IOGraphQLClient.js +2 -2
- package/lib/{clients/infra → HttpClient}/InfraClient.d.ts +3 -3
- package/lib/{clients/infra → HttpClient}/InfraClient.js +4 -9
- package/lib/{clients/janus → HttpClient}/JanusClient.d.ts +3 -3
- package/lib/{clients/janus → HttpClient}/JanusClient.js +3 -7
- package/lib/HttpClient/factories/index.d.ts +8 -0
- package/lib/HttpClient/factories/index.js +31 -0
- package/lib/HttpClient/index.d.ts +7 -1
- package/lib/HttpClient/index.js +7 -1
- package/lib/HttpClient/middlewares/cache.d.ts +2 -8
- package/lib/HttpClient/middlewares/cache.js +31 -120
- package/lib/HttpClient/middlewares/cancellationToken.d.ts +1 -1
- package/lib/HttpClient/middlewares/cancellationToken.js +1 -2
- package/lib/HttpClient/middlewares/memoization.js +1 -8
- package/lib/HttpClient/middlewares/metrics.js +31 -12
- package/lib/HttpClient/middlewares/recorder.d.ts +1 -1
- package/lib/HttpClient/middlewares/recorder.js +13 -16
- package/lib/HttpClient/middlewares/request.d.ts +10 -0
- package/lib/HttpClient/middlewares/request.js +87 -0
- package/lib/HttpClient/typings.d.ts +9 -43
- package/lib/IODataSource.d.ts +27 -0
- package/lib/IODataSource.js +46 -0
- package/lib/caches/LRUCache.js +1 -5
- package/lib/caches/LRUDiskCache.js +1 -5
- package/lib/clients/Apps.d.ts +84 -0
- package/lib/clients/Apps.js +326 -0
- package/lib/clients/Assets.d.ts +21 -0
- package/lib/clients/{infra/Assets.js → Assets.js} +19 -74
- package/lib/clients/Billing.d.ts +11 -0
- package/lib/clients/{apps/Billing.js → Billing.js} +3 -8
- package/lib/clients/BillingMetrics.d.ts +12 -0
- package/lib/clients/BillingMetrics.js +10 -0
- package/lib/clients/{apps/Builder.d.ts → Builder.d.ts} +11 -12
- package/lib/clients/{apps/Builder.js → Builder.js} +22 -49
- package/lib/clients/Events.d.ts +6 -0
- package/lib/clients/Events.js +19 -0
- package/lib/clients/Housekeeper.d.ts +11 -0
- package/lib/clients/Housekeeper.js +24 -0
- package/lib/clients/ID.d.ts +22 -0
- package/lib/clients/ID.js +48 -0
- package/lib/clients/IOClients.d.ts +24 -29
- package/lib/clients/IOClients.js +26 -36
- package/lib/clients/LicenseManager.d.ts +6 -0
- package/lib/clients/{janus/LicenseManager.js → LicenseManager.js} +8 -23
- package/lib/clients/Logger.d.ts +27 -0
- package/lib/clients/Logger.js +32 -0
- package/lib/clients/Messages.d.ts +18 -0
- package/lib/clients/Messages.js +20 -0
- package/lib/clients/MessagesGraphQL.d.ts +63 -0
- package/lib/clients/MessagesGraphQL.js +50 -0
- package/lib/clients/Metadata.d.ts +25 -0
- package/lib/clients/Metadata.js +53 -0
- package/lib/clients/Registry.d.ts +61 -0
- package/lib/clients/{infra/Registry.js → Registry.js} +33 -93
- package/lib/clients/Router.d.ts +33 -0
- package/lib/clients/Router.js +50 -0
- package/lib/clients/{janus/Segment.d.ts → Segment.d.ts} +11 -7
- package/lib/clients/Segment.js +69 -0
- package/lib/clients/{janus/Session.d.ts → Session.d.ts} +4 -4
- package/lib/clients/{janus/Session.js → Session.js} +13 -24
- package/lib/clients/{apps/Settings.d.ts → Settings.d.ts} +4 -5
- package/lib/clients/{apps/Settings.js → Settings.js} +20 -14
- package/lib/clients/Sphinx.d.ts +12 -0
- package/lib/clients/Sphinx.js +19 -0
- package/lib/clients/{janus/Tenant.d.ts → Tenant.d.ts} +7 -6
- package/lib/clients/Tenant.js +13 -0
- package/lib/clients/VBase.d.ts +57 -0
- package/lib/clients/VBase.js +116 -0
- package/lib/clients/Workspaces.d.ts +17 -0
- package/lib/clients/Workspaces.js +38 -0
- package/lib/clients/index.d.ts +21 -9
- package/lib/clients/index.js +21 -12
- package/lib/constants.d.ts +1 -49
- package/lib/constants.js +1 -54
- package/lib/errors/ResolverError.d.ts +1 -1
- package/lib/errors/ResolverError.js +2 -2
- package/lib/errors/ResolverWarning.d.ts +1 -1
- package/lib/errors/ResolverWarning.js +2 -2
- package/lib/index.d.ts +7 -9
- package/lib/index.js +6 -8
- package/lib/metrics/MetricsAccumulator.d.ts +18 -1
- package/lib/metrics/MetricsAccumulator.js +22 -38
- package/lib/responses.d.ts +44 -3
- package/lib/service/Runtime.d.ts +18 -0
- package/lib/service/Runtime.js +57 -0
- package/lib/service/{worker/runtime/Service.d.ts → Service.d.ts} +5 -5
- package/lib/service/{worker/runtime/Service.js → Service.js} +1 -2
- package/lib/service/events/index.d.ts +3 -0
- package/lib/service/events/index.js +21 -0
- package/lib/service/graphql/index.d.ts +7 -0
- package/lib/service/graphql/index.js +33 -0
- package/lib/service/graphql/middlewares/error.js +107 -0
- package/lib/service/graphql/middlewares/formatters.d.ts +2 -0
- package/lib/service/graphql/middlewares/formatters.js +64 -0
- package/lib/service/graphql/middlewares/query.d.ts +2 -0
- package/lib/service/graphql/middlewares/query.js +32 -0
- package/lib/service/graphql/middlewares/response.js +36 -0
- package/lib/service/graphql/middlewares/run.d.ts +4 -0
- package/lib/service/graphql/middlewares/run.js +55 -0
- package/lib/service/graphql/middlewares/schema.d.ts +2 -0
- package/lib/service/graphql/middlewares/schema.js +8 -0
- package/lib/service/graphql/middlewares/timings.d.ts +2 -0
- package/lib/service/graphql/middlewares/timings.js +10 -0
- package/lib/service/graphql/middlewares/upload.d.ts +7 -0
- package/lib/service/graphql/schema/index.d.ts +3 -0
- package/lib/service/graphql/schema/index.js +66 -0
- package/lib/service/graphql/schema/messagesLoader.d.ts +4 -0
- package/lib/service/graphql/schema/messagesLoader.js +41 -0
- package/lib/service/graphql/schema/messagesLoaderV2.d.ts +5 -0
- package/lib/service/graphql/schema/messagesLoaderV2.js +44 -0
- package/lib/service/{worker/runtime/graphql → graphql}/schema/schemaDirectives/Auth.d.ts +0 -1
- package/lib/service/{worker/runtime/graphql → graphql}/schema/schemaDirectives/Auth.js +5 -11
- package/lib/service/{worker/runtime/graphql → graphql}/schema/schemaDirectives/Sanitize.d.ts +0 -1
- package/lib/service/{worker/runtime/graphql → graphql}/schema/schemaDirectives/Sanitize.js +0 -6
- package/lib/service/{worker/runtime/graphql → graphql}/schema/schemaDirectives/SmartCacheDirective.d.ts +0 -1
- package/lib/service/{worker/runtime/graphql → graphql}/schema/schemaDirectives/SmartCacheDirective.js +3 -8
- package/lib/service/{worker/runtime/graphql/schema/schemaDirectives/TranslateTo.d.ts → graphql/schema/schemaDirectives/Translatable.d.ts} +1 -2
- package/lib/service/graphql/schema/schemaDirectives/Translatable.js +54 -0
- package/lib/service/graphql/schema/schemaDirectives/TranslatableV2.d.ts +13 -0
- package/lib/service/graphql/schema/schemaDirectives/TranslatableV2.js +67 -0
- package/lib/service/graphql/schema/schemaDirectives/index.d.ts +13 -0
- package/lib/service/graphql/schema/schemaDirectives/index.js +17 -0
- package/lib/service/graphql/schema/typeDefs/index.d.ts +16 -0
- package/lib/service/graphql/schema/typeDefs/index.js +21 -0
- package/lib/service/graphql/schema/typeDefs/ioMessage.d.ts +8 -0
- package/lib/service/graphql/schema/typeDefs/ioMessage.js +33 -0
- package/lib/service/{worker/runtime/graphql → graphql}/schema/typeDefs/sanitizedString.js +1 -5
- package/lib/service/graphql/typings.d.ts +21 -0
- package/lib/service/graphql/utils/cacheControl.d.ts +6 -0
- package/lib/service/graphql/utils/cacheControl.js +38 -0
- package/lib/service/graphql/utils/maxAgeEnum.d.ts +6 -0
- package/lib/service/graphql/utils/maxAgeEnum.js +17 -0
- package/lib/service/http/index.d.ts +3 -0
- package/lib/service/http/index.js +18 -0
- package/lib/service/http/middlewares/authTokens.d.ts +3 -0
- package/lib/service/http/middlewares/cancellationToken.d.ts +3 -0
- package/lib/service/{worker/runtime/http → http}/middlewares/cancellationToken.js +1 -2
- package/lib/service/http/middlewares/clients.d.ts +4 -0
- package/lib/service/http/middlewares/error.d.ts +3 -0
- package/lib/service/{worker/runtime/http → http}/middlewares/error.js +10 -19
- package/lib/service/{worker/runtime/http → http}/middlewares/requestStats.d.ts +3 -3
- package/lib/service/http/middlewares/setCookie.d.ts +3 -0
- package/lib/service/http/middlewares/timings.d.ts +3 -0
- package/lib/service/{worker/runtime/http → http}/middlewares/timings.js +8 -21
- package/lib/service/http/middlewares/vary.d.ts +3 -0
- package/lib/service/{worker/runtime/http → http}/middlewares/vary.js +3 -3
- package/lib/service/logger/index.d.ts +28 -2
- package/lib/service/logger/index.js +68 -5
- package/lib/service/method.d.ts +9 -0
- package/lib/service/{worker/runtime/typings.d.ts → typings.d.ts} +36 -70
- package/lib/service/utils/compose.d.ts +4 -0
- package/lib/service/{worker/runtime/utils → utils}/compose.js +2 -2
- package/lib/utils/MineWinsConflictsResolver.d.ts +4 -5
- package/lib/utils/MineWinsConflictsResolver.js +17 -23
- package/lib/utils/MineWinsConflictsResolver.test.d.ts +1 -0
- package/lib/utils/MineWinsConflictsResolver.test.js +134 -0
- package/lib/utils/app.d.ts +1 -3
- package/lib/utils/app.js +1 -3
- package/lib/utils/appsStaleIfError.d.ts +1 -1
- package/lib/utils/appsStaleIfError.js +2 -2
- package/lib/utils/billingOptions.d.ts +3 -36
- package/lib/utils/billingOptions.js +3 -7
- package/lib/utils/binding.d.ts +3 -3
- package/lib/utils/cancel.d.ts +2 -2
- package/lib/utils/cancel.js +1 -2
- package/lib/utils/log.d.ts +3 -1
- package/lib/utils/log.js +2 -2
- package/lib/utils/message.js +1 -4
- package/lib/utils/tenant.d.ts +3 -3
- package/lib/utils/time.d.ts +2 -4
- package/lib/utils/time.js +2 -9
- package/lib/utils/unhandled.d.ts +1 -0
- package/lib/{service/worker/listeners.js → utils/unhandled.js} +15 -9
- package/package.json +2 -2
- package/CHANGELOG.md +0 -1846
- package/lib/HttpClient/agents.d.ts +0 -3
- package/lib/HttpClient/agents.js +0 -24
- package/lib/HttpClient/middlewares/request/HttpAgentSingleton.d.ts +0 -11
- package/lib/HttpClient/middlewares/request/HttpAgentSingleton.js +0 -30
- package/lib/HttpClient/middlewares/request/index.d.ts +0 -18
- package/lib/HttpClient/middlewares/request/index.js +0 -84
- package/lib/HttpClient/middlewares/request/setupAxios/index.d.ts +0 -1
- package/lib/HttpClient/middlewares/request/setupAxios/index.js +0 -20
- package/lib/HttpClient/middlewares/request/setupAxios/interceptors/exponentialBackoff.d.ts +0 -2
- package/lib/HttpClient/middlewares/request/setupAxios/interceptors/exponentialBackoff.js +0 -53
- package/lib/HttpClient/middlewares/request/setupAxios/interceptors/index.d.ts +0 -2
- package/lib/HttpClient/middlewares/request/setupAxios/interceptors/index.js +0 -7
- package/lib/HttpClient/middlewares/request/setupAxios/interceptors/tracing/index.d.ts +0 -8
- package/lib/HttpClient/middlewares/request/setupAxios/interceptors/tracing/index.js +0 -53
- package/lib/HttpClient/middlewares/request/setupAxios/interceptors/tracing/spanSetup.d.ts +0 -4
- package/lib/HttpClient/middlewares/request/setupAxios/interceptors/tracing/spanSetup.js +0 -29
- package/lib/HttpClient/middlewares/tracing.d.ts +0 -15
- package/lib/HttpClient/middlewares/tracing.js +0 -56
- package/lib/clients/IOClient.js +0 -19
- package/lib/clients/apps/Billing.d.ts +0 -12
- package/lib/clients/apps/MessagesGraphQL.d.ts +0 -61
- package/lib/clients/apps/MessagesGraphQL.js +0 -121
- package/lib/clients/apps/catalogGraphQL/brand.d.ts +0 -13
- package/lib/clients/apps/catalogGraphQL/brand.js +0 -18
- package/lib/clients/apps/catalogGraphQL/category.d.ts +0 -11
- package/lib/clients/apps/catalogGraphQL/category.js +0 -16
- package/lib/clients/apps/catalogGraphQL/index.d.ts +0 -22
- package/lib/clients/apps/catalogGraphQL/index.js +0 -88
- package/lib/clients/apps/catalogGraphQL/product.d.ts +0 -25
- package/lib/clients/apps/catalogGraphQL/product.js +0 -30
- package/lib/clients/apps/catalogGraphQL/sku.d.ts +0 -26
- package/lib/clients/apps/catalogGraphQL/sku.js +0 -30
- package/lib/clients/apps/index.d.ts +0 -7
- package/lib/clients/apps/index.js +0 -12
- package/lib/clients/external/ID.d.ts +0 -23
- package/lib/clients/external/ID.js +0 -60
- package/lib/clients/external/Masterdata.d.ts +0 -94
- package/lib/clients/external/Masterdata.js +0 -224
- package/lib/clients/external/PaymentProvider.d.ts +0 -31
- package/lib/clients/external/PaymentProvider.js +0 -42
- package/lib/clients/external/index.d.ts +0 -4
- package/lib/clients/external/index.js +0 -9
- package/lib/clients/infra/Apps.d.ts +0 -88
- package/lib/clients/infra/Apps.js +0 -508
- package/lib/clients/infra/Assets.d.ts +0 -34
- package/lib/clients/infra/BillingMetrics.d.ts +0 -13
- package/lib/clients/infra/BillingMetrics.js +0 -15
- package/lib/clients/infra/Events.d.ts +0 -12
- package/lib/clients/infra/Events.js +0 -33
- package/lib/clients/infra/Housekeeper.d.ts +0 -10
- package/lib/clients/infra/Housekeeper.js +0 -30
- package/lib/clients/infra/Metadata.d.ts +0 -26
- package/lib/clients/infra/Metadata.js +0 -83
- package/lib/clients/infra/Registry.d.ts +0 -59
- package/lib/clients/infra/Router.d.ts +0 -34
- package/lib/clients/infra/Router.js +0 -81
- package/lib/clients/infra/Sphinx.d.ts +0 -13
- package/lib/clients/infra/Sphinx.js +0 -29
- package/lib/clients/infra/VBase.d.ts +0 -60
- package/lib/clients/infra/VBase.js +0 -196
- package/lib/clients/infra/Workspaces.d.ts +0 -18
- package/lib/clients/infra/Workspaces.js +0 -65
- package/lib/clients/infra/index.d.ts +0 -12
- package/lib/clients/infra/index.js +0 -17
- package/lib/clients/janus/LicenseManager.d.ts +0 -7
- package/lib/clients/janus/Segment.js +0 -88
- package/lib/clients/janus/Tenant.js +0 -28
- package/lib/clients/janus/index.d.ts +0 -5
- package/lib/clients/janus/index.js +0 -10
- package/lib/service/index.d.ts +0 -2
- package/lib/service/index.js +0 -30
- package/lib/service/loaders.d.ts +0 -8
- package/lib/service/loaders.js +0 -54
- package/lib/service/logger/console.d.ts +0 -10
- package/lib/service/logger/console.js +0 -36
- package/lib/service/logger/logger.d.ts +0 -29
- package/lib/service/logger/logger.js +0 -61
- package/lib/service/logger/metricsLogger.d.ts +0 -40
- package/lib/service/logger/metricsLogger.js +0 -149
- package/lib/service/master.d.ts +0 -2
- package/lib/service/master.js +0 -87
- package/lib/service/metrics/requestMetricsMiddleware.d.ts +0 -2
- package/lib/service/metrics/requestMetricsMiddleware.js +0 -44
- package/lib/service/tracing/TracerSingleton.d.ts +0 -7
- package/lib/service/tracing/TracerSingleton.js +0 -48
- package/lib/service/tracing/metrics/MetricNames.d.ts +0 -60
- package/lib/service/tracing/metrics/MetricNames.js +0 -44
- package/lib/service/tracing/metrics/instruments.d.ts +0 -9
- package/lib/service/tracing/metrics/instruments.js +0 -11
- package/lib/service/tracing/metrics/measurers/EventLoopLagMeasurer.d.ts +0 -9
- package/lib/service/tracing/metrics/measurers/EventLoopLagMeasurer.js +0 -25
- package/lib/service/tracing/tracingMiddlewares.d.ts +0 -5
- package/lib/service/tracing/tracingMiddlewares.js +0 -107
- package/lib/service/worker/index.d.ts +0 -11
- package/lib/service/worker/index.js +0 -195
- package/lib/service/worker/listeners.d.ts +0 -3
- package/lib/service/worker/runtime/builtIn/handlers.d.ts +0 -4
- package/lib/service/worker/runtime/builtIn/handlers.js +0 -30
- package/lib/service/worker/runtime/builtIn/middlewares.d.ts +0 -4
- package/lib/service/worker/runtime/builtIn/middlewares.js +0 -40
- package/lib/service/worker/runtime/events/index.d.ts +0 -4
- package/lib/service/worker/runtime/events/index.js +0 -46
- package/lib/service/worker/runtime/events/middlewares/body.d.ts +0 -3
- package/lib/service/worker/runtime/events/middlewares/body.js +0 -22
- package/lib/service/worker/runtime/events/middlewares/context.d.ts +0 -3
- package/lib/service/worker/runtime/events/middlewares/context.js +0 -22
- package/lib/service/worker/runtime/events/router.d.ts +0 -2
- package/lib/service/worker/runtime/events/router.js +0 -27
- package/lib/service/worker/runtime/graphql/index.d.ts +0 -6
- package/lib/service/worker/runtime/graphql/index.js +0 -27
- package/lib/service/worker/runtime/graphql/middlewares/context.d.ts +0 -2
- package/lib/service/worker/runtime/graphql/middlewares/context.js +0 -16
- package/lib/service/worker/runtime/graphql/middlewares/error.js +0 -93
- package/lib/service/worker/runtime/graphql/middlewares/query.d.ts +0 -2
- package/lib/service/worker/runtime/graphql/middlewares/query.js +0 -52
- package/lib/service/worker/runtime/graphql/middlewares/response.js +0 -38
- package/lib/service/worker/runtime/graphql/middlewares/run.d.ts +0 -2
- package/lib/service/worker/runtime/graphql/middlewares/run.js +0 -19
- package/lib/service/worker/runtime/graphql/middlewares/updateSchema.d.ts +0 -4
- package/lib/service/worker/runtime/graphql/middlewares/updateSchema.js +0 -28
- package/lib/service/worker/runtime/graphql/middlewares/upload.d.ts +0 -4
- package/lib/service/worker/runtime/graphql/schema/index.d.ts +0 -7
- package/lib/service/worker/runtime/graphql/schema/index.js +0 -31
- package/lib/service/worker/runtime/graphql/schema/messagesLoaderV2.d.ts +0 -6
- package/lib/service/worker/runtime/graphql/schema/messagesLoaderV2.js +0 -79
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/CacheControl.d.ts +0 -7
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/CacheControl.js +0 -37
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/Deprecated.d.ts +0 -11
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/Deprecated.js +0 -61
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/Metric.d.ts +0 -7
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/Metric.js +0 -40
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/Settings.d.ts +0 -6
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/Settings.js +0 -34
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/TranslatableV2.d.ts +0 -7
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/TranslatableV2.js +0 -39
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/TranslateTo.js +0 -33
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/index.d.ts +0 -22
- package/lib/service/worker/runtime/graphql/schema/schemaDirectives/index.js +0 -36
- package/lib/service/worker/runtime/graphql/schema/typeDefs/index.d.ts +0 -7
- package/lib/service/worker/runtime/graphql/schema/typeDefs/index.js +0 -12
- package/lib/service/worker/runtime/graphql/typings.d.ts +0 -31
- package/lib/service/worker/runtime/graphql/utils/cacheControl.d.ts +0 -1
- package/lib/service/worker/runtime/graphql/utils/cacheControl.js +0 -32
- package/lib/service/worker/runtime/graphql/utils/error.d.ts +0 -1
- package/lib/service/worker/runtime/graphql/utils/error.js +0 -76
- package/lib/service/worker/runtime/graphql/utils/translations.d.ts +0 -14
- package/lib/service/worker/runtime/graphql/utils/translations.js +0 -38
- package/lib/service/worker/runtime/http/index.d.ts +0 -5
- package/lib/service/worker/runtime/http/index.js +0 -58
- package/lib/service/worker/runtime/http/middlewares/authTokens.d.ts +0 -3
- package/lib/service/worker/runtime/http/middlewares/cancellationToken.d.ts +0 -3
- package/lib/service/worker/runtime/http/middlewares/clients.d.ts +0 -4
- package/lib/service/worker/runtime/http/middlewares/context.d.ts +0 -4
- package/lib/service/worker/runtime/http/middlewares/context.js +0 -36
- package/lib/service/worker/runtime/http/middlewares/error.d.ts +0 -2
- package/lib/service/worker/runtime/http/middlewares/rateLimit.d.ts +0 -6
- package/lib/service/worker/runtime/http/middlewares/rateLimit.js +0 -42
- package/lib/service/worker/runtime/http/middlewares/setCookie.d.ts +0 -3
- package/lib/service/worker/runtime/http/middlewares/settings.d.ts +0 -9
- package/lib/service/worker/runtime/http/middlewares/settings.js +0 -44
- package/lib/service/worker/runtime/http/middlewares/timings.d.ts +0 -3
- package/lib/service/worker/runtime/http/middlewares/vary.d.ts +0 -3
- package/lib/service/worker/runtime/http/router.d.ts +0 -2
- package/lib/service/worker/runtime/http/router.js +0 -23
- package/lib/service/worker/runtime/http/routes.d.ts +0 -19
- package/lib/service/worker/runtime/http/routes.js +0 -12
- package/lib/service/worker/runtime/method.d.ts +0 -9
- package/lib/service/worker/runtime/statusTrack.d.ts +0 -14
- package/lib/service/worker/runtime/statusTrack.js +0 -37
- package/lib/service/worker/runtime/utils/compose.d.ts +0 -5
- package/lib/service/worker/runtime/utils/context.d.ts +0 -2
- package/lib/service/worker/runtime/utils/context.js +0 -40
- package/lib/service/worker/runtime/utils/diff.d.ts +0 -12
- package/lib/service/worker/runtime/utils/diff.js +0 -21
- package/lib/service/worker/runtime/utils/recorder.d.ts +0 -8
- package/lib/service/worker/runtime/utils/recorder.js +0 -37
- package/lib/service/worker/runtime/utils/tokenBucket.d.ts +0 -2
- package/lib/service/worker/runtime/utils/tokenBucket.js +0 -16
- package/lib/tracing/LogEvents.d.ts +0 -31
- package/lib/tracing/LogEvents.js +0 -3
- package/lib/tracing/LogFields.d.ts +0 -66
- package/lib/tracing/LogFields.js +0 -3
- package/lib/tracing/Tags.d.ts +0 -81
- package/lib/tracing/Tags.js +0 -7
- package/lib/tracing/UserLandTracer.d.ts +0 -27
- package/lib/tracing/UserLandTracer.js +0 -56
- package/lib/tracing/errorReporting/ErrorReport.d.ts +0 -31
- package/lib/tracing/errorReporting/ErrorReport.js +0 -70
- package/lib/tracing/index.d.ts +0 -9
- package/lib/tracing/index.js +0 -19
- package/lib/tracing/spanReference/SpanReferenceTypes.d.ts +0 -4
- package/lib/tracing/spanReference/SpanReferenceTypes.js +0 -7
- package/lib/tracing/spanReference/createSpanReference.d.ts +0 -3
- package/lib/tracing/spanReference/createSpanReference.js +0 -8
- package/lib/tracing/utils.d.ts +0 -13
- package/lib/tracing/utils.js +0 -40
- package/lib/utils/conflicts.mock.d.ts +0 -17
- package/lib/utils/conflicts.mock.js +0 -27
- /package/lib/service/{worker/runtime/graphql → graphql}/middlewares/error.d.ts +0 -0
- /package/lib/service/{worker/runtime/graphql → graphql}/middlewares/response.d.ts +0 -0
- /package/lib/service/{worker/runtime/graphql → graphql}/middlewares/upload.js +0 -0
- /package/lib/service/{worker/runtime/graphql → graphql}/schema/typeDefs/ioUpload.d.ts +0 -0
- /package/lib/service/{worker/runtime/graphql → graphql}/schema/typeDefs/ioUpload.js +0 -0
- /package/lib/service/{worker/runtime/graphql → graphql}/schema/typeDefs/sanitizedString.d.ts +0 -0
- /package/lib/service/{worker/runtime/graphql → graphql}/typings.js +0 -0
- /package/lib/service/{worker/runtime/utils/toArray.d.ts → graphql/utils/array.d.ts} +0 -0
- /package/lib/service/{worker/runtime/utils/toArray.js → graphql/utils/array.js} +0 -0
- /package/lib/service/{worker/runtime/graphql → graphql}/utils/pathname.d.ts +0 -0
- /package/lib/service/{worker/runtime/graphql → graphql}/utils/pathname.js +0 -0
- /package/lib/service/{worker/runtime/http → http}/middlewares/authTokens.js +0 -0
- /package/lib/service/{worker/runtime/http → http}/middlewares/clients.js +0 -0
- /package/lib/service/{worker/runtime/http → http}/middlewares/requestStats.js +0 -0
- /package/lib/service/{worker/runtime/http → http}/middlewares/setCookie.js +0 -0
- /package/lib/service/{worker/runtime/method.js → method.js} +0 -0
- /package/lib/service/{worker/runtime/typings.js → typings.js} +0 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const HttpClient_1 = require("../HttpClient");
|
|
4
|
+
const error_1 = require("../utils/error");
|
|
5
|
+
const DEFAULT_SUBJECT = '-';
|
|
6
|
+
var LogLevel;
|
|
7
|
+
(function (LogLevel) {
|
|
8
|
+
LogLevel["Debug"] = "debug";
|
|
9
|
+
LogLevel["Info"] = "info";
|
|
10
|
+
LogLevel["Warn"] = "warn";
|
|
11
|
+
LogLevel["Error"] = "error";
|
|
12
|
+
})(LogLevel = exports.LogLevel || (exports.LogLevel = {}));
|
|
13
|
+
class Logger extends HttpClient_1.InfraClient {
|
|
14
|
+
constructor(context, options) {
|
|
15
|
+
super('colossus@0.x', Object.assign({}, context, { recorder: undefined }), Object.assign({}, options, { concurrency: 1 }));
|
|
16
|
+
this.debug = (message, subject = DEFAULT_SUBJECT) => this.sendLog(subject, message, LogLevel.Debug);
|
|
17
|
+
this.info = (message, subject = DEFAULT_SUBJECT) => this.sendLog(subject, message, LogLevel.Info);
|
|
18
|
+
this.warn = (warning, subject = DEFAULT_SUBJECT) => this.sendLog(subject, error_1.cleanError(warning), LogLevel.Warn);
|
|
19
|
+
this.error = (error, subject = DEFAULT_SUBJECT) => this.sendLog(subject, error_1.cleanError(error), LogLevel.Error);
|
|
20
|
+
this.sendLog = (_, message, level) => {
|
|
21
|
+
// Use stdout logger
|
|
22
|
+
if (this.logger) {
|
|
23
|
+
this.logger.log(message, level);
|
|
24
|
+
}
|
|
25
|
+
// Deprecate logging to colossus
|
|
26
|
+
console.warn('Logger in ctx.clients.logger is deprecated, please use ctx.vtex.logger instead.');
|
|
27
|
+
return Promise.resolve();
|
|
28
|
+
};
|
|
29
|
+
this.logger = context.logger;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.Logger = Logger;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { AppClient, InstanceOptions } from '../HttpClient';
|
|
2
|
+
import { IOContext } from '../service/typings';
|
|
3
|
+
import { IOMessage } from '../utils/message';
|
|
4
|
+
interface Locale {
|
|
5
|
+
[token: string]: string;
|
|
6
|
+
}
|
|
7
|
+
interface Locales {
|
|
8
|
+
[lang: string]: Locale;
|
|
9
|
+
}
|
|
10
|
+
interface LocalesByProvider {
|
|
11
|
+
[provider: string]: Locales;
|
|
12
|
+
}
|
|
13
|
+
export declare class Messages extends AppClient {
|
|
14
|
+
constructor(vtex: IOContext, options?: InstanceOptions);
|
|
15
|
+
translate: (to: string, data: IOMessage[]) => Promise<string[]>;
|
|
16
|
+
saveTranslation: (data: LocalesByProvider) => Promise<void>;
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const HttpClient_1 = require("../HttpClient");
|
|
4
|
+
class Messages extends HttpClient_1.AppClient {
|
|
5
|
+
constructor(vtex, options) {
|
|
6
|
+
super('vtex.messages@1.x', vtex, options);
|
|
7
|
+
this.translate = (to, data) => this.http.get('/_v/translations', {
|
|
8
|
+
inflightKey: HttpClient_1.inflightUrlWithQuery,
|
|
9
|
+
metric: 'messages-translate',
|
|
10
|
+
params: {
|
|
11
|
+
data: JSON.stringify(data),
|
|
12
|
+
to,
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
this.saveTranslation = (data) => this.http.post('/_v/translations', data, {
|
|
16
|
+
metric: 'messages-save-translation',
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.Messages = Messages;
|
|
@@ -0,0 +1,63 @@
|
|
|
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 {};
|
|
@@ -0,0 +1,50 @@
|
|
|
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;
|
|
@@ -0,0 +1,25 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
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;
|
|
@@ -0,0 +1,61 @@
|
|
|
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 {};
|
|
@@ -6,9 +6,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const archiver_1 = __importDefault(require("archiver"));
|
|
7
7
|
const tar_fs_1 = require("tar-fs");
|
|
8
8
|
const zlib_1 = require("zlib");
|
|
9
|
-
const constants_1 = require("
|
|
10
|
-
const HttpClient_1 = require("
|
|
11
|
-
const InfraClient_1 = require("./InfraClient");
|
|
9
|
+
const constants_1 = require("../constants");
|
|
10
|
+
const HttpClient_1 = require("../HttpClient");
|
|
12
11
|
const EMPTY_OBJECT = {};
|
|
13
12
|
const routes = {
|
|
14
13
|
App: (app) => `${routes.Registry}/${app}`,
|
|
@@ -17,103 +16,66 @@ const routes = {
|
|
|
17
16
|
},
|
|
18
17
|
AppFile: (app, version, path) => `${routes.AppFiles(app, version)}/${path}`,
|
|
19
18
|
AppFiles: (app, version) => `${routes.AppVersion(app, version)}/files`,
|
|
20
|
-
|
|
19
|
+
AppQueryString: (basePath, appQueryString) => appQueryString ? `${basePath}?${appQueryString.name}=${appQueryString.value}` : basePath,
|
|
21
20
|
AppVersion: (app, version) => `${routes.App(app)}/${version}`,
|
|
22
21
|
Publish: '/v2/registry',
|
|
23
22
|
PublishRc: '/v2/registry/rc',
|
|
24
23
|
Registry: '/registry',
|
|
25
24
|
ResolveDependenciesWithManifest: '/v2/registry/_resolve',
|
|
26
25
|
};
|
|
27
|
-
class Registry extends
|
|
26
|
+
class Registry extends HttpClient_1.InfraClient {
|
|
28
27
|
constructor(context, options) {
|
|
29
|
-
super('apps@0.x', {
|
|
30
|
-
this.
|
|
31
|
-
|
|
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);
|
|
28
|
+
super('apps@0.x', Object.assign({}, context, { workspace: constants_1.DEFAULT_WORKSPACE }), options);
|
|
29
|
+
this.publishApp = (files, tag, { zlib } = {}) => {
|
|
30
|
+
return this.publish(routes.Publish, files, tag, { zlib });
|
|
44
31
|
};
|
|
45
|
-
this.publishAppRc = (files, tag, { zlib } = {}
|
|
46
|
-
return this.publish(routes.PublishRc, files, tag, { zlib }
|
|
32
|
+
this.publishAppRc = (files, tag, { zlib } = {}) => {
|
|
33
|
+
return this.publish(routes.PublishRc, files, tag, { zlib });
|
|
47
34
|
};
|
|
48
|
-
this.listApps = (
|
|
35
|
+
this.listApps = () => {
|
|
49
36
|
const inflightKey = HttpClient_1.inflightURL;
|
|
50
37
|
const metric = 'registry-list';
|
|
51
|
-
return this.http.get(routes.Registry, {
|
|
52
|
-
requestSpanNameSuffix: metric,
|
|
53
|
-
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
54
|
-
} });
|
|
38
|
+
return this.http.get(routes.Registry, { metric, inflightKey });
|
|
55
39
|
};
|
|
56
|
-
this.listVersionsByApp = (app
|
|
40
|
+
this.listVersionsByApp = (app) => {
|
|
57
41
|
const inflightKey = HttpClient_1.inflightURL;
|
|
58
42
|
const metric = 'registry-list-versions';
|
|
59
|
-
return this.http.get(routes.App(app), {
|
|
60
|
-
requestSpanNameSuffix: metric,
|
|
61
|
-
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
62
|
-
} });
|
|
43
|
+
return this.http.get(routes.App(app), { metric, inflightKey });
|
|
63
44
|
};
|
|
64
|
-
this.deprecateApp = (app, version
|
|
45
|
+
this.deprecateApp = (app, version) => {
|
|
65
46
|
const metric = 'registry-deprecate';
|
|
66
|
-
return this.http.patch(routes.AppVersion(app, version), { patchState: 'deprecate' }, { metric
|
|
67
|
-
requestSpanNameSuffix: metric,
|
|
68
|
-
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
69
|
-
} });
|
|
47
|
+
return this.http.patch(routes.AppVersion(app, version), { patchState: 'deprecate' }, { metric });
|
|
70
48
|
};
|
|
71
|
-
this.undeprecateApp = (app, version
|
|
49
|
+
this.undeprecateApp = (app, version) => {
|
|
72
50
|
const metric = 'registry-undeprecate';
|
|
73
|
-
return this.http.patch(routes.AppVersion(app, version), { patchState: 'undeprecate' }, { metric
|
|
74
|
-
requestSpanNameSuffix: metric,
|
|
75
|
-
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
76
|
-
} });
|
|
51
|
+
return this.http.patch(routes.AppVersion(app, version), { patchState: 'undeprecate' }, { metric });
|
|
77
52
|
};
|
|
78
|
-
this.validateApp = (app, version,
|
|
53
|
+
this.validateApp = (app, version, appQueryString) => {
|
|
79
54
|
const metric = 'registry-validate';
|
|
80
|
-
return this.http.patch(routes.AppVersion(app, version), { patchState: 'validate' }, { metric
|
|
81
|
-
requestSpanNameSuffix: metric,
|
|
82
|
-
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
83
|
-
} });
|
|
55
|
+
return this.http.patch(routes.AppQueryString(routes.AppVersion(app, version), appQueryString), { patchState: 'validate' }, { metric });
|
|
84
56
|
};
|
|
85
|
-
this.getAppManifest = (app, version, opts
|
|
57
|
+
this.getAppManifest = (app, version, opts) => {
|
|
86
58
|
const inflightKey = HttpClient_1.inflightUrlWithQuery;
|
|
87
59
|
const params = opts;
|
|
88
60
|
const metric = 'registry-manifest';
|
|
89
|
-
return this.http.get(routes.AppVersion(app, version), {
|
|
90
|
-
requestSpanNameSuffix: metric,
|
|
91
|
-
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
92
|
-
} });
|
|
61
|
+
return this.http.get(routes.AppVersion(app, version), { params, metric, inflightKey });
|
|
93
62
|
};
|
|
94
|
-
this.listAppFiles = (app, version, opts
|
|
63
|
+
this.listAppFiles = (app, version, opts) => {
|
|
95
64
|
const inflightKey = HttpClient_1.inflightUrlWithQuery;
|
|
96
65
|
const params = opts;
|
|
97
66
|
const metric = 'registry-list-files';
|
|
98
|
-
return this.http.get(routes.AppFiles(app, version), {
|
|
99
|
-
requestSpanNameSuffix: metric,
|
|
100
|
-
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
101
|
-
} });
|
|
67
|
+
return this.http.get(routes.AppFiles(app, version), { params, metric, inflightKey });
|
|
102
68
|
};
|
|
103
|
-
this.getAppFile = (app, version, path
|
|
69
|
+
this.getAppFile = (app, version, path) => {
|
|
104
70
|
const inflightKey = HttpClient_1.inflightURL;
|
|
105
71
|
const metric = 'registry-get-file';
|
|
106
72
|
return this.http.getBuffer(routes.AppFile(app, version, path), {
|
|
107
73
|
cacheable: HttpClient_1.CacheType.Disk,
|
|
108
74
|
inflightKey,
|
|
109
75
|
metric,
|
|
110
|
-
tracing: {
|
|
111
|
-
requestSpanNameSuffix: metric,
|
|
112
|
-
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
113
|
-
},
|
|
114
76
|
});
|
|
115
77
|
};
|
|
116
|
-
this.getAppJSON = (app, version, path, nullIfNotFound
|
|
78
|
+
this.getAppJSON = (app, version, path, nullIfNotFound) => {
|
|
117
79
|
const inflightKey = HttpClient_1.inflightURL;
|
|
118
80
|
const metric = 'registry-get-json';
|
|
119
81
|
return this.http.get(routes.AppFile(app, version, path), {
|
|
@@ -121,23 +83,12 @@ class Registry extends InfraClient_1.InfraClient {
|
|
|
121
83
|
inflightKey,
|
|
122
84
|
metric,
|
|
123
85
|
nullIfNotFound,
|
|
124
|
-
tracing: {
|
|
125
|
-
requestSpanNameSuffix: metric,
|
|
126
|
-
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
127
|
-
},
|
|
128
86
|
});
|
|
129
87
|
};
|
|
130
|
-
this.getAppFileStream = (app, version, path
|
|
131
|
-
|
|
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
|
-
});
|
|
88
|
+
this.getAppFileStream = (app, version, path) => {
|
|
89
|
+
return this.http.getStream(routes.AppFile(app, version, path), { metric: 'registry-get-file-s' });
|
|
139
90
|
};
|
|
140
|
-
this.getAppBundle = (app, version, bundlePath, generatePackageJson
|
|
91
|
+
this.getAppBundle = (app, version, bundlePath, generatePackageJson) => {
|
|
141
92
|
const params = generatePackageJson && { _packageJSONEngine: 'npm', _packageJSONFilter: 'vtex.render-builder@x' };
|
|
142
93
|
const metric = 'registry-get-bundle';
|
|
143
94
|
return this.http.getStream(routes.AppBundle(app, version, bundlePath), {
|
|
@@ -147,27 +98,20 @@ class Registry extends InfraClient_1.InfraClient {
|
|
|
147
98
|
},
|
|
148
99
|
metric,
|
|
149
100
|
params,
|
|
150
|
-
tracing: {
|
|
151
|
-
requestSpanNameSuffix: metric,
|
|
152
|
-
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
153
|
-
},
|
|
154
101
|
});
|
|
155
102
|
};
|
|
156
|
-
this.unpackAppBundle = (app, version, bundlePath, unpackPath, generatePackageJson
|
|
157
|
-
return this.getAppBundle(app, version, bundlePath, generatePackageJson
|
|
103
|
+
this.unpackAppBundle = (app, version, bundlePath, unpackPath, generatePackageJson) => {
|
|
104
|
+
return this.getAppBundle(app, version, bundlePath, generatePackageJson)
|
|
158
105
|
.then(stream => stream
|
|
159
106
|
.pipe(zlib_1.createGunzip())
|
|
160
107
|
.pipe(tar_fs_1.extract(unpackPath)));
|
|
161
108
|
};
|
|
162
|
-
this.resolveDependenciesWithManifest = (manifest, filter = ''
|
|
109
|
+
this.resolveDependenciesWithManifest = (manifest, filter = '') => {
|
|
163
110
|
const params = { filter };
|
|
164
111
|
const metric = 'registry-resolve-deps';
|
|
165
|
-
return this.http.post(routes.ResolveDependenciesWithManifest, manifest, {
|
|
166
|
-
requestSpanNameSuffix: metric,
|
|
167
|
-
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
168
|
-
} });
|
|
112
|
+
return this.http.post(routes.ResolveDependenciesWithManifest, manifest, { params, metric });
|
|
169
113
|
};
|
|
170
|
-
this.publish = async (route, files, tag, { zlib } = {}
|
|
114
|
+
this.publish = async (route, files, tag, { zlib } = {}) => {
|
|
171
115
|
if (!(files[0] && files[0].path && files[0].content)) {
|
|
172
116
|
throw new Error('Argument files must be an array of {path, content}, where content can be a String, a Buffer or a ReadableStream.');
|
|
173
117
|
}
|
|
@@ -185,10 +129,6 @@ class Registry extends InfraClient_1.InfraClient {
|
|
|
185
129
|
headers: { 'Content-Type': 'application/zip' },
|
|
186
130
|
metric,
|
|
187
131
|
params: tag ? { tag } : EMPTY_OBJECT,
|
|
188
|
-
tracing: {
|
|
189
|
-
requestSpanNameSuffix: metric,
|
|
190
|
-
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
191
|
-
},
|
|
192
132
|
});
|
|
193
133
|
files.forEach(({ content, path }) => zip.append(content, { name: path }));
|
|
194
134
|
const finalize = zip.finalize();
|
|
@@ -0,0 +1,33 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
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;
|