@webiny/app 0.0.0-unstable.e53eceafb5 → 0.0.0-unstable.e6f0dc8ca7

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 (403) hide show
  1. package/App.d.ts +5 -6
  2. package/App.js +26 -32
  3. package/App.js.map +1 -1
  4. package/README.md +7 -15
  5. package/apollo-client/InMemoryCache.js +2 -2
  6. package/apollo-client/InMemoryCache.js.map +1 -1
  7. package/components/Image.d.ts +1 -2
  8. package/components/Image.js +1 -1
  9. package/components/Image.js.map +1 -1
  10. package/components/index.d.ts +1 -2
  11. package/components/index.js +1 -2
  12. package/components/index.js.map +1 -1
  13. package/config/RouterConfig/Route.d.ts +9 -10
  14. package/config/RouterConfig/Route.js +5 -14
  15. package/config/RouterConfig/Route.js.map +1 -1
  16. package/config/RouterConfig.d.ts +10 -11
  17. package/config/RouterConfig.js +1 -1
  18. package/config/RouterConfig.js.map +1 -1
  19. package/contexts/Ui/index.js.map +1 -1
  20. package/core/Plugin.d.ts +1 -1
  21. package/core/Plugin.js +2 -2
  22. package/core/Plugin.js.map +1 -1
  23. package/core/Plugins.d.ts +2 -2
  24. package/core/Plugins.js +5 -4
  25. package/core/Plugins.js.map +1 -1
  26. package/core/Provider.d.ts +1 -1
  27. package/core/Provider.js +1 -1
  28. package/core/Provider.js.map +1 -1
  29. package/core/createProviderPlugin.js +1 -1
  30. package/core/createProviderPlugin.js.map +1 -1
  31. package/errors/AuthenticationErrorEvent.d.ts +9 -0
  32. package/errors/AuthenticationErrorEvent.js +10 -0
  33. package/errors/AuthenticationErrorEvent.js.map +1 -0
  34. package/errors/NetworkErrorEvent.d.ts +15 -0
  35. package/errors/NetworkErrorEvent.js +10 -0
  36. package/errors/NetworkErrorEvent.js.map +1 -0
  37. package/errors/abstractions.d.ts +12 -0
  38. package/errors/abstractions.js +5 -0
  39. package/errors/abstractions.js.map +1 -0
  40. package/errors/index.d.ts +6 -0
  41. package/errors/index.js +6 -0
  42. package/errors/index.js.map +1 -0
  43. package/exports/admin/env-config.d.ts +2 -0
  44. package/exports/admin/env-config.js +4 -0
  45. package/exports/admin/env-config.js.map +1 -0
  46. package/exports/admin/graphql-client.d.ts +1 -0
  47. package/exports/admin/graphql-client.js +3 -0
  48. package/exports/admin/graphql-client.js.map +1 -0
  49. package/exports/admin/local-storage.d.ts +2 -0
  50. package/exports/admin/local-storage.js +4 -0
  51. package/exports/admin/local-storage.js.map +1 -0
  52. package/exports/admin/router.d.ts +5 -0
  53. package/exports/admin/router.js +7 -0
  54. package/exports/admin/router.js.map +1 -0
  55. package/exports/admin/security.d.ts +1 -0
  56. package/exports/admin/security.js +3 -0
  57. package/exports/admin/security.js.map +1 -0
  58. package/exports/admin.d.ts +7 -0
  59. package/exports/admin.js +9 -0
  60. package/exports/admin.js.map +1 -0
  61. package/features/envConfig/EnvConfig.d.ts +7 -0
  62. package/features/envConfig/EnvConfig.js +17 -0
  63. package/features/envConfig/EnvConfig.js.map +1 -0
  64. package/features/envConfig/abstractions.d.ts +28 -0
  65. package/features/envConfig/abstractions.js +4 -0
  66. package/features/envConfig/abstractions.js.map +1 -0
  67. package/features/envConfig/feature.d.ts +17 -0
  68. package/features/envConfig/feature.js +14 -0
  69. package/features/envConfig/feature.js.map +1 -0
  70. package/features/envConfig/index.d.ts +1 -0
  71. package/features/envConfig/index.js +3 -0
  72. package/features/envConfig/index.js.map +1 -0
  73. package/features/eventPublisher/EventPublisher.d.ts +8 -0
  74. package/features/eventPublisher/EventPublisher.js +27 -0
  75. package/features/eventPublisher/EventPublisher.js.map +1 -0
  76. package/features/eventPublisher/abstractions.d.ts +18 -0
  77. package/features/eventPublisher/abstractions.js +14 -0
  78. package/features/eventPublisher/abstractions.js.map +1 -0
  79. package/features/eventPublisher/feature.d.ts +3 -0
  80. package/features/eventPublisher/feature.js +16 -0
  81. package/features/eventPublisher/feature.js.map +1 -0
  82. package/features/eventPublisher/index.d.ts +3 -0
  83. package/features/eventPublisher/index.js +4 -0
  84. package/features/eventPublisher/index.js.map +1 -0
  85. package/features/graphqlClient/AuthenticationErrorPublishing.d.ts +13 -0
  86. package/features/graphqlClient/AuthenticationErrorPublishing.js +35 -0
  87. package/features/graphqlClient/AuthenticationErrorPublishing.js.map +1 -0
  88. package/features/graphqlClient/BatchingGraphQLClient.d.ts +16 -0
  89. package/features/graphqlClient/BatchingGraphQLClient.js +163 -0
  90. package/features/graphqlClient/BatchingGraphQLClient.js.map +1 -0
  91. package/features/graphqlClient/FetchGraphQLClient.d.ts +7 -0
  92. package/features/graphqlClient/FetchGraphQLClient.js +58 -0
  93. package/features/graphqlClient/FetchGraphQLClient.js.map +1 -0
  94. package/features/graphqlClient/NetworkErrorPublishing.d.ts +14 -0
  95. package/features/graphqlClient/NetworkErrorPublishing.js +55 -0
  96. package/features/graphqlClient/NetworkErrorPublishing.js.map +1 -0
  97. package/features/graphqlClient/RequestValue.d.ts +21 -0
  98. package/features/graphqlClient/RequestValue.js +45 -0
  99. package/features/graphqlClient/RequestValue.js.map +1 -0
  100. package/features/graphqlClient/RetryGraphQLClient.d.ts +18 -0
  101. package/features/graphqlClient/RetryGraphQLClient.js +54 -0
  102. package/features/graphqlClient/RetryGraphQLClient.js.map +1 -0
  103. package/features/graphqlClient/__tests__/GraphQLClient.test.d.ts +1 -0
  104. package/features/graphqlClient/__tests__/GraphQLClient.test.js +370 -0
  105. package/features/graphqlClient/__tests__/GraphQLClient.test.js.map +1 -0
  106. package/features/graphqlClient/abstractions.d.ts +18 -0
  107. package/features/graphqlClient/abstractions.js +4 -0
  108. package/features/graphqlClient/abstractions.js.map +1 -0
  109. package/features/graphqlClient/feature.d.ts +6 -0
  110. package/features/graphqlClient/feature.js +31 -0
  111. package/features/graphqlClient/feature.js.map +1 -0
  112. package/features/graphqlClient/index.d.ts +1 -0
  113. package/features/graphqlClient/index.js +3 -0
  114. package/features/graphqlClient/index.js.map +1 -0
  115. package/features/graphqlClient/types.d.ts +5 -0
  116. package/features/graphqlClient/types.js.map +1 -0
  117. package/features/localStorage/BrowserLocalStorageGateway.d.ts +9 -0
  118. package/features/localStorage/BrowserLocalStorageGateway.js +68 -0
  119. package/features/localStorage/BrowserLocalStorageGateway.js.map +1 -0
  120. package/features/localStorage/LocalStorage.d.ts +12 -0
  121. package/features/localStorage/LocalStorage.js +31 -0
  122. package/features/localStorage/LocalStorage.js.map +1 -0
  123. package/features/localStorage/LocalStorageRepository.d.ts +20 -0
  124. package/features/localStorage/LocalStorageRepository.js +95 -0
  125. package/features/localStorage/LocalStorageRepository.js.map +1 -0
  126. package/features/localStorage/abstractions.d.ts +48 -0
  127. package/features/localStorage/abstractions.js +19 -0
  128. package/features/localStorage/abstractions.js.map +1 -0
  129. package/features/localStorage/feature.d.ts +12 -0
  130. package/features/localStorage/feature.js +34 -0
  131. package/features/localStorage/feature.js.map +1 -0
  132. package/features/localStorage/index.d.ts +1 -0
  133. package/features/localStorage/index.js +3 -0
  134. package/features/localStorage/index.js.map +1 -0
  135. package/features/mainGraphQLClient/MainGraphQLClient.d.ts +11 -0
  136. package/features/mainGraphQLClient/MainGraphQLClient.js +23 -0
  137. package/features/mainGraphQLClient/MainGraphQLClient.js.map +1 -0
  138. package/features/mainGraphQLClient/abstractions.d.ts +17 -0
  139. package/features/mainGraphQLClient/abstractions.js +4 -0
  140. package/features/mainGraphQLClient/abstractions.js.map +1 -0
  141. package/features/mainGraphQLClient/feature.d.ts +3 -0
  142. package/features/mainGraphQLClient/feature.js +16 -0
  143. package/features/mainGraphQLClient/feature.js.map +1 -0
  144. package/features/mainGraphQLClient/index.d.ts +1 -0
  145. package/features/mainGraphQLClient/index.js +3 -0
  146. package/features/mainGraphQLClient/index.js.map +1 -0
  147. package/features/router/HistoryRouterGateway.d.ts +22 -0
  148. package/features/router/HistoryRouterGateway.js +118 -0
  149. package/features/router/HistoryRouterGateway.js.map +1 -0
  150. package/features/router/HistoryRouterGateway.test.d.ts +1 -0
  151. package/features/router/HistoryRouterGateway.test.js +204 -0
  152. package/features/router/HistoryRouterGateway.test.js.map +1 -0
  153. package/features/router/Route.d.ts +19 -0
  154. package/features/router/Route.js +59 -0
  155. package/features/router/Route.js.map +1 -0
  156. package/features/router/RouteUrl.d.ts +85 -0
  157. package/features/router/RouteUrl.js +232 -0
  158. package/features/router/RouteUrl.js.map +1 -0
  159. package/features/router/Router.d.ts +45 -0
  160. package/features/router/Router.js +129 -0
  161. package/features/router/Router.js.map +1 -0
  162. package/features/router/RouterPresenter.d.ts +21 -0
  163. package/features/router/RouterPresenter.js +57 -0
  164. package/features/router/RouterPresenter.js.map +1 -0
  165. package/features/router/RouterRepository.d.ts +30 -0
  166. package/features/router/RouterRepository.js +125 -0
  167. package/features/router/RouterRepository.js.map +1 -0
  168. package/features/router/RouterRepository.test.d.ts +1 -0
  169. package/features/router/RouterRepository.test.js +169 -0
  170. package/features/router/RouterRepository.test.js.map +1 -0
  171. package/features/router/abstractions.d.ts +81 -0
  172. package/features/router/abstractions.js +17 -0
  173. package/features/router/abstractions.js.map +1 -0
  174. package/features/router/feature.d.ts +4 -0
  175. package/features/router/feature.js +18 -0
  176. package/features/router/feature.js.map +1 -0
  177. package/features/router/index.d.ts +2 -0
  178. package/features/router/index.js +3 -0
  179. package/features/router/index.js.map +1 -0
  180. package/helpers/InterfaceGenerator/date.d.ts +15 -0
  181. package/helpers/InterfaceGenerator/date.js +3 -0
  182. package/helpers/InterfaceGenerator/date.js.map +1 -0
  183. package/helpers/InterfaceGenerator/id.d.ts +23 -0
  184. package/helpers/InterfaceGenerator/id.js +3 -0
  185. package/helpers/InterfaceGenerator/id.js.map +1 -0
  186. package/helpers/InterfaceGenerator/identity.d.ts +10 -0
  187. package/helpers/InterfaceGenerator/identity.js +3 -0
  188. package/helpers/InterfaceGenerator/identity.js.map +1 -0
  189. package/helpers/InterfaceGenerator/index.d.ts +5 -0
  190. package/helpers/InterfaceGenerator/index.js +3 -0
  191. package/helpers/InterfaceGenerator/index.js.map +1 -0
  192. package/helpers/InterfaceGenerator/numeric.d.ts +12 -0
  193. package/helpers/InterfaceGenerator/numeric.js +3 -0
  194. package/helpers/InterfaceGenerator/numeric.js.map +1 -0
  195. package/helpers/InterfaceGenerator/truthful.d.ts +7 -0
  196. package/helpers/InterfaceGenerator/truthful.js +3 -0
  197. package/helpers/InterfaceGenerator/truthful.js.map +1 -0
  198. package/hooks/useAutocomplete/index.d.ts +1 -1
  199. package/hooks/useAutocomplete/index.js +1 -1
  200. package/hooks/useAutocomplete/index.js.map +1 -1
  201. package/hooks/useAutocomplete/useAutocomplete.js +3 -6
  202. package/hooks/useAutocomplete/useAutocomplete.js.map +1 -1
  203. package/hooks/useDataList/functions/getData.js +1 -1
  204. package/hooks/useDataList/functions/getData.js.map +1 -1
  205. package/hooks/useDataList/functions/getError.js +1 -1
  206. package/hooks/useDataList/functions/getError.js.map +1 -1
  207. package/hooks/useDataList/functions/getMeta.js +1 -1
  208. package/hooks/useDataList/functions/getMeta.js.map +1 -1
  209. package/hooks/useDataList/functions/index.d.ts +3 -3
  210. package/hooks/useDataList/functions/index.js +3 -3
  211. package/hooks/useDataList/functions/index.js.map +1 -1
  212. package/hooks/useDataList/index.d.ts +1 -1
  213. package/hooks/useDataList/index.js +1 -1
  214. package/hooks/useDataList/index.js.map +1 -1
  215. package/hooks/useDataList/useDataList.d.ts +0 -1
  216. package/hooks/useDataList/useDataList.js +6 -26
  217. package/hooks/useDataList/useDataList.js.map +1 -1
  218. package/hooks/useDataList/utils/index.d.ts +1 -2
  219. package/hooks/useDataList/utils/index.js +1 -2
  220. package/hooks/useDataList/utils/index.js.map +1 -1
  221. package/hooks/useDataList/utils/prepareLoadListParams.js +1 -1
  222. package/hooks/useDataList/utils/prepareLoadListParams.js.map +1 -1
  223. package/hooks/useHandlers.js.map +1 -1
  224. package/hooks/useRegisterLegacyPlugin.d.ts +1 -1
  225. package/hooks/useRegisterLegacyPlugin.js.map +1 -1
  226. package/hooks/useUi.d.ts +1 -1
  227. package/hooks/useUi.js +1 -1
  228. package/hooks/useUi.js.map +1 -1
  229. package/i18n/index.d.ts +1 -1
  230. package/i18n/index.js +1 -1
  231. package/i18n/index.js.map +1 -1
  232. package/index.d.ts +23 -15
  233. package/index.js +22 -14
  234. package/index.js.map +1 -1
  235. package/package.json +33 -28
  236. package/plugins/AddQuerySelectionPlugin.d.ts +1 -1
  237. package/plugins/AddQuerySelectionPlugin.js +1 -1
  238. package/plugins/AddQuerySelectionPlugin.js.map +1 -1
  239. package/plugins/ApolloDynamicLink.d.ts +1 -1
  240. package/plugins/ApolloDynamicLink.js.map +1 -1
  241. package/plugins/ConsoleLinkPlugin.d.ts +1 -1
  242. package/plugins/ConsoleLinkPlugin.js +1 -1
  243. package/plugins/ConsoleLinkPlugin.js.map +1 -1
  244. package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.d.ts +8 -13
  245. package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.js +15 -26
  246. package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.js.map +1 -1
  247. package/plugins/NetworkErrorLinkPlugin/GqlErrorOverlay.d.ts +14 -0
  248. package/plugins/NetworkErrorLinkPlugin/GqlErrorOverlay.js +31 -0
  249. package/plugins/NetworkErrorLinkPlugin/GqlErrorOverlay.js.map +1 -0
  250. package/plugins/NetworkErrorLinkPlugin/LocalAwsLambdaTimeoutMessage.d.ts +2 -0
  251. package/plugins/NetworkErrorLinkPlugin/LocalAwsLambdaTimeoutMessage.js +31 -0
  252. package/plugins/NetworkErrorLinkPlugin/LocalAwsLambdaTimeoutMessage.js.map +1 -0
  253. package/plugins/NetworkErrorLinkPlugin/StyledComponents.d.ts +4 -5
  254. package/plugins/NetworkErrorLinkPlugin/StyledComponents.js +3 -3
  255. package/plugins/NetworkErrorLinkPlugin/StyledComponents.js.map +1 -1
  256. package/plugins/NetworkErrorLinkPlugin/Typography.d.ts +8 -0
  257. package/plugins/NetworkErrorLinkPlugin/Typography.js +18 -0
  258. package/plugins/NetworkErrorLinkPlugin/Typography.js.map +1 -0
  259. package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.d.ts +3 -3
  260. package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.js +4 -13
  261. package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.js.map +1 -1
  262. package/plugins/NetworkErrorLinkPlugin.d.ts +4 -1
  263. package/plugins/NetworkErrorLinkPlugin.js +47 -7
  264. package/plugins/NetworkErrorLinkPlugin.js.map +1 -1
  265. package/plugins/OmitTypenameLinkPlugin.d.ts +1 -1
  266. package/plugins/OmitTypenameLinkPlugin.js +1 -1
  267. package/plugins/OmitTypenameLinkPlugin.js.map +1 -1
  268. package/plugins/TenantHeaderLinkPlugin.d.ts +2 -2
  269. package/plugins/TenantHeaderLinkPlugin.js +2 -4
  270. package/plugins/TenantHeaderLinkPlugin.js.map +1 -1
  271. package/plugins/components/Image.d.ts +6 -0
  272. package/plugins/components/Image.js +19 -0
  273. package/plugins/components/Image.js.map +1 -0
  274. package/plugins/image.d.ts +1 -1
  275. package/plugins/image.js +2 -2
  276. package/plugins/image.js.map +1 -1
  277. package/plugins/index.d.ts +3 -3
  278. package/plugins/index.js +1 -1
  279. package/plugins/index.js.map +1 -1
  280. package/presentation/envConfig/useEnvConfig.d.ts +6 -0
  281. package/presentation/envConfig/useEnvConfig.js +13 -0
  282. package/presentation/envConfig/useEnvConfig.js.map +1 -0
  283. package/presentation/localStorage/index.d.ts +3 -0
  284. package/presentation/localStorage/index.js +5 -0
  285. package/presentation/localStorage/index.js.map +1 -0
  286. package/presentation/localStorage/useLocalStorage.d.ts +6 -0
  287. package/presentation/localStorage/useLocalStorage.js +21 -0
  288. package/presentation/localStorage/useLocalStorage.js.map +1 -0
  289. package/presentation/localStorage/useLocalStorageValue.d.ts +1 -0
  290. package/presentation/localStorage/useLocalStorageValue.js +20 -0
  291. package/presentation/localStorage/useLocalStorageValue.js.map +1 -0
  292. package/presentation/localStorage/useLocalStorageValues.d.ts +5 -0
  293. package/presentation/localStorage/useLocalStorageValues.js +39 -0
  294. package/presentation/localStorage/useLocalStorageValues.js.map +1 -0
  295. package/presentation/router/RouteElementRegistry.d.ts +14 -0
  296. package/presentation/router/RouteElementRegistry.js +32 -0
  297. package/presentation/router/RouteElementRegistry.js.map +1 -0
  298. package/presentation/router/abstractions.d.ts +13 -0
  299. package/presentation/router/abstractions.js +4 -0
  300. package/presentation/router/abstractions.js.map +1 -0
  301. package/presentation/router/components/Redirect.d.ts +14 -0
  302. package/presentation/router/components/Redirect.js +15 -0
  303. package/presentation/router/components/Redirect.js.map +1 -0
  304. package/presentation/router/components/RouteContent.d.ts +2 -0
  305. package/presentation/router/components/RouteContent.js +23 -0
  306. package/presentation/router/components/RouteContent.js.map +1 -0
  307. package/presentation/router/components/RouteLink.d.ts +50 -0
  308. package/presentation/router/components/RouteLink.js +22 -0
  309. package/presentation/router/components/RouteLink.js.map +1 -0
  310. package/presentation/router/components/SimpleLink.d.ts +44 -0
  311. package/presentation/router/components/SimpleLink.js +30 -0
  312. package/presentation/router/components/SimpleLink.js.map +1 -0
  313. package/presentation/router/hooks/useRoute.d.ts +6 -0
  314. package/presentation/router/hooks/useRoute.js +30 -0
  315. package/presentation/router/hooks/useRoute.js.map +1 -0
  316. package/presentation/router/hooks/useRouter.d.ts +11 -0
  317. package/presentation/router/hooks/useRouter.js +30 -0
  318. package/presentation/router/hooks/useRouter.js.map +1 -0
  319. package/presentation/router/index.d.ts +4 -0
  320. package/presentation/router/index.js +5 -0
  321. package/presentation/router/index.js.map +1 -0
  322. package/presentation/router/types.d.ts +5 -0
  323. package/presentation/router/types.js +3 -0
  324. package/presentation/router/types.js.map +1 -0
  325. package/react-butterfiles/Files.js +3 -3
  326. package/react-butterfiles/Files.js.map +1 -1
  327. package/react-butterfiles/file.todo +1 -0
  328. package/react-butterfiles/index.d.ts +1 -1
  329. package/react-butterfiles/index.js +1 -1
  330. package/react-butterfiles/index.js.map +1 -1
  331. package/renderApp.d.ts +1 -1
  332. package/renderApp.js.map +1 -1
  333. package/router.d.ts +5 -0
  334. package/router.js +8 -0
  335. package/router.js.map +1 -0
  336. package/shared/di/DiContainerProvider.d.ts +8 -0
  337. package/shared/di/DiContainerProvider.js +17 -0
  338. package/shared/di/DiContainerProvider.js.map +1 -0
  339. package/shared/di/createFeature.d.ts +11 -0
  340. package/shared/di/createFeature.js +11 -0
  341. package/shared/di/createFeature.js.map +1 -0
  342. package/shared/di/useFeature.d.ts +2 -0
  343. package/shared/di/useFeature.js +8 -0
  344. package/shared/di/useFeature.js.map +1 -0
  345. package/types.d.ts +7 -4
  346. package/types.js +1 -12
  347. package/types.js.map +1 -1
  348. package/utils/index.d.ts +2 -10
  349. package/utils/index.js +2 -10
  350. package/utils/index.js.map +1 -1
  351. package/utils/legacyPluginToReactComponent.js +1 -1
  352. package/utils/legacyPluginToReactComponent.js.map +1 -1
  353. package/components/Routes.d.ts +0 -2
  354. package/components/Routes.js +0 -36
  355. package/components/Routes.js.map +0 -1
  356. package/components/View.d.ts +0 -8
  357. package/components/View.js +0 -19
  358. package/components/View.js.map +0 -1
  359. package/core/DebounceRender.d.ts +0 -12
  360. package/core/DebounceRender.js +0 -31
  361. package/core/DebounceRender.js.map +0 -1
  362. package/core/Routes.d.ts +0 -6
  363. package/core/Routes.js +0 -34
  364. package/core/Routes.js.map +0 -1
  365. package/hooks/useDataList/utils/redirectToRouteWithQueryParams.d.ts +0 -14
  366. package/hooks/useDataList/utils/redirectToRouteWithQueryParams.js +0 -26
  367. package/hooks/useDataList/utils/redirectToRouteWithQueryParams.js.map +0 -1
  368. package/hooks/useDataList/utils/types.d.ts +0 -40
  369. package/hooks/useDataList/utils/types.js.map +0 -1
  370. package/plugins/LocaleHeaderLinkPlugin.d.ts +0 -10
  371. package/plugins/LocaleHeaderLinkPlugin.js +0 -32
  372. package/plugins/LocaleHeaderLinkPlugin.js.map +0 -1
  373. package/plugins/RoutePlugin.d.ts +0 -12
  374. package/plugins/RoutePlugin.js +0 -16
  375. package/plugins/RoutePlugin.js.map +0 -1
  376. package/plugins/ViewPlugin.d.ts +0 -14
  377. package/plugins/ViewPlugin.js +0 -19
  378. package/plugins/ViewPlugin.js.map +0 -1
  379. package/utils/getApiUrl.d.ts +0 -1
  380. package/utils/getApiUrl.js +0 -5
  381. package/utils/getApiUrl.js.map +0 -1
  382. package/utils/getGqlApiUrl.d.ts +0 -1
  383. package/utils/getGqlApiUrl.js +0 -6
  384. package/utils/getGqlApiUrl.js.map +0 -1
  385. package/utils/getHeadlessCmsGqlApiUrl.d.ts +0 -5
  386. package/utils/getHeadlessCmsGqlApiUrl.js +0 -12
  387. package/utils/getHeadlessCmsGqlApiUrl.js.map +0 -1
  388. package/utils/getLocaleCode.d.ts +0 -6
  389. package/utils/getLocaleCode.js +0 -33
  390. package/utils/getLocaleCode.js.map +0 -1
  391. package/utils/getPrerenderId.d.ts +0 -6
  392. package/utils/getPrerenderId.js +0 -5
  393. package/utils/getPrerenderId.js.map +0 -1
  394. package/utils/getTenantId.d.ts +0 -6
  395. package/utils/getTenantId.js +0 -45
  396. package/utils/getTenantId.js.map +0 -1
  397. package/utils/isLocalhost.d.ts +0 -1
  398. package/utils/isLocalhost.js +0 -7
  399. package/utils/isLocalhost.js.map +0 -1
  400. package/utils/isPrerendering.d.ts +0 -1
  401. package/utils/isPrerendering.js +0 -5
  402. package/utils/isPrerendering.js.map +0 -1
  403. /package/{hooks/useDataList/utils → features/graphqlClient}/types.js +0 -0
