@carlonicora/nextjs-jsonapi 1.0.4 → 1.0.5

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 (282) hide show
  1. package/dist/{AbstractService-BKlpJA61.d.mts → AbstractService-B2n_JdiC.d.mts} +1 -1
  2. package/dist/{AbstractService-D9eSVKNa.d.ts → AbstractService-DtQTYovo.d.ts} +1 -1
  3. package/dist/{content.interface-Dg2lt_An.d.mts → AuthComponent-CPLvEerw.d.mts} +11 -15
  4. package/dist/{content.interface-BhyAiOFq.d.ts → AuthComponent-m6Qp4Hz6.d.ts} +11 -15
  5. package/dist/{BlockNoteEditor-UVO3VZZE.mjs → BlockNoteEditor-BLVXQPXV.mjs} +14 -18
  6. package/dist/{BlockNoteEditor-UVO3VZZE.mjs.map → BlockNoteEditor-BLVXQPXV.mjs.map} +1 -1
  7. package/dist/{BlockNoteEditor-VFWG6LXI.js → BlockNoteEditor-ZTDHULFT.js} +15 -19
  8. package/dist/BlockNoteEditor-ZTDHULFT.js.map +1 -0
  9. package/dist/JsonApiRequest-O7BGUMFO.mjs +23 -0
  10. package/dist/JsonApiRequest-VARLNKAF.js +23 -0
  11. package/dist/JsonApiRequest-VARLNKAF.js.map +1 -0
  12. package/dist/chunk-2LM6LCJW.mjs +1 -0
  13. package/dist/chunk-3APORDYP.mjs +7783 -0
  14. package/dist/chunk-3APORDYP.mjs.map +1 -0
  15. package/dist/{chunk-TMVHSY3Y.js → chunk-5ZEADNNP.js} +36 -17
  16. package/dist/chunk-5ZEADNNP.js.map +1 -0
  17. package/dist/{chunk-ECDTZBYO.mjs → chunk-74F6BBHH.mjs} +21 -2
  18. package/dist/chunk-74F6BBHH.mjs.map +1 -0
  19. package/dist/{chunk-GYWPEPOH.mjs → chunk-7C5RAEBO.mjs} +72 -68
  20. package/dist/chunk-7C5RAEBO.mjs.map +1 -0
  21. package/dist/chunk-A5DDIABK.js +1 -0
  22. package/dist/{chunk-TEGF6ZWG.js → chunk-AGAJMJ4T.js} +47 -9
  23. package/dist/chunk-AGAJMJ4T.js.map +1 -0
  24. package/dist/{chunk-CXQOWQSY.js → chunk-AYHKQWHH.js} +15 -2
  25. package/dist/chunk-AYHKQWHH.js.map +1 -0
  26. package/dist/{chunk-I2REI7OA.js → chunk-HMHGLXWC.js} +33 -15
  27. package/dist/chunk-HMHGLXWC.js.map +1 -0
  28. package/dist/chunk-IWFGEPAA.mjs +1 -0
  29. package/dist/chunk-JC3WJK65.js +1 -0
  30. package/dist/{chunk-L6EQEAXU.mjs → chunk-PYF2U6WG.mjs} +25 -7
  31. package/dist/chunk-PYF2U6WG.mjs.map +1 -0
  32. package/dist/{chunk-YDVTFM7X.mjs → chunk-RBIVEH2K.mjs} +42 -4
  33. package/dist/chunk-RBIVEH2K.mjs.map +1 -0
  34. package/dist/{chunk-V2JJPI7N.js → chunk-RZO2LOW4.js} +237 -233
  35. package/dist/chunk-RZO2LOW4.js.map +1 -0
  36. package/dist/{chunk-X4BIHJ2B.mjs → chunk-SM63SZCP.mjs} +15 -2
  37. package/dist/chunk-SM63SZCP.mjs.map +1 -0
  38. package/dist/chunk-WEC4YMOS.js +7783 -0
  39. package/dist/chunk-WEC4YMOS.js.map +1 -0
  40. package/dist/client/index.d.mts +21 -2
  41. package/dist/client/index.d.ts +21 -2
  42. package/dist/client/index.js +18 -245
  43. package/dist/client/index.js.map +1 -1
  44. package/dist/client/index.mjs +28 -255
  45. package/dist/client/index.mjs.map +1 -1
  46. package/dist/components/index.d.mts +293 -8
  47. package/dist/components/index.d.ts +293 -8
  48. package/dist/components/index.js +78 -2323
  49. package/dist/components/index.js.map +1 -1
  50. package/dist/components/index.mjs +172 -2417
  51. package/dist/components/index.mjs.map +1 -1
  52. package/dist/{config-hXufftVS.d.ts → config-BmnK65TD.d.mts} +1 -0
  53. package/dist/{config-hXufftVS.d.mts → config-BmnK65TD.d.ts} +1 -0
  54. package/dist/config-DQeAo9Kf.d.mts +49 -0
  55. package/dist/config-DQeAo9Kf.d.ts +49 -0
  56. package/dist/contexts/index.d.mts +109 -21
  57. package/dist/contexts/index.d.ts +109 -21
  58. package/dist/contexts/index.js +39 -7
  59. package/dist/contexts/index.js.map +1 -1
  60. package/dist/contexts/index.mjs +40 -8
  61. package/dist/core/index.d.mts +3 -4
  62. package/dist/core/index.d.ts +3 -4
  63. package/dist/core/index.js +3 -7
  64. package/dist/core/index.js.map +1 -1
  65. package/dist/core/index.mjs +4 -8
  66. package/dist/{d3.link.interface-QMdB22bC.d.mts → d3.link.interface-ClC4Irqp.d.mts} +2 -1
  67. package/dist/{d3.link.interface-QMdB22bC.d.ts → d3.link.interface-ClC4Irqp.d.ts} +2 -1
  68. package/dist/features/index.d.mts +17 -86
  69. package/dist/features/index.d.ts +17 -86
  70. package/dist/features/index.js +7 -16
  71. package/dist/features/index.js.map +1 -1
  72. package/dist/features/index.mjs +10 -19
  73. package/dist/hooks/index.d.mts +18 -43
  74. package/dist/hooks/index.d.ts +18 -43
  75. package/dist/hooks/index.js +20 -7
  76. package/dist/hooks/index.js.map +1 -1
  77. package/dist/hooks/index.mjs +19 -6
  78. package/dist/index.d.mts +10 -6
  79. package/dist/index.d.ts +10 -6
  80. package/dist/index.js +13 -10
  81. package/dist/index.js.map +1 -1
  82. package/dist/index.mjs +22 -19
  83. package/dist/interfaces/index.d.mts +2 -1
  84. package/dist/interfaces/index.d.ts +2 -1
  85. package/dist/notification.interface-BBgMUdLR.d.mts +14 -0
  86. package/dist/notification.interface-gyvT-Z2F.d.ts +14 -0
  87. package/dist/permissions/index.d.mts +2 -3
  88. package/dist/permissions/index.d.ts +2 -3
  89. package/dist/server/index.d.mts +38 -18
  90. package/dist/server/index.d.ts +38 -18
  91. package/dist/server/index.js +70 -2
  92. package/dist/server/index.js.map +1 -1
  93. package/dist/server/index.mjs +68 -0
  94. package/dist/server/index.mjs.map +1 -1
  95. package/dist/types-BUAlgqqh.d.ts +39 -0
  96. package/dist/{types-DluCaP1I.d.ts → types-Bl61ob-7.d.mts} +19 -2
  97. package/dist/{types-lQVA8d_P.d.mts → types-Bl61ob-7.d.ts} +19 -2
  98. package/dist/types-iVdVY7ba.d.mts +39 -0
  99. package/dist/useSocket-Cn7fB_B1.d.mts +25 -0
  100. package/dist/useSocket-DzMKRKCA.d.ts +25 -0
  101. package/dist/user.fields-CbdObSmS.d.mts +18 -0
  102. package/dist/user.fields-CbdObSmS.d.ts +18 -0
  103. package/dist/utils/index.d.mts +1 -2
  104. package/dist/utils/index.d.ts +1 -2
  105. package/package.json +5 -3
  106. package/src/client/index.ts +13 -0
  107. package/src/components/forms/index.ts +1 -0
  108. package/src/components/index.ts +5 -0
  109. package/src/components/tables/ContentListTable.tsx +1 -0
  110. package/src/contexts/CommonContext.tsx +52 -0
  111. package/src/contexts/SharedContext.tsx +2 -0
  112. package/src/contexts/SocketContext.tsx +65 -0
  113. package/src/contexts/index.ts +6 -1
  114. package/src/features/auth/components/containers/AuthContainer.tsx +32 -0
  115. package/src/features/auth/components/containers/index.ts +1 -0
  116. package/src/features/auth/components/details/LandingComponent.tsx +39 -0
  117. package/src/features/auth/components/details/index.ts +1 -0
  118. package/src/features/auth/components/forms/AcceptInvitation.tsx +136 -0
  119. package/src/features/auth/components/forms/ActivateAccount.tsx +75 -0
  120. package/src/features/auth/components/forms/Cookies.tsx +32 -0
  121. package/src/features/auth/components/forms/ForgotPassword.tsx +108 -0
  122. package/src/features/auth/components/forms/Login.tsx +118 -0
  123. package/src/features/auth/components/forms/Logout.tsx +19 -0
  124. package/src/features/auth/components/forms/RefreshUser.tsx +39 -0
  125. package/src/features/auth/components/forms/Register.tsx +150 -0
  126. package/src/features/auth/components/forms/ResetPassword.tsx +126 -0
  127. package/src/features/auth/components/forms/index.ts +9 -0
  128. package/src/features/auth/components/index.ts +3 -0
  129. package/src/features/auth/contexts/AuthContext.tsx +77 -0
  130. package/src/features/auth/contexts/index.ts +1 -0
  131. package/src/features/auth/enums/AuthComponent.ts +9 -0
  132. package/src/features/auth/enums/index.ts +1 -0
  133. package/src/features/auth/index.ts +2 -1
  134. package/src/features/auth/utils/AuthCookies.ts +134 -0
  135. package/src/features/auth/utils/index.ts +1 -0
  136. package/src/features/company/components/containers/AdminCompanyContainer.tsx +26 -0
  137. package/src/features/company/components/containers/CompanyContainer.tsx +17 -0
  138. package/src/features/company/components/containers/index.ts +2 -0
  139. package/src/features/company/components/details/CompanyDetails.tsx +26 -0
  140. package/src/features/company/components/details/index.ts +1 -0
  141. package/src/features/company/components/forms/CompanyConfigurationEditor.tsx +151 -0
  142. package/src/features/company/components/forms/CompanyConfigurationSecurityForm.tsx +97 -0
  143. package/src/features/company/components/forms/CompanyDeleter.tsx +121 -0
  144. package/src/features/company/components/forms/CompanyEditor.tsx +245 -0
  145. package/src/features/company/components/forms/CompanyLicense.tsx +213 -0
  146. package/src/features/company/components/forms/index.ts +5 -0
  147. package/src/features/company/components/index.ts +4 -0
  148. package/src/features/company/components/lists/CompaniesList.tsx +31 -0
  149. package/src/features/company/components/lists/index.ts +1 -0
  150. package/src/features/company/contexts/CompanyContext.tsx +99 -0
  151. package/src/features/company/contexts/index.ts +0 -0
  152. package/src/features/company/hooks/index.ts +1 -0
  153. package/src/features/company/hooks/useCompanyTableStructure.tsx +82 -0
  154. package/src/features/feature/components/forms/FormFeatures.tsx +141 -140
  155. package/src/features/feature/components/forms/index.ts +1 -0
  156. package/src/features/feature/components/index.ts +1 -1
  157. package/src/features/feature/index.ts +1 -2
  158. package/src/features/module/index.ts +1 -1
  159. package/src/features/notification/components/common/NotificationErrorBoundary.tsx +51 -0
  160. package/src/features/notification/components/common/index.ts +1 -0
  161. package/src/features/notification/components/containers/NotificationsListContainer.tsx +44 -0
  162. package/src/features/notification/components/containers/index.ts +1 -0
  163. package/src/features/notification/components/index.ts +5 -0
  164. package/src/features/notification/components/lists/NotificationsList.tsx +129 -0
  165. package/src/features/notification/components/lists/index.ts +1 -0
  166. package/src/features/notification/components/modals/NotificationModal.tsx +220 -0
  167. package/src/features/notification/components/modals/index.ts +1 -0
  168. package/src/features/notification/components/notifications/Notification.tsx +120 -0
  169. package/src/features/notification/components/notifications/PushNotificationProvider.tsx +9 -0
  170. package/src/features/notification/components/notifications/index.ts +2 -0
  171. package/src/features/notification/contexts/NotificationContext.tsx +187 -0
  172. package/src/features/notification/contexts/index.ts +1 -0
  173. package/src/features/notification/index.ts +1 -1
  174. package/src/features/push/index.ts +1 -1
  175. package/src/features/role/components/containers/RoleContainer.tsx +18 -0
  176. package/src/features/role/components/containers/index.ts +1 -0
  177. package/src/features/role/components/details/RoleDetails.tsx +21 -0
  178. package/src/features/role/components/details/index.ts +1 -0
  179. package/src/features/role/components/forms/FormRoles.tsx +82 -0
  180. package/src/features/role/components/forms/RemoveUserFromRole.tsx +108 -0
  181. package/src/features/role/components/forms/UserRoleAdd.tsx +128 -0
  182. package/src/features/role/components/forms/index.ts +3 -0
  183. package/src/features/role/components/index.ts +4 -0
  184. package/src/features/role/components/lists/RolesList.tsx +27 -0
  185. package/src/features/role/components/lists/UserRolesList.tsx +31 -0
  186. package/src/features/role/components/lists/index.ts +2 -0
  187. package/src/features/role/contexts/RoleContext.tsx +84 -0
  188. package/src/features/role/contexts/index.ts +1 -0
  189. package/src/features/role/hooks/index.ts +1 -0
  190. package/src/features/role/hooks/useRoleTableStructure.tsx +72 -0
  191. package/src/features/s3/index.ts +1 -1
  192. package/src/features/user/components/containers/UserContainer.tsx +23 -0
  193. package/src/features/user/components/containers/UserIndexContainer.tsx +12 -0
  194. package/src/features/user/components/containers/UsersListContainer.tsx +36 -0
  195. package/src/features/user/components/containers/index.ts +3 -0
  196. package/src/features/user/components/details/UserDetails.tsx +74 -0
  197. package/src/features/user/components/details/UserIndexDetails.tsx +28 -0
  198. package/src/features/user/components/details/index.ts +2 -0
  199. package/src/features/user/components/forms/RoleUserAdd.tsx +93 -0
  200. package/src/features/user/components/forms/UserAvatarEditor.tsx +78 -0
  201. package/src/features/user/components/forms/UserDeleter.tsx +49 -0
  202. package/src/features/user/components/forms/UserEditor.tsx +319 -0
  203. package/src/features/user/components/forms/UserMultiSelect.tsx +218 -0
  204. package/src/features/user/components/forms/UserReactivator.tsx +79 -0
  205. package/src/features/user/components/forms/UserResentInvitationEmail.tsx +88 -0
  206. package/src/features/user/components/forms/UserSelector.tsx +185 -0
  207. package/src/features/user/components/forms/index.ts +8 -0
  208. package/src/features/user/components/index.ts +3 -0
  209. package/src/features/user/components/lists/AdminUsersList.tsx +41 -0
  210. package/src/features/user/components/lists/CompanyUsersList.tsx +44 -0
  211. package/src/features/user/components/lists/RelevantUsersList.tsx +30 -0
  212. package/src/features/user/components/lists/RoleUsersList.tsx +31 -0
  213. package/src/features/user/components/lists/UserListInAdd.tsx +53 -0
  214. package/src/features/user/components/lists/UsersList.tsx +30 -0
  215. package/src/features/user/components/lists/UsersListByContentIds.tsx +30 -0
  216. package/src/features/user/components/lists/index.ts +7 -0
  217. package/src/features/user/components/widgets/UserAvatarList.tsx +31 -0
  218. package/src/features/user/components/widgets/UserSearchPopover.tsx +89 -0
  219. package/src/features/user/contexts/UserContext.tsx +106 -0
  220. package/src/features/user/contexts/index.ts +1 -0
  221. package/src/features/user/hooks/index.ts +2 -0
  222. package/src/features/user/hooks/useUserSearch.ts +53 -0
  223. package/src/features/user/hooks/useUserTableStructure.tsx +115 -0
  224. package/src/features/user/index.ts +0 -1
  225. package/src/hooks/index.ts +4 -0
  226. package/src/hooks/useCustomD3Graph.tsx +2 -0
  227. package/src/hooks/useNotificationSync.ts +20 -0
  228. package/src/hooks/usePageTracker.ts +69 -0
  229. package/src/hooks/usePushNotifications.ts +82 -0
  230. package/src/hooks/useSocket.ts +201 -0
  231. package/src/hooks/useTableGenerator.ts +6 -2
  232. package/src/i18n/config.ts +1 -0
  233. package/src/index.ts +4 -0
  234. package/src/interfaces/d3.link.interface.ts +2 -1
  235. package/src/server/ServerSession.ts +103 -0
  236. package/src/server/index.ts +2 -1
  237. package/src/unified/JsonApiRequest.ts +23 -0
  238. package/dist/ApiRequestDataTypeInterface-CUKFDBx2.d.mts +0 -20
  239. package/dist/ApiRequestDataTypeInterface-CUKFDBx2.d.ts +0 -20
  240. package/dist/BlockNoteEditor-VFWG6LXI.js.map +0 -1
  241. package/dist/JsonApiRequest-S3ICLM7B.mjs +0 -20
  242. package/dist/JsonApiRequest-ZZLSP26T.js +0 -20
  243. package/dist/JsonApiRequest-ZZLSP26T.js.map +0 -1
  244. package/dist/chunk-366S2JCC.mjs +0 -31
  245. package/dist/chunk-366S2JCC.mjs.map +0 -1
  246. package/dist/chunk-5W6AKZE6.mjs +0 -131
  247. package/dist/chunk-5W6AKZE6.mjs.map +0 -1
  248. package/dist/chunk-A3J3AAYM.mjs +0 -97
  249. package/dist/chunk-A3J3AAYM.mjs.map +0 -1
  250. package/dist/chunk-AWONBQQP.js +0 -97
  251. package/dist/chunk-AWONBQQP.js.map +0 -1
  252. package/dist/chunk-CXQOWQSY.js.map +0 -1
  253. package/dist/chunk-DKKMWBP4.mjs +0 -1
  254. package/dist/chunk-DKKMWBP4.mjs.map +0 -1
  255. package/dist/chunk-DO2HLAZO.js +0 -48
  256. package/dist/chunk-DO2HLAZO.js.map +0 -1
  257. package/dist/chunk-DZXDB3K2.mjs +0 -17
  258. package/dist/chunk-DZXDB3K2.mjs.map +0 -1
  259. package/dist/chunk-ECDTZBYO.mjs.map +0 -1
  260. package/dist/chunk-FY4SXJGU.js +0 -806
  261. package/dist/chunk-FY4SXJGU.js.map +0 -1
  262. package/dist/chunk-GYWPEPOH.mjs.map +0 -1
  263. package/dist/chunk-H6FMOA6B.js +0 -1
  264. package/dist/chunk-H6FMOA6B.js.map +0 -1
  265. package/dist/chunk-I2REI7OA.js.map +0 -1
  266. package/dist/chunk-J4Q36PMP.js +0 -31
  267. package/dist/chunk-J4Q36PMP.js.map +0 -1
  268. package/dist/chunk-L6EQEAXU.mjs.map +0 -1
  269. package/dist/chunk-MFO27OHB.mjs +0 -48
  270. package/dist/chunk-MFO27OHB.mjs.map +0 -1
  271. package/dist/chunk-RAF7PNLG.js +0 -131
  272. package/dist/chunk-RAF7PNLG.js.map +0 -1
  273. package/dist/chunk-RUR22SVM.js +0 -17
  274. package/dist/chunk-RUR22SVM.js.map +0 -1
  275. package/dist/chunk-TEGF6ZWG.js.map +0 -1
  276. package/dist/chunk-TMVHSY3Y.js.map +0 -1
  277. package/dist/chunk-V2JJPI7N.js.map +0 -1
  278. package/dist/chunk-WWWMJZEF.mjs +0 -806
  279. package/dist/chunk-WWWMJZEF.mjs.map +0 -1
  280. package/dist/chunk-X4BIHJ2B.mjs.map +0 -1
  281. package/dist/chunk-YDVTFM7X.mjs.map +0 -1
  282. /package/dist/{JsonApiRequest-S3ICLM7B.mjs.map → JsonApiRequest-O7BGUMFO.mjs.map} +0 -0
