qeai-sdk 2.1.5 → 2.1.7

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 (32) hide show
  1. package/dist/constants/index.d.ts +1 -0
  2. package/dist/constants/index.js +2 -0
  3. package/dist/constants/inventory-events.constant.d.ts +24 -0
  4. package/dist/constants/inventory-events.constant.js +24 -0
  5. package/dist/dtos/inventory/confirm-order-item.dto.d.ts +12 -0
  6. package/dist/dtos/inventory/confirm-order-item.dto.js +11 -0
  7. package/dist/dtos/inventory/confirm-order.dto.d.ts +17 -0
  8. package/dist/dtos/inventory/confirm-order.dto.js +16 -0
  9. package/dist/dtos/inventory/index.d.ts +2 -0
  10. package/dist/dtos/inventory/index.js +2 -0
  11. package/dist/dtos/orders/change-order-status.dto.d.ts +21 -2
  12. package/dist/dtos/orders/change-order-status.dto.js +39 -7
  13. package/dist/dtos/orders/create-order.dto.d.ts +10 -2
  14. package/dist/dtos/orders/create-order.dto.js +33 -17
  15. package/dist/dtos/products/create-product.dto.d.ts +10 -0
  16. package/dist/dtos/products/create-product.dto.js +18 -0
  17. package/dist/interfaces/orders/order-item.interface.d.ts +2 -0
  18. package/dist/interfaces/orders/order.interface.d.ts +1 -0
  19. package/dist/interfaces/products/product.interface.d.ts +7 -5
  20. package/dist/interfaces/products/response/sub-resources/find-product-recipes-by-product-id-response.interface.dto.d.ts +5 -0
  21. package/dist/interfaces/products/response/sub-resources/find-product-recipes-by-product-id-response.interface.dto.js +1 -0
  22. package/dist/interfaces/products/response/sub-resources/index.d.ts +1 -0
  23. package/dist/interfaces/products/response/sub-resources/index.js +1 -0
  24. package/dist/types/index.d.ts +3 -0
  25. package/dist/types/index.js +3 -0
  26. package/dist/types/ingredient-consumption.type.d.ts +1 -0
  27. package/dist/types/ingredient-consumption.type.js +1 -0
  28. package/dist/types/recipe-by-product.type.d.ts +2 -0
  29. package/dist/types/recipe-by-product.type.js +1 -0
  30. package/dist/types/stock-mode.type.d.ts +21 -0
  31. package/dist/types/stock-mode.type.js +13 -0
  32. package/package.json +1 -1
@@ -30,3 +30,4 @@ export * from "./tag-commands.constant.js";
30
30
  export * from "./translation-commands.constant.js";
31
31
  export * from "./services-config.constant.js";
32
32
  export * from "./inventory-commands.constant.js";
33
+ export * from "./inventory-events.constant.js";
@@ -43,3 +43,5 @@ export * from "./translation-commands.constant.js";
43
43
  export * from "./services-config.constant.js";
44
44
  // Inventory commands
45
45
  export * from "./inventory-commands.constant.js";