@@ -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","onBlocked","fn","addGuard","guard","toHaveBeenCalledTimes","confirmTransition","dispose","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(\"transition guard should block route transition\", async () => {\n const { repository, history } = createRepository();\n history.push(\"/login\");\n await wait();\n\n // This guard should prevent the transition.\n const onBlocked = vi.fn();\n repository.addGuard({\n guard: () => true,\n onBlocked\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 expect(onBlocked).toHaveBeenCalledTimes(1);\n });\n\n it(\"transition guard should allow route transition when guard returns false\", async () => {\n const { repository, history } = createRepository();\n history.push(\"/login\");\n await wait();\n\n repository.addGuard({\n guard: () => false,\n onBlocked: vi.fn()\n });\n\n // Trigger a history location change.\n history.push(\"/users/123\");\n await wait();\n\n expect(repository.getMatchedRoute()).toEqual(userRoute(\"123\"));\n });\n\n it(\"confirmTransition should allow a blocked transition to proceed\", async () => {\n const { repository, history } = createRepository();\n history.push(\"/login\");\n await wait();\n\n repository.addGuard({\n guard: () => true,\n onBlocked: () => {\n repository.confirmTransition();\n }\n });\n\n history.push(\"/users/123\");\n await wait();\n\n expect(repository.getMatchedRoute()).toEqual(userRoute(\"123\"));\n });\n\n it(\"guard disposer should remove the guard\", async () => {\n const { repository, history } = createRepository();\n history.push(\"/login\");\n await wait();\n\n const dispose = repository.addGuard({\n guard: () => true,\n onBlocked: vi.fn()\n });\n\n // Remove the guard.\n dispose();\n\n // Transition should now pass through.\n history.push(\"/users/123\");\n await wait();\n\n expect(repository.getMatchedRoute()).toEqual(userRoute(\"123\"));\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,EAA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AI,CAAC,CAAC,CAAC,CAACgB,OAAO,CAAC,UAAU,CAAC;EAC7E,CAAC,CAAC;AACN,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,81 @@
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
+ addTransitionGuard(config: RouteTransitionGuardConfig): GuardDisposer;
16
+ isTransitionBlocked(): boolean;
17
+ unblockTransition(): void;
18
+ confirmTransition(): void;
19
+ cancelTransition(): void;
20
+ destroy(): void;
21
+ }
22
+ export declare const RouterPresenter: Abstraction<IRouterPresenter>;
23
+ export declare namespace RouterPresenter {
24
+ type Interface = IRouterPresenter;
25
+ }
26
+ /***** Repository *****/
27
+ export interface MatchedRoute<TParams = Record<string, any>> {
28
+ name: string;
29
+ pathname: string;
30
+ path: string;
31
+ params: TParams;
32
+ }
33
+ export interface IRouterRepository {
34
+ getMatchedRoute(): MatchedRoute | undefined;
35
+ getCurrentRoute(): Route<any> | undefined;
36
+ goToRoute<TParams extends RouteParamsDefinition | undefined>(route: Route<TParams>, params: TParams extends RouteParamsDefinition ? RouteParamsInfer<TParams> : undefined): void;
37
+ getLink<TParams extends RouteParamsDefinition | undefined>(route: Route<TParams>, params: TParams extends RouteParamsDefinition ? RouteParamsInfer<TParams> : undefined): string;
38
+ registerRoutes(routes: Route[]): void;
39
+ addGuard(config: RouteTransitionGuardConfig): GuardDisposer;
40
+ isBlocked(): boolean;
41
+ unblock(): void;
42
+ confirmTransition(): void;
43
+ cancelTransition(): void;
44
+ destroy(): void;
45
+ }
46
+ export declare const RouterRepository: Abstraction<IRouterRepository>;
47
+ export declare namespace RouterRepository {
48
+ type Interface = IRouterRepository;
49
+ }
50
+ /***** Gateway *****/
51
+ export interface RouteDefinition {
52
+ name: string;
53
+ path: string;
54
+ onMatch(route: MatchedRoute): void;
55
+ }
56
+ export type TransitionController = {
57
+ continue: () => void;
58
+ cancel: () => void;
59
+ };
60
+ interface IRouterGateway {
61
+ setRoutes(routes: RouteDefinition[]): void;
62
+ goToRoute(name: string, params?: {
63
+ [k: string]: any;
64
+ }): void;
65
+ pushState(url: string): void;
66
+ addGuard(config: RouteTransitionGuardConfig): GuardDisposer;
67
+ destroy(): void;
68
+ }
69
+ export declare const RouterGateway: Abstraction<IRouterGateway>;
70
+ export declare namespace RouterGateway {
71
+ type Interface = IRouterGateway;
72
+ }
73
+ /***** Route Transition *****/
74
+ export type GuardDisposer = () => void;
75
+ export interface RouteTransitionGuardConfig {
76
+ /** Return true to block the transition. */
77
+ guard: () => boolean;
78
+ /** Called when this guard blocks a transition. Show a confirmation dialog here. */
79
+ onBlocked: (controller: TransitionController) => void;
80
+ }
81
+ export {};
@@ -0,0 +1,17 @@
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
+ /***** Route Transition *****/
16
+
17
+ //# 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 addTransitionGuard(config: RouteTransitionGuardConfig): GuardDisposer;\n isTransitionBlocked(): boolean;\n unblockTransition(): void;\n confirmTransition(): void;\n cancelTransition(): 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\nexport interface IRouterRepository {\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 addGuard(config: RouteTransitionGuardConfig): GuardDisposer;\n isBlocked(): boolean;\n unblock(): void;\n confirmTransition(): void;\n cancelTransition(): 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\ninterface IRouterGateway {\n setRoutes(routes: RouteDefinition[]): void;\n goToRoute(name: string, params?: { [k: string]: any }): void;\n pushState(url: string): void;\n addGuard(config: RouteTransitionGuardConfig): GuardDisposer;\n destroy(): void;\n}\n\nexport const RouterGateway = new Abstraction<IRouterGateway>(\"RouterGateway\");\n\nexport namespace RouterGateway {\n export type Interface = IRouterGateway;\n}\n\n/***** Route Transition *****/\n\nexport type GuardDisposer = () => void;\n\nexport interface RouteTransitionGuardConfig {\n /** Return true to block the transition. */\n guard: () => boolean;\n /** Called when this guard blocks a transition. Show a confirmation dialog here. */\n onBlocked: (controller: TransitionController) => void;\n}\n"],"mappings":"AAAA,SAASA,WAAW,QAAQ,YAAY;;AAIxC;;AAgCA,OAAO,MAAMC,eAAe,GAAG,IAAID,WAAW,CAAmB,iBAAiB,CAAC;;AAMnF;;AAuCA,OAAO,MAAME,gBAAgB,GAAG,IAAIF,WAAW,CAAoB,kBAAkB,CAAC;;AAMtF;;AAqBA,OAAO,MAAMG,aAAa,GAAG,IAAIH,WAAW,CAAiB,eAAe,CAAC;;AAM7E","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,2 @@
1
+ export { RouterPresenter, RouterGateway } from "./abstractions.js";
2
+ export type { RouteTransitionGuardConfig, GuardDisposer, TransitionController } 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\";\nexport type {\n RouteTransitionGuardConfig,\n GuardDisposer,\n TransitionController\n} 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,3 +1,3 @@
1
- export { useAutocomplete } from "./useAutocomplete";
1
+ export { useAutocomplete } from "./useAutocomplete.js";
2
2
 
