@managemint-solutions/entities 1.36.0 → 1.46.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.
Files changed (39) hide show
  1. package/dist/audit-trail/enum/index.d.ts +13 -3
  2. package/dist/audit-trail/enum/index.js +10 -0
  3. package/dist/audit-trail/index.d.ts +14 -1
  4. package/dist/clients/dto/index.d.ts +5 -2
  5. package/dist/clients/index.d.ts +17 -1
  6. package/dist/documents/dto/index.d.ts +148 -0
  7. package/dist/documents/dto/index.js +2 -0
  8. package/dist/documents/enum/index.d.ts +127 -0
  9. package/dist/documents/enum/index.js +140 -0
  10. package/dist/documents/index.d.ts +390 -0
  11. package/dist/documents/index.js +2 -0
  12. package/dist/leads/index.d.ts +2 -0
  13. package/dist/notifications/enum/index.d.ts +4 -0
  14. package/dist/notifications/enum/index.js +4 -0
  15. package/dist/organization/payouts/dto/index.d.ts +15 -0
  16. package/dist/organization/payouts/dto/index.js +2 -0
  17. package/dist/organization/payouts/enum/index.d.ts +11 -0
  18. package/dist/organization/payouts/enum/index.js +16 -0
  19. package/dist/organization/payouts/index.d.ts +21 -0
  20. package/dist/organization/payouts/index.js +2 -0
  21. package/dist/payments/enum/index.d.ts +22 -0
  22. package/dist/payments/enum/index.js +29 -0
  23. package/dist/payments/index.d.ts +25 -0
  24. package/dist/payments/index.js +2 -0
  25. package/dist/paystack/enum/index.d.ts +8 -0
  26. package/dist/paystack/enum/index.js +11 -1
  27. package/dist/paystack/index.d.ts +63 -6
  28. package/dist/paystack/webhook/index.d.ts +9 -2
  29. package/dist/projects/index.d.ts +2 -0
  30. package/dist/tasks/index.d.ts +2 -0
  31. package/dist/users/index.d.ts +1 -0
  32. package/dist/users/permissions/dto/index.d.ts +4 -0
  33. package/dist/visibility/dto/index.d.ts +13 -0
  34. package/dist/visibility/dto/index.js +2 -0
  35. package/dist/visibility/enum/index.d.ts +17 -0
  36. package/dist/visibility/enum/index.js +22 -0
  37. package/dist/visibility/index.d.ts +13 -0
  38. package/dist/visibility/index.js +2 -0
  39. package/package.json +1 -1
