@managemint-solutions/sdk 0.68.0 → 0.70.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 (42) hide show
  1. package/README.md +7 -2
  2. package/dist/additional-details/dto.d.ts +9 -1
  3. package/dist/additional-details/dto.js +46 -1
  4. package/dist/additional-details/index.d.ts +8 -0
  5. package/dist/additional-details/index.js +12 -0
  6. package/dist/audit/index.d.ts +6 -0
  7. package/dist/audit/index.js +47 -0
  8. package/dist/auth.d.ts +11 -1
  9. package/dist/auth.js +5 -2
  10. package/dist/client.d.ts +3 -0
  11. package/dist/client.js +4 -0
  12. package/dist/configs/dto.d.ts +5 -1
  13. package/dist/configs/dto.js +10 -1
  14. package/dist/crons/dto.d.ts +9 -0
  15. package/dist/crons/dto.js +43 -0
  16. package/dist/crons/index.d.ts +38 -0
  17. package/dist/crons/index.js +109 -0
  18. package/dist/index.d.ts +8 -5
  19. package/dist/index.js +15 -4
  20. package/dist/notes/dto.d.ts +9 -1
  21. package/dist/notes/dto.js +46 -1
  22. package/dist/notes/index.d.ts +9 -0
  23. package/dist/notes/index.js +13 -0
  24. package/dist/oauth/dto.d.ts +7 -0
  25. package/dist/oauth/dto.js +32 -0
  26. package/dist/oauth/index.d.ts +25 -0
  27. package/dist/oauth/index.js +88 -0
  28. package/dist/service-client/index.d.ts +4 -0
  29. package/dist/service-client/index.js +6 -0
  30. package/dist/staff-client.d.ts +18 -1
  31. package/dist/staff-client.js +30 -0
  32. package/dist/statuses/dto.d.ts +9 -1
  33. package/dist/statuses/dto.js +46 -1
  34. package/dist/statuses/index.d.ts +7 -2
  35. package/dist/statuses/index.js +18 -10
  36. package/dist/supporting-files/dto.d.ts +9 -1
  37. package/dist/supporting-files/dto.js +46 -1
  38. package/dist/supporting-files/index.d.ts +5 -0
  39. package/dist/supporting-files/index.js +9 -0
  40. package/dist/tenancy.d.ts +12 -0
  41. package/dist/tenancy.js +22 -1
  42. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -7,10 +7,10 @@
7
7
  // their classes are not exported: a consumer never constructs one, and every export is a contract
