@vtex/api 6.48.1-beta → 6.48.1-beta.3

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.
Files changed (430) hide show
  1. package/gen/manifest.schema +5 -3
  2. package/lib/HttpClient/GraphQLClient.d.ts +2 -1
  3. package/lib/HttpClient/GraphQLClient.js +5 -1
  4. package/lib/HttpClient/HttpClient.d.ts +6 -5
  5. package/lib/HttpClient/HttpClient.js +64 -21
  6. package/lib/HttpClient/agents.d.ts +3 -0
  7. package/lib/HttpClient/agents.js +37 -0
  8. package/lib/HttpClient/index.d.ts +1 -7
  9. package/lib/HttpClient/index.js +17 -16
  10. package/lib/HttpClient/middlewares/cache.d.ts +8 -2
  11. package/lib/HttpClient/middlewares/cache.js +126 -33
  12. package/lib/HttpClient/middlewares/cancellationToken.d.ts +1 -1
  13. package/lib/HttpClient/middlewares/cancellationToken.js +3 -1
  14. package/lib/HttpClient/middlewares/inflight.js +1 -0
  15. package/lib/HttpClient/middlewares/memoization.js +9 -1
  16. package/lib/HttpClient/middlewares/metrics.js +17 -31
  17. package/lib/HttpClient/middlewares/notFound.js +1 -0
  18. package/lib/HttpClient/middlewares/recorder.d.ts +1 -1
  19. package/lib/HttpClient/middlewares/recorder.js +20 -12
  20. package/lib/HttpClient/middlewares/request/HttpAgentSingleton.d.ts +11 -0
  21. package/lib/HttpClient/middlewares/request/HttpAgentSingleton.js +31 -0
  22. package/lib/HttpClient/middlewares/request/index.d.ts +18 -0
  23. package/lib/HttpClient/middlewares/request/index.js +85 -0
  24. package/lib/HttpClient/middlewares/request/setupAxios/index.d.ts +2 -0
  25. package/lib/HttpClient/middlewares/request/setupAxios/index.js +21 -0
  26. package/lib/HttpClient/middlewares/request/setupAxios/interceptors/exponentialBackoff.d.ts +2 -0
  27. package/lib/HttpClient/middlewares/request/setupAxios/interceptors/exponentialBackoff.js +54 -0
  28. package/lib/HttpClient/middlewares/request/setupAxios/interceptors/index.d.ts +2 -0
  29. package/lib/HttpClient/middlewares/request/setupAxios/interceptors/index.js +7 -0
  30. package/lib/HttpClient/middlewares/request/setupAxios/interceptors/tracing/index.d.ts +8 -0
  31. package/lib/HttpClient/middlewares/request/setupAxios/interceptors/tracing/index.js +56 -0
  32. package/lib/HttpClient/middlewares/request/setupAxios/interceptors/tracing/spanSetup.d.ts +4 -0
  33. package/lib/HttpClient/middlewares/request/setupAxios/interceptors/tracing/spanSetup.js +30 -0
  34. package/lib/HttpClient/middlewares/tracing.d.ts +15 -0
  35. package/lib/HttpClient/middlewares/tracing.js +61 -0
  36. package/lib/HttpClient/typings.d.ts +44 -10
  37. package/lib/HttpClient/typings.js +1 -0
  38. package/lib/caches/DiskCache.d.ts +1 -1
  39. package/lib/caches/DiskCache.js +1 -0
  40. package/lib/caches/LRUCache.d.ts +2 -2
  41. package/lib/caches/LRUCache.js +6 -1
  42. package/lib/caches/LRUDiskCache.d.ts +1 -1
  43. package/lib/caches/LRUDiskCache.js +6 -1
  44. package/lib/caches/MultilayeredCache.d.ts +1 -1
  45. package/lib/caches/MultilayeredCache.js +2 -1
  46. package/lib/caches/index.js +16 -7
  47. package/lib/{HttpClient → clients}/IOClient.d.ts +4 -4
  48. package/lib/clients/IOClient.js +20 -0
  49. package/lib/clients/IOClients.d.ts +28 -24
  50. package/lib/clients/IOClients.js +36 -28
  51. package/lib/{HttpClient → clients}/IOGraphQLClient.d.ts +4 -4
  52. package/lib/{HttpClient → clients}/IOGraphQLClient.js +3 -2
  53. package/lib/{HttpClient → clients/apps}/AppClient.d.ts +3 -3
  54. package/lib/{HttpClient → clients/apps}/AppClient.js +11 -5
  55. package/lib/{HttpClient → clients/apps}/AppGraphQLClient.d.ts +3 -3
  56. package/lib/{HttpClient → clients/apps}/AppGraphQLClient.js +11 -5
  57. package/lib/clients/apps/Billing.d.ts +12 -0
  58. package/lib/clients/{Billing.js → apps/Billing.js} +9 -3
  59. package/lib/clients/{Builder.d.ts → apps/Builder.d.ts} +12 -11
  60. package/lib/clients/{Builder.js → apps/Builder.js} +50 -22
  61. package/lib/clients/apps/MessagesGraphQL.d.ts +61 -0
  62. package/lib/clients/apps/MessagesGraphQL.js +122 -0
  63. package/lib/clients/{Settings.d.ts → apps/Settings.d.ts} +5 -4
  64. package/lib/clients/{Settings.js → apps/Settings.js} +15 -20
  65. package/lib/clients/apps/catalogGraphQL/brand.d.ts +13 -0
  66. package/lib/clients/apps/catalogGraphQL/brand.js +19 -0
  67. package/lib/clients/apps/catalogGraphQL/category.d.ts +11 -0
  68. package/lib/clients/apps/catalogGraphQL/category.js +17 -0
  69. package/lib/clients/apps/catalogGraphQL/index.d.ts +22 -0
  70. package/lib/clients/apps/catalogGraphQL/index.js +89 -0
  71. package/lib/clients/apps/catalogGraphQL/product.d.ts +25 -0
  72. package/lib/clients/apps/catalogGraphQL/product.js +31 -0
  73. package/lib/clients/apps/catalogGraphQL/sku.d.ts +26 -0
  74. package/lib/clients/apps/catalogGraphQL/sku.js +31 -0
  75. package/lib/clients/apps/index.d.ts +7 -0
  76. package/lib/clients/apps/index.js +19 -0
  77. package/lib/{HttpClient → clients/external}/ExternalClient.d.ts +3 -3
  78. package/lib/{HttpClient → clients/external}/ExternalClient.js +10 -2
  79. package/lib/clients/external/ID.d.ts +23 -0
  80. package/lib/clients/external/ID.js +61 -0
  81. package/lib/clients/external/Masterdata.d.ts +94 -0
  82. package/lib/clients/external/Masterdata.js +225 -0
  83. package/lib/clients/external/PaymentProvider.d.ts +31 -0
  84. package/lib/clients/external/PaymentProvider.js +43 -0
  85. package/lib/clients/external/index.d.ts +4 -0
  86. package/lib/clients/external/index.js +16 -0
  87. package/lib/clients/index.d.ts +9 -21
  88. package/lib/clients/index.js +23 -24
  89. package/lib/clients/infra/Apps.d.ts +88 -0
  90. package/lib/clients/infra/Apps.js +511 -0
  91. package/lib/clients/infra/Assets.d.ts +34 -0
  92. package/lib/clients/{Assets.js → infra/Assets.js} +75 -19
  93. package/lib/clients/infra/BillingMetrics.d.ts +13 -0
  94. package/lib/clients/infra/BillingMetrics.js +16 -0
  95. package/lib/clients/infra/Events.d.ts +12 -0
  96. package/lib/clients/infra/Events.js +34 -0
  97. package/lib/clients/infra/Housekeeper.d.ts +10 -0
  98. package/lib/clients/infra/Housekeeper.js +31 -0
  99. package/lib/{HttpClient → clients/infra}/InfraClient.d.ts +3 -3
  100. package/lib/{HttpClient → clients/infra}/InfraClient.js +10 -4
  101. package/lib/clients/infra/Registry.d.ts +59 -0
  102. package/lib/clients/{Registry.js → infra/Registry.js} +95 -33
  103. package/lib/clients/infra/Router.d.ts +34 -0
  104. package/lib/clients/infra/Router.js +82 -0
  105. package/lib/clients/infra/Sphinx.d.ts +13 -0
  106. package/lib/clients/infra/Sphinx.js +30 -0
  107. package/lib/clients/infra/VBase.d.ts +60 -0
  108. package/lib/clients/infra/VBase.js +197 -0
  109. package/lib/clients/infra/Workspaces.d.ts +18 -0
  110. package/lib/clients/infra/Workspaces.js +66 -0
  111. package/lib/clients/infra/index.d.ts +11 -0
  112. package/lib/clients/infra/index.js +23 -0
  113. package/lib/{HttpClient → clients/janus}/JanusClient.d.ts +3 -3
  114. package/lib/{HttpClient → clients/janus}/JanusClient.js +8 -3
  115. package/lib/clients/janus/LicenseManager.d.ts +7 -0
  116. package/lib/clients/{LicenseManager.js → janus/LicenseManager.js} +24 -8
  117. package/lib/clients/{Segment.d.ts → janus/Segment.d.ts} +7 -11
  118. package/lib/clients/janus/Segment.js +89 -0
  119. package/lib/clients/{Session.d.ts → janus/Session.d.ts} +4 -4
  120. package/lib/clients/{Session.js → janus/Session.js} +25 -13
  121. package/lib/clients/{Tenant.d.ts → janus/Tenant.d.ts} +6 -7
  122. package/lib/clients/janus/Tenant.js +29 -0
  123. package/lib/clients/janus/index.d.ts +5 -0
  124. package/lib/clients/janus/index.js +17 -0
  125. package/lib/constants.d.ts +49 -1
  126. package/lib/constants.js +55 -1
  127. package/lib/errors/AuthenticationError.js +1 -0
  128. package/lib/errors/ForbiddenError.js +1 -0
  129. package/lib/errors/NotFoundError.js +1 -0
  130. package/lib/errors/RequestCancelledError.js +1 -0
  131. package/lib/errors/ResolverError.d.ts +1 -1
  132. package/lib/errors/ResolverError.js +3 -2
  133. package/lib/errors/ResolverWarning.d.ts +1 -1
  134. package/lib/errors/ResolverWarning.js +3 -2
  135. package/lib/errors/TooManyRequestsError.js +1 -0
  136. package/lib/errors/UserInputError.js +1 -0
  137. package/lib/errors/index.js +18 -11
  138. package/lib/index.d.ts +9 -7
  139. package/lib/index.js +27 -16
  140. package/lib/metrics/MetricsAccumulator.d.ts +1 -18
  141. package/lib/metrics/MetricsAccumulator.js +39 -22
  142. package/lib/responses.d.ts +3 -44
  143. package/lib/service/index.d.ts +2 -0
  144. package/lib/service/index.js +34 -0
  145. package/lib/service/loaders.d.ts +8 -0
  146. package/lib/service/loaders.js +55 -0
  147. package/lib/service/logger/console.d.ts +10 -0
  148. package/lib/service/logger/console.js +37 -0
  149. package/lib/service/logger/index.d.ts +2 -28
  150. package/lib/service/logger/index.js +12 -68
  151. package/lib/service/logger/logger.d.ts +29 -0
  152. package/lib/service/logger/logger.js +62 -0
  153. package/lib/service/logger/metricsLogger.d.ts +40 -0
  154. package/lib/service/logger/metricsLogger.js +150 -0
  155. package/lib/service/master.d.ts +2 -0
  156. package/lib/service/master.js +88 -0
  157. package/lib/service/metrics/requestMetricsMiddleware.d.ts +2 -0
  158. package/lib/service/metrics/requestMetricsMiddleware.js +45 -0
  159. package/lib/service/tracing/TracerSingleton.d.ts +7 -0
  160. package/lib/service/tracing/TracerSingleton.js +49 -0
  161. package/lib/service/tracing/metrics/MetricNames.d.ts +60 -0
  162. package/lib/service/tracing/metrics/MetricNames.js +45 -0
  163. package/lib/service/tracing/metrics/instruments.d.ts +9 -0
  164. package/lib/service/tracing/metrics/instruments.js +12 -0
  165. package/lib/service/tracing/metrics/measurers/EventLoopLagMeasurer.d.ts +9 -0
  166. package/lib/service/tracing/metrics/measurers/EventLoopLagMeasurer.js +26 -0
  167. package/lib/service/tracing/tracingMiddlewares.d.ts +5 -0
  168. package/lib/service/tracing/tracingMiddlewares.js +114 -0
  169. package/lib/service/worker/index.d.ts +11 -0
  170. package/lib/service/worker/index.js +196 -0
  171. package/lib/service/worker/listeners.d.ts +3 -0
  172. package/lib/{utils/unhandled.js → service/worker/listeners.js} +10 -15
  173. package/lib/service/{Service.d.ts → worker/runtime/Service.d.ts} +5 -5
  174. package/lib/service/{Service.js → worker/runtime/Service.js} +3 -1
  175. package/lib/service/worker/runtime/builtIn/handlers.d.ts +4 -0
  176. package/lib/service/worker/runtime/builtIn/handlers.js +31 -0
  177. package/lib/service/worker/runtime/builtIn/middlewares.d.ts +4 -0
  178. package/lib/service/worker/runtime/builtIn/middlewares.js +41 -0
  179. package/lib/service/worker/runtime/events/index.d.ts +4 -0
  180. package/lib/service/worker/runtime/events/index.js +47 -0
  181. package/lib/service/worker/runtime/events/middlewares/body.d.ts +3 -0
  182. package/lib/service/worker/runtime/events/middlewares/body.js +26 -0
  183. package/lib/service/worker/runtime/events/middlewares/context.d.ts +3 -0
  184. package/lib/service/worker/runtime/events/middlewares/context.js +23 -0
  185. package/lib/service/worker/runtime/events/router.d.ts +2 -0
  186. package/lib/service/worker/runtime/events/router.js +28 -0
  187. package/lib/service/worker/runtime/graphql/index.d.ts +6 -0
  188. package/lib/service/worker/runtime/graphql/index.js +28 -0
  189. package/lib/service/worker/runtime/graphql/middlewares/context.d.ts +2 -0
  190. package/lib/service/worker/runtime/graphql/middlewares/context.js +17 -0
  191. package/lib/service/worker/runtime/graphql/middlewares/error.js +97 -0
  192. package/lib/service/worker/runtime/graphql/middlewares/query.d.ts +3 -0
  193. package/lib/service/worker/runtime/graphql/middlewares/query.js +53 -0
  194. package/lib/service/worker/runtime/graphql/middlewares/response.js +39 -0
  195. package/lib/service/worker/runtime/graphql/middlewares/run.d.ts +2 -0
  196. package/lib/service/worker/runtime/graphql/middlewares/run.js +20 -0
  197. package/lib/service/worker/runtime/graphql/middlewares/updateSchema.d.ts +5 -0
  198. package/lib/service/worker/runtime/graphql/middlewares/updateSchema.js +29 -0
  199. package/lib/service/worker/runtime/graphql/middlewares/upload.d.ts +4 -0
  200. package/lib/service/{graphql → worker/runtime/graphql}/middlewares/upload.js +1 -0
  201. package/lib/service/worker/runtime/graphql/schema/index.d.ts +7 -0
  202. package/lib/service/worker/runtime/graphql/schema/index.js +32 -0
  203. package/lib/service/worker/runtime/graphql/schema/messagesLoaderV2.d.ts +6 -0
  204. package/lib/service/worker/runtime/graphql/schema/messagesLoaderV2.js +80 -0
  205. package/lib/service/{graphql → worker/runtime/graphql}/schema/schemaDirectives/Auth.d.ts +1 -0
  206. package/lib/service/{graphql → worker/runtime/graphql}/schema/schemaDirectives/Auth.js +17 -10
  207. package/lib/service/worker/runtime/graphql/schema/schemaDirectives/CacheControl.d.ts +7 -0
  208. package/lib/service/worker/runtime/graphql/schema/schemaDirectives/CacheControl.js +38 -0
  209. package/lib/service/worker/runtime/graphql/schema/schemaDirectives/Deprecated.d.ts +11 -0
  210. package/lib/service/worker/runtime/graphql/schema/schemaDirectives/Deprecated.js +62 -0
  211. package/lib/service/worker/runtime/graphql/schema/schemaDirectives/Metric.d.ts +7 -0
  212. package/lib/service/worker/runtime/graphql/schema/schemaDirectives/Metric.js +41 -0
  213. package/lib/service/{graphql → worker/runtime/graphql}/schema/schemaDirectives/Sanitize.d.ts +1 -0
  214. package/lib/service/{graphql → worker/runtime/graphql}/schema/schemaDirectives/Sanitize.js +7 -0
  215. package/lib/service/worker/runtime/graphql/schema/schemaDirectives/Settings.d.ts +6 -0
  216. package/lib/service/worker/runtime/graphql/schema/schemaDirectives/Settings.js +35 -0
  217. package/lib/service/{graphql → worker/runtime/graphql}/schema/schemaDirectives/SmartCacheDirective.d.ts +1 -0
  218. package/lib/service/{graphql → worker/runtime/graphql}/schema/schemaDirectives/SmartCacheDirective.js +9 -3
  219. package/lib/service/worker/runtime/graphql/schema/schemaDirectives/TranslatableV2.d.ts +7 -0
  220. package/lib/service/worker/runtime/graphql/schema/schemaDirectives/TranslatableV2.js +40 -0
  221. package/lib/service/{graphql/schema/schemaDirectives/Translatable.d.ts → worker/runtime/graphql/schema/schemaDirectives/TranslateTo.d.ts} +2 -1
  222. package/lib/service/worker/runtime/graphql/schema/schemaDirectives/TranslateTo.js +34 -0
  223. package/lib/service/worker/runtime/graphql/schema/schemaDirectives/index.d.ts +22 -0
  224. package/lib/service/worker/runtime/graphql/schema/schemaDirectives/index.js +37 -0
  225. package/lib/service/worker/runtime/graphql/schema/typeDefs/index.d.ts +8 -0
  226. package/lib/service/worker/runtime/graphql/schema/typeDefs/index.js +13 -0
  227. package/lib/service/{graphql → worker/runtime/graphql}/schema/typeDefs/ioUpload.js +1 -0
  228. package/lib/service/{graphql → worker/runtime/graphql}/schema/typeDefs/sanitizedString.js +6 -1
  229. package/lib/service/worker/runtime/graphql/typings.d.ts +31 -0
  230. package/lib/service/worker/runtime/graphql/utils/cacheControl.d.ts +2 -0
  231. package/lib/service/worker/runtime/graphql/utils/cacheControl.js +33 -0
  232. package/lib/service/worker/runtime/graphql/utils/error.d.ts +2 -0
  233. package/lib/service/worker/runtime/graphql/utils/error.js +77 -0
  234. package/lib/service/{graphql → worker/runtime/graphql}/utils/pathname.js +1 -0
  235. package/lib/service/worker/runtime/graphql/utils/translations.d.ts +14 -0
  236. package/lib/service/worker/runtime/graphql/utils/translations.js +39 -0
  237. package/lib/service/worker/runtime/http/index.d.ts +5 -0
  238. package/lib/service/worker/runtime/http/index.js +59 -0
  239. package/lib/service/worker/runtime/http/middlewares/authTokens.d.ts +3 -0
  240. package/lib/service/{http → worker/runtime/http}/middlewares/authTokens.js +1 -0
  241. package/lib/service/worker/runtime/http/middlewares/cancellationToken.d.ts +3 -0
  242. package/lib/service/{http → worker/runtime/http}/middlewares/cancellationToken.js +3 -1
  243. package/lib/service/worker/runtime/http/middlewares/clients.d.ts +4 -0
  244. package/lib/service/{http → worker/runtime/http}/middlewares/clients.js +1 -0
  245. package/lib/service/worker/runtime/http/middlewares/context.d.ts +4 -0
  246. package/lib/service/worker/runtime/http/middlewares/context.js +37 -0
  247. package/lib/service/worker/runtime/http/middlewares/error.d.ts +2 -0
  248. package/lib/service/{http → worker/runtime/http}/middlewares/error.js +28 -15
  249. package/lib/service/worker/runtime/http/middlewares/rateLimit.d.ts +6 -0
  250. package/lib/service/worker/runtime/http/middlewares/rateLimit.js +43 -0
  251. package/lib/service/{http → worker/runtime/http}/middlewares/requestStats.d.ts +3 -3
  252. package/lib/service/{http → worker/runtime/http}/middlewares/requestStats.js +1 -0
  253. package/lib/service/worker/runtime/http/middlewares/setCookie.d.ts +3 -0
  254. package/lib/service/{http → worker/runtime/http}/middlewares/setCookie.js +1 -0
  255. package/lib/service/worker/runtime/http/middlewares/settings.d.ts +9 -0
  256. package/lib/service/worker/runtime/http/middlewares/settings.js +45 -0
  257. package/lib/service/worker/runtime/http/middlewares/timings.d.ts +3 -0
  258. package/lib/service/{http → worker/runtime/http}/middlewares/timings.js +22 -8
  259. package/lib/service/worker/runtime/http/middlewares/vary.d.ts +3 -0
  260. package/lib/service/{http → worker/runtime/http}/middlewares/vary.js +4 -3
  261. package/lib/service/worker/runtime/http/router.d.ts +2 -0
  262. package/lib/service/worker/runtime/http/router.js +24 -0
  263. package/lib/service/worker/runtime/http/routes.d.ts +19 -0
  264. package/lib/service/worker/runtime/http/routes.js +13 -0
  265. package/lib/service/worker/runtime/method.d.ts +9 -0
  266. package/lib/service/{method.js → worker/runtime/method.js} +1 -0
  267. package/lib/service/worker/runtime/statusTrack.d.ts +14 -0
  268. package/lib/service/worker/runtime/statusTrack.js +38 -0
  269. package/lib/service/{typings.d.ts → worker/runtime/typings.d.ts} +70 -36
  270. package/lib/service/worker/runtime/utils/compose.d.ts +5 -0
  271. package/lib/service/{utils → worker/runtime/utils}/compose.js +3 -2
  272. package/lib/service/worker/runtime/utils/context.d.ts +5 -0
  273. package/lib/service/worker/runtime/utils/context.js +41 -0
  274. package/lib/service/worker/runtime/utils/diff.d.ts +12 -0
  275. package/lib/service/worker/runtime/utils/diff.js +22 -0
  276. package/lib/service/worker/runtime/utils/recorder.d.ts +8 -0
  277. package/lib/service/worker/runtime/utils/recorder.js +38 -0
  278. package/lib/service/{graphql/utils/array.js → worker/runtime/utils/toArray.js} +1 -0
  279. package/lib/service/worker/runtime/utils/tokenBucket.d.ts +2 -0
  280. package/lib/service/worker/runtime/utils/tokenBucket.js +17 -0
  281. package/lib/tracing/LogEvents.d.ts +31 -0
  282. package/lib/tracing/LogEvents.js +3 -0
  283. package/lib/tracing/LogFields.d.ts +66 -0
  284. package/lib/tracing/LogFields.js +3 -0
  285. package/lib/tracing/Tags.d.ts +81 -0
  286. package/lib/tracing/Tags.js +8 -0
  287. package/lib/tracing/UserLandTracer.d.ts +27 -0
  288. package/lib/tracing/UserLandTracer.js +57 -0
  289. package/lib/tracing/errorReporting/ErrorReport.d.ts +31 -0
  290. package/lib/tracing/errorReporting/ErrorReport.js +71 -0
  291. package/lib/tracing/index.d.ts +9 -0
  292. package/lib/tracing/index.js +20 -0
  293. package/lib/tracing/spanReference/SpanReferenceTypes.d.ts +4 -0
  294. package/lib/tracing/spanReference/SpanReferenceTypes.js +8 -0
  295. package/lib/tracing/spanReference/createSpanReference.d.ts +3 -0
  296. package/lib/tracing/spanReference/createSpanReference.js +9 -0
  297. package/lib/tracing/utils.d.ts +13 -0
  298. package/lib/tracing/utils.js +41 -0
  299. package/lib/utils/MineWinsConflictsResolver.d.ts +6 -4
  300. package/lib/utils/MineWinsConflictsResolver.js +35 -17
  301. package/lib/utils/app.d.ts +3 -1
  302. package/lib/utils/app.js +4 -1
  303. package/lib/utils/appsStaleIfError.d.ts +1 -1
  304. package/lib/utils/appsStaleIfError.js +20 -7
  305. package/lib/utils/billingOptions.d.ts +36 -3
  306. package/lib/utils/billingOptions.js +8 -3
  307. package/lib/utils/binding.d.ts +3 -3
  308. package/lib/utils/binding.js +1 -0
  309. package/lib/utils/buildFullPath.d.ts +11 -0
  310. package/lib/utils/buildFullPath.js +54 -0
  311. package/lib/utils/cancel.d.ts +2 -2
  312. package/lib/utils/cancel.js +3 -1
  313. package/lib/utils/conflicts.mock.d.ts +17 -0
  314. package/lib/utils/conflicts.mock.js +28 -0
  315. package/lib/utils/domain.js +1 -0
  316. package/lib/utils/error.js +1 -0
  317. package/lib/utils/index.js +19 -12
  318. package/lib/utils/json.js +1 -0
  319. package/lib/utils/log.d.ts +1 -3
  320. package/lib/utils/log.js +3 -2
  321. package/lib/utils/message.js +5 -1
  322. package/lib/utils/renameBy.js +1 -0
  323. package/lib/utils/retry.js +3 -2
  324. package/lib/utils/status.js +1 -0
  325. package/lib/utils/tenant.d.ts +3 -3
  326. package/lib/utils/tenant.js +1 -0
  327. package/lib/utils/throwOnGraphQLErrors.js +1 -0
  328. package/lib/utils/time.d.ts +7 -7
  329. package/lib/utils/time.js +10 -2
  330. package/package.json +3 -3
  331. package/lib/HttpClient/IOClient.js +0 -14
  332. package/lib/HttpClient/factories/index.d.ts +0 -8
  333. package/lib/HttpClient/factories/index.js +0 -31
  334. package/lib/HttpClient/middlewares/request.d.ts +0 -10
  335. package/lib/HttpClient/middlewares/request.js +0 -87
  336. package/lib/IODataSource.d.ts +0 -27
  337. package/lib/IODataSource.js +0 -46
  338. package/lib/clients/Apps.d.ts +0 -84
  339. package/lib/clients/Apps.js +0 -326
  340. package/lib/clients/Assets.d.ts +0 -21
  341. package/lib/clients/Billing.d.ts +0 -11
  342. package/lib/clients/BillingMetrics.d.ts +0 -12
  343. package/lib/clients/BillingMetrics.js +0 -10
  344. package/lib/clients/Events.d.ts +0 -6
  345. package/lib/clients/Events.js +0 -19
  346. package/lib/clients/Housekeeper.d.ts +0 -11
  347. package/lib/clients/Housekeeper.js +0 -24
  348. package/lib/clients/ID.d.ts +0 -22
  349. package/lib/clients/ID.js +0 -48
  350. package/lib/clients/LicenseManager.d.ts +0 -6
  351. package/lib/clients/Logger.d.ts +0 -27
  352. package/lib/clients/Logger.js +0 -32
  353. package/lib/clients/Messages.d.ts +0 -18
  354. package/lib/clients/Messages.js +0 -20
  355. package/lib/clients/MessagesGraphQL.d.ts +0 -63
  356. package/lib/clients/MessagesGraphQL.js +0 -50
  357. package/lib/clients/Metadata.d.ts +0 -25
  358. package/lib/clients/Metadata.js +0 -53
  359. package/lib/clients/Registry.d.ts +0 -61
  360. package/lib/clients/Router.d.ts +0 -33
  361. package/lib/clients/Router.js +0 -50
  362. package/lib/clients/Segment.js +0 -69
  363. package/lib/clients/Sphinx.d.ts +0 -12
  364. package/lib/clients/Sphinx.js +0 -19
  365. package/lib/clients/Tenant.js +0 -13
  366. package/lib/clients/VBase.d.ts +0 -57
  367. package/lib/clients/VBase.js +0 -116
  368. package/lib/clients/Workspaces.d.ts +0 -17
  369. package/lib/clients/Workspaces.js +0 -38
  370. package/lib/service/Runtime.d.ts +0 -18
  371. package/lib/service/Runtime.js +0 -57
  372. package/lib/service/events/index.d.ts +0 -3
  373. package/lib/service/events/index.js +0 -21
  374. package/lib/service/graphql/index.d.ts +0 -7
  375. package/lib/service/graphql/index.js +0 -33
  376. package/lib/service/graphql/middlewares/error.js +0 -107
  377. package/lib/service/graphql/middlewares/formatters.d.ts +0 -2
  378. package/lib/service/graphql/middlewares/formatters.js +0 -64
  379. package/lib/service/graphql/middlewares/query.d.ts +0 -2
  380. package/lib/service/graphql/middlewares/query.js +0 -32
  381. package/lib/service/graphql/middlewares/response.js +0 -36
  382. package/lib/service/graphql/middlewares/run.d.ts +0 -4
  383. package/lib/service/graphql/middlewares/run.js +0 -55
  384. package/lib/service/graphql/middlewares/schema.d.ts +0 -2
  385. package/lib/service/graphql/middlewares/schema.js +0 -8
  386. package/lib/service/graphql/middlewares/timings.d.ts +0 -2
  387. package/lib/service/graphql/middlewares/timings.js +0 -10
  388. package/lib/service/graphql/middlewares/upload.d.ts +0 -7
  389. package/lib/service/graphql/schema/index.d.ts +0 -3
  390. package/lib/service/graphql/schema/index.js +0 -66
  391. package/lib/service/graphql/schema/messagesLoader.d.ts +0 -4
  392. package/lib/service/graphql/schema/messagesLoader.js +0 -41
  393. package/lib/service/graphql/schema/messagesLoaderV2.d.ts +0 -5
  394. package/lib/service/graphql/schema/messagesLoaderV2.js +0 -44
  395. package/lib/service/graphql/schema/schemaDirectives/Translatable.js +0 -54
  396. package/lib/service/graphql/schema/schemaDirectives/TranslatableV2.d.ts +0 -13
  397. package/lib/service/graphql/schema/schemaDirectives/TranslatableV2.js +0 -67
  398. package/lib/service/graphql/schema/schemaDirectives/index.d.ts +0 -13
  399. package/lib/service/graphql/schema/schemaDirectives/index.js +0 -17
  400. package/lib/service/graphql/schema/typeDefs/index.d.ts +0 -16
  401. package/lib/service/graphql/schema/typeDefs/index.js +0 -21
  402. package/lib/service/graphql/schema/typeDefs/ioMessage.d.ts +0 -8
  403. package/lib/service/graphql/schema/typeDefs/ioMessage.js +0 -33
  404. package/lib/service/graphql/typings.d.ts +0 -21
  405. package/lib/service/graphql/utils/cacheControl.d.ts +0 -6
  406. package/lib/service/graphql/utils/cacheControl.js +0 -38
  407. package/lib/service/graphql/utils/maxAgeEnum.d.ts +0 -6
  408. package/lib/service/graphql/utils/maxAgeEnum.js +0 -17
  409. package/lib/service/http/index.d.ts +0 -3
  410. package/lib/service/http/index.js +0 -18
  411. package/lib/service/http/middlewares/authTokens.d.ts +0 -3
  412. package/lib/service/http/middlewares/cancellationToken.d.ts +0 -3
  413. package/lib/service/http/middlewares/clients.d.ts +0 -4
  414. package/lib/service/http/middlewares/error.d.ts +0 -3
  415. package/lib/service/http/middlewares/setCookie.d.ts +0 -3
  416. package/lib/service/http/middlewares/timings.d.ts +0 -3
  417. package/lib/service/http/middlewares/vary.d.ts +0 -3
  418. package/lib/service/method.d.ts +0 -9
  419. package/lib/service/utils/compose.d.ts +0 -4
  420. package/lib/utils/MineWinsConflictsResolver.test.d.ts +0 -1
  421. package/lib/utils/MineWinsConflictsResolver.test.js +0 -134
  422. package/lib/utils/unhandled.d.ts +0 -1
  423. /package/lib/service/{graphql → worker/runtime/graphql}/middlewares/error.d.ts +0 -0
  424. /package/lib/service/{graphql → worker/runtime/graphql}/middlewares/response.d.ts +0 -0
  425. /package/lib/service/{graphql → worker/runtime/graphql}/schema/typeDefs/ioUpload.d.ts +0 -0
  426. /package/lib/service/{graphql → worker/runtime/graphql}/schema/typeDefs/sanitizedString.d.ts +0 -0
  427. /package/lib/service/{graphql → worker/runtime/graphql}/typings.js +0 -0
  428. /package/lib/service/{graphql → worker/runtime/graphql}/utils/pathname.d.ts +0 -0
  429. /package/lib/service/{typings.js → worker/runtime/typings.js} +0 -0
  430. /package/lib/service/{graphql/utils/array.d.ts → worker/runtime/utils/toArray.d.ts} +0 -0
