@managemint-solutions/sdk 0.23.0 → 0.24.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 +57 -21
- package/dist/additional-details/dto.js +0 -1
- package/dist/additional-details/index.js +0 -1
- package/dist/additional-details/values.js +0 -1
- package/dist/audit/dto.js +0 -1
- package/dist/audit/index.js +0 -1
- package/dist/auth-client/dto.js +0 -1
- package/dist/auth-client/index.d.ts +7 -0
- package/dist/auth-client/index.js +11 -1
- package/dist/auth.js +0 -1
- package/dist/billing/dto.js +0 -1
- package/dist/billing/index.js +0 -1
- package/dist/billing/invoices/dto.d.ts +2 -2
- package/dist/billing/invoices/dto.js +0 -1
- package/dist/billing/invoices/index.js +0 -1
- package/dist/client.js +0 -1
- package/dist/clients/dto.js +0 -1
- package/dist/clients/index.js +0 -1
- package/dist/errors.js +11 -6
- package/dist/index.d.ts +3 -20
- package/dist/index.js +50 -85
- package/dist/nest/index.d.ts +5 -0
- package/dist/nest/index.js +5 -1
- package/dist/notes/dto.js +0 -1
- package/dist/notes/index.js +0 -1
- package/dist/notifications/dto.js +0 -1
- package/dist/notifications/index.js +0 -1
- package/dist/organization-invites/index.js +0 -1
- package/dist/organization-payment-methods/index.js +0 -1
- package/dist/organizations/dto.js +0 -1
- package/dist/organizations/index.js +0 -1
- package/dist/permissions/dto.js +0 -1
- package/dist/permissions/index.js +0 -1
- package/dist/pricebooks/index.js +0 -1
- package/dist/projects/dto.js +0 -1
- package/dist/projects/index.js +0 -1
- package/dist/service-client/index.d.ts +5 -0
- package/dist/service-client/index.js +13 -1
- package/dist/statuses/dto.js +0 -1
- package/dist/statuses/index.js +0 -1
- package/dist/supporting-files/dto.js +0 -1
- package/dist/supporting-files/index.js +0 -1
- package/dist/supporting-files/paths.js +0 -1
- package/dist/tasks/dto.js +0 -1
- package/dist/tasks/index.js +0 -1
- package/dist/transforms.js +0 -1
- package/dist/users/dto.js +0 -1
- package/dist/users/index.js +0 -1
- package/dist/users/paths.js +0 -1
- package/dist/validators.js +0 -1
- package/dist/webhook-events/index.js +0 -1
- package/package.json +1 -1
- package/dist/additional-details/dto.js.map +0 -1
- package/dist/additional-details/index.js.map +0 -1
- package/dist/additional-details/values.js.map +0 -1
- package/dist/audit/dto.js.map +0 -1
- package/dist/audit/index.js.map +0 -1
- package/dist/auth-client/dto.js.map +0 -1
- package/dist/auth-client/index.js.map +0 -1
- package/dist/auth.js.map +0 -1
- package/dist/billing/dto.js.map +0 -1
- package/dist/billing/index.js.map +0 -1
- package/dist/billing/invoices/dto.js.map +0 -1
- package/dist/billing/invoices/index.js.map +0 -1
- package/dist/client.js.map +0 -1
- package/dist/clients/dto.js.map +0 -1
- package/dist/clients/index.js.map +0 -1
- package/dist/errors.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/nest/index.js.map +0 -1
- package/dist/notes/dto.js.map +0 -1
- package/dist/notes/index.js.map +0 -1
- package/dist/notifications/dto.js.map +0 -1
- package/dist/notifications/index.js.map +0 -1
- package/dist/organization-invites/index.js.map +0 -1
- package/dist/organization-payment-methods/index.js.map +0 -1
- package/dist/organizations/dto.js.map +0 -1
- package/dist/organizations/index.js.map +0 -1
- package/dist/permissions/dto.js.map +0 -1
- package/dist/permissions/index.js.map +0 -1
- package/dist/pricebooks/index.js.map +0 -1
- package/dist/projects/dto.js.map +0 -1
- package/dist/projects/index.js.map +0 -1
- package/dist/service-client/index.js.map +0 -1
- package/dist/statuses/dto.js.map +0 -1
- package/dist/statuses/index.js.map +0 -1
- package/dist/supporting-files/dto.js.map +0 -1
- package/dist/supporting-files/index.js.map +0 -1
- package/dist/supporting-files/paths.js.map +0 -1
- package/dist/tasks/dto.js.map +0 -1
- package/dist/tasks/index.js.map +0 -1
- package/dist/transforms.js.map +0 -1
- package/dist/users/dto.js.map +0 -1
- package/dist/users/index.js.map +0 -1
- package/dist/users/paths.js.map +0 -1
- package/dist/validators.js.map +0 -1
- package/dist/webhook-events/index.js.map +0 -1
package/README.md
CHANGED
|
@@ -241,32 +241,35 @@ import { configureSupabaseUserClient } from '@managemint-solutions/sdk/nest';
|
|
|
241
241
|
configureSupabaseUserClient({ onAuditError: (error) => Sentry.captureException(error) });
|
|
242
242
|
```
|
|
243
243
|
|
|
244
|
-
|
|
245
|
-
|
|
244
|
+
Service-role work with no caller (webhooks, the queue worker, provisioning) goes through the
|
|
245
|
+
service client's organization scope, which supplies the audit actor — `mms_id: null` for system
|
|
246
|
+
work — and hands out audited tables for anything the SDK has no resource for:
|
|
246
247
|
|
|
247
248
|
```ts
|
|
248
|
-
import {
|
|
249
|
+
import { createSupabaseServiceClient } from '@managemint-solutions/sdk';
|
|
249
250
|
import { AuditTrailAction, AuditTrailEntityType } from '@managemint-solutions/entities/audit-trail/enum';
|
|
250
251
|
|
|
251
|
-
const
|
|
252
|
-
const
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
});
|
|
252
|
+
const service = createSupabaseServiceClient({ url, serviceRoleKey, onAuditError });
|
|
253
|
+
const scope = service.forOrganization(organizationId, actorMmsId); // actorMmsId: null for system jobs
|
|
254
|
+
|
|
255
|
+
await scope.paymentMethod.set({ paystack_customer_code: 'CUS_x' }); // service-role-only resource
|
|
256
|
+
const users = scope.table({ table: 'users', entityType: AuditTrailEntityType.USER });
|
|
257
257
|
|
|
258
|
-
const row = await users.insert({ ...payload, organization_id:
|
|
258
|
+
const row = await users.insert({ ...payload, organization_id: organizationId });
|
|
259
259
|
await users.update(userId, { name: 'Ada' }); // records UPDATE
|
|
260
260
|
await users.update(userId, (before) => ({ active: !before.active })); // payload from the pre-read
|
|
261
261
|
await users.transition(userId, AuditTrailAction.DELETE, { deleted: true }); // records the given action
|
|
262
262
|
const deleted = await users.remove(userId); // hard delete; returns the old row
|
|
263
263
|
```
|
|
264
264
|
|
|
265
|
+
Cross-tenant lookups — the organization behind a Paystack code, a ledger row by id, every
|
|
266
|
+
organization with a Paystack customer — hang off `service` itself, because a webhook or cron does
|
|
267
|
+
not know its tenant until it looks one up.
|
|
268
|
+
|
|
265
269
|
`update` / `transition` / `remove` pre-read the flat row (by `mms_id`, and by `organization_id`
|
|
266
270
|
unless `scopeByOrganization: false` — the `organizations` table is its own tenant), so a missing
|
|
267
271
|
row surfaces as the usual 406. The write itself still throws `SupabaseClientError` on failure;
|
|
268
|
-
only the audit insert is swallowed.
|
|
269
|
-
`snapshotChanges(row, 'new' | 'old')` are exported as pure functions if you need them directly.
|
|
272
|
+
only the audit insert is swallowed.
|
|
270
273
|
|
|
271
274
|
Only what goes through the SDK/API is logged — a raw PostgREST write or a dashboard edit is not.
|
|
272
275
|
|
|
@@ -286,7 +289,7 @@ const auth = createSupabaseAuthClient({
|
|
|
286
289
|
|
|
287
290
|
const { access_token, refresh_token } = await auth.signIn({ email, password });
|
|
288
291
|
await auth.refreshSession({ refresh_token });
|
|
289
|
-
await auth.signOut();
|
|
292
|
+
await auth.signOut(access_token); // revokes that session's refresh token on the server
|
|
290
293
|
|
|
291
294
|
// The redirect URL is passed in; the SDK reads no environment variables.
|
|
292
295
|
await auth.sendPasswordResetEmail({ email }, `${process.env.FRONTEND_URL}/reset-password`);
|
|
@@ -296,9 +299,12 @@ await auth.resetPassword({ password, access_token, refresh_token });
|
|
|
296
299
|
```
|
|
297
300
|
|
|
298
301
|
`signIn` also stamps `users.last_logged_in` for the user who just signed in, on a throwaway
|
|
299
|
-
client carrying the fresh access token; a failed stamp never fails the login. `signOut`
|
|
300
|
-
|
|
301
|
-
|
|
302
|
+
client carrying the fresh access token; a failed stamp never fails the login. `signOut` takes the
|
|
303
|
+
caller's access token because this client holds no session of its own: GoTrue's logout endpoint
|
|
304
|
+
authenticates with the token itself, and the `local` scope ends that device's session only. Build
|
|
305
|
+
one of these per request — supabase-js keeps the session `signIn`, `verifyOtp` and `setSession`
|
|
306
|
+
produce in the client's memory, so a shared instance would leak sessions between callers.
|
|
307
|
+
`auth.supabase` is the raw `@supabase/supabase-js` client.
|
|
302
308
|
|
|
303
309
|
```ts
|
|
304
310
|
import { SupabasePublicClient } from '@managemint-solutions/sdk/nest';
|
|
@@ -313,6 +319,33 @@ export class AuthController {
|
|
|
313
319
|
}
|
|
314
320
|
```
|
|
315
321
|
|
|
322
|
+
## Billing and invoices
|
|
323
|
+
|
|
324
|
+
Billing is split by who may write. On the caller's client, `supabase.billing` and
|
|
325
|
+
`supabase.invoices` are **read** resources over the ledger and the invoices table, scoped by RLS
|
|
326
|
+
to the caller's organization; every write to the ledger is service-role only and lives on the
|
|
327
|
+
service client's organization scope (`scope.billing`, `scope.invoices`, `scope.paymentMethod`).
|
|
328
|
+
|
|
329
|
+
```ts
|
|
330
|
+
import type { InvoiceEntity, InvoiceSummary } from '@managemint-solutions/entities/billing/invoices';
|
|
331
|
+
import type { MmsList } from '@managemint-solutions/entities/common';
|
|
332
|
+
|
|
333
|
+
// Paginated, newest first; `status_in` is a CSV of BillingTransactionStatus values.
|
|
334
|
+
const page: MmsList<InvoiceSummary> = await supabase.invoices.list({ page: 1, page_size: 25 });
|
|
335
|
+
const invoice: InvoiceEntity | null = await supabase.invoices.byId(invoiceId); // null when not ours
|
|
336
|
+
|
|
337
|
+
// Service side, when a ledger row is written:
|
|
338
|
+
const next = (await scope.invoices.maxNumber()) + 1; // per-organization sequence
|
|
339
|
+
await scope.invoices.create(row); // unique (organization_id, invoice_number)
|
|
340
|
+
await scope.invoices.syncStatus(transactionId, { status, paid_at });
|
|
341
|
+
const references = await scope.billing.paystackReferences(); // what the reconcile diffs against
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
Invoice numbers are assigned by the writer as `max + 1` and arbitrated by the unique index: a
|
|
345
|
+
`23505` on insert means a concurrent writer took the number, and the caller retries once with
|
|
346
|
+
the next one. The document itself (HTML/PDF) is rendered by the api from the row; the SDK stores
|
|
347
|
+
and reads rows only.
|
|
348
|
+
|
|
316
349
|
## Pricebooks
|
|
317
350
|
|
|
318
351
|
The price catalog (`pricebooks`, `pricebook_modules`, `billing_modules`) is readable by `anon`
|
|
@@ -338,11 +371,14 @@ row joined with its `billing_modules` catalog entry). Exactly one pricebook is a
|
|
|
338
371
|
|
|
339
372
|
Every error the SDK throws is a `SupabaseClientError` carrying the HTTP `status` to respond
|
|
340
373
|
with and the client-facing body, `toResponse()` → `{ error, message }`. Postgrest/Postgres
|
|
341
|
-
errors are
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
374
|
+
errors are mapped by code: `PGRST*` codes to their documented statuses, an RLS or grant denial
|
|
375
|
+
(`42501`) to **403**, a unique or foreign-key violation (`23505`, `23503`) to **409**, a not-null,
|
|
376
|
+
check or malformed-literal failure (`23502`, `23514`, `22P02`) to **400**, anything else 500 —
|
|
377
|
+
the message is always Postgrest's own. Storage errors carry the storage error's own HTTP status
|
|
378
|
+
(500 when it has none); Supabase Auth errors likewise, as `Authentication Error`; a rejected or
|
|
379
|
+
missing JWT is `401 Authentication Error`. Consumers return these as-is instead of mapping
|
|
380
|
+
database errors themselves, and `error.code` keeps the raw Postgres code for the few callers
|
|
381
|
+
that branch on one (the invoice-number retry on `23505`).
|
|
346
382
|
|
|
347
383
|
## NestJS
|
|
348
384
|
|
package/dist/audit/dto.js
CHANGED
package/dist/audit/index.js
CHANGED
package/dist/auth-client/dto.js
CHANGED
|
@@ -20,6 +20,13 @@ export declare class SupabaseAuthClient {
|
|
|
20
20
|
constructor(config: SupabaseAuthClientConfig);
|
|
21
21
|
signIn(input: loginDto): Promise<LoginResponse>;
|
|
22
22
|
refreshSession(input: ExchangeRefreshTokenDto): Promise<ExchangeTokenResponse>;
|
|
23
|
+
/**
|
|
24
|
+
* Revokes the session behind `accessToken`, so its refresh token stops working at once.
|
|
25
|
+
* GoTrue's logout endpoint authenticates with the token itself, which is why this session-less
|
|
26
|
+
* publishable-key client is enough; `local` ends this device's session and leaves the user's
|
|
27
|
+
* other sessions alone.
|
|
28
|
+
*/
|
|
29
|
+
signOut(accessToken: string): Promise<void>;
|
|
23
30
|
/** `redirectTo` is passed in — the SDK reads no environment variables. */
|
|
24
31
|
sendPasswordResetEmail(input: SendPasswordResetEmailDto, redirectTo: string): Promise<void>;
|
|
25
32
|
exchangeRecoveryToken(input: ExchangeTokenHashDto): Promise<ExchangeTokenResponse>;
|
|
@@ -63,6 +63,17 @@ class SupabaseAuthClient {
|
|
|
63
63
|
throw noSession('Token exchange failed: No session data returned');
|
|
64
64
|
return toTokens(data.session);
|
|
65
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* Revokes the session behind `accessToken`, so its refresh token stops working at once.
|
|
68
|
+
* GoTrue's logout endpoint authenticates with the token itself, which is why this session-less
|
|
69
|
+
* publishable-key client is enough; `local` ends this device's session and leaves the user's
|
|
70
|
+
* other sessions alone.
|
|
71
|
+
*/
|
|
72
|
+
async signOut(accessToken) {
|
|
73
|
+
const { error } = await this.supabase.auth.admin.signOut(accessToken, 'local');
|
|
74
|
+
if (error)
|
|
75
|
+
throw (0, errors_1.mapAuthError)(error);
|
|
76
|
+
}
|
|
66
77
|
/** `redirectTo` is passed in — the SDK reads no environment variables. */
|
|
67
78
|
async sendPasswordResetEmail(input, redirectTo) {
|
|
68
79
|
const { error } = await this.supabase.auth.resetPasswordForEmail(input.email, { redirectTo });
|
|
@@ -121,4 +132,3 @@ class SupabaseAuthClient {
|
|
|
121
132
|
exports.SupabaseAuthClient = SupabaseAuthClient;
|
|
122
133
|
const createSupabaseAuthClient = (config) => new SupabaseAuthClient(config);
|
|
123
134
|
exports.createSupabaseAuthClient = createSupabaseAuthClient;
|
|
124
|
-
//# sourceMappingURL=index.js.map
|
package/dist/auth.js
CHANGED
package/dist/billing/dto.js
CHANGED
package/dist/billing/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { GetInvoicesDto as GetInvoicesDtoType } from '@managemint-solutions/entities/billing/invoices/dto';
|
|
1
|
+
import type { GetInvoicesDto as GetInvoicesDtoType, InvoiceIdDto as InvoiceIdDtoType } from '@managemint-solutions/entities/billing/invoices/dto';
|
|
2
2
|
import { BillingTransactionStatus } from '@managemint-solutions/entities/billing/enum';
|
|
3
3
|
/** GET /billing/invoices/:invoiceId. v7: `invoices.mms_id` defaults from `uuidv7()`. */
|
|
4
|
-
export declare class InvoiceIdDto {
|
|
4
|
+
export declare class InvoiceIdDto implements InvoiceIdDtoType {
|
|
5
5
|
readonly invoiceId: string;
|
|
6
6
|
}
|
|
7
7
|
export declare class GetInvoicesQueryDto implements Omit<GetInvoicesDtoType, 'status_in'> {
|
package/dist/client.js
CHANGED
package/dist/clients/dto.js
CHANGED
package/dist/clients/index.js
CHANGED
package/dist/errors.js
CHANGED
|
@@ -61,11 +61,17 @@ const POSTGREST_CODE_TO_HTTP_STATUS = {
|
|
|
61
61
|
PGRST302: 401,
|
|
62
62
|
// Group X - Internal
|
|
63
63
|
PGRSTX00: 500,
|
|
64
|
-
//
|
|
65
|
-
//
|
|
66
|
-
42501:
|
|
67
|
-
|
|
68
|
-
|
|
64
|
+
// Postgres codes PostgREST passes through. An RLS or grant denial is a 403: the caller is
|
|
65
|
+
// authenticated, just not allowed - a 401 here sent the portal into a refresh-and-retry loop.
|
|
66
|
+
42501: 403,
|
|
67
|
+
// Integrity violations: the unique-index and foreign-key races are conflicts the caller (or
|
|
68
|
+
// a retry) can resolve; a not-null or check failure is a bad request.
|
|
69
|
+
23505: 409,
|
|
70
|
+
23503: 409,
|
|
71
|
+
23502: 400,
|
|
72
|
+
23514: 400,
|
|
73
|
+
// Malformed literal, e.g. a non-uuid where a uuid column is filtered.
|
|
74
|
+
'22P02': 400,
|
|
69
75
|
};
|
|
70
76
|
/**
|
|
71
77
|
* Converts a raw Postgrest error into the SupabaseClientError the SDK throws. The message is
|
|
@@ -100,4 +106,3 @@ const mapAuthError = (error) => new SupabaseClientError({
|
|
|
100
106
|
message: error.message,
|
|
101
107
|
}, { cause: error });
|
|
102
108
|
exports.mapAuthError = mapAuthError;
|
|
103
|
-
//# sourceMappingURL=errors.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,52 +1,35 @@
|
|
|
1
1
|
export { SupabaseClient, createSupabaseClient } from './client';
|
|
2
2
|
export type { SupabaseClientConfig, TypedSupabaseClient } from './client';
|
|
3
|
-
export { verifyAccessToken } from './auth';
|
|
4
3
|
export type { AuthContext, VerifiedAuth, VerifiedOrganization, VerifyAccessTokenConfig, } from './auth';
|
|
5
4
|
export { SupabaseAuthClient, createSupabaseAuthClient } from './auth-client';
|
|
6
5
|
export type { SupabaseAuthClientConfig } from './auth-client';
|
|
7
6
|
export { ExchangeRefreshTokenDto, ExchangeTokenHashDto, ResetPasswordDto, SendPasswordResetEmailDto, SignInDto, } from './auth-client';
|
|
8
|
-
export { SupabaseServiceClient,
|
|
9
|
-
export type { SupabaseServiceClientConfig } from './service-client';
|
|
7
|
+
export { SupabaseServiceClient, createSupabaseServiceClient } from './service-client';
|
|
8
|
+
export type { SupabaseOrganizationScope, SupabaseServiceClientConfig } from './service-client';
|
|
10
9
|
export { SupabaseClientError } from './errors';
|
|
11
10
|
export type { SupabaseClientErrorInit } from './errors';
|
|
12
11
|
export { IsNullable } from './validators';
|
|
13
|
-
export { AuditResource } from './audit';
|
|
14
12
|
export type { AuditActor, AuditChanges, AuditEntry, AuditErrorHandler, AuditGuard, AuditRow, AuditedTable, AuditedTableOptions, } from './audit';
|
|
15
13
|
export { GetAuditTrailDto } from './audit';
|
|
16
|
-
export { BillingReadsResource, BillingResource } from './billing';
|
|
17
14
|
export { CancelSubscriptionDto, InitialPaymentDto, PurchaseModuleDto, ReinstateSubscriptionDto, } from './billing';
|
|
18
|
-
export { InvoicesReadsResource, InvoicesResource } from './billing/invoices';
|
|
19
15
|
export { GetInvoicesQueryDto, InvoiceIdDto } from './billing/invoices';
|
|
20
|
-
export { StatusesResource } from './statuses';
|
|
21
16
|
export { AddStatusDto, GetStatusesDto, StatusIdDto, UpdateStatusDto } from './statuses';
|
|
22
|
-
export { AdditionalDetailsResource } from './additional-details';
|
|
23
17
|
export { AddAdditionalDetailsDto, AdditionalDetailsIdDto, GetAdditionalDetailsDto, IsAdditionalDetailsValueByType, UpdateAdditionalDetailsDto, } from './additional-details';
|
|
24
|
-
export { NotesResource } from './notes';
|
|
25
18
|
export { AddNoteDto, GetNotesDto, NoteIdDto } from './notes';
|
|
26
|
-
export { NotificationsResource, NotificationsOutboxResource } from './notifications';
|
|
27
19
|
export type { CreateNotificationInput, CreatedNotification, NotificationContentRow, OrganizationTableFactory, QueuedNotification, } from './notifications';
|
|
28
20
|
export { GetNotificationsDto, NotificationIdDto } from './notifications';
|
|
29
|
-
export { OrganizationInvitesResource } from './organization-invites';
|
|
30
21
|
export type { OrganizationInvite } from './organization-invites';
|
|
31
|
-
export { OrganizationPaymentMethodsResource } from './organization-payment-methods';
|
|
32
22
|
export type { OrganizationPaymentMethod, PaymentMethodLookupColumn, } from './organization-payment-methods';
|
|
33
|
-
export { OrganizationsResource, OrganizationSignupResource } from './organizations';
|
|
34
23
|
export type { CreateOrganizationRow, OrganizationRow } from './organizations';
|
|
35
24
|
export { CreateOrganizationDto, UpdateOrganizationDto } from './organizations';
|
|
36
25
|
export { PermissionsResource } from './permissions';
|
|
37
26
|
export type { PermissionFlags } from './permissions';
|
|
38
27
|
export { UpdatePermissionsDto } from './permissions';
|
|
39
|
-
export { UsersResource } from './users';
|
|
40
28
|
export type { UserRow } from './users';
|
|
41
29
|
export { AddUserDto, GetUsersQueryDto, UpdateMyProfileDto, UpdateUserDto, UserIdDto, } from './users';
|
|
42
|
-
export { WebhookEventsResource } from './webhook-events';
|
|
43
30
|
export type { ClaimOutcome, WebhookEventRow, WebhookEventsTable } from './webhook-events';
|
|
44
|
-
export { SupportingFilesResource } from './supporting-files';
|
|
45
31
|
export { GetSupportingFilesDto, SupportingFileIdDto } from './supporting-files';
|
|
46
|
-
export { ClientsResource } from './clients';
|
|
47
32
|
export { ClientIdDto, CreateClientDto, GetClientsDto, UpdateClientDto } from './clients';
|
|
48
|
-
export { ProjectsResource } from './projects';
|
|
49
33
|
export { CreateProjectDto, GetProjectsDto, ProjectIdDto, UpdateProjectDto } from './projects';
|
|
50
|
-
export { TasksResource } from './tasks';
|
|
51
34
|
export { CreateTaskDto, GetTasksDto, TaskIdDto, UpdateTaskDto } from './tasks';
|
|
52
|
-
export {
|
|
35
|
+
export { monthlyTotalMinor } from './pricebooks';
|
package/dist/index.js
CHANGED
|
@@ -2,14 +2,16 @@
|
|
|
2
2
|
// The package's public surface, spelled out. Anything not listed here is the SDK's own plumbing —
|
|
3
3
|
// the audit diff, the row helpers, the select-string fragments, the error mappers — and stays
|
|
4
4
|
// reachable only from inside. The `./nest` entrypoint is listed separately, in src/nest/index.ts.
|
|
5
|
+
//
|
|
6
|
+
// Resources are reached through the three clients (`supabase.tasks`, `scope.invoices`, ...), so
|
|
7
|
+
// their classes are not exported: a consumer never constructs one, and every export is a contract
|
|
8
|
+
// to keep. The row and input types they produce and accept are exported for annotations.
|
|
5
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
7
|
-
exports.monthlyTotalMinor = exports.
|
|
10
|
+
exports.CreateProjectDto = exports.UpdateClientDto = exports.GetClientsDto = exports.CreateClientDto = exports.ClientIdDto = exports.SupportingFileIdDto = exports.GetSupportingFilesDto = 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.InvoiceIdDto = exports.GetInvoicesQueryDto = exports.ReinstateSubscriptionDto = exports.PurchaseModuleDto = exports.InitialPaymentDto = exports.CancelSubscriptionDto = exports.GetAuditTrailDto = exports.IsNullable = 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 = void 0;
|
|
8
12
|
var client_1 = require("./client");
|
|
9
13
|
Object.defineProperty(exports, "SupabaseClient", { enumerable: true, get: function () { return client_1.SupabaseClient; } });
|
|
10
14
|
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
15
|
var auth_client_1 = require("./auth-client");
|
|
14
16
|
Object.defineProperty(exports, "SupabaseAuthClient", { enumerable: true, get: function () { return auth_client_1.SupabaseAuthClient; } });
|
|
15
17
|
Object.defineProperty(exports, "createSupabaseAuthClient", { enumerable: true, get: function () { return auth_client_1.createSupabaseAuthClient; } });
|
|
@@ -21,108 +23,71 @@ Object.defineProperty(exports, "SendPasswordResetEmailDto", { enumerable: true,
|
|
|
21
23
|
Object.defineProperty(exports, "SignInDto", { enumerable: true, get: function () { return auth_client_2.SignInDto; } });
|
|
22
24
|
var service_client_1 = require("./service-client");
|
|
23
25
|
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
26
|
Object.defineProperty(exports, "createSupabaseServiceClient", { enumerable: true, get: function () { return service_client_1.createSupabaseServiceClient; } });
|
|
26
27
|
var errors_1 = require("./errors");
|
|
27
28
|
Object.defineProperty(exports, "SupabaseClientError", { enumerable: true, get: function () { return errors_1.SupabaseClientError; } });
|
|
28
29
|
var validators_1 = require("./validators");
|
|
29
30
|
Object.defineProperty(exports, "IsNullable", { enumerable: true, get: function () { return validators_1.IsNullable; } });
|
|
30
31
|
var audit_1 = require("./audit");
|
|
31
|
-
Object.defineProperty(exports, "
|
|
32
|
-
var audit_2 = require("./audit");
|
|
33
|
-
Object.defineProperty(exports, "GetAuditTrailDto", { enumerable: true, get: function () { return audit_2.GetAuditTrailDto; } });
|
|
32
|
+
Object.defineProperty(exports, "GetAuditTrailDto", { enumerable: true, get: function () { return audit_1.GetAuditTrailDto; } });
|
|
34
33
|
var billing_1 = require("./billing");
|
|
35
|
-
Object.defineProperty(exports, "
|
|
36
|
-
Object.defineProperty(exports, "
|
|
37
|
-
|
|
38
|
-
Object.defineProperty(exports, "
|
|
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; } });
|
|
34
|
+
Object.defineProperty(exports, "CancelSubscriptionDto", { enumerable: true, get: function () { return billing_1.CancelSubscriptionDto; } });
|
|
35
|
+
Object.defineProperty(exports, "InitialPaymentDto", { enumerable: true, get: function () { return billing_1.InitialPaymentDto; } });
|
|
36
|
+
Object.defineProperty(exports, "PurchaseModuleDto", { enumerable: true, get: function () { return billing_1.PurchaseModuleDto; } });
|
|
37
|
+
Object.defineProperty(exports, "ReinstateSubscriptionDto", { enumerable: true, get: function () { return billing_1.ReinstateSubscriptionDto; } });
|
|
42
38
|
var invoices_1 = require("./billing/invoices");
|
|
43
|
-
Object.defineProperty(exports, "
|
|
44
|
-
Object.defineProperty(exports, "
|
|
45
|
-
var invoices_2 = require("./billing/invoices");
|
|
46
|
-
Object.defineProperty(exports, "GetInvoicesQueryDto", { enumerable: true, get: function () { return invoices_2.GetInvoicesQueryDto; } });
|
|
47
|
-
Object.defineProperty(exports, "InvoiceIdDto", { enumerable: true, get: function () { return invoices_2.InvoiceIdDto; } });
|
|
39
|
+
Object.defineProperty(exports, "GetInvoicesQueryDto", { enumerable: true, get: function () { return invoices_1.GetInvoicesQueryDto; } });
|
|
40
|
+
Object.defineProperty(exports, "InvoiceIdDto", { enumerable: true, get: function () { return invoices_1.InvoiceIdDto; } });
|
|
48
41
|
var statuses_1 = require("./statuses");
|
|
49
|
-
Object.defineProperty(exports, "
|
|
50
|
-
|
|
51
|
-
Object.defineProperty(exports, "
|
|
52
|
-
Object.defineProperty(exports, "
|
|
53
|
-
Object.defineProperty(exports, "StatusIdDto", { enumerable: true, get: function () { return statuses_2.StatusIdDto; } });
|
|
54
|
-
Object.defineProperty(exports, "UpdateStatusDto", { enumerable: true, get: function () { return statuses_2.UpdateStatusDto; } });
|
|
42
|
+
Object.defineProperty(exports, "AddStatusDto", { enumerable: true, get: function () { return statuses_1.AddStatusDto; } });
|
|
43
|
+
Object.defineProperty(exports, "GetStatusesDto", { enumerable: true, get: function () { return statuses_1.GetStatusesDto; } });
|
|
44
|
+
Object.defineProperty(exports, "StatusIdDto", { enumerable: true, get: function () { return statuses_1.StatusIdDto; } });
|
|
45
|
+
Object.defineProperty(exports, "UpdateStatusDto", { enumerable: true, get: function () { return statuses_1.UpdateStatusDto; } });
|
|
55
46
|
var additional_details_1 = require("./additional-details");
|
|
56
|
-
Object.defineProperty(exports, "
|
|
57
|
-
|
|
58
|
-
Object.defineProperty(exports, "
|
|
59
|
-
Object.defineProperty(exports, "
|
|
60
|
-
Object.defineProperty(exports, "
|
|
61
|
-
Object.defineProperty(exports, "IsAdditionalDetailsValueByType", { enumerable: true, get: function () { return additional_details_2.IsAdditionalDetailsValueByType; } });
|
|
62
|
-
Object.defineProperty(exports, "UpdateAdditionalDetailsDto", { enumerable: true, get: function () { return additional_details_2.UpdateAdditionalDetailsDto; } });
|
|
47
|
+
Object.defineProperty(exports, "AddAdditionalDetailsDto", { enumerable: true, get: function () { return additional_details_1.AddAdditionalDetailsDto; } });
|
|
48
|
+
Object.defineProperty(exports, "AdditionalDetailsIdDto", { enumerable: true, get: function () { return additional_details_1.AdditionalDetailsIdDto; } });
|
|
49
|
+
Object.defineProperty(exports, "GetAdditionalDetailsDto", { enumerable: true, get: function () { return additional_details_1.GetAdditionalDetailsDto; } });
|
|
50
|
+
Object.defineProperty(exports, "IsAdditionalDetailsValueByType", { enumerable: true, get: function () { return additional_details_1.IsAdditionalDetailsValueByType; } });
|
|
51
|
+
Object.defineProperty(exports, "UpdateAdditionalDetailsDto", { enumerable: true, get: function () { return additional_details_1.UpdateAdditionalDetailsDto; } });
|
|
63
52
|
var notes_1 = require("./notes");
|
|
64
|
-
Object.defineProperty(exports, "
|
|
65
|
-
|
|
66
|
-
Object.defineProperty(exports, "
|
|
67
|
-
Object.defineProperty(exports, "GetNotesDto", { enumerable: true, get: function () { return notes_2.GetNotesDto; } });
|
|
68
|
-
Object.defineProperty(exports, "NoteIdDto", { enumerable: true, get: function () { return notes_2.NoteIdDto; } });
|
|
53
|
+
Object.defineProperty(exports, "AddNoteDto", { enumerable: true, get: function () { return notes_1.AddNoteDto; } });
|
|
54
|
+
Object.defineProperty(exports, "GetNotesDto", { enumerable: true, get: function () { return notes_1.GetNotesDto; } });
|
|
55
|
+
Object.defineProperty(exports, "NoteIdDto", { enumerable: true, get: function () { return notes_1.NoteIdDto; } });
|
|
69
56
|
var notifications_1 = require("./notifications");
|
|
70
|
-
Object.defineProperty(exports, "
|
|
71
|
-
Object.defineProperty(exports, "
|
|
72
|
-
var notifications_2 = require("./notifications");
|
|
73
|
-
Object.defineProperty(exports, "GetNotificationsDto", { enumerable: true, get: function () { return notifications_2.GetNotificationsDto; } });
|
|
74
|
-
Object.defineProperty(exports, "NotificationIdDto", { enumerable: true, get: function () { return notifications_2.NotificationIdDto; } });
|
|
75
|
-
var organization_invites_1 = require("./organization-invites");
|
|
76
|
-
Object.defineProperty(exports, "OrganizationInvitesResource", { enumerable: true, get: function () { return organization_invites_1.OrganizationInvitesResource; } });
|
|
77
|
-
var organization_payment_methods_1 = require("./organization-payment-methods");
|
|
78
|
-
Object.defineProperty(exports, "OrganizationPaymentMethodsResource", { enumerable: true, get: function () { return organization_payment_methods_1.OrganizationPaymentMethodsResource; } });
|
|
57
|
+
Object.defineProperty(exports, "GetNotificationsDto", { enumerable: true, get: function () { return notifications_1.GetNotificationsDto; } });
|
|
58
|
+
Object.defineProperty(exports, "NotificationIdDto", { enumerable: true, get: function () { return notifications_1.NotificationIdDto; } });
|
|
79
59
|
var organizations_1 = require("./organizations");
|
|
80
|
-
Object.defineProperty(exports, "
|
|
81
|
-
Object.defineProperty(exports, "
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
Object.defineProperty(exports, "UpdateOrganizationDto", { enumerable: true, get: function () { return organizations_2.UpdateOrganizationDto; } });
|
|
60
|
+
Object.defineProperty(exports, "CreateOrganizationDto", { enumerable: true, get: function () { return organizations_1.CreateOrganizationDto; } });
|
|
61
|
+
Object.defineProperty(exports, "UpdateOrganizationDto", { enumerable: true, get: function () { return organizations_1.UpdateOrganizationDto; } });
|
|
62
|
+
// The one resource class still exported: the api's permissions guard spec drives a real
|
|
63
|
+
// PermissionsResource over a stubbed client.
|
|
85
64
|
var permissions_1 = require("./permissions");
|
|
86
65
|
Object.defineProperty(exports, "PermissionsResource", { enumerable: true, get: function () { return permissions_1.PermissionsResource; } });
|
|
87
66
|
var permissions_2 = require("./permissions");
|
|
88
67
|
Object.defineProperty(exports, "UpdatePermissionsDto", { enumerable: true, get: function () { return permissions_2.UpdatePermissionsDto; } });
|
|
89
68
|
var users_1 = require("./users");
|
|
90
|
-
Object.defineProperty(exports, "
|
|
91
|
-
|
|
92
|
-
Object.defineProperty(exports, "
|
|
93
|
-
Object.defineProperty(exports, "
|
|
94
|
-
Object.defineProperty(exports, "
|
|
95
|
-
Object.defineProperty(exports, "UpdateUserDto", { enumerable: true, get: function () { return users_2.UpdateUserDto; } });
|
|
96
|
-
Object.defineProperty(exports, "UserIdDto", { enumerable: true, get: function () { return users_2.UserIdDto; } });
|
|
97
|
-
var webhook_events_1 = require("./webhook-events");
|
|
98
|
-
Object.defineProperty(exports, "WebhookEventsResource", { enumerable: true, get: function () { return webhook_events_1.WebhookEventsResource; } });
|
|
69
|
+
Object.defineProperty(exports, "AddUserDto", { enumerable: true, get: function () { return users_1.AddUserDto; } });
|
|
70
|
+
Object.defineProperty(exports, "GetUsersQueryDto", { enumerable: true, get: function () { return users_1.GetUsersQueryDto; } });
|
|
71
|
+
Object.defineProperty(exports, "UpdateMyProfileDto", { enumerable: true, get: function () { return users_1.UpdateMyProfileDto; } });
|
|
72
|
+
Object.defineProperty(exports, "UpdateUserDto", { enumerable: true, get: function () { return users_1.UpdateUserDto; } });
|
|
73
|
+
Object.defineProperty(exports, "UserIdDto", { enumerable: true, get: function () { return users_1.UserIdDto; } });
|
|
99
74
|
var supporting_files_1 = require("./supporting-files");
|
|
100
|
-
Object.defineProperty(exports, "
|
|
101
|
-
|
|
102
|
-
Object.defineProperty(exports, "GetSupportingFilesDto", { enumerable: true, get: function () { return supporting_files_2.GetSupportingFilesDto; } });
|
|
103
|
-
Object.defineProperty(exports, "SupportingFileIdDto", { enumerable: true, get: function () { return supporting_files_2.SupportingFileIdDto; } });
|
|
75
|
+
Object.defineProperty(exports, "GetSupportingFilesDto", { enumerable: true, get: function () { return supporting_files_1.GetSupportingFilesDto; } });
|
|
76
|
+
Object.defineProperty(exports, "SupportingFileIdDto", { enumerable: true, get: function () { return supporting_files_1.SupportingFileIdDto; } });
|
|
104
77
|
var clients_1 = require("./clients");
|
|
105
|
-
Object.defineProperty(exports, "
|
|
106
|
-
|
|
107
|
-
Object.defineProperty(exports, "
|
|
108
|
-
Object.defineProperty(exports, "
|
|
109
|
-
Object.defineProperty(exports, "GetClientsDto", { enumerable: true, get: function () { return clients_2.GetClientsDto; } });
|
|
110
|
-
Object.defineProperty(exports, "UpdateClientDto", { enumerable: true, get: function () { return clients_2.UpdateClientDto; } });
|
|
78
|
+
Object.defineProperty(exports, "ClientIdDto", { enumerable: true, get: function () { return clients_1.ClientIdDto; } });
|
|
79
|
+
Object.defineProperty(exports, "CreateClientDto", { enumerable: true, get: function () { return clients_1.CreateClientDto; } });
|
|
80
|
+
Object.defineProperty(exports, "GetClientsDto", { enumerable: true, get: function () { return clients_1.GetClientsDto; } });
|
|
81
|
+
Object.defineProperty(exports, "UpdateClientDto", { enumerable: true, get: function () { return clients_1.UpdateClientDto; } });
|
|
111
82
|
var projects_1 = require("./projects");
|
|
112
|
-
Object.defineProperty(exports, "
|
|
113
|
-
|
|
114
|
-
Object.defineProperty(exports, "
|
|
115
|
-
Object.defineProperty(exports, "
|
|
116
|
-
Object.defineProperty(exports, "ProjectIdDto", { enumerable: true, get: function () { return projects_2.ProjectIdDto; } });
|
|
117
|
-
Object.defineProperty(exports, "UpdateProjectDto", { enumerable: true, get: function () { return projects_2.UpdateProjectDto; } });
|
|
83
|
+
Object.defineProperty(exports, "CreateProjectDto", { enumerable: true, get: function () { return projects_1.CreateProjectDto; } });
|
|
84
|
+
Object.defineProperty(exports, "GetProjectsDto", { enumerable: true, get: function () { return projects_1.GetProjectsDto; } });
|
|
85
|
+
Object.defineProperty(exports, "ProjectIdDto", { enumerable: true, get: function () { return projects_1.ProjectIdDto; } });
|
|
86
|
+
Object.defineProperty(exports, "UpdateProjectDto", { enumerable: true, get: function () { return projects_1.UpdateProjectDto; } });
|
|
118
87
|
var tasks_1 = require("./tasks");
|
|
119
|
-
Object.defineProperty(exports, "
|
|
120
|
-
|
|
121
|
-
Object.defineProperty(exports, "
|
|
122
|
-
Object.defineProperty(exports, "
|
|
123
|
-
Object.defineProperty(exports, "TaskIdDto", { enumerable: true, get: function () { return tasks_2.TaskIdDto; } });
|
|
124
|
-
Object.defineProperty(exports, "UpdateTaskDto", { enumerable: true, get: function () { return tasks_2.UpdateTaskDto; } });
|
|
88
|
+
Object.defineProperty(exports, "CreateTaskDto", { enumerable: true, get: function () { return tasks_1.CreateTaskDto; } });
|
|
89
|
+
Object.defineProperty(exports, "GetTasksDto", { enumerable: true, get: function () { return tasks_1.GetTasksDto; } });
|
|
90
|
+
Object.defineProperty(exports, "TaskIdDto", { enumerable: true, get: function () { return tasks_1.TaskIdDto; } });
|
|
91
|
+
Object.defineProperty(exports, "UpdateTaskDto", { enumerable: true, get: function () { return tasks_1.UpdateTaskDto; } });
|
|
125
92
|
var pricebooks_1 = require("./pricebooks");
|
|
126
|
-
Object.defineProperty(exports, "PricebooksResource", { enumerable: true, get: function () { return pricebooks_1.PricebooksResource; } });
|
|
127
93
|
Object.defineProperty(exports, "monthlyTotalMinor", { enumerable: true, get: function () { return pricebooks_1.monthlyTotalMinor; } });
|
|
128
|
-
//# sourceMappingURL=index.js.map
|
package/dist/nest/index.d.ts
CHANGED
|
@@ -55,5 +55,10 @@ export declare const createSupabaseServiceClientFromEnv: (options?: SupabaseUser
|
|
|
55
55
|
/**
|
|
56
56
|
* A `SupabaseAuthClient` for routes a logged-out caller hits (sign-in, refresh, password
|
|
57
57
|
* reset) — built from the publishable key alone, with no bearer token involved.
|
|
58
|
+
*
|
|
59
|
+
* Deliberately a fresh client per request, not a module-level singleton: supabase-js keeps the
|
|
60
|
+
* session `signIn`, `verifyOtp` and `setSession` produce in the client's own memory, so one
|
|
61
|
+
* shared instance would let concurrent sign-in and reset-password requests read each other's
|
|
62
|
+
* sessions. The construction is cheap (no network) and the isolation is the point.
|
|
58
63
|
*/
|
|
59
64
|
export declare const SupabasePublicClient: (...dataOrPipes: any[]) => ParameterDecorator;
|
package/dist/nest/index.js
CHANGED
|
@@ -114,9 +114,13 @@ exports.createSupabaseServiceClientFromEnv = createSupabaseServiceClientFromEnv;
|
|
|
114
114
|
/**
|
|
115
115
|
* A `SupabaseAuthClient` for routes a logged-out caller hits (sign-in, refresh, password
|
|
116
116
|
* reset) — built from the publishable key alone, with no bearer token involved.
|
|
117
|
+
*
|
|
118
|
+
* Deliberately a fresh client per request, not a module-level singleton: supabase-js keeps the
|
|
119
|
+
* session `signIn`, `verifyOtp` and `setSession` produce in the client's own memory, so one
|
|
120
|
+
* shared instance would let concurrent sign-in and reset-password requests read each other's
|
|
121
|
+
* sessions. The construction is cheap (no network) and the isolation is the point.
|
|
117
122
|
*/
|
|
118
123
|
exports.SupabasePublicClient = (0, common_1.createParamDecorator)(() => (0, auth_client_1.createSupabaseAuthClient)({
|
|
119
124
|
url: getEnvOrThrow('SUPABASE_URL'),
|
|
120
125
|
key: getEnvOrThrow('SUPABASE_PUBLISHABLE_KEY'),
|
|
121
126
|
}));
|
|
122
|
-
//# sourceMappingURL=index.js.map
|
package/dist/notes/dto.js
CHANGED
package/dist/notes/index.js
CHANGED