@managemint-solutions/sdk 0.24.0 → 0.24.2

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 CHANGED
@@ -8,7 +8,7 @@ export { SupabaseServiceClient, createSupabaseServiceClient } from './service-cl
8
8
  export type { SupabaseOrganizationScope, SupabaseServiceClientConfig } from './service-client';
9
9
  export { SupabaseClientError } from './errors';
10
10
  export type { SupabaseClientErrorInit } from './errors';
11
- export { IsNullable } from './validators';
11
+ export { EmptyToNull, IsNullable } from './validators';
12
12
  export type { AuditActor, AuditChanges, AuditEntry, AuditErrorHandler, AuditGuard, AuditRow, AuditedTable, AuditedTableOptions, } from './audit';
13
13
  export { GetAuditTrailDto } from './audit';
14
14
  export { CancelSubscriptionDto, InitialPaymentDto, PurchaseModuleDto, ReinstateSubscriptionDto, } from './billing';
package/dist/index.js CHANGED
@@ -7,8 +7,8 @@
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.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;
10
+ 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.EmptyToNull = 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 = exports.CreateProjectDto = void 0;
12
12
  var client_1 = require("./client");
13
13
  Object.defineProperty(exports, "SupabaseClient", { enumerable: true, get: function () { return client_1.SupabaseClient; } });
14
14
  Object.defineProperty(exports, "createSupabaseClient", { enumerable: true, get: function () { return client_1.createSupabaseClient; } });
