truflow 1.3.1 → 1.50.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 (41) hide show
  1. package/dist/API/Allmoxy/IGeneric.d.ts +1 -0
  2. package/dist/API/Allmoxy/IOrderInventoryItems.d.ts +27 -0
  3. package/dist/API/Allmoxy/IOrderInventoryItems.js +2 -0
  4. package/dist/API/Allmoxy/index.d.ts +1 -0
  5. package/dist/API/Allmoxy/index.js +1 -0
  6. package/dist/Helpers/IExporters.d.ts +1 -42
  7. package/dist/IAutomation.d.ts +25 -2
  8. package/dist/IBackorder.d.ts +79 -0
  9. package/dist/IBackorder.js +2 -0
  10. package/dist/IDocumentType.d.ts +36 -0
  11. package/dist/IDocumentType.js +2 -0
  12. package/dist/IIntegration.d.ts +28 -0
  13. package/dist/IJobRole.d.ts +56 -0
  14. package/dist/IJobRole.js +2 -0
  15. package/dist/IMailCache.d.ts +1 -0
  16. package/dist/IOrder.d.ts +15 -0
  17. package/dist/ISMTPServerConfig.d.ts +41 -0
  18. package/dist/ISMTPServerConfig.js +2 -0
  19. package/dist/ISOP.d.ts +30 -0
  20. package/dist/ISchedule.d.ts +27 -3
  21. package/dist/IShipment.d.ts +47 -0
  22. package/dist/IShipment.js +2 -0
  23. package/dist/IUser.d.ts +12 -0
  24. package/dist/index.d.ts +3 -0
  25. package/dist/index.js +3 -0
  26. package/package.json +1 -1
  27. package/src/API/Allmoxy/IGeneric.ts +1 -0
  28. package/src/API/Allmoxy/IOrderInventoryItems.ts +28 -0
  29. package/src/API/Allmoxy/index.ts +1 -0
  30. package/src/Helpers/IExporters.ts +3 -45
  31. package/src/IAutomation.ts +35 -0
  32. package/src/IDocumentType.ts +14 -0
  33. package/src/IIntegration.ts +36 -0
  34. package/src/IJobRole.ts +36 -0
  35. package/src/IMailCache.ts +1 -0
  36. package/src/IOrder.ts +16 -0
  37. package/src/ISMTPServerConfig.ts +19 -0
  38. package/src/ISOP.ts +33 -0
  39. package/src/ISchedule.ts +31 -3
  40. package/src/IUser.ts +14 -1
  41. package/src/index.ts +3 -0