46
+ // Inventory events
47
+ export * from "./inventory-events.constant.js";
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Inventory-related event subjects.
3
+ *
4
+ * Centralized constant containing all event subject names
5
+ * that represent domain events emitted by the Inventory microservice.
6
+ *
7
+ * These event subjects are used across the distributed system (e.g., via message bus)
8
+ * to notify other services or subsystems when significant inventory-related actions occur,
9
+ * such as stock reservation, decrement, replenishment, or movements triggered by order states.
10
+ *
11
+ * Usage examples:
12
+ * - INVENTORY_EVENTS.STOCK_RESERVED: Emitted when stock is reserved for an order.
13
+ * - INVENTORY_EVENTS.STOCK_DECREMENTED: Emitted when stock is decremented after order confirmation.
14
+ * - INVENTORY_EVENTS.STOCK_REPLENISHED: Emitted when stock is returned (e.g., order canceled).
15
+ * - INVENTORY_EVENTS.ORDER_CONFIRMED: Emitted when an order is confirmed for inventory synchronization.
16
+ *
17
+ * Keeping these values centralized ensures consistency, discoverability, and maintainability.
18
+ *
19
+ * @since 2.0.0
20
+ */
21
+ export declare const INVENTORY_EVENTS: {
22
+ /** Emitted when an order is confirmed, for inventory updates */
23
+ readonly ORDER_CONFIRMED: "inventory.order-confirmed";
24
+ };
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Inventory-related event subjects.
3
+ *
4
+ * Centralized constant containing all event subject names
5
+ * that represent domain events emitted by the Inventory microservice.
6
+ *
7
+ * These event subjects are used across the distributed system (e.g., via message bus)
8
+ * to notify other services or subsystems when significant inventory-related actions occur,
9
+ * such as stock reservation, decrement, replenishment, or movements triggered by order states.
10
+ *
11
+ * Usage examples:
12
+ * - INVENTORY_EVENTS.STOCK_RESERVED: Emitted when stock is reserved for an order.
13
+ * - INVENTORY_EVENTS.STOCK_DECREMENTED: Emitted when stock is decremented after order confirmation.
14
+ * - INVENTORY_EVENTS.STOCK_REPLENISHED: Emitted when stock is returned (e.g., order canceled).
15
+ * - INVENTORY_EVENTS.ORDER_CONFIRMED: Emitted when an order is confirmed for inventory synchronization.
16
+ *
17
+ * Keeping these values centralized ensures consistency, discoverability, and maintainability.
18
+ *
19
+ * @since 2.0.0
20
+ */
21
+ export const INVENTORY_EVENTS = {
22
+ /** Emitted when an order is confirmed, for inventory updates */
23
+ ORDER_CONFIRMED: "inventory.order-confirmed",
24
+ };
@@ -0,0 +1,12 @@
1
+ import { StockMode } from "../../types/index.js";
2
+ /**
3
+ * Represents an item inside the order to be confirmed by inventory.
4
+ *
5
+ * @class ConfirmOrderItemDtoOrderItem
6
+ * @since 2.0.0
7
+ */
8
+ export declare class ConfirmOrderItemDto {
9
+ itemId: string;
10
+ quantity: number;
11
+ stockMode: StockMode;
12
+ }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Represents an item inside the order to be confirmed by inventory.
3
+ *
4
+ * @class ConfirmOrderItemDtoOrderItem
5
+ * @since 2.0.0
6
+ */
7
+ export class ConfirmOrderItemDto {
8
+ itemId;
9
+ quantity;
10
+ stockMode;
11
+ }
@@ -0,0 +1,17 @@
1
+ import { ConfirmOrderItemDto } from "./confirm-order-item.dto";
2
+ /**
3
+ * Data Transfer Object for confirming inventory for order items in QeHay.
4
+ *
5
+ * This DTO is used by the inventory service to confirm stock reservation or movement
6
+ * for a set of order items, typically after the order has been processed or paid.
7
+ * Includes all required references and the actor responsible for the request.
8
+ *
9
+ * @class ConfirmOrderItemDto
10
+ * @since 2.0.0
11
+ */
12
+ export declare class ConfirmOrderDto {
13
+ restaurantId: string;
14
+ orderId: string;
15
+ items: ConfirmOrderItemDto[];
16
+ actor: string;
17
+ }
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Data Transfer Object for confirming inventory for order items in QeHay.
3
+ *
4
+ * This DTO is used by the inventory service to confirm stock reservation or movement
5
+ * for a set of order items, typically after the order has been processed or paid.
6
+ * Includes all required references and the actor responsible for the request.
7
+ *
8
+ * @class ConfirmOrderItemDto
9
+ * @since 2.0.0
10
+ */
11
+ export class ConfirmOrderDto {
12
+ restaurantId;
13
+ orderId;
14
+ items;
15
+ actor = "ms:orders-ms";
16
+ }
@@ -2,3 +2,5 @@ export * from "./adjust-ingredient-inventory.dto.js";
2
2
  export * from "./set-ingredient-inventory.dto.js";
3
3
  export * from "./get-ingredient-inventory.dto.js";
4
4
  export * from "./ingredient-inventory-filter.dto.js";
