@bibike/erp-sdk 1.1.2 → 1.1.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.
- package/dist/index.d.mts +52 -1
- package/dist/index.d.ts +52 -1
- package/dist/index.js +31 -0
- package/dist/index.mjs +31 -0
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -69,6 +69,12 @@ interface User {
|
|
|
69
69
|
organization_name?: string;
|
|
70
70
|
permissions?: string[];
|
|
71
71
|
}
|
|
72
|
+
interface ProductImage {
|
|
73
|
+
id: number;
|
|
74
|
+
url: string;
|
|
75
|
+
is_primary: boolean;
|
|
76
|
+
display_order: number;
|
|
77
|
+
}
|
|
72
78
|
interface Product {
|
|
73
79
|
id: number;
|
|
74
80
|
organization_id: number;
|
|
@@ -83,9 +89,12 @@ interface Product {
|
|
|
83
89
|
unit_price: number;
|
|
84
90
|
cost_price?: number;
|
|
85
91
|
reorder_level?: number;
|
|
92
|
+
total_stock?: number;
|
|
86
93
|
is_active: boolean;
|
|
94
|
+
images?: ProductImage[];
|
|
87
95
|
created_at: string;
|
|
88
96
|
updated_at?: string;
|
|
97
|
+
deleted_at?: string | null;
|
|
89
98
|
}
|
|
90
99
|
interface CreateProductInput {
|
|
91
100
|
name: string;
|
|
@@ -183,6 +192,7 @@ interface SaleItem {
|
|
|
183
192
|
total: number;
|
|
184
193
|
}
|
|
185
194
|
interface CreateSaleInput {
|
|
195
|
+
location_id?: number;
|
|
186
196
|
customer_id?: number;
|
|
187
197
|
warehouse_id?: number;
|
|
188
198
|
shop_id?: number;
|
|
@@ -543,6 +553,17 @@ interface Location {
|
|
|
543
553
|
address?: string;
|
|
544
554
|
is_active: boolean;
|
|
545
555
|
}
|
|
556
|
+
interface LocationInventoryItem {
|
|
557
|
+
product_id: number;
|
|
558
|
+
product_name: string;
|
|
559
|
+
sku?: string;
|
|
560
|
+
barcode?: string;
|
|
561
|
+
category?: string;
|
|
562
|
+
unit_price: number;
|
|
563
|
+
quantity: number;
|
|
564
|
+
reserved_quantity?: number;
|
|
565
|
+
available_quantity?: number;
|
|
566
|
+
}
|
|
546
567
|
|
|
547
568
|
/**
|
|
548
569
|
* Bibike ERP SDK Client
|
|
@@ -769,12 +790,42 @@ declare class BibikeClient {
|
|
|
769
790
|
dashboard: () => Promise<ApiResponse<DashboardStats>>;
|
|
770
791
|
};
|
|
771
792
|
readonly locations: {
|
|
793
|
+
/**
|
|
794
|
+
* @deprecated Use `locations.all()` instead. This method requires legacy
|
|
795
|
+
* `warehouses.view` permission which may not be available to all users.
|
|
796
|
+
* The unified locations API uses location scoping for access control.
|
|
797
|
+
*/
|
|
772
798
|
warehouses: () => Promise<ApiResponse<Warehouse[]>>;
|
|
799
|
+
/**
|
|
800
|
+
* @deprecated Use `locations.all()` instead. This method requires legacy
|
|
801
|
+
* `shops.view` permission which may not be available to all users.
|
|
802
|
+
* The unified locations API uses location scoping for access control.
|
|
803
|
+
*/
|
|
773
804
|
shops: () => Promise<ApiResponse<Shop[]>>;
|
|
805
|
+
/**
|
|
806
|
+
* Get all locations using the unified locations API.
|
|
807
|
+
* Uses location scoping for access control (no legacy permissions required).
|
|
808
|
+
* @param params.type_id - Filter by location type ID
|
|
809
|
+
* @param params.capability - Filter by capability: 'sellable', 'receivable', 'stockable', 'transferable'
|
|
810
|
+
*/
|
|
774
811
|
all: (params?: {
|
|
775
812
|
type_id?: number;
|
|
776
813
|
capability?: string;
|
|
777
814
|
}) => Promise<ApiResponse<Location[]>>;
|
|
815
|
+
/**
|
|
816
|
+
* Get locations by capability (e.g., sellable locations for POS)
|
|
817
|
+
* @param capability - One of: 'sellable', 'receivable', 'stockable', 'transferable'
|
|
818
|
+
*/
|
|
819
|
+
byCapability: (capability: "sellable" | "receivable" | "stockable" | "transferable") => Promise<ApiResponse<Location[]>>;
|
|
820
|
+
/**
|
|
821
|
+
* Get inventory for a specific location
|
|
822
|
+
* Returns products with stock quantities at the specified location
|
|
823
|
+
* @param locationId - The location ID to get inventory for
|
|
824
|
+
*/
|
|
825
|
+
inventory: (locationId: number) => Promise<ApiResponse<{
|
|
826
|
+
location: Location;
|
|
827
|
+
inventory: LocationInventoryItem[];
|
|
828
|
+
}>>;
|
|
778
829
|
};
|
|
779
830
|
private request;
|
|
780
831
|
}
|
|
@@ -784,4 +835,4 @@ declare class BibikeApiError extends Error {
|
|
|
784
835
|
constructor(message: string, statusCode: number, code?: string | undefined);
|
|
785
836
|
}
|
|
786
837
|
|
|
787
|
-
export { type Account, type Activity, type ApiResponse, type Attendance, type AuthResponse, BibikeApiError, BibikeClient, type BibikeConfig, type CreateAdjustmentInput, type CreateCustomerInput, type CreateJournalEntryInput, type CreateProductInput, type CreatePurchaseOrderInput, type CreateSaleInput, type CreateSupplierInput, type CreateTransferInput, type CreateWebhookInput, type Customer, type DashboardStats, type DateRangeParams, type Department, type Employee, type InventoryItem, type InventoryReport, type JournalEntry, type JournalLine, type Lead, type LeaveRequest, type Location, type LoginCredentials, type LoginResponse, type Opportunity, type POSSession, type PaginatedResponse, type PaginationParams, type Position, type Product, type ProfitLossReport, type PurchaseOrder, type PurchaseOrderItem, type PurchaseRequisition, type Quotation, type Sale, type SaleItem, type SalesOrder, type SalesReport, type Shop, type StockAdjustment, type StockTransfer, type StockTransferItem, type Supplier, type TaxRate, type TwoFactorRequiredResponse, type TwoFactorVerifyInput, type UpdateProductInput, type User, type Warehouse, type Webhook, type WebhookDelivery, type WebhookEvent };
|
|
838
|
+
export { type Account, type Activity, type ApiResponse, type Attendance, type AuthResponse, BibikeApiError, BibikeClient, type BibikeConfig, type CreateAdjustmentInput, type CreateCustomerInput, type CreateJournalEntryInput, type CreateProductInput, type CreatePurchaseOrderInput, type CreateSaleInput, type CreateSupplierInput, type CreateTransferInput, type CreateWebhookInput, type Customer, type DashboardStats, type DateRangeParams, type Department, type Employee, type InventoryItem, type InventoryReport, type JournalEntry, type JournalLine, type Lead, type LeaveRequest, type Location, type LocationInventoryItem, type LoginCredentials, type LoginResponse, type Opportunity, type POSSession, type PaginatedResponse, type PaginationParams, type Position, type Product, type ProductImage, type ProfitLossReport, type PurchaseOrder, type PurchaseOrderItem, type PurchaseRequisition, type Quotation, type Sale, type SaleItem, type SalesOrder, type SalesReport, type Shop, type StockAdjustment, type StockTransfer, type StockTransferItem, type Supplier, type TaxRate, type TwoFactorRequiredResponse, type TwoFactorVerifyInput, type UpdateProductInput, type User, type Warehouse, type Webhook, type WebhookDelivery, type WebhookEvent };
|
package/dist/index.d.ts
CHANGED
|
@@ -69,6 +69,12 @@ interface User {
|
|
|
69
69
|
organization_name?: string;
|
|
70
70
|
permissions?: string[];
|
|
71
71
|
}
|
|
72
|
+
interface ProductImage {
|
|
73
|
+
id: number;
|
|
74
|
+
url: string;
|
|
75
|
+
is_primary: boolean;
|
|
76
|
+
display_order: number;
|
|
77
|
+
}
|
|
72
78
|
interface Product {
|
|
73
79
|
id: number;
|
|
74
80
|
organization_id: number;
|
|
@@ -83,9 +89,12 @@ interface Product {
|
|
|
83
89
|
unit_price: number;
|
|
84
90
|
cost_price?: number;
|
|
85
91
|
reorder_level?: number;
|
|
92
|
+
total_stock?: number;
|
|
86
93
|
is_active: boolean;
|
|
94
|
+
images?: ProductImage[];
|
|
87
95
|
created_at: string;
|
|
88
96
|
updated_at?: string;
|
|
97
|
+
deleted_at?: string | null;
|
|
89
98
|
}
|
|
90
99
|
interface CreateProductInput {
|
|
91
100
|
name: string;
|
|
@@ -183,6 +192,7 @@ interface SaleItem {
|
|
|
183
192
|
total: number;
|
|
184
193
|
}
|
|
185
194
|
interface CreateSaleInput {
|
|
195
|
+
location_id?: number;
|
|
186
196
|
customer_id?: number;
|
|
187
197
|
warehouse_id?: number;
|
|
188
198
|
shop_id?: number;
|
|
@@ -543,6 +553,17 @@ interface Location {
|
|
|
543
553
|
address?: string;
|
|
544
554
|
is_active: boolean;
|
|
545
555
|
}
|
|
556
|
+
interface LocationInventoryItem {
|
|
557
|
+
product_id: number;
|
|
558
|
+
product_name: string;
|
|
559
|
+
sku?: string;
|
|
560
|
+
barcode?: string;
|
|
561
|
+
category?: string;
|
|
562
|
+
unit_price: number;
|
|
563
|
+
quantity: number;
|
|
564
|
+
reserved_quantity?: number;
|
|
565
|
+
available_quantity?: number;
|
|
566
|
+
}
|
|
546
567
|
|
|
547
568
|
/**
|
|
548
569
|
* Bibike ERP SDK Client
|
|
@@ -769,12 +790,42 @@ declare class BibikeClient {
|
|
|
769
790
|
dashboard: () => Promise<ApiResponse<DashboardStats>>;
|
|
770
791
|
};
|
|
771
792
|
readonly locations: {
|
|
793
|
+
/**
|
|
794
|
+
* @deprecated Use `locations.all()` instead. This method requires legacy
|
|
795
|
+
* `warehouses.view` permission which may not be available to all users.
|
|
796
|
+
* The unified locations API uses location scoping for access control.
|
|
797
|
+
*/
|
|
772
798
|
warehouses: () => Promise<ApiResponse<Warehouse[]>>;
|
|
799
|
+
/**
|
|
800
|
+
* @deprecated Use `locations.all()` instead. This method requires legacy
|
|
801
|
+
* `shops.view` permission which may not be available to all users.
|
|
802
|
+
* The unified locations API uses location scoping for access control.
|
|
803
|
+
*/
|
|
773
804
|
shops: () => Promise<ApiResponse<Shop[]>>;
|
|
805
|
+
/**
|
|
806
|
+
* Get all locations using the unified locations API.
|
|
807
|
+
* Uses location scoping for access control (no legacy permissions required).
|
|
808
|
+
* @param params.type_id - Filter by location type ID
|
|
809
|
+
* @param params.capability - Filter by capability: 'sellable', 'receivable', 'stockable', 'transferable'
|
|
810
|
+
*/
|
|
774
811
|
all: (params?: {
|
|
775
812
|
type_id?: number;
|
|
776
813
|
capability?: string;
|
|
777
814
|
}) => Promise<ApiResponse<Location[]>>;
|
|
815
|
+
/**
|
|
816
|
+
* Get locations by capability (e.g., sellable locations for POS)
|
|
817
|
+
* @param capability - One of: 'sellable', 'receivable', 'stockable', 'transferable'
|
|
818
|
+
*/
|
|
819
|
+
byCapability: (capability: "sellable" | "receivable" | "stockable" | "transferable") => Promise<ApiResponse<Location[]>>;
|
|
820
|
+
/**
|
|
821
|
+
* Get inventory for a specific location
|
|
822
|
+
* Returns products with stock quantities at the specified location
|
|
823
|
+
* @param locationId - The location ID to get inventory for
|
|
824
|
+
*/
|
|
825
|
+
inventory: (locationId: number) => Promise<ApiResponse<{
|
|
826
|
+
location: Location;
|
|
827
|
+
inventory: LocationInventoryItem[];
|
|
828
|
+
}>>;
|
|
778
829
|
};
|
|
779
830
|
private request;
|
|
780
831
|
}
|
|
@@ -784,4 +835,4 @@ declare class BibikeApiError extends Error {
|
|
|
784
835
|
constructor(message: string, statusCode: number, code?: string | undefined);
|
|
785
836
|
}
|
|
786
837
|
|
|
787
|
-
export { type Account, type Activity, type ApiResponse, type Attendance, type AuthResponse, BibikeApiError, BibikeClient, type BibikeConfig, type CreateAdjustmentInput, type CreateCustomerInput, type CreateJournalEntryInput, type CreateProductInput, type CreatePurchaseOrderInput, type CreateSaleInput, type CreateSupplierInput, type CreateTransferInput, type CreateWebhookInput, type Customer, type DashboardStats, type DateRangeParams, type Department, type Employee, type InventoryItem, type InventoryReport, type JournalEntry, type JournalLine, type Lead, type LeaveRequest, type Location, type LoginCredentials, type LoginResponse, type Opportunity, type POSSession, type PaginatedResponse, type PaginationParams, type Position, type Product, type ProfitLossReport, type PurchaseOrder, type PurchaseOrderItem, type PurchaseRequisition, type Quotation, type Sale, type SaleItem, type SalesOrder, type SalesReport, type Shop, type StockAdjustment, type StockTransfer, type StockTransferItem, type Supplier, type TaxRate, type TwoFactorRequiredResponse, type TwoFactorVerifyInput, type UpdateProductInput, type User, type Warehouse, type Webhook, type WebhookDelivery, type WebhookEvent };
|
|
838
|
+
export { type Account, type Activity, type ApiResponse, type Attendance, type AuthResponse, BibikeApiError, BibikeClient, type BibikeConfig, type CreateAdjustmentInput, type CreateCustomerInput, type CreateJournalEntryInput, type CreateProductInput, type CreatePurchaseOrderInput, type CreateSaleInput, type CreateSupplierInput, type CreateTransferInput, type CreateWebhookInput, type Customer, type DashboardStats, type DateRangeParams, type Department, type Employee, type InventoryItem, type InventoryReport, type JournalEntry, type JournalLine, type Lead, type LeaveRequest, type Location, type LocationInventoryItem, type LoginCredentials, type LoginResponse, type Opportunity, type POSSession, type PaginatedResponse, type PaginationParams, type Position, type Product, type ProductImage, type ProfitLossReport, type PurchaseOrder, type PurchaseOrderItem, type PurchaseRequisition, type Quotation, type Sale, type SaleItem, type SalesOrder, type SalesReport, type Shop, type StockAdjustment, type StockTransfer, type StockTransferItem, type Supplier, type TaxRate, type TwoFactorRequiredResponse, type TwoFactorVerifyInput, type UpdateProductInput, type User, type Warehouse, type Webhook, type WebhookDelivery, type WebhookEvent };
|
package/dist/index.js
CHANGED
|
@@ -324,14 +324,45 @@ var BibikeClient = class {
|
|
|
324
324
|
};
|
|
325
325
|
// ============ Locations ============
|
|
326
326
|
this.locations = {
|
|
327
|
+
/**
|
|
328
|
+
* @deprecated Use `locations.all()` instead. This method requires legacy
|
|
329
|
+
* `warehouses.view` permission which may not be available to all users.
|
|
330
|
+
* The unified locations API uses location scoping for access control.
|
|
331
|
+
*/
|
|
327
332
|
warehouses: async () => {
|
|
328
333
|
return this.request("warehouses", "list");
|
|
329
334
|
},
|
|
335
|
+
/**
|
|
336
|
+
* @deprecated Use `locations.all()` instead. This method requires legacy
|
|
337
|
+
* `shops.view` permission which may not be available to all users.
|
|
338
|
+
* The unified locations API uses location scoping for access control.
|
|
339
|
+
*/
|
|
330
340
|
shops: async () => {
|
|
331
341
|
return this.request("shops", "list");
|
|
332
342
|
},
|
|
343
|
+
/**
|
|
344
|
+
* Get all locations using the unified locations API.
|
|
345
|
+
* Uses location scoping for access control (no legacy permissions required).
|
|
346
|
+
* @param params.type_id - Filter by location type ID
|
|
347
|
+
* @param params.capability - Filter by capability: 'sellable', 'receivable', 'stockable', 'transferable'
|
|
348
|
+
*/
|
|
333
349
|
all: async (params) => {
|
|
334
350
|
return this.request("locations", "list", "GET", void 0, params);
|
|
351
|
+
},
|
|
352
|
+
/**
|
|
353
|
+
* Get locations by capability (e.g., sellable locations for POS)
|
|
354
|
+
* @param capability - One of: 'sellable', 'receivable', 'stockable', 'transferable'
|
|
355
|
+
*/
|
|
356
|
+
byCapability: async (capability) => {
|
|
357
|
+
return this.request("locations", "by_capability", "GET", void 0, { capability });
|
|
358
|
+
},
|
|
359
|
+
/**
|
|
360
|
+
* Get inventory for a specific location
|
|
361
|
+
* Returns products with stock quantities at the specified location
|
|
362
|
+
* @param locationId - The location ID to get inventory for
|
|
363
|
+
*/
|
|
364
|
+
inventory: async (locationId) => {
|
|
365
|
+
return this.request("locations", "inventory", "GET", void 0, { id: locationId });
|
|
335
366
|
}
|
|
336
367
|
};
|
|
337
368
|
this.baseUrl = config.baseUrl.replace(/\/$/, "");
|
package/dist/index.mjs
CHANGED
|
@@ -297,14 +297,45 @@ var BibikeClient = class {
|
|
|
297
297
|
};
|
|
298
298
|
// ============ Locations ============
|
|
299
299
|
this.locations = {
|
|
300
|
+
/**
|
|
301
|
+
* @deprecated Use `locations.all()` instead. This method requires legacy
|
|
302
|
+
* `warehouses.view` permission which may not be available to all users.
|
|
303
|
+
* The unified locations API uses location scoping for access control.
|
|
304
|
+
*/
|
|
300
305
|
warehouses: async () => {
|
|
301
306
|
return this.request("warehouses", "list");
|
|
302
307
|
},
|
|
308
|
+
/**
|
|
309
|
+
* @deprecated Use `locations.all()` instead. This method requires legacy
|
|
310
|
+
* `shops.view` permission which may not be available to all users.
|
|
311
|
+
* The unified locations API uses location scoping for access control.
|
|
312
|
+
*/
|
|
303
313
|
shops: async () => {
|
|
304
314
|
return this.request("shops", "list");
|
|
305
315
|
},
|
|
316
|
+
/**
|
|
317
|
+
* Get all locations using the unified locations API.
|
|
318
|
+
* Uses location scoping for access control (no legacy permissions required).
|
|
319
|
+
* @param params.type_id - Filter by location type ID
|
|
320
|
+
* @param params.capability - Filter by capability: 'sellable', 'receivable', 'stockable', 'transferable'
|
|
321
|
+
*/
|
|
306
322
|
all: async (params) => {
|
|
307
323
|
return this.request("locations", "list", "GET", void 0, params);
|
|
324
|
+
},
|
|
325
|
+
/**
|
|
326
|
+
* Get locations by capability (e.g., sellable locations for POS)
|
|
327
|
+
* @param capability - One of: 'sellable', 'receivable', 'stockable', 'transferable'
|
|
328
|
+
*/
|
|
329
|
+
byCapability: async (capability) => {
|
|
330
|
+
return this.request("locations", "by_capability", "GET", void 0, { capability });
|
|
331
|
+
},
|
|
332
|
+
/**
|
|
333
|
+
* Get inventory for a specific location
|
|
334
|
+
* Returns products with stock quantities at the specified location
|
|
335
|
+
* @param locationId - The location ID to get inventory for
|
|
336
|
+
*/
|
|
337
|
+
inventory: async (locationId) => {
|
|
338
|
+
return this.request("locations", "inventory", "GET", void 0, { id: locationId });
|
|
308
339
|
}
|
|
309
340
|
};
|
|
310
341
|
this.baseUrl = config.baseUrl.replace(/\/$/, "");
|