8
8
  // to keep. The row and input types they produce and accept are exported for annotations.
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.GetNotificationsDto = exports.NoteIdDto = exports.GetNotesDto = exports.AddNoteDto = exports.UpdateAdditionalDetailsDto = exports.IsAdditionalDetailsValueByType = exports.GetAdditionalDetailsDto = exports.AdditionalDetailsIdDto = exports.AddAdditionalDetailsDto = exports.UpdateLabelDto = exports.LabelIdDto = exports.GetLabelsDto = exports.AddLabelDto = exports.UpdateStatusDto = exports.StatusIdDto = exports.ReorderStatusesDto = exports.GetStatusesDto = exports.AddStatusDto = exports.CreateSupportRequestDto = exports.UpdateConfigDto = exports.CreateConfigDto = exports.CreateFeatureRequestDto = exports.InvoiceIdDto = exports.GetInvoicesQueryDto = exports.ReinstateSubscriptionDto = exports.PurchaseModuleDto = exports.ModuleSetDto = exports.ChangeModulesDto = exports.PaymentIdDto = exports.InitialPaymentDto = exports.GetPaymentsQueryDto = exports.CancelSubscriptionDto = exports.withAuditBatch = exports.GetAuditTrailDto = exports.IsNullable = exports.EmptyToNull = exports.SupabaseClientError = exports.createSupabaseServiceClient = exports.SupabaseServiceClient = exports.SignInDto = exports.SendPasswordResetEmailDto = exports.ResetPasswordDto = exports.ExchangeTokenHashDto = exports.ExchangeRefreshTokenDto = exports.createSupabaseAuthClient = exports.SupabaseAuthClient = exports.createSupabaseStaffClient = exports.SupabaseStaffClient = exports.createSupabaseClient = exports.SupabaseClient = void 0;
11
- exports.InventoryItemIdDto = exports.ImportInventoryItemsDto = exports.ImportInventoryItemDto = exports.GetInventoryTransfersDto = exports.GetInventoryStocktakesDto = exports.GetInventoryMovementsDto = exports.GetInventoryLocationsDto = exports.GetInventoryItemsDto = exports.GeocodeAddressDto = exports.CreateInventoryTransferLineDto = exports.CreateInventoryTransferDto = exports.CreateInventoryMovementDto = exports.CreateInventoryLocationDto = exports.CreateInventoryItemDto = exports.CountInventoryLineDto = exports.CountInventoryDto = exports.UpdateLeadDto = exports.StaffGetLeadsDto = exports.LeadIdDto = exports.GetLeadsDto = exports.CreateLeadDto = exports.ConvertLeadDto = exports.UpdateClientDto = exports.StaffGetClientsDto = exports.GetClientsDto = exports.CreateClientDto = exports.ClientIdDto = exports.SupportingFileNamesDto = exports.SupportingFileIdDto = exports.GetSupportingFilesDto = exports.UserIdDto = exports.UpdateUserDto = exports.UpdateMyProfileDto = exports.StaffGetUsersDto = exports.GetUsersQueryDto = exports.AddUserDto = exports.UserApiCredentialIdDto = exports.MintEmulationTokenDto = exports.CreateUserApiCredentialDto = exports.UpdateStaffPermissionsDto = exports.StaffIdDto = exports.CreateStaffDto = exports.UpdatePermissionsDto = exports.PermissionsResource = exports.UpdateOrganizationDto = exports.OrganizationIdDto = exports.GetOrganizationsDto = exports.CreateOrganizationDto = exports.UpdateOrganizationPayoutsDto = exports.NotificationIdDto = void 0;
12
- exports.CreateLeaveEntitlementDto = exports.CreateLeaveAdjustmentDto = exports.BulkCreateLeaveEntitlementsDto = exports.UpdateTaskDto = exports.TaskLinkIdDto = exports.TaskIdDto = exports.StaffGetTasksDto = exports.GetTasksDto = exports.CreateTaskDto = exports.AddTaskLinkDto = exports.UpdateProjectDto = exports.StaffGetProjectsDto = exports.ProjectIdDto = exports.GetProjectsDto = exports.CreateProjectDto = exports.UpdateVisibilityDto = exports.ReassignPrivateDocumentsDto = exports.ConvertDocumentDto = exports.VoidDocumentDto = exports.UpdateDocumentTemplateDto = exports.UpdateDocumentDto = exports.SendDocumentDto = exports.RecordDocumentPaymentDto = exports.PayDocumentDto = exports.GetDocumentTemplatesDto = exports.GetDocumentsDto = exports.GetCatalogueTemplatesDto = exports.documentProblem = exports.DocumentTemplateIdDto = exports.DocumentPaymentIdDto = exports.DocumentPayTokenDto = exports.DocumentPayQueryDto = exports.DocumentImageUrlsDto = exports.DocumentImageNameDto = exports.DocumentIdDto = exports.CreateDocumentTemplateDto = exports.CreateDocumentDto = exports.CopyCatalogueTemplateDto = exports.CatalogueTemplateSlugDto = exports.UpdateInventoryTransferDto = exports.UpdateInventoryLocationDto = exports.UpdateInventoryLevelDto = exports.UpdateInventoryItemDto = exports.SuggestAddressesDto = exports.StaffGetInventoryItemsDto = exports.ReceiveInventoryTransferDto = exports.InventoryTransferIdDto = exports.InventoryStocktakeIdDto = exports.InventoryLocationIdDto = exports.InventoryLevelKeyDto = void 0;
13
- exports.monthlyTotalMinor = exports.weekStartOf = exports.minutesBetween = exports.UpdateTimesheetEntryDto = exports.TimesheetIdDto = exports.TimesheetEntryIdDto = exports.ReviewTimesheetDto = exports.GetTimesheetsDto = exports.GetTimesheetReportDto = exports.CreateTimesheetEntryDto = exports.todayInJohannesburg = exports.shiftDays = exports.proRataDays = exports.isWithinPeriod = exports.initialUntil = exports.cyclePeriodFor = exports.countWorkingDays = exports.completedMonths = exports.addMonths = exports.GetPublicHolidaysDto = exports.UpdateLeaveTypeDto = exports.UpdateLeaveRequestDto = exports.UpdateLeaveEntitlementDto = exports.ReviewLeaveRequestDto = exports.LeaveTypeIdDto = exports.LeaveRequestIdDto = exports.LeaveEntitlementIdDto = exports.GetLeaveTypesDto = exports.GetLeaveRequestsDto = exports.GetLeaveEntitlementsDto = exports.GetLeaveCalendarDto = exports.CreateLeaveTypeDto = exports.CreateLeaveRequestDto = void 0;
10
+ exports.IsAdditionalDetailsValueByType = exports.GetAllAdditionalDetailsDto = exports.GetAdditionalDetailsDto = exports.AdditionalDetailsIdDto = exports.AddAdditionalDetailsDto = exports.UpdateLabelDto = exports.LabelIdDto = exports.GetLabelsDto = exports.AddLabelDto = exports.UpdateStatusDto = exports.StatusIdDto = exports.ReorderStatusesDto = exports.GetStatusesDto = exports.GetAllStatusesDto = exports.AddStatusDto = exports.CreateSupportRequestDto = exports.GetCronRunsDto = exports.CronIdDto = exports.UpdateConfigDto = exports.CreateConfigDto = exports.ConfigIdDto = exports.CreateFeatureRequestDto = exports.InvoiceIdDto = exports.GetInvoicesQueryDto = exports.ReinstateSubscriptionDto = exports.PurchaseModuleDto = exports.ModuleSetDto = exports.ChangeModulesDto = exports.PaymentIdDto = exports.InitialPaymentDto = exports.GetPaymentsQueryDto = exports.CancelSubscriptionDto = exports.withAuditBatch = exports.GetAuditTrailDto = exports.IsNullable = exports.EmptyToNull = exports.SupabaseClientError = exports.createSupabaseServiceClient = exports.SupabaseServiceClient = exports.SignInDto = exports.SendPasswordResetEmailDto = exports.ResetPasswordDto = exports.ExchangeTokenHashDto = exports.ExchangeRefreshTokenDto = exports.createSupabaseAuthClient = exports.SupabaseAuthClient = exports.createSupabaseStaffClient = exports.SupabaseStaffClient = exports.createSupabaseClient = exports.SupabaseClient = void 0;
11
+ exports.CreateInventoryTransferLineDto = exports.CreateInventoryTransferDto = exports.CreateInventoryMovementDto = exports.CreateInventoryLocationDto = exports.CreateInventoryItemDto = exports.CountInventoryLineDto = exports.CountInventoryDto = exports.UpdateLeadDto = exports.StaffGetLeadsDto = exports.LeadIdDto = exports.GetLeadsDto = exports.CreateLeadDto = exports.ConvertLeadDto = exports.UpdateClientDto = exports.StaffGetClientsDto = exports.GetClientsDto = exports.CreateClientDto = exports.ClientIdDto = exports.SupportingFileNamesDto = exports.SupportingFileIdDto = exports.GetSupportingFilesDto = exports.GetAllSupportingFilesDto = exports.UserIdDto = exports.UpdateUserDto = exports.UpdateMyProfileDto = exports.StaffGetUsersDto = exports.GetUsersQueryDto = exports.AddUserDto = exports.UserApiCredentialIdDto = exports.MintEmulationTokenDto = exports.CreateUserApiCredentialDto = exports.UpdateStaffPermissionsDto = exports.StaffIdDto = exports.CreateStaffDto = exports.OAuthClientIdDto = exports.OAuthAuthorizationIdDto = exports.UpdatePermissionsDto = exports.PermissionsResource = exports.UpdateOrganizationDto = exports.OrganizationIdDto = exports.GetOrganizationsDto = exports.CreateOrganizationDto = exports.UpdateOrganizationPayoutsDto = exports.NotificationIdDto = exports.GetNotificationsDto = exports.NoteIdDto = exports.GetNotesDto = exports.GetAllNotesDto = exports.AddNoteDto = exports.UpdateAdditionalDetailsDto = void 0;
12
+ exports.AddTaskLinkDto = exports.UpdateProjectDto = exports.StaffGetProjectsDto = exports.ProjectIdDto = exports.GetProjectsDto = exports.CreateProjectDto = exports.UpdateVisibilityDto = exports.ReassignPrivateDocumentsDto = exports.ConvertDocumentDto = exports.VoidDocumentDto = exports.UpdateDocumentTemplateDto = exports.UpdateDocumentDto = exports.SendDocumentDto = exports.RecordDocumentPaymentDto = exports.PayDocumentDto = exports.GetDocumentTemplatesDto = exports.GetDocumentsDto = exports.GetCatalogueTemplatesDto = exports.documentProblem = exports.DocumentTemplateIdDto = exports.DocumentPaymentIdDto = exports.DocumentPayTokenDto = exports.DocumentPayQueryDto = exports.DocumentImageUrlsDto = exports.DocumentImageNameDto = exports.DocumentIdDto = exports.CreateDocumentTemplateDto = exports.CreateDocumentDto = exports.CopyCatalogueTemplateDto = exports.CatalogueTemplateSlugDto = exports.UpdateInventoryTransferDto = exports.UpdateInventoryLocationDto = exports.UpdateInventoryLevelDto = exports.UpdateInventoryItemDto = exports.SuggestAddressesDto = exports.StaffGetInventoryItemsDto = exports.ReceiveInventoryTransferDto = exports.InventoryTransferIdDto = exports.InventoryStocktakeIdDto = exports.InventoryLocationIdDto = exports.InventoryLevelKeyDto = exports.InventoryItemIdDto = exports.ImportInventoryItemsDto = exports.ImportInventoryItemDto = exports.GetInventoryTransfersDto = exports.GetInventoryStocktakesDto = exports.GetInventoryMovementsDto = exports.GetInventoryLocationsDto = exports.GetInventoryItemsDto = exports.GeocodeAddressDto = void 0;
13
+ exports.monthlyTotalMinor = exports.weekStartOf = exports.minutesBetween = exports.UpdateTimesheetEntryDto = exports.TimesheetIdDto = exports.TimesheetEntryIdDto = exports.ReviewTimesheetDto = exports.GetTimesheetsDto = exports.GetTimesheetReportDto = exports.CreateTimesheetEntryDto = exports.todayInJohannesburg = exports.shiftDays = exports.proRataDays = exports.isWithinPeriod = exports.initialUntil = exports.cyclePeriodFor = exports.countWorkingDays = exports.completedMonths = exports.addMonths = exports.GetPublicHolidaysDto = exports.UpdateLeaveTypeDto = exports.UpdateLeaveRequestDto = exports.UpdateLeaveEntitlementDto = exports.ReviewLeaveRequestDto = exports.LeaveTypeIdDto = exports.LeaveRequestIdDto = exports.LeaveEntitlementIdDto = exports.GetLeaveTypesDto = exports.GetLeaveRequestsDto = exports.GetLeaveEntitlementsDto = exports.GetLeaveCalendarDto = exports.CreateLeaveTypeDto = exports.CreateLeaveRequestDto = exports.CreateLeaveEntitlementDto = exports.CreateLeaveAdjustmentDto = exports.BulkCreateLeaveEntitlementsDto = exports.UpdateTaskDto = exports.TaskLinkIdDto = exports.TaskIdDto = exports.StaffGetTasksDto = exports.GetTasksDto = exports.CreateTaskDto = void 0;
14
14
  var client_1 = require("./client");
