@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,204 @@
1
+ import { describe, it, beforeEach, expect, vi } from "vitest";
2
+ import { createMemoryHistory } from "history";
3
+ import { HistoryRouterGateway } from "./HistoryRouterGateway.js";
4
+ import { RouteUrl } from "./RouteUrl.js";
5
+ const wait = () => new Promise(resolve => setTimeout(resolve, 10));
6
+ describe("Router Gateway", () => {
7
+ beforeEach(() => {
8
+ vi.clearAllMocks();
9
+ });
10
+ it("should execute onMatch when history changes", async () => {
11
+ const spyHome = vi.fn();
12
+ const spyLogin = vi.fn();
13
+ const spyDynamic = vi.fn();
14
+
15
+ // Create `history` and set the initial pathname to an unknown route
16
+ const history = createMemoryHistory();
17
+ history.replace("/__unknown__");
18
+ const gateway = new HistoryRouterGateway(history, "");
19
+ gateway.setRoutes([{
20
+ name: "home",
21
+ path: "/",
22
+ onMatch: spyHome
23
+ }, {
24
+ name: "login",
25
+ path: "/login",
26
+ onMatch: spyLogin
27
+ }, {
28
+ name: "test",
29
+ path: "/dynamic-route/:name",
30
+ onMatch: spyDynamic
31
+ }]);
32
+ history.push("/login");
33
+ await wait();
34
+ history.push("/");
35
+ await wait();
36
+ history.push("/dynamic-route/cars");
37
+ await wait();
38
+ history.push("/login");
39
+ await wait();
40
+ history.push("/dynamic-route/blogs");
41
+ await wait();
42
+ history.push("/dynamic-route/blogs?search=123");
43
+ await wait();
44
+ expect(spyLogin).toHaveBeenCalledTimes(2);
45
+ expect(spyLogin).toHaveBeenNthCalledWith(1, {
46
+ name: "login",
47
+ path: "/login",
48
+ pathname: "/login",
49
+ params: {}
50
+ });
51
+ expect(spyLogin).toHaveBeenNthCalledWith(2, {
52
+ name: "login",
53
+ path: "/login",
54
+ pathname: "/login",
55
+ params: {}
56
+ });
57
+ expect(spyHome).toHaveBeenCalledTimes(1);
58
+ expect(spyHome).toHaveBeenLastCalledWith({
59
+ name: "home",
60
+ path: "/",
61
+ pathname: "/",
62
+ params: {}
63
+ });
64
+ expect(spyDynamic).toHaveBeenCalledTimes(3);
65
+ expect(spyDynamic).toHaveBeenNthCalledWith(1, {
66
+ name: "test",
67
+ path: "/dynamic-route/:name",
68
+ pathname: "/dynamic-route/cars",
69
+ params: {
70
+ name: "cars"
71
+ }
72
+ });
73
+ expect(spyDynamic).toHaveBeenNthCalledWith(2, {
74
+ name: "test",
75
+ path: "/dynamic-route/:name",
76
+ pathname: "/dynamic-route/blogs",
77
+ params: {
78
+ name: "blogs"
79
+ }
80
+ });
81
+ expect(spyDynamic).toHaveBeenNthCalledWith(3, {
82
+ name: "test",
83
+ path: "/dynamic-route/:name",
84
+ pathname: "/dynamic-route/blogs",
85
+ params: {
86
+ name: "blogs",
87
+ search: "123"
88
+ }
89
+ });
90
+ });
91
+ it("should generate route URLs", async () => {
92
+ const urls = [RouteUrl.fromPattern("/"), RouteUrl.fromPattern("/login", {}), RouteUrl.fromPattern("/login", {
93
+ redirect: "/",
94
+ reason: "login"
95
+ }), RouteUrl.fromPattern("/dynamic-route/:name", {
96
+ name: "cars"
97
+ }), RouteUrl.fromPattern("/dynamic-route", {
98
+ folderId: "696556831e485d00027a1a0b#0001"
99
+ })];
100
+ expect(urls).toEqual(["/", "/login", "/login?redirect=%2F&reason=login", "/dynamic-route/cars", "/dynamic-route?folderId=696556831e485d00027a1a0b%230001"]);
101
+ });
102
+ it("should handle baseUrl for route matching and URL generation", async () => {
103
+ const spyFileManager = vi.fn();
104
+ const spyHome = vi.fn();
105
+
106
+ // Create history with a tenant prefix
107
+ const history = createMemoryHistory();
108
+ history.replace("/tenant123/__unknown__");
109
+ const gateway = new HistoryRouterGateway(history, "/tenant123");
110
+ gateway.setRoutes([{
111
+ name: "home",
112
+ path: "/",
113
+ onMatch: spyHome
114
+ }, {
115
+ name: "fileManager",
116
+ path: "/file-manager",
117
+ onMatch: spyFileManager
118
+ }]);
119
+
120
+ // Navigate to /tenant123/file-manager
121
+ history.push("/tenant123/file-manager");
122
+ await wait();
123
+
124
+ // Should match the /file-manager route
125
+ expect(spyFileManager).toHaveBeenCalledTimes(1);
126
+ expect(spyFileManager).toHaveBeenCalledWith({
127
+ name: "fileManager",
128
+ path: "/file-manager",
129
+ pathname: "/tenant123/file-manager",
130
+ params: {}
131
+ });
132
+
133
+ // Test URL generation with baseUrl
134
+ const urlWithBase = RouteUrl.fromPattern("/file-manager", {}, "/tenant123");
135
+ expect(urlWithBase).toBe("/tenant123/file-manager");
136
+ const urlWithBaseAndParams = RouteUrl.fromPattern("/file-manager", {
137
+ folder: "abc"
138
+ }, "/tenant123");
139
+ expect(urlWithBaseAndParams).toBe("/tenant123/file-manager?folder=abc");
140
+ });
141
+ it("should properly sort routes with wildcards always at the bottom", async () => {
142
+ const spyWildcard = vi.fn();
143
+ const spySpecific = vi.fn();
144
+ const spyHome = vi.fn();
145
+ const history = createMemoryHistory();
146
+ // Start at a non-matching path to avoid initial route resolution
147
+ history.replace("/initial");
148
+ const gateway = new HistoryRouterGateway(history, "");
149
+
150
+ // Add wildcard first, then home route
151
+ // Note: setRoutes will trigger route resolution for current path (/initial)
152
+ gateway.setRoutes([{
153
+ name: "wildcard",
154
+ path: "*",
155
+ onMatch: spyWildcard
156
+ }, {
157
+ name: "home",
158
+ path: "/",
159
+ onMatch: spyHome
160
+ }]);
161
+
162
+ // Wildcard should have matched /initial
163
+ expect(spyWildcard).toHaveBeenCalledTimes(1);
164
+ vi.clearAllMocks();
165
+
166
+ // Now add a specific route after the wildcard - this should re-sort and keep wildcard at bottom
167
+ // Note: setRoutes will trigger route resolution again for /initial, matching wildcard again
168
+ gateway.setRoutes([{
169
+ name: "specific",
170
+ path: "/specific-route",
171
+ onMatch: spySpecific
172
+ }]);
173
+
174
+ // Wildcard should match /initial again after re-sorting
175
+ expect(spyWildcard).toHaveBeenCalledTimes(1);
176
+ vi.clearAllMocks();
177
+
178
+ // Navigate to the specific route
179
+ history.push("/specific-route");
180
+ await wait();
181
+
182
+ // Should match the specific route, not the wildcard
183
+ expect(spySpecific).toHaveBeenCalledTimes(1);
184
+ expect(spyWildcard).toHaveBeenCalledTimes(0);
185
+ expect(spyHome).toHaveBeenCalledTimes(0);
186
+
187
+ // Navigate to home
188
+ history.push("/");
189
+ await wait();
190
+
191
+ // Should match home route
192
+ expect(spyHome).toHaveBeenCalledTimes(1);
193
+ expect(spyWildcard).toHaveBeenCalledTimes(0);
194
+
195
+ // Navigate to unknown route
196
+ history.push("/unknown");
197
+ await wait();
198
+
199
+ // Should match wildcard
200
+ expect(spyWildcard).toHaveBeenCalledTimes(1);
201
+ });
202
+ });
203
+
204
+ //# sourceMappingURL=HistoryRouterGateway.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["describe","it","beforeEach","expect","vi","createMemoryHistory","HistoryRouterGateway","RouteUrl","wait","Promise","resolve","setTimeout","clearAllMocks","spyHome","fn","spyLogin","spyDynamic","history","replace","gateway","setRoutes","name","path","onMatch","push","toHaveBeenCalledTimes","toHaveBeenNthCalledWith","pathname","params","toHaveBeenLastCalledWith","search","urls","fromPattern","redirect","reason","folderId","toEqual","spyFileManager","toHaveBeenCalledWith","urlWithBase","toBe","urlWithBaseAndParams","folder","spyWildcard","spySpecific"],"sources":["HistoryRouterGateway.test.ts"],"sourcesContent":["import { describe, it, beforeEach, expect, vi } from \"vitest\";\nimport { createMemoryHistory } from \"history\";\nimport { HistoryRouterGateway } from \"./HistoryRouterGateway.js\";\nimport { RouteUrl } from \"./RouteUrl.js\";\n\nconst wait = () => new Promise(resolve => setTimeout(resolve, 10));\n\ndescribe(\"Router Gateway\", () => {\n beforeEach(() => {\n vi.clearAllMocks();\n });\n\n it(\"should execute onMatch when history changes\", async () => {\n const spyHome = vi.fn();\n const spyLogin = vi.fn();\n const spyDynamic = vi.fn();\n\n // Create `history` and set the initial pathname to an unknown route\n const history = createMemoryHistory();\n history.replace(\"/__unknown__\");\n\n const gateway = new HistoryRouterGateway(history, \"\");\n gateway.setRoutes([\n { name: \"home\", path: \"/\", onMatch: spyHome },\n { name: \"login\", path: \"/login\", onMatch: spyLogin },\n { name: \"test\", path: \"/dynamic-route/:name\", onMatch: spyDynamic }\n ]);\n\n history.push(\"/login\");\n await wait();\n history.push(\"/\");\n await wait();\n history.push(\"/dynamic-route/cars\");\n await wait();\n history.push(\"/login\");\n await wait();\n history.push(\"/dynamic-route/blogs\");\n await wait();\n history.push(\"/dynamic-route/blogs?search=123\");\n await wait();\n\n expect(spyLogin).toHaveBeenCalledTimes(2);\n expect(spyLogin).toHaveBeenNthCalledWith(1, {\n name: \"login\",\n path: \"/login\",\n pathname: \"/login\",\n params: {}\n });\n expect(spyLogin).toHaveBeenNthCalledWith(2, {\n name: \"login\",\n path: \"/login\",\n pathname: \"/login\",\n params: {}\n });\n expect(spyHome).toHaveBeenCalledTimes(1);\n expect(spyHome).toHaveBeenLastCalledWith({\n name: \"home\",\n path: \"/\",\n pathname: \"/\",\n params: {}\n });\n expect(spyDynamic).toHaveBeenCalledTimes(3);\n expect(spyDynamic).toHaveBeenNthCalledWith(1, {\n name: \"test\",\n path: \"/dynamic-route/:name\",\n pathname: \"/dynamic-route/cars\",\n params: {\n name: \"cars\"\n }\n });\n expect(spyDynamic).toHaveBeenNthCalledWith(2, {\n name: \"test\",\n path: \"/dynamic-route/:name\",\n pathname: \"/dynamic-route/blogs\",\n params: {\n name: \"blogs\"\n }\n });\n expect(spyDynamic).toHaveBeenNthCalledWith(3, {\n name: \"test\",\n path: \"/dynamic-route/:name\",\n pathname: \"/dynamic-route/blogs\",\n params: {\n name: \"blogs\",\n search: \"123\"\n }\n });\n });\n\n it(\"should generate route URLs\", async () => {\n const urls = [\n RouteUrl.fromPattern(\"/\"),\n RouteUrl.fromPattern(\"/login\", {}),\n RouteUrl.fromPattern(\"/login\", { redirect: \"/\", reason: \"login\" }),\n RouteUrl.fromPattern(\"/dynamic-route/:name\", { name: \"cars\" }),\n RouteUrl.fromPattern(\"/dynamic-route\", { folderId: \"696556831e485d00027a1a0b#0001\" })\n ];\n expect(urls).toEqual([\n \"/\",\n \"/login\",\n \"/login?redirect=%2F&reason=login\",\n \"/dynamic-route/cars\",\n \"/dynamic-route?folderId=696556831e485d00027a1a0b%230001\"\n ]);\n });\n\n it(\"should handle baseUrl for route matching and URL generation\", async () => {\n const spyFileManager = vi.fn();\n const spyHome = vi.fn();\n\n // Create history with a tenant prefix\n const history = createMemoryHistory();\n history.replace(\"/tenant123/__unknown__\");\n\n const gateway = new HistoryRouterGateway(history, \"/tenant123\");\n gateway.setRoutes([\n { name: \"home\", path: \"/\", onMatch: spyHome },\n { name: \"fileManager\", path: \"/file-manager\", onMatch: spyFileManager }\n ]);\n\n // Navigate to /tenant123/file-manager\n history.push(\"/tenant123/file-manager\");\n await wait();\n\n // Should match the /file-manager route\n expect(spyFileManager).toHaveBeenCalledTimes(1);\n expect(spyFileManager).toHaveBeenCalledWith({\n name: \"fileManager\",\n path: \"/file-manager\",\n pathname: \"/tenant123/file-manager\",\n params: {}\n });\n\n // Test URL generation with baseUrl\n const urlWithBase = RouteUrl.fromPattern(\"/file-manager\", {}, \"/tenant123\");\n expect(urlWithBase).toBe(\"/tenant123/file-manager\");\n\n const urlWithBaseAndParams = RouteUrl.fromPattern(\n \"/file-manager\",\n { folder: \"abc\" },\n \"/tenant123\"\n );\n expect(urlWithBaseAndParams).toBe(\"/tenant123/file-manager?folder=abc\");\n });\n\n it(\"should properly sort routes with wildcards always at the bottom\", async () => {\n const spyWildcard = vi.fn();\n const spySpecific = vi.fn();\n const spyHome = vi.fn();\n\n const history = createMemoryHistory();\n // Start at a non-matching path to avoid initial route resolution\n history.replace(\"/initial\");\n\n const gateway = new HistoryRouterGateway(history, \"\");\n\n // Add wildcard first, then home route\n // Note: setRoutes will trigger route resolution for current path (/initial)\n gateway.setRoutes([\n { name: \"wildcard\", path: \"*\", onMatch: spyWildcard },\n { name: \"home\", path: \"/\", onMatch: spyHome }\n ]);\n\n // Wildcard should have matched /initial\n expect(spyWildcard).toHaveBeenCalledTimes(1);\n vi.clearAllMocks();\n\n // Now add a specific route after the wildcard - this should re-sort and keep wildcard at bottom\n // Note: setRoutes will trigger route resolution again for /initial, matching wildcard again\n gateway.setRoutes([{ name: \"specific\", path: \"/specific-route\", onMatch: spySpecific }]);\n\n // Wildcard should match /initial again after re-sorting\n expect(spyWildcard).toHaveBeenCalledTimes(1);\n vi.clearAllMocks();\n\n // Navigate to the specific route\n history.push(\"/specific-route\");\n await wait();\n\n // Should match the specific route, not the wildcard\n expect(spySpecific).toHaveBeenCalledTimes(1);\n expect(spyWildcard).toHaveBeenCalledTimes(0);\n expect(spyHome).toHaveBeenCalledTimes(0);\n\n // Navigate to home\n history.push(\"/\");\n await wait();\n\n // Should match home route\n expect(spyHome).toHaveBeenCalledTimes(1);\n expect(spyWildcard).toHaveBeenCalledTimes(0);\n\n // Navigate to unknown route\n history.push(\"/unknown\");\n await wait();\n\n // Should match wildcard\n expect(spyWildcard).toHaveBeenCalledTimes(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,QAAQ;AAEjB,MAAMC,IAAI,GAAGA,CAAA,KAAM,IAAIC,OAAO,CAACC,OAAO,IAAIC,UAAU,CAACD,OAAO,EAAE,EAAE,CAAC,CAAC;AAElEV,QAAQ,CAAC,gBAAgB,EAAE,MAAM;EAC7BE,UAAU,CAAC,MAAM;IACbE,EAAE,CAACQ,aAAa,CAAC,CAAC;EACtB,CAAC,CAAC;EAEFX,EAAE,CAAC,6CAA6C,EAAE,YAAY;IAC1D,MAAMY,OAAO,GAAGT,EAAE,CAACU,EAAE,CAAC,CAAC;IACvB,MAAMC,QAAQ,GAAGX,EAAE,CAACU,EAAE,CAAC,CAAC;IACxB,MAAME,UAAU,GAAGZ,EAAE,CAACU,EAAE,CAAC,CAAC;;IAE1B;IACA,MAAMG,OAAO,GAAGZ,mBAAmB,CAAC,CAAC;IACrCY,OAAO,CAACC,OAAO,CAAC,cAAc,CAAC;IAE/B,MAAMC,OAAO,GAAG,IAAIb,oBAAoB,CAACW,OAAO,EAAE,EAAE,CAAC;IACrDE,OAAO,CAACC,SAAS,CAAC,CACd;MAAEC,IAAI,EAAE,MAAM;MAAEC,IAAI,EAAE,GAAG;MAAEC,OAAO,EAAEV;IAAQ,CAAC,EAC7C;MAAEQ,IAAI,EAAE,OAAO;MAAEC,IAAI,EAAE,QAAQ;MAAEC,OAAO,EAAER;IAAS,CAAC,EACpD;MAAEM,IAAI,EAAE,MAAM;MAAEC,IAAI,EAAE,sBAAsB;MAAEC,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AC,CAAC,CAAC;IAC5CtB,MAAM,CAACwC,WAAW,CAAC,CAAClB,qBAAqB,CAAC,CAAC,CAAC;IAC5CtB,MAAM,CAACU,OAAO,CAAC,CAACY,qBAAqB,CAAC,CAAC,CAAC;;IAExC;IACAR,OAAO,CAACO,IAAI,CAAC,GAAG,CAAC;IACjB,MAAMhB,IAAI,CAAC,CAAC;;IAEZ;IACAL,MAAM,CAACU,OAAO,CAAC,CAACY,qBAAqB,CAAC,CAAC,CAAC;IACxCtB,MAAM,CAACwC,WAAW,CAAC,CAAClB,qBAAqB,CAAC,CAAC,CAAC;;IAE5C;IACAR,OAAO,CAACO,IAAI,CAAC,UAAU,CAAC;IACxB,MAAMhB,IAAI,CAAC,CAAC;;IAEZ;IACAL,MAAM,CAACwC,WAAW,CAAC,CAAClB,qBAAqB,CAAC,CAAC,CAAC;EAChD,CAAC,CAAC;AACN,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,19 @@
1
+ import { z } from "zod";
2
+ export type RouteParamsDefinition = Record<string, z.ZodTypeAny>;
3
+ export type RouteParamsInfer<T extends RouteParamsDefinition | undefined> = T extends RouteParamsDefinition ? z.infer<z.ZodObject<T> & {
4
+ [k: string]: any;
5
+ }> : never;
6
+ export interface RouteParams<TParams extends RouteParamsDefinition | undefined> {
7
+ name: string;
8
+ path: `/${string}` | `*`;
9
+ params?: (zod: typeof z) => TParams;
10
+ }
11
+ export declare class Route<TParams extends RouteParamsDefinition | undefined = undefined> {
12
+ private readonly route;
13
+ private readonly schema;
14
+ constructor(route: RouteParams<TParams>);
15
+ get name(): string;
16
+ get path(): `/${string}` | "*";
17
+ get params(): TParams extends RouteParamsDefinition ? RouteParamsInfer<TParams> : undefined;
18
+ private coerceParams;
19
+ }
@@ -0,0 +1,59 @@
1
+ import { z } from "zod";
2
+ export class Route {
3
+ constructor(route) {
4
+ this.route = route;
5
+ const paramsSchema = route.params ? route.params(z) : undefined;
6
+ // @ts-expect-error
7
+ this.schema = paramsSchema ? z.looseObject(this.coerceParams(paramsSchema)) : undefined;
8
+ }
9
+ get name() {
10
+ return this.route.name;
11
+ }
12
+ get path() {
13
+ return this.route.path;
14
+ }
15
+ get params() {
16
+ return this.schema;
17
+ }
18
+ coerceParams(shape) {
19
+ const result = {};
20
+ for (const [key, schema] of Object.entries(shape)) {
21
+ let base = schema;
22
+ let isOptional = false;
23
+ let isNullable = false;
24
+
25
+ // unwrap optional
26
+ if (base instanceof z.ZodOptional) {
27
+ isOptional = true;
28
+ base = base.unwrap();
29
+ }
30
+
31
+ // unwrap nullable
32
+ if (base instanceof z.ZodNullable) {
33
+ isNullable = true;
34
+ base = base.unwrap();
35
+ }
36
+
37
+ // replace with coerced
38
+ if (base instanceof z.ZodString) {
39
+ base = z.coerce.string();
40
+ } else if (base instanceof z.ZodNumber) {
41
+ base = z.coerce.number();
42
+ } else if (base instanceof z.ZodBoolean) {
43
+ base = z.coerce.boolean();
44
+ }
45
+
46
+ // rewrap optional/nullable
47
+ if (isNullable) {
48
+ base = base.nullable();
49
+ }
50
+ if (isOptional) {
51
+ base = base.optional();
52
+ }
53
+ result[key] = base;
54
+ }
55
+ return result;
56
+ }
57
+ }
58
+
59
+ //# sourceMappingURL=Route.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["z","Route","constructor","route","paramsSchema","params","undefined","schema","looseObject","coerceParams","name","path","shape","result","key","Object","entries","base","isOptional","isNullable","ZodOptional","unwrap","ZodNullable","ZodString","coerce","string","ZodNumber","number","ZodBoolean","boolean","nullable","optional"],"sources":["Route.ts"],"sourcesContent":["import { z } from \"zod\";\n\nexport type RouteParamsDefinition = Record<string, z.ZodTypeAny>;\n\nexport type RouteParamsInfer<T extends RouteParamsDefinition | undefined> =\n T extends RouteParamsDefinition ? z.infer<z.ZodObject<T> & { [k: string]: any }> : never;\n\nexport interface RouteParams<TParams extends RouteParamsDefinition | undefined> {\n name: string;\n path: `/${string}` | `*`;\n params?: (zod: typeof z) => TParams;\n}\n\nexport class Route<TParams extends RouteParamsDefinition | undefined = undefined> {\n private readonly route: RouteParams<TParams>;\n private readonly schema: TParams extends RouteParamsDefinition\n ? RouteParamsInfer<TParams>\n : undefined;\n\n constructor(route: RouteParams<TParams>) {\n this.route = route;\n const paramsSchema = route.params ? route.params(z) : undefined;\n // @ts-expect-error\n this.schema = paramsSchema ? z.looseObject(this.coerceParams(paramsSchema)) : undefined;\n }\n\n get name() {\n return this.route.name;\n }\n\n get path() {\n return this.route.path;\n }\n\n get params(): TParams extends RouteParamsDefinition ? RouteParamsInfer<TParams> : undefined {\n return this.schema;\n }\n\n private coerceParams<T extends Record<string, z.ZodTypeAny>>(shape: T) {\n const result: Record<string, z.ZodTypeAny> = {};\n for (const [key, schema] of Object.entries(shape)) {\n let base = schema as z.ZodTypeAny;\n let isOptional = false;\n let isNullable = false;\n\n // unwrap optional\n if (base instanceof z.ZodOptional) {\n isOptional = true;\n base = base.unwrap() as z.ZodTypeAny;\n }\n\n // unwrap nullable\n if (base instanceof z.ZodNullable) {\n isNullable = true;\n base = base.unwrap() as z.ZodTypeAny;\n }\n\n // replace with coerced\n if (base instanceof z.ZodString) {\n base = z.coerce.string();\n } else if (base instanceof z.ZodNumber) {\n base = z.coerce.number();\n } else if (base instanceof z.ZodBoolean) {\n base = z.coerce.boolean();\n }\n\n // rewrap optional/nullable\n if (isNullable) {\n base = base.nullable();\n }\n if (isOptional) {\n base = base.optional();\n }\n\n result[key] = base;\n }\n return result;\n }\n}\n"],"mappings":"AAAA,SAASA,CAAC,QAAQ,KAAK;AAavB,OAAO,MAAMC,KAAK,CAAgE;EAM9EC,WAAWA,CAACC,KAA2B,EAAE;IACrC,IAAI,CAACA,KAAK,GAAGA,KAAK;IAClB,MAAMC,YAAY,GAAGD,KAAK,CAACE,MAAM,GAAGF,KAAK,CAACE,MAAM,CAACL,CAAC,CAAC,GAAGM,SAAS;IAC/D;IACA,IAAI,CAACC,MAAM,GAAGH,YAAY,GAAGJ,CAAC,CAACQ,WAAW,CAAC,IAAI,CA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,CAAC;MAC7B;;MAEA;MACA,IAAIV,UAAU,EAAE;QACZF,IAAI,GAAGA,IAAI,CAACa,QAAQ,CAAC,CAAC;MAC1B;MACA,IAAIZ,UAAU,EAAE;QACZD,IAAI,GAAGA,IAAI,CAACc,QAAQ,CAAC,CAAC;MAC1B;MAEAlB,MAAM,CAACC,GAAG,CAAC,GAAGG,IAAI;IACtB;IACA,OAAOJ,MAAM;EACjB;AACJ","ignoreList":[]}
@@ -0,0 +1,85 @@
1
+ interface Params {
2
+ [key: string]: any;
3
+ }
4
+ interface MatchResult {
5
+ params: Record<string, string>;
6
+ }
7
+ /**
8
+ * Utility class for route URL pattern matching and generation.
9
+ * Handles simple route patterns with :param syntax (e.g., /cms/entries/:modelId).
10
+ *
11
+ * Public API uses static methods, which internally construct RouteUrl instances
12
+ * to handle the logic through proper instance methods.
13
+ */
14
+ export declare class RouteUrl {
15
+ private static patternCache;
16
+ private readonly pattern;
17
+ private readonly params;
18
+ private readonly baseUrl;
19
+ private constructor();
20
+ /**
21
+ * Generate a URL from a route pattern and parameters.
22
+ * Path parameters are injected into the pattern, remaining parameters become query strings.
23
+ *
24
+ * @param pattern - Route pattern (e.g., '/security/api-keys/:id')
25
+ * @param params - Parameters object (e.g., { id: 123, new: true })
26
+ * @param baseUrl - Optional base URL to prepend (e.g., '/tenant123')
27
+ * @returns Generated URL string
28
+ *
29
+ * @example
30
+ * RouteUrl.fromPattern('/security/api-keys/:id', { id: 123, new: true })
31
+ * // Returns: '/security/api-keys/123?new=true'
32
+ *
33
+ * @example
34
+ * RouteUrl.fromPattern('/file-manager', {}, '/tenant123')
35
+ * // Returns: '/tenant123/file-manager'
36
+ */
37
+ static fromPattern(pattern: string, params?: Params, baseUrl?: string): string;
38
+ /**
39
+ * Match a pathname against a route pattern and extract parameters.
40
+ * If baseUrl is provided, it will be stripped from the pathname before matching.
41
+ *
42
+ * @param pathname - The pathname to match (e.g., '/tenant123/security/api-keys/123')
43
+ * @param pattern - Route pattern (e.g., '/security/api-keys/:id')
44
+ * @param baseUrl - Optional base URL to strip before matching (e.g., '/tenant123')
45
+ * @returns Object with extracted params if matched, null otherwise
46
+ *
47
+ * @example
48
+ * RouteUrl.match('/security/api-keys/123', '/security/api-keys/:id')
49
+ * // Returns: { params: { id: '123' } }
50
+ *
51
+ * @example
52
+ * RouteUrl.match('/tenant123/file-manager', '/file-manager', '/tenant123')
53
+ * // Returns: { params: {} }
54
+ */
55
+ static match(pathname: string, pattern: string, baseUrl?: string): MatchResult | null;
56
+ /**
57
+ * Generate a URL from the instance's pattern, params, and baseUrl.
58
+ */
59
+ private generate;
60
+ /**
61
+ * Match a pathname against the instance's pattern.
62
+ */
63
+ private matchPathname;
64
+ /**
65
+ * Extract path parameter names from the pattern.
66
+ */
67
+ private extractPathKeys;
68
+ /**
69
+ * Replace :param placeholders with actual values from params.
70
+ */
71
+ private replacePathParams;
72
+ /**
73
+ * Build query string from params that are not path parameters.
74
+ */
75
+ private buildQueryString;
76
+ /**
77
+ * Normalize baseUrl by ensuring it starts with / and doesn't end with /
78
+ */
79
+ private normalizeBaseUrl;
80
+ /**
81
+ * Compile the instance's pattern into a regex and extract parameter names.
82
+ */
83
+ private compilePattern;
84
+ }
85
+ export {};
@@ -0,0 +1,232 @@
1
+ /**
2
+ * Utility class for route URL pattern matching and generation.
3
+ * Handles simple route patterns with :param syntax (e.g., /cms/entries/:modelId).
4
+ *
5
+ * Public API uses static methods, which internally construct RouteUrl instances
6
+ * to handle the logic through proper instance methods.
7
+ */
8
+ export class RouteUrl {
9
+ static patternCache = new Map();
10
+ constructor(pattern, params, baseUrl) {
11
+ this.pattern = pattern;
12
+ this.params = params;
13
+ this.baseUrl = this.normalizeBaseUrl(baseUrl);
14
+ }
15
+
16
+ /**
17
+ * Generate a URL from a route pattern and parameters.
18
+ * Path parameters are injected into the pattern, remaining parameters become query strings.
19
+ *
20
+ * @param pattern - Route pattern (e.g., '/security/api-keys/:id')
21
+ * @param params - Parameters object (e.g., { id: 123, new: true })
22
+ * @param baseUrl - Optional base URL to prepend (e.g., '/tenant123')
23
+ * @returns Generated URL string
24
+ *
25
+ * @example
26
+ * RouteUrl.fromPattern('/security/api-keys/:id', { id: 123, new: true })
27
+ * // Returns: '/security/api-keys/123?new=true'
28
+ *
29
+ * @example
30
+ * RouteUrl.fromPattern('/file-manager', {}, '/tenant123')
31
+ * // Returns: '/tenant123/file-manager'
32
+ */
33
+ static fromPattern(pattern, params, baseUrl) {
34
+ const routeUrl = new RouteUrl(pattern, params, baseUrl);
35
+ return routeUrl.generate();
36
+ }
37
+
38
+ /**
39
+ * Match a pathname against a route pattern and extract parameters.
40
+ * If baseUrl is provided, it will be stripped from the pathname before matching.
41
+ *
42
+ * @param pathname - The pathname to match (e.g., '/tenant123/security/api-keys/123')
43
+ * @param pattern - Route pattern (e.g., '/security/api-keys/:id')
44
+ * @param baseUrl - Optional base URL to strip before matching (e.g., '/tenant123')
45
+ * @returns Object with extracted params if matched, null otherwise
46
+ *
47
+ * @example
48
+ * RouteUrl.match('/security/api-keys/123', '/security/api-keys/:id')
49
+ * // Returns: { params: { id: '123' } }
50
+ *
51
+ * @example
52
+ * RouteUrl.match('/tenant123/file-manager', '/file-manager', '/tenant123')
53
+ * // Returns: { params: {} }
54
+ */
55
+ static match(pathname, pattern, baseUrl) {
56
+ const routeUrl = new RouteUrl(pattern, undefined, baseUrl);
57
+ return routeUrl.matchPathname(pathname);
58
+ }
59
+
60
+ /**
61
+ * Generate a URL from the instance's pattern, params, and baseUrl.
62
+ */
63
+ generate() {
64
+ if (!this.params) {
65
+ return this.baseUrl + this.pattern;
66
+ }
67
+
68
+ // Extract path parameter names from pattern
69
+ const pathKeys = this.extractPathKeys();
70
+
71
+ // Replace :param with actual values
72
+ let url = this.replacePathParams();
73
+
74
+ // Handle empty url
75
+ if (!url || url === "") {
76
+ url = "/";
77
+ }
78
+
79
+ // Prepend baseUrl
80
+ url = this.baseUrl + url;
81
+
82
+ // Add query parameters for keys not used in the path
83
+ const queryString = this.buildQueryString(pathKeys);
84
+ if (queryString) {
85
+ url += `?${queryString}`;
86
+ }
87
+ return url;
88
+ }
89
+
90
+ /**
91
+ * Match a pathname against the instance's pattern.
92
+ */
93
+ matchPathname(pathname) {
94
+ // Strip baseUrl from pathname if provided
95
+ if (this.baseUrl && pathname.startsWith(this.baseUrl)) {
96
+ pathname = pathname.slice(this.baseUrl.length) || "/";
97
+ } else if (this.baseUrl) {
98
+ // pathname doesn't start with baseUrl, no match
99
+ return null;
100
+ }
101
+
102
+ // Handle wildcard pattern
103
+ if (this.pattern === "*" || this.pattern === "(.*)") {
104
+ return {
105
+ params: {}
106
+ };
107
+ }
108
+
109
+ // Get or create cached pattern
110
+ let compiled = RouteUrl.patternCache.get(this.pattern);
111
+ if (!compiled) {
112
+ compiled = this.compilePattern();
113
+ RouteUrl.patternCache.set(this.pattern, compiled);
114
+ }
115
+ const match = pathname.match(compiled.regex);
116
+ if (!match) {
117
+ return null;
118
+ }
119
+
120
+ // Extract parameters from capture groups
121
+ const params = {};
122
+ compiled.keys.forEach((key, index) => {
123
+ const value = match[index + 1];
124
+ if (value !== undefined) {
125
+ params[key] = decodeURIComponent(value);
126
+ }
127
+ });
128
+ return {
129
+ params
130
+ };
131
+ }
132
+
133
+ /**
134
+ * Extract path parameter names from the pattern.
135
+ */
136
+ extractPathKeys() {
137
+ const pathKeys = new Set();
138
+ const paramRegex = /:([a-zA-Z_][a-zA-Z0-9_]*)/g;
139
+ let match;
140
+ while ((match = paramRegex.exec(this.pattern)) !== null) {
141
+ pathKeys.add(match[1]);
142
+ }
143
+ return pathKeys;
144
+ }
145
+
146
+ /**
147
+ * Replace :param placeholders with actual values from params.
148
+ */
149
+ replacePathParams() {
150
+ return this.pattern.replace(/:([a-zA-Z_][a-zA-Z0-9_]*)/g, (_, key) => {
151
+ const value = this.params[key];
152
+ if (value === undefined || value === null) {
153
+ return "";
154
+ }
155
+ return encodeURIComponent(String(value));
156
+ });
157
+ }
158
+
159
+ /**
160
+ * Build query string from params that are not path parameters.
161
+ */
162
+ buildQueryString(pathKeys) {
163
+ const queryParams = {};
164
+ for (const key in this.params) {
165
+ if (!pathKeys.has(key)) {
166
+ queryParams[key] = this.params[key];
167
+ }
168
+ }
169
+ if (Object.keys(queryParams).length === 0) {
170
+ return "";
171
+ }
172
+ const searchParams = new URLSearchParams();
173
+ for (const key in queryParams) {
174
+ const value = queryParams[key];
175
+ if (value !== undefined && value !== null) {
176
+ if (Array.isArray(value)) {
177
+ value.forEach(v => searchParams.append(key, String(v)));
178
+ } else {
179
+ searchParams.append(key, String(value));
180
+ }
181
+ }
182
+ }
183
+ return searchParams.toString();
184
+ }
185
+
186
+ /**
187
+ * Normalize baseUrl by ensuring it starts with / and doesn't end with /
188
+ */
189
+ normalizeBaseUrl(baseUrl) {
190
+ if (!baseUrl || baseUrl === "/") {
191
+ return "";
192
+ }
193
+ let normalized = baseUrl;
194
+
195
+ // Ensure it starts with /
196
+ if (!normalized.startsWith("/")) {
197
+ normalized = "/" + normalized;
198
+ }
199
+
200
+ // Remove trailing /
201
+ if (normalized.endsWith("/")) {
202
+ normalized = normalized.slice(0, -1);
203
+ }
204
+ return normalized;
205
+ }
206
+
207
+ /**
208
+ * Compile the instance's pattern into a regex and extract parameter names.
209
+ */
210
+ compilePattern() {
211
+ const keys = [];
212
+
213
+ // Escape special regex characters except for :param syntax
214
+ let regexPattern = this.pattern.replace(/[.+?^${}()|[\]\\]/g, "\\$&") // Escape special chars
215
+ .replace(/\\\*/g, ".*"); // Handle * wildcard (already escaped by above)
216
+
217
+ // Replace :param with capture groups
218
+ regexPattern = regexPattern.replace(/:([a-zA-Z_][a-zA-Z0-9_]*)/g, (_, key) => {
219
+ keys.push(key);
220
+ return "([^/]+)"; // Match any non-slash characters
221
+ });
222
+
223
+ // Create regex that matches the entire pathname
224
+ const regex = new RegExp(`^${regexPattern}$`);
225
+ return {
226
+ regex,
227
+ keys
228
+ };
229
+ }
230
+ }
231
+
232
+ //# sourceMappingURL=RouteUrl.js.map