repzo 1.0.281 → 1.0.283

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.
package/lib/index.d.ts CHANGED
@@ -142,6 +142,8 @@ export declare const end_points: {
142
142
  readonly CALENDAR: "calendar";
143
143
  readonly LINE_TARGET: "line-target";
144
144
  readonly BULK_IMPORT: "bulk-import";
145
+ readonly DELIVERY_NOTE: "delivery-note";
146
+ readonly RESERVATION: "reservation";
145
147
  };
146
148
  export type EndPoints = (typeof end_points)[keyof typeof end_points];
147
149
  export declare const availableService: readonly ["client", "product", "variant", "category", "sub_category", "brand", "product_group", "tax", "measureunit", "measureunitFamily", "media", "priceList", "priceListItem", "team", "returnReason", "rep", "tag", "warehouse", "route", "productModifiersGroup", "channel", "speciality", "clientContact", "paymentTerm", "bank", "bank_list", "customStatus", "customList", "customListItem", "inventoryAdjustmentReason", "workorder", "workorderRequest", "supplier", "quickConvertToPdf", "visit", "activityFeedback", "activityFeedbackV2", "feedbackOption", "invoice", "proforma", "payment", "refund", "settlement", "voidSettlement", "check", "day", "receivingMaterial", "adjustAccount", "transfer", "msl", "mslProduct", "mediaStorage", "storecheckTemplate", "activityStorecheck", "activityItemStatus", "adjustInventory", "inventory", "integrationApp", "joinActionsWebHook", "patchAction", "updateIntegrationMeta", "assetPartType", "assetPart", "assetPartUnit", "assetPartReceival", "assetPartTransfer", "returnAssetPartUnit", "storeAssetPartUnit", "ocrInvoiceJobTemplate", "ocrInvoiceJobGroup", "activityAiSalesOrder", "ocrInvoiceJob", "ocrInvoiceJobPage", "settings", "mailUnsubscribe", "approvalRequest", "safeInvoiceSerialCounter", "clientLocation", "assetType", "asset", "assetUnit", "workorderPortal", "approval", "workorderCategory", "contract", "contractInstallment", "repBalanceSummary", "workorderPortalLink", "customField", "salesAnalyticsReport", "clmPresentation", "clmSequence", "clmSlide", "clmFetch", "pdfMergeField", "visitReason", "targetRule", "plan", "calendar", "lineTarget", "bulkImport"];
@@ -299,6 +301,8 @@ export default class Repzo {
299
301
  readonly CALENDAR: "calendar";
300
302
  readonly LINE_TARGET: "line-target";
301
303
  readonly BULK_IMPORT: "bulk-import";
304
+ readonly DELIVERY_NOTE: "delivery-note";
305
+ readonly RESERVATION: "reservation";
302
306
  };
303
307
  private _retryRequest;
304
308
  private _fetch;
@@ -1393,4 +1397,18 @@ export default class Repzo {
1393
1397
  create: (params: Service.BulkImport.Create.Params, body: Service.BulkImport.Create.Body) => Promise<Service.BulkImport.Create.Result>;
1394
1398
  update: (id: Service.BulkImport.Update.ID) => Promise<Service.BulkImport.Update.Result>;
1395
1399
  };
1400
+ deliveryNote: {
1401
+ _path: "delivery-note";
1402
+ find: (params?: Service.DeliveryNote.Find.Params) => Promise<Service.DeliveryNote.Find.Result>;
1403
+ get: (id: Service.DeliveryNote.Get.ID, params?: Service.DeliveryNote.Get.Params) => Promise<Service.DeliveryNote.Get.Result>;
1404
+ create: (body: Service.DeliveryNote.Create.Body) => Promise<Service.DeliveryNote.Create.Result>;
1405
+ update: (id: Service.DeliveryNote.Update.ID, body: Service.DeliveryNote.Update.Body) => Promise<Service.DeliveryNote.Update.Result>;
1406
+ };
1407
+ reservation: {
1408
+ _path: "reservation";
1409
+ find: (params?: Service.Reservation.Find.Params) => Promise<Service.Reservation.Find.Result>;
1410
+ get: (id: Service.Reservation.Get.ID, params?: Service.Reservation.Get.Params) => Promise<Service.Reservation.Get.Result>;
1411
+ create: (body: Service.Reservation.Create.Body) => Promise<Service.Reservation.Create.Result>;
1412
+ update: (id: Service.Reservation.Update.ID, body: Service.Reservation.Update.Body) => Promise<Service.Reservation.Update.Result>;
1413
+ };
1396
1414
  }
package/lib/index.js CHANGED
@@ -144,6 +144,8 @@ export const end_points = {
144
144
  CALENDAR: "calendar",
145
145
  LINE_TARGET: "line-target",
146
146
  BULK_IMPORT: "bulk-import",
147
+ DELIVERY_NOTE: "delivery-note",
148
+ RESERVATION: "reservation",
147
149
  };
148
150
  export const availableService = [
149
151
  "client",
@@ -2910,6 +2912,42 @@ class Repzo {
2910
2912
  return res;
2911
2913
  },
2912
2914
  };
2915
+ this.deliveryNote = {
2916
+ _path: Repzo._end_points.DELIVERY_NOTE,
2917
+ find: async (params) => {
2918
+ let res = await this._fetch(this.svAPIEndpoint, this.deliveryNote._path, params);
2919
+ return res;
2920
+ },
2921
+ get: async (id, params) => {
2922
+ return await this._fetch(this.svAPIEndpoint, this.deliveryNote._path + `/${id}`, params);
2923
+ },
2924
+ create: async (body) => {
2925
+ let res = await this._create(this.svAPIEndpoint, this.deliveryNote._path, body);
2926
+ return res;
2927
+ },
2928
+ update: async (id, body) => {
2929
+ let res = await this._update(this.svAPIEndpoint, this.deliveryNote._path + `/${id}`, body);
2930
+ return res;
2931
+ },
2932
+ };
2933
+ this.reservation = {
2934
+ _path: Repzo._end_points.RESERVATION,
2935
+ find: async (params) => {
2936
+ let res = await this._fetch(this.svAPIEndpoint, this.reservation._path, params);
2937
+ return res;
2938
+ },
2939
+ get: async (id, params) => {
2940
+ return await this._fetch(this.svAPIEndpoint, this.reservation._path + `/${id}`, params);
2941
+ },
2942
+ create: async (body) => {
2943
+ let res = await this._create(this.svAPIEndpoint, this.reservation._path, body);
2944
+ return res;
2945
+ },
2946
+ update: async (id, body) => {
2947
+ let res = await this._update(this.svAPIEndpoint, this.reservation._path + `/${id}`, body);
2948
+ return res;
2949
+ },
2950
+ };
2913
2951
  this.svAPIEndpoint =
2914
2952
  !options?.env || options?.env == "production"
2915
2953
  ? "https://sv.api.repzo.me"