5
+ export * from "./confirm-order.dto.js";
6
+ export * from "./confirm-order-item.dto.js";
@@ -2,3 +2,5 @@ export * from "./adjust-ingredient-inventory.dto.js";
2
2
  export * from "./set-ingredient-inventory.dto.js";
3
3
  export * from "./get-ingredient-inventory.dto.js";
4
4
  export * from "./ingredient-inventory-filter.dto.js";
5
+ export * from "./confirm-order.dto.js";
6
+ export * from "./confirm-order-item.dto.js";
@@ -11,7 +11,9 @@ import type { OrderStatus } from "../../types/order-status.type.js";
11
11
  * @example
12
12
  * {
13
13
  * "orderId": "550e8400-e29b-41d4-a716-446655440000",
14
- * "status": "CONFIRMED"
14
+ * "newStatus": "CONFIRMED",
15
+ * "oldStatus": "CREATED",
16
+ * "actor": "ms:orders"
15
17
  * }
16
18
  */
17
19
  export declare class ChangeOrderStatusDto {
@@ -23,6 +25,14 @@ export declare class ChangeOrderStatusDto {
23
25
  * @example "550e8400-e29b-41d4-a716-446655440000"
24
26
  */
25
27
  orderId: string;
28
+ /**
29
+ * Previous status value of the order before the change.
30
+ * Must be a valid value from the OrderStatus enum.
31
+ *
32
+ * @type {OrderStatus}
33
+ * @example "CREATED"
34
+ */
35
+ oldStatus?: OrderStatus;
26
36
  /**
27
37
  * New status value to set for the order.
28
38
  * Must be a valid value from the OrderStatus enum.
@@ -30,5 +40,14 @@ export declare class ChangeOrderStatusDto {
30
40
  * @type {OrderStatus}
31
41
  * @example "CONFIRMED"
32
42
  */
33
- status: OrderStatus;
43
+ newStatus: OrderStatus;
44
+ /**
45
+ * The actor performing the adjustment; must match:
46
+ * - user:<mongoId>
47
+ * - ms:<serviceName>
48
+ * - job:<jobName>
49
+ *
50
+ * For users, <mongoId> must be a valid MongoDB ObjectId (24 hex chars).
51
+ */
52
+ actor: string;
34
53
  }
@@ -7,7 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
7
7
  var __metadata = (this && this.__metadata) || function (k, v) {
8
8
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
9
  };
10
- import { IsIn, IsNotEmpty, IsString, IsUUID } from "class-validator";
10
+ import { IsIn, IsNotEmpty, IsOptional, IsString, IsUUID, Matches, } from "class-validator";
11
11
  import { ORDER_STATUS } from "../../types/order-status.type.js";
12
12
  /**
13
13
  * Data Transfer Object (DTO) for changing the status of an order.
@@ -21,7 +21,9 @@ import { ORDER_STATUS } from "../../types/order-status.type.js";
21
21
  * @example
22
22
  * {
23
23
  * "orderId": "550e8400-e29b-41d4-a716-446655440000",
24
- * "status": "CONFIRMED"
24
+ * "newStatus": "CONFIRMED",
25
+ * "oldStatus": "CREATED",
26
+ * "actor": "ms:orders"
25
27
  * }
26
28
  */
27
29
  export class ChangeOrderStatusDto {
@@ -33,6 +35,14 @@ export class ChangeOrderStatusDto {
33
35
  * @example "550e8400-e29b-41d4-a716-446655440000"
34
36
  */
35
37
  orderId;
38
+ /**
39
+ * Previous status value of the order before the change.
40
+ * Must be a valid value from the OrderStatus enum.
41
+ *
42
+ * @type {OrderStatus}
43
+ * @example "CREATED"
44
+ */
45
+ oldStatus;
36
46
  /**
37
47
  * New status value to set for the order.
38
48
  * Must be a valid value from the OrderStatus enum.
@@ -40,7 +50,16 @@ export class ChangeOrderStatusDto {
40
50
  * @type {OrderStatus}
41
51
  * @example "CONFIRMED"
42
52
  */
43
- status;
53
+ newStatus;
54
+ /**
55
+ * The actor performing the adjustment; must match:
56
+ * - user:<mongoId>
57
+ * - ms:<serviceName>
58
+ * - job:<jobName>
59
+ *
60
+ * For users, <mongoId> must be a valid MongoDB ObjectId (24 hex chars).
61
+ */
62
+ actor;
44
63
  }
45
64
  __decorate([
46
65
  IsUUID(4, { message: "orderId must be a valid UUID v4" }),
@@ -49,8 +68,21 @@ __decorate([
49
68
  __metadata("design:type", String)
50
69
  ], ChangeOrderStatusDto.prototype, "orderId", void 0);
51
70
  __decorate([
52
- IsIn(ORDER_STATUS, { message: "status must be a valid order status" }),
53
- IsString({ message: "status must be a string" }),
54
- IsNotEmpty({ message: "status is required" }),
71
+ IsIn(ORDER_STATUS, { message: "oldStatus must be a valid order status" }),
72
+ IsString({ message: "oldStatus must be a string" }),
73
+ IsOptional(),
74
+ __metadata("design:type", String)
75
+ ], ChangeOrderStatusDto.prototype, "oldStatus", void 0);
76
+ __decorate([
77
+ IsIn(ORDER_STATUS, { message: "newStatus must be a valid order status" }),
78
+ IsString({ message: "newStatus must be a string" }),
79
+ IsNotEmpty({ message: "newStatus is required" }),
80
+ __metadata("design:type", String)
81
+ ], ChangeOrderStatusDto.prototype, "newStatus", void 0);
82
+ __decorate([
83
+ IsString(),
84
+ Matches(/^(user:[a-fA-F0-9]{24}|ms:[a-zA-Z0-9_\-]+|job:[a-zA-Z0-9_\-]+)$/, {
85
+ message: 'actor must be in the format "user:<mongoId>", "ms:<serviceName>" or "job:<jobName>"',
86
+ }),
55
87
  __metadata("design:type", String)
56
- ], ChangeOrderStatusDto.prototype, "status", void 0);
88
+ ], ChangeOrderStatusDto.prototype, "actor", void 0);
@@ -1,5 +1,5 @@
1
- import { OrderItemDto } from './order-item.dto.js';
2
- import { type OrderMode } from '../../types/order-mode.type.js';
1
+ import { OrderItemDto } from "./order-item.dto.js";
2
+ import { type OrderMode } from "../../types/order-mode.type.js";
3
3
  /**
4
4
  * Data Transfer Object for creating a new order in QeHay.
5
5
  *
@@ -69,4 +69,12 @@ export declare class CreateOrderDto {
69
69
  * @example "507f1f77bcf86cd799439011"
70
70
  */
71
71
  userId: string;
72
+ /**
73
+ * Restaurant identifier (UUID) where the order is placed.
74
+ * - Required. Used for associating the order to a restaurant.
75
+ *
76
+ * @type {string}
77
+ * @example "5c7eaf90-13cc-4f8d-a4e9-6caf983c3e46"
78
+ */
79
+ restaurantId: string;
72
80
  }
@@ -7,10 +7,10 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
7
7
  var __metadata = (this && this.__metadata) || function (k, v) {
8
8
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
9
  };
10
- import { Type } from 'class-transformer';
11
- import { IsArray, ArrayMinSize, ValidateNested, IsString, IsOptional, MinLength, IsMongoId, IsNotEmpty, IsDateString, IsIn, } from 'class-validator';
12
- import { OrderItemDto } from './order-item.dto.js';
13
- import { ORDER_MODES } from '../../types/order-mode.type.js';
10
+ import { Type } from "class-transformer";
11
+ import { IsArray, ArrayMinSize, ValidateNested, IsString, IsOptional, MinLength, IsMongoId, IsNotEmpty, IsDateString, IsIn, IsUUID, } from "class-validator";
12
+ import { OrderItemDto } from "./order-item.dto.js";
13
+ import { ORDER_MODES } from "../../types/order-mode.type.js";
14
14
  /**
15
15
  * Data Transfer Object for creating a new order in QeHay.
16
16
  *
@@ -80,44 +80,60 @@ export class CreateOrderDto {
80
80
  * @example "507f1f77bcf86cd799439011"
81
81
  */
82
82
  userId;
83
+ /**
84
+ * Restaurant identifier (UUID) where the order is placed.
85
+ * - Required. Used for associating the order to a restaurant.
86
+ *
87
+ * @type {string}
88
+ * @example "5c7eaf90-13cc-4f8d-a4e9-6caf983c3e46"
89
+ */
90
+ restaurantId;
83
91
  }
