@carlonicora/nextjs-jsonapi 1.78.0 → 1.80.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/{AssistantMessageInterface-DS_tyJTV.d.ts → AssistantMessageInterface-BpEhx2pC.d.ts} +19 -2
- package/dist/{AssistantMessageInterface-D0Kwf8CR.d.mts → AssistantMessageInterface-DJ3Me16Y.d.mts} +19 -2
- package/dist/{AuthComponent-Blbs06ud.d.ts → AuthComponent-B6DIk8Vf.d.ts} +1 -1
- package/dist/{AuthComponent-huIaK5rm.d.mts → AuthComponent-BKI0ZbtD.d.mts} +1 -1
- package/dist/{BlockNoteEditor-JXK3JGKJ.mjs → BlockNoteEditor-3M5PD3BZ.mjs} +4 -4
- package/dist/{BlockNoteEditor-2G5UYALC.js → BlockNoteEditor-YLTPJPTV.js} +14 -14
- package/dist/{BlockNoteEditor-2G5UYALC.js.map → BlockNoteEditor-YLTPJPTV.js.map} +1 -1
- package/dist/RbacTypes-BTbr27Ew.d.mts +43 -0
- package/dist/RbacTypes-BTbr27Ew.d.ts +43 -0
- package/dist/{auth.interface-CQJ6A2Cj.d.ts → auth.interface-BBUgMZzs.d.ts} +1 -1
- package/dist/{auth.interface-Bdq7-8iV.d.mts → auth.interface-XYEREOD6.d.mts} +1 -1
- package/dist/billing/index.js +346 -346
- package/dist/billing/index.mjs +3 -3
- package/dist/{chunk-ZEDB6JVB.js → chunk-4NOQNTFI.js} +1585 -1405
- package/dist/chunk-4NOQNTFI.js.map +1 -0
- package/dist/{chunk-I65SSQ5Z.mjs → chunk-6UMB5LTQ.mjs} +157 -7
- package/dist/chunk-6UMB5LTQ.mjs.map +1 -0
- package/dist/{chunk-FDJQRIMY.js → chunk-N4YZ45SK.js} +174 -24
- package/dist/chunk-N4YZ45SK.js.map +1 -0
- package/dist/{chunk-NB6TIKHK.mjs → chunk-NQV5RDCK.mjs} +2524 -2344
- package/dist/chunk-NQV5RDCK.mjs.map +1 -0
- package/dist/{chunk-NZOUEN67.mjs → chunk-PV5V6CVW.mjs} +38 -29
- package/dist/{chunk-NZOUEN67.mjs.map → chunk-PV5V6CVW.mjs.map} +1 -1
- package/dist/{chunk-X4YDETTD.js → chunk-ZEJSPTHS.js} +39 -30
- package/dist/chunk-ZEJSPTHS.js.map +1 -0
- package/dist/client/index.d.mts +6 -24
- package/dist/client/index.d.ts +6 -24
- package/dist/client/index.js +4 -10
- package/dist/client/index.js.map +1 -1
- package/dist/client/index.mjs +3 -9
- package/dist/components/index.d.mts +55 -39
- package/dist/components/index.d.ts +55 -39
- package/dist/components/index.js +4 -8
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +5 -9
- package/dist/{config-B3jKt9P7.d.ts → config-B5oBQVEA.d.ts} +1 -1
- package/dist/{config-DkHF61xA.d.mts → config-Bx_uh22h.d.mts} +1 -1
- package/dist/contexts/index.d.mts +41 -4
- package/dist/contexts/index.d.ts +41 -4
- package/dist/contexts/index.js +8 -4
- package/dist/contexts/index.js.map +1 -1
- package/dist/contexts/index.mjs +7 -3
- package/dist/core/index.d.mts +51 -11
- package/dist/core/index.d.ts +51 -11
- package/dist/core/index.js +8 -2
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.mjs +7 -1
- package/dist/index.d.mts +117 -20
- package/dist/index.d.ts +117 -20
- package/dist/index.js +11 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -2
- package/dist/{notification.interface-DG6obXUH.d.mts → notification.interface-DLZGtV7Z.d.mts} +1 -1
- package/dist/{notification.interface-DcSuc9CL.d.ts → notification.interface-aLEJbA_g.d.ts} +1 -1
- package/dist/{s3.service-DGilbikH.d.mts → s3.service-CVgLWaDc.d.mts} +2 -2
- package/dist/{s3.service-DjwEQJPe.d.ts → s3.service-SLlX0Zbz.d.ts} +2 -2
- package/dist/server/index.d.mts +3 -3
- package/dist/server/index.d.ts +3 -3
- package/dist/server/index.js +3 -3
- package/dist/server/index.mjs +1 -1
- package/dist/useDataListRetriever-BqJSFBck.d.mts +33 -0
- package/dist/useDataListRetriever-BqJSFBck.d.ts +33 -0
- package/dist/{useSocket-CmzVtg32.d.mts → useSocket-BkxHHujj.d.mts} +1 -1
- package/dist/{useSocket-8eUtnL7J.d.ts → useSocket-CMDjWFYm.d.ts} +1 -1
- package/package.json +1 -1
- package/src/client/index.ts +0 -4
- package/src/components/index.ts +0 -3
- package/src/contexts/index.ts +1 -0
- package/src/core/index.ts +2 -0
- package/src/core/registry/ModuleRegistry.ts +2 -0
- package/src/features/assistant/components/parts/AssistantThread.tsx +1 -1
- package/src/features/assistant-message/AssistantMessageModule.ts +4 -0
- package/src/features/assistant-message/components/MessageItem.tsx +7 -7
- package/src/features/assistant-message/components/MessageList.tsx +1 -1
- package/src/features/assistant-message/components/__tests__/MessageItem.spec.tsx +11 -7
- package/src/features/assistant-message/components/index.ts +1 -0
- package/src/features/assistant-message/components/parts/MessageSourcesContainer.tsx +135 -0
- package/src/features/assistant-message/components/parts/MessageSourcesPanel.tsx +151 -0
- package/src/features/assistant-message/components/parts/RelevanceMeter.tsx +29 -0
- package/src/features/assistant-message/components/parts/__tests__/MessageSourcesPanel.spec.tsx +70 -0
- package/src/features/assistant-message/components/parts/tabs/CitationsTab.tsx +105 -0
- package/src/features/assistant-message/components/parts/tabs/ContentsTab.tsx +88 -0
- package/src/features/assistant-message/components/parts/tabs/ReferencesTab.tsx +51 -0
- package/src/features/assistant-message/components/parts/tabs/SuggestedQuestionsTab.tsx +24 -0
- package/src/features/assistant-message/components/parts/tabs/UsersTab.tsx +142 -0
- package/src/features/assistant-message/data/AssistantMessage.ts +20 -0
- package/src/features/assistant-message/data/AssistantMessageInterface.ts +2 -0
- package/src/features/assistant-message/data/AssistantMessageService.ts +13 -4
- package/src/features/assistant-message/data/__tests__/AssistantMessage.citations.spec.ts +65 -0
- package/src/features/assistant-message/data/__tests__/AssistantMessage.spec.ts +8 -0
- package/src/features/chunk/ChunkModule.ts +18 -0
- package/src/features/chunk/data/Chunk.ts +49 -0
- package/src/features/chunk/data/ChunkInput.ts +3 -0
- package/src/features/chunk/data/ChunkInterface.ts +18 -0
- package/src/features/chunk/data/__tests__/Chunk.spec.ts +83 -0
- package/src/features/chunk/data/index.ts +3 -0
- package/src/features/chunk/index.ts +2 -0
- package/src/features/rbac/components/RbacContainer.tsx +318 -49
- package/src/features/rbac/components/RbacPermissionPicker.tsx +144 -121
- package/src/features/rbac/contexts/RbacContext.tsx +209 -0
- package/src/features/rbac/contexts/index.ts +1 -0
- package/src/features/rbac/data/RbacMatrixModel.ts +84 -0
- package/src/features/rbac/data/RbacService.ts +61 -33
- package/src/features/rbac/data/RbacTypes.ts +28 -0
- package/src/features/rbac/data/index.ts +1 -0
- package/src/features/rbac/index.ts +1 -10
- package/src/features/rbac/rbac.module.ts +13 -0
- package/dist/ModulePathsInterface-BrdqgteS.d.mts +0 -31
- package/dist/ModulePathsInterface-DJKs7s_s.d.ts +0 -31
- package/dist/chunk-FDJQRIMY.js.map +0 -1
- package/dist/chunk-I65SSQ5Z.mjs.map +0 -1
- package/dist/chunk-NB6TIKHK.mjs.map +0 -1
- package/dist/chunk-X4YDETTD.js.map +0 -1
- package/dist/chunk-ZEDB6JVB.js.map +0 -1
- package/dist/useRbacState-C88O-5L8.d.ts +0 -77
- package/dist/useRbacState-mqYiRp3J.d.mts +0 -77
- package/src/features/assistant-message/components/parts/ReferenceBadges.tsx +0 -46
- package/src/features/assistant-message/components/parts/SuggestedFollowUps.tsx +0 -52
- package/src/features/assistant-message/components/parts/__tests__/ReferenceBadges.spec.tsx +0 -59
- package/src/features/assistant-message/components/parts/__tests__/SuggestedFollowUps.spec.tsx +0 -29
- package/src/features/rbac/components/RbacFeatureSection.tsx +0 -66
- package/src/features/rbac/components/RbacModuleTable.tsx +0 -121
- package/src/features/rbac/components/RbacToolbar.tsx +0 -40
- package/src/features/rbac/hooks/useRbacState.test.ts +0 -180
- package/src/features/rbac/hooks/useRbacState.ts +0 -319
- package/src/features/rbac/utils/RbacMigrationGenerator.test.ts +0 -124
- package/src/features/rbac/utils/RbacMigrationGenerator.ts +0 -184
- /package/dist/{BlockNoteEditor-JXK3JGKJ.mjs.map → BlockNoteEditor-3M5PD3BZ.mjs.map} +0 -0
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
import { RoleInterface } from "../../role";
|
|
2
|
-
import { ActionType, ACTION_TYPES, COMPANY_ADMINISTRATOR_ROLE_ID, PermissionsMap } from "../data/RbacTypes";
|
|
3
|
-
|
|
4
|
-
const ACTION_ENUM_MAP: Record<ActionType, string> = {
|
|
5
|
-
read: "Action.Read",
|
|
6
|
-
create: "Action.Create",
|
|
7
|
-
update: "Action.Update",
|
|
8
|
-
delete: "Action.Delete",
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
function formatPermissionValue(value: boolean | string): string {
|
|
12
|
-
if (value === true) return "true";
|
|
13
|
-
if (value === false) return "false";
|
|
14
|
-
return `"${value}"`;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
function formatPermissionsFromMap(perms: PermissionsMap): string {
|
|
18
|
-
const entries: string[] = [];
|
|
19
|
-
for (const actionType of ACTION_TYPES) {
|
|
20
|
-
const value = perms[actionType];
|
|
21
|
-
if (value !== undefined) {
|
|
22
|
-
entries.push(`{ type: ${ACTION_ENUM_MAP[actionType]}, value: ${formatPermissionValue(value)} }`);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
if (entries.length === 0) return "[]";
|
|
27
|
-
if (entries.length === 1) return `[${entries[0]}]`;
|
|
28
|
-
return `[\n ${entries.join(",\n ")},\n ]`;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
interface EffectiveFeature {
|
|
32
|
-
id: string;
|
|
33
|
-
name: string;
|
|
34
|
-
isCore: boolean;
|
|
35
|
-
modules: Array<{
|
|
36
|
-
id: string;
|
|
37
|
-
name: string;
|
|
38
|
-
permissions: PermissionsMap;
|
|
39
|
-
}>;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export function generateMigrationFile(params: {
|
|
43
|
-
features: EffectiveFeature[];
|
|
44
|
-
roles: RoleInterface[];
|
|
45
|
-
rolePermissionsMap: Map<string, PermissionsMap>;
|
|
46
|
-
}): string {
|
|
47
|
-
const { features, roles, rolePermissionsMap } = params;
|
|
48
|
-
const lines: string[] = [];
|
|
49
|
-
|
|
50
|
-
// Header
|
|
51
|
-
lines.push(`/**`);
|
|
52
|
-
lines.push(` * RBAC Migration - Generated on ${new Date().toISOString().split("T")[0]}`);
|
|
53
|
-
lines.push(` * Contains features, modules, roles, and permission mappings.`);
|
|
54
|
-
lines.push(` */`);
|
|
55
|
-
lines.push(``);
|
|
56
|
-
lines.push(`import { Action } from "src/common/enums/action";`);
|
|
57
|
-
lines.push(`import { MigrationInterface } from "src/core/migrator/interfaces/migration.interface";`);
|
|
58
|
-
lines.push(
|
|
59
|
-
`import { featureQuery, moduleQuery, roleQuery, permissionQuery } from "src/neo4j.migrations/queries/migration.queries";`,
|
|
60
|
-
);
|
|
61
|
-
lines.push(``);
|
|
62
|
-
lines.push(`export const migration: MigrationInterface[] = [`);
|
|
63
|
-
|
|
64
|
-
// Features
|
|
65
|
-
lines.push(` /* ************************************ */`);
|
|
66
|
-
lines.push(` /* FEATURES */`);
|
|
67
|
-
lines.push(` /* ************************************ */`);
|
|
68
|
-
for (const feature of features) {
|
|
69
|
-
lines.push(` {`);
|
|
70
|
-
lines.push(` query: featureQuery,`);
|
|
71
|
-
lines.push(` queryParams: {`);
|
|
72
|
-
lines.push(` featureId: "${feature.id}",`);
|
|
73
|
-
lines.push(` featureName: "${feature.name}",`);
|
|
74
|
-
lines.push(` isCore: ${feature.isCore},`);
|
|
75
|
-
lines.push(` },`);
|
|
76
|
-
lines.push(` },`);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
// Modules grouped by feature
|
|
80
|
-
for (const feature of features) {
|
|
81
|
-
if (feature.modules.length === 0) continue;
|
|
82
|
-
|
|
83
|
-
lines.push(` /* ************************************ */`);
|
|
84
|
-
lines.push(` /* ${feature.name.toUpperCase().padEnd(37)} */`);
|
|
85
|
-
lines.push(` /* ************************************ */`);
|
|
86
|
-
|
|
87
|
-
for (const mod of feature.modules) {
|
|
88
|
-
lines.push(` {`);
|
|
89
|
-
lines.push(` query: moduleQuery,`);
|
|
90
|
-
lines.push(` queryParams: {`);
|
|
91
|
-
lines.push(` moduleName: "${mod.name}",`);
|
|
92
|
-
lines.push(` moduleId: "${mod.id}",`);
|
|
93
|
-
lines.push(` featureId: "${feature.id}",`);
|
|
94
|
-
lines.push(` permissions: JSON.stringify(${formatPermissionsFromMap(mod.permissions)}),`);
|
|
95
|
-
lines.push(` },`);
|
|
96
|
-
lines.push(` },`);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
// Roles
|
|
101
|
-
lines.push(` /* ************************************ */`);
|
|
102
|
-
lines.push(` /* ROLES */`);
|
|
103
|
-
lines.push(` /* ************************************ */`);
|
|
104
|
-
for (const role of roles) {
|
|
105
|
-
lines.push(` {`);
|
|
106
|
-
lines.push(` query: roleQuery,`);
|
|
107
|
-
lines.push(` queryParams: {`);
|
|
108
|
-
lines.push(` roleId: "${role.id}",`);
|
|
109
|
-
lines.push(` roleName: "${role.name}",`);
|
|
110
|
-
lines.push(` isSelectable: ${role.isSelectable},`);
|
|
111
|
-
lines.push(` },`);
|
|
112
|
-
lines.push(` },`);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
// Permission mappings
|
|
116
|
-
lines.push(` /* ************************************ */`);
|
|
117
|
-
lines.push(` /* PERMISSIONS */`);
|
|
118
|
-
lines.push(` /* ************************************ */`);
|
|
119
|
-
|
|
120
|
-
// Collect all module IDs for CompanyAdministrator (always all-true)
|
|
121
|
-
const allModuleIds: string[] = [];
|
|
122
|
-
for (const feature of features) {
|
|
123
|
-
for (const mod of feature.modules) {
|
|
124
|
-
allModuleIds.push(mod.id);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
const allTruePermissions: PermissionsMap = { read: true, create: true, update: true, delete: true };
|
|
129
|
-
|
|
130
|
-
// Group by role for readability
|
|
131
|
-
const permsByRole = new Map<string, Array<{ moduleId: string; permissions: PermissionsMap }>>();
|
|
132
|
-
|
|
133
|
-
// CompanyAdministrator always gets all-true for every module
|
|
134
|
-
permsByRole.set(
|
|
135
|
-
COMPANY_ADMINISTRATOR_ROLE_ID,
|
|
136
|
-
allModuleIds.map((moduleId) => ({ moduleId, permissions: allTruePermissions })),
|
|
137
|
-
);
|
|
138
|
-
|
|
139
|
-
for (const [key, perms] of rolePermissionsMap) {
|
|
140
|
-
const [roleId, moduleId] = key.split(":");
|
|
141
|
-
if (roleId === COMPANY_ADMINISTRATOR_ROLE_ID) continue; // already handled
|
|
142
|
-
if (!permsByRole.has(roleId)) permsByRole.set(roleId, []);
|
|
143
|
-
permsByRole.get(roleId)!.push({ moduleId, permissions: perms });
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
for (const [roleId, moduleMappings] of permsByRole) {
|
|
147
|
-
const role = roles.find((r) => r.id === roleId);
|
|
148
|
-
if (role) {
|
|
149
|
-
lines.push(` // ${role.name}`);
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
for (const mapping of moduleMappings) {
|
|
153
|
-
lines.push(` {`);
|
|
154
|
-
lines.push(` query: permissionQuery,`);
|
|
155
|
-
lines.push(` queryParams: {`);
|
|
156
|
-
lines.push(` roleId: "${roleId}",`);
|
|
157
|
-
lines.push(` moduleId: "${mapping.moduleId}",`);
|
|
158
|
-
lines.push(` permissions: JSON.stringify(${formatPermissionsFromMap(mapping.permissions)}),`);
|
|
159
|
-
lines.push(` },`);
|
|
160
|
-
lines.push(` },`);
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
lines.push(`];`);
|
|
165
|
-
lines.push(``);
|
|
166
|
-
|
|
167
|
-
return lines.join("\n");
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
export function downloadMigrationFile(content: string): void {
|
|
171
|
-
const now = new Date();
|
|
172
|
-
const dateStr = `${now.getFullYear()}${String(now.getMonth() + 1).padStart(2, "0")}${String(now.getDate()).padStart(2, "0")}`;
|
|
173
|
-
const filename = `${dateStr}_001.ts`;
|
|
174
|
-
|
|
175
|
-
const blob = new Blob([content], { type: "text/plain" });
|
|
176
|
-
const url = URL.createObjectURL(blob);
|
|
177
|
-
const a = document.createElement("a");
|
|
178
|
-
a.href = url;
|
|
179
|
-
a.download = filename;
|
|
180
|
-
document.body.appendChild(a);
|
|
181
|
-
a.click();
|
|
182
|
-
document.body.removeChild(a);
|
|
183
|
-
URL.revokeObjectURL(url);
|
|
184
|
-
}
|
|
File without changes
|