@managemint-solutions/sdk 0.24.2 → 0.25.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.
package/README.md CHANGED
@@ -38,12 +38,19 @@ const supabase = createSupabaseClient({
38
38
 
39
39
  // Inputs and outputs are the shared types from @managemint-solutions/entities.
40
40
  const statuses: StatusEntity[] = await supabase.statuses.list(StatusEntityTypes.PROJECT);
41
+ // `is_complete` marks the finished state and is optional — it defaults to false on create and
42
+ // is left unchanged on update when omitted. `is_fail` and `is_triage` are read back on every
43
+ // status but are not settable through the SDK yet.
41
44
  const created = await supabase.statuses.create({
42
45
  label: 'In progress',
43
46
  colour: '#2ecc71',
44
47
  entity: StatusEntityTypes.PROJECT,
45
48
  });
46
- await supabase.statuses.update(created.mms_id, { label: 'Doing', colour: '#2ecc71' });
49
+ await supabase.statuses.update(created.mms_id, {
50
+ label: 'Done',
51
+ colour: '#2ecc71',
52
+ is_complete: true,
53
+ });
47
54
  await supabase.statuses.remove(created.mms_id);
48
55
  ```
49
56
 
@@ -31,7 +31,10 @@ const CLIENT_LIST_SELECT = `
31
31
  status:statuses!status_id (
32
32
  mms_id,
33
33
  colour,
34
- label
34
+ label,
35
+ is_complete,
36
+ is_fail,
37
+ is_triage
35
38
  ),
36
39
  created_by:user_profiles!created_by (*)
37
40
  `;
@@ -44,7 +47,10 @@ const CLIENT_DETAIL_SELECT = `
44
47
  status:statuses!status_id (
45
48
  mms_id,
46
49
  label,
47
- colour
50
+ colour,
51
+ is_complete,
52
+ is_fail,
53
+ is_triage
48
54
  ),
49
55
  contract_client,
50
56
  contracted_hours,
@@ -32,7 +32,10 @@ const PROJECT_LIST_SELECT = `
32
32
  status:statuses!status_id (
33
33
  mms_id,
34
34
  colour,
35
- label
35
+ label,
36
+ is_complete,
37
+ is_fail,
38
+ is_triage
36
39
  ),
37
40
  created_by:user_profiles!created_by (*),
38
41
  manager:user_profiles!manager_id (*),
@@ -46,7 +49,10 @@ const PROJECT_DETAIL_SELECT = `
46
49
  status:statuses!status_id (
47
50
  mms_id,
48
51
  label,
49
- colour
52
+ colour,
53
+ is_complete,
54
+ is_fail,
55
+ is_triage
50
56
  ),
51
57
  has_budget,
52
58
  start_date,
@@ -10,8 +10,10 @@ export declare class AddStatusDto implements AddStatusDtoType {
10
10
  readonly label: string;
11
11
  readonly colour: string;
12
12
  readonly entity: StatusEntityTypes;
13
+ readonly is_complete?: boolean;
13
14
  }
14
15
  export declare class UpdateStatusDto implements UpdateStatusDtoType {
15
16
  readonly label: string;
16
17
  readonly colour: string;
18
+ readonly is_complete?: boolean;
17
19
  }
@@ -36,6 +36,8 @@ class AddStatusDto {
36
36
  colour;
37
37
  // `entity` is the wire name; the SDK maps it to the `entity_type` column.
38
38
  entity;
39
+ // Marks the status as the finished state; omitted means false.
40
+ is_complete;
39
41
  }
40
42
  exports.AddStatusDto = AddStatusDto;
41
43
  __decorate([
@@ -55,10 +57,17 @@ __decorate([
55
57
  (0, class_validator_1.IsEnum)(enum_1.StatusEntityTypes, { message: 'Invalid entity type' }),
56
58
  __metadata("design:type", String)
57
59
  ], AddStatusDto.prototype, "entity", void 0);
60
+ __decorate([
61
+ (0, class_validator_1.IsOptional)(),
62
+ (0, class_validator_1.IsBoolean)({ message: 'is_complete must be true or false' }),
63
+ __metadata("design:type", Boolean)
64
+ ], AddStatusDto.prototype, "is_complete", void 0);
58
65
  class UpdateStatusDto {
59
66
  label;
60
67
  // Colour must be a valid hex code (e.g., #FFFFFF)
61
68
  colour;
69
+ // Marks the status as the finished state; omitted leaves the flag unchanged.
70
+ is_complete;
62
71
  }
63
72
  exports.UpdateStatusDto = UpdateStatusDto;
64
73
  __decorate([
@@ -74,3 +83,8 @@ __decorate([
74
83
  (0, class_validator_1.Matches)(/^#[0-9A-Fa-f]{6}$/, { message: 'Colour must be a valid hex code' }),
75
84
  __metadata("design:type", String)
76
85
  ], UpdateStatusDto.prototype, "colour", void 0);
86
+ __decorate([
87
+ (0, class_validator_1.IsOptional)(),
88
+ (0, class_validator_1.IsBoolean)({ message: 'is_complete must be true or false' }),
89
+ __metadata("design:type", Boolean)
90
+ ], UpdateStatusDto.prototype, "is_complete", void 0);
@@ -22,9 +22,16 @@ __exportStar(require("./dto"), exports);
22
22
  // The public contract is the shared StatusEntity from @managemint-solutions/entities; the
23
23
  // `as StatusEntity` casts declare the shape the select string below produces (the columns are
24
24
  // defined in the api's supabase/migrations).
25
- const STATUS_SELECT = 'mms_id, label, colour';
25
+ const STATUS_SELECT = 'mms_id, label, colour, is_complete, is_fail, is_triage';
26
26
  // The audited write returns the whole row; the wire shape is the STATUS_SELECT columns.
27
- const toStatus = (row) => ({ mms_id: row.mms_id, label: row.label, colour: row.colour });
27
+ const toStatus = (row) => ({
28
+ mms_id: row.mms_id,
29
+ label: row.label,
30
+ colour: row.colour,
31
+ is_complete: row.is_complete,
32
+ is_fail: row.is_fail,
33
+ is_triage: row.is_triage,
34
+ });
28
35
  class StatusesResource {
29
36
  supabase;
30
37
  auth;
@@ -52,6 +59,7 @@ class StatusesResource {
52
59
  label: input.label,
53
60
  colour: input.colour,
54
61
  entity_type: input.entity,
62
+ is_complete: input.is_complete ?? false,
55
63
  organization_id: this.auth.organization_id,
56
64
  created_by: this.auth.mms_id,
57
65
  });
@@ -61,6 +69,7 @@ class StatusesResource {
61
69
  const row = await this.table.update(statusId, {
62
70
  label: input.label,
63
71
  colour: input.colour,
72
+ ...(input.is_complete !== undefined && { is_complete: input.is_complete }),
64
73
  updated_at: new Date().toISOString(),
65
74
  last_updated_by: this.auth.mms_id,
66
75
  });
@@ -31,7 +31,10 @@ const TASK_LIST_SELECT = `
31
31
  status:statuses!status_id (
32
32
  mms_id,
33
33
  colour,
34
- label
34
+ label,
35
+ is_complete,
36
+ is_fail,
37
+ is_triage
35
38
  ),
36
39
  priority,
37
40
  assigned_to:user_profiles!assigned_to_id (*)
@@ -49,7 +52,10 @@ const TASK_DETAIL_SELECT = `
49
52
  status:statuses!status_id (
50
53
  mms_id,
51
54
  colour,
52
- label
55
+ label,
56
+ is_complete,
57
+ is_fail,
58
+ is_triage
53
59
  ),
54
60
  priority,
55
61
  assigned_to:user_profiles!assigned_to_id (*),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@managemint-solutions/sdk",
3
- "version": "0.24.2",
3
+ "version": "0.25.0",
4
4
  "description": "Typed Supabase data-access SDK for ManageMint Solutions",
5
5
  "license": "UNLICENSED",
6
6
  "author": "Scott Bebington <scottbebington@gmail.com>",
@@ -47,7 +47,7 @@
47
47
  "testEnvironment": "node"
48
48
  },
49
49
  "dependencies": {
50
- "@managemint-solutions/entities": "^1.8.0"
50
+ "@managemint-solutions/entities": "^1.9.0"
51
51
  },
52
52
  "peerDependencies": {
53
53
  "@nestjs/common": "^11.0.0",