@webiny/app 5.44.1-beta.0 → 5.45.0-beta.0

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 (427) hide show
  1. package/App.d.ts +5 -13
  2. package/App.js +70 -87
  3. package/App.js.map +1 -1
  4. package/AppContainer.d.ts +23 -0
  5. package/AppContainer.js +9 -0
  6. package/AppContainer.js.map +1 -0
  7. package/README.md +7 -15
  8. package/apollo-client/InMemoryCache.d.ts +3 -2
  9. package/apollo-client/InMemoryCache.js +16 -47
  10. package/apollo-client/InMemoryCache.js.map +1 -1
  11. package/apollo-client/IntrospectionFragmentMatcher.d.ts +2 -2
  12. package/apollo-client/IntrospectionFragmentMatcher.js +33 -50
  13. package/apollo-client/IntrospectionFragmentMatcher.js.map +1 -1
  14. package/components/Image.d.ts +1 -2
  15. package/components/Image.js +11 -19
  16. package/components/Image.js.map +1 -1
  17. package/components/index.d.ts +1 -2
  18. package/components/index.js +1 -19
  19. package/components/index.js.map +1 -1
  20. package/config/RouterConfig/Route.d.ts +29 -0
  21. package/config/RouterConfig/Route.js +33 -0
  22. package/config/RouterConfig/Route.js.map +1 -0
  23. package/config/RouterConfig.d.ts +31 -0
  24. package/config/RouterConfig.js +18 -0
  25. package/config/RouterConfig.js.map +1 -0
  26. package/config.js +9 -15
  27. package/config.js.map +1 -1
  28. package/contexts/Ui/index.js +28 -52
  29. package/contexts/Ui/index.js.map +1 -1
  30. package/core/DebounceRender.js +13 -24
  31. package/core/DebounceRender.js.map +1 -1
  32. package/core/Plugin.d.ts +1 -1
  33. package/core/Plugin.js +11 -19
  34. package/core/Plugin.js.map +1 -1
  35. package/core/Plugins.d.ts +1 -1
  36. package/core/Plugins.js +20 -25
  37. package/core/Plugins.js.map +1 -1
  38. package/core/Provider.d.ts +1 -1
  39. package/core/Provider.js +9 -13
  40. package/core/Provider.js.map +1 -1
  41. package/core/Routes.d.ts +2 -1
  42. package/core/Routes.js +13 -23
  43. package/core/Routes.js.map +1 -1
  44. package/core/createProvider.d.ts +2 -2
  45. package/core/createProvider.js +1 -7
  46. package/core/createProvider.js.map +1 -1
  47. package/core/createProviderPlugin.d.ts +1 -1
  48. package/core/createProviderPlugin.js +4 -10
  49. package/core/createProviderPlugin.js.map +1 -1
  50. package/errors/AuthenticationErrorEvent.d.ts +9 -0
  51. package/errors/AuthenticationErrorEvent.js +10 -0
  52. package/errors/AuthenticationErrorEvent.js.map +1 -0
  53. package/errors/NetworkErrorEvent.d.ts +15 -0
  54. package/errors/NetworkErrorEvent.js +10 -0
  55. package/errors/NetworkErrorEvent.js.map +1 -0
  56. package/errors/abstractions.d.ts +12 -0
  57. package/errors/abstractions.js +5 -0
  58. package/errors/abstractions.js.map +1 -0
  59. package/errors/index.d.ts +6 -0
  60. package/errors/index.js +6 -0
  61. package/errors/index.js.map +1 -0
  62. package/exports/admin/envConfig.d.ts +1 -0
  63. package/exports/admin/envConfig.js +3 -0
  64. package/exports/admin/envConfig.js.map +1 -0
  65. package/exports/admin/graphqlClient.d.ts +1 -0
  66. package/exports/admin/graphqlClient.js +3 -0
  67. package/exports/admin/graphqlClient.js.map +1 -0
  68. package/exports/admin/localStorage.d.ts +2 -0
  69. package/exports/admin/localStorage.js +4 -0
  70. package/exports/admin/localStorage.js.map +1 -0
  71. package/exports/admin/router.d.ts +4 -0
  72. package/exports/admin/router.js +6 -0
  73. package/exports/admin/router.js.map +1 -0
  74. package/exports/admin/security.d.ts +1 -0
  75. package/exports/admin/security.js +3 -0
  76. package/exports/admin/security.js.map +1 -0
  77. package/exports/admin.d.ts +6 -0
  78. package/exports/admin.js +8 -0
  79. package/exports/admin.js.map +1 -0
  80. package/features/envConfig/EnvConfig.d.ts +6 -0
  81. package/features/envConfig/EnvConfig.js +14 -0
  82. package/features/envConfig/EnvConfig.js.map +1 -0
  83. package/features/envConfig/abstractions.d.ts +27 -0
  84. package/features/envConfig/abstractions.js +4 -0
  85. package/features/envConfig/abstractions.js.map +1 -0
  86. package/features/envConfig/feature.d.ts +17 -0
  87. package/features/envConfig/feature.js +14 -0
  88. package/features/envConfig/feature.js.map +1 -0
  89. package/features/envConfig/index.d.ts +1 -0
  90. package/features/envConfig/index.js +3 -0
  91. package/features/envConfig/index.js.map +1 -0
  92. package/features/eventPublisher/EventPublisher.d.ts +8 -0
  93. package/features/eventPublisher/EventPublisher.js +27 -0
  94. package/features/eventPublisher/EventPublisher.js.map +1 -0
  95. package/features/eventPublisher/abstractions.d.ts +18 -0
  96. package/features/eventPublisher/abstractions.js +14 -0
  97. package/features/eventPublisher/abstractions.js.map +1 -0
  98. package/features/eventPublisher/feature.d.ts +1 -0
  99. package/features/eventPublisher/feature.js +11 -0
  100. package/features/eventPublisher/feature.js.map +1 -0
  101. package/features/eventPublisher/index.d.ts +3 -0
  102. package/features/eventPublisher/index.js +4 -0
  103. package/features/eventPublisher/index.js.map +1 -0
  104. package/features/graphqlClient/AuthenticationErrorPublishing.d.ts +13 -0
  105. package/features/graphqlClient/AuthenticationErrorPublishing.js +35 -0
  106. package/features/graphqlClient/AuthenticationErrorPublishing.js.map +1 -0
  107. package/features/graphqlClient/BatchingGraphQLClient.d.ts +18 -0
  108. package/features/graphqlClient/BatchingGraphQLClient.js +164 -0
  109. package/features/graphqlClient/BatchingGraphQLClient.js.map +1 -0
  110. package/features/graphqlClient/FetchGraphQLClient.d.ts +10 -0
  111. package/features/graphqlClient/FetchGraphQLClient.js +62 -0
  112. package/features/graphqlClient/FetchGraphQLClient.js.map +1 -0
  113. package/features/graphqlClient/NetworkErrorPublishing.d.ts +14 -0
  114. package/features/graphqlClient/NetworkErrorPublishing.js +55 -0
  115. package/features/graphqlClient/NetworkErrorPublishing.js.map +1 -0
  116. package/features/graphqlClient/RequestValue.d.ts +20 -0
  117. package/features/graphqlClient/RequestValue.js +42 -0
  118. package/features/graphqlClient/RequestValue.js.map +1 -0
  119. package/features/graphqlClient/RetryGraphQLClient.d.ts +18 -0
  120. package/features/graphqlClient/RetryGraphQLClient.js +54 -0
  121. package/features/graphqlClient/RetryGraphQLClient.js.map +1 -0
  122. package/features/graphqlClient/__tests__/GraphQLClient.test.d.ts +1 -0
  123. package/features/graphqlClient/__tests__/GraphQLClient.test.js +350 -0
  124. package/features/graphqlClient/__tests__/GraphQLClient.test.js.map +1 -0
  125. package/features/graphqlClient/abstractions.d.ts +17 -0
  126. package/features/graphqlClient/abstractions.js +4 -0
  127. package/features/graphqlClient/abstractions.js.map +1 -0
  128. package/features/graphqlClient/feature.d.ts +6 -0
  129. package/features/graphqlClient/feature.js +31 -0
  130. package/features/graphqlClient/feature.js.map +1 -0
  131. package/features/graphqlClient/index.d.ts +1 -0
  132. package/features/graphqlClient/index.js +3 -0
  133. package/features/graphqlClient/index.js.map +1 -0
  134. package/features/graphqlClient/types.d.ts +5 -0
  135. package/features/graphqlClient/types.js +3 -0
  136. package/features/graphqlClient/types.js.map +1 -0
  137. package/features/localStorage/BrowserLocalStorageGateway.d.ts +9 -0
  138. package/features/localStorage/BrowserLocalStorageGateway.js +68 -0
  139. package/features/localStorage/BrowserLocalStorageGateway.js.map +1 -0
  140. package/features/localStorage/LocalStorage.d.ts +12 -0
  141. package/features/localStorage/LocalStorage.js +31 -0
  142. package/features/localStorage/LocalStorage.js.map +1 -0
  143. package/features/localStorage/LocalStorageRepository.d.ts +20 -0
  144. package/features/localStorage/LocalStorageRepository.js +95 -0
  145. package/features/localStorage/LocalStorageRepository.js.map +1 -0
  146. package/features/localStorage/abstractions.d.ts +48 -0
  147. package/features/localStorage/abstractions.js +19 -0
  148. package/features/localStorage/abstractions.js.map +1 -0
  149. package/features/localStorage/feature.d.ts +12 -0
  150. package/features/localStorage/feature.js +34 -0
  151. package/features/localStorage/feature.js.map +1 -0
  152. package/features/localStorage/index.d.ts +1 -0
  153. package/features/localStorage/index.js +3 -0
  154. package/features/localStorage/index.js.map +1 -0
  155. package/features/router/HistoryRouterGateway.d.ts +18 -0
  156. package/features/router/HistoryRouterGateway.js +82 -0
  157. package/features/router/HistoryRouterGateway.js.map +1 -0
  158. package/features/router/HistoryRouterGateway.test.d.ts +1 -0
  159. package/features/router/HistoryRouterGateway.test.js +204 -0
  160. package/features/router/HistoryRouterGateway.test.js.map +1 -0
  161. package/features/router/Route.d.ts +19 -0
  162. package/features/router/Route.js +59 -0
  163. package/features/router/Route.js.map +1 -0
  164. package/features/router/RouteUrl.d.ts +85 -0
  165. package/features/router/RouteUrl.js +232 -0
  166. package/features/router/RouteUrl.js.map +1 -0
  167. package/features/router/Router.d.ts +45 -0
  168. package/features/router/Router.js +129 -0
  169. package/features/router/Router.js.map +1 -0
  170. package/features/router/RouterPresenter.d.ts +17 -0
  171. package/features/router/RouterPresenter.js +45 -0
  172. package/features/router/RouterPresenter.js.map +1 -0
  173. package/features/router/RouterRepository.d.ts +21 -0
  174. package/features/router/RouterRepository.js +71 -0
  175. package/features/router/RouterRepository.js.map +1 -0
  176. package/features/router/RouterRepository.test.d.ts +1 -0
  177. package/features/router/RouterRepository.test.js +154 -0
  178. package/features/router/RouterRepository.test.js.map +1 -0
  179. package/features/router/abstractions.d.ts +68 -0
  180. package/features/router/abstractions.js +15 -0
  181. package/features/router/abstractions.js.map +1 -0
  182. package/features/router/feature.d.ts +4 -0
  183. package/features/router/feature.js +18 -0
  184. package/features/router/feature.js.map +1 -0
  185. package/features/router/index.d.ts +1 -0
  186. package/features/router/index.js +3 -0
  187. package/features/router/index.js.map +1 -0
  188. package/helpers/InterfaceGenerator/date.d.ts +15 -0
  189. package/helpers/InterfaceGenerator/date.js +3 -0
  190. package/helpers/InterfaceGenerator/date.js.map +1 -0
  191. package/helpers/InterfaceGenerator/id.d.ts +23 -0
  192. package/helpers/InterfaceGenerator/id.js +3 -0
  193. package/helpers/InterfaceGenerator/id.js.map +1 -0
  194. package/helpers/InterfaceGenerator/identity.d.ts +10 -0
  195. package/helpers/InterfaceGenerator/identity.js +3 -0
  196. package/helpers/InterfaceGenerator/identity.js.map +1 -0
  197. package/helpers/InterfaceGenerator/index.d.ts +5 -0
  198. package/helpers/InterfaceGenerator/index.js +3 -0
  199. package/helpers/InterfaceGenerator/index.js.map +1 -0
  200. package/helpers/InterfaceGenerator/numeric.d.ts +12 -0
  201. package/helpers/InterfaceGenerator/numeric.js +3 -0
  202. package/helpers/InterfaceGenerator/numeric.js.map +1 -0
  203. package/helpers/InterfaceGenerator/truthful.d.ts +7 -0
  204. package/helpers/InterfaceGenerator/truthful.js +3 -0
  205. package/helpers/InterfaceGenerator/truthful.js.map +1 -0
  206. package/hooks/useAutocomplete/index.d.ts +1 -1
  207. package/hooks/useAutocomplete/index.js +1 -12
  208. package/hooks/useAutocomplete/index.js.map +1 -1
  209. package/hooks/useAutocomplete/useAutocomplete.d.ts +1 -1
  210. package/hooks/useAutocomplete/useAutocomplete.js +6 -16
  211. package/hooks/useAutocomplete/useAutocomplete.js.map +1 -1
  212. package/hooks/useDataList/functions/getData.js +2 -11
  213. package/hooks/useDataList/functions/getData.js.map +1 -1
  214. package/hooks/useDataList/functions/getError.js +2 -11
  215. package/hooks/useDataList/functions/getError.js.map +1 -1
  216. package/hooks/useDataList/functions/getMeta.js +2 -11
  217. package/hooks/useDataList/functions/getMeta.js.map +1 -1
  218. package/hooks/useDataList/functions/index.d.ts +3 -3
  219. package/hooks/useDataList/functions/index.js +3 -27
  220. package/hooks/useDataList/functions/index.js.map +1 -1
  221. package/hooks/useDataList/functions/searchDataByKey.js +4 -10
  222. package/hooks/useDataList/functions/searchDataByKey.js.map +1 -1
  223. package/hooks/useDataList/index.d.ts +1 -1
  224. package/hooks/useDataList/index.js +1 -12
  225. package/hooks/useDataList/index.js.map +1 -1
  226. package/hooks/useDataList/useDataList.d.ts +2 -3
  227. package/hooks/useDataList/useDataList.js +74 -94
  228. package/hooks/useDataList/useDataList.js.map +1 -1
  229. package/hooks/useDataList/utils/index.d.ts +1 -2
  230. package/hooks/useDataList/utils/index.js +1 -20
  231. package/hooks/useDataList/utils/index.js.map +1 -1
  232. package/hooks/useDataList/utils/prepareLoadListParams.js +10 -16
  233. package/hooks/useDataList/utils/prepareLoadListParams.js.map +1 -1
  234. package/hooks/useHandler.js +7 -12
  235. package/hooks/useHandler.js.map +1 -1
  236. package/hooks/useHandlers.js +11 -17
  237. package/hooks/useHandlers.js.map +1 -1
  238. package/hooks/useRegisterLegacyPlugin.d.ts +1 -1
  239. package/hooks/useRegisterLegacyPlugin.js +5 -11
  240. package/hooks/useRegisterLegacyPlugin.js.map +1 -1
  241. package/hooks/useUi.d.ts +1 -1
  242. package/hooks/useUi.js +4 -10
  243. package/hooks/useUi.js.map +1 -1
  244. package/i18n/i18n.js +5 -13
  245. package/i18n/i18n.js.map +1 -1
  246. package/i18n/index.d.ts +1 -1
  247. package/i18n/index.js +1 -13
  248. package/i18n/index.js.map +1 -1
  249. package/index.d.ts +23 -15
  250. package/index.js +25 -177
  251. package/index.js.map +1 -1
  252. package/package.json +25 -22
  253. package/plugins/AddQuerySelectionPlugin.d.ts +2 -2
  254. package/plugins/AddQuerySelectionPlugin.js +61 -107
  255. package/plugins/AddQuerySelectionPlugin.js.map +1 -1
  256. package/plugins/ApolloCacheObjectIdPlugin.js +12 -31
  257. package/plugins/ApolloCacheObjectIdPlugin.js.map +1 -1
  258. package/plugins/ApolloDynamicLink.d.ts +3 -2
  259. package/plugins/ApolloDynamicLink.js +19 -46
  260. package/plugins/ApolloDynamicLink.js.map +1 -1
  261. package/plugins/ApolloLinkPlugin.d.ts +1 -1
  262. package/plugins/ApolloLinkPlugin.js +18 -37
  263. package/plugins/ApolloLinkPlugin.js.map +1 -1
  264. package/plugins/ConsoleLinkPlugin.d.ts +1 -1
  265. package/plugins/ConsoleLinkPlugin.js +20 -41
  266. package/plugins/ConsoleLinkPlugin.js.map +1 -1
  267. package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.d.ts +8 -13
  268. package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.js +35 -58
  269. package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.js.map +1 -1
  270. package/plugins/NetworkErrorLinkPlugin/GqlErrorOverlay.d.ts +14 -0
  271. package/plugins/NetworkErrorLinkPlugin/GqlErrorOverlay.js +31 -0
  272. package/plugins/NetworkErrorLinkPlugin/GqlErrorOverlay.js.map +1 -0
  273. package/plugins/NetworkErrorLinkPlugin/LocalAwsLambdaTimeoutMessage.d.ts +2 -0
  274. package/plugins/NetworkErrorLinkPlugin/LocalAwsLambdaTimeoutMessage.js +31 -0
  275. package/plugins/NetworkErrorLinkPlugin/LocalAwsLambdaTimeoutMessage.js.map +1 -0
  276. package/plugins/NetworkErrorLinkPlugin/StyledComponents.d.ts +4 -5
  277. package/plugins/NetworkErrorLinkPlugin/StyledComponents.js +68 -12
  278. package/plugins/NetworkErrorLinkPlugin/StyledComponents.js.map +1 -1
  279. package/plugins/NetworkErrorLinkPlugin/Typography.d.ts +8 -0
  280. package/plugins/NetworkErrorLinkPlugin/Typography.js +18 -0
  281. package/plugins/NetworkErrorLinkPlugin/Typography.js.map +1 -0
  282. package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.d.ts +3 -3
  283. package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.js +10 -25
  284. package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.js.map +1 -1
  285. package/plugins/NetworkErrorLinkPlugin.d.ts +4 -1
  286. package/plugins/NetworkErrorLinkPlugin.js +60 -37
  287. package/plugins/NetworkErrorLinkPlugin.js.map +1 -1
  288. package/plugins/OmitTypenameLinkPlugin.d.ts +1 -1
  289. package/plugins/OmitTypenameLinkPlugin.js +11 -30
  290. package/plugins/OmitTypenameLinkPlugin.js.map +1 -1
  291. package/plugins/TenantHeaderLinkPlugin.d.ts +3 -3
  292. package/plugins/TenantHeaderLinkPlugin.js +29 -48
  293. package/plugins/TenantHeaderLinkPlugin.js.map +1 -1
  294. package/plugins/components/Image.d.ts +6 -0
  295. package/plugins/components/Image.js +19 -0
  296. package/plugins/components/Image.js.map +1 -0
  297. package/plugins/image.d.ts +1 -1
  298. package/plugins/image.js +46 -53
  299. package/plugins/image.js.map +1 -1
  300. package/plugins/index.d.ts +4 -4
  301. package/plugins/index.js +31 -53
  302. package/plugins/index.js.map +1 -1
  303. package/presentation/localStorage/index.d.ts +3 -0
  304. package/presentation/localStorage/index.js +5 -0
  305. package/presentation/localStorage/index.js.map +1 -0
  306. package/presentation/localStorage/useLocalStorage.d.ts +6 -0
  307. package/presentation/localStorage/useLocalStorage.js +21 -0
  308. package/presentation/localStorage/useLocalStorage.js.map +1 -0
  309. package/presentation/localStorage/useLocalStorageValue.d.ts +1 -0
  310. package/presentation/localStorage/useLocalStorageValue.js +20 -0
  311. package/presentation/localStorage/useLocalStorageValue.js.map +1 -0
  312. package/presentation/localStorage/useLocalStorageValues.d.ts +5 -0
  313. package/presentation/localStorage/useLocalStorageValues.js +39 -0
  314. package/presentation/localStorage/useLocalStorageValues.js.map +1 -0
  315. package/presentation/router/RouteElementRegistry.d.ts +14 -0
  316. package/presentation/router/RouteElementRegistry.js +32 -0
  317. package/presentation/router/RouteElementRegistry.js.map +1 -0
  318. package/presentation/router/abstractions.d.ts +13 -0
  319. package/presentation/router/abstractions.js +4 -0
  320. package/presentation/router/abstractions.js.map +1 -0
  321. package/presentation/router/components/RouteContent.d.ts +2 -0
  322. package/presentation/router/components/RouteContent.js +17 -0
  323. package/presentation/router/components/RouteContent.js.map +1 -0
  324. package/presentation/router/components/RouteLink.d.ts +50 -0
  325. package/presentation/router/components/RouteLink.js +22 -0
  326. package/presentation/router/components/RouteLink.js.map +1 -0
  327. package/presentation/router/components/SimpleLink.d.ts +44 -0
  328. package/presentation/router/components/SimpleLink.js +30 -0
  329. package/presentation/router/components/SimpleLink.js.map +1 -0
  330. package/presentation/router/hooks/useRoute.d.ts +6 -0
  331. package/presentation/router/hooks/useRoute.js +30 -0
  332. package/presentation/router/hooks/useRoute.js.map +1 -0
  333. package/presentation/router/hooks/useRouter.d.ts +7 -0
  334. package/presentation/router/hooks/useRouter.js +26 -0
  335. package/presentation/router/hooks/useRouter.js.map +1 -0
  336. package/presentation/router/index.d.ts +4 -0
  337. package/presentation/router/index.js +5 -0
  338. package/presentation/router/index.js.map +1 -0
  339. package/presentation/router/types.d.ts +5 -0
  340. package/presentation/router/types.js +3 -0
  341. package/presentation/router/types.js.map +1 -0
  342. package/react-butterfiles/Files.js +208 -235
  343. package/react-butterfiles/Files.js.map +1 -1
  344. package/react-butterfiles/file.todo +1 -0
  345. package/react-butterfiles/index.d.ts +1 -1
  346. package/react-butterfiles/index.js +2 -8
  347. package/react-butterfiles/index.js.map +1 -1
  348. package/react-butterfiles/utils/generateId.js +1 -7
  349. package/react-butterfiles/utils/generateId.js.map +1 -1
  350. package/react-butterfiles/utils/readFileContent.js +4 -10
  351. package/react-butterfiles/utils/readFileContent.js.map +1 -1
  352. package/renderApp.d.ts +1 -1
  353. package/renderApp.js +4 -11
  354. package/renderApp.js.map +1 -1
  355. package/router.d.ts +5 -0
  356. package/router.js +8 -0
  357. package/router.js.map +1 -0
  358. package/shared/di/DiContainerProvider.d.ts +8 -0
  359. package/shared/di/DiContainerProvider.js +17 -0
  360. package/shared/di/DiContainerProvider.js.map +1 -0
  361. package/shared/di/createFeature.d.ts +11 -0
  362. package/shared/di/createFeature.js +11 -0
  363. package/shared/di/createFeature.js.map +1 -0
  364. package/shared/di/useFeature.d.ts +2 -0
  365. package/shared/di/useFeature.js +18 -0
  366. package/shared/di/useFeature.js.map +1 -0
  367. package/types.d.ts +9 -6
  368. package/types.js +1 -12
  369. package/types.js.map +1 -1
  370. package/utils/createGenericContext.js +13 -22
  371. package/utils/createGenericContext.js.map +1 -1
  372. package/utils/createHashing.js +9 -15
  373. package/utils/createHashing.js.map +1 -1
  374. package/utils/index.d.ts +2 -10
  375. package/utils/index.js +2 -115
  376. package/utils/index.js.map +1 -1
  377. package/utils/legacyPluginToReactComponent.d.ts +1 -1
  378. package/utils/legacyPluginToReactComponent.js +5 -11
  379. package/utils/legacyPluginToReactComponent.js.map +1 -1
  380. package/components/Routes.d.ts +0 -2
  381. package/components/Routes.js +0 -46
  382. package/components/Routes.js.map +0 -1
  383. package/components/View.d.ts +0 -8
  384. package/components/View.js +0 -31
  385. package/components/View.js.map +0 -1
  386. package/core/AddRoute.d.ts +0 -21
  387. package/core/AddRoute.js +0 -21
  388. package/core/AddRoute.js.map +0 -1
  389. package/hooks/useDataList/utils/redirectToRouteWithQueryParams.d.ts +0 -14
  390. package/hooks/useDataList/utils/redirectToRouteWithQueryParams.js +0 -30
  391. package/hooks/useDataList/utils/redirectToRouteWithQueryParams.js.map +0 -1
  392. package/hooks/useDataList/utils/types.d.ts +0 -40
  393. package/hooks/useDataList/utils/types.js +0 -7
  394. package/hooks/useDataList/utils/types.js.map +0 -1
  395. package/plugins/LocaleHeaderLinkPlugin.d.ts +0 -10
  396. package/plugins/LocaleHeaderLinkPlugin.js +0 -49
  397. package/plugins/LocaleHeaderLinkPlugin.js.map +0 -1
  398. package/plugins/RoutePlugin.d.ts +0 -12
  399. package/plugins/RoutePlugin.js +0 -35
  400. package/plugins/RoutePlugin.js.map +0 -1
  401. package/plugins/ViewPlugin.d.ts +0 -14
  402. package/plugins/ViewPlugin.js +0 -40
  403. package/plugins/ViewPlugin.js.map +0 -1
  404. package/utils/getApiUrl.d.ts +0 -1
  405. package/utils/getApiUrl.js +0 -12
  406. package/utils/getApiUrl.js.map +0 -1
  407. package/utils/getGqlApiUrl.d.ts +0 -1
  408. package/utils/getGqlApiUrl.js +0 -12
  409. package/utils/getGqlApiUrl.js.map +0 -1
  410. package/utils/getHeadlessCmsGqlApiUrl.d.ts +0 -5
  411. package/utils/getHeadlessCmsGqlApiUrl.js +0 -18
  412. package/utils/getHeadlessCmsGqlApiUrl.js.map +0 -1
  413. package/utils/getLocaleCode.d.ts +0 -6
  414. package/utils/getLocaleCode.js +0 -43
  415. package/utils/getLocaleCode.js.map +0 -1
  416. package/utils/getPrerenderId.d.ts +0 -6
  417. package/utils/getPrerenderId.js +0 -11
  418. package/utils/getPrerenderId.js.map +0 -1
  419. package/utils/getTenantId.d.ts +0 -6
  420. package/utils/getTenantId.js +0 -51
  421. package/utils/getTenantId.js.map +0 -1
  422. package/utils/isLocalhost.d.ts +0 -1
  423. package/utils/isLocalhost.js +0 -15
  424. package/utils/isLocalhost.js.map +0 -1
  425. package/utils/isPrerendering.d.ts +0 -1
  426. package/utils/isPrerendering.js +0 -11
  427. package/utils/isPrerendering.js.map +0 -1
