@stacksjs/commerce 0.70.37 → 0.70.42
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/src/coupons/destroy.d.ts +17 -0
- package/dist/src/coupons/fetch.d.ts +59 -0
- package/dist/src/coupons/index.d.ts +25 -0
- package/dist/src/coupons/store.d.ts +9 -0
- package/dist/src/coupons/update.d.ts +10 -0
- package/dist/src/customers/destroy.d.ts +14 -0
- package/dist/src/customers/fetch.d.ts +9 -0
- package/dist/src/customers/index.d.ts +14 -0
- package/dist/src/customers/store.d.ts +9 -0
- package/dist/src/customers/update.d.ts +10 -0
- package/dist/src/devices/destroy.d.ts +14 -0
- package/dist/src/devices/export.d.ts +35 -0
- package/dist/src/devices/fetch.d.ts +38 -0
- package/dist/src/devices/index.d.ts +27 -0
- package/dist/src/devices/store.d.ts +16 -0
- package/dist/src/devices/update.d.ts +26 -0
- package/dist/src/errors/destroy.d.ts +12 -0
- package/dist/src/errors/fetch.d.ts +54 -0
- package/dist/src/errors/index.d.ts +25 -0
- package/dist/src/errors/update.d.ts +24 -0
- package/dist/src/gift-cards/destroy.d.ts +23 -0
- package/dist/src/gift-cards/fetch.d.ts +88 -0
- package/dist/src/gift-cards/index.d.ts +23 -0
- package/dist/src/gift-cards/store.d.ts +9 -0
- package/dist/src/gift-cards/update.d.ts +18 -0
- package/dist/src/index.d.ts +13 -13
- package/dist/src/orders/destroy.d.ts +28 -0
- package/dist/src/orders/export.d.ts +32 -0
- package/dist/src/orders/fetch.d.ts +76 -0
- package/dist/src/orders/index.d.ts +27 -0
- package/dist/src/orders/store.d.ts +9 -0
- package/dist/src/orders/update.d.ts +27 -0
- package/dist/src/payments/destroy.d.ts +14 -0
- package/dist/src/payments/fetch.d.ts +55 -0
- package/dist/src/payments/index.d.ts +13 -0
- package/dist/src/payments/store.d.ts +9 -0
- package/dist/src/payments/update.d.ts +18 -0
- package/dist/src/products/categories/destroy.d.ts +30 -0
- package/dist/src/products/categories/fetch.d.ts +49 -0
- package/dist/src/products/categories/index.d.ts +33 -0
- package/dist/src/products/categories/store.d.ts +21 -0
- package/dist/src/products/categories/update.d.ts +33 -0
- package/dist/src/products/index.d.ts +24 -0
- package/dist/src/products/items/destroy.d.ts +14 -0
- package/dist/src/products/items/fetch.d.ts +66 -0
- package/dist/src/products/items/index.d.ts +23 -0
- package/dist/src/products/items/store.d.ts +16 -0
- package/dist/src/products/items/update.d.ts +45 -0
- package/dist/src/products/manufacturers/destroy.d.ts +14 -0
- package/dist/src/products/manufacturers/fetch.d.ts +23 -0
- package/dist/src/products/manufacturers/index.d.ts +21 -0
- package/dist/src/products/manufacturers/store.d.ts +16 -0
- package/dist/src/products/manufacturers/update.d.ts +26 -0
- package/dist/src/products/reviews/destroy.d.ts +14 -0
- package/dist/src/products/reviews/fetch.d.ts +22 -0
- package/dist/src/products/reviews/index.d.ts +22 -0
- package/dist/src/products/reviews/store.d.ts +9 -0
- package/dist/src/products/reviews/update.d.ts +19 -0
- package/dist/src/products/units/destroy.d.ts +14 -0
- package/dist/src/products/units/fetch.d.ts +9 -0
- package/dist/src/products/units/index.d.ts +9 -0
- package/dist/src/products/units/store.d.ts +31 -0
- package/dist/src/products/units/update.d.ts +25 -0
- package/dist/src/products/variants/destroy.d.ts +14 -0
- package/dist/src/products/variants/fetch.d.ts +9 -0
- package/dist/src/products/variants/index.d.ts +18 -0
- package/dist/src/products/variants/store.d.ts +43 -0
- package/dist/src/products/variants/update.d.ts +25 -0
- package/dist/src/receipts/destroy.d.ts +14 -0
- package/dist/src/receipts/fetch.d.ts +80 -0
- package/dist/src/receipts/index.d.ts +21 -0
- package/dist/src/receipts/store.d.ts +16 -0
- package/dist/src/receipts/update.d.ts +28 -0
- package/dist/src/shippings/delivery-routes/destroy.d.ts +14 -0
- package/dist/src/shippings/delivery-routes/fetch.d.ts +17 -0
- package/dist/src/shippings/delivery-routes/index.d.ts +23 -0
- package/dist/src/shippings/delivery-routes/store.d.ts +16 -0
- package/dist/src/shippings/delivery-routes/update.d.ts +27 -0
- package/dist/src/shippings/digital-deliveries/destroy.d.ts +28 -0
- package/dist/src/shippings/digital-deliveries/fetch.d.ts +9 -0
- package/dist/src/shippings/digital-deliveries/index.d.ts +23 -0
- package/dist/src/shippings/digital-deliveries/store.d.ts +16 -0
- package/dist/src/shippings/digital-deliveries/update.d.ts +29 -0
- package/dist/src/shippings/drivers/destroy.d.ts +16 -0
- package/dist/src/shippings/drivers/fetch.d.ts +9 -0
- package/dist/src/shippings/drivers/index.d.ts +21 -0
- package/dist/src/shippings/drivers/store.d.ts +16 -0
- package/dist/src/shippings/drivers/update.d.ts +26 -0
- package/dist/src/shippings/index.d.ts +27 -0
- package/dist/src/shippings/license-keys/destroy.d.ts +28 -0
- package/dist/src/shippings/license-keys/fetch.d.ts +9 -0
- package/dist/src/shippings/license-keys/index.d.ts +23 -0
- package/dist/src/shippings/license-keys/store.d.ts +17 -0
- package/dist/src/shippings/license-keys/update.d.ts +26 -0
- package/dist/src/shippings/shipping-methods/destroy.d.ts +28 -0
- package/dist/src/shippings/shipping-methods/fetch.d.ts +9 -0
- package/dist/src/shippings/shipping-methods/index.d.ts +25 -0
- package/dist/src/shippings/shipping-methods/store.d.ts +28 -0
- package/dist/src/shippings/shipping-methods/update.d.ts +27 -0
- package/dist/src/shippings/shipping-rates/destroy.d.ts +28 -0
- package/dist/src/shippings/shipping-rates/fetch.d.ts +37 -0
- package/dist/src/shippings/shipping-rates/index.d.ts +27 -0
- package/dist/src/shippings/shipping-rates/store.d.ts +17 -0
- package/dist/src/shippings/shipping-rates/update.d.ts +36 -0
- package/dist/src/shippings/shipping-zones/destroy.d.ts +28 -0
- package/dist/src/shippings/shipping-zones/fetch.d.ts +28 -0
- package/dist/src/shippings/shipping-zones/index.d.ts +23 -0
- package/dist/src/shippings/shipping-zones/store.d.ts +17 -0
- package/dist/src/shippings/shipping-zones/update.d.ts +35 -0
- package/dist/src/tax/destroy.d.ts +14 -0
- package/dist/src/tax/fetch.d.ts +9 -0
- package/dist/src/tax/index.d.ts +21 -0
- package/dist/src/tax/store.d.ts +16 -0
- package/dist/src/tax/update.d.ts +26 -0
- package/dist/src/types.d.ts +265 -0
- package/dist/src/utils/typed-stats.d.ts +23 -0
- package/dist/src/waitlists/index.d.ts +12 -0
- package/dist/src/waitlists/products/destroy.d.ts +15 -0
- package/dist/src/waitlists/products/fetch.d.ts +100 -0
- package/dist/src/waitlists/products/index.d.ts +30 -0
- package/dist/src/waitlists/products/store.d.ts +16 -0
- package/dist/src/waitlists/products/update.d.ts +26 -0
- package/dist/src/waitlists/restaurant/destroy.d.ts +15 -0
- package/dist/src/waitlists/restaurant/fetch.d.ts +149 -0
- package/dist/src/waitlists/restaurant/index.d.ts +40 -0
- package/dist/src/waitlists/restaurant/store.d.ts +16 -0
- package/dist/src/waitlists/restaurant/update.d.ts +43 -0
- package/package.json +1 -1
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Update a product item
|
|
3
|
+
*
|
|
4
|
+
* @param id The ID of the product item to update
|
|
5
|
+
* @param data The product item data to update
|
|
6
|
+
* @returns The updated product item record
|
|
7
|
+
*/
|
|
8
|
+
export declare function update(id: number, data: Omit<ProductUpdate, 'id'>): Promise<ProductJsonResponse>;
|
|
9
|
+
/**
|
|
10
|
+
* Update multiple product items at once
|
|
11
|
+
*
|
|
12
|
+
* @param data Array of product item updates
|
|
13
|
+
* @returns Number of product items updated
|
|
14
|
+
*/
|
|
15
|
+
export declare function bulkUpdate(data: ProductUpdate[]): Promise<number>;
|
|
16
|
+
/**
|
|
17
|
+
* Update a product item's availability status
|
|
18
|
+
*
|
|
19
|
+
* @param id The ID of the product item
|
|
20
|
+
* @param isAvailable The new availability status
|
|
21
|
+
* @returns The updated product item with the new availability status
|
|
22
|
+
*/
|
|
23
|
+
export declare function updateAvailability(id: number, isAvailable: boolean): Promise<ProductJsonResponse | undefined>;
|
|
24
|
+
/**
|
|
25
|
+
* Atomically decrement (or increment) a product's inventory count by `delta`.
|
|
26
|
+
*
|
|
27
|
+
* Returns the updated row, or `null` if the requested decrement would push
|
|
28
|
+
* inventory below zero — that's how callers detect "we sold the last one"
|
|
29
|
+
* during checkout. The conditional UPDATE means two parallel checkout
|
|
30
|
+
* requests can't both observe stock=1 and both succeed; the second one
|
|
31
|
+
* matches zero rows and the function returns null. Existing
|
|
32
|
+
* `updateInventory(id, count)` keeps the previous "set absolute count"
|
|
33
|
+
* semantics for admin tooling.
|
|
34
|
+
*/
|
|
35
|
+
export declare function adjustInventory(id: number, delta: number): Promise<ProductJsonResponse | null>;
|
|
36
|
+
/**
|
|
37
|
+
* Update inventory information for a product item
|
|
38
|
+
*
|
|
39
|
+
* @param id The ID of the product item
|
|
40
|
+
* @param inventoryCount The updated inventory count
|
|
41
|
+
* @returns The updated product item
|
|
42
|
+
*/
|
|
43
|
+
export declare function updateInventory(id: number, inventoryCount?: number): Promise<ProductJsonResponse | undefined>;
|
|
44
|
+
declare type ProductJsonResponse = ModelRow<typeof Product>;
|
|
45
|
+
declare type ProductUpdate = UpdateModelData<typeof Product>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Delete an order by ID
|
|
3
|
+
*
|
|
4
|
+
* @param id The ID of the order to delete
|
|
5
|
+
* @returns True if the order was deleted, false otherwise
|
|
6
|
+
*/
|
|
7
|
+
export declare function destroy(id: number): Promise<boolean>;
|
|
8
|
+
/**
|
|
9
|
+
* Delete multiple orders by ID
|
|
10
|
+
*
|
|
11
|
+
* @param ids Array of order IDs to delete
|
|
12
|
+
* @returns Number of orders deleted
|
|
13
|
+
*/
|
|
14
|
+
export declare function bulkDestroy(ids: number[]): Promise<number>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { FetchManufacturersOptions, ManufacturerResponse } from '../../types';
|
|
2
|
+
export declare function fetchAll(): Promise<ManufacturerJsonResponse[]>;
|
|
3
|
+
/**
|
|
4
|
+
* Fetch a product manufacturer by ID
|
|
5
|
+
*/
|
|
6
|
+
export declare function fetchById(id: number): Promise<ManufacturerJsonResponse | undefined>;
|
|
7
|
+
/**
|
|
8
|
+
* Fetch a product manufacturer by UUID
|
|
9
|
+
*/
|
|
10
|
+
export declare function fetchByUuid(uuid: string): Promise<ManufacturerJsonResponse | undefined>;
|
|
11
|
+
/**
|
|
12
|
+
* Fetch featured manufacturers
|
|
13
|
+
*/
|
|
14
|
+
export declare function fetchFeatured(limit?: number): Promise<ManufacturerJsonResponse[]>;
|
|
15
|
+
/**
|
|
16
|
+
* Fetch manufacturers by country
|
|
17
|
+
*/
|
|
18
|
+
export declare function fetchByCountry(country: string, options?: FetchManufacturersOptions): Promise<ManufacturerResponse>;
|
|
19
|
+
/**
|
|
20
|
+
* Fetch manufacturers with their product count
|
|
21
|
+
*/
|
|
22
|
+
export declare function fetchWithProductCount(options?: FetchManufacturersOptions): Promise<ManufacturerJsonResponse[]>;
|
|
23
|
+
declare type ManufacturerJsonResponse = ModelRow<typeof Manufacturer>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export {
|
|
2
|
+
bulkDestroy,
|
|
3
|
+
destroy,
|
|
4
|
+
} from './destroy';
|
|
5
|
+
export {
|
|
6
|
+
fetchAll,
|
|
7
|
+
fetchByCountry,
|
|
8
|
+
fetchById,
|
|
9
|
+
fetchByUuid,
|
|
10
|
+
fetchFeatured,
|
|
11
|
+
fetchWithProductCount,
|
|
12
|
+
} from './fetch';
|
|
13
|
+
export {
|
|
14
|
+
bulkStore,
|
|
15
|
+
store,
|
|
16
|
+
} from './store';
|
|
17
|
+
export {
|
|
18
|
+
update,
|
|
19
|
+
updateByUuid,
|
|
20
|
+
updateFeaturedStatus,
|
|
21
|
+
} from './update';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create a new product manufacturer
|
|
3
|
+
*
|
|
4
|
+
* @param data The manufacturer data to store
|
|
5
|
+
* @returns The newly created manufacturer record
|
|
6
|
+
*/
|
|
7
|
+
export declare function store(data: NewManufacturer): Promise<ManufacturerJsonResponse>;
|
|
8
|
+
/**
|
|
9
|
+
* Create multiple manufacturers at once
|
|
10
|
+
*
|
|
11
|
+
* @param data Array of manufacturer data to store
|
|
12
|
+
* @returns Number of manufacturers created
|
|
13
|
+
*/
|
|
14
|
+
export declare function bulkStore(data: NewManufacturer[]): Promise<number>;
|
|
15
|
+
declare type ManufacturerJsonResponse = ModelRow<typeof Manufacturer>;
|
|
16
|
+
declare type NewManufacturer = NewModelData<typeof Manufacturer>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Update a manufacturer
|
|
3
|
+
*
|
|
4
|
+
* @param id The ID of the manufacturer to update
|
|
5
|
+
* @param data The manufacturer data to update
|
|
6
|
+
* @returns The updated manufacturer record
|
|
7
|
+
*/
|
|
8
|
+
export declare function update(id: number, data: ManufacturerUpdate): Promise<ManufacturerJsonResponse>;
|
|
9
|
+
/**
|
|
10
|
+
* Toggle the featured status of a manufacturer
|
|
11
|
+
*
|
|
12
|
+
* @param id The ID of the manufacturer
|
|
13
|
+
* @param featured The new featured status (or toggle if not provided)
|
|
14
|
+
* @returns The updated manufacturer with the new featured status
|
|
15
|
+
*/
|
|
16
|
+
export declare function updateFeaturedStatus(id: number, featured?: boolean): Promise<ManufacturerJsonResponse>;
|
|
17
|
+
/**
|
|
18
|
+
* Update a manufacturer by UUID
|
|
19
|
+
*
|
|
20
|
+
* @param uuid The UUID of the manufacturer to update
|
|
21
|
+
* @param data The updated manufacturer data
|
|
22
|
+
* @returns The updated manufacturer record
|
|
23
|
+
*/
|
|
24
|
+
export declare function updateByUuid(uuid: string, data: Omit<ManufacturerUpdate, 'id'>): Promise<ManufacturerJsonResponse>;
|
|
25
|
+
declare type ManufacturerJsonResponse = ModelRow<typeof Manufacturer>;
|
|
26
|
+
declare type ManufacturerUpdate = UpdateModelData<typeof Manufacturer>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Delete an order by ID
|
|
3
|
+
*
|
|
4
|
+
* @param id The ID of the order to delete
|
|
5
|
+
* @returns True if the order was deleted, false otherwise
|
|
6
|
+
*/
|
|
7
|
+
export declare function destroy(id: number): Promise<boolean>;
|
|
8
|
+
/**
|
|
9
|
+
* Delete multiple orders by ID
|
|
10
|
+
*
|
|
11
|
+
* @param ids Array of order IDs to delete
|
|
12
|
+
* @returns Number of orders deleted
|
|
13
|
+
*/
|
|
14
|
+
export declare function bulkDestroy(ids: number[]): Promise<number>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fetch a product review by ID
|
|
3
|
+
*/
|
|
4
|
+
export declare function fetchById(id: number): Promise<ReviewJsonResponse | undefined>;
|
|
5
|
+
/**
|
|
6
|
+
* Fetch all product reviews
|
|
7
|
+
*/
|
|
8
|
+
export declare function fetchAll(): Promise<ReviewJsonResponse[]>;
|
|
9
|
+
/**
|
|
10
|
+
* Fetch reviews for a specific product
|
|
11
|
+
*/
|
|
12
|
+
export declare function fetchByProductId(productId: number): Promise<ReviewJsonResponse[]>;
|
|
13
|
+
/**
|
|
14
|
+
* Fetch reviews by user ID
|
|
15
|
+
*/
|
|
16
|
+
export declare function fetchByUserId(userId: number): Promise<ReviewJsonResponse[]>;
|
|
17
|
+
/**
|
|
18
|
+
* Fetch approved reviews for a product
|
|
19
|
+
*/
|
|
20
|
+
export declare function fetchApprovedByProductId(productId: number): Promise<ReviewJsonResponse[]>;
|
|
21
|
+
export declare function fetchMostHelpfulByProductId(productId: number): Promise<ReviewJsonResponse[]>;
|
|
22
|
+
declare type ReviewJsonResponse = ModelRow<typeof Review>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export {
|
|
2
|
+
bulkDestroy,
|
|
3
|
+
destroy,
|
|
4
|
+
} from './destroy';
|
|
5
|
+
// Functions from fetch.ts
|
|
6
|
+
export {
|
|
7
|
+
fetchAll,
|
|
8
|
+
fetchApprovedByProductId,
|
|
9
|
+
fetchById,
|
|
10
|
+
fetchByProductId,
|
|
11
|
+
fetchByUserId,
|
|
12
|
+
fetchMostHelpfulByProductId,
|
|
13
|
+
} from './fetch';
|
|
14
|
+
// Functions from store.ts
|
|
15
|
+
export {
|
|
16
|
+
store,
|
|
17
|
+
} from './store';
|
|
18
|
+
// Functions from update.ts
|
|
19
|
+
export {
|
|
20
|
+
update,
|
|
21
|
+
updateVotes,
|
|
22
|
+
} from './update';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create a new product review
|
|
3
|
+
*
|
|
4
|
+
* @param data The review data to store
|
|
5
|
+
* @returns The newly created review record
|
|
6
|
+
*/
|
|
7
|
+
export declare function store(data: NewReview): Promise<ReviewJsonResponse>;
|
|
8
|
+
declare type ReviewJsonResponse = ModelRow<typeof Review>;
|
|
9
|
+
declare type NewReview = NewModelData<typeof Review>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Update a review
|
|
3
|
+
*
|
|
4
|
+
* @param id The id of the review to update
|
|
5
|
+
* @param data The review data to update
|
|
6
|
+
* @returns The updated review record
|
|
7
|
+
*/
|
|
8
|
+
export declare function update(id: number, data: ReviewUpdate): Promise<ReviewJsonResponse>;
|
|
9
|
+
/**
|
|
10
|
+
* Update a review's vote counts
|
|
11
|
+
*
|
|
12
|
+
* @param id The ID of the review
|
|
13
|
+
* @param voteType The type of vote ('helpful' or 'unhelpful')
|
|
14
|
+
* @param increment Whether to increment (true) or decrement (false) the vote count
|
|
15
|
+
* @returns The updated review with new vote counts
|
|
16
|
+
*/
|
|
17
|
+
export declare function updateVotes(id: number, voteType: 'helpful' | 'unhelpful', increment?: boolean): Promise<ReviewJsonResponse>;
|
|
18
|
+
declare type ReviewJsonResponse = ModelRow<typeof Review>;
|
|
19
|
+
declare type ReviewUpdate = UpdateModelData<typeof Review>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Delete a product unit by ID
|
|
3
|
+
*
|
|
4
|
+
* @param id The ID of the product unit to delete
|
|
5
|
+
* @returns True if the product unit was deleted, false otherwise
|
|
6
|
+
*/
|
|
7
|
+
export declare function destroy(id: number): Promise<boolean>;
|
|
8
|
+
/**
|
|
9
|
+
* Delete multiple product units by ID
|
|
10
|
+
*
|
|
11
|
+
* @param ids Array of product unit IDs to delete
|
|
12
|
+
* @returns Number of product units deleted
|
|
13
|
+
*/
|
|
14
|
+
export declare function bulkDestroy(ids: number[]): Promise<number>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fetch a product unit by ID
|
|
3
|
+
*/
|
|
4
|
+
export declare function fetchById(id: number): Promise<ProductUnitJsonResponse | undefined>;
|
|
5
|
+
/**
|
|
6
|
+
* Fetch all product units
|
|
7
|
+
*/
|
|
8
|
+
export declare function fetchAll(): Promise<ProductUnitJsonResponse[]>;
|
|
9
|
+
declare type ProductUnitJsonResponse = ModelRow<typeof ProductUnit>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// Export all functions from the unit modules
|
|
2
|
+
// Destroy functions
|
|
3
|
+
export { bulkDestroy, destroy } from './destroy';
|
|
4
|
+
// Fetch functions
|
|
5
|
+
export { fetchAll, fetchById } from './fetch';
|
|
6
|
+
// Store functions
|
|
7
|
+
export { bulkStore, formatUnitOptions, getDefaultUnit, store } from './store';
|
|
8
|
+
// Update functions
|
|
9
|
+
export { bulkUpdate, update, updateDefaultStatus } from './update';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create a new product unit
|
|
3
|
+
*
|
|
4
|
+
* @param data The product unit data to store
|
|
5
|
+
* @returns The newly created product unit record
|
|
6
|
+
*/
|
|
7
|
+
export declare function store(data: NewProductUnit): Promise<ProductUnitJsonResponse>;
|
|
8
|
+
/**
|
|
9
|
+
* Create multiple product units at once
|
|
10
|
+
*
|
|
11
|
+
* @param data Array of product unit data to store
|
|
12
|
+
* @returns Number of product units created
|
|
13
|
+
*/
|
|
14
|
+
export declare function bulkStore(data: NewProductUnit[]): Promise<number>;
|
|
15
|
+
/**
|
|
16
|
+
* Format product unit options for dropdown menus or selectors
|
|
17
|
+
*
|
|
18
|
+
* @param type Optional filter by unit type
|
|
19
|
+
* @returns Array of formatted unit options with id, name, and abbreviation
|
|
20
|
+
*/
|
|
21
|
+
export declare function formatUnitOptions(type?: string): Promise<{ id: string, name: string, abbreviation: string, is_default: boolean | undefined }[] | []>;
|
|
22
|
+
/**
|
|
23
|
+
* Get the default unit for a specific type
|
|
24
|
+
*
|
|
25
|
+
* @param type The unit type to get the default for
|
|
26
|
+
* @returns The default unit or undefined if none found
|
|
27
|
+
*/
|
|
28
|
+
export declare function getDefaultUnit(type: string): Promise<ProductUnitJsonResponse | undefined>;
|
|
29
|
+
// Import dependencies
|
|
30
|
+
declare type ProductUnitJsonResponse = ModelRow<typeof ProductUnit>;
|
|
31
|
+
declare type NewProductUnit = NewModelData<typeof ProductUnit>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Update a product unit
|
|
3
|
+
*
|
|
4
|
+
* @param id The ID of the product unit
|
|
5
|
+
* @param data The product unit data to update
|
|
6
|
+
* @returns The updated product unit record
|
|
7
|
+
*/
|
|
8
|
+
export declare function update(id: number, data: ProductUnitUpdate): Promise<ProductUnitJsonResponse>;
|
|
9
|
+
/**
|
|
10
|
+
* Update multiple product units at once
|
|
11
|
+
*
|
|
12
|
+
* @param data Array of product unit updates
|
|
13
|
+
* @returns Number of product units updated
|
|
14
|
+
*/
|
|
15
|
+
export declare function bulkUpdate(data: ProductUnitUpdate[]): Promise<number>;
|
|
16
|
+
/**
|
|
17
|
+
* Update the default status of a product unit
|
|
18
|
+
*
|
|
19
|
+
* @param id The ID of the product unit
|
|
20
|
+
* @param isDefault The new default status value
|
|
21
|
+
* @returns True if the status was updated successfully
|
|
22
|
+
*/
|
|
23
|
+
export declare function updateDefaultStatus(id: number, isDefault: boolean): Promise<boolean>;
|
|
24
|
+
declare type ProductUnitJsonResponse = ModelRow<typeof ProductUnit>;
|
|
25
|
+
declare type ProductUnitUpdate = UpdateModelData<typeof ProductUnit>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Delete a product variant by ID
|
|
3
|
+
*
|
|
4
|
+
* @param id The ID of the product variant to delete
|
|
5
|
+
* @returns True if the product variant was deleted, false otherwise
|
|
6
|
+
*/
|
|
7
|
+
export declare function destroy(id: number): Promise<boolean>;
|
|
8
|
+
/**
|
|
9
|
+
* Delete multiple product variants by ID
|
|
10
|
+
*
|
|
11
|
+
* @param ids Array of product variant IDs to delete
|
|
12
|
+
* @returns Number of product variants deleted
|
|
13
|
+
*/
|
|
14
|
+
export declare function bulkDestroy(ids: number[]): Promise<number>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fetch a product variant by ID
|
|
3
|
+
*/
|
|
4
|
+
export declare function fetchById(id: number): Promise<ProductVariantJsonResponse | undefined>;
|
|
5
|
+
/**
|
|
6
|
+
* Fetch all product variants
|
|
7
|
+
*/
|
|
8
|
+
export declare function fetchAll(): Promise<ProductVariantJsonResponse[]>;
|
|
9
|
+
declare type ProductVariantJsonResponse = ModelRow<typeof ProductVariant>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export {
|
|
2
|
+
bulkDestroy,
|
|
3
|
+
destroy,
|
|
4
|
+
} from './destroy';
|
|
5
|
+
export {
|
|
6
|
+
fetchAll,
|
|
7
|
+
fetchById,
|
|
8
|
+
} from './fetch';
|
|
9
|
+
export {
|
|
10
|
+
bulkStore,
|
|
11
|
+
formatVariantOptions,
|
|
12
|
+
generateVariantCombinations,
|
|
13
|
+
store,
|
|
14
|
+
} from './store';
|
|
15
|
+
export {
|
|
16
|
+
bulkUpdate,
|
|
17
|
+
update,
|
|
18
|
+
} from './update';
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create a new product variant
|
|
3
|
+
*
|
|
4
|
+
* @param data The product variant data to store
|
|
5
|
+
* @returns The newly created product variant record
|
|
6
|
+
*/
|
|
7
|
+
export declare function store(data: NewProductVariant): Promise<ProductVariantJsonResponse>;
|
|
8
|
+
/**
|
|
9
|
+
* Create multiple product variants at once
|
|
10
|
+
*
|
|
11
|
+
* @param data Array of product variant data to store
|
|
12
|
+
* @returns Number of product variants created
|
|
13
|
+
*/
|
|
14
|
+
export declare function bulkStore(data: NewProductVariant[]): Promise<number>;
|
|
15
|
+
/**
|
|
16
|
+
* Generate product variant options from raw input
|
|
17
|
+
*
|
|
18
|
+
* @param rawOptions String array of options
|
|
19
|
+
* @returns Formatted JSON string of options
|
|
20
|
+
*/
|
|
21
|
+
export declare function formatVariantOptions(rawOptions: string[]): string;
|
|
22
|
+
/**
|
|
23
|
+
* Create a set of common variant combinations from different option types
|
|
24
|
+
*
|
|
25
|
+
* @param optionSets Object containing option types and their values
|
|
26
|
+
* @returns Array of variant combinations
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* // Generate combinations for a t-shirt product
|
|
30
|
+
* const options = {
|
|
31
|
+
* size: ['S', 'M', 'L'],
|
|
32
|
+
* color: ['Red', 'Blue']
|
|
33
|
+
* }
|
|
34
|
+
* // Returns: [
|
|
35
|
+
* // { size: 'S', color: 'Red' },
|
|
36
|
+
* // { size: 'S', color: 'Blue' },
|
|
37
|
+
* // { size: 'M', color: 'Red' },
|
|
38
|
+
* // ...
|
|
39
|
+
* // ]
|
|
40
|
+
*/
|
|
41
|
+
export declare function generateVariantCombinations(optionSets: Record<string, string[]>): Record<string, string>[];
|
|
42
|
+
declare type ProductVariantJsonResponse = ModelRow<typeof ProductVariant>;
|
|
43
|
+
declare type NewProductVariant = NewModelData<typeof ProductVariant>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Update a product variant
|
|
3
|
+
*
|
|
4
|
+
* @param id The ID of the product variant to update
|
|
5
|
+
* @param data The product variant data to update
|
|
6
|
+
* @returns The updated product variant record
|
|
7
|
+
*/
|
|
8
|
+
export declare function update(id: number, data: Omit<ProductVariantUpdate, 'id'>): Promise<ProductVariantJsonResponse>;
|
|
9
|
+
/**
|
|
10
|
+
* Update multiple product variants at once
|
|
11
|
+
*
|
|
12
|
+
* @param data Array of objects containing variant ID and update data
|
|
13
|
+
* @returns Number of product variants updated
|
|
14
|
+
*/
|
|
15
|
+
export declare function bulkUpdate(data: ProductVariantUpdate[]): Promise<number>;
|
|
16
|
+
/**
|
|
17
|
+
* Update the status of a product variant
|
|
18
|
+
*
|
|
19
|
+
* @param id The ID of the product variant
|
|
20
|
+
* @param status The new status value
|
|
21
|
+
* @returns True if the status was updated successfully
|
|
22
|
+
*/
|
|
23
|
+
export declare function updateStatus(id: number, status: string): Promise<boolean>;
|
|
24
|
+
declare type ProductVariantJsonResponse = ModelRow<typeof ProductVariant>;
|
|
25
|
+
declare type ProductVariantUpdate = UpdateModelData<typeof ProductVariant>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Delete a print log by ID
|
|
3
|
+
*
|
|
4
|
+
* @param id The ID of the print log to delete
|
|
5
|
+
* @returns True if the print log was deleted, false otherwise
|
|
6
|
+
*/
|
|
7
|
+
export declare function destroy(id: number): Promise<boolean>;
|
|
8
|
+
/**
|
|
9
|
+
* Delete multiple print logs by ID
|
|
10
|
+
*
|
|
11
|
+
* @param ids Array of print log IDs to delete
|
|
12
|
+
* @returns Number of print logs deleted
|
|
13
|
+
*/
|
|
14
|
+
export declare function bulkDestroy(ids: number[]): Promise<number>;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fetch a print log by ID
|
|
3
|
+
*/
|
|
4
|
+
export declare function fetchById(id: number): Promise<ReceiptJsonResponse | undefined>;
|
|
5
|
+
/**
|
|
6
|
+
* Fetch all print logs
|
|
7
|
+
*/
|
|
8
|
+
export declare function fetchAll(): Promise<ReceiptJsonResponse[]>;
|
|
9
|
+
/**
|
|
10
|
+
* Fetch print job statistics by status within a date range
|
|
11
|
+
*
|
|
12
|
+
* @param startDate Start date for the range
|
|
13
|
+
* @param endDate End date for the range
|
|
14
|
+
* @returns Object containing counts for each status and total
|
|
15
|
+
*/
|
|
16
|
+
export declare function fetchPrintJobStats(_startDate: Date | number, _endDate: Date | number): Promise<{
|
|
17
|
+
total: number
|
|
18
|
+
success: number
|
|
19
|
+
failed: number
|
|
20
|
+
warning: number
|
|
21
|
+
averageSize: number
|
|
22
|
+
averagePages: number
|
|
23
|
+
averageDuration: number
|
|
24
|
+
}>;
|
|
25
|
+
/**
|
|
26
|
+
* Calculate the success rate percentage for print jobs within a date range
|
|
27
|
+
*
|
|
28
|
+
* @param startDate Start date for the range
|
|
29
|
+
* @param endDate End date for the range
|
|
30
|
+
* @returns Object containing success rate percentage and detailed counts
|
|
31
|
+
*/
|
|
32
|
+
export declare function fetchSuccessRate(_startDate: Date | number, _endDate: Date | number): Promise<{
|
|
33
|
+
successRate: number
|
|
34
|
+
total: number
|
|
35
|
+
success: number
|
|
36
|
+
failed: number
|
|
37
|
+
warning: number
|
|
38
|
+
}>;
|
|
39
|
+
/**
|
|
40
|
+
* Calculate total pages and average pages per receipt within a date range
|
|
41
|
+
*
|
|
42
|
+
* @param startDate Start date for the range
|
|
43
|
+
* @param endDate End date for the range
|
|
44
|
+
* @returns Object containing total pages and average pages per receipt
|
|
45
|
+
*/
|
|
46
|
+
export declare function fetchPageStats(_startDate: Date | number, _endDate: Date | number): Promise<{
|
|
47
|
+
totalPages: number
|
|
48
|
+
averagePagesPerReceipt: number
|
|
49
|
+
totalReceipts: number
|
|
50
|
+
}>;
|
|
51
|
+
/**
|
|
52
|
+
* Calculate average print time statistics within a date range
|
|
53
|
+
*
|
|
54
|
+
* @param startDate Start date for the range
|
|
55
|
+
* @param endDate End date for the range
|
|
56
|
+
* @returns Object containing average print time and related statistics
|
|
57
|
+
*/
|
|
58
|
+
export declare function fetchPrintTimeStats(_startDate: Date | number, _endDate: Date | number): Promise<{
|
|
59
|
+
averageDuration: number
|
|
60
|
+
minDuration: number
|
|
61
|
+
maxDuration: number
|
|
62
|
+
totalJobs: number
|
|
63
|
+
}>;
|
|
64
|
+
/**
|
|
65
|
+
* Calculate prints per hour statistics within a date range
|
|
66
|
+
*
|
|
67
|
+
* @param startDate Start date for the range
|
|
68
|
+
* @param endDate End date for the range
|
|
69
|
+
* @returns Object containing prints per hour statistics
|
|
70
|
+
*/
|
|
71
|
+
export declare function fetchPrintsPerHour(_startDate: Date | number, _endDate: Date | number): Promise<{
|
|
72
|
+
totalPrints: number
|
|
73
|
+
totalHours: number
|
|
74
|
+
printsPerHour: number
|
|
75
|
+
hourlyBreakdown: Array<{
|
|
76
|
+
hour: number
|
|
77
|
+
count: number
|
|
78
|
+
}>
|
|
79
|
+
}>;
|
|
80
|
+
declare type ReceiptJsonResponse = ModelRow<typeof Receipt>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// Functions from destroy.ts
|
|
2
|
+
export {
|
|
3
|
+
bulkDestroy,
|
|
4
|
+
destroy,
|
|
5
|
+
} from './destroy';
|
|
6
|
+
// Functions from fetch.ts
|
|
7
|
+
export {
|
|
8
|
+
fetchAll,
|
|
9
|
+
fetchById,
|
|
10
|
+
} from './fetch';
|
|
11
|
+
// Functions from store.ts
|
|
12
|
+
export {
|
|
13
|
+
bulkStore,
|
|
14
|
+
store,
|
|
15
|
+
} from './store';
|
|
16
|
+
// Functions from update.ts
|
|
17
|
+
export {
|
|
18
|
+
update,
|
|
19
|
+
updatePrintJob,
|
|
20
|
+
updateStatus,
|
|
21
|
+
} from './update';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create a new receipt
|
|
3
|
+
*
|
|
4
|
+
* @param data The receipt data to store
|
|
5
|
+
* @returns The newly created receipt record
|
|
6
|
+
*/
|
|
7
|
+
export declare function store(data: NewReceipt): Promise<ReceiptJsonResponse>;
|
|
8
|
+
/**
|
|
9
|
+
* Create multiple receipts at once
|
|
10
|
+
*
|
|
11
|
+
* @param data Array of receipt data to store
|
|
12
|
+
* @returns Number of receipts created
|
|
13
|
+
*/
|
|
14
|
+
export declare function bulkStore(data: NewReceipt[]): Promise<number>;
|
|
15
|
+
declare type ReceiptJsonResponse = ModelRow<typeof Receipt>;
|
|
16
|
+
declare type NewReceipt = NewModelData<typeof Receipt>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Update a receipt
|
|
3
|
+
*
|
|
4
|
+
* @param id The id of the receipt to update
|
|
5
|
+
* @param data The receipt data to update
|
|
6
|
+
* @returns The updated receipt record
|
|
7
|
+
*/
|
|
8
|
+
export declare function update(id: number, data: ReceiptUpdate): Promise<ReceiptJsonResponse>;
|
|
9
|
+
/**
|
|
10
|
+
* Update a receipt's status
|
|
11
|
+
*
|
|
12
|
+
* @param id The ID of the receipt
|
|
13
|
+
* @param status The new status
|
|
14
|
+
* @returns The updated receipt with the new status
|
|
15
|
+
*/
|
|
16
|
+
export declare function updateStatus(id: number, status: 'success' | 'failed' | 'warning'): Promise<ReceiptJsonResponse>;
|
|
17
|
+
/**
|
|
18
|
+
* Update print job information
|
|
19
|
+
*
|
|
20
|
+
* @param id The ID of the receipt
|
|
21
|
+
* @param size Optional new size value
|
|
22
|
+
* @param pages Optional new pages value
|
|
23
|
+
* @param duration Optional new duration value
|
|
24
|
+
* @returns The updated receipt
|
|
25
|
+
*/
|
|
26
|
+
export declare function updatePrintJob(id: number, size?: number, pages?: number, duration?: number): Promise<ReceiptJsonResponse>;
|
|
27
|
+
declare type ReceiptJsonResponse = ModelRow<typeof Receipt>;
|
|
28
|
+
declare type ReceiptUpdate = UpdateModelData<typeof Receipt>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Delete a delivery route by ID
|
|
3
|
+
*
|
|
4
|
+
* @param id The ID of the delivery route to delete
|
|
5
|
+
* @returns True if the delivery route was deleted, false otherwise
|
|
6
|
+
*/
|
|
7
|
+
export declare function destroy(id: number): Promise<boolean>;
|
|
8
|
+
/**
|
|
9
|
+
* Delete multiple delivery routes by ID
|
|
10
|
+
*
|
|
11
|
+
* @param ids Array of delivery route IDs to delete
|
|
12
|
+
* @returns Number of delivery routes deleted
|
|
13
|
+
*/
|
|
14
|
+
export declare function bulkDestroy(ids: number[]): Promise<number>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fetch a delivery route by ID
|
|
3
|
+
*/
|
|
4
|
+
export declare function fetchById(id: number): Promise<DeliveryRouteJsonResponse | undefined>;
|
|
5
|
+
/**
|
|
6
|
+
* Fetch all delivery routes
|
|
7
|
+
*/
|
|
8
|
+
export declare function fetchAll(): Promise<DeliveryRouteJsonResponse[]>;
|
|
9
|
+
/**
|
|
10
|
+
* Fetch active delivery routes
|
|
11
|
+
*/
|
|
12
|
+
export declare function fetchActive(): Promise<DeliveryRouteJsonResponse[]>;
|
|
13
|
+
/**
|
|
14
|
+
* Fetch delivery routes by driver
|
|
15
|
+
*/
|
|
16
|
+
export declare function fetchByDriver(driver: string): Promise<DeliveryRouteJsonResponse[]>;
|
|
17
|
+
declare type DeliveryRouteJsonResponse = ModelRow<typeof DeliveryRoute>;
|