@managemint-solutions/sdk 0.37.0 → 0.38.1
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 +32 -27
- package/dist/audit/dto.js +1 -1
- package/dist/audit/index.d.ts +12 -12
- package/dist/audit/index.js +9 -9
- package/dist/auth-client/index.d.ts +2 -2
- package/dist/auth-client/index.js +2 -2
- package/dist/auth.d.ts +3 -3
- package/dist/auth.js +3 -3
- package/dist/billing/dto.js +1 -1
- package/dist/billing/index.d.ts +4 -4
- package/dist/billing/index.js +5 -5
- package/dist/billing/invoices/dto.js +1 -1
- package/dist/billing/invoices/index.d.ts +6 -6
- package/dist/billing/invoices/index.js +7 -7
- package/dist/client.d.ts +3 -3
- package/dist/client.js +1 -1
- package/dist/clients/index.d.ts +1 -1
- package/dist/clients/index.js +1 -1
- package/dist/configs/dto.js +3 -3
- package/dist/configs/index.d.ts +3 -3
- package/dist/configs/index.js +3 -3
- package/dist/errors.d.ts +2 -2
- package/dist/errors.js +2 -2
- package/dist/feature-requests/dto.js +1 -1
- package/dist/feature-requests/index.d.ts +3 -3
- package/dist/feature-requests/index.js +2 -2
- package/dist/index.js +2 -2
- package/dist/leave/dto.d.ts +1 -0
- package/dist/leave/dto.js +7 -0
- package/dist/leave/leave-entitlements.d.ts +6 -0
- package/dist/leave/leave-entitlements.js +22 -0
- package/dist/leave/leave-requests.js +3 -0
- package/dist/nest/index.d.ts +5 -5
- package/dist/nest/index.js +4 -4
- package/dist/notifications/index.d.ts +8 -8
- package/dist/notifications/index.js +8 -8
- package/dist/organization-invites/index.d.ts +3 -3
- package/dist/organization-invites/index.js +2 -2
- package/dist/organization-payment-methods/index.d.ts +3 -3
- package/dist/organization-payment-methods/index.js +3 -3
- package/dist/organizations/index.d.ts +7 -7
- package/dist/organizations/index.js +7 -7
- package/dist/permissions/index.d.ts +6 -6
- package/dist/permissions/index.js +6 -6
- package/dist/pricebooks/index.d.ts +2 -2
- package/dist/pricebooks/index.js +3 -3
- package/dist/projects/dto.js +2 -2
- package/dist/projects/index.d.ts +1 -1
- package/dist/projects/index.js +2 -2
- package/dist/service-client/index.d.ts +5 -5
- package/dist/service-client/index.js +5 -5
- package/dist/support/dto.js +1 -1
- package/dist/supporting-files/dto.js +1 -1
- package/dist/supporting-files/index.js +5 -5
- package/dist/supporting-files/paths.d.ts +3 -3
- package/dist/supporting-files/paths.js +4 -4
- package/dist/tasks/dto.js +4 -4
- package/dist/tasks/index.d.ts +1 -1
- package/dist/tasks/index.js +2 -2
- package/dist/transforms.d.ts +6 -6
- package/dist/transforms.js +8 -8
- package/dist/users/dto.d.ts +3 -3
- package/dist/users/dto.js +4 -4
- package/dist/users/index.d.ts +2 -2
- package/dist/users/index.js +2 -2
- package/dist/users/paths.d.ts +2 -2
- package/dist/users/paths.js +2 -2
- package/dist/webhook-events/index.d.ts +3 -3
- package/dist/webhook-events/index.js +3 -3
- package/package.json +2 -2
package/dist/transforms.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// select strings and their list results.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
5
|
exports.restoredPatch = exports.deletedPatch = exports.unarchivedPatch = exports.archivedPatch = exports.toMmsList = exports.USER_PROFILE_EMBED = exports.toDateInput = exports.orIlike = exports.ilikeContains = exports.parseEntityIdFilter = void 0;
|
|
6
|
-
// v7, to match the `mms_id` columns these filters compare against
|
|
6
|
+
// v7, to match the `mms_id` columns these filters compare against - `public.uuidv7()` is the
|
|
7
7
|
// default on every table. This is the gate in front of `@IsUUID('7')`, so a stricter version
|
|
8
8
|
// here would null the id out before validation ever saw it, and a looser one would let a value
|
|
9
9
|
// through that the DTO then rejects.
|
|
@@ -11,7 +11,7 @@ const UUID_V7 = /^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f
|
|
|
11
11
|
/**
|
|
12
12
|
* The `client_id` / `project_id` list filters accept either a plain UUID v7 or the base64-JSON
|
|
13
13
|
* option value the portal's selects send (`{ mms_id }`, or `{ id }` as a fallback). Anything that
|
|
14
|
-
* is not one of those
|
|
14
|
+
* is not one of those - including a value that decodes to JSON without a UUID v7 - cannot filter
|
|
15
15
|
* anything, so it becomes `null` and the filter is skipped.
|
|
16
16
|
*/
|
|
17
17
|
const parseEntityIdFilter = (value) => {
|
|
@@ -35,19 +35,19 @@ exports.parseEntityIdFilter = parseEntityIdFilter;
|
|
|
35
35
|
/**
|
|
36
36
|
* A `%value%` ilike pattern, double-quoted for PostgREST's `or=(...)` grammar so `,`, `(`, `)`,
|
|
37
37
|
* `.`, `"` and `\` in the search stay literal instead of being read as more filters. Inside the
|
|
38
|
-
* quotes only `"` and `\` need escaping, which is what PostgREST defines
|
|
38
|
+
* quotes only `"` and `\` need escaping, which is what PostgREST defines - the `\,` the list
|
|
39
39
|
* endpoints used to emit was never an escape at all. LIKE's own wildcards `%` and `_` are left
|
|
40
40
|
* alone and still match as wildcards; they only widen the caller's own search, never its scope.
|
|
41
41
|
*/
|
|
42
42
|
const ilikeContains = (value) => `"%${value.replace(/[\\"]/g, '\\$&')}%"`;
|
|
43
43
|
exports.ilikeContains = ilikeContains;
|
|
44
|
-
/** The `or=(...)` argument matching `search` against any of `columns`
|
|
44
|
+
/** The `or=(...)` argument matching `search` against any of `columns` - `name.ilike."%x%",…`. */
|
|
45
45
|
const orIlike = (columns, search) => columns.map((column) => `${column}.ilike.${(0, exports.ilikeContains)(search)}`).join(',');
|
|
46
46
|
exports.orIlike = orIlike;
|
|
47
47
|
/**
|
|
48
48
|
* `date` columns take an ISO string. The shared `CreateProjectDto`/`UpdateProjectDto` types
|
|
49
|
-
* declare `Date`, but over the wire the value is the validated `@IsDateString` string
|
|
50
|
-
* must reach Postgres byte-identical ('2026-04-22' is a plain date, not an instant)
|
|
49
|
+
* declare `Date`, but over the wire the value is the validated `@IsDateString` string - which
|
|
50
|
+
* must reach Postgres byte-identical ('2026-04-22' is a plain date, not an instant) - so only a
|
|
51
51
|
* real `Date` (a portal caller) is serialized.
|
|
52
52
|
*/
|
|
53
53
|
const toDateInput = (value) => value instanceof Date ? value.toISOString() : value;
|
|
@@ -66,7 +66,7 @@ exports.USER_PROFILE_EMBED = `(
|
|
|
66
66
|
)`;
|
|
67
67
|
/**
|
|
68
68
|
* The `MmsList` envelope every paginated read returns. `rows` is `unknown` because each select
|
|
69
|
-
* string produces its own row shape
|
|
69
|
+
* string produces its own row shape - the caller's `T` is what declares it. `count` is
|
|
70
70
|
* PostgREST's estimate, so an empty page reports 0 total pages rather than 1.
|
|
71
71
|
*/
|
|
72
72
|
const toMmsList = (rows, page, pageSize, count) => {
|
|
@@ -85,7 +85,7 @@ const toMmsList = (rows, page, pageSize, count) => {
|
|
|
85
85
|
exports.toMmsList = toMmsList;
|
|
86
86
|
// The soft archive/delete patches projects, tasks and clients all write: the flag the transition
|
|
87
87
|
// sets, plus the who/when stamps named after it. `unarchived`/`restored` clear the flag their
|
|
88
|
-
// counterpart set and stamp their own columns
|
|
88
|
+
// counterpart set and stamp their own columns - the earlier ones stay as the history.
|
|
89
89
|
const archivedPatch = (by) => ({
|
|
90
90
|
archived: true,
|
|
91
91
|
archived_at: new Date().toISOString(),
|
package/dist/users/dto.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export declare class AddUserDto implements CreateUserDtoType {
|
|
|
16
16
|
* Optional: an internally created user - the owner at signup - has no client
|
|
17
17
|
* request behind it, and one is generated for it.
|
|
18
18
|
*
|
|
19
|
-
* Still v4: the key is not an `mms_id`
|
|
19
|
+
* Still v4: the key is not an `mms_id` - the column is `text` - and the api fills a missing
|
|
20
20
|
* one with `randomUUID()`, which is v4.
|
|
21
21
|
*/
|
|
22
22
|
readonly idempotency_key?: string;
|
|
@@ -50,13 +50,13 @@ export declare class UpdateUserDto implements UpdateUserDtoType {
|
|
|
50
50
|
readonly emergency_contact_email?: string | null;
|
|
51
51
|
}
|
|
52
52
|
/**
|
|
53
|
-
* `PATCH /users/me`
|
|
53
|
+
* `PATCH /users/me` - what a member may change about themselves.
|
|
54
54
|
*
|
|
55
55
|
* Every field here also appears on UpdateUserDto with the same constraints; what makes
|
|
56
56
|
* this a separate class is what it *omits*. The api's ValidationPipe runs
|
|
57
57
|
* `whitelist + forbidNonWhitelisted`, so a self-service request carrying `job_title`,
|
|
58
58
|
* `manager_id`, `employment_type`, `start_date`, `end_date` or `profile_image` is
|
|
59
|
-
* rejected with a 400 rather than silently ignored
|
|
59
|
+
* rejected with a 400 rather than silently ignored - the narrowing is the guard.
|
|
60
60
|
*/
|
|
61
61
|
export declare class UpdateMyProfileDto implements UpdateMyProfileDtoType {
|
|
62
62
|
readonly name: string;
|
package/dist/users/dto.js
CHANGED
|
@@ -38,7 +38,7 @@ class AddUserDto {
|
|
|
38
38
|
* Optional: an internally created user - the owner at signup - has no client
|
|
39
39
|
* request behind it, and one is generated for it.
|
|
40
40
|
*
|
|
41
|
-
* Still v4: the key is not an `mms_id`
|
|
41
|
+
* Still v4: the key is not an `mms_id` - the column is `text` - and the api fills a missing
|
|
42
42
|
* one with `randomUUID()`, which is v4.
|
|
43
43
|
*/
|
|
44
44
|
idempotency_key;
|
|
@@ -87,7 +87,7 @@ __decorate([
|
|
|
87
87
|
__metadata("design:type", String)
|
|
88
88
|
], AddUserDto.prototype, "idempotency_key", void 0);
|
|
89
89
|
// `active_in` arrives as a CSV string and is transformed to booleans, so it is omitted from the
|
|
90
|
-
// implemented contract
|
|
90
|
+
// implemented contract - the same exception GetClientsDto makes for status_id_in.
|
|
91
91
|
class GetUsersQueryDto {
|
|
92
92
|
search;
|
|
93
93
|
page = 1;
|
|
@@ -284,13 +284,13 @@ __decorate([
|
|
|
284
284
|
__metadata("design:type", Object)
|
|
285
285
|
], UpdateUserDto.prototype, "emergency_contact_email", void 0);
|
|
286
286
|
/**
|
|
287
|
-
* `PATCH /users/me`
|
|
287
|
+
* `PATCH /users/me` - what a member may change about themselves.
|
|
288
288
|
*
|
|
289
289
|
* Every field here also appears on UpdateUserDto with the same constraints; what makes
|
|
290
290
|
* this a separate class is what it *omits*. The api's ValidationPipe runs
|
|
291
291
|
* `whitelist + forbidNonWhitelisted`, so a self-service request carrying `job_title`,
|
|
292
292
|
* `manager_id`, `employment_type`, `start_date`, `end_date` or `profile_image` is
|
|
293
|
-
* rejected with a 400 rather than silently ignored
|
|
293
|
+
* rejected with a 400 rather than silently ignored - the narrowing is the guard.
|
|
294
294
|
*/
|
|
295
295
|
class UpdateMyProfileDto {
|
|
296
296
|
name;
|
package/dist/users/index.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ export declare class UsersResource {
|
|
|
23
23
|
* The public profile behind a `*_by` / `manager_id` column. `user_profiles` is a
|
|
24
24
|
* `security_invoker = on` view granted to `authenticated` (the base table's tenant predicate
|
|
25
25
|
* scopes it), so this runs on the caller's own
|
|
26
|
-
* client
|
|
26
|
+
* client - it needs no service role.
|
|
27
27
|
*/
|
|
28
28
|
identityById(userId?: string | null): Promise<UserIdentity | null>;
|
|
29
29
|
/** The users who report to `managerId` - the direct reports a leave approver may act on. */
|
|
@@ -41,7 +41,7 @@ export declare class UsersResource {
|
|
|
41
41
|
* avatar change is audited like any other.
|
|
42
42
|
*
|
|
43
43
|
* The previous object is removed *after* the new URL is committed, and a failed cleanup is
|
|
44
|
-
* swallowed
|
|
44
|
+
* swallowed - an orphaned object is a storage bill, a failed upload is a broken avatar.
|
|
45
45
|
*/
|
|
46
46
|
setProfileImage(userId: string, file: File): Promise<UserRow>;
|
|
47
47
|
/**
|
package/dist/users/index.js
CHANGED
|
@@ -78,7 +78,7 @@ class UsersResource {
|
|
|
78
78
|
* The public profile behind a `*_by` / `manager_id` column. `user_profiles` is a
|
|
79
79
|
* `security_invoker = on` view granted to `authenticated` (the base table's tenant predicate
|
|
80
80
|
* scopes it), so this runs on the caller's own
|
|
81
|
-
* client
|
|
81
|
+
* client - it needs no service role.
|
|
82
82
|
*/
|
|
83
83
|
async identityById(userId) {
|
|
84
84
|
if (!userId)
|
|
@@ -142,7 +142,7 @@ class UsersResource {
|
|
|
142
142
|
* avatar change is audited like any other.
|
|
143
143
|
*
|
|
144
144
|
* The previous object is removed *after* the new URL is committed, and a failed cleanup is
|
|
145
|
-
* swallowed
|
|
145
|
+
* swallowed - an orphaned object is a storage bill, a failed upload is a broken avatar.
|
|
146
146
|
*/
|
|
147
147
|
async setProfileImage(userId, file) {
|
|
148
148
|
const { name, extension } = (0, paths_1.splitFileName)((0, paths_1.sanitizeFileName)(file.name));
|
package/dist/users/paths.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export declare const PROFILE_PICTURES_BUCKET = "profile-pictures";
|
|
|
3
3
|
/**
|
|
4
4
|
* Where a member's avatar lives in the `profile-pictures` bucket.
|
|
5
5
|
*
|
|
6
|
-
* `organizationId/userId/timestamp-file`
|
|
6
|
+
* `organizationId/userId/timestamp-file` - the organization leads so the storage policy can
|
|
7
7
|
* scope by tenant, and the user id follows so it can scope by owner. Neither segment comes
|
|
8
8
|
* from the client.
|
|
9
9
|
*
|
|
@@ -17,7 +17,7 @@ export declare const profileImagePath: (organizationId: string, userId: string,
|
|
|
17
17
|
* The object key behind a stored `users.profile_image` URL, so the previous avatar can be
|
|
18
18
|
* removed when a new one replaces it.
|
|
19
19
|
*
|
|
20
|
-
* Returns null for anything that is not one of our own public URLs
|
|
20
|
+
* Returns null for anything that is not one of our own public URLs - the column also holds
|
|
21
21
|
* whatever `raw_user_meta_data` carried at signup (a Google or Gravatar URL), and those are
|
|
22
22
|
* not ours to delete.
|
|
23
23
|
*/
|
package/dist/users/paths.js
CHANGED
|
@@ -6,7 +6,7 @@ exports.PROFILE_PICTURES_BUCKET = 'profile-pictures';
|
|
|
6
6
|
/**
|
|
7
7
|
* Where a member's avatar lives in the `profile-pictures` bucket.
|
|
8
8
|
*
|
|
9
|
-
* `organizationId/userId/timestamp-file`
|
|
9
|
+
* `organizationId/userId/timestamp-file` - the organization leads so the storage policy can
|
|
10
10
|
* scope by tenant, and the user id follows so it can scope by owner. Neither segment comes
|
|
11
11
|
* from the client.
|
|
12
12
|
*
|
|
@@ -21,7 +21,7 @@ exports.profileImagePath = profileImagePath;
|
|
|
21
21
|
* The object key behind a stored `users.profile_image` URL, so the previous avatar can be
|
|
22
22
|
* removed when a new one replaces it.
|
|
23
23
|
*
|
|
24
|
-
* Returns null for anything that is not one of our own public URLs
|
|
24
|
+
* Returns null for anything that is not one of our own public URLs - the column also holds
|
|
25
25
|
* whatever `raw_user_meta_data` carried at signup (a Google or Gravatar URL), and those are
|
|
26
26
|
* not ours to delete.
|
|
27
27
|
*/
|
|
@@ -17,7 +17,7 @@ export type ClaimOutcome = {
|
|
|
17
17
|
kind: 'vanished';
|
|
18
18
|
};
|
|
19
19
|
/**
|
|
20
|
-
* The provider event logs
|
|
20
|
+
* The provider event logs - `paystack_webhook_events` and `resend_webhook_events`. Every policy
|
|
21
21
|
* on both is `false` for `authenticated`, including READ: the raw payloads are never exposed to
|
|
22
22
|
* end users, and an inbound webhook has no caller to run as.
|
|
23
23
|
*
|
|
@@ -30,7 +30,7 @@ export declare class WebhookEventsResource {
|
|
|
30
30
|
private readonly table;
|
|
31
31
|
constructor(supabase: TypedSupabaseClient, table: WebhookEventsTable);
|
|
32
32
|
/**
|
|
33
|
-
* The dedup test. One insert, straight to `processing`
|
|
33
|
+
* The dedup test. One insert, straight to `processing` - there is no useful window in which
|
|
34
34
|
* the row would sit at `received`.
|
|
35
35
|
*
|
|
36
36
|
* The unique index is partial (`where processing_status <> 'ignored_duplicate'`), so at
|
|
@@ -44,7 +44,7 @@ export declare class WebhookEventsResource {
|
|
|
44
44
|
findByEventKey(eventKey: string): Promise<WebhookEventRow | null>;
|
|
45
45
|
/**
|
|
46
46
|
* Reclaims a `failed` row for reprocessing, clearing the previous failure. Guarded on the
|
|
47
|
-
* row still being failed, because another redelivery may have reclaimed it first
|
|
47
|
+
* row still being failed, because another redelivery may have reclaimed it first - resolves
|
|
48
48
|
* to null when it did.
|
|
49
49
|
*
|
|
50
50
|
* This is the single most important detail in the pipeline: swallowing a redelivery of a
|
|
@@ -4,7 +4,7 @@ exports.WebhookEventsResource = void 0;
|
|
|
4
4
|
const errors_1 = require("../errors");
|
|
5
5
|
const UNIQUE_VIOLATION = '23505';
|
|
6
6
|
/**
|
|
7
|
-
* The provider event logs
|
|
7
|
+
* The provider event logs - `paystack_webhook_events` and `resend_webhook_events`. Every policy
|
|
8
8
|
* on both is `false` for `authenticated`, including READ: the raw payloads are never exposed to
|
|
9
9
|
* end users, and an inbound webhook has no caller to run as.
|
|
10
10
|
*
|
|
@@ -20,7 +20,7 @@ class WebhookEventsResource {
|
|
|
20
20
|
this.table = table;
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
|
-
* The dedup test. One insert, straight to `processing`
|
|
23
|
+
* The dedup test. One insert, straight to `processing` - there is no useful window in which
|
|
24
24
|
* the row would sit at `received`.
|
|
25
25
|
*
|
|
26
26
|
* The unique index is partial (`where processing_status <> 'ignored_duplicate'`), so at
|
|
@@ -57,7 +57,7 @@ class WebhookEventsResource {
|
|
|
57
57
|
}
|
|
58
58
|
/**
|
|
59
59
|
* Reclaims a `failed` row for reprocessing, clearing the previous failure. Guarded on the
|
|
60
|
-
* row still being failed, because another redelivery may have reclaimed it first
|
|
60
|
+
* row still being failed, because another redelivery may have reclaimed it first - resolves
|
|
61
61
|
* to null when it did.
|
|
62
62
|
*
|
|
63
63
|
* This is the single most important detail in the pipeline: swallowing a redelivery of a
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@managemint-solutions/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.38.1",
|
|
4
4
|
"description": "Typed Supabase data-access SDK for ManageMint Solutions",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"author": "Scott Bebington <scottbebington@gmail.com>",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"testEnvironment": "node"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@managemint-solutions/entities": "^1.
|
|
54
|
+
"@managemint-solutions/entities": "^1.22.0"
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
57
57
|
"@nestjs/common": "^11.0.0",
|