@managemint-solutions/sdk 0.21.0 → 0.21.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/dist/index.d.ts +2 -0
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/organization-paystack-credentials/index.d.ts +33 -0
- package/dist/organization-paystack-credentials/index.js +71 -0
- package/dist/organization-paystack-credentials/index.js.map +1 -0
- package/dist/service-client/index.d.ts +2 -0
- package/dist/service-client/index.js +3 -0
- package/dist/service-client/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -28,6 +28,8 @@ export type { CreateNotificationInput, CreatedNotification, NotificationContentR
|
|
|
28
28
|
export { GetNotificationsDto, NotificationIdDto } from './notifications';
|
|
29
29
|
export { OrganizationInvitesResource } from './organization-invites';
|
|
30
30
|
export type { OrganizationInvite } from './organization-invites';
|
|
31
|
+
export { OrganizationPaystackCredentialsResource } from './organization-paystack-credentials';
|
|
32
|
+
export type { OrganizationPaystackCredentials } from './organization-paystack-credentials';
|
|
31
33
|
export { OrganizationsResource, OrganizationSignupResource } from './organizations';
|
|
32
34
|
export type { CreateOrganizationRow, OrganizationRow } from './organizations';
|
|
33
35
|
export { CreateOrganizationDto, UpdateOrganizationDto } from './organizations';
|
package/dist/index.js
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
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
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
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.SupportTicketIdDto = exports.SupportAttachmentDto = exports.ReplySupportTicketDto = exports.GetSupportTicketsDto = exports.CreateSupportTicketDto = exports.AssignSupportTicketDto = exports.SupportTicketsAdminResource = exports.SupportTicketsResource = exports.SupportingFileIdDto = exports.GetSupportingFilesDto = exports.SupportingFilesResource = exports.WebhookEventsResource = exports.UserIdDto = exports.UpdateUserDto = exports.UpdateMyProfileDto = exports.GetUsersQueryDto = exports.AddUserDto = exports.UsersResource = exports.UpdatePermissionsDto = exports.PermissionsResource = exports.UpdateOrganizationDto = void 0;
|
|
6
|
+
exports.OrganizationSignupResource = exports.OrganizationsResource = exports.OrganizationPaystackCredentialsResource = 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.InvoiceIdDto = exports.GetInvoicesQueryDto = exports.InvoicesResource = exports.InvoicesReadsResource = 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.SupportTicketIdDto = exports.SupportAttachmentDto = exports.ReplySupportTicketDto = exports.GetSupportTicketsDto = exports.CreateSupportTicketDto = exports.AssignSupportTicketDto = exports.SupportTicketsAdminResource = exports.SupportTicketsResource = exports.SupportingFileIdDto = exports.GetSupportingFilesDto = exports.SupportingFilesResource = exports.WebhookEventsResource = exports.UserIdDto = exports.UpdateUserDto = exports.UpdateMyProfileDto = exports.GetUsersQueryDto = exports.AddUserDto = exports.UsersResource = exports.UpdatePermissionsDto = exports.PermissionsResource = exports.UpdateOrganizationDto = exports.CreateOrganizationDto = void 0;
|
|
8
8
|
var client_1 = require("./client");
|
|
9
9
|
Object.defineProperty(exports, "SupabaseClient", { enumerable: true, get: function () { return client_1.SupabaseClient; } });
|
|
10
10
|
Object.defineProperty(exports, "createSupabaseClient", { enumerable: true, get: function () { return client_1.createSupabaseClient; } });
|
|
@@ -74,6 +74,8 @@ Object.defineProperty(exports, "GetNotificationsDto", { enumerable: true, get: f
|
|
|
74
74
|
Object.defineProperty(exports, "NotificationIdDto", { enumerable: true, get: function () { return notifications_2.NotificationIdDto; } });
|
|
75
75
|
var organization_invites_1 = require("./organization-invites");
|
|
76
76
|
Object.defineProperty(exports, "OrganizationInvitesResource", { enumerable: true, get: function () { return organization_invites_1.OrganizationInvitesResource; } });
|
|
77
|
+
var organization_paystack_credentials_1 = require("./organization-paystack-credentials");
|
|
78
|
+
Object.defineProperty(exports, "OrganizationPaystackCredentialsResource", { enumerable: true, get: function () { return organization_paystack_credentials_1.OrganizationPaystackCredentialsResource; } });
|
|
77
79
|
var organizations_1 = require("./organizations");
|
|
78
80
|
Object.defineProperty(exports, "OrganizationsResource", { enumerable: true, get: function () { return organizations_1.OrganizationsResource; } });
|
|
79
81
|
Object.defineProperty(exports, "OrganizationSignupResource", { enumerable: true, get: function () { return organizations_1.OrganizationSignupResource; } });
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,kGAAkG;AAClG,8FAA8F;AAC9F,kGAAkG;;;;AAElG,mCAAgE;AAAvD,wGAAA,cAAc,OAAA;AAAE,8GAAA,oBAAoB,OAAA;AAG7C,+BAA2C;AAAlC,yGAAA,iBAAiB,OAAA;AAG1B,6CAA6E;AAApE,iHAAA,kBAAkB,OAAA;AAAE,uHAAA,wBAAwB,OAAA;AAErD,6CAMuB;AALrB,sHAAA,uBAAuB,OAAA;AACvB,mHAAA,oBAAoB,OAAA;AACpB,+GAAA,gBAAgB,OAAA;AAChB,wHAAA,yBAAyB,OAAA;AACzB,wGAAA,SAAS,OAAA;AAGX,mDAI0B;AAHxB,uHAAA,qBAAqB,OAAA;AACrB,2HAAA,yBAAyB,OAAA;AACzB,6HAAA,2BAA2B,OAAA;AAI7B,mCAA+C;AAAtC,6GAAA,mBAAmB,OAAA;AAG5B,2CAA0C;AAAjC,wGAAA,UAAU,OAAA;AAEnB,iCAAwC;AAA/B,sGAAA,aAAa,OAAA;AAWtB,iCAA2C;AAAlC,yGAAA,gBAAgB,OAAA;AAEzB,qCAAkE;AAAzD,+GAAA,oBAAoB,OAAA;AAAE,0GAAA,eAAe,OAAA;AAC9C,qCAKmB;AAJjB,gHAAA,qBAAqB,OAAA;AACrB,4GAAA,iBAAiB,OAAA;AACjB,4GAAA,iBAAiB,OAAA;AACjB,mHAAA,wBAAwB,OAAA;AAG1B,+CAA6E;AAApE,iHAAA,qBAAqB,OAAA;AAAE,4GAAA,gBAAgB,OAAA;AAChD,+CAAuE;AAA9D,+GAAA,mBAAmB,OAAA;AAAE,wG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gBAAgB,OAAA;AAAE,0GAAA,cAAc,OAAA;AAAE,wGAAA,YAAY,OAAA;AAAE,4GAAA,gBAAgB,OAAA;AAEzE,iCAAwC;AAA/B,sGAAA,aAAa,OAAA;AACtB,iCAA+E;AAAtE,sGAAA,aAAa,OAAA;AAAE,oGAAA,WAAW,OAAA;AAAE,kGAAA,SAAS,OAAA;AAAE,sGAAA,aAAa,OAAA;AAE7D,2CAAqE;AAA5D,gHAAA,kBAAkB,OAAA;AAAE,+GAAA,iBAAiB,OAAA"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type AuditActor, type AuditResource } from '../audit';
|
|
2
|
+
import type { TypedSupabaseClient } from '../client';
|
|
3
|
+
/** The two Paystack secrets an organization holds. Both null until the first successful charge. */
|
|
4
|
+
export type OrganizationPaystackCredentials = {
|
|
5
|
+
/** The saved card authorization every off-session charge is made against. */
|
|
6
|
+
paystack_customer_authorization_code: string | null;
|
|
7
|
+
/** Paired with the subscription code to disable or enable the subscription. */
|
|
8
|
+
paystack_subscription_email_token: string | null;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* The `organization_paystack_credentials` table: the one row per organization that holds the
|
|
12
|
+
* card authorization code and the subscription email token. They used to be columns on
|
|
13
|
+
* `organizations`, where the tenant-scoped READ policy handed them to every member; here the
|
|
14
|
+
* table carries no `authenticated` grant and no policy, so only the service role can reach it.
|
|
15
|
+
*
|
|
16
|
+
* Service-role only, like the invites — this lives on the organization scope of the service
|
|
17
|
+
* client and never on a caller's client. Writes are audited against the organization (the row
|
|
18
|
+
* has no identity of its own), and the audit diff redacts every `paystack_*` column, so the trail
|
|
19
|
+
* records that a credential changed and never what it changed to.
|
|
20
|
+
*/
|
|
21
|
+
export declare class OrganizationPaystackCredentialsResource {
|
|
22
|
+
private readonly supabase;
|
|
23
|
+
private readonly actor;
|
|
24
|
+
private readonly audit;
|
|
25
|
+
constructor(supabase: TypedSupabaseClient, actor: AuditActor, audit: AuditResource);
|
|
26
|
+
/** The actor organization's credentials; both null when nothing has been stored yet. */
|
|
27
|
+
get(): Promise<OrganizationPaystackCredentials>;
|
|
28
|
+
/**
|
|
29
|
+
* Stores the given credentials, leaving the other untouched. Creates the row on first use;
|
|
30
|
+
* `null` clears a credential (a cancelled subscription's dead token must never be reused).
|
|
31
|
+
*/
|
|
32
|
+
set(patch: Partial<OrganizationPaystackCredentials>): Promise<void>;
|
|
33
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OrganizationPaystackCredentialsResource = void 0;
|
|
4
|
+
const enum_1 = require("@managemint-solutions/entities/audit-trail/enum");
|
|
5
|
+
const audit_1 = require("../audit");
|
|
6
|
+
const errors_1 = require("../errors");
|
|
7
|
+
const CREDENTIAL_COLUMNS = 'paystack_customer_authorization_code, paystack_subscription_email_token';
|
|
8
|
+
/**
|
|
9
|
+
* The `organization_paystack_credentials` table: the one row per organization that holds the
|
|
10
|
+
* card authorization code and the subscription email token. They used to be columns on
|
|
11
|
+
* `organizations`, where the tenant-scoped READ policy handed them to every member; here the
|
|
12
|
+
* table carries no `authenticated` grant and no policy, so only the service role can reach it.
|
|
13
|
+
*
|
|
14
|
+
* Service-role only, like the invites — this lives on the organization scope of the service
|
|
15
|
+
* client and never on a caller's client. Writes are audited against the organization (the row
|
|
16
|
+
* has no identity of its own), and the audit diff redacts every `paystack_*` column, so the trail
|
|
17
|
+
* records that a credential changed and never what it changed to.
|
|
18
|
+
*/
|
|
19
|
+
class OrganizationPaystackCredentialsResource {
|
|
20
|
+
supabase;
|
|
21
|
+
actor;
|
|
22
|
+
audit;
|
|
23
|
+
constructor(supabase, actor, audit) {
|
|
24
|
+
this.supabase = supabase;
|
|
25
|
+
this.actor = actor;
|
|
26
|
+
this.audit = audit;
|
|
27
|
+
}
|
|
28
|
+
/** The actor organization's credentials; both null when nothing has been stored yet. */
|
|
29
|
+
async get() {
|
|
30
|
+
const { data, error } = await this.supabase
|
|
31
|
+
.from('organization_paystack_credentials')
|
|
32
|
+
.select(CREDENTIAL_COLUMNS)
|
|
33
|
+
.eq('organization_id', this.actor.organization_id)
|
|
34
|
+
.maybeSingle();
|
|
35
|
+
if (error)
|
|
36
|
+
throw (0, errors_1.mapPostgrestError)(error);
|
|
37
|
+
const row = (data ?? {});
|
|
38
|
+
return {
|
|
39
|
+
paystack_customer_authorization_code: row.paystack_customer_authorization_code ?? null,
|
|
40
|
+
paystack_subscription_email_token: row.paystack_subscription_email_token ?? null,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Stores the given credentials, leaving the other untouched. Creates the row on first use;
|
|
45
|
+
* `null` clears a credential (a cancelled subscription's dead token must never be reused).
|
|
46
|
+
*/
|
|
47
|
+
async set(patch) {
|
|
48
|
+
const before = await this.get();
|
|
49
|
+
const after = { ...before, ...patch };
|
|
50
|
+
const { error } = await this.supabase
|
|
51
|
+
.from('organization_paystack_credentials')
|
|
52
|
+
.upsert({
|
|
53
|
+
organization_id: this.actor.organization_id,
|
|
54
|
+
...after,
|
|
55
|
+
updated_at: new Date().toISOString(),
|
|
56
|
+
}, { onConflict: 'organization_id' });
|
|
57
|
+
if (error)
|
|
58
|
+
throw (0, errors_1.mapPostgrestError)(error);
|
|
59
|
+
const changes = (0, audit_1.diffChanges)(before, after);
|
|
60
|
+
if (Object.keys(changes).length === 0)
|
|
61
|
+
return;
|
|
62
|
+
await this.audit.record({
|
|
63
|
+
action: enum_1.AuditTrailAction.UPDATE,
|
|
64
|
+
entityType: enum_1.AuditTrailEntityType.ORGANIZATION,
|
|
65
|
+
entityId: this.actor.organization_id,
|
|
66
|
+
changes,
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
exports.OrganizationPaystackCredentialsResource = OrganizationPaystackCredentialsResource;
|
|
71
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
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E,IAAI,CAAC,KAAK,CAAC,eAAe;YAC3C,GAAG,KAAK;YACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;SACrC,EACD,EAAE,UAAU,EAAE,iBAAiB,EAAE,CAClC,CAAC;QACJ,IAAI,KAAK;YAAE,MAAM,IAAA,0BAAiB,EAAC,KAAK,CAAC,CAAC;QAE1C,MAAM,OAAO,GAAG,IAAA,mBAAW,EAAC,MAAkB,EAAE,KAAiB,CAAC,CAAC;QACnE,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO;QAE9C,MAAM,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;YACtB,MAAM,EAAE,uBAAgB,CAAC,MAAM;YAC/B,UAAU,EAAE,2BAAoB,CAAC,YAAY;YAC7C,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,eAAe;YACpC,OAAO;SACR,CAAC,CAAC;IACL,CAAC;CACF;AAtDD,0FAsDC"}
|
|
@@ -4,6 +4,7 @@ import { BillingResource } from '../billing';
|
|
|
4
4
|
import { InvoicesResource } from '../billing/invoices';
|
|
5
5
|
import { NotificationsOutboxResource } from '../notifications';
|
|
6
6
|
import { OrganizationInvitesResource } from '../organization-invites';
|
|
7
|
+
import { OrganizationPaystackCredentialsResource } from '../organization-paystack-credentials';
|
|
7
8
|
import { OrganizationsResource, OrganizationSignupResource } from '../organizations';
|
|
8
9
|
import { PermissionsResource } from '../permissions';
|
|
9
10
|
import { SupportTicketsAdminResource } from '../support/tickets';
|
|
@@ -29,6 +30,7 @@ export declare class SupabaseOrganizationScope {
|
|
|
29
30
|
readonly invoices: InvoicesResource;
|
|
30
31
|
readonly invites: OrganizationInvitesResource;
|
|
31
32
|
readonly organizations: OrganizationsResource;
|
|
33
|
+
readonly paystackCredentials: OrganizationPaystackCredentialsResource;
|
|
32
34
|
readonly permissions: PermissionsResource;
|
|
33
35
|
readonly users: UsersResource;
|
|
34
36
|
constructor(supabase: TypedSupabaseClient, actor: AuditActor, onAuditError?: AuditErrorHandler);
|
|
@@ -9,6 +9,7 @@ const invoices_1 = require("../billing/invoices");
|
|
|
9
9
|
const notifications_1 = require("../notifications");
|
|
10
10
|
const errors_1 = require("../errors");
|
|
11
11
|
const organization_invites_1 = require("../organization-invites");
|
|
12
|
+
const organization_paystack_credentials_1 = require("../organization-paystack-credentials");
|
|
12
13
|
const organizations_1 = require("../organizations");
|
|
13
14
|
const permissions_1 = require("../permissions");
|
|
14
15
|
const tickets_1 = require("../support/tickets");
|
|
@@ -27,6 +28,7 @@ class SupabaseOrganizationScope {
|
|
|
27
28
|
invoices;
|
|
28
29
|
invites;
|
|
29
30
|
organizations;
|
|
31
|
+
paystackCredentials;
|
|
30
32
|
permissions;
|
|
31
33
|
users;
|
|
32
34
|
constructor(supabase, actor, onAuditError) {
|
|
@@ -37,6 +39,7 @@ class SupabaseOrganizationScope {
|
|
|
37
39
|
this.invoices = new invoices_1.InvoicesResource(supabase, actor, this.audit);
|
|
38
40
|
this.invites = new organization_invites_1.OrganizationInvitesResource(supabase, actor);
|
|
39
41
|
this.organizations = new organizations_1.OrganizationsResource(supabase, actor, this.audit);
|
|
42
|
+
this.paystackCredentials = new organization_paystack_credentials_1.OrganizationPaystackCredentialsResource(supabase, actor, this.audit);
|
|
40
43
|
this.permissions = new permissions_1.PermissionsResource(supabase, actor, this.audit);
|
|
41
44
|
this.users = new users_1.UsersResource(supabase, actor, this.audit);
|
|
42
45
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/service-client/index.ts"],"names":[],"mappings":";;;AAAA,kCAA0C;AAC1C,oCAQkB;AAClB,0EAAuF;AAEvF,wCAA6C;AAC7C,kDAAuD;AACvD,oDAA+D;AAC/D,sCAA8C;AAC9C,kEAAsE;AACtE,oDAAqF;AACrF,gDAAqD;AACrD,gDAAiE;AACjE,oCAAyC;AACzC,sDAA0D;AAU1D;;;;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