@careflair/common 1.0.40 → 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) instead of deprecated Ability
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 interface for ability definition
18
+ * User type for ability definition
18
19
  * Only requires id and role - minimal interface for permission checks
19
20
  */
20
- export interface UserForAbility {
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
@@ -64,5 +64,7 @@ function defineAbilitiesFor(user) {
64
64
  can("read", "Profile", { user: user.id });
65
65
  can("update", "Profile", { user: user.id });
66
66
  }
67
- return build();
67
+ return build({
68
+ conditionsMatcher: ability_1.mongoQueryMatcher,
69
+ });
68
70
  }
@@ -363,7 +363,8 @@ export declare enum JOB_TABS {
363
363
  ALL = "all",
364
364
  MY_JOBS = "my-jobs",
365
365
  APPLIED_JOBS = "applied-jobs",
366
- MATCHED_JOBS = "matched-jobs"
366
+ MATCHED_JOBS = "matched-jobs",
367
+ OTHER_JOBS = "other-jobs"
367
368
  }
368
369
  export declare enum DocumentType {
369
370
  NDIS_WORKER_SCREENING = "NDIS_WORKER_SCREENING",
@@ -420,6 +420,7 @@ var JOB_TABS;
420
420
  JOB_TABS["MY_JOBS"] = "my-jobs";
421
421
  JOB_TABS["APPLIED_JOBS"] = "applied-jobs";
422
422
  JOB_TABS["MATCHED_JOBS"] = "matched-jobs";
423
+ JOB_TABS["OTHER_JOBS"] = "other-jobs";
423
424
  })(JOB_TABS || (exports.JOB_TABS = JOB_TABS = {}));
424
425
  var DocumentType;
425
426
  (function (DocumentType) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@careflair/common",
3
- "version": "1.0.40",
3
+ "version": "1.0.42",
4
4
  "description": "Shared assets for CareFlair",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",