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

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 (440) hide show
  1. package/gen/manifest.schema +5 -3
  2. package/lib/HttpClient/GraphQLClient.d.ts +3 -2
  3. package/lib/HttpClient/GraphQLClient.js +5 -1
  4. package/lib/HttpClient/HttpClient.d.ts +9 -7
  5. package/lib/HttpClient/HttpClient.js +70 -27
  6. package/lib/HttpClient/agents.d.ts +6 -0
  7. package/lib/HttpClient/agents.js +43 -0
  8. package/lib/HttpClient/index.d.ts +1 -7
  9. package/lib/HttpClient/index.js +22 -16
  10. package/lib/HttpClient/middlewares/cache.d.ts +9 -3
  11. package/lib/HttpClient/middlewares/cache.js +130 -35
  12. package/lib/HttpClient/middlewares/cancellationToken.d.ts +2 -2
  13. package/lib/HttpClient/middlewares/cancellationToken.js +5 -2
  14. package/lib/HttpClient/middlewares/inflight.d.ts +1 -1
  15. package/lib/HttpClient/middlewares/inflight.js +7 -3
  16. package/lib/HttpClient/middlewares/memoization.d.ts +1 -1
  17. package/lib/HttpClient/middlewares/memoization.js +13 -4
  18. package/lib/HttpClient/middlewares/metrics.js +25 -38
  19. package/lib/HttpClient/middlewares/notFound.d.ts +1 -1
  20. package/lib/HttpClient/middlewares/notFound.js +5 -2
  21. package/lib/HttpClient/middlewares/recorder.d.ts +1 -1
  22. package/lib/HttpClient/middlewares/recorder.js +21 -12
  23. package/lib/HttpClient/middlewares/request/HttpAgentSingleton.d.ts +11 -0
  24. package/lib/HttpClient/middlewares/request/HttpAgentSingleton.js +31 -0
  25. package/lib/HttpClient/middlewares/request/index.d.ts +18 -0
  26. package/lib/HttpClient/middlewares/request/index.js +88 -0
  27. package/lib/HttpClient/middlewares/request/setupAxios/index.d.ts +1 -0
  28. package/lib/HttpClient/middlewares/request/setupAxios/index.js +22 -0
  29. package/lib/HttpClient/middlewares/request/setupAxios/interceptors/exponentialBackoff.d.ts +2 -0
  30. package/lib/HttpClient/middlewares/request/setupAxios/interceptors/exponentialBackoff.js +55 -0
  31. package/lib/HttpClient/middlewares/request/setupAxios/interceptors/index.d.ts +2 -0
  32. package/lib/HttpClient/middlewares/request/setupAxios/interceptors/index.js +8 -0
  33. package/lib/HttpClient/middlewares/request/setupAxios/interceptors/tracing/index.d.ts +8 -0
  34. package/lib/HttpClient/middlewares/request/setupAxios/interceptors/tracing/index.js +56 -0
  35. package/lib/HttpClient/middlewares/request/setupAxios/interceptors/tracing/spanSetup.d.ts +4 -0
  36. package/lib/HttpClient/middlewares/request/setupAxios/interceptors/tracing/spanSetup.js +32 -0
  37. package/lib/HttpClient/middlewares/tracing.d.ts +15 -0
  38. package/lib/HttpClient/middlewares/tracing.js +62 -0
  39. package/lib/HttpClient/typings.d.ts +46 -12
  40. package/lib/HttpClient/typings.js +1 -0
  41. package/lib/caches/DiskCache.d.ts +1 -1
  42. package/lib/caches/DiskCache.js +3 -2
  43. package/lib/caches/LRUCache.d.ts +3 -3
  44. package/lib/caches/LRUCache.js +6 -1
  45. package/lib/caches/LRUDiskCache.d.ts +2 -2
  46. package/lib/caches/LRUDiskCache.js +8 -3
  47. package/lib/caches/MultilayeredCache.d.ts +2 -2
  48. package/lib/caches/MultilayeredCache.js +8 -7
  49. package/lib/caches/index.js +20 -7
  50. package/lib/caches/typings.d.ts +5 -5
  51. package/lib/clients/IOClient.d.ts +13 -0
  52. package/lib/clients/IOClient.js +20 -0
  53. package/lib/clients/IOClients.d.ts +29 -25
  54. package/lib/clients/IOClients.js +36 -28
  55. package/lib/{HttpClient → clients}/IOGraphQLClient.d.ts +4 -4
  56. package/lib/{HttpClient → clients}/IOGraphQLClient.js +3 -2
  57. package/lib/{HttpClient → clients/apps}/AppClient.d.ts +3 -3
  58. package/lib/{HttpClient → clients/apps}/AppClient.js +11 -5
  59. package/lib/{HttpClient → clients/apps}/AppGraphQLClient.d.ts +3 -3
  60. package/lib/{HttpClient → clients/apps}/AppGraphQLClient.js +11 -5
  61. package/lib/clients/apps/Billing.d.ts +12 -0
  62. package/lib/clients/{Billing.js → apps/Billing.js} +9 -3
  63. package/lib/clients/{Builder.d.ts → apps/Builder.d.ts} +12 -11
  64. package/lib/clients/{Builder.js → apps/Builder.js} +51 -23
  65. package/lib/clients/apps/MessagesGraphQL.d.ts +61 -0
  66. package/lib/clients/apps/MessagesGraphQL.js +122 -0
  67. package/lib/clients/{Settings.d.ts → apps/Settings.d.ts} +5 -4
  68. package/lib/clients/apps/Settings.js +39 -0
  69. package/lib/clients/apps/catalogGraphQL/brand.d.ts +13 -0
  70. package/lib/clients/apps/catalogGraphQL/brand.js +19 -0
  71. package/lib/clients/apps/catalogGraphQL/category.d.ts +11 -0
  72. package/lib/clients/apps/catalogGraphQL/category.js +17 -0
  73. package/lib/clients/apps/catalogGraphQL/index.d.ts +22 -0
  74. package/lib/clients/apps/catalogGraphQL/index.js +89 -0
  75. package/lib/clients/apps/catalogGraphQL/product.d.ts +25 -0
  76. package/lib/clients/apps/catalogGraphQL/product.js +31 -0
  77. package/lib/clients/apps/catalogGraphQL/sku.d.ts +26 -0
  78. package/lib/clients/apps/catalogGraphQL/sku.js +31 -0
  79. package/lib/clients/apps/index.d.ts +7 -0
  80. package/lib/clients/apps/index.js +23 -0
  81. package/lib/{HttpClient → clients/external}/ExternalClient.d.ts +3 -3
  82. package/lib/{HttpClient → clients/external}/ExternalClient.js +10 -2
  83. package/lib/clients/external/ID.d.ts +23 -0
  84. package/lib/clients/external/ID.js +61 -0
  85. package/lib/clients/external/Masterdata.d.ts +94 -0
  86. package/lib/clients/external/Masterdata.js +225 -0
  87. package/lib/clients/external/PaymentProvider.d.ts +31 -0
  88. package/lib/clients/external/PaymentProvider.js +43 -0
  89. package/lib/clients/external/index.d.ts +4 -0
  90. package/lib/clients/external/index.js +20 -0
  91. package/lib/clients/index.d.ts +9 -21
  92. package/lib/clients/index.js +27 -24
  93. package/lib/clients/infra/Apps.d.ts +93 -0
  94. package/lib/clients/infra/Apps.js +511 -0
  95. package/lib/clients/infra/Assets.d.ts +35 -0
  96. package/lib/clients/infra/Assets.js +166 -0
  97. package/lib/clients/infra/BillingMetrics.d.ts +13 -0
  98. package/lib/clients/infra/BillingMetrics.js +16 -0
  99. package/lib/clients/infra/Events.d.ts +12 -0
  100. package/lib/clients/infra/Events.js +34 -0
  101. package/lib/clients/infra/Housekeeper.d.ts +10 -0
  102. package/lib/clients/infra/Housekeeper.js +31 -0
  103. package/lib/{HttpClient → clients/infra}/InfraClient.d.ts +3 -3
  104. package/lib/{HttpClient → clients/infra}/InfraClient.js +10 -4
  105. package/lib/clients/infra/Registry.d.ts +65 -0
  106. package/lib/clients/infra/Registry.js +209 -0
  107. package/lib/clients/infra/Router.d.ts +34 -0
  108. package/lib/clients/infra/Router.js +82 -0
  109. package/lib/clients/infra/Sphinx.d.ts +13 -0
  110. package/lib/clients/infra/Sphinx.js +30 -0
  111. package/lib/clients/infra/VBase.d.ts +61 -0
  112. package/lib/clients/infra/VBase.js +197 -0
  113. package/lib/clients/infra/Workspaces.d.ts +18 -0
  114. package/lib/clients/infra/Workspaces.js +66 -0
  115. package/lib/clients/infra/index.d.ts +11 -0
  116. package/lib/clients/infra/index.js +27 -0
  117. package/lib/{HttpClient → clients/janus}/JanusClient.d.ts +4 -4
  118. package/lib/{HttpClient → clients/janus}/JanusClient.js +8 -3
  119. package/lib/clients/janus/LicenseManager.d.ts +7 -0
  120. package/lib/clients/janus/LicenseManager.js +59 -0
  121. package/lib/clients/{Segment.d.ts → janus/Segment.d.ts} +7 -11
  122. package/lib/clients/janus/Segment.js +89 -0
  123. package/lib/clients/{Session.d.ts → janus/Session.d.ts} +4 -4
  124. package/lib/clients/{Session.js → janus/Session.js} +25 -13
  125. package/lib/clients/{Tenant.d.ts → janus/Tenant.d.ts} +7 -8
  126. package/lib/clients/janus/Tenant.js +29 -0
  127. package/lib/clients/janus/index.d.ts +5 -0
  128. package/lib/clients/janus/index.js +21 -0
  129. package/lib/constants.d.ts +50 -2
  130. package/lib/constants.js +55 -1
  131. package/lib/errors/AuthenticationError.js +1 -0
  132. package/lib/errors/ForbiddenError.js +1 -0
  133. package/lib/errors/NotFoundError.js +1 -0
  134. package/lib/errors/RequestCancelledError.js +1 -0
  135. package/lib/errors/ResolverError.d.ts +1 -1
  136. package/lib/errors/ResolverError.js +4 -3
  137. package/lib/errors/ResolverWarning.d.ts +1 -1
  138. package/lib/errors/ResolverWarning.js +3 -2
  139. package/lib/errors/TooManyRequestsError.js +1 -0
  140. package/lib/errors/UserInputError.js +1 -0
  141. package/lib/errors/index.js +22 -11
  142. package/lib/index.d.ts +9 -7
  143. package/lib/index.js +31 -16
  144. package/lib/metrics/MetricsAccumulator.d.ts +3 -20
  145. package/lib/metrics/MetricsAccumulator.js +44 -27
  146. package/lib/responses.d.ts +5 -46
  147. package/lib/service/index.d.ts +2 -0
  148. package/lib/service/index.js +35 -0
  149. package/lib/service/loaders.d.ts +8 -0
  150. package/lib/service/loaders.js +57 -0
  151. package/lib/service/logger/console.d.ts +10 -0
  152. package/lib/service/logger/console.js +40 -0
  153. package/lib/service/logger/index.d.ts +2 -28
  154. package/lib/service/logger/index.js +16 -68
  155. package/lib/service/logger/logger.d.ts +29 -0
  156. package/lib/service/logger/logger.js +62 -0
  157. package/lib/service/logger/metricsLogger.d.ts +40 -0
  158. package/lib/service/logger/metricsLogger.js +150 -0
  159. package/lib/service/master.d.ts +2 -0
  160. package/lib/service/master.js +89 -0
  161. package/lib/service/metrics/requestMetricsMiddleware.d.ts +2 -0
  162. package/lib/service/metrics/requestMetricsMiddleware.js +46 -0
  163. package/lib/service/tracing/TracerSingleton.d.ts +7 -0
  164. package/lib/service/tracing/TracerSingleton.js +49 -0
  165. package/lib/service/tracing/metrics/MetricNames.d.ts +60 -0
  166. package/lib/service/tracing/metrics/MetricNames.js +45 -0
  167. package/lib/service/tracing/metrics/instruments.d.ts +9 -0
  168. package/lib/service/tracing/metrics/instruments.js +19 -0
  169. package/lib/service/tracing/metrics/measurers/EventLoopLagMeasurer.d.ts +9 -0
  170. package/lib/service/tracing/metrics/measurers/EventLoopLagMeasurer.js +26 -0
  171. package/lib/service/tracing/tracingMiddlewares.d.ts +5 -0
  172. package/lib/service/tracing/tracingMiddlewares.js +117 -0
  173. package/lib/service/worker/index.d.ts +11 -0
  174. package/lib/service/worker/index.js +197 -0
  175. package/lib/service/worker/listeners.d.ts +3 -0
  176. package/lib/{utils/unhandled.js → service/worker/listeners.js} +12 -16
  177. package/lib/service/{Service.d.ts → worker/runtime/Service.d.ts} +5 -5
  178. package/lib/service/{Service.js → worker/runtime/Service.js} +3 -1
  179. package/lib/service/worker/runtime/builtIn/handlers.d.ts +4 -0
  180. package/lib/service/worker/runtime/builtIn/handlers.js +34 -0
  181. package/lib/service/worker/runtime/builtIn/middlewares.d.ts +4 -0
  182. package/lib/service/worker/runtime/builtIn/middlewares.js +43 -0
  183. package/lib/service/worker/runtime/events/index.d.ts +4 -0
  184. package/lib/service/worker/runtime/events/index.js +48 -0
  185. package/lib/service/worker/runtime/events/middlewares/body.d.ts +3 -0
  186. package/lib/service/worker/runtime/events/middlewares/body.js +26 -0
  187. package/lib/service/worker/runtime/events/middlewares/context.d.ts +3 -0
  188. package/lib/service/worker/runtime/events/middlewares/context.js +23 -0
  189. package/lib/service/worker/runtime/events/router.d.ts +2 -0
  190. package/lib/service/worker/runtime/events/router.js +29 -0
  191. package/lib/service/worker/runtime/graphql/index.d.ts +6 -0
  192. package/lib/service/worker/runtime/graphql/index.js +29 -0
  193. package/lib/service/worker/runtime/graphql/middlewares/context.d.ts +2 -0
  194. package/lib/service/worker/runtime/graphql/middlewares/context.js +17 -0
  195. package/lib/service/worker/runtime/graphql/middlewares/error.js +97 -0
  196. package/lib/service/worker/runtime/graphql/middlewares/query.d.ts +3 -0
  197. package/lib/service/worker/runtime/graphql/middlewares/query.js +54 -0
  198. package/lib/service/worker/runtime/graphql/middlewares/response.js +39 -0
  199. package/lib/service/worker/runtime/graphql/middlewares/run.d.ts +2 -0
  200. package/lib/service/worker/runtime/graphql/middlewares/run.js +21 -0
  201. package/lib/service/worker/runtime/graphql/middlewares/updateSchema.d.ts +5 -0
  202. package/lib/service/worker/runtime/graphql/middlewares/updateSchema.js +30 -0
  203. package/lib/service/worker/runtime/graphql/middlewares/upload.d.ts +4 -0
  204. package/lib/service/{graphql → worker/runtime/graphql}/middlewares/upload.js +2 -1
  205. package/lib/service/worker/runtime/graphql/schema/index.d.ts +7 -0
  206. package/lib/service/worker/runtime/graphql/schema/index.js +33 -0
  207. package/lib/service/worker/runtime/graphql/schema/messagesLoaderV2.d.ts +6 -0
  208. package/lib/service/worker/runtime/graphql/schema/messagesLoaderV2.js +81 -0
  209. package/lib/service/{graphql → worker/runtime/graphql}/schema/schemaDirectives/Auth.d.ts +1 -0
  210. package/lib/service/{graphql → worker/runtime/graphql}/schema/schemaDirectives/Auth.js +17 -10
  211. package/lib/service/worker/runtime/graphql/schema/schemaDirectives/CacheControl.d.ts +7 -0
  212. package/lib/service/worker/runtime/graphql/schema/schemaDirectives/CacheControl.js +38 -0
  213. package/lib/service/worker/runtime/graphql/schema/schemaDirectives/Deprecated.d.ts +11 -0
  214. package/lib/service/worker/runtime/graphql/schema/schemaDirectives/Deprecated.js +62 -0
  215. package/lib/service/worker/runtime/graphql/schema/schemaDirectives/Metric.d.ts +7 -0
  216. package/lib/service/worker/runtime/graphql/schema/schemaDirectives/Metric.js +41 -0
  217. package/lib/service/{graphql → worker/runtime/graphql}/schema/schemaDirectives/Sanitize.d.ts +1 -0
  218. package/lib/service/{graphql → worker/runtime/graphql}/schema/schemaDirectives/Sanitize.js +7 -0
  219. package/lib/service/worker/runtime/graphql/schema/schemaDirectives/Settings.d.ts +6 -0
  220. package/lib/service/worker/runtime/graphql/schema/schemaDirectives/Settings.js +35 -0
  221. package/lib/service/{graphql → worker/runtime/graphql}/schema/schemaDirectives/SmartCacheDirective.d.ts +1 -0
  222. package/lib/service/{graphql → worker/runtime/graphql}/schema/schemaDirectives/SmartCacheDirective.js +9 -3
  223. package/lib/service/worker/runtime/graphql/schema/schemaDirectives/TranslatableV2.d.ts +7 -0
  224. package/lib/service/worker/runtime/graphql/schema/schemaDirectives/TranslatableV2.js +40 -0
  225. package/lib/service/{graphql/schema/schemaDirectives/Translatable.d.ts → worker/runtime/graphql/schema/schemaDirectives/TranslateTo.d.ts} +2 -1
  226. package/lib/service/worker/runtime/graphql/schema/schemaDirectives/TranslateTo.js +34 -0
  227. package/lib/service/worker/runtime/graphql/schema/schemaDirectives/index.d.ts +22 -0
  228. package/lib/service/worker/runtime/graphql/schema/schemaDirectives/index.js +37 -0
  229. package/lib/service/worker/runtime/graphql/schema/typeDefs/index.d.ts +8 -0
  230. package/lib/service/worker/runtime/graphql/schema/typeDefs/index.js +14 -0
  231. package/lib/service/{graphql → worker/runtime/graphql}/schema/typeDefs/ioUpload.js +1 -0
  232. package/lib/service/{graphql → worker/runtime/graphql}/schema/typeDefs/sanitizedString.js +8 -3
  233. package/lib/service/worker/runtime/graphql/typings.d.ts +31 -0
  234. package/lib/service/worker/runtime/graphql/utils/cacheControl.d.ts +2 -0
  235. package/lib/service/worker/runtime/graphql/utils/cacheControl.js +34 -0
  236. package/lib/service/worker/runtime/graphql/utils/error.d.ts +2 -0
  237. package/lib/service/worker/runtime/graphql/utils/error.js +78 -0
  238. package/lib/service/worker/runtime/graphql/utils/pathname.js +9 -0
  239. package/lib/service/worker/runtime/graphql/utils/translations.d.ts +14 -0
  240. package/lib/service/worker/runtime/graphql/utils/translations.js +42 -0
  241. package/lib/service/worker/runtime/http/index.d.ts +5 -0
  242. package/lib/service/worker/runtime/http/index.js +61 -0
  243. package/lib/service/worker/runtime/http/middlewares/authTokens.d.ts +3 -0
  244. package/lib/service/{http → worker/runtime/http}/middlewares/authTokens.js +1 -0
  245. package/lib/service/worker/runtime/http/middlewares/cancellationToken.d.ts +3 -0
  246. package/lib/service/{http → worker/runtime/http}/middlewares/cancellationToken.js +3 -1
  247. package/lib/service/worker/runtime/http/middlewares/clients.d.ts +4 -0
  248. package/lib/service/{http → worker/runtime/http}/middlewares/clients.js +1 -0
  249. package/lib/service/worker/runtime/http/middlewares/context.d.ts +4 -0
  250. package/lib/service/worker/runtime/http/middlewares/context.js +39 -0
  251. package/lib/service/worker/runtime/http/middlewares/error.d.ts +2 -0
  252. package/lib/service/{http → worker/runtime/http}/middlewares/error.js +29 -16
  253. package/lib/service/worker/runtime/http/middlewares/rateLimit.d.ts +6 -0
  254. package/lib/service/worker/runtime/http/middlewares/rateLimit.js +43 -0
  255. package/lib/service/{http → worker/runtime/http}/middlewares/requestStats.d.ts +3 -3
  256. package/lib/service/{http → worker/runtime/http}/middlewares/requestStats.js +1 -0
  257. package/lib/service/worker/runtime/http/middlewares/setCookie.d.ts +3 -0
  258. package/lib/service/{http → worker/runtime/http}/middlewares/setCookie.js +6 -5
  259. package/lib/service/worker/runtime/http/middlewares/settings.d.ts +9 -0
  260. package/lib/service/worker/runtime/http/middlewares/settings.js +49 -0
  261. package/lib/service/worker/runtime/http/middlewares/timings.d.ts +3 -0
  262. package/lib/service/{http → worker/runtime/http}/middlewares/timings.js +25 -11
  263. package/lib/service/worker/runtime/http/middlewares/vary.d.ts +3 -0
  264. package/lib/service/{http → worker/runtime/http}/middlewares/vary.js +4 -3
  265. package/lib/service/worker/runtime/http/router.d.ts +2 -0
  266. package/lib/service/worker/runtime/http/router.js +25 -0
  267. package/lib/service/worker/runtime/http/routes.d.ts +19 -0
  268. package/lib/service/worker/runtime/http/routes.js +16 -0
  269. package/lib/service/worker/runtime/method.d.ts +9 -0
  270. package/lib/service/{method.js → worker/runtime/method.js} +2 -1
  271. package/lib/service/worker/runtime/statusTrack.d.ts +14 -0
  272. package/lib/service/worker/runtime/statusTrack.js +43 -0
  273. package/lib/service/worker/runtime/typings.d.ts +173 -0
  274. package/lib/service/worker/runtime/utils/compose.d.ts +5 -0
  275. package/lib/service/worker/runtime/utils/compose.js +14 -0
  276. package/lib/service/worker/runtime/utils/context.d.ts +5 -0
  277. package/lib/service/worker/runtime/utils/context.js +42 -0
  278. package/lib/service/worker/runtime/utils/diff.d.ts +12 -0
  279. package/lib/service/worker/runtime/utils/diff.js +22 -0
  280. package/lib/service/worker/runtime/utils/recorder.d.ts +8 -0
  281. package/lib/service/worker/runtime/utils/recorder.js +38 -0
  282. package/lib/service/worker/runtime/utils/toArray.js +5 -0
  283. package/lib/service/worker/runtime/utils/tokenBucket.d.ts +2 -0
  284. package/lib/service/worker/runtime/utils/tokenBucket.js +17 -0
  285. package/lib/tracing/LogEvents.d.ts +31 -0
  286. package/lib/{service/graphql/utils/array.js → tracing/LogEvents.js} +1 -1
  287. package/lib/tracing/LogFields.d.ts +66 -0
  288. package/lib/tracing/LogFields.js +3 -0
  289. package/lib/tracing/Tags.d.ts +81 -0
  290. package/lib/tracing/Tags.js +8 -0
  291. package/lib/tracing/UserLandTracer.d.ts +27 -0
  292. package/lib/tracing/UserLandTracer.js +58 -0
  293. package/lib/tracing/errorReporting/ErrorReport.d.ts +31 -0
  294. package/lib/tracing/errorReporting/ErrorReport.js +71 -0
  295. package/lib/tracing/index.d.ts +9 -0
  296. package/lib/tracing/index.js +20 -0
  297. package/lib/tracing/spanReference/SpanReferenceTypes.d.ts +4 -0
  298. package/lib/tracing/spanReference/SpanReferenceTypes.js +8 -0
  299. package/lib/tracing/spanReference/createSpanReference.d.ts +3 -0
  300. package/lib/tracing/spanReference/createSpanReference.js +9 -0
  301. package/lib/tracing/utils.d.ts +13 -0
  302. package/lib/tracing/utils.js +42 -0
  303. package/lib/utils/MineWinsConflictsResolver.d.ts +7 -5
  304. package/lib/utils/MineWinsConflictsResolver.js +40 -22
  305. package/lib/utils/app.d.ts +3 -1
  306. package/lib/utils/app.js +40 -21
  307. package/lib/utils/appsStaleIfError.d.ts +2 -1
  308. package/lib/utils/appsStaleIfError.js +33 -12
  309. package/lib/utils/billingOptions.d.ts +36 -3
  310. package/lib/utils/billingOptions.js +9 -3
  311. package/lib/utils/binding.d.ts +3 -3
  312. package/lib/utils/binding.js +5 -2
  313. package/lib/utils/cancel.d.ts +2 -2
  314. package/lib/utils/cancel.js +3 -1
  315. package/lib/utils/conflicts.mock.d.ts +17 -0
  316. package/lib/utils/conflicts.mock.js +28 -0
  317. package/lib/utils/domain.js +2 -1
  318. package/lib/utils/error.js +6 -4
  319. package/lib/utils/index.js +23 -12
  320. package/lib/utils/json.js +1 -0
  321. package/lib/utils/log.d.ts +1 -3
  322. package/lib/utils/log.js +6 -4
  323. package/lib/utils/message.js +11 -4
  324. package/lib/utils/renameBy.js +3 -1
  325. package/lib/utils/retry.js +10 -7
  326. package/lib/utils/status.js +3 -1
  327. package/lib/utils/tenant.d.ts +3 -3
  328. package/lib/utils/tenant.js +5 -2
  329. package/lib/utils/throwOnGraphQLErrors.js +1 -0
  330. package/lib/utils/time.d.ts +7 -7
  331. package/lib/utils/time.js +29 -12
  332. package/package.json +3 -3
  333. package/lib/HttpClient/IOClient.d.ts +0 -13
  334. package/lib/HttpClient/IOClient.js +0 -14
  335. package/lib/HttpClient/factories/index.d.ts +0 -8
  336. package/lib/HttpClient/factories/index.js +0 -31
  337. package/lib/HttpClient/middlewares/request.d.ts +0 -10
  338. package/lib/HttpClient/middlewares/request.js +0 -87
  339. package/lib/IODataSource.d.ts +0 -27
  340. package/lib/IODataSource.js +0 -46
  341. package/lib/clients/Apps.d.ts +0 -84
  342. package/lib/clients/Apps.js +0 -326
  343. package/lib/clients/Assets.d.ts +0 -21
  344. package/lib/clients/Assets.js +0 -110
  345. package/lib/clients/Billing.d.ts +0 -11
  346. package/lib/clients/BillingMetrics.d.ts +0 -12
  347. package/lib/clients/BillingMetrics.js +0 -10
  348. package/lib/clients/Events.d.ts +0 -6
  349. package/lib/clients/Events.js +0 -19
  350. package/lib/clients/Housekeeper.d.ts +0 -11
  351. package/lib/clients/Housekeeper.js +0 -24
  352. package/lib/clients/ID.d.ts +0 -22
  353. package/lib/clients/ID.js +0 -48
  354. package/lib/clients/LicenseManager.d.ts +0 -6
  355. package/lib/clients/LicenseManager.js +0 -43
  356. package/lib/clients/Logger.d.ts +0 -27
  357. package/lib/clients/Logger.js +0 -32
  358. package/lib/clients/Messages.d.ts +0 -18
  359. package/lib/clients/Messages.js +0 -20
  360. package/lib/clients/MessagesGraphQL.d.ts +0 -63
  361. package/lib/clients/MessagesGraphQL.js +0 -50
  362. package/lib/clients/Metadata.d.ts +0 -25
  363. package/lib/clients/Metadata.js +0 -53
  364. package/lib/clients/Registry.d.ts +0 -61
  365. package/lib/clients/Registry.js +0 -147
  366. package/lib/clients/Router.d.ts +0 -33
  367. package/lib/clients/Router.js +0 -50
  368. package/lib/clients/Segment.js +0 -69
  369. package/lib/clients/Settings.js +0 -44
  370. package/lib/clients/Sphinx.d.ts +0 -12
  371. package/lib/clients/Sphinx.js +0 -19
  372. package/lib/clients/Tenant.js +0 -13
  373. package/lib/clients/VBase.d.ts +0 -57
  374. package/lib/clients/VBase.js +0 -116
  375. package/lib/clients/Workspaces.d.ts +0 -17
  376. package/lib/clients/Workspaces.js +0 -38
  377. package/lib/service/Runtime.d.ts +0 -18
  378. package/lib/service/Runtime.js +0 -57
  379. package/lib/service/events/index.d.ts +0 -3
  380. package/lib/service/events/index.js +0 -21
  381. package/lib/service/graphql/index.d.ts +0 -7
  382. package/lib/service/graphql/index.js +0 -33
  383. package/lib/service/graphql/middlewares/error.js +0 -107
  384. package/lib/service/graphql/middlewares/formatters.d.ts +0 -2
  385. package/lib/service/graphql/middlewares/formatters.js +0 -64
  386. package/lib/service/graphql/middlewares/query.d.ts +0 -2
  387. package/lib/service/graphql/middlewares/query.js +0 -32
  388. package/lib/service/graphql/middlewares/response.js +0 -36
  389. package/lib/service/graphql/middlewares/run.d.ts +0 -4
  390. package/lib/service/graphql/middlewares/run.js +0 -55
  391. package/lib/service/graphql/middlewares/schema.d.ts +0 -2
  392. package/lib/service/graphql/middlewares/schema.js +0 -8
  393. package/lib/service/graphql/middlewares/timings.d.ts +0 -2
  394. package/lib/service/graphql/middlewares/timings.js +0 -10
  395. package/lib/service/graphql/middlewares/upload.d.ts +0 -7
  396. package/lib/service/graphql/schema/index.d.ts +0 -3
  397. package/lib/service/graphql/schema/index.js +0 -66
  398. package/lib/service/graphql/schema/messagesLoader.d.ts +0 -4
  399. package/lib/service/graphql/schema/messagesLoader.js +0 -41
  400. package/lib/service/graphql/schema/messagesLoaderV2.d.ts +0 -5
  401. package/lib/service/graphql/schema/messagesLoaderV2.js +0 -44
  402. package/lib/service/graphql/schema/schemaDirectives/Translatable.js +0 -54
  403. package/lib/service/graphql/schema/schemaDirectives/TranslatableV2.d.ts +0 -13
  404. package/lib/service/graphql/schema/schemaDirectives/TranslatableV2.js +0 -67
  405. package/lib/service/graphql/schema/schemaDirectives/index.d.ts +0 -13
  406. package/lib/service/graphql/schema/schemaDirectives/index.js +0 -17
  407. package/lib/service/graphql/schema/typeDefs/index.d.ts +0 -16
  408. package/lib/service/graphql/schema/typeDefs/index.js +0 -21
  409. package/lib/service/graphql/schema/typeDefs/ioMessage.d.ts +0 -8
  410. package/lib/service/graphql/schema/typeDefs/ioMessage.js +0 -33
  411. package/lib/service/graphql/typings.d.ts +0 -21
  412. package/lib/service/graphql/utils/cacheControl.d.ts +0 -6
  413. package/lib/service/graphql/utils/cacheControl.js +0 -38
  414. package/lib/service/graphql/utils/maxAgeEnum.d.ts +0 -6
  415. package/lib/service/graphql/utils/maxAgeEnum.js +0 -17
  416. package/lib/service/graphql/utils/pathname.js +0 -7
  417. package/lib/service/http/index.d.ts +0 -3
  418. package/lib/service/http/index.js +0 -18
  419. package/lib/service/http/middlewares/authTokens.d.ts +0 -3
  420. package/lib/service/http/middlewares/cancellationToken.d.ts +0 -3
  421. package/lib/service/http/middlewares/clients.d.ts +0 -4
  422. package/lib/service/http/middlewares/error.d.ts +0 -3
  423. package/lib/service/http/middlewares/setCookie.d.ts +0 -3
  424. package/lib/service/http/middlewares/timings.d.ts +0 -3
  425. package/lib/service/http/middlewares/vary.d.ts +0 -3
  426. package/lib/service/method.d.ts +0 -9
  427. package/lib/service/typings.d.ts +0 -139
  428. package/lib/service/utils/compose.d.ts +0 -4
  429. package/lib/service/utils/compose.js +0 -11
  430. package/lib/utils/MineWinsConflictsResolver.test.d.ts +0 -1
  431. package/lib/utils/MineWinsConflictsResolver.test.js +0 -134
  432. package/lib/utils/unhandled.d.ts +0 -1
  433. /package/lib/service/{graphql → worker/runtime/graphql}/middlewares/error.d.ts +0 -0
  434. /package/lib/service/{graphql → worker/runtime/graphql}/middlewares/response.d.ts +0 -0
  435. /package/lib/service/{graphql → worker/runtime/graphql}/schema/typeDefs/ioUpload.d.ts +0 -0
  436. /package/lib/service/{graphql → worker/runtime/graphql}/schema/typeDefs/sanitizedString.d.ts +0 -0
  437. /package/lib/service/{graphql → worker/runtime/graphql}/typings.js +0 -0
  438. /package/lib/service/{graphql → worker/runtime/graphql}/utils/pathname.d.ts +0 -0
  439. /package/lib/service/{typings.js → worker/runtime/typings.js} +0 -0
  440. /package/lib/service/{graphql/utils/array.d.ts → worker/runtime/utils/toArray.d.ts} +0 -0
