@carlonicora/nextjs-jsonapi 1.15.0 → 1.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (321) hide show
  1. package/dist/ApiData-DPKNfY-9.d.mts +10 -0
  2. package/dist/ApiData-DPKNfY-9.d.ts +10 -0
  3. package/dist/ApiRequestDataTypeInterface-DIEOFn9s.d.mts +40 -0
  4. package/dist/ApiRequestDataTypeInterface-DIEOFn9s.d.ts +40 -0
  5. package/dist/{ApiResponseInterface-QLDnxLA9.d.ts → ApiResponseInterface-BKyod24U.d.ts} +3 -11
  6. package/dist/{ApiResponseInterface-B4QdWh-y.d.mts → ApiResponseInterface-Dqvu09tz.d.mts} +3 -11
  7. package/dist/{BlockNoteEditor-FGXYUAWI.js → BlockNoteEditor-34T5CY27.js} +17 -16
  8. package/dist/BlockNoteEditor-34T5CY27.js.map +1 -0
  9. package/dist/{BlockNoteEditor-ITJLAOXC.mjs → BlockNoteEditor-4Z6TZBJE.mjs} +7 -6
  10. package/dist/{BlockNoteEditor-ITJLAOXC.mjs.map → BlockNoteEditor-4Z6TZBJE.mjs.map} +1 -1
  11. package/dist/JsonApiContext-Bsm_Q2oe.d.mts +41 -0
  12. package/dist/JsonApiContext-Bsm_Q2oe.d.ts +41 -0
  13. package/dist/JsonApiRequest-54ZBO7WQ.js +24 -0
  14. package/dist/{JsonApiRequest-FXZCYIER.js.map → JsonApiRequest-54ZBO7WQ.js.map} +1 -1
  15. package/dist/{JsonApiRequest-HFWXMKMA.mjs → JsonApiRequest-XWQWTFEQ.mjs} +2 -2
  16. package/dist/chunk-3EPNHTMH.js +26 -0
  17. package/dist/chunk-3EPNHTMH.js.map +1 -0
  18. package/dist/{chunk-TGBXBUWM.mjs → chunk-3VM3WAOV.mjs} +8 -1
  19. package/dist/chunk-3VM3WAOV.mjs.map +1 -0
  20. package/dist/{chunk-6YD42BP6.js → chunk-7DTKRMYW.js} +31 -19
  21. package/dist/chunk-7DTKRMYW.js.map +1 -0
  22. package/dist/{chunk-PK5DRSUD.js → chunk-D7H7SRWB.js} +4104 -793
  23. package/dist/chunk-D7H7SRWB.js.map +1 -0
  24. package/dist/{chunk-JGVXZS7M.mjs → chunk-KUFWHMMY.mjs} +1592 -133
  25. package/dist/chunk-KUFWHMMY.mjs.map +1 -0
  26. package/dist/{chunk-SJIVGCNM.mjs → chunk-KX7YG6LY.mjs} +27 -15
  27. package/dist/chunk-KX7YG6LY.mjs.map +1 -0
  28. package/dist/{chunk-FPZPD4JI.js → chunk-LI6CPNJI.js} +17 -10
  29. package/dist/chunk-LI6CPNJI.js.map +1 -0
  30. package/dist/{chunk-WAFOKMKT.mjs → chunk-SXPXC2TY.mjs} +3729 -418
  31. package/dist/chunk-SXPXC2TY.mjs.map +1 -0
  32. package/dist/{chunk-C6QXZGL7.js → chunk-UYY34W7R.js} +1622 -163
  33. package/dist/chunk-UYY34W7R.js.map +1 -0
  34. package/dist/chunk-VOXD3ZLY.mjs +26 -0
  35. package/dist/chunk-VOXD3ZLY.mjs.map +1 -0
  36. package/dist/client/index.d.mts +11 -45
  37. package/dist/client/index.d.ts +11 -45
  38. package/dist/client/index.js +10 -6
  39. package/dist/client/index.js.map +1 -1
  40. package/dist/client/index.mjs +13 -9
  41. package/dist/components/index.d.mts +254 -9
  42. package/dist/components/index.d.ts +254 -9
  43. package/dist/components/index.js +85 -6
  44. package/dist/components/index.js.map +1 -1
  45. package/dist/components/index.mjs +84 -5
  46. package/dist/{config-C5tGGrYf.d.mts → config--nwiW74Z.d.ts} +7 -2
  47. package/dist/{config-eceYM5kN.d.ts → config-BKSQmUWU.d.mts} +7 -2
  48. package/dist/{content.interface-CxBBC7ec.d.mts → content.interface-4VICFRA0.d.ts} +2 -1
  49. package/dist/{content.interface-TB2MfJGs.d.ts → content.interface-CFc97-Cj.d.mts} +2 -1
  50. package/dist/contexts/index.d.mts +3 -2
  51. package/dist/contexts/index.d.ts +3 -2
  52. package/dist/contexts/index.js +7 -6
  53. package/dist/contexts/index.js.map +1 -1
  54. package/dist/contexts/index.mjs +6 -5
  55. package/dist/core/index.d.mts +524 -18
  56. package/dist/core/index.d.ts +524 -18
  57. package/dist/core/index.js +54 -4
  58. package/dist/core/index.js.map +1 -1
  59. package/dist/core/index.mjs +53 -3
  60. package/dist/index.d.mts +16 -12
  61. package/dist/index.d.ts +16 -12
  62. package/dist/index.js +57 -5
  63. package/dist/index.js.map +1 -1
  64. package/dist/index.mjs +58 -6
  65. package/dist/{notification.interface-lG6UpTpt.d.mts → notification.interface-BGaPiCUM.d.mts} +3 -42
  66. package/dist/{notification.interface-lG6UpTpt.d.ts → notification.interface-CqwaOIgM.d.ts} +3 -42
  67. package/dist/{s3.service-DP_hsssD.d.mts → s3.service-BYs88XEE.d.ts} +21 -2
  68. package/dist/{s3.service-Dq-PTUNa.d.ts → s3.service-C0BjOdvn.d.mts} +21 -2
  69. package/dist/scripts/generate-web-module/generator.d.ts.map +1 -1
  70. package/dist/scripts/generate-web-module/generator.js +66 -0
  71. package/dist/scripts/generate-web-module/generator.js.map +1 -1
  72. package/dist/scripts/generate-web-module/templates/index.d.ts +8 -0
  73. package/dist/scripts/generate-web-module/templates/index.d.ts.map +1 -1
  74. package/dist/scripts/generate-web-module/templates/index.js +18 -1
  75. package/dist/scripts/generate-web-module/templates/index.js.map +1 -1
  76. package/dist/scripts/generate-web-module/templates/project/bootstrapper.template.d.ts +7 -0
  77. package/dist/scripts/generate-web-module/templates/project/bootstrapper.template.d.ts.map +1 -0
  78. package/dist/scripts/generate-web-module/templates/project/bootstrapper.template.js +141 -0
  79. package/dist/scripts/generate-web-module/templates/project/bootstrapper.template.js.map +1 -0
  80. package/dist/scripts/generate-web-module/templates/project/env.template.d.ts +7 -0
  81. package/dist/scripts/generate-web-module/templates/project/env.template.d.ts.map +1 -0
  82. package/dist/scripts/generate-web-module/templates/project/env.template.js +110 -0
  83. package/dist/scripts/generate-web-module/templates/project/env.template.js.map +1 -0
  84. package/dist/scripts/generate-web-module/templates/project/main-layout.template.d.ts +7 -0
  85. package/dist/scripts/generate-web-module/templates/project/main-layout.template.d.ts.map +1 -0
  86. package/dist/scripts/generate-web-module/templates/project/main-layout.template.js +101 -0
  87. package/dist/scripts/generate-web-module/templates/project/main-layout.template.js.map +1 -0
  88. package/dist/scripts/generate-web-module/templates/project/middleware-env.template.d.ts +7 -0
  89. package/dist/scripts/generate-web-module/templates/project/middleware-env.template.d.ts.map +1 -0
  90. package/dist/scripts/generate-web-module/templates/project/middleware-env.template.js +66 -0
  91. package/dist/scripts/generate-web-module/templates/project/middleware-env.template.js.map +1 -0
  92. package/dist/scripts/generate-web-module/templates/project/settings-container.template.d.ts +7 -0
  93. package/dist/scripts/generate-web-module/templates/project/settings-container.template.d.ts.map +1 -0
  94. package/dist/scripts/generate-web-module/templates/project/settings-container.template.js +257 -0
  95. package/dist/scripts/generate-web-module/templates/project/settings-container.template.js.map +1 -0
  96. package/dist/scripts/generate-web-module/templates/project/settings-context.template.d.ts +7 -0
  97. package/dist/scripts/generate-web-module/templates/project/settings-context.template.d.ts.map +1 -0
  98. package/dist/scripts/generate-web-module/templates/project/settings-context.template.js +124 -0
  99. package/dist/scripts/generate-web-module/templates/project/settings-context.template.js.map +1 -0
  100. package/dist/scripts/generate-web-module/templates/project/settings-module-page.template.d.ts +7 -0
  101. package/dist/scripts/generate-web-module/templates/project/settings-module-page.template.d.ts.map +1 -0
  102. package/dist/scripts/generate-web-module/templates/project/settings-module-page.template.js +78 -0
  103. package/dist/scripts/generate-web-module/templates/project/settings-module-page.template.js.map +1 -0
  104. package/dist/scripts/generate-web-module/templates/project/settings-page.template.d.ts +7 -0
  105. package/dist/scripts/generate-web-module/templates/project/settings-page.template.d.ts.map +1 -0
  106. package/dist/scripts/generate-web-module/templates/project/settings-page.template.js +75 -0
  107. package/dist/scripts/generate-web-module/templates/project/settings-page.template.js.map +1 -0
  108. package/dist/scripts/generate-web-module/types/template-data.interface.d.ts +1 -1
  109. package/dist/scripts/generate-web-module/types/template-data.interface.d.ts.map +1 -1
  110. package/dist/server/index.d.mts +6 -4
  111. package/dist/server/index.d.ts +6 -4
  112. package/dist/server/index.js +13 -13
  113. package/dist/server/index.js.map +1 -1
  114. package/dist/server/index.mjs +3 -3
  115. package/dist/stripe-subscription.interface-B-TM40Io.d.ts +226 -0
  116. package/dist/stripe-subscription.interface-DDxnpj0F.d.mts +226 -0
  117. package/dist/testing/index.d.mts +338 -0
  118. package/dist/testing/index.d.ts +338 -0
  119. package/dist/testing/index.js +323 -0
  120. package/dist/testing/index.js.map +1 -0
  121. package/dist/testing/index.mjs +323 -0
  122. package/dist/testing/index.mjs.map +1 -0
  123. package/dist/{useSocket-Bua6MwLi.d.mts → useSocket-BNj9PrRw.d.mts} +1 -1
  124. package/dist/{useSocket-D5dhUp4m.d.ts → useSocket-Dwt8cz1x.d.ts} +1 -1
  125. package/package.json +29 -3
  126. package/scripts/generate-web-module/generator.ts +83 -0
  127. package/scripts/generate-web-module/templates/index.ts +10 -0
  128. package/scripts/generate-web-module/templates/project/bootstrapper.template.ts +108 -0
  129. package/scripts/generate-web-module/templates/project/env.template.ts +77 -0
  130. package/scripts/generate-web-module/templates/project/main-layout.template.tsx +68 -0
  131. package/scripts/generate-web-module/templates/project/middleware-env.template.ts +33 -0
  132. package/scripts/generate-web-module/templates/project/settings-container.template.tsx +224 -0
  133. package/scripts/generate-web-module/templates/project/settings-context.template.tsx +91 -0
  134. package/scripts/generate-web-module/templates/project/settings-module-page.template.tsx +45 -0
  135. package/scripts/generate-web-module/templates/project/settings-page.template.tsx +42 -0
  136. package/scripts/generate-web-module/types/template-data.interface.ts +1 -1
  137. package/src/client/config.ts +9 -0
  138. package/src/client/hooks/__tests__/useJsonApiGet.test.tsx +229 -0
  139. package/src/client/hooks/__tests__/useJsonApiMutation.test.tsx +348 -0
  140. package/src/client/hooks/__tests__/useRehydration.test.ts +188 -0
  141. package/src/components/forms/__tests__/FormCheckbox.test.tsx +238 -0
  142. package/src/components/forms/__tests__/FormDate.test.tsx +212 -0
  143. package/src/components/forms/__tests__/FormInput.test.tsx +292 -0
  144. package/src/components/forms/__tests__/FormSelect.test.tsx +173 -0
  145. package/src/components/index.ts +7 -0
  146. package/src/components/tables/__tests__/ContentListTable.test.tsx +411 -0
  147. package/src/core/abstracts/AbstractService.ts +104 -0
  148. package/src/core/endpoint/EndpointCreator.ts +7 -4
  149. package/src/core/endpoint/__tests__/EndpointCreator.test.ts +168 -0
  150. package/src/core/factories/__tests__/JsonApiDataFactory.test.ts +109 -0
  151. package/src/core/factories/__tests__/RehydrationFactory.test.ts +151 -0
  152. package/src/core/index.ts +12 -4
  153. package/src/core/interfaces/ApiResponseInterface.ts +1 -0
  154. package/src/core/registry/ModuleRegistry.ts +11 -2
  155. package/src/core/registry/__tests__/DataClassRegistry.test.ts +136 -0
  156. package/src/core/registry/__tests__/ModuleRegistrar.test.ts +159 -0
  157. package/src/core/utils/translateResponse.ts +17 -0
  158. package/src/features/auth/components/details/LandingComponent.tsx +14 -12
  159. package/src/features/billing/components/cards/BillingUsageSummaryCard.tsx +97 -0
  160. package/src/features/billing/components/cards/CustomerInfoCard.tsx +112 -0
  161. package/src/features/billing/components/cards/InvoicesSummaryCard.tsx +114 -0
  162. package/src/features/billing/components/cards/PaymentMethodSummaryCard.tsx +119 -0
  163. package/src/features/billing/components/cards/SubscriptionSummaryCard.tsx +146 -0
  164. package/src/features/billing/components/cards/index.ts +5 -0
  165. package/src/features/billing/components/containers/BillingDashboardContainer.tsx +427 -0
  166. package/src/features/billing/components/containers/index.ts +1 -0
  167. package/src/features/billing/components/index.ts +6 -0
  168. package/src/features/billing/components/modals/BillingDetailModal.tsx +36 -0
  169. package/src/features/billing/components/modals/index.ts +1 -0
  170. package/src/features/billing/components/providers/StripeProvider.tsx +48 -0
  171. package/src/features/billing/components/providers/index.ts +1 -0
  172. package/src/features/billing/components/utils/currency.ts +49 -0
  173. package/src/features/billing/components/utils/date.ts +21 -0
  174. package/src/features/billing/components/utils/index.ts +2 -0
  175. package/src/features/billing/components/widgets/BillingAlertBanner.tsx +63 -0
  176. package/src/features/billing/components/widgets/index.ts +1 -0
  177. package/src/features/billing/data/Billing.ts +17 -0
  178. package/src/features/billing/data/billing.service.ts +58 -0
  179. package/src/features/billing/data/index.ts +5 -0
  180. package/src/features/billing/index.ts +3 -0
  181. package/src/features/billing/modules/billing.module.ts +9 -0
  182. package/src/features/billing/modules/index.ts +1 -0
  183. package/src/features/billing/stripe-customer/components/containers/PaymentMethodsContainer.tsx +79 -0
  184. package/src/features/billing/stripe-customer/components/containers/index.ts +1 -0
  185. package/src/features/billing/stripe-customer/components/details/PaymentMethodCard.tsx +151 -0
  186. package/src/features/billing/stripe-customer/components/details/index.ts +1 -0
  187. package/src/features/billing/stripe-customer/components/forms/PaymentMethodEditor.tsx +186 -0
  188. package/src/features/billing/stripe-customer/components/forms/index.ts +1 -0
  189. package/src/features/billing/stripe-customer/components/index.ts +4 -0
  190. package/src/features/billing/stripe-customer/components/lists/PaymentMethodsList.tsx +19 -0
  191. package/src/features/billing/stripe-customer/components/lists/index.ts +1 -0
  192. package/src/features/billing/stripe-customer/data/index.ts +5 -0
  193. package/src/features/billing/stripe-customer/data/payment-method.interface.ts +27 -0
  194. package/src/features/billing/stripe-customer/data/payment-method.ts +119 -0
  195. package/src/features/billing/stripe-customer/data/stripe-customer.interface.ts +16 -0
  196. package/src/features/billing/stripe-customer/data/stripe-customer.service.ts +128 -0
  197. package/src/features/billing/stripe-customer/data/stripe-customer.ts +71 -0
  198. package/src/features/billing/stripe-customer/index.ts +3 -0
  199. package/src/features/billing/stripe-customer/stripe-customer.module.ts +9 -0
  200. package/src/features/billing/stripe-customer/stripe-payment-method.module.ts +9 -0
  201. package/src/features/billing/stripe-invoice/components/containers/InvoicesContainer.tsx +66 -0
  202. package/src/features/billing/stripe-invoice/components/containers/index.ts +1 -0
  203. package/src/features/billing/stripe-invoice/components/details/InvoiceDetails.tsx +172 -0
  204. package/src/features/billing/stripe-invoice/components/details/index.ts +1 -0
  205. package/src/features/billing/stripe-invoice/components/index.ts +4 -0
  206. package/src/features/billing/stripe-invoice/components/lists/InvoicesList.tsx +84 -0
  207. package/src/features/billing/stripe-invoice/components/lists/index.ts +1 -0
  208. package/src/features/billing/stripe-invoice/components/widgets/InvoiceStatusBadge.tsx +41 -0
  209. package/src/features/billing/stripe-invoice/components/widgets/index.ts +1 -0
  210. package/src/features/billing/stripe-invoice/data/index.ts +3 -0
  211. package/src/features/billing/stripe-invoice/data/stripe-invoice.interface.ts +65 -0
  212. package/src/features/billing/stripe-invoice/data/stripe-invoice.service.ts +64 -0
  213. package/src/features/billing/stripe-invoice/data/stripe-invoice.ts +177 -0
  214. package/src/features/billing/stripe-invoice/index.ts +2 -0
  215. package/src/features/billing/stripe-invoice/stripe-invoice.module.ts +9 -0
  216. package/src/features/billing/stripe-price/components/forms/PriceEditor.tsx +304 -0
  217. package/src/features/billing/stripe-price/components/forms/index.ts +1 -0
  218. package/src/features/billing/stripe-price/components/index.ts +2 -0
  219. package/src/features/billing/stripe-price/components/lists/PricesList.tsx +283 -0
  220. package/src/features/billing/stripe-price/components/lists/index.ts +1 -0
  221. package/src/features/billing/stripe-price/data/index.ts +3 -0
  222. package/src/features/billing/stripe-price/data/stripe-price.interface.ts +48 -0
  223. package/src/features/billing/stripe-price/data/stripe-price.service.ts +123 -0
  224. package/src/features/billing/stripe-price/data/stripe-price.ts +156 -0
  225. package/src/features/billing/stripe-price/index.ts +2 -0
  226. package/src/features/billing/stripe-price/stripe-price.module.ts +9 -0
  227. package/src/features/billing/stripe-product/components/containers/ProductsAdminContainer.tsx +86 -0
  228. package/src/features/billing/stripe-product/components/containers/index.ts +1 -0
  229. package/src/features/billing/stripe-product/components/forms/ProductEditor.tsx +100 -0
  230. package/src/features/billing/stripe-product/components/forms/index.ts +1 -0
  231. package/src/features/billing/stripe-product/components/index.ts +3 -0
  232. package/src/features/billing/stripe-product/components/lists/ProductsList.tsx +206 -0
  233. package/src/features/billing/stripe-product/components/lists/index.ts +1 -0
  234. package/src/features/billing/stripe-product/data/index.ts +3 -0
  235. package/src/features/billing/stripe-product/data/stripe-product.interface.ts +18 -0
  236. package/src/features/billing/stripe-product/data/stripe-product.service.ts +112 -0
  237. package/src/features/billing/stripe-product/data/stripe-product.ts +74 -0
  238. package/src/features/billing/stripe-product/index.ts +2 -0
  239. package/src/features/billing/stripe-product/stripe-product.module.ts +9 -0
  240. package/src/features/billing/stripe-subscription/components/containers/SubscriptionsContainer.tsx +304 -0
  241. package/src/features/billing/stripe-subscription/components/containers/index.ts +1 -0
  242. package/src/features/billing/stripe-subscription/components/details/SubscriptionDetails.tsx +223 -0
  243. package/src/features/billing/stripe-subscription/components/details/index.ts +1 -0
  244. package/src/features/billing/stripe-subscription/components/forms/CancelSubscriptionDialog.tsx +116 -0
  245. package/src/features/billing/stripe-subscription/components/forms/SubscriptionEditor.tsx +331 -0
  246. package/src/features/billing/stripe-subscription/components/forms/index.ts +2 -0
  247. package/src/features/billing/stripe-subscription/components/index.ts +5 -0
  248. package/src/features/billing/stripe-subscription/components/lists/SubscriptionsList.tsx +104 -0
  249. package/src/features/billing/stripe-subscription/components/lists/index.ts +1 -0
  250. package/src/features/billing/stripe-subscription/components/widgets/PricingCard.tsx +95 -0
  251. package/src/features/billing/stripe-subscription/components/widgets/PricingCardsGrid.tsx +110 -0
  252. package/src/features/billing/stripe-subscription/components/widgets/ProrationPreview.tsx +41 -0
  253. package/src/features/billing/stripe-subscription/components/widgets/SubscriptionStatusBadge.tsx +60 -0
  254. package/src/features/billing/stripe-subscription/components/widgets/index.ts +4 -0
  255. package/src/features/billing/stripe-subscription/data/index.ts +3 -0
  256. package/src/features/billing/stripe-subscription/data/stripe-subscription.interface.ts +66 -0
  257. package/src/features/billing/stripe-subscription/data/stripe-subscription.service.ts +193 -0
  258. package/src/features/billing/stripe-subscription/data/stripe-subscription.ts +135 -0
  259. package/src/features/billing/stripe-subscription/hooks/index.ts +1 -0
  260. package/src/features/billing/stripe-subscription/hooks/useConfirmSubscriptionPayment.ts +111 -0
  261. package/src/features/billing/stripe-subscription/index.ts +5 -0
  262. package/src/features/billing/stripe-subscription/stripe-subscription.module.ts +9 -0
  263. package/src/features/billing/stripe-usage/components/containers/UsageContainer.tsx +109 -0
  264. package/src/features/billing/stripe-usage/components/containers/index.ts +1 -0
  265. package/src/features/billing/stripe-usage/components/details/UsageSummaryCard.tsx +90 -0
  266. package/src/features/billing/stripe-usage/components/details/index.ts +1 -0
  267. package/src/features/billing/stripe-usage/components/index.ts +4 -0
  268. package/src/features/billing/stripe-usage/components/lists/UsageHistoryTable.tsx +72 -0
  269. package/src/features/billing/stripe-usage/components/lists/index.ts +1 -0
  270. package/src/features/billing/stripe-usage/components/widgets/UsageSummaryCards.tsx +19 -0
  271. package/src/features/billing/stripe-usage/components/widgets/index.ts +1 -0
  272. package/src/features/billing/stripe-usage/data/index.ts +3 -0
  273. package/src/features/billing/stripe-usage/data/stripe-usage.interface.ts +55 -0
  274. package/src/features/billing/stripe-usage/data/stripe-usage.service.ts +129 -0
  275. package/src/features/billing/stripe-usage/data/stripe-usage.ts +70 -0
  276. package/src/features/billing/stripe-usage/index.ts +2 -0
  277. package/src/features/billing/stripe-usage/stripe-usage.module.ts +9 -0
  278. package/src/features/company/components/forms/CompanyEditor.tsx +2 -2
  279. package/src/features/company/contexts/CompanyContext.tsx +2 -2
  280. package/src/features/feature/components/forms/FormFeatures.tsx +13 -106
  281. package/src/features/feature/data/feature.interface.ts +1 -1
  282. package/src/features/feature/data/feature.ts +4 -4
  283. package/src/features/index.ts +7 -0
  284. package/src/features/module/data/module.interface.ts +0 -1
  285. package/src/features/module/data/module.ts +0 -6
  286. package/src/features/user/components/lists/ContributorsList.tsx +2 -2
  287. package/src/features/user/components/widgets/UserAvatar.tsx +1 -1
  288. package/src/hooks/__tests__/useDataListRetriever.test.ts +321 -0
  289. package/src/hooks/__tests__/useDebounce.test.ts +170 -0
  290. package/src/index.ts +5 -2
  291. package/src/login/config.ts +27 -0
  292. package/src/login/index.ts +2 -0
  293. package/src/shadcnui/custom/link.tsx +16 -6
  294. package/src/testing/factories/createMockApiData.ts +143 -0
  295. package/src/testing/factories/createMockModule.ts +32 -0
  296. package/src/testing/factories/createMockResponse.ts +93 -0
  297. package/src/testing/factories/createMockService.ts +79 -0
  298. package/src/testing/index.ts +70 -0
  299. package/src/testing/matchers/jsonApiMatchers.ts +174 -0
  300. package/src/testing/providers/MockJsonApiProvider.tsx +58 -0
  301. package/src/testing/utils/renderWithProviders.tsx +76 -0
  302. package/src/utils/__tests__/date-formatter.test.ts +161 -0
  303. package/src/utils/__tests__/exists.test.ts +100 -0
  304. package/src/utils/blocknote-diff.util.ts +2 -1
  305. package/src/utils/blocknote-word-diff-renderer.util.ts +8 -7
  306. package/src/utils/cn.test.ts +44 -0
  307. package/dist/AuthComponent-hxOPs9o8.d.mts +0 -11
  308. package/dist/AuthComponent-hxOPs9o8.d.ts +0 -11
  309. package/dist/BlockNoteEditor-FGXYUAWI.js.map +0 -1
  310. package/dist/JsonApiRequest-FXZCYIER.js +0 -24
  311. package/dist/chunk-6YD42BP6.js.map +0 -1
  312. package/dist/chunk-C6QXZGL7.js.map +0 -1
  313. package/dist/chunk-FPZPD4JI.js.map +0 -1
  314. package/dist/chunk-JGVXZS7M.mjs.map +0 -1
  315. package/dist/chunk-PK5DRSUD.js.map +0 -1
  316. package/dist/chunk-SJIVGCNM.mjs.map +0 -1
  317. package/dist/chunk-TGBXBUWM.mjs.map +0 -1
  318. package/dist/chunk-WAFOKMKT.mjs.map +0 -1
  319. package/src/discord/config.ts +0 -15
  320. package/src/discord/index.ts +0 -1
  321. /package/dist/{JsonApiRequest-HFWXMKMA.mjs.map → JsonApiRequest-XWQWTFEQ.mjs.map} +0 -0
