@carlonicora/nextjs-jsonapi 1.78.0 → 1.79.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-DWnbd6J7.d.ts} +1 -1
- package/dist/{AssistantMessageInterface-D0Kwf8CR.d.mts → AssistantMessageInterface-Mla6kgPe.d.mts} +1 -1
- 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-6CBDTVKV.mjs} +4 -4
- package/dist/{BlockNoteEditor-2G5UYALC.js → BlockNoteEditor-EH4HWI7H.js} +14 -14
- package/dist/{BlockNoteEditor-2G5UYALC.js.map → BlockNoteEditor-EH4HWI7H.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-FDJQRIMY.js → chunk-5IEWLLLD.js} +61 -2
- package/dist/chunk-5IEWLLLD.js.map +1 -0
- package/dist/{chunk-I65SSQ5Z.mjs → chunk-BKM5U3DE.mjs} +60 -1
- package/dist/chunk-BKM5U3DE.mjs.map +1 -0
- package/dist/{chunk-NB6TIKHK.mjs → chunk-ENRSFVOS.mjs} +2064 -2295
- package/dist/chunk-ENRSFVOS.mjs.map +1 -0
- package/dist/{chunk-NZOUEN67.mjs → chunk-MEWXQEVE.mjs} +38 -29
- package/dist/{chunk-NZOUEN67.mjs.map → chunk-MEWXQEVE.mjs.map} +1 -1
- package/dist/{chunk-X4YDETTD.js → chunk-TWDSDTHU.js} +39 -30
- package/dist/chunk-TWDSDTHU.js.map +1 -0
- package/dist/{chunk-ZEDB6JVB.js → chunk-ZDP3MBUI.js} +1142 -1373
- package/dist/chunk-ZDP3MBUI.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 +32 -34
- package/dist/components/index.d.ts +32 -34
- package/dist/components/index.js +4 -10
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +3 -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 +19 -11
- package/dist/core/index.d.ts +19 -11
- package/dist/core/index.js +4 -2
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.mjs +3 -1
- package/dist/index.d.mts +117 -20
- package/dist/index.d.ts +117 -20
- package/dist/index.js +7 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -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/registry/ModuleRegistry.ts +1 -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/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-6CBDTVKV.mjs.map} +0 -0
|
@@ -1,47 +1,75 @@
|
|
|
1
1
|
import { AbstractService, EndpointCreator, HttpMethod, Modules } from "../../../core";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { PermissionMappingInterface } from "./PermissionMappingInterface";
|
|
5
|
-
import { ModulePathsInterface } from "./ModulePathsInterface";
|
|
2
|
+
import type { RbacMatrixModel } from "./RbacMatrixModel";
|
|
3
|
+
import type { RbacMatrix } from "./RbacTypes";
|
|
6
4
|
|
|
5
|
+
/**
|
|
6
|
+
* RbacService — fetches RBAC configuration for the admin UI.
|
|
7
|
+
*
|
|
8
|
+
* Declarative-matrix methods (`fetchMatrix`, `saveMatrix`) talk to the
|
|
9
|
+
* dev-only endpoints added in
|
|
10
|
+
* `packages/nestjs-neo4jsonapi/.../rbac-dev.controller.ts`. The controller
|
|
11
|
+
* speaks JSON:API (singleton resource with `type: "rbac-matrix"`, `id:
|
|
12
|
+
* "singleton"`), so these methods go through the standard `callApi()`
|
|
13
|
+
* pipeline like every other service in the codebase.
|
|
14
|
+
*
|
|
15
|
+
* The backend only registers these routes when `devMode` is enabled on
|
|
16
|
+
* `RbacModule.register` (see `apps/api/src/features/features.modules.ts`).
|
|
17
|
+
* In production the routes return 404; callers should guard with a dev-mode
|
|
18
|
+
* check.
|
|
19
|
+
*/
|
|
7
20
|
export class RbacService extends AbstractService {
|
|
8
|
-
|
|
9
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Fetch the current RBAC matrix plus each module's known BFS relationship
|
|
23
|
+
* paths (used by the permission picker as scope suggestions).
|
|
24
|
+
*
|
|
25
|
+
* Dev-only endpoint — see class header.
|
|
26
|
+
*/
|
|
27
|
+
static async fetchMatrix(): Promise<{
|
|
28
|
+
matrix: RbacMatrix;
|
|
29
|
+
modulePaths: Record<string, readonly string[]>;
|
|
30
|
+
}> {
|
|
31
|
+
const endpoint = new EndpointCreator({ endpoint: Modules.RbacMatrix }).generate();
|
|
10
32
|
|
|
11
|
-
|
|
12
|
-
type: Modules.
|
|
33
|
+
const model = await this.callApi<RbacMatrixModel>({
|
|
34
|
+
type: Modules.RbacMatrix,
|
|
13
35
|
method: HttpMethod.GET,
|
|
14
|
-
endpoint
|
|
36
|
+
endpoint,
|
|
15
37
|
});
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
static async getRoles(): Promise<RoleInterface[]> {
|
|
19
|
-
const endpoint = new EndpointCreator({ endpoint: Modules.Role }).addAdditionalParam("fetchAll", "true");
|
|
20
38
|
|
|
21
|
-
return
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
});
|
|
39
|
+
return {
|
|
40
|
+
matrix: model.matrix ?? {},
|
|
41
|
+
modulePaths: model.modulePaths ?? {},
|
|
42
|
+
};
|
|
26
43
|
}
|
|
27
44
|
|
|
28
|
-
|
|
29
|
-
|
|
45
|
+
/**
|
|
46
|
+
* Persist a matrix back to the declarative `permissions.ts` file.
|
|
47
|
+
*
|
|
48
|
+
* The backend serializes the matrix to formatted TypeScript using the
|
|
49
|
+
* provided `roleNames` / `moduleNames` lookup tables (so the emitted file
|
|
50
|
+
* references `RoleId.X` / `ModuleId.X` rather than raw UUIDs) and writes
|
|
51
|
+
* it to `outputPath` (absolute, or relative to the repo root).
|
|
52
|
+
*
|
|
53
|
+
* Dev-only endpoint — see class header.
|
|
54
|
+
*/
|
|
55
|
+
static async saveMatrix(args: {
|
|
56
|
+
matrix: RbacMatrix;
|
|
57
|
+
roleNames: Record<string, string>;
|
|
58
|
+
moduleNames: Record<string, string>;
|
|
59
|
+
outputPath: string;
|
|
60
|
+
}): Promise<{ bytesWritten: number; path: string }> {
|
|
61
|
+
const endpoint = new EndpointCreator({ endpoint: Modules.RbacMatrix }).generate();
|
|
30
62
|
|
|
31
|
-
|
|
32
|
-
type: Modules.
|
|
33
|
-
method: HttpMethod.
|
|
34
|
-
endpoint
|
|
63
|
+
const model = await this.callApi<RbacMatrixModel>({
|
|
64
|
+
type: Modules.RbacMatrix,
|
|
65
|
+
method: HttpMethod.PUT,
|
|
66
|
+
endpoint,
|
|
67
|
+
input: args,
|
|
35
68
|
});
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
static async getModuleRelationshipPaths(): Promise<ModulePathsInterface[]> {
|
|
39
|
-
const endpoint = new EndpointCreator({ endpoint: Modules.ModulePaths });
|
|
40
69
|
|
|
41
|
-
return
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
});
|
|
70
|
+
return {
|
|
71
|
+
bytesWritten: model.bytesWritten ?? 0,
|
|
72
|
+
path: model.path ?? "",
|
|
73
|
+
};
|
|
46
74
|
}
|
|
47
75
|
}
|
|
@@ -13,3 +13,31 @@ export type PermissionsMap = {
|
|
|
13
13
|
update?: PermissionValue;
|
|
14
14
|
delete?: PermissionValue;
|
|
15
15
|
};
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Declarative-RBAC matrix types.
|
|
19
|
+
*
|
|
20
|
+
* Mirror of the library types defined in
|
|
21
|
+
* `packages/nestjs-neo4jsonapi/src/foundations/rbac/dsl/types.ts`.
|
|
22
|
+
* Frontend does not import from backend, so the shape is redefined here.
|
|
23
|
+
*
|
|
24
|
+
* A `PermToken` represents a single permission entry:
|
|
25
|
+
* - `scope: true` → unconditional (e.g. full read of the module)
|
|
26
|
+
* - `scope: false` → nothing (rarely used, mostly a placeholder)
|
|
27
|
+
* - `scope: "path"` → scoped by relationship path (e.g. "orders.account")
|
|
28
|
+
*/
|
|
29
|
+
export type PermToken = { action: string; scope: boolean | string };
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* A per-module block of the matrix. Always has a `default` row (permissions
|
|
33
|
+
* granted to every role). Additional keys are role IDs → role-specific
|
|
34
|
+
* permission tokens that are unioned with `default` to produce the effective
|
|
35
|
+
* permissions for that role in that module.
|
|
36
|
+
*/
|
|
37
|
+
export type RbacModuleBlock = { default: PermToken[] } & Record<string, PermToken[]>;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* The full RBAC matrix as served by the dev endpoint `GET /_dev/rbac/matrix`.
|
|
41
|
+
* Keys are module IDs; values are module blocks.
|
|
42
|
+
*/
|
|
43
|
+
export type RbacMatrix = Record<string, RbacModuleBlock>;
|
|
@@ -1,19 +1,10 @@
|
|
|
1
1
|
// Data layer
|
|
2
2
|
export * from "./data";
|
|
3
3
|
|
|
4
|
-
// Hooks
|
|
5
|
-
export { useRbacState } from "./hooks/useRbacState";
|
|
6
|
-
|
|
7
|
-
// Utils
|
|
8
|
-
export { generateMigrationFile, downloadMigrationFile } from "./utils/RbacMigrationGenerator";
|
|
9
|
-
|
|
10
4
|
// Components
|
|
11
5
|
export { RbacContainer } from "./components/RbacContainer";
|
|
12
|
-
export { RbacToolbar } from "./components/RbacToolbar";
|
|
13
|
-
export { RbacFeatureSection } from "./components/RbacFeatureSection";
|
|
14
|
-
export { RbacModuleTable } from "./components/RbacModuleTable";
|
|
15
6
|
export { RbacPermissionCell } from "./components/RbacPermissionCell";
|
|
16
7
|
export { RbacPermissionPicker } from "./components/RbacPermissionPicker";
|
|
17
8
|
|
|
18
9
|
// Module registrations
|
|
19
|
-
export { PermissionMappingModule, ModulePathsModule } from "./rbac.module";
|
|
10
|
+
export { PermissionMappingModule, ModulePathsModule, RbacMatrixModule } from "./rbac.module";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ModuleFactory } from "../../permissions";
|
|
2
2
|
import { PermissionMapping } from "./data/PermissionMapping";
|
|
3
3
|
import { ModulePaths } from "./data/ModulePaths";
|
|
4
|
+
import { RbacMatrixModel } from "./data/RbacMatrixModel";
|
|
4
5
|
|
|
5
6
|
export const PermissionMappingModule = (factory: ModuleFactory) =>
|
|
6
7
|
factory({
|
|
@@ -17,3 +18,15 @@ export const ModulePathsModule = (factory: ModuleFactory) =>
|
|
|
17
18
|
model: ModulePaths,
|
|
18
19
|
moduleId: "f4fb3f01-a947-4c2e-89c8-354a518cdb13",
|
|
19
20
|
});
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Dev-only matrix module. The `name` is the URL path of the dev singleton
|
|
24
|
+
* endpoint (`GET|PUT _dev/rbac/matrix`), NOT a plural resource collection.
|
|
25
|
+
* This module is only useful when the backend is running with `devMode: true`
|
|
26
|
+
* on `RbacModule.register`.
|
|
27
|
+
*/
|
|
28
|
+
export const RbacMatrixModule = (factory: ModuleFactory) =>
|
|
29
|
+
factory({
|
|
30
|
+
name: "_dev/rbac/matrix",
|
|
31
|
+
model: RbacMatrixModel,
|
|
32
|
+
});
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { A as ApiDataInterface } from './ApiDataInterface-BcZeXy5X.mjs';
|
|
2
|
-
|
|
3
|
-
declare const COMPANY_ADMINISTRATOR_ROLE_ID = "2e1eee00-6cba-4506-9059-ccd24e4ea5b0";
|
|
4
|
-
type PermissionValue = boolean | string;
|
|
5
|
-
type ActionType = "read" | "create" | "update" | "delete";
|
|
6
|
-
declare const ACTION_TYPES: ActionType[];
|
|
7
|
-
/** The permissions object shape used by both Module and PermissionMapping entities */
|
|
8
|
-
type PermissionsMap = {
|
|
9
|
-
create?: PermissionValue;
|
|
10
|
-
read?: PermissionValue;
|
|
11
|
-
update?: PermissionValue;
|
|
12
|
-
delete?: PermissionValue;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
interface PermissionMappingInterface extends ApiDataInterface {
|
|
16
|
-
get roleId(): string;
|
|
17
|
-
get moduleId(): string;
|
|
18
|
-
get permissions(): {
|
|
19
|
-
create?: boolean | string;
|
|
20
|
-
read?: boolean | string;
|
|
21
|
-
update?: boolean | string;
|
|
22
|
-
delete?: boolean | string;
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
interface ModulePathsInterface extends ApiDataInterface {
|
|
27
|
-
get moduleId(): string;
|
|
28
|
-
get paths(): string[];
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export { type ActionType as A, COMPANY_ADMINISTRATOR_ROLE_ID as C, type ModulePathsInterface as M, type PermissionMappingInterface as P, type PermissionValue as a, type PermissionsMap as b, ACTION_TYPES as c };
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { A as ApiDataInterface } from './ApiDataInterface-BcZeXy5X.js';
|
|
2
|
-
|
|
3
|
-
declare const COMPANY_ADMINISTRATOR_ROLE_ID = "2e1eee00-6cba-4506-9059-ccd24e4ea5b0";
|
|
4
|
-
type PermissionValue = boolean | string;
|
|
5
|
-
type ActionType = "read" | "create" | "update" | "delete";
|
|
6
|
-
declare const ACTION_TYPES: ActionType[];
|
|
7
|
-
/** The permissions object shape used by both Module and PermissionMapping entities */
|
|
8
|
-
type PermissionsMap = {
|
|
9
|
-
create?: PermissionValue;
|
|
10
|
-
read?: PermissionValue;
|
|
11
|
-
update?: PermissionValue;
|
|
12
|
-
delete?: PermissionValue;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
interface PermissionMappingInterface extends ApiDataInterface {
|
|
16
|
-
get roleId(): string;
|
|
17
|
-
get moduleId(): string;
|
|
18
|
-
get permissions(): {
|
|
19
|
-
create?: boolean | string;
|
|
20
|
-
read?: boolean | string;
|
|
21
|
-
update?: boolean | string;
|
|
22
|
-
delete?: boolean | string;
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
interface ModulePathsInterface extends ApiDataInterface {
|
|
27
|
-
get moduleId(): string;
|
|
28
|
-
get paths(): string[];
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export { type ActionType as A, COMPANY_ADMINISTRATOR_ROLE_ID as C, type ModulePathsInterface as M, type PermissionMappingInterface as P, type PermissionValue as a, type PermissionsMap as b, ACTION_TYPES as c };
|