@carlonicora/nextjs-jsonapi 1.4.0 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +208 -127
- package/dist/{ApiResponseInterface-DDI7QQPR.d.ts → ApiResponseInterface-CfcC7pPC.d.mts} +11 -2
- package/dist/{ApiResponseInterface-BHN5D9r5.d.mts → ApiResponseInterface-DTBJaV5R.d.ts} +11 -2
- package/dist/{BlockNoteEditor-QV6ESIQA.js → BlockNoteEditor-7FM7B737.js} +19 -24
- package/dist/BlockNoteEditor-7FM7B737.js.map +1 -0
- package/dist/{BlockNoteEditor-U2IHUVUF.mjs → BlockNoteEditor-RVL76ZAS.mjs} +11 -16
- package/dist/BlockNoteEditor-RVL76ZAS.mjs.map +1 -0
- package/dist/JsonApiRequest-KOKGVPBI.js +25 -0
- package/dist/{JsonApiRequest-UJ7FGIVI.js.map → JsonApiRequest-KOKGVPBI.js.map} +1 -1
- package/dist/{JsonApiRequest-6UR7DIAR.mjs → JsonApiRequest-VCCRO732.mjs} +2 -2
- package/dist/chunk-2Z56AS2S.js +2723 -0
- package/dist/chunk-2Z56AS2S.js.map +1 -0
- package/dist/{chunk-HTLEKZND.mjs → chunk-37NJZ2VD.mjs} +281 -1019
- package/dist/chunk-37NJZ2VD.mjs.map +1 -0
- package/dist/{chunk-2K3Q24UF.js → chunk-3ZPK4QOB.js} +24 -14
- package/dist/chunk-3ZPK4QOB.js.map +1 -0
- package/dist/chunk-AGWQ75PQ.js +142 -0
- package/dist/chunk-AGWQ75PQ.js.map +1 -0
- package/dist/{chunk-32HM6MDD.js → chunk-CSM6AIAP.js} +1 -1
- package/dist/{chunk-32HM6MDD.js.map → chunk-CSM6AIAP.js.map} +1 -1
- package/dist/{chunk-IKBA4AHN.mjs → chunk-F4Y3GZG4.mjs} +3 -3
- package/dist/{chunk-YF5XQZDR.mjs → chunk-F5UNXZ3J.mjs} +1 -1
- package/dist/chunk-F5UNXZ3J.mjs.map +1 -0
- package/dist/chunk-IGOWVLJH.mjs +142 -0
- package/dist/chunk-IGOWVLJH.mjs.map +1 -0
- package/dist/{chunk-HAG77QBV.mjs → chunk-K4W5QXL5.mjs} +1 -1
- package/dist/chunk-KFL5ZFM4.mjs +2723 -0
- package/dist/chunk-KFL5ZFM4.mjs.map +1 -0
- package/dist/{chunk-HR4H2FP7.mjs → chunk-KJ4ETLJB.mjs} +24 -14
- package/dist/chunk-KJ4ETLJB.mjs.map +1 -0
- package/dist/chunk-LOSPCUCF.js +637 -0
- package/dist/chunk-LOSPCUCF.js.map +1 -0
- package/dist/{chunk-E2HRC2OG.js → chunk-SVX7E6RR.js} +10360 -6256
- package/dist/chunk-SVX7E6RR.js.map +1 -0
- package/dist/{chunk-EFJEWLRL.js → chunk-YUO55Q5A.js} +1 -1
- package/dist/chunk-YUO55Q5A.js.map +1 -0
- package/dist/chunk-ZQTFZKLJ.mjs +12089 -0
- package/dist/chunk-ZQTFZKLJ.mjs.map +1 -0
- package/dist/{chunk-PMXG5WBC.js → chunk-ZUEEIQHW.js} +3 -3
- package/dist/{chunk-PMXG5WBC.js.map → chunk-ZUEEIQHW.js.map} +1 -1
- package/dist/client/index.d.mts +161 -11
- package/dist/client/index.d.ts +161 -11
- package/dist/client/index.js +74 -12
- package/dist/client/index.js.map +1 -1
- package/dist/client/index.mjs +73 -11
- package/dist/components/index.d.mts +762 -73
- package/dist/components/index.d.ts +762 -73
- package/dist/components/index.js +465 -12
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +466 -13
- package/dist/config-B43zxEvn.d.mts +69 -0
- package/dist/config-D2OUrI_G.d.ts +69 -0
- package/dist/content.fields-Ck5lkQ5d.d.mts +47 -0
- package/dist/content.fields-Ck5lkQ5d.d.ts +47 -0
- package/dist/{content.interface-C_PGZMuy.d.ts → content.interface-Bs8a7uW6.d.mts} +2 -3
- package/dist/{content.interface-D_WS6CrB.d.mts → content.interface-UtsJ-mzs.d.ts} +2 -3
- package/dist/contexts/index.d.mts +13 -6
- package/dist/contexts/index.d.ts +13 -6
- package/dist/contexts/index.js +10 -12
- package/dist/contexts/index.js.map +1 -1
- package/dist/contexts/index.mjs +9 -11
- package/dist/core/index.d.mts +539 -8
- package/dist/core/index.d.ts +539 -8
- package/dist/core/index.js +104 -2
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.mjs +105 -3
- package/dist/index.d.mts +131 -70
- package/dist/index.d.ts +131 -70
- package/dist/index.js +97 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +118 -28
- package/dist/notification.interface-BdcwkuQE.d.mts +228 -0
- package/dist/notification.interface-BdcwkuQE.d.ts +228 -0
- package/dist/request-GBLBPYFM.js +8 -0
- package/dist/request-GBLBPYFM.js.map +1 -0
- package/dist/request-XABCMU25.mjs +8 -0
- package/dist/{AbstractService-wLid8dB0.d.ts → s3.interface-D7ttGatc.d.ts} +36 -26
- package/dist/{AbstractService-BsY6W3Ej.d.mts → s3.interface-DlaMDRTn.d.mts} +36 -26
- package/dist/scripts/generate-web-module/generator.d.ts.map +1 -1
- package/dist/scripts/generate-web-module/generator.js +8 -5
- package/dist/scripts/generate-web-module/generator.js.map +1 -1
- package/dist/scripts/generate-web-module/index.js +1 -1
- package/dist/scripts/generate-web-module/index.js.map +1 -1
- package/dist/scripts/generate-web-module/templates/components/editor.template.js +8 -1
- package/dist/scripts/generate-web-module/templates/components/editor.template.js.map +1 -1
- package/dist/scripts/generate-web-module/transformers/parent-detector.d.ts +4 -3
- package/dist/scripts/generate-web-module/transformers/parent-detector.d.ts.map +1 -1
- package/dist/scripts/generate-web-module/transformers/parent-detector.js +9 -3
- package/dist/scripts/generate-web-module/transformers/parent-detector.js.map +1 -1
- package/dist/scripts/generate-web-module/transformers/relationship-resolver.d.ts +11 -0
- package/dist/scripts/generate-web-module/transformers/relationship-resolver.d.ts.map +1 -1
- package/dist/scripts/generate-web-module/transformers/relationship-resolver.js +36 -9
- package/dist/scripts/generate-web-module/transformers/relationship-resolver.js.map +1 -1
- package/dist/scripts/generate-web-module/types/json-schema.interface.d.ts +2 -0
- package/dist/scripts/generate-web-module/types/json-schema.interface.d.ts.map +1 -1
- package/dist/scripts/generate-web-module/types/template-data.interface.d.ts +1 -0
- package/dist/scripts/generate-web-module/types/template-data.interface.d.ts.map +1 -1
- package/dist/scripts/generate-web-module/utils/i18n-updater.d.ts +4 -3
- package/dist/scripts/generate-web-module/utils/i18n-updater.d.ts.map +1 -1
- package/dist/scripts/generate-web-module/utils/i18n-updater.js +9 -9
- package/dist/scripts/generate-web-module/utils/i18n-updater.js.map +1 -1
- package/dist/scripts/generate-web-module/validators/json-schema-validator.js +3 -3
- package/dist/scripts/generate-web-module/validators/json-schema-validator.js.map +1 -1
- package/dist/server/index.d.mts +299 -4
- package/dist/server/index.d.ts +299 -4
- package/dist/server/index.js +215 -5
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +214 -4
- package/dist/server/index.mjs.map +1 -1
- package/dist/token-2UWQJY5T.js +8 -0
- package/dist/token-2UWQJY5T.js.map +1 -0
- package/dist/token-EOK3N45S.mjs +8 -0
- package/dist/{useSocket-DzMKRKCA.d.ts → useSocket-8vwK_R_c.d.ts} +1 -1
- package/dist/{useSocket-Cn7fB_B1.d.mts → useSocket-BWJUXuOl.d.mts} +1 -1
- package/package.json +12 -52
- package/scripts/generate-web-module/generator.ts +8 -5
- package/scripts/generate-web-module/index.ts +1 -1
- package/scripts/generate-web-module/templates/components/editor.template.ts +7 -2
- package/scripts/generate-web-module/transformers/parent-detector.ts +10 -3
- package/scripts/generate-web-module/transformers/relationship-resolver.ts +36 -9
- package/scripts/generate-web-module/types/json-schema.interface.ts +2 -0
- package/scripts/generate-web-module/types/template-data.interface.ts +1 -0
- package/scripts/generate-web-module/utils/i18n-updater.ts +9 -9
- package/scripts/generate-web-module/validators/json-schema-validator.ts +3 -3
- package/src/client/JsonApiClient.ts +248 -0
- package/src/client/config.ts +78 -0
- package/src/client/index.ts +6 -1
- package/src/components/containers/TabsContainer.tsx +1 -1
- package/src/components/editors/BlockNoteEditor.tsx +3 -1
- package/src/components/index.ts +4 -0
- package/src/components/navigations/Breadcrumb.tsx +1 -1
- package/src/components/navigations/Header.tsx +2 -2
- package/src/contexts/CommonContext.tsx +1 -1
- package/src/contexts/SocketContext.tsx +1 -1
- package/src/contexts/index.ts +3 -0
- package/src/core/abstracts/ClientAbstractService.ts +255 -0
- package/src/core/abstracts/ServerAbstractService.ts +180 -0
- package/src/core/abstracts/index.ts +2 -0
- package/src/core/index.ts +32 -3
- package/src/discord/config.ts +15 -0
- package/src/discord/index.ts +1 -0
- package/src/features/auth/components/details/LandingComponent.tsx +2 -2
- package/src/features/auth/components/forms/AcceptInvitation.tsx +1 -1
- package/src/features/auth/components/forms/ActivateAccount.tsx +1 -1
- package/src/features/auth/components/forms/Cookies.tsx +2 -1
- package/src/features/auth/components/forms/ForgotPassword.tsx +1 -1
- package/src/features/auth/components/forms/Login.tsx +1 -1
- package/src/features/auth/components/forms/Logout.tsx +1 -1
- package/src/features/auth/components/forms/RefreshUser.tsx +2 -1
- package/src/features/auth/components/forms/Register.tsx +1 -1
- package/src/features/auth/components/forms/ResetPassword.tsx +1 -1
- package/src/features/auth/data/auth.service.ts +1 -1
- package/src/features/auth/data/index.ts +0 -1
- package/src/features/auth/utils/AuthCookies.ts +1 -1
- package/src/features/company/components/forms/CompanyConfigurationEditor.tsx +4 -2
- package/src/features/company/components/forms/CompanyDeleter.tsx +2 -1
- package/src/features/company/components/forms/CompanyEditor.tsx +6 -3
- package/src/features/company/components/forms/CompanyLicense.tsx +4 -2
- package/src/features/company/components/lists/CompaniesList.tsx +2 -1
- package/src/features/company/data/index.ts +0 -1
- package/src/features/content/components/lists/ContentsListById.tsx +2 -1
- package/src/features/content/components/lists/RelevantContentsList.tsx +2 -1
- package/src/features/content/data/index.ts +0 -1
- package/src/features/feature/data/index.ts +0 -1
- package/src/features/notification/components/lists/NotificationsList.tsx +2 -1
- package/src/features/notification/contexts/NotificationContext.tsx +2 -1
- package/src/features/notification/data/index.ts +0 -1
- package/src/features/push/data/index.ts +0 -1
- package/src/features/role/components/forms/RemoveUserFromRole.tsx +4 -2
- package/src/features/role/components/forms/UserRoleAdd.tsx +2 -1
- package/src/features/role/components/lists/RolesList.tsx +2 -1
- package/src/features/role/components/lists/UserRolesList.tsx +2 -1
- package/src/features/role/data/index.ts +0 -1
- package/src/features/s3/data/index.ts +0 -1
- package/src/features/user/components/forms/RoleUserAdd.tsx +4 -2
- package/src/features/user/components/forms/UserDeleter.tsx +2 -1
- package/src/features/user/components/forms/UserEditor.tsx +6 -3
- package/src/features/user/components/forms/UserMultiSelect.tsx +2 -1
- package/src/features/user/components/forms/UserReactivator.tsx +2 -1
- package/src/features/user/components/forms/UserResentInvitationEmail.tsx +2 -1
- package/src/features/user/components/forms/UserSelector.tsx +2 -1
- package/src/features/user/components/lists/AdminUsersList.tsx +2 -1
- package/src/features/user/components/lists/CompanyUsersList.tsx +2 -1
- package/src/features/user/components/lists/RelevantUsersList.tsx +2 -1
- package/src/features/user/components/lists/RoleUsersList.tsx +2 -1
- package/src/features/user/components/lists/UsersListByContentIds.tsx +2 -1
- package/src/features/user/data/index.ts +0 -1
- package/src/features/user/hooks/useUserSearch.ts +2 -1
- package/src/features/user/index.ts +1 -0
- package/src/hooks/useDataListRetriever.ts +4 -4
- package/src/hooks/usePageTracker.ts +1 -1
- package/src/hooks/usePushNotifications.ts +3 -2
- package/src/hooks/useSocket.ts +1 -1
- package/src/index.ts +7 -2
- package/src/roles/config.ts +0 -15
- package/src/roles/index.ts +1 -9
- package/src/server/JsonApiServer.ts +249 -0
- package/src/server/cache.ts +1 -1
- package/src/server/index.ts +13 -0
- package/src/server/request.ts +32 -18
- package/src/server/token.ts +1 -1
- package/dist/ApiData-DPKNfY-9.d.mts +0 -10
- package/dist/ApiData-DPKNfY-9.d.ts +0 -10
- package/dist/ApiDataInterface-DPP8s46n.d.mts +0 -21
- package/dist/ApiDataInterface-DPP8s46n.d.ts +0 -21
- package/dist/BlockNoteEditor-QV6ESIQA.js.map +0 -1
- package/dist/BlockNoteEditor-U2IHUVUF.mjs.map +0 -1
- package/dist/JsonApiRequest-UJ7FGIVI.js +0 -25
- package/dist/atoms/index.d.mts +0 -12
- package/dist/atoms/index.d.ts +0 -12
- package/dist/atoms/index.js +0 -9
- package/dist/atoms/index.js.map +0 -1
- package/dist/atoms/index.mjs +0 -9
- package/dist/chunk-2K3Q24UF.js.map +0 -1
- package/dist/chunk-3FBCC4G3.js +0 -8
- package/dist/chunk-3FBCC4G3.js.map +0 -1
- package/dist/chunk-3UELCPIN.js +0 -46
- package/dist/chunk-3UELCPIN.js.map +0 -1
- package/dist/chunk-5IET37O4.js +0 -4210
- package/dist/chunk-5IET37O4.js.map +0 -1
- package/dist/chunk-AYHKQWHH.js +0 -68
- package/dist/chunk-AYHKQWHH.js.map +0 -1
- package/dist/chunk-DEYKTLA3.js +0 -1131
- package/dist/chunk-DEYKTLA3.js.map +0 -1
- package/dist/chunk-E2HRC2OG.js.map +0 -1
- package/dist/chunk-EFJEWLRL.js.map +0 -1
- package/dist/chunk-FMBQZAIP.mjs +0 -490
- package/dist/chunk-FMBQZAIP.mjs.map +0 -1
- package/dist/chunk-HR4H2FP7.mjs.map +0 -1
- package/dist/chunk-HTLEKZND.mjs.map +0 -1
- package/dist/chunk-JGFWIT2E.mjs +0 -1131
- package/dist/chunk-JGFWIT2E.mjs.map +0 -1
- package/dist/chunk-P2F54I7Q.mjs +0 -4210
- package/dist/chunk-P2F54I7Q.mjs.map +0 -1
- package/dist/chunk-PO5Q3H5I.js +0 -1375
- package/dist/chunk-PO5Q3H5I.js.map +0 -1
- package/dist/chunk-Q2N6SQYW.mjs +0 -8
- package/dist/chunk-Q2N6SQYW.mjs.map +0 -1
- package/dist/chunk-Q4FXESVT.js +0 -490
- package/dist/chunk-Q4FXESVT.js.map +0 -1
- package/dist/chunk-R2ONK22M.mjs +0 -7985
- package/dist/chunk-R2ONK22M.mjs.map +0 -1
- package/dist/chunk-SM63SZCP.mjs +0 -68
- package/dist/chunk-SM63SZCP.mjs.map +0 -1
- package/dist/chunk-SZZYEG3P.mjs +0 -46
- package/dist/chunk-SZZYEG3P.mjs.map +0 -1
- package/dist/chunk-YF5XQZDR.mjs.map +0 -1
- package/dist/config-BmnK65TD.d.mts +0 -35
- package/dist/config-BmnK65TD.d.ts +0 -35
- package/dist/config-DQeAo9Kf.d.mts +0 -49
- package/dist/config-DQeAo9Kf.d.ts +0 -49
- package/dist/content.fields-cHPdM8GJ.d.mts +0 -27
- package/dist/content.fields-cHPdM8GJ.d.ts +0 -27
- package/dist/d3.link.interface-ClC4Irqp.d.mts +0 -21
- package/dist/d3.link.interface-ClC4Irqp.d.ts +0 -21
- package/dist/features/index.d.mts +0 -476
- package/dist/features/index.d.ts +0 -476
- package/dist/features/index.js +0 -87
- package/dist/features/index.js.map +0 -1
- package/dist/features/index.mjs +0 -87
- package/dist/hooks/index.d.mts +0 -69
- package/dist/hooks/index.d.ts +0 -69
- package/dist/hooks/index.js +0 -56
- package/dist/hooks/index.js.map +0 -1
- package/dist/hooks/index.mjs +0 -56
- package/dist/hooks/index.mjs.map +0 -1
- package/dist/interfaces/index.d.mts +0 -4
- package/dist/interfaces/index.d.ts +0 -4
- package/dist/interfaces/index.js +0 -2
- package/dist/interfaces/index.js.map +0 -1
- package/dist/interfaces/index.mjs +0 -2
- package/dist/interfaces/index.mjs.map +0 -1
- package/dist/notification.interface-BBgMUdLR.d.mts +0 -14
- package/dist/notification.interface-gyvT-Z2F.d.ts +0 -14
- package/dist/permissions/index.d.mts +0 -41
- package/dist/permissions/index.d.ts +0 -41
- package/dist/permissions/index.js +0 -14
- package/dist/permissions/index.js.map +0 -1
- package/dist/permissions/index.mjs +0 -14
- package/dist/permissions/index.mjs.map +0 -1
- package/dist/request-7FE3LJLV.mjs +0 -9
- package/dist/request-7FE3LJLV.mjs.map +0 -1
- package/dist/request-QFS7NEIE.js +0 -9
- package/dist/request-QFS7NEIE.js.map +0 -1
- package/dist/roles/index.d.mts +0 -39
- package/dist/roles/index.d.ts +0 -39
- package/dist/roles/index.js +0 -18
- package/dist/roles/index.js.map +0 -1
- package/dist/roles/index.mjs +0 -18
- package/dist/roles/index.mjs.map +0 -1
- package/dist/shadcnui/index.d.mts +0 -698
- package/dist/shadcnui/index.d.ts +0 -698
- package/dist/shadcnui/index.js +0 -468
- package/dist/shadcnui/index.js.map +0 -1
- package/dist/shadcnui/index.mjs +0 -467
- package/dist/shadcnui/index.mjs.map +0 -1
- package/dist/token-IJSPOMW6.mjs +0 -9
- package/dist/token-IJSPOMW6.mjs.map +0 -1
- package/dist/token-UYE7CV6X.js +0 -9
- package/dist/token-UYE7CV6X.js.map +0 -1
- package/dist/types-B2QRyqyK.d.ts +0 -39
- package/dist/types-CgvNmxTd.d.mts +0 -39
- package/dist/types-t2PyXhDu.d.mts +0 -116
- package/dist/types-t2PyXhDu.d.ts +0 -116
- package/dist/user.interface-CAsTIbuQ.d.mts +0 -85
- package/dist/user.interface-CbWqMaaU.d.ts +0 -85
- package/dist/utils/index.d.mts +0 -224
- package/dist/utils/index.d.ts +0 -224
- package/dist/utils/index.js +0 -46
- package/dist/utils/index.js.map +0 -1
- package/dist/utils/index.mjs +0 -46
- package/dist/utils/index.mjs.map +0 -1
- /package/dist/{JsonApiRequest-6UR7DIAR.mjs.map → JsonApiRequest-VCCRO732.mjs.map} +0 -0
- /package/dist/{chunk-IKBA4AHN.mjs.map → chunk-F4Y3GZG4.mjs.map} +0 -0
- /package/dist/{chunk-HAG77QBV.mjs.map → chunk-K4W5QXL5.mjs.map} +0 -0
- /package/dist/{atoms/index.mjs.map → request-XABCMU25.mjs.map} +0 -0
- /package/dist/{features/index.mjs.map → token-EOK3N45S.mjs.map} +0 -0
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* i18n Updater
|
|
3
3
|
*
|
|
4
|
-
* Updates the messages/
|
|
4
|
+
* Updates the messages/{language}.json files with new module translations.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import * as fs from "fs";
|
|
8
8
|
import { FrontendTemplateData } from "../types/template-data.interface";
|
|
9
9
|
import { buildI18nMessages } from "../transformers/i18n-generator";
|
|
10
10
|
|
|
11
|
-
const MESSAGES_PATH = "apps/web/messages/en.json";
|
|
12
|
-
|
|
13
11
|
export interface I18nUpdateResult {
|
|
14
12
|
success: boolean;
|
|
15
13
|
message: string;
|
|
@@ -17,20 +15,22 @@ export interface I18nUpdateResult {
|
|
|
17
15
|
}
|
|
18
16
|
|
|
19
17
|
/**
|
|
20
|
-
* Update messages/
|
|
18
|
+
* Update messages/{language}.json with new module translations
|
|
21
19
|
*
|
|
22
20
|
* @param data - Frontend template data
|
|
23
21
|
* @param webBasePath - Base path to web app
|
|
22
|
+
* @param language - Language code (e.g., "en", "es", "fr")
|
|
24
23
|
* @param dryRun - Whether to perform a dry run
|
|
25
24
|
* @returns Update result
|
|
26
25
|
*/
|
|
27
26
|
export function updateI18n(
|
|
28
27
|
data: FrontendTemplateData,
|
|
29
28
|
webBasePath: string,
|
|
29
|
+
language: string = "en",
|
|
30
30
|
dryRun: boolean = false
|
|
31
31
|
): I18nUpdateResult {
|
|
32
32
|
const { names, i18nKeys } = data;
|
|
33
|
-
const messagesPath = `${webBasePath}/${
|
|
33
|
+
const messagesPath = `${webBasePath}/apps/web/messages/${language}.json`;
|
|
34
34
|
|
|
35
35
|
// Check if file exists
|
|
36
36
|
if (!fs.existsSync(messagesPath)) {
|
|
@@ -48,7 +48,7 @@ export function updateI18n(
|
|
|
48
48
|
} catch (e) {
|
|
49
49
|
return {
|
|
50
50
|
success: false,
|
|
51
|
-
message: `Failed to parse messages
|
|
51
|
+
message: `Failed to parse messages/${language}.json: ${e}`,
|
|
52
52
|
};
|
|
53
53
|
}
|
|
54
54
|
|
|
@@ -56,7 +56,7 @@ export function updateI18n(
|
|
|
56
56
|
if (messages.features && messages.features[names.camelCase]) {
|
|
57
57
|
return {
|
|
58
58
|
success: true,
|
|
59
|
-
message: `Module ${names.camelCase} already exists in messages
|
|
59
|
+
message: `Module ${names.camelCase} already exists in messages/${language}.json`,
|
|
60
60
|
alreadyExists: true,
|
|
61
61
|
};
|
|
62
62
|
}
|
|
@@ -82,7 +82,7 @@ export function updateI18n(
|
|
|
82
82
|
if (dryRun) {
|
|
83
83
|
return {
|
|
84
84
|
success: true,
|
|
85
|
-
message: `[DRY RUN] Would update messages
|
|
85
|
+
message: `[DRY RUN] Would update messages/${language}.json with ${names.camelCase} translations`,
|
|
86
86
|
};
|
|
87
87
|
}
|
|
88
88
|
|
|
@@ -92,7 +92,7 @@ export function updateI18n(
|
|
|
92
92
|
|
|
93
93
|
return {
|
|
94
94
|
success: true,
|
|
95
|
-
message: `Updated messages
|
|
95
|
+
message: `Updated messages/${language}.json with ${names.camelCase} translations`,
|
|
96
96
|
};
|
|
97
97
|
}
|
|
98
98
|
|
|
@@ -134,11 +134,11 @@ export function validateJsonSchema(schema: any): ValidationError[] {
|
|
|
134
134
|
});
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
-
// Directory should be features or
|
|
138
|
-
if (rel.directory && !["features", "foundations"].includes(rel.directory)) {
|
|
137
|
+
// Directory should be features, foundations, or @foundation (for package imports)
|
|
138
|
+
if (rel.directory && !["features", "foundations", "@foundation"].includes(rel.directory) && !rel.directory.startsWith("@foundation/")) {
|
|
139
139
|
errors.push({
|
|
140
140
|
field: `relationships[${index}].directory`,
|
|
141
|
-
message: 'Relationship directory should be "features" or "
|
|
141
|
+
message: 'Relationship directory should be "features", "foundations", or "@foundation"',
|
|
142
142
|
severity: "warning",
|
|
143
143
|
});
|
|
144
144
|
}
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { JsonApiDataFactory } from "../core/factories/JsonApiDataFactory";
|
|
4
|
+
import { ApiRequestDataTypeInterface } from "../core/interfaces/ApiRequestDataTypeInterface";
|
|
5
|
+
import { ApiResponseInterface } from "../core/interfaces/ApiResponseInterface";
|
|
6
|
+
import { translateResponse } from "../core/utils/translateResponse";
|
|
7
|
+
import { ModuleWithPermissions } from "../permissions/types";
|
|
8
|
+
import { directFetch } from "./request";
|
|
9
|
+
import { getClientToken } from "./token";
|
|
10
|
+
|
|
11
|
+
// Config storage for client contexts
|
|
12
|
+
let _clientConfig: {
|
|
13
|
+
apiUrl: string;
|
|
14
|
+
appUrl?: string;
|
|
15
|
+
trackablePages?: ModuleWithPermissions[];
|
|
16
|
+
bootstrapper?: () => void;
|
|
17
|
+
additionalHeaders?: Record<string, string>;
|
|
18
|
+
} | null = null;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Configure the JSON:API client for browser contexts.
|
|
22
|
+
* Call this in your client-side initialization or use JsonApiProvider.
|
|
23
|
+
*/
|
|
24
|
+
export function configureClientJsonApi(config: {
|
|
25
|
+
apiUrl: string;
|
|
26
|
+
appUrl?: string;
|
|
27
|
+
trackablePages?: ModuleWithPermissions[];
|
|
28
|
+
bootstrapper?: () => void;
|
|
29
|
+
additionalHeaders?: Record<string, string>;
|
|
30
|
+
}): void {
|
|
31
|
+
_clientConfig = config;
|
|
32
|
+
if (config.bootstrapper) {
|
|
33
|
+
config.bootstrapper();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function getClientApiUrl(): string {
|
|
38
|
+
if (_clientConfig?.apiUrl) {
|
|
39
|
+
return _clientConfig.apiUrl;
|
|
40
|
+
}
|
|
41
|
+
const envUrl = process.env.NEXT_PUBLIC_API_URL;
|
|
42
|
+
if (!envUrl) {
|
|
43
|
+
throw new Error("API URL not configured. Use configureClientJsonApi() or set NEXT_PUBLIC_API_URL environment variable.");
|
|
44
|
+
}
|
|
45
|
+
return envUrl;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function getClientAppUrl(): string {
|
|
49
|
+
if (_clientConfig?.appUrl) {
|
|
50
|
+
return _clientConfig.appUrl;
|
|
51
|
+
}
|
|
52
|
+
const envUrl = process.env.NEXT_PUBLIC_ADDRESS;
|
|
53
|
+
if (!envUrl) {
|
|
54
|
+
throw new Error("App URL not configured. Use configureClientJsonApi({ appUrl }) or set NEXT_PUBLIC_ADDRESS environment variable.");
|
|
55
|
+
}
|
|
56
|
+
return envUrl.trim().replace(/\/+$/, "");
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export function getClientTrackablePages(): ModuleWithPermissions[] {
|
|
60
|
+
return _clientConfig?.trackablePages ?? [];
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function runClientBootstrapper(): void {
|
|
64
|
+
if (_clientConfig?.bootstrapper) {
|
|
65
|
+
_clientConfig.bootstrapper();
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function buildClientUrl(endpoint: string): string {
|
|
70
|
+
const apiUrl = getClientApiUrl();
|
|
71
|
+
return endpoint.startsWith("http") ? endpoint : `${apiUrl}${endpoint}`;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export async function ClientJsonApiGet(params: {
|
|
75
|
+
classKey: ApiRequestDataTypeInterface;
|
|
76
|
+
endpoint: string;
|
|
77
|
+
companyId?: string;
|
|
78
|
+
language: string;
|
|
79
|
+
}): Promise<ApiResponseInterface> {
|
|
80
|
+
runClientBootstrapper();
|
|
81
|
+
const token = await getClientToken();
|
|
82
|
+
|
|
83
|
+
const apiResponse = await directFetch({
|
|
84
|
+
method: "GET",
|
|
85
|
+
url: buildClientUrl(params.endpoint),
|
|
86
|
+
token,
|
|
87
|
+
companyId: params.companyId,
|
|
88
|
+
language: params.language,
|
|
89
|
+
additionalHeaders: _clientConfig?.additionalHeaders,
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
return translateResponse({
|
|
93
|
+
classKey: params.classKey,
|
|
94
|
+
apiResponse,
|
|
95
|
+
companyId: params.companyId,
|
|
96
|
+
language: params.language,
|
|
97
|
+
paginationHandler: async (endpoint: string) =>
|
|
98
|
+
ClientJsonApiGet({
|
|
99
|
+
classKey: params.classKey,
|
|
100
|
+
endpoint,
|
|
101
|
+
companyId: params.companyId,
|
|
102
|
+
language: params.language,
|
|
103
|
+
}),
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export async function ClientJsonApiPost(params: {
|
|
108
|
+
classKey: ApiRequestDataTypeInterface;
|
|
109
|
+
endpoint: string;
|
|
110
|
+
companyId?: string;
|
|
111
|
+
body?: any;
|
|
112
|
+
overridesJsonApiCreation?: boolean;
|
|
113
|
+
files?: { [key: string]: File | Blob } | File | Blob;
|
|
114
|
+
language: string;
|
|
115
|
+
responseType?: ApiRequestDataTypeInterface;
|
|
116
|
+
}): Promise<ApiResponseInterface> {
|
|
117
|
+
runClientBootstrapper();
|
|
118
|
+
const token = await getClientToken();
|
|
119
|
+
|
|
120
|
+
let body = params.body;
|
|
121
|
+
if (!body) {
|
|
122
|
+
body = {};
|
|
123
|
+
} else if (params.overridesJsonApiCreation !== true) {
|
|
124
|
+
body = JsonApiDataFactory.create(params.classKey, body);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
const apiResponse = await directFetch({
|
|
128
|
+
method: "POST",
|
|
129
|
+
url: buildClientUrl(params.endpoint),
|
|
130
|
+
token,
|
|
131
|
+
body,
|
|
132
|
+
files: params.files,
|
|
133
|
+
companyId: params.companyId,
|
|
134
|
+
language: params.language,
|
|
135
|
+
additionalHeaders: _clientConfig?.additionalHeaders,
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
return translateResponse({
|
|
139
|
+
classKey: params.responseType ?? params.classKey,
|
|
140
|
+
apiResponse,
|
|
141
|
+
companyId: params.companyId,
|
|
142
|
+
language: params.language,
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export async function ClientJsonApiPut(params: {
|
|
147
|
+
classKey: ApiRequestDataTypeInterface;
|
|
148
|
+
endpoint: string;
|
|
149
|
+
companyId?: string;
|
|
150
|
+
body?: any;
|
|
151
|
+
files?: { [key: string]: File | Blob } | File | Blob;
|
|
152
|
+
language: string;
|
|
153
|
+
responseType?: ApiRequestDataTypeInterface;
|
|
154
|
+
}): Promise<ApiResponseInterface> {
|
|
155
|
+
runClientBootstrapper();
|
|
156
|
+
const token = await getClientToken();
|
|
157
|
+
|
|
158
|
+
let body = params.body;
|
|
159
|
+
if (!body) {
|
|
160
|
+
body = {};
|
|
161
|
+
} else {
|
|
162
|
+
body = JsonApiDataFactory.create(params.classKey, body);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
const apiResponse = await directFetch({
|
|
166
|
+
method: "PUT",
|
|
167
|
+
url: buildClientUrl(params.endpoint),
|
|
168
|
+
token,
|
|
169
|
+
body,
|
|
170
|
+
files: params.files,
|
|
171
|
+
companyId: params.companyId,
|
|
172
|
+
language: params.language,
|
|
173
|
+
additionalHeaders: _clientConfig?.additionalHeaders,
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
return translateResponse({
|
|
177
|
+
classKey: params.responseType ?? params.classKey,
|
|
178
|
+
apiResponse,
|
|
179
|
+
companyId: params.companyId,
|
|
180
|
+
language: params.language,
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
export async function ClientJsonApiPatch(params: {
|
|
185
|
+
classKey: ApiRequestDataTypeInterface;
|
|
186
|
+
endpoint: string;
|
|
187
|
+
companyId?: string;
|
|
188
|
+
body?: any;
|
|
189
|
+
files?: { [key: string]: File | Blob } | File | Blob;
|
|
190
|
+
overridesJsonApiCreation?: boolean;
|
|
191
|
+
responseType?: ApiRequestDataTypeInterface;
|
|
192
|
+
language: string;
|
|
193
|
+
}): Promise<ApiResponseInterface> {
|
|
194
|
+
runClientBootstrapper();
|
|
195
|
+
const token = await getClientToken();
|
|
196
|
+
|
|
197
|
+
let body = params.body;
|
|
198
|
+
if (!body) {
|
|
199
|
+
body = {};
|
|
200
|
+
} else if (params.overridesJsonApiCreation !== true) {
|
|
201
|
+
body = JsonApiDataFactory.create(params.classKey, body);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
const apiResponse = await directFetch({
|
|
205
|
+
method: "PATCH",
|
|
206
|
+
url: buildClientUrl(params.endpoint),
|
|
207
|
+
token,
|
|
208
|
+
body,
|
|
209
|
+
files: params.files,
|
|
210
|
+
companyId: params.companyId,
|
|
211
|
+
language: params.language,
|
|
212
|
+
additionalHeaders: _clientConfig?.additionalHeaders,
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
return translateResponse({
|
|
216
|
+
classKey: params.responseType ?? params.classKey,
|
|
217
|
+
apiResponse,
|
|
218
|
+
companyId: params.companyId,
|
|
219
|
+
language: params.language,
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
export async function ClientJsonApiDelete(params: {
|
|
224
|
+
classKey: ApiRequestDataTypeInterface;
|
|
225
|
+
endpoint: string;
|
|
226
|
+
companyId?: string;
|
|
227
|
+
language: string;
|
|
228
|
+
responseType?: ApiRequestDataTypeInterface;
|
|
229
|
+
}): Promise<ApiResponseInterface> {
|
|
230
|
+
runClientBootstrapper();
|
|
231
|
+
const token = await getClientToken();
|
|
232
|
+
|
|
233
|
+
const apiResponse = await directFetch({
|
|
234
|
+
method: "DELETE",
|
|
235
|
+
url: buildClientUrl(params.endpoint),
|
|
236
|
+
token,
|
|
237
|
+
companyId: params.companyId,
|
|
238
|
+
language: params.language,
|
|
239
|
+
additionalHeaders: _clientConfig?.additionalHeaders,
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
return translateResponse({
|
|
243
|
+
classKey: params.responseType ?? params.classKey,
|
|
244
|
+
apiResponse,
|
|
245
|
+
companyId: params.companyId,
|
|
246
|
+
language: params.language,
|
|
247
|
+
});
|
|
248
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { ModuleWithPermissions } from "../permissions/types";
|
|
4
|
+
|
|
5
|
+
// Config storage for client-side contexts
|
|
6
|
+
let _clientConfig: {
|
|
7
|
+
apiUrl: string;
|
|
8
|
+
appUrl?: string;
|
|
9
|
+
trackablePages?: ModuleWithPermissions[];
|
|
10
|
+
bootstrapper?: () => void;
|
|
11
|
+
additionalHeaders?: Record<string, string>;
|
|
12
|
+
} | null = null;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Configure the JSON:API client. This is the main configuration function.
|
|
16
|
+
* This is typically called during app initialization.
|
|
17
|
+
*/
|
|
18
|
+
export function configureJsonApi(config: {
|
|
19
|
+
apiUrl: string;
|
|
20
|
+
appUrl?: string;
|
|
21
|
+
trackablePages?: ModuleWithPermissions[];
|
|
22
|
+
bootstrapper?: () => void;
|
|
23
|
+
additionalHeaders?: Record<string, string>;
|
|
24
|
+
}): void {
|
|
25
|
+
_clientConfig = config;
|
|
26
|
+
// Call bootstrapper immediately to register all modules
|
|
27
|
+
if (config.bootstrapper) {
|
|
28
|
+
config.bootstrapper();
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Configure the client config. This is typically called during app initialization.
|
|
34
|
+
* @deprecated Use configureJsonApi instead
|
|
35
|
+
*/
|
|
36
|
+
export function configureClientConfig(config: {
|
|
37
|
+
apiUrl: string;
|
|
38
|
+
appUrl?: string;
|
|
39
|
+
trackablePages?: ModuleWithPermissions[];
|
|
40
|
+
}): void {
|
|
41
|
+
_clientConfig = config;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Get the configured API URL.
|
|
46
|
+
*/
|
|
47
|
+
export function getApiUrl(): string {
|
|
48
|
+
if (_clientConfig?.apiUrl) {
|
|
49
|
+
return _clientConfig.apiUrl;
|
|
50
|
+
}
|
|
51
|
+
if (typeof process !== "undefined" && process.env?.NEXT_PUBLIC_API_URL) {
|
|
52
|
+
return process.env.NEXT_PUBLIC_API_URL;
|
|
53
|
+
}
|
|
54
|
+
return "";
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Get the configured app URL.
|
|
59
|
+
*/
|
|
60
|
+
export function getAppUrl(): string {
|
|
61
|
+
if (_clientConfig?.appUrl) {
|
|
62
|
+
return _clientConfig.appUrl;
|
|
63
|
+
}
|
|
64
|
+
if (typeof process !== "undefined" && process.env?.NEXT_PUBLIC_APP_URL) {
|
|
65
|
+
return process.env.NEXT_PUBLIC_APP_URL;
|
|
66
|
+
}
|
|
67
|
+
if (typeof window !== "undefined") {
|
|
68
|
+
return window.location.origin;
|
|
69
|
+
}
|
|
70
|
+
return "";
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Get the configured trackable pages.
|
|
75
|
+
*/
|
|
76
|
+
export function getTrackablePages(): ModuleWithPermissions[] {
|
|
77
|
+
return _clientConfig?.trackablePages ?? [];
|
|
78
|
+
}
|
package/src/client/index.ts
CHANGED
|
@@ -3,12 +3,17 @@
|
|
|
3
3
|
// Context and Provider
|
|
4
4
|
export * from "./context";
|
|
5
5
|
|
|
6
|
-
//
|
|
6
|
+
// Client-side hooks
|
|
7
7
|
export * from "./hooks";
|
|
8
8
|
|
|
9
9
|
// Client-side request utilities
|
|
10
10
|
export * from "./request";
|
|
11
11
|
export * from "./token";
|
|
12
|
+
export * from "./JsonApiClient";
|
|
13
|
+
export * from "./config";
|
|
14
|
+
|
|
15
|
+
// All hooks (merged from /hooks entry point)
|
|
16
|
+
export * from "../hooks";
|
|
12
17
|
|
|
13
18
|
// Table generator registration (must be in client-only context)
|
|
14
19
|
import { useCompanyTableStructure } from "../features/company/hooks";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { useCurrentUserContext } from "../../contexts";
|
|
4
|
-
import { UserInterface } from "../../features";
|
|
4
|
+
import { UserInterface } from "../../features/user/data";
|
|
5
5
|
import { Action, ModuleWithPermissions } from "../../permissions";
|
|
6
6
|
import { ScrollArea, Tabs, TabsContent, TabsList, TabsTrigger } from "../../shadcnui";
|
|
7
7
|
import { cn } from "../../utils";
|
|
@@ -8,7 +8,9 @@ import { CheckIcon, XIcon } from "lucide-react";
|
|
|
8
8
|
import { useTranslations } from "next-intl";
|
|
9
9
|
import React, { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
10
10
|
import { useCurrentUserContext } from "../../contexts";
|
|
11
|
-
import { S3Interface
|
|
11
|
+
import { S3Interface } from "../../features/s3/data";
|
|
12
|
+
import { UserInterface } from "../../features/user/data";
|
|
13
|
+
import { S3Service } from "../../features/s3/data/s3.service";
|
|
12
14
|
import { Button } from "../../shadcnui";
|
|
13
15
|
import { BlockNoteDiffUtil, BlockNoteWordDiffRendererUtil, cn } from "../../utils";
|
|
14
16
|
import { errorToast } from "../errors";
|
package/src/components/index.ts
CHANGED
|
@@ -8,6 +8,7 @@ export * from "./navigations";
|
|
|
8
8
|
export * from "./pages";
|
|
9
9
|
export * from "./tables";
|
|
10
10
|
|
|
11
|
+
// Feature components
|
|
11
12
|
export * from "../features/auth/components";
|
|
12
13
|
export * from "../features/company/components";
|
|
13
14
|
export * from "../features/content/components";
|
|
@@ -15,3 +16,6 @@ export * from "../features/feature/components";
|
|
|
15
16
|
export * from "../features/notification/components";
|
|
16
17
|
export * from "../features/role/components";
|
|
17
18
|
export * from "../features/user/components";
|
|
19
|
+
|
|
20
|
+
// shadcn/ui components (merged from /shadcnui entry point)
|
|
21
|
+
export * from "../shadcnui";
|
|
@@ -21,7 +21,7 @@ type BreadcrumbProps = { items: BreadcrumbItemData[] };
|
|
|
21
21
|
|
|
22
22
|
const ITEMS_TO_DISPLAY = 3;
|
|
23
23
|
|
|
24
|
-
export function
|
|
24
|
+
export function BreadcrumbNavigation({ items }: BreadcrumbProps) {
|
|
25
25
|
const generateUrl = usePageUrlGenerator();
|
|
26
26
|
const t = useTranslations();
|
|
27
27
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { useSharedContext } from "../../contexts/SharedContext";
|
|
4
4
|
import { SidebarTrigger } from "../../shadcnui";
|
|
5
|
-
import {
|
|
5
|
+
import { BreadcrumbNavigation } from "./Breadcrumb";
|
|
6
6
|
|
|
7
7
|
type HeaderProps = {
|
|
8
8
|
children?: React.ReactNode;
|
|
@@ -16,7 +16,7 @@ export function Header({ children }: HeaderProps) {
|
|
|
16
16
|
<div className="bg-sidebar flex h-12 w-full flex-row items-center justify-between pl-2 pr-4">
|
|
17
17
|
<SidebarTrigger aria-label="Toggle sidebar" />
|
|
18
18
|
<div className="flex w-full flex-row items-center justify-start">
|
|
19
|
-
<
|
|
19
|
+
<BreadcrumbNavigation items={breadcrumbs} />
|
|
20
20
|
</div>
|
|
21
21
|
<div className="flex w-64 flex-row items-center justify-end gap-x-4 whitespace-nowrap">
|
|
22
22
|
{children ? children : null}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { useTranslations } from "next-intl";
|
|
4
4
|
|
|
5
5
|
import { createContext, ReactNode, useContext } from "react";
|
|
6
|
-
import { UserInterface } from "../features";
|
|
6
|
+
import { UserInterface } from "../features/user/data";
|
|
7
7
|
import { useCurrentUserContext } from "../features/user/contexts";
|
|
8
8
|
import { BreadcrumbItemData } from "../interfaces";
|
|
9
9
|
import { SharedProvider } from "./SharedContext";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import React, { createContext, useContext } from "react";
|
|
4
|
-
import { NotificationInterface } from "../features";
|
|
4
|
+
import { NotificationInterface } from "../features/notification/data";
|
|
5
5
|
import { useSocket } from "../hooks";
|
|
6
6
|
|
|
7
7
|
interface SocketContextProps {
|