truflow 0.0.189 → 0.0.190

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/dist/Helpers/IOrders/IMoveOrder.d.ts +1 -1
  2. package/dist/Helpers/IZapier/index.d.ts +7 -6
  3. package/dist/IAutomation.d.ts +197 -0
  4. package/dist/IDailyTotal.d.ts +6 -0
  5. package/dist/IExporter.d.ts +1 -0
  6. package/dist/IExpress.d.ts +2 -0
  7. package/dist/IExpress.js +1 -0
  8. package/dist/IInventory.d.ts +35 -0
  9. package/dist/IMailCache.d.ts +13 -0
  10. package/dist/IOrder.d.ts +1 -1
  11. package/dist/ISchedule.d.ts +119 -0
  12. package/dist/ISetting.d.ts +31 -2
  13. package/dist/ISupplier.d.ts +1 -0
  14. package/dist/Inventory/IInventoryTransfer.d.ts +122 -0
  15. package/dist/Inventory/IInventoryTransfer.js +2 -0
  16. package/dist/Inventory/ILocation.d.ts +6 -0
  17. package/dist/{IInventoryLocation.d.ts → Inventory/ISelectFieldDefinition.d.ts} +20 -34
  18. package/dist/Inventory/ISelectFieldDefinition.js +2 -0
  19. package/dist/index.d.ts +4 -0
  20. package/dist/index.js +4 -0
  21. package/package-lock.json +2180 -0
  22. package/package.json +13 -4
  23. package/src/Helpers/IOrders/IMoveOrder.ts +1 -1
  24. package/src/Helpers/IZapier/index.ts +9 -6
  25. package/src/IAutomation.ts +264 -0
  26. package/src/IDailyTotal.ts +7 -0
  27. package/src/IExporter.ts +1 -0
  28. package/src/IExpress.ts +1 -0
  29. package/src/IIntegration.ts +1 -0
  30. package/src/IInventory.ts +38 -0
  31. package/src/IMailCache.ts +14 -0
  32. package/src/IOrder.ts +1 -1
  33. package/src/ISchedule.ts +125 -0
  34. package/src/ISetting.ts +49 -2
  35. package/src/ISupplier.ts +1 -0
  36. package/src/Inventory/IInventoryTransfer.ts +108 -0
  37. package/src/Inventory/ILocation.ts +12 -0
  38. package/src/Inventory/ISelectFieldDefinition.ts +29 -0
  39. package/src/index.ts +4 -0
  40. package/dist/ILocation.d.ts +0 -75
  41. /package/dist/{IInventoryLocation.js → IAutomation.js} +0 -0
  42. /package/dist/{ILocation.js → ISchedule.js} +0 -0
package/src/ISetting.ts CHANGED
@@ -25,20 +25,63 @@ export interface ILeanHoliday extends ILeanSetting {
25
25
  recurs?: string;
26
26
  }
27
27
 
28
+ export type AttributeFilterOperator =
29
+ | "equals"
30
+ | "notEquals"
31
+ | "contains"
32
+ | "notContains"
33
+ | "startsWith"
34
+ | "endsWith";
35
+
36
+ export interface IAttributeFilter {
37
+ attributeName: string;
38
+ operator?: AttributeFilterOperator;
39
+ value: any;
40
+ }
41
+
28
42
  export interface ILeanLimit extends ILeanSetting {
29
43
  name: string;
30
44
  rpd: string;
31
- limit: string;
45
+ capacity: string;
32
46
  enabled: boolean;
33
47
  products?: [
34
48
  {
35
49
  name: string;
50
+ allmoxyProductId?: number;
36
51
  sheetGroupingAttribute?: string;
37
52
  grainedProduct?: boolean;
38
53
  grainedProductAttribute?: string;
54
+ attributeFilters?: IAttributeFilter[];
55
+ priority?: number;
39
56
  }
40
57
  ];
41
58
  nestable?: boolean;
59
+ visibleOnDashboard?: boolean;
60
+ }
61
+
62
+ export interface IMachinePathStep {
63
+ machine: mongoose.Types.ObjectId;
64
+ offsetDays: number;
65
+ _id?: mongoose.Types.ObjectId;
66
+ }
67
+
68
+ // Production Line is the new name for Limits, with additional path configuration
69
+ export interface ILeanProductionLine extends ILeanLimit {
70
+ // Machine path: ordered list of machines with timing offsets
71
+ machinePath?: IMachinePathStep[];
72
+ }
73
+
74
+ // Machine or Station in the production facility
75
+ export interface ILeanMachine extends ILeanSetting {
76
+ name: string;
77
+ description?: string;
78
+ type: "machine" | "station";
79
+ enabled: boolean;
80
+ // Optional capacity or throughput metrics
81
+ dailyCapacity?: number;
82
+ // Optional location or area information
83
+ location?: string;
84
+ visibleOnDashboard?: boolean;
42
85
  }
