repzo 1.0.4 → 1.0.5

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.
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "repzo",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "Repzo TypeScript SDK",
5
5
  "main": "./lib/index.js",
6
6
  "type": "module",
package/src/index.ts CHANGED
@@ -235,7 +235,7 @@ export default class Repzo {
235
235
  };
236
236
 
237
237
  category = {
238
- _path: "/product-sub-category",
238
+ _path: "/product-category",
239
239
  find: async (
240
240
  params?: Service.Category.Find.Params
241
241
  ): Promise<Service.Category.Find.Result> => {
@@ -1409,4 +1409,18 @@ export default class Repzo {
1409
1409
  return res;
1410
1410
  },
1411
1411
  };
1412
+
1413
+ inventory = {
1414
+ _path: "/inventory",
1415
+ find: async (
1416
+ params?: Service.Inventory.Find.Params
1417
+ ): Promise<Service.Inventory.Find.Result> => {
1418
+ let res: Service.Inventory.Find.Result = await this._fetch(
1419
+ this.svAPIEndpoint,
1420
+ this.inventory._path,
1421
+ params
1422
+ );
1423
+ return res;
1424
+ },
1425
+ };
1412
1426
  }
@@ -416,15 +416,15 @@ export namespace Service {
416
416
  product_groups?: string[];
417
417
  frozen_pre_sales?: boolean;
418
418
  frozen_sales?: boolean;
419
- variants?: Variant.VariantBody & {
419
+ variants?: (Variant.VariantBody & {
420
420
  name: string;
421
- product: string;
421
+ product?: string;
422
422
  price: number;
423
423
  _id?: string;
424
424
  createdAt?: string;
425
425
  updatedAt?: string;
426
426
  __v?: number;
427
- };
427
+ })[];
428
428
  }
429
429
 
430
430
  type ProductWithPopulatedKeys = ProductSchema & {
@@ -683,7 +683,10 @@ export namespace Service {
683
683
  [key: string]: any; // integration_meta.
684
684
  };
685
685
  export interface Result extends DefaultPaginationResult {
686
- data: CategorySchema & { hasSubCategory?: boolean; isLeaf?: boolean }[];
686
+ data: (CategorySchema & {
687
+ hasSubCategory?: boolean;
688
+ isLeaf?: boolean;
689
+ })[];
687
690
  }
688
691
  }
689
692
 
@@ -1032,8 +1035,9 @@ export namespace Service {
1032
1035
  [key: string]: any; // integration_meta.
1033
1036
  };
1034
1037
  export interface Result extends DefaultPaginationResult {
1035
- data: MeasureUnitSchema &
1036
- { family?: MeasureUnitFamily.MeasureUnitFamilySchema[] }[];
1038
+ data: (MeasureUnitSchema & {
1039
+ family?: MeasureUnitFamily.MeasureUnitFamilySchema[];
1040
+ })[];
1037
1041
  }
1038
1042
  }
1039
1043
 
@@ -1316,12 +1320,11 @@ export namespace Service {
1316
1320
  [key: string]: any; // integration_meta.
1317
1321
  };
1318
1322
  export interface Result extends DefaultPaginationResult {
1319
- data: PriceListItemSchema &
1320
- {
1321
- product_id: string | Product.ProductSchema;
1322
- variant_id: string | Variant.VariantSchema;
1323
- pricelist_id: string | PriceList.PriceListSchema;
1324
- }[];
1323
+ data: (PriceListItemSchema & {
1324
+ product_id: string | Product.ProductSchema;
1325
+ variant_id: string | Variant.VariantSchema;
1326
+ pricelist_id: string | PriceList.PriceListSchema;
1327
+ })[];
1325
1328
  }
1326
1329
  }
1327
1330
 
@@ -1748,7 +1751,7 @@ export namespace Service {
1748
1751
  }