84
92
  __decorate([
85
93
  IsArray(),
86
- ArrayMinSize(1, { message: 'Order must contain at least one item' }),
94
+ ArrayMinSize(1, { message: "Order must contain at least one item" }),
87
95
  ValidateNested({ each: true }),
88
96
  Type(() => OrderItemDto),
89
97
  __metadata("design:type", Array)
90
98
  ], CreateOrderDto.prototype, "items", void 0);
91
99
  __decorate([
92
- IsIn(ORDER_MODES, { message: 'Order type must be DINE_IN, PICKUP, or DELIVERY' }),
93
- IsString({ message: 'Order mode must be a string' }),
94
- IsNotEmpty({ message: 'Order mode is required' }),
100
+ IsIn(ORDER_MODES, {
101
+ message: "Order type must be DINE_IN, PICKUP, or DELIVERY",
102
+ }),
103
+ IsString({ message: "Order mode must be a string" }),
104
+ IsNotEmpty({ message: "Order mode is required" }),
95
105
  __metadata("design:type", String)
96
106
  ], CreateOrderDto.prototype, "mode", void 0);
97
107
  __decorate([
98
- IsString({ message: 'tableId must be a string' }),
99
- MinLength(2, { message: 'tableId must be at least 2 characters' }),
108
+ IsString({ message: "tableId must be a string" }),
109
+ MinLength(2, { message: "tableId must be at least 2 characters" }),
100
110
  IsOptional(),
101
111
  __metadata("design:type", String)
102
112
  ], CreateOrderDto.prototype, "tableId", void 0);