@@ -1,21 +0,0 @@
1
- /// <reference types="node" />
2
- import { Readable } from 'stream';
3
- import { AppMetaInfo } from '..';
4
- import { InfraClient, InstanceOptions } from '../HttpClient';
5
- import { IOContext } from '../service/typings';
6
- export interface AssetsParams {
7
- files?: string[];
8
- pick?: string[];
9
- }
10
- export declare class Assets extends InfraClient {
11
- private routes;
12
- constructor(context: IOContext, options?: InstanceOptions);
13
- getSettings(dependencies: AppMetaInfo[], appAtMajor: string, params?: AssetsParams): Promise<Record<string, any>[]>;
14
- getBuildJSONForApp(app: AppMetaInfo, appVendorName: string, pick?: string | string[]): Promise<Record<string, any>>;
15
- getSettingsFromFilesForApp(app: AppMetaInfo, files?: string | string[]): Promise<Record<string, any>>;
16
- getFile<T extends object | null>(appId: string, file: string, nullIfNotFound?: boolean): Promise<T>;
17
- getFilteredDependencies(apps: string | string[], dependencies: AppMetaInfo[]): AppMetaInfo[];
18
- getAppBundleByVendor: (app: string, bundlePath: string, generatePackageJson: boolean) => Promise<Readable>;
19
- protected getAppFileByAccount: <T extends object | null>(app: string, path: string, nullIfNotFound?: boolean | undefined) => Promise<T>;
20
- protected getAppFileByVendor: <T extends object | null>(app: string, path: string, nullIfNotFound?: boolean | undefined) => Promise<T>;
21
- }
@@ -1,110 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const ramda_1 = require("ramda");
4
- const HttpClient_1 = require("../HttpClient");
5
- const utils_1 = require("../utils");
6
- const dependsOnApp = (appsAtMajor) => (a) => {
7
- let dependsOn = false;
8
- appsAtMajor.forEach(appAtMajor => {
9
- const [name, major] = appAtMajor.split('@');
10
- const version = a._resolvedDependencies[name];
11
- if (version) {
12
- const [depMajor] = version.split('.');
13
- if (major === depMajor) {
14
- dependsOn = true;
15
- }
16
- }
17
- });
18
- return dependsOn;
19
- };
20
- const useBuildJson = (app, appVendorName) => {
21
- const buildFeatures = app._buildFeatures;
22
- return buildFeatures && buildFeatures[appVendorName] && ramda_1.contains('build.json', buildFeatures[appVendorName]);
23
- };
24
- const appOrRegistry = (workspace, { name, version, build }) => build
25
- ? `${workspace}/apps/${name}@${version}+${build}`
26
- : `master/registry/${name}/${version}`;
27
- const createRoutes = (workspace) => ({
28
- Bundle: (scope, locator, path) => `/${scope}/${appOrRegistry(workspace, locator)}/bundle/${path}`,
29
- Files: (scope, locator, path) => `/${scope}/${appOrRegistry(workspace, locator)}/files/${path}`,
30
- });
31
- class Assets extends HttpClient_1.InfraClient {
32
- constructor(context, options) {
33
- super('apps@0.x', context, options, true);
34
- this.getAppBundleByVendor = (app, bundlePath, generatePackageJson) => {
35
- const locator = utils_1.parseAppId(app);
36
- const params = generatePackageJson && { _packageJSONEngine: 'npm', _packageJSONFilter: 'vtex.render-builder@x' };
37
- const metric = locator.build ? 'apps-get-bundle' : 'registry-get-bundle';
38
- return this.http.getStream(this.routes.Bundle(this.context.account, locator, bundlePath), {
39
- headers: {
40
- Accept: 'application/x-gzip',
41
- 'Accept-Encoding': 'gzip',
42
- },
43
- metric,
44
- params,
45
- });
46
- };
47
- this.getAppFileByAccount = (app, path, nullIfNotFound) => {
48
- const locator = utils_1.parseAppId(app);
49
- const inflightKey = HttpClient_1.inflightURL;
50
- return this.http.get(this.routes.Files(this.context.account, locator, path), {
51
- cacheable: HttpClient_1.CacheType.Memory,
52
- inflightKey,
53
- metric: 'assets-get-json-by-account',
54
- nullIfNotFound,
55
- });
56
- };
57
- this.getAppFileByVendor = (app, path, nullIfNotFound) => {
58
- const locator = utils_1.parseAppId(app);
59
- const vendor = locator.name.split('.')[0];
60
- const inflightKey = HttpClient_1.inflightURL;
61
- return this.http.get(this.routes.Files(vendor, locator, path), {
62
- cacheable: HttpClient_1.CacheType.Any,
63
- inflightKey,
64
- metric: 'assets-get-json-by-vendor',
65
- nullIfNotFound,
66
- });
67
- };
68
- this.routes = createRoutes(this.context.workspace);
69
- }
70
- getSettings(dependencies, appAtMajor, params = {}) {
71
- const { pick, files } = params;
72
- const filtered = this.getFilteredDependencies(appAtMajor, dependencies);
73
- return Promise.all(filtered.map(dependency => {
74
- const [appVendorName] = appAtMajor.split('@');
75
- const buildJson = useBuildJson(dependency, appVendorName);
76
- return buildJson
77
- ? this.getBuildJSONForApp(dependency, appVendorName, pick)
78
- : this.getSettingsFromFilesForApp(dependency, files);
79
- }));
80
- }
81
- async getBuildJSONForApp(app, appVendorName, pick = []) {
82
- const pickArray = Array.isArray(pick) ? pick : [pick];
83
- const buildJson = await this.getFile(app.id, `dist/${appVendorName}/build.json`);
84
- const result = !ramda_1.isEmpty(pickArray) ? ramda_1.pick(pickArray, buildJson) : buildJson;
85
- result.declarer = app.id;
86
- return result;
87
- }
88
- async getSettingsFromFilesForApp(app, files = []) {
89
- // If there's no support for build.json, then fetch individual files and zip them into an {[file]: content} object.
90
- const filesArray = Array.isArray(files) ? files : [files];
91
- const fetched = await Promise.all(filesArray.map(file => this.getFile(app.id, file, true)));
92
- const result = ramda_1.zipObj(filesArray, fetched);
93
- result.declarer = app.id;
94
- return result;
95
- }
96
- async getFile(appId, file, nullIfNotFound) {
97
- const locator = utils_1.parseAppId(appId);
98
- const linked = !!locator.build;
99
- if (linked) {
100
- return this.getAppFileByAccount(appId, file, nullIfNotFound);
101
- }
102
- return this.getAppFileByVendor(appId, file, nullIfNotFound);
103
- }
104
- getFilteredDependencies(apps, dependencies) {
105
- const appsAtMajor = typeof (apps) === 'string' ? [apps] : apps;
106
- const depends = dependsOnApp(appsAtMajor);
107
- return ramda_1.filter(depends, dependencies);
108
- }
109
- }
110
- exports.Assets = Assets;
@@ -1,11 +0,0 @@
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,12 +0,0 @@
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
- }
@@ -1,10 +0,0 @@
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,6 +0,0 @@
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
- }
@@ -1,19 +0,0 @@
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;
@@ -1,11 +0,0 @@
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
- }
@@ -1,24 +0,0 @@
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;
@@ -1,22 +0,0 @@
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
- }
package/lib/clients/ID.js DELETED
@@ -1,48 +0,0 @@
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,6 +0,0 @@
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,43 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const qs_1 = require("qs");
4
- const HttpClient_1 = require("../HttpClient");
5
- const TWO_MINUTES_S = 2 * 60;
6
- const BASE_URL = '/api/license-manager';
7
- const routes = {
8
- accountData: `${BASE_URL}/account`,
9
- resourceAccess: `${BASE_URL}/resources`,
10
- topbarData: `${BASE_URL}/site/pvt/newtopbar`,
11
- };
12
- const inflightKey = ({ baseURL, url, params }) => {
13
- return baseURL + url + qs_1.stringify(params, { arrayFormat: 'repeat', addQueryPrefix: true });
14
- };
15
- class LicenseManager extends HttpClient_1.JanusClient {
16
- getAccountData(VtexIdclientAutCookie) {
17
- return this.http.get(routes.accountData, {
18
- forceMaxAge: TWO_MINUTES_S,
19
- headers: {
20
- VtexIdclientAutCookie,
21
- },
22
- inflightKey,
23
- metric: 'lm-account-data',
24
- });
25
- }
26
- getTopbarData(VtexIdclientAutCookie) {
27
- return this.http.get(routes.topbarData, {
28
- headers: {
29
- VtexIdclientAutCookie,
30
- },
31
- metric: 'lm-topbar-data',
32
- });
33
- }
34
- canAccessResource(VtexIdclientAutCookie, resourceKey) {
35
- return this.http.get(`${routes.resourceAccess}/${resourceKey}/access`, {
36
- headers: {
37
- VtexIdclientAutCookie,
38
- },
39
- metric: 'lm-resource-access',
40
- }).then(() => true, () => false);
41
- }
42
- }
43
- exports.LicenseManager = LicenseManager;
@@ -1,27 +0,0 @@
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
- }
@@ -1,32 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const HttpClient_1 = require("../HttpClient");
4
- const error_1 = require("../utils/error");
5
- const DEFAULT_SUBJECT = '-';
6
- var LogLevel;
7
- (function (LogLevel) {
8
- LogLevel["Debug"] = "debug";
9
- LogLevel["Info"] = "info";
10
- LogLevel["Warn"] = "warn";
11
- LogLevel["Error"] = "error";
12
- })(LogLevel = exports.LogLevel || (exports.LogLevel = {}));
13
- class Logger extends HttpClient_1.InfraClient {
14
- constructor(context, options) {
15
- super('colossus@0.x', Object.assign({}, context, { recorder: undefined }), Object.assign({}, options, { concurrency: 1 }));
16
- this.debug = (message, subject = DEFAULT_SUBJECT) => this.sendLog(subject, message, LogLevel.Debug);
17
- this.info = (message, subject = DEFAULT_SUBJECT) => this.sendLog(subject, message, LogLevel.Info);
18
- this.warn = (warning, subject = DEFAULT_SUBJECT) => this.sendLog(subject, error_1.cleanError(warning), LogLevel.Warn);
19
- this.error = (error, subject = DEFAULT_SUBJECT) => this.sendLog(subject, error_1.cleanError(error), LogLevel.Error);
20
- this.sendLog = (_, message, level) => {
21
- // Use stdout logger
22
- if (this.logger) {
23
- this.logger.log(message, level);
24
- }
25
- // Deprecate logging to colossus
26
- console.warn('Logger in ctx.clients.logger is deprecated, please use ctx.vtex.logger instead.');
27
- return Promise.resolve();
28
- };
29
- this.logger = context.logger;
30
- }
31
- }
32
- exports.Logger = Logger;
@@ -1,18 +0,0 @@
1
- import { AppClient, InstanceOptions } from '../HttpClient';
2
- import { IOContext } from '../service/typings';
3
- import { IOMessage } from '../utils/message';
4
- interface Locale {
5
- [token: string]: string;
6
- }
7
- interface Locales {
8
- [lang: string]: Locale;
9
- }
10
- interface LocalesByProvider {
11
- [provider: string]: Locales;
12
- }
13
- export declare class Messages extends AppClient {
14
- constructor(vtex: IOContext, options?: InstanceOptions);
15
- translate: (to: string, data: IOMessage[]) => Promise<string[]>;
16
- saveTranslation: (data: LocalesByProvider) => Promise<void>;
17
- }
18
- export {};
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const HttpClient_1 = require("../HttpClient");
4
- class Messages extends HttpClient_1.AppClient {
5
- constructor(vtex, options) {
6
- super('vtex.messages@1.x', vtex, options);
7
- this.translate = (to, data) => this.http.get('/_v/translations', {
8
- inflightKey: HttpClient_1.inflightUrlWithQuery,
9
- metric: 'messages-translate',
10
- params: {
11
- data: JSON.stringify(data),
12
- to,
13
- },
14
- });
15
- this.saveTranslation = (data) => this.http.post('/_v/translations', data, {
16
- metric: 'messages-save-translation',
17
- });
18
- }
19
- }
20
- exports.Messages = Messages;
@@ -1,63 +0,0 @@
1
- import { AppGraphQLClient, InstanceOptions } from '../HttpClient';
2
- import { IOContext } from '../service/typings';
3
- import { IOMessage } from '../utils/message';
4
- declare type IOMessageInput = Pick<IOMessage, 'id' | 'content' | 'description' | 'behavior'>;
5
- export interface IndexedMessageV2 {
6
- messages: IOMessageInputV2[];
7
- from: string;
8
- }
9
- export interface IOMessageInputV2 {
10
- content: string;
11
- context?: string;
12
- behavior?: Behavior;
13
- withAppsMetaInfo?: boolean;
14
- }
15
- export declare type Behavior = 'FULL' | 'USER_ONLY' | 'USER_AND_APP';
16
- export interface IOMessageV2 extends IOMessageInputV2 {
17
- from: string;
18
- to: string;
19
- }
20
- interface MessagesInput {
21
- provider: string;
22
- messages: IOMessageInput[];
23
- }
24
- export interface IOMessageSaveInput extends IOMessageInput {
25
- content: string;
26
- }
27
- export interface MessageSaveInputV2 {
28
- srcLang: string;
29
- srcMessage: string;
30
- context?: string;
31
- targetMessage: string;
32
- groupContext?: string;
33
- }
34
- export interface Translate {
35
- messages: MessagesInput[];
36
- from?: string;
37
- to: string;
38
- }
39
- export interface TranslateInputV2 {
40
- indexedByFrom: IndexedMessageV2[];
41
- to: string;
42
- depTree?: string;
43
- }
44
- export interface SaveArgs {
45
- to: string;
46
- messagesByProvider: Array<{
47
- messages: IOMessageSaveInput[];
48
- provider: string;
49
- }>;
50
- }
51
- export interface SaveArgsV2 {
52
- fireEvent?: boolean;
53
- to: string;
54
- messages: MessageSaveInputV2[];
55
- }
56
- export declare class MessagesGraphQL extends AppGraphQLClient {
57
- constructor(vtex: IOContext, options?: InstanceOptions);
58
- translate: (args: Translate) => Promise<string[]>;
59
- translateV2: (args: TranslateInputV2) => Promise<string[]>;
60
- save: (args: SaveArgs) => Promise<boolean>;
61
- saveV2: (args: SaveArgsV2) => Promise<boolean>;
62
- }
63
- export {};
@@ -1,50 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const ramda_1 = require("ramda");
4
- const HttpClient_1 = require("../HttpClient");
5
- class MessagesGraphQL extends HttpClient_1.AppGraphQLClient {
6
- constructor(vtex, options) {
7
- super('vtex.messages@1.x', vtex, options);
8
- this.translate = async (args) => this.graphql.query({
9
- query: `
10
- query Translate($args: NewTranslateArgs!) {
11
- newTranslate(args: $args)
12
- }
13
- `,
14
- variables: { args },
15
- }, {
16
- metric: 'messages-translate',
17
- }).then(ramda_1.path(['data', 'newTranslate']));
18
- this.translateV2 = (args) => this.graphql.query({
19
- query: `
20
- query Translate($args: TranslateArgs!) {
21
- translate(args: $args)
22
- }
23
- `,
24
- variables: { args },
25
- }, {
26
- metric: 'messages-translate-v2',
27
- }).then(ramda_1.path(['data', 'translate']));
28
- this.save = (args) => this.graphql.mutate({
29
- mutate: `
30
- mutation Save($args: SaveArgs!) {
31
- save(args: $args)
32
- }
33
- `,
34
- variables: { args },
35
- }, {
36
- metric: 'messages-save-translation',
37
- }).then(ramda_1.path(['data', 'save']));
38
- this.saveV2 = (args) => this.graphql.mutate({
39
- mutate: `
40
- mutation SaveV2($args: SaveArgsV2!) {
41
- saveV2(args: $args)
42
- }
43
- `,
44
- variables: { args },
45
- }, {
46
- metric: 'messages-saveV2-translation',
47
- }).then(ramda_1.path(['data', 'saveV2']));
48
- }
49
- }
50
- exports.MessagesGraphQL = MessagesGraphQL;
@@ -1,25 +0,0 @@
1
- import { InfraClient, InstanceOptions } from '../HttpClient';
2
- import { BucketMetadata } from '../responses';
3
- import { IOContext } from '../service/typings';
4
- export interface MetadataEntry {
5
- Key: string;
6
- Hash: string;
7
- Value: any;
8
- }
9
- export interface MetadataEntryList {
10
- Data: MetadataEntry[];
11
- Next: string;
12
- }
13
- export declare class Metadata extends InfraClient {
14
- constructor(context: IOContext, options?: InstanceOptions);
15
- getBuckets: (bucket: string) => Promise<BucketMetadata>;
16
- list: (bucket: string, includeValue: boolean, limit?: number | undefined, nextMarker?: string | undefined) => Promise<MetadataEntryList>;
17
- listAll: (bucket: string, includeValue: boolean) => Promise<MetadataEntryList>;
18
- get: (bucket: string, key: string) => Promise<any>;
19
- save: (bucket: string, key: string, data: any) => Promise<void>;
20
- saveAll: (bucket: string, data: {
21
- [key: string]: any;
22
- }) => Promise<void>;
23
- delete: (bucket: string, key: string) => Promise<import("../HttpClient").IOResponse<void>>;
24
- deleteAll: (bucket: string) => Promise<import("../HttpClient").IOResponse<void>>;
25
- }
@@ -1,53 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const HttpClient_1 = require("../HttpClient");
4
- const appId = process.env.VTEX_APP_ID;
5
- const [runningAppName] = appId ? appId.split('@') : [''];
6
- const routes = {
7
- Bucket: (bucket) => `/buckets/${runningAppName}/${bucket}`,
8
- Metadata: (bucket) => `${routes.Bucket(bucket)}/metadata`,
9
- MetadataKey: (bucket, key) => `${routes.Metadata(bucket)}/${key}`,
10
- };
11
- class Metadata extends HttpClient_1.InfraClient {
12
- constructor(context, options) {
13
- super('router', context, options);
14
- this.getBuckets = (bucket) => {
15
- return this.http.get(routes.Bucket(bucket), { metric: 'meta-get-buckets' });
16
- };
17
- this.list = (bucket, includeValue, limit, nextMarker) => {
18
- const query = { value: includeValue, _limit: 10 };
19
- if (limit && limit > 0) {
20
- query._limit = limit;
21
- }
22
- if (nextMarker) {
23
- query._marker = nextMarker;
24
- }
25
- const metric = 'meta-list';
26
- return this.http.get(routes.Metadata(bucket), { params: query, metric });
27
- };
28
- this.listAll = (bucket, includeValue) => {
29
- const query = { value: includeValue, _limit: 1000 };
30
- const metric = 'meta-list-all';
31
- return this.http.get(routes.Metadata(bucket), { params: query, metric });
32
- };
33
- this.get = (bucket, key) => {
34
- return this.http.get(routes.MetadataKey(bucket, key), { metric: 'meta-get' });
35
- };
36
- this.save = (bucket, key, data) => {
37
- return this.http.put(routes.MetadataKey(bucket, key), data, { metric: 'meta-save' });
38
- };
39
- this.saveAll = (bucket, data) => {
40
- return this.http.put(routes.Metadata(bucket), data, { metric: 'meta-save-all' });
41
- };
42
- this.delete = (bucket, key) => {
43
- return this.http.delete(routes.MetadataKey(bucket, key), { metric: 'meta-delete' });
44
- };
45
- this.deleteAll = (bucket) => {
46
- return this.http.delete(routes.Metadata(bucket), { metric: 'meta-delete-all' });
47
- };
48
- if (runningAppName === '') {
49
- throw new Error(`Invalid path to access Metadata. Variable VTEX_APP_ID is not available.`);
50
- }
51
- }
52
- }
53
- exports.Metadata = Metadata;