@@ -6,10 +6,18 @@ import {
6
6
  useCustomD3Graph,
7
7
  useDataListRetriever,
8
8
  useDebounce,
9
+ useNotificationSync,
10
+ usePageTracker,
9
11
  usePageUrlGenerator,
12
+ useSocket,
10
13
  useTableGenerator,
11
14
  useUrlRewriter
12
- } from "../chunk-WWWMJZEF.mjs";
15
+ } from "../chunk-3APORDYP.mjs";
16
+ import "../chunk-C7C7VY4F.mjs";
17
+ import "../chunk-IWFGEPAA.mjs";
18
+ import "../chunk-2LM6LCJW.mjs";
19
+ import "../chunk-7C5RAEBO.mjs";
20
+ import "../chunk-AUXK7QSA.mjs";
13
21
  import {
14
22
  configureI18n,
15
23
  getI18nLink,
@@ -17,11 +25,13 @@ import {
17
25
  useI18nLocale,
18
26
  useI18nRouter,
19
27
  useI18nTranslations
20
- } from "../chunk-X4BIHJ2B.mjs";
21
- import "../chunk-L6EQEAXU.mjs";
22
- import "../chunk-YDVTFM7X.mjs";
23
- import "../chunk-366S2JCC.mjs";
24
- import "../chunk-MFO27OHB.mjs";
28
+ } from "../chunk-SM63SZCP.mjs";
29
+ import "../chunk-74F6BBHH.mjs";
30
+ import "../chunk-BLWVZK6J.mjs";
31
+ import "../chunk-Q2N6SQYW.mjs";
32
+ import "../chunk-PYF2U6WG.mjs";
33
+ import "../chunk-RBIVEH2K.mjs";
34
+ import "../chunk-DD3KISNB.mjs";
25
35
  import "../chunk-PAWJFY3S.mjs";