43
86
 
44
87
  export interface ILeanOrderFlag extends ILeanSetting {
@@ -51,7 +94,7 @@ export interface ILeanOrderFlag extends ILeanSetting {
51
94
  export interface ILeanSorting extends ILeanSetting {
52
95
  headerList?: string[];
53
96
  itemList: string[];
54
- usage: "totals-groups" | "limits";
97
+ usage: "totals-groups" | "production-lines" | "machines";
55
98
  }
56
99
 
57
100
  export interface ICalculation {
@@ -92,3 +135,7 @@ export type ISorting = ILeanSorting & Document;
92
135
  export type ITotalsGroup = ILeanTotalsGroup & Document;
93
136
 
94
137
  export type IKeyValue = ILeanKeyValue & Document;
138
+
139
+ export type IProductionLine = ILeanProductionLine & Document;
140
+
141
+ export type IMachine = ILeanMachine & Document;
package/src/ISupplier.ts CHANGED
@@ -12,6 +12,7 @@ export interface ISupplier {
12
12
  };
13
13
  notes?: string;
14
14
  active: boolean;
15
+ allowedInventoryTypes?: mongoose.Types.ObjectId[];
15
16
  createdAt: Date;
16
17
  updatedAt: Date;
17
18
  }
@@ -0,0 +1,108 @@
1
+ import { Document, Types } from "mongoose";
2
+
3
+ /**
4
+ * Single item in a bulk transfer
5
+ */
6
+ export interface ITransferItem {
7
+ itemId: Types.ObjectId; // Reference to InventoryItem
8
+ fromLocation: Types.ObjectId;
9
+ fromLocationPath?: {
10
+ rackId?: Types.ObjectId;
11
+ shelfId?: Types.ObjectId;
12
+ binId?: Types.ObjectId;
13
+ };
14
+ toLocation: Types.ObjectId;
15
+ toLocationPath?: {
16
+ rackId?: Types.ObjectId;
17
+ shelfId?: Types.ObjectId;
18
+ binId?: Types.ObjectId;
19
+ };
20
+ quantity?: number;
21
+ }
22
+
23
+ /**
24
+ * Inventory transfer - records movement of inventory between locations
25
+ * Supports both single and bulk transfers
26
+ */
27
+ export interface IInventoryTransfer {
28
+ _id: Types.ObjectId;
29
+ // Single transfer fields (backward compatibility)
30
+ itemId?: Types.ObjectId; // Reference to InventoryItem
31
+ fromLocation?: Types.ObjectId; // Reference to Location
32
+ fromLocationPath?: {
33
+ rackId?: Types.ObjectId;
34
+ shelfId?: Types.ObjectId;
35
+ binId?: Types.ObjectId;
36
+ };
37
+ toLocation?: Types.ObjectId; // Reference to Location
38
+ toLocationPath?: {
39
+ rackId?: Types.ObjectId;
40
+ shelfId?: Types.ObjectId;
41
+ binId?: Types.ObjectId;
42
+ };
43
+ quantity?: number; // Optional: if only transferring part of the item
44
+
45
+ // Bulk transfer fields
46
+ items?: ITransferItem[]; // For bulk transfers
47
+ isBulk?: boolean; // Flag to indicate bulk transfer
48
+
49
+ notes?: string;
50
+ status: "pending" | "completed" | "cancelled";
51
+ initiatedBy: Types.ObjectId; // Reference to User
52
+ completedBy?: Types.ObjectId; // Reference to User
53
+ completedAt?: Date;
54
+ createdAt: Date;
55
+ updatedAt: Date;
56
+ }
57
+
58
+ export type IInventoryTransferDocument = IInventoryTransfer & Document;
59
+
60
+ /**
61
+ * Count session item - tracks counting of a single inventory item
62
+ */
63
+ export interface ICountSessionItem {
64
+ itemId: Types.ObjectId; // Reference to InventoryItem
65
+ expectedLocation?: Types.ObjectId;
66
+ expectedLocationPath?: {
67
+ rackId?: Types.ObjectId;
68
+ shelfId?: Types.ObjectId;
69
+ binId?: Types.ObjectId;
70
+ };
71
+ actualLocation?: Types.ObjectId;
72
+ actualLocationPath?: {
73
+ rackId?: Types.ObjectId;
74
+ shelfId?: Types.ObjectId;
75
+ binId?: Types.ObjectId;
76
+ };
77
+ expectedQuantity?: number;
78
+ countedQuantity?: number;
79
+ status: "pending" | "counted" | "discrepancy" | "resolved";
80
+ scannedAt?: Date;
81
+ notes?: string;
82
+ }
83
+
84
+ /**
85
+ * Inventory counting session - guides users through rack-by-rack counting
86
+ */
87
+ export interface IInventoryCountSession {
88
+ _id: Types.ObjectId;
89
+ name: string;
90
+ locationId: Types.ObjectId; // Reference to Location
91
+ racks: Types.ObjectId[]; // Array of rack IDs to count
92
+ shelves?: Types.ObjectId[]; // Optional: Array of shelf IDs for granular counting
93
+ bins?: Types.ObjectId[]; // Optional: Array of bin IDs for most granular counting
94
+ currentRackIndex: number; // Which rack we're currently counting
95
+ currentRackId?: Types.ObjectId;
96
+ items: ICountSessionItem[];
97
+ totalExpectedItems: number;
98
+ status: "not_started" | "in_progress" | "completed" | "cancelled";
99
+ startedBy: Types.ObjectId; // Reference to User
100
+ startedAt?: Date;
101
+ completedBy?: Types.ObjectId;
102
+ completedAt?: Date;
103
+ notes?: string;
104
+ createdAt: Date;
105
+ updatedAt: Date;
106
+ }
107
+
108
+ export type IInventoryCountSessionDocument = IInventoryCountSession & Document;
@@ -19,18 +19,28 @@ export interface ILocationComponentBase {
19
19
  export interface IBin extends ILocationComponentBase {
20
20
  capacity?: number;
21
21
  currentStock?: number;
22
+ // For merged bins: array of bin IDs that are merged into one logical bin
23
+ mergedWith?: Types.ObjectId[];
24
+ // If this bin is merged into another, reference the primary bin
25
+ mergedInto?: Types.ObjectId;
26
+ // Array of inventory type IDs that can be stored in this bin
27
+ allowedInventoryTypes?: Types.ObjectId[];
22
28
  }
23
29
 
24
30
  export interface IShelf extends ILocationComponentBase {
25
31
  bins: IBin[];
26
32
  capacity?: number;
27
33
  currentStock?: number;
34
+ // Array of inventory type IDs that can be stored in this shelf
35
+ allowedInventoryTypes?: Types.ObjectId[];
28
36
  }
29
37
 
30
38
  export interface IRack extends ILocationComponentBase {
31
39
  shelves: IShelf[];
32
40
  capacity?: number;
33
41
  currentStock?: number;
42
+ // Array of inventory type IDs that can be stored in this rack
43
+ allowedInventoryTypes?: Types.ObjectId[];
34
44
  }
35
45
 
36
46
  export interface ILocationMethods {
@@ -48,6 +58,8 @@ export interface ILocation extends Omit<Document, '_id'>, ILocationComponentBase
48
58
  capacity?: number;
49
59
  currentStock?: number;
50
60
  isActive: boolean;
61
+ // Array of inventory type IDs that can be stored in this location
62
+ allowedInventoryTypes?: Types.ObjectId[];
51
63
  }
52
64
 
53
65
  export interface ILocationPath {
@@ -0,0 +1,29 @@
1
+ import { Document, Types } from "mongoose";
2
+
3
+ /**
4
+ * Select field definition option
5
+ */
6
+ export interface ISelectOption {
7
+ key: string; // Unique key for the option (e.g., "4_4_MAPLE")
8
+ value: string; // Display value (e.g., "4/4 Maple")
9
+ }
10
+
11
+ /**
12
+ * Source type for select field data
13
+ */
14
+ export type SelectFieldSource = "table";
15
+
16
+ /**
17
+ * Select field definition - defines a reusable select field with its options
18
+ */
19
+ export interface ISelectFieldDefinition {
20
+ _id: Types.ObjectId;
21
+ name: string; // Display name (e.g., "Material Types", "Finish Options")
22
+ description?: string;
23
+ source: SelectFieldSource; // Where the data comes from
24
+ options: ISelectOption[]; // Options array
25
+ createdAt: Date;
26
+ updatedAt: Date;
27
+ }
28
+
29
+ export type ISelectFieldDefinitionDocument = ISelectFieldDefinition & Document;
package/src/index.ts CHANGED
@@ -30,5 +30,9 @@ export * from "./Classes/IRoute";
30
30
  export * from "./IApplication";
31
31
  export * from "./IQualityControl";
32
32
  export * from "./Inventory/ILocation";
33
+ export * from "./Inventory/ISelectFieldDefinition";
34
+ export * from "./Inventory/IInventoryTransfer";
33
35
  export * from "./IInventory";
34
36
  export * from "./ISupplier";
37
+ export * from "./ISchedule";
38
+ export * from "./IAutomation";
@@ -1,75 +0,0 @@
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 { Document, Model, Types } from "mongoose";
26
- /**
27
- * Base interface for location components with common fields
28
- */
29
- export interface ILocationComponentBase {
30
- _id: Types.ObjectId;
31
- name: string;
32
- code: string;
33
- status: number;
34
- createdBy: string;
35
- createdById: number;
36
- createdDate: Date;
37
- updatedBy: string;
38
- updatedById: number;
39
- updatedDate: Date;
40
- }
41
- export interface IBin extends ILocationComponentBase {
42
- capacity?: number;
43
- currentStock?: number;
44
- }
45
- export interface IShelf extends ILocationComponentBase {
46
- bins: IBin[];
47
- capacity?: number;
48
- currentStock?: number;
49
- }
50
- export interface IRack extends ILocationComponentBase {
51
- shelves: IShelf[];
52
- capacity?: number;
53
- currentStock?: number;
54
- }
55
- export interface ILocationMethods {
56
- generateUniqueCode(prefix: string): Promise<string>;
57
- }
58
- export interface ILocationModel extends Model<ILocation, {}, ILocationMethods> {
59
- generateUniqueCode(prefix: string): Promise<string>;
60
- }
61
- export interface ILocation extends Omit<Document, '_id'>, ILocationComponentBase {
62
- type: "warehouse" | "shed" | "other";
63
- description?: string;
64
- racks: IRack[];
65
- capacity?: number;
66
- currentStock?: number;
67
- isActive: boolean;
68
- }
69
- export interface ILocationPath {
70
- locationId: Types.ObjectId;
71
- rackId?: Types.ObjectId;
72
- shelfId?: Types.ObjectId;
73
- binId?: Types.ObjectId;
74
- path: string;
75
- }
File without changes
File without changes