@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,11 @@
|
|
|
1
|
+
import { AppClient, InstanceOptions } from '../HttpClient';
|
|
2
|
+
import { IOContext } from '../service/typings';
|
|
3
|
+
export declare class Billing extends AppClient {
|
|
4
|
+
constructor(context: IOContext, options?: InstanceOptions);
|
|
5
|
+
status: () => Promise<ContractStatus>;
|
|
6
|
+
}
|
|
7
|
+
export declare enum ContractStatus {
|
|
8
|
+
ACTIVE = "active_contract",
|
|
9
|
+
INACTIVE = "inactive_contract",
|
|
10
|
+
NO_CONTRACT = "no_contract"
|
|
11
|
+
}
|
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
4
|
-
class Billing extends
|
|
3
|
+
const HttpClient_1 = require("../HttpClient");
|
|
4
|
+
class Billing extends HttpClient_1.AppClient {
|
|
5
5
|
constructor(context, options) {
|
|
6
6
|
super('vtex.billing@0.x', context, options);
|
|
7
|
-
this.status = (
|
|
8
|
-
tracing: {
|
|
9
|
-
requestSpanNameSuffix: 'billing-status',
|
|
10
|
-
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
11
|
-
},
|
|
12
|
-
});
|
|
7
|
+
this.status = () => this.http.get('/_v/contractStatus');
|
|
13
8
|
}
|
|
14
9
|
}
|
|
15
10
|
exports.Billing = Billing;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { InfraClient, InstanceOptions } from '../HttpClient';
|
|
2
|
+
import { IOContext } from '../service/typings';
|
|
3
|
+
export declare class BillingMetrics extends InfraClient {
|
|
4
|
+
constructor(context: IOContext, options?: InstanceOptions);
|
|
5
|
+
sendMetric: (metric: BillingMetric) => Promise<BillingMetric>;
|
|
6
|
+
}
|
|
7
|
+
export interface BillingMetric {
|
|
8
|
+
value: number;
|
|
9
|
+
unit: string;
|
|
10
|
+
metricId: string;
|
|
11
|
+
timestamp?: number;
|
|
12
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const HttpClient_1 = require("../HttpClient");
|
|
4
|
+
class BillingMetrics extends HttpClient_1.InfraClient {
|
|
5
|
+
constructor(context, options) {
|
|
6
|
+
super('colossus@0.x', context, options);
|
|
7
|
+
this.sendMetric = (metric) => this.http.post('/metrics', metric);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.BillingMetrics = BillingMetrics;
|
|
@@ -1,24 +1,23 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { ZlibOptions } from 'zlib';
|
|
3
|
-
import {
|
|
4
|
-
import { IOContext } from '
|
|
5
|
-
import { Change } from '
|
|
6
|
-
import { File } from '
|
|
7
|
-
import { AppClient } from './AppClient';
|
|
3
|
+
import { AppClient, InstanceOptions } from '../HttpClient';
|
|
4
|
+
import { IOContext } from '../service/typings';
|
|
5
|
+
import { Change } from './Apps';
|
|
6
|
+
import { File } from './Registry';
|
|
8
7
|
export declare class Builder extends AppClient {
|
|
9
8
|
private stickyHost;
|
|
10
9
|
constructor(ioContext: IOContext, opts?: InstanceOptions);
|
|
11
|
-
availability: (app: string, hintIndex: number
|
|
10
|
+
availability: (app: string, hintIndex: number) => Promise<{
|
|
12
11
|
host: string;
|
|
13
12
|
hostname: string | undefined;
|
|
14
13
|
score: number;
|
|
15
14
|
}>;
|
|
16
|
-
clean: (app: string
|
|
17
|
-
getPinnedDependencies: (
|
|
18
|
-
linkApp: (app: string, files: File[], zipOptions?: ZipOptions, params?: RequestParams
|
|
19
|
-
publishApp: (app: string, files: File[], zipOptions?: ZipOptions, params?: RequestParams
|
|
20
|
-
relinkApp: (app: string, changes: Change[], params?: RequestParams
|
|
21
|
-
testApp: (app: string, files: File[], zipOptions?: ZipOptions, params?: RequestParams
|
|
15
|
+
clean: (app: string) => Promise<BuildResult>;
|
|
16
|
+
getPinnedDependencies: () => Promise<any>;
|
|
17
|
+
linkApp: (app: string, files: File[], zipOptions?: ZipOptions, params?: RequestParams) => Promise<BuildResult>;
|
|
18
|
+
publishApp: (app: string, files: File[], zipOptions?: ZipOptions, params?: RequestParams) => Promise<BuildResult>;
|
|
19
|
+
relinkApp: (app: string, changes: Change[], params?: RequestParams) => Promise<BuildResult>;
|
|
20
|
+
testApp: (app: string, files: File[], zipOptions?: ZipOptions, params?: RequestParams) => Promise<BuildResult>;
|
|
22
21
|
private zipAndSend;
|
|
23
22
|
}
|
|
24
23
|
interface RequestParams {
|
|
@@ -4,8 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const archiver_1 = __importDefault(require("archiver"));
|
|
7
|
-
const
|
|
8
|
-
const
|
|
7
|
+
const HttpClient_1 = require("../HttpClient");
|
|
8
|
+
const cache_1 = require("../HttpClient/middlewares/cache");
|
|
9
9
|
const routes = {
|
|
10
10
|
Availability: (app) => `${routes.Builder}/availability/${app}`,
|
|
11
11
|
Builder: '/_v/builder/0',
|
|
@@ -16,10 +16,10 @@ const routes = {
|
|
|
16
16
|
Relink: (app) => `${routes.Builder}/relink/${app}`,
|
|
17
17
|
Test: (app) => `${routes.Builder}/test/${app}`,
|
|
18
18
|
};
|
|
19
|
-
class Builder extends
|
|
19
|
+
class Builder extends HttpClient_1.AppClient {
|
|
20
20
|
constructor(ioContext, opts) {
|
|
21
21
|
super('vtex.builder-hub@0.x', ioContext, opts);
|
|
22
|
-
this.availability = async (app, hintIndex
|
|
22
|
+
this.availability = async (app, hintIndex) => {
|
|
23
23
|
const stickyHint = hintIndex === undefined || hintIndex === null ?
|
|
24
24
|
`request:${this.context.account}:${this.context.workspace}:${app}` :
|
|
25
25
|
`request:${this.context.account}:${this.context.workspace}:${app}:${hintIndex}`;
|
|
@@ -28,53 +28,33 @@ class Builder extends AppClient_1.AppClient {
|
|
|
28
28
|
'x-vtex-sticky-host': stickyHint,
|
|
29
29
|
};
|
|
30
30
|
const metric = 'bh-availability';
|
|
31
|
-
const { data: { availability }, headers: { 'x-vtex-sticky-host': host }, } = await this.http.getRaw(routes.Availability(app), { cacheable: cache_1.CacheType.None
|
|
32
|
-
requestSpanNameSuffix: metric,
|
|
33
|
-
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
34
|
-
} });
|
|
31
|
+
const { data: { availability }, headers: { 'x-vtex-sticky-host': host }, } = await this.http.getRaw(routes.Availability(app), { headers, metric, cacheable: cache_1.CacheType.None });
|
|
35
32
|
const { hostname, score } = availability;
|
|
36
33
|
return { host, hostname, score };
|
|
37
34
|
};
|
|
38
|
-
this.clean = (app
|
|
39
|
-
const headers = {
|
|
40
|
-
'Content-Type': 'application/json',
|
|
41
|
-
...this.stickyHost && { 'x-vtex-sticky-host': this.stickyHost },
|
|
42
|
-
};
|
|
35
|
+
this.clean = (app) => {
|
|
36
|
+
const headers = Object.assign({ 'Content-Type': 'application/json' }, this.stickyHost && { 'x-vtex-sticky-host': this.stickyHost });
|
|
43
37
|
const metric = 'bh-clean';
|
|
44
|
-
return this.http.post(routes.Clean(app), { headers, metric
|
|
45
|
-
requestSpanNameSuffix: metric,
|
|
46
|
-
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
47
|
-
} });
|
|
38
|
+
return this.http.post(routes.Clean(app), { headers, metric });
|
|
48
39
|
};
|
|
49
|
-
this.getPinnedDependencies = (
|
|
50
|
-
return this.http.get(routes.PinnedDependencies()
|
|
51
|
-
tracing: {
|
|
52
|
-
requestSpanNameSuffix: 'pinned-dependencies',
|
|
53
|
-
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
54
|
-
},
|
|
55
|
-
});
|
|
40
|
+
this.getPinnedDependencies = () => {
|
|
41
|
+
return this.http.get(routes.PinnedDependencies());
|
|
56
42
|
};
|
|
57
|
-
this.linkApp = (app, files, zipOptions = { sticky: true }, params = {}
|
|
58
|
-
return this.zipAndSend(routes.Link(app), app, files, zipOptions, params
|
|
43
|
+
this.linkApp = (app, files, zipOptions = { sticky: true }, params = {}) => {
|
|
44
|
+
return this.zipAndSend(routes.Link(app), app, files, zipOptions, params);
|
|
59
45
|
};
|
|
60
|
-
this.publishApp = (app, files, zipOptions = { sticky: true }, params = {}
|
|
61
|
-
return this.zipAndSend(routes.Publish(app), app, files, zipOptions, params
|
|
46
|
+
this.publishApp = (app, files, zipOptions = { sticky: true }, params = {}) => {
|
|
47
|
+
return this.zipAndSend(routes.Publish(app), app, files, zipOptions, params);
|
|
62
48
|
};
|
|
63
|
-
this.relinkApp = (app, changes, params = {}
|
|
64
|
-
const headers = {
|
|
65
|
-
'Content-Type': 'application/json',
|
|
66
|
-
...this.stickyHost && { 'x-vtex-sticky-host': this.stickyHost },
|
|
67
|
-
};
|
|
49
|
+
this.relinkApp = (app, changes, params = {}) => {
|
|
50
|
+
const headers = Object.assign({ 'Content-Type': 'application/json' }, this.stickyHost && { 'x-vtex-sticky-host': this.stickyHost });
|
|
68
51
|
const metric = 'bh-relink';
|
|
69
|
-
return this.http.put(routes.Relink(app), changes, { headers, metric, params
|
|
70
|
-
requestSpanNameSuffix: metric,
|
|
71
|
-
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
72
|
-
} });
|
|
52
|
+
return this.http.put(routes.Relink(app), changes, { headers, metric, params });
|
|
73
53
|
};
|
|
74
|
-
this.testApp = (app, files, zipOptions = { sticky: true }, params = {}
|
|
75
|
-
return this.zipAndSend(routes.Test(app), app, files, zipOptions, params
|
|
54
|
+
this.testApp = (app, files, zipOptions = { sticky: true }, params = {}) => {
|
|
55
|
+
return this.zipAndSend(routes.Test(app), app, files, zipOptions, params);
|
|
76
56
|
};
|
|
77
|
-
this.zipAndSend = async (route, app, files, { tag, sticky, stickyHint, zlib } = {}, requestParams = {}
|
|
57
|
+
this.zipAndSend = async (route, app, files, { tag, sticky, stickyHint, zlib } = {}, requestParams = {}) => {
|
|
78
58
|
if (!(files[0] && files[0].path && files[0].content)) {
|
|
79
59
|
throw new Error('Argument files must be an array of {path, content}, where content can be a String, a Buffer or a ReadableStream.');
|
|
80
60
|
}
|
|
@@ -89,18 +69,11 @@ class Builder extends AppClient_1.AppClient {
|
|
|
89
69
|
});
|
|
90
70
|
const hint = stickyHint || `request:${this.context.account}:${this.context.workspace}:${app}`;
|
|
91
71
|
const metric = 'bh-zip-send';
|
|
92
|
-
const params = tag ? {
|
|
72
|
+
const params = tag ? Object.assign({}, requestParams, { tag }) : requestParams;
|
|
93
73
|
const request = this.http.postRaw(route, zip, {
|
|
94
|
-
headers: {
|
|
95
|
-
'Content-Type': 'application/octet-stream',
|
|
96
|
-
...sticky && { 'x-vtex-sticky-host': this.stickyHost || hint },
|
|
97
|
-
},
|
|
74
|
+
headers: Object.assign({ 'Content-Type': 'application/octet-stream' }, sticky && { 'x-vtex-sticky-host': this.stickyHost || hint }),
|
|
98
75
|
metric,
|
|
99
76
|
params,
|
|
100
|
-
tracing: {
|
|
101
|
-
requestSpanNameSuffix: metric,
|
|
102
|
-
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
103
|
-
},
|
|
104
77
|
});
|
|
105
78
|
files.forEach(({ content, path }) => zip.append(content, { name: path }));
|
|
106
79
|
const finalize = zip.finalize();
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { InfraClient, InstanceOptions } from '../HttpClient';
|
|
2
|
+
import { IOContext } from '../service/typings';
|
|
3
|
+
export declare class Events extends InfraClient {
|
|
4
|
+
constructor(context: IOContext, options?: InstanceOptions);
|
|
5
|
+
sendEvent: (subject: string, route: string, message?: any) => Promise<void>;
|
|
6
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const HttpClient_1 = require("../HttpClient");
|
|
4
|
+
const eventRoute = (route) => `/events/${route}`;
|
|
5
|
+
class Events extends HttpClient_1.InfraClient {
|
|
6
|
+
constructor(context, options) {
|
|
7
|
+
super('courier@0.x', Object.assign({}, context, { recorder: undefined }), options);
|
|
8
|
+
this.sendEvent = (subject, route, message) => {
|
|
9
|
+
const resource = subject === '' || subject === '-'
|
|
10
|
+
? ''
|
|
11
|
+
: `vrn:apps:aws-us-east-1:${this.context.account}:${this.context.workspace}:/apps/${subject}`;
|
|
12
|
+
return this.http.put(eventRoute(route), message, {
|
|
13
|
+
metric: 'events-send',
|
|
14
|
+
params: { resource },
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.Events = Events;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { InfraClient, InstanceOptions } from '../HttpClient';
|
|
2
|
+
import { HousekeeperStatesAndUpdates } from '../responses';
|
|
3
|
+
import { IOContext } from '../service/typings';
|
|
4
|
+
export declare class Housekeeper extends InfraClient {
|
|
5
|
+
private _routes;
|
|
6
|
+
private readonly routes;
|
|
7
|
+
constructor(context: IOContext, options?: InstanceOptions);
|
|
8
|
+
apply: (data: HousekeeperStatesAndUpdates) => Promise<void>;
|
|
9
|
+
perform: () => Promise<void>;
|
|
10
|
+
resolve: () => Promise<HousekeeperStatesAndUpdates>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const HttpClient_1 = require("../HttpClient");
|
|
4
|
+
const createRoutes = ({ account, workspace }) => {
|
|
5
|
+
const routes = {
|
|
6
|
+
Apply: () => `v2/housekeeping/apply`,
|
|
7
|
+
Perform: () => `v2/_housekeeping/perform`,
|
|
8
|
+
Resolve: () => `v2/housekeeping/resolve`,
|
|
9
|
+
};
|
|
10
|
+
return routes;
|
|
11
|
+
};
|
|
12
|
+
class Housekeeper extends HttpClient_1.InfraClient {
|
|
13
|
+
constructor(context, options) {
|
|
14
|
+
super('housekeeper@0.x', context, options);
|
|
15
|
+
this.apply = async (data) => this.http.post(this.routes.Apply(), data, { metric: 'housekeeper-apply' });
|
|
16
|
+
this.perform = async () => this.http.post(this.routes.Perform(), {}, { metric: 'housekeeper-perform' });
|
|
17
|
+
this.resolve = async () => this.http.get(this.routes.Resolve(), { metric: 'housekeeper-resolve' });
|
|
18
|
+
this._routes = createRoutes(context);
|
|
19
|
+
}
|
|
20
|
+
get routes() {
|
|
21
|
+
return this._routes;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.Housekeeper = Housekeeper;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ExternalClient, InstanceOptions } from '../HttpClient';
|
|
2
|
+
import { IOContext } from '../service/typings';
|
|
3
|
+
export declare class ID extends ExternalClient {
|
|
4
|
+
constructor(context: IOContext, opts?: InstanceOptions);
|
|
5
|
+
getTemporaryToken: () => Promise<string>;
|
|
6
|
+
sendCodeToEmail: (token: string, email: string) => Promise<any>;
|
|
7
|
+
getEmailCodeAuthenticationToken: (token: string, email: string, code: string) => Promise<AuthenticationResponse>;
|
|
8
|
+
getPasswordAuthenticationToken: (token: string, email: string, password: string) => Promise<AuthenticationResponse>;
|
|
9
|
+
}
|
|
10
|
+
export interface AuthenticationResponse {
|
|
11
|
+
promptMFA: boolean;
|
|
12
|
+
clientToken: any;
|
|
13
|
+
authCookie: {
|
|
14
|
+
Name: string;
|
|
15
|
+
Value: string;
|
|
16
|
+
};
|
|
17
|
+
accountAuthCookie: any;
|
|
18
|
+
expiresIn: number;
|
|
19
|
+
userId: string;
|
|
20
|
+
phoneNumber: string;
|
|
21
|
+
scope: any;
|
|
22
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const HttpClient_1 = require("../HttpClient");
|
|
4
|
+
const routes = {
|
|
5
|
+
SEND: '/accesskey/send',
|
|
6
|
+
START: '/start',
|
|
7
|
+
VALIDATE: '/accesskey/validate',
|
|
8
|
+
VALIDATE_CLASSIC: '/classic/validate',
|
|
9
|
+
};
|
|
10
|
+
const VTEXID_ENDPOINTS = {
|
|
11
|
+
STABLE: 'https://vtexid.vtex.com.br/api/vtexid/pub/authentication',
|
|
12
|
+
};
|
|
13
|
+
const endpoint = (env) => {
|
|
14
|
+
return VTEXID_ENDPOINTS[env] || env;
|
|
15
|
+
};
|
|
16
|
+
class ID extends HttpClient_1.ExternalClient {
|
|
17
|
+
constructor(context, opts) {
|
|
18
|
+
super(endpoint(VTEXID_ENDPOINTS.STABLE), context, opts);
|
|
19
|
+
this.getTemporaryToken = () => {
|
|
20
|
+
const metric = 'vtexid-temp-token';
|
|
21
|
+
return this.http.get(routes.START, { metric }).then(({ authenticationToken }) => authenticationToken);
|
|
22
|
+
};
|
|
23
|
+
this.sendCodeToEmail = (token, email) => {
|
|
24
|
+
const params = { authenticationToken: token, email };
|
|
25
|
+
const metric = 'vtexid-send-code';
|
|
26
|
+
return this.http.get(routes.SEND, { params, metric });
|
|
27
|
+
};
|
|
28
|
+
this.getEmailCodeAuthenticationToken = (token, email, code) => {
|
|
29
|
+
const params = {
|
|
30
|
+
accesskey: code,
|
|
31
|
+
authenticationToken: token,
|
|
32
|
+
login: email,
|
|
33
|
+
};
|
|
34
|
+
const metric = 'vtexid-email-token';
|
|
35
|
+
return this.http.get(routes.VALIDATE, { params, metric });
|
|
36
|
+
};
|
|
37
|
+
this.getPasswordAuthenticationToken = (token, email, password) => {
|
|
38
|
+
const params = {
|
|
39
|
+
authenticationToken: token,
|
|
40
|
+
login: email,
|
|
41
|
+
password,
|
|
42
|
+
};
|
|
43
|
+
const metric = 'vtexid-pass-token';
|
|
44
|
+
return this.http.get(routes.VALIDATE_CLASSIC, { params, metric });
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.ID = ID;
|
|
@@ -1,37 +1,32 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { ID, MasterData, PaymentProvider } from './external';
|
|
6
|
-
import { Apps, Assets, BillingMetrics, Events, Metadata, Registry, Router, VBase, Workspaces } from './infra';
|
|
7
|
-
import { IOClientConstructor } from './IOClient';
|
|
8
|
-
import { LicenseManager, Segment, Session, TenantClient } from './janus';
|
|
1
|
+
import { Apps, Assets, Billing, BillingMetrics, Builder, Events, ID, LicenseManager, Logger, Messages, MessagesGraphQL, Metadata, Registry, Router, Segment, Session, Settings, VBase, Workspaces } from '.';
|
|
2
|
+
import { InstanceOptions, IOClientConstructor } from '../HttpClient';
|
|
3
|
+
import { IOContext } from '../service/typings';
|
|
4
|
+
import { TenantClient } from './Tenant';
|
|
9
5
|
export declare type ClientsImplementation<T extends IOClients> = new (clientOptions: Record<string, InstanceOptions>, ctx: IOContext) => T;
|
|
10
6
|
export declare class IOClients {
|
|
11
7
|
private clientOptions;
|
|
12
8
|
private ctx;
|
|
13
9
|
private clients;
|
|
14
10
|
constructor(clientOptions: Record<string, InstanceOptions>, ctx: IOContext);
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
get paymentProvider(): PaymentProvider;
|
|
11
|
+
readonly apps: Apps;
|
|
12
|
+
readonly assets: Assets;
|
|
13
|
+
readonly billing: Billing;
|
|
14
|
+
readonly billingMetrics: BillingMetrics;
|
|
15
|
+
readonly builder: Builder;
|
|
16
|
+
readonly events: Events;
|
|
17
|
+
readonly id: ID;
|
|
18
|
+
readonly licenseManager: LicenseManager;
|
|
19
|
+
readonly logger: Logger;
|
|
20
|
+
readonly messages: Messages;
|
|
21
|
+
readonly messagesGraphQL: MessagesGraphQL;
|
|
22
|
+
readonly metadata: Metadata;
|
|
23
|
+
readonly registry: Registry;
|
|
24
|
+
readonly router: Router;
|
|
25
|
+
readonly segment: Segment;
|
|
26
|
+
readonly settings: Settings;
|
|
27
|
+
readonly session: Session;
|
|
28
|
+
readonly tenant: TenantClient;
|
|
29
|
+
readonly vbase: VBase;
|
|
30
|
+
readonly workspaces: Workspaces;
|
|
36
31
|
protected getOrSet<TClient extends IOClientConstructor>(key: string, Implementation: TClient): InstanceType<TClient>;
|
|
37
32
|
}
|
package/lib/clients/IOClients.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const external_1 = require("./external");
|
|
6
|
-
const infra_1 = require("./infra");
|
|
7
|
-
const janus_1 = require("./janus");
|
|
3
|
+
const _1 = require(".");
|
|
4
|
+
const Tenant_1 = require("./Tenant");
|
|
8
5
|
class IOClients {
|
|
9
6
|
constructor(clientOptions, ctx) {
|
|
10
7
|
this.clientOptions = clientOptions;
|
|
@@ -12,74 +9,67 @@ class IOClients {
|
|
|
12
9
|
this.clients = {};
|
|
13
10
|
}
|
|
14
11
|
get apps() {
|
|
15
|
-
return this.getOrSet('apps',
|
|
12
|
+
return this.getOrSet('apps', _1.Apps);
|
|
16
13
|
}
|
|
17
14
|
get assets() {
|
|
18
|
-
return this.getOrSet('assets',
|
|
15
|
+
return this.getOrSet('assets', _1.Assets);
|
|
19
16
|
}
|
|
20
17
|
get billing() {
|
|
21
|
-
return this.getOrSet('billing',
|
|
18
|
+
return this.getOrSet('billing', _1.Billing);
|
|
22
19
|
}
|
|
23
20
|
get billingMetrics() {
|
|
24
|
-
return this.getOrSet('billingMetrics',
|
|
21
|
+
return this.getOrSet('billingMetrics', _1.BillingMetrics);
|
|
25
22
|
}
|
|
26
23
|
get builder() {
|
|
27
|
-
return this.getOrSet('builder',
|
|
24
|
+
return this.getOrSet('builder', _1.Builder);
|
|
28
25
|
}
|
|
29
26
|
get events() {
|
|
30
|
-
return this.getOrSet('events',
|
|
27
|
+
return this.getOrSet('events', _1.Events);
|
|
31
28
|
}
|
|
32
29
|
get id() {
|
|
33
|
-
return this.getOrSet('id',
|
|
30
|
+
return this.getOrSet('id', _1.ID);
|
|
34
31
|
}
|
|
35
32
|
get licenseManager() {
|
|
36
|
-
return this.getOrSet('licenseManager',
|
|
33
|
+
return this.getOrSet('licenseManager', _1.LicenseManager);
|
|
37
34
|
}
|
|
38
|
-
get
|
|
39
|
-
return this.getOrSet('
|
|
35
|
+
get logger() {
|
|
36
|
+
return this.getOrSet('logger', _1.Logger);
|
|
37
|
+
}
|
|
38
|
+
get messages() {
|
|
39
|
+
return this.getOrSet('messages', _1.Messages);
|
|
40
40
|
}
|
|
41
41
|
get messagesGraphQL() {
|
|
42
|
-
return this.getOrSet('messagesGraphQL',
|
|
42
|
+
return this.getOrSet('messagesGraphQL', _1.MessagesGraphQL);
|
|
43
43
|
}
|
|
44
44
|
get metadata() {
|
|
45
|
-
return this.getOrSet('metadata',
|
|
45
|
+
return this.getOrSet('metadata', _1.Metadata);
|
|
46
46
|
}
|
|
47
47
|
get registry() {
|
|
48
|
-
return this.getOrSet('registry',
|
|
48
|
+
return this.getOrSet('registry', _1.Registry);
|
|
49
49
|
}
|
|
50
50
|
get router() {
|
|
51
|
-
return this.getOrSet('router',
|
|
51
|
+
return this.getOrSet('router', _1.Router);
|
|
52
52
|
}
|
|
53
53
|
get segment() {
|
|
54
|
-
return this.getOrSet('segment',
|
|
54
|
+
return this.getOrSet('segment', _1.Segment);
|
|
55
55
|
}
|
|
56
56
|
get settings() {
|
|
57
|
-
return this.getOrSet('settings',
|
|
57
|
+
return this.getOrSet('settings', _1.Settings);
|
|
58
58
|
}
|
|
59
59
|
get session() {
|
|
60
|
-
return this.getOrSet('session',
|
|
60
|
+
return this.getOrSet('session', _1.Session);
|
|
61
61
|
}
|
|
62
62
|
get tenant() {
|
|
63
|
-
return this.getOrSet('tenant',
|
|
63
|
+
return this.getOrSet('tenant', Tenant_1.TenantClient);
|
|
64
64
|
}
|
|
65
65
|
get vbase() {
|
|
66
|
-
return this.getOrSet('vbase',
|
|
66
|
+
return this.getOrSet('vbase', _1.VBase);
|
|
67
67
|
}
|
|
68
68
|
get workspaces() {
|
|
69
|
-
return this.getOrSet('workspaces',
|
|
70
|
-
}
|
|
71
|
-
get catalogGraphQL() {
|
|
72
|
-
return this.getOrSet('catalogGraphQL', index_1.CatalogGraphQL);
|
|
73
|
-
}
|
|
74
|
-
get paymentProvider() {
|
|
75
|
-
return this.getOrSet('paymentProvider', external_1.PaymentProvider);
|
|
69
|
+
return this.getOrSet('workspaces', _1.Workspaces);
|
|
76
70
|
}
|
|
77
71
|
getOrSet(key, Implementation) {
|
|
78
|
-
const options = {
|
|
79
|
-
...this.clientOptions.default,
|
|
80
|
-
...this.clientOptions[key],
|
|
81
|
-
metrics,
|
|
82
|
-
};
|
|
72
|
+
const options = Object.assign({}, this.clientOptions.default, this.clientOptions[key], { metrics });
|
|
83
73
|
if (!this.clients[key]) {
|
|
84
74
|
this.clients[key] = new Implementation(this.ctx, options);
|
|
85
75
|
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { JanusClient } from '../HttpClient';
|
|
2
|
+
export declare class LicenseManager extends JanusClient {
|
|
3
|
+
getAccountData(VtexIdclientAutCookie: string): Promise<any>;
|
|
4
|
+
getTopbarData(VtexIdclientAutCookie: string): Promise<any>;
|
|
5
|
+
canAccessResource(VtexIdclientAutCookie: string, resourceKey: string): Promise<boolean>;
|
|
6
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const qs_1 = require("qs");
|
|
4
|
-
const
|
|
4
|
+
const HttpClient_1 = require("../HttpClient");
|
|
5
5
|
const TWO_MINUTES_S = 2 * 60;
|
|
6
6
|
const BASE_URL = '/api/license-manager';
|
|
7
7
|
const routes = {
|
|
@@ -12,46 +12,31 @@ const routes = {
|
|
|
12
12
|
const inflightKey = ({ baseURL, url, params }) => {
|
|
13
13
|
return baseURL + url + qs_1.stringify(params, { arrayFormat: 'repeat', addQueryPrefix: true });
|
|
14
14
|
};
|
|
15
|
-
class LicenseManager extends
|
|
16
|
-
getAccountData(VtexIdclientAutCookie
|
|
17
|
-
const metric = 'lm-account-data';
|
|
15
|
+
class LicenseManager extends HttpClient_1.JanusClient {
|
|
16
|
+
getAccountData(VtexIdclientAutCookie) {
|
|
18
17
|
return this.http.get(routes.accountData, {
|
|
19
18
|
forceMaxAge: TWO_MINUTES_S,
|
|
20
19
|
headers: {
|
|
21
20
|
VtexIdclientAutCookie,
|
|
22
21
|
},
|
|
23
22
|
inflightKey,
|
|
24
|
-
metric,
|
|
25
|
-
tracing: {
|
|
26
|
-
requestSpanNameSuffix: metric,
|
|
27
|
-
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
28
|
-
},
|
|
23
|
+
metric: 'lm-account-data',
|
|
29
24
|
});
|
|
30
25
|
}
|
|
31
|
-
getTopbarData(VtexIdclientAutCookie
|
|
32
|
-
const metric = 'lm-topbar-data';
|
|
26
|
+
getTopbarData(VtexIdclientAutCookie) {
|
|
33
27
|
return this.http.get(routes.topbarData, {
|
|
34
28
|
headers: {
|
|
35
29
|
VtexIdclientAutCookie,
|
|
36
30
|
},
|
|
37
|
-
metric,
|
|
38
|
-
tracing: {
|
|
39
|
-
requestSpanNameSuffix: metric,
|
|
40
|
-
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
41
|
-
},
|
|
31
|
+
metric: 'lm-topbar-data',
|
|
42
32
|
});
|
|
43
33
|
}
|
|
44
|
-
canAccessResource(VtexIdclientAutCookie, resourceKey
|
|
45
|
-
const metric = 'lm-resource-access';
|
|
34
|
+
canAccessResource(VtexIdclientAutCookie, resourceKey) {
|
|
46
35
|
return this.http.get(`${routes.resourceAccess}/${resourceKey}/access`, {
|
|
47
36
|
headers: {
|
|
48
37
|
VtexIdclientAutCookie,
|
|
49
38
|
},
|
|
50
|
-
metric,
|
|
51
|
-
tracing: {
|
|
52
|
-
requestSpanNameSuffix: metric,
|
|
53
|
-
...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
|
|
54
|
-
},
|
|
39
|
+
metric: 'lm-resource-access',
|
|
55
40
|
}).then(() => true, () => false);
|
|
56
41
|
}
|
|
57
42
|
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { InfraClient, InstanceOptions } from '../HttpClient';
|
|
2
|
+
import { IOContext } from '../service/typings';
|
|
3
|
+
export declare enum LogLevel {
|
|
4
|
+
Debug = "debug",
|
|
5
|
+
Info = "info",
|
|
6
|
+
Warn = "warn",
|
|
7
|
+
Error = "error"
|
|
8
|
+
}
|
|
9
|
+
export declare class Logger extends InfraClient {
|
|
10
|
+
private logger;
|
|
11
|
+
constructor(context: IOContext, options?: InstanceOptions);
|
|
12
|
+
debug: (message: any, subject?: string) => Promise<void>;
|
|
13
|
+
info: (message: any, subject?: string) => Promise<void>;
|
|
14
|
+
warn: (warning: any, subject?: string) => Promise<void>;
|
|
15
|
+
error: (error: any, subject?: string) => Promise<void>;
|
|
16
|
+
sendLog: (_: string, message: any, level: LogLevel) => Promise<void>;
|
|
17
|
+
}
|
|
18
|
+
export interface ErrorLog {
|
|
19
|
+
code: string;
|
|
20
|
+
message: string;
|
|
21
|
+
response?: {
|
|
22
|
+
status: number;
|
|
23
|
+
data: string;
|
|
24
|
+
headers: Record<string, string>;
|
|
25
|
+
};
|
|
26
|
+
[key: string]: any;
|
|
27
|
+
}
|