3
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["useAutocomplete"],"sources":["index.ts"],"sourcesContent":["export { useAutocomplete } from \"./useAutocomplete\";\n"],"mappings":"AAAA,SAASA,eAAe","ignoreList":[]}
1
+ {"version":3,"names":["useAutocomplete"],"sources":["index.ts"],"sourcesContent":["export { useAutocomplete } from \"./useAutocomplete.js\";\n"],"mappings":"AAAA,SAASA,eAAe","ignoreList":[]}
@@ -1,10 +1,7 @@
1
- import { useDataList } from "../useDataList";
2
- import debounce from "lodash/debounce";
1
+ import { useDataList } from "../useDataList/index.js";
2
+ import debounce from "lodash/debounce.js";
3
3
  export const useAutocomplete = props => {
4
- const dataList = useDataList({
5
- useRouter: false,
6
- ...props
7
- });
4
+ const dataList = useDataList(props);
8
5
  return {
9
6
  options: dataList.data || [],
10
7
  onInput: debounce(query => {
@@ -1 +1 @@
1
- {"version":3,"names":["useDataList","debounce","useAutocomplete","props","dataList","useRouter","options","data","onInput","query","search","setSearch"],"sources":["useAutocomplete.ts"],"sourcesContent":["import { useDataList } from \"../useDataList\";\nimport debounce from \"lodash/debounce\";\nimport type { DocumentNode } from \"graphql\";\n\ninterface UseAutocompleteHook {\n options: any[];\n onInput(value: string): void;\n}\n\ninterface Props {\n query: DocumentNode;\n search?: string | ((value: string) => string);\n}\n\nexport const useAutocomplete = (props: Props): UseAutocompleteHook => {\n const dataList = useDataList({ useRouter: false, ...props });\n\n return {\n options: dataList.data || [],\n onInput: debounce(query => {\n if (!query) {\n return;\n }\n\n let search = props.search || query;\n if (typeof search === \"function\") {\n search = search(query);\n }\n\n dataList.setSearch(search);\n }, 250)\n };\n};\n"],"mappings":"AAAA,SAASA,WAAW;AACpB,OAAOC,QAAQ,MAAM,iBAAiB;AAatC,OAAO,MAAMC,eAAe,GAAIC,KAAY,IAA0B;EAClE,MAAMC,QAAQ,GAAGJ,WAAW,CAAC;IAAEK,SAAS,EAAE,KAAK;IAAE,GAAGF;EAAM,CAAC,CAAC;EAE5D,OAAO;IACHG,OAAO,EAAEF,QAAQ,CAACG,IAAI,IAAI,EAAE;IAC5BC,OAAO,EAAEP,QAAQ,CAACQ,KAAK,IAAI;MACvB,IAAI,CAACA,KAAK,EAAE;QACR;MACJ;MAEA,IAAIC,MAAM,GAAGP,KAAK,CAACO,MAAM,IAAID,KAAK;MAClC,IAAI,OAAOC,MAAM,KAAK,UAAU,EAAE;QAC9BA,MAAM,GAAGA,MAAM,CAACD,KAAK,CAAC;MAC1B;MAEAL,QAAQ,CAACO,SAAS,CAACD,MAAM,CAAC;IAC9B,CAAC,EAAE,GAAG;EACV,CAAC;AACL,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["useDataList","debounce","useAutocomplete","props","dataList","options","data","onInput","query","search","setSearch"],"sources":["useAutocomplete.ts"],"sourcesContent":["import { useDataList } from \"../useDataList/index.js\";\nimport debounce from \"lodash/debounce.js\";\nimport type { DocumentNode } from \"graphql\";\n\ninterface UseAutocompleteHook {\n options: any[];\n onInput(value: string): void;\n}\n\ninterface Props {\n query: DocumentNode;\n search?: string | ((value: string) => string);\n}\n\nexport const useAutocomplete = (props: Props): UseAutocompleteHook => {\n const dataList = useDataList(props);\n\n return {\n options: dataList.data || [],\n onInput: debounce(query => {\n if (!query) {\n return;\n }\n\n let search = props.search || query;\n if (typeof search === \"function\") {\n search = search(query);\n }\n\n dataList.setSearch(search);\n }, 250)\n };\n};\n"],"mappings":"AAAA,SAASA,WAAW;AACpB,OAAOC,QAAQ,MAAM,oBAAoB;AAazC,OAAO,MAAMC,eAAe,GAAIC,KAAY,IAA0B;EAClE,MAAMC,QAAQ,GAAGJ,WAAW,CAACG,KAAK,CAAC;EAEnC,OAAO;IACHE,OAAO,EAAED,QAAQ,CAACE,IAAI,IAAI,EAAE;IAC5BC,OAAO,EAAEN,QAAQ,CAACO,KAAK,IAAI;MACvB,IAAI,CAACA,KAAK,EAAE;QACR;MACJ;MAEA,IAAIC,MAAM,GAAGN,KAAK,CAACM,MAAM,IAAID,KAAK;MAClC,IAAI,OAAOC,MAAM,KAAK,UAAU,EAAE;QAC9BA,MAAM,GAAGA,MAAM,CAACD,KAAK,CAAC;MAC1B;MAEAJ,QAAQ,CAACM,SAAS,CAACD,MAAM,CAAC;IAC9B,CAAC,EAAE,GAAG;EACV,CAAC;AACL,CAAC","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- import searchDataByKey from "./searchDataByKey";
1
+ import searchDataByKey from "./searchDataByKey.js";
2
2
  export default response => searchDataByKey("data", response);
3
3
 
4
4
  //# sourceMappingURL=getData.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["searchDataByKey","response"],"sources":["getData.ts"],"sourcesContent":["import searchDataByKey from \"./searchDataByKey\";\n\nexport default (response: Record<string, string>) => searchDataByKey(\"data\", response);\n"],"mappings":"AAAA,OAAOA,eAAe;AAEtB,eAAgBC,QAAgC,IAAKD,eAAe,CAAC,MAAM,EAAEC,QAAQ,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["searchDataByKey","response"],"sources":["getData.ts"],"sourcesContent":["import searchDataByKey from \"./searchDataByKey.js\";\n\nexport default (response: Record<string, string>) => searchDataByKey(\"data\", response);\n"],"mappings":"AAAA,OAAOA,eAAe;AAEtB,eAAgBC,QAAgC,IAAKD,eAAe,CAAC,MAAM,EAAEC,QAAQ,CAAC","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- import searchDataByKey from "./searchDataByKey";
1
+ import searchDataByKey from "./searchDataByKey.js";
2
2
  export default response => searchDataByKey("error", response);
3
3
 
4
4
  //# sourceMappingURL=getError.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["searchDataByKey","response"],"sources":["getError.ts"],"sourcesContent":["import searchDataByKey from \"./searchDataByKey\";\n\nexport default (response: Record<string, string>) => searchDataByKey(\"error\", response);\n"],"mappings":"AAAA,OAAOA,eAAe;AAEtB,eAAgBC,QAAgC,IAAKD,eAAe,CAAC,OAAO,EAAEC,QAAQ,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["searchDataByKey","response"],"sources":["getError.ts"],"sourcesContent":["import searchDataByKey from \"./searchDataByKey.js\";\n\nexport default (response: Record<string, string>) => searchDataByKey(\"error\", response);\n"],"mappings":"AAAA,OAAOA,eAAe;AAEtB,eAAgBC,QAAgC,IAAKD,eAAe,CAAC,OAAO,EAAEC,QAAQ,CAAC","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- import searchDataByKey from "./searchDataByKey";
1
+ import searchDataByKey from "./searchDataByKey.js";
2
2
  export default response => searchDataByKey("meta", response);
3
3
 
4
4
  //# sourceMappingURL=getMeta.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["searchDataByKey","response"],"sources":["getMeta.ts"],"sourcesContent":["import searchDataByKey from \"./searchDataByKey\";\n\nexport default (response: Record<string, string>) => searchDataByKey(\"meta\", response);\n"],"mappings":"AAAA,OAAOA,eAAe;AAEtB,eAAgBC,QAAgC,IAAKD,eAAe,CAAC,MAAM,EAAEC,QAAQ,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["searchDataByKey","response"],"sources":["getMeta.ts"],"sourcesContent":["import searchDataByKey from \"./searchDataByKey.js\";\n\nexport default (response: Record<string, string>) => searchDataByKey(\"meta\", response);\n"],"mappings":"AAAA,OAAOA,eAAe;AAEtB,eAAgBC,QAAgC,IAAKD,eAAe,CAAC,MAAM,EAAEC,QAAQ,CAAC","ignoreList":[]}
@@ -1,3 +1,3 @@
1
- export { default as getData } from "./getData";
2
- export { default as getError } from "./getError";
3
- export { default as getMeta } from "./getMeta";
1
+ export { default as getData } from "./getData.js";
2
+ export { default as getError } from "./getError.js";
3
+ export { default as getMeta } from "./getMeta.js";
@@ -1,5 +1,5 @@
1
- export { default as getData } from "./getData";
2
- export { default as getError } from "./getError";
3
- export { default as getMeta } from "./getMeta";
1
+ export { default as getData } from "./getData.js";
2
+ export { default as getError } from "./getError.js";
3
+ export { default as getMeta } from "./getMeta.js";
4
4
 
5
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["default","getData","getError","getMeta"],"sources":["index.ts"],"sourcesContent":["export { default as getData } from \"./getData\";\nexport { default as getError } from \"./getError\";\nexport { default as getMeta } from \"./getMeta\";\n"],"mappings":"AAAA,SAASA,OAAO,IAAIC,OAAO;AAC3B,SAASD,OAAO,IAAIE,QAAQ;AAC5B,SAASF,OAAO,IAAIG,OAAO","ignoreList":[]}
1
+ {"version":3,"names":["default","getData","getError","getMeta"],"sources":["index.ts"],"sourcesContent":["export { default as getData } from \"./getData.js\";\nexport { default as getError } from \"./getError.js\";\nexport { default as getMeta } from \"./getMeta.js\";\n"],"mappings":"AAAA,SAASA,OAAO,IAAIC,OAAO;AAC3B,SAASD,OAAO,IAAIE,QAAQ;AAC5B,SAASF,OAAO,IAAIG,OAAO","ignoreList":[]}
@@ -1 +1 @@
1
- export { useDataList } from "./useDataList";
1
+ export { useDataList } from "./useDataList.js";
@@ -1,3 +1,3 @@
1
- export { useDataList } from "./useDataList";
1
+ export { useDataList } from "./useDataList.js";
2
2
 
3
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["useDataList"],"sources":["index.ts"],"sourcesContent":["export { useDataList } from \"./useDataList\";\n"],"mappings":"AAAA,SAASA,WAAW","ignoreList":[]}
1
+ {"version":3,"names":["useDataList"],"sources":["index.ts"],"sourcesContent":["export { useDataList } from \"./useDataList.js\";\n"],"mappings":"AAAA,SAASA,WAAW","ignoreList":[]}
@@ -1,7 +1,6 @@
1
1
  import type { DocumentNode } from "graphql";
2
2
  import type { ApolloClient } from "apollo-client";
3
3
  export interface UseDataListParams {
4
- useRouter?: boolean;
5
4
  variables?: ((params: UseDataListParams) => any) | object;
6
5
  client?: ApolloClient<any>;
7
6
  query: DocumentNode;
@@ -1,22 +1,11 @@
1
- import { useState, useEffect, useRef, useCallback } from "react";
1
+ import { useCallback, useEffect, useRef, useState } from "react";
2
2
  import { useQuery } from "@apollo/react-hooks";
3
- import { useRouter } from "@webiny/react-router";
4
- import get from "lodash/get";
5
- import isEqual from "lodash/isEqual";
6
- import { prepareLoadListParams } from "./utils";
7
- import { getData, getError, getMeta } from "./functions";
3
+ import get from "lodash/get.js";
4
+ import isEqual from "lodash/isEqual.js";
5
+ import { prepareLoadListParams } from "./utils/index.js";
6
+ import { getData, getError, getMeta } from "./functions/index.js";
8
7
  const useDataList = params => {
9
8
  const [multiSelectedItems, multiSelect] = useState([]);
10
- let history = null;
11
- /**
12
- * TODO: figure out the location type.
13
- */
14
- let location = null;
15
- const routerHook = useRouter();
16
- if (params.useRouter !== false) {
17
- history = routerHook.history;
18
- location = routerHook.location;
19
- }
20
9
  const getQueryOptions = useCallback(() => {
21
10
  let variables = params.variables;
22
11
  if (typeof variables === "function") {
@@ -26,7 +15,7 @@ const useDataList = params => {
26
15
  client: params.client,
27
16
  variables: {
28
17
  ...variables,
29
- ...prepareLoadListParams(location)
18
+ ...prepareLoadListParams()
30
19
  }
31
20
  };
32
21
  }, []);
@@ -47,12 +36,6 @@ const useDataList = params => {
47
36
  queryData.refetch(dataListProps.__loadParams);
48
37
  return;
49
38
  }
50
-
51
- // if (history) {
52
- // redirectToRouteWithQueryParams(params, { history, location });
53
- // return;
54
- // }
55
-
56
39
  queryData.refetch(params);
57
40
  },
58
41
  setPerPage(perPage) {
@@ -132,9 +115,6 @@ const useDataList = params => {
132
115
  select(item) {
133
116
  const query = new URLSearchParams(location.search);
134
117
  query.set("id", item.id);
135
- history.push({
136
- search: query.toString()
137
- });
138
118
  },
139
119
  isMultiSelected(item) {
140
120
  if (!Array.isArray(multiSelectedItems)) {
@@ -1 +1 @@
1
- {"version":3,"names":["useState","useEffect","useRef","useCallback","useQuery","useRouter","get","isEqual","prepareLoadListParams","getData","getError","getMeta","useDataList","params","multiSelectedItems","multiSelect","history","location","routerHook","getQueryOptions","variables","client","queryData","query","prevLoadParamsRef","dataListProps","data","meta","error","loading","init","refresh","refetch","__loadParams","setPerPage","perPage","preparedParams","limit","parseInt","after","undefined","before","setNextPage","cursor","setPreviousPage","setSearch","search","setWhere","where","setSorters","sort","items","value","Array","isArray","returnItems","forEach","item","includes","splice","indexOf","push","isSelected","URLSearchParams","id","select","set","toString","isMultiSelected","isNoneMultiSelected","length","getMultiSelected","multiSelectAll","isAllMultiSelected","prev","current"],"sources":["useDataList.ts"],"sourcesContent":["import { useState, useEffect, useRef, useCallback } from \"react\";\nimport { useQuery } from \"@apollo/react-hooks\";\nimport { useRouter } from \"@webiny/react-router\";\nimport get from \"lodash/get\";\nimport isEqual from \"lodash/isEqual\";\nimport { prepareLoadListParams } from \"./utils\";\nimport { getData, getError, getMeta } from \"./functions\";\n\nimport type { DocumentNode } from \"graphql\";\nimport type { ApolloClient } from \"apollo-client\";\n\nexport interface UseDataListParams {\n useRouter?: boolean;\n variables?: ((params: UseDataListParams) => any) | object;\n client?: ApolloClient<any>;\n query: DocumentNode;\n getData?: (data: any) => any;\n getMeta?: (data: any) => any;\n getError?: (data: any) => any;\n}\n\nexport interface DataListProps {\n __loadParams: any;\n refresh: (params?: any) => void;\n data: any[];\n meta: any;\n error: any;\n loading: boolean;\n isSelected: (item: any) => boolean;\n select: (item: any) => void;\n isMultiSelected: (item: any) => boolean;\n isNoneMultiSelected: () => boolean;\n isAllMultiSelected: () => boolean;\n multiSelectAll: (value: boolean) => void;\n getMultiSelected: () => any[];\n setSearch: (search: any) => void;\n setWhere: (where: any) => void;\n setSorters: (sort: any) => void;\n setPerPage: (perPage: number) => void;\n setPreviousPage: (cursor: string) => void;\n setNextPage: (cursor: string) => void;\n multiSelect: (items: string | string[], value?: boolean) => void;\n init: () => void;\n}\n\nconst useDataList = (params: UseDataListParams) => {\n const [multiSelectedItems, multiSelect] = useState<string[]>([]);\n\n let history = null;\n /**\n * TODO: figure out the location type.\n */\n let location: any = null;\n const routerHook = useRouter();\n\n if (params.useRouter !== false) {\n history = routerHook.history;\n location = routerHook.location;\n }\n\n const getQueryOptions = useCallback(() => {\n let variables = params.variables;\n if (typeof variables === \"function\") {\n variables = variables(params);\n }\n\n return {\n client: params.client,\n variables: {\n ...variables,\n ...prepareLoadListParams(location)\n }\n };\n }, []);\n\n const queryData = useQuery(params.query, getQueryOptions());\n const prevLoadParamsRef = useRef({});\n\n const dataListProps: DataListProps = {\n data: get(params, \"getData\", getData)(queryData.data),\n meta: get(params, \"getMeta\", getMeta)(queryData.data),\n error: get(params, \"getError\", getError)(queryData.data),\n\n loading: queryData.loading,\n init() {\n this.refresh();\n },\n refresh(params = null): void {\n // Refresh multi select first.\n multiSelect([]);\n\n if (!params) {\n queryData.refetch(dataListProps.__loadParams);\n return;\n }\n\n // if (history) {\n // redirectToRouteWithQueryParams(params, { history, location });\n // return;\n // }\n\n queryData.refetch(params);\n },\n setPerPage(perPage: number): void {\n const preparedParams = {\n ...dataListProps.__loadParams,\n limit: parseInt(\"\" + perPage),\n after: undefined,\n before: undefined\n };\n this.refresh(preparedParams);\n },\n setNextPage(cursor: string): void {\n const preparedParams = {\n ...dataListProps.__loadParams,\n after: cursor,\n before: undefined\n };\n this.refresh(preparedParams);\n },\n setPreviousPage(cursor: string): void {\n const preparedParams = {\n ...dataListProps.__loadParams,\n after: undefined,\n before: cursor\n };\n this.refresh(preparedParams);\n },\n setSearch(search): void {\n const preparedParams = {\n ...dataListProps.__loadParams,\n search,\n after: undefined,\n before: undefined\n };\n this.refresh(preparedParams);\n },\n setWhere(where): void {\n const preparedParams = {\n ...dataListProps.__loadParams,\n where,\n after: undefined,\n before: undefined\n };\n this.refresh(preparedParams);\n },\n setSorters(sort): void {\n const preparedParams = {\n ...dataListProps.__loadParams,\n sort,\n after: undefined,\n before: undefined\n };\n this.refresh(preparedParams);\n },\n multiSelect(items, value): void {\n if (!Array.isArray(items)) {\n items = [items];\n }\n\n const returnItems = [...multiSelectedItems];\n\n items.forEach(item => {\n if (value === undefined) {\n returnItems.includes(item)\n ? returnItems.splice(returnItems.indexOf(item), 1)\n : returnItems.push(item);\n } else {\n if (value === true) {\n !returnItems.includes(item) && returnItems.push(item);\n } else {\n returnItems.includes(item) &&\n returnItems.splice(returnItems.indexOf(item), 1);\n }\n }\n });\n\n multiSelect(returnItems);\n },\n isSelected(item) {\n const query = new URLSearchParams(location.search);\n return query.get(\"id\") === item.id;\n },\n select(item) {\n const query = new URLSearchParams(location.search);\n query.set(\"id\", item.id);\n history.push({ search: query.toString() });\n },\n isMultiSelected(item) {\n if (!Array.isArray(multiSelectedItems)) {\n return false;\n }\n\n return multiSelectedItems.includes(item);\n },\n isNoneMultiSelected() {\n return multiSelectedItems.length === 0;\n },\n getMultiSelected() {\n return multiSelectedItems;\n },\n multiSelectAll(value: boolean): void {\n const { data } = dataListProps;\n if (Array.isArray(data)) {\n dataListProps.multiSelect(data, value);\n } else {\n dataListProps.multiSelect([], value);\n }\n },\n isAllMultiSelected(): boolean {\n const { data } = dataListProps;\n\n return Array.isArray(data) && multiSelectedItems.length === data.length;\n },\n\n __loadParams: prepareLoadListParams(location)\n };\n\n useEffect(() => {\n const params = {\n prev: prevLoadParamsRef.current,\n current: dataListProps.__loadParams\n };\n\n if (!isEqual(params.prev, params.current)) {\n dataListProps.init();\n }\n\n prevLoadParamsRef.current = params.current;\n });\n\n return dataListProps;\n};\n\nexport { useDataList };\n"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,SAAS,EAAEC,MAAM,EAAEC,WAAW,QAAQ,OAAO;AAChE,SAASC,QAAQ,QAAQ,qBAAqB;AAC9C,SAASC,SAAS,QAAQ,sBAAsB;AAChD,OAAOC,GAAG,MAAM,YAAY;AAC5B,OAAOC,OAAO,MAAM,gBAAgB;AACpC,SAASC,qBAAqB;AAC9B,SAASC,OAAO,EAAEC,QAAQ,EAAEC,OAAO;AAuCnC,MAAMC,WAAW,GAAIC,MAAyB,IAAK;EAC/C,MAAM,CAACC,kBAAkB,EAAEC,WAAW,CAAC,GAAGf,QAAQ,CAAW,EAAE,CAAC;EAEhE,IAAIgB,OAAO,GAAG,IAAI;EAClB;AACJ;AACA;EACI,IAAIC,QAAa,GAAG,IAAI;EACxB,MAAMC,UAAU,GAAGb,SAAS,CAAC,CAAC;EAE9B,IAAIQ,MAAM,CAACR,SAAS,KAAK,KAAK,EAAE;IAC5BW,OAAO,GAAGE,UAAU,CAACF,OAAO;IAC5BC,QAAQ,GAAGC,UAAU,CAACD,QAAQ;EAClC;EAEA,MAAME,eAAe,GAAGhB,WAAW,CAAC,MAAM;IACtC,IAAIiB,SAAS,GAAGP,MAAM,CAACO,SAAS;IAChC,IAAI,OAAOA,SAAS,KAAK,UAAU,EAAE;MACjCA,SAAS,GAAGA,SAAS,CAACP,MAAM,CAAC;IACjC;IAEA,OAAO;MACHQ,MAAM,EAAER,MAAM,CAACQ,MAAM;MACrBD,SAAS,EAAE;QACP,GAAGA,SAAS;QACZ,GAAGZ,qBAAqB,CAACS,QAAQ;MACrC;IACJ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,QAAQ,CAACD,IAAI,CAAC;IAC5C,CAAC;IACDY,mBAAmBA,CAAA,EAAG;MAClB,OAAOvD,kBAAkB,CAACwD,MAAM,KAAK,CAAC;IAC1C,CAAC;IACDC,gBAAgBA,CAAA,EAAG;MACf,OAAOzD,kBAAkB;IAC7B,CAAC;IACD0D,cAAcA,CAACpB,KAAc,EAAQ;MACjC,MAAM;QAAE1B;MAAK,CAAC,GAAGD,aAAa;MAC9B,IAAI4B,KAAK,CAACC,OAAO,CAAC5B,IAAI,CAAC,EAAE;QACrBD,aAAa,CAACV,WAAW,CAACW,IAAI,EAAE0B,KAAK,CAAC;MAC1C,CAAC,MAAM;QACH3B,aAAa,CAACV,WAAW,CAAC,EAAE,EAAEqC,KAAK,CAAC;MACxC;IACJ,CAAC;IACDqB,kBAAkBA,CAAA,EAAY;MAC1B,MAAM;QAAE/C;MAAK,CAAC,GAAGD,aAAa;MAE9B,OAAO4B,KAAK,CAACC,OAAO,CAAC5B,IAAI,CAAC,IAAIZ,kBAAkB,CAACwD,MAAM,KAAK5C,IAAI,CAAC4C,MAAM;IAC3E,CAAC;IAEDrC,YAAY,EAAEzB,qBAAqB,CAACS,QAAQ;EAChD,CAAC;EAEDhB,SAAS,CAAC,MAAM;IACZ,MAAMY,MAAM,GAAG;MACX6D,IAAI,EAAElD,iBAAiB,CAACmD,OAAO;MAC/BA,OAAO,EAAElD,aAAa,CAACQ;IAC3B,CAAC;IAED,IAAI,CAAC1B,OAAO,CAACM,MAAM,CAAC6D,IAAI,EAAE7D,MAAM,CAAC8D,OAAO,CAAC,EAAE;MACvClD,aAAa,CAACK,IAAI,CAAC,CAAC;IACxB;IAEAN,iBAAiB,CAACmD,OAAO,GAAG9D,MAAM,CAAC8D,OAAO;EAC9C,CAAC,CAAC;EAEF,OAAOlD,aAAa;AACxB,CAAC;AAED,SAASb,WAAW","ignoreList":[]}
1
+ {"version":3,"names":["useCallback","useEffect","useRef","useState","useQuery","get","isEqual","prepareLoadListParams","getData","getError","getMeta","useDataList","params","multiSelectedItems","multiSelect","getQueryOptions","variables","client","queryData","query","prevLoadParamsRef","dataListProps","data","meta","error","loading","init","refresh","refetch","__loadParams","setPerPage","perPage","preparedParams","limit","parseInt","after","undefined","before","setNextPage","cursor","setPreviousPage","setSearch","search","setWhere","where","setSorters","sort","items","value","Array","isArray","returnItems","forEach","item","includes","splice","indexOf","push","isSelected","URLSearchParams","location","id","select","set","isMultiSelected","isNoneMultiSelected","length","getMultiSelected","multiSelectAll","isAllMultiSelected","prev","current"],"sources":["useDataList.ts"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from \"react\";\nimport { useQuery } from \"@apollo/react-hooks\";\nimport get from \"lodash/get.js\";\nimport isEqual from \"lodash/isEqual.js\";\nimport { prepareLoadListParams } from \"./utils/index.js\";\nimport { getData, getError, getMeta } from \"./functions/index.js\";\n\nimport type { DocumentNode } from \"graphql\";\nimport type { ApolloClient } from \"apollo-client\";\n\nexport interface UseDataListParams {\n variables?: ((params: UseDataListParams) => any) | object;\n client?: ApolloClient<any>;\n query: DocumentNode;\n getData?: (data: any) => any;\n getMeta?: (data: any) => any;\n getError?: (data: any) => any;\n}\n\nexport interface DataListProps {\n __loadParams: any;\n refresh: (params?: any) => void;\n data: any[];\n meta: any;\n error: any;\n loading: boolean;\n isSelected: (item: any) => boolean;\n select: (item: any) => void;\n isMultiSelected: (item: any) => boolean;\n isNoneMultiSelected: () => boolean;\n isAllMultiSelected: () => boolean;\n multiSelectAll: (value: boolean) => void;\n getMultiSelected: () => any[];\n setSearch: (search: any) => void;\n setWhere: (where: any) => void;\n setSorters: (sort: any) => void;\n setPerPage: (perPage: number) => void;\n setPreviousPage: (cursor: string) => void;\n setNextPage: (cursor: string) => void;\n multiSelect: (items: string | string[], value?: boolean) => void;\n init: () => void;\n}\n\nconst useDataList = (params: UseDataListParams) => {\n const [multiSelectedItems, multiSelect] = useState<string[]>([]);\n\n const getQueryOptions = useCallback(() => {\n let variables = params.variables;\n if (typeof variables === \"function\") {\n variables = variables(params);\n }\n\n return {\n client: params.client,\n variables: {\n ...variables,\n ...prepareLoadListParams()\n }\n };\n }, []);\n\n const queryData = useQuery(params.query, getQueryOptions());\n const prevLoadParamsRef = useRef({});\n\n const dataListProps: DataListProps = {\n data: get(params, \"getData\", getData)(queryData.data),\n meta: get(params, \"getMeta\", getMeta)(queryData.data),\n error: get(params, \"getError\", getError)(queryData.data),\n\n loading: queryData.loading,\n init() {\n this.refresh();\n },\n refresh(params = null): void {\n // Refresh multi select first.\n multiSelect([]);\n\n if (!params) {\n queryData.refetch(dataListProps.__loadParams);\n return;\n }\n\n queryData.refetch(params);\n },\n setPerPage(perPage: number): void {\n const preparedParams = {\n ...dataListProps.__loadParams,\n limit: parseInt(\"\" + perPage),\n after: undefined,\n before: undefined\n };\n this.refresh(preparedParams);\n },\n setNextPage(cursor: string): void {\n const preparedParams = {\n ...dataListProps.__loadParams,\n after: cursor,\n before: undefined\n };\n this.refresh(preparedParams);\n },\n setPreviousPage(cursor: string): void {\n const preparedParams = {\n ...dataListProps.__loadParams,\n after: undefined,\n before: cursor\n };\n this.refresh(preparedParams);\n },\n setSearch(search): void {\n const preparedParams = {\n ...dataListProps.__loadParams,\n search,\n after: undefined,\n before: undefined\n };\n this.refresh(preparedParams);\n },\n setWhere(where): void {\n const preparedParams = {\n ...dataListProps.__loadParams,\n where,\n after: undefined,\n before: undefined\n };\n this.refresh(preparedParams);\n },\n setSorters(sort): void {\n const preparedParams = {\n ...dataListProps.__loadParams,\n sort,\n after: undefined,\n before: undefined\n };\n this.refresh(preparedParams);\n },\n multiSelect(items, value): void {\n if (!Array.isArray(items)) {\n items = [items];\n }\n\n const returnItems = [...multiSelectedItems];\n\n items.forEach(item => {\n if (value === undefined) {\n returnItems.includes(item)\n ? returnItems.splice(returnItems.indexOf(item), 1)\n : returnItems.push(item);\n } else {\n if (value === true) {\n !returnItems.includes(item) && returnItems.push(item);\n } else {\n returnItems.includes(item) &&\n returnItems.splice(returnItems.indexOf(item), 1);\n }\n }\n });\n\n multiSelect(returnItems);\n },\n isSelected(item) {\n const query = new URLSearchParams(location.search);\n return query.get(\"id\") === item.id;\n },\n select(item) {\n const query = new URLSearchParams(location.search);\n query.set(\"id\", item.id);\n },\n isMultiSelected(item) {\n if (!Array.isArray(multiSelectedItems)) {\n return false;\n }\n\n return multiSelectedItems.includes(item);\n },\n isNoneMultiSelected() {\n return multiSelectedItems.length === 0;\n },\n getMultiSelected() {\n return multiSelectedItems;\n },\n multiSelectAll(value: boolean): void {\n const { data } = dataListProps;\n if (Array.isArray(data)) {\n dataListProps.multiSelect(data, value);\n } else {\n dataListProps.multiSelect([], value);\n }\n },\n isAllMultiSelected(): boolean {\n const { data } = dataListProps;\n\n return Array.isArray(data) && multiSelectedItems.length === data.length;\n },\n\n __loadParams: prepareLoadListParams(location)\n };\n\n useEffect(() => {\n const params = {\n prev: prevLoadParamsRef.current,\n current: dataListProps.__loadParams\n };\n\n if (!isEqual(params.prev, params.current)) {\n dataListProps.init();\n }\n\n prevLoadParamsRef.current = params.current;\n });\n\n return dataListProps;\n};\n\nexport { useDataList };\n"],"mappings":"AAAA,SAASA,WAAW,EAAEC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAChE,SAASC,QAAQ,QAAQ,qBAAqB;AAC9C,OAAOC,GAAG,MAAM,eAAe;AAC/B,OAAOC,OAAO,MAAM,mBAAmB;AACvC,SAASC,qBAAqB;AAC9B,SAASC,OAAO,EAAEC,QAAQ,EAAEC,OAAO;AAsCnC,MAAMC,WAAW,GAAIC,MAAyB,IAAK;EAC/C,MAAM,CAACC,kBAAkB,EAAEC,WAAW,CAAC,GAAGX,QAAQ,CAAW,EAAE,CAAC;EAEhE,MAAMY,eAAe,GAAGf,WAAW,CAAC,MAAM;IACtC,IAAIgB,SAAS,GAAGJ,MAAM,CAACI,SAAS;IAChC,IAAI,OAAOA,SAAS,KAAK,UAAU,EAAE;MACjCA,SAAS,GAAGA,SAAS,CAACJ,MAAM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,CAACyC,QAAQ,CAACD,IAAI,CAAC;IAC5C,CAAC;IACDY,mBAAmBA,CAAA,EAAG;MAClB,OAAOpD,kBAAkB,CAACqD,MAAM,KAAK,CAAC;IAC1C,CAAC;IACDC,gBAAgBA,CAAA,EAAG;MACf,OAAOtD,kBAAkB;IAC7B,CAAC;IACDuD,cAAcA,CAACpB,KAAc,EAAQ;MACjC,MAAM;QAAE1B;MAAK,CAAC,GAAGD,aAAa;MAC9B,IAAI4B,KAAK,CAACC,OAAO,CAAC5B,IAAI,CAAC,EAAE;QACrBD,aAAa,CAACP,WAAW,CAACQ,IAAI,EAAE0B,KAAK,CAAC;MAC1C,CAAC,MAAM;QACH3B,aAAa,CAACP,WAAW,CAAC,EAAE,EAAEkC,KAAK,CAAC;MACxC;IACJ,CAAC;IACDqB,kBAAkBA,CAAA,EAAY;MAC1B,MAAM;QAAE/C;MAAK,CAAC,GAAGD,aAAa;MAE9B,OAAO4B,KAAK,CAACC,OAAO,CAAC5B,IAAI,CAAC,IAAIT,kBAAkB,CAACqD,MAAM,KAAK5C,IAAI,CAAC4C,MAAM;IAC3E,CAAC;IAEDrC,YAAY,EAAEtB,qBAAqB,CAACqD,QAAQ;EAChD,CAAC;EAED3D,SAAS,CAAC,MAAM;IACZ,MAAMW,MAAM,GAAG;MACX0D,IAAI,EAAElD,iBAAiB,CAACmD,OAAO;MAC/BA,OAAO,EAAElD,aAAa,CAACQ;IAC3B,CAAC;IAED,IAAI,CAACvB,OAAO,CAACM,MAAM,CAAC0D,IAAI,EAAE1D,MAAM,CAAC2D,OAAO,CAAC,EAAE;MACvClD,aAAa,CAACK,IAAI,CAAC,CAAC;IACxB;IAEAN,iBAAiB,CAACmD,OAAO,GAAG3D,MAAM,CAAC2D,OAAO;EAC9C,CAAC,CAAC;EAEF,OAAOlD,aAAa;AACxB,CAAC;AAED,SAASV,WAAW","ignoreList":[]}
@@ -1,2 +1 @@
1
- export { default as prepareLoadListParams } from "./prepareLoadListParams";
2
- export { default as redirectToRouteWithQueryParams } from "./redirectToRouteWithQueryParams";
1
+ export { default as prepareLoadListParams } from "./prepareLoadListParams.js";
@@ -1,4 +1,3 @@
1
- export { default as prepareLoadListParams } from "./prepareLoadListParams";
2
- export { default as redirectToRouteWithQueryParams } from "./redirectToRouteWithQueryParams";
1
+ export { default as prepareLoadListParams } from "./prepareLoadListParams.js";
3
2
 
4
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["default","prepareLoadListParams","redirectToRouteWithQueryParams"],"sources":["index.ts"],"sourcesContent":["export { default as prepareLoadListParams } from \"./prepareLoadListParams\";\nexport { default as redirectToRouteWithQueryParams } from \"./redirectToRouteWithQueryParams\";\n"],"mappings":"AAAA,SAASA,OAAO,IAAIC,qBAAqB;AACzC,SAASD,OAAO,IAAIE,8BAA8B","ignoreList":[]}
1
+ {"version":3,"names":["default","prepareLoadListParams"],"sources":["index.ts"],"sourcesContent":["export { default as prepareLoadListParams } from \"./prepareLoadListParams.js\";\n"],"mappings":"AAAA,SAASA,OAAO,IAAIC,qBAAqB","ignoreList":[]}
@@ -24,7 +24,7 @@ export default location => {
24
24
  }
25
25
  try {
26
26
  params[key] = JSON.parse(value);
27
- } catch (e) {
27
+ } catch {
28
28
  /**
29
29
  * If we can't parse the value, it means it's a string.
30
30
  */