@@ -1,3 +1,4 @@
1
+ import type { PaystackDocumentChargeMetadata, PaystackOwnChargeMetadata } from './webhook';
1
2
  export type PaystackReturn<T = any> = {
2
3
  status: false;
3
4
  message: string;
@@ -111,15 +112,13 @@ export type PaystackTransactionInitialize = {
111
112
  callback_url?: string;
112
113
  plan?: string;
113
114
  invoice_limit?: number;
114
- metadata: {
115
- organization_id: string;
116
- idempotencyKey: string;
117
- transactionId: string;
118
- };
115
+ metadata: PaystackOwnChargeMetadata | PaystackDocumentChargeMetadata;
119
116
  split_code?: string;
117
+ /** The subaccount the charge settles to (`ACCT_...`). */
120
118
  subaccount?: string;
121
119
  transaction_charge?: number;
122
- bearer?: string;
120
+ /** Who pays Paystack's fee: `account` (the platform, the default) or `subaccount`. */
121
+ bearer?: 'account' | 'subaccount';
123
122
  };
124
123
  export type PaystackTransactionInitializeResponse = {
125
124
  authorization_url: string;
@@ -162,3 +161,61 @@ export type PaystackChargeAuthorizationResponse = {
162
161
  reusable: boolean;
163
162
  };
164
163
  };
164
+ /** One bank from `GET /bank?currency=ZAR` - the fields the payouts form uses. */
165
+ export type PaystackBank = {
166
+ id: number;
167
+ name: string;
168
+ /** The branch code Paystack names the bank by (`250655`). */
169
+ code: string;
170
+ active: boolean;
171
+ is_deleted: boolean;
172
+ currency: string;
173
+ };
174
+ /**
175
+ * `POST /bank/validate`: South Africa's account check against the holder's identity document
176
+ * (there is no account-name lookup there).
177
+ */
178
+ export type PaystackBankValidate = {
179
+ bank_code: string;
180
+ country_code: 'ZA';
181
+ account_number: string;
182
+ account_name: string;
183
+ account_type: string;
184
+ document_type: string;
185
+ document_number: string;
186
+ };
187
+ export type PaystackBankValidateResponse = {
188
+ /** The answer that matters; the flags below are its parts. Always false in test mode. */
189
+ verified: boolean;
190
+ verificationMessage: string;
191
+ accountAcceptsCredits: boolean;
192
+ accountAcceptsDebits: boolean;
193
+ accountHolderMatch: boolean;
194
+ accountOpenForMoreThanThreeMonths: boolean;
195
+ };
196
+ /**
197
+ * `POST /subaccount`. The API reads the bank code as `settlement_bank`, as the docs' own sample
198
+ * does, not the `bank_code` their parameter list names.
199
+ */
200
+ export type PaystackSubaccountCreate = {
201
+ business_name: string;
202
+ settlement_bank: string;
203
+ account_number: string;
204
+ /** The platform's share of each payment, in percent. */
205
+ percentage_charge: number;
206
+ };
207
+ /** `PUT /subaccount/:code`; `active: false` switches it off. */
208
+ export type PaystackSubaccountUpdate = Partial<PaystackSubaccountCreate> & {
209
+ active?: boolean;
210
+ };
211
+ export type PaystackSubaccountResponse = {
212
+ id: number;
213
+ subaccount_code: string;
214
+ business_name: string;
215
+ /** The bank's name, though the request sent its code. */
216
+ settlement_bank: string;
217
+ account_number: string;
218
+ percentage_charge: number;
219
+ currency: string;
220
+ active: boolean;
221
+ };
@@ -1,4 +1,4 @@
1
- import { PaystackWebhookEvent } from '../enum';
1
+ import { PaystackChargeKind, PaystackWebhookEvent } from '../enum';
2
2
  export type PaystackAuthorization = {
3
3
  authorization_code: string;
4
4
  bin: number;
@@ -248,6 +248,12 @@ export type PaystackOwnChargeMetadata = {
248
248
  idempotencyKey: string;
249
249
  transactionId: string;
250
250
  };
251
+ /** The metadata block on a document's Pay now checkout. */
252
+ export type PaystackDocumentChargeMetadata = {
253
+ kind: PaystackChargeKind.DOCUMENT_PAYMENT;
254
+ document_id: string;
255
+ organization_id: string;
256
+ };
251
257
  /** The metadata block Paystack's own hosted pages attach, e.g. the card-update page. */
252
258
  export type PaystackHostedPageChargeMetadata = {
253
259
  /** 'update_card' on the card-update page's tokenising charge. */
@@ -282,8 +288,9 @@ export type PaystackTransactionSuccessfulEvent = {
282
288
  * - Absent or empty: not ours. A subscription renewal is recognised by `plan`
283
289
  * naming the organization's plan code, never by the missing metadata alone;
284
290
  * anything else is recorded as unclassified.
291
+ * - `kind: 'document_payment'`: a document's Pay now checkout.
285
292
  */
286
- metadata?: PaystackOwnChargeMetadata | PaystackHostedPageChargeMetadata;
293
+ metadata?: PaystackOwnChargeMetadata | PaystackHostedPageChargeMetadata | PaystackDocumentChargeMetadata;
287
294
  log: {
288
295
  time_spent: number;
289
296
  attempts: number;
@@ -44,4 +44,6 @@ export type ProjectEntity = {
44
44
  deleted_by: UserIdentity | null;
45
45
  restored_at: Date | null;
46
46
  restored_by: UserIdentity | null;
47
+ /** Present on staff reads only. */
48
+ organization?: OrganizationIdentity;
47
49
  };
@@ -69,4 +69,6 @@ export type TaskEntity = {
69
69
  deleted_by: UserIdentity | null;
70
70
  restored_at: Date | null;
71
71
  restored_by: UserIdentity | null;
72
+ /** Present on staff reads only. */
73
+ organization?: OrganizationIdentity;
72
74
  };
@@ -149,6 +149,7 @@ export interface Permissions {
149
149
  projects: CrudPermission;
150
150
  project_budgets: CrudPermission;
151
151
  tasks: CrudPermission;
152
+ documents: CrudPermission;
152
153
  timesheets: CrudPermission;
153
154
  invoices: Omit<CrudPermission, 'create' | 'update' | 'delete'>;
154
155
  leave_types: CrudPermission;
@@ -19,6 +19,10 @@ export type UpdatePermissionsDto = {
19
19
  read_timesheets: boolean;
20
20
  update_timesheets: boolean;
21
21
  delete_timesheets: boolean;
22
+ create_documents: boolean;
23
+ read_documents: boolean;
24
+ update_documents: boolean;
25
+ delete_documents: boolean;
22
26
  create_leave: boolean;
23
27
  read_leave: boolean;
24
28
  update_leave: boolean;
@@ -0,0 +1,13 @@
1
+ import type { DocumentVisibility } from '../../documents/enum';
2
+ import type { VisibilityRole } from '../enum';
3
+ /**
4
+ * Replaces a record's setting and its whole share list. The creator is never in the list - they
5
+ * are always an admin - and everyone in it belongs to the organization.
6
+ */
7
+ export type UpdateVisibilityDto = {
8
+ visibility: DocumentVisibility;
9
+ shares: {
10
+ user_id: string;
11
+ role: VisibilityRole;
12
+ }[];
13
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,17 @@
1
+ /**
2
+ * The kinds of record a private share can be on. Each value is the record's own table, and the
3
+ * key a `visibility` row is filed under; a new kind is a member here and a policy on its table.
4
+ */
5
+ export declare enum VisibilityEntityType {
6
+ DOCUMENT_TEMPLATES = "document_templates",
7
+ DOCUMENTS = "documents"
8
+ }
9
+ /** What a person may do with a private record shared with them. Its creator is always ADMIN. */
10
+ export declare enum VisibilityRole {
11
+ /** View and print. */
12
+ READ = "read",
13
+ /** Read, and edit (a document only while it is a draft). */
14
+ WRITE = "write",
15
+ /** Write, and issue, void, delete and manage who it is shared with. */
16
+ ADMIN = "admin"
17
+ }
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.VisibilityRole = exports.VisibilityEntityType = void 0;
4
+ /**
5
+ * The kinds of record a private share can be on. Each value is the record's own table, and the
6
+ * key a `visibility` row is filed under; a new kind is a member here and a policy on its table.
7
+ */
8
+ var VisibilityEntityType;
9
+ (function (VisibilityEntityType) {
10
+ VisibilityEntityType["DOCUMENT_TEMPLATES"] = "document_templates";
11
+ VisibilityEntityType["DOCUMENTS"] = "documents";
12
+ })(VisibilityEntityType || (exports.VisibilityEntityType = VisibilityEntityType = {}));
13
+ /** What a person may do with a private record shared with them. Its creator is always ADMIN. */
14
+ var VisibilityRole;
15
+ (function (VisibilityRole) {
16
+ /** View and print. */
17
+ VisibilityRole["READ"] = "read";
18
+ /** Read, and edit (a document only while it is a draft). */
19
+ VisibilityRole["WRITE"] = "write";
20
+ /** Write, and issue, void, delete and manage who it is shared with. */
21
+ VisibilityRole["ADMIN"] = "admin";
22
+ })(VisibilityRole || (exports.VisibilityRole = VisibilityRole = {}));
@@ -0,0 +1,13 @@
1
+ import type { DocumentVisibility } from '../documents/enum';
2
+ import type { UserIdentity } from '../users';
3
+ import type { VisibilityRole } from './enum';
4
+ /** One person a private record is shared with. */
5
+ export type VisibilityShare = {
6
+ user: UserIdentity;
7
+ role: VisibilityRole;
8
+ };
9
+ /** Who can see a record: its setting and, when private, the people it is shared with. */
10
+ export type RecordVisibility = {
11
+ visibility: DocumentVisibility;
12
+ shares: VisibilityShare[];
13
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@managemint-solutions/entities",
3
- "version": "1.36.0",
3
+ "version": "1.46.0",
4
4
  "description": "Entity types used by both the api and portal",
5
5
  "homepage": "https://github.com/ManageMint-Solutions/managemint-solutions-entities#readme",
6
6
  "bugs": {