@@ -27,6 +27,7 @@ Object.defineProperty(exports, "createSupabaseServiceClient", { enumerable: true
27
27
  var errors_1 = require("./errors");
28
28
  Object.defineProperty(exports, "SupabaseClientError", { enumerable: true, get: function () { return errors_1.SupabaseClientError; } });
29
29
  var validators_1 = require("./validators");
30
+ Object.defineProperty(exports, "EmptyToNull", { enumerable: true, get: function () { return validators_1.EmptyToNull; } });
30
31
  Object.defineProperty(exports, "IsNullable", { enumerable: true, get: function () { return validators_1.IsNullable; } });
31
32
  var audit_1 = require("./audit");
32
33
  Object.defineProperty(exports, "GetAuditTrailDto", { enumerable: true, get: function () { return audit_1.GetAuditTrailDto; } });
@@ -17,17 +17,10 @@ export type CreateNotificationInput = {
17
17
  recipient_id?: string;
18
18
  recipient_email?: string;
19
19
  recipient_phone?: string;
20
- /**
21
- * Where a reply to this mail should go. Support sets it to the ticket's own
22
- * `support+<email_token>@…` address, which is what makes replying by email land back on the
23
- * thread; everything else leaves it unset and replies go to the sending address.
24
- */
25
- reply_to?: string;
26
20
  };
27
21
  export type CreatedNotification = NotificationEntity & {
28
22
  organization_id: string | null;
29
23
  provider_message_id: string | null;
30
- reply_to: string | null;
31
24
  };
32
25
  /** The columns the queue worker needs to decide whether and how to send. */
33
26
  export type QueuedNotification = {
@@ -38,7 +31,6 @@ export type QueuedNotification = {
38
31
  template_id: string | null;
39
32
  template_variables: Record<string, string>;
40
33
  recipient_email: string | null;
41
- reply_to: string | null;
42
34
  attempts: number;
43
35
  sent_at: string | null;
44
36
  deleted: boolean;
@@ -69,8 +69,7 @@ const NOTIFICATION_CREATED_SELECT = `
69
69
  failure_reason,
70
70
  provider,
71
71
  provider_message_id,
72
- delivered_at,
73
- reply_to
72
+ delivered_at
74
73
  `;
75
74
  /** The columns the queue worker loads before it decides whether and how to send. */
76
75
  const NOTIFICATION_DELIVERY_SELECT = `
@@ -81,7 +80,6 @@ const NOTIFICATION_DELIVERY_SELECT = `
81
80
  template_id,
82
81
  template_variables,
83
82
  recipient_email,
84
- reply_to,
85
83
  attempts,
86
84
  sent_at,
87
85
  deleted
@@ -140,6 +140,7 @@ __decorate([
140
140
  ], CreateProjectDto.prototype, "name", void 0);
141
141
  __decorate([
142
142
  (0, class_validator_1.IsOptional)(),
143
+ (0, validators_1.EmptyToNull)(),
143
144
  (0, validators_1.IsNullable)(),
144
145
  (0, class_validator_1.IsString)({ message: 'Invalid specification' }),
145
146
  __metadata("design:type", Object)
@@ -200,6 +201,7 @@ __decorate([
200
201
  ], UpdateProjectDto.prototype, "name", void 0);
201
202
  __decorate([
202
203
  (0, class_validator_1.IsOptional)(),
204
+ (0, validators_1.EmptyToNull)(),
203
205
  (0, validators_1.IsNullable)(),
204
206
  (0, class_validator_1.IsString)({ message: 'Invalid specification' }),
205
207
  __metadata("design:type", Object)
package/dist/tasks/dto.js CHANGED
@@ -169,6 +169,7 @@ __decorate([
169
169
  ], CreateTaskDto.prototype, "name", void 0);
170
170
  __decorate([
171
171
  (0, class_validator_1.IsOptional)(),
172
+ (0, validators_1.EmptyToNull)(),
172
173
  (0, validators_1.IsNullable)(),
173
174
  (0, class_validator_1.ValidateIf)((o) => o.description !== null && o.description !== undefined),
174
175
  (0, class_validator_1.IsString)({ message: 'Invalid description' }),
@@ -240,10 +241,12 @@ __decorate([
240
241
  ], UpdateTaskDto.prototype, "name", void 0);
241
242
  __decorate([
242
243
  (0, class_validator_1.IsOptional)(),
243
- (0, validators_1.IsNullable)(),
244
+ (0, validators_1.EmptyToNull)(),
245
+ (0, validators_1.IsNullable)()
246
+ // No minimum length, the same as on create: a task may have no specification.
247
+ ,
244
248
  (0, class_validator_1.ValidateIf)((o) => o.description !== null && o.description !== undefined),
245
249
  (0, class_validator_1.IsString)({ message: 'Invalid description' }),
246
- (0, class_validator_1.MinLength)(1, { message: 'Description cannot be empty' }),
247
250
  (0, class_validator_1.MaxLength)(500, { message: 'Description cannot exceed 500 characters' }),
248
251
  __metadata("design:type", Object)
249
252
  ], UpdateTaskDto.prototype, "description", void 0);
package/dist/users/dto.js CHANGED
@@ -195,6 +195,7 @@ __decorate([
195
195
  ], UpdateUserDto.prototype, "end_date", void 0);
196
196
  __decorate([
197
197
  (0, class_validator_1.IsOptional)(),
198
+ (0, validators_1.EmptyToNull)(),
198
199
  (0, validators_1.IsNullable)(),
199
200
  (0, class_validator_1.IsString)({ message: 'Invalid job title' }),
200
201
  (0, class_validator_1.MaxLength)(100, { message: 'Job title cannot be longer than 100 characters' }),
@@ -210,42 +211,49 @@ __decorate([
210
211
  ], UpdateUserDto.prototype, "manager_id", void 0);
211
212
  __decorate([
212
213
  (0, class_validator_1.IsOptional)(),
214
+ (0, validators_1.EmptyToNull)(),
213
215
  (0, validators_1.IsNullable)(),
214
216
  (0, class_validator_1.IsUrl)({}, { message: 'Invalid Facebook URL' }),
215
217
  __metadata("design:type", Object)
216
218
  ], UpdateUserDto.prototype, "social_facebook", void 0);
217
219
  __decorate([
218
220
  (0, class_validator_1.IsOptional)(),
221
+ (0, validators_1.EmptyToNull)(),
219
222
  (0, validators_1.IsNullable)(),
220
223
  (0, class_validator_1.IsUrl)({}, { message: 'Invalid LinkedIn URL' }),
221
224
  __metadata("design:type", Object)
222
225
  ], UpdateUserDto.prototype, "social_linkedin", void 0);
223
226
  __decorate([
224
227
  (0, class_validator_1.IsOptional)(),
228
+ (0, validators_1.EmptyToNull)(),
225
229
  (0, validators_1.IsNullable)(),
226
230
  (0, class_validator_1.IsUrl)({}, { message: 'Invalid Twitter URL' }),
227
231
  __metadata("design:type", Object)
228
232
  ], UpdateUserDto.prototype, "social_twitter", void 0);
229
233
  __decorate([
230
234
  (0, class_validator_1.IsOptional)(),
235
+ (0, validators_1.EmptyToNull)(),
231
236
  (0, validators_1.IsNullable)(),
232
237
  (0, class_validator_1.IsUrl)({}, { message: 'Invalid Instagram URL' }),
233
238
  __metadata("design:type", Object)
234
239
  ], UpdateUserDto.prototype, "social_instagram", void 0);
235
240
  __decorate([
236
241
  (0, class_validator_1.IsOptional)(),
242
+ (0, validators_1.EmptyToNull)(),
237
243
  (0, validators_1.IsNullable)(),
238
244
  (0, class_validator_1.IsUrl)({}, { message: 'Invalid GitHub URL' }),
239
245
  __metadata("design:type", Object)
240
246
  ], UpdateUserDto.prototype, "social_github", void 0);
241
247
  __decorate([
242
248
  (0, class_validator_1.IsOptional)(),
249
+ (0, validators_1.EmptyToNull)(),
243
250
  (0, validators_1.IsNullable)(),
244
251
  (0, class_validator_1.IsUrl)({}, { message: 'Invalid website URL' }),
245
252
  __metadata("design:type", Object)
246
253
  ], UpdateUserDto.prototype, "social_website", void 0);
247
254
  __decorate([
248
255
  (0, class_validator_1.IsOptional)(),
256
+ (0, validators_1.EmptyToNull)(),
249
257
  (0, validators_1.IsNullable)(),
250
258
  (0, class_validator_1.IsString)({ message: 'Invalid emergency contact name' }),
251
259
  (0, class_validator_1.MinLength)(1, { message: 'Emergency contact name is required' }),
@@ -254,6 +262,7 @@ __decorate([
254
262
  ], UpdateUserDto.prototype, "emergency_contact_name", void 0);
255
263
  __decorate([
256
264
  (0, class_validator_1.IsOptional)(),
265
+ (0, validators_1.EmptyToNull)(),
257
266
  (0, validators_1.IsNullable)(),
258
267
  (0, class_validator_1.IsEnum)(enum_1.EmergencyContactRelationship, { message: 'Invalid emergency contact relationship' }),
259
268
  (0, class_validator_1.MinLength)(1, { message: 'Emergency contact relationship is required' }),
@@ -262,12 +271,14 @@ __decorate([
262
271
  ], UpdateUserDto.prototype, "emergency_contact_relationship", void 0);
263
272
  __decorate([
264
273
  (0, class_validator_1.IsOptional)(),
274
+ (0, validators_1.EmptyToNull)(),
265
275
  (0, validators_1.IsNullable)(),
266
276
  (0, class_validator_1.IsString)({ message: 'Invalid emergency contact phone number' }),
267
277
  __metadata("design:type", Object)
268
278
  ], UpdateUserDto.prototype, "emergency_contact_phone", void 0);
269
279
  __decorate([
270
280
  (0, class_validator_1.IsOptional)(),
281
+ (0, validators_1.EmptyToNull)(),
271
282
  (0, validators_1.IsNullable)(),
272
283
  (0, class_validator_1.IsEmail)({}, { message: 'Invalid emergency contact email address' }),
273
284
  __metadata("design:type", Object)
@@ -328,42 +339,49 @@ __decorate([
328
339
  ], UpdateMyProfileDto.prototype, "birthday", void 0);
329
340
  __decorate([
330
341
  (0, class_validator_1.IsOptional)(),
342
+ (0, validators_1.EmptyToNull)(),
331
343
  (0, validators_1.IsNullable)(),
332
344
  (0, class_validator_1.IsUrl)({}, { message: 'Invalid Facebook URL' }),
333
345
  __metadata("design:type", Object)
334
346
  ], UpdateMyProfileDto.prototype, "social_facebook", void 0);
335
347
  __decorate([
336
348
  (0, class_validator_1.IsOptional)(),
349
+ (0, validators_1.EmptyToNull)(),
337
350
  (0, validators_1.IsNullable)(),
338
351
  (0, class_validator_1.IsUrl)({}, { message: 'Invalid LinkedIn URL' }),
339
352
  __metadata("design:type", Object)
340
353
  ], UpdateMyProfileDto.prototype, "social_linkedin", void 0);
341
354
  __decorate([
342
355
  (0, class_validator_1.IsOptional)(),
356
+ (0, validators_1.EmptyToNull)(),
343
357
  (0, validators_1.IsNullable)(),
344
358
  (0, class_validator_1.IsUrl)({}, { message: 'Invalid Twitter URL' }),
345
359
  __metadata("design:type", Object)
346
360
  ], UpdateMyProfileDto.prototype, "social_twitter", void 0);
347
361
  __decorate([
348
362
  (0, class_validator_1.IsOptional)(),
363
+ (0, validators_1.EmptyToNull)(),
349
364
  (0, validators_1.IsNullable)(),
350
365
  (0, class_validator_1.IsUrl)({}, { message: 'Invalid Instagram URL' }),
351
366
  __metadata("design:type", Object)
352
367
  ], UpdateMyProfileDto.prototype, "social_instagram", void 0);
353
368
  __decorate([
354
369
  (0, class_validator_1.IsOptional)(),
370
+ (0, validators_1.EmptyToNull)(),
355
371
  (0, validators_1.IsNullable)(),
356
372
  (0, class_validator_1.IsUrl)({}, { message: 'Invalid GitHub URL' }),
357
373
  __metadata("design:type", Object)
358
374
  ], UpdateMyProfileDto.prototype, "social_github", void 0);
359
375
  __decorate([
360
376
  (0, class_validator_1.IsOptional)(),
377
+ (0, validators_1.EmptyToNull)(),
361
378
  (0, validators_1.IsNullable)(),
362
379
  (0, class_validator_1.IsUrl)({}, { message: 'Invalid website URL' }),
363
380
  __metadata("design:type", Object)
364
381
  ], UpdateMyProfileDto.prototype, "social_website", void 0);
365
382
  __decorate([
366
383
  (0, class_validator_1.IsOptional)(),
384
+ (0, validators_1.EmptyToNull)(),
367
385
  (0, validators_1.IsNullable)(),
368
386
  (0, class_validator_1.IsString)({ message: 'Invalid emergency contact name' }),
369
387
  (0, class_validator_1.MinLength)(1, { message: 'Emergency contact name is required' }),
@@ -372,18 +390,21 @@ __decorate([
372
390
  ], UpdateMyProfileDto.prototype, "emergency_contact_name", void 0);
373
391
  __decorate([
374
392
  (0, class_validator_1.IsOptional)(),
393
+ (0, validators_1.EmptyToNull)(),
375
394
  (0, validators_1.IsNullable)(),
376
395
  (0, class_validator_1.IsEnum)(enum_1.EmergencyContactRelationship, { message: 'Invalid emergency contact relationship' }),
377
396
  __metadata("design:type", Object)
378
397
  ], UpdateMyProfileDto.prototype, "emergency_contact_relationship", void 0);
379
398
  __decorate([
380
399
  (0, class_validator_1.IsOptional)(),
400
+ (0, validators_1.EmptyToNull)(),
381
401
  (0, validators_1.IsNullable)(),
382
402
  (0, class_validator_1.IsString)({ message: 'Invalid emergency contact phone number' }),
383
403
  __metadata("design:type", Object)
384
404
  ], UpdateMyProfileDto.prototype, "emergency_contact_phone", void 0);
385
405
  __decorate([
386
406
  (0, class_validator_1.IsOptional)(),
407
+ (0, validators_1.EmptyToNull)(),
387
408
  (0, validators_1.IsNullable)(),
388
409
  (0, class_validator_1.IsEmail)({}, { message: 'Invalid emergency contact email address' }),
389
410
  __metadata("design:type", Object)
@@ -1,2 +1,8 @@
1
1
  import { ValidationOptions } from 'class-validator';
2
2
  export declare function IsNullable(validationOptions?: ValidationOptions): PropertyDecorator;
3
+ /**
4
+ * An empty string from a cleared form field means "none". It becomes null before validation,
5
+ * so an optional text field can carry a minimum length, a URL or an email rule without a
6
+ * blank submission tripping it. Goes above `IsNullable()`, which then skips the rules.
7
+ */
8
+ export declare function EmptyToNull(): PropertyDecorator;
@@ -1,7 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.IsNullable = IsNullable;
4
+ exports.EmptyToNull = EmptyToNull;
4
5
  const class_validator_1 = require("class-validator");
6
+ const class_transformer_1 = require("class-transformer");
5
7
  function IsNullable(validationOptions) {
6
8
  return (0, class_validator_1.ValidateIf)((_object, value) => value !== null, validationOptions);
7
9
  }
10
+ /**
11
+ * An empty string from a cleared form field means "none". It becomes null before validation,
12
+ * so an optional text field can carry a minimum length, a URL or an email rule without a
13
+ * blank submission tripping it. Goes above `IsNullable()`, which then skips the rules.
14
+ */
15
+ function EmptyToNull() {
16
+ return (0, class_transformer_1.Transform)(({ value }) => (value === '' ? null : value), { toClassOnly: true });
17
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@managemint-solutions/sdk",
3
- "version": "0.24.0",
3
+ "version": "0.24.2",
4
4
  "description": "Typed Supabase data-access SDK for ManageMint Solutions",
5
5
  "license": "UNLICENSED",
6
6
  "author": "Scott Bebington <scottbebington@gmail.com>",