@@ -0,0 +1,338 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import React__default, { ReactElement } from 'react';
3
+ import { J as JsonApiConfig } from '../JsonApiContext-Bsm_Q2oe.mjs';
4
+ import { a as ApiRequestDataTypeInterface, A as ApiDataInterface } from '../ApiRequestDataTypeInterface-DIEOFn9s.mjs';
5
+ import { A as ApiResponseInterface } from '../ApiResponseInterface-Dqvu09tz.mjs';
6
+ import { Mock } from 'vitest';
7
+ import { RenderOptions, RenderResult } from '@testing-library/react';
8
+ export { fireEvent, render, screen, waitFor, within } from '@testing-library/react';
9
+ export { userEvent } from '@testing-library/user-event';
10
+
11
+ interface MockJsonApiProviderProps {
12
+ children: React__default.ReactNode;
13
+ config?: Partial<JsonApiConfig>;
14
+ }
15
+ declare const defaultMockConfig: JsonApiConfig;
16
+ /**
17
+ * A test-friendly provider that wraps components with mock JSON:API context.
18
+ *
19
+ * @example
20
+ * ```tsx
21
+ * import { MockJsonApiProvider } from '@carlonicora/nextjs-jsonapi/testing';
22
+ *
23
+ * render(
24
+ * <MockJsonApiProvider>
25
+ * <MyComponent />
26
+ * </MockJsonApiProvider>
27
+ * );
28
+ * ```
29
+ *
30
+ * @example With custom config
31
+ * ```tsx
32
+ * render(
33
+ * <MockJsonApiProvider config={{ apiUrl: 'https://custom.api.com' }}>
34
+ * <MyComponent />
35
+ * </MockJsonApiProvider>
36
+ * );
37
+ * ```
38
+ */
39
+ declare function MockJsonApiProvider({ children, config }: MockJsonApiProviderProps): react_jsx_runtime.JSX.Element;
40
+
41
+ interface CreateMockModuleOptions {
42
+ name: string;
43
+ cache?: string;
44
+ inclusions?: ApiRequestDataTypeInterface["inclusions"];
45
+ }
46
+ /**
47
+ * Creates a mock module definition for testing.
48
+ *
49
+ * @example
50
+ * ```ts
51
+ * import { createMockModule } from '@carlonicora/nextjs-jsonapi/testing';
52
+ *
53
+ * const mockArticleModule = createMockModule({ name: 'articles' });
54
+ * ```
55
+ */
56
+ declare function createMockModule(options: CreateMockModuleOptions): ApiRequestDataTypeInterface;
57
+
58
+ interface CreateMockResponseOptions {
59
+ data?: ApiDataInterface | ApiDataInterface[] | null;
60
+ ok?: boolean;
61
+ response?: number;
62
+ error?: string;
63
+ meta?: Record<string, any>;
64
+ self?: string;
65
+ next?: string;
66
+ prev?: string;
67
+ }
68
+ /**
69
+ * Creates a mock API response for testing.
70
+ *
71
+ * @example
72
+ * ```ts
73
+ * import { createMockResponse, createMockApiData } from '@carlonicora/nextjs-jsonapi/testing';
74
+ *
75
+ * const mockData = createMockApiData({ type: 'articles', id: '1' });
76
+ * const response = createMockResponse({ data: mockData, ok: true });
77
+ * ```
78
+ *
79
+ * @example With pagination
80
+ * ```ts
81
+ * const response = createMockResponse({
82
+ * data: [mockData],
83
+ * ok: true,
84
+ * next: '/articles?page=2',
85
+ * prev: '/articles?page=0',
86
+ * });
87
+ * ```
88
+ */
89
+ declare function createMockResponse(options?: CreateMockResponseOptions): ApiResponseInterface;
90
+ /**
91
+ * Creates a mock error response for testing error scenarios.
92
+ *
93
+ * @example
94
+ * ```ts
95
+ * import { createMockErrorResponse } from '@carlonicora/nextjs-jsonapi/testing';
96
+ *
97
+ * const errorResponse = createMockErrorResponse(404, 'Not Found');
98
+ * ```
99
+ */
100
+ declare function createMockErrorResponse(statusCode: number, errorMessage: string): ApiResponseInterface;
101
+
102
+ type MockApiMethod = Mock<(...args: any[]) => Promise<ApiResponseInterface>>;
103
+ interface MockService {
104
+ get: MockApiMethod;
105
+ post: MockApiMethod;
106
+ put: MockApiMethod;
107
+ patch: MockApiMethod;
108
+ delete: MockApiMethod;
109
+ }
110
+ interface CreateMockServiceOptions {
111
+ defaultResponse?: ApiResponseInterface;
112
+ }
113
+ /**
114
+ * Creates a mock service with Vitest mock functions for all HTTP methods.
115
+ *
116
+ * @example
117
+ * ```ts
118
+ * import { createMockService, createMockResponse } from '@carlonicora/nextjs-jsonapi/testing';
119
+ *
120
+ * const mockService = createMockService();
121
+ * mockService.get.mockResolvedValue(createMockResponse({ data: mockData }));
122
+ *
123
+ * // Use in test
124
+ * expect(mockService.get).toHaveBeenCalled();
125
+ * ```
126
+ *
127
+ * @example With default response
128
+ * ```ts
129
+ * const mockService = createMockService({
130
+ * defaultResponse: createMockResponse({ ok: true, data: [] }),
131
+ * });
132
+ * ```
133
+ */
134
+ declare function createMockService(options?: CreateMockServiceOptions): MockService;
135
+ /**
136
+ * Creates a mock service that returns errors for all methods.
137
+ *
138
+ * @example
139
+ * ```ts
140
+ * import { createMockErrorService } from '@carlonicora/nextjs-jsonapi/testing';
141
+ *
142
+ * const errorService = createMockErrorService(500, 'Internal Server Error');
143
+ * ```
144
+ */
145
+ declare function createMockErrorService(statusCode?: number, errorMessage?: string): MockService;
146
+
147
+ interface CreateMockApiDataOptions {
148
+ type: string;
149
+ id?: string;
150
+ attributes?: Record<string, any>;
151
+ relationships?: Record<string, any>;
152
+ included?: any[];
153
+ createdAt?: Date;
154
+ updatedAt?: Date;
155
+ self?: string;
156
+ }
157
+ /**
158
+ * Creates a mock ApiDataInterface object for testing.
159
+ *
160
+ * @example
161
+ * ```ts
162
+ * import { createMockApiData } from '@carlonicora/nextjs-jsonapi/testing';
163
+ *
164
+ * const mockArticle = createMockApiData({
165
+ * type: 'articles',
166
+ * id: '1',
167
+ * attributes: { title: 'Test Article', body: 'Content here' },
168
+ * });
169
+ * ```
170
+ *
171
+ * @example With relationships
172
+ * ```ts
173
+ * const mockArticle = createMockApiData({
174
+ * type: 'articles',
175
+ * id: '1',
176
+ * attributes: { title: 'Test' },
177
+ * relationships: {
178
+ * author: { data: { type: 'users', id: '42' } },
179
+ * },
180
+ * });
181
+ * ```
182
+ */
183
+ declare function createMockApiData(options: CreateMockApiDataOptions): ApiDataInterface;
184
+ /**
185
+ * Creates an array of mock ApiDataInterface objects.
186
+ *
187
+ * @example
188
+ * ```ts
189
+ * import { createMockApiDataList } from '@carlonicora/nextjs-jsonapi/testing';
190
+ *
191
+ * const mockArticles = createMockApiDataList('articles', 5, (index) => ({
192
+ * title: `Article ${index + 1}`,
193
+ * }));
194
+ * ```
195
+ */
196
+ declare function createMockApiDataList(type: string, count: number, attributesFactory?: (index: number) => Record<string, any>): ApiDataInterface[];
197
+
198
+ interface JsonApiResponse {
199
+ data?: {
200
+ type?: string;
201
+ id?: string;
202
+ attributes?: Record<string, any>;
203
+ relationships?: Record<string, any>;
204
+ } | Array<{
205
+ type?: string;
206
+ id?: string;
207
+ attributes?: Record<string, any>;
208
+ relationships?: Record<string, any>;
209
+ }>;
210
+ }
211
+ /**
212
+ * Custom Vitest matchers for JSON:API assertions.
213
+ *
214
+ * @example
215
+ * ```ts
216
+ * import { jsonApiMatchers } from '@carlonicora/nextjs-jsonapi/testing';
217
+ * import { expect } from 'vitest';
218
+ *
219
+ * expect.extend(jsonApiMatchers);
220
+ *
221
+ * // Then use in tests:
222
+ * expect(response).toBeValidJsonApi();
223
+ * expect(response).toHaveJsonApiType('articles');
224
+ * expect(response).toHaveJsonApiAttribute('title', 'My Article');
225
+ * expect(response).toHaveJsonApiRelationship('author');
226
+ * ```
227
+ */
228
+ declare const jsonApiMatchers: {
229
+ /**
230
+ * Asserts that the response has a valid JSON:API structure with type and id.
231
+ */
232
+ toBeValidJsonApi(received: JsonApiResponse): {
233
+ pass: boolean;
234
+ message: () => string;
235
+ };
236
+ /**
237
+ * Asserts that the response data has the expected JSON:API type.
238
+ */
239
+ toHaveJsonApiType(received: JsonApiResponse, expectedType: string): {
240
+ pass: boolean;
241
+ message: () => string;
242
+ };
243
+ /**
244
+ * Asserts that the response data has an attribute with the expected value.
245
+ */
246
+ toHaveJsonApiAttribute(received: JsonApiResponse, attributeName: string, expectedValue?: any): {
247
+ pass: boolean;
248
+ message: () => string;
249
+ };
250
+ /**
251
+ * Asserts that the response data has the specified relationship.
252
+ */
253
+ toHaveJsonApiRelationship(received: JsonApiResponse, relationshipName: string): {
254
+ pass: boolean;
255
+ message: () => string;
256
+ };
257
+ /**
258
+ * Asserts that the response data array has the expected length.
259
+ */
260
+ toHaveJsonApiLength(received: JsonApiResponse, expectedLength: number): {
261
+ pass: boolean;
262
+ message: () => string;
263
+ };
264
+ };
265
+ declare module "vitest" {
266
+ interface Assertion<T = any> {
267
+ toBeValidJsonApi(): T;
268
+ toHaveJsonApiType(expectedType: string): T;
269
+ toHaveJsonApiAttribute(attributeName: string, expectedValue?: any): T;
270
+ toHaveJsonApiRelationship(relationshipName: string): T;
271
+ toHaveJsonApiLength(expectedLength: number): T;
272
+ }
273
+ interface AsymmetricMatchersContaining {
274
+ toBeValidJsonApi(): any;
275
+ toHaveJsonApiType(expectedType: string): any;
276
+ toHaveJsonApiAttribute(attributeName: string, expectedValue?: any): any;
277
+ toHaveJsonApiRelationship(relationshipName: string): any;
278
+ toHaveJsonApiLength(expectedLength: number): any;
279
+ }
280
+ }
281
+ /**
282
+ * Extends Vitest's expect with JSON:API matchers.
283
+ * Call this in your test setup file.
284
+ *
285
+ * @example
286
+ * ```ts
287
+ * // vitest.setup.ts
288
+ * import { extendExpectWithJsonApiMatchers } from '@carlonicora/nextjs-jsonapi/testing';
289
+ *
290
+ * extendExpectWithJsonApiMatchers();
291
+ * ```
292
+ */
293
+ declare function extendExpectWithJsonApiMatchers(): void;
294
+
295
+ interface RenderWithProvidersOptions extends Omit<RenderOptions, "wrapper"> {
296
+ /**
297
+ * Custom JSON:API configuration to pass to the mock provider.
298
+ */
299
+ jsonApiConfig?: Partial<JsonApiConfig>;
300
+ /**
301
+ * Additional wrapper component to wrap around the providers.
302
+ */
303
+ wrapper?: React__default.ComponentType<{
304
+ children: React__default.ReactNode;
305
+ }>;
306
+ }
307
+ /**
308
+ * Renders a component wrapped with all necessary providers for testing.
309
+ *
310
+ * @example
311
+ * ```tsx
312
+ * import { renderWithProviders } from '@carlonicora/nextjs-jsonapi/testing';
313
+ *
314
+ * const { getByText } = renderWithProviders(<MyComponent />);
315
+ * expect(getByText('Hello')).toBeInTheDocument();
316
+ * ```
317
+ *
318
+ * @example With custom config
319
+ * ```tsx
320
+ * const { getByText } = renderWithProviders(<MyComponent />, {
321
+ * jsonApiConfig: { apiUrl: 'https://custom.api.com' },
322
+ * });
323
+ * ```
324
+ *
325
+ * @example With additional wrapper
326
+ * ```tsx
327
+ * const CustomWrapper = ({ children }) => (
328
+ * <ThemeProvider>{children}</ThemeProvider>
329
+ * );
330
+ *
331
+ * const { getByText } = renderWithProviders(<MyComponent />, {
332
+ * wrapper: CustomWrapper,
333
+ * });
334
+ * ```
335
+ */
336
+ declare function renderWithProviders(ui: ReactElement, options?: RenderWithProvidersOptions): RenderResult;
337
+
338
+ export { type CreateMockApiDataOptions, type CreateMockModuleOptions, type CreateMockResponseOptions, type CreateMockServiceOptions, type MockApiMethod, MockJsonApiProvider, type MockJsonApiProviderProps, type MockService, type RenderWithProvidersOptions, createMockApiData, createMockApiDataList, createMockErrorResponse, createMockErrorService, createMockModule, createMockResponse, createMockService, defaultMockConfig, extendExpectWithJsonApiMatchers, jsonApiMatchers, renderWithProviders };
@@ -0,0 +1,338 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import React__default, { ReactElement } from 'react';
3
+ import { J as JsonApiConfig } from '../JsonApiContext-Bsm_Q2oe.js';
4
+ import { a as ApiRequestDataTypeInterface, A as ApiDataInterface } from '../ApiRequestDataTypeInterface-DIEOFn9s.js';
5
+ import { A as ApiResponseInterface } from '../ApiResponseInterface-BKyod24U.js';
6
+ import { Mock } from 'vitest';
7
+ import { RenderOptions, RenderResult } from '@testing-library/react';
8
+ export { fireEvent, render, screen, waitFor, within } from '@testing-library/react';
9
+ export { userEvent } from '@testing-library/user-event';
10
+
11
+ interface MockJsonApiProviderProps {
12
+ children: React__default.ReactNode;
13
+ config?: Partial<JsonApiConfig>;
14
+ }
15
+ declare const defaultMockConfig: JsonApiConfig;
16
+ /**
17
+ * A test-friendly provider that wraps components with mock JSON:API context.
18
+ *
19
+ * @example
20
+ * ```tsx
21
+ * import { MockJsonApiProvider } from '@carlonicora/nextjs-jsonapi/testing';
22
+ *
23
+ * render(
24
+ * <MockJsonApiProvider>
25
+ * <MyComponent />
26
+ * </MockJsonApiProvider>
27
+ * );
28
+ * ```
29
+ *
30
+ * @example With custom config
31
+ * ```tsx
32
+ * render(
33
+ * <MockJsonApiProvider config={{ apiUrl: 'https://custom.api.com' }}>
34
+ * <MyComponent />
35
+ * </MockJsonApiProvider>
36
+ * );
37
+ * ```
38
+ */
39
+ declare function MockJsonApiProvider({ children, config }: MockJsonApiProviderProps): react_jsx_runtime.JSX.Element;
40
+
41
+ interface CreateMockModuleOptions {
42
+ name: string;
43
+ cache?: string;
44
+ inclusions?: ApiRequestDataTypeInterface["inclusions"];
45
+ }
46
+ /**
47
+ * Creates a mock module definition for testing.
48
+ *
49
+ * @example
50
+ * ```ts
51
+ * import { createMockModule } from '@carlonicora/nextjs-jsonapi/testing';
52
+ *
53
+ * const mockArticleModule = createMockModule({ name: 'articles' });
54
+ * ```
55
+ */
56
+ declare function createMockModule(options: CreateMockModuleOptions): ApiRequestDataTypeInterface;
57
+
58
+ interface CreateMockResponseOptions {
59
+ data?: ApiDataInterface | ApiDataInterface[] | null;
60
+ ok?: boolean;
61
+ response?: number;
62
+ error?: string;
63
+ meta?: Record<string, any>;
64
+ self?: string;
65
+ next?: string;
66
+ prev?: string;
67
+ }
68
+ /**
69
+ * Creates a mock API response for testing.
70
+ *
71
+ * @example
72
+ * ```ts
73
+ * import { createMockResponse, createMockApiData } from '@carlonicora/nextjs-jsonapi/testing';
74
+ *
75
+ * const mockData = createMockApiData({ type: 'articles', id: '1' });
76
+ * const response = createMockResponse({ data: mockData, ok: true });
77
+ * ```
78
+ *
79
+ * @example With pagination
80
+ * ```ts
81
+ * const response = createMockResponse({
82
+ * data: [mockData],
83
+ * ok: true,
84
+ * next: '/articles?page=2',
85
+ * prev: '/articles?page=0',
86
+ * });
87
+ * ```
88
+ */
89
+ declare function createMockResponse(options?: CreateMockResponseOptions): ApiResponseInterface;
90
+ /**
91
+ * Creates a mock error response for testing error scenarios.
92
+ *
93
+ * @example
94
+ * ```ts
95
+ * import { createMockErrorResponse } from '@carlonicora/nextjs-jsonapi/testing';
96
+ *
97
+ * const errorResponse = createMockErrorResponse(404, 'Not Found');
98
+ * ```
99
+ */
100
+ declare function createMockErrorResponse(statusCode: number, errorMessage: string): ApiResponseInterface;
101
+
102
+ type MockApiMethod = Mock<(...args: any[]) => Promise<ApiResponseInterface>>;
103
+ interface MockService {
104
+ get: MockApiMethod;
105
+ post: MockApiMethod;
106
+ put: MockApiMethod;
107
+ patch: MockApiMethod;
108
+ delete: MockApiMethod;
109
+ }
110
+ interface CreateMockServiceOptions {
111
+ defaultResponse?: ApiResponseInterface;
112
+ }
113
+ /**
114
+ * Creates a mock service with Vitest mock functions for all HTTP methods.
115
+ *
116
+ * @example
117
+ * ```ts
118
+ * import { createMockService, createMockResponse } from '@carlonicora/nextjs-jsonapi/testing';
119
+ *
120
+ * const mockService = createMockService();
121
+ * mockService.get.mockResolvedValue(createMockResponse({ data: mockData }));
122
+ *
123
+ * // Use in test
124
+ * expect(mockService.get).toHaveBeenCalled();
125
+ * ```
126
+ *
127
+ * @example With default response
128
+ * ```ts
129
+ * const mockService = createMockService({
130
+ * defaultResponse: createMockResponse({ ok: true, data: [] }),
131
+ * });
132
+ * ```
133
+ */
134
+ declare function createMockService(options?: CreateMockServiceOptions): MockService;
135
+ /**
136
+ * Creates a mock service that returns errors for all methods.
137
+ *
138
+ * @example
139
+ * ```ts
140
+ * import { createMockErrorService } from '@carlonicora/nextjs-jsonapi/testing';
141
+ *
142
+ * const errorService = createMockErrorService(500, 'Internal Server Error');
143
+ * ```
144
+ */
145
+ declare function createMockErrorService(statusCode?: number, errorMessage?: string): MockService;
146
+
147
+ interface CreateMockApiDataOptions {
148
+ type: string;
149
+ id?: string;
150
+ attributes?: Record<string, any>;
151
+ relationships?: Record<string, any>;
152
+ included?: any[];
153
+ createdAt?: Date;
154
+ updatedAt?: Date;
155
+ self?: string;
156
+ }
157
+ /**
158
+ * Creates a mock ApiDataInterface object for testing.
159
+ *
160
+ * @example
161
+ * ```ts
162
+ * import { createMockApiData } from '@carlonicora/nextjs-jsonapi/testing';
163
+ *
164
+ * const mockArticle = createMockApiData({
165
+ * type: 'articles',
166
+ * id: '1',
167
+ * attributes: { title: 'Test Article', body: 'Content here' },
168
+ * });
169
+ * ```
170
+ *
171
+ * @example With relationships
172
+ * ```ts
173
+ * const mockArticle = createMockApiData({
174
+ * type: 'articles',
175
+ * id: '1',
176
+ * attributes: { title: 'Test' },
177
+ * relationships: {
178
+ * author: { data: { type: 'users', id: '42' } },
179
+ * },
180
+ * });
181
+ * ```
182
+ */
183
+ declare function createMockApiData(options: CreateMockApiDataOptions): ApiDataInterface;
184
+ /**
185
+ * Creates an array of mock ApiDataInterface objects.
186
+ *
187
+ * @example
188
+ * ```ts
189
+ * import { createMockApiDataList } from '@carlonicora/nextjs-jsonapi/testing';
190
+ *
191
+ * const mockArticles = createMockApiDataList('articles', 5, (index) => ({
192
+ * title: `Article ${index + 1}`,
193
+ * }));
194
+ * ```
195
+ */
196
+ declare function createMockApiDataList(type: string, count: number, attributesFactory?: (index: number) => Record<string, any>): ApiDataInterface[];
197
+
198
+ interface JsonApiResponse {
199
+ data?: {
200
+ type?: string;
201
+ id?: string;
202
+ attributes?: Record<string, any>;
203
+ relationships?: Record<string, any>;
204
+ } | Array<{
205
+ type?: string;
206
+ id?: string;
207
+ attributes?: Record<string, any>;
208
+ relationships?: Record<string, any>;
209
+ }>;
210
+ }
211
+ /**
212
+ * Custom Vitest matchers for JSON:API assertions.
213
+ *
214
+ * @example
215
+ * ```ts
216
+ * import { jsonApiMatchers } from '@carlonicora/nextjs-jsonapi/testing';
217
+ * import { expect } from 'vitest';
218
+ *
219
+ * expect.extend(jsonApiMatchers);
220
+ *
221
+ * // Then use in tests:
222
+ * expect(response).toBeValidJsonApi();
223
+ * expect(response).toHaveJsonApiType('articles');
224
+ * expect(response).toHaveJsonApiAttribute('title', 'My Article');
225
+ * expect(response).toHaveJsonApiRelationship('author');
226
+ * ```
227
+ */
228
+ declare const jsonApiMatchers: {
229
+ /**
230
+ * Asserts that the response has a valid JSON:API structure with type and id.
231
+ */
232
+ toBeValidJsonApi(received: JsonApiResponse): {
233
+ pass: boolean;
234
+ message: () => string;
235
+ };
236
+ /**
237
+ * Asserts that the response data has the expected JSON:API type.
238
+ */
239
+ toHaveJsonApiType(received: JsonApiResponse, expectedType: string): {
240
+ pass: boolean;
241
+ message: () => string;
242
+ };
243
+ /**
244
+ * Asserts that the response data has an attribute with the expected value.
245
+ */
246
+ toHaveJsonApiAttribute(received: JsonApiResponse, attributeName: string, expectedValue?: any): {
247
+ pass: boolean;
248
+ message: () => string;
249
+ };
250
+ /**
251
+ * Asserts that the response data has the specified relationship.
252
+ */
253
+ toHaveJsonApiRelationship(received: JsonApiResponse, relationshipName: string): {
254
+ pass: boolean;
255
+ message: () => string;
256
+ };
257
+ /**
258
+ * Asserts that the response data array has the expected length.
259
+ */
260
+ toHaveJsonApiLength(received: JsonApiResponse, expectedLength: number): {
261
+ pass: boolean;
262
+ message: () => string;
263
+ };
264
+ };
265
+ declare module "vitest" {
266
+ interface Assertion<T = any> {
267
+ toBeValidJsonApi(): T;
268
+ toHaveJsonApiType(expectedType: string): T;
269
+ toHaveJsonApiAttribute(attributeName: string, expectedValue?: any): T;
270
+ toHaveJsonApiRelationship(relationshipName: string): T;
271
+ toHaveJsonApiLength(expectedLength: number): T;
272
+ }
273
+ interface AsymmetricMatchersContaining {
274
+ toBeValidJsonApi(): any;
275
+ toHaveJsonApiType(expectedType: string): any;
276
+ toHaveJsonApiAttribute(attributeName: string, expectedValue?: any): any;
277
+ toHaveJsonApiRelationship(relationshipName: string): any;
278
+ toHaveJsonApiLength(expectedLength: number): any;
279
+ }
280
+ }
281
+ /**
282
+ * Extends Vitest's expect with JSON:API matchers.
283
+ * Call this in your test setup file.
284
+ *
285
+ * @example
286
+ * ```ts
287
+ * // vitest.setup.ts
288
+ * import { extendExpectWithJsonApiMatchers } from '@carlonicora/nextjs-jsonapi/testing';
289
+ *
290
+ * extendExpectWithJsonApiMatchers();
291
+ * ```
292
+ */
293
+ declare function extendExpectWithJsonApiMatchers(): void;
294
+
295
+ interface RenderWithProvidersOptions extends Omit<RenderOptions, "wrapper"> {
296
+ /**
297
+ * Custom JSON:API configuration to pass to the mock provider.
298
+ */
299
+ jsonApiConfig?: Partial<JsonApiConfig>;
300
+ /**
301
+ * Additional wrapper component to wrap around the providers.
302
+ */
303
+ wrapper?: React__default.ComponentType<{
304
+ children: React__default.ReactNode;
305
+ }>;
306
+ }
307
+ /**
308
+ * Renders a component wrapped with all necessary providers for testing.
309
+ *
310
+ * @example
311
+ * ```tsx
312
+ * import { renderWithProviders } from '@carlonicora/nextjs-jsonapi/testing';
313
+ *
314
+ * const { getByText } = renderWithProviders(<MyComponent />);
315
+ * expect(getByText('Hello')).toBeInTheDocument();
316
+ * ```
317
+ *
318
+ * @example With custom config
319
+ * ```tsx
320
+ * const { getByText } = renderWithProviders(<MyComponent />, {
321
+ * jsonApiConfig: { apiUrl: 'https://custom.api.com' },
322
+ * });
323
+ * ```
324
+ *
325
+ * @example With additional wrapper
326
+ * ```tsx
327
+ * const CustomWrapper = ({ children }) => (
328
+ * <ThemeProvider>{children}</ThemeProvider>
329
+ * );
330
+ *
331
+ * const { getByText } = renderWithProviders(<MyComponent />, {
332
+ * wrapper: CustomWrapper,
333
+ * });
334
+ * ```
335
+ */
336
+ declare function renderWithProviders(ui: ReactElement, options?: RenderWithProvidersOptions): RenderResult;
337
+
338
+ export { type CreateMockApiDataOptions, type CreateMockModuleOptions, type CreateMockResponseOptions, type CreateMockServiceOptions, type MockApiMethod, MockJsonApiProvider, type MockJsonApiProviderProps, type MockService, type RenderWithProvidersOptions, createMockApiData, createMockApiDataList, createMockErrorResponse, createMockErrorService, createMockModule, createMockResponse, createMockService, defaultMockConfig, extendExpectWithJsonApiMatchers, jsonApiMatchers, renderWithProviders };