1749
1752
  export interface WarehouseBody {
1750
1753
  name?: string;
1751
- type?: WarehouseType;
1754
+ type?: "van" | "main";
1752
1755
  code?: string;
1753
1756
  disabled?: boolean;
1754
1757
  integration_meta?: { [key: string]: any };
@@ -1782,7 +1785,7 @@ export namespace Service {
1782
1785
  export namespace Create {
1783
1786
  export interface Body extends WarehouseBody {
1784
1787
  name: string;
1785
- type: WarehouseType;
1788
+ type: "van" | "main";
1786
1789
  }
1787
1790
  export type Result = WarehouseSchema;
1788
1791
  }
@@ -2210,7 +2213,7 @@ export namespace Service {
2210
2213
  tax_amount?: number;
2211
2214
  gross_value?: number;
2212
2215
  }
2213
- interface ModifierGroup {
2216
+ export interface ModifierGroup {
2214
2217
  name?: string;
2215
2218
  local_name?: string;
2216
2219
  position?: number;
@@ -2564,19 +2567,250 @@ export namespace Service {
2564
2567
  issue_date?: string;
2565
2568
  }
2566
2569
 
2567
- type InvoiceSchemaWithPopulatedKeys = InvoiceSchema & {
2568
- items: (Item.Body & {
2569
- variant: Item.Item_Variant & {
2570
+ type InvoiceSchemaWithPopulatedKeys = {
2571
+ _id: string;
2572
+ items: {
2573
+ variant: {
2574
+ product_name: string;
2570
2575
  variant_id: Pick<Variant.VariantSchema, "sku" | "_id" | "barcode">;
2571
2576
  product_id: Pick<Product.ProductSchema, "sku" | "_id" | "barcode">;
2577
+ variant_name: string;
2578
+ listed_price: number;
2579
+ variant_local_name?: string;
2580
+ variant_img?: string;
2581
+ product_local_name?: string;
2582
+ product_img?: string;
2583
+ product_sku?: string;
2584
+ product_barcode?: string;
2585
+ variant_sku?: string;
2586
+ variant_barcode?: string;
2572
2587
  };
2573
- })[];
2574
- return_items: (Item.Body & {
2575
- variant: Item.Item_Variant & {
2588
+ measureunit: {
2589
+ _id: string;
2590
+ name: string;
2591
+ factor: number;
2592
+ parent?: string;
2593
+ disabled?: boolean;
2594
+ company_namespace: string[];
2595
+ };
2596
+ tax: {
2597
+ name: string;
2598
+ rate: number;
2599
+ type: "inclusive" | "additive" | "N/A";
2600
+ disabled?: boolean;
2601
+ };
2602
+ promotions?: Promotion.Schema[];
2603
+ used_promotions?: { id: string; name: string };
2604
+ general_promotions?: { id: string; name: string };
2605
+ applicable_promotions?: { id: string; name: string };
2606
+ modifiers_groups?: Item.ModifierGroup[];
2607
+ isAdditional?: boolean;
2608
+ qty: number;
2609
+ base_unit_qty?: number;
2610
+ overwritePrice?: number;
2611
+ price: number;
2612
+ discounted_price: number;
2613
+ tax_amount: number;
2614
+ tax_total: number;
2615
+ discount_value: number;
2616
+ gross_value?: number;
2617
+ line_total?: number;
2618
+ total_before_tax?: number;
2619
+ hidden_price?: number;
2620
+ modifiers_total?: number;
2621
+ modifiers_total_before_tax?: number;
2622
+ modifiers_tax_total?: number;
2623
+ tax_total_without_modifiers?: number;
2624
+ line_total_without_modifiers?: number;
2625
+ total_before_tax_without_modifiers?: number;
2626
+ deductionRatio?: number;
2627
+ deductedTax?: number;
2628
+ deduction?: number;
2629
+ deductionBeforeTax?: number;
2630
+ lineTotalAfterDeduction?: number;
2631
+ company_namespace?: string[];
2632
+ note?: string;
2633
+ }[];
2634
+ return_items: {
2635
+ variant: {
2636
+ product_name: string;
2576
2637
  variant_id: Pick<Variant.VariantSchema, "sku" | "_id" | "barcode">;
2577
2638
  product_id: Pick<Product.ProductSchema, "sku" | "_id" | "barcode">;
2639
+ variant_name: string;
2640
+ listed_price: number;
2641
+ variant_local_name?: string;
2642
+ variant_img?: string;
2643
+ product_local_name?: string;
2644
+ product_img?: string;
2645
+ product_sku?: string;
2646
+ product_barcode?: string;
2647
+ variant_sku?: string;
2648
+ variant_barcode?: string;
2578
2649
  };
2579
- })[];
2650
+ measureunit: {
2651
+ _id: string;
2652
+ name: string;
2653
+ factor: number;
2654
+ parent?: string;
2655
+ disabled?: boolean;
2656
+ company_namespace: string[];
2657
+ };
2658
+ tax: {
2659
+ name: string;
2660
+ rate: number;
2661
+ type: "inclusive" | "additive" | "N/A";
2662
+ disabled?: boolean;
2663
+ };
2664
+ promotions?: Promotion.Schema[];
2665
+ used_promotions?: { id: string; name: string };
2666
+ general_promotions?: { id: string; name: string };
2667
+ applicable_promotions?: { id: string; name: string };
2668
+ modifiers_groups?: Item.ModifierGroup[];
2669
+ isAdditional?: boolean;
2670
+ qty: number;
2671
+ base_unit_qty?: number;
2672
+ overwritePrice?: number;
2673
+ price: number;
2674
+ discounted_price: number;
2675
+ tax_amount: number;
2676
+ tax_total: number;
2677
+ discount_value: number;
2678
+ gross_value?: number;
2679
+ line_total?: number;
2680
+ total_before_tax?: number;
2681
+ hidden_price?: number;
2682
+ modifiers_total?: number;
2683
+ modifiers_total_before_tax?: number;
2684
+ modifiers_tax_total?: number;
2685
+ tax_total_without_modifiers?: number;
2686
+ line_total_without_modifiers?: number;
2687
+ total_before_tax_without_modifiers?: number;
2688
+ deductionRatio?: number;
2689
+ deductedTax?: number;
2690
+ deduction?: number;
2691
+ deductionBeforeTax?: number;
2692
+ lineTotalAfterDeduction?: number;
2693
+ company_namespace?: string[];
2694
+ note?: string;
2695
+ }[];
2696
+ integration_meta?: { [key: string]: any };
2697
+ external_serial_number?: string;
2698
+ qr_code_tlv?: string;
2699
+ processable?: boolean;
2700
+ client_name: string;
2701
+ comment?: string;
2702
+ return_comment?: string;
2703
+ creator: AdminCreator | RepCreator | ClientCreator;
2704
+ latest?: boolean;
2705
+ version?: number;
2706
+ time?: number;
2707
+ issue_date: string;
2708
+ delivery_date?: string;
2709
+ currency: string;
2710
+ serial_number: SerialNumber;
2711
+ geo_tag?: {
2712
+ type: "Point";
2713
+ coordinates: number[];
2714
+ };
2715
+ sync_id: string;
2716
+ address?: { [key: string]: any };
2717
+ company_namespace: string[];
2718
+ promotions: Promotion.Schema[];
2719
+ priceLists: { [key: string]: any }[];
2720
+ visit_id?: string;
2721
+ teams?: string[];
2722
+ converter?: AdminCreator | RepCreator | ClientCreator;
2723
+ converted_proforma_serial_number?: SerialNumber;
2724
+ converted_proforma_return_serial_number?: SerialNumber;
2725
+ proforma_reference?: string;
2726
+ converted_at?: number;
2727
+ exclude_return_items?: boolean;
2728
+ returned_from?: string;
2729
+ returned_to?: string;
2730
+ returned_from_serial_number?: SerialNumber;
2731
+ returned_to_serial_number?: SerialNumber;
2732
+ is_void?: boolean;
2733
+ due_date: string;
2734
+ return_serial_number?: SerialNumber;
2735
+ origin_warehouse: string;
2736
+ route?: string;
2737
+ paymentsData: {
2738
+ _id: string;
2739
+ invoice_value: number;
2740
+ paid: number;
2741
+ balance: number;
2742
+ payments: PaymentData[];
2743
+ };
2744
+ consumption: {
2745
+ status: "consumed" | "unconsumed" | "partially_consumed";
2746
+ remainder: number;
2747
+ };
2748
+ status: InvoiceStatus;
2749
+ subtotal: number;
2750
+ discount_amount: number;
2751
+ taxable_subtotal: number;
2752
+ tax_amount: number;
2753
+ total: number;
2754
+ pre_subtotal: number;
2755
+ pre_discount_amount: number;
2756
+ pre_taxable_subtotal: number;
2757
+ pre_tax_amount: number;
2758
+ pre_total: number;
2759
+ return_subtotal: number;
2760
+ return_discount_amount: number;
2761
+ return_taxable_subtotal: number;
2762
+ return_tax_amount: number;
2763
+ return_total: number;
2764
+ deductionRatio?: number;
2765
+ deductionFixed?: number;
2766
+ totalDeductedTax?: number;
2767
+ totalDeduction?: number;
2768
+ totalDeductionBeforeTax?: number;
2769
+ totalAfterDeduction?: number;
2770
+ taxes?: { [key: string]: any };
2771
+ overwriteDeductionFixed?: number;
2772
+ overwriteTaxExempt?: boolean;
2773
+ tax_exempt?: boolean;
2774
+ overwriteDeductionRatio?: number;
2775
+ shipping_zone?: {
2776
+ geoData: {
2777
+ type: "Polygon";
2778
+ coordinates: number[][][]; // ??????
2779
+ }[];
2780
+ name: string;
2781
+ local_name?: string;
2782
+ shipping_method?: {
2783
+ local_name?: string;
2784
+ name: string;
2785
+ rate?: number;
2786
+ tax?: string;
2787
+ description?: string;
2788
+ local_description?: string;
2789
+ company_namespace: string[];
2790
+ };
2791
+ note?: string;
2792
+ local_note?: string;
2793
+ country: string;
2794
+ reachable: boolean;
2795
+ company_namespace: string[];
2796
+ };
2797
+ payment_method?: {
2798
+ name: string;
2799
+ local_name?: string;
2800
+ fee?: number;
2801
+ rate?: number;
2802
+ type: "online" | "offline";
2803
+ company_namespace: string[];
2804
+ };
2805
+ shipping_price?: number;
2806
+ shipping_tax?: number;
2807
+ shipping_charge?: number;
2808
+ payment_charge?: number;
2809
+ total_with_charges?: number;
2810
+ payment?: { amount?: number };
2811
+ createdAt: string;
2812
+ updatedAt: string;
2813
+ __v: number;
2580
2814
  client_id?: string | Client.ClientSchema;
2581
2815
  custom_status?: string | CustomStatus.CustomStatusSchema;
2582
2816
  tax_number?: string | Pick<Client.ClientSchema, "_id" | "tax_number">;
@@ -3488,4 +3722,32 @@ export namespace Service {
3488
3722
  export type Result = Schema;
3489
3723
  }
3490
3724
  }
3725
+
3726
+ export namespace Inventory {
3727
+ export interface InventorySchema {
3728
+ _id: string;
3729
+ warehouse_id: string;
3730
+ warehouse_name: string;
3731
+ variant_id: string;
3732
+ variant_name: string;
3733
+ product_id: string;
3734
+ product_name: string;
3735
+ listed_price: number;
3736
+ qty: number;
3737
+ UpdatedAt: string;
3738
+ }
3739
+
3740
+ export namespace Find {
3741
+ export type Params = DefaultPaginationQueryParams & {
3742
+ warehouse_id?: string[] | string;
3743
+ variant_id?: string[] | string;
3744
+ rep?: string[] | string;
3745
+ qty?: number[] | number;
3746
+ from_updatedAt?: number;
3747
+ };
3748
+ export interface Result extends DefaultPaginationResult {
3749
+ data: InventorySchema[];
3750
+ }
3751
+ }
3752
+ }
3491
3753
  }
package/test.ts CHANGED
@@ -5,5 +5,4 @@ console.log(clients);
5
5
  repzo.client.create({ name: "kf" });
6
6
  repzo.headers["ho"] = "faf";
7
7
  repzo.client.update("", {});
8
-
9
8
  // repzo.