@@ -0,0 +1,45 @@
1
+ import { makeAutoObservable, toJS } from "mobx";
2
+ import { createImplementation } from "@webiny/di";
3
+ import { RouterRepository, RouterPresenter as Abstraction } from "./abstractions.js";
4
+ class RouterPresenterImpl {
5
+ constructor(routerRepository) {
6
+ this.routerRepository = routerRepository;
7
+ makeAutoObservable(this);
8
+ }
9
+ get vm() {
10
+ return {
11
+ currentRoute: toJS(this.routerRepository.getMatchedRoute())
12
+ };
13
+ }
14
+ bootstrap = routes => {
15
+ this.routerRepository.registerRoutes(routes);
16
+ };
17
+ goToRoute = (route, params) => {
18
+ this.routerRepository.goToRoute(route, params);
19
+ };
20
+ setRouteParams = cb => {
21
+ const currentRoute = this.routerRepository.getCurrentRoute();
22
+ if (!currentRoute) {
23
+ return;
24
+ }
25
+ const matchedRoute = this.routerRepository.getMatchedRoute();
26
+ const newParams = cb(matchedRoute?.params ?? {});
27
+ this.goToRoute(currentRoute, newParams);
28
+ };
29
+ getLink = (route, params) => {
30
+ return this.routerRepository.getLink(route, params);
31
+ };
32
+ onRouteExit = cb => {
33
+ this.routerRepository.onRouteExit(cb);
34
+ };
35
+ destroy = () => {
36
+ this.routerRepository.destroy();
37
+ };
38
+ }
39
+ export const RouterPresenter = createImplementation({
40
+ abstraction: Abstraction,
41
+ implementation: RouterPresenterImpl,
42
+ dependencies: [RouterRepository]
43
+ });
44
+
45
+ //# sourceMappingURL=RouterPresenter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["makeAutoObservable","toJS","createImplementation","RouterRepository","RouterPresenter","Abstraction","RouterPresenterImpl","constructor","routerRepository","vm","currentRoute","getMatchedRoute","bootstrap","routes","registerRoutes","goToRoute","route","params","setRouteParams","cb","getCurrentRoute","matchedRoute","newParams","getLink","onRouteExit","destroy","abstraction","implementation","dependencies"],"sources":["RouterPresenter.ts"],"sourcesContent":["import { makeAutoObservable, toJS } from \"mobx\";\nimport { createImplementation } from \"@webiny/di\";\nimport { Route } from \"./Route.js\";\nimport {\n RouterRepository,\n RouterPresenter as Abstraction,\n type OnRouteExit\n} from \"./abstractions.js\";\n\nclass RouterPresenterImpl implements Abstraction.Interface {\n private routerRepository: RouterRepository.Interface;\n\n constructor(routerRepository: RouterRepository.Interface) {\n this.routerRepository = routerRepository;\n\n makeAutoObservable(this);\n }\n\n get vm() {\n return {\n currentRoute: toJS(this.routerRepository.getMatchedRoute())\n };\n }\n\n bootstrap = (routes: Route[]) => {\n this.routerRepository.registerRoutes(routes);\n };\n\n goToRoute = (route: any, params?: any) => {\n this.routerRepository.goToRoute(route, params);\n };\n\n setRouteParams = (cb: any) => {\n const currentRoute = this.routerRepository.getCurrentRoute();\n if (!currentRoute) {\n return;\n }\n\n const matchedRoute = this.routerRepository.getMatchedRoute();\n const newParams = cb(matchedRoute?.params ?? {});\n this.goToRoute(currentRoute, newParams);\n };\n\n getLink = (route: any, params?: any) => {\n return this.routerRepository.getLink(route, params);\n };\n\n onRouteExit = (cb: OnRouteExit) => {\n this.routerRepository.onRouteExit(cb);\n };\n\n destroy = () => {\n this.routerRepository.destroy();\n };\n}\n\nexport const RouterPresenter = createImplementation({\n abstraction: Abstraction,\n implementation: RouterPresenterImpl,\n dependencies: [RouterRepository]\n});\n"],"mappings":"AAAA,SAASA,kBAAkB,EAAEC,IAAI,QAAQ,MAAM;AAC/C,SAASC,oBAAoB,QAAQ,YAAY;AAEjD,SACIC,gBAAgB,EAChBC,eAAe,IAAIC,WAAW;AAIlC,MAAMC,mBAAmB,CAAkC;EAGvDC,WAAWA,CAACC,gBAA4C,EAAE;IACtD,IAAI,CAACA,gBAAgB,GAAGA,gBAA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mB;EACnCsB,YAAY,EAAE,CAACzB,gBAAgB;AACnC,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,21 @@
1
+ import type { MatchedRoute, OnRouteExit } from "./abstractions.js";
2
+ import * as Abstractions from "./abstractions.js";
3
+ import { Route, RouteParamsDefinition, RouteParamsInfer } from "./Route.js";
4
+ declare class RouterRepositoryImpl implements Abstractions.RouterRepository.Interface {
5
+ private gateway;
6
+ private currentRoute;
7
+ private routes;
8
+ constructor(gateway: Abstractions.RouterGateway.Interface);
9
+ getMatchedRoute(): MatchedRoute<Record<string, any>> | undefined;
10
+ getCurrentRoute(): Route<any> | undefined;
11
+ registerRoutes: (routes: Route[]) => void;
12
+ getLink<TParams extends RouteParamsDefinition | undefined>(route: Route<TParams>, params?: TParams extends RouteParamsDefinition ? RouteParamsInfer<TParams> : undefined): string;
13
+ goToRoute<TParams extends RouteParamsDefinition | undefined>(route: Route<TParams>, params: TParams extends RouteParamsDefinition ? RouteParamsInfer<TParams> : undefined): void;
14
+ onRouteExit(cb: OnRouteExit): void;
15
+ destroy(): void;
16
+ private routeWithAction;
17
+ private transitionToRoute;
18
+ private getRouteByName;
19
+ }
20
+ export declare const RouterRepository: import("@webiny/di").Implementation<typeof RouterRepositoryImpl>;
21
+ export {};
@@ -0,0 +1,71 @@
1
+ import { makeAutoObservable, runInAction } from "mobx";
2
+ import * as Abstractions from "./abstractions.js";
3
+ import { createImplementation } from "@webiny/di";
4
+ import { RouteUrl } from "./RouteUrl.js";
5
+ const INIT_ROUTE = {
6
+ name: "__init__",
7
+ path: "",
8
+ pathname: "",
9
+ params: {}
10
+ };
11
+ class RouterRepositoryImpl {
12
+ currentRoute = INIT_ROUTE;
13
+ routes = [];
14
+ constructor(gateway) {
15
+ this.gateway = gateway;
16
+ makeAutoObservable(this);
17
+ }
18
+ getMatchedRoute() {
19
+ return this.currentRoute.name !== INIT_ROUTE.name ? this.currentRoute : undefined;
20
+ }
21
+ getCurrentRoute() {
22
+ return this.routes.find(route => route.name === this.currentRoute.name);
23
+ }
24
+ registerRoutes = routes => {
25
+ this.routes = routes;
26
+ const routesWithAction = routes.map(this.routeWithAction);
27
+ this.gateway.setRoutes(routesWithAction);
28
+ };
29
+ getLink(route, params) {
30
+ return RouteUrl.fromPattern(route.path, params);
31
+ }
32
+ goToRoute(route, params) {
33
+ this.gateway.goToRoute(route.name, params);
34
+ }
35
+ onRouteExit(cb) {
36
+ this.gateway.onRouteExit(cb);
37
+ }
38
+ destroy() {
39
+ this.gateway.destroy();
40
+ }
41
+ routeWithAction = route => {
42
+ return {
43
+ name: route.name,
44
+ path: route.path,
45
+ onMatch: this.transitionToRoute.bind(this)
46
+ };
47
+ };
48
+ async transitionToRoute(matchedRoute) {
49
+ const route = this.getRouteByName(matchedRoute.name);
50
+ if (!route) {
51
+ return;
52
+ }
53
+ const params = route.params ? route.params.parse(matchedRoute.params) : matchedRoute.params;
54
+ runInAction(() => {
55
+ Object.assign(this.currentRoute, {
56
+ ...matchedRoute,
57
+ params
58
+ });
59
+ });
60
+ }
61
+ getRouteByName(name) {
62
+ return this.routes.find(existingRoute => existingRoute.name === name);
63
+ }
64
+ }
65
+ export const RouterRepository = createImplementation({
66
+ implementation: RouterRepositoryImpl,
67
+ abstraction: Abstractions.RouterRepository,
68
+ dependencies: [Abstractions.RouterGateway]
69
+ });
70
+
71
+ //# sourceMappingURL=RouterRepository.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["makeAutoObservable","runInAction","Abstractions","createImplementation","RouteUrl","INIT_ROUTE","name","path","pathname","params","RouterRepositoryImpl","currentRoute","routes","constructor","gateway","getMatchedRoute","undefined","getCurrentRoute","find","route","registerRoutes","routesWithAction","map","routeWithAction","setRoutes","getLink","fromPattern","goToRoute","onRouteExit","cb","destroy","onMatch","transitionToRoute","bind","matchedRoute","getRouteByName","parse","Object","assign","existingRoute","RouterRepository","implementation","abstraction","dependencies","RouterGateway"],"sources":["RouterRepository.ts"],"sourcesContent":["import { makeAutoObservable, runInAction } from \"mobx\";\nimport type { MatchedRoute, RouteDefinition, OnRouteExit } from \"./abstractions.js\";\nimport * as Abstractions from \"./abstractions.js\";\nimport { Route, RouteParamsDefinition, RouteParamsInfer } from \"./Route.js\";\nimport { createImplementation } from \"@webiny/di\";\nimport { RouteUrl } from \"./RouteUrl.js\";\n\nconst INIT_ROUTE = { name: \"__init__\", path: \"\", pathname: \"\", params: {} };\n\nclass RouterRepositoryImpl implements Abstractions.RouterRepository.Interface {\n private gateway: Abstractions.RouterGateway.Interface;\n private currentRoute: MatchedRoute = INIT_ROUTE;\n private routes: Route<any>[] = [];\n\n constructor(gateway: Abstractions.RouterGateway.Interface) {\n this.gateway = gateway;\n\n makeAutoObservable(this);\n }\n\n getMatchedRoute() {\n return this.currentRoute.name !== INIT_ROUTE.name ? this.currentRoute : undefined;\n }\n\n getCurrentRoute(): Route<any> | undefined {\n return this.routes.find(route => route.name === this.currentRoute.name);\n }\n\n registerRoutes = (routes: Route[]) => {\n this.routes = routes;\n const routesWithAction = routes.map<RouteDefinition>(this.routeWithAction);\n\n this.gateway.setRoutes(routesWithAction);\n };\n\n getLink<TParams extends RouteParamsDefinition | undefined>(\n route: Route<TParams>,\n params?: TParams extends RouteParamsDefinition ? RouteParamsInfer<TParams> : undefined\n ): string {\n return RouteUrl.fromPattern(route.path, params);\n }\n\n goToRoute<TParams extends RouteParamsDefinition | undefined>(\n route: Route<TParams>,\n params: TParams extends RouteParamsDefinition ? RouteParamsInfer<TParams> : undefined\n ): void {\n this.gateway.goToRoute(route.name, params);\n }\n\n onRouteExit(cb: OnRouteExit): void {\n this.gateway.onRouteExit(cb);\n }\n\n destroy() {\n this.gateway.destroy();\n }\n\n private routeWithAction = (route: Route<any>) => {\n return {\n name: route.name,\n path: route.path,\n onMatch: this.transitionToRoute.bind(this)\n };\n };\n\n private async transitionToRoute(matchedRoute: MatchedRoute) {\n const route = this.getRouteByName(matchedRoute.name);\n if (!route) {\n return;\n }\n\n const params = route.params ? route.params.parse(matchedRoute.params) : matchedRoute.params;\n\n runInAction(() => {\n Object.assign(this.currentRoute, {\n ...matchedRoute,\n params\n });\n });\n }\n\n private getRouteByName(name: string) {\n return this.routes.find(existingRoute => existingRoute.name === name);\n }\n}\n\nexport const RouterRepository = createImplementation({\n implementation: RouterRepositoryImpl,\n abstraction: Abstractions.RouterRepository,\n dependencies: [Abstractions.RouterGateway]\n});\n"],"mappings":"AAAA,SAASA,kBAAkB,EAAEC,WAAW,QAAQ,MAAM;AAEtD,OAAO,KAAKC,YAAY;AAExB,SAASC,oBAAoB,QAAQ,YAAY;AACjD,SAASC,QAAQ;AAEjB,MAAMC,UAAU,GAAG;EAAEC,IAAI,EAAE,UAAU;EAAEC,IAAI,EAAE,EAAE;EAAEC,QAAQ,EAAE,EAAE;EAAEC,MAAM,EAAE,CAAC;AAAE,CAAC;AAE3E,MAAMC,oBAAoB,CAAoD;EAElEC,YAAY,GAAiBN,UAAU;EACvCO,MAAM,GAAiB,EAAE;EAEjCC,WAAWA,CAACC,OAA6C,EAAE;IACvD,IAAI,CAACA,OAAO,GAAGA,OAAO;IAEtBd,kBAAkB,CAAC,IAAI,CAAC;EAC5B;EAEAe,eAAeA,CAAA,EAAG;IACd,OAAO,IAAI,CAACJ,YAAY,CAACL,IAAI,KAAKD,UAAU,CAACC,IAAI,GAAG,IAAI,CAACK,YAAY,GAAGK,SAAS;EACrF;EAEAC,eAAeA,CAAA,EAA2B;IACtC,OAAO,IAAI,CAACL,MAAM,CAACM,IAAI,CAACC,KAAK,IAAIA,KAAK,CAACb,IAAI,KAAK,IAAI,CAACK,YAAY,CAACL,IAAI,CAAC;EAC3E;EAEAc,cAAc,GAAIR,MAAe,IAAK;IAClC,IAAI,CAACA,MAAM,GAAGA,MAAM;IACpB,MAAMS,gBAAgB,GAAGT,MAAM,CAACU,GAAG,CAAkB,IAAI,CAACC,eAAe,CAAC;IAE1E,IAAI,CAACT,OAAO,CAACU,SAAS,CAACH,gBAAgB,CAAC;EAC5C,CAAC;EAEDI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A,IAAI,CAAC;EACzE;AACJ;AAEA,OAAO,MAAMkC,gBAAgB,GAAGrC,oBAAoB,CAAC;EACjDsC,cAAc,EAAE/B,oBAAoB;EACpCgC,WAAW,EAAExC,YAAY,CAACsC,gBAAgB;EAC1CG,YAAY,EAAE,CAACzC,YAAY,CAAC0C,aAAa;AAC7C,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,154 @@
1
+ import { describe, it, beforeEach, expect, vi } from "vitest";
2
+ import { createMemoryHistory } from "history";
3
+ import { HistoryRouterGateway } from "./HistoryRouterGateway.js";
4
+ import { RouterRepository } from "./RouterRepository.js";
5
+ import { Route } from "./Route.js";
6
+ const wait = () => new Promise(resolve => setTimeout(resolve, 10));
7
+ const loginRouteDef = new Route({
8
+ name: "login",
9
+ path: "/login"
10
+ });
11
+ const userRouteDef = new Route({
12
+ name: "userById",
13
+ path: "/users/:id",
14
+ params: zod => {
15
+ return {
16
+ id: zod.string()
17
+ };
18
+ }
19
+ });
20
+ const allRoutes = [new Route({
21
+ name: "home",
22
+ path: "/"
23
+ }), loginRouteDef, userRouteDef];
24
+ const loginRoute = {
25
+ name: "login",
26
+ path: "/login",
27
+ pathname: "/login",
28
+ params: {}
29
+ };
30
+ const userRoute = id => {
31
+ return {
32
+ name: "userById",
33
+ path: "/users/:id",
34
+ pathname: `/users/${id}`,
35
+ params: {
36
+ id
37
+ }
38
+ };
39
+ };
40
+ const createRepository = (routes = allRoutes) => {
41
+ const history = createMemoryHistory();
42
+ history.replace("/__unknown__");
43
+ const gateway = new HistoryRouterGateway(history, "");
44
+ const repository = new RouterRepository(gateway);
45
+ repository.registerRoutes(routes);
46
+ return {
47
+ repository,
48
+ history
49
+ };
50
+ };
51
+ describe("Router Repository", () => {
52
+ beforeEach(() => {
53
+ vi.clearAllMocks();
54
+ });
55
+ it("state should contain current route", async () => {
56
+ const {
57
+ repository,
58
+ history
59
+ } = createRepository();
60
+ history.push("/login");
61
+ await wait();
62
+ expect(repository.getMatchedRoute()).toEqual(loginRoute);
63
+ });
64
+ it("route guard should allow or prevent route transition", async () => {
65
+ const {
66
+ repository,
67
+ history
68
+ } = createRepository();
69
+ history.push("/login");
70
+ await wait();
71
+
72
+ // This guard should prevent the transition.
73
+ // The Repository should stay where it was, and the `history` should restore the previous URL.
74
+ repository.onRouteExit(({
75
+ cancel
76
+ }) => {
77
+ cancel();
78
+ });
79
+
80
+ // Trigger a history location change (imagine a click on "Back" button in the browser).
81
+ history.push("/users/123");
82
+ await wait();
83
+ expect(repository.getMatchedRoute()).toEqual(loginRoute);
84
+
85
+ // This guard should allow the transition.
86
+ repository.onRouteExit(guard => {
87
+ guard.continue();
88
+ });
89
+
90
+ // Trigger a history location change (imagine a click on "Back" button in the browser).
91
+ history.push("/users/123");
92
+ await wait();
93
+ expect(repository.getMatchedRoute()).toEqual(userRoute("123"));
94
+ });
95
+ it("route guard should be unset after route transition", async () => {
96
+ const guardSpy = vi.fn();
97
+ const {
98
+ repository,
99
+ history
100
+ } = createRepository();
101
+ history.push("/login");
102
+ await wait();
103
+
104
+ // This guard should prevent the transition.
105
+ // The Repository should stay where it was, and the `history` should restore the previous URL.
106
+ repository.onRouteExit(guard => {
107
+ guardSpy();
108
+ guard.continue();
109
+ });
110
+
111
+ // Trigger a history location change (imagine a click on "Back" button in the browser).
112
+ history.push("/users/123");
113
+ await wait();
114
+ expect(repository.getMatchedRoute()).toEqual(userRoute("123"));
115
+ expect(guardSpy).toHaveBeenCalledTimes(1);
116
+ vi.resetAllMocks();
117
+
118
+ // Trigger a history location change (imagine a click on "Back" button in the browser).
119
+ history.push("/login");
120
+ await wait();
121
+ expect(repository.getMatchedRoute()).toEqual(loginRoute);
122
+ expect(guardSpy).toHaveBeenCalledTimes(0);
123
+ });
124
+ it("should go to the right route", async () => {
125
+ const {
126
+ repository
127
+ } = createRepository();
128
+ repository.goToRoute(userRouteDef, {
129
+ id: "5"
130
+ });
131
+ await wait();
132
+ expect(repository.getMatchedRoute()).toEqual(userRoute("5"));
133
+ });
134
+ it("should generate a valid route link", async () => {
135
+ const {
136
+ repository
137
+ } = createRepository();
138
+ expect(repository.getLink(loginRouteDef)).toEqual("/login");
139
+ expect(repository.getLink(userRouteDef, {
140
+ id: "1"
141
+ })).toEqual("/users/1");
142
+ });
143
+ it("should generate a valid route link when no routes are registered", async () => {
144
+ const {
145
+ repository
146
+ } = createRepository([]);
147
+ expect(repository.getLink(loginRouteDef)).toEqual("/login");
148
+ expect(repository.getLink(userRouteDef, {
149
+ id: "1"
150
+ })).toEqual("/users/1");
151
+ });
152
+ });
153
+
154
+ //# sourceMappingURL=RouterRepository.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["describe","it","beforeEach","expect","vi","createMemoryHistory","HistoryRouterGateway","RouterRepository","Route","wait","Promise","resolve","setTimeout","loginRouteDef","name","path","userRouteDef","params","zod","id","string","allRoutes","loginRoute","pathname","userRoute","createRepository","routes","history","replace","gateway","repository","registerRoutes","clearAllMocks","push","getMatchedRoute","toEqual","onRouteExit","cancel","guard","continue","guardSpy","fn","toHaveBeenCalledTimes","resetAllMocks","goToRoute","getLink"],"sources":["RouterRepository.test.ts"],"sourcesContent":["import { describe, it, beforeEach, expect, vi } from \"vitest\";\nimport { createMemoryHistory } from \"history\";\nimport { HistoryRouterGateway } from \"./HistoryRouterGateway.js\";\nimport { RouterRepository } from \"./RouterRepository.js\";\nimport { Route } from \"./Route.js\";\n\nconst wait = () => new Promise(resolve => setTimeout(resolve, 10));\n\nconst loginRouteDef = new Route({ name: \"login\", path: \"/login\" });\n\nconst userRouteDef = new Route({\n name: \"userById\",\n path: \"/users/:id\",\n params: zod => {\n return {\n id: zod.string()\n };\n }\n});\n\nconst allRoutes: Route<any>[] = [\n new Route({ name: \"home\", path: \"/\" }),\n loginRouteDef,\n userRouteDef\n];\n\nconst loginRoute = {\n name: \"login\",\n path: \"/login\",\n pathname: \"/login\",\n params: {}\n};\n\nconst userRoute = (id: string) => {\n return {\n name: \"userById\",\n path: \"/users/:id\",\n pathname: `/users/${id}`,\n params: {\n id\n }\n };\n};\n\nconst createRepository = (routes = allRoutes) => {\n const history = createMemoryHistory();\n history.replace(\"/__unknown__\");\n\n const gateway = new HistoryRouterGateway(history, \"\");\n const repository = new RouterRepository(gateway);\n\n repository.registerRoutes(routes);\n\n return { repository, history };\n};\n\ndescribe(\"Router Repository\", () => {\n beforeEach(() => {\n vi.clearAllMocks();\n });\n\n it(\"state should contain current route\", async () => {\n const { repository, history } = createRepository();\n history.push(\"/login\");\n await wait();\n\n expect(repository.getMatchedRoute()).toEqual(loginRoute);\n });\n\n it(\"route guard should allow or prevent route transition\", async () => {\n const { repository, history } = createRepository();\n history.push(\"/login\");\n await wait();\n\n // This guard should prevent the transition.\n // The Repository should stay where it was, and the `history` should restore the previous URL.\n repository.onRouteExit(({ cancel }) => {\n cancel();\n });\n\n // Trigger a history location change (imagine a click on \"Back\" button in the browser).\n history.push(\"/users/123\");\n await wait();\n\n expect(repository.getMatchedRoute()).toEqual(loginRoute);\n\n // This guard should allow the transition.\n repository.onRouteExit(guard => {\n guard.continue();\n });\n\n // Trigger a history location change (imagine a click on \"Back\" button in the browser).\n history.push(\"/users/123\");\n await wait();\n\n expect(repository.getMatchedRoute()).toEqual(userRoute(\"123\"));\n });\n\n it(\"route guard should be unset after route transition\", async () => {\n const guardSpy = vi.fn();\n const { repository, history } = createRepository();\n history.push(\"/login\");\n await wait();\n\n // This guard should prevent the transition.\n // The Repository should stay where it was, and the `history` should restore the previous URL.\n repository.onRouteExit(guard => {\n guardSpy();\n guard.continue();\n });\n\n // Trigger a history location change (imagine a click on \"Back\" button in the browser).\n history.push(\"/users/123\");\n await wait();\n\n expect(repository.getMatchedRoute()).toEqual(userRoute(\"123\"));\n expect(guardSpy).toHaveBeenCalledTimes(1);\n vi.resetAllMocks();\n\n // Trigger a history location change (imagine a click on \"Back\" button in the browser).\n history.push(\"/login\");\n await wait();\n\n expect(repository.getMatchedRoute()).toEqual(loginRoute);\n expect(guardSpy).toHaveBeenCalledTimes(0);\n });\n\n it(\"should go to the right route\", async () => {\n const { repository } = createRepository();\n repository.goToRoute(userRouteDef, { id: \"5\" });\n await wait();\n expect(repository.getMatchedRoute()).toEqual(userRoute(\"5\"));\n });\n\n it(\"should generate a valid route link\", async () => {\n const { repository } = createRepository();\n\n expect(repository.getLink(loginRouteDef)).toEqual(\"/login\");\n expect(repository.getLink(userRouteDef, { id: \"1\" })).toEqual(\"/users/1\");\n });\n\n it(\"should generate a valid route link when no routes are registered\", async () => {\n const { repository } = createRepository([]);\n\n expect(repository.getLink(loginRouteDef)).toEqual(\"/login\");\n expect(repository.getLink(userRouteDef, { id: \"1\" })).toEqual(\"/users/1\");\n });\n});\n"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,EAAE,EAAEC,UAAU,EAAEC,MAAM,EAAEC,EAAE,QAAQ,QAAQ;AAC7D,SAASC,mBAAmB,QAAQ,SAAS;AAC7C,SAASC,oBAAoB;AAC7B,SAASC,gBAAgB;AACzB,SAASC,KAAK;AAEd,MAAMC,IAAI,GAAGA,CAAA,KAAM,IAAIC,OAAO,CAACC,OAAO,IAAIC,UAAU,CAACD,OAAO,EAAE,EAAE,CAAC,CAAC;AAElE,MAAME,aAAa,GAAG,IAAIL,KAAK,CAAC;EAAEM,IAAI,EAAE,OAAO;EAAEC,IAAI,EAAE;AAAS,CAAC,CAAC;AAElE,MAAMC,YAAY,GAAG,IAAIR,KAAK,CAAC;EAC3BM,IAAI,EAAE,UAAU;EAChBC,IAAI,EAAE,YAAY;EAClBE,MAAM,EAAEC,GAAG,IAAI;IACX,OAAO;MACHC,EAAE,EAAED,GAAG,CAACE,MAAM,CAAC;IACnB,CAAC;EACL;AACJ,CAAC,CAAC;AAEF,MAAMC,SAAuB,GAAG,CAC5B,IAAIb,KAAK,CAAC;EAAEM,IAAI,EAAE,MAAM;EAAEC,IAAI,EAAE;AAAI,CAAC,CAAC,EACtCF,aAAa,EACbG,YAAY,CACf;AAED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C;IAE3CtB,MAAM,CAAC2B,UAAU,CAACe,OAAO,CAAChC,aAAa,CAAC,CAAC,CAACsB,OAAO,CAAC,QAAQ,CAAC;IAC3DhC,MAAM,CAAC2B,UAAU,CAACe,OAAO,CAAC7B,YAAY,EAAE;MAAEG,EAAE,EAAE;IAAI,CAAC,CAAC,CAAC,CAACgB,OAAO,CAAC,UAAU,CAAC;EAC7E,CAAC,CAAC;AACN,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,68 @@
1
+ import { Abstraction } from "@webiny/di";
2
+ import type { Route, RouteParamsDefinition, RouteParamsInfer } from "./Route.js";
3
+ import type { RequiredKeysOf } from "type-fest";
4
+ /***** Presenter *****/
5
+ export type RouteParamsArgs<TParams extends RouteParamsDefinition | undefined> = TParams extends RouteParamsDefinition ? RequiredKeysOf<RouteParamsInfer<TParams>> extends never ? [params?: RouteParamsInfer<TParams>] : [params: RouteParamsInfer<TParams>] : [];
6
+ interface RouterViewModel {
7
+ currentRoute: MatchedRoute | undefined;
8
+ }
9
+ export interface IRouterPresenter {
10
+ vm: RouterViewModel;
11
+ bootstrap(routes: Route[]): void;
12
+ goToRoute<TParams extends RouteParamsDefinition | undefined>(route: Route<TParams>, ...args: RouteParamsArgs<TParams>): void;
13
+ getLink<TParams extends RouteParamsDefinition | undefined>(route: Route<TParams>, ...args: RouteParamsArgs<TParams>): string;
14
+ setRouteParams<T extends Record<string, any>>(cb: (params: T) => T): void;
15
+ onRouteExit(cb: OnRouteExit): void;
16
+ destroy(): void;
17
+ }
18
+ export declare const RouterPresenter: Abstraction<IRouterPresenter>;
19
+ export declare namespace RouterPresenter {
20
+ type Interface = IRouterPresenter;
21
+ }
22
+ /***** Repository *****/
23
+ export interface MatchedRoute<TParams = Record<string, any>> {
24
+ name: string;
25
+ pathname: string;
26
+ path: string;
27
+ params: TParams;
28
+ }
29
+ interface IRouterRepository {
30
+ onRouteExit(cb: OnRouteExit): void;
31
+ getMatchedRoute(): MatchedRoute | undefined;
32
+ getCurrentRoute(): Route<any> | undefined;
33
+ goToRoute<TParams extends RouteParamsDefinition | undefined>(route: Route<TParams>, params: TParams extends RouteParamsDefinition ? RouteParamsInfer<TParams> : undefined): void;
34
+ getLink<TParams extends RouteParamsDefinition | undefined>(route: Route<TParams>, params: TParams extends RouteParamsDefinition ? RouteParamsInfer<TParams> : undefined): string;
35
+ registerRoutes(routes: Route[]): void;
36
+ destroy(): void;
37
+ }
38
+ export declare const RouterRepository: Abstraction<IRouterRepository>;
39
+ export declare namespace RouterRepository {
40
+ type Interface = IRouterRepository;
41
+ }
42
+ /***** Gateway *****/
43
+ export interface RouteDefinition {
44
+ name: string;
45
+ path: string;
46
+ onMatch(route: MatchedRoute): void;
47
+ }
48
+ export type TransitionController = {
49
+ continue: () => void;
50
+ cancel: () => void;
51
+ };
52
+ export interface OnRouteExit {
53
+ (controller: TransitionController): void;
54
+ }
55
+ interface IRouterGateway {
56
+ setRoutes(routes: RouteDefinition[]): void;
57
+ goToRoute(name: string, params?: {
58
+ [k: string]: any;
59
+ }): void;
60
+ pushState(url: string): void;
61
+ onRouteExit(cb: OnRouteExit): void;
62
+ destroy(): void;
63
+ }
64
+ export declare const RouterGateway: Abstraction<IRouterGateway>;
65
+ export declare namespace RouterGateway {
66
+ type Interface = IRouterGateway;
67
+ }
68
+ export {};
@@ -0,0 +1,15 @@
1
+ import { Abstraction } from "@webiny/di";
2
+
3
+ /***** Presenter *****/
4
+
5
+ export const RouterPresenter = new Abstraction("RouterPresenter");
6
+
7
+ /***** Repository *****/
8
+
9
+ export const RouterRepository = new Abstraction("RouterRepository");
10
+
11
+ /***** Gateway *****/
12
+
13
+ export const RouterGateway = new Abstraction("RouterGateway");
14
+
15
+ //# sourceMappingURL=abstractions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Abstraction","RouterPresenter","RouterRepository","RouterGateway"],"sources":["abstractions.ts"],"sourcesContent":["import { Abstraction } from \"@webiny/di\";\nimport type { Route, RouteParamsDefinition, RouteParamsInfer } from \"./Route.js\";\nimport type { RequiredKeysOf } from \"type-fest\";\n\n/***** Presenter *****/\n\nexport type RouteParamsArgs<TParams extends RouteParamsDefinition | undefined> =\n TParams extends RouteParamsDefinition\n ? RequiredKeysOf<RouteParamsInfer<TParams>> extends never\n ? [params?: RouteParamsInfer<TParams>] // all optional → param optional\n : [params: RouteParamsInfer<TParams>] // some required → param required\n : [];\n\ninterface RouterViewModel {\n currentRoute: MatchedRoute | undefined;\n}\n\nexport interface IRouterPresenter {\n vm: RouterViewModel;\n bootstrap(routes: Route[]): void;\n goToRoute<TParams extends RouteParamsDefinition | undefined>(\n route: Route<TParams>,\n ...args: RouteParamsArgs<TParams>\n ): void;\n getLink<TParams extends RouteParamsDefinition | undefined>(\n route: Route<TParams>,\n ...args: RouteParamsArgs<TParams>\n ): string;\n setRouteParams<T extends Record<string, any>>(cb: (params: T) => T): void;\n onRouteExit(cb: OnRouteExit): void;\n destroy(): void;\n}\nexport const RouterPresenter = new Abstraction<IRouterPresenter>(\"RouterPresenter\");\n\nexport namespace RouterPresenter {\n export type Interface = IRouterPresenter;\n}\n\n/***** Repository *****/\n\nexport interface MatchedRoute<TParams = Record<string, any>> {\n // Name of the matched route.\n name: string;\n // Pathname that was used to match the route.\n pathname: string;\n // Path pattern that matched this route.\n path: string;\n // Route params extracted from the pathname.\n params: TParams;\n}\n\ninterface IRouterRepository {\n onRouteExit(cb: OnRouteExit): void;\n\n getMatchedRoute(): MatchedRoute | undefined;\n\n getCurrentRoute(): Route<any> | undefined;\n\n goToRoute<TParams extends RouteParamsDefinition | undefined>(\n route: Route<TParams>,\n params: TParams extends RouteParamsDefinition ? RouteParamsInfer<TParams> : undefined\n ): void;\n\n getLink<TParams extends RouteParamsDefinition | undefined>(\n route: Route<TParams>,\n params: TParams extends RouteParamsDefinition ? RouteParamsInfer<TParams> : undefined\n ): string;\n\n registerRoutes(routes: Route[]): void;\n\n destroy(): void;\n}\n\nexport const RouterRepository = new Abstraction<IRouterRepository>(\"RouterRepository\");\n\nexport namespace RouterRepository {\n export type Interface = IRouterRepository;\n}\n\n/***** Gateway *****/\n\nexport interface RouteDefinition {\n name: string;\n path: string;\n onMatch(route: MatchedRoute): void;\n}\n\nexport type TransitionController = {\n continue: () => void;\n cancel: () => void;\n};\n\nexport interface OnRouteExit {\n (controller: TransitionController): void;\n}\n\ninterface IRouterGateway {\n setRoutes(routes: RouteDefinition[]): void;\n goToRoute(name: string, params?: { [k: string]: any }): void;\n pushState(url: string): void;\n onRouteExit(cb: OnRouteExit): void;\n destroy(): void;\n}\n\nexport const RouterGateway = new Abstraction<IRouterGateway>(\"RouterGateway\");\n\nexport namespace RouterGateway {\n export type Interface = IRouterGateway;\n}\n"],"mappings":"AAAA,SAASA,WAAW,QAAQ,YAAY;;AAIxC;;AA4BA,OAAO,MAAMC,eAAe,GAAG,IAAID,WAAW,CAAmB,iBAAiB,CAAC;;AAMnF;;AAmCA,OAAO,MAAME,gBAAgB,GAAG,IAAIF,WAAW,CAAoB,kBAAkB,CAAC;;AAMtF;;AAyBA,OAAO,MAAMG,aAAa,GAAG,IAAIH,WAAW,CAAiB,eAAe,CAAC","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ import * as Abstractions from "../../features/router/abstractions.js";
2
+ export declare const RouterFeature: import("~/shared/di/createFeature.js").FeatureDefinition<{
3
+ presenter: Abstractions.IRouterPresenter;
4
+ }, []>;
@@ -0,0 +1,18 @@
1
+ import { RouterRepository } from "./RouterRepository.js";
2
+ import { RouterPresenter } from "./RouterPresenter.js";
3
+ import * as Abstractions from "./abstractions.js";
4
+ import { createFeature } from "../../shared/di/createFeature.js";
5
+ export const RouterFeature = createFeature({
6
+ name: "Router",
7
+ register(container) {
8
+ container.register(RouterRepository).inSingletonScope();
9
+ container.register(RouterPresenter).inSingletonScope();
10
+ },
11
+ resolve(container) {
12
+ return {
13
+ presenter: container.resolve(Abstractions.RouterPresenter)
14
+ };
15
+ }
16
+ });
17
+
18
+ //# sourceMappingURL=feature.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["RouterRepository","RouterPresenter","Abstractions","createFeature","RouterFeature","name","register","container","inSingletonScope","resolve","presenter"],"sources":["feature.ts"],"sourcesContent":["import { RouterRepository } from \"~/features/router/RouterRepository.js\";\nimport { RouterPresenter } from \"~/features/router/RouterPresenter.js\";\nimport * as Abstractions from \"~/features/router/abstractions.js\";\nimport { createFeature } from \"~/shared/di/createFeature.js\";\n\nexport const RouterFeature = createFeature({\n name: \"Router\",\n register(container) {\n container.register(RouterRepository).inSingletonScope();\n container.register(RouterPresenter).inSingletonScope();\n },\n resolve(container) {\n return {\n presenter: container.resolve(Abstractions.RouterPresenter)\n };\n }\n});\n"],"mappings":"AAAA,SAASA,gBAAgB;AACzB,SAASC,eAAe;AACxB,OAAO,KAAKC,YAAY;AACxB,SAASC,aAAa;AAEtB,OAAO,MAAMC,aAAa,GAAGD,aAAa,CAAC;EACvCE,IAAI,EAAE,QAAQ;EACdC,QAAQA,CAACC,SAAS,EAAE;IAChBA,SAAS,CAACD,QAAQ,CAACN,gBAAgB,CAAC,CAACQ,gBAAgB,CAAC,CAAC;IACvDD,SAAS,CAACD,QAAQ,CAACL,eAAe,CAAC,CAACO,gBAAgB,CAAC,CAAC;EAC1D,CAAC;EACDC,OAAOA,CAACF,SAAS,EAAE;IACf,OAAO;MACHG,SAAS,EAAEH,SAAS,CAACE,OAAO,CAACP,YAAY,CAACD,eAAe;IAC7D,CAAC;EACL;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1 @@
1
+ export { RouterPresenter, RouterGateway } from "./abstractions.js";
@@ -0,0 +1,3 @@
1
+ export { RouterPresenter, RouterGateway } from "./abstractions.js";
2
+
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["RouterPresenter","RouterGateway"],"sources":["index.ts"],"sourcesContent":["export { RouterPresenter, RouterGateway } from \"./abstractions.js\";\n"],"mappings":"AAAA,SAASA,eAAe,EAAEC,aAAa","ignoreList":[]}
@@ -0,0 +1,15 @@
1
+ type DateOps<T> = {
2
+ "": T;
3
+ _gt: T;
4
+ _gte: T;
5
+ _lt: T;
6
+ _lte: T;
7
+ _between: [T, T];
8
+ };
9
+ export type DateInterfaceGenerator<Name extends string> = {
10
+ [K in keyof DateOps<Date> as `${Name}${K}`]?: DateOps<Date>[K];
11
+ };
12
+ export type DateStringInterfaceGenerator<Name extends string> = {
13
+ [K in keyof DateOps<string> as `${Name}${K}`]?: DateOps<string>[K];
14
+ };
15
+ export {};
@@ -0,0 +1,3 @@
1
+ export {};
2
+
3
+ //# sourceMappingURL=date.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["date.ts"],"sourcesContent":["type DateOps<T> = {\n \"\": T;\n _gt: T;\n _gte: T;\n _lt: T;\n _lte: T;\n _between: [T, T];\n};\n\nexport type DateInterfaceGenerator<Name extends string> = {\n [K in keyof DateOps<Date> as `${Name}${K}`]?: DateOps<Date>[K];\n};\n\nexport type DateStringInterfaceGenerator<Name extends string> = {\n [K in keyof DateOps<string> as `${Name}${K}`]?: DateOps<string>[K];\n};\n"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,23 @@
1
+ type IdOperators<TType extends string> = {
2
+ "": TType;
3
+ _not: TType;
4
+ _in: TType[];
5
+ _not_in: TType[];
6
+ };
7
+ export type IdInterfaceGenerator<TName extends string, TType extends string = string> = {
8
+ [K in keyof IdOperators<TType> as `${TName}${K}`]?: IdOperators<TType>[K];
9
+ };
10
+ type IdMixedOperators = {
11
+ "": string;
12
+ _not: string;
13
+ _in: string[];
14
+ _not_in: string[];
15
+ _gt: number | string;
16
+ _gte: number | string;
17
+ _lt: number | string;
18
+ _lte: number | string;
19
+ };
20
+ export type IdMixedInterfaceGenerator<TName extends string> = {
21
+ [K in keyof IdMixedOperators as `${TName}${K}`]?: IdMixedOperators[K];
22
+ };
23
+ export {};
@@ -0,0 +1,3 @@
1
+ export {};
2
+
3
+ //# sourceMappingURL=id.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["id.ts"],"sourcesContent":["type IdOperators<TType extends string> = {\n \"\": TType;\n _not: TType;\n _in: TType[];\n _not_in: TType[];\n};\n\nexport type IdInterfaceGenerator<TName extends string, TType extends string = string> = {\n [K in keyof IdOperators<TType> as `${TName}${K}`]?: IdOperators<TType>[K];\n};\n\ntype IdMixedOperators = {\n \"\": string;\n _not: string;\n _in: string[];\n _not_in: string[];\n _gt: number | string;\n _gte: number | string;\n _lt: number | string;\n _lte: number | string;\n};\n\nexport type IdMixedInterfaceGenerator<TName extends string> = {\n [K in keyof IdMixedOperators as `${TName}${K}`]?: IdMixedOperators[K];\n};\n"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,10 @@
1
+ type IdentityOps<TId> = {
2
+ "": TId;
3
+ _not: TId;
4
+ _in: TId[];
5
+ _not_in: TId[];
6
+ };
7
+ export type IdentityInterfaceGenerator<Name extends string, TId = string> = {
8
+ [K in keyof IdentityOps<TId> as `${Name}${K}`]?: IdentityOps<TId>[K];
9
+ };
10
+ export {};
@@ -0,0 +1,3 @@
1
+ export {};
2
+
3
+ //# sourceMappingURL=identity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["identity.ts"],"sourcesContent":["type IdentityOps<TId> = {\n \"\": TId;\n _not: TId;\n _in: TId[];\n _not_in: TId[];\n};\n\nexport type IdentityInterfaceGenerator<Name extends string, TId = string> = {\n [K in keyof IdentityOps<TId> as `${Name}${K}`]?: IdentityOps<TId>[K];\n};\n"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,5 @@
1
+ export type { IdInterfaceGenerator, IdMixedInterfaceGenerator } from "./id.js";
2
+ export type { DateInterfaceGenerator, DateStringInterfaceGenerator } from "./date.js";
3
+ export type { IdentityInterfaceGenerator } from "./identity.js";
4
+ export type { NumericInterfaceGenerator } from "./numeric.js";
5
+ export type { TruthfulInterfaceGenerator } from "./truthful.js";
@@ -0,0 +1,3 @@
1
+ export {};
2
+
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export type { IdInterfaceGenerator, IdMixedInterfaceGenerator } from \"./id.js\";\nexport type { DateInterfaceGenerator, DateStringInterfaceGenerator } from \"./date.js\";\nexport type { IdentityInterfaceGenerator } from \"./identity.js\";\nexport type { NumericInterfaceGenerator } from \"./numeric.js\";\nexport type { TruthfulInterfaceGenerator } from \"./truthful.js\";\n"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,12 @@
1
+ type Numeric = {
2
+ "": number;
3
+ _gt: number;
4
+ _gte: number;
5
+ _lt: number;
6
+ _lte: number;
7
+ _between: [number, number];
8
+ };
9
+ export type NumericInterfaceGenerator<Name extends string> = {
10
+ [K in keyof Numeric as `${Name}${K}`]?: Numeric[K];
11
+ };
12
+ export {};
@@ -0,0 +1,3 @@
1
+ export {};
2
+
3
+ //# sourceMappingURL=numeric.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["numeric.ts"],"sourcesContent":["type Numeric = {\n \"\": number;\n _gt: number;\n _gte: number;\n _lt: number;\n _lte: number;\n _between: [number, number];\n};\n\nexport type NumericInterfaceGenerator<Name extends string> = {\n [K in keyof Numeric as `${Name}${K}`]?: Numeric[K];\n};\n"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,7 @@
1
+ type Truthful = {
2
+ "": boolean;
3
+ };
4
+ export type TruthfulInterfaceGenerator<Name extends string> = {
5
+ [K in keyof Truthful as `${Name}${K}`]?: Truthful[K];
6
+ };
7
+ export {};
@@ -0,0 +1,3 @@
1
+ export {};
2
+
3
+ //# sourceMappingURL=truthful.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["truthful.ts"],"sourcesContent":["type Truthful = {\n \"\": boolean;\n};\n\nexport type TruthfulInterfaceGenerator<Name extends string> = {\n [K in keyof Truthful as `${Name}${K}`]?: Truthful[K];\n};\n"],"mappings":"","ignoreList":[]}
@@ -1 +1 @@
1
- export { useAutocomplete } from "./useAutocomplete";
1
+ export { useAutocomplete } from "./useAutocomplete.js";
@@ -1,14 +1,3 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "useAutocomplete", {
7
- enumerable: true,
8
- get: function get() {
9
- return _useAutocomplete.useAutocomplete;
10
- }
11
- });
12
- var _useAutocomplete = require("./useAutocomplete");
1
+ export { useAutocomplete } from "./useAutocomplete.js";
13
2
 
14
3
  //# sourceMappingURL=index.js.map