@managemint-solutions/sdk 0.17.0 → 0.18.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/dist/audit/index.d.ts +23 -2
- package/dist/audit/index.js +56 -21
- package/dist/audit/index.js.map +1 -1
- package/dist/auth-client/index.d.ts +1 -6
- package/dist/auth-client/index.js +3 -18
- package/dist/auth-client/index.js.map +1 -1
- package/dist/auth.d.ts +36 -1
- package/dist/auth.js +52 -22
- package/dist/auth.js.map +1 -1
- package/dist/billing/index.d.ts +0 -1
- package/dist/billing/index.js +2 -12
- package/dist/billing/index.js.map +1 -1
- package/dist/client.d.ts +16 -1
- package/dist/client.js +8 -6
- package/dist/client.js.map +1 -1
- package/dist/clients/index.js +13 -75
- package/dist/clients/index.js.map +1 -1
- package/dist/errors.d.ts +4 -1
- package/dist/errors.js +7 -58
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +48 -22
- package/dist/index.js +116 -36
- package/dist/index.js.map +1 -1
- package/dist/nest/index.d.ts +26 -3
- package/dist/nest/index.js +54 -15
- package/dist/nest/index.js.map +1 -1
- package/dist/notifications/index.d.ts +0 -1
- package/dist/notifications/index.js +4 -16
- package/dist/notifications/index.js.map +1 -1
- package/dist/organization-invites/index.d.ts +29 -0
- package/dist/organization-invites/index.js +48 -0
- package/dist/organization-invites/index.js.map +1 -0
- package/dist/organizations/index.js +4 -9
- package/dist/organizations/index.js.map +1 -1
- package/dist/permissions/index.d.ts +8 -0
- package/dist/permissions/index.js +16 -1
- package/dist/permissions/index.js.map +1 -1
- package/dist/projects/index.js +12 -75
- package/dist/projects/index.js.map +1 -1
- package/dist/service-client/index.d.ts +2 -0
- package/dist/service-client/index.js +7 -6
- package/dist/service-client/index.js.map +1 -1
- package/dist/supporting-files/index.js +31 -15
- package/dist/supporting-files/index.js.map +1 -1
- package/dist/supporting-files/paths.d.ts +19 -5
- package/dist/supporting-files/paths.js +46 -10
- package/dist/supporting-files/paths.js.map +1 -1
- package/dist/tasks/index.js +7 -33
- package/dist/tasks/index.js.map +1 -1
- package/dist/transforms.d.ts +43 -0
- package/dist/transforms.js +73 -2
- package/dist/transforms.js.map +1 -1
- package/dist/users/index.js +4 -14
- package/dist/users/index.js.map +1 -1
- package/package.json +6 -2
package/dist/clients/index.js
CHANGED
|
@@ -18,6 +18,7 @@ exports.ClientsResource = void 0;
|
|
|
18
18
|
const enum_1 = require("@managemint-solutions/entities/audit-trail/enum");
|
|
19
19
|
const audit_1 = require("../audit");
|
|
20
20
|
const errors_1 = require("../errors");
|
|
21
|
+
const transforms_1 = require("../transforms");
|
|
21
22
|
__exportStar(require("./dto"), exports);
|
|
22
23
|
// The public contract is the shared ClientSummary / ClientEntity from
|
|
23
24
|
// @managemint-solutions/entities; the casts at the returns declare the shape the select strings
|
|
@@ -48,54 +49,18 @@ const CLIENT_DETAIL_SELECT = `
|
|
|
48
49
|
contract_client,
|
|
49
50
|
contracted_hours,
|
|
50
51
|
updated_at,
|
|
51
|
-
last_updated_by:user_profiles!last_updated_by
|
|
52
|
-
|
|
53
|
-
name,
|
|
54
|
-
surname,
|
|
55
|
-
email,
|
|
56
|
-
profile_image
|
|
57
|
-
),
|
|
58
|
-
created_by:user_profiles!created_by (
|
|
59
|
-
mms_id,
|
|
60
|
-
name,
|
|
61
|
-
surname,
|
|
62
|
-
email,
|
|
63
|
-
profile_image
|
|
64
|
-
),
|
|
52
|
+
last_updated_by:user_profiles!last_updated_by ${transforms_1.USER_PROFILE_EMBED},
|
|
53
|
+
created_by:user_profiles!created_by ${transforms_1.USER_PROFILE_EMBED},
|
|
65
54
|
archived,
|
|
66
55
|
archived_at,
|
|
67
|
-
archived_by:user_profiles!archived_by
|
|
68
|
-
mms_id,
|
|
69
|
-
name,
|
|
70
|
-
surname,
|
|
71
|
-
email,
|
|
72
|
-
profile_image
|
|
73
|
-
),
|
|
56
|
+
archived_by:user_profiles!archived_by ${transforms_1.USER_PROFILE_EMBED},
|
|
74
57
|
unarchived_at,
|
|
75
|
-
unarchived_by:user_profiles!unarchived_by
|
|
76
|
-
mms_id,
|
|
77
|
-
name,
|
|
78
|
-
surname,
|
|
79
|
-
email,
|
|
80
|
-
profile_image
|
|
81
|
-
),
|
|
58
|
+
unarchived_by:user_profiles!unarchived_by ${transforms_1.USER_PROFILE_EMBED},
|
|
82
59
|
deleted,
|
|
83
60
|
deleted_at,
|
|
84
|
-
deleted_by:user_profiles!deleted_by
|
|
85
|
-
mms_id,
|
|
86
|
-
name,
|
|
87
|
-
surname,
|
|
88
|
-
email,
|
|
89
|
-
profile_image
|
|
90
|
-
),
|
|
61
|
+
deleted_by:user_profiles!deleted_by ${transforms_1.USER_PROFILE_EMBED},
|
|
91
62
|
restored_at,
|
|
92
|
-
restored_by:user_profiles!restored_by
|
|
93
|
-
mms_id,
|
|
94
|
-
name,
|
|
95
|
-
surname,
|
|
96
|
-
email,
|
|
97
|
-
profile_image
|
|
98
|
-
)
|
|
63
|
+
restored_by:user_profiles!restored_by ${transforms_1.USER_PROFILE_EMBED}
|
|
99
64
|
`;
|
|
100
65
|
class ClientsResource {
|
|
101
66
|
supabase;
|
|
@@ -125,8 +90,7 @@ class ClientsResource {
|
|
|
125
90
|
.order('created_at', { ascending: false })
|
|
126
91
|
.range(offset, offset + pageSize - 1);
|
|
127
92
|
if (trimmedSearch) {
|
|
128
|
-
|
|
129
|
-
clientsQuery = clientsQuery.or(`name.ilike.%${escapedSearch}%,email.ilike.%${escapedSearch}%`);
|
|
93
|
+
clientsQuery = clientsQuery.or((0, transforms_1.orIlike)(['name', 'email'], trimmedSearch));
|
|
130
94
|
}
|
|
131
95
|
if (query.created_after) {
|
|
132
96
|
clientsQuery = clientsQuery.gte('created_at', query.created_after);
|
|
@@ -140,17 +104,7 @@ class ClientsResource {
|
|
|
140
104
|
const { data, error, count } = await clientsQuery;
|
|
141
105
|
if (error)
|
|
142
106
|
throw (0, errors_1.mapPostgrestError)(error);
|
|
143
|
-
|
|
144
|
-
const totalPages = totalEstimated > 0 ? Math.ceil(totalEstimated / pageSize) : 0;
|
|
145
|
-
return {
|
|
146
|
-
results: (data ?? []),
|
|
147
|
-
page,
|
|
148
|
-
per_page: pageSize,
|
|
149
|
-
count: totalEstimated,
|
|
150
|
-
total_pages: totalPages,
|
|
151
|
-
has_next_page: page < totalPages,
|
|
152
|
-
has_previous_page: page > 1,
|
|
153
|
-
};
|
|
107
|
+
return (0, transforms_1.toMmsList)(data, page, pageSize, count);
|
|
154
108
|
}
|
|
155
109
|
async getById(clientId) {
|
|
156
110
|
const { data, error } = await this.supabase
|
|
@@ -193,36 +147,20 @@ class ClientsResource {
|
|
|
193
147
|
return this.getById(clientId);
|
|
194
148
|
}
|
|
195
149
|
async archive(clientId) {
|
|
196
|
-
await this.table.transition(clientId, enum_1.AuditTrailAction.ARCHIVE,
|
|
197
|
-
archived: true,
|
|
198
|
-
archived_at: new Date().toISOString(),
|
|
199
|
-
archived_by: this.auth.mms_id,
|
|
200
|
-
});
|
|
150
|
+
await this.table.transition(clientId, enum_1.AuditTrailAction.ARCHIVE, (0, transforms_1.archivedPatch)(this.auth.mms_id));
|
|
201
151
|
return this.getById(clientId);
|
|
202
152
|
}
|
|
203
153
|
async unarchive(clientId) {
|
|
204
|
-
await this.table.transition(clientId, enum_1.AuditTrailAction.UNARCHIVE,
|
|
205
|
-
archived: false,
|
|
206
|
-
unarchived_at: new Date().toISOString(),
|
|
207
|
-
unarchived_by: this.auth.mms_id,
|
|
208
|
-
});
|
|
154
|
+
await this.table.transition(clientId, enum_1.AuditTrailAction.UNARCHIVE, (0, transforms_1.unarchivedPatch)(this.auth.mms_id));
|
|
209
155
|
return this.getById(clientId);
|
|
210
156
|
}
|
|
211
157
|
async restore(clientId) {
|
|
212
|
-
await this.table.transition(clientId, enum_1.AuditTrailAction.RESTORE,
|
|
213
|
-
deleted: false,
|
|
214
|
-
restored_at: new Date().toISOString(),
|
|
215
|
-
restored_by: this.auth.mms_id,
|
|
216
|
-
});
|
|
158
|
+
await this.table.transition(clientId, enum_1.AuditTrailAction.RESTORE, (0, transforms_1.restoredPatch)(this.auth.mms_id));
|
|
217
159
|
return this.getById(clientId);
|
|
218
160
|
}
|
|
219
161
|
/** Soft delete — the row stays, flagged `deleted`, and `restore()` brings it back. */
|
|
220
162
|
async remove(clientId) {
|
|
221
|
-
await this.table.transition(clientId, enum_1.AuditTrailAction.DELETE,
|
|
222
|
-
deleted: true,
|
|
223
|
-
deleted_at: new Date().toISOString(),
|
|
224
|
-
deleted_by: this.auth.mms_id,
|
|
225
|
-
});
|
|
163
|
+
await this.table.transition(clientId, enum_1.AuditTrailAction.DELETE, (0, transforms_1.deletedPatch)(this.auth.mms_id));
|
|
226
164
|
}
|
|
227
165
|
}
|
|
228
166
|
exports.ClientsResource = ClientsResource;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/clients/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAEA,0EAGyD;AAEzD,oCAA+E;AAE/E,sCAA8C;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/clients/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAEA,0EAGyD;AAEzD,oCAA+E;AAE/E,sCAA8C;AAC9C,8CAQuB;AAGvB,wCAAsB;AAEtB,sEAAsE;AACtE,gGAAgG;AAChG,4EAA4E;AAC5E,MAAM,kBAAkB,GAAG;;;;;;;;;;;OAWX,CAAC;AAEjB,MAAM,oBAAoB,GAAG;;;;;;;;;;;;;;wDAc2B,+BAAkB;8CAC5B,+BAAkB;;;gDAGhB,+BAAkB;;oDAEd,+BAAkB;;;8CAGxB,+BAAkB;;gDAEhB,+BAAkB;OAClD,CAAC;AAEjB,MAAa,eAAe;IAIP;IACA;IAJF,KAAK,CAAe;IAErC,YACmB,QAA6B,EAC7B,IAAiB,EAClC,KAAoB;QAFH,aAAQ,GAAR,QAAQ,CAAqB;QAC7B,SAAI,GAAJ,IAAI,CAA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,KAAK,CAAC,OAAO,CAAC,QAAgB;QAC5B,MAAM,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,QAAQ,EAAE,uBAAgB,CAAC,OAAO,EAAE,IAAA,0BAAa,EAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;QAEjG,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAChC,CAAC;IAED,sFAAsF;IACtF,KAAK,CAAC,MAAM,CAAC,QAAgB;QAC3B,MAAM,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,QAAQ,EAAE,uBAAgB,CAAC,MAAM,EAAE,IAAA,yBAAY,EAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;IACjG,CAAC;CACF;AA7HD,0CA6HC"}
|
package/dist/errors.d.ts
CHANGED
|
@@ -26,7 +26,10 @@ export declare class SupabaseClientError extends Error {
|
|
|
26
26
|
message: string;
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
|
-
/**
|
|
29
|
+
/**
|
|
30
|
+
* Converts a raw Postgrest error into the SupabaseClientError the SDK throws. The message is
|
|
31
|
+
* Postgrest's own — RLS denials say what the policy said, and nothing rewrites it.
|
|
32
|
+
*/
|
|
30
33
|
export declare const mapPostgrestError: (error: PostgrestError) => SupabaseClientError;
|
|
31
34
|
/**
|
|
32
35
|
* Converts a Supabase Storage error into the SupabaseClientError the SDK throws. `StorageError`
|
package/dist/errors.js
CHANGED
|
@@ -61,71 +61,20 @@ const POSTGREST_CODE_TO_HTTP_STATUS = {
|
|
|
61
61
|
PGRST302: 401,
|
|
62
62
|
// Group X - Internal
|
|
63
63
|
PGRSTX00: 500,
|
|
64
|
-
// RLS
|
|
64
|
+
// Not PGRST* codes: an RLS denial, and the bare HTTP statuses PostgREST reports for some
|
|
65
|
+
// failures.
|
|
65
66
|
42501: 401,
|
|
66
67
|
404: 404,
|
|
67
68
|
400: 400,
|
|
68
69
|
};
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
// permission <slug>" / "Unauthorized: Module required <module>". New permissions and
|
|
74
|
-
// modules must be added here to get a readable client message.
|
|
75
|
-
const PERMISSION_MESSAGES = {
|
|
76
|
-
create_client: '(Clients - Create)',
|
|
77
|
-
read_client: '(Clients - Read)',
|
|
78
|
-
update_client: '(Clients - Update)',
|
|
79
|
-
delete_client: '(Clients - Delete)',
|
|
80
|
-
read_organizations: '(Organization - Read)',
|
|
81
|
-
create_users: '(Users - Create)',
|
|
82
|
-
read_users: '(Users - Read)',
|
|
83
|
-
update_users: '(Users - Update)',
|
|
84
|
-
delete_users: '(Users - Delete)',
|
|
85
|
-
read_user_permissions: '(User Permissions - Read)',
|
|
86
|
-
update_user_permissions: '(User Permissions - Update)',
|
|
87
|
-
create_clients: '(Clients - Create)',
|
|
88
|
-
read_clients: '(Clients - Read)',
|
|
89
|
-
update_clients: '(Clients - Update)',
|
|
90
|
-
delete_clients: '(Clients - Delete)',
|
|
91
|
-
create_projects: '(Projects - Create)',
|
|
92
|
-
read_projects: '(Projects - Read)',
|
|
93
|
-
update_projects: '(Projects - Update)',
|
|
94
|
-
delete_projects: '(Projects - Delete)',
|
|
95
|
-
create_budgets: '(Budgets - Create)',
|
|
96
|
-
read_budgets: '(Budgets - Read)',
|
|
97
|
-
update_budgets: '(Budgets - Update)',
|
|
98
|
-
delete_budgets: '(Budgets - Delete)',
|
|
99
|
-
create_tasks: '(Tasks - Create)',
|
|
100
|
-
read_tasks: '(Tasks - Read)',
|
|
101
|
-
update_tasks: '(Tasks - Update)',
|
|
102
|
-
delete_tasks: '(Tasks - Delete)',
|
|
103
|
-
read_notifications: '(Notifications - Read)',
|
|
104
|
-
create_notifications: '(Notifications - Create)',
|
|
105
|
-
update_notifications: '(Notifications - Update)',
|
|
106
|
-
delete_notifications: '(Notifications - Delete)',
|
|
107
|
-
create_payments: '(Payments - Create)',
|
|
108
|
-
update_subscriptions: '(Subscriptions - Update)',
|
|
109
|
-
};
|
|
110
|
-
const MODULE_MESSAGES = {
|
|
111
|
-
client: '(CRM)',
|
|
112
|
-
};
|
|
113
|
-
const PERMISSION_PREFIX = 'Unauthorized: Missing required permission ';
|
|
114
|
-
const MODULE_PREFIX = 'Unauthorized: Module required ';
|
|
115
|
-
const readableMessage = (details, message) => {
|
|
116
|
-
if (message.includes(PERMISSION_PREFIX)) {
|
|
117
|
-
return PERMISSION_PREFIX + (PERMISSION_MESSAGES[message.split(PERMISSION_PREFIX)[1]] || '');
|
|
118
|
-
}
|
|
119
|
-
if (message.includes(MODULE_PREFIX)) {
|
|
120
|
-
return MODULE_PREFIX + (MODULE_MESSAGES[message.split(MODULE_PREFIX)[1]] || '');
|
|
121
|
-
}
|
|
122
|
-
return DETAILS_MESSAGES[details] || message;
|
|
123
|
-
};
|
|
124
|
-
/** Converts a raw Postgrest error into the SupabaseClientError the SDK throws. */
|
|
70
|
+
/**
|
|
71
|
+
* Converts a raw Postgrest error into the SupabaseClientError the SDK throws. The message is
|
|
72
|
+
* Postgrest's own — RLS denials say what the policy said, and nothing rewrites it.
|
|
73
|
+
*/
|
|
125
74
|
const mapPostgrestError = (error) => new SupabaseClientError({
|
|
126
75
|
status: POSTGREST_CODE_TO_HTTP_STATUS[error.code] || 500,
|
|
127
76
|
error: 'Database Error',
|
|
128
|
-
message:
|
|
77
|
+
message: error.message,
|
|
129
78
|
code: error.code,
|
|
130
79
|
}, { cause: error });
|
|
131
80
|
exports.mapPostgrestError = mapPostgrestError;
|
package/dist/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":";;;AAcA;;;GAGG;AACH,MAAa,mBAAoB,SAAQ,KAAK;IACnC,MAAM,CAAS;IACf,KAAK,CAAS;IACd,IAAI,CAAU;IAEvB,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAA2B,EAAE,OAA6B;QAClG,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AAC,MAAM,IAAI,GAAG;IAC3B,KAAK,EAAE,sBAAsB;IAC7B,OAAO,EAAE,KAAK,CAAC,OAAO;CACvB,EACD,EAAE,KAAK,EAAE,KAAK,EAAE,CACjB,CAAC;AARS,QAAA,YAAY,gBAQrB"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,22 +1,48 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export
|
|
11
|
-
export
|
|
12
|
-
export
|
|
13
|
-
export
|
|
14
|
-
export
|
|
15
|
-
export
|
|
16
|
-
export
|
|
17
|
-
export
|
|
18
|
-
export
|
|
19
|
-
export
|
|
20
|
-
export
|
|
21
|
-
export
|
|
22
|
-
export
|
|
1
|
+
export { SupabaseClient, createSupabaseClient } from './client';
|
|
2
|
+
export type { SupabaseClientConfig, TypedSupabaseClient } from './client';
|
|
3
|
+
export { verifyAccessToken } from './auth';
|
|
4
|
+
export type { AuthContext, VerifiedAuth, VerifyAccessTokenConfig } from './auth';
|
|
5
|
+
export { SupabaseAuthClient, createSupabaseAuthClient } from './auth-client';
|
|
6
|
+
export type { SupabaseAuthClientConfig } from './auth-client';
|
|
7
|
+
export { ExchangeRefreshTokenDto, ExchangeTokenHashDto, ResetPasswordDto, SendPasswordResetEmailDto, SignInDto, } from './auth-client';
|
|
8
|
+
export { SupabaseServiceClient, SupabaseOrganizationScope, createSupabaseServiceClient, } from './service-client';
|
|
9
|
+
export type { SupabaseServiceClientConfig } from './service-client';
|
|
10
|
+
export { SupabaseClientError } from './errors';
|
|
11
|
+
export type { SupabaseClientErrorInit } from './errors';
|
|
12
|
+
export { IsNullable } from './validators';
|
|
13
|
+
export { AuditResource } from './audit';
|
|
14
|
+
export type { AuditActor, AuditChanges, AuditEntry, AuditErrorHandler, AuditGuard, AuditRow, AuditedTable, AuditedTableOptions, } from './audit';
|
|
15
|
+
export { GetAuditTrailDto } from './audit';
|
|
16
|
+
export { BillingReadsResource, BillingResource } from './billing';
|
|
17
|
+
export { CancelSubscriptionDto, InitialPaymentDto, PurchaseModuleDto, ReinstateSubscriptionDto, } from './billing';
|
|
18
|
+
export { StatusesResource } from './statuses';
|
|
19
|
+
export { AddStatusDto, GetStatusesDto, StatusIdDto, UpdateStatusDto } from './statuses';
|
|
20
|
+
export { AdditionalDetailsResource } from './additional-details';
|
|
21
|
+
export { AddAdditionalDetailsDto, AdditionalDetailsIdDto, GetAdditionalDetailsDto, IsAdditionalDetailsValueByType, UpdateAdditionalDetailsDto, } from './additional-details';
|
|
22
|
+
export { NotesResource } from './notes';
|
|
23
|
+
export { AddNoteDto, GetNotesDto, NoteIdDto } from './notes';
|
|
24
|
+
export { NotificationsResource, NotificationsOutboxResource } from './notifications';
|
|
25
|
+
export type { CreateNotificationInput, CreatedNotification, NotificationContentRow, OrganizationTableFactory, QueuedNotification, } from './notifications';
|
|
26
|
+
export { GetNotificationsDto, NotificationIdDto } from './notifications';
|
|
27
|
+
export { OrganizationInvitesResource } from './organization-invites';
|
|
28
|
+
export type { OrganizationInvite } from './organization-invites';
|
|
29
|
+
export { OrganizationsResource, OrganizationSignupResource } from './organizations';
|
|
30
|
+
export type { CreateOrganizationRow, OrganizationRow } from './organizations';
|
|
31
|
+
export { CreateOrganizationDto, UpdateOrganizationDto } from './organizations';
|
|
32
|
+
export { PermissionsResource } from './permissions';
|
|
33
|
+
export type { PermissionFlags } from './permissions';
|
|
34
|
+
export { UpdatePermissionsDto } from './permissions';
|
|
35
|
+
export { UsersResource } from './users';
|
|
36
|
+
export type { UserRow } from './users';
|
|
37
|
+
export { AddUserDto, GetUsersQueryDto, UpdateUserDto, UserIdDto } from './users';
|
|
38
|
+
export { WebhookEventsResource } from './webhook-events';
|
|
39
|
+
export type { ClaimOutcome, WebhookEventRow, WebhookEventsTable } from './webhook-events';
|
|
40
|
+
export { SupportingFilesResource } from './supporting-files';
|
|
41
|
+
export { GetSupportingFilesDto, SupportingFileIdDto } from './supporting-files';
|
|
42
|
+
export { ClientsResource } from './clients';
|
|
43
|
+
export { ClientIdDto, CreateClientDto, GetClientsDto, UpdateClientDto } from './clients';
|
|
44
|
+
export { ProjectsResource } from './projects';
|
|
45
|
+
export { CreateProjectDto, GetProjectsDto, ProjectIdDto, UpdateProjectDto } from './projects';
|
|
46
|
+
export { TasksResource } from './tasks';
|
|
47
|
+
export { CreateTaskDto, GetTasksDto, TaskIdDto, UpdateTaskDto } from './tasks';
|
|
48
|
+
export { PricebooksResource, monthlyTotalMinor } from './pricebooks';
|
package/dist/index.js
CHANGED
|
@@ -1,39 +1,119 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
2
|
+
// The package's public surface, spelled out. Anything not listed here is the SDK's own plumbing —
|
|
3
|
+
// the audit diff, the row helpers, the select-string fragments, the error mappers — and stays
|
|
4
|
+
// reachable only from inside. The `./nest` entrypoint is listed separately, in src/nest/index.ts.
|
|
16
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
6
|
+
exports.UsersResource = exports.UpdatePermissionsDto = exports.PermissionsResource = exports.UpdateOrganizationDto = exports.CreateOrganizationDto = exports.OrganizationSignupResource = exports.OrganizationsResource = exports.OrganizationInvitesResource = exports.NotificationIdDto = exports.GetNotificationsDto = exports.NotificationsOutboxResource = exports.NotificationsResource = exports.NoteIdDto = exports.GetNotesDto = exports.AddNoteDto = exports.NotesResource = exports.UpdateAdditionalDetailsDto = exports.IsAdditionalDetailsValueByType = exports.GetAdditionalDetailsDto = exports.AdditionalDetailsIdDto = exports.AddAdditionalDetailsDto = exports.AdditionalDetailsResource = exports.UpdateStatusDto = exports.StatusIdDto = exports.GetStatusesDto = exports.AddStatusDto = exports.StatusesResource = exports.ReinstateSubscriptionDto = exports.PurchaseModuleDto = exports.InitialPaymentDto = exports.CancelSubscriptionDto = exports.BillingResource = exports.BillingReadsResource = exports.GetAuditTrailDto = exports.AuditResource = exports.IsNullable = exports.SupabaseClientError = exports.createSupabaseServiceClient = exports.SupabaseOrganizationScope = exports.SupabaseServiceClient = exports.SignInDto = exports.SendPasswordResetEmailDto = exports.ResetPasswordDto = exports.ExchangeTokenHashDto = exports.ExchangeRefreshTokenDto = exports.createSupabaseAuthClient = exports.SupabaseAuthClient = exports.verifyAccessToken = exports.createSupabaseClient = exports.SupabaseClient = void 0;
|
|
7
|
+
exports.monthlyTotalMinor = exports.PricebooksResource = exports.UpdateTaskDto = exports.TaskIdDto = exports.GetTasksDto = exports.CreateTaskDto = exports.TasksResource = exports.UpdateProjectDto = exports.ProjectIdDto = exports.GetProjectsDto = exports.CreateProjectDto = exports.ProjectsResource = exports.UpdateClientDto = exports.GetClientsDto = exports.CreateClientDto = exports.ClientIdDto = exports.ClientsResource = exports.SupportingFileIdDto = exports.GetSupportingFilesDto = exports.SupportingFilesResource = exports.WebhookEventsResource = exports.UserIdDto = exports.UpdateUserDto = exports.GetUsersQueryDto = exports.AddUserDto = void 0;
|
|
8
|
+
var client_1 = require("./client");
|
|
9
|
+
Object.defineProperty(exports, "SupabaseClient", { enumerable: true, get: function () { return client_1.SupabaseClient; } });
|
|
10
|
+
Object.defineProperty(exports, "createSupabaseClient", { enumerable: true, get: function () { return client_1.createSupabaseClient; } });
|
|
11
|
+
var auth_1 = require("./auth");
|
|
12
|
+
Object.defineProperty(exports, "verifyAccessToken", { enumerable: true, get: function () { return auth_1.verifyAccessToken; } });
|
|
13
|
+
var auth_client_1 = require("./auth-client");
|
|
14
|
+
Object.defineProperty(exports, "SupabaseAuthClient", { enumerable: true, get: function () { return auth_client_1.SupabaseAuthClient; } });
|
|
15
|
+
Object.defineProperty(exports, "createSupabaseAuthClient", { enumerable: true, get: function () { return auth_client_1.createSupabaseAuthClient; } });
|
|
16
|
+
var auth_client_2 = require("./auth-client");
|
|
17
|
+
Object.defineProperty(exports, "ExchangeRefreshTokenDto", { enumerable: true, get: function () { return auth_client_2.ExchangeRefreshTokenDto; } });
|
|
18
|
+
Object.defineProperty(exports, "ExchangeTokenHashDto", { enumerable: true, get: function () { return auth_client_2.ExchangeTokenHashDto; } });
|
|
19
|
+
Object.defineProperty(exports, "ResetPasswordDto", { enumerable: true, get: function () { return auth_client_2.ResetPasswordDto; } });
|
|
20
|
+
Object.defineProperty(exports, "SendPasswordResetEmailDto", { enumerable: true, get: function () { return auth_client_2.SendPasswordResetEmailDto; } });
|
|
21
|
+
Object.defineProperty(exports, "SignInDto", { enumerable: true, get: function () { return auth_client_2.SignInDto; } });
|
|
22
|
+
var service_client_1 = require("./service-client");
|
|
23
|
+
Object.defineProperty(exports, "SupabaseServiceClient", { enumerable: true, get: function () { return service_client_1.SupabaseServiceClient; } });
|
|
24
|
+
Object.defineProperty(exports, "SupabaseOrganizationScope", { enumerable: true, get: function () { return service_client_1.SupabaseOrganizationScope; } });
|
|
25
|
+
Object.defineProperty(exports, "createSupabaseServiceClient", { enumerable: true, get: function () { return service_client_1.createSupabaseServiceClient; } });
|
|
26
|
+
var errors_1 = require("./errors");
|
|
27
|
+
Object.defineProperty(exports, "SupabaseClientError", { enumerable: true, get: function () { return errors_1.SupabaseClientError; } });
|
|
28
|
+
var validators_1 = require("./validators");
|
|
29
|
+
Object.defineProperty(exports, "IsNullable", { enumerable: true, get: function () { return validators_1.IsNullable; } });
|
|
30
|
+
var audit_1 = require("./audit");
|
|
31
|
+
Object.defineProperty(exports, "AuditResource", { enumerable: true, get: function () { return audit_1.AuditResource; } });
|
|
32
|
+
var audit_2 = require("./audit");
|
|
33
|
+
Object.defineProperty(exports, "GetAuditTrailDto", { enumerable: true, get: function () { return audit_2.GetAuditTrailDto; } });
|
|
34
|
+
var billing_1 = require("./billing");
|
|
35
|
+
Object.defineProperty(exports, "BillingReadsResource", { enumerable: true, get: function () { return billing_1.BillingReadsResource; } });
|
|
36
|
+
Object.defineProperty(exports, "BillingResource", { enumerable: true, get: function () { return billing_1.BillingResource; } });
|
|
37
|
+
var billing_2 = require("./billing");
|
|
38
|
+
Object.defineProperty(exports, "CancelSubscriptionDto", { enumerable: true, get: function () { return billing_2.CancelSubscriptionDto; } });
|
|
39
|
+
Object.defineProperty(exports, "InitialPaymentDto", { enumerable: true, get: function () { return billing_2.InitialPaymentDto; } });
|
|
40
|
+
Object.defineProperty(exports, "PurchaseModuleDto", { enumerable: true, get: function () { return billing_2.PurchaseModuleDto; } });
|
|
41
|
+
Object.defineProperty(exports, "ReinstateSubscriptionDto", { enumerable: true, get: function () { return billing_2.ReinstateSubscriptionDto; } });
|
|
42
|
+
var statuses_1 = require("./statuses");
|
|
43
|
+
Object.defineProperty(exports, "StatusesResource", { enumerable: true, get: function () { return statuses_1.StatusesResource; } });
|
|
44
|
+
var statuses_2 = require("./statuses");
|
|
45
|
+
Object.defineProperty(exports, "AddStatusDto", { enumerable: true, get: function () { return statuses_2.AddStatusDto; } });
|
|
46
|
+
Object.defineProperty(exports, "GetStatusesDto", { enumerable: true, get: function () { return statuses_2.GetStatusesDto; } });
|
|
47
|
+
Object.defineProperty(exports, "StatusIdDto", { enumerable: true, get: function () { return statuses_2.StatusIdDto; } });
|
|
48
|
+
Object.defineProperty(exports, "UpdateStatusDto", { enumerable: true, get: function () { return statuses_2.UpdateStatusDto; } });
|
|
49
|
+
var additional_details_1 = require("./additional-details");
|
|
50
|
+
Object.defineProperty(exports, "AdditionalDetailsResource", { enumerable: true, get: function () { return additional_details_1.AdditionalDetailsResource; } });
|
|
51
|
+
var additional_details_2 = require("./additional-details");
|
|
52
|
+
Object.defineProperty(exports, "AddAdditionalDetailsDto", { enumerable: true, get: function () { return additional_details_2.AddAdditionalDetailsDto; } });
|
|
53
|
+
Object.defineProperty(exports, "AdditionalDetailsIdDto", { enumerable: true, get: function () { return additional_details_2.AdditionalDetailsIdDto; } });
|
|
54
|
+
Object.defineProperty(exports, "GetAdditionalDetailsDto", { enumerable: true, get: function () { return additional_details_2.GetAdditionalDetailsDto; } });
|
|
55
|
+
Object.defineProperty(exports, "IsAdditionalDetailsValueByType", { enumerable: true, get: function () { return additional_details_2.IsAdditionalDetailsValueByType; } });
|
|
56
|
+
Object.defineProperty(exports, "UpdateAdditionalDetailsDto", { enumerable: true, get: function () { return additional_details_2.UpdateAdditionalDetailsDto; } });
|
|
57
|
+
var notes_1 = require("./notes");
|
|
58
|
+
Object.defineProperty(exports, "NotesResource", { enumerable: true, get: function () { return notes_1.NotesResource; } });
|
|
59
|
+
var notes_2 = require("./notes");
|
|
60
|
+
Object.defineProperty(exports, "AddNoteDto", { enumerable: true, get: function () { return notes_2.AddNoteDto; } });
|
|
61
|
+
Object.defineProperty(exports, "GetNotesDto", { enumerable: true, get: function () { return notes_2.GetNotesDto; } });
|
|
62
|
+
Object.defineProperty(exports, "NoteIdDto", { enumerable: true, get: function () { return notes_2.NoteIdDto; } });
|
|
63
|
+
var notifications_1 = require("./notifications");
|
|
64
|
+
Object.defineProperty(exports, "NotificationsResource", { enumerable: true, get: function () { return notifications_1.NotificationsResource; } });
|
|
65
|
+
Object.defineProperty(exports, "NotificationsOutboxResource", { enumerable: true, get: function () { return notifications_1.NotificationsOutboxResource; } });
|
|
66
|
+
var notifications_2 = require("./notifications");
|
|
67
|
+
Object.defineProperty(exports, "GetNotificationsDto", { enumerable: true, get: function () { return notifications_2.GetNotificationsDto; } });
|
|
68
|
+
Object.defineProperty(exports, "NotificationIdDto", { enumerable: true, get: function () { return notifications_2.NotificationIdDto; } });
|
|
69
|
+
var organization_invites_1 = require("./organization-invites");
|
|
70
|
+
Object.defineProperty(exports, "OrganizationInvitesResource", { enumerable: true, get: function () { return organization_invites_1.OrganizationInvitesResource; } });
|
|
71
|
+
var organizations_1 = require("./organizations");
|
|
72
|
+
Object.defineProperty(exports, "OrganizationsResource", { enumerable: true, get: function () { return organizations_1.OrganizationsResource; } });
|
|
73
|
+
Object.defineProperty(exports, "OrganizationSignupResource", { enumerable: true, get: function () { return organizations_1.OrganizationSignupResource; } });
|
|
74
|
+
var organizations_2 = require("./organizations");
|
|
75
|
+
Object.defineProperty(exports, "CreateOrganizationDto", { enumerable: true, get: function () { return organizations_2.CreateOrganizationDto; } });
|
|
76
|
+
Object.defineProperty(exports, "UpdateOrganizationDto", { enumerable: true, get: function () { return organizations_2.UpdateOrganizationDto; } });
|
|
77
|
+
var permissions_1 = require("./permissions");
|
|
78
|
+
Object.defineProperty(exports, "PermissionsResource", { enumerable: true, get: function () { return permissions_1.PermissionsResource; } });
|
|
79
|
+
var permissions_2 = require("./permissions");
|
|
80
|
+
Object.defineProperty(exports, "UpdatePermissionsDto", { enumerable: true, get: function () { return permissions_2.UpdatePermissionsDto; } });
|
|
81
|
+
var users_1 = require("./users");
|
|
82
|
+
Object.defineProperty(exports, "UsersResource", { enumerable: true, get: function () { return users_1.UsersResource; } });
|
|
83
|
+
var users_2 = require("./users");
|
|
84
|
+
Object.defineProperty(exports, "AddUserDto", { enumerable: true, get: function () { return users_2.AddUserDto; } });
|
|
85
|
+
Object.defineProperty(exports, "GetUsersQueryDto", { enumerable: true, get: function () { return users_2.GetUsersQueryDto; } });
|
|
86
|
+
Object.defineProperty(exports, "UpdateUserDto", { enumerable: true, get: function () { return users_2.UpdateUserDto; } });
|
|
87
|
+
Object.defineProperty(exports, "UserIdDto", { enumerable: true, get: function () { return users_2.UserIdDto; } });
|
|
88
|
+
var webhook_events_1 = require("./webhook-events");
|
|
89
|
+
Object.defineProperty(exports, "WebhookEventsResource", { enumerable: true, get: function () { return webhook_events_1.WebhookEventsResource; } });
|
|
90
|
+
var supporting_files_1 = require("./supporting-files");
|
|
91
|
+
Object.defineProperty(exports, "SupportingFilesResource", { enumerable: true, get: function () { return supporting_files_1.SupportingFilesResource; } });
|
|
92
|
+
var supporting_files_2 = require("./supporting-files");
|
|
93
|
+
Object.defineProperty(exports, "GetSupportingFilesDto", { enumerable: true, get: function () { return supporting_files_2.GetSupportingFilesDto; } });
|
|
94
|
+
Object.defineProperty(exports, "SupportingFileIdDto", { enumerable: true, get: function () { return supporting_files_2.SupportingFileIdDto; } });
|
|
95
|
+
var clients_1 = require("./clients");
|
|
96
|
+
Object.defineProperty(exports, "ClientsResource", { enumerable: true, get: function () { return clients_1.ClientsResource; } });
|
|
97
|
+
var clients_2 = require("./clients");
|
|
98
|
+
Object.defineProperty(exports, "ClientIdDto", { enumerable: true, get: function () { return clients_2.ClientIdDto; } });
|
|
99
|
+
Object.defineProperty(exports, "CreateClientDto", { enumerable: true, get: function () { return clients_2.CreateClientDto; } });
|
|
100
|
+
Object.defineProperty(exports, "GetClientsDto", { enumerable: true, get: function () { return clients_2.GetClientsDto; } });
|
|
101
|
+
Object.defineProperty(exports, "UpdateClientDto", { enumerable: true, get: function () { return clients_2.UpdateClientDto; } });
|
|
102
|
+
var projects_1 = require("./projects");
|
|
103
|
+
Object.defineProperty(exports, "ProjectsResource", { enumerable: true, get: function () { return projects_1.ProjectsResource; } });
|
|
104
|
+
var projects_2 = require("./projects");
|
|
105
|
+
Object.defineProperty(exports, "CreateProjectDto", { enumerable: true, get: function () { return projects_2.CreateProjectDto; } });
|
|
106
|
+
Object.defineProperty(exports, "GetProjectsDto", { enumerable: true, get: function () { return projects_2.GetProjectsDto; } });
|
|
107
|
+
Object.defineProperty(exports, "ProjectIdDto", { enumerable: true, get: function () { return projects_2.ProjectIdDto; } });
|
|
108
|
+
Object.defineProperty(exports, "UpdateProjectDto", { enumerable: true, get: function () { return projects_2.UpdateProjectDto; } });
|
|
109
|
+
var tasks_1 = require("./tasks");
|
|
110
|
+
Object.defineProperty(exports, "TasksResource", { enumerable: true, get: function () { return tasks_1.TasksResource; } });
|
|
111
|
+
var tasks_2 = require("./tasks");
|
|
112
|
+
Object.defineProperty(exports, "CreateTaskDto", { enumerable: true, get: function () { return tasks_2.CreateTaskDto; } });
|
|
113
|
+
Object.defineProperty(exports, "GetTasksDto", { enumerable: true, get: function () { return tasks_2.GetTasksDto; } });
|
|
114
|
+
Object.defineProperty(exports, "TaskIdDto", { enumerable: true, get: function () { return tasks_2.TaskIdDto; } });
|
|
115
|
+
Object.defineProperty(exports, "UpdateTaskDto", { enumerable: true, get: function () { return tasks_2.UpdateTaskDto; } });
|
|
116
|
+
var pricebooks_1 = require("./pricebooks");
|
|
117
|
+
Object.defineProperty(exports, "PricebooksResource", { enumerable: true, get: function () { return pricebooks_1.PricebooksResource; } });
|
|
118
|
+
Object.defineProperty(exports, "monthlyTotalMinor", { enumerable: true, get: function () { return pricebooks_1.monthlyTotalMinor; } });
|
|
39
119
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,kGAAkG;AAClG,8FAA8F;AAC9F,kGAAkG;;;;AAElG,mCAAgE;AAAvD,wGAAA,cA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AAE,sGAAA,aAAa,OAAA;AAE7D,2CAAqE;AAA5D,gHAAA,kBAAkB,OAAA;AAAE,+GAAA,iBAAiB,OAAA"}
|
package/dist/nest/index.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { HttpException } from '@nestjs/common';
|
|
2
|
+
import type { Request } from 'express';
|
|
2
3
|
import type { AuditErrorHandler } from '../audit';
|
|
4
|
+
import { type VerifiedAuth } from '../auth';
|
|
5
|
+
import { type SupabaseClient } from '../client';
|
|
3
6
|
import { SupabaseClientError } from '../errors';
|
|
4
7
|
import { type SupabaseServiceClient } from '../service-client';
|
|
5
8
|
/**
|
|
@@ -13,11 +16,31 @@ export type SupabaseUserClientOptions = {
|
|
|
13
16
|
onAuditError?: AuditErrorHandler;
|
|
14
17
|
};
|
|
15
18
|
/**
|
|
16
|
-
* Options the
|
|
17
|
-
*
|
|
18
|
-
* pass them).
|
|
19
|
+
* Options the per-request clients are built with. Call it once at startup (the auth guard
|
|
20
|
+
* constructs the client itself, so there is nowhere else to pass them).
|
|
19
21
|
*/
|
|
20
22
|
export declare const configureSupabaseUserClient: (options: SupabaseUserClientOptions) => void;
|
|
23
|
+
/** What the auth guard leaves on the request for the decorators to pick up. */
|
|
24
|
+
export type SupabaseRequestContext = {
|
|
25
|
+
client: SupabaseClient;
|
|
26
|
+
auth: VerifiedAuth;
|
|
27
|
+
};
|
|
28
|
+
/** Where on the request the context is stored — `request[SUPABASE_REQUEST_KEY]`. */
|
|
29
|
+
export declare const SUPABASE_REQUEST_KEY = "supabase";
|
|
30
|
+
/**
|
|
31
|
+
* Verifies the bearer token on `request`, builds the caller's client from it and stores both on
|
|
32
|
+
* the request. This is the one place a token is authenticated, so it belongs in the api's auth
|
|
33
|
+
* guard — a param decorator cannot be async and must not be where identity is established.
|
|
34
|
+
*
|
|
35
|
+
* Idempotent: a second call hands back the context the first one attached.
|
|
36
|
+
*/
|
|
37
|
+
export declare const attachSupabaseRequestContext: (request: Request) => Promise<SupabaseRequestContext>;
|
|
38
|
+
/**
|
|
39
|
+
* The context the auth guard attached. Throws when it is absent, which only happens when the
|
|
40
|
+
* route is missing the guard.
|
|
41
|
+
*/
|
|
42
|
+
export declare const getSupabaseRequestContext: (request: Request) => SupabaseRequestContext;
|
|
43
|
+
/** The caller's data client, from the context the auth guard attached. */
|
|
21
44
|
export declare const SupabaseUserClient: (...dataOrPipes: unknown[]) => ParameterDecorator;
|
|
22
45
|
/**
|
|
23
46
|
* A `SupabaseServiceClient` from the ambient env — the SDK-side replacement for the api's
|