@managemint-solutions/sdk 0.35.0 → 0.37.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 +82 -15
- package/dist/cache/index.d.ts +28 -22
- package/dist/cache/index.js +36 -29
- package/dist/client.d.ts +6 -0
- package/dist/client.js +11 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +25 -1
- package/dist/leave/dto.d.ts +75 -0
- package/dist/leave/dto.js +375 -0
- package/dist/leave/index.d.ts +5 -0
- package/dist/leave/index.js +29 -0
- package/dist/leave/leave-entitlements.d.ts +42 -0
- package/dist/leave/leave-entitlements.js +170 -0
- package/dist/leave/leave-requests.d.ts +69 -0
- package/dist/leave/leave-requests.js +181 -0
- package/dist/leave/leave-types.d.ts +21 -0
- package/dist/leave/leave-types.js +95 -0
- package/dist/leave/working-days.d.ts +29 -0
- package/dist/leave/working-days.js +80 -0
- package/dist/permissions/dto.d.ts +12 -0
- package/dist/permissions/dto.js +60 -24
- package/dist/public-holidays/dto.d.ts +4 -0
- package/dist/public-holidays/dto.js +30 -0
- package/dist/public-holidays/index.d.ts +21 -0
- package/dist/public-holidays/index.js +63 -0
- package/dist/users/index.d.ts +2 -0
- package/dist/users/index.js +11 -0
- package/dist/validators.d.ts +8 -0
- package/dist/validators.js +32 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -400,6 +400,62 @@ await service.configs.update('feature_flags', { value: { ...flags.value, timeshe
|
|
|
400
400
|
await service.configs.remove('maintenance'); // hard delete, service role only
|
|
401
401
|
```
|
|
402
402
|
|
|
403
|
+
## Leave
|
|
404
|
+
|
|
405
|
+
The first slice of the HR module: `leave_types`, `leave_entitlements` and `leave_requests`, one
|
|
406
|
+
org-scoped audited resource each on the caller's client. Every date is a calendar date
|
|
407
|
+
(`YYYY-MM-DD`, the columns are `date`), and the DTOs refuse anything else; body fields are
|
|
408
|
+
required keys, with `null` for an empty one. Balances are never stored — an entitlement's
|
|
409
|
+
`days_used` / `days_pending` / `days_remaining` are computed on read from the approved and pending
|
|
410
|
+
requests of that user and type whose start date falls in its period — and a request's `days` is
|
|
411
|
+
a snapshot taken when it was filed, so a holiday added later does not rewrite approved history.
|
|
412
|
+
|
|
413
|
+
The calendar arithmetic is plain exported functions, shared with the api:
|
|
414
|
+
|
|
415
|
+
```ts
|
|
416
|
+
import { countWorkingDays, leavePeriodFor, todayInJohannesburg } from '@managemint-solutions/sdk';
|
|
417
|
+
|
|
418
|
+
const org = await supabase.organizations.get();
|
|
419
|
+
const period = leavePeriodFor('2026-09-21', org.leave_calendar_start_month); // { period_start, period_end }
|
|
420
|
+
const holidays = await supabase.publicHolidays.datesBetween('2026-09-21', '2026-09-25'); // see Public holidays
|
|
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"
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
```ts
|
|
426
|
+
const types = await supabase.leaveTypes.list({ active: true });
|
|
427
|
+
const annual = await supabase.leaveTypes.create({ name: 'Annual', description: null, default_days: 15, is_paid: true, requires_approval: true });
|
|
428
|
+
await supabase.leaveTypes.remove(annual.mms_id); // hard delete; 409 once a request or entitlement references it
|
|
429
|
+
|
|
430
|
+
const cover = await supabase.leaveEntitlements.findFor(userId, annual.mms_id, '2026-09-21'); // period + cap, or null = untracked
|
|
431
|
+
const committed = await supabase.leaveRequests.sumDays(userId, annual.mms_id, cover, [LeaveRequestStatus.APPROVED, LeaveRequestStatus.PENDING]);
|
|
432
|
+
const clash = await supabase.leaveRequests.overlaps(userId, '2026-09-21', '2026-09-25');
|
|
433
|
+
|
|
434
|
+
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 });
|
|
435
|
+
const reviewed = await supabase.leaveRequests.review(request.mms_id, { status: LeaveReviewDecision.APPROVED, reviewed_by: managerId, review_note: null }); // null = no longer pending
|
|
436
|
+
const cancelled = await supabase.leaveRequests.cancel(request.mms_id, userId); // null = already closed
|
|
437
|
+
const mine = await supabase.leaveRequests.list({ ...query, user_id: me }); // one list; user_id narrows it
|
|
438
|
+
const reports = await supabase.leaveRequests.list(query, { userIds: [me, ...(await supabase.users.idsManagedBy(me))] });
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
`review`, `cancel` and `update` are compare-and-set writes (`updateWhere`): they land only while
|
|
442
|
+
the request is still in the status they expect and resolve to `null` otherwise, so two reviewers
|
|
443
|
+
cannot both decide the same request. The `leave_requests` table also carries an exclusion
|
|
444
|
+
constraint so two overlapping live requests of one user cannot both be inserted in a race.
|
|
445
|
+
|
|
446
|
+
## Public holidays
|
|
447
|
+
|
|
448
|
+
The public-holiday calendar, `public_holidays`, on the caller's client as `supabase.publicHolidays`.
|
|
449
|
+
Global like configs: there is no organization on a row, every signed-in caller reads the same
|
|
450
|
+
list, and only the service role may write — Scott maintains it in Supabase Studio, so the SDK is
|
|
451
|
+
read-only here. Several holidays may share a date; only the ones with `religion` null count as a
|
|
452
|
+
day off for everyone.
|
|
453
|
+
|
|
454
|
+
```ts
|
|
455
|
+
const year = await supabase.publicHolidays.list({ year: 2026 });
|
|
456
|
+
const off = await supabase.publicHolidays.datesBetween('2026-09-21', '2026-09-25'); // Set of religion-neutral dates
|
|
457
|
+
```
|
|
458
|
+
|
|
403
459
|
## Errors
|
|
404
460
|
|
|
405
461
|
Every error the SDK throws is a `SupabaseClientError` carrying the HTTP `status` to respond
|
|
@@ -416,29 +472,40 @@ that branch on one (the invoice-number retry on `23505`).
|
|
|
416
472
|
## Cache
|
|
417
473
|
|
|
418
474
|
```ts
|
|
419
|
-
import {
|
|
420
|
-
import {
|
|
475
|
+
import { createCache, profileCacheKey } from '@managemint-solutions/sdk/cache';
|
|
476
|
+
import { PROFILE_CACHE_TTL_SECONDS } from '@managemint-solutions/entities/users/cache';
|
|
477
|
+
import { FEATURE_FLAGS_CACHE_KEY } from '@managemint-solutions/entities/feature-flags';
|
|
478
|
+
|
|
479
|
+
const cache = createCache({ url: UPSTASH_REDIS_REST_URL, token: UPSTASH_REDIS_REST_TOKEN });
|
|
421
480
|
|
|
422
|
-
|
|
481
|
+
// Profiles: one hash per organization, one field per member.
|
|
482
|
+
await cache.setField(profileCacheKey(organizationId), mmsId, profile, PROFILE_CACHE_TTL_SECONDS);
|
|
483
|
+
const hit = await cache.getField<LoggedInUser>(profileCacheKey(organizationId), mmsId); // null on a miss
|
|
484
|
+
await cache.deleteField(profileCacheKey(organizationId), mmsId); // one member
|
|
485
|
+
await cache.delete(profileCacheKey(organizationId)); // every member
|
|
423
486
|
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
await cache.
|
|
487
|
+
// Global values: plain strings with their own TTL.
|
|
488
|
+
await cache.set(FEATURE_FLAGS_CACHE_KEY, flags, 86_400);
|
|
489
|
+
const flags = await cache.get<FeatureFlags>(FEATURE_FLAGS_CACHE_KEY);
|
|
427
490
|
```
|
|
428
491
|
|
|
429
|
-
A
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
and
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
492
|
+
A small client on Upstash Redis (REST), shared by the portal, which reads and writes each
|
|
493
|
+
member's own `GET /users/me` and reads the feature flags, and the api, which writes the flags
|
|
494
|
+
and drops profile entries after a write. Two shapes, chosen so the data browser stays readable
|
|
495
|
+
and nothing needs an index of its own: a **string** per global value, and a **hash per
|
|
496
|
+
organization** for the profiles, so dropping a member is one field delete and dropping an
|
|
497
|
+
organization is one key delete. `setField` is one pipeline (`HSET`, then `EXPIRE … NX`): the
|
|
498
|
+
hash's TTL is set once, when it is first written, so an organization's whole cache re-reads
|
|
499
|
+
once a day however busy it is. Every other call is one round trip. Values are JSON-serialised
|
|
500
|
+
by the client; `get<T>` / `getField<T>` are the caller's promise about what was written, not a
|
|
501
|
+
check.
|
|
436
502
|
|
|
437
503
|
The client takes its URL and token as config — the SDK reads no environment variables — and
|
|
438
504
|
retries once with a three-second timeout per request. It **throws** on a failed call: what a
|
|
439
505
|
failure means is the caller's decision, and both callers today fail open (a miss on the portal,
|
|
440
|
-
a Sentry report on the api). The key
|
|
441
|
-
`@managemint-solutions/entities/users/cache
|
|
506
|
+
a Sentry report on the api). The key prefix and TTL for the profile hash live in
|
|
507
|
+
`@managemint-solutions/entities/users/cache` and the flags key in `entities/feature-flags`;
|
|
508
|
+
`profileCacheKey` here is the one builder both sides use.
|
|
442
509
|
|
|
443
510
|
## NestJS
|
|
444
511
|
|
package/dist/cache/index.d.ts
CHANGED
|
@@ -1,41 +1,47 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* The Upstash Redis cache shared by the portal (which reads and writes profile entries and
|
|
3
|
+
* reads the feature flags) and the api (which writes the flags and deletes profile entries).
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
* `tag:<tag>`. Expiring a tag deletes every key in the set and the set itself. The sets expire
|
|
7
|
-
* with the entries they hold, so an entry that simply ages out leaves nothing behind.
|
|
5
|
+
* Two shapes, chosen so the data browser stays readable and nothing needs an index of its own:
|
|
8
6
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
7
|
+
* - **A string per global value** - the feature flags - with its own TTL.
|
|
8
|
+
* - **A hash per organization** for the member profiles: one field per member, so dropping a
|
|
9
|
+
* member is one field delete and dropping an organization is one key delete. The hash's
|
|
10
|
+
* TTL is set once, when it is first written, so the whole organization re-reads once a day
|
|
11
|
+
* however busy it is.
|
|
11
12
|
*
|
|
12
13
|
* Like every other client in the SDK it takes its configuration as an argument and reads no
|
|
13
14
|
* environment variables. It throws on a failed call; the callers decide what a failure means,
|
|
14
15
|
* and both of them fail open.
|
|
15
16
|
*/
|
|
16
|
-
export type
|
|
17
|
+
export type CacheConfig = {
|
|
17
18
|
/** The database's REST URL, `https://<name>.upstash.io`. */
|
|
18
19
|
url: string;
|
|
19
20
|
/** The database's REST token. */
|
|
20
21
|
token: string;
|
|
21
22
|
};
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
/** The tags a later `invalidateTag` may drop the entry under. */
|
|
26
|
-
tags?: string[];
|
|
27
|
-
};
|
|
28
|
-
export declare class TaggedCache {
|
|
23
|
+
/** The hash that holds an organization's cached member profiles. */
|
|
24
|
+
export declare const profileCacheKey: (organizationId: string) => string;
|
|
25
|
+
export declare class Cache {
|
|
29
26
|
private readonly redis;
|
|
30
|
-
constructor(config:
|
|
27
|
+
constructor(config: CacheConfig);
|
|
31
28
|
/**
|
|
32
|
-
* The
|
|
29
|
+
* The string under `key`, or null when there is none. The value is JSON-parsed by the
|
|
33
30
|
* client; `T` is the caller's promise about what was written, not a check.
|
|
34
31
|
*/
|
|
35
32
|
get<T>(key: string): Promise<T | null>;
|
|
36
|
-
/** Writes `value` under `key` for `ttl` seconds
|
|
37
|
-
set(key: string, value: unknown,
|
|
38
|
-
/** Deletes
|
|
39
|
-
|
|
33
|
+
/** Writes `value` under `key` for `ttl` seconds. One round trip. */
|
|
34
|
+
set(key: string, value: unknown, ttl: number): Promise<void>;
|
|
35
|
+
/** Deletes `key` - a string or a whole hash. One round trip. */
|
|
36
|
+
delete(key: string): Promise<void>;
|
|
37
|
+
/** One field of the hash under `key`, or null when either is missing. */
|
|
38
|
+
getField<T>(key: string, field: string): Promise<T | null>;
|
|
39
|
+
/**
|
|
40
|
+
* Writes one field of the hash under `key`, and gives the hash `ttl` seconds to live if it
|
|
41
|
+
* has no expiry yet - a hash written to every day still dies once a day. One round trip.
|
|
42
|
+
*/
|
|
43
|
+
setField(key: string, field: string, value: unknown, ttl: number): Promise<void>;
|
|
44
|
+
/** Deletes one field of the hash under `key`; a missing field or hash is a no-op. One round trip. */
|
|
45
|
+
deleteField(key: string, field: string): Promise<void>;
|
|
40
46
|
}
|
|
41
|
-
export declare const
|
|
47
|
+
export declare const createCache: (config: CacheConfig) => Cache;
|
package/dist/cache/index.js
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.createCache = exports.Cache = exports.profileCacheKey = void 0;
|
|
4
4
|
const redis_1 = require("@upstash/redis");
|
|
5
|
+
const cache_1 = require("@managemint-solutions/entities/users/cache");
|
|
5
6
|
/**
|
|
6
7
|
* How long one Upstash call may take before it is abandoned. Every call here sits on the
|
|
7
|
-
* request path - a portal boot on the read side, a profile write on the
|
|
8
|
+
* request path - a portal boot on the read side, a profile write on the delete side - so a
|
|
8
9
|
* stalled Redis must cost the caller a bounded wait and nothing more.
|
|
9
10
|
*/
|
|
10
11
|
const REQUEST_TIMEOUT_MS = 3_000;
|
|
11
12
|
/** One retry, briefly: the callers fail open, so patience only lengthens the miss. */
|
|
12
13
|
const RETRY = { retries: 1, backoff: () => 200 };
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
/** The hash that holds an organization's cached member profiles. */
|
|
15
|
+
const profileCacheKey = (organizationId) => `${cache_1.PROFILE_CACHE_KEY_PREFIX}${organizationId}`;
|
|
16
|
+
exports.profileCacheKey = profileCacheKey;
|
|
17
|
+
class Cache {
|
|
15
18
|
redis;
|
|
16
19
|
constructor(config) {
|
|
17
20
|
this.redis = new redis_1.Redis({
|
|
@@ -24,36 +27,40 @@ class TaggedCache {
|
|
|
24
27
|
});
|
|
25
28
|
}
|
|
26
29
|
/**
|
|
27
|
-
* The
|
|
30
|
+
* The string under `key`, or null when there is none. The value is JSON-parsed by the
|
|
28
31
|
* client; `T` is the caller's promise about what was written, not a check.
|
|
29
32
|
*/
|
|
30
33
|
get(key) {
|
|
31
34
|
return this.redis.get(key);
|
|
32
35
|
}
|
|
33
|
-
/** Writes `value` under `key` for `ttl` seconds
|
|
34
|
-
async set(key, value,
|
|
35
|
-
|
|
36
|
-
for (const tag of tags) {
|
|
37
|
-
// The set lives at least as long as its newest member, so a member can never outlive
|
|
38
|
-
// the set that would be used to find it.
|
|
39
|
-
pipeline.sadd(tagSetKey(tag), key).expire(tagSetKey(tag), ttl);
|
|
40
|
-
}
|
|
41
|
-
await pipeline.exec();
|
|
36
|
+
/** Writes `value` under `key` for `ttl` seconds. One round trip. */
|
|
37
|
+
async set(key, value, ttl) {
|
|
38
|
+
await this.redis.set(key, value, { ex: ttl });
|
|
42
39
|
}
|
|
43
|
-
/** Deletes
|
|
44
|
-
async
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
40
|
+
/** Deletes `key` - a string or a whole hash. One round trip. */
|
|
41
|
+
async delete(key) {
|
|
42
|
+
await this.redis.del(key);
|
|
43
|
+
}
|
|
44
|
+
/** One field of the hash under `key`, or null when either is missing. */
|
|
45
|
+
getField(key, field) {
|
|
46
|
+
return this.redis.hget(key, field);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Writes one field of the hash under `key`, and gives the hash `ttl` seconds to live if it
|
|
50
|
+
* has no expiry yet - a hash written to every day still dies once a day. One round trip.
|
|
51
|
+
*/
|
|
52
|
+
async setField(key, field, value, ttl) {
|
|
53
|
+
await this.redis
|
|
54
|
+
.pipeline()
|
|
55
|
+
.hset(key, { [field]: value })
|
|
56
|
+
.expire(key, ttl, 'NX')
|
|
57
|
+
.exec();
|
|
58
|
+
}
|
|
59
|
+
/** Deletes one field of the hash under `key`; a missing field or hash is a no-op. One round trip. */
|
|
60
|
+
async deleteField(key, field) {
|
|
61
|
+
await this.redis.hdel(key, field);
|
|
55
62
|
}
|
|
56
63
|
}
|
|
57
|
-
exports.
|
|
58
|
-
const
|
|
59
|
-
exports.
|
|
64
|
+
exports.Cache = Cache;
|
|
65
|
+
const createCache = (config) => new Cache(config);
|
|
66
|
+
exports.createCache = createCache;
|
package/dist/client.d.ts
CHANGED
|
@@ -8,9 +8,11 @@ import { NotesResource } from './notes';
|
|
|
8
8
|
import { NotificationsResource } from './notifications';
|
|
9
9
|
import { BillingReadsResource } from './billing';
|
|
10
10
|
import { InvoicesReadsResource } from './billing/invoices';
|
|
11
|
+
import { LeaveEntitlementsResource, LeaveRequestsResource, LeaveTypesResource } from './leave';
|
|
11
12
|
import { OrganizationsResource } from './organizations';
|
|
12
13
|
import { PermissionsResource } from './permissions';
|
|
13
14
|
import { ProjectsResource } from './projects';
|
|
15
|
+
import { PublicHolidaysResource } from './public-holidays';
|
|
14
16
|
import { StatusesResource } from './statuses';
|
|
15
17
|
import { SupportingFilesResource } from './supporting-files';
|
|
16
18
|
import { TasksResource } from './tasks';
|
|
@@ -56,6 +58,10 @@ export declare class SupabaseClient {
|
|
|
56
58
|
readonly clients: ClientsResource;
|
|
57
59
|
readonly projects: ProjectsResource;
|
|
58
60
|
readonly tasks: TasksResource;
|
|
61
|
+
readonly leaveTypes: LeaveTypesResource;
|
|
62
|
+
readonly publicHolidays: PublicHolidaysResource;
|
|
63
|
+
readonly leaveEntitlements: LeaveEntitlementsResource;
|
|
64
|
+
readonly leaveRequests: LeaveRequestsResource;
|
|
59
65
|
constructor(config: SupabaseClientConfig);
|
|
60
66
|
}
|
|
61
67
|
export declare const createSupabaseClient: (config: SupabaseClientConfig) => SupabaseClient;
|
package/dist/client.js
CHANGED
|
@@ -10,9 +10,11 @@ const notes_1 = require("./notes");
|
|
|
10
10
|
const notifications_1 = require("./notifications");
|
|
11
11
|
const billing_1 = require("./billing");
|
|
12
12
|
const invoices_1 = require("./billing/invoices");
|
|
13
|
+
const leave_1 = require("./leave");
|
|
13
14
|
const organizations_1 = require("./organizations");
|
|
14
15
|
const permissions_1 = require("./permissions");
|
|
15
16
|
const projects_1 = require("./projects");
|
|
17
|
+
const public_holidays_1 = require("./public-holidays");
|
|
16
18
|
const statuses_1 = require("./statuses");
|
|
17
19
|
const supporting_files_1 = require("./supporting-files");
|
|
18
20
|
const tasks_1 = require("./tasks");
|
|
@@ -41,6 +43,10 @@ class SupabaseClient {
|
|
|
41
43
|
clients;
|
|
42
44
|
projects;
|
|
43
45
|
tasks;
|
|
46
|
+
leaveTypes;
|
|
47
|
+
publicHolidays;
|
|
48
|
+
leaveEntitlements;
|
|
49
|
+
leaveRequests;
|
|
44
50
|
constructor(config) {
|
|
45
51
|
this.auth = config.auth;
|
|
46
52
|
this.supabase =
|
|
@@ -61,6 +67,11 @@ class SupabaseClient {
|
|
|
61
67
|
this.clients = new clients_1.ClientsResource(this.supabase, this.auth, this.audit);
|
|
62
68
|
this.projects = new projects_1.ProjectsResource(this.supabase, this.auth, this.audit);
|
|
63
69
|
this.tasks = new tasks_1.TasksResource(this.supabase, this.auth, this.audit);
|
|
70
|
+
this.leaveTypes = new leave_1.LeaveTypesResource(this.supabase, this.auth, this.audit);
|
|
71
|
+
// Global like configs: every signed-in caller reads the same calendar, nobody writes it here.
|
|
72
|
+
this.publicHolidays = new public_holidays_1.PublicHolidaysResource(this.supabase);
|
|
73
|
+
this.leaveEntitlements = new leave_1.LeaveEntitlementsResource(this.supabase, this.auth, this.audit);
|
|
74
|
+
this.leaveRequests = new leave_1.LeaveRequestsResource(this.supabase, this.auth, this.audit);
|
|
64
75
|
}
|
|
65
76
|
}
|
|
66
77
|
exports.SupabaseClient = SupabaseClient;
|
package/dist/index.d.ts
CHANGED
|
@@ -36,4 +36,8 @@ export { GetSupportingFilesDto, SupportingFileIdDto } from './supporting-files';
|
|
|
36
36
|
export { ClientIdDto, CreateClientDto, GetClientsDto, UpdateClientDto } from './clients';
|
|
37
37
|
export { CreateProjectDto, GetProjectsDto, ProjectIdDto, UpdateProjectDto } from './projects';
|
|
38
38
|
export { CreateTaskDto, GetTasksDto, TaskIdDto, UpdateTaskDto } from './tasks';
|
|
39
|
+
export type { CreateLeaveEntitlementInput, CreateLeaveRequestRow, LeaveEntitlementCover, ReviewLeaveRequestRow, UpdateLeaveRequestRow, } from './leave';
|
|
40
|
+
export { CreateLeaveEntitlementDto, CreateLeaveRequestDto, CreateLeaveTypeDto, GetLeaveEntitlementsDto, GetLeaveRequestsDto, GetLeaveTypesDto, LeaveEntitlementIdDto, LeaveRequestIdDto, LeaveTypeIdDto, ReviewLeaveRequestDto, UpdateLeaveEntitlementDto, UpdateLeaveRequestDto, UpdateLeaveTypeDto, } from './leave';
|
|
41
|
+
export { GetPublicHolidaysDto } from './public-holidays';
|
|
42
|
+
export { addOneYearMinusDay, countWorkingDays, isWithinPeriod, leavePeriodFor, todayInJohannesburg, } from './leave';
|
|
39
43
|
export { monthlyTotalMinor } from './pricebooks';
|
package/dist/index.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
// to keep. The row and input types they produce and accept are exported for annotations.
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.UserIdDto = exports.UpdateUserDto = exports.UpdateMyProfileDto = exports.GetUsersQueryDto = exports.AddUserDto = exports.UpdatePermissionsDto = exports.PermissionsResource = exports.UpdateOrganizationDto = exports.CreateOrganizationDto = exports.NotificationIdDto = exports.GetNotificationsDto = exports.NoteIdDto = exports.GetNotesDto = exports.AddNoteDto = exports.UpdateAdditionalDetailsDto = exports.IsAdditionalDetailsValueByType = exports.GetAdditionalDetailsDto = exports.AdditionalDetailsIdDto = exports.AddAdditionalDetailsDto = exports.UpdateStatusDto = exports.StatusIdDto = exports.GetStatusesDto = exports.AddStatusDto = exports.CreateSupportRequestDto = exports.UpdateConfigDto = exports.CreateConfigDto = exports.CreateFeatureRequestDto = exports.InvoiceIdDto = exports.GetInvoicesQueryDto = exports.ReinstateSubscriptionDto = exports.PurchaseModuleDto = exports.PaymentIdDto = exports.InitialPaymentDto = exports.GetPaymentsQueryDto = exports.CancelSubscriptionDto = exports.GetAuditTrailDto = exports.IsNullable = exports.EmptyToNull = exports.SupabaseClientError = exports.createSupabaseServiceClient = exports.SupabaseServiceClient = exports.SignInDto = exports.SendPasswordResetEmailDto = exports.ResetPasswordDto = exports.ExchangeTokenHashDto = exports.ExchangeRefreshTokenDto = exports.createSupabaseAuthClient = exports.SupabaseAuthClient = exports.createSupabaseClient = exports.SupabaseClient = void 0;
|
|
11
|
-
exports.monthlyTotalMinor = exports.UpdateTaskDto = exports.TaskIdDto = exports.GetTasksDto = exports.CreateTaskDto = exports.UpdateProjectDto = exports.ProjectIdDto = exports.GetProjectsDto = exports.CreateProjectDto = exports.UpdateClientDto = exports.GetClientsDto = exports.CreateClientDto = exports.ClientIdDto = exports.SupportingFileIdDto = exports.GetSupportingFilesDto = void 0;
|
|
11
|
+
exports.monthlyTotalMinor = exports.todayInJohannesburg = exports.leavePeriodFor = exports.isWithinPeriod = exports.countWorkingDays = exports.addOneYearMinusDay = exports.GetPublicHolidaysDto = exports.UpdateLeaveTypeDto = exports.UpdateLeaveRequestDto = exports.UpdateLeaveEntitlementDto = exports.ReviewLeaveRequestDto = exports.LeaveTypeIdDto = exports.LeaveRequestIdDto = exports.LeaveEntitlementIdDto = exports.GetLeaveTypesDto = exports.GetLeaveRequestsDto = exports.GetLeaveEntitlementsDto = exports.CreateLeaveTypeDto = exports.CreateLeaveRequestDto = exports.CreateLeaveEntitlementDto = exports.UpdateTaskDto = exports.TaskIdDto = exports.GetTasksDto = exports.CreateTaskDto = exports.UpdateProjectDto = exports.ProjectIdDto = exports.GetProjectsDto = exports.CreateProjectDto = exports.UpdateClientDto = exports.GetClientsDto = exports.CreateClientDto = exports.ClientIdDto = exports.SupportingFileIdDto = exports.GetSupportingFilesDto = void 0;
|
|
12
12
|
var client_1 = require("./client");
|
|
13
13
|
Object.defineProperty(exports, "SupabaseClient", { enumerable: true, get: function () { return client_1.SupabaseClient; } });
|
|
14
14
|
Object.defineProperty(exports, "createSupabaseClient", { enumerable: true, get: function () { return client_1.createSupabaseClient; } });
|
|
@@ -99,5 +99,29 @@ Object.defineProperty(exports, "CreateTaskDto", { enumerable: true, get: functio
|
|
|
99
99
|
Object.defineProperty(exports, "GetTasksDto", { enumerable: true, get: function () { return tasks_1.GetTasksDto; } });
|
|
100
100
|
Object.defineProperty(exports, "TaskIdDto", { enumerable: true, get: function () { return tasks_1.TaskIdDto; } });
|
|
101
101
|
Object.defineProperty(exports, "UpdateTaskDto", { enumerable: true, get: function () { return tasks_1.UpdateTaskDto; } });
|
|
102
|
+
var leave_1 = require("./leave");
|
|
103
|
+
Object.defineProperty(exports, "CreateLeaveEntitlementDto", { enumerable: true, get: function () { return leave_1.CreateLeaveEntitlementDto; } });
|
|
104
|
+
Object.defineProperty(exports, "CreateLeaveRequestDto", { enumerable: true, get: function () { return leave_1.CreateLeaveRequestDto; } });
|
|
105
|
+
Object.defineProperty(exports, "CreateLeaveTypeDto", { enumerable: true, get: function () { return leave_1.CreateLeaveTypeDto; } });
|
|
106
|
+
Object.defineProperty(exports, "GetLeaveEntitlementsDto", { enumerable: true, get: function () { return leave_1.GetLeaveEntitlementsDto; } });
|
|
107
|
+
Object.defineProperty(exports, "GetLeaveRequestsDto", { enumerable: true, get: function () { return leave_1.GetLeaveRequestsDto; } });
|
|
108
|
+
Object.defineProperty(exports, "GetLeaveTypesDto", { enumerable: true, get: function () { return leave_1.GetLeaveTypesDto; } });
|
|
109
|
+
Object.defineProperty(exports, "LeaveEntitlementIdDto", { enumerable: true, get: function () { return leave_1.LeaveEntitlementIdDto; } });
|
|
110
|
+
Object.defineProperty(exports, "LeaveRequestIdDto", { enumerable: true, get: function () { return leave_1.LeaveRequestIdDto; } });
|
|
111
|
+
Object.defineProperty(exports, "LeaveTypeIdDto", { enumerable: true, get: function () { return leave_1.LeaveTypeIdDto; } });
|
|
112
|
+
Object.defineProperty(exports, "ReviewLeaveRequestDto", { enumerable: true, get: function () { return leave_1.ReviewLeaveRequestDto; } });
|
|
113
|
+
Object.defineProperty(exports, "UpdateLeaveEntitlementDto", { enumerable: true, get: function () { return leave_1.UpdateLeaveEntitlementDto; } });
|
|
114
|
+
Object.defineProperty(exports, "UpdateLeaveRequestDto", { enumerable: true, get: function () { return leave_1.UpdateLeaveRequestDto; } });
|
|
115
|
+
Object.defineProperty(exports, "UpdateLeaveTypeDto", { enumerable: true, get: function () { return leave_1.UpdateLeaveTypeDto; } });
|
|
116
|
+
var public_holidays_1 = require("./public-holidays");
|
|
117
|
+
Object.defineProperty(exports, "GetPublicHolidaysDto", { enumerable: true, get: function () { return public_holidays_1.GetPublicHolidaysDto; } });
|
|
118
|
+
// The calendar arithmetic is plain functions, not a resource, so the api counts days with the
|
|
119
|
+
// same code the SDK's tests pin down.
|
|
120
|
+
var leave_2 = require("./leave");
|
|
121
|
+
Object.defineProperty(exports, "addOneYearMinusDay", { enumerable: true, get: function () { return leave_2.addOneYearMinusDay; } });
|
|
122
|
+
Object.defineProperty(exports, "countWorkingDays", { enumerable: true, get: function () { return leave_2.countWorkingDays; } });
|
|
123
|
+
Object.defineProperty(exports, "isWithinPeriod", { enumerable: true, get: function () { return leave_2.isWithinPeriod; } });
|
|
124
|
+
Object.defineProperty(exports, "leavePeriodFor", { enumerable: true, get: function () { return leave_2.leavePeriodFor; } });
|
|
125
|
+
Object.defineProperty(exports, "todayInJohannesburg", { enumerable: true, get: function () { return leave_2.todayInJohannesburg; } });
|
|
102
126
|
var pricebooks_1 = require("./pricebooks");
|
|
103
127
|
Object.defineProperty(exports, "monthlyTotalMinor", { enumerable: true, get: function () { return pricebooks_1.monthlyTotalMinor; } });
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { CreateLeaveEntitlementDto as CreateLeaveEntitlementDtoType, CreateLeaveRequestDto as CreateLeaveRequestDtoType, CreateLeaveTypeDto as CreateLeaveTypeDtoType, GetLeaveEntitlementsDto as GetLeaveEntitlementsDtoType, GetLeaveRequestsDto as GetLeaveRequestsDtoType, GetLeaveTypesDto as GetLeaveTypesDtoType, LeaveEntitlementIdDto as LeaveEntitlementIdDtoType, LeaveRequestIdDto as LeaveRequestIdDtoType, LeaveTypeIdDto as LeaveTypeIdDtoType, ReviewLeaveRequestDto as ReviewLeaveRequestDtoType, UpdateLeaveEntitlementDto as UpdateLeaveEntitlementDtoType, UpdateLeaveRequestDto as UpdateLeaveRequestDtoType, UpdateLeaveTypeDto as UpdateLeaveTypeDtoType } from '@managemint-solutions/entities/leave/dto';
|
|
2
|
+
import { LeaveRequestStatus, LeaveReviewDecision } from '@managemint-solutions/entities/leave/enum';
|
|
3
|
+
export declare class LeaveTypeIdDto implements LeaveTypeIdDtoType {
|
|
4
|
+
readonly leaveTypeId: string;
|
|
5
|
+
}
|
|
6
|
+
export declare class GetLeaveTypesDto implements GetLeaveTypesDtoType {
|
|
7
|
+
readonly active?: boolean | null;
|
|
8
|
+
}
|
|
9
|
+
export declare class CreateLeaveTypeDto implements CreateLeaveTypeDtoType {
|
|
10
|
+
readonly name: string;
|
|
11
|
+
readonly description: string | null;
|
|
12
|
+
readonly default_days: number;
|
|
13
|
+
readonly is_paid: boolean;
|
|
14
|
+
readonly requires_approval: boolean;
|
|
15
|
+
}
|
|
16
|
+
export declare class UpdateLeaveTypeDto implements UpdateLeaveTypeDtoType {
|
|
17
|
+
readonly name: string;
|
|
18
|
+
readonly description: string | null;
|
|
19
|
+
readonly default_days: number;
|
|
20
|
+
readonly is_paid: boolean;
|
|
21
|
+
readonly requires_approval: boolean;
|
|
22
|
+
readonly active: boolean;
|
|
23
|
+
}
|
|
24
|
+
export declare class LeaveEntitlementIdDto implements LeaveEntitlementIdDtoType {
|
|
25
|
+
readonly leaveEntitlementId: string;
|
|
26
|
+
}
|
|
27
|
+
export declare class GetLeaveEntitlementsDto implements GetLeaveEntitlementsDtoType {
|
|
28
|
+
readonly page: number;
|
|
29
|
+
readonly page_size: number;
|
|
30
|
+
readonly user_id?: string | null;
|
|
31
|
+
readonly leave_type_id?: string | null;
|
|
32
|
+
readonly as_of?: string | null;
|
|
33
|
+
}
|
|
34
|
+
export declare class CreateLeaveEntitlementDto implements CreateLeaveEntitlementDtoType {
|
|
35
|
+
readonly user_id: string;
|
|
36
|
+
readonly leave_type_id: string;
|
|
37
|
+
readonly days_entitled: number;
|
|
38
|
+
readonly period_start: string | null;
|
|
39
|
+
readonly period_end: string | null;
|
|
40
|
+
readonly notes: string | null;
|
|
41
|
+
}
|
|
42
|
+
export declare class UpdateLeaveEntitlementDto implements UpdateLeaveEntitlementDtoType {
|
|
43
|
+
readonly days_entitled: number;
|
|
44
|
+
readonly period_end: string;
|
|
45
|
+
readonly notes: string | null;
|
|
46
|
+
}
|
|
47
|
+
export declare class LeaveRequestIdDto implements LeaveRequestIdDtoType {
|
|
48
|
+
readonly leaveRequestId: string;
|
|
49
|
+
}
|
|
50
|
+
export declare class GetLeaveRequestsDto implements GetLeaveRequestsDtoType {
|
|
51
|
+
readonly page: number;
|
|
52
|
+
readonly page_size: number;
|
|
53
|
+
readonly user_id?: string | null;
|
|
54
|
+
readonly status?: LeaveRequestStatus | null;
|
|
55
|
+
readonly start_date_after?: string | null;
|
|
56
|
+
readonly start_date_before?: string | null;
|
|
57
|
+
}
|
|
58
|
+
export declare class CreateLeaveRequestDto implements CreateLeaveRequestDtoType {
|
|
59
|
+
readonly leave_type_id: string;
|
|
60
|
+
readonly start_date: string;
|
|
61
|
+
readonly end_date: string;
|
|
62
|
+
readonly is_half_day: boolean;
|
|
63
|
+
readonly reason: string | null;
|
|
64
|
+
}
|
|
65
|
+
export declare class UpdateLeaveRequestDto implements UpdateLeaveRequestDtoType {
|
|
66
|
+
readonly leave_type_id: string;
|
|
67
|
+
readonly start_date: string;
|
|
68
|
+
readonly end_date: string;
|
|
69
|
+
readonly is_half_day: boolean;
|
|
70
|
+
readonly reason: string | null;
|
|
71
|
+
}
|
|
72
|
+
export declare class ReviewLeaveRequestDto implements ReviewLeaveRequestDtoType {
|
|
73
|
+
readonly status: LeaveReviewDecision;
|
|
74
|
+
readonly review_note: string | null;
|
|
75
|
+
}
|