@managemint-solutions/sdk 0.65.0 → 0.67.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 (44) hide show
  1. package/dist/audit/index.d.ts +1 -1
  2. package/dist/audit/index.js +14 -0
  3. package/dist/client.d.ts +7 -0
  4. package/dist/client.js +14 -0
  5. package/dist/documents/content.js +6 -1
  6. package/dist/documents/document-templates.js +15 -5
  7. package/dist/documents/documents.d.ts +14 -5
  8. package/dist/documents/documents.js +14 -2
  9. package/dist/documents/dto.d.ts +12 -2
  10. package/dist/documents/dto.js +61 -1
  11. package/dist/documents/render/html.d.ts +5 -0
  12. package/dist/documents/render/html.js +10 -3
  13. package/dist/documents/render/index.d.ts +1 -1
  14. package/dist/documents/render/index.js +3 -1
  15. package/dist/documents/render/values.d.ts +12 -5
  16. package/dist/documents/render/values.js +16 -6
  17. package/dist/index.d.ts +3 -1
  18. package/dist/index.js +32 -3
  19. package/dist/inventory/dto.d.ts +134 -0
  20. package/dist/inventory/dto.js +684 -0
  21. package/dist/inventory/index.d.ts +7 -0
  22. package/dist/inventory/index.js +30 -0
  23. package/dist/inventory/items.d.ts +65 -0
  24. package/dist/inventory/items.js +216 -0
  25. package/dist/inventory/levels.d.ts +52 -0
  26. package/dist/inventory/levels.js +157 -0
  27. package/dist/inventory/locations.d.ts +29 -0
  28. package/dist/inventory/locations.js +158 -0
  29. package/dist/inventory/movements.d.ts +36 -0
  30. package/dist/inventory/movements.js +103 -0
  31. package/dist/inventory/stocktakes.d.ts +36 -0
  32. package/dist/inventory/stocktakes.js +70 -0
  33. package/dist/inventory/transfers.d.ts +73 -0
  34. package/dist/inventory/transfers.js +134 -0
  35. package/dist/organizations/dto.d.ts +3 -1
  36. package/dist/organizations/dto.js +12 -0
  37. package/dist/organizations/index.js +2 -0
  38. package/dist/permissions/dto.d.ts +4 -0
  39. package/dist/permissions/dto.js +20 -0
  40. package/dist/service-client/index.d.ts +6 -0
  41. package/dist/service-client/index.js +10 -0
  42. package/dist/users/paths.d.ts +5 -6
  43. package/dist/users/paths.js +12 -12
  44. package/package.json +2 -2
