@blueprint-ts/core 4.1.0-beta.1 → 4.1.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (507) hide show
  1. package/dist/bulkRequests/BulkRequestEvent.enum.d.ts +4 -0
  2. package/dist/bulkRequests/BulkRequestEvent.enum.js +5 -0
  3. package/dist/bulkRequests/BulkRequestSender.d.ts +31 -0
  4. package/dist/bulkRequests/BulkRequestSender.js +161 -0
  5. package/dist/bulkRequests/BulkRequestWrapper.d.ts +15 -0
  6. package/dist/bulkRequests/BulkRequestWrapper.js +50 -0
  7. package/dist/bulkRequests/index.d.ts +5 -0
  8. package/dist/bulkRequests/index.js +5 -0
  9. package/{src/laravel/pagination/contracts/PaginationResponseBodyContract.ts → dist/laravel/pagination/contracts/PaginationResponseBodyContract.d.ts} +4 -4
  10. package/dist/laravel/pagination/contracts/PaginationResponseBodyContract.js +1 -0
  11. package/dist/laravel/pagination/dataDrivers/RequestDriver.d.ts +10 -0
  12. package/dist/laravel/pagination/dataDrivers/RequestDriver.js +18 -0
  13. package/dist/laravel/pagination/index.d.ts +4 -0
  14. package/dist/laravel/pagination/index.js +2 -0
  15. package/dist/laravel/requests/JsonBaseRequest.d.ts +14 -0
  16. package/dist/laravel/requests/JsonBaseRequest.js +15 -0
  17. package/dist/laravel/requests/PaginationJsonBaseRequest.d.ts +8 -0
  18. package/dist/laravel/requests/PaginationJsonBaseRequest.js +13 -0
  19. package/dist/laravel/requests/index.d.ts +7 -0
  20. package/dist/laravel/requests/index.js +5 -0
  21. package/dist/laravel/requests/responses/JsonResponse.d.ts +5 -0
  22. package/dist/laravel/requests/responses/JsonResponse.js +6 -0
  23. package/dist/laravel/requests/responses/PaginationResponse.d.ts +7 -0
  24. package/dist/laravel/requests/responses/PaginationResponse.js +9 -0
  25. package/dist/pagination/BasePaginator.d.ts +19 -0
  26. package/dist/pagination/BasePaginator.js +65 -0
  27. package/dist/pagination/InfiniteScroller.d.ts +6 -0
  28. package/dist/pagination/InfiniteScroller.js +17 -0
  29. package/dist/pagination/PageAwarePaginator.d.ts +32 -0
  30. package/dist/pagination/PageAwarePaginator.js +86 -0
  31. package/dist/pagination/StatePaginator.d.ts +25 -0
  32. package/dist/pagination/StatePaginator.js +55 -0
  33. package/dist/pagination/contracts/BaseViewDriverContract.d.ts +6 -0
  34. package/dist/pagination/contracts/BaseViewDriverContract.js +1 -0
  35. package/{src/pagination/contracts/BaseViewDriverFactoryContract.ts → dist/pagination/contracts/BaseViewDriverFactoryContract.d.ts} +2 -3
  36. package/dist/pagination/contracts/BaseViewDriverFactoryContract.js +1 -0
  37. package/dist/pagination/contracts/PaginateableRequestContract.d.ts +4 -0
  38. package/dist/pagination/contracts/PaginateableRequestContract.js +1 -0
  39. package/dist/pagination/contracts/PaginationDataDriverContract.d.ts +4 -0
  40. package/dist/pagination/contracts/PaginationDataDriverContract.js +1 -0
  41. package/{src/pagination/contracts/PaginationResponseContract.ts → dist/pagination/contracts/PaginationResponseContract.d.ts} +3 -5
  42. package/dist/pagination/contracts/PaginationResponseContract.js +1 -0
  43. package/{src/pagination/contracts/PaginatorLoadDataOptions.ts → dist/pagination/contracts/PaginatorLoadDataOptions.d.ts} +2 -2
  44. package/dist/pagination/contracts/PaginatorLoadDataOptions.js +1 -0
  45. package/{src/pagination/contracts/StatePaginationDataDriverContract.ts → dist/pagination/contracts/StatePaginationDataDriverContract.d.ts} +2 -3
  46. package/dist/pagination/contracts/StatePaginationDataDriverContract.js +1 -0
  47. package/dist/pagination/contracts/ViewDriverContract.d.ts +9 -0
  48. package/dist/pagination/contracts/ViewDriverContract.js +1 -0
  49. package/dist/pagination/contracts/ViewDriverFactoryContract.d.ts +4 -0
  50. package/dist/pagination/contracts/ViewDriverFactoryContract.js +1 -0
  51. package/dist/pagination/dataDrivers/ArrayDriver.d.ts +9 -0
  52. package/dist/pagination/dataDrivers/ArrayDriver.js +20 -0
  53. package/dist/pagination/dtos/PaginationDataDto.d.ts +7 -0
  54. package/dist/pagination/dtos/PaginationDataDto.js +12 -0
  55. package/dist/pagination/dtos/StatePaginationDataDto.d.ts +7 -0
  56. package/dist/pagination/dtos/StatePaginationDataDto.js +13 -0
  57. package/dist/pagination/factories/VueBaseViewDriverFactory.d.ts +5 -0
  58. package/dist/pagination/factories/VueBaseViewDriverFactory.js +6 -0
  59. package/dist/pagination/factories/VuePaginationDriverFactory.d.ts +5 -0
  60. package/dist/pagination/factories/VuePaginationDriverFactory.js +6 -0
  61. package/dist/pagination/frontendDrivers/VueBaseViewDriver.d.ts +11 -0
  62. package/dist/pagination/frontendDrivers/VueBaseViewDriver.js +19 -0
  63. package/dist/pagination/frontendDrivers/VuePaginationDriver.d.ts +21 -0
  64. package/dist/pagination/frontendDrivers/VuePaginationDriver.js +41 -0
  65. package/dist/pagination/index.d.ts +22 -0
  66. package/dist/pagination/index.js +13 -0
  67. package/dist/persistenceDrivers/LocalStorageDriver.d.ts +9 -0
  68. package/dist/persistenceDrivers/LocalStorageDriver.js +18 -0
  69. package/dist/persistenceDrivers/NonPersistentDriver.d.ts +7 -0
  70. package/dist/persistenceDrivers/NonPersistentDriver.js +8 -0
  71. package/dist/persistenceDrivers/SessionStorageDriver.d.ts +9 -0
  72. package/dist/persistenceDrivers/SessionStorageDriver.js +18 -0
  73. package/dist/persistenceDrivers/index.d.ts +6 -0
  74. package/dist/persistenceDrivers/index.js +4 -0
  75. package/dist/persistenceDrivers/types/PersistenceDriver.d.ts +5 -0
  76. package/dist/persistenceDrivers/types/PersistenceDriver.js +1 -0
  77. package/dist/requests/BaseRequest.d.ts +62 -0
  78. package/dist/requests/BaseRequest.js +224 -0
  79. package/dist/requests/ErrorHandler.d.ts +11 -0
  80. package/dist/requests/ErrorHandler.js +127 -0
  81. package/dist/requests/RequestConcurrencyMode.enum.d.ts +6 -0
  82. package/dist/requests/RequestConcurrencyMode.enum.js +7 -0
  83. package/dist/requests/RequestErrorRouter.d.ts +38 -0
  84. package/dist/requests/RequestErrorRouter.js +38 -0
  85. package/dist/requests/RequestEvents.enum.d.ts +4 -0
  86. package/dist/requests/RequestEvents.enum.js +5 -0
  87. package/dist/requests/RequestMethod.enum.d.ts +8 -0
  88. package/dist/requests/RequestMethod.enum.js +9 -0
  89. package/dist/requests/bodies/BinaryBody.d.ts +10 -0
  90. package/dist/requests/bodies/BinaryBody.js +22 -0
  91. package/dist/requests/bodies/FormDataBody.d.ts +14 -0
  92. package/dist/requests/bodies/FormDataBody.js +60 -0
  93. package/dist/requests/bodies/JsonBody.d.ts +8 -0
  94. package/dist/requests/bodies/JsonBody.js +13 -0
  95. package/{src/requests/contracts/AbortableRequestContract.ts → dist/requests/contracts/AbortableRequestContract.d.ts} +1 -1
  96. package/dist/requests/contracts/AbortableRequestContract.js +1 -0
  97. package/dist/requests/contracts/BaseRequestContract.d.ts +23 -0
  98. package/dist/requests/contracts/BaseRequestContract.js +1 -0
  99. package/dist/requests/contracts/BodyContract.d.ts +6 -0
  100. package/dist/requests/contracts/BodyContract.js +1 -0
  101. package/dist/requests/contracts/BodyFactoryContract.d.ts +4 -0
  102. package/dist/requests/contracts/BodyFactoryContract.js +1 -0
  103. package/dist/requests/contracts/DriverConfigContract.d.ts +8 -0
  104. package/dist/requests/contracts/DriverConfigContract.js +1 -0
  105. package/dist/requests/contracts/HeadersContract.d.ts +7 -0
  106. package/dist/requests/contracts/HeadersContract.js +1 -0
  107. package/dist/requests/contracts/RequestDriverContract.d.ts +8 -0
  108. package/dist/requests/contracts/RequestDriverContract.js +1 -0
  109. package/dist/requests/contracts/RequestLoaderContract.d.ts +4 -0
  110. package/dist/requests/contracts/RequestLoaderContract.js +1 -0
  111. package/{src/requests/contracts/RequestLoaderFactoryContract.ts → dist/requests/contracts/RequestLoaderFactoryContract.d.ts} +2 -3
  112. package/dist/requests/contracts/RequestLoaderFactoryContract.js +1 -0
  113. package/dist/requests/contracts/ResponseContract.d.ts +5 -0
  114. package/dist/requests/contracts/ResponseContract.js +1 -0
  115. package/dist/requests/drivers/contracts/ResponseHandlerContract.d.ts +9 -0
  116. package/dist/requests/drivers/contracts/ResponseHandlerContract.js +1 -0
  117. package/dist/requests/drivers/fetch/FetchDriver.d.ts +26 -0
  118. package/dist/requests/drivers/fetch/FetchDriver.js +73 -0
  119. package/dist/requests/drivers/fetch/FetchResponse.d.ts +12 -0
  120. package/dist/requests/drivers/fetch/FetchResponse.js +38 -0
  121. package/dist/requests/drivers/xhr/XMLHttpRequestDriver.d.ts +13 -0
  122. package/dist/requests/drivers/xhr/XMLHttpRequestDriver.js +107 -0
  123. package/dist/requests/drivers/xhr/XMLHttpRequestResponse.d.ts +17 -0
  124. package/dist/requests/drivers/xhr/XMLHttpRequestResponse.js +84 -0
  125. package/dist/requests/exceptions/BadGatewayException.d.ts +3 -0
  126. package/dist/requests/exceptions/BadGatewayException.js +3 -0
  127. package/dist/requests/exceptions/BadRequestException.d.ts +3 -0
  128. package/dist/requests/exceptions/BadRequestException.js +3 -0
  129. package/dist/requests/exceptions/ConflictException.d.ts +3 -0
  130. package/dist/requests/exceptions/ConflictException.js +3 -0
  131. package/dist/requests/exceptions/ForbiddenException.d.ts +3 -0
  132. package/dist/requests/exceptions/ForbiddenException.js +3 -0
  133. package/dist/requests/exceptions/GatewayTimeoutException.d.ts +3 -0
  134. package/dist/requests/exceptions/GatewayTimeoutException.js +3 -0
  135. package/dist/requests/exceptions/GoneException.d.ts +3 -0
  136. package/dist/requests/exceptions/GoneException.js +3 -0
  137. package/dist/requests/exceptions/InvalidJsonException.d.ts +7 -0
  138. package/dist/requests/exceptions/InvalidJsonException.js +10 -0
  139. package/dist/requests/exceptions/LockedException.d.ts +3 -0
  140. package/dist/requests/exceptions/LockedException.js +3 -0
  141. package/dist/requests/exceptions/MethodNotAllowedException.d.ts +3 -0
  142. package/dist/requests/exceptions/MethodNotAllowedException.js +3 -0
  143. package/dist/requests/exceptions/NoResponseReceivedException.d.ts +3 -0
  144. package/{src/requests/exceptions/NoResponseReceivedException.ts → dist/requests/exceptions/NoResponseReceivedException.js} +3 -3
  145. package/dist/requests/exceptions/NotFoundException.d.ts +3 -0
  146. package/dist/requests/exceptions/NotFoundException.js +3 -0
  147. package/dist/requests/exceptions/NotImplementedException.d.ts +3 -0
  148. package/dist/requests/exceptions/NotImplementedException.js +3 -0
  149. package/dist/requests/exceptions/PageExpiredException.d.ts +3 -0
  150. package/dist/requests/exceptions/PageExpiredException.js +3 -0
  151. package/dist/requests/exceptions/PayloadTooLargeException.d.ts +3 -0
  152. package/dist/requests/exceptions/PayloadTooLargeException.js +3 -0
  153. package/dist/requests/exceptions/PreconditionFailedException.d.ts +3 -0
  154. package/dist/requests/exceptions/PreconditionFailedException.js +3 -0
  155. package/dist/requests/exceptions/RequestTimeoutException.d.ts +3 -0
  156. package/dist/requests/exceptions/RequestTimeoutException.js +3 -0
  157. package/dist/requests/exceptions/ResponseBodyException.d.ts +7 -0
  158. package/dist/requests/exceptions/ResponseBodyException.js +10 -0
  159. package/dist/requests/exceptions/ResponseException.d.ts +6 -0
  160. package/dist/requests/exceptions/ResponseException.js +9 -0
  161. package/dist/requests/exceptions/ServerErrorException.d.ts +3 -0
  162. package/dist/requests/exceptions/ServerErrorException.js +3 -0
  163. package/dist/requests/exceptions/ServiceUnavailableException.d.ts +3 -0
  164. package/dist/requests/exceptions/ServiceUnavailableException.js +3 -0
  165. package/dist/requests/exceptions/StaleResponseException.d.ts +5 -0
  166. package/dist/requests/exceptions/StaleResponseException.js +10 -0
  167. package/dist/requests/exceptions/TooManyRequestsException.d.ts +3 -0
  168. package/dist/requests/exceptions/TooManyRequestsException.js +3 -0
  169. package/dist/requests/exceptions/UnauthorizedException.d.ts +3 -0
  170. package/dist/requests/exceptions/UnauthorizedException.js +3 -0
  171. package/dist/requests/exceptions/UnsupportedMediaTypeException.d.ts +3 -0
  172. package/dist/requests/exceptions/UnsupportedMediaTypeException.js +3 -0
  173. package/dist/requests/exceptions/ValidationException.d.ts +3 -0
  174. package/dist/requests/exceptions/ValidationException.js +3 -0
  175. package/dist/requests/exceptions/index.d.ts +25 -0
  176. package/dist/requests/exceptions/index.js +25 -0
  177. package/dist/requests/factories/BinaryBodyFactory.d.ts +8 -0
  178. package/dist/requests/factories/BinaryBodyFactory.js +9 -0
  179. package/dist/requests/factories/FormDataFactory.d.ts +12 -0
  180. package/dist/requests/factories/FormDataFactory.js +6 -0
  181. package/dist/requests/factories/JsonBodyFactory.d.ts +5 -0
  182. package/dist/requests/factories/JsonBodyFactory.js +6 -0
  183. package/dist/requests/index.d.ts +31 -0
  184. package/dist/requests/index.js +19 -0
  185. package/dist/requests/responses/BaseResponse.d.ts +14 -0
  186. package/dist/requests/responses/BaseResponse.js +36 -0
  187. package/dist/requests/responses/BlobResponse.d.ts +7 -0
  188. package/dist/requests/responses/BlobResponse.js +16 -0
  189. package/dist/requests/responses/JsonResponse.d.ts +5 -0
  190. package/dist/requests/responses/JsonResponse.js +12 -0
  191. package/dist/requests/responses/PlainTextResponse.d.ts +5 -0
  192. package/dist/requests/responses/PlainTextResponse.js +12 -0
  193. package/{src/requests/types/RequestConcurrencyOptions.ts → dist/requests/types/RequestConcurrencyOptions.d.ts} +4 -5
  194. package/dist/requests/types/RequestConcurrencyOptions.js +1 -0
  195. package/dist/requests/types/RequestUploadProgress.d.ts +6 -0
  196. package/dist/requests/types/RequestUploadProgress.js +1 -0
  197. package/dist/support/DeferredPromise.d.ts +37 -0
  198. package/dist/support/DeferredPromise.js +55 -0
  199. package/dist/support/helpers.d.ts +5 -0
  200. package/dist/support/helpers.js +69 -0
  201. package/{src/support/index.ts → dist/support/index.d.ts} +3 -4
  202. package/dist/support/index.js +3 -0
  203. package/dist/vue/composables/useConfirmDialog.d.ts +20 -0
  204. package/dist/vue/composables/useConfirmDialog.js +52 -0
  205. package/dist/vue/composables/useGlobalCheckbox.d.ts +13 -0
  206. package/dist/vue/composables/useGlobalCheckbox.js +123 -0
  207. package/dist/vue/composables/useIsEmpty.d.ts +4 -0
  208. package/dist/vue/composables/useIsEmpty.js +27 -0
  209. package/dist/vue/composables/useIsOpen.d.ts +5 -0
  210. package/dist/vue/composables/useIsOpen.js +25 -0
  211. package/dist/vue/composables/useIsOpenFromVar.d.ts +6 -0
  212. package/dist/vue/composables/useIsOpenFromVar.js +45 -0
  213. package/dist/vue/composables/useModelWrapper.d.ts +9 -0
  214. package/dist/vue/composables/useModelWrapper.js +18 -0
  215. package/dist/vue/composables/useOnOpen.d.ts +7 -0
  216. package/dist/vue/composables/useOnOpen.js +25 -0
  217. package/{src/vue/contracts/ModelValueOptions.ts → dist/vue/contracts/ModelValueOptions.d.ts} +1 -1
  218. package/dist/vue/contracts/ModelValueOptions.js +1 -0
  219. package/dist/vue/contracts/ModelValueProps.d.ts +3 -0
  220. package/dist/vue/contracts/ModelValueProps.js +1 -0
  221. package/dist/vue/forms/BaseForm.d.ts +162 -0
  222. package/dist/vue/forms/BaseForm.js +997 -0
  223. package/dist/vue/forms/PropertyAwareArray.d.ts +53 -0
  224. package/dist/vue/forms/PropertyAwareArray.js +54 -0
  225. package/{src/vue/forms/index.ts → dist/vue/forms/index.d.ts} +9 -11
  226. package/dist/vue/forms/index.js +6 -0
  227. package/dist/vue/forms/types/PersistedForm.d.ts +6 -0
  228. package/dist/vue/forms/types/PersistedForm.js +1 -0
  229. package/dist/vue/forms/validation/ValidationMode.enum.d.ts +11 -0
  230. package/dist/vue/forms/validation/ValidationMode.enum.js +14 -0
  231. package/dist/vue/forms/validation/index.d.ts +12 -0
  232. package/dist/vue/forms/validation/index.js +9 -0
  233. package/dist/vue/forms/validation/rules/BaseRule.d.ts +5 -0
  234. package/dist/vue/forms/validation/rules/BaseRule.js +5 -0
  235. package/dist/vue/forms/validation/rules/ConfirmedRule.d.ts +10 -0
  236. package/dist/vue/forms/validation/rules/ConfirmedRule.js +26 -0
  237. package/dist/vue/forms/validation/rules/EmailRule.d.ts +7 -0
  238. package/dist/vue/forms/validation/rules/EmailRule.js +19 -0
  239. package/dist/vue/forms/validation/rules/JsonRule.d.ts +7 -0
  240. package/dist/vue/forms/validation/rules/JsonRule.js +25 -0
  241. package/dist/vue/forms/validation/rules/MinRule.d.ts +26 -0
  242. package/dist/vue/forms/validation/rules/MinRule.js +52 -0
  243. package/dist/vue/forms/validation/rules/RequiredRule.d.ts +7 -0
  244. package/dist/vue/forms/validation/rules/RequiredRule.js +16 -0
  245. package/dist/vue/forms/validation/rules/UrlRule.d.ts +7 -0
  246. package/dist/vue/forms/validation/rules/UrlRule.js +22 -0
  247. package/{src/vue/forms/validation/types/BidirectionalRule.ts → dist/vue/forms/validation/types/BidirectionalRule.d.ts} +4 -4
  248. package/dist/vue/forms/validation/types/BidirectionalRule.js +1 -0
  249. package/dist/vue/forms/validation/types/ValidationRules.d.ts +11 -0
  250. package/dist/vue/forms/validation/types/ValidationRules.js +1 -0
  251. package/dist/vue/index.d.ts +11 -0
  252. package/dist/vue/index.js +10 -0
  253. package/dist/vue/requests/factories/VueRequestLoaderFactory.d.ts +6 -0
  254. package/dist/vue/requests/factories/VueRequestLoaderFactory.js +6 -0
  255. package/{src/vue/requests/index.ts → dist/vue/requests/index.d.ts} +4 -5
  256. package/dist/vue/requests/index.js +4 -0
  257. package/dist/vue/requests/loaders/VueRequestBatchLoader.d.ts +12 -0
  258. package/dist/vue/requests/loaders/VueRequestBatchLoader.js +29 -0
  259. package/dist/vue/requests/loaders/VueRequestLoader.d.ts +8 -0
  260. package/dist/vue/requests/loaders/VueRequestLoader.js +12 -0
  261. package/dist/vue/router/routeResourceBinding/RouteResourceBoundView.d.ts +57 -0
  262. package/dist/vue/router/routeResourceBinding/RouteResourceBoundView.js +135 -0
  263. package/dist/vue/router/routeResourceBinding/RouteResourceRequestResolver.d.ts +6 -0
  264. package/dist/vue/router/routeResourceBinding/RouteResourceRequestResolver.js +20 -0
  265. package/dist/vue/router/routeResourceBinding/defineRoute.d.ts +23 -0
  266. package/dist/vue/router/routeResourceBinding/defineRoute.js +42 -0
  267. package/dist/vue/router/routeResourceBinding/index.d.ts +8 -0
  268. package/dist/vue/router/routeResourceBinding/index.js +6 -0
  269. package/dist/vue/router/routeResourceBinding/installRouteInjection.d.ts +14 -0
  270. package/dist/vue/router/routeResourceBinding/installRouteInjection.js +133 -0
  271. package/dist/vue/router/routeResourceBinding/types.d.ts +55 -0
  272. package/dist/vue/router/routeResourceBinding/types.js +1 -0
  273. package/dist/vue/router/routeResourceBinding/useRouteResource.d.ts +8 -0
  274. package/dist/vue/router/routeResourceBinding/useRouteResource.js +29 -0
  275. package/dist/vue/state/State.d.ts +75 -0
  276. package/dist/vue/state/State.js +267 -0
  277. package/dist/vue/state/index.d.ts +2 -0
  278. package/dist/vue/state/index.js +2 -0
  279. package/package.json +81 -23
  280. package/.editorconfig +0 -508
  281. package/.eslintrc.cjs +0 -15
  282. package/.prettierrc.json +0 -8
  283. package/CHANGELOG.md +0 -213
  284. package/docker-compose.yaml +0 -8
  285. package/docs/.vitepress/config.ts +0 -124
  286. package/docs/index.md +0 -13
  287. package/docs/laravel/pagination.md +0 -67
  288. package/docs/laravel/requests.md +0 -62
  289. package/docs/services/pagination/index.md +0 -46
  290. package/docs/services/pagination/infinite-scroller.md +0 -20
  291. package/docs/services/pagination/page-aware.md +0 -51
  292. package/docs/services/pagination/state-pagination.md +0 -77
  293. package/docs/services/pagination/updating-rows.md +0 -52
  294. package/docs/services/persistence/index.md +0 -46
  295. package/docs/services/requests/abort-requests.md +0 -29
  296. package/docs/services/requests/bulk-requests.md +0 -70
  297. package/docs/services/requests/concurrency.md +0 -58
  298. package/docs/services/requests/drivers.md +0 -115
  299. package/docs/services/requests/error-handling.md +0 -153
  300. package/docs/services/requests/events.md +0 -53
  301. package/docs/services/requests/file-uploads.md +0 -105
  302. package/docs/services/requests/getting-started.md +0 -201
  303. package/docs/services/requests/headers.md +0 -40
  304. package/docs/services/requests/loading.md +0 -63
  305. package/docs/services/requests/request-bodies.md +0 -61
  306. package/docs/services/requests/responses.md +0 -34
  307. package/docs/services/support/deferred-promise.md +0 -63
  308. package/docs/services/support/helpers.md +0 -77
  309. package/docs/services/support/index.md +0 -6
  310. package/docs/upgrading/v1-to-v2.md +0 -64
  311. package/docs/upgrading/v2-to-v3.md +0 -52
  312. package/docs/upgrading/v3-to-v4.md +0 -214
  313. package/docs/upgrading.md +0 -0
  314. package/docs/vue/composables/use-confirm-dialog.md +0 -96
  315. package/docs/vue/composables/use-global-checkbox.md +0 -73
  316. package/docs/vue/composables/use-is-empty.md +0 -26
  317. package/docs/vue/composables/use-is-open-from-var.md +0 -32
  318. package/docs/vue/composables/use-is-open.md +0 -28
  319. package/docs/vue/composables/use-model-wrapper.md +0 -29
  320. package/docs/vue/composables/use-on-open.md +0 -26
  321. package/docs/vue/forms/arrays.md +0 -102
  322. package/docs/vue/forms/errors.md +0 -52
  323. package/docs/vue/forms/index.md +0 -99
  324. package/docs/vue/forms/payloads.md +0 -99
  325. package/docs/vue/forms/persistence.md +0 -19
  326. package/docs/vue/forms/state-and-properties.md +0 -26
  327. package/docs/vue/forms/utilities.md +0 -27
  328. package/docs/vue/forms/validation.md +0 -189
  329. package/docs/vue/requests/loading.md +0 -51
  330. package/docs/vue/router/route-resource-binding.md +0 -240
  331. package/docs/vue/state.md +0 -309
  332. package/env.d.ts +0 -1
  333. package/eslint.config.js +0 -15
  334. package/release-tool.json +0 -26
  335. package/src/bulkRequests/BulkRequestEvent.enum.ts +0 -4
  336. package/src/bulkRequests/BulkRequestSender.ts +0 -196
  337. package/src/bulkRequests/BulkRequestWrapper.ts +0 -49
  338. package/src/bulkRequests/index.ts +0 -6
  339. package/src/laravel/pagination/dataDrivers/RequestDriver.ts +0 -30
  340. package/src/laravel/pagination/index.ts +0 -6
  341. package/src/laravel/requests/JsonBaseRequest.ts +0 -35
  342. package/src/laravel/requests/PaginationJsonBaseRequest.ts +0 -29
  343. package/src/laravel/requests/index.ts +0 -9
  344. package/src/laravel/requests/responses/JsonResponse.ts +0 -8
  345. package/src/laravel/requests/responses/PaginationResponse.ts +0 -16
  346. package/src/pagination/BasePaginator.ts +0 -94
  347. package/src/pagination/InfiniteScroller.ts +0 -22
  348. package/src/pagination/PageAwarePaginator.ts +0 -132
  349. package/src/pagination/StatePaginator.ts +0 -86
  350. package/src/pagination/contracts/BaseViewDriverContract.ts +0 -6
  351. package/src/pagination/contracts/PaginateableRequestContract.ts +0 -13
  352. package/src/pagination/contracts/PaginationDataDriverContract.ts +0 -5
  353. package/src/pagination/contracts/ViewDriverContract.ts +0 -10
  354. package/src/pagination/contracts/ViewDriverFactoryContract.ts +0 -5
  355. package/src/pagination/dataDrivers/ArrayDriver.ts +0 -28
  356. package/src/pagination/dtos/PaginationDataDto.ts +0 -14
  357. package/src/pagination/dtos/StatePaginationDataDto.ts +0 -19
  358. package/src/pagination/factories/VueBaseViewDriverFactory.ts +0 -9
  359. package/src/pagination/factories/VuePaginationDriverFactory.ts +0 -9
  360. package/src/pagination/frontendDrivers/VueBaseViewDriver.ts +0 -28
  361. package/src/pagination/frontendDrivers/VuePaginationDriver.ts +0 -61
  362. package/src/pagination/index.ts +0 -46
  363. package/src/persistenceDrivers/LocalStorageDriver.ts +0 -22
  364. package/src/persistenceDrivers/NonPersistentDriver.ts +0 -12
  365. package/src/persistenceDrivers/SessionStorageDriver.ts +0 -22
  366. package/src/persistenceDrivers/index.ts +0 -8
  367. package/src/persistenceDrivers/types/PersistenceDriver.ts +0 -5
  368. package/src/requests/BaseRequest.ts +0 -321
  369. package/src/requests/ErrorHandler.ts +0 -144
  370. package/src/requests/RequestConcurrencyMode.enum.ts +0 -6
  371. package/src/requests/RequestErrorRouter.ts +0 -89
  372. package/src/requests/RequestEvents.enum.ts +0 -4
  373. package/src/requests/RequestMethod.enum.ts +0 -8
  374. package/src/requests/bodies/FormDataBody.ts +0 -81
  375. package/src/requests/bodies/JsonBody.ts +0 -16
  376. package/src/requests/contracts/BaseRequestContract.ts +0 -39
  377. package/src/requests/contracts/BodyContract.ts +0 -7
  378. package/src/requests/contracts/BodyFactoryContract.ts +0 -5
  379. package/src/requests/contracts/DriverConfigContract.ts +0 -9
  380. package/src/requests/contracts/HeadersContract.ts +0 -5
  381. package/src/requests/contracts/RequestDriverContract.ts +0 -15
  382. package/src/requests/contracts/RequestLoaderContract.ts +0 -5
  383. package/src/requests/contracts/ResponseContract.ts +0 -7
  384. package/src/requests/drivers/contracts/ResponseHandlerContract.ts +0 -10
  385. package/src/requests/drivers/fetch/FetchDriver.ts +0 -115
  386. package/src/requests/drivers/fetch/FetchResponse.ts +0 -30
  387. package/src/requests/drivers/xhr/XMLHttpRequestDriver.ts +0 -138
  388. package/src/requests/drivers/xhr/XMLHttpRequestResponse.ts +0 -95
  389. package/src/requests/exceptions/BadGatewayException.ts +0 -3
  390. package/src/requests/exceptions/BadRequestException.ts +0 -3
  391. package/src/requests/exceptions/ConflictException.ts +0 -3
  392. package/src/requests/exceptions/ForbiddenException.ts +0 -3
  393. package/src/requests/exceptions/GatewayTimeoutException.ts +0 -3
  394. package/src/requests/exceptions/GoneException.ts +0 -3
  395. package/src/requests/exceptions/InvalidJsonException.ts +0 -15
  396. package/src/requests/exceptions/LockedException.ts +0 -3
  397. package/src/requests/exceptions/MethodNotAllowedException.ts +0 -3
  398. package/src/requests/exceptions/NotFoundException.ts +0 -3
  399. package/src/requests/exceptions/NotImplementedException.ts +0 -3
  400. package/src/requests/exceptions/PageExpiredException.ts +0 -3
  401. package/src/requests/exceptions/PayloadTooLargeException.ts +0 -3
  402. package/src/requests/exceptions/PreconditionFailedException.ts +0 -3
  403. package/src/requests/exceptions/RequestTimeoutException.ts +0 -3
  404. package/src/requests/exceptions/ResponseBodyException.ts +0 -15
  405. package/src/requests/exceptions/ResponseException.ts +0 -11
  406. package/src/requests/exceptions/ServerErrorException.ts +0 -3
  407. package/src/requests/exceptions/ServiceUnavailableException.ts +0 -3
  408. package/src/requests/exceptions/StaleResponseException.ts +0 -13
  409. package/src/requests/exceptions/TooManyRequestsException.ts +0 -3
  410. package/src/requests/exceptions/UnauthorizedException.ts +0 -3
  411. package/src/requests/exceptions/UnsupportedMediaTypeException.ts +0 -3
  412. package/src/requests/exceptions/ValidationException.ts +0 -3
  413. package/src/requests/exceptions/index.ts +0 -51
  414. package/src/requests/factories/FormDataFactory.ts +0 -17
  415. package/src/requests/factories/JsonBodyFactory.ts +0 -9
  416. package/src/requests/index.ts +0 -61
  417. package/src/requests/responses/BaseResponse.ts +0 -41
  418. package/src/requests/responses/BlobResponse.ts +0 -19
  419. package/src/requests/responses/JsonResponse.ts +0 -15
  420. package/src/requests/responses/PlainTextResponse.ts +0 -15
  421. package/src/requests/types/RequestUploadProgress.ts +0 -6
  422. package/src/support/DeferredPromise.ts +0 -67
  423. package/src/support/helpers.ts +0 -78
  424. package/src/vue/composables/useConfirmDialog.ts +0 -63
  425. package/src/vue/composables/useGlobalCheckbox.ts +0 -145
  426. package/src/vue/composables/useIsEmpty.ts +0 -34
  427. package/src/vue/composables/useIsOpen.ts +0 -37
  428. package/src/vue/composables/useIsOpenFromVar.ts +0 -61
  429. package/src/vue/composables/useModelWrapper.ts +0 -27
  430. package/src/vue/composables/useOnOpen.ts +0 -34
  431. package/src/vue/contracts/ModelValueProps.ts +0 -3
  432. package/src/vue/forms/BaseForm.ts +0 -1192
  433. package/src/vue/forms/PropertyAwareArray.ts +0 -81
  434. package/src/vue/forms/types/PersistedForm.ts +0 -6
  435. package/src/vue/forms/validation/ValidationMode.enum.ts +0 -14
  436. package/src/vue/forms/validation/index.ts +0 -15
  437. package/src/vue/forms/validation/rules/BaseRule.ts +0 -7
  438. package/src/vue/forms/validation/rules/ConfirmedRule.ts +0 -39
  439. package/src/vue/forms/validation/rules/EmailRule.ts +0 -23
  440. package/src/vue/forms/validation/rules/JsonRule.ts +0 -28
  441. package/src/vue/forms/validation/rules/MinRule.ts +0 -61
  442. package/src/vue/forms/validation/rules/RequiredRule.ts +0 -19
  443. package/src/vue/forms/validation/rules/UrlRule.ts +0 -24
  444. package/src/vue/forms/validation/types/ValidationRules.ts +0 -15
  445. package/src/vue/index.ts +0 -14
  446. package/src/vue/requests/factories/VueRequestLoaderFactory.ts +0 -10
  447. package/src/vue/requests/loaders/VueRequestBatchLoader.ts +0 -35
  448. package/src/vue/requests/loaders/VueRequestLoader.ts +0 -18
  449. package/src/vue/router/routeResourceBinding/RouteResourceBoundView.ts +0 -145
  450. package/src/vue/router/routeResourceBinding/RouteResourceRequestResolver.ts +0 -11
  451. package/src/vue/router/routeResourceBinding/defineRoute.ts +0 -59
  452. package/src/vue/router/routeResourceBinding/index.ts +0 -11
  453. package/src/vue/router/routeResourceBinding/installRouteInjection.ts +0 -164
  454. package/src/vue/router/routeResourceBinding/types.ts +0 -53
  455. package/src/vue/router/routeResourceBinding/useRouteResource.ts +0 -24
  456. package/src/vue/state/State.ts +0 -380
  457. package/src/vue/state/index.ts +0 -3
  458. package/tests/service/bulkRequests/BulkRequestSender.test.ts +0 -76
  459. package/tests/service/bulkRequests/BulkRequestWrapper.test.ts +0 -51
  460. package/tests/service/helpers/mergeDeep.test.ts +0 -53
  461. package/tests/service/laravel/pagination/dataDrivers/RequestDriver.test.ts +0 -84
  462. package/tests/service/laravel/requests/JsonBaseRequest.test.ts +0 -43
  463. package/tests/service/laravel/requests/PaginationJsonBaseRequest.test.ts +0 -58
  464. package/tests/service/laravel/requests/responses/JsonResponse.test.ts +0 -59
  465. package/tests/service/laravel/requests/responses/PaginationResponse.test.ts +0 -127
  466. package/tests/service/pagination/BasePaginator.test.ts +0 -100
  467. package/tests/service/pagination/InfiniteScroller.test.ts +0 -101
  468. package/tests/service/pagination/PageAwarePaginator.test.ts +0 -133
  469. package/tests/service/pagination/StatePaginator.test.ts +0 -76
  470. package/tests/service/pagination/VueViewDrivers.test.ts +0 -46
  471. package/tests/service/pagination/dtos/PaginationDataDto.test.ts +0 -35
  472. package/tests/service/pagination/dtos/StatePaginationDataDto.test.ts +0 -14
  473. package/tests/service/pagination/factories/VuePaginationDriverFactory.test.ts +0 -32
  474. package/tests/service/pagination/frontendDrivers/VuePaginationDriver.test.ts +0 -66
  475. package/tests/service/persistenceDrivers/PersistenceDrivers.test.ts +0 -56
  476. package/tests/service/requests/BaseRequest.test.ts +0 -250
  477. package/tests/service/requests/BodiesAndFactories.test.ts +0 -28
  478. package/tests/service/requests/Enums.test.ts +0 -20
  479. package/tests/service/requests/ErrorHandler.test.ts +0 -188
  480. package/tests/service/requests/FormDataBody.test.ts +0 -63
  481. package/tests/service/requests/RequestErrorRouter.test.ts +0 -44
  482. package/tests/service/requests/Responses.test.ts +0 -83
  483. package/tests/service/requests/exceptions/Exceptions.test.ts +0 -43
  484. package/tests/service/requests/fetch/FetchDriver.test.ts +0 -76
  485. package/tests/service/requests/fetch/FetchResponse.test.ts +0 -21
  486. package/tests/service/requests/xhr/XMLHttpRequestDriver.test.ts +0 -178
  487. package/tests/service/support/DeferredPromise.test.ts +0 -40
  488. package/tests/service/support/helpers.test.ts +0 -37
  489. package/tests/vue/composables/useConfirmDialog.test.ts +0 -77
  490. package/tests/vue/composables/useGlobalCheckbox.test.ts +0 -126
  491. package/tests/vue/composables/useIsEmpty.test.ts +0 -18
  492. package/tests/vue/composables/useIsOpen.test.ts +0 -25
  493. package/tests/vue/composables/useIsOpenFromVar.test.ts +0 -22
  494. package/tests/vue/composables/useModelWrapper.test.ts +0 -30
  495. package/tests/vue/composables/useOnOpen.test.ts +0 -26
  496. package/tests/vue/forms/BaseForm.behavior.test.ts +0 -98
  497. package/tests/vue/forms/BaseForm.transformers.test.ts +0 -109
  498. package/tests/vue/forms/PropertyAwareArray.test.ts +0 -30
  499. package/tests/vue/forms/validation/ValidationRules.test.ts +0 -79
  500. package/tests/vue/requests/VueRequestLoaders.test.ts +0 -48
  501. package/tests/vue/router/routeResourceBinding/RouteResourceBoundView.test.ts +0 -344
  502. package/tests/vue/router/routeResourceBinding/RouteResourceUtils.test.ts +0 -70
  503. package/tests/vue/router/routeResourceBinding/installRouteInjection.test.ts +0 -450
  504. package/tests/vue/state/State.test.ts +0 -151
  505. package/tsconfig.json +0 -114
  506. package/vite.config.ts +0 -34
  507. package/vitest.config.ts +0 -23
