@careflair/common 1.0.41 → 1.0.42
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.
|
@@ -10,17 +10,18 @@ export type Actions = "create" | "read" | "update" | "delete" | "apply" | "initi
|
|
|
10
10
|
export type Subjects = "Job" | "Chat" | "NDISScreening" | "WorkingWithChildren" | "Profile" | "all";
|
|
11
11
|
/**
|
|
12
12
|
* AppAbility type for type-safe permission checks
|
|
13
|
-
* Uses PureAbility (modern API)
|
|
13
|
+
* Uses PureAbility (modern API) + mongoQueryMatcher so we can define conditional rules
|
|
14
|
+
* (e.g. { postedBy: user.id }) without runtime errors.
|
|
14
15
|
*/
|
|
15
|
-
export type AppAbility = PureAbility<[Actions, Subjects]>;
|
|
16
|
+
export type AppAbility = PureAbility<[Actions, Subjects], any>;
|
|
16
17
|
/**
|
|
17
|
-
* User
|
|
18
|
+
* User type for ability definition
|
|
18
19
|
* Only requires id and role - minimal interface for permission checks
|
|
19
20
|
*/
|
|
20
|
-
export
|
|
21
|
+
export type UserForAbility = {
|
|
21
22
|
id: string;
|
|
22
23
|
role: UserRole;
|
|
23
|
-
}
|
|
24
|
+
};
|
|
24
25
|
/**
|
|
25
26
|
* Define abilities for a user based on their role
|
|
26
27
|
* This is the SINGLE SOURCE OF TRUTH for permissions
|
package/dist/abilities/index.js
CHANGED