26
36
  export {
27
37
  TableGeneratorRegistry,
@@ -36,7 +46,10 @@ export {
36
46
  useI18nLocale,
37
47
  useI18nRouter,
38
48
  useI18nTranslations,
49
+ useNotificationSync,
50
+ usePageTracker,
39
51
  usePageUrlGenerator,
52
+ useSocket,
40
53
  useTableGenerator,
41
54
  useUrlRewriter
42
55
  };
package/dist/index.d.mts CHANGED
@@ -1,14 +1,14 @@
1
- import { A as ApiRequestDataTypeInterface } from './ApiRequestDataTypeInterface-CUKFDBx2.mjs';
2
- export { F as FieldSelector, G as GetterKeys, c as createJsonApiInclusion } from './ApiRequestDataTypeInterface-CUKFDBx2.mjs';
1
+ import { M as ModuleWithPermissions, A as ApiRequestDataTypeInterface } from './types-Bl61ob-7.mjs';
2
+ export { a as Action, F as FieldSelector, G as GetterKeys, e as ModuleDefinition, i as ModuleFactory, d as ModulePermissionDefinition, b as PageUrl, P as PermissionCheck, f as PermissionConfig, g as PermissionModule, h as PermissionUser, c as createJsonApiInclusion } from './types-Bl61ob-7.mjs';
3
3
  import { A as ApiResponseInterface } from './ApiResponseInterface-BHN5D9r5.mjs';
4
4
  export { A as ApiData } from './ApiData-DPKNfY-9.mjs';
5
5
  export { A as ApiDataInterface, J as JsonApiHydratedDataInterface } from './ApiDataInterface-DPP8s46n.mjs';
6
- export { A as AbstractApiData, a as AbstractService, H as HttpMethod, N as NextRef, P as PreviousRef, S as SelfRef, g as getGlobalErrorHandler, s as setGlobalErrorHandler } from './AbstractService-BKlpJA61.mjs';
6
+ export { A as AbstractApiData, a as AbstractService, H as HttpMethod, N as NextRef, P as PreviousRef, S as SelfRef, g as getGlobalErrorHandler, s as setGlobalErrorHandler } from './AbstractService-B2n_JdiC.mjs';
7
7
  export { AppModuleDefinitions, DataClass, DataClass as DataClassRegistry, EndpointCreator, EndpointQuery, FoundationModuleDefinitions, JsonApiDataFactory, ModuleDefinitions, ModuleRegistrar, ModuleRegistry, Modules, RehydrationFactory, rehydrate, rehydrateList, translateData, translateResponse } from './core/index.mjs';
8
- export { A as Action, b as ModuleDefinition, g as ModuleFactory, M as ModulePermissionDefinition, f as ModuleWithPermissions, a as PageUrl, P as PermissionCheck, c as PermissionConfig, d as PermissionModule, e as PermissionUser } from './types-lQVA8d_P.mjs';
9
8
  export { checkPermissions, checkPermissionsFromServer, getValueFromPath } from './permissions/index.mjs';
10
- export { I as I18nConfig, c as configureI18n } from './config-hXufftVS.mjs';
9
+ export { I as I18nConfig, c as configureI18n } from './config-BmnK65TD.mjs';
11
10
  export { RoleIdConfig, configureRoles, getRoleId, isRolesConfigured } from './roles/index.mjs';
11
+ export { T as TokenHandler, a as TokenParams, c as configureAuth, g as getTokenHandler } from './config-DQeAo9Kf.mjs';
12
12
  import 'react';
13
13
 
14
14
  /**
@@ -17,9 +17,13 @@ import 'react';
17
17
  */
18
18
  declare function configureJsonApi(config: {
19
19
  apiUrl: string;
20
+ appUrl?: string;
21
+ trackablePages?: ModuleWithPermissions[];
20
22
  bootstrapper?: () => void;
21
23
  additionalHeaders?: Record<string, string>;
22
24
  }): void;
25
+ declare function getAppUrl(): string;
26
+ declare function getTrackablePages(): ModuleWithPermissions[];
23
27
  declare function JsonApiGet(params: {
24
28
  classKey: ApiRequestDataTypeInterface;
25
29
  endpoint: string;
@@ -69,4 +73,4 @@ declare function JsonApiDelete(params: {
69
73
  responseType?: ApiRequestDataTypeInterface;
70
74
  }): Promise<ApiResponseInterface>;
71
75
 
72
- export { ApiRequestDataTypeInterface, ApiResponseInterface, JsonApiDelete, JsonApiGet, JsonApiPatch, JsonApiPost, JsonApiPut, configureJsonApi };
76
+ export { ApiRequestDataTypeInterface, ApiResponseInterface, JsonApiDelete, JsonApiGet, JsonApiPatch, JsonApiPost, JsonApiPut, ModuleWithPermissions, configureJsonApi, getAppUrl, getTrackablePages };
package/dist/index.d.ts CHANGED
@@ -1,14 +1,14 @@
1
- import { A as ApiRequestDataTypeInterface } from './ApiRequestDataTypeInterface-CUKFDBx2.js';
2
- export { F as FieldSelector, G as GetterKeys, c as createJsonApiInclusion } from './ApiRequestDataTypeInterface-CUKFDBx2.js';
1
+ import { M as ModuleWithPermissions, A as ApiRequestDataTypeInterface } from './types-Bl61ob-7.js';
2
+ export { a as Action, F as FieldSelector, G as GetterKeys, e as ModuleDefinition, i as ModuleFactory, d as ModulePermissionDefinition, b as PageUrl, P as PermissionCheck, f as PermissionConfig, g as PermissionModule, h as PermissionUser, c as createJsonApiInclusion } from './types-Bl61ob-7.js';
3
3
  import { A as ApiResponseInterface } from './ApiResponseInterface-DDI7QQPR.js';
4
4
  export { A as ApiData } from './ApiData-DPKNfY-9.js';
5
5
  export { A as ApiDataInterface, J as JsonApiHydratedDataInterface } from './ApiDataInterface-DPP8s46n.js';
6
- export { A as AbstractApiData, a as AbstractService, H as HttpMethod, N as NextRef, P as PreviousRef, S as SelfRef, g as getGlobalErrorHandler, s as setGlobalErrorHandler } from './AbstractService-D9eSVKNa.js';
6
+ export { A as AbstractApiData, a as AbstractService, H as HttpMethod, N as NextRef, P as PreviousRef, S as SelfRef, g as getGlobalErrorHandler, s as setGlobalErrorHandler } from './AbstractService-DtQTYovo.js';
7
7
  export { AppModuleDefinitions, DataClass, DataClass as DataClassRegistry, EndpointCreator, EndpointQuery, FoundationModuleDefinitions, JsonApiDataFactory, ModuleDefinitions, ModuleRegistrar, ModuleRegistry, Modules, RehydrationFactory, rehydrate, rehydrateList, translateData, translateResponse } from './core/index.js';
8
- export { A as Action, b as ModuleDefinition, g as ModuleFactory, M as ModulePermissionDefinition, f as ModuleWithPermissions, a as PageUrl, P as PermissionCheck, c as PermissionConfig, d as PermissionModule, e as PermissionUser } from './types-DluCaP1I.js';
9
8
  export { checkPermissions, checkPermissionsFromServer, getValueFromPath } from './permissions/index.js';
10
- export { I as I18nConfig, c as configureI18n } from './config-hXufftVS.js';
9
+ export { I as I18nConfig, c as configureI18n } from './config-BmnK65TD.js';
11
10
  export { RoleIdConfig, configureRoles, getRoleId, isRolesConfigured } from './roles/index.js';
11
+ export { T as TokenHandler, a as TokenParams, c as configureAuth, g as getTokenHandler } from './config-DQeAo9Kf.js';
12
12
  import 'react';
13
13
 
14
14
  /**
@@ -17,9 +17,13 @@ import 'react';
17
17
  */
18
18
  declare function configureJsonApi(config: {
19
19
  apiUrl: string;
20
+ appUrl?: string;
21
+ trackablePages?: ModuleWithPermissions[];
20
22
  bootstrapper?: () => void;
21
23
  additionalHeaders?: Record<string, string>;
22
24
  }): void;
25
+ declare function getAppUrl(): string;
26
+ declare function getTrackablePages(): ModuleWithPermissions[];
23
27
  declare function JsonApiGet(params: {
24
28
  classKey: ApiRequestDataTypeInterface;
25
29
  endpoint: string;
@@ -69,4 +73,4 @@ declare function JsonApiDelete(params: {
69
73
  responseType?: ApiRequestDataTypeInterface;
70
74
  }): Promise<ApiResponseInterface>;
71
75
 
72
- export { ApiRequestDataTypeInterface, ApiResponseInterface, JsonApiDelete, JsonApiGet, JsonApiPatch, JsonApiPost, JsonApiPut, configureJsonApi };
76
+ export { ApiRequestDataTypeInterface, ApiResponseInterface, JsonApiDelete, JsonApiGet, JsonApiPatch, JsonApiPost, JsonApiPut, ModuleWithPermissions, configureJsonApi, getAppUrl, getTrackablePages };
package/dist/index.js CHANGED
@@ -1,26 +1,25 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('./chunk-H6FMOA6B.js');
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
3
 
4
4
 
5
+ var _chunkAYHKQWHHjs = require('./chunk-AYHKQWHH.js');
5
6
 
6
7
 
7
8
 
8
9
 
9
- var _chunkTMVHSY3Yjs = require('./chunk-TMVHSY3Y.js');
10
10
 
11
11
 
12
- var _chunkCXQOWQSYjs = require('./chunk-CXQOWQSY.js');
13
12
 
14
13
 
15
14
 
15
+ var _chunk5ZEADNNPjs = require('./chunk-5ZEADNNP.js');
16
16
 
17
17
 
18
- var _chunk6GKHCVF6js = require('./chunk-6GKHCVF6.js');
19
18
 
20
19
 
20
+ var _chunk4HCRAOS5js = require('./chunk-4HCRAOS5.js');
21
21
 
22
22
 
23
- var _chunk4HCRAOS5js = require('./chunk-4HCRAOS5.js');
24
23
 
25
24
 
26
25
 
@@ -33,19 +32,19 @@ var _chunk4HCRAOS5js = require('./chunk-4HCRAOS5.js');
33
32
 
34
33
 
35
34
 
35
+ var _chunkHMHGLXWCjs = require('./chunk-HMHGLXWC.js');
36
36
 
37
- var _chunkI2REI7OAjs = require('./chunk-I2REI7OA.js');
38
37
 
39
38
 
40
39
 
41
40
 
42
- var _chunkTEGF6ZWGjs = require('./chunk-TEGF6ZWG.js');
41
+ var _chunkAGAJMJ4Tjs = require('./chunk-AGAJMJ4T.js');
43
42
 
44
43
 
45
- var _chunkJ4Q36PMPjs = require('./chunk-J4Q36PMP.js');
46
44
 
47
45
 
48
- var _chunkDO2HLAZOjs = require('./chunk-DO2HLAZO.js');
46
+
47
+ var _chunk6GKHCVF6js = require('./chunk-6GKHCVF6.js');
49
48
  require('./chunk-7QVYU63E.js');
50
49
 
51
50
 
@@ -80,5 +79,9 @@ require('./chunk-7QVYU63E.js');
80
79
 
81
80
 
82
81
 
83
- exports.AbstractApiData = _chunkI2REI7OAjs.AbstractApiData; exports.AbstractService = _chunkI2REI7OAjs.AbstractService; exports.Action = _chunk6GKHCVF6js.Action; exports.DataClass = _chunkDO2HLAZOjs.DataClassRegistry; exports.DataClassRegistry = _chunkDO2HLAZOjs.DataClassRegistry; exports.EndpointCreator = _chunkI2REI7OAjs.EndpointCreator; exports.HttpMethod = _chunkI2REI7OAjs.HttpMethod; exports.JsonApiDataFactory = _chunkTEGF6ZWGjs.JsonApiDataFactory; exports.JsonApiDelete = _chunkTMVHSY3Yjs.JsonApiDelete; exports.JsonApiGet = _chunkTMVHSY3Yjs.JsonApiGet; exports.JsonApiPatch = _chunkTMVHSY3Yjs.JsonApiPatch; exports.JsonApiPost = _chunkTMVHSY3Yjs.JsonApiPost; exports.JsonApiPut = _chunkTMVHSY3Yjs.JsonApiPut; exports.ModuleRegistrar = _chunkI2REI7OAjs.ModuleRegistrar; exports.ModuleRegistry = _chunkI2REI7OAjs.ModuleRegistry; exports.Modules = _chunkI2REI7OAjs.Modules; exports.RehydrationFactory = _chunkJ4Q36PMPjs.RehydrationFactory; exports.checkPermissions = _chunk6GKHCVF6js.checkPermissions; exports.checkPermissionsFromServer = _chunk6GKHCVF6js.checkPermissionsFromServer; exports.configureI18n = _chunkCXQOWQSYjs.configureI18n; exports.configureJsonApi = _chunkTMVHSY3Yjs.configureJsonApi; exports.configureRoles = _chunk4HCRAOS5js.configureRoles; exports.createJsonApiInclusion = _chunkI2REI7OAjs.createJsonApiInclusion; exports.getGlobalErrorHandler = _chunkI2REI7OAjs.getGlobalErrorHandler; exports.getRoleId = _chunk4HCRAOS5js.getRoleId; exports.getValueFromPath = _chunk6GKHCVF6js.getValueFromPath; exports.isRolesConfigured = _chunk4HCRAOS5js.isRolesConfigured; exports.rehydrate = _chunkI2REI7OAjs.rehydrate; exports.rehydrateList = _chunkI2REI7OAjs.rehydrateList; exports.setGlobalErrorHandler = _chunkI2REI7OAjs.setGlobalErrorHandler; exports.translateData = _chunkTEGF6ZWGjs.translateData; exports.translateResponse = _chunkTEGF6ZWGjs.translateResponse;
82
+
83
+
84
+
85
+
86
+ exports.AbstractApiData = _chunkHMHGLXWCjs.AbstractApiData; exports.AbstractService = _chunkHMHGLXWCjs.AbstractService; exports.Action = _chunk6GKHCVF6js.Action; exports.DataClass = _chunkAGAJMJ4Tjs.DataClassRegistry; exports.DataClassRegistry = _chunkAGAJMJ4Tjs.DataClassRegistry; exports.EndpointCreator = _chunkHMHGLXWCjs.EndpointCreator; exports.HttpMethod = _chunkHMHGLXWCjs.HttpMethod; exports.JsonApiDataFactory = _chunkAGAJMJ4Tjs.JsonApiDataFactory; exports.JsonApiDelete = _chunk5ZEADNNPjs.JsonApiDelete; exports.JsonApiGet = _chunk5ZEADNNPjs.JsonApiGet; exports.JsonApiPatch = _chunk5ZEADNNPjs.JsonApiPatch; exports.JsonApiPost = _chunk5ZEADNNPjs.JsonApiPost; exports.JsonApiPut = _chunk5ZEADNNPjs.JsonApiPut; exports.ModuleRegistrar = _chunkHMHGLXWCjs.ModuleRegistrar; exports.ModuleRegistry = _chunkHMHGLXWCjs.ModuleRegistry; exports.Modules = _chunkHMHGLXWCjs.Modules; exports.RehydrationFactory = _chunkHMHGLXWCjs.RehydrationFactory; exports.checkPermissions = _chunk6GKHCVF6js.checkPermissions; exports.checkPermissionsFromServer = _chunk6GKHCVF6js.checkPermissionsFromServer; exports.configureAuth = _chunkAYHKQWHHjs.configureAuth; exports.configureI18n = _chunkAYHKQWHHjs.configureI18n; exports.configureJsonApi = _chunk5ZEADNNPjs.configureJsonApi; exports.configureRoles = _chunk4HCRAOS5js.configureRoles; exports.createJsonApiInclusion = _chunkHMHGLXWCjs.createJsonApiInclusion; exports.getAppUrl = _chunk5ZEADNNPjs.getAppUrl; exports.getGlobalErrorHandler = _chunkHMHGLXWCjs.getGlobalErrorHandler; exports.getRoleId = _chunk4HCRAOS5js.getRoleId; exports.getTokenHandler = _chunkAYHKQWHHjs.getTokenHandler; exports.getTrackablePages = _chunk5ZEADNNPjs.getTrackablePages; exports.getValueFromPath = _chunk6GKHCVF6js.getValueFromPath; exports.isRolesConfigured = _chunk4HCRAOS5js.isRolesConfigured; exports.rehydrate = _chunkHMHGLXWCjs.rehydrate; exports.rehydrateList = _chunkHMHGLXWCjs.rehydrateList; exports.setGlobalErrorHandler = _chunkHMHGLXWCjs.setGlobalErrorHandler; exports.translateData = _chunkAGAJMJ4Tjs.translateData; exports.translateResponse = _chunkAGAJMJ4Tjs.translateResponse;
84
87
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/runner/work/nextjs-jsonapi/nextjs-jsonapi/dist/index.js"],"names":[],"mappings":"AAAA,wGAA4B;AAC5B;AACE;AACA;AACA;AACA;AACA;AACA;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACE;AACA;AACA;AACA;AACF,sDAA4B;AAC5B;AACE;AACA;AACA;AACF,sDAA4B;AAC5B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,sDAA4B;AAC5B;AACE;AACA;AACA;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B,+BAA4B;AAC5B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,21DAAC","file":"/home/runner/work/nextjs-jsonapi/nextjs-jsonapi/dist/index.js"}
1
+ {"version":3,"sources":["/home/runner/work/nextjs-jsonapi/nextjs-jsonapi/dist/index.js"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACF,sDAA4B;AAC5B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,sDAA4B;AAC5B;AACE;AACA;AACA;AACF,sDAA4B;AAC5B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,sDAA4B;AAC5B;AACE;AACA;AACA;AACA;AACF,sDAA4B;AAC5B;AACE;AACA;AACA;AACA;AACF,sDAA4B;AAC5B,+BAA4B;AAC5B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,+jEAAC","file":"/home/runner/work/nextjs-jsonapi/nextjs-jsonapi/dist/index.js"}
package/dist/index.mjs CHANGED
@@ -1,21 +1,18 @@
1
- import "./chunk-DKKMWBP4.mjs";
1
+ import {
2
+ configureAuth,
3
+ configureI18n,
4
+ getTokenHandler
5
+ } from "./chunk-SM63SZCP.mjs";
2
6
  import {
3
7
  JsonApiDelete,
4
8
  JsonApiGet,
5
9
  JsonApiPatch,
6
10
  JsonApiPost,
7
11
  JsonApiPut,
8
- configureJsonApi
9
- } from "./chunk-ECDTZBYO.mjs";
10
- import {
11
- configureI18n
12
- } from "./chunk-X4BIHJ2B.mjs";
13
- import {
14
- Action,
15
- checkPermissions,
16
- checkPermissionsFromServer,
17
- getValueFromPath
18
- } from "./chunk-DD3KISNB.mjs";
12
+ configureJsonApi,
13
+ getAppUrl,
14
+ getTrackablePages
15
+ } from "./chunk-74F6BBHH.mjs";
19
16
  import {
20
17
  configureRoles,
21
18
  getRoleId,
@@ -29,23 +26,25 @@ import {
29
26
  ModuleRegistrar,
30
27
  ModuleRegistry,
31
28
  Modules,
29
+ RehydrationFactory,
32
30
  createJsonApiInclusion,
33
31
  getGlobalErrorHandler,
34
32
  rehydrate,
35
33
  rehydrateList,
36
34
  setGlobalErrorHandler
37
- } from "./chunk-L6EQEAXU.mjs";
35
+ } from "./chunk-PYF2U6WG.mjs";
38
36
  import {
37
+ DataClassRegistry,
39
38
  JsonApiDataFactory,
40
39
  translateData,
41
40
  translateResponse
42
- } from "./chunk-YDVTFM7X.mjs";
41
+ } from "./chunk-RBIVEH2K.mjs";
43
42
  import {
44
- RehydrationFactory
45
- } from "./chunk-366S2JCC.mjs";
46
- import {
47
- DataClassRegistry
48
- } from "./chunk-MFO27OHB.mjs";
43
+ Action,
44
+ checkPermissions,
45
+ checkPermissionsFromServer,
46
+ getValueFromPath
47
+ } from "./chunk-DD3KISNB.mjs";
49
48
  import "./chunk-PAWJFY3S.mjs";
50
49
  export {
51
50
  AbstractApiData,
@@ -67,12 +66,16 @@ export {
67
66
  RehydrationFactory,
68
67
  checkPermissions,
69
68
  checkPermissionsFromServer,
69
+ configureAuth,
70
70
  configureI18n,
71
71
  configureJsonApi,
72
72
  configureRoles,
73
73
  createJsonApiInclusion,
74
+ getAppUrl,
74
75
  getGlobalErrorHandler,
75
76
  getRoleId,
77
+ getTokenHandler,
78
+ getTrackablePages,
76
79
  getValueFromPath,
77
80
  isRolesConfigured,
78
81
  rehydrate,
@@ -1,3 +1,4 @@
1
1
  export { B as BreadcrumbItemData } from '../breadcrumb.item.data.interface-CgB4_1EE.mjs';
2
- export { D as D3Link, a as D3Node } from '../d3.link.interface-QMdB22bC.mjs';
2
+ export { D as D3Link, a as D3Node } from '../d3.link.interface-ClC4Irqp.mjs';
3
+ import 'd3';
3
4
  import 'lucide-react';
@@ -1,3 +1,4 @@
1
1
  export { B as BreadcrumbItemData } from '../breadcrumb.item.data.interface-CgB4_1EE.js';
2
- export { D as D3Link, a as D3Node } from '../d3.link.interface-QMdB22bC.js';
2
+ export { D as D3Link, a as D3Node } from '../d3.link.interface-ClC4Irqp.js';
3
+ import 'd3';
3
4
  import 'lucide-react';
@@ -0,0 +1,14 @@
1
+ import { A as ApiDataInterface } from './ApiDataInterface-DPP8s46n.mjs';
2
+ import { U as UserInterface } from './user.interface-CAsTIbuQ.mjs';
3
+
4
+ type NotificationInput = {
5
+ id: string;
6
+ isRead: boolean;
7
+ };
8
+ interface NotificationInterface extends ApiDataInterface {
9
+ get notificationType(): string;
10
+ get isRead(): boolean;
11
+ get actor(): UserInterface | undefined;
12
+ }
13
+
14
+ export type { NotificationInterface as N, NotificationInput as a };
@@ -0,0 +1,14 @@
1
+ import { A as ApiDataInterface } from './ApiDataInterface-DPP8s46n.js';
2
+ import { U as UserInterface } from './user.interface-CbWqMaaU.js';
3
+
4
+ type NotificationInput = {
5
+ id: string;
6
+ isRead: boolean;
7
+ };
8
+ interface NotificationInterface extends ApiDataInterface {
9
+ get notificationType(): string;
10
+ get isRead(): boolean;
11
+ get actor(): UserInterface | undefined;
12
+ }
13
+
14
+ export type { NotificationInterface as N, NotificationInput as a };
@@ -1,6 +1,5 @@
1
- import { e as PermissionUser, f as ModuleWithPermissions, A as Action, d as PermissionModule } from '../types-lQVA8d_P.mjs';
2
- export { b as ModuleDefinition, g as ModuleFactory, M as ModulePermissionDefinition, a as PageUrl, P as PermissionCheck, c as PermissionConfig } from '../types-lQVA8d_P.mjs';
3
- import '../ApiRequestDataTypeInterface-CUKFDBx2.mjs';
1
+ import { h as PermissionUser, M as ModuleWithPermissions, a as Action, g as PermissionModule } from '../types-Bl61ob-7.mjs';
2
+ export { e as ModuleDefinition, i as ModuleFactory, d as ModulePermissionDefinition, b as PageUrl, P as PermissionCheck, f as PermissionConfig } from '../types-Bl61ob-7.mjs';
4
3
 
5
4
  /**
6
5
  * Check if a user has permission to perform an action on a module.
@@ -1,6 +1,5 @@
1
- import { e as PermissionUser, f as ModuleWithPermissions, A as Action, d as PermissionModule } from '../types-DluCaP1I.js';
2
- export { b as ModuleDefinition, g as ModuleFactory, M as ModulePermissionDefinition, a as PageUrl, P as PermissionCheck, c as PermissionConfig } from '../types-DluCaP1I.js';
3
- import '../ApiRequestDataTypeInterface-CUKFDBx2.js';
1
+ import { h as PermissionUser, M as ModuleWithPermissions, a as Action, g as PermissionModule } from '../types-Bl61ob-7.js';
2
+ export { e as ModuleDefinition, i as ModuleFactory, d as ModulePermissionDefinition, b as PageUrl, P as PermissionCheck, f as PermissionConfig } from '../types-Bl61ob-7.js';
4
3
 
5
4
  /**
6
5
  * Check if a user has permission to perform an action on a module.
@@ -1,4 +1,22 @@
1
1
  import { A as ApiData } from '../ApiData-DPKNfY-9.mjs';
2
+ import { M as ModuleWithPermissions, a as Action } from '../types-Bl61ob-7.mjs';
3
+
4
+ type CacheProfile = "seconds" | "minutes" | "hours" | "days" | "weeks" | "max" | "default";
5
+ /**
6
+ * Revalidate a cache tag to invalidate cached data.
7
+ * Next.js 16+ requires a profile parameter.
8
+ *
9
+ * @param tag - The cache tag to invalidate
10
+ * @param profile - The cache profile (defaults to "max" for immediate invalidation)
11
+ */
12
+ declare function invalidateCacheTag(tag: string, profile?: CacheProfile): Promise<void>;
13
+ /**
14
+ * Revalidate multiple cache tags.
15
+ *
16
+ * @param tags - Array of cache tags to invalidate
17
+ * @param profile - The cache profile (defaults to "max" for immediate invalidation)
18
+ */
19
+ declare function invalidateCacheTags(tags: string[], profile?: CacheProfile): Promise<void>;
2
20
 
3
21
  interface ServerRequestParams {
4
22
  method: string;
@@ -19,26 +37,28 @@ interface ServerRequestParams {
19
37
  */
20
38
  declare function serverRequest(params: ServerRequestParams): Promise<ApiData>;
21
39
 
40
+ declare class ServerSession {
41
+ static isLogged(): Promise<boolean>;
42
+ static isLicenseActive(): Promise<boolean>;
43
+ static companyId(): Promise<string>;
44
+ static userId(): Promise<string>;
45
+ static checkPermission<M extends ModuleWithPermissions>(params: {
46
+ module: M;
47
+ action: Action;
48
+ data?: any;
49
+ }): Promise<void>;
50
+ static hasRole(roleId: string): Promise<boolean>;
51
+ static hasFeature(featureId: string): Promise<boolean>;
52
+ static hasPermissionToModule<M extends ModuleWithPermissions>(params: {
53
+ module: M;
54
+ action: Action;
55
+ data?: any;
56
+ }): Promise<boolean>;
57
+ }
58
+
22
59
  /**
23
60
  * Get the authentication token from cookies (server-side)
24
61
  */
25
62
  declare function getServerToken(): Promise<string | undefined>;
26
63
 
27
- type CacheProfile = "seconds" | "minutes" | "hours" | "days" | "weeks" | "max" | "default";
28
- /**
29
- * Revalidate a cache tag to invalidate cached data.
30
- * Next.js 16+ requires a profile parameter.
31
- *
32
- * @param tag - The cache tag to invalidate
33
- * @param profile - The cache profile (defaults to "max" for immediate invalidation)
34
- */
35
- declare function invalidateCacheTag(tag: string, profile?: CacheProfile): Promise<void>;
36
- /**
37
- * Revalidate multiple cache tags.
38
- *
39
- * @param tags - Array of cache tags to invalidate
40
- * @param profile - The cache profile (defaults to "max" for immediate invalidation)
41
- */
42
- declare function invalidateCacheTags(tags: string[], profile?: CacheProfile): Promise<void>;
43
-
44
- export { type CacheProfile, type ServerRequestParams, getServerToken, invalidateCacheTag, invalidateCacheTags, serverRequest };
64
+ export { type CacheProfile, type ServerRequestParams, ServerSession, getServerToken, invalidateCacheTag, invalidateCacheTags, serverRequest };
@@ -1,4 +1,22 @@
1
1
  import { A as ApiData } from '../ApiData-DPKNfY-9.js';
2
+ import { M as ModuleWithPermissions, a as Action } from '../types-Bl61ob-7.js';
3
+
4
+ type CacheProfile = "seconds" | "minutes" | "hours" | "days" | "weeks" | "max" | "default";
5
+ /**
6
+ * Revalidate a cache tag to invalidate cached data.
7
+ * Next.js 16+ requires a profile parameter.
8
+ *
9
+ * @param tag - The cache tag to invalidate
10
+ * @param profile - The cache profile (defaults to "max" for immediate invalidation)
11
+ */
12
+ declare function invalidateCacheTag(tag: string, profile?: CacheProfile): Promise<void>;
13
+ /**
14
+ * Revalidate multiple cache tags.
15
+ *
16
+ * @param tags - Array of cache tags to invalidate
17
+ * @param profile - The cache profile (defaults to "max" for immediate invalidation)
18
+ */
19
+ declare function invalidateCacheTags(tags: string[], profile?: CacheProfile): Promise<void>;
2
20
 
3
21
  interface ServerRequestParams {
4
22
  method: string;
@@ -19,26 +37,28 @@ interface ServerRequestParams {
19
37
  */
20
38
  declare function serverRequest(params: ServerRequestParams): Promise<ApiData>;
21
39
 
40
+ declare class ServerSession {
41
+ static isLogged(): Promise<boolean>;
42
+ static isLicenseActive(): Promise<boolean>;
43
+ static companyId(): Promise<string>;
44
+ static userId(): Promise<string>;
45
+ static checkPermission<M extends ModuleWithPermissions>(params: {
46
+ module: M;
47
+ action: Action;
48
+ data?: any;
49
+ }): Promise<void>;
50
+ static hasRole(roleId: string): Promise<boolean>;
51
+ static hasFeature(featureId: string): Promise<boolean>;
52
+ static hasPermissionToModule<M extends ModuleWithPermissions>(params: {
53
+ module: M;
54
+ action: Action;
55
+ data?: any;
56
+ }): Promise<boolean>;
57
+ }
58
+
22
59
  /**
23
60
  * Get the authentication token from cookies (server-side)
24
61
  */
25
62
  declare function getServerToken(): Promise<string | undefined>;
26
63
 
27
- type CacheProfile = "seconds" | "minutes" | "hours" | "days" | "weeks" | "max" | "default";
28
- /**
29
- * Revalidate a cache tag to invalidate cached data.
30
- * Next.js 16+ requires a profile parameter.
31
- *
32
- * @param tag - The cache tag to invalidate
33
- * @param profile - The cache profile (defaults to "max" for immediate invalidation)
34
- */
35
- declare function invalidateCacheTag(tag: string, profile?: CacheProfile): Promise<void>;
36
- /**
37
- * Revalidate multiple cache tags.
38
- *
39
- * @param tags - Array of cache tags to invalidate
40
- * @param profile - The cache profile (defaults to "max" for immediate invalidation)
41
- */
42
- declare function invalidateCacheTags(tags: string[], profile?: CacheProfile): Promise<void>;
43
-
44
- export { type CacheProfile, type ServerRequestParams, getServerToken, invalidateCacheTag, invalidateCacheTags, serverRequest };
64
+ export { type CacheProfile, type ServerRequestParams, ServerSession, getServerToken, invalidateCacheTag, invalidateCacheTags, serverRequest };
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
3
  var _chunk2K3Q24UFjs = require('../chunk-2K3Q24UF.js');
4
4
 
@@ -6,6 +6,9 @@ var _chunk2K3Q24UFjs = require('../chunk-2K3Q24UF.js');
6
6
  var _chunkEFJEWLRLjs = require('../chunk-EFJEWLRL.js');
7
7
 
8
8
 
9
+ var _chunk6GKHCVF6js = require('../chunk-6GKHCVF6.js');
10
+
11
+
9
12
  var _chunk7QVYU63Ejs = require('../chunk-7QVYU63E.js');
10
13
 
11
14
  // src/server/cache.ts
@@ -21,9 +24,74 @@ async function invalidateCacheTags(tags, profile = "max") {
21
24
  }
22
25
  _chunk7QVYU63Ejs.__name.call(void 0, invalidateCacheTags, "invalidateCacheTags");
23
26
 
27
+ // src/server/ServerSession.ts
28
+ var _headers = require('next/headers');
29
+ var _navigation = require('next/navigation');
30
+ var _zlib = require('zlib'); var _zlib2 = _interopRequireDefault(_zlib);
31
+ var ServerSession = class {
32
+ static {
33
+ _chunk7QVYU63Ejs.__name.call(void 0, this, "ServerSession");
34
+ }
35
+ static async isLogged() {
36
+ const cookieStore = await _headers.cookies.call(void 0, );
37
+ const token = cookieStore.get("token");
38
+ if (!token || !token.value) return false;
39
+ return true;
40
+ }
41
+ static async isLicenseActive() {
42
+ const cookieStore = await _headers.cookies.call(void 0, );
43
+ const licenseExpirationDate = _optionalChain([cookieStore, 'access', _ => _.get, 'call', _2 => _2("licenseExpirationDate"), 'optionalAccess', _3 => _3.value]);
44
+ if (!licenseExpirationDate) return false;
45
+ const now = /* @__PURE__ */ new Date();
46
+ return new Date(licenseExpirationDate) > now;
47
+ }
48
+ static async companyId() {
49
+ const cookieStore = await _headers.cookies.call(void 0, );
50
+ return _nullishCoalesce(_optionalChain([cookieStore, 'access', _4 => _4.get, 'call', _5 => _5("companyId"), 'optionalAccess', _6 => _6.value]), () => ( ""));
51
+ }
52
+ static async userId() {
53
+ const cookieStore = await _headers.cookies.call(void 0, );
54
+ return _nullishCoalesce(_optionalChain([cookieStore, 'access', _7 => _7.get, 'call', _8 => _8("userId"), 'optionalAccess', _9 => _9.value]), () => ( ""));
55
+ }
56
+ static async checkPermission(params) {
57
+ if (!await this.hasPermissionToModule(params)) _navigation.redirect.call(void 0, `/401`);
58
+ }
59
+ static async hasRole(roleId) {
60
+ const cookieStore = await _headers.cookies.call(void 0, );
61
+ const roles = _optionalChain([cookieStore, 'access', _10 => _10.get, 'call', _11 => _11("roles"), 'optionalAccess', _12 => _12.value]);
62
+ if (!roles || !roles.includes(roleId)) return false;
63
+ return true;
64
+ }
65
+ static async hasFeature(featureId) {
66
+ const cookieStore = await _headers.cookies.call(void 0, );
67
+ const features = _optionalChain([cookieStore, 'access', _13 => _13.get, 'call', _14 => _14("features"), 'optionalAccess', _15 => _15.value]);
68
+ if (!features || !features.includes(featureId)) return false;
69
+ return true;
70
+ }
71
+ static async hasPermissionToModule(params) {
72
+ const cookieStore = await _headers.cookies.call(void 0, );
73
+ if (params.module.feature) {
74
+ const features = _optionalChain([cookieStore, 'access', _16 => _16.get, 'call', _17 => _17("features"), 'optionalAccess', _18 => _18.value]);
75
+ if (features && !features.includes(params.module.feature)) return false;
76
+ }
77
+ const rawModules = _optionalChain([cookieStore, 'access', _19 => _19.get, 'call', _20 => _20("modules"), 'optionalAccess', _21 => _21.value]);
78
+ if (!rawModules) return false;
79
+ const modules = JSON.parse(_zlib2.default.gunzipSync(Buffer.from(rawModules, "base64")).toString());
80
+ const selectedModule = modules.find((module) => module.id === params.module.moduleId);
81
+ return _chunk6GKHCVF6js.checkPermissionsFromServer.call(void 0, {
82
+ module: params.module,
83
+ action: params.action,
84
+ data: params.data,
85
+ userId: await this.userId(),
86
+ selectedModule
87
+ });
88
+ }
89
+ };
90
+
91
+
24
92
 
25
93
 
26
94
 
27
95
 
28
- exports.getServerToken = _chunkEFJEWLRLjs.getServerToken; exports.invalidateCacheTag = invalidateCacheTag; exports.invalidateCacheTags = invalidateCacheTags; exports.serverRequest = _chunk2K3Q24UFjs.serverRequest;
96
+ exports.ServerSession = ServerSession; exports.getServerToken = _chunkEFJEWLRLjs.getServerToken; exports.invalidateCacheTag = invalidateCacheTag; exports.invalidateCacheTags = invalidateCacheTags; exports.serverRequest = _chunk2K3Q24UFjs.serverRequest;
29
97
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/runner/work/nextjs-jsonapi/nextjs-jsonapi/dist/server/index.js","../../src/server/cache.ts"],"names":[],"mappings":"AAAA;AACE;AACF,uDAA6B;AAC7B;AACE;AACF,uDAA6B;AAC7B;AACE;AACF,uDAA6B;AAC7B;AACA;ACRA,mCAA8B;AAW9B,MAAA,SAAsB,kBAAA,CAAmB,GAAA,EAAa,QAAA,EAAwB,KAAA,EAAsB;AAClG,EAAA,kCAAA,GAAc,EAAK,OAAO,CAAA;AAC5B;AAFsB,qCAAA,kBAAA,EAAA,oBAAA,CAAA;AAUtB,MAAA,SAAsB,mBAAA,CAAoB,IAAA,EAAgB,QAAA,EAAwB,KAAA,EAAsB;AACtG,EAAA,IAAA,CAAA,MAAW,IAAA,GAAO,IAAA,EAAM;AACtB,IAAA,kCAAA,GAAc,EAAK,OAAO,CAAA;AAAA,EAC5B;AACF;AAJsB,qCAAA,mBAAA,EAAA,qBAAA,CAAA;ADDtB;AACE;AACA;AACA;AACA;AACF,qNAAC","file":"/home/runner/work/nextjs-jsonapi/nextjs-jsonapi/dist/server/index.js","sourcesContent":[null,"\"use server\";\n\nimport { revalidateTag } from \"next/cache\";\n\nexport type CacheProfile = \"seconds\" | \"minutes\" | \"hours\" | \"days\" | \"weeks\" | \"max\" | \"default\";\n\n/**\n * Revalidate a cache tag to invalidate cached data.\n * Next.js 16+ requires a profile parameter.\n *\n * @param tag - The cache tag to invalidate\n * @param profile - The cache profile (defaults to \"max\" for immediate invalidation)\n */\nexport async function invalidateCacheTag(tag: string, profile: CacheProfile = \"max\"): Promise<void> {\n revalidateTag(tag, profile);\n}\n\n/**\n * Revalidate multiple cache tags.\n *\n * @param tags - Array of cache tags to invalidate\n * @param profile - The cache profile (defaults to \"max\" for immediate invalidation)\n */\nexport async function invalidateCacheTags(tags: string[], profile: CacheProfile = \"max\"): Promise<void> {\n for (const tag of tags) {\n revalidateTag(tag, profile);\n }\n}\n"]}
1
+ {"version":3,"sources":["/home/runner/work/nextjs-jsonapi/nextjs-jsonapi/dist/server/index.js","../../src/server/cache.ts","../../src/server/ServerSession.ts"],"names":[],"mappings":"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","file":"/home/runner/work/nextjs-jsonapi/nextjs-jsonapi/dist/server/index.js","sourcesContent":[null,"\"use server\";\n\nimport { revalidateTag } from \"next/cache\";\n\nexport type CacheProfile = \"seconds\" | \"minutes\" | \"hours\" | \"days\" | \"weeks\" | \"max\" | \"default\";\n\n/**\n * Revalidate a cache tag to invalidate cached data.\n * Next.js 16+ requires a profile parameter.\n *\n * @param tag - The cache tag to invalidate\n * @param profile - The cache profile (defaults to \"max\" for immediate invalidation)\n */\nexport async function invalidateCacheTag(tag: string, profile: CacheProfile = \"max\"): Promise<void> {\n revalidateTag(tag, profile);\n}\n\n/**\n * Revalidate multiple cache tags.\n *\n * @param tags - Array of cache tags to invalidate\n * @param profile - The cache profile (defaults to \"max\" for immediate invalidation)\n */\nexport async function invalidateCacheTags(tags: string[], profile: CacheProfile = \"max\"): Promise<void> {\n for (const tag of tags) {\n revalidateTag(tag, profile);\n }\n}\n","import { cookies } from \"next/headers\";\nimport { redirect } from \"next/navigation\";\nimport zlib from \"zlib\";\nimport { Action, checkPermissionsFromServer, ModuleWithPermissions } from \"../permissions\";\n\nexport class ServerSession {\n static async isLogged() {\n const cookieStore = await cookies();\n const token = cookieStore.get(\"token\");\n\n if (!token || !token.value) return false;\n return true;\n }\n\n static async isLicenseActive(): Promise<boolean> {\n const cookieStore = await cookies();\n const licenseExpirationDate = cookieStore.get(\"licenseExpirationDate\")?.value;\n\n if (!licenseExpirationDate) return false;\n\n const now = new Date();\n return new Date(licenseExpirationDate) > now;\n }\n\n static async companyId() {\n const cookieStore = await cookies();\n return cookieStore.get(\"companyId\")?.value ?? \"\";\n }\n\n static async userId() {\n const cookieStore = await cookies();\n return cookieStore.get(\"userId\")?.value ?? \"\";\n }\n\n static async checkPermission<M extends ModuleWithPermissions>(params: { module: M; action: Action; data?: any }) {\n if (!(await this.hasPermissionToModule(params))) redirect(`/401`);\n }\n\n static async hasRole(roleId: string): Promise<boolean> {\n const cookieStore = await cookies();\n const roles = cookieStore.get(\"roles\")?.value;\n\n if (!roles || !roles.includes(roleId)) return false;\n\n return true;\n }\n\n static async hasFeature(featureId: string): Promise<boolean> {\n const cookieStore = await cookies();\n const features = cookieStore.get(\"features\")?.value;\n\n if (!features || !features.includes(featureId)) return false;\n\n return true;\n }\n\n static async hasPermissionToModule<M extends ModuleWithPermissions>(params: {\n module: M;\n action: Action;\n data?: any;\n }): Promise<boolean> {\n const cookieStore = await cookies();\n\n if (params.module.feature) {\n const features = cookieStore.get(\"features\")?.value;\n\n if (features && !features.includes(params.module.feature)) return false;\n }\n\n const rawModules = cookieStore.get(\"modules\")?.value;\n if (!rawModules) return false;\n\n const modules: {\n id: string;\n permissions: {\n create: boolean | string;\n read: boolean | string;\n update: boolean | string;\n delete: boolean | string;\n };\n }[] = JSON.parse(zlib.gunzipSync(Buffer.from(rawModules, \"base64\")).toString());\n\n const selectedModule = modules.find((module) => module.id === params.module.moduleId);\n\n return checkPermissionsFromServer({\n module: params.module,\n action: params.action,\n data: params.data,\n userId: await this.userId(),\n selectedModule: selectedModule,\n });\n\n // if (!selectedModule) return false;\n\n // if (!selectedModule.permissions[params.action]) return false;\n // if (typeof selectedModule.permissions[params.action] === \"boolean\")\n // return selectedModule.permissions[params.action] as boolean;\n\n // if (!params.data) return false;\n\n // return params.data[selectedModule.permissions[params.action] as string] === this.userId;\n }\n}\n"]}