@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
|
@@ -1,508 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const archiver_1 = __importDefault(require("archiver"));
|
|
7
|
-
const tar_fs_1 = require("tar-fs");
|
|
8
|
-
const zlib_1 = require("zlib");
|
|
9
|
-
const HttpClient_1 = require("../../HttpClient");
|
|
10
|
-
const utils_1 = require("../../utils");
|
|
11
|
-
const appsStaleIfError_1 = require("../../utils/appsStaleIfError");
|
|
12
|
-
const InfraClient_1 = require("./InfraClient");
|
|
13
|
-
const createRoutes = ({ account, workspace }) => {
|
|
14
|
-
const routes = {
|
|
15
|
-
Acknowledge: (app, service) => `${routes.App(app)}/acknowledge/${service}`,
|
|
16
|
-
App: (app) => `${routes.Apps()}/${app}`,
|
|
17
|
-
AppBundle: (locator, path) => `${routes.AppOrRegistry(locator)}/bundle/${path}`,
|
|
18
|
-
AppOrRegistry: ({ name, version, build }) => build
|
|
19
|
-
? `${routes.Apps()}/${name}@${version}+${build}`
|
|
20
|
-
: `${routes.Registry()}/${name}/${version}`,
|
|
21
|
-
Apps: () => `${routes.Workspace}/apps`,
|
|
22
|
-
Dependencies: () => `${routes.Workspace}/dependencies`,
|
|
23
|
-
File: (locator, path) => `${routes.Files(locator)}/${path}`,
|
|
24
|
-
FileFromApps: (app, path) => `${routes.Workspace}/apps/${app}/files/${path}`,
|
|
25
|
-
Files: (locator) => `${routes.AppOrRegistry(locator)}/files`,
|
|
26
|
-
Link: (app) => `${routes.Workspace}/v2/links/${app}`,
|
|
27
|
-
Links: () => `${routes.Workspace}/links`,
|
|
28
|
-
Master: `/${account}/master`,
|
|
29
|
-
Meta: () => `${routes.Workspace}/v2/apps`,
|
|
30
|
-
Registry: () => `${routes.Master}/registry`,
|
|
31
|
-
ResolveDependencies: () => `${routes.Workspace}/dependencies/_resolve`,
|
|
32
|
-
ResolveDependenciesWithManifest: () => `${routes.Workspace}/v2/apps/_resolve`,
|
|
33
|
-
Settings: (app) => `${routes.App(app)}/settings`,
|
|
34
|
-
Unlink: (app) => `${routes.Links()}/${app}`,
|
|
35
|
-
Workspace: `/${account}/${workspace}`,
|
|
36
|
-
};
|
|
37
|
-
return routes;
|
|
38
|
-
};
|
|
39
|
-
const getVendorAndName = ({ id }) => utils_1.removeVersionFromAppId(id);
|
|
40
|
-
const notFound = (e) => {
|
|
41
|
-
if (e.response && e.response.status === 404) {
|
|
42
|
-
return {};
|
|
43
|
-
}
|
|
44
|
-
throw e;
|
|
45
|
-
};
|
|
46
|
-
const zipObj = (keys, values) => {
|
|
47
|
-
let idx = 0;
|
|
48
|
-
const len = Math.min(keys.length, values.length);
|
|
49
|
-
const out = {};
|
|
50
|
-
while (idx < len) {
|
|
51
|
-
out[keys[idx]] = values[idx];
|
|
52
|
-
idx += 1;
|
|
53
|
-
}
|
|
54
|
-
return out;
|
|
55
|
-
};
|
|
56
|
-
// 🚨🚨🚨
|
|
57
|
-
// In order to make changes in here, please also change the colossus App so we
|
|
58
|
-
// share the same cache key and do NOT call Apps unecessarily
|
|
59
|
-
const workspaceFields = [
|
|
60
|
-
'_activationDate',
|
|
61
|
-
'_buildFeatures',
|
|
62
|
-
'_isRoot',
|
|
63
|
-
'_resolvedDependencies',
|
|
64
|
-
'credentialType',
|
|
65
|
-
'link',
|
|
66
|
-
'name',
|
|
67
|
-
'registry',
|
|
68
|
-
'settingsSchema',
|
|
69
|
-
'vendor',
|
|
70
|
-
'version',
|
|
71
|
-
].join(',');
|
|
72
|
-
class Apps extends InfraClient_1.InfraClient {
|
|
73
|
-
constructor(context, options) {
|
|
74
|
-
super('apps@0.x', context, options, true);
|
|
75
|
-
this.installApp = (descriptor, tracingConfig) => {
|
|
76
|
-
if (descriptor.startsWith('infra:service-')) {
|
|
77
|
-
return this.installRuntime(descriptor, tracingConfig);
|
|
78
|
-
}
|
|
79
|
-
const metric = 'apps-install';
|
|
80
|
-
return this.http.post(this.routes.Apps(), { id: descriptor }, {
|
|
81
|
-
metric,
|
|
82
|
-
tracing: {
|
|
83
|
-
requestSpanNameSuffix: metric,
|
|
84
|
-
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
85
|
-
},
|
|
86
|
-
});
|
|
87
|
-
};
|
|
88
|
-
this.uninstallApp = (app, tracingConfig) => {
|
|
89
|
-
const metric = 'apps-uninstall';
|
|
90
|
-
return this.http.delete(this.routes.App(app), {
|
|
91
|
-
metric,
|
|
92
|
-
tracing: {
|
|
93
|
-
requestSpanNameSuffix: metric,
|
|
94
|
-
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
95
|
-
},
|
|
96
|
-
});
|
|
97
|
-
};
|
|
98
|
-
this.acknowledgeApp = (app, service, tracingConfig) => {
|
|
99
|
-
const metric = 'apps-ack';
|
|
100
|
-
return this.http.put(this.routes.Acknowledge(app, service), null, {
|
|
101
|
-
metric,
|
|
102
|
-
tracing: {
|
|
103
|
-
requestSpanNameSuffix: metric,
|
|
104
|
-
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
105
|
-
},
|
|
106
|
-
});
|
|
107
|
-
};
|
|
108
|
-
this.link = async (app, files, { zlib } = {}, tracingConfig) => {
|
|
109
|
-
if (!(files[0] && files[0].path)) {
|
|
110
|
-
throw new Error('Argument files must be an array of {path, content}, where content can be a String, a Buffer or a ReadableStream.');
|
|
111
|
-
}
|
|
112
|
-
const emptyChanges = files.filter(file => !file.content);
|
|
113
|
-
if (emptyChanges.length > 0) {
|
|
114
|
-
throw new Error(`Missing content for paths: ${emptyChanges.map(e => e.path).join('; ')}`);
|
|
115
|
-
}
|
|
116
|
-
const indexOfManifest = files.findIndex(({ path }) => path === 'manifest.json');
|
|
117
|
-
if (indexOfManifest === -1) {
|
|
118
|
-
throw new Error('No manifest.json file found in files.');
|
|
119
|
-
}
|
|
120
|
-
const zip = archiver_1.default('zip', { zlib });
|
|
121
|
-
// Throw stream errors so they reject the promise chain.
|
|
122
|
-
zip.on('error', (e) => {
|
|
123
|
-
throw e;
|
|
124
|
-
});
|
|
125
|
-
const metric = 'apps-link';
|
|
126
|
-
const request = this.http.put(this.routes.Link(app), zip, {
|
|
127
|
-
headers: { 'Content-Type': 'application/zip' },
|
|
128
|
-
metric,
|
|
129
|
-
tracing: {
|
|
130
|
-
requestSpanNameSuffix: metric,
|
|
131
|
-
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
132
|
-
},
|
|
133
|
-
});
|
|
134
|
-
files.forEach(({ content, path }) => zip.append(content, { name: path }));
|
|
135
|
-
const finalize = zip.finalize();
|
|
136
|
-
try {
|
|
137
|
-
const [response] = await Promise.all([request, finalize]);
|
|
138
|
-
response.bundleSize = zip.pointer();
|
|
139
|
-
return response;
|
|
140
|
-
}
|
|
141
|
-
catch (e) {
|
|
142
|
-
e.bundleSize = zip.pointer();
|
|
143
|
-
throw e;
|
|
144
|
-
}
|
|
145
|
-
};
|
|
146
|
-
this.patch = async (app, changes, { zlib } = {}, tracingConfig) => {
|
|
147
|
-
if (!(changes[0] && changes[0].path)) {
|
|
148
|
-
throw new Error('Argument changes must be an array of {path, content}, where content can be a String, a Buffer or a ReadableStream.');
|
|
149
|
-
}
|
|
150
|
-
const files = changes.filter(change => !!change.content);
|
|
151
|
-
const deletedFiles = changes
|
|
152
|
-
.filter(change => !change.content)
|
|
153
|
-
.map(change => change.path)
|
|
154
|
-
.join(':');
|
|
155
|
-
const zip = archiver_1.default('zip', { zlib });
|
|
156
|
-
// Throw stream errors so they reject the promise chain.
|
|
157
|
-
zip.on('error', (e) => {
|
|
158
|
-
throw e;
|
|
159
|
-
});
|
|
160
|
-
const metric = 'apps-patch';
|
|
161
|
-
const request = this.http.patch(this.routes.Link(app), zip, {
|
|
162
|
-
headers: { 'Content-Type': 'application/zip' },
|
|
163
|
-
metric,
|
|
164
|
-
params: { deletedFiles },
|
|
165
|
-
tracing: {
|
|
166
|
-
requestSpanNameSuffix: metric,
|
|
167
|
-
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
168
|
-
},
|
|
169
|
-
});
|
|
170
|
-
files.forEach(({ content, path }) => zip.append(content, { name: path }));
|
|
171
|
-
const finalize = zip.finalize();
|
|
172
|
-
const [response] = await Promise.all([request, finalize]);
|
|
173
|
-
return response;
|
|
174
|
-
};
|
|
175
|
-
this.unlink = (app, tracingConfig) => {
|
|
176
|
-
return this.http.delete(this.routes.Unlink(app), {
|
|
177
|
-
tracing: {
|
|
178
|
-
requestSpanNameSuffix: 'apps-unlink',
|
|
179
|
-
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
180
|
-
},
|
|
181
|
-
});
|
|
182
|
-
};
|
|
183
|
-
this.unlinkAll = (tracingConfig) => {
|
|
184
|
-
return this.http.delete(this.routes.Links(), {
|
|
185
|
-
tracing: {
|
|
186
|
-
requestSpanNameSuffix: 'apps-unlink-all',
|
|
187
|
-
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
188
|
-
},
|
|
189
|
-
});
|
|
190
|
-
};
|
|
191
|
-
this.saveAppSettings = (app, settings, tracingConfig) => {
|
|
192
|
-
const headers = { 'Content-Type': 'application/json' };
|
|
193
|
-
const metric = 'apps-save';
|
|
194
|
-
return this.http.put(this.routes.Settings(app), settings, {
|
|
195
|
-
headers,
|
|
196
|
-
metric,
|
|
197
|
-
tracing: {
|
|
198
|
-
requestSpanNameSuffix: metric,
|
|
199
|
-
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
200
|
-
},
|
|
201
|
-
});
|
|
202
|
-
};
|
|
203
|
-
this.listApps = ({ oldVersion, since, service } = {}, tracingConfig) => {
|
|
204
|
-
const params = {
|
|
205
|
-
oldVersion,
|
|
206
|
-
service,
|
|
207
|
-
since,
|
|
208
|
-
};
|
|
209
|
-
const metric = 'apps-list';
|
|
210
|
-
const inflightKey = HttpClient_1.inflightUrlWithQuery;
|
|
211
|
-
return this.http.get(this.routes.Apps(), {
|
|
212
|
-
inflightKey,
|
|
213
|
-
metric,
|
|
214
|
-
params,
|
|
215
|
-
tracing: {
|
|
216
|
-
requestSpanNameSuffix: metric,
|
|
217
|
-
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
218
|
-
},
|
|
219
|
-
});
|
|
220
|
-
};
|
|
221
|
-
this.listAppFiles = (app, { prefix, nextMarker } = {}, tracingConfig) => {
|
|
222
|
-
const locator = utils_1.parseAppId(app);
|
|
223
|
-
const linked = !!locator.build;
|
|
224
|
-
const params = {
|
|
225
|
-
marker: nextMarker,
|
|
226
|
-
prefix,
|
|
227
|
-
};
|
|
228
|
-
const metric = linked ? 'apps-list-files' : 'registry-list-files';
|
|
229
|
-
const inflightKey = HttpClient_1.inflightUrlWithQuery;
|
|
230
|
-
return this.http.get(this.routes.Files(locator), {
|
|
231
|
-
inflightKey,
|
|
232
|
-
metric,
|
|
233
|
-
params,
|
|
234
|
-
tracing: {
|
|
235
|
-
requestSpanNameSuffix: metric,
|
|
236
|
-
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
237
|
-
},
|
|
238
|
-
});
|
|
239
|
-
};
|
|
240
|
-
this.listLinks = (tracingConfig) => {
|
|
241
|
-
const inflightKey = HttpClient_1.inflightURL;
|
|
242
|
-
const metric = 'apps-list-links';
|
|
243
|
-
return this.http.get(this.routes.Links(), {
|
|
244
|
-
inflightKey,
|
|
245
|
-
metric,
|
|
246
|
-
tracing: {
|
|
247
|
-
requestSpanNameSuffix: metric,
|
|
248
|
-
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
249
|
-
},
|
|
250
|
-
});
|
|
251
|
-
};
|
|
252
|
-
this.getAppFile = (app, path, staleIfError, tracingConfig) => {
|
|
253
|
-
const { logger } = this.context;
|
|
254
|
-
const locator = utils_1.parseAppId(app);
|
|
255
|
-
const linked = !!locator.build;
|
|
256
|
-
const inflightKey = HttpClient_1.inflightURL;
|
|
257
|
-
if (staleIfError && this.memoryCache) {
|
|
258
|
-
appsStaleIfError_1.saveVersion(app, this.memoryCache);
|
|
259
|
-
}
|
|
260
|
-
const metric = linked ? 'apps-get-file' : 'registry-get-file';
|
|
261
|
-
try {
|
|
262
|
-
return this.http.getBuffer(this.routes.File(locator, path), {
|
|
263
|
-
cacheable: linked ? HttpClient_1.CacheType.Memory : HttpClient_1.CacheType.Disk,
|
|
264
|
-
inflightKey,
|
|
265
|
-
metric,
|
|
266
|
-
tracing: {
|
|
267
|
-
requestSpanNameSuffix: metric,
|
|
268
|
-
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
269
|
-
},
|
|
270
|
-
});
|
|
271
|
-
}
|
|
272
|
-
catch (error) {
|
|
273
|
-
logger.error({ error, message: 'getAppFile failed', app, path });
|
|
274
|
-
if (staleIfError && this.memoryCache) {
|
|
275
|
-
return appsStaleIfError_1.getFallbackFile(app, path, this.memoryCache, this);
|
|
276
|
-
}
|
|
277
|
-
throw error;
|
|
278
|
-
}
|
|
279
|
-
};
|
|
280
|
-
this.getAppJSON = (app, path, nullIfNotFound, tracingConfig) => {
|
|
281
|
-
const locator = utils_1.parseAppId(app);
|
|
282
|
-
const linked = !!locator.build;
|
|
283
|
-
const inflightKey = HttpClient_1.inflightURL;
|
|
284
|
-
const metric = linked ? 'apps-get-json' : 'registry-get-json';
|
|
285
|
-
return this.http.get(this.routes.File(locator, path), {
|
|
286
|
-
cacheable: linked ? HttpClient_1.CacheType.Memory : HttpClient_1.CacheType.Any,
|
|
287
|
-
inflightKey,
|
|
288
|
-
metric,
|
|
289
|
-
nullIfNotFound,
|
|
290
|
-
tracing: {
|
|
291
|
-
requestSpanNameSuffix: metric,
|
|
292
|
-
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
293
|
-
},
|
|
294
|
-
});
|
|
295
|
-
};
|
|
296
|
-
this.getFileFromApps = (app, path, nullIfNotFound, tracingConfig) => {
|
|
297
|
-
const inflightKey = HttpClient_1.inflightURL;
|
|
298
|
-
const metric = 'get-file-from-apps';
|
|
299
|
-
return this.http.get(this.routes.FileFromApps(app, path), {
|
|
300
|
-
cacheable: HttpClient_1.CacheType.Memory,
|
|
301
|
-
inflightKey,
|
|
302
|
-
metric,
|
|
303
|
-
nullIfNotFound,
|
|
304
|
-
tracing: {
|
|
305
|
-
requestSpanNameSuffix: metric,
|
|
306
|
-
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
307
|
-
},
|
|
308
|
-
});
|
|
309
|
-
};
|
|
310
|
-
this.getAppFileStream = (app, path, tracingConfig) => {
|
|
311
|
-
const locator = utils_1.parseAppId(app);
|
|
312
|
-
const metric = locator.build ? 'apps-get-file-s' : 'registry-get-file-s';
|
|
313
|
-
return this.http.getStream(this.routes.File(locator, path), {
|
|
314
|
-
metric,
|
|
315
|
-
tracing: {
|
|
316
|
-
requestSpanNameSuffix: metric,
|
|
317
|
-
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
318
|
-
},
|
|
319
|
-
});
|
|
320
|
-
};
|
|
321
|
-
this.getApp = (app, tracingConfig) => {
|
|
322
|
-
const metric = 'apps-get-app';
|
|
323
|
-
const inflightKey = HttpClient_1.inflightURL;
|
|
324
|
-
return this.http.get(this.routes.App(app), {
|
|
325
|
-
inflightKey,
|
|
326
|
-
metric,
|
|
327
|
-
tracing: {
|
|
328
|
-
requestSpanNameSuffix: metric,
|
|
329
|
-
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
330
|
-
},
|
|
331
|
-
});
|
|
332
|
-
};
|
|
333
|
-
this.getAppSettings = (app, tracingConfig) => {
|
|
334
|
-
const inflightKey = HttpClient_1.inflightURL;
|
|
335
|
-
const metric = 'apps-get-settings';
|
|
336
|
-
return this.http.get(this.routes.Settings(app), {
|
|
337
|
-
inflightKey,
|
|
338
|
-
metric,
|
|
339
|
-
tracing: {
|
|
340
|
-
requestSpanNameSuffix: metric,
|
|
341
|
-
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
342
|
-
},
|
|
343
|
-
});
|
|
344
|
-
};
|
|
345
|
-
this.getAllAppsSettings = (listAppsOptions = {}, tracingConfig) => {
|
|
346
|
-
return this.listApps(listAppsOptions, tracingConfig).then(({ data: installedApps }) => {
|
|
347
|
-
const names = installedApps.map(getVendorAndName);
|
|
348
|
-
const settingsPromises = names.map(vendorAndName => this.getAppSettings(vendorAndName, tracingConfig).catch(notFound));
|
|
349
|
-
return Promise.all(settingsPromises).then((settings) => {
|
|
350
|
-
return zipObj(names, settings);
|
|
351
|
-
});
|
|
352
|
-
});
|
|
353
|
-
};
|
|
354
|
-
this.getAppBundle = (app, bundlePath, generatePackageJson, tracingConfig) => {
|
|
355
|
-
const locator = utils_1.parseAppId(app);
|
|
356
|
-
const params = generatePackageJson && { _packageJSONEngine: 'npm', _packageJSONFilter: 'vtex.render-builder@x' };
|
|
357
|
-
const metric = locator.build ? 'apps-get-bundle' : 'registry-get-bundle';
|
|
358
|
-
return this.http.getStream(this.routes.AppBundle(locator, bundlePath), {
|
|
359
|
-
headers: {
|
|
360
|
-
Accept: 'application/x-gzip',
|
|
361
|
-
'Accept-Encoding': 'gzip',
|
|
362
|
-
},
|
|
363
|
-
metric,
|
|
364
|
-
params,
|
|
365
|
-
tracing: {
|
|
366
|
-
requestSpanNameSuffix: metric,
|
|
367
|
-
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
368
|
-
},
|
|
369
|
-
});
|
|
370
|
-
};
|
|
371
|
-
this.unpackAppBundle = (app, bundlePath, unpackPath, generatePackageJson, tracingConfig) => {
|
|
372
|
-
return this.getAppBundle(app, bundlePath, generatePackageJson, tracingConfig)
|
|
373
|
-
.then(stream => stream
|
|
374
|
-
.pipe(zlib_1.createGunzip())
|
|
375
|
-
.pipe(tar_fs_1.extract(unpackPath)));
|
|
376
|
-
};
|
|
377
|
-
this.getAppsMetaInfos = async (filter, staleWhileRevalidate = true, tracingConfig) => {
|
|
378
|
-
var _a;
|
|
379
|
-
const { account, production, recorder, workspace, logger } = this.context;
|
|
380
|
-
const metric = 'get-apps-meta';
|
|
381
|
-
const inflightKey = HttpClient_1.inflightURL;
|
|
382
|
-
const key = appsStaleIfError_1.getMetaInfoKey(account, workspace);
|
|
383
|
-
const cachedResponse = production && staleWhileRevalidate
|
|
384
|
-
? await ((_a = this.diskCache) === null || _a === void 0 ? void 0 : _a.get(key))
|
|
385
|
-
: undefined;
|
|
386
|
-
if (cachedResponse && recorder) {
|
|
387
|
-
recorder.record(cachedResponse.headers);
|
|
388
|
-
}
|
|
389
|
-
const metaInfoPromise = this.http
|
|
390
|
-
.getRaw(this.routes.Meta(), {
|
|
391
|
-
ignoreRecorder: Boolean(cachedResponse),
|
|
392
|
-
inflightKey,
|
|
393
|
-
metric,
|
|
394
|
-
params: { fields: workspaceFields },
|
|
395
|
-
tracing: {
|
|
396
|
-
requestSpanNameSuffix: metric,
|
|
397
|
-
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
398
|
-
},
|
|
399
|
-
})
|
|
400
|
-
.then(response => {
|
|
401
|
-
const { data, headers: responseHeaders } = response;
|
|
402
|
-
if (this.diskCache && production) {
|
|
403
|
-
this.diskCache.set(key, {
|
|
404
|
-
appsMetaInfo: data.apps || [],
|
|
405
|
-
headers: responseHeaders,
|
|
406
|
-
});
|
|
407
|
-
}
|
|
408
|
-
return response;
|
|
409
|
-
});
|
|
410
|
-
let appsMetaInfo;
|
|
411
|
-
if (cachedResponse) {
|
|
412
|
-
appsMetaInfo = cachedResponse.appsMetaInfo;
|
|
413
|
-
metaInfoPromise.catch(error => {
|
|
414
|
-
logger.warn({ message: 'Unable to update stale cache', error });
|
|
415
|
-
});
|
|
416
|
-
}
|
|
417
|
-
else {
|
|
418
|
-
appsMetaInfo = await metaInfoPromise.then(response => response.data.apps);
|
|
419
|
-
}
|
|
420
|
-
if (filter) {
|
|
421
|
-
return appsMetaInfo.filter(appMeta => { var _a; return (_a = appMeta === null || appMeta === void 0 ? void 0 : appMeta._resolvedDependencies) === null || _a === void 0 ? void 0 : _a.filter; });
|
|
422
|
-
}
|
|
423
|
-
return appsMetaInfo;
|
|
424
|
-
};
|
|
425
|
-
this.getDependencies = (filter = '', tracingConfig) => {
|
|
426
|
-
const params = { filter };
|
|
427
|
-
const metric = 'apps-get-deps';
|
|
428
|
-
const inflightKey = HttpClient_1.inflightUrlWithQuery;
|
|
429
|
-
return this.http.get(this.routes.Dependencies(), {
|
|
430
|
-
inflightKey,
|
|
431
|
-
metric,
|
|
432
|
-
params,
|
|
433
|
-
tracing: {
|
|
434
|
-
requestSpanNameSuffix: metric,
|
|
435
|
-
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
436
|
-
},
|
|
437
|
-
});
|
|
438
|
-
};
|
|
439
|
-
this.updateDependencies = (tracingConfig) => {
|
|
440
|
-
const metric = 'apps-update-deps';
|
|
441
|
-
return this.http.put(this.routes.Dependencies(), null, {
|
|
442
|
-
metric,
|
|
443
|
-
tracing: {
|
|
444
|
-
requestSpanNameSuffix: metric,
|
|
445
|
-
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
446
|
-
},
|
|
447
|
-
});
|
|
448
|
-
};
|
|
449
|
-
this.updateDependency = (name, version, registry, tracingConfig) => {
|
|
450
|
-
const metric = 'apps-update-dep';
|
|
451
|
-
return this.http.patch(this.routes.Apps(), [{ name, version, registry }], {
|
|
452
|
-
metric,
|
|
453
|
-
tracing: {
|
|
454
|
-
requestSpanNameSuffix: metric,
|
|
455
|
-
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
456
|
-
},
|
|
457
|
-
});
|
|
458
|
-
};
|
|
459
|
-
this.resolveDependencies = (apps, registries, filter = '', tracingConfig) => {
|
|
460
|
-
const params = { apps, registries, filter };
|
|
461
|
-
const metric = 'apps-resolve-deps';
|
|
462
|
-
const inflightKey = HttpClient_1.inflightUrlWithQuery;
|
|
463
|
-
return this.http.get(this.routes.ResolveDependencies(), {
|
|
464
|
-
inflightKey,
|
|
465
|
-
metric,
|
|
466
|
-
params,
|
|
467
|
-
tracing: {
|
|
468
|
-
requestSpanNameSuffix: metric,
|
|
469
|
-
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
470
|
-
},
|
|
471
|
-
});
|
|
472
|
-
};
|
|
473
|
-
this.resolveDependenciesWithManifest = (manifest, filter = '', tracingConfig) => {
|
|
474
|
-
const params = { filter };
|
|
475
|
-
const metric = 'apps-resolve-deps-m';
|
|
476
|
-
return this.http.post(this.routes.ResolveDependenciesWithManifest(), manifest, {
|
|
477
|
-
metric,
|
|
478
|
-
params,
|
|
479
|
-
tracing: {
|
|
480
|
-
requestSpanNameSuffix: metric,
|
|
481
|
-
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
482
|
-
},
|
|
483
|
-
});
|
|
484
|
-
};
|
|
485
|
-
this.installRuntime = (descriptor, tracingConfig) => {
|
|
486
|
-
const { account, workspace } = this.context;
|
|
487
|
-
const [name, version] = descriptor.split('@');
|
|
488
|
-
return this.http.patch(`http://apps.aws-us-east-1.vtex.io/${account}/${workspace}/apps`, [
|
|
489
|
-
{
|
|
490
|
-
name,
|
|
491
|
-
version,
|
|
492
|
-
},
|
|
493
|
-
], {
|
|
494
|
-
tracing: {
|
|
495
|
-
requestSpanNameSuffix: 'apps-install-runtime',
|
|
496
|
-
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
497
|
-
},
|
|
498
|
-
});
|
|
499
|
-
};
|
|
500
|
-
this.diskCache = options && options.diskCache;
|
|
501
|
-
this.memoryCache = options && options.memoryCache;
|
|
502
|
-
this._routes = createRoutes(context);
|
|
503
|
-
}
|
|
504
|
-
get routes() {
|
|
505
|
-
return this._routes;
|
|
506
|
-
}
|
|
507
|
-
}
|
|
508
|
-
exports.Apps = Apps;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { Readable } from 'stream';
|
|
3
|
-
import { AppMetaInfo } from '../..';
|
|
4
|
-
import { InstanceOptions, RequestTracingConfig } from '../../HttpClient';
|
|
5
|
-
import { IOContext } from '../../service/worker/runtime/typings';
|
|
6
|
-
import { InfraClient } from './InfraClient';
|
|
7
|
-
export interface AssetsParams {
|
|
8
|
-
files?: string[];
|
|
9
|
-
pick?: string[];
|
|
10
|
-
}
|
|
11
|
-
export declare class Assets extends InfraClient {
|
|
12
|
-
private routes;
|
|
13
|
-
constructor(context: IOContext, options?: InstanceOptions);
|
|
14
|
-
getSettings(dependencies: AppMetaInfo[], appAtMajor: string, params?: AssetsParams, tracingConfig?: RequestTracingConfig): Promise<Record<string, any>[]>;
|
|
15
|
-
getBuildJSONForApp(app: AppMetaInfo, appVendorName: string, pick?: string | string[], tracingConfig?: RequestTracingConfig): Promise<Record<string, any>>;
|
|
16
|
-
getSettingsFromFilesForApp(app: AppMetaInfo, files?: string | string[], tracingConfig?: RequestTracingConfig): Promise<Record<string, any>>;
|
|
17
|
-
getJSON<T extends object | null>(appId: string, file: string, nullIfNotFound?: boolean, tracingConfig?: RequestTracingConfig): Promise<T>;
|
|
18
|
-
getFile(appId: string, file: string, nullIfNotFound?: boolean, tracingConfig?: RequestTracingConfig): Promise<{
|
|
19
|
-
data: Buffer;
|
|
20
|
-
headers: any;
|
|
21
|
-
}>;
|
|
22
|
-
getFilteredDependencies(apps: string | string[], dependencies: AppMetaInfo[]): AppMetaInfo[];
|
|
23
|
-
getAppBundleByVendor: (app: string, bundlePath: string, generatePackageJson: boolean, tracingConfig?: RequestTracingConfig | undefined) => Promise<Readable>;
|
|
24
|
-
protected getAppJSONByAccount: <T extends object | null>(app: string, path: string, nullIfNotFound?: boolean | undefined, tracingConfig?: RequestTracingConfig | undefined) => Promise<T>;
|
|
25
|
-
protected getAppJSONByVendor: <T extends object | null>(app: string, path: string, nullIfNotFound?: boolean | undefined, tracingConfig?: RequestTracingConfig | undefined) => Promise<T>;
|
|
26
|
-
protected getAppFileByAccount: (app: string, path: string, nullIfNotFound?: boolean | undefined, tracingConfig?: RequestTracingConfig | undefined) => Promise<{
|
|
27
|
-
data: Buffer;
|
|
28
|
-
headers: any;
|
|
29
|
-
}>;
|
|
30
|
-
protected getAppFileByVendor: (app: string, path: string, nullIfNotFound?: boolean | undefined, tracingConfig?: RequestTracingConfig | undefined) => Promise<{
|
|
31
|
-
data: Buffer;
|
|
32
|
-
headers: any;
|
|
33
|
-
}>;
|
|
34
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { InstanceOptions, RequestTracingConfig } from '../../HttpClient';
|
|
2
|
-
import { IOContext } from '../../service/worker/runtime/typings';
|
|
3
|
-
import { InfraClient } from './InfraClient';
|
|
4
|
-
export declare class BillingMetrics extends InfraClient {
|
|
5
|
-
constructor(context: IOContext, options?: InstanceOptions);
|
|
6
|
-
sendMetric: (metric: BillingMetric, tracingConfig?: RequestTracingConfig | undefined) => Promise<BillingMetric>;
|
|
7
|
-
}
|
|
8
|
-
export interface BillingMetric {
|
|
9
|
-
value: number;
|
|
10
|
-
unit: string;
|
|
11
|
-
metricId: string;
|
|
12
|
-
timestamp?: number;
|
|
13
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const InfraClient_1 = require("./InfraClient");
|
|
4
|
-
class BillingMetrics extends InfraClient_1.InfraClient {
|
|
5
|
-
constructor(context, options) {
|
|
6
|
-
super('colossus@0.x', context, options);
|
|
7
|
-
this.sendMetric = (metric, tracingConfig) => {
|
|
8
|
-
return this.http.post('/metrics', metric, { tracing: {
|
|
9
|
-
requestSpanNameSuffix: 'send-metric',
|
|
10
|
-
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
11
|
-
} });
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
exports.BillingMetrics = BillingMetrics;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { InstanceOptions, RequestTracingConfig } from '../../HttpClient';
|
|
2
|
-
import { IOContext } from '../../service/worker/runtime/typings';
|
|
3
|
-
import { InfraClient } from './InfraClient';
|
|
4
|
-
export declare class Events extends InfraClient {
|
|
5
|
-
constructor({ recorder, ...context }: IOContext, options?: InstanceOptions);
|
|
6
|
-
sendEvent: (appIdOrResource: string | ResourceVRN, route: string, message?: any, tracingConfig?: RequestTracingConfig | undefined) => Promise<void>;
|
|
7
|
-
private resourceFor;
|
|
8
|
-
}
|
|
9
|
-
export interface ResourceVRN {
|
|
10
|
-
service: string;
|
|
11
|
-
path: string;
|
|
12
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const util_1 = require("util");
|
|
4
|
-
const InfraClient_1 = require("./InfraClient");
|
|
5
|
-
const ANY_APP = '';
|
|
6
|
-
const eventRoute = (route) => `/events/${route}`;
|
|
7
|
-
const isResourceVRN = (appIdOrResource) => util_1.isObject(appIdOrResource) && !util_1.isNullOrUndefined(appIdOrResource.service);
|
|
8
|
-
class Events extends InfraClient_1.InfraClient {
|
|
9
|
-
constructor({ recorder, ...context }, options) {
|
|
10
|
-
super('courier@0.x', context, options);
|
|
11
|
-
this.sendEvent = (appIdOrResource, route, message, tracingConfig) => {
|
|
12
|
-
const resource = this.resourceFor(appIdOrResource);
|
|
13
|
-
return this.http.put(eventRoute(route), message, {
|
|
14
|
-
metric: 'events-send',
|
|
15
|
-
params: { resource },
|
|
16
|
-
tracing: {
|
|
17
|
-
requestSpanNameSuffix: 'events-send',
|
|
18
|
-
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
19
|
-
},
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
this.resourceFor = (appIdOrResource) => {
|
|
23
|
-
if (appIdOrResource === ANY_APP) {
|
|
24
|
-
return ANY_APP;
|
|
25
|
-
}
|
|
26
|
-
const { service, path } = isResourceVRN(appIdOrResource)
|
|
27
|
-
? appIdOrResource
|
|
28
|
-
: { service: 'apps', path: `/apps/${appIdOrResource}` };
|
|
29
|
-
return `vrn:${service}:${this.context.region}:${this.context.account}:${this.context.workspace}:${path}`;
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
exports.Events = Events;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { InstanceOptions, RequestTracingConfig } from '../../HttpClient';
|
|
2
|
-
import { HousekeeperStatesAndUpdates } from '../../responses';
|
|
3
|
-
import { IOContext } from '../../service/worker/runtime/typings';
|
|
4
|
-
import { InfraClient } from './InfraClient';
|
|
5
|
-
export declare class Housekeeper extends InfraClient {
|
|
6
|
-
constructor(context: IOContext, options?: InstanceOptions);
|
|
7
|
-
apply: (data: HousekeeperStatesAndUpdates, tracingConfig?: RequestTracingConfig | undefined) => Promise<void>;
|
|
8
|
-
perform: (tracingConfig?: RequestTracingConfig | undefined) => Promise<void>;
|
|
9
|
-
resolve: (tracingConfig?: RequestTracingConfig | undefined) => Promise<HousekeeperStatesAndUpdates>;
|
|
10
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const InfraClient_1 = require("./InfraClient");
|
|
4
|
-
class Housekeeper extends InfraClient_1.InfraClient {
|
|
5
|
-
constructor(context, options) {
|
|
6
|
-
super('housekeeper@0.x', context, options);
|
|
7
|
-
this.apply = async (data, tracingConfig) => {
|
|
8
|
-
const metric = 'housekeeper-apply';
|
|
9
|
-
return this.http.post('v2/housekeeping/apply', data, { metric, tracing: {
|
|
10
|
-
requestSpanNameSuffix: metric,
|
|
11
|
-
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
12
|
-
} });
|
|
13
|
-
};
|
|
14
|
-
this.perform = async (tracingConfig) => {
|
|
15
|
-
const metric = 'housekeeper-perform';
|
|
16
|
-
return this.http.post('v2/_housekeeping/perform', {}, { metric, tracing: {
|
|
17
|
-
requestSpanNameSuffix: metric,
|
|
18
|
-
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
19
|
-
} });
|
|
20
|
-
};
|
|
21
|
-
this.resolve = async (tracingConfig) => {
|
|
22
|
-
const metric = 'housekeeper-resolve';
|
|
23
|
-
return this.http.get('v2/housekeeping/resolve', { metric, tracing: {
|
|
24
|
-
requestSpanNameSuffix: metric,
|
|
25
|
-
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
26
|
-
} });
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
exports.Housekeeper = Housekeeper;
|