@careflair/common 1.0.43 → 1.0.44

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.
@@ -1,29 +1,19 @@
1
- import { PureAbility, MongoQuery } from "@casl/ability";
1
+ import { PureAbility } from "@casl/ability";
2
2
  import { UserRole } from "../enums";
3
3
  /**
4
4
  * Actions that users can perform
5
5
  */
6
6
  export type Actions = "create" | "read" | "update" | "delete" | "apply" | "initiate" | "respond" | "submit" | "manage";
7
- /**
8
- * Subject types with their fields for conditional checks
9
- */
10
- type Job = {
11
- postedBy: string;
12
- };
13
- type Profile = {
14
- user: string;
15
- };
16
7
  /**
17
8
  * Subjects/resources that users act upon
18
- * Includes both string literals (for rule definition) and object types (for instance checking)
19
9
  */
20
- export type Subjects = "Job" | "Chat" | "NDISScreening" | "WorkingWithChildren" | "Profile" | "all" | Job | Profile;
10
+ export type Subjects = "Job" | "Chat" | "NDISScreening" | "WorkingWithChildren" | "Profile" | "Onboarding" | "all";
21
11
  /**
22
12
  * AppAbility type for type-safe permission checks
23
13
  * Uses PureAbility (modern API) + mongoQueryMatcher so we can define conditional rules
24
14
  * (e.g. { postedBy: user.id }) without runtime errors.
25
15
  */
26
- export type AppAbility = PureAbility<[Actions, Subjects], MongoQuery>;
16
+ export type AppAbility = PureAbility<[Actions, Subjects], any>;
27
17
  /**
28
18
  * User type for ability definition
29
19
  * Only requires id and role - minimal interface for permission checks
@@ -41,4 +31,3 @@ export type UserForAbility = {
41
31
  * @returns AppAbility instance with user's permissions
42
32
  */
43
33
  export declare function defineAbilitiesFor(user: UserForAbility): AppAbility;
44
- export {};
@@ -45,6 +45,8 @@ function defineAbilitiesFor(user) {
45
45
  // Profile
46
46
  can("read", "Profile", { user: user.id });
47
47
  can("update", "Profile", { user: user.id });
48
+ // Onboarding
49
+ can("update", "Onboarding", { user: user.id });
48
50
  }
49
51
  // ============================================
50
52
  // WORKERS: PROVIDER
@@ -63,6 +65,8 @@ function defineAbilitiesFor(user) {
63
65
  // Profile
64
66
  can("read", "Profile", { user: user.id });
65
67
  can("update", "Profile", { user: user.id });
68
+ // Onboarding
69
+ can("update", "Onboarding", { user: user.id });
66
70
  }
67
71
  return build({
68
72
  conditionsMatcher: ability_1.mongoQueryMatcher,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@careflair/common",
3
- "version": "1.0.43",
3
+ "version": "1.0.44",
4
4
  "description": "Shared assets for CareFlair",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",