@@ -440,6 +440,7 @@ export declare namespace Service {
440
440
  status?: StringId;
441
441
  job_category?: StringId[];
442
442
  availability_msl?: StringId[];
443
+ assigned_msl?: StringId[];
443
444
  territory?: StringId;
444
445
  sv_priceList?: StringId;
445
446
  assigned_media?: StringId[];
@@ -523,6 +524,7 @@ export declare namespace Service {
523
524
  status?: StringId;
524
525
  job_category?: StringId[];
525
526
  availability_msl?: StringId[];
527
+ assigned_msl?: StringId[];
526
528
  territory?: StringId;
527
529
  sv_priceList?: StringId;
528
530
  assigned_media?: StringId[];
@@ -587,6 +589,7 @@ export declare namespace Service {
587
589
  sales?: Sales & {
588
590
  logo_media?: StringId | MediaPopulated;
589
591
  };
592
+ assigned_msl?: StringId[] | Pick<Msl.Data, "_id" | "name">[];
590
593
  };
591
594
  export namespace Find {
592
595
  type Params = DefaultPaginationQueryParams & {
@@ -603,7 +606,8 @@ export declare namespace Service {
603
606
  tags?: string[] | string;
604
607
  _id?: string[] | string;
605
608
  assigned_to?: string[] | string;
606
- availability_msl?: string[] | string;
609
+ availability_msl?: StringId[] | StringId;
610
+ assigned_msl?: StringId[] | StringId;
607
611
  status?: string[] | string;
608
612
  CLIENT_TAGS?: string[] | string;
609
613
  AREA_TAGS?: string[] | string;
@@ -892,6 +896,7 @@ export declare namespace Service {
892
896
  updatedAt: string;
893
897
  __v: number;
894
898
  }
899
+ export type Data = VariantSchema;
895
900
  export interface VariantBody {
896
901
  name?: string;
897
902
  product?: string;
@@ -2262,6 +2267,7 @@ export declare namespace Service {
2262
2267
  createdAt: string;
2263
2268
  updatedAt: string;
2264
2269
  }
2270
+ type Data = MslSchema;
2265
2271
  interface CreateBody {
2266
2272
  name: string;
2267
2273
  disabled: boolean;
@@ -2407,6 +2413,7 @@ export declare namespace Service {
2407
2413
  updatedAt: string;
2408
2414
  __v: number;
2409
2415
  }
2416
+ type Data = TeamSchema;
2410
2417
  interface TeamBody {
2411
2418
  name?: string;
2412
2419
  company_namespace?: string[];
@@ -3202,6 +3209,7 @@ export declare namespace Service {
3202
3209
  updatedAt: string;
3203
3210
  __v: number;
3204
3211
  }
3212
+ export type Data = WarehouseSchema;
3205
3213
  export interface WarehouseBody {
3206
3214
  name?: string;
3207
3215
  type?: "van" | "main";
@@ -4289,8 +4297,8 @@ export declare namespace Service {
4289
4297
  group_tax_total?: number;
4290
4298
  }
4291
4299
  export interface Item_Variant {
4292
- product_id: string | {
4293
- _id: string;
4300
+ product_id: StringId | {
4301
+ _id: StringId;
4294
4302
  name: string;
4295
4303
  local_name: string;
4296
4304
  barcode: string;
@@ -4299,8 +4307,8 @@ export declare namespace Service {
4299
4307
  };
4300
4308
  };
4301
4309
  product_name: string;
4302
- variant_id: string | {
4303
- _id: string;
4310
+ variant_id: StringId | {
4311
+ _id: StringId;
4304
4312
  name: string;
4305
4313
  local_name: string;
4306
4314
  sku: string;
@@ -4319,32 +4327,38 @@ export declare namespace Service {
4319
4327
  product_barcode?: string;
4320
4328
  variant_sku?: string;
4321
4329
  variant_barcode?: string;
4322
- _id: string;
4330
+ _id: StringId;
4323
4331
  }
4324
4332
  export interface Schema {
4325
- _id: string;
4333
+ _id: StringId;
4326
4334
  variant: Item_Variant;
4327
4335
  measureunit: {
4328
- _id: string;
4336
+ _id: StringId;
4329
4337
  name: string;
4330
4338
  factor: number;
4331
- parent?: string;
4339
+ parent?: StringId;
4332
4340
  disabled?: boolean;
4333
4341
  company_namespace: string[];
4334
4342
  };
4335
4343
  tax: {
4336
- _id: string;
4344
+ _id: StringId;
4337
4345
  name: string;
4338
4346
  rate: number;
4339
4347
  type: "inclusive" | "additive" | "N/A";
4348
+ ubl_tax_details?: {
4349
+ tax_code: "O" | "Z" | "E" | "S";
4350
+ reason: string;
4351
+ reason_code?: string;
4352
+ };
4340
4353
  disabled?: boolean;
4354
+ company_namespace?: string[];
4341
4355
  };
4342
4356
  promotions?: {
4343
4357
  isGet: boolean;
4344
4358
  taken: number;
4345
4359
  free: number;
4346
4360
  bookings?: {
4347
- promotion: string;
4361
+ promotion: StringId;
4348
4362
  type: "get" | "buy";
4349
4363
  count: number;
4350
4364
  round_id: number;
@@ -4359,22 +4373,23 @@ export declare namespace Service {
4359
4373
  [key: string]: any;
4360
4374
  };
4361
4375
  used_promotions?: {
4362
- id: string;
4376
+ id: StringId;
4363
4377
  name: string;
4364
4378
  ref?: string;
4365
4379
  }[];
4366
4380
  general_promotions?: {
4367
- id: string;
4381
+ id: StringId;
4368
4382
  name: string;
4369
4383
  ref?: string;
4370
4384
  }[];
4371
4385
  applicable_promotions?: {
4372
- id: string;
4386
+ id: StringId;
4373
4387
  name: string;
4374
4388
  ref?: string;
4375
4389
  }[];
4376
4390
  modifiers_groups: ModifierGroup[];
4377
4391
  isAdditional?: boolean;
4392
+ additional_on_promo?: string;
4378
4393
  qty: number;
4379
4394
  base_unit_qty?: number;
4380
4395
  overwritePrice?: number;
@@ -4402,7 +4417,24 @@ export declare namespace Service {
4402
4417
  class: "invoice" | "return";
4403
4418
  note?: string;
4404
4419
  return_reason?: string;
4420
+ variant_batches?: {
4421
+ _id: StringId;
4422
+ batch_number: string;
4423
+ expiry_date?: string;
4424
+ non_txn_quantity?: number;
4425
+ qty: number;
4426
+ base_unit_qty?: number;
4427
+ warehouse?: StringId;
4428
+ non_txn_quantity_in_measure_unit?: number;
4429
+ isSelected?: boolean;
4430
+ }[];
4431
+ delivery_tracking?: {
4432
+ free: number;
4433
+ noted_for_delivery: number;
4434
+ delivered: number;
4435
+ };
4405
4436
  }
4437
+ export type Data = Schema;
4406
4438
  export interface Body {
4407
4439
  variant: Item_Variant;
4408
4440
  measureunit: {
@@ -12307,6 +12339,20 @@ export declare namespace Service {
12307
12339
  print_payment_allowance_period_in_days?: number;
12308
12340
  freshness_window_in_minutes: number;
12309
12341
  bypass_freshness_window_code: string;
12342
+ invoice_delivery_mode: "transactional" | "non_transactional" | "optional";
12343
+ default_invoice_delivery_mode: "transactional" | "non_transactional";
12344
+ invoice_source_msl: {
12345
+ level: "client" | "rep";
12346
+ active: boolean;
12347
+ }[];
12348
+ proforma_source_msl: {
12349
+ level: "all_products" | "client" | "rep";
12350
+ active: boolean;
12351
+ }[];
12352
+ transfer_source_msl: {
12353
+ level: "all_products" | "rep";
12354
+ active: boolean;
12355
+ }[];
12310
12356
  }
12311
12357
  interface WorkorderSettings {
12312
12358
  workorder_teams_follow_assigned_to?: boolean;
@@ -19661,6 +19707,352 @@ export declare namespace Service {
19661
19707
  }
19662
19708
  export {};
19663
19709
  }
19710
+ namespace DeliveryNote {
19711
+ interface User {
19712
+ _id: string;
19713
+ name?: string;
19714
+ type: "admin" | "rep";
19715
+ admin?: string;
19716
+ rep?: string;
19717
+ }
19718
+ type DeliveryNoteItem = {
19719
+ item_index: number;
19720
+ variant: {
19721
+ product_id: StringId;
19722
+ product_name: string;
19723
+ variant_id: StringId | (Pick<Variant.Data, "_id" | "name" | "local_name" | "sku" | "barcode"> & {
19724
+ product: Pick<Product.Data, "_id" | "name" | "local_name" | "sku" | "barcode">;
19725
+ });
19726
+ variant_name: string;
19727
+ variant_local_name?: string;
19728
+ variant_img?: string;
19729
+ variant_cover_photo?: StringId;
19730
+ product_local_name?: string;
19731
+ product_img?: string;
19732
+ product_cover_photo?: StringId;
19733
+ product_sku?: string;
19734
+ product_barcode?: string;
19735
+ variant_sku?: string;
19736
+ variant_barcode?: string;
19737
+ };
19738
+ } & Pick<Item.Data, "_id" | "qty" | "measureunit" | "base_unit_qty" | "modifiers_groups" | "company_namespace" | "variant_batches">;
19739
+ export interface Data {
19740
+ _id: StringId;
19741
+ company_namespace: string[];
19742
+ serial_number: SerialNumber;
19743
+ status: "pending" | "processing" | "approved" | "rejected" | "canceled" | "failed";
19744
+ transaction_processed: boolean;
19745
+ qty_reserved: boolean;
19746
+ client_id: StringId;
19747
+ client_name: string;
19748
+ warehouse_id: StringId;
19749
+ warehouse_name: string;
19750
+ creator: User;
19751
+ editor?: User;
19752
+ implemented_by?: User;
19753
+ time?: number;
19754
+ teams: StringId[];
19755
+ assigned_to: StringId[];
19756
+ sync_id: string;
19757
+ visit_id?: string;
19758
+ client_geo_location?: {
19759
+ lat: number;
19760
+ lng: number;
19761
+ };
19762
+ network_state?: number;
19763
+ platform?: string;
19764
+ version_name?: string;
19765
+ battery_level?: number;
19766
+ time_zone?: string;
19767
+ identifier?: number;
19768
+ device_id?: string;
19769
+ device_unique_id?: string;
19770
+ invoice_id?: StringId;
19771
+ invoice_serial_number?: SerialNumber;
19772
+ proforma_id?: StringId;
19773
+ proforma_serial_number?: SerialNumber;
19774
+ active_transfer_id?: StringId;
19775
+ active_transfer_serial_number?: SerialNumber;
19776
+ items_count?: number;
19777
+ total_items_base_unit_qty?: number;
19778
+ total_measure_unit_qty?: number;
19779
+ items: DeliveryNoteItem[];
19780
+ process_time?: number;
19781
+ failed_reasons?: {
19782
+ code: string;
19783
+ message: string;
19784
+ }[];
19785
+ signature?: StringId;
19786
+ note?: string;
19787
+ media?: StringId[];
19788
+ integration_meta?: Record<string, any>;
19789
+ create_transfer?: boolean;
19790
+ to_warehouse?: StringId;
19791
+ createdAt: Date;
19792
+ updatedAt: Date;
19793
+ }
19794
+ export interface CreateBody {
19795
+ company_namespace: string[];
19796
+ serial_number?: SerialNumber;
19797
+ status?: "pending" | "approved" | "rejected";
19798
+ transaction_processed?: boolean;
19799
+ qty_reserved?: boolean;
19800
+ client_id: StringId;
19801
+ client_name: string;
19802
+ warehouse_id: StringId;
19803
+ warehouse_name: string;
19804
+ creator?: User;
19805
+ implemented_by?: User;
19806
+ time?: number;
19807
+ teams?: StringId[];
19808
+ assigned_to?: StringId[];
19809
+ sync_id: string;
19810
+ visit_id?: string;
19811
+ client_geo_location?: {
19812
+ lat: number;
19813
+ lng: number;
19814
+ };
19815
+ network_state?: number;
19816
+ platform?: string;
19817
+ version_name?: string;
19818
+ battery_level?: number;
19819
+ time_zone?: string;
19820
+ identifier?: number;
19821
+ device_id?: string;
19822
+ device_unique_id?: string;
19823
+ invoice_id?: StringId;
19824
+ invoice_serial_number?: SerialNumber;
19825
+ proforma_id?: StringId;
19826
+ proforma_serial_number?: SerialNumber;
19827
+ active_transfer_id?: StringId;
19828
+ active_transfer_serial_number?: SerialNumber;
19829
+ items_count?: number;
19830
+ total_items_base_unit_qty?: number;
19831
+ total_measure_unit_qty?: number;
19832
+ items: DeliveryNoteItem[];
19833
+ integration_meta?: Record<string, any>;
19834
+ create_transfer?: boolean;
19835
+ to_warehouse?: StringId;
19836
+ }
19837
+ export type UpdateBody = Partial<Data>;
19838
+ export type PopulatedDoc = Data & {
19839
+ client_populated?: Pick<Client.Data, "_id" | "name" | "client_code" | "local_name">[];
19840
+ warehouse_populated?: Pick<Warehouse.Data, "_id" | "name" | "code">[];
19841
+ assigned_to_populated?: Pick<Rep.Data, "_id" | "name">[];
19842
+ teams_populated?: Pick<Team.Data, "_id" | "name">[];
19843
+ invoice_id_populated?: Pick<FullInvoice.Data, "_id" | "serial_number" | "return_serial_number" | "external_serial_number" | "advanced_serial_number">[];
19844
+ proforma_id_populated?: Pick<Proforma.Data, "_id" | "serial_number" | "return_serial_number" | "external_serial_number">[];
19845
+ active_transfer_id_populated?: Pick<Transfer.Data, "_id" | "serial_number" | "status">[];
19846
+ media_populated?: PopulatedMediaStorage[];
19847
+ signature_populated?: PopulatedMediaStorage;
19848
+ cycle?: Cycle.Schema & {
19849
+ approval?: string | Approval.Data;
19850
+ };
19851
+ };
19852
+ type PopulatedKeys = "variant_id" | "client_id" | "warehouse_id" | "assigned_to" | "teams" | "invoice_id" | "proforma_id" | "active_transfer_id" | "media" | "signature";
19853
+ type SortingKeys = "_id" | "createdAt" | "updatedAt" | "time";
19854
+ export namespace Find {
19855
+ type Params = DefaultPaginationQueryParams & {
19856
+ sortBy?: {
19857
+ field: SortingKeys;
19858
+ type: "asc" | "desc";
19859
+ }[];
19860
+ populatedKeys?: PopulatedKeys | PopulatedKeys[];
19861
+ _id?: StringId | StringId[];
19862
+ withCycle?: boolean;
19863
+ status?: Data["status"] | Data["status"][];
19864
+ client_id?: StringId | StringId[];
19865
+ warehouse_id?: StringId | StringId[];
19866
+ teams?: StringId | StringId[];
19867
+ assigned_to?: StringId | StringId[];
19868
+ sync_id?: string | string[];
19869
+ "serial_number.formatted"?: string | string[];
19870
+ transaction_processed?: boolean;
19871
+ qty_reserved?: boolean;
19872
+ invoice_id?: StringId | StringId[];
19873
+ proforma_id?: StringId | StringId[];
19874
+ active_transfer_id?: StringId | StringId[];
19875
+ from_updatedAt?: number;
19876
+ to_updatedAt?: number;
19877
+ from_createdAt?: number;
19878
+ to_createdAt?: number;
19879
+ from_time?: number;
19880
+ to_time?: number;
19881
+ "creator._id"?: StringId | StringId[];
19882
+ "creator.type"?: User["type"] | User["type"][];
19883
+ "items.variant.product_id"?: StringId | StringId[];
19884
+ "items.variant.variant_id"?: StringId | StringId[];
19885
+ };
19886
+ interface Result extends DefaultPaginationResult {
19887
+ data: PopulatedDoc[];
19888
+ }
19889
+ }
19890
+ export namespace Get {
19891
+ type ID = string;
19892
+ type Params = {
19893
+ populatedKeys?: PopulatedKeys[];
19894
+ withCycle?: boolean;
19895
+ };
19896
+ type Result = PopulatedDoc;
19897
+ }
19898
+ export namespace Create {
19899
+ type Body = CreateBody;
19900
+ type Result = Data;
19901
+ }
19902
+ export namespace Update {
19903
+ type ID = StringId;
19904
+ type Body = UpdateBody;
19905
+ type Result = Data;
19906
+ }
19907
+ export {};
19908
+ }
19909
+ namespace Reservation {
19910
+ interface User {
19911
+ _id: StringId;
19912
+ name?: string;
19913
+ type: "admin" | "rep";
19914
+ admin?: StringId;
19915
+ rep?: StringId;
19916
+ }
19917
+ interface Source {
19918
+ _id: StringId;
19919
+ type: "proforma" | "invoice";
19920
+ serial_number: SerialNumber;
19921
+ invoice?: StringId;
19922
+ proforma?: StringId;
19923
+ }
19924
+ interface Item {
19925
+ item_index: number;
19926
+ _id: StringId;
19927
+ variant: {
19928
+ product_id: StringId | Product.Data;
19929
+ product_name: string;
19930
+ variant_id: StringId | Variant.Data;
19931
+ variant_name: string;
19932
+ variant_local_name?: string;
19933
+ variant_img?: string;
19934
+ variant_cover_photo?: StringId;
19935
+ product_local_name?: string;
19936
+ product_img?: string;
19937
+ product_cover_photo?: StringId;
19938
+ product_sku?: string;
19939
+ product_barcode?: string;
19940
+ variant_sku?: string;
19941
+ variant_barcode?: string;
19942
+ };
19943
+ measureunit: {
19944
+ _id: StringId;
19945
+ parent: StringId;
19946
+ name: string;
19947
+ factor: number;
19948
+ disabled: boolean;
19949
+ company_namespace: string[];
19950
+ };
19951
+ qty: number;
19952
+ base_unit_qty?: number;
19953
+ }
19954
+ export interface Data {
19955
+ _id: StringId;
19956
+ company_namespace: string[];
19957
+ serial_number: SerialNumber;
19958
+ qty_reserved: boolean;
19959
+ warehouse_id: StringId;
19960
+ warehouse_name: string;
19961
+ client_id?: StringId;
19962
+ client_name?: string;
19963
+ creator: User;
19964
+ editor?: User;
19965
+ time?: number;
19966
+ teams?: StringId[];
19967
+ sync_id: string;
19968
+ type: "free" | "automated";
19969
+ status: "active" | "revoked" | "cancelled";
19970
+ source?: Source;
19971
+ items_count?: number;
19972
+ total_items_base_unit_qty?: number;
19973
+ total_measure_unit_qty?: number;
19974
+ items: Item[];
19975
+ createdAt: Date;
19976
+ updatedAt: Date;
19977
+ }
19978
+ export interface CreateBody {
19979
+ company_namespace: string[];
19980
+ serial_number?: SerialNumber;
19981
+ qty_reserved?: boolean;
19982
+ warehouse_id: StringId;
19983
+ warehouse_name: string;
19984
+ client_id?: StringId;
19985
+ client_name?: string;
19986
+ creator?: User;
19987
+ time?: number;
19988
+ teams?: StringId[];
19989
+ sync_id: string;
19990
+ type: "free" | "automated";
19991
+ status?: "active" | "revoked" | "cancelled";
19992
+ source?: Source;
19993
+ items_count?: number;
19994
+ total_items_base_unit_qty?: number;
19995
+ total_measure_unit_qty?: number;
19996
+ items: Item[];
19997
+ }
19998
+ export type UpdateBody = Partial<Data>;
19999
+ export type PopulatedDoc = Data & {
20000
+ client_populated?: Pick<Client.Data, "_id" | "name" | "client_code" | "local_name">[];
20001
+ warehouse_populated?: Pick<Warehouse.Data, "_id" | "name" | "code">[];
20002
+ teams_populated?: Pick<Team.Data, "_id" | "name">[];
20003
+ };
20004
+ type PopulatedKeys = "client_id" | "warehouse_id" | "teams";
20005
+ type SortingKeys = "_id";
20006
+ export namespace Find {
20007
+ type Params = DefaultPaginationQueryParams & {
20008
+ sortBy?: {
20009
+ field: SortingKeys;
20010
+ type: "asc" | "desc";
20011
+ }[];
20012
+ populatedKeys?: PopulatedKeys | PopulatedKeys[];
20013
+ _id?: StringId | StringId[];
20014
+ status?: Data["status"] | Data["status"][];
20015
+ client_id?: StringId | StringId[];
20016
+ warehouse_id?: StringId | StringId[];
20017
+ teams?: StringId | StringId[];
20018
+ sync_id?: string | string[];
20019
+ "serial_number.formatted"?: string | string[];
20020
+ from_updatedAt?: number;
20021
+ to_updatedAt?: number;
20022
+ from_createdAt?: number;
20023
+ to_createdAt?: number;
20024
+ "creator._id"?: StringId | StringId[];
20025
+ "creator.type"?: User["type"] | User["type"][];
20026
+ "items.variant.product_id"?: StringId | StringId[];
20027
+ "items.variant.variant_id"?: StringId | StringId[];
20028
+ type?: Data["type"] | Data["type"][];
20029
+ "source.type"?: Source["type"] | Source["type"][];
20030
+ "source._id"?: StringId | StringId[];
20031
+ "source.serial_number.formatted"?: string | string[];
20032
+ };
20033
+ interface Result extends DefaultPaginationResult {
20034
+ data: PopulatedDoc[];
20035
+ }
20036
+ }
20037
+ export namespace Get {
20038
+ type ID = string;
20039
+ type Params = {
20040
+ populatedKeys?: PopulatedKeys[];
20041
+ withCycle?: boolean;
20042
+ };
20043
+ type Result = PopulatedDoc;
20044
+ }
20045
+ export namespace Create {
20046
+ type Body = CreateBody;
20047
+ type Result = Data;
20048
+ }
20049
+ export namespace Update {
20050
+ type ID = StringId;
20051
+ type Body = UpdateBody;
20052
+ type Result = Data;
20053
+ }
20054
+ export {};
20055
+ }
19664
20056
  }
19665
20057
  export type StringId = string;
19666
20058
  export type NameSpaces = string[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "repzo",
3
- "version": "1.0.281",
3
+ "version": "1.0.283",
4
4
  "description": "Repzo TypeScript SDK",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./lib/index.d.ts",
package/src/index.ts CHANGED
@@ -154,6 +154,8 @@ export const end_points = {
154
154
  CALENDAR: "calendar",
155
155
  LINE_TARGET: "line-target",
156
156
  BULK_IMPORT: "bulk-import",
157
+ DELIVERY_NOTE: "delivery-note",
158
+ RESERVATION: "reservation",
157
159
  } as const;
158
160
  export type EndPoints = (typeof end_points)[keyof typeof end_points];
159
161
 
@@ -7273,6 +7275,96 @@ export default class Repzo {
7273
7275
  return res;
7274
7276
  },
7275
7277
  };
7278
+
7279
+ deliveryNote = {
7280
+ _path: Repzo._end_points.DELIVERY_NOTE,
7281
+ find: async (
7282
+ params?: Service.DeliveryNote.Find.Params,
7283
+ ): Promise<Service.DeliveryNote.Find.Result> => {
7284
+ let res: Service.DeliveryNote.Find.Result = await this._fetch(
7285
+ this.svAPIEndpoint,
7286
+ this.deliveryNote._path,
7287
+ params,
7288
+ );
7289
+ return res;
7290
+ },
7291
+ get: async (
7292
+ id: Service.DeliveryNote.Get.ID,
7293
+ params?: Service.DeliveryNote.Get.Params,
7294
+ ): Promise<Service.DeliveryNote.Get.Result> => {
7295
+ return await this._fetch(
7296
+ this.svAPIEndpoint,
7297
+ this.deliveryNote._path + `/${id}`,
7298
+ params,
7299
+ );
7300
+ },
7301
+ create: async (
7302
+ body: Service.DeliveryNote.Create.Body,
7303
+ ): Promise<Service.DeliveryNote.Create.Result> => {
7304
+ let res = await this._create(
7305
+ this.svAPIEndpoint,
7306
+ this.deliveryNote._path,
7307
+ body,
7308
+ );
7309
+ return res;
7310
+ },
7311
+ update: async (
7312
+ id: Service.DeliveryNote.Update.ID,
7313
+ body: Service.DeliveryNote.Update.Body,
7314
+ ): Promise<Service.DeliveryNote.Update.Result> => {
7315
+ let res: Service.DeliveryNote.Update.Result = await this._update(
7316
+ this.svAPIEndpoint,
7317
+ this.deliveryNote._path + `/${id}`,
7318
+ body,
7319
+ );
7320
+ return res;
7321
+ },
7322
+ };
7323
+
7324
+ reservation = {
7325
+ _path: Repzo._end_points.RESERVATION,
7326
+ find: async (
7327
+ params?: Service.Reservation.Find.Params,
7328
+ ): Promise<Service.Reservation.Find.Result> => {
7329
+ let res: Service.Reservation.Find.Result = await this._fetch(
7330
+ this.svAPIEndpoint,
7331
+ this.reservation._path,
7332
+ params,
7333
+ );
7334
+ return res;
7335
+ },
7336
+ get: async (
7337
+ id: Service.Reservation.Get.ID,
7338
+ params?: Service.Reservation.Get.Params,
7339
+ ): Promise<Service.Reservation.Get.Result> => {
7340
+ return await this._fetch(
7341
+ this.svAPIEndpoint,
7342
+ this.reservation._path + `/${id}`,
7343
+ params,
7344
+ );
7345
+ },
7346
+ create: async (
7347
+ body: Service.Reservation.Create.Body,
7348
+ ): Promise<Service.Reservation.Create.Result> => {
7349
+ let res = await this._create(
7350
+ this.svAPIEndpoint,
7351
+ this.reservation._path,
7352
+ body,
7353
+ );
7354
+ return res;
7355
+ },
7356
+ update: async (
7357
+ id: Service.Reservation.Update.ID,
7358
+ body: Service.Reservation.Update.Body,
7359
+ ): Promise<Service.Reservation.Update.Result> => {
7360
+ let res: Service.Reservation.Update.Result = await this._update(
7361
+ this.svAPIEndpoint,
7362
+ this.reservation._path + `/${id}`,
7363
+ body,
7364
+ );
7365
+ return res;
7366
+ },
7367
+ };
7276
7368
  }
7277
7369
 
7278
7370
  function normalizeParams(params: Params): { [key: string]: any } {
@@ -656,6 +656,7 @@ export namespace Service {
656
656
  status?: StringId;
657
657
  job_category?: StringId[];
658
658
  availability_msl?: StringId[];
659
+ assigned_msl?: StringId[];
659
660
  territory?: StringId;
660
661
  sv_priceList?: StringId;
661
662
  assigned_media?: StringId[];
@@ -736,6 +737,7 @@ export namespace Service {
736
737
  status?: StringId;
737
738
  job_category?: StringId[];
738
739
  availability_msl?: StringId[];
740
+ assigned_msl?: StringId[];
739
741
  territory?: StringId;
740
742
  sv_priceList?: StringId;
741
743
  assigned_media?: StringId[];
@@ -831,6 +833,7 @@ export namespace Service {
831
833
  | Pick<PaymentTerm.PaymentTermSchema, "_id" | "name" | "due_days">;
832
834
  sales?: Sales & { logo_media?: StringId | MediaPopulated };
833
835
  // availability_msl?: StringId[] | AvailabilityMsl.AvailabilityMslSchema[];
836
+ assigned_msl?: StringId[] | Pick<Msl.Data, "_id" | "name">[];
834
837
  };
835
838
 
836
839
  export namespace Find {
@@ -848,7 +851,8 @@ export namespace Service {
848
851
  tags?: string[] | string;
849
852
  _id?: string[] | string;
850
853
  assigned_to?: string[] | string;
851
- availability_msl?: string[] | string;
854
+ availability_msl?: StringId[] | StringId;
855
+ assigned_msl?: StringId[] | StringId;
852
856
  status?: string[] | string;
853
857
  CLIENT_TAGS?: string[] | string;
854
858
  AREA_TAGS?: string[] | string;
@@ -1164,6 +1168,7 @@ export namespace Service {
1164
1168
  updatedAt: string;
1165
1169
  __v: number;
1166
1170
  }
1171
+ export type Data = VariantSchema;
1167
1172
  export interface VariantBody {
1168
1173
  name?: string;
1169
1174
  product?: string;
@@ -2673,6 +2678,7 @@ export namespace Service {
2673
2678
  createdAt: string;
2674
2679
  updatedAt: string;
2675
2680
  }
2681
+ export type Data = MslSchema;
2676
2682
  export interface CreateBody {
2677
2683
  name: string;
2678
2684
  disabled: boolean;
@@ -2817,6 +2823,7 @@ export namespace Service {
2817
2823
  updatedAt: string;
2818
2824
  __v: number;
2819
2825
  }
2826
+ export type Data = TeamSchema;
2820
2827
  export interface TeamBody {
2821
2828
  name?: string;
2822
2829
  company_namespace?: string[];
@@ -3698,6 +3705,7 @@ export namespace Service {
3698
3705
  updatedAt: string;
3699
3706
  __v: number;
3700
3707
  }
3708
+ export type Data = WarehouseSchema;
3701
3709
  export interface WarehouseBody {
3702
3710
  name?: string;
3703
3711
  type?: "van" | "main";
@@ -4901,9 +4909,9 @@ export namespace Service {
4901
4909
  }
4902
4910
  export interface Item_Variant {
4903
4911
  product_id:
4904
- | string
4912
+ | StringId
4905
4913
  | {
4906
- _id: string;
4914
+ _id: StringId;
4907
4915
  name: string;
4908
4916
  local_name: string;
4909
4917
  barcode: string;
@@ -4911,9 +4919,9 @@ export namespace Service {
4911
4919
  };
4912
4920
  product_name: string;
4913
4921
  variant_id:
4914
- | string
4922
+ | StringId
4915
4923
  | {
4916
- _id: string;
4924
+ _id: StringId;
4917
4925
  name: string;
4918
4926
  local_name: string;
4919
4927
  sku: string;
@@ -4930,32 +4938,38 @@ export namespace Service {
4930
4938
  product_barcode?: string;
4931
4939
  variant_sku?: string;
4932
4940
  variant_barcode?: string;
4933
- _id: string;
4941
+ _id: StringId;
4934
4942
  }
4935
4943
  export interface Schema {
4936
- _id: string;
4944
+ _id: StringId;
4937
4945
  variant: Item_Variant;
4938
4946
  measureunit: {
4939
- _id: string;
4947
+ _id: StringId;
4940
4948
  name: string;
4941
4949
  factor: number;
4942
- parent?: string;
4950
+ parent?: StringId;
4943
4951
  disabled?: boolean;
4944
4952
  company_namespace: string[];
4945
4953
  };
4946
4954
  tax: {
4947
- _id: string;
4955
+ _id: StringId;
4948
4956
  name: string;
4949
4957
  rate: number;
4950
4958
  type: "inclusive" | "additive" | "N/A";
4959
+ ubl_tax_details?: {
4960
+ tax_code: "O" | "Z" | "E" | "S";
4961
+ reason: string;
4962
+ reason_code?: string;
4963
+ };
4951
4964
  disabled?: boolean;
4965
+ company_namespace?: string[];
4952
4966
  };
4953
4967
  promotions?: {
4954
4968
  isGet: boolean;
4955
4969
  taken: number;
4956
4970
  free: number;
4957
4971
  bookings?: {
4958
- promotion: string;
4972
+ promotion: StringId;
4959
4973
  type: "get" | "buy";
4960
4974
  count: number;
4961
4975
  round_id: number;
@@ -4969,11 +4983,12 @@ export namespace Service {
4969
4983
  highlight: boolean;
4970
4984
  [key: string]: any;
4971
4985
  };
4972
- used_promotions?: { id: string; name: string; ref?: string }[];
4973
- general_promotions?: { id: string; name: string; ref?: string }[];
4974
- applicable_promotions?: { id: string; name: string; ref?: string }[];
4986
+ used_promotions?: { id: StringId; name: string; ref?: string }[];
4987
+ general_promotions?: { id: StringId; name: string; ref?: string }[];
4988
+ applicable_promotions?: { id: StringId; name: string; ref?: string }[];
4975
4989
  modifiers_groups: ModifierGroup[];
4976
4990
  isAdditional?: boolean;
4991
+ additional_on_promo?: string;
4977
4992
  qty: number;
4978
4993
  base_unit_qty?: number;
4979
4994
  overwritePrice?: number;
@@ -5001,7 +5016,24 @@ export namespace Service {
5001
5016
  class: "invoice" | "return";
5002
5017
  note?: string;
5003
5018
  return_reason?: string;
5019
+ variant_batches?: {
5020
+ _id: StringId;
5021
+ batch_number: string;
5022
+ expiry_date?: string;
5023
+ non_txn_quantity?: number;
5024
+ qty: number;
5025
+ base_unit_qty?: number;
5026
+ warehouse?: StringId;
5027
+ non_txn_quantity_in_measure_unit?: number;
5028
+ isSelected?: boolean;
5029
+ }[];
5030
+ delivery_tracking?: {
5031
+ free: number;
5032
+ noted_for_delivery: number;
5033
+ delivered: number;
5034
+ };
5004
5035
  }
5036
+ export type Data = Schema;
5005
5037
  export interface Body {
5006
5038
  variant: Item_Variant;
5007
5039
  measureunit: {
@@ -13065,6 +13097,14 @@ export namespace Service {
13065
13097
  print_payment_allowance_period_in_days?: number;
13066
13098
  freshness_window_in_minutes: number;
13067
13099
  bypass_freshness_window_code: string;
13100
+ invoice_delivery_mode: "transactional" | "non_transactional" | "optional";
13101
+ default_invoice_delivery_mode: "transactional" | "non_transactional";
13102
+ invoice_source_msl: { level: "client" | "rep"; active: boolean }[];
13103
+ proforma_source_msl: {
13104
+ level: "all_products" | "client" | "rep";
13105
+ active: boolean;
13106
+ }[];
13107
+ transfer_source_msl: { level: "all_products" | "rep"; active: boolean }[];
13068
13108
  }
13069
13109
 
13070
13110
  export interface WorkorderSettings {
@@ -22022,6 +22062,402 @@ export namespace Service {
22022
22062
  export type Result = Data;
22023
22063
  }
22024
22064
  }
22065
+
22066
+ export namespace DeliveryNote {
22067
+ interface User {
22068
+ _id: string;
22069
+ name?: string;
22070
+ type: "admin" | "rep";
22071
+ admin?: string;
22072
+ rep?: string;
22073
+ }
22074
+
22075
+ type DeliveryNoteItem = {
22076
+ item_index: number;
22077
+ variant: {
22078
+ product_id: StringId;
22079
+ product_name: string;
22080
+ variant_id:
22081
+ | StringId
22082
+ | (Pick<
22083
+ Variant.Data,
22084
+ "_id" | "name" | "local_name" | "sku" | "barcode"
22085
+ > & {
22086
+ product: Pick<
22087
+ Product.Data,
22088
+ "_id" | "name" | "local_name" | "sku" | "barcode"
22089
+ >;
22090
+ });
22091
+ variant_name: string;
22092
+ variant_local_name?: string;
22093
+ variant_img?: string;
22094
+ variant_cover_photo?: StringId;
22095
+ product_local_name?: string;
22096
+ product_img?: string;
22097
+ product_cover_photo?: StringId;
22098
+ product_sku?: string;
22099
+ product_barcode?: string;
22100
+ variant_sku?: string;
22101
+ variant_barcode?: string;
22102
+ };
22103
+ } & Pick<
22104
+ Item.Data,
22105
+ | "_id"
22106
+ | "qty"
22107
+ | "measureunit"
22108
+ | "base_unit_qty"
22109
+ | "modifiers_groups"
22110
+ | "company_namespace"
22111
+ | "variant_batches"
22112
+ >;
22113
+
22114
+ export interface Data {
22115
+ _id: StringId;
22116
+ company_namespace: string[];
22117
+ serial_number: SerialNumber;
22118
+ status:
22119
+ | "pending" // when create
22120
+ | "processing" // after first transfer
22121
+ | "approved" // action from client
22122
+ | "rejected" // action from client
22123
+ | "canceled" // action from rep/admin to disabled the delivery note
22124
+ | "failed"; // when create but the items was reserved to another delivery-notes
22125
+ transaction_processed: boolean;
22126
+ qty_reserved: boolean;
22127
+ client_id: StringId;
22128
+ client_name: string;
22129
+ warehouse_id: StringId;
22130
+ warehouse_name: string;
22131
+ creator: User;
22132
+ editor?: User;
22133
+ implemented_by?: User;
22134
+ time?: number;
22135
+ teams: StringId[];
22136
+ assigned_to: StringId[];
22137
+ sync_id: string;
22138
+ visit_id?: string;
22139
+ client_geo_location?: { lat: number; lng: number };
22140
+ network_state?: number;
22141
+ platform?: string;
22142
+ version_name?: string;
22143
+ battery_level?: number;
22144
+ time_zone?: string;
22145
+ identifier?: number;
22146
+ device_id?: string;
22147
+ device_unique_id?: string;
22148
+ invoice_id?: StringId;
22149
+ invoice_serial_number?: SerialNumber;
22150
+ proforma_id?: StringId;
22151
+ proforma_serial_number?: SerialNumber;
22152
+ active_transfer_id?: StringId;
22153
+ active_transfer_serial_number?: SerialNumber;
22154
+ items_count?: number;
22155
+ total_items_base_unit_qty?: number;
22156
+ total_measure_unit_qty?: number;
22157
+ items: DeliveryNoteItem[];
22158
+ process_time?: number;
22159
+ failed_reasons?: { code: string; message: string }[];
22160
+ signature?: StringId;
22161
+ note?: string;
22162
+ media?: StringId[];
22163
+ integration_meta?: Record<string, any>;
22164
+ create_transfer?: boolean;
22165
+ to_warehouse?: StringId;
22166
+ createdAt: Date;
22167
+ updatedAt: Date;
22168
+ }
22169
+ export interface CreateBody {
22170
+ company_namespace: string[];
22171
+ serial_number?: SerialNumber;
22172
+ status?: "pending" | "approved" | "rejected";
22173
+ transaction_processed?: boolean;
22174
+ qty_reserved?: boolean;
22175
+ client_id: StringId;
22176
+ client_name: string;
22177
+ warehouse_id: StringId;
22178
+ warehouse_name: string;
22179
+ creator?: User;
22180
+ implemented_by?: User;
22181
+ time?: number;
22182
+ teams?: StringId[];
22183
+ assigned_to?: StringId[];
22184
+ sync_id: string;
22185
+ visit_id?: string;
22186
+ client_geo_location?: { lat: number; lng: number };
22187
+ network_state?: number;
22188
+ platform?: string;
22189
+ version_name?: string;
22190
+ battery_level?: number;
22191
+ time_zone?: string;
22192
+ identifier?: number;
22193
+ device_id?: string;
22194
+ device_unique_id?: string;
22195
+ invoice_id?: StringId;
22196
+ invoice_serial_number?: SerialNumber;
22197
+ proforma_id?: StringId;
22198
+ proforma_serial_number?: SerialNumber;
22199
+ active_transfer_id?: StringId;
22200
+ active_transfer_serial_number?: SerialNumber;
22201
+ items_count?: number;
22202
+ total_items_base_unit_qty?: number;
22203
+ total_measure_unit_qty?: number;
22204
+ items: DeliveryNoteItem[];
22205
+ integration_meta?: Record<string, any>;
22206
+ create_transfer?: boolean;
22207
+ to_warehouse?: StringId;
22208
+ }
22209
+ export type UpdateBody = Partial<Data>;
22210
+
22211
+ export type PopulatedDoc = Data & {
22212
+ client_populated?: Pick<
22213
+ Client.Data,
22214
+ "_id" | "name" | "client_code" | "local_name"
22215
+ >[];
22216
+ warehouse_populated?: Pick<Warehouse.Data, "_id" | "name" | "code">[];
22217
+ assigned_to_populated?: Pick<Rep.Data, "_id" | "name">[];
22218
+ teams_populated?: Pick<Team.Data, "_id" | "name">[];
22219
+ invoice_id_populated?: Pick<
22220
+ FullInvoice.Data,
22221
+ | "_id"
22222
+ | "serial_number"
22223
+ | "return_serial_number"
22224
+ | "external_serial_number"
22225
+ | "advanced_serial_number"
22226
+ >[];
22227
+ proforma_id_populated?: Pick<
22228
+ Proforma.Data,
22229
+ | "_id"
22230
+ | "serial_number"
22231
+ | "return_serial_number"
22232
+ | "external_serial_number"
22233
+ >[];
22234
+ active_transfer_id_populated?: Pick<
22235
+ Transfer.Data,
22236
+ "_id" | "serial_number" | "status"
22237
+ >[];
22238
+ media_populated?: PopulatedMediaStorage[];
22239
+ signature_populated?: PopulatedMediaStorage;
22240
+ cycle?: Cycle.Schema & { approval?: string | Approval.Data };
22241
+ };
22242
+
22243
+ type PopulatedKeys =
22244
+ | "variant_id"
22245
+ | "client_id"
22246
+ | "warehouse_id"
22247
+ | "assigned_to"
22248
+ | "teams"
22249
+ | "invoice_id"
22250
+ | "proforma_id"
22251
+ | "active_transfer_id"
22252
+ | "media"
22253
+ | "signature";
22254
+ type SortingKeys = "_id" | "createdAt" | "updatedAt" | "time";
22255
+
22256
+ export namespace Find {
22257
+ export type Params = DefaultPaginationQueryParams & {
22258
+ sortBy?: { field: SortingKeys; type: "asc" | "desc" }[];
22259
+ populatedKeys?: PopulatedKeys | PopulatedKeys[];
22260
+ _id?: StringId | StringId[];
22261
+ withCycle?: boolean;
22262
+ status?: Data["status"] | Data["status"][];
22263
+ client_id?: StringId | StringId[];
22264
+ warehouse_id?: StringId | StringId[];
22265
+ teams?: StringId | StringId[];
22266
+ assigned_to?: StringId | StringId[];
22267
+ sync_id?: string | string[];
22268
+ "serial_number.formatted"?: string | string[];
22269
+ transaction_processed?: boolean;
22270
+ qty_reserved?: boolean;
22271
+ invoice_id?: StringId | StringId[];
22272
+ proforma_id?: StringId | StringId[];
22273
+ active_transfer_id?: StringId | StringId[];
22274
+ from_updatedAt?: number;
22275
+ to_updatedAt?: number;
22276
+ from_createdAt?: number;
22277
+ to_createdAt?: number;
22278
+ from_time?: number;
22279
+ to_time?: number;
22280
+ "creator._id"?: StringId | StringId[];
22281
+ "creator.type"?: User["type"] | User["type"][];
22282
+ "items.variant.product_id"?: StringId | StringId[];
22283
+ "items.variant.variant_id"?: StringId | StringId[];
22284
+ };
22285
+ export interface Result extends DefaultPaginationResult {
22286
+ data: PopulatedDoc[];
22287
+ }
22288
+ }
22289
+ export namespace Get {
22290
+ export type ID = string;
22291
+ export type Params = {
22292
+ populatedKeys?: PopulatedKeys[];
22293
+ withCycle?: boolean;
22294
+ };
22295
+ export type Result = PopulatedDoc;
22296
+ }
22297
+ export namespace Create {
22298
+ export type Body = CreateBody;
22299
+ export type Result = Data;
22300
+ }
22301
+ export namespace Update {
22302
+ export type ID = StringId;
22303
+ export type Body = UpdateBody;
22304
+ export type Result = Data;
22305
+ }
22306
+ }
22307
+
22308
+ export namespace Reservation {
22309
+ interface User {
22310
+ _id: StringId;
22311
+ name?: string;
22312
+ type: "admin" | "rep";
22313
+ admin?: StringId;
22314
+ rep?: StringId;
22315
+ }
22316
+
22317
+ interface Source {
22318
+ _id: StringId;
22319
+ type: "proforma" | "invoice";
22320
+ serial_number: SerialNumber;
22321
+ invoice?: StringId;
22322
+ proforma?: StringId;
22323
+ }
22324
+
22325
+ interface Item {
22326
+ item_index: number;
22327
+ _id: StringId;
22328
+ variant: {
22329
+ product_id: StringId | Product.Data;
22330
+ product_name: string;
22331
+ variant_id: StringId | Variant.Data;
22332
+ variant_name: string;
22333
+ variant_local_name?: string;
22334
+ variant_img?: string;
22335
+ variant_cover_photo?: StringId;
22336
+ product_local_name?: string;
22337
+ product_img?: string;
22338
+ product_cover_photo?: StringId;
22339
+ product_sku?: string;
22340
+ product_barcode?: string;
22341
+ variant_sku?: string;
22342
+ variant_barcode?: string;
22343
+ };
22344
+ measureunit: {
22345
+ _id: StringId;
22346
+ parent: StringId;
22347
+ name: string;
22348
+ factor: number;
22349
+ disabled: boolean;
22350
+ company_namespace: string[];
22351
+ };
22352
+ qty: number;
22353
+ base_unit_qty?: number;
22354
+ }
22355
+
22356
+ export interface Data {
22357
+ _id: StringId;
22358
+ company_namespace: string[];
22359
+ serial_number: SerialNumber;
22360
+ qty_reserved: boolean;
22361
+ warehouse_id: StringId;
22362
+ warehouse_name: string;
22363
+ client_id?: StringId;
22364
+ client_name?: string;
22365
+ creator: User;
22366
+ editor?: User;
22367
+ time?: number;
22368
+ teams?: StringId[];
22369
+ sync_id: string;
22370
+ type: "free" | "automated";
22371
+ status: "active" | "revoked" | "cancelled";
22372
+ source?: Source;
22373
+ items_count?: number;
22374
+ total_items_base_unit_qty?: number;
22375
+ total_measure_unit_qty?: number;
22376
+ items: Item[];
22377
+ createdAt: Date;
22378
+ updatedAt: Date;
22379
+ }
22380
+
22381
+ export interface CreateBody {
22382
+ company_namespace: string[];
22383
+ serial_number?: SerialNumber;
22384
+ qty_reserved?: boolean;
22385
+ warehouse_id: StringId;
22386
+ warehouse_name: string;
22387
+ client_id?: StringId;
22388
+ client_name?: string;
22389
+ creator?: User;
22390
+ time?: number;
22391
+ teams?: StringId[];
22392
+ sync_id: string;
22393
+ type: "free" | "automated";
22394
+ status?: "active" | "revoked" | "cancelled";
22395
+ source?: Source;
22396
+ items_count?: number;
22397
+ total_items_base_unit_qty?: number;
22398
+ total_measure_unit_qty?: number;
22399
+ items: Item[];
22400
+ }
22401
+ export type UpdateBody = Partial<Data>;
22402
+
22403
+ export type PopulatedDoc = Data & {
22404
+ client_populated?: Pick<
22405
+ Client.Data,
22406
+ "_id" | "name" | "client_code" | "local_name"
22407
+ >[];
22408
+ warehouse_populated?: Pick<Warehouse.Data, "_id" | "name" | "code">[];
22409
+ teams_populated?: Pick<Team.Data, "_id" | "name">[];
22410
+ };
22411
+
22412
+ type PopulatedKeys = "client_id" | "warehouse_id" | "teams"; // | "variant_id"
22413
+ type SortingKeys = "_id";
22414
+
22415
+ export namespace Find {
22416
+ export type Params = DefaultPaginationQueryParams & {
22417
+ sortBy?: { field: SortingKeys; type: "asc" | "desc" }[];
22418
+ populatedKeys?: PopulatedKeys | PopulatedKeys[];
22419
+ _id?: StringId | StringId[];
22420
+ status?: Data["status"] | Data["status"][];
22421
+ client_id?: StringId | StringId[];
22422
+ warehouse_id?: StringId | StringId[];
22423
+ teams?: StringId | StringId[];
22424
+ sync_id?: string | string[];
22425
+ "serial_number.formatted"?: string | string[];
22426
+ from_updatedAt?: number;
22427
+ to_updatedAt?: number;
22428
+ from_createdAt?: number;
22429
+ to_createdAt?: number;
22430
+ "creator._id"?: StringId | StringId[];
22431
+ "creator.type"?: User["type"] | User["type"][];
22432
+ "items.variant.product_id"?: StringId | StringId[];
22433
+ "items.variant.variant_id"?: StringId | StringId[];
22434
+ type?: Data["type"] | Data["type"][];
22435
+ "source.type"?: Source["type"] | Source["type"][];
22436
+ "source._id"?: StringId | StringId[];
22437
+ "source.serial_number.formatted"?: string | string[];
22438
+ };
22439
+ export interface Result extends DefaultPaginationResult {
22440
+ data: PopulatedDoc[];
22441
+ }
22442
+ }
22443
+ export namespace Get {
22444
+ export type ID = string;
22445
+ export type Params = {
22446
+ populatedKeys?: PopulatedKeys[];
22447
+ withCycle?: boolean;
22448
+ };
22449
+ export type Result = PopulatedDoc;
22450
+ }
22451
+ export namespace Create {
22452
+ export type Body = CreateBody;
22453
+ export type Result = Data;
22454
+ }
22455
+ export namespace Update {
22456
+ export type ID = StringId;
22457
+ export type Body = UpdateBody;
22458
+ export type Result = Data;
22459
+ }
22460
+ }
22025
22461
  }
22026
22462
 
22027
22463
  export type StringId = string;