@@ -1,450 +0,0 @@
1
- import { describe, it, expect, vi, beforeEach } from 'vitest'
2
- import { installRouteInjection } from '../../../../src/vue/router/routeResourceBinding/installRouteInjection'
3
-
4
- /**
5
- * Flush all pending microtasks / promises.
6
- */
7
- function flushPromises() {
8
- return new Promise<void>(resolve => setTimeout(resolve, 0))
9
- }
10
-
11
- /**
12
- * Minimal stub for vue-router's Router – we only need `beforeResolve`.
13
- */
14
- function createMockRouter() {
15
- const guards: Array<(to: any) => Promise<void>> = []
16
-
17
- return {
18
- beforeResolve(guard: (to: any) => Promise<void>) {
19
- guards.push(guard)
20
- },
21
- async simulateNavigation(to: any) {
22
- for (const guard of guards) {
23
- await guard(to)
24
- }
25
- }
26
- }
27
- }
28
-
29
- function createRoute(params: Record<string, string>, matched: any[]) {
30
- return {
31
- params,
32
- matched,
33
- meta: {} as Record<string, any>
34
- }
35
- }
36
-
37
- describe('installRouteInjection', () => {
38
- let mockRouter: ReturnType<typeof createMockRouter>
39
-
40
- beforeEach(() => {
41
- mockRouter = createMockRouter()
42
- })
43
-
44
- it('resolves injected props and stores them in _injectedProps', async () => {
45
- installRouteInjection(mockRouter as any)
46
-
47
- const resolveFn = vi.fn().mockResolvedValue('resolved-invoice')
48
-
49
- const to = createRoute({ invoiceId: '123' }, [
50
- {
51
- path: ':invoiceId',
52
- meta: {
53
- inject: {
54
- invoice: {
55
- from: 'invoiceId',
56
- resolve: () => ({ resolve: resolveFn })
57
- }
58
- }
59
- }
60
- }
61
- ])
62
-
63
- await mockRouter.simulateNavigation(to)
64
- await flushPromises()
65
-
66
- expect(resolveFn).toHaveBeenCalledTimes(1)
67
- expect(to.meta._injectedProps).toEqual({ invoice: 'resolved-invoice' })
68
- })
69
-
70
- it('reuses cached value when navigating to a child route with the same param', async () => {
71
- installRouteInjection(mockRouter as any)
72
-
73
- const resolveFn = vi.fn().mockResolvedValue('resolved-invoice')
74
- const parentRecord = {
75
- path: ':invoiceId',
76
- meta: {
77
- inject: {
78
- invoice: {
79
- from: 'invoiceId',
80
- resolve: () => ({ resolve: resolveFn })
81
- }
82
- }
83
- }
84
- }
85
-
86
- // First navigation: parent route
87
- const to1 = createRoute({ invoiceId: '123' }, [parentRecord])
88
- await mockRouter.simulateNavigation(to1)
89
- await flushPromises()
90
-
91
- expect(resolveFn).toHaveBeenCalledTimes(1)
92
- expect(to1.meta._injectedProps).toEqual({ invoice: 'resolved-invoice' })
93
-
94
- // Second navigation: parent + child route, same invoiceId
95
- const to2 = createRoute({ invoiceId: '123' }, [
96
- parentRecord,
97
- { path: 'details', meta: {} }
98
- ])
99
- await mockRouter.simulateNavigation(to2)
100
- await flushPromises()
101
-
102
- // resolve should NOT be called again – cached value reused
103
- expect(resolveFn).toHaveBeenCalledTimes(1)
104
- expect(to2.meta._injectedProps).toEqual({ invoice: 'resolved-invoice' })
105
- })
106
-
107
- it('re-resolves when param value changes', async () => {
108
- installRouteInjection(mockRouter as any)
109
-
110
- const resolveFn = vi.fn()
111
- .mockResolvedValueOnce('invoice-A')
112
- .mockResolvedValueOnce('invoice-B')
113
-
114
- const makeParent = () => ({
115
- path: ':invoiceId',
116
- meta: {
117
- inject: {
118
- invoice: {
119
- from: 'invoiceId',
120
- resolve: () => ({ resolve: resolveFn })
121
- }
122
- }
123
- }
124
- })
125
-
126
- // Navigate with invoiceId=1
127
- const to1 = createRoute({ invoiceId: '1' }, [makeParent()])
128
- await mockRouter.simulateNavigation(to1)
129
- await flushPromises()
130
-
131
- expect(resolveFn).toHaveBeenCalledTimes(1)
132
- expect(to1.meta._injectedProps).toEqual({ invoice: 'invoice-A' })
133
-
134
- // Navigate with invoiceId=2 – must re-resolve
135
- const to2 = createRoute({ invoiceId: '2' }, [makeParent()])
136
- await mockRouter.simulateNavigation(to2)
137
- await flushPromises()
138
-
139
- expect(resolveFn).toHaveBeenCalledTimes(2)
140
- expect(to2.meta._injectedProps).toEqual({ invoice: 'invoice-B' })
141
- })
142
-
143
- it('refresh() bypasses cache and fetches fresh data', async () => {
144
- installRouteInjection(mockRouter as any)
145
-
146
- const resolveFn = vi.fn()
147
- .mockResolvedValueOnce('old-data')
148
- .mockResolvedValueOnce('fresh-data')
149
-
150
- const to = createRoute({ invoiceId: '123' }, [
151
- {
152
- path: ':invoiceId',
153
- meta: {
154
- inject: {
155
- invoice: {
156
- from: 'invoiceId',
157
- resolve: () => ({ resolve: resolveFn })
158
- }
159
- }
160
- }
161
- }
162
- ])
163
-
164
- await mockRouter.simulateNavigation(to)
165
- await flushPromises()
166
- expect(to.meta._injectedProps).toEqual({ invoice: 'old-data' })
167
-
168
- // Manually refresh
169
- await to.meta.refresh!('invoice')
170
- expect(resolveFn).toHaveBeenCalledTimes(2)
171
- expect(to.meta._injectedProps).toEqual({ invoice: 'fresh-data' })
172
- })
173
-
174
- it('evicts cache entries when navigating away from a route', async () => {
175
- installRouteInjection(mockRouter as any)
176
-
177
- const invoiceResolve = vi.fn().mockResolvedValue('invoice-data')
178
- const productResolve = vi.fn().mockResolvedValue('product-data')
179
-
180
- // Navigate to invoice route
181
- const to1 = createRoute({ invoiceId: '1' }, [
182
- {
183
- path: ':invoiceId',
184
- meta: {
185
- inject: {
186
- invoice: {
187
- from: 'invoiceId',
188
- resolve: () => ({ resolve: invoiceResolve })
189
- }
190
- }
191
- }
192
- }
193
- ])
194
- await mockRouter.simulateNavigation(to1)
195
- await flushPromises()
196
- expect(invoiceResolve).toHaveBeenCalledTimes(1)
197
-
198
- // Navigate to a completely different route (product)
199
- const to2 = createRoute({ productId: '5' }, [
200
- {
201
- path: ':productId',
202
- meta: {
203
- inject: {
204
- product: {
205
- from: 'productId',
206
- resolve: () => ({ resolve: productResolve })
207
- }
208
- }
209
- }
210
- }
211
- ])
212
- await mockRouter.simulateNavigation(to2)
213
- await flushPromises()
214
-
215
- // Now navigate back to invoice with the same id – should re-resolve (cache was evicted)
216
- const to3 = createRoute({ invoiceId: '1' }, [
217
- {
218
- path: ':invoiceId',
219
- meta: {
220
- inject: {
221
- invoice: {
222
- from: 'invoiceId',
223
- resolve: () => ({ resolve: invoiceResolve })
224
- }
225
- }
226
- }
227
- }
228
- ])
229
- await mockRouter.simulateNavigation(to3)
230
- await flushPromises()
231
- expect(invoiceResolve).toHaveBeenCalledTimes(2)
232
- })
233
-
234
- it('child routes inherit parent injected props without re-resolving across multiple children', async () => {
235
- installRouteInjection(mockRouter as any)
236
-
237
- const resolveFn = vi.fn().mockResolvedValue('invoice-data')
238
- const parentRecord = {
239
- path: ':invoiceId',
240
- meta: {
241
- inject: {
242
- invoice: {
243
- from: 'invoiceId',
244
- resolve: () => ({ resolve: resolveFn })
245
- }
246
- }
247
- }
248
- }
249
-
250
- // Navigate to parent
251
- await mockRouter.simulateNavigation(createRoute({ invoiceId: '42' }, [parentRecord]))
252
- await flushPromises()
253
- expect(resolveFn).toHaveBeenCalledTimes(1)
254
-
255
- // Navigate to child A
256
- const toChildA = createRoute({ invoiceId: '42' }, [parentRecord, { path: 'edit', meta: {} }])
257
- await mockRouter.simulateNavigation(toChildA)
258
- await flushPromises()
259
- expect(resolveFn).toHaveBeenCalledTimes(1)
260
- expect(toChildA.meta._injectedProps).toEqual({ invoice: 'invoice-data' })
261
-
262
- // Navigate to child B
263
- const toChildB = createRoute({ invoiceId: '42' }, [parentRecord, { path: 'payments', meta: {} }])
264
- await mockRouter.simulateNavigation(toChildB)
265
- await flushPromises()
266
- expect(resolveFn).toHaveBeenCalledTimes(1)
267
- expect(toChildB.meta._injectedProps).toEqual({ invoice: 'invoice-data' })
268
- })
269
-
270
- it('sets loading state to true while resolving and false after', async () => {
271
- installRouteInjection(mockRouter as any)
272
-
273
- let resolvePromise: (value: string) => void
274
- const resolveFn = vi.fn().mockImplementation(() => {
275
- return new Promise<string>((resolve) => {
276
- resolvePromise = resolve
277
- })
278
- })
279
-
280
- const to = createRoute({ invoiceId: '123' }, [
281
- {
282
- path: ':invoiceId',
283
- meta: {
284
- inject: {
285
- invoice: {
286
- from: 'invoiceId',
287
- resolve: () => ({ resolve: resolveFn })
288
- }
289
- }
290
- }
291
- }
292
- ])
293
-
294
- await mockRouter.simulateNavigation(to)
295
-
296
- // Loading should be true while the resolver is pending
297
- const state = to.meta._injectionState as Record<string, { loading: boolean; error: Error | null }>
298
- expect(state.invoice.loading).toBe(true)
299
- expect(state.invoice.error).toBeNull()
300
-
301
- // Resolve the promise
302
- resolvePromise!('resolved-invoice')
303
- await flushPromises()
304
-
305
- // Loading should be false after resolution
306
- expect(state.invoice.loading).toBe(false)
307
- expect(state.invoice.error).toBeNull()
308
- expect(to.meta._injectedProps).toEqual({ invoice: 'resolved-invoice' })
309
- })
310
-
311
- it('sets error state when resolver fails', async () => {
312
- installRouteInjection(mockRouter as any)
313
-
314
- const resolveFn = vi.fn().mockRejectedValue(new Error('Network error'))
315
-
316
- const to = createRoute({ invoiceId: '123' }, [
317
- {
318
- path: ':invoiceId',
319
- meta: {
320
- inject: {
321
- invoice: {
322
- from: 'invoiceId',
323
- resolve: () => ({ resolve: resolveFn })
324
- }
325
- }
326
- }
327
- }
328
- ])
329
-
330
- await mockRouter.simulateNavigation(to)
331
- await flushPromises()
332
-
333
- const state = to.meta._injectionState as Record<string, { loading: boolean; error: Error | null }>
334
- expect(state.invoice.loading).toBe(false)
335
- expect(state.invoice.error).toBeInstanceOf(Error)
336
- expect(state.invoice.error!.message).toBe('Network error')
337
- })
338
-
339
- it('navigation is non-blocking (guard returns before resolvers complete)', async () => {
340
- installRouteInjection(mockRouter as any)
341
-
342
- let resolvePromise: (value: string) => void
343
- const resolveFn = vi.fn().mockImplementation(() => {
344
- return new Promise<string>((resolve) => {
345
- resolvePromise = resolve
346
- })
347
- })
348
-
349
- const to = createRoute({ invoiceId: '123' }, [
350
- {
351
- path: ':invoiceId',
352
- meta: {
353
- inject: {
354
- invoice: {
355
- from: 'invoiceId',
356
- resolve: () => ({ resolve: resolveFn })
357
- }
358
- }
359
- }
360
- }
361
- ])
362
-
363
- // simulateNavigation should return even though the resolver hasn't completed
364
- await mockRouter.simulateNavigation(to)
365
-
366
- // Props should NOT be set yet (resolver still pending)
367
- expect((to.meta._injectedProps as any).invoice).toBeUndefined()
368
-
369
- // Now resolve
370
- resolvePromise!('resolved-invoice')
371
- await flushPromises()
372
-
373
- expect(to.meta._injectedProps).toEqual({ invoice: 'resolved-invoice' })
374
- })
375
-
376
- it('refresh() with silent option does not set loading state', async () => {
377
- installRouteInjection(mockRouter as any)
378
-
379
- const resolveFn = vi.fn()
380
- .mockResolvedValueOnce('old-data')
381
- .mockResolvedValueOnce('fresh-data')
382
-
383
- const to = createRoute({ invoiceId: '123' }, [
384
- {
385
- path: ':invoiceId',
386
- meta: {
387
- inject: {
388
- invoice: {
389
- from: 'invoiceId',
390
- resolve: () => ({ resolve: resolveFn })
391
- }
392
- }
393
- }
394
- }
395
- ])
396
-
397
- await mockRouter.simulateNavigation(to)
398
- await flushPromises()
399
- expect(to.meta._injectedProps).toEqual({ invoice: 'old-data' })
400
-
401
- const state = to.meta._injectionState as Record<string, { loading: boolean; error: Error | null }>
402
-
403
- // Track loading state changes during silent refresh
404
- let loadingWasTrue = false
405
- const checkLoading = setInterval(() => {
406
- if (state.invoice.loading) loadingWasTrue = true
407
- }, 0)
408
-
409
- await to.meta.refresh!('invoice', { silent: true })
410
-
411
- clearInterval(checkLoading)
412
- expect(loadingWasTrue).toBe(false)
413
- expect(state.invoice.loading).toBe(false)
414
- expect(to.meta._injectedProps).toEqual({ invoice: 'fresh-data' })
415
- })
416
-
417
- it('refresh() resets loading and error state', async () => {
418
- installRouteInjection(mockRouter as any)
419
-
420
- const resolveFn = vi.fn()
421
- .mockRejectedValueOnce(new Error('First fail'))
422
- .mockResolvedValueOnce('success-data')
423
-
424
- const to = createRoute({ invoiceId: '123' }, [
425
- {
426
- path: ':invoiceId',
427
- meta: {
428
- inject: {
429
- invoice: {
430
- from: 'invoiceId',
431
- resolve: () => ({ resolve: resolveFn })
432
- }
433
- }
434
- }
435
- }
436
- ])
437
-
438
- await mockRouter.simulateNavigation(to)
439
- await flushPromises()
440
-
441
- const state = to.meta._injectionState as Record<string, { loading: boolean; error: Error | null }>
442
- expect(state.invoice.error).toBeInstanceOf(Error)
443
-
444
- // Refresh should clear the error and resolve successfully
445
- await to.meta.refresh!('invoice')
446
- expect(state.invoice.loading).toBe(false)
447
- expect(state.invoice.error).toBeNull()
448
- expect(to.meta._injectedProps).toEqual({ invoice: 'success-data' })
449
- })
450
- })
@@ -1,151 +0,0 @@
1
- import { beforeEach, describe, expect, it, vi } from 'vitest'
2
- import { nextTick } from 'vue'
3
- import { State } from '../../../src/vue/state/State'
4
- import type { PersistenceDriver } from '../../../src/persistenceDrivers/types/PersistenceDriver'
5
-
6
- class MemoryDriver implements PersistenceDriver {
7
- public store = new Map<string, unknown>()
8
-
9
- get<T>(key: string): T | null {
10
- return (this.store.get(key) as T) ?? null
11
- }
12
-
13
- set<T>(key: string, state: T): void {
14
- this.store.set(key, state)
15
- }
16
-
17
- remove(key: string): void {
18
- this.store.delete(key)
19
- }
20
- }
21
-
22
- let driver: MemoryDriver
23
-
24
- class TestState extends State<{ count: number; nested: { value: string }; items: number[] }> {
25
- protected getPersistenceDriver(): PersistenceDriver {
26
- return driver
27
- }
28
- }
29
-
30
- describe('State', () => {
31
- beforeEach(() => {
32
- driver = new MemoryDriver()
33
- })
34
-
35
- it('exposes proxy access and deep exports', () => {
36
- const state = new TestState({ count: 1, nested: { value: 'a' }, items: [1] })
37
-
38
- state.state.count = 2
39
- expect(state.state.count).toBe(2)
40
-
41
- const exported = state.export()
42
- exported.nested.value = 'changed'
43
-
44
- expect(state.state.nested.value).toBe('a')
45
- })
46
-
47
- it('imports values and persists when enabled', () => {
48
- const state = new TestState(
49
- { count: 1, nested: { value: 'a' }, items: [1] },
50
- { persist: true }
51
- )
52
-
53
- state.import({ count: 5 })
54
-
55
- expect(state.state.count).toBe(5)
56
- expect(driver.get(state.persistKey)).toEqual({ count: 5, nested: { value: 'a' }, items: [1] })
57
- })
58
-
59
- it('loads persisted values when keys match', () => {
60
- driver.set('TestState', { count: 9, nested: { value: 'persisted' }, items: [2] })
61
-
62
- const state = new TestState({ count: 1, nested: { value: 'a' }, items: [1] }, { persist: true })
63
-
64
- expect(state.state.count).toBe(9)
65
- expect(state.state.nested.value).toBe('persisted')
66
- expect(state.state.items).toEqual([2])
67
- })
68
-
69
- it('clears persisted values when keys mismatch', () => {
70
- driver.set('TestState', { count: 9 })
71
-
72
- const state = new TestState({ count: 1, nested: { value: 'a' }, items: [1] }, { persist: true })
73
-
74
- expect(driver.get(state.persistKey)).toBeNull()
75
- expect(state.state.count).toBe(1)
76
- })
77
-
78
- it('subscribes to top-level and nested changes', async () => {
79
- const state = new TestState({ count: 1, nested: { value: 'a' }, items: [] })
80
-
81
- const countHandler = vi.fn()
82
- const nestedHandler = vi.fn()
83
-
84
- const stopCount = state.subscribe('count', countHandler)
85
- const stopNested = state.subscribe('nested.value', nestedHandler)
86
-
87
- state.state.count = 2
88
- state.state.nested.value = 'b'
89
-
90
- await nextTick()
91
-
92
- expect(countHandler).toHaveBeenCalledTimes(1)
93
- expect(nestedHandler).toHaveBeenCalledTimes(1)
94
-
95
- stopCount()
96
- stopNested()
97
-
98
- state.state.count = 3
99
- await nextTick()
100
- expect(countHandler).toHaveBeenCalledTimes(1)
101
- })
102
-
103
- it('supports array path subscriptions and reset handlers', async () => {
104
- const state = new TestState({ count: 1, nested: { value: 'a' }, items: [] })
105
-
106
- const handler = vi.fn()
107
- state.subscribe(['count', 'nested.value'], handler, { executeOnReset: true })
108
-
109
- state.reset()
110
-
111
- await nextTick()
112
-
113
- const calls = handler.mock.calls.map((call) => call[0])
114
- expect(calls).toContain('count')
115
- expect(calls).toContain('nested.value')
116
- })
117
-
118
- it('debounces change handlers', async () => {
119
- vi.useFakeTimers()
120
-
121
- const state = new TestState({ count: 1, nested: { value: 'a' }, items: [] })
122
- const handler = vi.fn()
123
-
124
- state.subscribe('count', handler, { debounce: 50 })
125
- state.state.count = 2
126
-
127
- await nextTick()
128
- expect(handler).not.toHaveBeenCalled()
129
-
130
- vi.advanceTimersByTime(50)
131
- await nextTick()
132
-
133
- expect(handler).toHaveBeenCalledTimes(1)
134
-
135
- vi.useRealTimers()
136
- })
137
-
138
- it('destroys watchers and clears internal state', async () => {
139
- const state = new TestState({ count: 1, nested: { value: 'a' }, items: [] })
140
- const handler = vi.fn()
141
-
142
- state.subscribe('count', handler)
143
-
144
- state.destroy()
145
-
146
- state.state.count = 2
147
- await nextTick()
148
-
149
- expect(handler).not.toHaveBeenCalled()
150
- })
151
- })