15
15
  Object.defineProperty(exports, "SupabaseClient", { enumerable: true, get: function () { return client_1.SupabaseClient; } });
16
16
  Object.defineProperty(exports, "createSupabaseClient", { enumerable: true, get: function () { return client_1.createSupabaseClient; } });
@@ -52,12 +52,17 @@ Object.defineProperty(exports, "InvoiceIdDto", { enumerable: true, get: function
52
52
  var feature_requests_1 = require("./feature-requests");
53
53
  Object.defineProperty(exports, "CreateFeatureRequestDto", { enumerable: true, get: function () { return feature_requests_1.CreateFeatureRequestDto; } });
54
54
  var configs_1 = require("./configs");
55
+ Object.defineProperty(exports, "ConfigIdDto", { enumerable: true, get: function () { return configs_1.ConfigIdDto; } });
55
56
  Object.defineProperty(exports, "CreateConfigDto", { enumerable: true, get: function () { return configs_1.CreateConfigDto; } });
56
57
  Object.defineProperty(exports, "UpdateConfigDto", { enumerable: true, get: function () { return configs_1.UpdateConfigDto; } });
58
+ var crons_1 = require("./crons");
59
+ Object.defineProperty(exports, "CronIdDto", { enumerable: true, get: function () { return crons_1.CronIdDto; } });
60
+ Object.defineProperty(exports, "GetCronRunsDto", { enumerable: true, get: function () { return crons_1.GetCronRunsDto; } });
57
61
  var support_1 = require("./support");
58
62
  Object.defineProperty(exports, "CreateSupportRequestDto", { enumerable: true, get: function () { return support_1.CreateSupportRequestDto; } });
59
63
  var statuses_1 = require("./statuses");
60
64
  Object.defineProperty(exports, "AddStatusDto", { enumerable: true, get: function () { return statuses_1.AddStatusDto; } });
65
+ Object.defineProperty(exports, "GetAllStatusesDto", { enumerable: true, get: function () { return statuses_1.GetAllStatusesDto; } });
61
66
  Object.defineProperty(exports, "GetStatusesDto", { enumerable: true, get: function () { return statuses_1.GetStatusesDto; } });
62
67
  Object.defineProperty(exports, "ReorderStatusesDto", { enumerable: true, get: function () { return statuses_1.ReorderStatusesDto; } });
63
68
  Object.defineProperty(exports, "StatusIdDto", { enumerable: true, get: function () { return statuses_1.StatusIdDto; } });
@@ -71,10 +76,12 @@ var additional_details_1 = require("./additional-details");
71
76
  Object.defineProperty(exports, "AddAdditionalDetailsDto", { enumerable: true, get: function () { return additional_details_1.AddAdditionalDetailsDto; } });
72
77
  Object.defineProperty(exports, "AdditionalDetailsIdDto", { enumerable: true, get: function () { return additional_details_1.AdditionalDetailsIdDto; } });
73
78
  Object.defineProperty(exports, "GetAdditionalDetailsDto", { enumerable: true, get: function () { return additional_details_1.GetAdditionalDetailsDto; } });
79
+ Object.defineProperty(exports, "GetAllAdditionalDetailsDto", { enumerable: true, get: function () { return additional_details_1.GetAllAdditionalDetailsDto; } });
74
80
  Object.defineProperty(exports, "IsAdditionalDetailsValueByType", { enumerable: true, get: function () { return additional_details_1.IsAdditionalDetailsValueByType; } });
75
81
  Object.defineProperty(exports, "UpdateAdditionalDetailsDto", { enumerable: true, get: function () { return additional_details_1.UpdateAdditionalDetailsDto; } });
76
82
  var notes_1 = require("./notes");
77
83
  Object.defineProperty(exports, "AddNoteDto", { enumerable: true, get: function () { return notes_1.AddNoteDto; } });
84
+ Object.defineProperty(exports, "GetAllNotesDto", { enumerable: true, get: function () { return notes_1.GetAllNotesDto; } });
78
85
  Object.defineProperty(exports, "GetNotesDto", { enumerable: true, get: function () { return notes_1.GetNotesDto; } });
79
86
  Object.defineProperty(exports, "NoteIdDto", { enumerable: true, get: function () { return notes_1.NoteIdDto; } });
80
87
  var notifications_1 = require("./notifications");
@@ -93,6 +100,9 @@ var permissions_1 = require("./permissions");
93
100
  Object.defineProperty(exports, "PermissionsResource", { enumerable: true, get: function () { return permissions_1.PermissionsResource; } });
94
101
  var permissions_2 = require("./permissions");
95
102
  Object.defineProperty(exports, "UpdatePermissionsDto", { enumerable: true, get: function () { return permissions_2.UpdatePermissionsDto; } });
103
+ var oauth_1 = require("./oauth");
104
+ Object.defineProperty(exports, "OAuthAuthorizationIdDto", { enumerable: true, get: function () { return oauth_1.OAuthAuthorizationIdDto; } });
105
+ Object.defineProperty(exports, "OAuthClientIdDto", { enumerable: true, get: function () { return oauth_1.OAuthClientIdDto; } });
96
106
  var staff_1 = require("./staff");
97
107
  Object.defineProperty(exports, "CreateStaffDto", { enumerable: true, get: function () { return staff_1.CreateStaffDto; } });
98
108
  Object.defineProperty(exports, "StaffIdDto", { enumerable: true, get: function () { return staff_1.StaffIdDto; } });
@@ -109,6 +119,7 @@ Object.defineProperty(exports, "UpdateMyProfileDto", { enumerable: true, get: fu
109
119
  Object.defineProperty(exports, "UpdateUserDto", { enumerable: true, get: function () { return users_1.UpdateUserDto; } });
110
120
  Object.defineProperty(exports, "UserIdDto", { enumerable: true, get: function () { return users_1.UserIdDto; } });
111
121
  var supporting_files_1 = require("./supporting-files");
122
+ Object.defineProperty(exports, "GetAllSupportingFilesDto", { enumerable: true, get: function () { return supporting_files_1.GetAllSupportingFilesDto; } });
112
123
  Object.defineProperty(exports, "GetSupportingFilesDto", { enumerable: true, get: function () { return supporting_files_1.GetSupportingFilesDto; } });
113
124
  Object.defineProperty(exports, "SupportingFileIdDto", { enumerable: true, get: function () { return supporting_files_1.SupportingFileIdDto; } });
114
125
  Object.defineProperty(exports, "SupportingFileNamesDto", { enumerable: true, get: function () { return supporting_files_1.SupportingFileNamesDto; } });
@@ -1,4 +1,4 @@
1
- import type { AddNoteDto as AddNoteDtoType, GetNotesDto as GetNotesDtoType, NoteIdDto as NoteIdDtoType } from '@managemint-solutions/entities/notes/dto';
1
+ import type { AddNoteDto as AddNoteDtoType, GetAllNotesDto as GetAllNotesDtoType, GetNotesDto as GetNotesDtoType, NoteIdDto as NoteIdDtoType } from '@managemint-solutions/entities/notes/dto';
2
2
  import { NotesEntityTypes } from '@managemint-solutions/entities/notes/enum';
3
3
  export declare class NoteIdDto implements NoteIdDtoType {
4
4
  readonly noteId: string;
@@ -10,3 +10,11 @@ export declare class GetNotesDto implements GetNotesDtoType {
10
10
  export declare class AddNoteDto implements AddNoteDtoType {
11
11
  readonly content: string;
12
12
  }
13
+ /** The admin api's GET /notes: every organization's notes, a page at a time. */
14
+ export declare class GetAllNotesDto implements GetAllNotesDtoType {
15
+ readonly page: number;
16
+ readonly page_size: number;
17
+ readonly organization_id?: string | null;
18
+ readonly entity_type?: NotesEntityTypes | null;
19
+ readonly search?: string | null;
20
+ }
package/dist/notes/dto.js CHANGED
@@ -9,9 +9,11 @@ var __metadata = (this && this.__metadata) || function (k, v) {
9
9
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.AddNoteDto = exports.GetNotesDto = exports.NoteIdDto = void 0;
12
+ exports.GetAllNotesDto = exports.AddNoteDto = exports.GetNotesDto = exports.NoteIdDto = void 0;
13
13
  const class_validator_1 = require("class-validator");
14
+ const class_transformer_1 = require("class-transformer");
14
15
  const enum_1 = require("@managemint-solutions/entities/notes/enum");
16
+ const validators_1 = require("../validators");
15
17
  // class-validator versions of the shared DTO types from @managemint-solutions/entities.
16
18
  // Each class `implements` its entities type so the wire contract cannot drift.
17
19
  class NoteIdDto {
@@ -45,3 +47,46 @@ __decorate([
45
47
  (0, class_validator_1.MaxLength)(255, { message: 'Content cannot exceed 255 characters' }),
46
48
  __metadata("design:type", String)
47
49
  ], AddNoteDto.prototype, "content", void 0);
50
+ /** The admin api's GET /notes: every organization's notes, a page at a time. */
51
+ class GetAllNotesDto {
52
+ page = 1;
53
+ page_size = 25;
54
+ organization_id;
55
+ entity_type;
56
+ search;
57
+ }
58
+ exports.GetAllNotesDto = GetAllNotesDto;
59
+ __decorate([
60
+ (0, class_validator_1.IsOptional)(),
61
+ (0, class_transformer_1.Transform)(({ value }) => (value ? Number(value) : 1), { toClassOnly: true }),
62
+ (0, class_validator_1.IsNumber)({}, { message: 'Page must be a number' }),
63
+ (0, class_validator_1.Min)(1, { message: 'Page must be at least 1' }),
64
+ __metadata("design:type", Number)
65
+ ], GetAllNotesDto.prototype, "page", void 0);
66
+ __decorate([
67
+ (0, class_validator_1.IsOptional)(),
68
+ (0, class_transformer_1.Transform)(({ value }) => (value ? Number(value) : 25), { toClassOnly: true }),
69
+ (0, class_validator_1.IsNumber)({}, { message: 'Page size must be a number' }),
70
+ (0, class_validator_1.Min)(1, { message: 'Page size must be at least 1' }),
71
+ (0, class_validator_1.Max)(100, { message: 'Page size cannot exceed 100' }),
72
+ __metadata("design:type", Number)
73
+ ], GetAllNotesDto.prototype, "page_size", void 0);
74
+ __decorate([
75
+ (0, class_validator_1.IsOptional)(),
76
+ (0, validators_1.IsNullable)(),
77
+ (0, class_validator_1.IsUUID)('7', { message: 'Invalid organization ID format' }),
78
+ __metadata("design:type", Object)
79
+ ], GetAllNotesDto.prototype, "organization_id", void 0);
80
+ __decorate([
81
+ (0, class_validator_1.IsOptional)(),
82
+ (0, validators_1.IsNullable)(),
83
+ (0, class_validator_1.IsEnum)(enum_1.NotesEntityTypes, { message: 'Invalid record type' }),
84
+ __metadata("design:type", Object)
85
+ ], GetAllNotesDto.prototype, "entity_type", void 0);
86
+ __decorate([
87
+ (0, class_validator_1.IsOptional)(),
88
+ (0, validators_1.IsNullable)(),
89
+ (0, class_validator_1.IsString)({ message: 'Invalid search' }),
90
+ (0, class_validator_1.MaxLength)(200, { message: 'Search cannot exceed 200 characters' }),
91
+ __metadata("design:type", Object)
92
+ ], GetAllNotesDto.prototype, "search", void 0);
@@ -1,10 +1,13 @@
1
1
  import type { NoteEntity } from '@managemint-solutions/entities/notes';
2
+ import type { StaffNoteRow } from '@managemint-solutions/entities/notes';
3
+ import type { MmsList } from '@managemint-solutions/entities/common';
2
4
  import type { AddNoteDto } from '@managemint-solutions/entities/notes/dto';
3
5
  import { NotesEntityTypes } from '@managemint-solutions/entities/notes/enum';
4
6
  import type { ClientContext } from '../auth';
5
7
  import { type AuditResource } from '../audit';
6
8
  import type { TypedSupabaseClient } from '../client';
7
9
  export * from './dto';
10
+ import type { GetAllNotesDto } from './dto';
8
11
  export declare class NotesResource {
9
12
  private readonly supabase;
10
13
  private readonly auth;
@@ -12,6 +15,12 @@ export declare class NotesResource {
12
15
  constructor(supabase: TypedSupabaseClient, auth: ClientContext, audit: AuditResource);
13
16
  getById(noteId: string): Promise<NoteEntity>;
14
17
  list(entity: NotesEntityTypes, entityId: string): Promise<NoteEntity[]>;
18
+ /**
19
+ * The admin portal's Notes list: every note on a record type in `entityTypes` (the ones the
20
+ * caller may read), across the organizations staff can see, newest first. `record` is left
21
+ * for the caller to name.
22
+ */
23
+ listAll(query: GetAllNotesDto, entityTypes: string[]): Promise<MmsList<StaffNoteRow>>;
15
24
  create(entity: NotesEntityTypes, entityId: string, input: AddNoteDto): Promise<NoteEntity>;
16
25
  togglePin(noteId: string): Promise<NoteEntity>;
17
26
  remove(noteId: string): Promise<void>;
@@ -21,11 +21,13 @@ const audit_1 = require("../audit");
21
21
  const errors_1 = require("../errors");
22
22
  const won_1 = require("../leads/won");
23
23
  const tenancy_1 = require("../tenancy");
24
+ const transforms_1 = require("../transforms");
24
25
  __exportStar(require("./dto"), exports);
25
26
  // The public contract is the shared NoteEntity from @managemint-solutions/entities; the casts at
26
27
  // the returns declare the shape the select string below produces (the columns are defined in the
27
28
  // api's supabase/migrations).
28
29
  const NOTE_SELECT = 'mms_id, created_at, content, pinned, user:user_profiles!user_id(*)';
30
+ const NOTE_LIST_SELECT = `${NOTE_SELECT}, entity_type, entity_id, organization:organizations!organization_id(mms_id, name)`;
29
31
  class NotesResource {
30
32
  supabase;
31
33
  auth;
@@ -55,6 +57,17 @@ class NotesResource {
55
57
  throw (0, errors_1.mapPostgrestError)(error);
56
58
  return data;
57
59
  }
60
+ /**
61
+ * The admin portal's Notes list: every note on a record type in `entityTypes` (the ones the
62
+ * caller may read), across the organizations staff can see, newest first. `record` is left
63
+ * for the caller to name.
64
+ */
65
+ async listAll(query, entityTypes) {
66
+ const { data, error, count } = await (0, tenancy_1.filterStaffList)(this.supabase.from('notes').select(NOTE_LIST_SELECT, { count: 'exact' }), query, ['content'], entityTypes).order('created_at', { ascending: false });
67
+ if (error)
68
+ throw (0, errors_1.mapPostgrestError)(error);
69
+ return (0, transforms_1.toMmsList)(data, query.page, query.page_size, count);
70
+ }
58
71
  async create(entity, entityId, input) {
59
72
  const organizationId = (0, tenancy_1.requireOrganization)(this.auth);
60
73
  if (entity === enum_1.NotesEntityTypes.LEAD) {
@@ -0,0 +1,7 @@
1
+ import type { OAuthAuthorizationIdDto as OAuthAuthorizationIdDtoType, OAuthClientIdDto as OAuthClientIdDtoType } from '@managemint-solutions/entities/oauth/dto';
2
+ export declare class OAuthAuthorizationIdDto implements OAuthAuthorizationIdDtoType {
3
+ readonly authorizationId: string;
4
+ }
5
+ export declare class OAuthClientIdDto implements OAuthClientIdDtoType {
6
+ readonly clientId: string;
7
+ }
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.OAuthClientIdDto = exports.OAuthAuthorizationIdDto = void 0;
13
+ const class_validator_1 = require("class-validator");
14
+ class OAuthAuthorizationIdDto {
15
+ // GoTrue's own id format, not one of ours, so only its length is checked.
16
+ authorizationId;
17
+ }
18
+ exports.OAuthAuthorizationIdDto = OAuthAuthorizationIdDto;
19
+ __decorate([
20
+ (0, class_validator_1.IsString)({ message: 'Invalid authorization ID' }),
21
+ (0, class_validator_1.MinLength)(1, { message: 'Invalid authorization ID' }),
22
+ (0, class_validator_1.MaxLength)(255, { message: 'Invalid authorization ID' }),
23
+ __metadata("design:type", String)
24
+ ], OAuthAuthorizationIdDto.prototype, "authorizationId", void 0);
25
+ class OAuthClientIdDto {
26
+ clientId;
27
+ }
28
+ exports.OAuthClientIdDto = OAuthClientIdDto;
29
+ __decorate([
30
+ (0, class_validator_1.IsUUID)('all', { message: 'Invalid app ID format' }),
31
+ __metadata("design:type", String)
32
+ ], OAuthClientIdDto.prototype, "clientId", void 0);
@@ -0,0 +1,25 @@
1
+ import type { OAuthAuthorizationResponse, OAuthGrant, OAuthRedirect } from '@managemint-solutions/entities/oauth';
2
+ export * from './dto';
3
+ /**
4
+ * The caller's side of Supabase Auth's OAuth server: answering a connection request on the
5
+ * consent page, and the apps they have connected.
6
+ *
7
+ * GoTrue authenticates these endpoints with the caller's own token, and supabase-js only sends
8
+ * one from a stored session, which a stateless server-side client never has - so these are plain
9
+ * calls to the same endpoints supabase-js uses (`auth.oauth.*`), carrying the caller's bearer.
10
+ */
11
+ export declare class OAuthResource {
12
+ private readonly url;
13
+ private readonly key;
14
+ private readonly accessToken;
15
+ constructor(url: string, key: string, accessToken: string);
16
+ /** A connection request: what the consent page shows, or a redirect if already approved. */
17
+ getAuthorization(authorizationId: string): Promise<OAuthAuthorizationResponse>;
18
+ /** Approves or denies a connection request; either way the answer is a redirect to the app. */
19
+ answerAuthorization(authorizationId: string, action: 'approve' | 'deny'): Promise<OAuthRedirect>;
20
+ /** The apps the caller has connected. */
21
+ listGrants(): Promise<OAuthGrant[]>;
22
+ /** Disconnects an app: GoTrue ends its sessions and refresh tokens at once. */
23
+ revokeGrant(clientId: string): Promise<void>;
24
+ private request;
25
+ }
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
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
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.OAuthResource = void 0;
18
+ const errors_1 = require("../errors");
19
+ __exportStar(require("./dto"), exports);
20
+ /**
21
+ * The caller's side of Supabase Auth's OAuth server: answering a connection request on the
22
+ * consent page, and the apps they have connected.
23
+ *
24
+ * GoTrue authenticates these endpoints with the caller's own token, and supabase-js only sends
25
+ * one from a stored session, which a stateless server-side client never has - so these are plain
26
+ * calls to the same endpoints supabase-js uses (`auth.oauth.*`), carrying the caller's bearer.
27
+ */
28
+ class OAuthResource {
29
+ url;
30
+ key;
31
+ accessToken;
32
+ constructor(url, key, accessToken) {
33
+ this.url = url;
34
+ this.key = key;
35
+ this.accessToken = accessToken;
36
+ }
37
+ /** A connection request: what the consent page shows, or a redirect if already approved. */
38
+ async getAuthorization(authorizationId) {
39
+ const data = await this.request('GET', `/oauth/authorizations/${encodeURIComponent(authorizationId)}`);
40
+ if ('redirect_url' in data)
41
+ return { redirect_url: data.redirect_url };
42
+ // GoTrue also sends the signed-in user; the caller already knows who they are.
43
+ return {
44
+ authorization_id: data.authorization_id,
45
+ redirect_uri: data.redirect_uri,
46
+ client: data.client,
47
+ scope: data.scope,
48
+ };
49
+ }
50
+ /** Approves or denies a connection request; either way the answer is a redirect to the app. */
51
+ async answerAuthorization(authorizationId, action) {
52
+ const data = await this.request('POST', `/oauth/authorizations/${encodeURIComponent(authorizationId)}/consent`, { action });
53
+ return { redirect_url: data.redirect_url };
54
+ }
55
+ /** The apps the caller has connected. */
56
+ async listGrants() {
57
+ return await this.request('GET', '/user/oauth/grants');
58
+ }
59
+ /** Disconnects an app: GoTrue ends its sessions and refresh tokens at once. */
60
+ async revokeGrant(clientId) {
61
+ await this.request('DELETE', `/user/oauth/grants?client_id=${encodeURIComponent(clientId)}`);
62
+ }
63
+ async request(method, path, body) {
64
+ const response = await fetch(`${this.url}/auth/v1${path}`, {
65
+ method,
66
+ headers: {
67
+ apikey: this.key,
68
+ Authorization: `Bearer ${this.accessToken}`,
69
+ ...(body ? { 'Content-Type': 'application/json' } : {}),
70
+ },
71
+ ...(body ? { body: JSON.stringify(body) } : {}),
72
+ });
73
+ const text = await response.text();
74
+ const data = text ? JSON.parse(text) : null;
75
+ if (!response.ok) {
76
+ const error = (data ?? {});
77
+ throw new errors_1.SupabaseClientError({
78
+ // GoTrue answers an unknown or expired request with 404 and a bad id with 400; anything
79
+ // else is its own failure, not the caller's.
80
+ status: response.status >= 500 ? 502 : response.status,
81
+ error: 'Authentication Error',
82
+ message: error.msg ?? error.message ?? error.error_description ?? 'The connection request failed',
83
+ });
84
+ }
85
+ return data;
86
+ }
87
+ }
88
+ exports.OAuthResource = OAuthResource;
@@ -4,6 +4,7 @@ import { BillingResource } from '../billing';
4
4
  import { InvoicesResource } from '../billing/invoices';
5
5
  import { ClientsResource } from '../clients';
6
6
  import { ConfigsResource } from '../configs';
7
+ import { CronRunsResource, CronsResource } from '../crons';
7
8
  import { DocumentsResource } from '../documents';
8
9
  import { EmulationHandshakesResource } from '../emulation-handshakes';
9
10
  import { FeatureRequestsResource } from '../feature-requests';
@@ -112,6 +113,9 @@ export declare class SupabaseServiceClient {
112
113
  readonly notifications: NotificationsOutboxResource;
113
114
  readonly featureRequests: FeatureRequestsResource;
114
115
  readonly configs: ConfigsResource;
116
+ /** The api's cron routes record each run here. */
117
+ readonly crons: CronsResource;
118
+ readonly cronRuns: CronRunsResource;
115
119
  readonly signup: OrganizationSignupResource;
116
120
  readonly paystackEvents: WebhookEventsResource;
117
121
  readonly resendEvents: WebhookEventsResource;
@@ -9,6 +9,7 @@ const billing_1 = require("../billing");
9
9
  const invoices_1 = require("../billing/invoices");
10
10
  const clients_1 = require("../clients");
11
11
  const configs_1 = require("../configs");
12
+ const crons_1 = require("../crons");
12
13
  const documents_1 = require("../documents");
13
14
  const emulation_handshakes_1 = require("../emulation-handshakes");
14
15
  const feature_requests_1 = require("../feature-requests");
@@ -159,6 +160,9 @@ class SupabaseServiceClient {
159
160
  featureRequests;
160
161
  // Global, with no organization on the row, so it hangs off the client rather than a scope.
161
162
  configs;
163
+ /** The api's cron routes record each run here. */
164
+ crons;
165
+ cronRuns;
162
166
  signup;
163
167
  paystackEvents;
164
168
  resendEvents;
@@ -173,6 +177,8 @@ class SupabaseServiceClient {
173
177
  this.resendEvents = new webhook_events_1.WebhookEventsResource(this.supabase, 'resend_webhook_events');
174
178
  this.featureRequests = new feature_requests_1.FeatureRequestsResource(this.supabase);
175
179
  this.configs = new configs_1.ConfigsResource(this.supabase);
180
+ this.crons = new crons_1.CronsResource(this.supabase);
181
+ this.cronRuns = new crons_1.CronRunsResource(this.supabase);
176
182
  this.signup = new organizations_1.OrganizationSignupResource(this.supabase, (organizationId) => this.forOrganization(organizationId).audit);
177
183
  // The outbox spans organizations - the row it is about carries its own - so it takes a
178
184
  // factory and scopes per write rather than being built inside one organization's scope.
@@ -1,14 +1,17 @@
1
1
  import { type StaffContext } from './auth';
2
2
  import { AuditResource } from './audit';
3
3
  import { AdditionalDetailsResource } from './additional-details';
4
- import type { SupabaseClientConfig, TypedSupabaseClient } from './client';
4
+ import { SupabaseClient, type SupabaseClientConfig, type TypedSupabaseClient } from './client';
5
5
  import { ClientsResource } from './clients';
6
+ import { ConfigsResource } from './configs';
7
+ import { CronRunsResource, CronsResource } from './crons';
6
8
  import { DocumentsResource, DocumentTemplatesResource } from './documents';
7
9
  import { LeadsResource } from './leads';
8
10
  import { NotesResource } from './notes';
9
11
  import { OrganizationsResource } from './organizations';
10
12
  import { ProjectsResource } from './projects';
11
13
  import { StaffPermissionsResource, StaffResource } from './staff';
14
+ import { StatusesResource } from './statuses';
12
15
  import { SupportingFilesResource } from './supporting-files';
13
16
  import { TasksResource } from './tasks';
14
17
  import { UserApiCredentialsReads } from './user-api-credentials';
@@ -28,6 +31,10 @@ export declare class SupabaseStaffClient {
28
31
  readonly audit: AuditResource;
29
32
  readonly additionalDetails: AdditionalDetailsResource;
30
33
  readonly clients: ClientsResource;
34
+ /** Reads only: the `staff` role has no write grant, so an edit goes through the service client. */
35
+ readonly configs: ConfigsResource;
36
+ readonly crons: CronsResource;
37
+ readonly cronRuns: CronRunsResource;
31
38
  readonly leads: LeadsResource;
32
39
  readonly notes: NotesResource;
33
40
  readonly projects: ProjectsResource;
@@ -38,10 +45,20 @@ export declare class SupabaseStaffClient {
38
45
  readonly organizations: OrganizationsResource;
39
46
  readonly staff: StaffResource;
40
47
  readonly staffPermissions: StaffPermissionsResource;
48
+ /** Every organization's statuses (`listAll`); a write is refused, there being no organization. */
49
+ readonly statuses: StatusesResource;
41
50
  /** Lists and parents only: Storage names no staff, so a download is signed on the service client. */
42
51
  readonly supportingFiles: SupportingFilesResource;
43
52
  readonly userApiCredentials: UserApiCredentialsReads;
44
53
  constructor({ url, key, accessToken, auth, client }: SupabaseStaffClientConfig);
54
+ /**
55
+ * The tenant client's resources, reading one organization as this staff member: the same
56
+ * staff token, so the `staff` role's policies still decide what comes back, and every write
57
+ * is still refused at the database (the role holds SELECT alone). For the modules whose
58
+ * resources scope every query to the caller's organization - HR, inventory, documents,
59
+ * billing, statuses and labels - which a staff client, having none, cannot read through.
60
+ */
61
+ forOrganization(organizationId: string): SupabaseClient;
45
62
  }
46
63
  export declare const createSupabaseStaffClient: (config: SupabaseStaffClientConfig) => SupabaseStaffClient;
47
64
  export {};
@@ -4,13 +4,17 @@ exports.createSupabaseStaffClient = exports.SupabaseStaffClient = void 0;
4
4
  const auth_1 = require("./auth");
5
5
  const audit_1 = require("./audit");
6
6
  const additional_details_1 = require("./additional-details");
7
+ const client_1 = require("./client");
7
8
  const clients_1 = require("./clients");
9
+ const configs_1 = require("./configs");
10
+ const crons_1 = require("./crons");
8
11
  const documents_1 = require("./documents");
9
12
  const leads_1 = require("./leads");
10
13
  const notes_1 = require("./notes");
11
14
  const organizations_1 = require("./organizations");
12
15
  const projects_1 = require("./projects");
13
16
  const staff_1 = require("./staff");
17
+ const statuses_1 = require("./statuses");
14
18
  const supporting_files_1 = require("./supporting-files");
15
19
  const tasks_1 = require("./tasks");
16
20
  const user_api_credentials_1 = require("./user-api-credentials");
@@ -27,6 +31,10 @@ class SupabaseStaffClient {
27
31
  audit;
28
32
  additionalDetails;
29
33
  clients;
34
+ /** Reads only: the `staff` role has no write grant, so an edit goes through the service client. */
35
+ configs;
36
+ crons;
37
+ cronRuns;
30
38
  leads;
31
39
  notes;
32
40
  projects;
@@ -37,6 +45,8 @@ class SupabaseStaffClient {
37
45
  organizations;
38
46
  staff;
39
47
  staffPermissions;
48
+ /** Every organization's statuses (`listAll`); a write is refused, there being no organization. */
49
+ statuses;
40
50
  /** Lists and parents only: Storage names no staff, so a download is signed on the service client. */
41
51
  supportingFiles;
42
52
  userApiCredentials;
@@ -45,6 +55,9 @@ class SupabaseStaffClient {
45
55
  this.auth = auth;
46
56
  this.audit = new audit_1.AuditResource(this.supabase, auth);
47
57
  this.clients = new clients_1.ClientsResource(this.supabase, auth, this.audit);
58
+ this.configs = new configs_1.ConfigsResource(this.supabase);
59
+ this.crons = new crons_1.CronsResource(this.supabase);
60
+ this.cronRuns = new crons_1.CronRunsResource(this.supabase);
48
61
  this.additionalDetails = new additional_details_1.AdditionalDetailsResource(this.supabase, auth, this.audit);
49
62
  this.leads = new leads_1.LeadsResource(this.supabase, auth, this.audit, this.additionalDetails);
50
63
  this.notes = new notes_1.NotesResource(this.supabase, auth, this.audit);
@@ -56,9 +69,26 @@ class SupabaseStaffClient {
56
69
  this.organizations = new organizations_1.OrganizationsResource(this.supabase, auth, this.audit);
57
70
  this.staff = new staff_1.StaffResource(this.supabase);
58
71
  this.staffPermissions = new staff_1.StaffPermissionsResource(this.supabase);
72
+ this.statuses = new statuses_1.StatusesResource(this.supabase, auth, this.audit);
59
73
  this.supportingFiles = new supporting_files_1.SupportingFilesResource(this.supabase, auth, this.audit);
60
74
  this.userApiCredentials = new user_api_credentials_1.UserApiCredentialsReads(this.supabase);
61
75
  }
76
+ /**
77
+ * The tenant client's resources, reading one organization as this staff member: the same
78
+ * staff token, so the `staff` role's policies still decide what comes back, and every write
79
+ * is still refused at the database (the role holds SELECT alone). For the modules whose
80
+ * resources scope every query to the caller's organization - HR, inventory, documents,
81
+ * billing, statuses and labels - which a staff client, having none, cannot read through.
82
+ */
83
+ forOrganization(organizationId) {
84
+ return new client_1.SupabaseClient({
85
+ url: '',
86
+ key: '',
87
+ accessToken: '',
88
+ client: this.supabase,
89
+ auth: { mms_id: this.auth.mms_id, organization_id: organizationId },
90
+ });
91
+ }
62
92
  }
63
93
  exports.SupabaseStaffClient = SupabaseStaffClient;
64
94
  const createSupabaseStaffClient = (config) => new SupabaseStaffClient(config);
@@ -1,4 +1,4 @@
1
- import type { AddStatusDto as AddStatusDtoType, GetStatusesDto as GetStatusesDtoType, ReorderStatusesDto as ReorderStatusesDtoType, StatusIdDto as StatusIdDtoType, UpdateStatusDto as UpdateStatusDtoType } from '@managemint-solutions/entities/status/dto';
1
+ import type { AddStatusDto as AddStatusDtoType, GetAllStatusesDto as GetAllStatusesDtoType, GetStatusesDto as GetStatusesDtoType, ReorderStatusesDto as ReorderStatusesDtoType, StatusIdDto as StatusIdDtoType, UpdateStatusDto as UpdateStatusDtoType } from '@managemint-solutions/entities/status/dto';
2
2
  import { StatusEntityTypes } from '@managemint-solutions/entities/status/enum';
3
3
  export declare class StatusIdDto implements StatusIdDtoType {
4
4
  readonly statusId: string;
@@ -20,3 +20,11 @@ export declare class UpdateStatusDto implements UpdateStatusDtoType {
20
20
  readonly colour: string;
21
21
  readonly is_complete?: boolean;
22
22
  }
23
+ /** The admin api's GET /statuses: every organization's statuses, a page at a time. */
24
+ export declare class GetAllStatusesDto implements GetAllStatusesDtoType {
25
+ readonly page: number;
26
+ readonly page_size: number;
27
+ readonly organization_id?: string | null;
28
+ readonly entity_type?: StatusEntityTypes | null;
29
+ readonly search?: string | null;
30
+ }
@@ -9,9 +9,11 @@ var __metadata = (this && this.__metadata) || function (k, v) {
9
9
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.UpdateStatusDto = exports.ReorderStatusesDto = exports.AddStatusDto = exports.GetStatusesDto = exports.StatusIdDto = void 0;
12
+ exports.GetAllStatusesDto = exports.UpdateStatusDto = exports.ReorderStatusesDto = exports.AddStatusDto = exports.GetStatusesDto = exports.StatusIdDto = void 0;
13
13
  const class_validator_1 = require("class-validator");
14
+ const class_transformer_1 = require("class-transformer");
14
15
  const enum_1 = require("@managemint-solutions/entities/status/enum");
16
+ const validators_1 = require("../validators");
15
17
  // class-validator versions of the shared DTO types from @managemint-solutions/entities.
16
18
  // Each class `implements` its entities type so the wire contract cannot drift.
17
19
  class StatusIdDto {
@@ -100,3 +102,46 @@ __decorate([
100
102
  (0, class_validator_1.IsBoolean)({ message: 'is_complete must be true or false' }),
101
103
  __metadata("design:type", Boolean)
102
104
  ], UpdateStatusDto.prototype, "is_complete", void 0);
105
+ /** The admin api's GET /statuses: every organization's statuses, a page at a time. */
106
+ class GetAllStatusesDto {
107
+ page = 1;
108
+ page_size = 25;
109
+ organization_id;
110
+ entity_type;
111
+ search;
112
+ }
113
+ exports.GetAllStatusesDto = GetAllStatusesDto;
114
+ __decorate([
115
+ (0, class_validator_1.IsOptional)(),
116
+ (0, class_transformer_1.Transform)(({ value }) => (value ? Number(value) : 1), { toClassOnly: true }),
117
+ (0, class_validator_1.IsNumber)({}, { message: 'Page must be a number' }),
118
+ (0, class_validator_1.Min)(1, { message: 'Page must be at least 1' }),
119
+ __metadata("design:type", Number)
120
+ ], GetAllStatusesDto.prototype, "page", void 0);
121
+ __decorate([
122
+ (0, class_validator_1.IsOptional)(),
123
+ (0, class_transformer_1.Transform)(({ value }) => (value ? Number(value) : 25), { toClassOnly: true }),
124
+ (0, class_validator_1.IsNumber)({}, { message: 'Page size must be a number' }),
125
+ (0, class_validator_1.Min)(1, { message: 'Page size must be at least 1' }),
126
+ (0, class_validator_1.Max)(100, { message: 'Page size cannot exceed 100' }),
127
+ __metadata("design:type", Number)
128
+ ], GetAllStatusesDto.prototype, "page_size", void 0);
129
+ __decorate([
130
+ (0, class_validator_1.IsOptional)(),
131
+ (0, validators_1.IsNullable)(),
132
+ (0, class_validator_1.IsUUID)('7', { message: 'Invalid organization ID format' }),
133
+ __metadata("design:type", Object)
134
+ ], GetAllStatusesDto.prototype, "organization_id", void 0);
135
+ __decorate([
136
+ (0, class_validator_1.IsOptional)(),
137
+ (0, validators_1.IsNullable)(),
138
+ (0, class_validator_1.IsEnum)(enum_1.StatusEntityTypes, { message: 'Invalid record type' }),
139
+ __metadata("design:type", Object)
140
+ ], GetAllStatusesDto.prototype, "entity_type", void 0);
141
+ __decorate([
142
+ (0, class_validator_1.IsOptional)(),
143
+ (0, validators_1.IsNullable)(),
144
+ (0, class_validator_1.IsString)({ message: 'Invalid search' }),
145
+ (0, class_validator_1.MaxLength)(200, { message: 'Search cannot exceed 200 characters' }),
146
+ __metadata("design:type", Object)
147
+ ], GetAllStatusesDto.prototype, "search", void 0);