@bibike/erp-sdk 1.1.2 → 1.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.
- package/dist/index.d.mts +51 -1
- package/dist/index.d.ts +51 -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;
|
|
@@ -543,6 +552,17 @@ interface Location {
|
|
|
543
552
|
address?: string;
|
|
544
553
|
is_active: boolean;
|
|
545
554
|
}
|
|
555
|
+
interface LocationInventoryItem {
|
|
556
|
+
product_id: number;
|
|
557
|
+
product_name: string;
|
|
558
|
+
sku?: string;
|
|
559
|
+
barcode?: string;
|
|
560
|
+
category?: string;
|
|
561
|
+
unit_price: number;
|
|
562
|
+
quantity: number;
|
|
563
|
+
reserved_quantity?: number;
|
|
564
|
+
available_quantity?: number;
|
|
565
|
+
}
|
|
546
566
|
|
|
547
567
|
/**
|
|
548
568
|
* Bibike ERP SDK Client
|
|
@@ -769,12 +789,42 @@ declare class BibikeClient {
|
|
|
769
789
|
dashboard: () => Promise<ApiResponse<DashboardStats>>;
|
|
770
790
|
};
|
|
771
791
|
readonly locations: {
|
|
792
|
+
/**
|
|
793
|
+
* @deprecated Use `locations.all()` instead. This method requires legacy
|
|
794
|
+
* `warehouses.view` permission which may not be available to all users.
|
|
795
|
+
* The unified locations API uses location scoping for access control.
|
|
796
|
+
*/
|
|
772
797
|
warehouses: () => Promise<ApiResponse<Warehouse[]>>;
|
|
798
|
+
/**
|
|
799
|
+
* @deprecated Use `locations.all()` instead. This method requires legacy
|
|
800
|
+
* `shops.view` permission which may not be available to all users.
|
|
801
|
+
* The unified locations API uses location scoping for access control.
|
|
802
|
+
*/
|
|
773
803
|
shops: () => Promise<ApiResponse<Shop[]>>;
|
|
804
|
+
/**
|
|
805
|
+
* Get all locations using the unified locations API.
|
|
806
|
+
* Uses location scoping for access control (no legacy permissions required).
|
|
807
|
+
* @param params.type_id - Filter by location type ID
|
|
808
|
+
* @param params.capability - Filter by capability: 'sellable', 'receivable', 'stockable', 'transferable'
|
|
809
|
+
*/
|
|
774
810
|
all: (params?: {
|
|
775
811
|
type_id?: number;
|
|
776
812
|
capability?: string;
|
|
777
813
|
}) => Promise<ApiResponse<Location[]>>;
|
|
814
|
+
/**
|
|
815
|
+
* Get locations by capability (e.g., sellable locations for POS)
|
|
816
|
+
* @param capability - One of: 'sellable', 'receivable', 'stockable', 'transferable'
|
|
817
|
+
*/
|
|
818
|
+
byCapability: (capability: "sellable" | "receivable" | "stockable" | "transferable") => Promise<ApiResponse<Location[]>>;
|
|
819
|
+
/**
|
|
820
|
+
* Get inventory for a specific location
|
|
821
|
+
* Returns products with stock quantities at the specified location
|
|
822
|
+
* @param locationId - The location ID to get inventory for
|
|
823
|
+
*/
|
|
824
|
+
inventory: (locationId: number) => Promise<ApiResponse<{
|
|
825
|
+
location: Location;
|
|
826
|
+
inventory: LocationInventoryItem[];
|
|
827
|
+
}>>;
|
|
778
828
|
};
|
|
779
829
|
private request;
|
|
780
830
|
}
|
|
@@ -784,4 +834,4 @@ declare class BibikeApiError extends Error {
|
|
|
784
834
|
constructor(message: string, statusCode: number, code?: string | undefined);
|
|
785
835
|
}
|
|
786
836
|
|
|
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 };
|
|
837
|
+
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;
|
|
@@ -543,6 +552,17 @@ interface Location {
|
|
|
543
552
|
address?: string;
|
|
544
553
|
is_active: boolean;
|
|
545
554
|
}
|
|
555
|
+
interface LocationInventoryItem {
|
|
556
|
+
product_id: number;
|
|
557
|
+
product_name: string;
|
|
558
|
+
sku?: string;
|
|
559
|
+
barcode?: string;
|
|
560
|
+
category?: string;
|
|
561
|
+
unit_price: number;
|
|
562
|
+
quantity: number;
|
|
563
|
+
reserved_quantity?: number;
|
|
564
|
+
available_quantity?: number;
|
|
565
|
+
}
|
|
546
566
|
|
|
547
567
|
/**
|
|
548
568
|
* Bibike ERP SDK Client
|
|
@@ -769,12 +789,42 @@ declare class BibikeClient {
|
|
|
769
789
|
dashboard: () => Promise<ApiResponse<DashboardStats>>;
|
|
770
790
|
};
|
|
771
791
|
readonly locations: {
|
|
792
|
+
/**
|
|
793
|
+
* @deprecated Use `locations.all()` instead. This method requires legacy
|
|
794
|
+
* `warehouses.view` permission which may not be available to all users.
|
|
795
|
+
* The unified locations API uses location scoping for access control.
|
|
796
|
+
*/
|
|
772
797
|
warehouses: () => Promise<ApiResponse<Warehouse[]>>;
|
|
798
|
+
/**
|
|
799
|
+
* @deprecated Use `locations.all()` instead. This method requires legacy
|
|
800
|
+
* `shops.view` permission which may not be available to all users.
|
|
801
|
+
* The unified locations API uses location scoping for access control.
|
|
802
|
+
*/
|
|
773
803
|
shops: () => Promise<ApiResponse<Shop[]>>;
|
|
804
|
+
/**
|
|
805
|
+
* Get all locations using the unified locations API.
|
|
806
|
+
* Uses location scoping for access control (no legacy permissions required).
|
|
807
|
+
* @param params.type_id - Filter by location type ID
|
|
808
|
+
* @param params.capability - Filter by capability: 'sellable', 'receivable', 'stockable', 'transferable'
|
|
809
|
+
*/
|
|
774
810
|
all: (params?: {
|
|
775
811
|
type_id?: number;
|
|
776
812
|
capability?: string;
|
|
777
813
|
}) => Promise<ApiResponse<Location[]>>;
|
|
814
|
+
/**
|
|
815
|
+
* Get locations by capability (e.g., sellable locations for POS)
|
|
816
|
+
* @param capability - One of: 'sellable', 'receivable', 'stockable', 'transferable'
|
|
817
|
+
*/
|
|
818
|
+
byCapability: (capability: "sellable" | "receivable" | "stockable" | "transferable") => Promise<ApiResponse<Location[]>>;
|
|
819
|
+
/**
|
|
820
|
+
* Get inventory for a specific location
|
|
821
|
+
* Returns products with stock quantities at the specified location
|
|
822
|
+
* @param locationId - The location ID to get inventory for
|
|
823
|
+
*/
|
|
824
|
+
inventory: (locationId: number) => Promise<ApiResponse<{
|
|
825
|
+
location: Location;
|
|
826
|
+
inventory: LocationInventoryItem[];
|
|
827
|
+
}>>;
|
|
778
828
|
};
|
|
779
829
|
private request;
|
|
780
830
|
}
|
|
@@ -784,4 +834,4 @@ declare class BibikeApiError extends Error {
|
|
|
784
834
|
constructor(message: string, statusCode: number, code?: string | undefined);
|
|
785
835
|
}
|
|
786
836
|
|
|
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 };
|
|
837
|
+
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(/\/$/, "");
|