103
113
  __decorate([
104
- IsString({ message: 'Delivery address must be a string' }),
114
+ IsString({ message: "Delivery address must be a string" }),
105
115
  IsOptional(),
106
116
  __metadata("design:type", String)
107
117
  ], CreateOrderDto.prototype, "deliveryAddress", void 0);
108
118
  __decorate([
109
- IsDateString({}, { message: 'pickupTime must be a valid ISO date string' }),
119
+ IsDateString({}, { message: "pickupTime must be a valid ISO date string" }),
110
120
  IsOptional(),
111
121
  __metadata("design:type", String)
112
122
  ], CreateOrderDto.prototype, "pickupTime", void 0);
113
123
  __decorate([
114
- IsString({ message: 'paymentMethodId must be a string' }),
115
- IsNotEmpty({ message: 'Payment method ID is required' }),
124
+ IsString({ message: "paymentMethodId must be a string" }),
125
+ IsNotEmpty({ message: "Payment method ID is required" }),
116
126
  __metadata("design:type", String)
117
127
  ], CreateOrderDto.prototype, "paymentMethodId", void 0);
118
128
  __decorate([
119
- IsString({ message: 'userId must be a string' }),
120
- IsMongoId({ message: 'userId must be a valid MongoDB ObjectId' }),
121
- IsNotEmpty({ message: 'userId is required' }),
129
+ IsString({ message: "userId must be a string" }),
130
+ IsMongoId({ message: "userId must be a valid MongoDB ObjectId" }),
131
+ IsNotEmpty({ message: "userId is required" }),
122
132
  __metadata("design:type", String)
123
133
  ], CreateOrderDto.prototype, "userId", void 0);
134
+ __decorate([
135
+ IsString({ message: "restaurantId must be a string" }),
136
+ IsUUID("4", { message: "restaurantId must be a valid UUID (v4)" }),
137
+ IsNotEmpty({ message: "restaurantId is required" }),
138
+ __metadata("design:type", String)
139
+ ], CreateOrderDto.prototype, "restaurantId", void 0);
@@ -1,4 +1,5 @@
1
1
  import { type ProductStatus } from "../../types/product-status.type.js";
