@managesome/eposmatic-toolkit 0.2.769 → 0.2.771

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 (57) hide show
  1. package/lib/helpers/utils/receipt-engine.js +10 -2
  2. package/lib/tests/classic-specials-quantity.test.js +7 -4
  3. package/lib/tests/receipt-engine.test.js +79 -0
  4. package/package.json +1 -1
  5. package/lib/constants/MATERIALIZED_REPORTS.d.ts +0 -44
  6. package/lib/constants/MATERIALIZED_REPORTS.js +0 -58
  7. package/lib/constants/WAREHOUSE_INVOICE.d.ts +0 -14
  8. package/lib/constants/WAREHOUSE_INVOICE.js +0 -35
  9. package/lib/helpers/offer/generate-offer.d.ts +0 -11
  10. package/lib/helpers/offer/generate-offer.js +0 -143
  11. package/lib/helpers/offer/index.d.ts +0 -1
  12. package/lib/helpers/offer/index.js +0 -17
  13. package/lib/helpers/order/generate-warehouse-invoice.d.ts +0 -11
  14. package/lib/helpers/order/generate-warehouse-invoice.js +0 -196
  15. package/lib/helpers/store/all-warehouse-invoice-actions.d.ts +0 -13
  16. package/lib/helpers/store/all-warehouse-invoice-actions.js +0 -58
  17. package/lib/helpers/store/common-warehouse-invoice-actions.d.ts +0 -31
  18. package/lib/helpers/store/common-warehouse-invoice-actions.js +0 -545
  19. package/lib/helpers/store/warehouse-invoice-cart-actions.d.ts +0 -24
  20. package/lib/helpers/store/warehouse-invoice-cart-actions.js +0 -486
  21. package/lib/helpers/types/sockets.d.ts +0 -6
  22. package/lib/helpers/types/sockets.js +0 -2
  23. package/lib/helpers/types/warehouse-invoice-cart-actions.d.ts +0 -26
  24. package/lib/helpers/types/warehouse-invoice-cart-actions.js +0 -2
  25. package/lib/helpers/utils/materialized-report-helpers.d.ts +0 -35
  26. package/lib/helpers/utils/materialized-report-helpers.js +0 -73
  27. package/lib/helpers/utils/void-warehouse-invoice-items-helpers.d.ts +0 -3
  28. package/lib/helpers/utils/void-warehouse-invoice-items-helpers.js +0 -38
  29. package/lib/helpers/utils/void-warehouse-invoice-items-report-helpers.d.ts +0 -13
  30. package/lib/helpers/utils/void-warehouse-invoice-items-report-helpers.js +0 -22
  31. package/lib/helpers/utils/warehouse-invoice-order-engine.d.ts +0 -11
  32. package/lib/helpers/utils/warehouse-invoice-order-engine.js +0 -39
  33. package/lib/helpers/utils/warehouse-invoice-x-report-helpers.d.ts +0 -58
  34. package/lib/helpers/utils/warehouse-invoice-x-report-helpers.js +0 -1432
  35. package/lib/schemas/models/inventory_department_transactions.d.ts +0 -86
  36. package/lib/schemas/models/inventory_department_transactions.js +0 -116
  37. package/lib/schemas/models/inventory_department_utilities.d.ts +0 -108
  38. package/lib/schemas/models/inventory_department_utilities.js +0 -88
  39. package/lib/schemas/models/inventory_departments.d.ts +0 -53
  40. package/lib/schemas/models/inventory_departments.js +0 -58
  41. package/lib/schemas/models/inventory_entries.d.ts +0 -152
  42. package/lib/schemas/models/inventory_entries.js +0 -142
  43. package/lib/schemas/models/materialized_reports.d.ts +0 -277
  44. package/lib/schemas/models/materialized_reports.js +0 -60
  45. package/lib/schemas/models/warehouse_invoices.d.ts +0 -2675
  46. package/lib/schemas/models/warehouse_invoices.js +0 -327
  47. package/lib/schemas/models/warehouse_void_invoice_items.d.ts +0 -176
  48. package/lib/schemas/models/warehouse_void_invoice_items.js +0 -176
  49. package/lib/schemas/types/inventory_entries.d.ts +0 -41
  50. package/lib/schemas/types/inventory_entries.js +0 -2
  51. package/lib/schemas/types/materialized_reports.d.ts +0 -82
  52. package/lib/schemas/types/materialized_reports.js +0 -2
  53. package/lib/schemas/types/warehouse_invoices.d.ts +0 -69
  54. package/lib/schemas/types/warehouse_invoices.js +0 -2
  55. package/lib/schemas/types/warehouse_void_invoice_items.d.ts +0 -37
  56. package/lib/schemas/types/warehouse_void_invoice_items.js +0 -2
  57. package/lib/tests/materialized-report-helpers.test.d.ts +0 -1