@@ -1,13 +1,28 @@
1
1
  /// <reference types="node" />
2
2
  import { AxiosRequestConfig, AxiosResponse } from 'axios';
3
- import { IAxiosRetryConfig } from 'axios-retry';
4
3
  import { Middleware } from 'koa-compose';
4
+ import { Span } from 'opentracing';
5
5
  import { CacheLayer } from '../caches/CacheLayer';
6
6
  import { MetricsAccumulator } from '../metrics/MetricsAccumulator';
7
+ import { IOContext } from '../service/worker/runtime/typings';
8
+ import { SpanReferenceTypes } from '../tracing';
9
+ import { IUserLandTracer } from '../tracing/UserLandTracer';
7
10
  import { Cached, CacheType } from './middlewares/cache';
8
11
  export declare type InflightKeyGenerator = (x: RequestConfig) => string;
9
- export interface RequestConfig extends AxiosRequestConfig {
10
- 'axios-retry'?: IAxiosRetryConfig;
12
+ interface RequestTracingUserConfig {
13
+ rootSpan?: Span;
14
+ referenceType?: SpanReferenceTypes;
15
+ requestSpanNameSuffix?: string;
16
+ }
17
+ export interface RequestTracingConfig {
18
+ tracing?: RequestTracingUserConfig;
19
+ }
20
+ export interface RequestConfig extends AxiosRequestConfig, RequestTracingConfig {
21
+ retries?: number;
22
+ exponentialTimeoutCoefficient?: number;
23
+ initialBackoffDelay?: number;
24
+ exponentialBackoffCoefficient?: number;
25
+ retryCount?: number;
11
26
  /**
12
27
  * Identifies the type of request for metrification purposes. Should vary with client method.
13
28
  */
@@ -29,8 +44,9 @@ export interface RequestConfig extends AxiosRequestConfig {
29
44
  memoizeable?: boolean;
30
45
  inflightKey?: InflightKeyGenerator;
31
46
  forceMaxAge?: number;
32
- responseEncoding?: BufferEncoding;
47
+ responseEncoding?: BufferEncoding | string;
33
48
  nullIfNotFound?: boolean;
49
+ ignoreRecorder?: boolean;
34
50
  }
35
51
  export interface CacheHit {
36
52
  disk?: 0 | 1;
@@ -38,27 +54,42 @@ export interface CacheHit {
38
54
  revalidated?: 0 | 1;
39
55
  router?: 0 | 1;
40
56
  }
57
+ export interface MiddlewaresTracingContext extends Omit<RequestTracingUserConfig, 'rootSpan'> {
58
+ tracer: IUserLandTracer;
59
+ logger: IOContext['logger'];
60
+ rootSpan?: Span;
61
+ isSampled: boolean;
62
+ }
41
63
  export interface MiddlewareContext {
42
64
  config: RequestConfig;
65
+ tracing?: MiddlewaresTracingContext;
43
66
  response?: AxiosResponse;
44
67
  cacheHit?: CacheHit;
45
68
  inflightHit?: boolean;
46
69
  memoizedHit?: boolean;
47
70
  }
48
71
  export declare type CacheStorage = CacheLayer<string, Cached>;
49
- export { Recorder } from './middlewares/recorder';
50
72
  export interface InstanceOptions {
51
73
  authType?: AuthType;
52
74
  timeout?: number;
53
75
  memoryCache?: CacheLayer<string, Cached>;
54
76
  diskCache?: CacheLayer<string, Cached>;
55
- baseURL?: string;
56
- retries?: number;
77
+ asyncSetCache?: boolean;
57
78
  /**
58
- * @deprecated use retries instead.
59
- * @memberof InstanceOptions
79
+ * Enables memoization, ephemeral within each request, for all requests of this client.
80
+ * Useful for services that makes recursive requests, like graphql resolvers, which
81
+ * might fetch the same endpoint more than once.
82
+ * If that's not the case for your service, disabling it might improve the CPU and
83
+ * memory usage.
84
+ *
85
+ * Default value: true
60
86
  */
61
- retryConfig?: void;
87
+ memoizable?: boolean;
88
+ baseURL?: string;
89
+ retries?: number;
90
+ exponentialTimeoutCoefficient?: number;
91
+ initialBackoffDelay?: number;
92
+ exponentialBackoffCoefficient?: number;
62
93
  metrics?: MetricsAccumulator;
63
94
  /**
64
95
  * Maximum number of concurrent requests
@@ -85,6 +116,8 @@ export interface InstanceOptions {
85
116
  verbose?: boolean;
86
117
  name?: string;
87
118
  serverTimings?: Record<string, string>;
119
+ httpsAgent?: AxiosRequestConfig['httpsAgent'];
120
+ cacheableType?: CacheType;
88
121
  }
89
122
  export interface IOResponse<T> {
90
123
  data: T;
@@ -99,3 +132,4 @@ export declare enum AuthType {
99
132
  */
100
133
  token = "token"
101
134
  }
135
+ export {};
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AuthType = void 0;
3
4
  var AuthType;
4
5
  (function (AuthType) {
5
6
  AuthType["basic"] = "Basic";
@@ -11,7 +11,7 @@ export declare class DiskCache<V> implements CacheLayer<string, V> {
11
11
  constructor(cachePath: string, readFile?: typeof readJSON, writeFile?: typeof outputJSON);
12
12
  has: (key: string) => boolean;
13
13
  getStats: (name?: string) => DiskStats;
14
- get: (key: string) => Promise<void | V>;
14
+ get: (key: string) => Promise<V | void>;
15
15
  set: (key: string, value: V) => Promise<boolean>;
16
16
  private getPathKey;
17
17
  }
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.DiskCache = void 0;
6
7
  const fs_extra_1 = require("fs-extra");
7
8
  const path_1 = require("path");
8
9
  const rwlock_1 = __importDefault(require("rwlock"));
@@ -8,8 +8,8 @@ export declare class LRUCache<K, V> implements CacheLayer<K, V> {
8
8
  private total;
9
9
  private disposed;
10
10
  constructor(options: LRU.Options<K, V>);
11
- get: (key: K) => void | V;
12
- getOrSet: (key: K, fetcher?: (() => Promise<FetchResult<V>>) | undefined) => Promise<void | V>;
11
+ get: (key: K) => V | void;
12
+ getOrSet: (key: K, fetcher?: (() => Promise<FetchResult<V>>) | undefined) => Promise<V | void>;
13
13
  set: (key: K, value: V, maxAge?: number | undefined) => boolean;
14
14
  has: (key: K) => boolean;
15
15
  getStats: (name?: string) => LRUStats;
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.LRUCache = void 0;
6
7
  const lru_cache_1 = __importDefault(require("lru-cache"));
7
8
  const MultilayeredCache_1 = require("./MultilayeredCache");
8
9
  class LRUCache {
@@ -37,7 +38,11 @@ class LRUCache {
37
38
  this.hits = 0;
38
39
  this.total = 0;
39
40
  this.disposed = 0;
40
- this.storage = new lru_cache_1.default(Object.assign({}, options, { dispose: () => this.disposed += 1, noDisposeOnSet: true }));
41
+ this.storage = new lru_cache_1.default({
42
+ ...options,
43
+ dispose: () => this.disposed += 1,
44
+ noDisposeOnSet: true,
45
+ });
41
46
  this.multilayer = new MultilayeredCache_1.MultilayeredCache([this]);
42
47
  }
43
48
  }
@@ -14,7 +14,7 @@ export declare class LRUDiskCache<V> implements CacheLayer<string, V> {
14
14
  constructor(cachePath: string, options: LRUDiskCacheOptions, readFile?: typeof readJSON, writeFile?: typeof outputJSON);
15
15
  has: (key: string) => boolean;
16
16
  getStats: (name?: string) => LRUStats;
17
- get: (key: string) => Promise<void | V>;
17
+ get: (key: string) => Promise<V | void>;
18
18
  set: (key: string, value: V, maxAge?: number | undefined) => Promise<boolean>;
19
19
  private getPathKey;
20
20
  private deleteFile;
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.LRUDiskCache = void 0;
6
7
  const fs_extra_1 = require("fs-extra");
7
8
  const lru_cache_1 = __importDefault(require("lru-cache"));
8
9
  const path_1 = require("path");
@@ -121,7 +122,11 @@ class LRUDiskCache {
121
122
  this.keyToBeDeleted = key;
122
123
  this.disposed += 1;
123
124
  };
124
- const lruOptions = Object.assign({}, options, { dispose, noDisposeOnSet: true });
125
+ const lruOptions = {
126
+ ...options,
127
+ dispose,
128
+ noDisposeOnSet: true,
129
+ };
125
130
  this.lruStorage = new lru_cache_1.default(lruOptions);
126
131
  }
127
132
  }
@@ -5,7 +5,7 @@ export declare class MultilayeredCache<K, V> implements CacheLayer<K, V> {
5
5
  private hits;
6
6
  private total;
7
7
  constructor(caches: Array<CacheLayer<K, V>>);
8
- get: (key: K, fetcher?: (() => Promise<FetchResult<V>>) | undefined) => Promise<void | V>;
8
+ get: (key: K, fetcher?: (() => Promise<FetchResult<V>>) | undefined) => Promise<V | void>;
9
9
  set: (key: K, value: V, maxAge?: number | undefined) => Promise<boolean>;
10
10
  has: (key: K) => Promise<boolean>;
11
11
  getStats: (name?: string) => MultilayerStats;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MultilayeredCache = void 0;
3
4
  const ramda_1 = require("ramda");
4
5
  class MultilayeredCache {
5
6
  constructor(caches) {
@@ -7,7 +8,7 @@ class MultilayeredCache {
7
8
  this.hits = 0;
8
9
  this.total = 0;
9
10
  this.get = async (key, fetcher) => {
10
- let value;
11
+ let value = undefined;
11
12
  let maxAge;
12
13
  let successIndex = await this.findIndex(async (cache) => {
13
14
  const [getValue, hasKey] = await Promise.all([cache.get(key), cache.has(key)]);
@@ -1,9 +1,18 @@
1
1
  "use strict";
2
- function __export(m) {
3
- for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
4
- }
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
11
+ };
5
12
  Object.defineProperty(exports, "__esModule", { value: true });
6
- __export(require("./DiskCache"));
7
- __export(require("./LRUCache"));
8
- __export(require("./LRUDiskCache"));
9
- __export(require("./MultilayeredCache"));
13
+ __exportStar(require("./CacheLayer"), exports);
14
+ __exportStar(require("./DiskCache"), exports);
15
+ __exportStar(require("./LRUCache"), exports);
16
+ __exportStar(require("./LRUDiskCache"), exports);
17
+ __exportStar(require("./MultilayeredCache"), exports);
18
+ __exportStar(require("./typings"), exports);
@@ -1,9 +1,9 @@
1
- import { IOContext } from '../service/typings';
2
- import { HttpClient } from './HttpClient';
3
- import { InstanceOptions } from './typings';
1
+ import { IOContext } from '../service/worker/runtime/typings';
2
+ import { HttpClient } from '../HttpClient/HttpClient';
3
+ import { InstanceOptions } from '../HttpClient/typings';
4
4
  export declare type IOClientConstructor = new (context: IOContext, options?: InstanceOptions) => IOClient;
5
5
  /**
6
- * A client that can be instantiated by the Service runtime layer.
6
+ * A client that can be instantiated by the Serviceruntime layer.
7
7
  */
8
8
  export declare class IOClient {
9
9
  protected context: IOContext;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.IOClient = void 0;
4
+ const HttpClient_1 = require("../HttpClient/HttpClient");
5
+ /**
6
+ * A client that can be instantiated by the Serviceruntime layer.
7
+ */
8
+ class IOClient {
9
+ constructor(context, options) {
10
+ this.context = context;
11
+ this.options = options;
12
+ this.http = new HttpClient_1.HttpClient({
13
+ name: this.constructor.name,
14
+ ...context,
15
+ ...options,
16
+ metrics: options && options.metrics,
17
+ });
18
+ }
19
+ }
20
+ exports.IOClient = IOClient;
@@ -1,32 +1,36 @@
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';
1
+ import { InstanceOptions } from '../HttpClient';
2
+ import { IOContext } from '../service/worker/runtime/typings';
3
+ import { Billing, Builder, MessagesGraphQL, Settings } from './apps';
4
+ import { CatalogGraphQL } from './apps/catalogGraphQL/index';
5
+ import { ID, MasterData, PaymentProvider } from './external';
6
+ import { Apps, Assets, BillingMetrics, Events, Registry, Router, VBase, Workspaces } from './infra';
7
+ import { IOClientConstructor } from './IOClient';
8
+ import { LicenseManager, Segment, Session, TenantClient } from './janus';
5
9
  export declare type ClientsImplementation<T extends IOClients> = new (clientOptions: Record<string, InstanceOptions>, ctx: IOContext) => T;
6
10
  export declare class IOClients {
7
11
  private clientOptions;
8
12
  private ctx;
9
13
  private clients;
10
14
  constructor(clientOptions: Record<string, InstanceOptions>, ctx: IOContext);
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;
15
+ get apps(): Apps;
16
+ get assets(): Assets;
17
+ get billing(): Billing;
18
+ get billingMetrics(): BillingMetrics;
19
+ get builder(): Builder;
20
+ get events(): Events;
21
+ get id(): ID;
22
+ get licenseManager(): LicenseManager;
23
+ get masterdata(): MasterData;
24
+ get messagesGraphQL(): MessagesGraphQL;
25
+ get registry(): Registry;
26
+ get router(): Router;
27
+ get segment(): Segment;
28
+ get settings(): Settings;
29
+ get session(): Session;
30
+ get tenant(): TenantClient;
31
+ get vbase(): VBase;
32
+ get workspaces(): Workspaces;
33
+ get catalogGraphQL(): CatalogGraphQL;
34
+ get paymentProvider(): PaymentProvider;
31
35
  protected getOrSet<TClient extends IOClientConstructor>(key: string, Implementation: TClient): InstanceType<TClient>;
32
36
  }
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const _1 = require(".");
4
- const Tenant_1 = require("./Tenant");
3
+ exports.IOClients = void 0;
4
+ const apps_1 = require("./apps");
5
+ const index_1 = require("./apps/catalogGraphQL/index");
6
+ const external_1 = require("./external");
7
+ const infra_1 = require("./infra");
8
+ const janus_1 = require("./janus");
5
9
  class IOClients {
6
10
  constructor(clientOptions, ctx) {
7
11
  this.clientOptions = clientOptions;
@@ -9,67 +13,71 @@ class IOClients {
9
13
  this.clients = {};
10
14
  }
11
15
  get apps() {
12
- return this.getOrSet('apps', _1.Apps);
16
+ return this.getOrSet('apps', infra_1.Apps);
13
17
  }
14
18
  get assets() {
15
- return this.getOrSet('assets', _1.Assets);
19
+ return this.getOrSet('assets', infra_1.Assets);
16
20
  }
17
21
  get billing() {
18
- return this.getOrSet('billing', _1.Billing);
22
+ return this.getOrSet('billing', apps_1.Billing);
19
23
  }
20
24
  get billingMetrics() {
21
- return this.getOrSet('billingMetrics', _1.BillingMetrics);
25
+ return this.getOrSet('billingMetrics', infra_1.BillingMetrics);
22
26
  }
23
27
  get builder() {
24
- return this.getOrSet('builder', _1.Builder);
28
+ return this.getOrSet('builder', apps_1.Builder);
25
29
  }
26
30
  get events() {
27
- return this.getOrSet('events', _1.Events);
31
+ return this.getOrSet('events', infra_1.Events);
28
32
  }
29
33
  get id() {
30
- return this.getOrSet('id', _1.ID);
34
+ return this.getOrSet('id', external_1.ID);
31
35
  }
32
36
  get licenseManager() {
33
- return this.getOrSet('licenseManager', _1.LicenseManager);
37
+ return this.getOrSet('licenseManager', janus_1.LicenseManager);
34
38
  }
35
- get logger() {
36
- return this.getOrSet('logger', _1.Logger);
37
- }
38
- get messages() {
39
- return this.getOrSet('messages', _1.Messages);
39
+ get masterdata() {
40
+ return this.getOrSet('masterdata', external_1.MasterData);
40
41
  }
41
42
  get messagesGraphQL() {
42
- return this.getOrSet('messagesGraphQL', _1.MessagesGraphQL);
43
- }
44
- get metadata() {
45
- return this.getOrSet('metadata', _1.Metadata);
43
+ return this.getOrSet('messagesGraphQL', apps_1.MessagesGraphQL);
46
44
  }
47
45
  get registry() {
48
- return this.getOrSet('registry', _1.Registry);
46
+ return this.getOrSet('registry', infra_1.Registry);
49
47
  }
50
48
  get router() {
51
- return this.getOrSet('router', _1.Router);
49
+ return this.getOrSet('router', infra_1.Router);
52
50
  }
53
51
  get segment() {
54
- return this.getOrSet('segment', _1.Segment);
52
+ return this.getOrSet('segment', janus_1.Segment);
55
53
  }
56
54
  get settings() {
57
- return this.getOrSet('settings', _1.Settings);
55
+ return this.getOrSet('settings', apps_1.Settings);
58
56
  }
59
57
  get session() {
60
- return this.getOrSet('session', _1.Session);
58
+ return this.getOrSet('session', janus_1.Session);
61
59
  }
62
60
  get tenant() {
63
- return this.getOrSet('tenant', Tenant_1.TenantClient);
61
+ return this.getOrSet('tenant', janus_1.TenantClient);
64
62
  }
65
63
  get vbase() {
66
- return this.getOrSet('vbase', _1.VBase);
64
+ return this.getOrSet('vbase', infra_1.VBase);
67
65
  }
68
66
  get workspaces() {
69
- return this.getOrSet('workspaces', _1.Workspaces);
67
+ return this.getOrSet('workspaces', infra_1.Workspaces);
68
+ }
69
+ get catalogGraphQL() {
70
+ return this.getOrSet('catalogGraphQL', index_1.CatalogGraphQL);
71
+ }
72
+ get paymentProvider() {
73
+ return this.getOrSet('paymentProvider', external_1.PaymentProvider);
70
74
  }
71
75
  getOrSet(key, Implementation) {
72
- const options = Object.assign({}, this.clientOptions.default, this.clientOptions[key], { metrics });
76
+ const options = {
77
+ ...this.clientOptions.default,
78
+ ...this.clientOptions[key],
79
+ metrics,
80
+ };
73
81
  if (!this.clients[key]) {
74
82
  this.clients[key] = new Implementation(this.ctx, options);
75
83
  }
@@ -1,9 +1,9 @@
1
- import { IOContext } from '../service/typings';
2
- import { GraphQLClient } from './GraphQLClient';
1
+ import { GraphQLClient } from '../HttpClient/GraphQLClient';
2
+ import { InstanceOptions } from '../HttpClient/typings';
3
+ import { IOContext } from '../service/worker/runtime/typings';
3
4
  import { IOClient } from './IOClient';
4
- import { InstanceOptions } from './typings';
5
5
  /**
6
- * A GraphQL client that can be instantiated by the Service runtime layer.
6
+ * A GraphQL client that can be instantiated by the Serviceruntime layer.
7
7
  */
8
8
  export declare class IOGraphQLClient extends IOClient {
9
9
  protected context: IOContext;
@@ -1,9 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const GraphQLClient_1 = require("./GraphQLClient");
3
+ exports.IOGraphQLClient = void 0;
4
+ const GraphQLClient_1 = require("../HttpClient/GraphQLClient");
4
5
  const IOClient_1 = require("./IOClient");
5
6
  /**
6
- * A GraphQL client that can be instantiated by the Service runtime layer.
7
+ * A GraphQL client that can be instantiated by the Serviceruntime layer.
7
8
  */
8
9
  class IOGraphQLClient extends IOClient_1.IOClient {
9
10
  constructor(context, options) {
@@ -1,6 +1,6 @@
1
- import { IOContext } from '../service/typings';
2
- import { IOClient } from './IOClient';
3
- import { InstanceOptions } from './typings';
1
+ import { InstanceOptions } from '../../HttpClient/typings';
2
+ import { IOContext } from '../../service/worker/runtime/typings';
3
+ import { IOClient } from '../IOClient';
4
4
  /**
5
5
  * Used to perform calls on apps you declared a dependency for in your manifest.
6
6
  */
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const IOClient_1 = require("./IOClient");
4
- const typings_1 = require("./typings");
3
+ exports.AppClient = void 0;
4
+ const typings_1 = require("../../HttpClient/typings");
5
+ const routes_1 = require("../../service/worker/runtime/http/routes");
6
+ const IOClient_1 = require("../IOClient");
5
7
  const useHttps = !process.env.VTEX_IO;
6
8
  /**
7
9
  * Used to perform calls on apps you declared a dependency for in your manifest.
@@ -15,15 +17,19 @@ class AppClient extends IOClient_1.IOClient {
15
17
  let baseURL;
16
18
  if (appVersion) {
17
19
  const [major] = appVersion.split('.');
18
- baseURL = `${protocol}://app.io.vtex.com/${vendor}.${name}/v${major}/${account}/${workspace}`;
20
+ baseURL = routes_1.formatPrivateRoute({ account, workspace, vendor, name, major, protocol });
19
21
  }
20
22
  else {
21
23
  console.warn(`${account} in ${workspace} is using old routing for ${app}. Please change vendor.app to vendor.app@major in client ${(options && options.name) || ''}`);
22
24
  const service = [name, vendor].join('.'); // messages.vtex
23
25
  baseURL = `http://${service}.${region}.vtex.io/${account}/${workspace}`;
24
26
  }
25
- super(context, Object.assign({}, options, { authType: typings_1.AuthType.bearer, baseURL,
26
- name }));
27
+ super(context, {
28
+ ...options,
29
+ authType: typings_1.AuthType.bearer,
30
+ baseURL,
31
+ name,
32
+ });
27
33
  }
28
34
  }
29
35
  exports.AppClient = AppClient;
@@ -1,6 +1,6 @@
1
- import { IOContext } from '../service/typings';
2
- import { IOGraphQLClient } from './IOGraphQLClient';
3
- import { InstanceOptions } from './typings';
1
+ import { InstanceOptions } from '../../HttpClient/typings';
2
+ import { IOContext } from '../../service/worker/runtime/typings';
3
+ import { IOGraphQLClient } from '../IOGraphQLClient';
4
4
  /**
5
5
  * Used to perform calls on apps you declared a dependency for in your manifest.
6
6
  */
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const IOGraphQLClient_1 = require("./IOGraphQLClient");
4
- const typings_1 = require("./typings");
3
+ exports.AppGraphQLClient = void 0;
4
+ const typings_1 = require("../../HttpClient/typings");
5
+ const routes_1 = require("../../service/worker/runtime/http/routes");
6
+ const IOGraphQLClient_1 = require("../IOGraphQLClient");
5
7
  const useHttps = !process.env.VTEX_IO;
6
8
  /**
7
9
  * Used to perform calls on apps you declared a dependency for in your manifest.
@@ -15,15 +17,19 @@ class AppGraphQLClient extends IOGraphQLClient_1.IOGraphQLClient {
15
17
  let baseURL;
16
18
  if (appVersion) {
17
19
  const [major] = appVersion.split('.');
18
- baseURL = `${protocol}://app.io.vtex.com/${vendor}.${name}/v${major}/${account}/${workspace}/_v/graphql`;
20
+ baseURL = routes_1.formatPrivateRoute({ account, workspace, major, name, vendor, protocol, path: '/_v/graphql' });
19
21
  }
20
22
  else {
21
23
  console.warn(`${account} in ${workspace} is using old routing for ${app}. Please change vendor.app to vendor.app@major in client ${(options && options.name) || ''}`);
22
24
  const service = [name, vendor].join('.'); // messages.vtex
23
25
  baseURL = `http://${service}.${region}.vtex.io/${account}/${workspace}/_v/graphql`;
24
26
  }
25
- super(context, Object.assign({}, options, { authType: typings_1.AuthType.bearer, baseURL,
26
- name }));
27
+ super(context, {
28
+ ...options,
29
+ authType: typings_1.AuthType.bearer,
30
+ baseURL,
31
+ name,
32
+ });
27
33
  }
28
34
  }
29
35
  exports.AppGraphQLClient = AppGraphQLClient;
@@ -0,0 +1,12 @@
1
+ import { InstanceOptions, RequestTracingConfig } from '../../HttpClient';
2
+ import { IOContext } from '../../service/worker/runtime/typings';
3
+ import { AppClient } from './AppClient';
4
+ export declare class Billing extends AppClient {
5
+ constructor(context: IOContext, options?: InstanceOptions);
6
+ status: (tracingConfig?: RequestTracingConfig | undefined) => Promise<ContractStatus>;
7
+ }
8
+ export declare enum ContractStatus {
9
+ ACTIVE = "active_contract",
10
+ INACTIVE = "inactive_contract",
11
+ NO_CONTRACT = "no_contract"
12
+ }
@@ -1,10 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const HttpClient_1 = require("../HttpClient");
4
- class Billing extends HttpClient_1.AppClient {
3
+ exports.ContractStatus = exports.Billing = void 0;
4
+ const AppClient_1 = require("./AppClient");
5
+ class Billing extends AppClient_1.AppClient {
5
6
  constructor(context, options) {
6
7
  super('vtex.billing@0.x', context, options);
7
- this.status = () => this.http.get('/_v/contractStatus');
8
+ this.status = (tracingConfig) => this.http.get('/_v/contractStatus', {
9
+ tracing: {
10
+ requestSpanNameSuffix: 'billing-status',
11
+ ...tracingConfig === null || tracingConfig === void 0 ? void 0 : tracingConfig.tracing,
12
+ },
13
+ });
8
14
  }
9
15
  }
10
16
  exports.Billing = Billing;