qeai-sdk 2.1.2 → 2.1.4

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.
@@ -1,4 +1,4 @@
1
- import { type IngredientUnit } from "../../types/ingredient-unit.type";
1
+ import { type IngredientUnit } from "../../types/ingredient-unit.type.js";
2
2
  /**
3
3
  * DTO for creating a new ingredient.
4
4
  *
@@ -8,7 +8,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
10
  import { IsString, IsNotEmpty, MaxLength, IsMongoId, IsIn, } from "class-validator";
11
- import { INGREDIENT_UNITS, } from "../../types/ingredient-unit.type";
11
+ import { INGREDIENT_UNITS, } from "../../types/ingredient-unit.type.js";
12
12
  /**
13
13
  * DTO for creating a new ingredient.
14
14
  *
@@ -1,4 +1,4 @@
1
- import { type IngredientUnit } from "../../types/ingredient-unit.type";
1
+ import { type IngredientUnit } from "../../types/ingredient-unit.type.js";
2
2
  /**
3
3
  * DTO for updating an existing ingredient.
4
4
  *
@@ -8,7 +8,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
10
  import { IsString, IsOptional, IsMongoId, IsUUID, MaxLength, IsNotEmpty, IsIn, } from "class-validator";
11
- import { INGREDIENT_UNITS, } from "../../types/ingredient-unit.type";
11
+ import { INGREDIENT_UNITS, } from "../../types/ingredient-unit.type.js";
12
12
  /**
13
13
  * DTO for updating an existing ingredient.
14
14
  *
@@ -42,9 +42,11 @@ export declare class AdjustIngredientInventoryDto {
42
42
  reason: string;
43
43
  /**
44
44
  * The actor performing the adjustment; must match:
45
- * - user:<uuid>
45
+ * - user:<mongoId>
46
46
  * - ms:<serviceName>
47
47
  * - job:<jobName>
48
+ *
49
+ * For users, <mongoId> must be a valid MongoDB ObjectId (24 hex chars).
48
50
  */
49
51
  actor: string;
50
52
  }
@@ -52,9 +52,11 @@ export class AdjustIngredientInventoryDto {
52
52
  reason;
53
53
  /**
54
54
  * The actor performing the adjustment; must match:
55
- * - user:<uuid>
55
+ * - user:<mongoId>
56
56
  * - ms:<serviceName>
57
57
  * - job:<jobName>
58
+ *
59
+ * For users, <mongoId> must be a valid MongoDB ObjectId (24 hex chars).
58
60
  */
59
61
  actor;
60
62
  }
@@ -79,8 +81,8 @@ __decorate([
79
81
  ], AdjustIngredientInventoryDto.prototype, "reason", void 0);