@@ -1,142 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.INVENTORY_ENTRIES_COLLECTION_NAME = exports.InventoryEntrySchema = void 0;
4
- const mongoose_1 = require("mongoose");
5
- const constants_1 = require("../../constants");
6
- const InventoryEntryActorSchema = new mongoose_1.Schema({
7
- _id: {
8
- type: String,
9
- required: true,
10
- },
11
- name: {
12
- type: String,
13
- required: true,
14
- default: '',
15
- },
16
- }, {
17
- _id: false,
18
- minimize: false,
19
- });
20
- const InventoryEntryItemSchema = new mongoose_1.Schema({
21
- _id: {
22
- type: mongoose_1.Schema.Types.ObjectId,
23
- required: true,
24
- immutable: true,
25
- },
26
- inventory_code: {
27
- type: String,
28
- required: true,
29
- trim: true,
30
- },
31
- inventory_name: {
32
- type: String,
33
- required: true,
34
- },
35
- unit: {
36
- type: String,
37
- enum: constants_1.ALL_INVENTORY_UNIT_TYPES,
38
- required: true,
39
- },
40
- transaction_type: {
41
- type: String,
42
- enum: constants_1.ALL_INVENTORY_TRANSACTION_TYPES,
43
- required: true,
44
- },
45
- transaction_quantity: {
46
- type: Number,
47
- min: 0,
48
- required: true,
49
- },
50
- stock_price: {
51
- type: Number,
52
- min: 0,
53
- required: false,
54
- },
55
- preparation: {
56
- type: mongoose_1.Schema.Types.Mixed,
57
- required: false,
58
- default: null,
59
- },
60
- }, {
61
- _id: false,
62
- minimize: false,
63
- });
64
- exports.InventoryEntrySchema = new mongoose_1.Schema({
65
- _id: {
66
- type: mongoose_1.Schema.Types.ObjectId,
67
- required: true,
68
- immutable: true,
69
- },
70
- ref_id: {
71
- type: String,
72
- required: true,
73
- trim: true,
74
- immutable: true,
75
- },
76
- ref_type: {
77
- type: String,
78
- enum: constants_1.ALL_WAREHOUSE_REF_TYPE_NAMES,
79
- required: true,
80
- immutable: true,
81
- },
82
- department_code: {
83
- type: String,
84
- required: false,
85
- default: null,
86
- immutable: true,
87
- ref: 'tenant_inventory_departments',
88
- },
89
- doc_number: {
90
- type: String,
91
- required: true,
92
- trim: true,
93
- immutable: true,
94
- },
95
- transaction_category: {
96
- type: String,
97
- enum: constants_1.ALL_INVENTORY_TRANSACTION_CATEGORIES,
98
- required: true,
99
- immutable: true,
100
- },
101
- description: {
102
- type: String,
103
- required: false,
104
- },
105
- items: {
106
- type: [InventoryEntryItemSchema],
107
- required: true,
108
- default: [],
109
- },
110
- total_items: {
111
- type: Number,
112
- min: 0,
113
- required: true,
114
- default: 0,
115
- },
116
- total_stock_price: {
117
- type: Number,
118
- min: 0,
119
- required: true,
120
- default: 0,
121
- },
122
- created_by: {
123
- type: InventoryEntryActorSchema,
124
- required: true,
125
- },
126
- createdAt: {
127
- type: mongoose_1.Schema.Types.Date,
128
- required: true,
129
- default: () => new Date(),
130
- immutable: true,
131
- },
132
- updatedAt: {
133
- type: mongoose_1.Schema.Types.Date,
134
- required: true,
135
- default: () => new Date(),
136
- },
137
- }, {
138
- timestamps: true,
139
- versionKey: false,
140
- minimize: false,
141
- });
142
- exports.INVENTORY_ENTRIES_COLLECTION_NAME = 'inventory_entries';
@@ -1,277 +0,0 @@
1
- import { Schema } from 'mongoose';
2
- export declare const TenantSalesOverviewReportSchema: Schema<any, import("mongoose").Model<any, any, any, any, any, any>, {}, {}, {}, {}, {
3
- timestamps: true;
4
- versionKey: false;
5
- minimize: false;
6
- }, {
7
- createdAt: NativeDate;
8
- updatedAt: NativeDate;
9
- } & {
10
- localDate: string;
11
- localWeek: number;
12
- localMonth: number;
13
- localQuarter: number;
14
- localSemester: number;
15
- localYear: number;
16
- _id: import("mongoose").Types.ObjectId;
17
- tenant_id: string;
18
- createdAt: NativeDate;
19
- updatedAt: NativeDate;
20
- last_order_at: NativeDate;
21
- localDay: number;
22
- amount_collected: number;
23
- day_index: import("../../constants").DAY_INDEX_ENUM;
24
- localSecond: number;
25
- localMinute: number;
26
- localHour: number;
27
- localWeekOfYear: number;
28
- localTime: string;
29
- localDayOfYear: number;
30
- complimentary_amount: number;
31
- unpaid_amount: number;
32
- net_sales: number;
33
- covers: number;
34
- query_field: import("../../constants").REPORT_QUERY_FIELD_ENUM;
35
- period_start_local_date: string;
36
- period_end_local_date: string;
37
- total_sales: {
38
- count: number;
39
- _id: string;
40
- grossAmount: number;
41
- };
42
- cancelled_orders: {
43
- count: number;
44
- _id: string;
45
- grossAmount: number;
46
- };
47
- total_payment_sales: import("mongoose").Types.DocumentArray<{
48
- count: number;
49
- _id: string;
50
- grossAmount: number;
51
- }, import("mongoose").Types.Subdocument<string, any, {
52
- count: number;
53
- _id: string;
54
- grossAmount: number;
55
- }> & {
56
- count: number;
57
- _id: string;
58
- grossAmount: number;
59
- }>;
60
- sales_by_platform: import("mongoose").Types.DocumentArray<{
61
- count: number;
62
- _id: string;
63
- grossAmount: number;
64
- }, import("mongoose").Types.Subdocument<string, any, {
65
- count: number;
66
- _id: string;
67
- grossAmount: number;
68
- }> & {
69
- count: number;
70
- _id: string;
71
- grossAmount: number;
72
- }>;
73
- average_order_value: number;
74
- first_order_at: NativeDate;
75
- compiled_at: NativeDate;
76
- compile_source: import("../../constants").MATERIALIZE_SOURCE_ENUM;
77
- }, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
78
- createdAt: NativeDate;
79
- updatedAt: NativeDate;
80
- } & {
81
- localDate: string;
82
- localWeek: number;
83
- localMonth: number;
84
- localQuarter: number;
85
- localSemester: number;
86
- localYear: number;
87
- _id: import("mongoose").Types.ObjectId;
88
- tenant_id: string;
89
- createdAt: NativeDate;
90
- updatedAt: NativeDate;
91
- last_order_at: NativeDate;
92
- localDay: number;
93
- amount_collected: number;
94
- day_index: import("../../constants").DAY_INDEX_ENUM;
95
- localSecond: number;
96
- localMinute: number;
97
- localHour: number;
98
- localWeekOfYear: number;
99
- localTime: string;
100
- localDayOfYear: number;
101
- complimentary_amount: number;
102
- unpaid_amount: number;
103
- net_sales: number;
104
- covers: number;
105
- query_field: import("../../constants").REPORT_QUERY_FIELD_ENUM;
106
- period_start_local_date: string;
107
- period_end_local_date: string;
108
- total_sales: {
109
- count: number;
110
- _id: string;
111
- grossAmount: number;
112
- };
113
- cancelled_orders: {
114
- count: number;
115
- _id: string;
116
- grossAmount: number;
117
- };
118
- total_payment_sales: import("mongoose").Types.DocumentArray<{
119
- count: number;
120
- _id: string;
121
- grossAmount: number;
122
- }, import("mongoose").Types.Subdocument<string, any, {
123
- count: number;
124
- _id: string;
125
- grossAmount: number;
126
- }> & {
127
- count: number;
128
- _id: string;
129
- grossAmount: number;
130
- }>;
131
- sales_by_platform: import("mongoose").Types.DocumentArray<{
132
- count: number;
133
- _id: string;
134
- grossAmount: number;
135
- }, import("mongoose").Types.Subdocument<string, any, {
136
- count: number;
137
- _id: string;
138
- grossAmount: number;
139
- }> & {
140
- count: number;
141
- _id: string;
142
- grossAmount: number;
143
- }>;
144
- average_order_value: number;
145
- first_order_at: NativeDate;
146
- compiled_at: NativeDate;
147
- compile_source: import("../../constants").MATERIALIZE_SOURCE_ENUM;
148
- }>> & import("mongoose").FlatRecord<{
149
- createdAt: NativeDate;
150
- updatedAt: NativeDate;
151
- } & {
152
- localDate: string;
153
- localWeek: number;
154
- localMonth: number;
155
- localQuarter: number;
156
- localSemester: number;
157
- localYear: number;
158
- _id: import("mongoose").Types.ObjectId;
159
- tenant_id: string;
160
- createdAt: NativeDate;
161
- updatedAt: NativeDate;
162
- last_order_at: NativeDate;
163
- localDay: number;
164
- amount_collected: number;
165
- day_index: import("../../constants").DAY_INDEX_ENUM;
166
- localSecond: number;
167
- localMinute: number;
168
- localHour: number;
169
- localWeekOfYear: number;
170
- localTime: string;
171
- localDayOfYear: number;
172
- complimentary_amount: number;
173
- unpaid_amount: number;
174
- net_sales: number;
175
- covers: number;
176
- query_field: import("../../constants").REPORT_QUERY_FIELD_ENUM;
177
- period_start_local_date: string;
178
- period_end_local_date: string;
179
- total_sales: {
180
- count: number;
181
- _id: string;
182
- grossAmount: number;
183
- };
184
- cancelled_orders: {
185
- count: number;
186
- _id: string;
187
- grossAmount: number;
188
- };
189
- total_payment_sales: import("mongoose").Types.DocumentArray<{
190
- count: number;
191
- _id: string;
192
- grossAmount: number;
193
- }, import("mongoose").Types.Subdocument<string, any, {
194
- count: number;
195
- _id: string;
196
- grossAmount: number;
197
- }> & {
198
- count: number;
199
- _id: string;
200
- grossAmount: number;
201
- }>;
202
- sales_by_platform: import("mongoose").Types.DocumentArray<{
203
- count: number;
204
- _id: string;
205
- grossAmount: number;
206
- }, import("mongoose").Types.Subdocument<string, any, {
207
- count: number;
208
- _id: string;
209
- grossAmount: number;
210
- }> & {
211
- count: number;
212
- _id: string;
213
- grossAmount: number;
214
- }>;
215
- average_order_value: number;
216
- first_order_at: NativeDate;
217
- compiled_at: NativeDate;
218
- compile_source: import("../../constants").MATERIALIZE_SOURCE_ENUM;
219
- }> & Required<{
220
- _id: import("mongoose").Types.ObjectId;
221
- }> & {
222
- __v: number;
223
- }>;
224
- export declare const TenantProcessesSchema: Schema<any, import("mongoose").Model<any, any, any, any, any, any>, {}, {}, {}, {}, {
225
- timestamps: true;
226
- versionKey: false;
227
- minimize: false;
228
- }, {
229
- createdAt: NativeDate;
230
- updatedAt: NativeDate;
231
- } & {
232
- localDate: string;
233
- _id: import("mongoose").Types.ObjectId;
234
- tenant_id: string;
235
- createdAt: NativeDate;
236
- updatedAt: NativeDate;
237
- completed_at: NativeDate;
238
- running_process: import("../../constants").TENANT_PROCESS_ENUM;
239
- total_processes: number;
240
- current_process: number;
241
- completed_processes: any;
242
- started_at: NativeDate;
243
- }, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
244
- createdAt: NativeDate;
245
- updatedAt: NativeDate;
246
- } & {
247
- localDate: string;
248
- _id: import("mongoose").Types.ObjectId;
249
- tenant_id: string;
250
- createdAt: NativeDate;
251
- updatedAt: NativeDate;
252
- completed_at: NativeDate;
253
- running_process: import("../../constants").TENANT_PROCESS_ENUM;
254
- total_processes: number;
255
- current_process: number;
256
- completed_processes: any;
257
- started_at: NativeDate;
258
- }>> & import("mongoose").FlatRecord<{
259
- createdAt: NativeDate;
260
- updatedAt: NativeDate;
261
- } & {
262
- localDate: string;
263
- _id: import("mongoose").Types.ObjectId;
264
- tenant_id: string;
265
- createdAt: NativeDate;
266
- updatedAt: NativeDate;
267
- completed_at: NativeDate;
268
- running_process: import("../../constants").TENANT_PROCESS_ENUM;
269
- total_processes: number;
270
- current_process: number;
271
- completed_processes: any;
272
- started_at: NativeDate;
273
- }> & Required<{
274
- _id: import("mongoose").Types.ObjectId;
275
- }> & {
276
- __v: number;
277
- }>;
@@ -1,60 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TenantProcessesSchema = exports.TenantSalesOverviewReportSchema = void 0;
4
- const mongoose_1 = require("mongoose");
5
- const constants_1 = require("../../constants");
6
- const common_models_1 = require("./common-models");
7
- const SalesOverviewBucketSchema = new mongoose_1.Schema({
8
- _id: { type: String, required: true },
9
- count: { type: Number, required: true, min: 0 },
10
- grossAmount: { type: Number, required: true },
11
- }, { _id: false, minimize: false });
12
- exports.TenantSalesOverviewReportSchema = new mongoose_1.Schema({
13
- _id: { type: mongoose_1.Schema.Types.ObjectId, required: true, immutable: true },
14
- tenant_id: { type: String, required: true, immutable: true, ref: 'tenants' },
15
- query_field: { type: String, enum: constants_1.ALL_REPORT_QUERY_FIELDS, required: true, immutable: true },
16
- period_start_local_date: { type: String, required: true, immutable: true },
17
- period_end_local_date: { type: String, required: true, immutable: true },
18
- total_sales: { type: SalesOverviewBucketSchema, required: true },
19
- cancelled_orders: { type: SalesOverviewBucketSchema, required: true },
20
- total_payment_sales: { type: [SalesOverviewBucketSchema], required: true, default: [] },
21
- sales_by_platform: { type: [SalesOverviewBucketSchema], required: true, default: [] },
22
- complimentary_amount: { type: Number, required: true, default: 0 },
23
- unpaid_amount: { type: Number, required: true, default: 0 },
24
- amount_collected: { type: Number, required: true, default: 0 },
25
- net_sales: { type: Number, required: true, default: 0 },
26
- average_order_value: { type: Number, required: true, default: 0 },
27
- covers: { type: Number, required: true, default: 0 },
28
- first_order_at: { type: mongoose_1.Schema.Types.Date, required: true, default: null },
29
- last_order_at: { type: mongoose_1.Schema.Types.Date, required: true, default: null },
30
- compiled_at: { type: mongoose_1.Schema.Types.Date, required: true, default: () => new Date() },
31
- compile_source: { type: String, enum: constants_1.ALL_MATERIALIZE_SOURCES, required: true },
32
- ...common_models_1.LocalTimeFieldsSchema,
33
- createdAt: { type: mongoose_1.Schema.Types.Date, required: true, default: () => new Date(), immutable: true },
34
- updatedAt: { type: mongoose_1.Schema.Types.Date, required: true, default: () => new Date() },
35
- }, { timestamps: true, versionKey: false, minimize: false });
36
- // Partial unique indexes — one per query_field so targeted queries hit a dedicated index.
37
- exports.TenantSalesOverviewReportSchema.index({ tenant_id: 1, localDate: 1 }, { unique: true, partialFilterExpression: { query_field: 'localDate' }, name: 'tenant_sales_overview_report_localDate' });
38
- exports.TenantSalesOverviewReportSchema.index({ tenant_id: 1, localYear: 1, localWeekOfYear: 1 }, { unique: true, partialFilterExpression: { query_field: 'localWeek' }, name: 'tenant_sales_overview_report_localWeek' });
39
- exports.TenantSalesOverviewReportSchema.index({ tenant_id: 1, localYear: 1, localMonth: 1 }, { unique: true, partialFilterExpression: { query_field: 'localMonth' }, name: 'tenant_sales_overview_report_localMonth' });
40
- exports.TenantSalesOverviewReportSchema.index({ tenant_id: 1, localYear: 1, localQuarter: 1 }, { unique: true, partialFilterExpression: { query_field: 'localQuarter' }, name: 'tenant_sales_overview_report_localQuarter' });
41
- exports.TenantSalesOverviewReportSchema.index({ tenant_id: 1, localYear: 1, localSemester: 1 }, { unique: true, partialFilterExpression: { query_field: 'localSemester' }, name: 'tenant_sales_overview_report_localSemester' });
42
- exports.TenantSalesOverviewReportSchema.index({ tenant_id: 1, localYear: 1 }, { unique: true, partialFilterExpression: { query_field: 'localYear' }, name: 'tenant_sales_overview_report_localYear' });
43
- exports.TenantProcessesSchema = new mongoose_1.Schema({
44
- _id: { type: mongoose_1.Schema.Types.ObjectId, required: true, immutable: true },
45
- tenant_id: { type: String, required: true, immutable: true, ref: 'tenants' },
46
- localDate: { type: String, required: true },
47
- running_process: { type: String, enum: constants_1.ALL_TENANT_PROCESSES, default: null },
48
- total_processes: { type: Number, required: true, default: 0 },
49
- current_process: { type: Number, required: true, default: 0 },
50
- completed_processes: {
51
- type: Object,
52
- required: true,
53
- default: () => Object.fromEntries(constants_1.ALL_TENANT_PROCESSES.map((p) => [p, false])),
54
- },
55
- started_at: { type: mongoose_1.Schema.Types.Date, default: null },
56
- completed_at: { type: mongoose_1.Schema.Types.Date, default: null },
57
- createdAt: { type: mongoose_1.Schema.Types.Date, required: true, default: () => new Date(), immutable: true },
58
- updatedAt: { type: mongoose_1.Schema.Types.Date, required: true, default: () => new Date() },
59
- }, { timestamps: true, versionKey: false, minimize: false });
60
- exports.TenantProcessesSchema.index({ tenant_id: 1 }, { unique: true, name: 'tenant_processes_tenant_id' });