@chopkola/common 1.0.128 → 1.0.129

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.
@@ -11,6 +11,8 @@ export interface MenuI extends Timestamps {
11
11
  vendor_id: UUID;
12
12
  category_id: UUID | null;
13
13
  name: string;
14
+ slug: string;
15
+ daily_max_orders: number;
14
16
  description: string | null;
15
17
  is_active: boolean;
16
18
  availability_schedule: AvailabilityScheduleEntry[] | null;
@@ -1,11 +1,11 @@
1
- import { DecimalString, Timestamps, UUID } from "./global";
2
- export declare enum StockStatus {
1
+ import { Timestamps, UUID } from "./global";
2
+ export declare enum StockStatusEnum {
3
3
  IN_STOCK = "in_stock",
4
4
  LOW_STOCK = "low_stock",
5
5
  OUT_OF_STOCK = "out_of_stock",
6
6
  DISCONTINUED = "discontinued"
7
7
  }
8
- export declare enum StockMovementReason {
8
+ export declare enum StockMovementReasonEnum {
9
9
  SALE = "sale",
10
10
  RETURN = "return",
11
11
  SUPPLIER_INTAKE = "supplier_intake",
@@ -17,12 +17,6 @@ export declare enum StockMovementReason {
17
17
  TRANSFER_IN = "transfer_in",
18
18
  INITIAL_STOCK = "initial_stock"
19
19
  }
20
- export interface ProductAttributesI {
21
- [key: string]: string | number | boolean | string[] | number[] | null;
22
- }
23
- export interface VariantOptionsI {
24
- [optionName: string]: string;
25
- }
26
20
  export interface ProductI extends Timestamps {
27
21
  id: UUID;
28
22
  vendor_id: UUID;
@@ -33,32 +27,29 @@ export interface ProductI extends Timestamps {
33
27
  images: string[] | null;
34
28
  category_id: UUID | null;
35
29
  tags: string[] | null;
36
- attributes: ProductAttributesI | null;
30
+ attributes: Record<string, any> | null;
37
31
  is_approved: boolean;
38
32
  }
39
33
  export interface ProductVariantI extends Timestamps {
40
34
  id: UUID;
41
35
  product_id: UUID;
42
36
  name_suffix: string | null;
43
- options: VariantOptionsI;
37
+ options: Record<string, any>;
44
38
  images: string[] | null;
45
39
  is_default: boolean;
46
40
  }
47
41
  export interface InventoryItemI extends Timestamps {
48
42
  id: UUID;
49
43
  vendor_id: UUID;
50
- /**
51
- * One of these must be present (enforced at DB level)
52
- */
53
44
  product_id: UUID | null;
54
45
  product_variant_id: UUID | null;
55
46
  sku: string;
56
- price: DecimalString;
57
- cost_price: DecimalString | null;
58
- sale_price: DecimalString | null;
59
- quantity: DecimalString;
60
- low_stock_threshold: DecimalString | null;
61
- stock_status: StockStatus;
47
+ price: string;
48
+ cost_price: string | null;
49
+ sale_price: string | null;
50
+ quantity: string;
51
+ low_stock_threshold: string | null;
52
+ stock_status: StockStatusEnum;
62
53
  is_trackable: boolean;
63
54
  is_visible: boolean;
64
55
  supplier: string | null;
@@ -67,26 +58,36 @@ export interface InventoryItemI extends Timestamps {
67
58
  export interface StockMovementI extends Timestamps {
68
59
  id: UUID;
69
60
  inventory_item_id: UUID;
70
- quantity_change: DecimalString;
71
- quantity_before: DecimalString;
72
- quantity_after: DecimalString;
73
- reason: StockMovementReason;
61
+ quantity_change: string;
62
+ quantity_before: string;
63
+ quantity_after: string;
64
+ reason: StockMovementReasonEnum;
74
65
  notes: string | null;
75
66
  source_reference_id: UUID | null;
76
67
  user_id: UUID | null;
77
68
  }
78
- export type CreateProductVariantInputI = Omit<ProductVariantI, "id" | "created_at" | "updated_at">;
79
- export type CreateProductInputI = Omit<ProductI, "id" | "created_at" | "updated_at">;
80
- export type CreateInventoryItemInputI = Omit<InventoryItemI, "id" | "created_at" | "updated_at">;
81
- export type CreateStockMovementInputI = Omit<StockMovementI, "id" | "created_at" | "updated_at">;
82
69
  export interface ProductWithVariantsI extends ProductI {
83
70
  variants: ProductVariantI[];
84
71
  }
85
- export interface InventoryItemWithProductI extends InventoryItemI {
86
- product?: ProductI | null;
87
- variant?: ProductVariantI | null;
72
+ export interface ProductWithInventoryItemI extends ProductWithVariantsI {
73
+ inventory: InventoryItemI;
88
74
  }
89
- export interface InventoryLedgerI {
90
- item: InventoryItemI;
75
+ export interface ProductWithInventoryItemI extends ProductWithVariantsI {
76
+ inventory: InventoryItemI;
91
77
  movements: StockMovementI[];
92
78
  }
79
+ export interface InventoryItemWithProductI extends InventoryItemI {
80
+ product?: ProductI | null;
81
+ product_variant?: ProductVariantI | null;
82
+ }
83
+ export type CreateProductInput = Omit<ProductI, "id" | "created_at" | "updated_at">;
84
+ export type CreateProductVariantInput = Omit<ProductVariantI, "id" | "created_at" | "updated_at">;
85
+ export type CreateInventoryItemInput = Omit<InventoryItemI, "id" | "created_at" | "updated_at" | "stock_status">;
86
+ export type CreateStockMovementInput = Omit<StockMovementI, "id" | "created_at" | "updated_at">;
87
+ export type InventoryLink = {
88
+ product_id: UUID;
89
+ product_variant_id: null;
90
+ } | {
91
+ product_id: null;
92
+ product_variant_id: UUID;
93
+ };
@@ -1,29 +1,23 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.StockMovementReason = exports.StockStatus = void 0;
4
- var StockStatus;
5
- (function (StockStatus) {
6
- StockStatus["IN_STOCK"] = "in_stock";
7
- StockStatus["LOW_STOCK"] = "low_stock";
8
- StockStatus["OUT_OF_STOCK"] = "out_of_stock";
9
- StockStatus["DISCONTINUED"] = "discontinued";
10
- })(StockStatus || (exports.StockStatus = StockStatus = {}));
11
- var StockMovementReason;
12
- (function (StockMovementReason) {
13
- StockMovementReason["SALE"] = "sale";
14
- StockMovementReason["RETURN"] = "return";
15
- StockMovementReason["SUPPLIER_INTAKE"] = "supplier_intake";
16
- StockMovementReason["RECOUNT_ADJUSTMENT"] = "recount_adjustment";
17
- StockMovementReason["DAMAGE"] = "damage";
18
- StockMovementReason["THEFT"] = "theft";
19
- StockMovementReason["PROMOTION"] = "promotion";
20
- StockMovementReason["TRANSFER_OUT"] = "transfer_out";
21
- StockMovementReason["TRANSFER_IN"] = "transfer_in";
22
- StockMovementReason["INITIAL_STOCK"] = "initial_stock";
23
- })(StockMovementReason || (exports.StockMovementReason = StockMovementReason = {}));
24
- // Either product_id OR product_variant_id
25
- // But never both.
26
- // Never neither.
27
- // if (!input.product_id && !input.product_variant_id) {
28
- // throw new Error("Inventory item must reference product or variant");
29
- // }
3
+ exports.StockMovementReasonEnum = exports.StockStatusEnum = void 0;
4
+ var StockStatusEnum;
5
+ (function (StockStatusEnum) {
6
+ StockStatusEnum["IN_STOCK"] = "in_stock";
7
+ StockStatusEnum["LOW_STOCK"] = "low_stock";
8
+ StockStatusEnum["OUT_OF_STOCK"] = "out_of_stock";
9
+ StockStatusEnum["DISCONTINUED"] = "discontinued";
10
+ })(StockStatusEnum || (exports.StockStatusEnum = StockStatusEnum = {}));
11
+ var StockMovementReasonEnum;
12
+ (function (StockMovementReasonEnum) {
13
+ StockMovementReasonEnum["SALE"] = "sale";
14
+ StockMovementReasonEnum["RETURN"] = "return";
15
+ StockMovementReasonEnum["SUPPLIER_INTAKE"] = "supplier_intake";
16
+ StockMovementReasonEnum["RECOUNT_ADJUSTMENT"] = "recount_adjustment";
17
+ StockMovementReasonEnum["DAMAGE"] = "damage";
18
+ StockMovementReasonEnum["THEFT"] = "theft";
19
+ StockMovementReasonEnum["PROMOTION"] = "promotion";
20
+ StockMovementReasonEnum["TRANSFER_OUT"] = "transfer_out";
21
+ StockMovementReasonEnum["TRANSFER_IN"] = "transfer_in";
22
+ StockMovementReasonEnum["INITIAL_STOCK"] = "initial_stock";
23
+ })(StockMovementReasonEnum || (exports.StockMovementReasonEnum = StockMovementReasonEnum = {}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chopkola/common",
3
- "version": "1.0.128",
3
+ "version": "1.0.129",
4
4
  "description": "",
5
5
  "license": "ISC",
6
6
  "author": "akrosoft technology ltd",