@@ -58,6 +58,10 @@ class UpdatePermissionsDto {
58
58
  read_leave_requests;
59
59
  update_leave_requests;
60
60
  delete_leave_requests;
61
+ create_inventory;
62
+ read_inventory;
63
+ update_inventory;
64
+ delete_inventory;
61
65
  // @IsBoolean({ message: 'Create Invoices must be a boolean' })
62
66
  // readonly create_invoices!: boolean;
63
67
  read_invoices;
@@ -252,6 +256,22 @@ __decorate([
252
256
  (0, class_validator_1.IsBoolean)({ message: 'Delete Leave Requests must be a boolean' }),
253
257
  __metadata("design:type", Boolean)
254
258
  ], UpdatePermissionsDto.prototype, "delete_leave_requests", void 0);
259
+ __decorate([
260
+ (0, class_validator_1.IsBoolean)({ message: 'Create Inventory must be a boolean' }),
261
+ __metadata("design:type", Boolean)
262
+ ], UpdatePermissionsDto.prototype, "create_inventory", void 0);
263
+ __decorate([
264
+ (0, class_validator_1.IsBoolean)({ message: 'Read Inventory must be a boolean' }),
265
+ __metadata("design:type", Boolean)
266
+ ], UpdatePermissionsDto.prototype, "read_inventory", void 0);
267
+ __decorate([
268
+ (0, class_validator_1.IsBoolean)({ message: 'Update Inventory must be a boolean' }),
269
+ __metadata("design:type", Boolean)
270
+ ], UpdatePermissionsDto.prototype, "update_inventory", void 0);
271
+ __decorate([
272
+ (0, class_validator_1.IsBoolean)({ message: 'Delete Inventory must be a boolean' }),
273
+ __metadata("design:type", Boolean)
274
+ ], UpdatePermissionsDto.prototype, "delete_inventory", void 0);
255
275
  __decorate([
256
276
  (0, class_validator_1.IsBoolean)({ message: 'Read Invoices must be a boolean' }),
257
277
  __metadata("design:type", Boolean)
@@ -13,6 +13,7 @@ import { OrganizationInvitesResource } from '../organization-invites';
13
13
  import { OrganizationPaymentMethodsResource, type PaymentMethodLookupColumn } from '../organization-payment-methods';
14
14
  import { OrganizationsResource, OrganizationSignupResource } from '../organizations';
15
15
  import { PaymentsResource } from '../payments';
16
+ import { InventoryItemsResource, InventoryLevelsResource, InventoryLocationsResource, InventoryMovementsResource } from '../inventory';
16
17
  import { PermissionsResource } from '../permissions';
17
18
  import { StaffPermissionsResource, StaffResource } from '../staff';
18
19
  import { SupportingFilesResource } from '../supporting-files';
@@ -46,6 +47,11 @@ export declare class SupabaseOrganizationScope {
46
47
  readonly payments: PaymentsResource;
47
48
  readonly invoices: InvoicesResource;
48
49
  readonly invites: OrganizationInvitesResource;
50
+ /** For stock that moves with a document paid through Paystack or issued by the cron. */
51
+ readonly inventoryItems: InventoryItemsResource;
52
+ readonly inventoryLocations: InventoryLocationsResource;
53
+ readonly inventoryLevels: InventoryLevelsResource;
54
+ readonly inventoryMovements: InventoryMovementsResource;
49
55
  readonly leaveTypes: LeaveTypesResource;
50
56
  readonly leaveEntitlements: LeaveEntitlementsResource;
51
57
  readonly leaveRequests: LeaveRequestsResource;
@@ -19,6 +19,7 @@ const organization_invites_1 = require("../organization-invites");
19
19
  const organization_payment_methods_1 = require("../organization-payment-methods");
20
20
  const organizations_1 = require("../organizations");
21
21
  const payments_1 = require("../payments");
22
+ const inventory_1 = require("../inventory");
22
23
  const permissions_1 = require("../permissions");
23
24
  const staff_1 = require("../staff");
24
25
  const supporting_files_1 = require("../supporting-files");
@@ -45,6 +46,11 @@ class SupabaseOrganizationScope {
45
46
  payments;
46
47
  invoices;
47
48
  invites;
49
+ /** For stock that moves with a document paid through Paystack or issued by the cron. */
50
+ inventoryItems;
51
+ inventoryLocations;
52
+ inventoryLevels;
53
+ inventoryMovements;
48
54
  leaveTypes;
49
55
  leaveEntitlements;
50
56
  leaveRequests;
@@ -65,6 +71,10 @@ class SupabaseOrganizationScope {
65
71
  this.payments = new payments_1.PaymentsResource(supabase, actor, this.audit);
66
72
  this.invoices = new invoices_1.InvoicesResource(supabase, actor, this.audit);
67
73
  this.invites = new organization_invites_1.OrganizationInvitesResource(supabase, actor);
74
+ this.inventoryItems = new inventory_1.InventoryItemsResource(supabase, actor, this.audit);
75
+ this.inventoryLocations = new inventory_1.InventoryLocationsResource(supabase, actor, this.audit);
76
+ this.inventoryLevels = new inventory_1.InventoryLevelsResource(supabase, actor, this.audit);
77
+ this.inventoryMovements = new inventory_1.InventoryMovementsResource(supabase, actor, this.audit);
68
78
  // The leave-year rollover writes next period's entitlements as the system (`mms_id: null`).
69
79
  this.leaveTypes = new leave_1.LeaveTypesResource(supabase, actor, this.audit);
70
80
  this.leaveEntitlements = new leave_1.LeaveEntitlementsResource(supabase, actor, this.audit);
@@ -14,11 +14,10 @@ export declare const PROFILE_PICTURES_BUCKET = "profile-pictures";
14
14
  */
15
15
  export declare const profileImagePath: (organizationId: string, userId: string, name: string, extension: string) => string;
16
16
  /**
17
- * The object key behind a stored `users.profile_image` URL, so the previous avatar can be
18
- * removed when a new one replaces it.
19
- *
20
- * Returns null for anything that is not one of our own public URLs - the column also holds
21
- * whatever `raw_user_meta_data` carried at signup (a Google or Gravatar URL), and those are
22
- * not ours to delete.
17
+ * The object key behind one of our own public-bucket URLs, so the previous object can be
18
+ * removed when a new one replaces it. Null for anything else (a Google or Gravatar URL from
19
+ * signup is not ours to delete).
23
20
  */
21
+ export declare const publicObjectPath: (bucket: string, url: unknown) => string | null;
22
+ /** The object key behind a stored `users.profile_image` URL. */
24
23
  export declare const profileImageObjectPath: (profileImage: unknown) => string | null;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.profileImageObjectPath = exports.profileImagePath = exports.PROFILE_PICTURES_BUCKET = void 0;
3
+ exports.profileImageObjectPath = exports.publicObjectPath = exports.profileImagePath = exports.PROFILE_PICTURES_BUCKET = void 0;
4
4
  /** Storage bucket every profile picture lives in. Public-read; writes are policy-scoped. */
5
5
  exports.PROFILE_PICTURES_BUCKET = 'profile-pictures';
6
6
  /**
@@ -18,21 +18,21 @@ exports.PROFILE_PICTURES_BUCKET = 'profile-pictures';
18
18
  const profileImagePath = (organizationId, userId, name, extension) => `${organizationId}/${userId}/${Date.now()}-${name}${extension ? `.${extension}` : ''}`;
19
19
  exports.profileImagePath = profileImagePath;
20
20
  /**
21
- * The object key behind a stored `users.profile_image` URL, so the previous avatar can be
22
- * removed when a new one replaces it.
23
- *
24
- * Returns null for anything that is not one of our own public URLs - the column also holds
25
- * whatever `raw_user_meta_data` carried at signup (a Google or Gravatar URL), and those are
26
- * not ours to delete.
21
+ * The object key behind one of our own public-bucket URLs, so the previous object can be
22
+ * removed when a new one replaces it. Null for anything else (a Google or Gravatar URL from
23
+ * signup is not ours to delete).
27
24
  */
28
- const profileImageObjectPath = (profileImage) => {
29
- if (typeof profileImage !== 'string')
25
+ const publicObjectPath = (bucket, url) => {
26
+ if (typeof url !== 'string')
30
27
  return null;
31
- const marker = `/storage/v1/object/public/${exports.PROFILE_PICTURES_BUCKET}/`;
32
- const index = profileImage.indexOf(marker);
28
+ const marker = `/storage/v1/object/public/${bucket}/`;
29
+ const index = url.indexOf(marker);
33
30
  if (index === -1)
34
31
  return null;
35
- const path = profileImage.slice(index + marker.length).split('?')[0];
32
+ const path = url.slice(index + marker.length).split('?')[0];
36
33
  return path ? decodeURIComponent(path) : null;
37
34
  };
35
+ exports.publicObjectPath = publicObjectPath;
36
+ /** The object key behind a stored `users.profile_image` URL. */
37
+ const profileImageObjectPath = (profileImage) => (0, exports.publicObjectPath)(exports.PROFILE_PICTURES_BUCKET, profileImage);
38
38
  exports.profileImageObjectPath = profileImageObjectPath;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@managemint-solutions/sdk",
3
- "version": "0.65.0",
3
+ "version": "0.67.0",
4
4
  "description": "Typed Supabase data-access SDK for ManageMint Solutions",
5
5
  "license": "UNLICENSED",
6
6
  "author": "Scott Bebington <scottbebington@gmail.com>",
@@ -55,7 +55,7 @@
55
55
  "testEnvironment": "node"
56
56
  },
57
57
  "dependencies": {
58
- "@managemint-solutions/entities": "^1.47.0"
58
+ "@managemint-solutions/entities": "^1.49.0"
59
59
  },
60
60
  "peerDependencies": {
61
61
  "@nestjs/common": "^11.0.0",