80
82
  __decorate([
81
83
  IsString(),
82
- Matches(/^(user:[0-9a-fA-F\-]{36}|ms:[a-zA-Z0-9_\-]+|job:[a-zA-Z0-9_\-]+)$/, {
83
- message: 'actor must be in the format "user:<uuid>", "ms:<serviceName>" or "job:<jobName>"',
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>"',
84
86
  }),
85
87
  __metadata("design:type", String)
86
88
  ], AdjustIngredientInventoryDto.prototype, "actor", void 0);
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Data Transfer Object for fetching a specific ingredient inventory of a restaurant.
3
+ *
4
+ * This DTO is used to specify the required identifiers to uniquely
5
+ * retrieve the inventory record for an ingredient within a restaurant.
6
+ */
7
+ export declare class GetIngredientInventoryDto {
8
+ /**
9
+ * UUID v4 of the restaurant.
10
+ */
11
+ restaurantId: string;
12
+ /**
13
+ * UUID v4 of the ingredient.
14
+ */
15
+ ingredientId: string;
16
+ }
@@ -0,0 +1,34 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ import { IsUUID } from "class-validator";
11
+ /**
12
+ * Data Transfer Object for fetching a specific ingredient inventory of a restaurant.
13
+ *
14
+ * This DTO is used to specify the required identifiers to uniquely
15
+ * retrieve the inventory record for an ingredient within a restaurant.
16
+ */
17
+ export class GetIngredientInventoryDto {
18
+ /**
19
+ * UUID v4 of the restaurant.
20
+ */
21
+ restaurantId;
22
+ /**
23
+ * UUID v4 of the ingredient.
24
+ */
25
+ ingredientId;
26
+ }
27
+ __decorate([
28
+ IsUUID("4", { message: "restaurantId must be a valid UUID v4" }),
29
+ __metadata("design:type", String)
30
+ ], GetIngredientInventoryDto.prototype, "restaurantId", void 0);
31
+ __decorate([
32
+ IsUUID("4", { message: "ingredientId must be a valid UUID v4" }),
33
+ __metadata("design:type", String)
34
+ ], GetIngredientInventoryDto.prototype, "ingredientId", void 0);
@@ -1,2 +1,2 @@
1
- export * from "./adjust-ingredient-inventory.dto";
2
- export * from "./set-ingredient-inventory.dto";
1
+ export * from "./adjust-ingredient-inventory.dto.js";
2
+ export * from "./set-ingredient-inventory.dto.js";
@@ -1,2 +1,2 @@
1
- export * from "./adjust-ingredient-inventory.dto";
2
- export * from "./set-ingredient-inventory.dto";
1
+ export * from "./adjust-ingredient-inventory.dto.js";
2
+ export * from "./set-ingredient-inventory.dto.js";
@@ -0,0 +1,37 @@
1
+ import { PaginationDto } from "../common";
2
+ /**
3
+ * Data Transfer Object for filtering the ingredient inventory listing.
4
+ * Includes pagination and optional filtering by ingredient name, ingredient IDs,
5
+ * and minimum/maximum quantity.
6
+ */
7
+ export declare class IngredientInventoryFiltersDto extends PaginationDto {
8
+ /**
9
+ * Optional filter by ingredient name (partial match, case-insensitive)
10
+ */
11
+ ingredientName?: string;
12
+ /**
13
+ * Optional filter by an array of specific ingredient IDs
14
+ */
15
+ ingredientIds?: string[];
16
+ /**
17
+ * Optional filter for minimum quantity available
18
+ */
19
+ minQuantity?: number;
20
+ /**
21
+ * Optional filter for maximum quantity available
22
+ */
23
+ maxQuantity?: number;
24
+ /**
25
+ * Optional expand parameter to include related entities in the inventory results.
26
+ * Allows the client to request that related resources such as 'ingredient', 'restaurant', etc.,
27
+ * be included in the response payload. Typical values: ['ingredient'], ['restaurant', 'ingredient'].
28
+ *
29
+ * This field is compatible with URL query usage:
30
+ * GET /restaurants/:id/ingredients/inventory?expand=ingredient
31
+ * GET /restaurants/:id/ingredients/inventory?expand=restaurant,ingredient
32
+ *
33
+ * @example ['ingredient']
34
+ * @example ['restaurant', 'ingredient']
35
+ */
36
+ expand?: string[];
37
+ }
@@ -0,0 +1,82 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ import { IsInt, IsOptional, IsString, IsUUID, IsArray, ArrayUnique, } from "class-validator";
11
+ import { Type } from "class-transformer";
12
+ import { PaginationDto } from "../common";
13
+ /**
14
+ * Data Transfer Object for filtering the ingredient inventory listing.
15
+ * Includes pagination and optional filtering by ingredient name, ingredient IDs,
16
+ * and minimum/maximum quantity.
17
+ */
18
+ export class IngredientInventoryFiltersDto extends PaginationDto {
19
+ /**
20
+ * Optional filter by ingredient name (partial match, case-insensitive)
21
+ */
22
+ ingredientName;
23
+ /**
24
+ * Optional filter by an array of specific ingredient IDs
25
+ */
26
+ ingredientIds;
27
+ /**
28
+ * Optional filter for minimum quantity available
29
+ */
30
+ minQuantity;
31
+ /**
32
+ * Optional filter for maximum quantity available
33
+ */
34
+ maxQuantity;
35
+ /**
36
+ * Optional expand parameter to include related entities in the inventory results.
37
+ * Allows the client to request that related resources such as 'ingredient', 'restaurant', etc.,
38
+ * be included in the response payload. Typical values: ['ingredient'], ['restaurant', 'ingredient'].
39
+ *
40
+ * This field is compatible with URL query usage:
41
+ * GET /restaurants/:id/ingredients/inventory?expand=ingredient
42
+ * GET /restaurants/:id/ingredients/inventory?expand=restaurant,ingredient
43
+ *
44
+ * @example ['ingredient']
45
+ * @example ['restaurant', 'ingredient']
46
+ */
47
+ expand;
48
+ }
49
+ __decorate([
50
+ IsOptional(),
51
+ IsString({ message: "ingredientName must be a string" }),
52
+ __metadata("design:type", String)
53
+ ], IngredientInventoryFiltersDto.prototype, "ingredientName", void 0);
54
+ __decorate([
55
+ IsOptional(),
56
+ IsArray({ message: "ingredientIds must be an array of UUIDs" }),
57
+ ArrayUnique({ message: "ingredientIds must contain unique values" }),
58
+ IsUUID("4", {
59
+ each: true,
60
+ message: "each ingredientId must be a valid UUID v4",
61
+ }),
62
+ __metadata("design:type", Array)
63
+ ], IngredientInventoryFiltersDto.prototype, "ingredientIds", void 0);
64
+ __decorate([
65
+ IsOptional(),
66
+ Type(() => Number),
67
+ IsInt({ message: "minQuantity must be an integer" }),
68
+ __metadata("design:type", Number)
69
+ ], IngredientInventoryFiltersDto.prototype, "minQuantity", void 0);
70
+ __decorate([
71
+ IsOptional(),
72
+ Type(() => Number),
73
+ IsInt({ message: "maxQuantity must be an integer" }),
74
+ __metadata("design:type", Number)
75
+ ], IngredientInventoryFiltersDto.prototype, "maxQuantity", void 0);
76
+ __decorate([
77
+ IsOptional(),
78
+ IsArray({ message: "expand must be an array of strings" }),
79
+ ArrayUnique({ message: "expand must contain unique values" }),
80
+ IsString({ each: true, message: "each expand value must be a string" }),
81
+ __metadata("design:type", Array)
82
+ ], IngredientInventoryFiltersDto.prototype, "expand", void 0);
@@ -65,8 +65,8 @@ __decorate([
65
65
  ], SetIngredientInventoryDto.prototype, "quantity", void 0);
66
66
  __decorate([
67
67
  IsString(),
68
- Matches(/^(user:[0-9a-fA-F\-]{36}|ms:[a-zA-Z0-9_\-]+|job:[a-zA-Z0-9_\-]+)$/, {
69
- message: 'actor must be in the format "user:<uuid>", "ms:<serviceName>" or "job:<jobName>"',
68
+ Matches(/^(user:[a-fA-F0-9]{24}|ms:[a-zA-Z0-9_\-]+|job:[a-zA-Z0-9_\-]+)$/, {
69
+ message: 'actor must be in the format "user:<mongoId>", "ms:<serviceName>" or "job:<jobName>"',
70
70
  }),
71
71
  __metadata("design:type", String)
72
72
  ], SetIngredientInventoryDto.prototype, "actor", void 0);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qeai-sdk",
3
- "version": "2.1.2",
3
+ "version": "2.1.4",
4
4
  "description": "In this version we have added the interfaces for the qhay sdk",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {