@carlonicora/nextjs-jsonapi 1.5.0 → 1.7.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/dist/{ApiResponseInterface-DDI7QQPR.d.ts → ApiResponseInterface-DMwITHYP.d.mts} +11 -2
- package/dist/{ApiResponseInterface-BHN5D9r5.d.mts → ApiResponseInterface-DWgIAXI-.d.ts} +11 -2
- package/dist/AuthComponent-hxOPs9o8.d.mts +11 -0
- package/dist/AuthComponent-hxOPs9o8.d.ts +11 -0
- package/dist/{BlockNoteEditor-G6AK2NWA.js → BlockNoteEditor-IJASTIUZ.js} +16 -23
- package/dist/BlockNoteEditor-IJASTIUZ.js.map +1 -0
- package/dist/{BlockNoteEditor-AIEEQM6A.mjs → BlockNoteEditor-M6TUP3NT.mjs} +8 -15
- package/dist/BlockNoteEditor-M6TUP3NT.mjs.map +1 -0
- package/dist/JsonApiRequest-2OM5NDAW.js +24 -0
- package/dist/JsonApiRequest-2OM5NDAW.js.map +1 -0
- package/dist/{JsonApiRequest-6UR7DIAR.mjs → JsonApiRequest-SYZ6FGCA.mjs} +2 -3
- package/dist/{chunk-2K3Q24UF.js → chunk-3ZPK4QOB.js} +24 -14
- package/dist/chunk-3ZPK4QOB.js.map +1 -0
- package/dist/{chunk-VET55IZO.js → chunk-4L7OWJ2P.js} +10290 -7537
- package/dist/chunk-4L7OWJ2P.js.map +1 -0
- package/dist/chunk-4U5CJA44.mjs +3435 -0
- package/dist/chunk-4U5CJA44.mjs.map +1 -0
- package/dist/chunk-AGWQ75PQ.js +142 -0
- package/dist/chunk-AGWQ75PQ.js.map +1 -0
- package/dist/{chunk-PMXG5WBC.js → chunk-CKS6SVUK.js} +160 -24
- package/dist/chunk-CKS6SVUK.js.map +1 -0
- 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-HR4H2FP7.mjs → chunk-KJ4ETLJB.mjs} +24 -14
- package/dist/chunk-KJ4ETLJB.mjs.map +1 -0
- package/dist/{chunk-IKBA4AHN.mjs → chunk-SAL7XW2G.mjs} +143 -7
- package/dist/chunk-SAL7XW2G.mjs.map +1 -0
- package/dist/chunk-TW4QRJ7D.mjs +12085 -0
- package/dist/chunk-TW4QRJ7D.mjs.map +1 -0
- package/dist/chunk-U4NADAHN.js +3435 -0
- package/dist/chunk-U4NADAHN.js.map +1 -0
- package/dist/{chunk-EFJEWLRL.js → chunk-YUO55Q5A.js} +1 -1
- package/dist/chunk-YUO55Q5A.js.map +1 -0
- package/dist/client/index.d.mts +161 -11
- package/dist/client/index.d.ts +161 -11
- package/dist/client/index.js +71 -11
- package/dist/client/index.js.map +1 -1
- package/dist/client/index.mjs +70 -10
- package/dist/components/index.d.mts +763 -11
- package/dist/components/index.d.ts +763 -11
- package/dist/components/index.js +462 -11
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +463 -12
- package/dist/config-BdCV25CE.d.mts +69 -0
- package/dist/config-C9dt1QiR.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-CR2aBeAW.d.ts → content.interface-B6qP_ABq.d.mts} +2 -3
- package/dist/{content.interface-FpLfsaRm.d.mts → content.interface-DHAFLasV.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 +7 -11
- package/dist/contexts/index.js.map +1 -1
- package/dist/contexts/index.mjs +6 -10
- package/dist/core/index.d.mts +575 -8
- package/dist/core/index.d.ts +575 -8
- package/dist/core/index.js +131 -3
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.mjs +132 -4
- package/dist/index.d.mts +95 -71
- package/dist/index.d.ts +95 -71
- package/dist/index.js +113 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +135 -29
- package/dist/notification.interface-agcMYCkg.d.mts +228 -0
- package/dist/notification.interface-agcMYCkg.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/s3.service-DYnmymEd.d.mts +350 -0
- package/dist/s3.service-DyXjKTqr.d.ts +350 -0
- package/dist/server/index.d.mts +69 -4
- package/dist/server/index.d.ts +69 -4
- package/dist/server/index.js +211 -5
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +211 -5
- 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-L-An7_Mr.d.mts → useSocket-91s8M4Xd.d.mts} +1 -1
- package/dist/{useSocket-BV6yMdWS.d.ts → useSocket-DSR7vaXj.d.ts} +1 -1
- package/package.json +12 -52
- 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 +35 -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/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/content/components/lists/ContentsListById.tsx +2 -1
- package/src/features/content/components/lists/RelevantContentsList.tsx +2 -1
- package/src/features/notification/components/lists/NotificationsList.tsx +2 -1
- package/src/features/notification/contexts/NotificationContext.tsx +2 -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/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/hooks/useUserSearch.ts +2 -1
- 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/AbstractService-BsY6W3Ej.d.mts +0 -109
- package/dist/AbstractService-wLid8dB0.d.ts +0 -109
- 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/AuthComponent-B_Ps2Vb9.d.ts +0 -78
- package/dist/AuthComponent-CxnGgvoh.d.mts +0 -78
- package/dist/BlockNoteEditor-AIEEQM6A.mjs.map +0 -1
- package/dist/BlockNoteEditor-G6AK2NWA.js.map +0 -1
- package/dist/JsonApiRequest-UJ7FGIVI.js +0 -25
- package/dist/JsonApiRequest-UJ7FGIVI.js.map +0 -1
- 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-32HM6MDD.js +0 -98
- package/dist/chunk-32HM6MDD.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-AGAJMJ4T.js +0 -147
- package/dist/chunk-AGAJMJ4T.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-EFJEWLRL.js.map +0 -1
- package/dist/chunk-FMBQZAIP.mjs +0 -490
- package/dist/chunk-FMBQZAIP.mjs.map +0 -1
- package/dist/chunk-HAG77QBV.mjs +0 -98
- package/dist/chunk-HAG77QBV.mjs.map +0 -1
- package/dist/chunk-HR4H2FP7.mjs.map +0 -1
- package/dist/chunk-IKBA4AHN.mjs.map +0 -1
- package/dist/chunk-J7YDGYSW.mjs +0 -9332
- package/dist/chunk-J7YDGYSW.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-PMXG5WBC.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-RBIVEH2K.mjs +0 -147
- package/dist/chunk-RBIVEH2K.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-VET55IZO.js.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 -477
- package/dist/features/index.d.ts +0 -477
- package/dist/features/index.js +0 -108
- package/dist/features/index.js.map +0 -1
- package/dist/features/index.mjs +0 -108
- package/dist/hooks/index.d.mts +0 -69
- package/dist/hooks/index.d.ts +0 -69
- package/dist/hooks/index.js +0 -55
- package/dist/hooks/index.js.map +0 -1
- package/dist/hooks/index.mjs +0 -55
- 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-B2BrLoDA.d.mts +0 -14
- package/dist/notification.interface-DlZLnAfg.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-CooB1R79.d.mts +0 -85
- package/dist/user.interface-KnIT9pVY.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-SYZ6FGCA.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
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import { LucideIcon } from 'lucide-react';
|
|
2
|
+
|
|
3
|
+
interface JsonApiHydratedDataInterface {
|
|
4
|
+
jsonApi: any;
|
|
5
|
+
included: any[];
|
|
6
|
+
allData?: any[];
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
interface ApiDataInterface {
|
|
10
|
+
get included(): any[];
|
|
11
|
+
get type(): string;
|
|
12
|
+
get id(): string;
|
|
13
|
+
get createdAt(): Date;
|
|
14
|
+
get updatedAt(): Date;
|
|
15
|
+
get self(): string | undefined;
|
|
16
|
+
get jsonApi(): any;
|
|
17
|
+
generateApiUrl(params?: any): string;
|
|
18
|
+
dehydrate(): JsonApiHydratedDataInterface;
|
|
19
|
+
rehydrate(data: JsonApiHydratedDataInterface): this;
|
|
20
|
+
createJsonApi(data: any): any;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
type GetterKeys<T> = {
|
|
24
|
+
[K in keyof T]: T[K] extends () => any ? never : K;
|
|
25
|
+
}[keyof T];
|
|
26
|
+
type FieldSelector<T> = {
|
|
27
|
+
type: string;
|
|
28
|
+
fields: ReadonlyArray<GetterKeys<T>>;
|
|
29
|
+
};
|
|
30
|
+
declare function createJsonApiInclusion<T>(dataType: string, fields: ReadonlyArray<GetterKeys<T>>): FieldSelector<T>;
|
|
31
|
+
|
|
32
|
+
type ApiRequestDataTypeInterface = {
|
|
33
|
+
name: string;
|
|
34
|
+
cache?: string;
|
|
35
|
+
inclusions?: Record<string, {
|
|
36
|
+
types?: string[];
|
|
37
|
+
fields?: FieldSelector<any>[];
|
|
38
|
+
}>;
|
|
39
|
+
model: new () => any;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Permission actions
|
|
44
|
+
*/
|
|
45
|
+
declare enum Action {
|
|
46
|
+
Read = "read",
|
|
47
|
+
Create = "create",
|
|
48
|
+
Update = "update",
|
|
49
|
+
Delete = "delete"
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Generic permission check type.
|
|
53
|
+
* Can be a boolean or a function that checks permissions dynamically.
|
|
54
|
+
* @template T - The data type being checked
|
|
55
|
+
* @template U - The user type (defaults to PermissionUser)
|
|
56
|
+
*/
|
|
57
|
+
type PermissionCheck<T, U = PermissionUser> = boolean | ((user?: U | string, data?: T) => boolean);
|
|
58
|
+
/**
|
|
59
|
+
* Page URL configuration for modules
|
|
60
|
+
*/
|
|
61
|
+
type PageUrl = {
|
|
62
|
+
pageUrl?: string;
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* Module permission definition wrapper
|
|
66
|
+
*/
|
|
67
|
+
type ModulePermissionDefinition<T> = {
|
|
68
|
+
interface: T;
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Base module definition
|
|
72
|
+
*/
|
|
73
|
+
type ModuleDefinition = {
|
|
74
|
+
pageUrl?: string;
|
|
75
|
+
name: string;
|
|
76
|
+
model: any;
|
|
77
|
+
feature?: string;
|
|
78
|
+
moduleId?: string;
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* Permission configuration for a module.
|
|
82
|
+
* Can be a boolean (allow/deny all) or a string path for dynamic checks.
|
|
83
|
+
*/
|
|
84
|
+
interface PermissionConfig {
|
|
85
|
+
create: boolean | string;
|
|
86
|
+
read: boolean | string;
|
|
87
|
+
update: boolean | string;
|
|
88
|
+
delete: boolean | string;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Generic interface for a module that has permissions.
|
|
92
|
+
* Apps should ensure their Module class implements this.
|
|
93
|
+
*/
|
|
94
|
+
interface PermissionModule {
|
|
95
|
+
id: string;
|
|
96
|
+
permissions: PermissionConfig;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Generic interface for a user that has modules with permissions.
|
|
100
|
+
* Apps should ensure their User class implements this.
|
|
101
|
+
*/
|
|
102
|
+
interface PermissionUser {
|
|
103
|
+
id: string;
|
|
104
|
+
modules: PermissionModule[];
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Module definition with permissions - extends ApiRequestDataTypeInterface
|
|
108
|
+
*/
|
|
109
|
+
type ModuleWithPermissions = ApiRequestDataTypeInterface & {
|
|
110
|
+
pageUrl?: string;
|
|
111
|
+
feature?: string;
|
|
112
|
+
moduleId?: string;
|
|
113
|
+
icon?: LucideIcon;
|
|
114
|
+
inclusions?: Record<string, {
|
|
115
|
+
types?: string[];
|
|
116
|
+
fields?: FieldSelector<any>[];
|
|
117
|
+
}>;
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* Factory type for creating module definitions
|
|
121
|
+
*/
|
|
122
|
+
type ModuleFactory = (params: {
|
|
123
|
+
pageUrl?: string;
|
|
124
|
+
name: string;
|
|
125
|
+
cache?: string | "days" | "default" | "hours" | "max" | "minutes" | "seconds" | "weeks";
|
|
126
|
+
model: any;
|
|
127
|
+
feature?: string;
|
|
128
|
+
moduleId?: string;
|
|
129
|
+
icon?: LucideIcon;
|
|
130
|
+
inclusions?: Record<string, {
|
|
131
|
+
types?: string[];
|
|
132
|
+
fields?: FieldSelector<any>[];
|
|
133
|
+
}>;
|
|
134
|
+
}) => ModuleWithPermissions;
|
|
135
|
+
|
|
136
|
+
interface ModuleInterface extends ApiDataInterface {
|
|
137
|
+
get name(): string;
|
|
138
|
+
get isCore(): boolean;
|
|
139
|
+
get permissions(): {
|
|
140
|
+
create: boolean | string;
|
|
141
|
+
read: boolean | string;
|
|
142
|
+
update: boolean | string;
|
|
143
|
+
delete: boolean | string;
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
interface FeatureInterface extends ApiDataInterface {
|
|
148
|
+
get name(): string;
|
|
149
|
+
get isProduction(): boolean;
|
|
150
|
+
get modules(): ModuleInterface[];
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
type CompanyInput = {
|
|
154
|
+
id: string;
|
|
155
|
+
name?: string;
|
|
156
|
+
logo?: string;
|
|
157
|
+
configurations?: any;
|
|
158
|
+
license?: string;
|
|
159
|
+
privateKey?: string;
|
|
160
|
+
featureIds?: string[];
|
|
161
|
+
moduleIds?: string[];
|
|
162
|
+
};
|
|
163
|
+
interface CompanyInterface extends ApiDataInterface {
|
|
164
|
+
get name(): string;
|
|
165
|
+
get configurations(): any;
|
|
166
|
+
get logo(): string | undefined;
|
|
167
|
+
get logoUrl(): string | undefined;
|
|
168
|
+
get licenseExpirationDate(): Date | undefined;
|
|
169
|
+
get features(): FeatureInterface[];
|
|
170
|
+
get modules(): ModuleInterface[];
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
type RoleInput = {
|
|
174
|
+
id: string;
|
|
175
|
+
name: string;
|
|
176
|
+
description?: string;
|
|
177
|
+
};
|
|
178
|
+
interface RoleInterface extends ApiDataInterface {
|
|
179
|
+
get name(): string;
|
|
180
|
+
get description(): string;
|
|
181
|
+
get isSelectable(): boolean;
|
|
182
|
+
get requiredFeature(): FeatureInterface | undefined;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
type UserInput = {
|
|
186
|
+
id: string;
|
|
187
|
+
email?: string | undefined | null;
|
|
188
|
+
name?: string;
|
|
189
|
+
title?: string;
|
|
190
|
+
bio?: string;
|
|
191
|
+
password?: string | undefined;
|
|
192
|
+
roleIds?: string[];
|
|
193
|
+
sendInvitationEmail?: boolean;
|
|
194
|
+
companyId?: string;
|
|
195
|
+
adminCreated?: boolean;
|
|
196
|
+
avatar?: string;
|
|
197
|
+
phone?: string;
|
|
198
|
+
rate?: number;
|
|
199
|
+
};
|
|
200
|
+
interface UserInterface extends ApiDataInterface {
|
|
201
|
+
get email(): string;
|
|
202
|
+
get name(): string;
|
|
203
|
+
get title(): string;
|
|
204
|
+
get bio(): string;
|
|
205
|
+
get avatar(): string | undefined;
|
|
206
|
+
get avatarUrl(): string | undefined;
|
|
207
|
+
get phone(): string | undefined;
|
|
208
|
+
get rate(): number | undefined;
|
|
209
|
+
get isActivated(): boolean;
|
|
210
|
+
get isDeleted(): boolean;
|
|
211
|
+
get lastLogin(): Date | undefined;
|
|
212
|
+
get relevance(): number | undefined;
|
|
213
|
+
get roles(): RoleInterface[];
|
|
214
|
+
get company(): CompanyInterface | undefined;
|
|
215
|
+
get modules(): ModuleInterface[];
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
type NotificationInput = {
|
|
219
|
+
id: string;
|
|
220
|
+
isRead: boolean;
|
|
221
|
+
};
|
|
222
|
+
interface NotificationInterface extends ApiDataInterface {
|
|
223
|
+
get notificationType(): string;
|
|
224
|
+
get isRead(): boolean;
|
|
225
|
+
get actor(): UserInterface | undefined;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
export { type ApiDataInterface as A, type CompanyInput as C, type FieldSelector as F, type GetterKeys as G, type JsonApiHydratedDataInterface as J, type ModuleWithPermissions as M, type NotificationInterface as N, type PermissionCheck as P, type RoleInput as R, type UserInterface as U, type ApiRequestDataTypeInterface as a, Action as b, createJsonApiInclusion as c, type PageUrl as d, type ModulePermissionDefinition as e, type ModuleDefinition as f, type PermissionConfig as g, type PermissionModule as h, type PermissionUser as i, type ModuleFactory as j, type CompanyInterface as k, type FeatureInterface as l, type ModuleInterface as m, type NotificationInput as n, type RoleInterface as o, type UserInput as p };
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import { LucideIcon } from 'lucide-react';
|
|
2
|
+
|
|
3
|
+
interface JsonApiHydratedDataInterface {
|
|
4
|
+
jsonApi: any;
|
|
5
|
+
included: any[];
|
|
6
|
+
allData?: any[];
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
interface ApiDataInterface {
|
|
10
|
+
get included(): any[];
|
|
11
|
+
get type(): string;
|
|
12
|
+
get id(): string;
|
|
13
|
+
get createdAt(): Date;
|
|
14
|
+
get updatedAt(): Date;
|
|
15
|
+
get self(): string | undefined;
|
|
16
|
+
get jsonApi(): any;
|
|
17
|
+
generateApiUrl(params?: any): string;
|
|
18
|
+
dehydrate(): JsonApiHydratedDataInterface;
|
|
19
|
+
rehydrate(data: JsonApiHydratedDataInterface): this;
|
|
20
|
+
createJsonApi(data: any): any;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
type GetterKeys<T> = {
|
|
24
|
+
[K in keyof T]: T[K] extends () => any ? never : K;
|
|
25
|
+
}[keyof T];
|
|
26
|
+
type FieldSelector<T> = {
|
|
27
|
+
type: string;
|
|
28
|
+
fields: ReadonlyArray<GetterKeys<T>>;
|
|
29
|
+
};
|
|
30
|
+
declare function createJsonApiInclusion<T>(dataType: string, fields: ReadonlyArray<GetterKeys<T>>): FieldSelector<T>;
|
|
31
|
+
|
|
32
|
+
type ApiRequestDataTypeInterface = {
|
|
33
|
+
name: string;
|
|
34
|
+
cache?: string;
|
|
35
|
+
inclusions?: Record<string, {
|
|
36
|
+
types?: string[];
|
|
37
|
+
fields?: FieldSelector<any>[];
|
|
38
|
+
}>;
|
|
39
|
+
model: new () => any;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Permission actions
|
|
44
|
+
*/
|
|
45
|
+
declare enum Action {
|
|
46
|
+
Read = "read",
|
|
47
|
+
Create = "create",
|
|
48
|
+
Update = "update",
|
|
49
|
+
Delete = "delete"
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Generic permission check type.
|
|
53
|
+
* Can be a boolean or a function that checks permissions dynamically.
|
|
54
|
+
* @template T - The data type being checked
|
|
55
|
+
* @template U - The user type (defaults to PermissionUser)
|
|
56
|
+
*/
|
|
57
|
+
type PermissionCheck<T, U = PermissionUser> = boolean | ((user?: U | string, data?: T) => boolean);
|
|
58
|
+
/**
|
|
59
|
+
* Page URL configuration for modules
|
|
60
|
+
*/
|
|
61
|
+
type PageUrl = {
|
|
62
|
+
pageUrl?: string;
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* Module permission definition wrapper
|
|
66
|
+
*/
|
|
67
|
+
type ModulePermissionDefinition<T> = {
|
|
68
|
+
interface: T;
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Base module definition
|
|
72
|
+
*/
|
|
73
|
+
type ModuleDefinition = {
|
|
74
|
+
pageUrl?: string;
|
|
75
|
+
name: string;
|
|
76
|
+
model: any;
|
|
77
|
+
feature?: string;
|
|
78
|
+
moduleId?: string;
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* Permission configuration for a module.
|
|
82
|
+
* Can be a boolean (allow/deny all) or a string path for dynamic checks.
|
|
83
|
+
*/
|
|
84
|
+
interface PermissionConfig {
|
|
85
|
+
create: boolean | string;
|
|
86
|
+
read: boolean | string;
|
|
87
|
+
update: boolean | string;
|
|
88
|
+
delete: boolean | string;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Generic interface for a module that has permissions.
|
|
92
|
+
* Apps should ensure their Module class implements this.
|
|
93
|
+
*/
|
|
94
|
+
interface PermissionModule {
|
|
95
|
+
id: string;
|
|
96
|
+
permissions: PermissionConfig;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Generic interface for a user that has modules with permissions.
|
|
100
|
+
* Apps should ensure their User class implements this.
|
|
101
|
+
*/
|
|
102
|
+
interface PermissionUser {
|
|
103
|
+
id: string;
|
|
104
|
+
modules: PermissionModule[];
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Module definition with permissions - extends ApiRequestDataTypeInterface
|
|
108
|
+
*/
|
|
109
|
+
type ModuleWithPermissions = ApiRequestDataTypeInterface & {
|
|
110
|
+
pageUrl?: string;
|
|
111
|
+
feature?: string;
|
|
112
|
+
moduleId?: string;
|
|
113
|
+
icon?: LucideIcon;
|
|
114
|
+
inclusions?: Record<string, {
|
|
115
|
+
types?: string[];
|
|
116
|
+
fields?: FieldSelector<any>[];
|
|
117
|
+
}>;
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* Factory type for creating module definitions
|
|
121
|
+
*/
|
|
122
|
+
type ModuleFactory = (params: {
|
|
123
|
+
pageUrl?: string;
|
|
124
|
+
name: string;
|
|
125
|
+
cache?: string | "days" | "default" | "hours" | "max" | "minutes" | "seconds" | "weeks";
|
|
126
|
+
model: any;
|
|
127
|
+
feature?: string;
|
|
128
|
+
moduleId?: string;
|
|
129
|
+
icon?: LucideIcon;
|
|
130
|
+
inclusions?: Record<string, {
|
|
131
|
+
types?: string[];
|
|
132
|
+
fields?: FieldSelector<any>[];
|
|
133
|
+
}>;
|
|
134
|
+
}) => ModuleWithPermissions;
|
|
135
|
+
|
|
136
|
+
interface ModuleInterface extends ApiDataInterface {
|
|
137
|
+
get name(): string;
|
|
138
|
+
get isCore(): boolean;
|
|
139
|
+
get permissions(): {
|
|
140
|
+
create: boolean | string;
|
|
141
|
+
read: boolean | string;
|
|
142
|
+
update: boolean | string;
|
|
143
|
+
delete: boolean | string;
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
interface FeatureInterface extends ApiDataInterface {
|
|
148
|
+
get name(): string;
|
|
149
|
+
get isProduction(): boolean;
|
|
150
|
+
get modules(): ModuleInterface[];
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
type CompanyInput = {
|
|
154
|
+
id: string;
|
|
155
|
+
name?: string;
|
|
156
|
+
logo?: string;
|
|
157
|
+
configurations?: any;
|
|
158
|
+
license?: string;
|
|
159
|
+
privateKey?: string;
|
|
160
|
+
featureIds?: string[];
|
|
161
|
+
moduleIds?: string[];
|
|
162
|
+
};
|
|
163
|
+
interface CompanyInterface extends ApiDataInterface {
|
|
164
|
+
get name(): string;
|
|
165
|
+
get configurations(): any;
|
|
166
|
+
get logo(): string | undefined;
|
|
167
|
+
get logoUrl(): string | undefined;
|
|
168
|
+
get licenseExpirationDate(): Date | undefined;
|
|
169
|
+
get features(): FeatureInterface[];
|
|
170
|
+
get modules(): ModuleInterface[];
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
type RoleInput = {
|
|
174
|
+
id: string;
|
|
175
|
+
name: string;
|
|
176
|
+
description?: string;
|
|
177
|
+
};
|
|
178
|
+
interface RoleInterface extends ApiDataInterface {
|
|
179
|
+
get name(): string;
|
|
180
|
+
get description(): string;
|
|
181
|
+
get isSelectable(): boolean;
|
|
182
|
+
get requiredFeature(): FeatureInterface | undefined;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
type UserInput = {
|
|
186
|
+
id: string;
|
|
187
|
+
email?: string | undefined | null;
|
|
188
|
+
name?: string;
|
|
189
|
+
title?: string;
|
|
190
|
+
bio?: string;
|
|
191
|
+
password?: string | undefined;
|
|
192
|
+
roleIds?: string[];
|
|
193
|
+
sendInvitationEmail?: boolean;
|
|
194
|
+
companyId?: string;
|
|
195
|
+
adminCreated?: boolean;
|
|
196
|
+
avatar?: string;
|
|
197
|
+
phone?: string;
|
|
198
|
+
rate?: number;
|
|
199
|
+
};
|
|
200
|
+
interface UserInterface extends ApiDataInterface {
|
|
201
|
+
get email(): string;
|
|
202
|
+
get name(): string;
|
|
203
|
+
get title(): string;
|
|
204
|
+
get bio(): string;
|
|
205
|
+
get avatar(): string | undefined;
|
|
206
|
+
get avatarUrl(): string | undefined;
|
|
207
|
+
get phone(): string | undefined;
|
|
208
|
+
get rate(): number | undefined;
|
|
209
|
+
get isActivated(): boolean;
|
|
210
|
+
get isDeleted(): boolean;
|
|
211
|
+
get lastLogin(): Date | undefined;
|
|
212
|
+
get relevance(): number | undefined;
|
|
213
|
+
get roles(): RoleInterface[];
|
|
214
|
+
get company(): CompanyInterface | undefined;
|
|
215
|
+
get modules(): ModuleInterface[];
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
type NotificationInput = {
|
|
219
|
+
id: string;
|
|
220
|
+
isRead: boolean;
|
|
221
|
+
};
|
|
222
|
+
interface NotificationInterface extends ApiDataInterface {
|
|
223
|
+
get notificationType(): string;
|
|
224
|
+
get isRead(): boolean;
|
|
225
|
+
get actor(): UserInterface | undefined;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
export { type ApiDataInterface as A, type CompanyInput as C, type FieldSelector as F, type GetterKeys as G, type JsonApiHydratedDataInterface as J, type ModuleWithPermissions as M, type NotificationInterface as N, type PermissionCheck as P, type RoleInput as R, type UserInterface as U, type ApiRequestDataTypeInterface as a, Action as b, createJsonApiInclusion as c, type PageUrl as d, type ModulePermissionDefinition as e, type ModuleDefinition as f, type PermissionConfig as g, type PermissionModule as h, type PermissionUser as i, type ModuleFactory as j, type CompanyInterface as k, type FeatureInterface as l, type ModuleInterface as m, type NotificationInput as n, type RoleInterface as o, type UserInput as p };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunk3ZPK4QOBjs = require('./chunk-3ZPK4QOB.js');
|
|
4
|
+
require('./chunk-7QVYU63E.js');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
exports.serverRequest = _chunk3ZPK4QOBjs.serverRequest;
|
|
8
|
+
//# sourceMappingURL=request-GBLBPYFM.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/nextjs-jsonapi/nextjs-jsonapi/dist/request-GBLBPYFM.js"],"names":[],"mappings":"AAAA;AACE;AACF,sDAA4B;AAC5B,+BAA4B;AAC5B;AACE;AACF,uDAAC","file":"/home/runner/work/nextjs-jsonapi/nextjs-jsonapi/dist/request-GBLBPYFM.js"}
|