2
+ import { type StockMode } from "../../types/stock-mode.type.js";
2
3
  /**
3
4
  * DTO for creating a new product.
4
5
  *
@@ -44,6 +45,15 @@ export declare class CreateProductDto {
44
45
  * @default ProductStatus.ACTIVE
45
46
  */
46
47
  status?: ProductStatus;
48
+ /**
49
+ * Stock management mode. Determines how stock is controlled for this product.
50
+ * Must be one of the allowed stock modes: INGREDIENT, PRODUCT_UNIT.
51
+ * Optional; defaults to "INGREDIENT" if not provided.
52
+ *
53
+ * @example "INGREDIENT"
54
+ * @default "INGREDIENT"
55
+ */
56
+ stockMode?: StockMode;
47
57
  /**
48
58
  * User who created the product.
49
59
  * Must be a valid MongoDB ObjectId.
@@ -10,6 +10,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
10
10
  import { IsString, IsNotEmpty, IsNumber, Min, IsOptional, IsMongoId, IsIn, } from "class-validator";
11
11
  import { Type } from "class-transformer";
12
12
  import { PRODUCT_STATUS, } from "../../types/product-status.type.js";
13
+ import { STOCK_MODES } from "../../types/stock-mode.type.js";
13
14
  /**
14
15
  * DTO for creating a new product.
15
16
  *
@@ -55,6 +56,15 @@ export class CreateProductDto {
55
56
  * @default ProductStatus.ACTIVE
56
57
  */
57
58
  status = "ACTIVE";
59
+ /**
60
+ * Stock management mode. Determines how stock is controlled for this product.
61
+ * Must be one of the allowed stock modes: INGREDIENT, PRODUCT_UNIT.
62
+ * Optional; defaults to "INGREDIENT" if not provided.
63
+ *
64
+ * @example "INGREDIENT"
65
+ * @default "INGREDIENT"
66
+ */
67
+ stockMode = "INGREDIENT";
58
68
  /**
59
69
  * User who created the product.
60
70
  * Must be a valid MongoDB ObjectId.
@@ -94,6 +104,14 @@ __decorate([
94
104
  }),
95
105
  __metadata("design:type", String)
96
106
  ], CreateProductDto.prototype, "status", void 0);
107
+ __decorate([
108
+ IsOptional(),
109
+ IsString({ message: "Stock mode must be a string" }),
110
+ IsIn(STOCK_MODES, {
111
+ message: "Stock mode must be INGREDIENT or PRODUCT_UNIT",
112
+ }),
113
+ __metadata("design:type", String)
114
+ ], CreateProductDto.prototype, "stockMode", void 0);
97
115
  __decorate([
98
116
  IsString(),
99
117
  IsMongoId(),
@@ -1,3 +1,4 @@
1
+ import { StockMode } from "../../types/index.js";
1
2
  /**
2
3
  * Order item interface.
3
4
  *
@@ -58,6 +59,7 @@ export interface OrderItem {
58
59
  * @example "Big Mac"
59
60
  */
60
61
  name: string;
62
+ stockMode: StockMode;
61
63
  /**
62
64
  * Child items for this order item, used for combos or nested options.
63
65
  * For example, a combo meal could have child items for a drink and side.
@@ -99,6 +99,7 @@ export interface Order {
99
99
  * @example "payment-method-uuid-123"
100
100
  */
101
101
  paymentMethodId?: string | null;
102
+ restaurantId: string;
102
103
  /**
103
104
  * Timestamp for when the order was created in the system.
104
105
  *
@@ -1,8 +1,9 @@
1
- import { ProductSize, ProductImage, ProductSchedule, ProductRecipe } from './index.js';
2
- import { ProductStatus } from '../../types/product-status.type.js';
3
- import { Translation } from '../translations/translation.interface.js';
4
- import { Tag } from '../tags/tag.interface.js';
5
- import { Question } from '../questions/question.interface.js';
1
+ import { ProductSize, ProductImage, ProductSchedule, ProductRecipe } from "./index.js";
2
+ import { ProductStatus } from "../../types/product-status.type.js";
3
+ import { Translation } from "../translations/translation.interface.js";
4
+ import { Tag } from "../tags/tag.interface.js";
5
+ import { Question } from "../questions/question.interface.js";
6
+ import { StockMode } from "../../types/index.js";
6
7
  /**
7
8
  * Product interface.
8
9
  *
@@ -52,6 +53,7 @@ export interface Product {
52
53
  * @example ProductStatus.OUT_OF_STOCK
53
54
  */
