@managemint-solutions/sdk 0.38.1 → 0.39.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/README.md CHANGED
@@ -419,7 +419,7 @@ const org = await supabase.organizations.get();
419
419
  const period = leavePeriodFor('2026-09-21', org.leave_calendar_start_month); // { period_start, period_end }
420
420
  const holidays = await supabase.publicHolidays.datesBetween('2026-09-21', '2026-09-25'); // see Public holidays
421
421
  const days = countWorkingDays('2026-09-21', '2026-09-25', holidays); // Mon–Fri less holidays; 0.5 for a half day
422
- const today = todayInJohannesburg(); // the cancel rule's "today"
422
+ const today = todayInJohannesburg(); // "today" for the entitlements' as-of lookup
423
423
  ```
424
424
 
425
425
  ```ts
@@ -434,7 +434,7 @@ const clash = await supabase.leaveRequests.overlaps(userId, '2026-09-21', '2026-
434
434
 
435
435
  const request = await supabase.leaveRequests.create({ user_id: userId, leave_type_id: annual.mms_id, start_date: '2026-09-21', end_date: '2026-09-25', is_half_day: false, days, reason: null, status: LeaveRequestStatus.PENDING });
436
436
  const reviewed = await supabase.leaveRequests.review(request.mms_id, { status: LeaveReviewDecision.APPROVED, reviewed_by: managerId, review_note: null }); // null = no longer pending
437
- const cancelled = await supabase.leaveRequests.cancel(request.mms_id, userId); // null = already closed
437
+ const cancelled = await supabase.leaveRequests.cancel(request.mms_id, userId); // null = no longer pending (a decided request is final)
438
438
  const mine = await supabase.leaveRequests.list({ ...query, user_id: me }); // one list; user_id narrows it
439
439
  const annualOnly = await supabase.leaveRequests.list({ ...query, leave_type_id: annual.mms_id }); // leave_type_id narrows it too
440
440
  const reports = await supabase.leaveRequests.list(query, { userIds: [me, ...(await supabase.users.idsManagedBy(me))] });
@@ -63,7 +63,7 @@ export declare class LeaveRequestsResource {
63
63
  * can say so instead of overwriting their decision.
64
64
  */
65
65
  review(leaveRequestId: string, input: ReviewLeaveRequestRow): Promise<LeaveRequestEntity | null>;
66
- /** Cancels a pending or approved request; null when it was already closed. */
66
+ /** Cancels a request while it is still pending; null when it no longer is - a decided request is final. */
67
67
  cancel(leaveRequestId: string, cancelledBy: string): Promise<LeaveRequestEntity | null>;
68
68
  }
69
69
  export {};
@@ -168,10 +168,10 @@ class LeaveRequestsResource {
168
168
  });
169
169
  return row ? this.getById(leaveRequestId) : null;
170
170
  }
171
- /** Cancels a pending or approved request; null when it was already closed. */
171
+ /** Cancels a request while it is still pending; null when it no longer is - a decided request is final. */
172
172
  async cancel(leaveRequestId, cancelledBy) {
173
173
  const now = new Date().toISOString();
174
- const row = await this.table.updateWhere(leaveRequestId, (query) => query.in('status', LIVE_STATUSES), {
174
+ const row = await this.table.updateWhere(leaveRequestId, (query) => query.eq('status', enum_2.LeaveRequestStatus.PENDING), {
175
175
  status: enum_2.LeaveRequestStatus.CANCELLED,
176
176
  cancelled_by: cancelledBy,
177
177
  cancelled_at: now,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@managemint-solutions/sdk",
3
- "version": "0.38.1",
3
+ "version": "0.39.0",
4
4
  "description": "Typed Supabase data-access SDK for ManageMint Solutions",
5
5
  "license": "UNLICENSED",
6
6
  "author": "Scott Bebington <scottbebington@gmail.com>",