@carlonicora/nextjs-jsonapi 1.0.3 → 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.
- package/dist/{AbstractService-BKlpJA61.d.mts → AbstractService-B2n_JdiC.d.mts} +1 -1
- package/dist/{AbstractService-D9eSVKNa.d.ts → AbstractService-DtQTYovo.d.ts} +1 -1
- package/dist/{content.interface-Dg2lt_An.d.mts → AuthComponent-CPLvEerw.d.mts} +11 -15
- package/dist/{content.interface-BhyAiOFq.d.ts → AuthComponent-m6Qp4Hz6.d.ts} +11 -15
- package/dist/{BlockNoteEditor-UVO3VZZE.mjs → BlockNoteEditor-BLVXQPXV.mjs} +14 -18
- package/dist/{BlockNoteEditor-UVO3VZZE.mjs.map → BlockNoteEditor-BLVXQPXV.mjs.map} +1 -1
- package/dist/{BlockNoteEditor-VFWG6LXI.js → BlockNoteEditor-ZTDHULFT.js} +15 -19
- package/dist/BlockNoteEditor-ZTDHULFT.js.map +1 -0
- package/dist/JsonApiRequest-O7BGUMFO.mjs +23 -0
- package/dist/JsonApiRequest-VARLNKAF.js +23 -0
- package/dist/JsonApiRequest-VARLNKAF.js.map +1 -0
- package/dist/chunk-2LM6LCJW.mjs +1 -0
- package/dist/chunk-3APORDYP.mjs +7783 -0
- package/dist/chunk-3APORDYP.mjs.map +1 -0
- package/dist/{chunk-TMVHSY3Y.js → chunk-5ZEADNNP.js} +36 -17
- package/dist/chunk-5ZEADNNP.js.map +1 -0
- package/dist/{chunk-ECDTZBYO.mjs → chunk-74F6BBHH.mjs} +21 -2
- package/dist/chunk-74F6BBHH.mjs.map +1 -0
- package/dist/{chunk-GYWPEPOH.mjs → chunk-7C5RAEBO.mjs} +72 -68
- package/dist/chunk-7C5RAEBO.mjs.map +1 -0
- package/dist/chunk-A5DDIABK.js +1 -0
- package/dist/{chunk-TEGF6ZWG.js → chunk-AGAJMJ4T.js} +47 -9
- package/dist/chunk-AGAJMJ4T.js.map +1 -0
- package/dist/{chunk-CXQOWQSY.js → chunk-AYHKQWHH.js} +15 -2
- package/dist/chunk-AYHKQWHH.js.map +1 -0
- package/dist/{chunk-I2REI7OA.js → chunk-HMHGLXWC.js} +33 -15
- package/dist/chunk-HMHGLXWC.js.map +1 -0
- package/dist/chunk-IWFGEPAA.mjs +1 -0
- package/dist/chunk-JC3WJK65.js +1 -0
- package/dist/{chunk-L6EQEAXU.mjs → chunk-PYF2U6WG.mjs} +25 -7
- package/dist/chunk-PYF2U6WG.mjs.map +1 -0
- package/dist/{chunk-YDVTFM7X.mjs → chunk-RBIVEH2K.mjs} +42 -4
- package/dist/chunk-RBIVEH2K.mjs.map +1 -0
- package/dist/{chunk-V2JJPI7N.js → chunk-RZO2LOW4.js} +237 -233
- package/dist/chunk-RZO2LOW4.js.map +1 -0
- package/dist/{chunk-X4BIHJ2B.mjs → chunk-SM63SZCP.mjs} +15 -2
- package/dist/chunk-SM63SZCP.mjs.map +1 -0
- package/dist/chunk-WEC4YMOS.js +7783 -0
- package/dist/chunk-WEC4YMOS.js.map +1 -0
- package/dist/client/index.d.mts +21 -2
- package/dist/client/index.d.ts +21 -2
- package/dist/client/index.js +18 -245
- package/dist/client/index.js.map +1 -1
- package/dist/client/index.mjs +28 -255
- package/dist/client/index.mjs.map +1 -1
- package/dist/components/index.d.mts +293 -8
- package/dist/components/index.d.ts +293 -8
- package/dist/components/index.js +78 -2323
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +172 -2417
- package/dist/components/index.mjs.map +1 -1
- package/dist/{config-hXufftVS.d.ts → config-BmnK65TD.d.mts} +1 -0
- package/dist/{config-hXufftVS.d.mts → config-BmnK65TD.d.ts} +1 -0
- package/dist/config-DQeAo9Kf.d.mts +49 -0
- package/dist/config-DQeAo9Kf.d.ts +49 -0
- package/dist/contexts/index.d.mts +109 -21
- package/dist/contexts/index.d.ts +109 -21
- package/dist/contexts/index.js +39 -7
- package/dist/contexts/index.js.map +1 -1
- package/dist/contexts/index.mjs +40 -8
- package/dist/core/index.d.mts +3 -4
- package/dist/core/index.d.ts +3 -4
- package/dist/core/index.js +3 -7
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.mjs +4 -8
- package/dist/{d3.link.interface-QMdB22bC.d.mts → d3.link.interface-ClC4Irqp.d.mts} +2 -1
- package/dist/{d3.link.interface-QMdB22bC.d.ts → d3.link.interface-ClC4Irqp.d.ts} +2 -1
- package/dist/features/index.d.mts +17 -86
- package/dist/features/index.d.ts +17 -86
- package/dist/features/index.js +7 -16
- package/dist/features/index.js.map +1 -1
- package/dist/features/index.mjs +10 -19
- package/dist/hooks/index.d.mts +18 -43
- package/dist/hooks/index.d.ts +18 -43
- package/dist/hooks/index.js +20 -7
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +19 -6
- package/dist/index.d.mts +10 -6
- package/dist/index.d.ts +10 -6
- package/dist/index.js +13 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +22 -19
- package/dist/interfaces/index.d.mts +2 -1
- package/dist/interfaces/index.d.ts +2 -1
- package/dist/notification.interface-BBgMUdLR.d.mts +14 -0
- package/dist/notification.interface-gyvT-Z2F.d.ts +14 -0
- package/dist/permissions/index.d.mts +2 -3
- package/dist/permissions/index.d.ts +2 -3
- package/dist/server/index.d.mts +38 -18
- package/dist/server/index.d.ts +38 -18
- package/dist/server/index.js +70 -2
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +68 -0
- package/dist/server/index.mjs.map +1 -1
- package/dist/types-BUAlgqqh.d.ts +39 -0
- package/dist/{types-DluCaP1I.d.ts → types-Bl61ob-7.d.mts} +19 -2
- package/dist/{types-lQVA8d_P.d.mts → types-Bl61ob-7.d.ts} +19 -2
- package/dist/types-iVdVY7ba.d.mts +39 -0
- package/dist/useSocket-Cn7fB_B1.d.mts +25 -0
- package/dist/useSocket-DzMKRKCA.d.ts +25 -0
- package/dist/user.fields-CbdObSmS.d.mts +18 -0
- package/dist/user.fields-CbdObSmS.d.ts +18 -0
- package/dist/utils/index.d.mts +1 -2
- package/dist/utils/index.d.ts +1 -2
- package/package.json +6 -3
- package/src/atoms/index.ts +1 -0
- package/src/atoms/recentPagesAtom.ts +10 -0
- package/src/client/context/JsonApiContext.ts +61 -0
- package/src/client/context/JsonApiProvider.tsx +27 -0
- package/src/client/context/index.ts +2 -0
- package/src/client/hooks/index.ts +3 -0
- package/src/client/hooks/useJsonApiGet.ts +188 -0
- package/src/client/hooks/useJsonApiMutation.ts +193 -0
- package/src/client/hooks/useRehydration.ts +47 -0
- package/src/client/index.ts +24 -0
- package/src/client/request.ts +97 -0
- package/src/client/token.ts +10 -0
- package/src/components/containers/PageContainer.tsx +15 -0
- package/src/components/containers/ReactMarkdownContainer.tsx +119 -0
- package/src/components/containers/TabsContainer.tsx +93 -0
- package/src/components/containers/index.ts +3 -0
- package/src/components/contents/AttributeElement.tsx +20 -0
- package/src/components/contents/index.ts +1 -0
- package/src/components/details/AllowedUsersDetails.tsx +23 -0
- package/src/components/details/index.ts +1 -0
- package/src/components/editors/BlockNoteDiffInlineContent.tsx +152 -0
- package/src/components/editors/BlockNoteEditor.tsx +404 -0
- package/src/components/editors/BlockNoteEditorContainer.tsx +13 -0
- package/src/components/editors/BlockNoteEditorFormattingToolbar.tsx +38 -0
- package/src/components/editors/index.ts +1 -0
- package/src/components/errors/ErrorDetails.tsx +41 -0
- package/src/components/errors/errorToast.ts +9 -0
- package/src/components/errors/index.ts +2 -0
- package/src/components/forms/CommonAssociationForm.tsx +162 -0
- package/src/components/forms/CommonDeleter.tsx +94 -0
- package/src/components/forms/CommonEditorButtons.tsx +30 -0
- package/src/components/forms/CommonEditorHeader.tsx +35 -0
- package/src/components/forms/CommonEditorTrigger.tsx +26 -0
- package/src/components/forms/DatePickerPopover.tsx +219 -0
- package/src/components/forms/DateRangeSelector.tsx +110 -0
- package/src/components/forms/FileUploader.tsx +324 -0
- package/src/components/forms/FormCheckbox.tsx +66 -0
- package/src/components/forms/FormContainerGeneric.tsx +39 -0
- package/src/components/forms/FormDate.tsx +247 -0
- package/src/components/forms/FormDateTime.tsx +231 -0
- package/src/components/forms/FormInput.tsx +110 -0
- package/src/components/forms/FormPassword.tsx +54 -0
- package/src/components/forms/FormPlaceAutocomplete.tsx +286 -0
- package/src/components/forms/FormSelect.tsx +72 -0
- package/src/components/forms/FormSlider.tsx +51 -0
- package/src/components/forms/FormSwitch.tsx +25 -0
- package/src/components/forms/FormTextarea.tsx +44 -0
- package/src/components/forms/MultiFileUploader.tsx +107 -0
- package/src/components/forms/PasswordInput.tsx +47 -0
- package/src/components/forms/index.ts +22 -0
- package/src/components/index.ts +16 -0
- package/src/components/navigations/Breadcrumb.tsx +83 -0
- package/src/components/navigations/ContentTitle.tsx +39 -0
- package/src/components/navigations/Header.tsx +27 -0
- package/src/components/navigations/ModeToggleSwitch.tsx +25 -0
- package/src/components/navigations/PageSection.tsx +64 -0
- package/src/components/navigations/RecentPagesNavigator.tsx +52 -0
- package/src/components/navigations/index.ts +6 -0
- package/src/components/pages/PageContainerContentDetails.tsx +76 -0
- package/src/components/pages/PageContentContainer.tsx +31 -0
- package/src/components/pages/index.ts +2 -0
- package/src/components/tables/ContentListTable.tsx +166 -0
- package/src/components/tables/ContentTableSearch.tsx +105 -0
- package/src/components/tables/cells/cell.component.tsx +18 -0
- package/src/components/tables/cells/cell.date.tsx +16 -0
- package/src/components/tables/cells/cell.id.tsx +27 -0
- package/src/components/tables/cells/cell.link.tsx +18 -0
- package/src/components/tables/cells/cell.text.tsx +12 -0
- package/src/components/tables/cells/cell.url.tsx +13 -0
- package/src/components/tables/cells/index.ts +5 -0
- package/src/components/tables/index.ts +3 -0
- package/src/contexts/CommonContext.tsx +52 -0
- package/src/contexts/SharedContext.tsx +37 -0
- package/src/contexts/SocketContext.tsx +65 -0
- package/src/contexts/index.ts +7 -0
- package/src/core/abstracts/AbstractApiData.ts +138 -0
- package/src/core/abstracts/AbstractService.ts +263 -0
- package/src/core/abstracts/index.ts +2 -0
- package/src/core/endpoint/EndpointCreator.ts +97 -0
- package/src/core/endpoint/index.ts +1 -0
- package/src/core/factories/JsonApiDataFactory.ts +12 -0
- package/src/core/factories/RehydrationFactory.ts +30 -0
- package/src/core/factories/index.ts +2 -0
- package/src/core/fields/FieldSelector.ts +15 -0
- package/src/core/fields/index.ts +1 -0
- package/src/core/index.ts +20 -0
- package/src/core/interfaces/ApiData.ts +8 -0
- package/src/core/interfaces/ApiDataInterface.ts +15 -0
- package/src/core/interfaces/ApiRequestDataTypeInterface.ts +14 -0
- package/src/core/interfaces/ApiResponseInterface.ts +17 -0
- package/src/core/interfaces/JsonApiHydratedDataInterface.ts +5 -0
- package/src/core/interfaces/index.ts +5 -0
- package/{dist/chunk-DO2HLAZO.js → src/core/registry/DataClassRegistry.ts} +20 -17
- package/src/core/registry/ModuleRegistrar.ts +43 -0
- package/src/core/registry/ModuleRegistry.ts +64 -0
- package/src/core/registry/index.ts +3 -0
- package/src/core/utils/index.ts +2 -0
- package/src/core/utils/rehydrate.ts +24 -0
- package/src/core/utils/translateResponse.ts +125 -0
- package/src/features/auth/auth.module.ts +9 -0
- package/src/features/auth/components/containers/AuthContainer.tsx +32 -0
- package/src/features/auth/components/containers/index.ts +1 -0
- package/src/features/auth/components/details/LandingComponent.tsx +39 -0
- package/src/features/auth/components/details/index.ts +1 -0
- package/src/features/auth/components/forms/AcceptInvitation.tsx +136 -0
- package/src/features/auth/components/forms/ActivateAccount.tsx +75 -0
- package/src/features/auth/components/forms/Cookies.tsx +32 -0
- package/src/features/auth/components/forms/ForgotPassword.tsx +108 -0
- package/src/features/auth/components/forms/Login.tsx +118 -0
- package/src/features/auth/components/forms/Logout.tsx +19 -0
- package/src/features/auth/components/forms/RefreshUser.tsx +39 -0
- package/src/features/auth/components/forms/Register.tsx +150 -0
- package/src/features/auth/components/forms/ResetPassword.tsx +126 -0
- package/src/features/auth/components/forms/index.ts +9 -0
- package/src/features/auth/components/index.ts +3 -0
- package/src/features/auth/config.ts +57 -0
- package/src/features/auth/contexts/AuthContext.tsx +77 -0
- package/src/features/auth/contexts/index.ts +1 -0
- package/src/features/auth/data/auth.interface.ts +31 -0
- package/src/features/auth/data/auth.service.ts +159 -0
- package/src/features/auth/data/auth.ts +54 -0
- package/src/features/auth/data/index.ts +3 -0
- package/src/features/auth/enums/AuthComponent.ts +9 -0
- package/src/features/auth/enums/index.ts +1 -0
- package/src/features/auth/index.ts +4 -0
- package/src/features/auth/utils/AuthCookies.ts +134 -0
- package/src/features/auth/utils/index.ts +1 -0
- package/src/features/company/company.module.ts +10 -0
- package/src/features/company/components/containers/AdminCompanyContainer.tsx +26 -0
- package/src/features/company/components/containers/CompanyContainer.tsx +17 -0
- package/src/features/company/components/containers/index.ts +2 -0
- package/src/features/company/components/details/CompanyDetails.tsx +26 -0
- package/src/features/company/components/details/index.ts +1 -0
- package/src/features/company/components/forms/CompanyConfigurationEditor.tsx +151 -0
- package/src/features/company/components/forms/CompanyConfigurationSecurityForm.tsx +97 -0
- package/src/features/company/components/forms/CompanyDeleter.tsx +121 -0
- package/src/features/company/components/forms/CompanyEditor.tsx +245 -0
- package/src/features/company/components/forms/CompanyLicense.tsx +213 -0
- package/src/features/company/components/forms/index.ts +5 -0
- package/src/features/company/components/index.ts +4 -0
- package/src/features/company/components/lists/CompaniesList.tsx +31 -0
- package/src/features/company/components/lists/index.ts +1 -0
- package/src/features/company/contexts/CompanyContext.tsx +99 -0
- package/src/features/company/contexts/index.ts +0 -0
- package/src/features/company/data/company.fields.ts +6 -0
- package/src/features/company/data/company.interface.ts +28 -0
- package/src/features/company/data/company.service.ts +73 -0
- package/src/features/company/data/company.ts +104 -0
- package/src/features/company/data/index.ts +4 -0
- package/src/features/company/hooks/index.ts +1 -0
- package/src/features/company/hooks/useCompanyTableStructure.tsx +82 -0
- package/src/features/company/index.ts +2 -0
- package/src/features/content/content.module.ts +20 -0
- package/src/features/content/data/content.fields.ts +13 -0
- package/src/features/content/data/content.interface.ts +23 -0
- package/src/features/content/data/content.service.ts +75 -0
- package/src/features/content/data/content.ts +85 -0
- package/src/features/content/data/index.ts +4 -0
- package/src/features/content/index.ts +2 -0
- package/src/features/feature/components/forms/FormFeatures.tsx +150 -0
- package/src/features/feature/components/forms/index.ts +1 -0
- package/src/features/feature/components/index.ts +1 -0
- package/src/features/feature/data/feature.interface.ts +9 -0
- package/src/features/feature/data/feature.service.ts +19 -0
- package/src/features/feature/data/feature.ts +33 -0
- package/src/features/feature/data/index.ts +3 -0
- package/src/features/feature/feature.module.ts +10 -0
- package/src/features/feature/index.ts +2 -0
- package/src/features/index.ts +12 -0
- package/src/features/module/data/index.ts +2 -0
- package/src/features/module/data/module.interface.ts +12 -0
- package/src/features/module/data/module.ts +42 -0
- package/src/features/module/index.ts +2 -0
- package/src/features/module/module.module.ts +10 -0
- package/src/features/notification/components/common/NotificationErrorBoundary.tsx +51 -0
- package/src/features/notification/components/common/index.ts +1 -0
- package/src/features/notification/components/containers/NotificationsListContainer.tsx +44 -0
- package/src/features/notification/components/containers/index.ts +1 -0
- package/src/features/notification/components/index.ts +5 -0
- package/src/features/notification/components/lists/NotificationsList.tsx +129 -0
- package/src/features/notification/components/lists/index.ts +1 -0
- package/src/features/notification/components/modals/NotificationModal.tsx +220 -0
- package/src/features/notification/components/modals/index.ts +1 -0
- package/src/features/notification/components/notifications/Notification.tsx +120 -0
- package/src/features/notification/components/notifications/PushNotificationProvider.tsx +9 -0
- package/src/features/notification/components/notifications/index.ts +2 -0
- package/src/features/notification/contexts/NotificationContext.tsx +187 -0
- package/src/features/notification/contexts/index.ts +1 -0
- package/src/features/notification/data/index.ts +4 -0
- package/src/features/notification/data/notification.fields.ts +8 -0
- package/src/features/notification/data/notification.interface.ts +14 -0
- package/src/features/notification/data/notification.service.ts +34 -0
- package/src/features/notification/data/notification.ts +51 -0
- package/src/features/notification/index.ts +2 -0
- package/src/features/notification/notification.module.ts +10 -0
- package/src/features/push/data/index.ts +3 -0
- package/src/features/push/data/push.interface.ts +8 -0
- package/src/features/push/data/push.service.ts +17 -0
- package/src/features/push/data/push.ts +18 -0
- package/src/features/push/index.ts +2 -0
- package/src/features/push/push.module.ts +10 -0
- package/src/features/role/components/containers/RoleContainer.tsx +18 -0
- package/src/features/role/components/containers/index.ts +1 -0
- package/src/features/role/components/details/RoleDetails.tsx +21 -0
- package/src/features/role/components/details/index.ts +1 -0
- package/src/features/role/components/forms/FormRoles.tsx +82 -0
- package/src/features/role/components/forms/RemoveUserFromRole.tsx +108 -0
- package/src/features/role/components/forms/UserRoleAdd.tsx +128 -0
- package/src/features/role/components/forms/index.ts +3 -0
- package/src/features/role/components/index.ts +4 -0
- package/src/features/role/components/lists/RolesList.tsx +27 -0
- package/src/features/role/components/lists/UserRolesList.tsx +31 -0
- package/src/features/role/components/lists/index.ts +2 -0
- package/src/features/role/contexts/RoleContext.tsx +84 -0
- package/src/features/role/contexts/index.ts +1 -0
- package/src/features/role/data/index.ts +4 -0
- package/src/features/role/data/role.fields.ts +8 -0
- package/src/features/role/data/role.interface.ts +16 -0
- package/src/features/role/data/role.service.ts +117 -0
- package/src/features/role/data/role.ts +62 -0
- package/src/features/role/hooks/index.ts +1 -0
- package/src/features/role/hooks/useRoleTableStructure.tsx +72 -0
- package/src/features/role/index.ts +2 -0
- package/src/features/role/role.module.ts +10 -0
- package/src/features/s3/data/index.ts +3 -0
- package/src/features/s3/data/s3.interface.ts +11 -0
- package/src/features/s3/data/s3.service.ts +30 -0
- package/src/features/s3/data/s3.ts +60 -0
- package/src/features/s3/index.ts +2 -0
- package/src/features/s3/s3.module.ts +10 -0
- package/src/features/search/index.ts +1 -0
- package/src/features/search/interfaces/index.ts +1 -0
- package/src/features/search/interfaces/search.result.interface.ts +3 -0
- package/src/features/user/author.module.ts +10 -0
- package/src/features/user/components/containers/UserContainer.tsx +23 -0
- package/src/features/user/components/containers/UserIndexContainer.tsx +12 -0
- package/src/features/user/components/containers/UsersListContainer.tsx +36 -0
- package/src/features/user/components/containers/index.ts +3 -0
- package/src/features/user/components/details/UserDetails.tsx +74 -0
- package/src/features/user/components/details/UserIndexDetails.tsx +28 -0
- package/src/features/user/components/details/index.ts +2 -0
- package/src/features/user/components/forms/RoleUserAdd.tsx +93 -0
- package/src/features/user/components/forms/UserAvatarEditor.tsx +78 -0
- package/src/features/user/components/forms/UserDeleter.tsx +49 -0
- package/src/features/user/components/forms/UserEditor.tsx +319 -0
- package/src/features/user/components/forms/UserMultiSelect.tsx +218 -0
- package/src/features/user/components/forms/UserReactivator.tsx +79 -0
- package/src/features/user/components/forms/UserResentInvitationEmail.tsx +88 -0
- package/src/features/user/components/forms/UserSelector.tsx +185 -0
- package/src/features/user/components/forms/index.ts +8 -0
- package/src/features/user/components/index.ts +5 -0
- package/src/features/user/components/lists/AdminUsersList.tsx +41 -0
- package/src/features/user/components/lists/CompanyUsersList.tsx +44 -0
- package/src/features/user/components/lists/ContributorsList.tsx +41 -0
- package/src/features/user/components/lists/RelevantUsersList.tsx +30 -0
- package/src/features/user/components/lists/RoleUsersList.tsx +31 -0
- package/src/features/user/components/lists/UserListInAdd.tsx +53 -0
- package/src/features/user/components/lists/UsersList.tsx +30 -0
- package/src/features/user/components/lists/UsersListByContentIds.tsx +30 -0
- package/src/features/user/components/lists/index.ts +8 -0
- package/src/features/user/components/widgets/UserAvatar.tsx +86 -0
- package/src/features/user/components/widgets/UserAvatarList.tsx +31 -0
- package/src/features/user/components/widgets/UserSearchPopover.tsx +89 -0
- package/src/features/user/components/widgets/index.ts +1 -0
- package/src/features/user/contexts/CurrentUserContext.tsx +156 -0
- package/src/features/user/contexts/UserContext.tsx +106 -0
- package/src/features/user/contexts/index.ts +2 -0
- package/src/features/user/data/index.ts +4 -0
- package/src/features/user/data/user.fields.ts +8 -0
- package/src/features/user/data/user.interface.ts +41 -0
- package/src/features/user/data/user.service.ts +246 -0
- package/src/features/user/data/user.ts +162 -0
- package/src/features/user/hooks/index.ts +2 -0
- package/src/features/user/hooks/useUserSearch.ts +53 -0
- package/src/features/user/hooks/useUserTableStructure.tsx +115 -0
- package/src/features/user/index.ts +3 -0
- package/src/features/user/user.module.ts +21 -0
- package/src/hooks/TableGeneratorRegistry.ts +53 -0
- package/src/hooks/index.ts +37 -0
- package/src/hooks/types.ts +35 -0
- package/src/hooks/url.rewriter.ts +22 -0
- package/src/hooks/useCustomD3Graph.tsx +707 -0
- package/src/hooks/useDataListRetriever.ts +349 -0
- package/src/hooks/useDebounce.ts +33 -0
- package/src/hooks/useNotificationSync.ts +20 -0
- package/src/hooks/usePageTracker.ts +69 -0
- package/src/hooks/usePageUrlGenerator.ts +50 -0
- package/src/hooks/usePushNotifications.ts +82 -0
- package/src/hooks/useSocket.ts +201 -0
- package/src/hooks/useTableGenerator.ts +20 -0
- package/src/i18n/config.ts +74 -0
- package/src/i18n/index.ts +18 -0
- package/src/index.ts +20 -0
- package/src/interfaces/breadcrumb.item.data.interface.ts +4 -0
- package/src/interfaces/d3.link.interface.ts +8 -0
- package/src/interfaces/d3.node.interface.ts +12 -0
- package/src/interfaces/index.ts +3 -0
- package/src/permissions/check.ts +127 -0
- package/src/permissions/index.ts +2 -0
- package/src/permissions/types.ts +109 -0
- package/src/roles/config.ts +46 -0
- package/src/roles/index.ts +1 -0
- package/src/server/ServerSession.ts +103 -0
- package/src/server/cache.ts +28 -0
- package/src/server/index.ts +4 -0
- package/src/server/request.ts +113 -0
- package/src/server/token.ts +10 -0
- package/src/shadcnui/custom/kanban.tsx +1001 -0
- package/src/shadcnui/custom/link.tsx +18 -0
- package/src/shadcnui/custom/multi-select.tsx +382 -0
- package/src/shadcnui/index.ts +49 -0
- package/src/shadcnui/ui/accordion.tsx +52 -0
- package/src/shadcnui/ui/alert-dialog.tsx +141 -0
- package/src/shadcnui/ui/alert.tsx +43 -0
- package/src/shadcnui/ui/avatar.tsx +50 -0
- package/src/shadcnui/ui/badge.tsx +40 -0
- package/src/shadcnui/ui/breadcrumb.tsx +115 -0
- package/src/shadcnui/ui/button.tsx +51 -0
- package/src/shadcnui/ui/calendar.tsx +73 -0
- package/src/shadcnui/ui/card.tsx +43 -0
- package/src/shadcnui/ui/carousel.tsx +225 -0
- package/src/shadcnui/ui/chart.tsx +320 -0
- package/src/shadcnui/ui/checkbox.tsx +29 -0
- package/src/shadcnui/ui/collapsible.tsx +11 -0
- package/src/shadcnui/ui/command.tsx +155 -0
- package/src/shadcnui/ui/context-menu.tsx +179 -0
- package/src/shadcnui/ui/dialog.tsx +96 -0
- package/src/shadcnui/ui/drawer.tsx +89 -0
- package/src/shadcnui/ui/dropdown-menu.tsx +205 -0
- package/src/shadcnui/ui/form.tsx +138 -0
- package/src/shadcnui/ui/hover-card.tsx +29 -0
- package/src/shadcnui/ui/input.tsx +21 -0
- package/src/shadcnui/ui/label.tsx +26 -0
- package/src/shadcnui/ui/navigation-menu.tsx +168 -0
- package/src/shadcnui/ui/popover.tsx +33 -0
- package/src/shadcnui/ui/progress.tsx +25 -0
- package/src/shadcnui/ui/radio-group.tsx +37 -0
- package/src/shadcnui/ui/resizable.tsx +47 -0
- package/src/shadcnui/ui/scroll-area.tsx +40 -0
- package/src/shadcnui/ui/select.tsx +164 -0
- package/src/shadcnui/ui/separator.tsx +28 -0
- package/src/shadcnui/ui/sheet.tsx +139 -0
- package/src/shadcnui/ui/sidebar.tsx +677 -0
- package/src/shadcnui/ui/skeleton.tsx +13 -0
- package/src/shadcnui/ui/slider.tsx +25 -0
- package/src/shadcnui/ui/sonner.tsx +25 -0
- package/src/shadcnui/ui/switch.tsx +31 -0
- package/src/shadcnui/ui/table.tsx +120 -0
- package/src/shadcnui/ui/tabs.tsx +55 -0
- package/src/shadcnui/ui/textarea.tsx +24 -0
- package/src/shadcnui/ui/toggle.tsx +39 -0
- package/src/shadcnui/ui/tooltip.tsx +61 -0
- package/src/unified/JsonApiRequest.ts +348 -0
- package/src/unified/index.ts +1 -0
- package/src/utils/blocknote-diff.util.ts +815 -0
- package/src/utils/blocknote-word-diff-renderer.util.ts +413 -0
- package/src/utils/cn.ts +6 -0
- package/src/utils/compose-refs.ts +61 -0
- package/src/utils/date-formatter.ts +53 -0
- package/src/utils/exists.ts +7 -0
- package/src/utils/index.ts +15 -0
- package/src/utils/schemas/entity.object.schema.ts +8 -0
- package/src/utils/schemas/index.ts +2 -0
- package/src/utils/schemas/user.object.schema.ts +9 -0
- package/src/utils/table-options.ts +67 -0
- package/src/utils/use-mobile.tsx +21 -0
- package/dist/ApiRequestDataTypeInterface-CUKFDBx2.d.mts +0 -20
- package/dist/ApiRequestDataTypeInterface-CUKFDBx2.d.ts +0 -20
- package/dist/BlockNoteEditor-VFWG6LXI.js.map +0 -1
- package/dist/JsonApiRequest-S3ICLM7B.mjs +0 -20
- package/dist/JsonApiRequest-ZZLSP26T.js +0 -20
- package/dist/JsonApiRequest-ZZLSP26T.js.map +0 -1
- package/dist/chunk-366S2JCC.mjs +0 -31
- package/dist/chunk-366S2JCC.mjs.map +0 -1
- package/dist/chunk-5W6AKZE6.mjs +0 -131
- package/dist/chunk-5W6AKZE6.mjs.map +0 -1
- package/dist/chunk-A3J3AAYM.mjs +0 -97
- package/dist/chunk-A3J3AAYM.mjs.map +0 -1
- package/dist/chunk-AWONBQQP.js +0 -97
- package/dist/chunk-AWONBQQP.js.map +0 -1
- package/dist/chunk-CXQOWQSY.js.map +0 -1
- package/dist/chunk-DKKMWBP4.mjs +0 -1
- package/dist/chunk-DKKMWBP4.mjs.map +0 -1
- package/dist/chunk-DO2HLAZO.js.map +0 -1
- package/dist/chunk-DZXDB3K2.mjs +0 -17
- package/dist/chunk-DZXDB3K2.mjs.map +0 -1
- package/dist/chunk-ECDTZBYO.mjs.map +0 -1
- package/dist/chunk-FY4SXJGU.js +0 -806
- package/dist/chunk-FY4SXJGU.js.map +0 -1
- package/dist/chunk-GYWPEPOH.mjs.map +0 -1
- package/dist/chunk-H6FMOA6B.js +0 -1
- package/dist/chunk-H6FMOA6B.js.map +0 -1
- package/dist/chunk-I2REI7OA.js.map +0 -1
- package/dist/chunk-J4Q36PMP.js +0 -31
- package/dist/chunk-J4Q36PMP.js.map +0 -1
- package/dist/chunk-L6EQEAXU.mjs.map +0 -1
- package/dist/chunk-MFO27OHB.mjs +0 -48
- package/dist/chunk-MFO27OHB.mjs.map +0 -1
- package/dist/chunk-RAF7PNLG.js +0 -131
- package/dist/chunk-RAF7PNLG.js.map +0 -1
- package/dist/chunk-RUR22SVM.js +0 -17
- package/dist/chunk-RUR22SVM.js.map +0 -1
- package/dist/chunk-TEGF6ZWG.js.map +0 -1
- package/dist/chunk-TMVHSY3Y.js.map +0 -1
- package/dist/chunk-V2JJPI7N.js.map +0 -1
- package/dist/chunk-WWWMJZEF.mjs +0 -806
- package/dist/chunk-WWWMJZEF.mjs.map +0 -1
- package/dist/chunk-X4BIHJ2B.mjs.map +0 -1
- package/dist/chunk-YDVTFM7X.mjs.map +0 -1
- /package/dist/{JsonApiRequest-S3ICLM7B.mjs.map → JsonApiRequest-O7BGUMFO.mjs.map} +0 -0
package/dist/client/index.d.mts
CHANGED
|
@@ -2,9 +2,14 @@ import * as React from 'react';
|
|
|
2
2
|
import React__default from 'react';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
4
|
import { A as ApiDataInterface, J as JsonApiHydratedDataInterface } from '../ApiDataInterface-DPP8s46n.mjs';
|
|
5
|
-
import { A as ApiRequestDataTypeInterface } from '../
|
|
5
|
+
import { A as ApiRequestDataTypeInterface } from '../types-Bl61ob-7.mjs';
|
|
6
6
|
import { A as ApiResponseInterface } from '../ApiResponseInterface-BHN5D9r5.mjs';
|
|
7
7
|
import { A as ApiData } from '../ApiData-DPKNfY-9.mjs';
|
|
8
|
+
import { U as UseTableStructureHook } from '../types-iVdVY7ba.mjs';
|
|
9
|
+
import { R as RoleInterface, U as UserInterface } from '../user.interface-CAsTIbuQ.mjs';
|
|
10
|
+
import { R as RoleFields, U as UserFields } from '../user.fields-CbdObSmS.mjs';
|
|
11
|
+
import '@tanstack/react-table';
|
|
12
|
+
import '../useDataListRetriever-futhx3OP.mjs';
|
|
8
13
|
|
|
9
14
|
type CacheProfile = "seconds" | "minutes" | "hours" | "days" | "weeks" | "max" | "default";
|
|
10
15
|
interface JsonApiConfig {
|
|
@@ -249,4 +254,18 @@ declare function directFetch(params: DirectFetchParams): Promise<ApiData>;
|
|
|
249
254
|
*/
|
|
250
255
|
declare function getClientToken(): Promise<string | undefined>;
|
|
251
256
|
|
|
252
|
-
|
|
257
|
+
declare const useRoleTableStructure: UseTableStructureHook<RoleInterface, RoleFields>;
|
|
258
|
+
|
|
259
|
+
declare const useUserSearch: () => {
|
|
260
|
+
users: UserInterface[];
|
|
261
|
+
searchQuery: string;
|
|
262
|
+
setSearchQuery: React.Dispatch<React.SetStateAction<string>>;
|
|
263
|
+
isLoading: boolean;
|
|
264
|
+
loadUsers: (search: string) => Promise<void>;
|
|
265
|
+
clearSearch: () => void;
|
|
266
|
+
searchQueryRef: React.RefObject<string>;
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
declare const useUserTableStructure: UseTableStructureHook<UserInterface, UserFields>;
|
|
270
|
+
|
|
271
|
+
export { type CacheProfile, type DirectFetchParams, type JsonApiConfig, JsonApiContext, JsonApiProvider, type JsonApiProviderProps, type MutationMethod, type MutationParams, type UseJsonApiGetOptions, type UseJsonApiGetResult, type UseJsonApiMutationResult, directFetch, getClientToken, useJsonApiConfig, useJsonApiConfigOptional, useJsonApiGet, useJsonApiMutation, useRehydration, useRehydrationList, useRoleTableStructure, useUserSearch, useUserTableStructure };
|
package/dist/client/index.d.ts
CHANGED
|
@@ -2,9 +2,14 @@ import * as React from 'react';
|
|
|
2
2
|
import React__default from 'react';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
4
|
import { A as ApiDataInterface, J as JsonApiHydratedDataInterface } from '../ApiDataInterface-DPP8s46n.js';
|
|
5
|
-
import { A as ApiRequestDataTypeInterface } from '../
|
|
5
|
+
import { A as ApiRequestDataTypeInterface } from '../types-Bl61ob-7.js';
|
|
6
6
|
import { A as ApiResponseInterface } from '../ApiResponseInterface-DDI7QQPR.js';
|
|
7
7
|
import { A as ApiData } from '../ApiData-DPKNfY-9.js';
|
|
8
|
+
import { U as UseTableStructureHook } from '../types-BUAlgqqh.js';
|
|
9
|
+
import { R as RoleInterface, U as UserInterface } from '../user.interface-CbWqMaaU.js';
|
|
10
|
+
import { R as RoleFields, U as UserFields } from '../user.fields-CbdObSmS.js';
|
|
11
|
+
import '@tanstack/react-table';
|
|
12
|
+
import '../useDataListRetriever-futhx3OP.js';
|
|
8
13
|
|
|
9
14
|
type CacheProfile = "seconds" | "minutes" | "hours" | "days" | "weeks" | "max" | "default";
|
|
10
15
|
interface JsonApiConfig {
|
|
@@ -249,4 +254,18 @@ declare function directFetch(params: DirectFetchParams): Promise<ApiData>;
|
|
|
249
254
|
*/
|
|
250
255
|
declare function getClientToken(): Promise<string | undefined>;
|
|
251
256
|
|
|
252
|
-
|
|
257
|
+
declare const useRoleTableStructure: UseTableStructureHook<RoleInterface, RoleFields>;
|
|
258
|
+
|
|
259
|
+
declare const useUserSearch: () => {
|
|
260
|
+
users: UserInterface[];
|
|
261
|
+
searchQuery: string;
|
|
262
|
+
setSearchQuery: React.Dispatch<React.SetStateAction<string>>;
|
|
263
|
+
isLoading: boolean;
|
|
264
|
+
loadUsers: (search: string) => Promise<void>;
|
|
265
|
+
clearSearch: () => void;
|
|
266
|
+
searchQueryRef: React.RefObject<string>;
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
declare const useUserTableStructure: UseTableStructureHook<UserInterface, UserFields>;
|
|
270
|
+
|
|
271
|
+
export { type CacheProfile, type DirectFetchParams, type JsonApiConfig, JsonApiContext, JsonApiProvider, type JsonApiProviderProps, type MutationMethod, type MutationParams, type UseJsonApiGetOptions, type UseJsonApiGetResult, type UseJsonApiMutationResult, directFetch, getClientToken, useJsonApiConfig, useJsonApiConfigOptional, useJsonApiGet, useJsonApiMutation, useRehydration, useRehydrationList, useRoleTableStructure, useUserSearch, useUserTableStructure };
|
package/dist/client/index.js
CHANGED
|
@@ -1,265 +1,38 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
3
|
+
|
|
3
4
|
|
|
4
5
|
|
|
5
|
-
var _chunkIBS6NI7Djs = require('../chunk-IBS6NI7D.js');
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var _chunkLXKSUWAVjs = require('../chunk-LXKSUWAV.js');
|
|
9
8
|
|
|
10
9
|
|
|
11
|
-
var _chunkJ4Q36PMPjs = require('../chunk-J4Q36PMP.js');
|
|
12
|
-
require('../chunk-DO2HLAZO.js');
|
|
13
10
|
|
|
14
11
|
|
|
15
|
-
var _chunk7QVYU63Ejs = require('../chunk-7QVYU63E.js');
|
|
16
12
|
|
|
17
|
-
// src/client/context/JsonApiContext.ts
|
|
18
|
-
var _react = require('react');
|
|
19
|
-
var JsonApiContext = _react.createContext.call(void 0, null);
|
|
20
|
-
function useJsonApiConfig() {
|
|
21
|
-
const config = _react.useContext.call(void 0, JsonApiContext);
|
|
22
|
-
if (!config) {
|
|
23
|
-
throw new Error("useJsonApiConfig must be used within a JsonApiProvider");
|
|
24
|
-
}
|
|
25
|
-
return config;
|
|
26
|
-
}
|
|
27
|
-
_chunk7QVYU63Ejs.__name.call(void 0, useJsonApiConfig, "useJsonApiConfig");
|
|
28
|
-
function useJsonApiConfigOptional() {
|
|
29
|
-
return _react.useContext.call(void 0, JsonApiContext);
|
|
30
|
-
}
|
|
31
|
-
_chunk7QVYU63Ejs.__name.call(void 0, useJsonApiConfigOptional, "useJsonApiConfigOptional");
|
|
32
13
|
|
|
33
|
-
// src/client/context/JsonApiProvider.tsx
|
|
34
14
|
|
|
35
|
-
var
|
|
36
|
-
function JsonApiProvider({ config, children }) {
|
|
37
|
-
_react.useEffect.call(void 0, () => {
|
|
38
|
-
if (config.bootstrapper) {
|
|
39
|
-
config.bootstrapper();
|
|
40
|
-
}
|
|
41
|
-
}, [config.bootstrapper]);
|
|
42
|
-
const memoizedConfig = _react.useMemo.call(void 0, () => config, [config]);
|
|
43
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, JsonApiContext.Provider, { value: memoizedConfig, children });
|
|
44
|
-
}
|
|
45
|
-
_chunk7QVYU63Ejs.__name.call(void 0, JsonApiProvider, "JsonApiProvider");
|
|
15
|
+
var _chunkWEC4YMOSjs = require('../chunk-WEC4YMOS.js');
|
|
46
16
|
|
|
47
|
-
// src/client/hooks/useJsonApiGet.ts
|
|
48
17
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
const isMounted = _react.useRef.call(void 0, true);
|
|
55
|
-
const fetchData = _react.useCallback.call(void 0, async () => {
|
|
56
|
-
if (_optionalChain([params, 'access', _ => _.options, 'optionalAccess', _2 => _2.enabled]) === false) return;
|
|
57
|
-
setLoading(true);
|
|
58
|
-
setError(null);
|
|
59
|
-
try {
|
|
60
|
-
const { JsonApiGet } = await Promise.resolve().then(() => _interopRequireWildcard(require("../JsonApiRequest-ZZLSP26T.js")));
|
|
61
|
-
const language = navigator.language.split("-")[0] || "en";
|
|
62
|
-
const apiResponse = await JsonApiGet({
|
|
63
|
-
classKey: params.classKey,
|
|
64
|
-
endpoint: params.endpoint,
|
|
65
|
-
companyId: params.companyId,
|
|
66
|
-
language
|
|
67
|
-
});
|
|
68
|
-
if (!isMounted.current) return;
|
|
69
|
-
setResponse(apiResponse);
|
|
70
|
-
if (apiResponse.ok) {
|
|
71
|
-
setData(apiResponse.data);
|
|
72
|
-
} else {
|
|
73
|
-
setError(apiResponse.error);
|
|
74
|
-
}
|
|
75
|
-
} catch (err) {
|
|
76
|
-
if (!isMounted.current) return;
|
|
77
|
-
setError(err instanceof Error ? err.message : "Unknown error");
|
|
78
|
-
} finally {
|
|
79
|
-
if (isMounted.current) {
|
|
80
|
-
setLoading(false);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
}, [params.classKey, params.endpoint, params.companyId, _optionalChain([params, 'access', _3 => _3.options, 'optionalAccess', _4 => _4.enabled])]);
|
|
84
|
-
const fetchNextPage = _react.useCallback.call(void 0, async () => {
|
|
85
|
-
if (!_optionalChain([response, 'optionalAccess', _5 => _5.nextPage])) return;
|
|
86
|
-
setLoading(true);
|
|
87
|
-
try {
|
|
88
|
-
const nextResponse = await response.nextPage();
|
|
89
|
-
if (!isMounted.current) return;
|
|
90
|
-
setResponse(nextResponse);
|
|
91
|
-
if (nextResponse.ok) {
|
|
92
|
-
setData(nextResponse.data);
|
|
93
|
-
} else {
|
|
94
|
-
setError(nextResponse.error);
|
|
95
|
-
}
|
|
96
|
-
} catch (err) {
|
|
97
|
-
if (!isMounted.current) return;
|
|
98
|
-
setError(err instanceof Error ? err.message : "Unknown error");
|
|
99
|
-
} finally {
|
|
100
|
-
if (isMounted.current) {
|
|
101
|
-
setLoading(false);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}, [response]);
|
|
105
|
-
const fetchPreviousPage = _react.useCallback.call(void 0, async () => {
|
|
106
|
-
if (!_optionalChain([response, 'optionalAccess', _6 => _6.prevPage])) return;
|
|
107
|
-
setLoading(true);
|
|
108
|
-
try {
|
|
109
|
-
const prevResponse = await response.prevPage();
|
|
110
|
-
if (!isMounted.current) return;
|
|
111
|
-
setResponse(prevResponse);
|
|
112
|
-
if (prevResponse.ok) {
|
|
113
|
-
setData(prevResponse.data);
|
|
114
|
-
} else {
|
|
115
|
-
setError(prevResponse.error);
|
|
116
|
-
}
|
|
117
|
-
} catch (err) {
|
|
118
|
-
if (!isMounted.current) return;
|
|
119
|
-
setError(err instanceof Error ? err.message : "Unknown error");
|
|
120
|
-
} finally {
|
|
121
|
-
if (isMounted.current) {
|
|
122
|
-
setLoading(false);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
}, [response]);
|
|
126
|
-
_react.useEffect.call(void 0, () => {
|
|
127
|
-
isMounted.current = true;
|
|
128
|
-
fetchData();
|
|
129
|
-
return () => {
|
|
130
|
-
isMounted.current = false;
|
|
131
|
-
};
|
|
132
|
-
}, [fetchData, ..._optionalChain([params, 'access', _7 => _7.options, 'optionalAccess', _8 => _8.deps]) || []]);
|
|
133
|
-
return {
|
|
134
|
-
data,
|
|
135
|
-
loading,
|
|
136
|
-
error,
|
|
137
|
-
response,
|
|
138
|
-
refetch: fetchData,
|
|
139
|
-
hasNextPage: !!_optionalChain([response, 'optionalAccess', _9 => _9.next]),
|
|
140
|
-
hasPreviousPage: !!_optionalChain([response, 'optionalAccess', _10 => _10.prev]),
|
|
141
|
-
fetchNextPage,
|
|
142
|
-
fetchPreviousPage
|
|
143
|
-
};
|
|
144
|
-
}
|
|
145
|
-
_chunk7QVYU63Ejs.__name.call(void 0, useJsonApiGet, "useJsonApiGet");
|
|
18
|
+
var _chunkIBS6NI7Djs = require('../chunk-IBS6NI7D.js');
|
|
19
|
+
require('../chunk-A5DDIABK.js');
|
|
20
|
+
require('../chunk-JC3WJK65.js');
|
|
21
|
+
require('../chunk-RZO2LOW4.js');
|
|
22
|
+
|
|
146
23
|
|
|
147
|
-
|
|
24
|
+
var _chunkLXKSUWAVjs = require('../chunk-LXKSUWAV.js');
|
|
25
|
+
require('../chunk-AYHKQWHH.js');
|
|
26
|
+
require('../chunk-5ZEADNNP.js');
|
|
27
|
+
require('../chunk-4HCRAOS5.js');
|
|
28
|
+
require('../chunk-3FBCC4G3.js');
|
|
29
|
+
require('../chunk-HMHGLXWC.js');
|
|
30
|
+
require('../chunk-AGAJMJ4T.js');
|
|
31
|
+
require('../chunk-6GKHCVF6.js');
|
|
32
|
+
require('../chunk-7QVYU63E.js');
|
|
148
33
|
|
|
149
|
-
function useJsonApiMutation(config) {
|
|
150
|
-
const [data, setData] = _react.useState.call(void 0, null);
|
|
151
|
-
const [loading, setLoading] = _react.useState.call(void 0, false);
|
|
152
|
-
const [error, setError] = _react.useState.call(void 0, null);
|
|
153
|
-
const [response, setResponse] = _react.useState.call(void 0, null);
|
|
154
|
-
const reset = _react.useCallback.call(void 0, () => {
|
|
155
|
-
setData(null);
|
|
156
|
-
setLoading(false);
|
|
157
|
-
setError(null);
|
|
158
|
-
setResponse(null);
|
|
159
|
-
}, []);
|
|
160
|
-
const mutate = _react.useCallback.call(void 0,
|
|
161
|
-
async (params) => {
|
|
162
|
-
setLoading(true);
|
|
163
|
-
setError(null);
|
|
164
|
-
try {
|
|
165
|
-
const { JsonApiPost, JsonApiPut, JsonApiPatch, JsonApiDelete } = await Promise.resolve().then(() => _interopRequireWildcard(require("../JsonApiRequest-ZZLSP26T.js")));
|
|
166
|
-
const language = navigator.language.split("-")[0] || "en";
|
|
167
|
-
let apiResponse;
|
|
168
|
-
switch (config.method) {
|
|
169
|
-
case "POST":
|
|
170
|
-
apiResponse = await JsonApiPost({
|
|
171
|
-
classKey: config.classKey,
|
|
172
|
-
endpoint: params.endpoint,
|
|
173
|
-
companyId: params.companyId,
|
|
174
|
-
body: params.body,
|
|
175
|
-
overridesJsonApiCreation: params.overridesJsonApiCreation,
|
|
176
|
-
files: params.files,
|
|
177
|
-
language,
|
|
178
|
-
responseType: params.responseType
|
|
179
|
-
});
|
|
180
|
-
break;
|
|
181
|
-
case "PUT":
|
|
182
|
-
apiResponse = await JsonApiPut({
|
|
183
|
-
classKey: config.classKey,
|
|
184
|
-
endpoint: params.endpoint,
|
|
185
|
-
companyId: params.companyId,
|
|
186
|
-
body: params.body,
|
|
187
|
-
files: params.files,
|
|
188
|
-
language,
|
|
189
|
-
responseType: params.responseType
|
|
190
|
-
});
|
|
191
|
-
break;
|
|
192
|
-
case "PATCH":
|
|
193
|
-
apiResponse = await JsonApiPatch({
|
|
194
|
-
classKey: config.classKey,
|
|
195
|
-
endpoint: params.endpoint,
|
|
196
|
-
companyId: params.companyId,
|
|
197
|
-
body: params.body,
|
|
198
|
-
overridesJsonApiCreation: params.overridesJsonApiCreation,
|
|
199
|
-
files: params.files,
|
|
200
|
-
language,
|
|
201
|
-
responseType: params.responseType
|
|
202
|
-
});
|
|
203
|
-
break;
|
|
204
|
-
case "DELETE":
|
|
205
|
-
apiResponse = await JsonApiDelete({
|
|
206
|
-
classKey: config.classKey,
|
|
207
|
-
endpoint: params.endpoint,
|
|
208
|
-
companyId: params.companyId,
|
|
209
|
-
language,
|
|
210
|
-
responseType: params.responseType
|
|
211
|
-
});
|
|
212
|
-
break;
|
|
213
|
-
}
|
|
214
|
-
setResponse(apiResponse);
|
|
215
|
-
if (apiResponse.ok) {
|
|
216
|
-
const resultData = apiResponse.data;
|
|
217
|
-
setData(resultData);
|
|
218
|
-
_optionalChain([config, 'access', _11 => _11.onSuccess, 'optionalCall', _12 => _12(resultData)]);
|
|
219
|
-
return resultData;
|
|
220
|
-
} else {
|
|
221
|
-
setError(apiResponse.error);
|
|
222
|
-
_optionalChain([config, 'access', _13 => _13.onError, 'optionalCall', _14 => _14(apiResponse.error)]);
|
|
223
|
-
return null;
|
|
224
|
-
}
|
|
225
|
-
} catch (err) {
|
|
226
|
-
const errorMessage = err instanceof Error ? err.message : "Unknown error";
|
|
227
|
-
setError(errorMessage);
|
|
228
|
-
_optionalChain([config, 'access', _15 => _15.onError, 'optionalCall', _16 => _16(errorMessage)]);
|
|
229
|
-
return null;
|
|
230
|
-
} finally {
|
|
231
|
-
setLoading(false);
|
|
232
|
-
}
|
|
233
|
-
},
|
|
234
|
-
[config]
|
|
235
|
-
);
|
|
236
|
-
return {
|
|
237
|
-
data,
|
|
238
|
-
loading,
|
|
239
|
-
error,
|
|
240
|
-
response,
|
|
241
|
-
mutate,
|
|
242
|
-
reset
|
|
243
|
-
};
|
|
244
|
-
}
|
|
245
|
-
_chunk7QVYU63Ejs.__name.call(void 0, useJsonApiMutation, "useJsonApiMutation");
|
|
246
34
|
|
|
247
|
-
// src/client/hooks/useRehydration.ts
|
|
248
35
|
|
|
249
|
-
function useRehydration(classKey, data) {
|
|
250
|
-
return _react.useMemo.call(void 0, () => {
|
|
251
|
-
if (!data) return null;
|
|
252
|
-
return _chunkJ4Q36PMPjs.RehydrationFactory.rehydrate(classKey, data);
|
|
253
|
-
}, [classKey, data]);
|
|
254
|
-
}
|
|
255
|
-
_chunk7QVYU63Ejs.__name.call(void 0, useRehydration, "useRehydration");
|
|
256
|
-
function useRehydrationList(classKey, data) {
|
|
257
|
-
return _react.useMemo.call(void 0, () => {
|
|
258
|
-
if (!data || data.length === 0) return [];
|
|
259
|
-
return _chunkJ4Q36PMPjs.RehydrationFactory.rehydrateList(classKey, data);
|
|
260
|
-
}, [classKey, data]);
|
|
261
|
-
}
|
|
262
|
-
_chunk7QVYU63Ejs.__name.call(void 0, useRehydrationList, "useRehydrationList");
|
|
263
36
|
|
|
264
37
|
|
|
265
38
|
|
|
@@ -271,5 +44,5 @@ _chunk7QVYU63Ejs.__name.call(void 0, useRehydrationList, "useRehydrationList");
|
|
|
271
44
|
|
|
272
45
|
|
|
273
46
|
|
|
274
|
-
exports.JsonApiContext = JsonApiContext; exports.JsonApiProvider = JsonApiProvider; exports.directFetch = _chunkIBS6NI7Djs.directFetch; exports.getClientToken = _chunkLXKSUWAVjs.getClientToken; exports.useJsonApiConfig = useJsonApiConfig; exports.useJsonApiConfigOptional = useJsonApiConfigOptional; exports.useJsonApiGet = useJsonApiGet; exports.useJsonApiMutation = useJsonApiMutation; exports.useRehydration = useRehydration; exports.useRehydrationList = useRehydrationList;
|
|
47
|
+
exports.JsonApiContext = _chunkWEC4YMOSjs.JsonApiContext; exports.JsonApiProvider = _chunkWEC4YMOSjs.JsonApiProvider; exports.directFetch = _chunkIBS6NI7Djs.directFetch; exports.getClientToken = _chunkLXKSUWAVjs.getClientToken; exports.useJsonApiConfig = _chunkWEC4YMOSjs.useJsonApiConfig; exports.useJsonApiConfigOptional = _chunkWEC4YMOSjs.useJsonApiConfigOptional; exports.useJsonApiGet = _chunkWEC4YMOSjs.useJsonApiGet; exports.useJsonApiMutation = _chunkWEC4YMOSjs.useJsonApiMutation; exports.useRehydration = _chunkWEC4YMOSjs.useRehydration; exports.useRehydrationList = _chunkWEC4YMOSjs.useRehydrationList; exports.useRoleTableStructure = _chunkWEC4YMOSjs.useRoleTableStructure; exports.useUserSearch = _chunkWEC4YMOSjs.useUserSearch; exports.useUserTableStructure = _chunkWEC4YMOSjs.useUserTableStructure;
|
|
275
48
|
//# sourceMappingURL=index.js.map
|
package/dist/client/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/nextjs-jsonapi/nextjs-jsonapi/dist/client/index.js","../../src/client/context/JsonApiContext.ts","../../src/client/context/JsonApiProvider.tsx","../../src/client/hooks/useJsonApiGet.ts","../../src/client/hooks/useJsonApiMutation.ts","../../src/client/hooks/useRehydration.ts"],"names":["useEffect","useState","useCallback","useMemo"],"mappings":"AAAA,22BAAY;AACZ;AACE;AACF,uDAA6B;AAC7B;AACE;AACF,uDAA6B;AAC7B;AACE;AACF,uDAA6B;AAC7B,gCAA6B;AAC7B;AACE;AACF,uDAA6B;AAC7B;AACA;ACbA,8BAA0C;AA4C1C,IAAM,eAAA,EAAiB,kCAAA,IAAwC,CAAA;AAExD,SAAS,gBAAA,CAAA,EAAkC;AAChD,EAAA,MAAM,OAAA,EAAS,+BAAA,cAAyB,CAAA;AACxC,EAAA,GAAA,CAAI,CAAC,MAAA,EAAQ;AACX,IAAA,MAAM,IAAI,KAAA,CAAM,wDAAwD,CAAA;AAAA,EAC1E;AACA,EAAA,OAAO,MAAA;AACT;AANgB,qCAAA,gBAAA,EAAA,kBAAA,CAAA;AAQT,SAAS,wBAAA,CAAA,EAAiD;AAC/D,EAAA,OAAO,+BAAA,cAAyB,CAAA;AAClC;AAFgB,qCAAA,wBAAA,EAAA,0BAAA,CAAA;AD1BhB;AACA;AE7BA;AAoBI,+CAAA;AAZG,SAAS,eAAA,CAAgB,EAAE,MAAA,EAAQ,SAAS,CAAA,EAAyB;AAE1E,EAAA,8BAAA,CAAU,EAAA,GAAM;AACd,IA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IAAA,CAAK,OAAA,IAAW,CAAA,EAAG,OAAO,CAAC,CAAA;AACxC,IAAA,OAAO,mCAAA,CAAmB,aAAA,CAAiB,QAAA,EAAU,IAAI,CAAA;AAAA,EAC3D,CAAA,EAAG,CAAC,QAAA,EAAU,IAAI,CAAC,CAAA;AACrB;AARgB,qCAAA,kBAAA,EAAA,oBAAA,CAAA;AL+NhB;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,6dAAC","file":"/home/runner/work/nextjs-jsonapi/nextjs-jsonapi/dist/client/index.js","sourcesContent":[null,"\"use client\";\n\nimport { createContext, useContext } from \"react\";\n\nexport type CacheProfile = \"seconds\" | \"minutes\" | \"hours\" | \"days\" | \"weeks\" | \"max\" | \"default\";\n\nexport interface JsonApiConfig {\n /**\n * The base URL for API requests (e.g., https://api.example.com)\n */\n apiUrl: string;\n\n /**\n * Custom token getter function. If not provided, will use default cookie-based token retrieval.\n */\n tokenGetter?: () => Promise<string | undefined>;\n\n /**\n * Custom language getter function. If not provided, will use browser locale or next-intl.\n */\n languageGetter?: () => Promise<string>;\n\n /**\n * Default headers to include in all requests\n */\n defaultHeaders?: Record<string, string>;\n\n /**\n * Global error handler for failed requests (client-side only)\n */\n onError?: (status: number, message: string) => void;\n\n /**\n * Cache configuration\n */\n cacheConfig?: {\n defaultProfile: CacheProfile;\n };\n\n /**\n * Function to bootstrap the data class registry.\n * Will be called automatically when needed.\n */\n bootstrapper?: () => void;\n}\n\nconst JsonApiContext = createContext<JsonApiConfig | null>(null);\n\nexport function useJsonApiConfig(): JsonApiConfig {\n const config = useContext(JsonApiContext);\n if (!config) {\n throw new Error(\"useJsonApiConfig must be used within a JsonApiProvider\");\n }\n return config;\n}\n\nexport function useJsonApiConfigOptional(): JsonApiConfig | null {\n return useContext(JsonApiContext);\n}\n\nexport { JsonApiContext };\n","\"use client\";\n\nimport React, { useEffect, useMemo } from \"react\";\nimport { JsonApiConfig, JsonApiContext } from \"./JsonApiContext\";\n\nexport interface JsonApiProviderProps {\n config: JsonApiConfig;\n children: React.ReactNode;\n}\n\nexport function JsonApiProvider({ config, children }: JsonApiProviderProps) {\n // Run bootstrapper on mount if provided\n useEffect(() => {\n if (config.bootstrapper) {\n config.bootstrapper();\n }\n }, [config.bootstrapper]);\n\n // Memoize config to prevent unnecessary re-renders\n const memoizedConfig = useMemo(() => config, [config]);\n\n return (\n <JsonApiContext.Provider value={memoizedConfig}>\n {children}\n </JsonApiContext.Provider>\n );\n}\n","\"use client\";\n\nimport { useState, useEffect, useCallback, useRef } from \"react\";\nimport { ApiDataInterface } from \"../../core/interfaces/ApiDataInterface\";\nimport { ApiRequestDataTypeInterface } from \"../../core/interfaces/ApiRequestDataTypeInterface\";\nimport { ApiResponseInterface } from \"../../core/interfaces/ApiResponseInterface\";\n\nexport interface UseJsonApiGetOptions {\n /**\n * Whether to enable the query. If false, the query won't run.\n */\n enabled?: boolean;\n /**\n * Dependencies that trigger a refetch when changed.\n */\n deps?: any[];\n}\n\nexport interface UseJsonApiGetResult<T> {\n /**\n * The fetched data, or null if not yet fetched.\n */\n data: T | null;\n /**\n * Whether the query is currently loading.\n */\n loading: boolean;\n /**\n * Error message if the query failed.\n */\n error: string | null;\n /**\n * The full API response (includes raw data, pagination, etc.)\n */\n response: ApiResponseInterface | null;\n /**\n * Function to manually refetch the data.\n */\n refetch: () => Promise<void>;\n /**\n * Whether there is a next page available.\n */\n hasNextPage: boolean;\n /**\n * Whether there is a previous page available.\n */\n hasPreviousPage: boolean;\n /**\n * Function to fetch the next page.\n */\n fetchNextPage: () => Promise<void>;\n /**\n * Function to fetch the previous page.\n */\n fetchPreviousPage: () => Promise<void>;\n}\n\n/**\n * Hook for fetching data from a JSON:API endpoint.\n *\n * @example\n * ```tsx\n * const { data, loading, error, refetch } = useJsonApiGet<Article>({\n * classKey: Modules.Article,\n * endpoint: `/articles/${id}`,\n * });\n *\n * if (loading) return <Loading />;\n * if (error) return <Error message={error} />;\n * return <ArticleView article={data} />;\n * ```\n */\nexport function useJsonApiGet<T extends ApiDataInterface>(params: {\n classKey: ApiRequestDataTypeInterface;\n endpoint: string;\n companyId?: string;\n options?: UseJsonApiGetOptions;\n}): UseJsonApiGetResult<T> {\n const [data, setData] = useState<T | null>(null);\n const [loading, setLoading] = useState(false);\n const [error, setError] = useState<string | null>(null);\n const [response, setResponse] = useState<ApiResponseInterface | null>(null);\n const isMounted = useRef(true);\n\n const fetchData = useCallback(async () => {\n if (params.options?.enabled === false) return;\n\n setLoading(true);\n setError(null);\n\n try {\n const { JsonApiGet } = await import(\"../../unified/JsonApiRequest\");\n const language = navigator.language.split(\"-\")[0] || \"en\";\n\n const apiResponse = await JsonApiGet({\n classKey: params.classKey,\n endpoint: params.endpoint,\n companyId: params.companyId,\n language,\n });\n\n if (!isMounted.current) return;\n\n setResponse(apiResponse);\n\n if (apiResponse.ok) {\n setData(apiResponse.data as T);\n } else {\n setError(apiResponse.error);\n }\n } catch (err) {\n if (!isMounted.current) return;\n setError(err instanceof Error ? err.message : \"Unknown error\");\n } finally {\n if (isMounted.current) {\n setLoading(false);\n }\n }\n }, [params.classKey, params.endpoint, params.companyId, params.options?.enabled]);\n\n const fetchNextPage = useCallback(async () => {\n if (!response?.nextPage) return;\n\n setLoading(true);\n try {\n const nextResponse = await response.nextPage();\n if (!isMounted.current) return;\n\n setResponse(nextResponse);\n if (nextResponse.ok) {\n setData(nextResponse.data as T);\n } else {\n setError(nextResponse.error);\n }\n } catch (err) {\n if (!isMounted.current) return;\n setError(err instanceof Error ? err.message : \"Unknown error\");\n } finally {\n if (isMounted.current) {\n setLoading(false);\n }\n }\n }, [response]);\n\n const fetchPreviousPage = useCallback(async () => {\n if (!response?.prevPage) return;\n\n setLoading(true);\n try {\n const prevResponse = await response.prevPage();\n if (!isMounted.current) return;\n\n setResponse(prevResponse);\n if (prevResponse.ok) {\n setData(prevResponse.data as T);\n } else {\n setError(prevResponse.error);\n }\n } catch (err) {\n if (!isMounted.current) return;\n setError(err instanceof Error ? err.message : \"Unknown error\");\n } finally {\n if (isMounted.current) {\n setLoading(false);\n }\n }\n }, [response]);\n\n useEffect(() => {\n isMounted.current = true;\n fetchData();\n return () => {\n isMounted.current = false;\n };\n }, [fetchData, ...(params.options?.deps || [])]);\n\n return {\n data,\n loading,\n error,\n response,\n refetch: fetchData,\n hasNextPage: !!response?.next,\n hasPreviousPage: !!response?.prev,\n fetchNextPage,\n fetchPreviousPage,\n };\n}\n","\"use client\";\n\nimport { useState, useCallback } from \"react\";\nimport { ApiDataInterface } from \"../../core/interfaces/ApiDataInterface\";\nimport { ApiRequestDataTypeInterface } from \"../../core/interfaces/ApiRequestDataTypeInterface\";\nimport { ApiResponseInterface } from \"../../core/interfaces/ApiResponseInterface\";\n\nexport type MutationMethod = \"POST\" | \"PUT\" | \"PATCH\" | \"DELETE\";\n\nexport interface UseJsonApiMutationResult<T> {\n /**\n * The result data from the mutation, or null if not yet executed.\n */\n data: T | null;\n /**\n * Whether the mutation is currently in progress.\n */\n loading: boolean;\n /**\n * Error message if the mutation failed.\n */\n error: string | null;\n /**\n * The full API response.\n */\n response: ApiResponseInterface | null;\n /**\n * Execute the mutation.\n */\n mutate: (params: MutationParams) => Promise<T | null>;\n /**\n * Reset the mutation state.\n */\n reset: () => void;\n}\n\nexport interface MutationParams {\n /**\n * The endpoint to call.\n */\n endpoint: string;\n /**\n * The request body.\n */\n body?: any;\n /**\n * Files to upload.\n */\n files?: { [key: string]: File | Blob } | File | Blob;\n /**\n * Company ID for multi-tenant requests.\n */\n companyId?: string;\n /**\n * Override the default JSON:API body creation.\n */\n overridesJsonApiCreation?: boolean;\n /**\n * Response type if different from the request type.\n */\n responseType?: ApiRequestDataTypeInterface;\n}\n\n/**\n * Hook for making mutations (POST, PUT, PATCH, DELETE) to a JSON:API endpoint.\n *\n * @example\n * ```tsx\n * const { mutate, loading, error } = useJsonApiMutation<Article>({\n * method: \"POST\",\n * classKey: Modules.Article,\n * });\n *\n * const handleSubmit = async (data: ArticleInput) => {\n * const result = await mutate({\n * endpoint: \"/articles\",\n * body: data,\n * });\n * if (result) {\n * // Success!\n * }\n * };\n * ```\n */\nexport function useJsonApiMutation<T extends ApiDataInterface>(config: {\n method: MutationMethod;\n classKey: ApiRequestDataTypeInterface;\n onSuccess?: (data: T) => void;\n onError?: (error: string) => void;\n}): UseJsonApiMutationResult<T> {\n const [data, setData] = useState<T | null>(null);\n const [loading, setLoading] = useState(false);\n const [error, setError] = useState<string | null>(null);\n const [response, setResponse] = useState<ApiResponseInterface | null>(null);\n\n const reset = useCallback(() => {\n setData(null);\n setLoading(false);\n setError(null);\n setResponse(null);\n }, []);\n\n const mutate = useCallback(\n async (params: MutationParams): Promise<T | null> => {\n setLoading(true);\n setError(null);\n\n try {\n const { JsonApiPost, JsonApiPut, JsonApiPatch, JsonApiDelete } = await import(\"../../unified/JsonApiRequest\");\n const language = navigator.language.split(\"-\")[0] || \"en\";\n\n let apiResponse: ApiResponseInterface;\n\n switch (config.method) {\n case \"POST\":\n apiResponse = await JsonApiPost({\n classKey: config.classKey,\n endpoint: params.endpoint,\n companyId: params.companyId,\n body: params.body,\n overridesJsonApiCreation: params.overridesJsonApiCreation,\n files: params.files,\n language,\n responseType: params.responseType,\n });\n break;\n case \"PUT\":\n apiResponse = await JsonApiPut({\n classKey: config.classKey,\n endpoint: params.endpoint,\n companyId: params.companyId,\n body: params.body,\n files: params.files,\n language,\n responseType: params.responseType,\n });\n break;\n case \"PATCH\":\n apiResponse = await JsonApiPatch({\n classKey: config.classKey,\n endpoint: params.endpoint,\n companyId: params.companyId,\n body: params.body,\n overridesJsonApiCreation: params.overridesJsonApiCreation,\n files: params.files,\n language,\n responseType: params.responseType,\n });\n break;\n case \"DELETE\":\n apiResponse = await JsonApiDelete({\n classKey: config.classKey,\n endpoint: params.endpoint,\n companyId: params.companyId,\n language,\n responseType: params.responseType,\n });\n break;\n }\n\n setResponse(apiResponse);\n\n if (apiResponse.ok) {\n const resultData = apiResponse.data as T;\n setData(resultData);\n config.onSuccess?.(resultData);\n return resultData;\n } else {\n setError(apiResponse.error);\n config.onError?.(apiResponse.error);\n return null;\n }\n } catch (err) {\n const errorMessage = err instanceof Error ? err.message : \"Unknown error\";\n setError(errorMessage);\n config.onError?.(errorMessage);\n return null;\n } finally {\n setLoading(false);\n }\n },\n [config],\n );\n\n return {\n data,\n loading,\n error,\n response,\n mutate,\n reset,\n };\n}\n","\"use client\";\n\nimport { useMemo } from \"react\";\nimport { ApiDataInterface } from \"../../core/interfaces/ApiDataInterface\";\nimport { ApiRequestDataTypeInterface } from \"../../core/interfaces/ApiRequestDataTypeInterface\";\nimport { JsonApiHydratedDataInterface } from \"../../core/interfaces/JsonApiHydratedDataInterface\";\nimport { RehydrationFactory } from \"../../core/factories/RehydrationFactory\";\n\n/**\n * Hook to rehydrate server-passed data into typed objects.\n * Use this when passing data from server components to client components.\n *\n * @example\n * ```tsx\n * // In server component\n * const article = await ArticleService.findOne(id);\n * return <ArticleDetails data={article.dehydrate()} />;\n *\n * // In client component\n * function ArticleDetails({ data }: { data: JsonApiHydratedDataInterface }) {\n * const article = useRehydration<Article>(Modules.Article, data);\n * return <div>{article.title}</div>;\n * }\n * ```\n */\nexport function useRehydration<T extends ApiDataInterface>(\n classKey: ApiRequestDataTypeInterface,\n data: JsonApiHydratedDataInterface | null | undefined,\n): T | null {\n return useMemo(() => {\n if (!data) return null;\n return RehydrationFactory.rehydrate<T>(classKey, data);\n }, [classKey, data]);\n}\n\n/**\n * Hook to rehydrate a list of server-passed data into typed objects.\n */\nexport function useRehydrationList<T extends ApiDataInterface>(\n classKey: ApiRequestDataTypeInterface,\n data: JsonApiHydratedDataInterface[] | null | undefined,\n): T[] {\n return useMemo(() => {\n if (!data || data.length === 0) return [];\n return RehydrationFactory.rehydrateList<T>(classKey, data);\n }, [classKey, data]);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/nextjs-jsonapi/nextjs-jsonapi/dist/client/index.js"],"names":[],"mappings":"AAAA,qFAAY;AACZ;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,uDAA6B;AAC7B;AACE;AACF,uDAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B;AACE;AACF,uDAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,6yBAAC","file":"/home/runner/work/nextjs-jsonapi/nextjs-jsonapi/dist/client/index.js"}
|