@@ -43,6 +43,7 @@ export interface IStatusChangeTrigger {
43
43
  contact_tags: any[];
44
44
  delivery_date: string;
45
45
  due_date: string;
46
+ previous_delivery_date?: string;
46
47
  entered_date: string;
47
48
  exported: string;
48
49
  gst: string;
@@ -0,0 +1,27 @@
1
+ export interface IOrderInventoryItemsQuery {
2
+ order_id?: number;
3
+ }
4
+ export interface IOrderInventoryItemsResponse {
5
+ supply_id: number;
6
+ order_id: number;
7
+ location_id: number | null;
8
+ item_id: number;
9
+ quantity: number;
10
+ /** Allmoxy returns price as a numeric string (e.g. "0E-8"). Parsed to number when storing internally. */
11
+ price: string | number;
12
+ type: string | null;
13
+ allocated_by: string | null;
14
+ timestamp: string | null;
15
+ createdby: string | null;
16
+ createdbyid: number | null;
17
+ createddate: string | null;
18
+ updatedby: string | null;
19
+ updatedbyid: number | null;
20
+ updateddate: string | null;
21
+ inventory_item_name: string;
22
+ inventory_item_piece_size: string;
23
+ inventory_item_status: number;
24
+ order_name: string;
25
+ order_type: string;
26
+ order_status: string;
27
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -14,4 +14,5 @@ export * from "./IProductAttributeOptions";
14
14
  export * from "./IProductProductAttribute";
15
15
  export * from "./ITrigger";
16
16
  export * from "./IOrderBatch";
17
+ export * from "./IOrderInventoryItems";
17
18
  export * from "./IShippingMethod";
@@ -30,4 +30,5 @@ __exportStar(require("./IProductAttributeOptions"), exports);
30
30
  __exportStar(require("./IProductProductAttribute"), exports);
31
31
  __exportStar(require("./ITrigger"), exports);
32
32
  __exportStar(require("./IOrderBatch"), exports);
33
+ __exportStar(require("./IOrderInventoryItems"), exports);
33
34
  __exportStar(require("./IShippingMethod"), exports);
@@ -1,42 +1 @@
1
- export interface ICloudPanelAccount {
2
- name: string;
3
- username: string;
4
- password: string;
5
- }
6
- export interface ICloudPanelAPIRequest {
7
- DisplayName: string;
8
- Company: string;
9
- Username: string;
10
- Domain: string;
11
- Pwd: string;
12
- confirmPwd: string;
13
- PasswordNeverExpires: boolean;
14
- EnableMailbox: boolean;
15
- LocalPart: string;
16
- DomainPart: string;
17
- MailboxPlan: number;
18
- }
19
- export interface IPosteBox {
20
- address: string;
21
- user: string;
22
- home: string;
23
- name: string;
24
- disabled: boolean;
25
- domain_admin: boolean;
26
- super_admin: boolean;
27
- strict_from_disabled: boolean;
28
- created: string;
29
- updated: string;
30
- redirect_only: boolean;
31
- redirect_to: [];
32
- discard: boolean;
33
- }
34
- export interface ICreatePosteBox {
35
- name: string;
36
- email: string;
37
- passwordPlaintext: string;
38
- disabled: boolean;
39
- superAdmin: boolean;
40
- redirectTo?: ["string"];
41
- referenceId?: "string";
42
- }
1
+ export {};
@@ -24,7 +24,7 @@
24
24
  /// <reference types="mongoose/types/inferschematype" />
25
25
  import mongoose, { Document } from "mongoose";
26
26
  export type AutomationTriggerType = "order.created" | "order.updated" | "order.statusChanged" | "schedule.entryAdded" | "schedule.fieldChanged" | "measurement.added" | "measurement.completed" | "walkthrough.submitted" | "walkthrough.arrived" | "machineCheck.submitted" | "machineCheck.arrived" | "machineStatus.changed";
27
- export type AutomationActionType = "webhook" | "email" | "notification" | "sms" | "slack" | "update_field" | "add_note";
27
+ export type AutomationActionType = "webhook" | "email" | "notification" | "push_notification" | "sms" | "slack" | "google_chat" | "clickup" | "update_field" | "add_note";
28
28
  export type AutomationConditionOperator = "equals" | "notEquals" | "contains" | "notContains" | "greaterThan" | "lessThan" | "greaterThanOrEqual" | "lessThanOrEqual" | "exists" | "notExists" | "in" | "notIn";
29
29
  export interface IAutomationCondition {
30
30
  field: string;
@@ -91,6 +91,19 @@ export interface IAutomationSlackAction {
91
91
  username?: string;
92
92
  iconEmoji?: string;
93
93
  }
94
+ export interface IAutomationGoogleChatAction {
95
+ type: "google_chat";
96
+ integrationId: string;
97
+ spaceId: string;
98
+ message: string;
99
+ threadKey?: string;
100
+ }
101
+ export interface IAutomationClickUpAction {
102
+ type: "clickup";
103
+ integrationId: string;
104
+ channelId: string;
105
+ message: string;
106
+ }
94
107
  export interface IAutomationUpdateFieldAction {
95
108
  type: "update_field";
96
109
  targetType: "order" | "scheduleEntry";
@@ -102,7 +115,17 @@ export interface IAutomationAddNoteAction {
102
115
  noteText: string;
103
116
  mentionUserIds?: string[];
104
117
  }
105
- export type IAutomationAction = IAutomationWebhookAction | IAutomationEmailAction | IAutomationNotificationAction | IAutomationSMSAction | IAutomationSlackAction | IAutomationUpdateFieldAction | IAutomationAddNoteAction;
118
+ export interface IAutomationPushNotificationAction {
119
+ type: "push_notification";
120
+ userIds: string[];
121
+ title: string;
122
+ message: string;
123
+ /** Optional deep-link payload. Supports template variables in string values.
124
+ * e.g. { screen: "Walkthroughs", templateId: "{{walkthrough.templateId}}" }
125
+ */
126
+ data?: Record<string, string>;
127
+ }
128
+ export type IAutomationAction = IAutomationWebhookAction | IAutomationEmailAction | IAutomationNotificationAction | IAutomationPushNotificationAction | IAutomationSMSAction | IAutomationSlackAction | IAutomationGoogleChatAction | IAutomationClickUpAction | IAutomationUpdateFieldAction | IAutomationAddNoteAction;
106
129
  export interface ILeanAutomation {
107
130
  _id: mongoose.Types.ObjectId;
108
131
  name: string;
@@ -0,0 +1,79 @@
1
+ /// <reference types="mongoose/types/aggregate" />
2
+ /// <reference types="mongoose/types/callback" />
3
+ /// <reference types="mongoose/types/collection" />
4
+ /// <reference types="mongoose/types/connection" />
5
+ /// <reference types="mongoose/types/cursor" />
6
+ /// <reference types="mongoose/types/document" />
7
+ /// <reference types="mongoose/types/error" />
8
+ /// <reference types="mongoose/types/expressions" />
9
+ /// <reference types="mongoose/types/helpers" />
10
+ /// <reference types="mongoose/types/middlewares" />
11
+ /// <reference types="mongoose/types/indexes" />
12
+ /// <reference types="mongoose/types/models" />
13
+ /// <reference types="mongoose/types/mongooseoptions" />
14
+ /// <reference types="mongoose/types/pipelinestage" />
15
+ /// <reference types="mongoose/types/populate" />
16
+ /// <reference types="mongoose/types/query" />
17
+ /// <reference types="mongoose/types/schemaoptions" />
18
+ /// <reference types="mongoose/types/schematypes" />
19
+ /// <reference types="mongoose/types/session" />
20
+ /// <reference types="mongoose/types/types" />
21
+ /// <reference types="mongoose/types/utility" />
22
+ /// <reference types="mongoose/types/validation" />
23
+ /// <reference types="mongoose/types/virtuals" />
24
+ /// <reference types="mongoose/types/inferschematype" />
25
+ import mongoose, { Document } from "mongoose";
26
+ export interface IBackorderAttribute {
27
+ attributeName: string;
28
+ value: string | number;
29
+ }
30
+ export interface IBackorderLineItem {
31
+ id: number;
32
+ width?: number;
33
+ height?: number;
34
+ thickness?: number;
35
+ quantity: number;
36
+ description?: string;
37
+ reason: string;
38
+ attributes?: IBackorderAttribute[];
39
+ }
40
+ export interface IBackorderAllmoxyData {
41
+ groupId?: number;
42
+ opId?: number;
43
+ opiId?: number;
44
+ productId: number;
45
+ productAttributes?: IBackorderAttribute[];
46
+ lineItems?: IBackorderLineItem[];
47
+ }
48
+ export interface IBackorderOrderProduct {
49
+ _id?: string;
50
+ quantity: number;
51
+ type: string;
52
+ productionLine?: string;
53
+ startDate?: string;
54
+ hasStarted?: boolean;
55
+ highlight?: boolean;
56
+ allmoxyData?: IBackorderAllmoxyData;
57
+ }
58
+ export interface IBackorderEntry {
59
+ _id?: mongoose.Types.ObjectId;
60
+ orderId?: number;
61
+ orderName?: string;
62
+ orderProducts: IBackorderOrderProduct[];
63
+ createdBy: mongoose.Types.ObjectId;
64
+ assignedTo?: mongoose.Types.ObjectId;
65
+ status: "pending" | "in-progress" | "completed" | "cancelled";
66
+ completedAt?: Date;
67
+ notes?: string;
68
+ createdAt?: Date;
69
+ updatedAt?: Date;
70
+ }
71
+ export type IBackorder = IBackorderEntry & Document;
72
+ export interface IBackorderReason {
73
+ _id?: mongoose.Types.ObjectId;
74
+ reason: string;
75
+ enabled: boolean;
76
+ order: number;
77
+ createdAt?: Date;
78
+ updatedAt?: Date;
79
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,36 @@
1
+ /// <reference types="mongoose/types/aggregate" />
2
+ /// <reference types="mongoose/types/callback" />
3
+ /// <reference types="mongoose/types/collection" />
4
+ /// <reference types="mongoose/types/connection" />
5
+ /// <reference types="mongoose/types/cursor" />
6
+ /// <reference types="mongoose/types/document" />
7
+ /// <reference types="mongoose/types/error" />
8
+ /// <reference types="mongoose/types/expressions" />
9
+ /// <reference types="mongoose/types/helpers" />
10
+ /// <reference types="mongoose/types/middlewares" />
11
+ /// <reference types="mongoose/types/indexes" />
12
+ /// <reference types="mongoose/types/models" />
13
+ /// <reference types="mongoose/types/mongooseoptions" />
14
+ /// <reference types="mongoose/types/pipelinestage" />
15
+ /// <reference types="mongoose/types/populate" />
16
+ /// <reference types="mongoose/types/query" />
17
+ /// <reference types="mongoose/types/schemaoptions" />
18
+ /// <reference types="mongoose/types/schematypes" />
19
+ /// <reference types="mongoose/types/session" />
20
+ /// <reference types="mongoose/types/types" />
21
+ /// <reference types="mongoose/types/utility" />
22
+ /// <reference types="mongoose/types/validation" />
23
+ /// <reference types="mongoose/types/virtuals" />
24
+ /// <reference types="mongoose/types/inferschematype" />
25
+ import mongoose, { Document } from "mongoose";
26
+ export interface ILeanDocumentType {
27
+ _id?: mongoose.Types.ObjectId;
28
+ name: string;
29
+ slug: string;
30
+ description?: string;
31
+ isActive: boolean;
32
+ isSystem: boolean;
33
+ createdAt?: Date;
34
+ updatedAt?: Date;
35
+ }
36
+ export type IDocumentType = ILeanDocumentType & Document;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -47,6 +47,13 @@ export interface ILeanAllmoxyIntegration extends ILeanIntegration {
47
47
  authToken: string;
48
48
  }[];
49
49
  saveSelectedAttributesInOrder?: boolean;
50
+ enableShipDateSync?: boolean;
51
+ shipDateWebhook?: {
52
+ id: string;
53
+ url: string;
54
+ event: string;
55
+ authToken: string;
56
+ };
50
57
  webhook?: {
51
58
  id: string;
52
59
  url: string;
@@ -57,3 +64,24 @@ export interface ILeanAllmoxyIntegration extends ILeanIntegration {
57
64
  };
58
65
  }
59
66
  export type IAllmoxyIntegration = ILeanAllmoxyIntegration & Document;
67
+ export interface IGoogleChatSpace {
68
+ _id: mongoose.Types.ObjectId;
69
+ name: string;
70
+ type: "space" | "dm" | "group";
71
+ webhookUrl: string;
72
+ }
73
+ export interface ILeanGoogleChatIntegration extends ILeanIntegration {
74
+ spaces: IGoogleChatSpace[];
75
+ }
76
+ export type IGoogleChatIntegration = ILeanGoogleChatIntegration & Document;
77
+ export interface IClickUpChannel {
78
+ _id: mongoose.Types.ObjectId;
79
+ name: string;
80
+ type: "channel" | "dm";
81
+ channelId: string;
82
+ }
83
+ export interface ILeanClickUpIntegration extends ILeanIntegration {
84
+ apiKey: string;
85
+ channels: IClickUpChannel[];
86
+ }
87
+ export type IClickUpIntegration = ILeanClickUpIntegration & Document;
@@ -0,0 +1,56 @@
1
+ /// <reference types="mongoose/types/aggregate" />
2
+ /// <reference types="mongoose/types/callback" />
3
+ /// <reference types="mongoose/types/collection" />
4
+ /// <reference types="mongoose/types/connection" />
5
+ /// <reference types="mongoose/types/cursor" />
6
+ /// <reference types="mongoose/types/document" />
7
+ /// <reference types="mongoose/types/error" />
8
+ /// <reference types="mongoose/types/expressions" />
9
+ /// <reference types="mongoose/types/helpers" />
10
+ /// <reference types="mongoose/types/middlewares" />
11
+ /// <reference types="mongoose/types/indexes" />
12
+ /// <reference types="mongoose/types/models" />
13
+ /// <reference types="mongoose/types/mongooseoptions" />
14
+ /// <reference types="mongoose/types/pipelinestage" />
15
+ /// <reference types="mongoose/types/populate" />
16
+ /// <reference types="mongoose/types/query" />
17
+ /// <reference types="mongoose/types/schemaoptions" />
18
+ /// <reference types="mongoose/types/schematypes" />
19
+ /// <reference types="mongoose/types/session" />
20
+ /// <reference types="mongoose/types/types" />
21
+ /// <reference types="mongoose/types/utility" />
22
+ /// <reference types="mongoose/types/validation" />
23
+ /// <reference types="mongoose/types/virtuals" />
24
+ /// <reference types="mongoose/types/inferschematype" />
25
+ import mongoose, { Document } from "mongoose";
26
+ export type IJobRole = ILeanJobRole & Document;
27
+ export interface ILeanJobRole {
28
+ _id: mongoose.Types.ObjectId;
29
+ name: string;
30
+ description?: string;
31
+ responsibilities?: string;
32
+ tasks?: IJobRoleTask[];
33
+ metrics?: IJobRoleMetric[];
34
+ qualifications?: string;
35
+ safetyNotes?: string;
36
+ tools?: string;
37
+ reportingTo?: string;
38
+ notes?: string;
39
+ assignedMachineIds?: (mongoose.Types.ObjectId | string)[];
40
+ assignedDepartmentIds?: (mongoose.Types.ObjectId | string)[];
41
+ assignedSOPIds?: (mongoose.Types.ObjectId | string)[];
42
+ enabled?: boolean;
43
+ createdAt?: Date;
44
+ updatedAt?: Date;
45
+ }
46
+ export interface IJobRoleTask {
47
+ title: string;
48
+ frequency: "daily" | "weekly" | "biweekly" | "monthly" | "asNeeded";
49
+ description?: string;
50
+ }
51
+ export interface IJobRoleMetric {
52
+ name: string;
53
+ description?: string;
54
+ unit?: string;
55
+ target?: string;
56
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -49,5 +49,6 @@ export interface IPDFAttachment {
49
49
  storagePath?: string;
50
50
  gridFSId?: mongoose.Types.ObjectId;
51
51
  orderNumber?: number;
52
+ documentType?: string;
52
53
  }
53
54
  export type IMailCache = ILeanMailCache & Document;
package/dist/IOrder.d.ts CHANGED
@@ -60,6 +60,7 @@ export interface ILineItem {
60
60
  width: number;
61
61
  height: number;
62
62
  thickness: number;
63
+ price?: number;
63
64
  attributes: IProductAttribute[];
64
65
  measurements?: IMeasurement[];
65
66
  }
@@ -89,6 +90,9 @@ export interface ILeanOrder {
89
90
  status: string;
90
91
  notes?: INote[];
91
92
  shippingComplete?: boolean;
93
+ subtotal?: number;
94
+ total?: number;
95
+ inventoryItems?: IOrderInventoryItem[];
92
96
  }
93
97
  export interface IMeasurement {
94
98
  width: number;
@@ -97,3 +101,14 @@ export interface IMeasurement {
97
101
  outOfSquare: number;
98
102
  comments: string;
99
103
  }
104
+ export interface IOrderInventoryItem {
105
+ supply_id: number;
106
+ item_id: number;
107
+ location_id?: number | null;
108
+ quantity: number;
109
+ price?: number;
110
+ inventory_item_name: string;
111
+ inventory_item_piece_size: string;
112
+ /** Whether this is a quote (pre-allocation) or initial (confirmed allocation) entry */
113
+ type: "quote" | "initial";
114
+ }
@@ -0,0 +1,41 @@
1
+ /// <reference types="mongoose/types/aggregate" />
2
+ /// <reference types="mongoose/types/callback" />
3
+ /// <reference types="mongoose/types/collection" />
4
+ /// <reference types="mongoose/types/connection" />
5
+ /// <reference types="mongoose/types/cursor" />
6
+ /// <reference types="mongoose/types/document" />
7
+ /// <reference types="mongoose/types/error" />
8
+ /// <reference types="mongoose/types/expressions" />
9
+ /// <reference types="mongoose/types/helpers" />
10
+ /// <reference types="mongoose/types/middlewares" />
11
+ /// <reference types="mongoose/types/indexes" />
12
+ /// <reference types="mongoose/types/models" />
13
+ /// <reference types="mongoose/types/mongooseoptions" />
14
+ /// <reference types="mongoose/types/pipelinestage" />
15
+ /// <reference types="mongoose/types/populate" />
16
+ /// <reference types="mongoose/types/query" />
17
+ /// <reference types="mongoose/types/schemaoptions" />
18
+ /// <reference types="mongoose/types/schematypes" />
19
+ /// <reference types="mongoose/types/session" />
20
+ /// <reference types="mongoose/types/types" />
21
+ /// <reference types="mongoose/types/utility" />
22
+ /// <reference types="mongoose/types/validation" />
23
+ /// <reference types="mongoose/types/virtuals" />
24
+ /// <reference types="mongoose/types/inferschematype" />
25
+ import mongoose, { Document } from "mongoose";
26
+ export interface ILeanSMTPServerConfig {
27
+ _id?: mongoose.Types.ObjectId;
28
+ enabled: boolean;
29
+ host: string;
30
+ port: number;
31
+ secure: boolean;
32
+ domain: string;
33
+ maxSize: number;
34
+ requireAuth: boolean;
35
+ authUsername?: string;
36
+ authPassword?: string;
37
+ rejectUnauthorized: boolean;
38
+ createdAt?: Date;
39
+ updatedAt?: Date;
40
+ }
41
+ export type ISMTPServerConfig = ILeanSMTPServerConfig & Document;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/dist/ISOP.d.ts CHANGED
@@ -1,6 +1,27 @@
1
1
  /**
2
2
  * SOP (Standard Operating Procedure) Type Definitions
3
3
  */
4
+ /**
5
+ * Linked SOP reference
6
+ */
7
+ export interface ILinkedSOP {
8
+ sopId: string;
9
+ label?: string;
10
+ }
11
+ /**
12
+ * External link
13
+ */
14
+ export interface IExternalLink {
15
+ url: string;
16
+ label?: string;
17
+ }
18
+ /**
19
+ * Linked machine check reference
20
+ */
21
+ export interface ILinkedMachineCheck {
22
+ checkId: string;
23
+ label?: string;
24
+ }
4
25
  /**
5
26
  * Step in a step-based SOP
6
27
  */
@@ -9,6 +30,9 @@ export interface ISOPStep {
9
30
  title: string;
10
31
  description?: string;
11
32
  imageUrl?: string;
33
+ linkedSOPs?: ILinkedSOP[];
34
+ externalLinks?: IExternalLink[];
35
+ linkedMachineChecks?: ILinkedMachineCheck[];
12
36
  }
13
37
  /**
14
38
  * Row in an operating parameters table
@@ -41,6 +65,9 @@ export interface ISOP {
41
65
  machineIds?: string[];
42
66
  folderId?: string;
43
67
  trainingStep?: string;
68
+ linkedSOPs?: ILinkedSOP[];
69
+ externalLinks?: IExternalLink[];
70
+ linkedMachineChecks?: ILinkedMachineCheck[];
44
71
  enabled: boolean;
45
72
  version: number;
46
73
  note?: string;
@@ -59,6 +86,9 @@ export interface ISOPRevisionData {
59
86
  parameters?: ISOPParameters;
60
87
  machineIds?: string[];
61
88
  trainingStep?: string;
89
+ linkedSOPs?: ILinkedSOP[];
90
+ externalLinks?: IExternalLink[];
91
+ linkedMachineChecks?: ILinkedMachineCheck[];
62
92
  enabled: boolean;
63
93
  }
64
94
  /**
@@ -27,7 +27,7 @@ export interface IScheduleFilterCondition {
27
27
  field: "product" | "attribute";
28
28
  productId?: number;
29
29
  attributeName?: string;
30
- operator: "equals" | "notEquals" | "contains" | "greaterThan" | "lessThan" | "greaterThanOrEqual" | "lessThanOrEqual";
30
+ operator: "equals" | "notEquals" | "contains" | "greaterThan" | "lessThan" | "greaterThanOrEqual" | "lessThanOrEqual" | "exists" | "doesNotExist";
31
31
  value: string;
32
32
  }
33
33
  export interface IViewFilterCondition {
@@ -53,6 +53,7 @@ export interface ISavedViewFilter {
53
53
  sortConditions?: IFilterSortCondition[];
54
54
  }
55
55
  export interface IScheduleFilterGroup {
56
+ name?: string;
56
57
  conditions: IScheduleFilterCondition[];
57
58
  conditionOperator?: "and" | "or";
58
59
  }
@@ -62,9 +63,10 @@ export interface IScheduleColumn {
62
63
  machineId: mongoose.Types.ObjectId;
63
64
  offsetDays: number;
64
65
  order: number;
66
+ disableCondition?: IFieldDisableCondition;
65
67
  }
66
68
  export interface IScheduleDisplayColumn {
67
- type: "orderNumber" | "company" | "product" | "quantity" | "shipDate" | "startDate" | "status" | "attribute" | "stage" | "customField";
69
+ type: "orderNumber" | "company" | "product" | "quantity" | "shipDate" | "startDate" | "status" | "attribute" | "stage" | "customField" | "shipDateStage";
68
70
  stageColumnId?: mongoose.Types.ObjectId;
69
71
  attributeName?: string;
70
72
  customFieldName?: string;
@@ -72,7 +74,7 @@ export interface IScheduleDisplayColumn {
72
74
  visible: boolean;
73
75
  }
74
76
  export interface IScheduleAdditionalAttribute {
75
- attributeName: string;
77
+ attributeNames: string[];
76
78
  label?: string;
77
79
  displayCondition?: {
78
80
  operator: "equals" | "notEquals" | "contains" | "greaterThan" | "lessThan" | "greaterThanOrEqual" | "lessThanOrEqual";
@@ -89,11 +91,20 @@ export interface IScheduleView {
89
91
  additionalAttributes?: (string | IScheduleAdditionalAttribute)[];
90
92
  combineAdditionalAttributes?: boolean;
91
93
  groupByMatchingAttributes?: boolean;
94
+ combineByAttributes?: string[];
95
+ combineFilterGroups?: boolean;
92
96
  isDefault?: boolean;
93
97
  savedFilters?: ISavedViewFilter[];
94
98
  defaultFilterId?: mongoose.Types.ObjectId;
95
99
  activeFilterId?: mongoose.Types.ObjectId;
96
100
  }
101
+ export interface IFieldDisableCondition {
102
+ fieldType: "attribute" | "customField";
103
+ fieldName: string;
104
+ operator: "equals" | "notEquals" | "contains" | "greaterThan" | "lessThan" | "greaterThanOrEqual" | "lessThanOrEqual" | "isEmpty" | "isNotEmpty";
105
+ value?: string;
106
+ disabledPlaceholder?: string;
107
+ }
97
108
  export interface IScheduleCustomField {
98
109
  _id?: mongoose.Types.ObjectId;
99
110
  name: string;
@@ -103,6 +114,7 @@ export interface IScheduleCustomField {
103
114
  defaultValue?: string | boolean | number;
104
115
  required?: boolean;
105
116
  order?: number;
117
+ disableCondition?: IFieldDisableCondition;
106
118
  }
107
119
  export interface ILeanSchedule {
108
120
  _id: mongoose.Types.ObjectId;
@@ -115,11 +127,14 @@ export interface ILeanSchedule {
115
127
  views?: IScheduleView[];
116
128
  customFields?: IScheduleCustomField[];
117
129
  baseDateField: "shipDate" | "startDate";
130
+ completedStatuses?: string[];
131
+ hideCompletedOrders?: boolean;
118
132
  displayColumns?: IScheduleDisplayColumn[];
119
133
  hidePastShipDates?: boolean;
120
134
  hideShippedOrders?: boolean;
121
135
  showShipDate?: boolean;
122
136
  showStartDate?: boolean;
137
+ showShipDateStage?: boolean;
123
138
  defaultSortField?: string;
124
139
  defaultSortDirection?: "asc" | "desc";
125
140
  createdAt?: Date;
@@ -130,6 +145,14 @@ export interface IScheduleEntryDate {
130
145
  columnId: mongoose.Types.ObjectId;
131
146
  date: string;
132
147
  }
148
+ export interface IScheduleEntryHistory {
149
+ fieldType: "date" | "status" | "customField";
150
+ fieldName: string;
151
+ oldValue?: string | number | boolean | null;
152
+ newValue?: string | number | boolean | null;
153
+ changedAt: Date;
154
+ changedBy?: string;
155
+ }
133
156
  export interface ILeanScheduleEntry {
134
157
  _id: mongoose.Types.ObjectId;
135
158
  scheduleId: mongoose.Types.ObjectId;
@@ -141,6 +164,7 @@ export interface ILeanScheduleEntry {
141
164
  customStatus?: {
142
165
  [key: string]: any;
143
166
  };
167
+ history?: IScheduleEntryHistory[];
144
168
  createdAt?: Date;
145
169
  updatedAt?: Date;
146
170
  }
@@ -0,0 +1,47 @@
1
+ /// <reference types="mongoose/types/aggregate" />
2
+ /// <reference types="mongoose/types/callback" />
3
+ /// <reference types="mongoose/types/collection" />
4
+ /// <reference types="mongoose/types/connection" />
5
+ /// <reference types="mongoose/types/cursor" />
6
+ /// <reference types="mongoose/types/document" />
7
+ /// <reference types="mongoose/types/error" />
8
+ /// <reference types="mongoose/types/expressions" />
9
+ /// <reference types="mongoose/types/helpers" />
10
+ /// <reference types="mongoose/types/middlewares" />
11
+ /// <reference types="mongoose/types/indexes" />
12
+ /// <reference types="mongoose/types/models" />
13
+ /// <reference types="mongoose/types/mongooseoptions" />
14
+ /// <reference types="mongoose/types/pipelinestage" />
15
+ /// <reference types="mongoose/types/populate" />
16
+ /// <reference types="mongoose/types/query" />
17
+ /// <reference types="mongoose/types/schemaoptions" />
18
+ /// <reference types="mongoose/types/schematypes" />
19
+ /// <reference types="mongoose/types/session" />
20
+ /// <reference types="mongoose/types/types" />
21
+ /// <reference types="mongoose/types/utility" />
22
+ /// <reference types="mongoose/types/validation" />
23
+ /// <reference types="mongoose/types/virtuals" />
24
+ /// <reference types="mongoose/types/inferschematype" />
25
+ import mongoose, { Document } from "mongoose";
26
+ export interface IShipmentOrder {
27
+ orderId: number;
28
+ orderName?: string;
29
+ quantity?: number;
30
+ backorderIds?: mongoose.Types.ObjectId[];
31
+ }
32
+ export interface IShipmentEntry {
33
+ _id?: mongoose.Types.ObjectId;
34
+ shipmentNumber?: string;
35
+ customerId?: number;
36
+ customerName: string;
37
+ orders: IShipmentOrder[];
38
+ packingListPaths?: string[];
39
+ notes?: string;
40
+ shippedDate?: Date;
41
+ createdBy: mongoose.Types.ObjectId;
42
+ status: "pending" | "shipped" | "delivered" | "cancelled";
43
+ publicToken?: string;
44
+ createdAt?: Date;
45
+ updatedAt?: Date;
46
+ }
47
+ export type IShipment = IShipmentEntry & Document;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/dist/IUser.d.ts CHANGED
@@ -34,11 +34,18 @@ export interface ILeanUser {
34
34
  permissions: any[];
35
35
  groups: any[];
36
36
  pushSubscriptions?: PushSubscription[];
37
+ expoPushTokens?: ExpoPushToken[];
37
38
  pushNotificationTags?: NotificationTag[];
38
39
  enableSignin?: boolean;
39
40
  position?: string;
40
41
  department?: mongoose.Types.ObjectId | string;
42
+ departments?: (mongoose.Types.ObjectId | string)[];
41
43
  employeeId?: string;
44
+ startupPage?: string;
45
+ jobRoleId?: mongoose.Types.ObjectId | string;
46
+ isOrgRoot?: boolean;
47
+ reportsTo?: mongoose.Types.ObjectId | string;
48
+ hideFromOrgChartUnassigned?: boolean;
42
49
  }
43
50
  export interface PushSubscription {
44
51
  endpoint: string;
@@ -49,3 +56,8 @@ export interface PushSubscription {
49
56
  device?: string;
50
57
  createdAt?: Date;
51
58
  }
59
+ export interface ExpoPushToken {
60
+ token: string;
61
+ device?: string;
62
+ createdAt?: Date;
63
+ }
package/dist/index.d.ts CHANGED
@@ -40,3 +40,6 @@ export * from "./ISchedule";
40
40
  export * from "./IAutomation";
41
41
  export * from "./IEmailTemplate";
42
42
  export * from "./ISOP";
43
+ export * from "./IDocumentType";
44
+ export * from "./ISMTPServerConfig";
45
+ export * from "./IJobRole";
package/dist/index.js CHANGED
@@ -56,3 +56,6 @@ __exportStar(require("./ISchedule"), exports);
56
56
  __exportStar(require("./IAutomation"), exports);
57
57
  __exportStar(require("./IEmailTemplate"), exports);
58
58
  __exportStar(require("./ISOP"), exports);
59
+ __exportStar(require("./IDocumentType"), exports);
60
+ __exportStar(require("./ISMTPServerConfig"), exports);
61
+ __exportStar(require("./IJobRole"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "truflow",
3
- "version": "1.3.1",
3
+ "version": "1.50.0",
4
4
  "main": "./dist/index.js",
5
5
  "license": "MIT",
6
6
  "scripts": {
@@ -43,6 +43,7 @@ export interface IStatusChangeTrigger {
43
43
  contact_tags: any[];
44
44
  delivery_date: string;
45
45
  due_date: string;
46
+ previous_delivery_date?: string;
46
47
  entered_date: string;
47
48
  exported: string;
48
49
  gst: string;
@@ -0,0 +1,28 @@
1
+ export interface IOrderInventoryItemsQuery {
2
+ order_id?: number;
3
+ }
4
+
5
+ export interface IOrderInventoryItemsResponse {
6
+ supply_id: number;
7
+ order_id: number;
8
+ location_id: number | null;
9
+ item_id: number;
10
+ quantity: number;
11
+ /** Allmoxy returns price as a numeric string (e.g. "0E-8"). Parsed to number when storing internally. */
12
+ price: string | number;
13
+ type: string | null;
14
+ allocated_by: string | null;
15
+ timestamp: string | null;
16
+ createdby: string | null;
17
+ createdbyid: number | null;
18
+ createddate: string | null;
19
+ updatedby: string | null;
20
+ updatedbyid: number | null;
21
+ updateddate: string | null;
22
+ inventory_item_name: string;
23
+ inventory_item_piece_size: string;
24
+ inventory_item_status: number;
25
+ order_name: string;
26
+ order_type: string;
27
+ order_status: string;
28
+ }
@@ -14,4 +14,5 @@ export * from "./IProductAttributeOptions";
14
14
  export * from "./IProductProductAttribute";
15
15
  export * from "./ITrigger";
16
16
  export * from "./IOrderBatch";
17
+ export * from "./IOrderInventoryItems";
17
18
  export * from "./IShippingMethod";
@@ -1,45 +1,3 @@
1
- export interface ICloudPanelAccount {
2
- name: string;
3
- username: string;
4
- password: string;
5
- }
6
-
7
- export interface ICloudPanelAPIRequest {
8
- DisplayName: string;
9
- Company: string;
10
- Username: string;
11
- Domain: string;
12
- Pwd: string;
13
- confirmPwd: string;
14
- PasswordNeverExpires: boolean;
15
- EnableMailbox: boolean;
16
- LocalPart: string;
17
- DomainPart: string;
18
- MailboxPlan: number;
19
- }
20
-
21
- export interface IPosteBox {
22
- address: string;
23
- user: string;
24
- home: string;
25
- name: string;
26
- disabled: boolean;
27
- domain_admin: boolean;
28
- super_admin: boolean;
29
- strict_from_disabled: boolean;
30
- created: string;
31
- updated: string;
32
- redirect_only: boolean;
33
- redirect_to: [];
34
- discard: boolean;
35
- }
36
-
37
- export interface ICreatePosteBox {
38
- name: string;
39
- email: string;
40
- passwordPlaintext: string;
41
- disabled: boolean;
42
- superAdmin: boolean;
43
- redirectTo?: ["string"];
44
- referenceId?: "string";
45
- }
1
+ // No interfaces needed in this file after removing legacy email account creation
2
+ // All exporter types are in IExporter.ts
3
+ export {};
@@ -20,8 +20,11 @@ export type AutomationActionType =
20
20
  | "webhook" // Trigger a webhook (HTTP request)
21
21
  | "email" // Send an email
22
22
  | "notification" // Send in-app notification to user(s)
23
+ | "push_notification" // Send Expo push notification to mobile app
23
24
  | "sms" // Send SMS/text message
24
25
  | "slack" // Post to Slack channel
26
+ | "google_chat" // Send a Google Chat message
27
+ | "clickup" // Post a ClickUp Chat message
25
28
  | "update_field" // Update order or schedule entry field
26
29
  | "add_note"; // Add a note to the order
27
30
 
@@ -129,6 +132,23 @@ export interface IAutomationSlackAction {
129
132
  iconEmoji?: string; // Optional emoji icon (e.g., ":robot_face:")
130
133
  }
131
134
 
135
+ // Google Chat action configuration
136
+ export interface IAutomationGoogleChatAction {
137
+ type: "google_chat";
138
+ integrationId: string; // References the GoogleChat integration _id
139
+ spaceId: string; // References a space _id within the integration's spaces array
140
+ message: string; // Message text (can use template variables)
141
+ threadKey?: string; // Optional thread key for grouping messages into a thread
142
+ }
143
+
144
+ // ClickUp Chat action configuration
145
+ export interface IAutomationClickUpAction {
146
+ type: "clickup";
147
+ integrationId: string; // References the ClickUp integration _id
148
+ channelId: string; // ClickUp channel ID (from the integration's channels array)
149
+ message: string; // Message text (can use template variables)
150
+ }
151
+
132
152
  // Update field action configuration
133
153
  export interface IAutomationUpdateFieldAction {
134
154
  type: "update_field";
@@ -144,13 +164,28 @@ export interface IAutomationAddNoteAction {
144
164
  mentionUserIds?: string[]; // Optional user IDs to mention
145
165
  }
146
166
 
167
+ // Push notification action configuration (for Expo mobile app)
168
+ export interface IAutomationPushNotificationAction {
169
+ type: "push_notification";
170
+ userIds: string[]; // Array of user IDs to notify (can use "all" for all users with matching tags)
171
+ title: string; // Notification title (can use template variables)
172
+ message: string; // Notification message (can use template variables)
173
+ /** Optional deep-link payload. Supports template variables in string values.
174
+ * e.g. { screen: "Walkthroughs", templateId: "{{walkthrough.templateId}}" }
175
+ */
176
+ data?: Record<string, string>;
177
+ }
178
+
147
179
  // Union type for all action configurations
148
180
  export type IAutomationAction =
149
181
  | IAutomationWebhookAction
150
182
  | IAutomationEmailAction
151
183
  | IAutomationNotificationAction
184
+ | IAutomationPushNotificationAction
152
185
  | IAutomationSMSAction
153
186
  | IAutomationSlackAction
187
+ | IAutomationGoogleChatAction
188
+ | IAutomationClickUpAction
154
189
  | IAutomationUpdateFieldAction
155
190
  | IAutomationAddNoteAction;
156
191
 
@@ -0,0 +1,14 @@
1
+ import mongoose, { Document } from "mongoose";
2
+
3
+ export interface ILeanDocumentType {
4
+ _id?: mongoose.Types.ObjectId;
5
+ name: string;
6
+ slug: string;
7
+ description?: string;
8
+ isActive: boolean;
9
+ isSystem: boolean;
10
+ createdAt?: Date;
11
+ updatedAt?: Date;
12
+ }
13
+
14
+ export type IDocumentType = ILeanDocumentType & Document;
@@ -25,6 +25,13 @@ export interface ILeanAllmoxyIntegration extends ILeanIntegration {
25
25
  authToken: string;
26
26
  }[];
27
27
  saveSelectedAttributesInOrder?: boolean;
28
+ enableShipDateSync?: boolean;
29
+ shipDateWebhook?: {
30
+ id: string;
31
+ url: string;
32
+ event: string;
33
+ authToken: string;
34
+ };
28
35
  webhook?: {
29
36
  id: string;
30
37
  url: string;
@@ -37,3 +44,32 @@ export interface ILeanAllmoxyIntegration extends ILeanIntegration {
37
44
 
38
45
  export type IAllmoxyIntegration = ILeanAllmoxyIntegration & Document;
39
46
 
47
+ // A single configured target (space, DM, or group) in a Google Chat integration
48
+ export interface IGoogleChatSpace {
49
+ _id: mongoose.Types.ObjectId;
50
+ name: string; // User-defined display name (e.g. "Engineering Space")
51
+ type: "space" | "dm" | "group"; // Target type
52
+ webhookUrl: string; // Google Chat incoming webhook URL
53
+ }
54
+
55
+ export interface ILeanGoogleChatIntegration extends ILeanIntegration {
56
+ spaces: IGoogleChatSpace[];
57
+ }
58
+
59
+ export type IGoogleChatIntegration = ILeanGoogleChatIntegration & Document;
60
+
61
+ // A single configured channel or DM in a ClickUp integration
62
+ export interface IClickUpChannel {
63
+ _id: mongoose.Types.ObjectId;
64
+ name: string; // User-defined display name (e.g. "Engineering")
65
+ type: "channel" | "dm"; // Target type
66
+ channelId: string; // ClickUp Chat channel ID
67
+ }
68
+
69
+ export interface ILeanClickUpIntegration extends ILeanIntegration {
70
+ apiKey: string; // ClickUp Personal API Key
71
+ channels: IClickUpChannel[];
72
+ }
73
+
74
+ export type IClickUpIntegration = ILeanClickUpIntegration & Document;
75
+
@@ -0,0 +1,36 @@
1
+ import mongoose, { Document } from "mongoose";
2
+
3
+ export type IJobRole = ILeanJobRole & Document;
4
+
5
+ export interface ILeanJobRole {
6
+ _id: mongoose.Types.ObjectId;
7
+ name: string;
8
+ description?: string;
9
+ responsibilities?: string;
10
+ tasks?: IJobRoleTask[];
11
+ metrics?: IJobRoleMetric[];
12
+ qualifications?: string;
13
+ safetyNotes?: string;
14
+ tools?: string;
15
+ reportingTo?: string;
16
+ notes?: string;
17
+ assignedMachineIds?: (mongoose.Types.ObjectId | string)[];
18
+ assignedDepartmentIds?: (mongoose.Types.ObjectId | string)[];
19
+ assignedSOPIds?: (mongoose.Types.ObjectId | string)[];
20
+ enabled?: boolean;
21
+ createdAt?: Date;
22
+ updatedAt?: Date;
23
+ }
24
+
25
+ export interface IJobRoleTask {
26
+ title: string;
27
+ frequency: "daily" | "weekly" | "biweekly" | "monthly" | "asNeeded";
28
+ description?: string;
29
+ }
30
+
31
+ export interface IJobRoleMetric {
32
+ name: string;
33
+ description?: string;
34
+ unit?: string;
35
+ target?: string;
36
+ }
package/src/IMailCache.ts CHANGED
@@ -28,6 +28,7 @@ export interface IPDFAttachment {
28
28
  storagePath?: string;
29
29
  gridFSId?: mongoose.Types.ObjectId;
30
30
  orderNumber?: number;
31
+ documentType?: string;
31
32
  }
32
33
 
33
34
  export type IMailCache = ILeanMailCache & Document;
package/src/IOrder.ts CHANGED
@@ -40,6 +40,7 @@ export interface ILineItem {
40
40
  width: number;
41
41
  height: number;
42
42
  thickness: number;
43
+ price?: number;
43
44
  attributes: IProductAttribute[];
44
45
  measurements?: IMeasurement[];
45
46
  }
@@ -72,6 +73,9 @@ export interface ILeanOrder {
72
73
  status: string;
73
74
  notes?: INote[];
74
75
  shippingComplete?: boolean;
76
+ subtotal?: number;
77
+ total?: number;
78
+ inventoryItems?: IOrderInventoryItem[];
75
79
  }
76
80
 
77
81
  export interface IMeasurement {
@@ -81,3 +85,15 @@ export interface IMeasurement {
81
85
  outOfSquare: number;
82
86
  comments: string;
83
87
  }
88
+
89
+ export interface IOrderInventoryItem {
90
+ supply_id: number;
91
+ item_id: number;
92
+ location_id?: number | null;
93
+ quantity: number;
94
+ price?: number;
95
+ inventory_item_name: string;
96
+ inventory_item_piece_size: string;
97
+ /** Whether this is a quote (pre-allocation) or initial (confirmed allocation) entry */
98
+ type: "quote" | "initial";
99
+ }
@@ -0,0 +1,19 @@
1
+ import mongoose, { Document } from "mongoose";
2
+
3
+ export interface ILeanSMTPServerConfig {
4
+ _id?: mongoose.Types.ObjectId;
5
+ enabled: boolean;
6
+ host: string;
7
+ port: number;
8
+ secure: boolean;
9
+ domain: string;
10
+ maxSize: number;
11
+ requireAuth: boolean;
12
+ authUsername?: string;
13
+ authPassword?: string;
14
+ rejectUnauthorized: boolean;
15
+ createdAt?: Date;
16
+ updatedAt?: Date;
17
+ }
18
+
19
+ export type ISMTPServerConfig = ILeanSMTPServerConfig & Document;
package/src/ISOP.ts CHANGED
@@ -2,6 +2,30 @@
2
2
  * SOP (Standard Operating Procedure) Type Definitions
3
3
  */
4
4
 
5
+ /**
6
+ * Linked SOP reference
7
+ */
8
+ export interface ILinkedSOP {
9
+ sopId: string;
10
+ label?: string;
11
+ }
12
+
13
+ /**
14
+ * External link
15
+ */
16
+ export interface IExternalLink {
17
+ url: string;
18
+ label?: string;
19
+ }
20
+
21
+ /**
22
+ * Linked machine check reference
23
+ */
24
+ export interface ILinkedMachineCheck {
25
+ checkId: string;
26
+ label?: string;
27
+ }
28
+
5
29
  /**
6
30
  * Step in a step-based SOP
7
31
  */
@@ -10,6 +34,9 @@ export interface ISOPStep {
10
34
  title: string;
11
35
  description?: string;
12
36
  imageUrl?: string;
37
+ linkedSOPs?: ILinkedSOP[];
38
+ externalLinks?: IExternalLink[];
39
+ linkedMachineChecks?: ILinkedMachineCheck[];
13
40
  }
14
41
 
15
42
  /**
@@ -45,6 +72,9 @@ export interface ISOP {
45
72
  machineIds?: string[];
46
73
  folderId?: string;
47
74
  trainingStep?: string;
75
+ linkedSOPs?: ILinkedSOP[];
76
+ externalLinks?: IExternalLink[];
77
+ linkedMachineChecks?: ILinkedMachineCheck[];
48
78
  enabled: boolean;
49
79
  version: number;
50
80
  note?: string;
@@ -64,6 +94,9 @@ export interface ISOPRevisionData {
64
94
  parameters?: ISOPParameters;
65
95
  machineIds?: string[];
66
96
  trainingStep?: string;
97
+ linkedSOPs?: ILinkedSOP[];
98
+ externalLinks?: IExternalLink[];
99
+ linkedMachineChecks?: ILinkedMachineCheck[];
67
100
  enabled: boolean;
68
101
  }
69
102
 
package/src/ISchedule.ts CHANGED
@@ -5,7 +5,7 @@ export interface IScheduleFilterCondition {
5
5
  field: "product" | "attribute";
6
6
  productId?: number;
7
7
  attributeName?: string;
8
- operator: "equals" | "notEquals" | "contains" | "greaterThan" | "lessThan" | "greaterThanOrEqual" | "lessThanOrEqual";
8
+ operator: "equals" | "notEquals" | "contains" | "greaterThan" | "lessThan" | "greaterThanOrEqual" | "lessThanOrEqual" | "exists" | "doesNotExist";
9
9
  value: string;
10
10
  }
11
11
 
@@ -39,6 +39,7 @@ export interface ISavedViewFilter {
39
39
 
40
40
  // A filter group - conditions are combined based on conditionOperator
41
41
  export interface IScheduleFilterGroup {
42
+ name?: string; // Optional display name for this filter group (used when combining groups)
42
43
  conditions: IScheduleFilterCondition[];
43
44
  conditionOperator?: "and" | "or";
44
45
  }
@@ -50,11 +51,12 @@ export interface IScheduleColumn {
50
51
  machineId: mongoose.Types.ObjectId;
51
52
  offsetDays: number; // Days offset from the base date (ship date or start date)
52
53
  order: number; // Display order of this column
54
+ disableCondition?: IFieldDisableCondition; // When set, the stage cell is read-only if the condition is met
53
55
  }
54
56
 
55
57
  // Display column configuration - controls order and visibility of all columns
56
58
  export interface IScheduleDisplayColumn {
57
- type: "orderNumber" | "company" | "product" | "quantity" | "shipDate" | "startDate" | "status" | "attribute" | "stage" | "customField";
59
+ type: "orderNumber" | "company" | "product" | "quantity" | "shipDate" | "startDate" | "status" | "attribute" | "stage" | "customField" | "shipDateStage";
58
60
  stageColumnId?: mongoose.Types.ObjectId; // Reference to the stage column if type is "stage"
59
61
  attributeName?: string; // Reference to the attribute if type is "attribute"
60
62
  customFieldName?: string; // Reference to the custom field name if type is "customField"
@@ -64,7 +66,7 @@ export interface IScheduleDisplayColumn {
64
66
 
65
67
  // Additional attribute with optional display condition
66
68
  export interface IScheduleAdditionalAttribute {
67
- attributeName: string;
69
+ attributeNames: string[]; // Array of attribute names - will use the first one with a value
68
70
  label?: string; // Optional custom label for display
69
71
  // Optional condition - if specified, attribute only displays when condition is met
70
72
  displayCondition?: {
@@ -88,6 +90,8 @@ export interface IScheduleView {
88
90
  combineAdditionalAttributes?: boolean; // Whether to show all additional attributes in one column (like matched attributes)
89
91
  // Product grouping configuration
90
92
  groupByMatchingAttributes?: boolean; // Whether to group products with matching filter attributes in the same order
93
+ combineByAttributes?: string[]; // When groupByMatchingAttributes is true, only use these specific attribute names for the grouping key (empty/undefined = use all filter-condition attributes)
94
+ combineFilterGroups?: boolean; // Whether to combine products from different named filter groups into a single row (requires groupByMatchingAttributes and named filter groups)
91
95
  isDefault?: boolean; // Whether this is the default view
92
96
  // Saved filters for this view
93
97
  savedFilters?: ISavedViewFilter[];
@@ -97,6 +101,15 @@ export interface IScheduleView {
97
101
  activeFilterId?: mongoose.Types.ObjectId;
98
102
  }
99
103
 
104
+ // Condition that determines when a stage or custom field should be disabled (read-only)
105
+ export interface IFieldDisableCondition {
106
+ fieldType: "attribute" | "customField"; // Where to look for the value
107
+ fieldName: string; // Attribute name or custom field name to evaluate
108
+ operator: "equals" | "notEquals" | "contains" | "greaterThan" | "lessThan" | "greaterThanOrEqual" | "lessThanOrEqual" | "isEmpty" | "isNotEmpty";
109
+ value?: string; // Comparison value (not used for isEmpty/isNotEmpty)
110
+ disabledPlaceholder?: string; // Text shown in the cell when the field is disabled (e.g. "No Finish")
111
+ }
112
+
100
113
  // Custom field definition for schedule entries
101
114
  export interface IScheduleCustomField {
102
115
  _id?: mongoose.Types.ObjectId;
@@ -107,6 +120,7 @@ export interface IScheduleCustomField {
107
120
  defaultValue?: string | boolean | number; // Default value for new entries
108
121
  required?: boolean; // Whether field is required
109
122
  order?: number; // Display order
123
+ disableCondition?: IFieldDisableCondition; // When set, the field is read-only if the condition is met
110
124
  }
111
125
 
112
126
  // The main Schedule configuration
@@ -126,12 +140,16 @@ export interface ILeanSchedule {
126
140
  customFields?: IScheduleCustomField[];
127
141
  // Base date field to calculate offsets from
128
142
  baseDateField: "shipDate" | "startDate";
143
+ // Completed status configuration
144
+ completedStatuses?: string[];
145
+ hideCompletedOrders?: boolean;
129
146
  // Legacy fields (kept for backward compatibility, will be migrated to default view)
130
147
  displayColumns?: IScheduleDisplayColumn[];
131
148
  hidePastShipDates?: boolean;
132
149
  hideShippedOrders?: boolean;
133
150
  showShipDate?: boolean;
134
151
  showStartDate?: boolean;
152
+ showShipDateStage?: boolean;
135
153
  defaultSortField?: string;
136
154
  defaultSortDirection?: "asc" | "desc";
137
155
  createdAt?: Date;
@@ -146,6 +164,15 @@ export interface IScheduleEntryDate {
146
164
  date: string; // ISO date string
147
165
  }
148
166
 
167
+ export interface IScheduleEntryHistory {
168
+ fieldType: "date" | "status" | "customField";
169
+ fieldName: string;
170
+ oldValue?: string | number | boolean | null;
171
+ newValue?: string | number | boolean | null;
172
+ changedAt: Date;
173
+ changedBy?: string;
174
+ }
175
+
149
176
  export interface ILeanScheduleEntry {
150
177
  _id: mongoose.Types.ObjectId;
151
178
  scheduleId: mongoose.Types.ObjectId;
@@ -155,6 +182,7 @@ export interface ILeanScheduleEntry {
155
182
  notes?: string;
156
183
  status?: string; // Legacy status field
157
184
  customStatus?: { [key: string]: any }; // Custom status fields (key-value pairs)
185
+ history?: IScheduleEntryHistory[]; // Audit trail
158
186
  createdAt?: Date;
159
187
  updatedAt?: Date;
160
188
  }
package/src/IUser.ts CHANGED
@@ -12,12 +12,19 @@ export interface ILeanUser {
12
12
  permissions: any[];
13
13
  groups: any[];
14
14
  pushSubscriptions?: PushSubscription[];
15
+ expoPushTokens?: ExpoPushToken[]; // Expo push tokens for the native mobile app
15
16
  pushNotificationTags?: NotificationTag[]; // Tags user wants to receive push notifications for
16
17
  // Employee fields
17
18
  enableSignin?: boolean; // If true, this person can sign in (user), if false they're employee-only
18
19
  position?: string; // Job title/position
19
- department?: mongoose.Types.ObjectId | string; // Department reference (ObjectId) or populated name
20
+ department?: mongoose.Types.ObjectId | string; // Deprecated kept for backward compat; use departments[]
21
+ departments?: (mongoose.Types.ObjectId | string)[]; // Department memberships (can belong to multiple)
20
22
  employeeId?: string; // Employee ID number (optional)
23
+ startupPage?: string; // Default page to load after login (e.g., "/quality-control")
24
+ jobRoleId?: mongoose.Types.ObjectId | string;
25
+ isOrgRoot?: boolean;
26
+ reportsTo?: mongoose.Types.ObjectId | string; // Direct reporting relationship for org chart
27
+ hideFromOrgChartUnassigned?: boolean; // If true, exclude from org chart unassigned section
21
28
  }
22
29
 
23
30
  export interface PushSubscription {
@@ -29,3 +36,9 @@ export interface PushSubscription {
29
36
  device?: string;
30
37
  createdAt?: Date;
31
38
  }
39
+
40
+ export interface ExpoPushToken {
41
+ token: string; // The Expo push token (ExponentPushToken[xxx])
42
+ device?: string; // Optional device label
43
+ createdAt?: Date;
44
+ }
package/src/index.ts CHANGED
@@ -40,3 +40,6 @@ export * from "./ISchedule";
40
40
  export * from "./IAutomation";
41
41
  export * from "./IEmailTemplate";
42
42
  export * from "./ISOP";
43
+ export * from "./IDocumentType";
44
+ export * from "./ISMTPServerConfig";
45
+ export * from "./IJobRole";