54
55
  status: ProductStatus;
56
+ stockMode: StockMode;
55
57
  /**
56
58
  * Date and time when the product was created.
57
59
  *
@@ -0,0 +1,5 @@
1
+ export interface FindProductRecipesByProductIdResponse {
2
+ productId: string;
3
+ ingredientId: string;
4
+ quantity: number;
5
+ }
@@ -23,3 +23,4 @@ export * from "./question-relationship.interface.js";
23
23
  export * from "./recipe-relationship.interface.js";
24
24
  export * from "./replace-sub-products-response.interface.js";
25
25
  export * from "./sub-resource-response.interface.js";
26
+ export * from "./find-product-recipes-by-product-id-response.interface.dto.js";
@@ -23,3 +23,4 @@ export * from "./question-relationship.interface.js";
23
23
  export * from "./recipe-relationship.interface.js";
24
24
  export * from "./replace-sub-products-response.interface.js";
25
25
  export * from "./sub-resource-response.interface.js";
26
+ export * from "./find-product-recipes-by-product-id-response.interface.dto.js";
@@ -3,3 +3,6 @@ export * from "./order-status.type.js";
3
3
  export * from "./currency.type.js";
4
4
  export * from "./product-status.type.js";
5
5
  export * from "./ingredient-unit.type.js";
6
+ export * from "./stock-mode.type.js";
7
+ export * from "./ingredient-consumption.type.js";
8
+ export * from "./recipe-by-product.type.js";
@@ -3,3 +3,6 @@ export * from "./order-status.type.js";
3
3
  export * from "./currency.type.js";
4
4
  export * from "./product-status.type.js";
5
5
  export * from "./ingredient-unit.type.js";
6
+ export * from "./stock-mode.type.js";
7
+ export * from "./ingredient-consumption.type.js";
8
+ export * from "./recipe-by-product.type.js";
@@ -0,0 +1 @@
1
+ export type IngredientConsumptionMap = Map<string, number>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ import { FindProductRecipesByProductIdResponse } from "../interfaces/index.js";
2
+ export type RecipeByProductType = Map<string, FindProductRecipesByProductIdResponse[]>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Stock mode constants for the QeHay platform.
3
+ *
4
+ * This array defines all possible stock management modes supported for products in the inventory system.
5
+ * It acts as the single source of truth for allowed stock mode values across all modules
6
+ * (client, waiter, kitchen, admin).
7
+ *
8
+ * - INGREDIENT: Stock is managed by ingredients composing the product.
9
+ * - PRODUCT_UNIT: Stock is managed by counting product units.
10
+ *
11
+ * @since 2.0.0
12
+ */
13
+ export declare const STOCK_MODES: readonly ["INGREDIENT", "PRODUCT_UNIT"];
14
+ /**
15
+ * Type representing all supported stock management modes within the QeHay platform.
16
+ * @see STOCK_MODES
17
+ *
18
+ * @example StockMode.INGREDIENT
19
+ * @example StockMode.PRODUCT_UNIT
20
+ */
21
+ export type StockMode = (typeof STOCK_MODES)[number];
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Stock mode constants for the QeHay platform.
3
+ *
4
+ * This array defines all possible stock management modes supported for products in the inventory system.
5
+ * It acts as the single source of truth for allowed stock mode values across all modules
6
+ * (client, waiter, kitchen, admin).
7
+ *
8
+ * - INGREDIENT: Stock is managed by ingredients composing the product.
9
+ * - PRODUCT_UNIT: Stock is managed by counting product units.
10
+ *
11
+ * @since 2.0.0
12
+ */
13
+ export const STOCK_MODES = ["INGREDIENT", "PRODUCT_UNIT"];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qeai-sdk",
3
- "version": "2.1.5",
3
+ "version": "2.1.7",
4
4
  "description": "In this version we have added the interfaces for the qhay sdk",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {